aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/Kconfig28
-rw-r--r--arch/alpha/Kconfig1
-rw-r--r--arch/alpha/include/asm/Kbuild1
-rw-r--r--arch/alpha/include/asm/pgalloc.h5
-rw-r--r--arch/alpha/include/uapi/asm/errno.h2
-rw-r--r--arch/alpha/include/uapi/asm/socket.h4
-rw-r--r--arch/arc/Kconfig17
-rw-r--r--arch/arc/configs/fpga_defconfig3
-rw-r--r--arch/arc/include/asm/Kbuild1
-rw-r--r--arch/arc/include/asm/cache.h8
-rw-r--r--arch/arc/include/asm/irq.h4
-rw-r--r--arch/arc/include/asm/irqflags.h22
-rw-r--r--arch/arc/include/asm/mach_desc.h17
-rw-r--r--arch/arc/include/asm/mmu.h2
-rw-r--r--arch/arc/include/asm/mmu_context.h61
-rw-r--r--arch/arc/include/asm/pgalloc.h11
-rw-r--r--arch/arc/include/asm/prom.h14
-rw-r--r--arch/arc/include/asm/setup.h2
-rw-r--r--arch/arc/include/asm/smp.h2
-rw-r--r--arch/arc/include/asm/spinlock.h9
-rw-r--r--arch/arc/include/asm/tlbflush.h11
-rw-r--r--arch/arc/include/asm/uaccess.h4
-rw-r--r--arch/arc/include/asm/unaligned.h3
-rw-r--r--arch/arc/kernel/ctx_sw.c13
-rw-r--r--arch/arc/kernel/ctx_sw_asm.S11
-rw-r--r--arch/arc/kernel/devtree.c97
-rw-r--r--arch/arc/kernel/entry.S24
-rw-r--r--arch/arc/kernel/head.S2
-rw-r--r--arch/arc/kernel/irq.c12
-rw-r--r--arch/arc/kernel/kgdb.c12
-rw-r--r--arch/arc/kernel/kprobes.c6
-rw-r--r--arch/arc/kernel/ptrace.c2
-rw-r--r--arch/arc/kernel/reset.c1
-rw-r--r--arch/arc/kernel/setup.c17
-rw-r--r--arch/arc/kernel/signal.c25
-rw-r--r--arch/arc/kernel/smp.c10
-rw-r--r--arch/arc/kernel/stacktrace.c5
-rw-r--r--arch/arc/kernel/time.c18
-rw-r--r--arch/arc/kernel/traps.c3
-rw-r--r--arch/arc/kernel/unaligned.c6
-rw-r--r--arch/arc/mm/cache_arc700.c155
-rw-r--r--arch/arc/mm/fault.c8
-rw-r--r--arch/arc/mm/init.c7
-rw-r--r--arch/arc/mm/tlb.c91
-rw-r--r--arch/arc/mm/tlbex.S4
-rw-r--r--arch/arm/Kconfig98
-rw-r--r--arch/arm/Kconfig.debug49
-rw-r--r--arch/arm/Makefile11
-rw-r--r--arch/arm/boot/Makefile16
-rw-r--r--arch/arm/boot/compressed/Makefile4
-rw-r--r--arch/arm/boot/compressed/head-shark.S140
-rw-r--r--arch/arm/boot/compressed/head.S9
-rw-r--r--arch/arm/boot/compressed/ofw-shark.c260
-rw-r--r--arch/arm/boot/dts/Makefile53
-rw-r--r--arch/arm/boot/dts/am335x-base0033.dts16
-rw-r--r--arch/arm/boot/dts/am335x-bone-common.dtsi299
-rw-r--r--arch/arm/boot/dts/am335x-bone.dts258
-rw-r--r--arch/arm/boot/dts/am335x-boneblack.dts78
-rw-r--r--arch/arm/boot/dts/am335x-evm.dts771
-rw-r--r--arch/arm/boot/dts/am335x-evmsk.dts474
-rw-r--r--arch/arm/boot/dts/am335x-igep0033.dtsi278
-rw-r--r--arch/arm/boot/dts/am335x-nano.dts431
-rw-r--r--arch/arm/boot/dts/am33xx.dtsi161
-rw-r--r--arch/arm/boot/dts/am4372.dtsi599
-rw-r--r--arch/arm/boot/dts/am43x-epos-evm.dts168
-rw-r--r--arch/arm/boot/dts/armada-370-netgear-rn102.dts49
-rw-r--r--arch/arm/boot/dts/armada-370-netgear-rn104.dts193
-rw-r--r--arch/arm/boot/dts/armada-370-xp.dtsi20
-rw-r--r--arch/arm/boot/dts/armada-370.dtsi9
-rw-r--r--arch/arm/boot/dts/armada-xp-matrix.dts75
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78230.dtsi1
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78260.dtsi1
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78460.dtsi1
-rw-r--r--arch/arm/boot/dts/armada-xp.dtsi21
-rw-r--r--arch/arm/boot/dts/at91sam9g20ek_common.dtsi1
-rw-r--r--arch/arm/boot/dts/at91sam9g25.dtsi2
-rw-r--r--arch/arm/boot/dts/at91sam9g35.dtsi1
-rw-r--r--arch/arm/boot/dts/at91sam9n12.dtsi3
-rw-r--r--arch/arm/boot/dts/at91sam9n12ek.dts34
-rw-r--r--arch/arm/boot/dts/at91sam9x25.dtsi24
-rw-r--r--arch/arm/boot/dts/at91sam9x35.dtsi1
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi73
-rw-r--r--arch/arm/boot/dts/at91sam9x5_macb0.dtsi56
-rw-r--r--arch/arm/boot/dts/at91sam9x5_macb1.dtsi44
-rw-r--r--arch/arm/boot/dts/at91sam9x5_usart3.dtsi51
-rw-r--r--arch/arm/boot/dts/atlas6.dtsi57
-rw-r--r--arch/arm/boot/dts/bcm11351-brt.dts1
-rw-r--r--arch/arm/boot/dts/bcm11351.dtsi54
-rw-r--r--arch/arm/boot/dts/bcm28155-ap.dts1
-rw-r--r--arch/arm/boot/dts/dove-cm-a510.dts2
-rw-r--r--arch/arm/boot/dts/dove-cubox.dts20
-rw-r--r--arch/arm/boot/dts/dove-d2plug.dts2
-rw-r--r--arch/arm/boot/dts/dove-d3plug.dts103
-rw-r--r--arch/arm/boot/dts/dove-dove-db.dts2
-rw-r--r--arch/arm/boot/dts/dove.dtsi1037
-rw-r--r--arch/arm/boot/dts/dra7-evm.dts275
-rw-r--r--arch/arm/boot/dts/dra7.dtsi586
-rw-r--r--arch/arm/boot/dts/ecx-common.dtsi8
-rw-r--r--arch/arm/boot/dts/emev2-kzm9d-reference.dts57
-rw-r--r--arch/arm/boot/dts/emev2-kzm9d.dts33
-rw-r--r--arch/arm/boot/dts/exynos4.dtsi10
-rw-r--r--arch/arm/boot/dts/exynos4210-origen.dts28
-rw-r--r--arch/arm/boot/dts/exynos4210-trats.dts7
-rw-r--r--arch/arm/boot/dts/exynos4210-universal_c210.dts4
-rw-r--r--arch/arm/boot/dts/exynos4412-origen.dts21
-rw-r--r--arch/arm/boot/dts/exynos5250-arndale.dts33
-rw-r--r--arch/arm/boot/dts/exynos5250-pinctrl.dtsi44
-rw-r--r--arch/arm/boot/dts/exynos5250-smdk5250.dts8
-rw-r--r--arch/arm/boot/dts/exynos5250.dtsi16
-rw-r--r--arch/arm/boot/dts/exynos5420-smdk5420.dts26
-rw-r--r--arch/arm/boot/dts/exynos5420.dtsi75
-rw-r--r--arch/arm/boot/dts/exynos5440-sd5v1.dts2
-rw-r--r--arch/arm/boot/dts/exynos5440-ssdk5440.dts4
-rw-r--r--arch/arm/boot/dts/exynos5440.dtsi2
-rw-r--r--arch/arm/boot/dts/imx23-evk.dts16
-rw-r--r--arch/arm/boot/dts/imx23-olinuxino.dts18
-rw-r--r--arch/arm/boot/dts/imx23-pinfunc.h333
-rw-r--r--arch/arm/boot/dts/imx23-stmp378x_devb.dts12
-rw-r--r--arch/arm/boot/dts/imx23.dtsi222
-rw-r--r--arch/arm/boot/dts/imx27-apf27dev.dts26
-rw-r--r--arch/arm/boot/dts/imx27.dtsi7
-rw-r--r--arch/arm/boot/dts/imx28-apf28.dts2
-rw-r--r--arch/arm/boot/dts/imx28-apf28dev.dts36
-rw-r--r--arch/arm/boot/dts/imx28-apx4devkit.dts60
-rw-r--r--arch/arm/boot/dts/imx28-cfa10036.dts26
-rw-r--r--arch/arm/boot/dts/imx28-cfa10037.dts18
-rw-r--r--arch/arm/boot/dts/imx28-cfa10049.dts156
-rw-r--r--arch/arm/boot/dts/imx28-cfa10055.dts80
-rw-r--r--arch/arm/boot/dts/imx28-cfa10056.dts38
-rw-r--r--arch/arm/boot/dts/imx28-cfa10057.dts66
-rw-r--r--arch/arm/boot/dts/imx28-cfa10058.dts24
-rw-r--r--arch/arm/boot/dts/imx28-evk.dts63
-rw-r--r--arch/arm/boot/dts/imx28-m28cu3.dts266
-rw-r--r--arch/arm/boot/dts/imx28-m28evk.dts28
-rw-r--r--arch/arm/boot/dts/imx28-pinfunc.h506
-rw-r--r--arch/arm/boot/dts/imx28-sps1.dts14
-rw-r--r--arch/arm/boot/dts/imx28-tx28.dts703
-rw-r--r--arch/arm/boot/dts/imx28.dtsi621
-rw-r--r--arch/arm/boot/dts/imx51-apf51dev.dts27
-rw-r--r--arch/arm/boot/dts/imx51-babbage.dts37
-rw-r--r--arch/arm/boot/dts/imx51.dtsi25
-rw-r--r--arch/arm/boot/dts/imx53-qsb.dts9
-rw-r--r--arch/arm/boot/dts/imx6q-pinfunc.h8
-rw-r--r--arch/arm/boot/dts/imx6q-sabrelite.dts104
-rw-r--r--arch/arm/boot/dts/imx6q-udoo.dts39
-rw-r--r--arch/arm/boot/dts/imx6qdl-sabreauto.dtsi5
-rw-r--r--arch/arm/boot/dts/imx6qdl-sabresd.dtsi18
-rw-r--r--arch/arm/boot/dts/imx6qdl-wandboard.dtsi23
-rw-r--r--arch/arm/boot/dts/imx6qdl.dtsi67
-rw-r--r--arch/arm/boot/dts/imx6sl-evk.dts67
-rw-r--r--arch/arm/boot/dts/imx6sl.dtsi176
-rw-r--r--arch/arm/boot/dts/integrator.dtsi5
-rw-r--r--arch/arm/boot/dts/integratorap.dts5
-rw-r--r--arch/arm/boot/dts/integratorcp.dts13
-rw-r--r--arch/arm/boot/dts/keystone-clocks.dtsi821
-rw-r--r--arch/arm/boot/dts/keystone.dts63
-rw-r--r--arch/arm/boot/dts/kirkwood-db-88f6281.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-db-88f6282.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-db.dtsi44
-rw-r--r--arch/arm/boot/dts/kirkwood-dnskw.dtsi76
-rw-r--r--arch/arm/boot/dts/kirkwood-dockstar.dts40
-rw-r--r--arch/arm/boot/dts/kirkwood-goflexnet.dts51
-rw-r--r--arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts40
-rw-r--r--arch/arm/boot/dts/kirkwood-ib62x0.dts53
-rw-r--r--arch/arm/boot/dts/kirkwood-iconnect.dts59
-rw-r--r--arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts51
-rw-r--r--arch/arm/boot/dts/kirkwood-km_kirkwood.dts14
-rw-r--r--arch/arm/boot/dts/kirkwood-mplcec4.dts63
-rw-r--r--arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts61
-rw-r--r--arch/arm/boot/dts/kirkwood-nsa310-common.dtsi86
-rw-r--r--arch/arm/boot/dts/kirkwood-nsa310.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-openblocks_a6.dts74
-rw-r--r--arch/arm/boot/dts/kirkwood-openblocks_a7.dts223
-rw-r--r--arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi42
-rw-r--r--arch/arm/boot/dts/kirkwood-topkick.dts62
-rw-r--r--arch/arm/boot/dts/kirkwood-ts219-6282.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood.dtsi60
-rw-r--r--arch/arm/boot/dts/mxs-pinfunc.h31
-rw-r--r--arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi52
-rw-r--r--arch/arm/boot/dts/omap-zoom-common.dtsi33
-rw-r--r--arch/arm/boot/dts/omap2420-h4.dts6
-rw-r--r--arch/arm/boot/dts/omap3-beagle-xm.dts69
-rw-r--r--arch/arm/boot/dts/omap3-beagle.dts46
-rw-r--r--arch/arm/boot/dts/omap3-devkit8000.dts2
-rw-r--r--arch/arm/boot/dts/omap3-evm-37xx.dts151
-rw-r--r--arch/arm/boot/dts/omap3-evm-common.dtsi96
-rw-r--r--arch/arm/boot/dts/omap3-evm.dts58
-rw-r--r--arch/arm/boot/dts/omap3-gta04.dts170
-rw-r--r--arch/arm/boot/dts/omap3-igep.dtsi25
-rw-r--r--arch/arm/boot/dts/omap3-igep0020.dts107
-rw-r--r--arch/arm/boot/dts/omap3-igep0030.dts17
-rw-r--r--arch/arm/boot/dts/omap3-n9.dts18
-rw-r--r--arch/arm/boot/dts/omap3-n900.dts484
-rw-r--r--arch/arm/boot/dts/omap3-n950-n9.dtsi174
-rw-r--r--arch/arm/boot/dts/omap3-n950.dts18
-rw-r--r--arch/arm/boot/dts/omap3-overo.dtsi2
-rw-r--r--arch/arm/boot/dts/omap3-zoom3.dts217
-rw-r--r--arch/arm/boot/dts/omap3.dtsi62
-rw-r--r--arch/arm/boot/dts/omap3430-sdp.dts22
-rw-r--r--arch/arm/boot/dts/omap36xx.dtsi4
-rw-r--r--arch/arm/boot/dts/omap4-panda-common.dtsi124
-rw-r--r--arch/arm/boot/dts/omap4-panda-es.dts4
-rw-r--r--arch/arm/boot/dts/omap4-sdp.dts56
-rw-r--r--arch/arm/boot/dts/omap4.dtsi60
-rw-r--r--arch/arm/boot/dts/omap5-uevm.dts84
-rw-r--r--arch/arm/boot/dts/omap5.dtsi57
-rw-r--r--arch/arm/boot/dts/prima2.dtsi99
-rw-r--r--arch/arm/boot/dts/qcom-msm8660-surf.dts (renamed from arch/arm/boot/dts/msm8660-surf.dts)0
-rw-r--r--arch/arm/boot/dts/qcom-msm8960-cdp.dts (renamed from arch/arm/boot/dts/msm8960-cdp.dts)0
-rw-r--r--arch/arm/boot/dts/r7s72100-genmai.dts31
-rw-r--r--arch/arm/boot/dts/r7s72100.dtsi36
-rw-r--r--arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts73
-rw-r--r--arch/arm/boot/dts/r8a73a4-ape6evm.dts1
-rw-r--r--arch/arm/boot/dts/r8a73a4.dtsi58
-rw-r--r--arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts78
-rw-r--r--arch/arm/boot/dts/r8a7740.dtsi35
-rw-r--r--arch/arm/boot/dts/r8a7778-bockw-reference.dts27
-rw-r--r--arch/arm/boot/dts/r8a7778.dtsi20
-rw-r--r--arch/arm/boot/dts/r8a7779-marzen-reference.dts8
-rw-r--r--arch/arm/boot/dts/r8a7779.dtsi6
-rw-r--r--arch/arm/boot/dts/r8a7790.dtsi98
-rw-r--r--arch/arm/boot/dts/r8a7791-koelsch.dts32
-rw-r--r--arch/arm/boot/dts/r8a7791.dtsi74
-rw-r--r--arch/arm/boot/dts/rk3066a-bqcurie2.dts109
-rw-r--r--arch/arm/boot/dts/rk3066a.dtsi120
-rw-r--r--arch/arm/boot/dts/rk3188-clocks.dtsi289
-rw-r--r--arch/arm/boot/dts/rk3188-radxarock.dts80
-rw-r--r--arch/arm/boot/dts/rk3188.dtsi253
-rw-r--r--arch/arm/boot/dts/rk3xxx.dtsi124
-rw-r--r--arch/arm/boot/dts/s3c6400.dtsi41
-rw-r--r--arch/arm/boot/dts/s3c6410-mini6410.dts228
-rw-r--r--arch/arm/boot/dts/s3c6410-smdk6410.dts103
-rw-r--r--arch/arm/boot/dts/s3c6410.dtsi57
-rw-r--r--arch/arm/boot/dts/s3c64xx-pinctrl.dtsi687
-rw-r--r--arch/arm/boot/dts/s3c64xx.dtsi199
-rw-r--r--arch/arm/boot/dts/sama5d3.dtsi203
-rw-r--r--arch/arm/boot/dts/sama5d31.dtsi16
-rw-r--r--arch/arm/boot/dts/sama5d31ek.dts3
-rw-r--r--arch/arm/boot/dts/sama5d33.dtsi14
-rw-r--r--arch/arm/boot/dts/sama5d33ek.dts3
-rw-r--r--arch/arm/boot/dts/sama5d34.dtsi16
-rw-r--r--arch/arm/boot/dts/sama5d34ek.dts3
-rw-r--r--arch/arm/boot/dts/sama5d35.dtsi18
-rw-r--r--arch/arm/boot/dts/sama5d35ek.dts3
-rw-r--r--arch/arm/boot/dts/sama5d3_can.dtsi54
-rw-r--r--arch/arm/boot/dts/sama5d3_emac.dtsi44
-rw-r--r--arch/arm/boot/dts/sama5d3_gmac.dtsi77
-rw-r--r--arch/arm/boot/dts/sama5d3_lcd.dtsi55
-rw-r--r--arch/arm/boot/dts/sama5d3_mci2.dtsi47
-rw-r--r--arch/arm/boot/dts/sama5d3_tcb1.dtsi27
-rw-r--r--arch/arm/boot/dts/sama5d3_uart.dtsi53
-rw-r--r--arch/arm/boot/dts/sama5d3xcm.dtsi1
-rw-r--r--arch/arm/boot/dts/sh73a0-kzm9g-reference.dts2
-rw-r--r--arch/arm/boot/dts/sh73a0.dtsi11
-rw-r--r--arch/arm/boot/dts/socfpga.dtsi297
-rw-r--r--arch/arm/boot/dts/socfpga_arria5.dtsi58
-rw-r--r--arch/arm/boot/dts/socfpga_arria5_socdk.dts (renamed from arch/mips/include/asm/mach-powertv/powertv-clock.h)37
-rw-r--r--arch/arm/boot/dts/socfpga_cyclone5.dtsi (renamed from arch/arm/boot/dts/socfpga_cyclone5.dts)20
-rw-r--r--arch/arm/boot/dts/socfpga_cyclone5_socdk.dts40
-rw-r--r--arch/arm/boot/dts/socfpga_cyclone5_sockit.dts (renamed from arch/mips/include/asm/mach-powertv/irq.h)30
-rw-r--r--arch/arm/boot/dts/ste-dbx5x0.dtsi216
-rw-r--r--arch/arm/boot/dts/ste-href-stuib.dtsi (renamed from arch/arm/boot/dts/ste-stuib.dtsi)2
-rw-r--r--arch/arm/boot/dts/ste-href-tvk1281618.dtsi41
-rw-r--r--arch/arm/boot/dts/ste-href.dtsi109
-rw-r--r--arch/arm/boot/dts/ste-hrefprev60-stuib.dts34
-rw-r--r--arch/arm/boot/dts/ste-hrefprev60-tvk.dts19
-rw-r--r--arch/arm/boot/dts/ste-hrefprev60.dtsi (renamed from arch/arm/boot/dts/ste-hrefprev60.dts)37
-rw-r--r--arch/arm/boot/dts/ste-hrefv60plus-stuib.dts36
-rw-r--r--arch/arm/boot/dts/ste-hrefv60plus-tvk.dts21
-rw-r--r--arch/arm/boot/dts/ste-hrefv60plus.dts210
-rw-r--r--arch/arm/boot/dts/ste-hrefv60plus.dtsi70
-rw-r--r--arch/arm/boot/dts/ste-nomadik-stn8815.dtsi12
-rw-r--r--arch/arm/boot/dts/ste-snowball.dts85
-rw-r--r--arch/arm/boot/dts/sun4i-a10.dtsi5
-rw-r--r--arch/arm/boot/dts/sun5i-a10s.dtsi5
-rw-r--r--arch/arm/boot/dts/sun5i-a13.dtsi5
-rw-r--r--arch/arm/boot/dts/sun6i-a31.dtsi2
-rw-r--r--arch/arm/boot/dts/sun7i-a20-cubieboard2.dts12
-rw-r--r--arch/arm/boot/dts/sun7i-a20-cubietruck.dts63
-rw-r--r--arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts18
-rw-r--r--arch/arm/boot/dts/sun7i-a20.dtsi71
-rw-r--r--arch/arm/boot/dts/tegra114-dalmore.dts32
-rw-r--r--arch/arm/boot/dts/tegra114.dtsi6
-rw-r--r--arch/arm/boot/dts/tegra124-venice2.dts27
-rw-r--r--arch/arm/boot/dts/tegra124.dtsi149
-rw-r--r--arch/arm/boot/dts/tegra30-cardhu.dtsi3
-rw-r--r--arch/arm/boot/dts/tegra30.dtsi5
-rw-r--r--arch/arm/boot/dts/testcases/tests-interrupts.dtsi58
-rw-r--r--arch/arm/boot/dts/testcases/tests.dtsi1
-rw-r--r--arch/arm/boot/dts/twl4030.dtsi50
-rw-r--r--arch/arm/boot/dts/twl6030_omap4.dtsi38
-rw-r--r--arch/arm/boot/dts/versatile-ab.dts2
-rw-r--r--arch/arm/boot/dts/versatile-pb.dts2
-rw-r--r--arch/arm/boot/dts/vf610-cosmic.dts47
-rw-r--r--arch/arm/boot/dts/vf610-twr.dts17
-rw-r--r--arch/arm/boot/dts/vf610.dtsi12
-rw-r--r--arch/arm/boot/dts/zynq-7000.dtsi8
-rw-r--r--arch/arm/boot/install.sh14
-rw-r--r--arch/arm/common/Makefile3
-rw-r--r--arch/arm/common/bL_switcher.c822
-rw-r--r--arch/arm/common/bL_switcher_dummy_if.c71
-rw-r--r--arch/arm/common/edma.c38
-rw-r--r--arch/arm/common/mcpm_entry.c33
-rw-r--r--arch/arm/common/mcpm_head.S18
-rw-r--r--arch/arm/common/mcpm_platsmp.c27
-rw-r--r--arch/arm/common/sharpsl_param.c5
-rw-r--r--arch/arm/common/timer-sp.c2
-rw-r--r--arch/arm/common/via82c505.c83
-rw-r--r--arch/arm/configs/bcm_defconfig10
-rw-r--r--arch/arm/configs/bockw_defconfig4
-rw-r--r--arch/arm/configs/ep93xx_defconfig17
-rw-r--r--arch/arm/configs/h3600_defconfig22
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig16
-rw-r--r--arch/arm/configs/integrator_defconfig25
-rw-r--r--arch/arm/configs/keystone_defconfig2
-rw-r--r--arch/arm/configs/koelsch_defconfig54
-rw-r--r--arch/arm/configs/lager_defconfig2
-rw-r--r--arch/arm/configs/marzen_defconfig2
-rw-r--r--arch/arm/configs/multi_v7_defconfig4
-rw-r--r--arch/arm/configs/mxs_defconfig7
-rw-r--r--arch/arm/configs/omap2plus_defconfig109
-rw-r--r--arch/arm/configs/shark_defconfig80
-rw-r--r--arch/arm/configs/sunxi_defconfig61
-rw-r--r--arch/arm/configs/tegra_defconfig5
-rw-r--r--arch/arm/configs/u8500_defconfig12
-rw-r--r--arch/arm/configs/vexpress_defconfig73
-rw-r--r--arch/arm/crypto/.gitignore1
-rw-r--r--arch/arm/crypto/Makefile14
-rw-r--r--arch/arm/crypto/aes-armv4.S6
-rw-r--r--arch/arm/crypto/aes_glue.c22
-rw-r--r--arch/arm/crypto/aes_glue.h19
-rw-r--r--arch/arm/crypto/aesbs-core.S_shipped2544
-rw-r--r--arch/arm/crypto/aesbs-glue.c434
-rw-r--r--arch/arm/crypto/bsaes-armv7.pl2467
-rw-r--r--arch/arm/include/asm/Kbuild3
-rw-r--r--arch/arm/include/asm/arch_timer.h36
-rw-r--r--arch/arm/include/asm/assembler.h7
-rw-r--r--arch/arm/include/asm/atomic.h108
-rw-r--r--arch/arm/include/asm/bL_switcher.h77
-rw-r--r--arch/arm/include/asm/bug.h10
-rw-r--r--arch/arm/include/asm/cacheflush.h46
-rw-r--r--arch/arm/include/asm/cmpxchg.h58
-rw-r--r--arch/arm/include/asm/cputype.h1
-rw-r--r--arch/arm/include/asm/dma-mapping.h54
-rw-r--r--arch/arm/include/asm/hardirq.h2
-rw-r--r--arch/arm/include/asm/hardware/coresight.h8
-rw-r--r--arch/arm/include/asm/hardware/iop3xx-gpio.h75
-rw-r--r--arch/arm/include/asm/hardware/iop3xx.h12
-rw-r--r--arch/arm/include/asm/io.h9
-rw-r--r--arch/arm/include/asm/jump_label.h2
-rw-r--r--arch/arm/include/asm/kgdb.h3
-rw-r--r--arch/arm/include/asm/kvm_arm.h9
-rw-r--r--arch/arm/include/asm/kvm_asm.h2
-rw-r--r--arch/arm/include/asm/kvm_emulate.h51
-rw-r--r--arch/arm/include/asm/kvm_host.h6
-rw-r--r--arch/arm/include/asm/kvm_mmu.h17
-rw-r--r--arch/arm/include/asm/mach/arch.h1
-rw-r--r--arch/arm/include/asm/mach/pci.h4
-rw-r--r--arch/arm/include/asm/mcpm.h53
-rw-r--r--arch/arm/include/asm/memory.h76
-rw-r--r--arch/arm/include/asm/mmu.h2
-rw-r--r--arch/arm/include/asm/pgalloc.h12
-rw-r--r--arch/arm/include/asm/pgtable-2level.h7
-rw-r--r--arch/arm/include/asm/pgtable-3level.h5
-rw-r--r--arch/arm/include/asm/processor.h33
-rw-r--r--arch/arm/include/asm/prom.h2
-rw-r--r--arch/arm/include/asm/sched_clock.h4
-rw-r--r--arch/arm/include/asm/setup.h2
-rw-r--r--arch/arm/include/asm/smp.h2
-rw-r--r--arch/arm/include/asm/spinlock.h36
-rw-r--r--arch/arm/include/asm/spinlock_types.h2
-rw-r--r--arch/arm/include/asm/syscall.h6
-rw-r--r--arch/arm/include/asm/tlbflush.h48
-rw-r--r--arch/arm/include/asm/uaccess.h7
-rw-r--r--arch/arm/include/asm/unified.h4
-rw-r--r--arch/arm/include/asm/xen/hypervisor.h2
-rw-r--r--arch/arm/include/asm/xen/page-coherent.h50
-rw-r--r--arch/arm/include/asm/xen/page.h44
-rw-r--r--arch/arm/include/debug/efm32.S45
-rw-r--r--arch/arm/include/debug/msm.S5
-rw-r--r--arch/arm/include/debug/pl01x.S2
-rw-r--r--arch/arm/include/debug/vf.S26
-rw-r--r--arch/arm/include/uapi/asm/Kbuild1
-rw-r--r--arch/arm/include/uapi/asm/hwcap.h1
-rw-r--r--arch/arm/include/uapi/asm/kvm.h3
-rw-r--r--arch/arm/include/uapi/asm/perf_regs.h23
-rw-r--r--arch/arm/kernel/Makefile4
-rw-r--r--arch/arm/kernel/arch_timer.c14
-rw-r--r--arch/arm/kernel/armksyms.c1
-rw-r--r--arch/arm/kernel/devtree.c57
-rw-r--r--arch/arm/kernel/entry-armv.S6
-rw-r--r--arch/arm/kernel/entry-common.S8
-rw-r--r--arch/arm/kernel/entry-header.S8
-rw-r--r--arch/arm/kernel/head.S103
-rw-r--r--arch/arm/kernel/hw_breakpoint.c14
-rw-r--r--arch/arm/kernel/kprobes.c8
-rw-r--r--arch/arm/kernel/module.c59
-rw-r--r--arch/arm/kernel/perf_event.c3
-rw-r--r--arch/arm/kernel/perf_event_cpu.c2
-rw-r--r--arch/arm/kernel/perf_regs.c30
-rw-r--r--arch/arm/kernel/psci_smp.c1
-rw-r--r--arch/arm/kernel/setup.c29
-rw-r--r--arch/arm/kernel/signal.c38
-rw-r--r--arch/arm/kernel/sigreturn_codes.S80
-rw-r--r--arch/arm/kernel/sleep.S27
-rw-r--r--arch/arm/kernel/smp.c42
-rw-r--r--arch/arm/kernel/smp_scu.c14
-rw-r--r--arch/arm/kernel/smp_tlb.c36
-rw-r--r--arch/arm/kernel/smp_twd.c24
-rw-r--r--arch/arm/kernel/suspend.c8
-rw-r--r--arch/arm/kernel/time.c29
-rw-r--r--arch/arm/kernel/traps.c24
-rw-r--r--arch/arm/kvm/Kconfig1
-rw-r--r--arch/arm/kvm/Makefile2
-rw-r--r--arch/arm/kvm/arm.c24
-rw-r--r--arch/arm/kvm/coproc.c120
-rw-r--r--arch/arm/kvm/coproc_a15.c117
-rw-r--r--arch/arm/kvm/coproc_a7.c54
-rw-r--r--arch/arm/kvm/emulate.c2
-rw-r--r--arch/arm/kvm/guest.c24
-rw-r--r--arch/arm/kvm/handle_exit.c20
-rw-r--r--arch/arm/kvm/mmio.c86
-rw-r--r--arch/arm/kvm/mmu.c223
-rw-r--r--arch/arm/kvm/psci.c21
-rw-r--r--arch/arm/kvm/reset.c19
-rw-r--r--arch/arm/lib/Makefile1
-rw-r--r--arch/arm/lib/bitops.h5
-rw-r--r--arch/arm/lib/io-shark.c13
-rw-r--r--arch/arm/lib/uaccess_with_memcpy.c41
-rw-r--r--arch/arm/mach-at91/Makefile1
-rw-r--r--arch/arm/mach-at91/at91rm9200.c2
-rw-r--r--arch/arm/mach-at91/at91rm9200_time.c2
-rw-r--r--arch/arm/mach-at91/at91sam9260.c2
-rw-r--r--arch/arm/mach-at91/at91sam9261.c2
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c6
-rw-r--r--arch/arm/mach-at91/at91sam9263.c2
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c6
-rw-r--r--arch/arm/mach-at91/at91sam926x_time.c2
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c2
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c6
-rw-r--r--arch/arm/mach-at91/at91sam9g45_reset.S8
-rw-r--r--arch/arm/mach-at91/at91sam9n12.c1
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c2
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c6
-rw-r--r--arch/arm/mach-at91/at91x40_time.c2
-rw-r--r--arch/arm/mach-at91/board-cam60.c2
-rw-r--r--arch/arm/mach-at91/board-dt-rm9200.c7
-rw-r--r--arch/arm/mach-at91/board-dt-sam9.c7
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c10
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c6
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c4
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c6
-rw-r--r--arch/arm/mach-at91/board.h4
-rw-r--r--arch/arm/mach-at91/cpuidle.c68
-rw-r--r--arch/arm/mach-at91/include/mach/at91_adc.h34
-rw-r--r--arch/arm/mach-at91/pm.c27
-rw-r--r--arch/arm/mach-at91/pm.h59
-rw-r--r--arch/arm/mach-at91/setup.c14
-rw-r--r--arch/arm/mach-bcm/Kconfig22
-rw-r--r--arch/arm/mach-bcm/Makefile2
-rw-r--r--arch/arm/mach-bcm/board_bcm281xx.c3
-rw-r--r--arch/arm/mach-bcm2835/bcm2835.c7
-rw-r--r--arch/arm/mach-clps711x/common.c2
-rw-r--r--arch/arm/mach-davinci/Kconfig1
-rw-r--r--arch/arm/mach-davinci/board-da830-evm.c16
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c6
-rw-r--r--arch/arm/mach-davinci/board-dm355-evm.c15
-rw-r--r--arch/arm/mach-davinci/board-dm355-leopard.c14
-rw-r--r--arch/arm/mach-davinci/board-dm365-evm.c8
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c5
-rw-r--r--arch/arm/mach-davinci/board-dm646x-evm.c13
-rw-r--r--arch/arm/mach-davinci/board-neuros-osd2.c14
-rw-r--r--arch/arm/mach-davinci/board-omapl138-hawk.c8
-rw-r--r--arch/arm/mach-davinci/da830.c16
-rw-r--r--arch/arm/mach-davinci/da850.c16
-rw-r--r--arch/arm/mach-davinci/davinci.h7
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c26
-rw-r--r--arch/arm/mach-davinci/devices.c13
-rw-r--r--arch/arm/mach-davinci/dm355.c35
-rw-r--r--arch/arm/mach-davinci/dm365.c37
-rw-r--r--arch/arm/mach-davinci/dm644x.c30
-rw-r--r--arch/arm/mach-davinci/dm646x.c30
-rw-r--r--arch/arm/mach-davinci/include/mach/da8xx.h3
-rw-r--r--arch/arm/mach-davinci/include/mach/gpio-davinci.h91
-rw-r--r--arch/arm/mach-davinci/include/mach/gpio.h88
-rw-r--r--arch/arm/mach-davinci/include/mach/serial.h4
-rw-r--r--arch/arm/mach-davinci/sram.c9
-rw-r--r--arch/arm/mach-davinci/time.c13
-rw-r--r--arch/arm/mach-dove/board-dt.c50
-rw-r--r--arch/arm/mach-ep93xx/clock.c2
-rw-r--r--arch/arm/mach-ep93xx/core.c39
-rw-r--r--arch/arm/mach-exynos/Kconfig38
-rw-r--r--arch/arm/mach-exynos/Makefile4
-rw-r--r--arch/arm/mach-exynos/common.c19
-rw-r--r--arch/arm/mach-exynos/common.h2
-rw-r--r--arch/arm/mach-exynos/cpuidle.c18
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-pmu.h5
-rw-r--r--arch/arm/mach-exynos/mach-exynos4-dt.c7
-rw-r--r--arch/arm/mach-exynos/mach-exynos5-dt.c7
-rw-r--r--arch/arm/mach-footbridge/netwinder-hw.c8
-rw-r--r--arch/arm/mach-gemini/gpio.c2
-rw-r--r--arch/arm/mach-gemini/include/mach/gpio.h20
-rw-r--r--arch/arm/mach-gemini/time.c97
-rw-r--r--arch/arm/mach-highbank/Kconfig5
-rw-r--r--arch/arm/mach-highbank/Makefile2
-rw-r--r--arch/arm/mach-highbank/core.h4
-rw-r--r--arch/arm/mach-highbank/highbank.c47
-rw-r--r--arch/arm/mach-highbank/hotplug.c37
-rw-r--r--arch/arm/mach-highbank/platsmp.c68
-rw-r--r--arch/arm/mach-highbank/pm.c27
-rw-r--r--arch/arm/mach-imx/Kconfig15
-rw-r--r--arch/arm/mach-imx/Makefile2
-rw-r--r--arch/arm/mach-imx/anatop.c33
-rw-r--r--arch/arm/mach-imx/clk-fixup-mux.c1
-rw-r--r--arch/arm/mach-imx/clk-imx27.c2
-rw-r--r--arch/arm/mach-imx/clk-imx51-imx53.c46
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c190
-rw-r--r--arch/arm/mach-imx/clk-imx6sl.c3
-rw-r--r--arch/arm/mach-imx/common.h190
-rw-r--r--arch/arm/mach-imx/cpu.c95
-rw-r--r--arch/arm/mach-imx/epit.c2
-rw-r--r--arch/arm/mach-imx/gpc.c4
-rw-r--r--arch/arm/mach-imx/hotplug.c4
-rw-r--r--arch/arm/mach-imx/imx51-dt.c6
-rw-r--r--arch/arm/mach-imx/mach-armadillo5x0.c3
-rw-r--r--arch/arm/mach-imx/mach-imx53.c6
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c102
-rw-r--r--arch/arm/mach-imx/mach-imx6sl.c40
-rw-r--r--arch/arm/mach-imx/mach-mx31_3ds.c2
-rw-r--r--arch/arm/mach-imx/mach-pcm037.c3
-rw-r--r--arch/arm/mach-imx/mach-vf610.c9
-rw-r--r--arch/arm/mach-imx/mm-imx5.c19
-rw-r--r--arch/arm/mach-imx/mx31lilly-db.c3
-rw-r--r--arch/arm/mach-imx/mxc.h6
-rw-r--r--arch/arm/mach-imx/pm-imx6q.c176
-rw-r--r--arch/arm/mach-imx/src.c1
-rw-r--r--arch/arm/mach-imx/system.c16
-rw-r--r--arch/arm/mach-imx/time.c2
-rw-r--r--arch/arm/mach-integrator/cm.h (renamed from arch/arm/mach-integrator/include/mach/cm.h)7
-rw-r--r--arch/arm/mach-integrator/core.c182
-rw-r--r--arch/arm/mach-integrator/include/mach/irqs.h81
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c152
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c185
-rw-r--r--arch/arm/mach-integrator/leds.c5
-rw-r--r--arch/arm/mach-integrator/pci_v3.c127
-rw-r--r--arch/arm/mach-integrator/pci_v3.h7
-rw-r--r--arch/arm/mach-iop32x/em7210.c2
-rw-r--r--arch/arm/mach-iop32x/glantank.c2
-rw-r--r--arch/arm/mach-iop32x/gpio-iop32x.h10
-rw-r--r--arch/arm/mach-iop32x/include/mach/gpio.h6
-rw-r--r--arch/arm/mach-iop32x/include/mach/iop32x.h1
-rw-r--r--arch/arm/mach-iop32x/iq31244.c2
-rw-r--r--arch/arm/mach-iop32x/iq80321.c2
-rw-r--r--arch/arm/mach-iop32x/n2100.c47
-rw-r--r--arch/arm/mach-iop33x/include/mach/gpio.h6
-rw-r--r--arch/arm/mach-iop33x/include/mach/iop33x.h1
-rw-r--r--arch/arm/mach-iop33x/iq80331.c7
-rw-r--r--arch/arm/mach-iop33x/iq80332.c7
-rw-r--r--arch/arm/mach-ixp4xx/Kconfig4
-rw-r--r--arch/arm/mach-ixp4xx/common.c49
-rw-r--r--arch/arm/mach-ixp4xx/dsmg600-setup.c65
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/platform.h39
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c8
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-setup.c49
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c17
-rw-r--r--arch/arm/mach-keystone/Kconfig2
-rw-r--r--arch/arm/mach-keystone/Makefile3
-rw-r--r--arch/arm/mach-keystone/platsmp.c1
-rw-r--r--arch/arm/mach-keystone/pm_domain.c82
-rw-r--r--arch/arm/mach-kirkwood/Makefile2
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c103
-rw-r--r--arch/arm/mach-kirkwood/common.c1
-rw-r--r--arch/arm/mach-kirkwood/common.h6
-rw-r--r--arch/arm/mach-kirkwood/include/mach/bridge-regs.h2
-rw-r--r--arch/arm/mach-kirkwood/pm.c73
-rw-r--r--arch/arm/mach-mmp/include/mach/gpio.h8
-rw-r--r--arch/arm/mach-mmp/ttc_dkb.c4
-rw-r--r--arch/arm/mach-msm/Kconfig13
-rw-r--r--arch/arm/mach-msm/Makefile3
-rw-r--r--arch/arm/mach-msm/board-dt-8660.c48
-rw-r--r--arch/arm/mach-msm/board-dt.c (renamed from arch/arm/mach-msm/board-dt-8960.c)17
-rw-r--r--arch/arm/mach-msm/include/mach/irqs-8960.h277
-rw-r--r--arch/arm/mach-msm/include/mach/irqs-8x60.h258
-rw-r--r--arch/arm/mach-msm/include/mach/irqs.h5
-rw-r--r--arch/arm/mach-msm/timer.c1
-rw-r--r--arch/arm/mach-mvebu/Kconfig1
-rw-r--r--arch/arm/mach-mvebu/coherency.c8
-rw-r--r--arch/arm/mach-mvebu/coherency_ll.S3
-rw-r--r--arch/arm/mach-mvebu/headsmp.S4
-rw-r--r--arch/arm/mach-mvebu/pmsu.c1
-rw-r--r--arch/arm/mach-mvebu/system-controller.c1
-rw-r--r--arch/arm/mach-mxs/mach-mxs.c20
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c71
-rw-r--r--arch/arm/mach-nspire/nspire.c9
-rw-r--r--arch/arm/mach-omap1/common.h3
-rw-r--r--arch/arm/mach-omap1/fpga.c3
-rw-r--r--arch/arm/mach-omap1/gpio15xx.c8
-rw-r--r--arch/arm/mach-omap1/gpio16xx.c22
-rw-r--r--arch/arm/mach-omap1/gpio7xx.c30
-rw-r--r--arch/arm/mach-omap1/pm.c1
-rw-r--r--arch/arm/mach-omap1/time.c2
-rw-r--r--arch/arm/mach-omap1/timer32k.c2
-rw-r--r--arch/arm/mach-omap2/Kconfig65
-rw-r--r--arch/arm/mach-omap2/Makefile29
-rw-r--r--arch/arm/mach-omap2/board-3630sdp.c225
-rw-r--r--arch/arm/mach-omap2/board-flash.c2
-rw-r--r--arch/arm/mach-omap2/board-generic.c58
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c718
-rw-r--r--arch/arm/mach-omap2/board-ldp.c3
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c16
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c756
-rw-r--r--arch/arm/mach-omap2/board-rm680.c167
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c48
-rw-r--r--arch/arm/mach-omap2/board-rx51.c12
-rw-r--r--arch/arm/mach-omap2/board-zoom-debugboard.c139
-rw-r--r--arch/arm/mach-omap2/board-zoom-display.c71
-rw-r--r--arch/arm/mach-omap2/board-zoom-peripherals.c360
-rw-r--r--arch/arm/mach-omap2/board-zoom.c159
-rw-r--r--arch/arm/mach-omap2/board-zoom.h10
-rw-r--r--arch/arm/mach-omap2/cclock3xxx_data.c1
-rw-r--r--arch/arm/mach-omap2/cclock44xx_data.c2
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_apll.c4
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_dpllcore.c11
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c24
-rw-r--r--arch/arm/mach-omap2/clock.c38
-rw-r--r--arch/arm/mach-omap2/clock.h2
-rw-r--r--arch/arm/mach-omap2/clockdomain.h4
-rw-r--r--arch/arm/mach-omap2/clockdomains43xx_data.c196
-rw-r--r--arch/arm/mach-omap2/cm2xxx.c67
-rw-r--r--arch/arm/mach-omap2/cm2xxx.h8
-rw-r--r--arch/arm/mach-omap2/cm33xx.c16
-rw-r--r--arch/arm/mach-omap2/cm33xx.h12
-rw-r--r--arch/arm/mach-omap2/cm3xxx.c22
-rw-r--r--arch/arm/mach-omap2/cm3xxx.h1
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c29
-rw-r--r--arch/arm/mach-omap2/cminst44xx.h26
-rw-r--r--arch/arm/mach-omap2/common.h7
-rw-r--r--arch/arm/mach-omap2/control.c54
-rw-r--r--arch/arm/mach-omap2/control.h1
-rw-r--r--arch/arm/mach-omap2/cpuidle44xx.c2
-rw-r--r--arch/arm/mach-omap2/devices.c46
-rw-r--r--arch/arm/mach-omap2/display.c28
-rw-r--r--arch/arm/mach-omap2/display.h4
-rw-r--r--arch/arm/mach-omap2/drm.c24
-rw-r--r--arch/arm/mach-omap2/dss-common.c44
-rw-r--r--arch/arm/mach-omap2/dss-common.h1
-rw-r--r--arch/arm/mach-omap2/fb.c14
-rw-r--r--arch/arm/mach-omap2/gpmc-onenand.c12
-rw-r--r--arch/arm/mach-omap2/gpmc.c90
-rw-r--r--arch/arm/mach-omap2/id.c20
-rw-r--r--arch/arm/mach-omap2/io.c26
-rw-r--r--arch/arm/mach-omap2/irq.c2
-rw-r--r--arch/arm/mach-omap2/mcbsp.c16
-rw-r--r--arch/arm/mach-omap2/mux.c8
-rw-r--r--arch/arm/mach-omap2/mux.h4
-rw-r--r--arch/arm/mach-omap2/mux34xx.c2
-rw-r--r--arch/arm/mach-omap2/omap-pm.h2
-rw-r--r--arch/arm/mach-omap2/omap-secure.c76
-rw-r--r--arch/arm/mach-omap2/omap-secure.h17
-rw-r--r--arch/arm/mach-omap2/omap-smc.S21
-rw-r--r--arch/arm/mach-omap2/omap-smp.c9
-rw-r--r--arch/arm/mach-omap2/omap-wakeupgen.c18
-rw-r--r--arch/arm/mach-omap2/omap_device.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c57
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.h1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h163
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c643
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c1469
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_data.c1990
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c48
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_43xx_data.c758
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_54xx_data.c230
-rw-r--r--arch/arm/mach-omap2/opp.c10
-rw-r--r--arch/arm/mach-omap2/pdata-quirks.c174
-rw-r--r--arch/arm/mach-omap2/pm.c20
-rw-r--r--arch/arm/mach-omap2/pm24xx.c24
-rw-r--r--arch/arm/mach-omap2/pm34xx.c3
-rw-r--r--arch/arm/mach-omap2/powerdomain.h1
-rw-r--r--arch/arm/mach-omap2/powerdomains43xx_data.c136
-rw-r--r--arch/arm/mach-omap2/prcm43xx.h146
-rw-r--r--arch/arm/mach-omap2/prm3xxx.h8
-rw-r--r--arch/arm/mach-omap2/prm44xx_54xx.h8
-rw-r--r--arch/arm/mach-omap2/prm_common.c11
-rw-r--r--arch/arm/mach-omap2/soc.h2
-rw-r--r--arch/arm/mach-omap2/timer.c23
-rw-r--r--arch/arm/mach-omap2/twl-common.c11
-rw-r--r--arch/arm/mach-omap2/usb-host.c18
-rw-r--r--arch/arm/mach-omap2/usb.h1
-rw-r--r--arch/arm/mach-prima2/common.c11
-rw-r--r--arch/arm/mach-prima2/common.h1
-rw-r--r--arch/arm/mach-pxa/Kconfig3
-rw-r--r--arch/arm/mach-pxa/include/mach/gpio.h32
-rw-r--r--arch/arm/mach-rockchip/Kconfig5
-rw-r--r--arch/arm/mach-rockchip/rockchip.c9
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig3
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2412.c8
-rw-r--r--arch/arm/mach-s3c24xx/common-s3c2443.c12
-rw-r--r--arch/arm/mach-s3c24xx/common.c206
-rw-r--r--arch/arm/mach-s3c24xx/common.h5
-rw-r--r--arch/arm/mach-s3c24xx/mach-jive.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2413.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2416.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2443.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-vstms.c1
-rw-r--r--arch/arm/mach-s3c64xx/Kconfig29
-rw-r--r--arch/arm/mach-s3c64xx/Makefile3
-rw-r--r--arch/arm/mach-s3c64xx/clock.c1007
-rw-r--r--arch/arm/mach-s3c64xx/common.c33
-rw-r--r--arch/arm/mach-s3c64xx/common.h12
-rw-r--r--arch/arm/mach-s3c64xx/dma.c13
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/regs-clock.h132
-rw-r--r--arch/arm/mach-s3c64xx/irq-pm.c9
-rw-r--r--arch/arm/mach-s3c64xx/mach-anw6410.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410.c14
-rw-r--r--arch/arm/mach-s3c64xx/mach-hmt.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-mini6410.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-ncp.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c85
-rw-r--r--arch/arm/mach-s3c64xx/mach-smartq.c11
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6400.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6410.c2
-rw-r--r--arch/arm/mach-s3c64xx/pm.c21
-rw-r--r--arch/arm/mach-s3c64xx/s3c6400.c15
-rw-r--r--arch/arm/mach-s3c64xx/s3c6410.c16
-rw-r--r--arch/arm/mach-s5pv210/include/mach/regs-clock.h4
-rw-r--r--arch/arm/mach-sa1100/assabet.c3
-rw-r--r--arch/arm/mach-sa1100/collie.c2
-rw-r--r--arch/arm/mach-sa1100/generic.c81
-rw-r--r--arch/arm/mach-sa1100/generic.h7
-rw-r--r--arch/arm/mach-sa1100/include/mach/gpio.h55
-rw-r--r--arch/arm/mach-sa1100/include/mach/h3xxx.h2
-rw-r--r--arch/arm/mach-sa1100/simpad.c1
-rw-r--r--arch/arm/mach-shark/Makefile10
-rw-r--r--arch/arm/mach-shark/Makefile.boot2
-rw-r--r--arch/arm/mach-shark/core.c146
-rw-r--r--arch/arm/mach-shark/dma.c23
-rw-r--r--arch/arm/mach-shark/include/mach/debug-macro.S34
-rw-r--r--arch/arm/mach-shark/include/mach/entry-macro.S36
-rw-r--r--arch/arm/mach-shark/include/mach/framebuffer.h16
-rw-r--r--arch/arm/mach-shark/include/mach/hardware.h16
-rw-r--r--arch/arm/mach-shark/include/mach/irqs.h13
-rw-r--r--arch/arm/mach-shark/include/mach/isa-dma.h13
-rw-r--r--arch/arm/mach-shark/include/mach/memory.h26
-rw-r--r--arch/arm/mach-shark/include/mach/timex.h7
-rw-r--r--arch/arm/mach-shark/include/mach/uncompress.h50
-rw-r--r--arch/arm/mach-shark/irq.c108
-rw-r--r--arch/arm/mach-shark/leds.c117
-rw-r--r--arch/arm/mach-shark/pci.c57
-rw-r--r--arch/arm/mach-shmobile/Kconfig46
-rw-r--r--arch/arm/mach-shmobile/Makefile14
-rw-r--r--arch/arm/mach-shmobile/Makefile.boot3
-rw-r--r--arch/arm/mach-shmobile/board-ape6evm-reference.c2
-rw-r--r--arch/arm/mach-shmobile/board-ape6evm.c61
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c5
-rw-r--r--arch/arm/mach-shmobile/board-bockw-reference.c20
-rw-r--r--arch/arm/mach-shmobile/board-bockw.c418
-rw-r--r--arch/arm/mach-shmobile/board-genmai.c43
-rw-r--r--arch/arm/mach-shmobile/board-koelsch.c47
-rw-r--r--arch/arm/mach-shmobile/board-kzm9d-reference.c1
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c1
-rw-r--r--arch/arm/mach-shmobile/board-lager-reference.c5
-rw-r--r--arch/arm/mach-shmobile/board-lager.c114
-rw-r--r--arch/arm/mach-shmobile/board-marzen-reference.c1
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c74
-rw-r--r--arch/arm/mach-shmobile/clock-r7s72100.c202
-rw-r--r--arch/arm/mach-shmobile/clock-r8a73a4.c7
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7778.c44
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c2
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7790.c24
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7791.c237
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c2
-rw-r--r--arch/arm/mach-shmobile/headsmp.S3
-rw-r--r--arch/arm/mach-shmobile/include/mach/common.h12
-rw-r--r--arch/arm/mach-shmobile/include/mach/r7s72100.h8
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a73a4.h11
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7778.h14
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7779.h8
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7790.h9
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7791.h10
-rw-r--r--arch/arm/mach-shmobile/include/mach/rcar-gen2.h8
-rw-r--r--arch/arm/mach-shmobile/platsmp-apmu.c195
-rw-r--r--arch/arm/mach-shmobile/platsmp-scu.c30
-rw-r--r--arch/arm/mach-shmobile/platsmp.c22
-rw-r--r--arch/arm/mach-shmobile/setup-r7s72100.c88
-rw-r--r--arch/arm/mach-shmobile/setup-r8a73a4.c95
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7778.c178
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c160
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7790.c94
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7791.c184
-rw-r--r--arch/arm/mach-shmobile/setup-rcar-gen2.c91
-rw-r--r--arch/arm/mach-shmobile/smp-emev2.c6
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c4
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7790.c67
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7791.c62
-rw-r--r--arch/arm/mach-shmobile/smp-sh73a0.c14
-rw-r--r--arch/arm/mach-socfpga/Kconfig1
-rw-r--r--arch/arm/mach-socfpga/socfpga.c2
-rw-r--r--arch/arm/mach-spear/Kconfig2
-rw-r--r--arch/arm/mach-sti/board-dt.c10
-rw-r--r--arch/arm/mach-sunxi/Kconfig6
-rw-r--r--arch/arm/mach-sunxi/sunxi.c45
-rw-r--r--arch/arm/mach-tegra/Kconfig14
-rw-r--r--arch/arm/mach-tegra/Makefile6
-rw-r--r--arch/arm/mach-tegra/apbio.c2
-rw-r--r--arch/arm/mach-tegra/board-paz00.c5
-rw-r--r--arch/arm/mach-tegra/board-paz00.h25
-rw-r--r--arch/arm/mach-tegra/board.h12
-rw-r--r--arch/arm/mach-tegra/common.c115
-rw-r--r--arch/arm/mach-tegra/cpuidle.c4
-rw-r--r--arch/arm/mach-tegra/flowctrl.c2
-rw-r--r--arch/arm/mach-tegra/fuse.c56
-rw-r--r--arch/arm/mach-tegra/fuse.h1
-rw-r--r--arch/arm/mach-tegra/gpio-names.h247
-rw-r--r--arch/arm/mach-tegra/hotplug.c2
-rw-r--r--arch/arm/mach-tegra/iomap.h155
-rw-r--r--arch/arm/mach-tegra/irammap.h6
-rw-r--r--arch/arm/mach-tegra/platsmp.c2
-rw-r--r--arch/arm/mach-tegra/pm.c20
-rw-r--r--arch/arm/mach-tegra/pm.h3
-rw-r--r--arch/arm/mach-tegra/pmc.c58
-rw-r--r--arch/arm/mach-tegra/pmc.h5
-rw-r--r--arch/arm/mach-tegra/powergate.c48
-rw-r--r--arch/arm/mach-tegra/reset-handler.S13
-rw-r--r--arch/arm/mach-tegra/reset.c2
-rw-r--r--arch/arm/mach-tegra/sleep-tegra20.S5
-rw-r--r--arch/arm/mach-tegra/sleep-tegra30.S54
-rw-r--r--arch/arm/mach-tegra/tegra.c73
-rw-r--r--arch/arm/mach-u300/Kconfig11
-rw-r--r--arch/arm/mach-u300/timer.c9
-rw-r--r--arch/arm/mach-ux500/Kconfig30
-rw-r--r--arch/arm/mach-ux500/Makefile5
-rw-r--r--arch/arm/mach-ux500/board-mop500-audio.c50
-rw-r--r--arch/arm/mach-ux500/board-mop500-sdi.c51
-rw-r--r--arch/arm/mach-ux500/board-mop500-stuib.c120
-rw-r--r--arch/arm/mach-ux500/board-mop500-u8500uib.c92
-rw-r--r--arch/arm/mach-ux500/board-mop500-uib.c133
-rw-r--r--arch/arm/mach-ux500/board-mop500.c637
-rw-r--r--arch/arm/mach-ux500/board-mop500.h16
-rw-r--r--arch/arm/mach-ux500/cache-l2x0.c1
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c124
-rw-r--r--arch/arm/mach-ux500/cpu.c19
-rw-r--r--arch/arm/mach-ux500/devices-common.c60
-rw-r--r--arch/arm/mach-ux500/devices-common.h149
-rw-r--r--arch/arm/mach-ux500/devices-db8500.c94
-rw-r--r--arch/arm/mach-ux500/devices-db8500.h110
-rw-r--r--arch/arm/mach-ux500/devices.h8
-rw-r--r--arch/arm/mach-ux500/setup.h1
-rw-r--r--arch/arm/mach-ux500/timer.c4
-rw-r--r--arch/arm/mach-ux500/usb.c135
-rw-r--r--arch/arm/mach-vexpress/Kconfig15
-rw-r--r--arch/arm/mach-vexpress/Makefile3
-rw-r--r--arch/arm/mach-vexpress/dcscb.c56
-rw-r--r--arch/arm/mach-vexpress/spc.c366
-rw-r--r--arch/arm/mach-vexpress/spc.h2
-rw-r--r--arch/arm/mach-vexpress/tc2_pm.c66
-rw-r--r--arch/arm/mach-vexpress/v2m.c14
-rw-r--r--arch/arm/mach-vt8500/Kconfig1
-rw-r--r--arch/arm/mach-vt8500/common.h24
-rw-r--r--arch/arm/mach-vt8500/vt8500.c6
-rw-r--r--arch/arm/mach-w90x900/include/mach/gpio.h30
-rw-r--r--arch/arm/mach-zynq/Kconfig1
-rw-r--r--arch/arm/mach-zynq/common.c6
-rw-r--r--arch/arm/mm/Kconfig6
-rw-r--r--arch/arm/mm/abort-ev6.S5
-rw-r--r--arch/arm/mm/alignment.c9
-rw-r--r--arch/arm/mm/dma-mapping.c98
-rw-r--r--arch/arm/mm/extable.c7
-rw-r--r--arch/arm/mm/fault-armv.c6
-rw-r--r--arch/arm/mm/idmap.c8
-rw-r--r--arch/arm/mm/init.c28
-rw-r--r--arch/arm/mm/mm.h2
-rw-r--r--arch/arm/mm/mmap.c6
-rw-r--r--arch/arm/mm/mmu.c82
-rw-r--r--arch/arm/mm/nommu.c9
-rw-r--r--arch/arm/mm/proc-v6.S4
-rw-r--r--arch/arm/mm/proc-v7.S4
-rw-r--r--arch/arm/net/bpf_jit_32.c7
-rw-r--r--arch/arm/plat-iop/Makefile2
-rw-r--r--arch/arm/plat-iop/gpio.c93
-rw-r--r--arch/arm/plat-omap/dma.c1
-rw-r--r--arch/arm/plat-samsung/Kconfig10
-rw-r--r--arch/arm/plat-samsung/Makefile1
-rw-r--r--arch/arm/plat-samsung/devs.c39
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu.h4
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h1
-rw-r--r--arch/arm/plat-samsung/init.c12
-rw-r--r--arch/arm/plat-samsung/setup-mipiphy.c60
-rw-r--r--arch/arm/plat-versatile/headsmp.S2
-rw-r--r--arch/arm/vfp/vfpmodule.c6
-rw-r--r--arch/arm/xen/Makefile2
-rw-r--r--arch/arm/xen/mm.c65
-rw-r--r--arch/arm/xen/p2m.c208
-rw-r--r--arch/arm64/Kconfig20
-rw-r--r--arch/arm64/Kconfig.debug7
-rw-r--r--arch/arm64/Makefile6
-rw-r--r--arch/arm64/boot/dts/apm-storm.dtsi75
-rw-r--r--arch/arm64/configs/defconfig7
-rw-r--r--arch/arm64/include/asm/Kbuild1
-rw-r--r--arch/arm64/include/asm/arch_timer.h42
-rw-r--r--arch/arm64/include/asm/assembler.h31
-rw-r--r--arch/arm64/include/asm/atomic.h14
-rw-r--r--arch/arm64/include/asm/cmpxchg.h2
-rw-r--r--arch/arm64/include/asm/compat.h14
-rw-r--r--arch/arm64/include/asm/cpu_ops.h59
-rw-r--r--arch/arm64/include/asm/dma-mapping.h14
-rw-r--r--arch/arm64/include/asm/elf.h18
-rw-r--r--arch/arm64/include/asm/hwcap.h13
-rw-r--r--arch/arm64/include/asm/io.h12
-rw-r--r--arch/arm64/include/asm/irq.h1
-rw-r--r--arch/arm64/include/asm/kvm_arm.h8
-rw-r--r--arch/arm64/include/asm/kvm_emulate.h61
-rw-r--r--arch/arm64/include/asm/kvm_host.h6
-rw-r--r--arch/arm64/include/asm/kvm_mmu.h12
-rw-r--r--arch/arm64/include/asm/memory.h11
-rw-r--r--arch/arm64/include/asm/pgalloc.h9
-rw-r--r--arch/arm64/include/asm/pgtable-2level-hwdef.h4
-rw-r--r--arch/arm64/include/asm/pgtable-hwdef.h2
-rw-r--r--arch/arm64/include/asm/pgtable.h2
-rw-r--r--arch/arm64/include/asm/processor.h5
-rw-r--r--arch/arm64/include/asm/prom.h1
-rw-r--r--arch/arm64/include/asm/psci.h19
-rw-r--r--arch/arm64/include/asm/ptrace.h1
-rw-r--r--arch/arm64/include/asm/smp.h15
-rw-r--r--arch/arm64/include/asm/spinlock.h83
-rw-r--r--arch/arm64/include/asm/spinlock_types.h15
-rw-r--r--arch/arm64/include/asm/syscall.h6
-rw-r--r--arch/arm64/include/asm/uaccess.h10
-rw-r--r--arch/arm64/include/asm/virt.h3
-rw-r--r--arch/arm64/include/asm/xen/page-coherent.h47
-rw-r--r--arch/arm64/include/uapi/asm/byteorder.h4
-rw-r--r--arch/arm64/include/uapi/asm/hwcap.h1
-rw-r--r--arch/arm64/kernel/Makefile4
-rw-r--r--arch/arm64/kernel/arm64ksyms.c1
-rw-r--r--arch/arm64/kernel/cpu_ops.c87
-rw-r--r--arch/arm64/kernel/cputable.c2
-rw-r--r--arch/arm64/kernel/debug-monitors.c13
-rw-r--r--arch/arm64/kernel/entry.S22
-rw-r--r--arch/arm64/kernel/fpsimd.c2
-rw-r--r--arch/arm64/kernel/head.S61
-rw-r--r--arch/arm64/kernel/hw_breakpoint.c22
-rw-r--r--arch/arm64/kernel/irq.c61
-rw-r--r--arch/arm64/kernel/kuser32.S57
-rw-r--r--arch/arm64/kernel/module.c7
-rw-r--r--arch/arm64/kernel/perf_event.c11
-rw-r--r--arch/arm64/kernel/process.c28
-rw-r--r--arch/arm64/kernel/psci.c87
-rw-r--r--arch/arm64/kernel/setup.c82
-rw-r--r--arch/arm64/kernel/signal32.c39
-rw-r--r--arch/arm64/kernel/smp.c214
-rw-r--r--arch/arm64/kernel/smp_psci.c53
-rw-r--r--arch/arm64/kernel/smp_spin_table.c97
-rw-r--r--arch/arm64/kernel/sys32.S22
-rw-r--r--arch/arm64/kernel/time.c10
-rw-r--r--arch/arm64/kernel/vdso.c5
-rw-r--r--arch/arm64/kernel/vmlinux.lds.S32
-rw-r--r--arch/arm64/kvm/Kconfig1
-rw-r--r--arch/arm64/kvm/guest.c20
-rw-r--r--arch/arm64/kvm/handle_exit.c18
-rw-r--r--arch/arm64/kvm/hyp-init.S5
-rw-r--r--arch/arm64/kvm/hyp.S13
-rw-r--r--arch/arm64/mm/fault.c2
-rw-r--r--arch/arm64/mm/init.c25
-rw-r--r--arch/arm64/mm/ioremap.c20
-rw-r--r--arch/arm64/mm/proc.S4
-rw-r--r--arch/arm64/mm/tlb.S2
-rw-r--r--arch/arm64/xen/Makefile2
-rw-r--r--arch/avr32/boards/atngw100/evklcd10x.c8
-rw-r--r--arch/avr32/boards/atngw100/mrmt.c4
-rw-r--r--arch/avr32/boards/atstk1000/atstk1000.h2
-rw-r--r--arch/avr32/boards/atstk1000/setup.c2
-rw-r--r--arch/avr32/boards/favr-32/setup.c2
-rw-r--r--arch/avr32/boards/hammerhead/setup.c2
-rw-r--r--arch/avr32/boards/merisc/display.c2
-rw-r--r--arch/avr32/boards/mimc200/setup.c4
-rw-r--r--arch/avr32/include/asm/Kbuild17
-rw-r--r--arch/avr32/include/asm/cputime.h6
-rw-r--r--arch/avr32/include/asm/delay.h1
-rw-r--r--arch/avr32/include/asm/device.h7
-rw-r--r--arch/avr32/include/asm/div64.h6
-rw-r--r--arch/avr32/include/asm/emergency-restart.h6
-rw-r--r--arch/avr32/include/asm/futex.h6
-rw-r--r--arch/avr32/include/asm/irq_regs.h1
-rw-r--r--arch/avr32/include/asm/local.h6
-rw-r--r--arch/avr32/include/asm/local64.h1
-rw-r--r--arch/avr32/include/asm/percpu.h6
-rw-r--r--arch/avr32/include/asm/pgalloc.h5
-rw-r--r--arch/avr32/include/asm/scatterlist.h6
-rw-r--r--arch/avr32/include/asm/sections.h6
-rw-r--r--arch/avr32/include/asm/topology.h6
-rw-r--r--arch/avr32/include/asm/xor.h6
-rw-r--r--arch/avr32/include/uapi/asm/socket.h2
-rw-r--r--arch/avr32/kernel/process.c2
-rw-r--r--arch/avr32/kernel/time.c9
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c8
-rw-r--r--arch/avr32/mach-at32ap/include/mach/board.h4
-rw-r--r--arch/blackfin/Kconfig13
-rw-r--r--arch/blackfin/include/asm/Kbuild1
-rw-r--r--arch/blackfin/include/asm/gpio.h157
-rw-r--r--arch/blackfin/include/asm/portmux.h19
-rw-r--r--arch/blackfin/kernel/Makefile3
-rw-r--r--arch/blackfin/mach-bf548/include/mach/portmux.h2
-rw-r--r--arch/blackfin/mach-bf609/include/mach/portmux.h2
-rw-r--r--arch/c6x/include/asm/Kbuild1
-rw-r--r--arch/c6x/include/asm/prom.h1
-rw-r--r--arch/c6x/include/asm/setup.h2
-rw-r--r--arch/c6x/kernel/devicetree.c29
-rw-r--r--arch/c6x/kernel/setup.c13
-rw-r--r--arch/c6x/kernel/vmlinux.lds.S6
-rw-r--r--arch/cris/Kconfig2
-rw-r--r--arch/cris/include/asm/Kbuild1
-rw-r--r--arch/cris/include/asm/io.h1
-rw-r--r--arch/cris/include/asm/pci.h1
-rw-r--r--arch/cris/include/asm/pgalloc.h7
-rw-r--r--arch/cris/include/uapi/asm/socket.h2
-rw-r--r--arch/frv/include/asm/Kbuild1
-rw-r--r--arch/frv/include/uapi/asm/socket.h2
-rw-r--r--arch/frv/mb93090-mb00/pci-frv.h1
-rw-r--r--arch/frv/mb93090-mb00/pci-vdk.c36
-rw-r--r--arch/frv/mm/pgalloc.c12
-rw-r--r--arch/h8300/Kconfig108
-rw-r--r--arch/h8300/Kconfig.cpu171
-rw-r--r--arch/h8300/Kconfig.debug68
-rw-r--r--arch/h8300/Kconfig.ide44
-rw-r--r--arch/h8300/Makefile71
-rw-r--r--arch/h8300/README38
-rw-r--r--arch/h8300/boot/Makefile22
-rw-r--r--arch/h8300/boot/compressed/Makefile37
-rw-r--r--arch/h8300/boot/compressed/head.S47
-rw-r--r--arch/h8300/boot/compressed/misc.c180
-rw-r--r--arch/h8300/boot/compressed/vmlinux.lds32
-rw-r--r--arch/h8300/boot/compressed/vmlinux.scr9
-rw-r--r--arch/h8300/defconfig42
-rw-r--r--arch/h8300/include/asm/Kbuild8
-rw-r--r--arch/h8300/include/asm/asm-offsets.h1
-rw-r--r--arch/h8300/include/asm/atomic.h146
-rw-r--r--arch/h8300/include/asm/barrier.h29
-rw-r--r--arch/h8300/include/asm/bitops.h211
-rw-r--r--arch/h8300/include/asm/bootinfo.h2
-rw-r--r--arch/h8300/include/asm/bug.h12
-rw-r--r--arch/h8300/include/asm/bugs.h16
-rw-r--r--arch/h8300/include/asm/cache.h13
-rw-r--r--arch/h8300/include/asm/cachectl.h14
-rw-r--r--arch/h8300/include/asm/cacheflush.h40
-rw-r--r--arch/h8300/include/asm/checksum.h102
-rw-r--r--arch/h8300/include/asm/cmpxchg.h60
-rw-r--r--arch/h8300/include/asm/cputime.h6
-rw-r--r--arch/h8300/include/asm/current.h25
-rw-r--r--arch/h8300/include/asm/dbg.h2
-rw-r--r--arch/h8300/include/asm/delay.h38
-rw-r--r--arch/h8300/include/asm/device.h7
-rw-r--r--arch/h8300/include/asm/div64.h1
-rw-r--r--arch/h8300/include/asm/dma.h15
-rw-r--r--arch/h8300/include/asm/elf.h101
-rw-r--r--arch/h8300/include/asm/emergency-restart.h6
-rw-r--r--arch/h8300/include/asm/fb.h12
-rw-r--r--arch/h8300/include/asm/flat.h26
-rw-r--r--arch/h8300/include/asm/fpu.h1
-rw-r--r--arch/h8300/include/asm/ftrace.h1
-rw-r--r--arch/h8300/include/asm/futex.h6
-rw-r--r--arch/h8300/include/asm/gpio-internal.h52
-rw-r--r--arch/h8300/include/asm/hardirq.h19
-rw-r--r--arch/h8300/include/asm/hw_irq.h1
-rw-r--r--arch/h8300/include/asm/io.h358
-rw-r--r--arch/h8300/include/asm/irq.h49
-rw-r--r--arch/h8300/include/asm/irq_regs.h1
-rw-r--r--arch/h8300/include/asm/irqflags.h43
-rw-r--r--arch/h8300/include/asm/kdebug.h1
-rw-r--r--arch/h8300/include/asm/kmap_types.h6
-rw-r--r--arch/h8300/include/asm/local.h6
-rw-r--r--arch/h8300/include/asm/local64.h1
-rw-r--r--arch/h8300/include/asm/mc146818rtc.h9
-rw-r--r--arch/h8300/include/asm/mmu_context.h32
-rw-r--r--arch/h8300/include/asm/mutex.h9
-rw-r--r--arch/h8300/include/asm/page.h78
-rw-r--r--arch/h8300/include/asm/page_offset.h3
-rw-r--r--arch/h8300/include/asm/param.h9
-rw-r--r--arch/h8300/include/asm/pci.h19
-rw-r--r--arch/h8300/include/asm/percpu.h6
-rw-r--r--arch/h8300/include/asm/pgalloc.h8
-rw-r--r--arch/h8300/include/asm/pgtable.h73
-rw-r--r--arch/h8300/include/asm/processor.h139
-rw-r--r--arch/h8300/include/asm/ptrace.h33
-rw-r--r--arch/h8300/include/asm/regs267x.h336
-rw-r--r--arch/h8300/include/asm/regs306x.h212
-rw-r--r--arch/h8300/include/asm/scatterlist.h6
-rw-r--r--arch/h8300/include/asm/sections.h6
-rw-r--r--arch/h8300/include/asm/segment.h49
-rw-r--r--arch/h8300/include/asm/sh_bios.h29
-rw-r--r--arch/h8300/include/asm/shm.h31
-rw-r--r--arch/h8300/include/asm/shmparam.h6
-rw-r--r--arch/h8300/include/asm/signal.h24
-rw-r--r--arch/h8300/include/asm/smp.h1
-rw-r--r--arch/h8300/include/asm/spinlock.h6
-rw-r--r--arch/h8300/include/asm/string.h44
-rw-r--r--arch/h8300/include/asm/switch_to.h50
-rw-r--r--arch/h8300/include/asm/target_time.h4
-rw-r--r--arch/h8300/include/asm/termios.h50
-rw-r--r--arch/h8300/include/asm/thread_info.h103
-rw-r--r--arch/h8300/include/asm/timer.h25
-rw-r--r--arch/h8300/include/asm/timex.h19
-rw-r--r--arch/h8300/include/asm/tlb.h8
-rw-r--r--arch/h8300/include/asm/tlbflush.h55
-rw-r--r--arch/h8300/include/asm/topology.h6
-rw-r--r--arch/h8300/include/asm/traps.h37
-rw-r--r--arch/h8300/include/asm/types.h9
-rw-r--r--arch/h8300/include/asm/uaccess.h163
-rw-r--r--arch/h8300/include/asm/ucontext.h12
-rw-r--r--arch/h8300/include/asm/unaligned.h11
-rw-r--r--arch/h8300/include/asm/unistd.h36
-rw-r--r--arch/h8300/include/asm/user.h75
-rw-r--r--arch/h8300/include/asm/virtconvert.h20
-rw-r--r--arch/h8300/include/uapi/asm/Kbuild34
-rw-r--r--arch/h8300/include/uapi/asm/auxvec.h4
-rw-r--r--arch/h8300/include/uapi/asm/bitsperlong.h1
-rw-r--r--arch/h8300/include/uapi/asm/byteorder.h6
-rw-r--r--arch/h8300/include/uapi/asm/errno.h6
-rw-r--r--arch/h8300/include/uapi/asm/fcntl.h11
-rw-r--r--arch/h8300/include/uapi/asm/ioctl.h1
-rw-r--r--arch/h8300/include/uapi/asm/ioctls.h8
-rw-r--r--arch/h8300/include/uapi/asm/ipcbuf.h1
-rw-r--r--arch/h8300/include/uapi/asm/kvm_para.h1
-rw-r--r--arch/h8300/include/uapi/asm/mman.h1
-rw-r--r--arch/h8300/include/uapi/asm/msgbuf.h31
-rw-r--r--arch/h8300/include/uapi/asm/param.h16
-rw-r--r--arch/h8300/include/uapi/asm/poll.h11
-rw-r--r--arch/h8300/include/uapi/asm/posix_types.h26
-rw-r--r--arch/h8300/include/uapi/asm/ptrace.h44
-rw-r--r--arch/h8300/include/uapi/asm/resource.h6
-rw-r--r--arch/h8300/include/uapi/asm/sembuf.h25
-rw-r--r--arch/h8300/include/uapi/asm/setup.h6
-rw-r--r--arch/h8300/include/uapi/asm/shmbuf.h42
-rw-r--r--arch/h8300/include/uapi/asm/sigcontext.h18
-rw-r--r--arch/h8300/include/uapi/asm/siginfo.h6
-rw-r--r--arch/h8300/include/uapi/asm/signal.h115
-rw-r--r--arch/h8300/include/uapi/asm/socket.h79
-rw-r--r--arch/h8300/include/uapi/asm/sockios.h13
-rw-r--r--arch/h8300/include/uapi/asm/stat.h78
-rw-r--r--arch/h8300/include/uapi/asm/statfs.h6
-rw-r--r--arch/h8300/include/uapi/asm/swab.h10
-rw-r--r--arch/h8300/include/uapi/asm/termbits.h201
-rw-r--r--arch/h8300/include/uapi/asm/termios.h44
-rw-r--r--arch/h8300/include/uapi/asm/types.h1
-rw-r--r--arch/h8300/include/uapi/asm/unistd.h330
-rw-r--r--arch/h8300/kernel/Makefile12
-rw-r--r--arch/h8300/kernel/asm-offsets.c60
-rw-r--r--arch/h8300/kernel/entry.S402
-rw-r--r--arch/h8300/kernel/gpio.c178
-rw-r--r--arch/h8300/kernel/h8300_ksyms.c100
-rw-r--r--arch/h8300/kernel/irq.c165
-rw-r--r--arch/h8300/kernel/module.c75
-rw-r--r--arch/h8300/kernel/process.c154
-rw-r--r--arch/h8300/kernel/ptrace.c168
-rw-r--r--arch/h8300/kernel/setup.c242
-rw-r--r--arch/h8300/kernel/signal.c444
-rw-r--r--arch/h8300/kernel/sys_h8300.c48
-rw-r--r--arch/h8300/kernel/syscalls.S338
-rw-r--r--arch/h8300/kernel/time.c66
-rw-r--r--arch/h8300/kernel/timer/Makefile6
-rw-r--r--arch/h8300/kernel/timer/itu.c82
-rw-r--r--arch/h8300/kernel/timer/timer16.c77
-rw-r--r--arch/h8300/kernel/timer/timer8.c102
-rw-r--r--arch/h8300/kernel/timer/tpu.c100
-rw-r--r--arch/h8300/kernel/traps.c166
-rw-r--r--arch/h8300/kernel/vmlinux.lds.S157
-rw-r--r--arch/h8300/lib/Makefile5
-rw-r--r--arch/h8300/lib/abs.S21
-rw-r--r--arch/h8300/lib/ashrdi3.c63
-rw-r--r--arch/h8300/lib/checksum.c164
-rw-r--r--arch/h8300/lib/memcpy.S84
-rw-r--r--arch/h8300/lib/memset.S61
-rw-r--r--arch/h8300/lib/romfs.S57
-rw-r--r--arch/h8300/mm/Makefile5
-rw-r--r--arch/h8300/mm/fault.c56
-rw-r--r--arch/h8300/mm/init.c155
-rw-r--r--arch/h8300/mm/kmap.c58
-rw-r--r--arch/h8300/mm/memory.c54
-rw-r--r--arch/h8300/platform/h8300h/Makefile7
-rw-r--r--arch/h8300/platform/h8300h/aki3068net/Makefile5
-rw-r--r--arch/h8300/platform/h8300h/aki3068net/crt0_ram.S110
-rw-r--r--arch/h8300/platform/h8300h/generic/Makefile5
-rw-r--r--arch/h8300/platform/h8300h/generic/crt0_ram.S107
-rw-r--r--arch/h8300/platform/h8300h/generic/crt0_rom.S122
-rw-r--r--arch/h8300/platform/h8300h/h8max/Makefile5
-rw-r--r--arch/h8300/platform/h8300h/h8max/crt0_ram.S110
-rw-r--r--arch/h8300/platform/h8300h/irq.c82
-rw-r--r--arch/h8300/platform/h8300h/ptrace_h8300h.c284
-rw-r--r--arch/h8300/platform/h8s/Makefile7
-rw-r--r--arch/h8300/platform/h8s/edosk2674/Makefile5
-rw-r--r--arch/h8300/platform/h8s/edosk2674/crt0_ram.S130
-rw-r--r--arch/h8300/platform/h8s/edosk2674/crt0_rom.S186
-rw-r--r--arch/h8300/platform/h8s/generic/Makefile5
-rw-r--r--arch/h8300/platform/h8s/generic/crt0_ram.S127
-rw-r--r--arch/h8300/platform/h8s/generic/crt0_rom.S128
-rw-r--r--arch/h8300/platform/h8s/irq.c104
-rw-r--r--arch/h8300/platform/h8s/ptrace_h8s.c84
-rw-r--r--arch/hexagon/Kconfig1
-rw-r--r--arch/hexagon/include/asm/Kbuild1
-rw-r--r--arch/hexagon/include/asm/pgalloc.h10
-rw-r--r--arch/hexagon/kernel/setup.c3
-rw-r--r--arch/ia64/Kconfig1
-rw-r--r--arch/ia64/include/asm/Kbuild1
-rw-r--r--arch/ia64/include/asm/io.h1
-rw-r--r--arch/ia64/include/asm/kvm_host.h6
-rw-r--r--arch/ia64/include/asm/pgalloc.h5
-rw-r--r--arch/ia64/include/asm/processor.h2
-rw-r--r--arch/ia64/include/asm/xen/page-coherent.h38
-rw-r--r--arch/ia64/include/uapi/asm/socket.h2
-rw-r--r--arch/ia64/kernel/acpi.c38
-rw-r--r--arch/ia64/kernel/efi.c54
-rw-r--r--arch/ia64/kernel/elfcore.c12
-rw-r--r--arch/ia64/kernel/setup.c1
-rw-r--r--arch/ia64/kernel/signal.c2
-rw-r--r--arch/ia64/kvm/kvm-ia64.c5
-rw-r--r--arch/ia64/mm/init.c4
-rw-r--r--arch/m32r/Kconfig1
-rw-r--r--arch/m32r/include/asm/Kbuild1
-rw-r--r--arch/m32r/include/asm/pgalloc.h7
-rw-r--r--arch/m32r/include/uapi/asm/socket.h2
-rw-r--r--arch/m68k/include/asm/Kbuild1
-rw-r--r--arch/m68k/include/asm/floppy.h2
-rw-r--r--arch/m68k/include/asm/mcf_pgalloc.h4
-rw-r--r--arch/m68k/include/asm/motorola_pgalloc.h8
-rw-r--r--arch/m68k/include/asm/sun3_pgalloc.h5
-rw-r--r--arch/m68k/include/asm/sun3xflop.h2
-rw-r--r--arch/m68k/include/asm/uaccess.h7
-rw-r--r--arch/m68k/platform/68000/timers.c2
-rw-r--r--arch/m68k/platform/68360/config.c2
-rw-r--r--arch/m68k/platform/coldfire/pit.c2
-rw-r--r--arch/m68k/platform/coldfire/sltimers.c4
-rw-r--r--arch/m68k/platform/coldfire/timers.c4
-rw-r--r--arch/metag/Kconfig1
-rw-r--r--arch/metag/include/asm/Kbuild1
-rw-r--r--arch/metag/include/asm/mach/arch.h2
-rw-r--r--arch/metag/include/asm/pgalloc.h8
-rw-r--r--arch/metag/include/asm/prom.h23
-rw-r--r--arch/metag/include/asm/setup.h1
-rw-r--r--arch/metag/include/asm/tbx.h19
-rw-r--r--arch/metag/include/asm/topology.h2
-rw-r--r--arch/metag/kernel/devtree.c83
-rw-r--r--arch/metag/kernel/dma.c4
-rw-r--r--arch/metag/kernel/irq.c52
-rw-r--r--arch/metag/kernel/setup.c13
-rw-r--r--arch/metag/kernel/traps.c5
-rw-r--r--arch/metag/mm/init.c11
-rw-r--r--arch/metag/mm/numa.c2
-rw-r--r--arch/metag/tbx/tbidefr.S2
-rw-r--r--arch/microblaze/Kconfig9
-rw-r--r--arch/microblaze/boot/dts/Makefile2
-rw-r--r--arch/microblaze/include/asm/Kbuild1
-rw-r--r--arch/microblaze/include/asm/pci.h2
-rw-r--r--arch/microblaze/include/asm/pgalloc.h12
-rw-r--r--arch/microblaze/include/asm/prom.h39
-rw-r--r--arch/microblaze/kernel/head.S2
-rw-r--r--arch/microblaze/kernel/hw_exception_handler.S4
-rw-r--r--arch/microblaze/kernel/prom.c32
-rw-r--r--arch/microblaze/kernel/setup.c3
-rw-r--r--arch/microblaze/kernel/sys_microblaze.c17
-rw-r--r--arch/microblaze/kernel/syscall_table.S2
-rw-r--r--arch/microblaze/kernel/timer.c3
-rw-r--r--arch/microblaze/mm/consistent.c7
-rw-r--r--arch/microblaze/pci/pci-common.c73
-rw-r--r--arch/mips/Kbuild.platforms1
-rw-r--r--arch/mips/Kconfig28
-rw-r--r--arch/mips/Kconfig.debug8
-rw-r--r--arch/mips/Makefile17
-rw-r--r--arch/mips/alchemy/board-mtx1.c2
-rw-r--r--arch/mips/alchemy/common/usb.c3
-rw-r--r--arch/mips/alchemy/devboards/db1235.c2
-rw-r--r--arch/mips/ath79/dev-common.c6
-rw-r--r--arch/mips/bcm47xx/Makefile1
-rw-r--r--arch/mips/bcm47xx/board.c309
-rw-r--r--arch/mips/bcm47xx/nvram.c20
-rw-r--r--arch/mips/bcm47xx/prom.c27
-rw-r--r--arch/mips/bcm47xx/setup.c2
-rw-r--r--arch/mips/bcm47xx/time.c23
-rw-r--r--arch/mips/bcm63xx/cpu.c4
-rw-r--r--arch/mips/boot/compressed/Makefile6
-rw-r--r--arch/mips/boot/compressed/decompress.c13
-rw-r--r--arch/mips/boot/compressed/ld.script5
l---------arch/mips/boot/dts/include/dt-bindings2
-rw-r--r--arch/mips/boot/ecoff.h1
-rw-r--r--arch/mips/cavium-octeon/csrc-octeon.c1
-rw-r--r--arch/mips/cavium-octeon/setup.c4
-rw-r--r--arch/mips/cobalt/Makefile1
-rw-r--r--arch/mips/cobalt/console.c20
-rw-r--r--arch/mips/cobalt/setup.c3
-rw-r--r--arch/mips/configs/powertv_defconfig136
-rw-r--r--arch/mips/dec/int-handler.S8
-rw-r--r--arch/mips/dec/ioasic-irq.c43
-rw-r--r--arch/mips/dec/prom/call_o32.S2
-rw-r--r--arch/mips/dec/prom/init.c3
-rw-r--r--arch/mips/dec/prom/memory.c2
-rw-r--r--arch/mips/dec/setup.c4
-rw-r--r--arch/mips/include/asm/Kbuild1
-rw-r--r--arch/mips/include/asm/addrspace.h4
-rw-r--r--arch/mips/include/asm/atomic.h2
-rw-r--r--arch/mips/include/asm/barrier.h6
-rw-r--r--arch/mips/include/asm/cacheops.h93
-rw-r--r--arch/mips/include/asm/cpu-features.h8
-rw-r--r--arch/mips/include/asm/cpu-info.h1
-rw-r--r--arch/mips/include/asm/cpu-type.h203
-rw-r--r--arch/mips/include/asm/cpu.h38
-rw-r--r--arch/mips/include/asm/dec/ioasic.h2
-rw-r--r--arch/mips/include/asm/dec/ioasic_addrs.h2
-rw-r--r--arch/mips/include/asm/dec/kn01.h12
-rw-r--r--arch/mips/include/asm/dec/kn02ca.h2
-rw-r--r--arch/mips/include/asm/dec/prom.h2
-rw-r--r--arch/mips/include/asm/elf.h1
-rw-r--r--arch/mips/include/asm/jump_label.h2
-rw-r--r--arch/mips/include/asm/kvm_host.h7
-rw-r--r--arch/mips/include/asm/mach-ath79/ar933x_uart_platform.h18
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1000.h4
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h110
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h2
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h12
-rw-r--r--arch/mips/include/asm/mach-dec/cpu-feature-overrides.h87
-rw-r--r--arch/mips/include/asm/mach-generic/dma-coherence.h10
-rw-r--r--arch/mips/include/asm/mach-ip22/cpu-feature-overrides.h2
-rw-r--r--arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h2
-rw-r--r--arch/mips/include/asm/mach-ip27/dma-coherence.h10
-rw-r--r--arch/mips/include/asm/mach-ip28/cpu-feature-overrides.h2
-rw-r--r--arch/mips/include/asm/mach-ip32/dma-coherence.h11
-rw-r--r--arch/mips/include/asm/mach-jazz/dma-coherence.h10
-rw-r--r--arch/mips/include/asm/mach-loongson/dma-coherence.h10
-rw-r--r--arch/mips/include/asm/mach-powertv/asic.h120
-rw-r--r--arch/mips/include/asm/mach-powertv/asic_reg_map.h90
-rw-r--r--arch/mips/include/asm/mach-powertv/asic_regs.h125
-rw-r--r--arch/mips/include/asm/mach-powertv/cpu-feature-overrides.h60
-rw-r--r--arch/mips/include/asm/mach-powertv/dma-coherence.h117
-rw-r--r--arch/mips/include/asm/mach-powertv/interrupts.h253
-rw-r--r--arch/mips/include/asm/mach-powertv/ioremap.h167
-rw-r--r--arch/mips/include/asm/mach-powertv/war.h27
-rw-r--r--arch/mips/include/asm/mips-boards/piix4.h78
-rw-r--r--arch/mips/include/asm/mipsregs.h7
-rw-r--r--arch/mips/include/asm/mmu_context.h22
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/xlp.h1
-rw-r--r--arch/mips/include/asm/pci.h12
-rw-r--r--arch/mips/include/asm/pgalloc.h9
-rw-r--r--arch/mips/include/asm/prom.h14
-rw-r--r--arch/mips/include/asm/ptrace.h14
-rw-r--r--arch/mips/include/asm/r4kcache.h41
-rw-r--r--arch/mips/include/asm/setup.h8
-rw-r--r--arch/mips/include/asm/stackframe.h24
-rw-r--r--arch/mips/include/asm/syscall.h116
-rw-r--r--arch/mips/include/asm/thread_info.h42
-rw-r--r--arch/mips/include/asm/time.h2
-rw-r--r--arch/mips/include/asm/timex.h33
-rw-r--r--arch/mips/include/asm/unistd.h7
-rw-r--r--arch/mips/include/asm/vga.h3
-rw-r--r--arch/mips/include/uapi/asm/errno.h2
-rw-r--r--arch/mips/include/uapi/asm/siginfo.h9
-rw-r--r--arch/mips/include/uapi/asm/socket.h2
-rw-r--r--arch/mips/kernel/Makefile3
-rw-r--r--arch/mips/kernel/cpu-probe.c90
-rw-r--r--arch/mips/kernel/csrc-powertv.c151
-rw-r--r--arch/mips/kernel/early_printk_8250.c66
-rw-r--r--arch/mips/kernel/ftrace.c33
-rw-r--r--arch/mips/kernel/genex.S14
-rw-r--r--arch/mips/kernel/idle.c3
-rw-r--r--arch/mips/kernel/irq_cpu.c2
-rw-r--r--arch/mips/kernel/module.c3
-rw-r--r--arch/mips/kernel/octeon_switch.S2
-rw-r--r--arch/mips/kernel/perf_event_mipsxx.c4
-rw-r--r--arch/mips/kernel/prom.c60
-rw-r--r--arch/mips/kernel/ptrace.c199
-rw-r--r--arch/mips/kernel/r2300_switch.S2
-rw-r--r--arch/mips/kernel/r4k_switch.S2
-rw-r--r--arch/mips/kernel/rtlx.c19
-rw-r--r--arch/mips/kernel/scall32-o32.S846
-rw-r--r--arch/mips/kernel/scall64-64.S3
-rw-r--r--arch/mips/kernel/scall64-n32.S1
-rw-r--r--arch/mips/kernel/scall64-o32.S10
-rw-r--r--arch/mips/kernel/setup.c19
-rw-r--r--arch/mips/kernel/signal32.c2
-rw-r--r--arch/mips/kernel/smp-bmips.c4
-rw-r--r--arch/mips/kernel/smp.c1
-rw-r--r--arch/mips/kernel/time.c1
-rw-r--r--arch/mips/kernel/traps.c41
-rw-r--r--arch/mips/kvm/kvm_mips.c5
-rw-r--r--arch/mips/lantiq/irq.c2
-rw-r--r--arch/mips/lantiq/prom.c1
-rw-r--r--arch/mips/lantiq/xway/sysctrl.c2
-rw-r--r--arch/mips/mm/c-octeon.c6
-rw-r--r--arch/mips/mm/c-r4k.c102
-rw-r--r--arch/mips/mm/dma-default.c17
-rw-r--r--arch/mips/mm/init.c5
-rw-r--r--arch/mips/mm/page.c1
-rw-r--r--arch/mips/mm/sc-mips.c3
-rw-r--r--arch/mips/mm/tlb-funcs.S2
-rw-r--r--arch/mips/mm/tlb-r4k.c38
-rw-r--r--arch/mips/mm/tlbex.c308
-rw-r--r--arch/mips/mti-malta/malta-int.c10
-rw-r--r--arch/mips/mti-malta/malta-time.c5
-rw-r--r--arch/mips/mti-sead3/sead3-setup.c2
-rw-r--r--arch/mips/mti-sead3/sead3-time.c3
-rw-r--r--arch/mips/netlogic/common/smp.c2
-rw-r--r--arch/mips/netlogic/xlp/dt.c18
-rw-r--r--arch/mips/netlogic/xlp/setup.c2
-rw-r--r--arch/mips/netlogic/xlr/fmn-config.c3
-rw-r--r--arch/mips/oprofile/common.c1
-rw-r--r--arch/mips/pci/fixup-lantiq.c13
-rw-r--r--arch/mips/pci/fixup-malta.c36
-rw-r--r--arch/mips/pci/pci-ar71xx.c3
-rw-r--r--arch/mips/pci/pci-ar724x.c9
-rw-r--r--arch/mips/pci/pci-bcm1480.c1
-rw-r--r--arch/mips/pci/pci-rt3883.c24
-rw-r--r--arch/mips/pci/pci.c50
-rw-r--r--arch/mips/powertv/Kconfig12
-rw-r--r--arch/mips/powertv/Makefile29
-rw-r--r--arch/mips/powertv/Platform7
-rw-r--r--arch/mips/powertv/asic/Makefile21
-rw-r--r--arch/mips/powertv/asic/asic-calliope.c101
-rw-r--r--arch/mips/powertv/asic/asic-cronus.c101
-rw-r--r--arch/mips/powertv/asic/asic-gaia.c96
-rw-r--r--arch/mips/powertv/asic/asic-zeus.c101
-rw-r--r--arch/mips/powertv/asic/asic_devices.c549
-rw-r--r--arch/mips/powertv/asic/asic_int.c125
-rw-r--r--arch/mips/powertv/asic/irq_asic.c115
-rw-r--r--arch/mips/powertv/asic/prealloc-calliope.c385
-rw-r--r--arch/mips/powertv/asic/prealloc-cronus.c340
-rw-r--r--arch/mips/powertv/asic/prealloc-cronuslite.c174
-rw-r--r--arch/mips/powertv/asic/prealloc-gaia.c589
-rw-r--r--arch/mips/powertv/asic/prealloc-zeus.c304
-rw-r--r--arch/mips/powertv/asic/prealloc.h70
-rw-r--r--arch/mips/powertv/init.c90
-rw-r--r--arch/mips/powertv/init.h28
-rw-r--r--arch/mips/powertv/ioremap.c136
-rw-r--r--arch/mips/powertv/memory.c353
-rw-r--r--arch/mips/powertv/pci/Makefile19
-rw-r--r--arch/mips/powertv/pci/fixup-powertv.c37
-rw-r--r--arch/mips/powertv/pci/powertv-pci.h31
-rw-r--r--arch/mips/powertv/powertv-clock.h26
-rw-r--r--arch/mips/powertv/powertv-usb.c404
-rw-r--r--arch/mips/powertv/powertv_setup.c319
-rw-r--r--arch/mips/powertv/reset.c35
-rw-r--r--arch/mips/powertv/reset.h26
-rw-r--r--arch/mips/powertv/time.c36
-rw-r--r--arch/mips/ralink/clk.c2
-rw-r--r--arch/mips/ralink/mt7620.c2
-rw-r--r--arch/mips/ralink/of.c3
-rw-r--r--arch/mips/ralink/rt305x.c2
-rw-r--r--arch/mips/ralink/timer.c2
-rw-r--r--arch/mips/sibyte/bcm1480/setup.c3
-rw-r--r--arch/mips/sibyte/sb1250/setup.c3
-rw-r--r--arch/mips/sni/setup.c3
-rw-r--r--arch/mn10300/Kconfig1
-rw-r--r--arch/mn10300/include/asm/Kbuild1
-rw-r--r--arch/mn10300/include/asm/pci.h1
-rw-r--r--arch/mn10300/include/asm/pgalloc.h1
-rw-r--r--arch/mn10300/include/uapi/asm/socket.h2
-rw-r--r--arch/mn10300/kernel/setup.c3
-rw-r--r--arch/mn10300/mm/pgtable.c9
-rw-r--r--arch/mn10300/unit-asb2305/pci-asb2305.h1
-rw-r--r--arch/mn10300/unit-asb2305/pci.c5
-rw-r--r--arch/openrisc/include/asm/Kbuild1
-rw-r--r--arch/openrisc/include/asm/pgalloc.h10
-rw-r--r--arch/openrisc/include/asm/prom.h66
-rw-r--r--arch/openrisc/kernel/prom.c70
-rw-r--r--arch/openrisc/kernel/setup.c6
-rw-r--r--arch/parisc/Kconfig4
-rw-r--r--arch/parisc/Makefile22
-rw-r--r--arch/parisc/configs/712_defconfig2
-rw-r--r--arch/parisc/configs/a500_defconfig2
-rw-r--r--arch/parisc/configs/b180_defconfig3
-rw-r--r--arch/parisc/configs/c3000_defconfig3
-rw-r--r--arch/parisc/configs/c8000_defconfig2
-rw-r--r--arch/parisc/configs/default_defconfig2
-rw-r--r--arch/parisc/configs/generic-32bit_defconfig328
-rw-r--r--arch/parisc/configs/generic-64bit_defconfig346
-rw-r--r--arch/parisc/include/asm/Kbuild1
-rw-r--r--arch/parisc/include/asm/assembly.h12
-rw-r--r--arch/parisc/include/asm/delay.h41
-rw-r--r--arch/parisc/include/asm/hardirq.h1
-rw-r--r--arch/parisc/include/asm/pgalloc.h8
-rw-r--r--arch/parisc/include/asm/ptrace.h4
-rw-r--r--arch/parisc/include/asm/thread_info.h4
-rw-r--r--arch/parisc/include/asm/traps.h2
-rw-r--r--arch/parisc/include/asm/uaccess.h53
-rw-r--r--arch/parisc/include/uapi/asm/errno.h2
-rw-r--r--arch/parisc/include/uapi/asm/socket.h2
-rw-r--r--arch/parisc/install.sh44
-rw-r--r--arch/parisc/kernel/Makefile4
-rw-r--r--arch/parisc/kernel/audit.c81
-rw-r--r--arch/parisc/kernel/compat_audit.c40
-rw-r--r--arch/parisc/kernel/head.S4
-rw-r--r--arch/parisc/kernel/irq.c21
-rw-r--r--arch/parisc/kernel/module.c2
-rw-r--r--arch/parisc/kernel/ptrace.c26
-rw-r--r--arch/parisc/kernel/setup.c8
-rw-r--r--arch/parisc/kernel/signal32.c2
-rw-r--r--arch/parisc/kernel/signal32.h2
-rw-r--r--arch/parisc/kernel/smp.c13
-rw-r--r--arch/parisc/kernel/syscall.S6
-rw-r--r--arch/parisc/kernel/traps.c11
-rw-r--r--arch/parisc/lib/Makefile2
-rw-r--r--arch/parisc/lib/delay.c73
-rw-r--r--arch/parisc/lib/lusercopy.S10
-rw-r--r--arch/parisc/lib/memcpy.c15
-rw-r--r--arch/parisc/math-emu/float.h1
-rw-r--r--arch/parisc/mm/fault.c42
-rw-r--r--arch/powerpc/Kconfig14
-rw-r--r--arch/powerpc/Makefile37
-rw-r--r--arch/powerpc/boot/Makefile7
-rw-r--r--arch/powerpc/boot/dts/b4860emu.dts218
-rw-r--r--arch/powerpc/boot/dts/b4qds.dtsi51
-rw-r--r--arch/powerpc/boot/dts/c293pcie.dts1
-rw-r--r--arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi2
-rw-r--r--arch/powerpc/boot/dts/fsl/b4860si-post.dtsi2
-rw-r--r--arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi2
-rw-r--r--arch/powerpc/boot/dts/fsl/bsc9131si-post.dtsi2
-rw-r--r--arch/powerpc/boot/dts/fsl/bsc9131si-pre.dtsi3
-rw-r--r--arch/powerpc/boot/dts/t4240emu.dts268
-rw-r--r--arch/powerpc/boot/dts/t4240qds.dts73
-rw-r--r--arch/powerpc/boot/epapr-wrapper.c9
-rw-r--r--arch/powerpc/boot/epapr.c4
-rw-r--r--arch/powerpc/boot/of.c16
-rwxr-xr-xarch/powerpc/boot/wrapper17
-rw-r--r--arch/powerpc/configs/corenet32_smp_defconfig7
-rw-r--r--arch/powerpc/configs/corenet64_smp_defconfig5
-rw-r--r--arch/powerpc/configs/mpc85xx_defconfig1
-rw-r--r--arch/powerpc/configs/mpc85xx_smp_defconfig1
-rw-r--r--arch/powerpc/configs/ppc64_defconfig27
-rw-r--r--arch/powerpc/configs/ppc64e_defconfig12
-rw-r--r--arch/powerpc/configs/ppc6xx_defconfig2
-rw-r--r--arch/powerpc/configs/pseries_defconfig25
-rw-r--r--arch/powerpc/include/asm/Kbuild1
-rw-r--r--arch/powerpc/include/asm/archrandom.h32
-rw-r--r--arch/powerpc/include/asm/checksum.h5
-rw-r--r--arch/powerpc/include/asm/disassemble.h4
-rw-r--r--arch/powerpc/include/asm/emulated_ops.h1
-rw-r--r--arch/powerpc/include/asm/exception-64s.h21
-rw-r--r--arch/powerpc/include/asm/fsl_ifc.h2
-rw-r--r--arch/powerpc/include/asm/hvsi.h16
-rw-r--r--arch/powerpc/include/asm/io.h69
-rw-r--r--arch/powerpc/include/asm/irq.h4
-rw-r--r--arch/powerpc/include/asm/jump_label.h2
-rw-r--r--arch/powerpc/include/asm/kvm_asm.h4
-rw-r--r--arch/powerpc/include/asm/kvm_book3s.h232
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_32.h2
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_64.h8
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_asm.h9
-rw-r--r--arch/powerpc/include/asm/kvm_booke.h7
-rw-r--r--arch/powerpc/include/asm/kvm_host.h57
-rw-r--r--arch/powerpc/include/asm/kvm_ppc.h107
-rw-r--r--arch/powerpc/include/asm/lppaca.h12
-rw-r--r--arch/powerpc/include/asm/machdep.h16
-rw-r--r--arch/powerpc/include/asm/mmu-hash64.h4
-rw-r--r--arch/powerpc/include/asm/opal.h109
-rw-r--r--arch/powerpc/include/asm/paca.h2
-rw-r--r--arch/powerpc/include/asm/page.h4
-rw-r--r--arch/powerpc/include/asm/pgalloc-64.h5
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h2
-rw-r--r--arch/powerpc/include/asm/ppc-opcode.h8
-rw-r--r--arch/powerpc/include/asm/ppc_asm.h142
-rw-r--r--arch/powerpc/include/asm/processor.h93
-rw-r--r--arch/powerpc/include/asm/prom.h36
-rw-r--r--arch/powerpc/include/asm/pte-book3e.h2
-rw-r--r--arch/powerpc/include/asm/reg.h22
-rw-r--r--arch/powerpc/include/asm/reg_booke.h8
-rw-r--r--arch/powerpc/include/asm/scom.h23
-rw-r--r--arch/powerpc/include/asm/setup.h4
-rw-r--r--arch/powerpc/include/asm/sfp-machine.h2
-rw-r--r--arch/powerpc/include/asm/spu.h3
-rw-r--r--arch/powerpc/include/asm/string.h4
-rw-r--r--arch/powerpc/include/asm/switch_to.h1
-rw-r--r--arch/powerpc/include/asm/uprobes.h8
-rw-r--r--arch/powerpc/include/asm/word-at-a-time.h78
-rw-r--r--arch/powerpc/include/asm/xor.h67
-rw-r--r--arch/powerpc/include/uapi/asm/byteorder.h4
-rw-r--r--arch/powerpc/include/uapi/asm/kvm.h86
-rw-r--r--arch/powerpc/include/uapi/asm/socket.h2
-rw-r--r--arch/powerpc/kernel/align.c173
-rw-r--r--arch/powerpc/kernel/asm-offsets.c53
-rw-r--r--arch/powerpc/kernel/eeh.c11
-rw-r--r--arch/powerpc/kernel/entry_64.S50
-rw-r--r--arch/powerpc/kernel/epapr_paravirt.c1
-rw-r--r--arch/powerpc/kernel/exceptions-64e.S6
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S30
-rw-r--r--arch/powerpc/kernel/fpu.S86
-rw-r--r--arch/powerpc/kernel/ftrace.c4
-rw-r--r--arch/powerpc/kernel/head_64.S3
-rw-r--r--arch/powerpc/kernel/head_8xx.S3
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S10
-rw-r--r--arch/powerpc/kernel/ibmebus.c14
-rw-r--r--arch/powerpc/kernel/idle_power7.S2
-rw-r--r--arch/powerpc/kernel/iommu.c2
-rw-r--r--arch/powerpc/kernel/irq.c118
-rw-r--r--arch/powerpc/kernel/kgdb.c6
-rw-r--r--arch/powerpc/kernel/legacy_serial.c2
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c2
-rw-r--r--arch/powerpc/kernel/misc_32.S39
-rw-r--r--arch/powerpc/kernel/misc_64.S10
-rw-r--r--arch/powerpc/kernel/module.c3
-rw-r--r--arch/powerpc/kernel/module_32.c3
-rw-r--r--arch/powerpc/kernel/module_64.c19
-rw-r--r--arch/powerpc/kernel/nvram_64.c10
-rw-r--r--arch/powerpc/kernel/paca.c6
-rw-r--r--arch/powerpc/kernel/pci-common.c11
-rw-r--r--arch/powerpc/kernel/pci_of_scan.c4
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c10
-rw-r--r--arch/powerpc/kernel/process.c70
-rw-r--r--arch/powerpc/kernel/prom.c40
-rw-r--r--arch/powerpc/kernel/prom_init.c49
-rw-r--r--arch/powerpc/kernel/ptrace.c209
-rw-r--r--arch/powerpc/kernel/ptrace32.c13
-rw-r--r--arch/powerpc/kernel/rtas_pci.c6
-rw-r--r--arch/powerpc/kernel/setup-common.c2
-rw-r--r--arch/powerpc/kernel/setup.h9
-rw-r--r--arch/powerpc/kernel/setup_32.c2
-rw-r--r--arch/powerpc/kernel/setup_64.c2
-rw-r--r--arch/powerpc/kernel/signal_32.c83
-rw-r--r--arch/powerpc/kernel/signal_64.c32
-rw-r--r--arch/powerpc/kernel/smp.c12
-rw-r--r--arch/powerpc/kernel/swsusp_asm64.S4
-rw-r--r--arch/powerpc/kernel/sysfs.c18
-rw-r--r--arch/powerpc/kernel/tm.S144
-rw-r--r--arch/powerpc/kernel/traps.c56
-rw-r--r--arch/powerpc/kernel/vdso.c3
-rw-r--r--arch/powerpc/kernel/vdso32/vdso32.lds.S4
-rw-r--r--arch/powerpc/kernel/vdso64/vdso64.lds.S4
-rw-r--r--arch/powerpc/kernel/vecemu.c6
-rw-r--r--arch/powerpc/kernel/vector.S80
-rw-r--r--arch/powerpc/kernel/vio.c81
-rw-r--r--arch/powerpc/kvm/44x.c58
-rw-r--r--arch/powerpc/kvm/44x_emulate.c8
-rw-r--r--arch/powerpc/kvm/44x_tlb.c2
-rw-r--r--arch/powerpc/kvm/Kconfig29
-rw-r--r--arch/powerpc/kvm/Makefile29
-rw-r--r--arch/powerpc/kvm/book3s.c257
-rw-r--r--arch/powerpc/kvm/book3s.h34
-rw-r--r--arch/powerpc/kvm/book3s_32_mmu.c73
-rw-r--r--arch/powerpc/kvm/book3s_32_mmu_host.c16
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu.c181
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_host.c106
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c24
-rw-r--r--arch/powerpc/kvm/book3s_64_vio_hv.c1
-rw-r--r--arch/powerpc/kvm/book3s_emulate.c18
-rw-r--r--arch/powerpc/kvm/book3s_exports.c5
-rw-r--r--arch/powerpc/kvm/book3s_hv.c389
-rw-r--r--arch/powerpc/kvm/book3s_hv_interrupts.S3
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S620
-rw-r--r--arch/powerpc/kvm/book3s_interrupts.S32
-rw-r--r--arch/powerpc/kvm/book3s_mmu_hpte.c66
-rw-r--r--arch/powerpc/kvm/book3s_pr.c534
-rw-r--r--arch/powerpc/kvm/book3s_pr_papr.c52
-rw-r--r--arch/powerpc/kvm/book3s_rmhandlers.S32
-rw-r--r--arch/powerpc/kvm/book3s_rtas.c1
-rw-r--r--arch/powerpc/kvm/book3s_segment.S4
-rw-r--r--arch/powerpc/kvm/book3s_xics.c7
-rw-r--r--arch/powerpc/kvm/booke.c356
-rw-r--r--arch/powerpc/kvm/booke.h29
-rw-r--r--arch/powerpc/kvm/e500.c59
-rw-r--r--arch/powerpc/kvm/e500.h2
-rw-r--r--arch/powerpc/kvm/e500_emulate.c34
-rw-r--r--arch/powerpc/kvm/e500_mmu.c4
-rw-r--r--arch/powerpc/kvm/e500_mmu_host.c24
-rw-r--r--arch/powerpc/kvm/e500mc.c58
-rw-r--r--arch/powerpc/kvm/emulate.c12
-rw-r--r--arch/powerpc/kvm/powerpc.c171
-rw-r--r--arch/powerpc/kvm/trace.h429
-rw-r--r--arch/powerpc/kvm/trace_booke.h177
-rw-r--r--arch/powerpc/kvm/trace_pr.h297
-rw-r--r--arch/powerpc/lib/Makefile21
-rw-r--r--arch/powerpc/lib/checksum_64.S58
-rw-r--r--arch/powerpc/lib/copyuser_power7.S54
-rw-r--r--arch/powerpc/lib/memcpy_power7.S55
-rw-r--r--arch/powerpc/lib/sstep.c100
-rw-r--r--arch/powerpc/lib/xor_vmx.c177
-rw-r--r--arch/powerpc/mm/dma-noncoherent.c4
-rw-r--r--arch/powerpc/mm/hash_native_64.c46
-rw-r--r--arch/powerpc/mm/hash_utils_64.c38
-rw-r--r--arch/powerpc/mm/hugetlbpage.c2
-rw-r--r--arch/powerpc/mm/init_32.c5
-rw-r--r--arch/powerpc/mm/init_64.c55
-rw-r--r--arch/powerpc/mm/mem.c9
-rw-r--r--arch/powerpc/mm/numa.c11
-rw-r--r--arch/powerpc/mm/pgtable.c19
-rw-r--r--arch/powerpc/mm/pgtable_32.c5
-rw-r--r--arch/powerpc/mm/pgtable_64.c7
-rw-r--r--arch/powerpc/net/bpf_jit.h11
-rw-r--r--arch/powerpc/net/bpf_jit_64.S9
-rw-r--r--arch/powerpc/net/bpf_jit_comp.c38
-rw-r--r--arch/powerpc/perf/power8-pmu.c5
-rw-r--r--arch/powerpc/platforms/512x/clock.c1
-rw-r--r--arch/powerpc/platforms/512x/mpc512x_shared.c18
-rw-r--r--arch/powerpc/platforms/512x/pdm360ng.c2
-rw-r--r--arch/powerpc/platforms/52xx/Kconfig2
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pic.c5
-rw-r--r--arch/powerpc/platforms/82xx/mpc8272_ads.c2
-rw-r--r--arch/powerpc/platforms/82xx/pq2fads.c2
-rw-r--r--arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c1
-rw-r--r--arch/powerpc/platforms/83xx/suspend.c2
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig101
-rw-r--r--arch/powerpc/platforms/85xx/Makefile8
-rw-r--r--arch/powerpc/platforms/85xx/b4_qds.c102
-rw-r--r--arch/powerpc/platforms/85xx/c293pcie.c1
-rw-r--r--arch/powerpc/platforms/85xx/common.c2
-rw-r--r--arch/powerpc/platforms/85xx/corenet_ds.c96
-rw-r--r--arch/powerpc/platforms/85xx/corenet_ds.h19
-rw-r--r--arch/powerpc/platforms/85xx/corenet_generic.c182
-rw-r--r--arch/powerpc/platforms/85xx/p1010rdb.c2
-rw-r--r--arch/powerpc/platforms/85xx/p2041_rdb.c87
-rw-r--r--arch/powerpc/platforms/85xx/p3041_ds.c89
-rw-r--r--arch/powerpc/platforms/85xx/p4080_ds.c87
-rw-r--r--arch/powerpc/platforms/85xx/p5020_ds.c93
-rw-r--r--arch/powerpc/platforms/85xx/p5040_ds.c84
-rw-r--r--arch/powerpc/platforms/85xx/ppa8548.c1
-rw-r--r--arch/powerpc/platforms/85xx/sgy_cts1000.c1
-rw-r--r--arch/powerpc/platforms/85xx/smp.c1
-rw-r--r--arch/powerpc/platforms/85xx/socrates_fpga_pic.c2
-rw-r--r--arch/powerpc/platforms/85xx/t4240_qds.c93
-rw-r--r--arch/powerpc/platforms/86xx/pic.c1
-rw-r--r--arch/powerpc/platforms/8xx/ep88xc.c2
-rw-r--r--arch/powerpc/platforms/8xx/mpc86xads_setup.c2
-rw-r--r--arch/powerpc/platforms/8xx/mpc885ads_setup.c2
-rw-r--r--arch/powerpc/platforms/8xx/tqm8xx_setup.c5
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype9
-rw-r--r--arch/powerpc/platforms/cell/celleb_scc_pciex.c6
-rw-r--r--arch/powerpc/platforms/cell/celleb_scc_sio.c7
-rw-r--r--arch/powerpc/platforms/cell/spider-pic.c7
-rw-r--r--arch/powerpc/platforms/cell/spu_manage.c13
-rw-r--r--arch/powerpc/platforms/cell/spu_syscalls.c5
-rw-r--r--arch/powerpc/platforms/cell/spufs/coredump.c89
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h3
-rw-r--r--arch/powerpc/platforms/chrp/nvram.c4
-rw-r--r--arch/powerpc/platforms/embedded6xx/flipper-pic.c1
-rw-r--r--arch/powerpc/platforms/embedded6xx/hlwd-pic.c3
-rw-r--r--arch/powerpc/platforms/fsl_uli1575.c12
-rw-r--r--arch/powerpc/platforms/pasemi/gpio_mdio.c1
-rw-r--r--arch/powerpc/platforms/powermac/low_i2c.c6
-rw-r--r--arch/powerpc/platforms/powermac/pfunc_base.c1
-rw-r--r--arch/powerpc/platforms/powermac/pic.c10
-rw-r--r--arch/powerpc/platforms/powernv/Kconfig2
-rw-r--r--arch/powerpc/platforms/powernv/Makefile4
-rw-r--r--arch/powerpc/platforms/powernv/eeh-ioda.c153
-rw-r--r--arch/powerpc/platforms/powernv/eeh-powernv.c5
-rw-r--r--arch/powerpc/platforms/powernv/opal-flash.c667
-rw-r--r--arch/powerpc/platforms/powernv/opal-lpc.c1
-rw-r--r--arch/powerpc/platforms/powernv/opal-nvram.c4
-rw-r--r--arch/powerpc/platforms/powernv/opal-rtc.c12
-rw-r--r--arch/powerpc/platforms/powernv/opal-wrappers.S16
-rw-r--r--arch/powerpc/platforms/powernv/opal-xscom.c128
-rw-r--r--arch/powerpc/platforms/powernv/opal.c58
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c110
-rw-r--r--arch/powerpc/platforms/powernv/pci-p5ioc2.c4
-rw-r--r--arch/powerpc/platforms/powernv/pci.c78
-rw-r--r--arch/powerpc/platforms/powernv/pci.h6
-rw-r--r--arch/powerpc/platforms/powernv/rng.c125
-rw-r--r--arch/powerpc/platforms/powernv/setup.c1
-rw-r--r--arch/powerpc/platforms/pseries/Makefile2
-rw-r--r--arch/powerpc/platforms/pseries/dlpar.c43
-rw-r--r--arch/powerpc/platforms/pseries/event_sources.c8
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c2
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c59
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c10
-rw-r--r--arch/powerpc/platforms/pseries/rng.c44
-rw-r--r--arch/powerpc/platforms/pseries/smp.c26
-rw-r--r--arch/powerpc/platforms/pseries/suspend.c2
-rw-r--r--arch/powerpc/platforms/wsp/scom_smp.c18
-rw-r--r--arch/powerpc/platforms/wsp/scom_wsp.c12
-rw-r--r--arch/powerpc/platforms/wsp/wsp.c13
-rw-r--r--arch/powerpc/sysdev/Kconfig2
-rw-r--r--arch/powerpc/sysdev/cpm_common.c1
-rw-r--r--arch/powerpc/sysdev/ehv_pic.c1
-rw-r--r--arch/powerpc/sysdev/fsl_gtm.c11
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c7
-rw-r--r--arch/powerpc/sysdev/fsl_pmc.c1
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c2
-rw-r--r--arch/powerpc/sysdev/fsl_rmu.c1
-rw-r--r--arch/powerpc/sysdev/fsl_soc.h3
-rw-r--r--arch/powerpc/sysdev/mpic.c16
-rw-r--r--arch/powerpc/sysdev/mpic_msgr.c6
-rw-r--r--arch/powerpc/sysdev/mpic_msi.c8
-rw-r--r--arch/powerpc/sysdev/mpic_timer.c2
-rw-r--r--arch/powerpc/sysdev/mv64x60_dev.c2
-rw-r--r--arch/powerpc/sysdev/of_rtc.c1
-rw-r--r--arch/powerpc/sysdev/ppc4xx_ocm.c1
-rw-r--r--arch/powerpc/sysdev/ppc4xx_soc.c1
-rw-r--r--arch/powerpc/sysdev/scom.c168
-rw-r--r--arch/powerpc/sysdev/xics/ics-opal.c17
-rw-r--r--arch/powerpc/sysdev/xilinx_intc.c2
-rw-r--r--arch/s390/Kconfig65
-rw-r--r--arch/s390/Makefile22
-rw-r--r--arch/s390/appldata/appldata_base.c18
-rw-r--r--arch/s390/configs/default_defconfig655
-rw-r--r--arch/s390/configs/gcov_defconfig618
-rw-r--r--arch/s390/configs/performance_defconfig610
-rw-r--r--arch/s390/configs/zfcpdump_defconfig86
-rw-r--r--arch/s390/crypto/aes_s390.c15
-rw-r--r--arch/s390/defconfig4
-rw-r--r--arch/s390/include/asm/Kbuild1
-rw-r--r--arch/s390/include/asm/atomic.h190
-rw-r--r--arch/s390/include/asm/bitops.h1008
-rw-r--r--arch/s390/include/asm/compat.h5
-rw-r--r--arch/s390/include/asm/ctl_reg.h112
-rw-r--r--arch/s390/include/asm/debug.h5
-rw-r--r--arch/s390/include/asm/dis.h52
-rw-r--r--arch/s390/include/asm/fcx.h38
-rw-r--r--arch/s390/include/asm/ipl.h10
-rw-r--r--arch/s390/include/asm/jump_label.h2
-rw-r--r--arch/s390/include/asm/kvm_host.h8
-rw-r--r--arch/s390/include/asm/mmu_context.h10
-rw-r--r--arch/s390/include/asm/mutex.h2
-rw-r--r--arch/s390/include/asm/page.h7
-rw-r--r--arch/s390/include/asm/pci_debug.h5
-rw-r--r--arch/s390/include/asm/pci_insn.h15
-rw-r--r--arch/s390/include/asm/percpu.h137
-rw-r--r--arch/s390/include/asm/pgtable.h4
-rw-r--r--arch/s390/include/asm/processor.h20
-rw-r--r--arch/s390/include/asm/ptrace.h7
-rw-r--r--arch/s390/include/asm/setup.h7
-rw-r--r--arch/s390/include/asm/smp.h1
-rw-r--r--arch/s390/include/asm/spinlock.h5
-rw-r--r--arch/s390/include/asm/switch_to.h124
-rw-r--r--arch/s390/include/asm/timex.h32
-rw-r--r--arch/s390/include/asm/uaccess.h18
-rw-r--r--arch/s390/include/uapi/asm/ptrace.h4
-rw-r--r--arch/s390/include/uapi/asm/sigcontext.h1
-rw-r--r--arch/s390/include/uapi/asm/socket.h2
-rw-r--r--arch/s390/kernel/Makefile2
-rw-r--r--arch/s390/kernel/bitmap.c54
-rw-r--r--arch/s390/kernel/cache.c5
-rw-r--r--arch/s390/kernel/compat_linux.c4
-rw-r--r--arch/s390/kernel/compat_linux.h1
-rw-r--r--arch/s390/kernel/compat_signal.c95
-rw-r--r--arch/s390/kernel/crash_dump.c75
-rw-r--r--arch/s390/kernel/debug.c4
-rw-r--r--arch/s390/kernel/dis.c81
-rw-r--r--arch/s390/kernel/dumpstack.c1
-rw-r--r--arch/s390/kernel/early.c2
-rw-r--r--arch/s390/kernel/entry.S1
-rw-r--r--arch/s390/kernel/entry.h1
-rw-r--r--arch/s390/kernel/entry64.S1
-rw-r--r--arch/s390/kernel/ftrace.c9
-rw-r--r--arch/s390/kernel/head.S2
-rw-r--r--arch/s390/kernel/ipl.c4
-rw-r--r--arch/s390/kernel/irq.c52
-rw-r--r--arch/s390/kernel/kprobes.c19
-rw-r--r--arch/s390/kernel/module.c2
-rw-r--r--arch/s390/kernel/pgm_check.S2
-rw-r--r--arch/s390/kernel/process.c15
-rw-r--r--arch/s390/kernel/ptrace.c70
-rw-r--r--arch/s390/kernel/runtime_instr.c2
-rw-r--r--arch/s390/kernel/setup.c59
-rw-r--r--arch/s390/kernel/signal.c49
-rw-r--r--arch/s390/kernel/smp.c21
-rw-r--r--arch/s390/kernel/vdso.c9
-rw-r--r--arch/s390/kernel/vtime.c4
-rw-r--r--arch/s390/kvm/diag.c4
-rw-r--r--arch/s390/kvm/gaccess.h21
-rw-r--r--arch/s390/kvm/intercept.c6
-rw-r--r--arch/s390/kvm/interrupt.c9
-rw-r--r--arch/s390/kvm/kvm-s390.c119
-rw-r--r--arch/s390/kvm/kvm-s390.h9
-rw-r--r--arch/s390/kvm/priv.c61
-rw-r--r--arch/s390/kvm/trace.h1
-rw-r--r--arch/s390/lib/Makefile2
-rw-r--r--arch/s390/lib/delay.c14
-rw-r--r--arch/s390/lib/find.c77
-rw-r--r--arch/s390/lib/uaccess_mvcos.c30
-rw-r--r--arch/s390/lib/uaccess_pt.c2
-rw-r--r--arch/s390/lib/uaccess_std.c305
-rw-r--r--arch/s390/math-emu/math.c2
-rw-r--r--arch/s390/mm/cmm.c12
-rw-r--r--arch/s390/mm/fault.c46
-rw-r--r--arch/s390/mm/gup.c83
-rw-r--r--arch/s390/mm/mmap.c21
-rw-r--r--arch/s390/mm/pageattr.c4
-rw-r--r--arch/s390/mm/pgtable.c66
-rw-r--r--arch/s390/net/bpf_jit_comp.c10
-rw-r--r--arch/s390/pci/pci.c108
-rw-r--r--arch/s390/pci/pci_clp.c33
-rw-r--r--arch/s390/pci/pci_dma.c18
-rw-r--r--arch/s390/pci/pci_event.c35
-rw-r--r--arch/score/Kconfig4
-rw-r--r--arch/score/Makefile4
-rw-r--r--arch/score/include/asm/Kbuild1
-rw-r--r--arch/score/include/asm/checksum.h93
-rw-r--r--arch/score/include/asm/io.h1
-rw-r--r--arch/score/include/asm/pgalloc.h11
-rw-r--r--arch/score/kernel/entry.S4
-rw-r--r--arch/score/kernel/process.c4
-rw-r--r--arch/sh/Kconfig1
-rw-r--r--arch/sh/include/asm/Kbuild1
-rw-r--r--arch/sh/include/asm/fpu.h2
-rw-r--r--arch/sh/include/asm/pgalloc.h5
-rw-r--r--arch/sh/include/asm/processor_32.h10
-rw-r--r--arch/sh/include/asm/processor_64.h10
-rw-r--r--arch/sh/kernel/cpu/fpu.c2
-rw-r--r--arch/sh/kernel/irq.c57
-rw-r--r--arch/sh/kernel/process_32.c6
-rw-r--r--arch/sh/kernel/process_64.c4
-rw-r--r--arch/sh/mm/init.c2
-rw-r--r--arch/sparc/Kconfig9
-rw-r--r--arch/sparc/include/asm/Kbuild1
-rw-r--r--arch/sparc/include/asm/floppy_64.h2
-rw-r--r--arch/sparc/include/asm/jump_label.h2
-rw-r--r--arch/sparc/include/asm/mmu_64.h1
-rw-r--r--arch/sparc/include/asm/page_64.h49
-rw-r--r--arch/sparc/include/asm/pgtable_64.h209
-rw-r--r--arch/sparc/include/asm/prom.h12
-rw-r--r--arch/sparc/include/asm/sparsemem.h6
-rw-r--r--arch/sparc/include/asm/thread_info_64.h3
-rw-r--r--arch/sparc/include/asm/tsb.h105
-rw-r--r--arch/sparc/include/uapi/asm/errno.h2
-rw-r--r--arch/sparc/include/uapi/asm/socket.h2
-rw-r--r--arch/sparc/kernel/Makefile3
-rw-r--r--arch/sparc/kernel/ds.c5
-rw-r--r--arch/sparc/kernel/entry.h1
-rw-r--r--arch/sparc/kernel/irq_64.c31
-rw-r--r--arch/sparc/kernel/kgdb_64.c5
-rw-r--r--arch/sparc/kernel/kprobes.c7
-rw-r--r--arch/sparc/kernel/ktlb.S30
-rw-r--r--arch/sparc/kernel/ldc.c4
-rw-r--r--arch/sparc/kernel/module.c2
-rw-r--r--arch/sparc/kernel/pci.c4
-rw-r--r--arch/sparc/kernel/process_64.c2
-rw-r--r--arch/sparc/kernel/prom_64.c53
-rw-r--r--arch/sparc/kernel/ptrace_64.c10
-rw-r--r--arch/sparc/kernel/rtrap_64.S8
-rw-r--r--arch/sparc/kernel/signal32.c2
-rw-r--r--arch/sparc/kernel/signal_64.c13
-rw-r--r--arch/sparc/kernel/smp_64.c9
-rw-r--r--arch/sparc/kernel/sun4v_tlb_miss.S2
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c6
-rw-r--r--arch/sparc/kernel/syscalls.S8
-rw-r--r--arch/sparc/kernel/traps_64.c85
-rw-r--r--arch/sparc/kernel/tsb.S2
-rw-r--r--arch/sparc/kernel/unaligned_64.c16
-rw-r--r--arch/sparc/kernel/vmlinux.lds.S5
-rw-r--r--arch/sparc/lib/clear_page.S4
-rw-r--r--arch/sparc/lib/copy_page.S4
-rw-r--r--arch/sparc/mm/fault_64.c14
-rw-r--r--arch/sparc/mm/gup.c9
-rw-r--r--arch/sparc/mm/hugetlbpage.c2
-rw-r--r--arch/sparc/mm/init_64.c293
-rw-r--r--arch/sparc/mm/init_64.h4
-rw-r--r--arch/sparc/mm/srmmu.c5
-rw-r--r--arch/sparc/mm/tlb.c25
-rw-r--r--arch/sparc/mm/tsb.c13
-rw-r--r--arch/sparc/mm/ultra.S12
-rw-r--r--arch/sparc/net/bpf_jit_comp.c1
-rw-r--r--arch/tile/Kconfig3
-rw-r--r--arch/tile/gxio/iorpc_mpipe.c90
-rw-r--r--arch/tile/gxio/iorpc_mpipe_info.c15
-rw-r--r--arch/tile/gxio/iorpc_trio.c28
-rw-r--r--arch/tile/gxio/iorpc_usb_host.c8
-rw-r--r--arch/tile/gxio/usb_host.c8
-rw-r--r--arch/tile/include/arch/mpipe.h24
-rw-r--r--arch/tile/include/arch/mpipe_constants.h6
-rw-r--r--arch/tile/include/arch/mpipe_shm.h54
-rw-r--r--arch/tile/include/arch/trio_constants.h10
-rw-r--r--arch/tile/include/asm/Kbuild1
-rw-r--r--arch/tile/include/asm/atomic.h5
-rw-r--r--arch/tile/include/asm/atomic_32.h27
-rw-r--r--arch/tile/include/asm/cmpxchg.h28
-rw-r--r--arch/tile/include/asm/page.h5
-rw-r--r--arch/tile/include/asm/percpu.h34
-rw-r--r--arch/tile/include/asm/pgtable_32.h12
-rw-r--r--arch/tile/include/asm/pgtable_64.h4
-rw-r--r--arch/tile/include/gxio/iorpc_mpipe.h52
-rw-r--r--arch/tile/include/gxio/iorpc_mpipe_info.h12
-rw-r--r--arch/tile/include/gxio/iorpc_trio.h28
-rw-r--r--arch/tile/include/gxio/iorpc_usb_host.h8
-rw-r--r--arch/tile/include/gxio/usb_host.h8
-rw-r--r--arch/tile/kernel/compat.c2
-rw-r--r--arch/tile/kernel/compat_signal.c2
-rw-r--r--arch/tile/kernel/futex_64.S55
-rw-r--r--arch/tile/kernel/hardwall.c6
-rw-r--r--arch/tile/kernel/intvec_32.S3
-rw-r--r--arch/tile/kernel/intvec_64.S3
-rw-r--r--arch/tile/kernel/pci.c7
-rw-r--r--arch/tile/kernel/setup.c3
-rw-r--r--arch/tile/kernel/stack.c12
-rw-r--r--arch/tile/kernel/unaligned.c4
-rw-r--r--arch/tile/lib/atomic_32.c8
-rw-r--r--arch/tile/mm/fault.c2
-rw-r--r--arch/tile/mm/init.c4
-rw-r--r--arch/tile/mm/pgtable.c9
-rw-r--r--arch/um/include/asm/Kbuild1
-rw-r--r--arch/um/kernel/exitcode.c4
-rw-r--r--arch/um/kernel/mem.c8
-rw-r--r--arch/unicore32/include/asm/Kbuild1
-rw-r--r--arch/unicore32/include/asm/pgalloc.h14
-rw-r--r--arch/x86/Kconfig65
-rw-r--r--arch/x86/Kconfig.debug10
-rw-r--r--arch/x86/boot/Makefile3
-rw-r--r--arch/x86/boot/compressed/eboot.c789
-rw-r--r--arch/x86/boot/compressed/eboot.h9
-rw-r--r--arch/x86/boot/compressed/mkpiggy.c16
-rw-r--r--arch/x86/boot/tools/build.c40
-rw-r--r--arch/x86/configs/i386_defconfig2
-rw-r--r--arch/x86/configs/x86_64_defconfig2
-rw-r--r--arch/x86/ia32/ia32_aout.c86
-rw-r--r--arch/x86/ia32/ia32_signal.c2
-rw-r--r--arch/x86/include/asm/acpi.h1
-rw-r--r--arch/x86/include/asm/atomic.h29
-rw-r--r--arch/x86/include/asm/atomic64_64.h28
-rw-r--r--arch/x86/include/asm/bitops.h24
-rw-r--r--arch/x86/include/asm/calling.h50
-rw-r--r--arch/x86/include/asm/cpufeature.h6
-rw-r--r--arch/x86/include/asm/desc.h57
-rw-r--r--arch/x86/include/asm/efi.h2
-rw-r--r--arch/x86/include/asm/fpu-internal.h10
-rw-r--r--arch/x86/include/asm/hw_irq.h3
-rw-r--r--arch/x86/include/asm/intel-mid.h113
-rw-r--r--arch/x86/include/asm/intel_mid_vrtc.h (renamed from arch/x86/include/asm/mrst-vrtc.h)4
-rw-r--r--arch/x86/include/asm/jump_label.h2
-rw-r--r--arch/x86/include/asm/kdebug.h2
-rw-r--r--arch/x86/include/asm/kvm_emulate.h10
-rw-r--r--arch/x86/include/asm/kvm_host.h23
-rw-r--r--arch/x86/include/asm/local.h28
-rw-r--r--arch/x86/include/asm/mce.h1
-rw-r--r--arch/x86/include/asm/misc.h6
-rw-r--r--arch/x86/include/asm/mpspec.h2
-rw-r--r--arch/x86/include/asm/mrst.h81
-rw-r--r--arch/x86/include/asm/msr.h22
-rw-r--r--arch/x86/include/asm/mutex_64.h4
-rw-r--r--arch/x86/include/asm/percpu.h11
-rw-r--r--arch/x86/include/asm/pgalloc.h11
-rw-r--r--arch/x86/include/asm/preempt.h100
-rw-r--r--arch/x86/include/asm/processor.h9
-rw-r--r--arch/x86/include/asm/prom.h5
-rw-r--r--arch/x86/include/asm/pvclock.h2
-rw-r--r--arch/x86/include/asm/rmwcc.h41
-rw-r--r--arch/x86/include/asm/segment.h3
-rw-r--r--arch/x86/include/asm/setup.h4
-rw-r--r--arch/x86/include/asm/thread_info.h5
-rw-r--r--arch/x86/include/asm/trace/exceptions.h52
-rw-r--r--arch/x86/include/asm/traps.h20
-rw-r--r--arch/x86/include/asm/uaccess.h98
-rw-r--r--arch/x86/include/asm/uaccess_32.h29
-rw-r--r--arch/x86/include/asm/uaccess_64.h52
-rw-r--r--arch/x86/include/asm/uprobes.h12
-rw-r--r--arch/x86/include/asm/uv/uv.h2
-rw-r--r--arch/x86/include/asm/uv/uv_hub.h57
-rw-r--r--arch/x86/include/asm/uv/uv_mmrs.h31
-rw-r--r--arch/x86/include/asm/x86_init.h3
-rw-r--r--arch/x86/include/asm/xen/page-coherent.h38
-rw-r--r--arch/x86/include/asm/xen/page.h31
-rw-r--r--arch/x86/include/uapi/asm/bootparam.h2
-rw-r--r--arch/x86/include/uapi/asm/hyperv.h19
-rw-r--r--arch/x86/include/uapi/asm/kvm.h6
-rw-r--r--arch/x86/include/uapi/asm/msr-index.h1
-rw-r--r--arch/x86/kernel/Makefile2
-rw-r--r--arch/x86/kernel/acpi/boot.c90
-rw-r--r--arch/x86/kernel/acpi/sleep.c11
-rw-r--r--arch/x86/kernel/acpi/sleep.h2
-rw-r--r--arch/x86/kernel/acpi/wakeup_32.S2
-rw-r--r--arch/x86/kernel/acpi/wakeup_64.S2
-rw-r--r--arch/x86/kernel/alternative.c11
-rw-r--r--arch/x86/kernel/apb_timer.c10
-rw-r--r--arch/x86/kernel/apic/apic.c8
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c72
-rw-r--r--arch/x86/kernel/asm-offsets.c1
-rw-r--r--arch/x86/kernel/cpu/amd.c6
-rw-r--r--arch/x86/kernel/cpu/centaur.c8
-rw-r--r--arch/x86/kernel/cpu/common.c17
-rw-r--r--arch/x86/kernel/cpu/cpu.h20
-rw-r--r--arch/x86/kernel/cpu/intel.c12
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce-apei.c3
-rw-r--r--arch/x86/kernel/cpu/mshyperv.c27
-rw-r--r--arch/x86/kernel/cpu/perf_event.c31
-rw-r--r--arch/x86/kernel/cpu/perf_event.h6
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c83
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_ds.c204
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_lbr.c31
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.c144
-rw-r--r--arch/x86/kernel/cpu/proc.c15
-rw-r--r--arch/x86/kernel/cpu/umc.c4
-rw-r--r--arch/x86/kernel/crash.c2
-rw-r--r--arch/x86/kernel/devicetree.c51
-rw-r--r--arch/x86/kernel/dumpstack.c11
-rw-r--r--arch/x86/kernel/early-quirks.c12
-rw-r--r--arch/x86/kernel/early_printk.c9
-rw-r--r--arch/x86/kernel/entry_32.S17
-rw-r--r--arch/x86/kernel/entry_64.S36
-rw-r--r--arch/x86/kernel/head32.c4
-rw-r--r--arch/x86/kernel/head64.c2
-rw-r--r--arch/x86/kernel/i386_ksyms_32.c7
-rw-r--r--arch/x86/kernel/i387.c2
-rw-r--r--arch/x86/kernel/i8259.c3
-rw-r--r--arch/x86/kernel/irq_32.c34
-rw-r--r--arch/x86/kernel/irq_64.c21
-rw-r--r--arch/x86/kernel/jump_label.c25
-rw-r--r--arch/x86/kernel/kvm.c21
-rw-r--r--arch/x86/kernel/kvmclock.c1
-rw-r--r--arch/x86/kernel/microcode_amd.c3
-rw-r--r--arch/x86/kernel/module.c2
-rw-r--r--arch/x86/kernel/msr.c2
-rw-r--r--arch/x86/kernel/nmi.c4
-rw-r--r--arch/x86/kernel/preempt.S25
-rw-r--r--arch/x86/kernel/process.c6
-rw-r--r--arch/x86/kernel/process_32.c12
-rw-r--r--arch/x86/kernel/process_64.c12
-rw-r--r--arch/x86/kernel/pvclock.c13
-rw-r--r--arch/x86/kernel/reboot.c285
-rw-r--r--arch/x86/kernel/rtc.c12
-rw-r--r--arch/x86/kernel/setup.c10
-rw-r--r--arch/x86/kernel/smpboot.c57
-rw-r--r--arch/x86/kernel/sysfb_simplefb.c4
-rw-r--r--arch/x86/kernel/topology.c11
-rw-r--r--arch/x86/kernel/traps.c34
-rw-r--r--arch/x86/kernel/vmlinux.lds.S9
-rw-r--r--arch/x86/kernel/x8664_ksyms_64.c7
-rw-r--r--arch/x86/kernel/x86_init.c10
-rw-r--r--arch/x86/kvm/Kconfig1
-rw-r--r--arch/x86/kvm/Makefile2
-rw-r--r--arch/x86/kvm/cpuid.c115
-rw-r--r--arch/x86/kvm/cpuid.h5
-rw-r--r--arch/x86/kvm/emulate.c144
-rw-r--r--arch/x86/kvm/mmu.c115
-rw-r--r--arch/x86/kvm/mmu.h4
-rw-r--r--arch/x86/kvm/paging_tmpl.h20
-rw-r--r--arch/x86/kvm/svm.c8
-rw-r--r--arch/x86/kvm/vmx.c189
-rw-r--r--arch/x86/kvm/x86.c108
-rw-r--r--arch/x86/kvm/x86.h1
-rw-r--r--arch/x86/lib/Makefile2
-rw-r--r--arch/x86/lib/misc.c21
-rw-r--r--arch/x86/lib/msr-smp.c62
-rw-r--r--arch/x86/lib/usercopy.c43
-rw-r--r--arch/x86/lib/usercopy_32.c8
-rw-r--r--arch/x86/mm/Makefile2
-rw-r--r--arch/x86/mm/fault.c66
-rw-r--r--arch/x86/mm/init.c148
-rw-r--r--arch/x86/mm/numa.c11
-rw-r--r--arch/x86/mm/pgtable.c19
-rw-r--r--arch/x86/net/bpf_jit_comp.c20
-rw-r--r--arch/x86/oprofile/backtrace.c4
-rw-r--r--arch/x86/pci/Makefile2
-rw-r--r--arch/x86/pci/acpi.c8
-rw-r--r--arch/x86/pci/fixup.c18
-rw-r--r--arch/x86/pci/intel_mid_pci.c (renamed from arch/x86/pci/mrst.c)20
-rw-r--r--arch/x86/pci/mmconfig-shared.c7
-rw-r--r--arch/x86/pci/xen.c13
-rw-r--r--arch/x86/platform/Makefile2
-rw-r--r--arch/x86/platform/efi/Makefile1
-rw-r--r--arch/x86/platform/efi/early_printk.c191
-rw-r--r--arch/x86/platform/efi/efi.c137
-rw-r--r--arch/x86/platform/geode/alix.c2
-rw-r--r--arch/x86/platform/geode/geos.c2
-rw-r--r--arch/x86/platform/geode/net5501.c2
-rw-r--r--arch/x86/platform/intel-mid/Makefile7
-rw-r--r--arch/x86/platform/intel-mid/device_libs/Makefile22
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_bma023.c20
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_emc1403.c41
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c83
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_ipc.c68
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_ipc.h17
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_lis331.c39
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_max3111.c35
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_max7315.c79
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c36
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_msic.c87
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_msic.h19
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_msic_audio.c47
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_msic_battery.c37
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c48
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c49
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.c36
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.c37
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c54
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c36
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_tca6416.c57
-rw-r--r--arch/x86/platform/intel-mid/early_printk_intel_mid.c (renamed from arch/x86/platform/mrst/early_printk_mrst.c)11
-rw-r--r--arch/x86/platform/intel-mid/intel-mid.c213
-rw-r--r--arch/x86/platform/intel-mid/intel_mid_vrtc.c (renamed from arch/x86/platform/mrst/vrtc.c)19
-rw-r--r--arch/x86/platform/intel-mid/sfi.c488
-rw-r--r--arch/x86/platform/mrst/Makefile3
-rw-r--r--arch/x86/platform/mrst/mrst.c1052
-rw-r--r--arch/x86/platform/olpc/olpc-xo15-sci.c9
-rw-r--r--arch/x86/platform/uv/Makefile2
-rw-r--r--arch/x86/platform/uv/uv_nmi.c700
-rw-r--r--arch/x86/um/elfcore.c15
-rw-r--r--arch/x86/vdso/vclock_gettime.c8
-rw-r--r--arch/x86/xen/mmu.c23
-rw-r--r--arch/x86/xen/p2m.c16
-rw-r--r--arch/x86/xen/pci-swiotlb-xen.c4
-rw-r--r--arch/x86/xen/setup.c2
-rw-r--r--arch/x86/xen/smp.c19
-rw-r--r--arch/x86/xen/spinlock.c28
-rw-r--r--arch/x86/xen/time.c3
-rw-r--r--arch/xtensa/include/asm/Kbuild1
-rw-r--r--arch/xtensa/include/asm/pgalloc.h29
-rw-r--r--arch/xtensa/include/asm/pgtable.h3
-rw-r--r--arch/xtensa/include/asm/prom.h6
-rw-r--r--arch/xtensa/include/uapi/asm/socket.h2
-rw-r--r--arch/xtensa/kernel/entry.S49
-rw-r--r--arch/xtensa/kernel/setup.c55
-rw-r--r--arch/xtensa/kernel/signal.c2
-rw-r--r--arch/xtensa/mm/mmu.c20
-rw-r--r--arch/xtensa/platforms/iss/network.c3
2194 files changed, 59800 insertions, 49128 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index 1feb169274fe..f1cf895c040f 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -207,9 +207,6 @@ config HAVE_DMA_ATTRS
207config HAVE_DMA_CONTIGUOUS 207config HAVE_DMA_CONTIGUOUS
208 bool 208 bool
209 209
210config USE_GENERIC_SMP_HELPERS
211 bool
212
213config GENERIC_SMP_IDLE_THREAD 210config GENERIC_SMP_IDLE_THREAD
214 bool 211 bool
215 212
@@ -286,9 +283,6 @@ config HAVE_PERF_USER_STACK_DUMP
286config HAVE_ARCH_JUMP_LABEL 283config HAVE_ARCH_JUMP_LABEL
287 bool 284 bool
288 285
289config HAVE_ARCH_MUTEX_CPU_RELAX
290 bool
291
292config HAVE_RCU_TABLE_FREE 286config HAVE_RCU_TABLE_FREE
293 bool 287 bool
294 288
@@ -356,6 +350,18 @@ config HAVE_CONTEXT_TRACKING
356config HAVE_VIRT_CPU_ACCOUNTING 350config HAVE_VIRT_CPU_ACCOUNTING
357 bool 351 bool
358 352
353config HAVE_VIRT_CPU_ACCOUNTING_GEN
354 bool
355 default y if 64BIT
356 help
357 With VIRT_CPU_ACCOUNTING_GEN, cputime_t becomes 64-bit.
358 Before enabling this option, arch code must be audited
359 to ensure there are no races in concurrent read/write of
360 cputime_t. For example, reading/writing 64-bit cputime_t on
361 some 32-bit arches may require multiple accesses, so proper
362 locking is needed to protect against concurrent accesses.
363
364
359config HAVE_IRQ_TIME_ACCOUNTING 365config HAVE_IRQ_TIME_ACCOUNTING
360 bool 366 bool
361 help 367 help
@@ -393,6 +399,16 @@ config HAVE_UNDERSCORE_SYMBOL_PREFIX
393 Some architectures generate an _ in front of C symbols; things like 399 Some architectures generate an _ in front of C symbols; things like
394 module loading and assembly files need to know about this. 400 module loading and assembly files need to know about this.
395 401
402config HAVE_IRQ_EXIT_ON_IRQ_STACK
403 bool
404 help
405 Architecture doesn't only execute the irq handler on the irq stack
406 but also irq_exit(). This way we can process softirqs on this irq
407 stack instead of switching to a new one when we call __do_softirq()
408 in the end of an hardirq.
409 This spares a stack switch and improves cache usage on softirq
410 processing.
411
396# 412#
397# ABI hall of shame 413# ABI hall of shame
398# 414#
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 84803f88a169..135c674eaf9e 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -523,7 +523,6 @@ config ARCH_MAY_HAVE_PC_FDC
523config SMP 523config SMP
524 bool "Symmetric multi-processing support" 524 bool "Symmetric multi-processing support"
525 depends on ALPHA_SABLE || ALPHA_LYNX || ALPHA_RAWHIDE || ALPHA_DP264 || ALPHA_WILDFIRE || ALPHA_TITAN || ALPHA_GENERIC || ALPHA_SHARK || ALPHA_MARVEL 525 depends on ALPHA_SABLE || ALPHA_LYNX || ALPHA_RAWHIDE || ALPHA_DP264 || ALPHA_WILDFIRE || ALPHA_TITAN || ALPHA_GENERIC || ALPHA_SHARK || ALPHA_MARVEL
526 select USE_GENERIC_SMP_HELPERS
527 ---help--- 526 ---help---
528 This enables support for systems with more than one CPU. If you have 527 This enables support for systems with more than one CPU. If you have
529 a system with only one CPU, like most personal computers, say N. If 528 a system with only one CPU, like most personal computers, say N. If
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index a6e85f448c1c..f01fb505ad52 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -3,3 +3,4 @@ generic-y += clkdev.h
3 3
4generic-y += exec.h 4generic-y += exec.h
5generic-y += trace_clock.h 5generic-y += trace_clock.h
6generic-y += preempt.h
diff --git a/arch/alpha/include/asm/pgalloc.h b/arch/alpha/include/asm/pgalloc.h
index bc2a0daf2d92..aab14a019c20 100644
--- a/arch/alpha/include/asm/pgalloc.h
+++ b/arch/alpha/include/asm/pgalloc.h
@@ -72,7 +72,10 @@ pte_alloc_one(struct mm_struct *mm, unsigned long address)
72 if (!pte) 72 if (!pte)
73 return NULL; 73 return NULL;
74 page = virt_to_page(pte); 74 page = virt_to_page(pte);
75 pgtable_page_ctor(page); 75 if (!pgtable_page_ctor(page)) {
76 __free_page(page);
77 return NULL;
78 }
76 return page; 79 return page;
77} 80}
78 81
diff --git a/arch/alpha/include/uapi/asm/errno.h b/arch/alpha/include/uapi/asm/errno.h
index e5f29ca28180..17f92aa76b2f 100644
--- a/arch/alpha/include/uapi/asm/errno.h
+++ b/arch/alpha/include/uapi/asm/errno.h
@@ -43,7 +43,7 @@
43 43
44#define EUSERS 68 /* Too many users */ 44#define EUSERS 68 /* Too many users */
45#define EDQUOT 69 /* Quota exceeded */ 45#define EDQUOT 69 /* Quota exceeded */
46#define ESTALE 70 /* Stale NFS file handle */ 46#define ESTALE 70 /* Stale file handle */
47#define EREMOTE 71 /* Object is remote */ 47#define EREMOTE 71 /* Object is remote */
48 48
49#define ENOLCK 77 /* No record locks available */ 49#define ENOLCK 77 /* No record locks available */
diff --git a/arch/alpha/include/uapi/asm/socket.h b/arch/alpha/include/uapi/asm/socket.h
index 467de010ea7e..e3a1491d5073 100644
--- a/arch/alpha/include/uapi/asm/socket.h
+++ b/arch/alpha/include/uapi/asm/socket.h
@@ -81,6 +81,8 @@
81 81
82#define SO_SELECT_ERR_QUEUE 45 82#define SO_SELECT_ERR_QUEUE 45
83 83
84#define SO_BUSY_POLL 46 84#define SO_BUSY_POLL 46
85
86#define SO_MAX_PACING_RATE 47
85 87
86#endif /* _UAPI_ASM_SOCKET_H */ 88#endif /* _UAPI_ASM_SOCKET_H */
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 91dbb2757afd..2ee0c9bfd032 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -35,6 +35,12 @@ config ARC
35 select PERF_USE_VMALLOC 35 select PERF_USE_VMALLOC
36 select HAVE_DEBUG_STACKOVERFLOW 36 select HAVE_DEBUG_STACKOVERFLOW
37 37
38config TRACE_IRQFLAGS_SUPPORT
39 def_bool y
40
41config LOCKDEP_SUPPORT
42 def_bool y
43
38config SCHED_OMIT_FRAME_POINTER 44config SCHED_OMIT_FRAME_POINTER
39 def_bool y 45 def_bool y
40 46
@@ -119,7 +125,6 @@ config ARC_PLAT_NEEDS_CPU_TO_DMA
119config SMP 125config SMP
120 bool "Symmetric Multi-Processing (Incomplete)" 126 bool "Symmetric Multi-Processing (Incomplete)"
121 default n 127 default n
122 select USE_GENERIC_SMP_HELPERS
123 help 128 help
124 This enables support for systems with more than one CPU. If you have 129 This enables support for systems with more than one CPU. If you have
125 a system with only one CPU, like most personal computers, say N. If 130 a system with only one CPU, like most personal computers, say N. If
@@ -130,17 +135,14 @@ if SMP
130config ARC_HAS_COH_CACHES 135config ARC_HAS_COH_CACHES
131 def_bool n 136 def_bool n
132 137
133config ARC_HAS_COH_RTSC
134 def_bool n
135
136config ARC_HAS_REENTRANT_IRQ_LV2 138config ARC_HAS_REENTRANT_IRQ_LV2
137 def_bool n 139 def_bool n
138 140
139endif 141endif
140 142
141config NR_CPUS 143config NR_CPUS
142 int "Maximum number of CPUs (2-32)" 144 int "Maximum number of CPUs (2-4096)"
143 range 2 32 145 range 2 4096
144 depends on SMP 146 depends on SMP
145 default "2" 147 default "2"
146 148
@@ -326,8 +328,7 @@ config ARC_HAS_RTSC
326 bool "Insn: RTSC (64-bit r/o cycle counter)" 328 bool "Insn: RTSC (64-bit r/o cycle counter)"
327 default y 329 default y
328 depends on ARC_CPU_REL_4_10 330 depends on ARC_CPU_REL_4_10
329 # if SMP, enable RTSC only if counter is coherent across cores 331 depends on !SMP
330 depends on !SMP || ARC_HAS_COH_RTSC
331 332
332endmenu # "ARC CPU Configuration" 333endmenu # "ARC CPU Configuration"
333 334
diff --git a/arch/arc/configs/fpga_defconfig b/arch/arc/configs/fpga_defconfig
index 4ca50f1f8d05..e283aa586934 100644
--- a/arch/arc/configs/fpga_defconfig
+++ b/arch/arc/configs/fpga_defconfig
@@ -2,6 +2,8 @@ CONFIG_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
5CONFIG_SYSVIPC=y
6CONFIG_POSIX_MQUEUE=y
5CONFIG_HIGH_RES_TIMERS=y 7CONFIG_HIGH_RES_TIMERS=y
6CONFIG_IKCONFIG=y 8CONFIG_IKCONFIG=y
7CONFIG_IKCONFIG_PROC=y 9CONFIG_IKCONFIG_PROC=y
@@ -62,4 +64,5 @@ CONFIG_TMPFS=y
62CONFIG_NFS_FS=y 64CONFIG_NFS_FS=y
63# CONFIG_ENABLE_WARN_DEPRECATED is not set 65# CONFIG_ENABLE_WARN_DEPRECATED is not set
64# CONFIG_ENABLE_MUST_CHECK is not set 66# CONFIG_ENABLE_MUST_CHECK is not set
67# CONFIG_DEBUG_PREEMPT is not set
65CONFIG_XZ_DEC=y 68CONFIG_XZ_DEC=y
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild
index d8dd660898b9..5943f7f9d325 100644
--- a/arch/arc/include/asm/Kbuild
+++ b/arch/arc/include/asm/Kbuild
@@ -46,3 +46,4 @@ generic-y += ucontext.h
46generic-y += user.h 46generic-y += user.h
47generic-y += vga.h 47generic-y += vga.h
48generic-y += xor.h 48generic-y += xor.h
49generic-y += preempt.h
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h
index e4abdaac6f9f..2fd3162ec4df 100644
--- a/arch/arc/include/asm/cache.h
+++ b/arch/arc/include/asm/cache.h
@@ -17,13 +17,7 @@
17#endif 17#endif
18 18
19#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 19#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
20 20#define CACHE_LINE_MASK (~(L1_CACHE_BYTES - 1))
21/* For a rare case where customers have differently config I/D */
22#define ARC_ICACHE_LINE_LEN L1_CACHE_BYTES
23#define ARC_DCACHE_LINE_LEN L1_CACHE_BYTES
24
25#define ICACHE_LINE_MASK (~(ARC_ICACHE_LINE_LEN - 1))
26#define DCACHE_LINE_MASK (~(ARC_DCACHE_LINE_LEN - 1))
27 21
28/* 22/*
29 * ARC700 doesn't cache any access in top 256M. 23 * ARC700 doesn't cache any access in top 256M.
diff --git a/arch/arc/include/asm/irq.h b/arch/arc/include/asm/irq.h
index c0a72105ee0b..291a70db68b8 100644
--- a/arch/arc/include/asm/irq.h
+++ b/arch/arc/include/asm/irq.h
@@ -18,8 +18,8 @@
18 18
19#include <asm-generic/irq.h> 19#include <asm-generic/irq.h>
20 20
21extern void __init arc_init_IRQ(void); 21extern void arc_init_IRQ(void);
22extern int __init get_hw_config_num_irq(void); 22extern int get_hw_config_num_irq(void);
23 23
24void arc_local_timer_setup(unsigned int cpu); 24void arc_local_timer_setup(unsigned int cpu);
25 25
diff --git a/arch/arc/include/asm/irqflags.h b/arch/arc/include/asm/irqflags.h
index b68b53f458d1..cb7efc29f16f 100644
--- a/arch/arc/include/asm/irqflags.h
+++ b/arch/arc/include/asm/irqflags.h
@@ -151,16 +151,38 @@ static inline void arch_unmask_irq(unsigned int irq)
151 151
152#else 152#else
153 153
154#ifdef CONFIG_TRACE_IRQFLAGS
155
156.macro TRACE_ASM_IRQ_DISABLE
157 bl trace_hardirqs_off
158.endm
159
160.macro TRACE_ASM_IRQ_ENABLE
161 bl trace_hardirqs_on
162.endm
163
164#else
165
166.macro TRACE_ASM_IRQ_DISABLE
167.endm
168
169.macro TRACE_ASM_IRQ_ENABLE
170.endm
171
172#endif
173
154.macro IRQ_DISABLE scratch 174.macro IRQ_DISABLE scratch
155 lr \scratch, [status32] 175 lr \scratch, [status32]
156 bic \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) 176 bic \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK)
157 flag \scratch 177 flag \scratch
178 TRACE_ASM_IRQ_DISABLE
158.endm 179.endm
159 180
160.macro IRQ_ENABLE scratch 181.macro IRQ_ENABLE scratch
161 lr \scratch, [status32] 182 lr \scratch, [status32]
162 or \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) 183 or \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK)
163 flag \scratch 184 flag \scratch
185 TRACE_ASM_IRQ_ENABLE
164.endm 186.endm
165 187
166#endif /* __ASSEMBLY__ */ 188#endif /* __ASSEMBLY__ */
diff --git a/arch/arc/include/asm/mach_desc.h b/arch/arc/include/asm/mach_desc.h
index 9998dc846ebb..e8993a2be6c2 100644
--- a/arch/arc/include/asm/mach_desc.h
+++ b/arch/arc/include/asm/mach_desc.h
@@ -51,22 +51,12 @@ struct machine_desc {
51/* 51/*
52 * Current machine - only accessible during boot. 52 * Current machine - only accessible during boot.
53 */ 53 */
54extern struct machine_desc *machine_desc; 54extern const struct machine_desc *machine_desc;
55 55
56/* 56/*
57 * Machine type table - also only accessible during boot 57 * Machine type table - also only accessible during boot
58 */ 58 */
59extern struct machine_desc __arch_info_begin[], __arch_info_end[]; 59extern const struct machine_desc __arch_info_begin[], __arch_info_end[];
60#define for_each_machine_desc(p) \
61 for (p = __arch_info_begin; p < __arch_info_end; p++)
62
63static inline struct machine_desc *default_machine_desc(void)
64{
65 /* the default machine is the last one linked in */
66 if (__arch_info_end - 1 < __arch_info_begin)
67 return NULL;
68 return __arch_info_end - 1;
69}
70 60
71/* 61/*
72 * Set of macros to define architecture features. 62 * Set of macros to define architecture features.
@@ -81,7 +71,6 @@ __attribute__((__section__(".arch.info.init"))) = { \
81#define MACHINE_END \ 71#define MACHINE_END \
82}; 72};
83 73
84extern struct machine_desc *setup_machine_fdt(void *dt); 74extern const struct machine_desc *setup_machine_fdt(void *dt);
85extern void __init copy_devtree(void);
86 75
87#endif 76#endif
diff --git a/arch/arc/include/asm/mmu.h b/arch/arc/include/asm/mmu.h
index c2663b32866b..8c84ae98c337 100644
--- a/arch/arc/include/asm/mmu.h
+++ b/arch/arc/include/asm/mmu.h
@@ -48,7 +48,7 @@
48#ifndef __ASSEMBLY__ 48#ifndef __ASSEMBLY__
49 49
50typedef struct { 50typedef struct {
51 unsigned long asid; /* 8 bit MMU PID + Generation cycle */ 51 unsigned long asid[NR_CPUS]; /* 8 bit MMU PID + Generation cycle */
52} mm_context_t; 52} mm_context_t;
53 53
54#ifdef CONFIG_ARC_DBG_TLB_PARANOIA 54#ifdef CONFIG_ARC_DBG_TLB_PARANOIA
diff --git a/arch/arc/include/asm/mmu_context.h b/arch/arc/include/asm/mmu_context.h
index 43a1b51bb8cc..1fd467ef658f 100644
--- a/arch/arc/include/asm/mmu_context.h
+++ b/arch/arc/include/asm/mmu_context.h
@@ -30,13 +30,13 @@
30 * "Fast Context Switch" i.e. no TLB flush on ctxt-switch 30 * "Fast Context Switch" i.e. no TLB flush on ctxt-switch
31 * 31 *
32 * Linux assigns each task a unique ASID. A simple round-robin allocation 32 * Linux assigns each task a unique ASID. A simple round-robin allocation
33 * of H/w ASID is done using software tracker @asid_cache. 33 * of H/w ASID is done using software tracker @asid_cpu.
34 * When it reaches max 255, the allocation cycle starts afresh by flushing 34 * When it reaches max 255, the allocation cycle starts afresh by flushing
35 * the entire TLB and wrapping ASID back to zero. 35 * the entire TLB and wrapping ASID back to zero.
36 * 36 *
37 * A new allocation cycle, post rollover, could potentially reassign an ASID 37 * A new allocation cycle, post rollover, could potentially reassign an ASID
38 * to a different task. Thus the rule is to refresh the ASID in a new cycle. 38 * to a different task. Thus the rule is to refresh the ASID in a new cycle.
39 * The 32 bit @asid_cache (and mm->asid) have 8 bits MMU PID and rest 24 bits 39 * The 32 bit @asid_cpu (and mm->asid) have 8 bits MMU PID and rest 24 bits
40 * serve as cycle/generation indicator and natural 32 bit unsigned math 40 * serve as cycle/generation indicator and natural 32 bit unsigned math
41 * automagically increments the generation when lower 8 bits rollover. 41 * automagically increments the generation when lower 8 bits rollover.
42 */ 42 */
@@ -47,9 +47,11 @@
47#define MM_CTXT_FIRST_CYCLE (MM_CTXT_ASID_MASK + 1) 47#define MM_CTXT_FIRST_CYCLE (MM_CTXT_ASID_MASK + 1)
48#define MM_CTXT_NO_ASID 0UL 48#define MM_CTXT_NO_ASID 0UL
49 49
50#define hw_pid(mm) (mm->context.asid & MM_CTXT_ASID_MASK) 50#define asid_mm(mm, cpu) mm->context.asid[cpu]
51#define hw_pid(mm, cpu) (asid_mm(mm, cpu) & MM_CTXT_ASID_MASK)
51 52
52extern unsigned int asid_cache; 53DECLARE_PER_CPU(unsigned int, asid_cache);
54#define asid_cpu(cpu) per_cpu(asid_cache, cpu)
53 55
54/* 56/*
55 * Get a new ASID if task doesn't have a valid one (unalloc or from prev cycle) 57 * Get a new ASID if task doesn't have a valid one (unalloc or from prev cycle)
@@ -57,6 +59,7 @@ extern unsigned int asid_cache;
57 */ 59 */
58static inline void get_new_mmu_context(struct mm_struct *mm) 60static inline void get_new_mmu_context(struct mm_struct *mm)
59{ 61{
62 const unsigned int cpu = smp_processor_id();
60 unsigned long flags; 63 unsigned long flags;
61 64
62 local_irq_save(flags); 65 local_irq_save(flags);
@@ -71,28 +74,28 @@ static inline void get_new_mmu_context(struct mm_struct *mm)
71 * first need to destroy the context, setting it to invalid 74 * first need to destroy the context, setting it to invalid
72 * value. 75 * value.
73 */ 76 */
74 if (!((mm->context.asid ^ asid_cache) & MM_CTXT_CYCLE_MASK)) 77 if (!((asid_mm(mm, cpu) ^ asid_cpu(cpu)) & MM_CTXT_CYCLE_MASK))
75 goto set_hw; 78 goto set_hw;
76 79
77 /* move to new ASID and handle rollover */ 80 /* move to new ASID and handle rollover */
78 if (unlikely(!(++asid_cache & MM_CTXT_ASID_MASK))) { 81 if (unlikely(!(++asid_cpu(cpu) & MM_CTXT_ASID_MASK))) {
79 82
80 flush_tlb_all(); 83 local_flush_tlb_all();
81 84
82 /* 85 /*
83 * Above checke for rollover of 8 bit ASID in 32 bit container. 86 * Above checke for rollover of 8 bit ASID in 32 bit container.
84 * If the container itself wrapped around, set it to a non zero 87 * If the container itself wrapped around, set it to a non zero
85 * "generation" to distinguish from no context 88 * "generation" to distinguish from no context
86 */ 89 */
87 if (!asid_cache) 90 if (!asid_cpu(cpu))
88 asid_cache = MM_CTXT_FIRST_CYCLE; 91 asid_cpu(cpu) = MM_CTXT_FIRST_CYCLE;
89 } 92 }
90 93
91 /* Assign new ASID to tsk */ 94 /* Assign new ASID to tsk */
92 mm->context.asid = asid_cache; 95 asid_mm(mm, cpu) = asid_cpu(cpu);
93 96
94set_hw: 97set_hw:
95 write_aux_reg(ARC_REG_PID, hw_pid(mm) | MMU_ENABLE); 98 write_aux_reg(ARC_REG_PID, hw_pid(mm, cpu) | MMU_ENABLE);
96 99
97 local_irq_restore(flags); 100 local_irq_restore(flags);
98} 101}
@@ -104,16 +107,45 @@ set_hw:
104static inline int 107static inline int
105init_new_context(struct task_struct *tsk, struct mm_struct *mm) 108init_new_context(struct task_struct *tsk, struct mm_struct *mm)
106{ 109{
107 mm->context.asid = MM_CTXT_NO_ASID; 110 int i;
111
112 for_each_possible_cpu(i)
113 asid_mm(mm, i) = MM_CTXT_NO_ASID;
114
108 return 0; 115 return 0;
109} 116}
110 117
118static inline void destroy_context(struct mm_struct *mm)
119{
120 unsigned long flags;
121
122 /* Needed to elide CONFIG_DEBUG_PREEMPT warning */
123 local_irq_save(flags);
124 asid_mm(mm, smp_processor_id()) = MM_CTXT_NO_ASID;
125 local_irq_restore(flags);
126}
127
111/* Prepare the MMU for task: setup PID reg with allocated ASID 128/* Prepare the MMU for task: setup PID reg with allocated ASID
112 If task doesn't have an ASID (never alloc or stolen, get a new ASID) 129 If task doesn't have an ASID (never alloc or stolen, get a new ASID)
113*/ 130*/
114static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 131static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
115 struct task_struct *tsk) 132 struct task_struct *tsk)
116{ 133{
134 const int cpu = smp_processor_id();
135
136 /*
137 * Note that the mm_cpumask is "aggregating" only, we don't clear it
138 * for the switched-out task, unlike some other arches.
139 * It is used to enlist cpus for sending TLB flush IPIs and not sending
140 * it to CPUs where a task once ran-on, could cause stale TLB entry
141 * re-use, specially for a multi-threaded task.
142 * e.g. T1 runs on C1, migrates to C3. T2 running on C2 munmaps.
143 * For a non-aggregating mm_cpumask, IPI not sent C1, and if T1
144 * were to re-migrate to C1, it could access the unmapped region
145 * via any existing stale TLB entries.
146 */
147 cpumask_set_cpu(cpu, mm_cpumask(next));
148
117#ifndef CONFIG_SMP 149#ifndef CONFIG_SMP
118 /* PGD cached in MMU reg to avoid 3 mem lookups: task->mm->pgd */ 150 /* PGD cached in MMU reg to avoid 3 mem lookups: task->mm->pgd */
119 write_aux_reg(ARC_REG_SCRATCH_DATA0, next->pgd); 151 write_aux_reg(ARC_REG_SCRATCH_DATA0, next->pgd);
@@ -131,11 +163,6 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
131 */ 163 */
132#define activate_mm(prev, next) switch_mm(prev, next, NULL) 164#define activate_mm(prev, next) switch_mm(prev, next, NULL)
133 165
134static inline void destroy_context(struct mm_struct *mm)
135{
136 mm->context.asid = MM_CTXT_NO_ASID;
137}
138
139/* it seemed that deactivate_mm( ) is a reasonable place to do book-keeping 166/* it seemed that deactivate_mm( ) is a reasonable place to do book-keeping
140 * for retiring-mm. However destroy_context( ) still needs to do that because 167 * for retiring-mm. However destroy_context( ) still needs to do that because
141 * between mm_release( ) = >deactive_mm( ) and 168 * between mm_release( ) = >deactive_mm( ) and
diff --git a/arch/arc/include/asm/pgalloc.h b/arch/arc/include/asm/pgalloc.h
index 36a9f20c21a3..81208bfd9dcb 100644
--- a/arch/arc/include/asm/pgalloc.h
+++ b/arch/arc/include/asm/pgalloc.h
@@ -105,11 +105,16 @@ static inline pgtable_t
105pte_alloc_one(struct mm_struct *mm, unsigned long address) 105pte_alloc_one(struct mm_struct *mm, unsigned long address)
106{ 106{
107 pgtable_t pte_pg; 107 pgtable_t pte_pg;
108 struct page *page;
108 109
109 pte_pg = __get_free_pages(GFP_KERNEL | __GFP_REPEAT, __get_order_pte()); 110 pte_pg = __get_free_pages(GFP_KERNEL | __GFP_REPEAT, __get_order_pte());
110 if (pte_pg) { 111 if (!pte_pg)
111 memzero((void *)pte_pg, PTRS_PER_PTE * 4); 112 return 0;
112 pgtable_page_ctor(virt_to_page(pte_pg)); 113 memzero((void *)pte_pg, PTRS_PER_PTE * 4);
114 page = virt_to_page(pte_pg);
115 if (!pgtable_page_ctor(page)) {
116 __free_page(page);
117 return 0;
113 } 118 }
114 119
115 return pte_pg; 120 return pte_pg;
diff --git a/arch/arc/include/asm/prom.h b/arch/arc/include/asm/prom.h
deleted file mode 100644
index 692d0d0789a7..000000000000
--- a/arch/arc/include/asm/prom.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * Copyright (C) 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 _ASM_ARC_PROM_H_
10#define _ASM_ARC_PROM_H_
11
12#define HAVE_ARCH_DEVTREE_FIXUPS
13
14#endif
diff --git a/arch/arc/include/asm/setup.h b/arch/arc/include/asm/setup.h
index 229e50681497..e10f8cef56a8 100644
--- a/arch/arc/include/asm/setup.h
+++ b/arch/arc/include/asm/setup.h
@@ -31,7 +31,7 @@ struct cpuinfo_data {
31extern int root_mountflags, end_mem; 31extern int root_mountflags, end_mem;
32extern int running_on_hw; 32extern int running_on_hw;
33 33
34void __init setup_processor(void); 34void setup_processor(void);
35void __init setup_arch_memory(void); 35void __init setup_arch_memory(void);
36 36
37#endif /* __ASMARC_SETUP_H */ 37#endif /* __ASMARC_SETUP_H */
diff --git a/arch/arc/include/asm/smp.h b/arch/arc/include/asm/smp.h
index c4fb211dcd25..eefc29f08cdb 100644
--- a/arch/arc/include/asm/smp.h
+++ b/arch/arc/include/asm/smp.h
@@ -30,7 +30,7 @@ extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
30 * APIs provided by arch SMP code to rest of arch code 30 * APIs provided by arch SMP code to rest of arch code
31 */ 31 */
32extern void __init smp_init_cpus(void); 32extern void __init smp_init_cpus(void);
33extern void __init first_lines_of_secondary(void); 33extern void first_lines_of_secondary(void);
34extern const char *arc_platform_smp_cpuinfo(void); 34extern const char *arc_platform_smp_cpuinfo(void);
35 35
36/* 36/*
diff --git a/arch/arc/include/asm/spinlock.h b/arch/arc/include/asm/spinlock.h
index f158197ac5b0..b6a8c2dfbe6e 100644
--- a/arch/arc/include/asm/spinlock.h
+++ b/arch/arc/include/asm/spinlock.h
@@ -45,7 +45,14 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)
45 45
46static inline void arch_spin_unlock(arch_spinlock_t *lock) 46static inline void arch_spin_unlock(arch_spinlock_t *lock)
47{ 47{
48 lock->slock = __ARCH_SPIN_LOCK_UNLOCKED__; 48 unsigned int tmp = __ARCH_SPIN_LOCK_UNLOCKED__;
49
50 __asm__ __volatile__(
51 " ex %0, [%1] \n"
52 : "+r" (tmp)
53 : "r"(&(lock->slock))
54 : "memory");
55
49 smp_mb(); 56 smp_mb();
50} 57}
51 58
diff --git a/arch/arc/include/asm/tlbflush.h b/arch/arc/include/asm/tlbflush.h
index b2f9bc7f68c8..71c7b2e4b874 100644
--- a/arch/arc/include/asm/tlbflush.h
+++ b/arch/arc/include/asm/tlbflush.h
@@ -18,11 +18,18 @@ void local_flush_tlb_kernel_range(unsigned long start, unsigned long end);
18void local_flush_tlb_range(struct vm_area_struct *vma, 18void local_flush_tlb_range(struct vm_area_struct *vma,
19 unsigned long start, unsigned long end); 19 unsigned long start, unsigned long end);
20 20
21/* XXX: Revisit for SMP */ 21#ifndef CONFIG_SMP
22#define flush_tlb_range(vma, s, e) local_flush_tlb_range(vma, s, e) 22#define flush_tlb_range(vma, s, e) local_flush_tlb_range(vma, s, e)
23#define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page) 23#define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page)
24#define flush_tlb_kernel_range(s, e) local_flush_tlb_kernel_range(s, e) 24#define flush_tlb_kernel_range(s, e) local_flush_tlb_kernel_range(s, e)
25#define flush_tlb_all() local_flush_tlb_all() 25#define flush_tlb_all() local_flush_tlb_all()
26#define flush_tlb_mm(mm) local_flush_tlb_mm(mm) 26#define flush_tlb_mm(mm) local_flush_tlb_mm(mm)
27 27#else
28extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
29 unsigned long end);
30extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page);
31extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
32extern void flush_tlb_all(void);
33extern void flush_tlb_mm(struct mm_struct *mm);
34#endif /* CONFIG_SMP */
28#endif 35#endif
diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h
index 32420824375b..30c9baffa96f 100644
--- a/arch/arc/include/asm/uaccess.h
+++ b/arch/arc/include/asm/uaccess.h
@@ -43,7 +43,7 @@
43 * Because it essentially checks if buffer end is within limit and @len is 43 * Because it essentially checks if buffer end is within limit and @len is
44 * non-ngeative, which implies that buffer start will be within limit too. 44 * non-ngeative, which implies that buffer start will be within limit too.
45 * 45 *
46 * The reason for rewriting being, for majorit yof cases, @len is generally 46 * The reason for rewriting being, for majority of cases, @len is generally
47 * compile time constant, causing first sub-expression to be compile time 47 * compile time constant, causing first sub-expression to be compile time
48 * subsumed. 48 * subsumed.
49 * 49 *
@@ -53,7 +53,7 @@
53 * 53 *
54 */ 54 */
55#define __user_ok(addr, sz) (((sz) <= TASK_SIZE) && \ 55#define __user_ok(addr, sz) (((sz) <= TASK_SIZE) && \
56 (((addr)+(sz)) <= get_fs())) 56 ((addr) <= (get_fs() - (sz))))
57#define __access_ok(addr, sz) (unlikely(__kernel_ok) || \ 57#define __access_ok(addr, sz) (unlikely(__kernel_ok) || \
58 likely(__user_ok((addr), (sz)))) 58 likely(__user_ok((addr), (sz))))
59 59
diff --git a/arch/arc/include/asm/unaligned.h b/arch/arc/include/asm/unaligned.h
index 60702f3751d2..3e5f071bc00c 100644
--- a/arch/arc/include/asm/unaligned.h
+++ b/arch/arc/include/asm/unaligned.h
@@ -22,7 +22,8 @@ static inline int
22misaligned_fixup(unsigned long address, struct pt_regs *regs, 22misaligned_fixup(unsigned long address, struct pt_regs *regs,
23 struct callee_regs *cregs) 23 struct callee_regs *cregs)
24{ 24{
25 return 0; 25 /* Not fixed */
26 return 1;
26} 27}
27#endif 28#endif
28 29
diff --git a/arch/arc/kernel/ctx_sw.c b/arch/arc/kernel/ctx_sw.c
index 34410eb1a308..c14a5bea0c76 100644
--- a/arch/arc/kernel/ctx_sw.c
+++ b/arch/arc/kernel/ctx_sw.c
@@ -17,6 +17,8 @@
17#include <asm/asm-offsets.h> 17#include <asm/asm-offsets.h>
18#include <linux/sched.h> 18#include <linux/sched.h>
19 19
20#define KSP_WORD_OFF ((TASK_THREAD + THREAD_KSP) / 4)
21
20struct task_struct *__sched 22struct task_struct *__sched
21__switch_to(struct task_struct *prev_task, struct task_struct *next_task) 23__switch_to(struct task_struct *prev_task, struct task_struct *next_task)
22{ 24{
@@ -45,7 +47,16 @@ __switch_to(struct task_struct *prev_task, struct task_struct *next_task)
45#endif 47#endif
46 48
47 /* set ksp of outgoing task in tsk->thread.ksp */ 49 /* set ksp of outgoing task in tsk->thread.ksp */
50#if KSP_WORD_OFF <= 255
48 "st.as sp, [%3, %1] \n\t" 51 "st.as sp, [%3, %1] \n\t"
52#else
53 /*
54 * Workaround for NR_CPUS=4k
55 * %1 is bigger than 255 (S9 offset for st.as)
56 */
57 "add2 r24, %3, %1 \n\t"
58 "st sp, [r24] \n\t"
59#endif
49 60
50 "sync \n\t" 61 "sync \n\t"
51 62
@@ -97,7 +108,7 @@ __switch_to(struct task_struct *prev_task, struct task_struct *next_task)
97 /* FP/BLINK restore generated by gcc (standard func epilogue */ 108 /* FP/BLINK restore generated by gcc (standard func epilogue */
98 109
99 : "=r"(tmp) 110 : "=r"(tmp)
100 : "n"((TASK_THREAD + THREAD_KSP) / 4), "r"(next), "r"(prev) 111 : "n"(KSP_WORD_OFF), "r"(next), "r"(prev)
101 : "blink" 112 : "blink"
102 ); 113 );
103 114
diff --git a/arch/arc/kernel/ctx_sw_asm.S b/arch/arc/kernel/ctx_sw_asm.S
index d8972345e4c2..65690e7fcc8c 100644
--- a/arch/arc/kernel/ctx_sw_asm.S
+++ b/arch/arc/kernel/ctx_sw_asm.S
@@ -14,6 +14,8 @@
14#include <asm/asm-offsets.h> 14#include <asm/asm-offsets.h>
15#include <asm/linkage.h> 15#include <asm/linkage.h>
16 16
17#define KSP_WORD_OFF ((TASK_THREAD + THREAD_KSP) / 4)
18
17;################### Low Level Context Switch ########################## 19;################### Low Level Context Switch ##########################
18 20
19 .section .sched.text,"ax",@progbits 21 .section .sched.text,"ax",@progbits
@@ -28,8 +30,13 @@ __switch_to:
28 SAVE_CALLEE_SAVED_KERNEL 30 SAVE_CALLEE_SAVED_KERNEL
29 31
30 /* Save the now KSP in task->thread.ksp */ 32 /* Save the now KSP in task->thread.ksp */
31 st.as sp, [r0, (TASK_THREAD + THREAD_KSP)/4] 33#if KSP_WORD_OFF <= 255
32 34 st.as sp, [r0, KSP_WORD_OFF]
35#else
36 /* Workaround for NR_CPUS=4k as ST.as can only take s9 offset */
37 add2 r24, r0, KSP_WORD_OFF
38 st sp, [r24]
39#endif
33 /* 40 /*
34 * Return last task in r0 (return reg) 41 * Return last task in r0 (return reg)
35 * On ARC, Return reg = First Arg reg = r0. 42 * On ARC, Return reg = First Arg reg = r0.
diff --git a/arch/arc/kernel/devtree.c b/arch/arc/kernel/devtree.c
index 2340af0e1d6f..b6dc4e21fd32 100644
--- a/arch/arc/kernel/devtree.c
+++ b/arch/arc/kernel/devtree.c
@@ -14,10 +14,22 @@
14#include <linux/memblock.h> 14#include <linux/memblock.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_fdt.h> 16#include <linux/of_fdt.h>
17#include <asm/prom.h>
18#include <asm/clk.h> 17#include <asm/clk.h>
19#include <asm/mach_desc.h> 18#include <asm/mach_desc.h>
20 19
20static const void * __init arch_get_next_mach(const char *const **match)
21{
22 static const struct machine_desc *mdesc = __arch_info_begin;
23 const struct machine_desc *m = mdesc;
24
25 if (m >= __arch_info_end)
26 return NULL;
27
28 mdesc++;
29 *match = m->dt_compat;
30 return m;
31}
32
21/** 33/**
22 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel 34 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
23 * @dt: virtual address pointer to dt blob 35 * @dt: virtual address pointer to dt blob
@@ -25,93 +37,24 @@
25 * If a dtb was passed to the kernel, then use it to choose the correct 37 * If a dtb was passed to the kernel, then use it to choose the correct
26 * machine_desc and to setup the system. 38 * machine_desc and to setup the system.
27 */ 39 */
28struct machine_desc * __init setup_machine_fdt(void *dt) 40const struct machine_desc * __init setup_machine_fdt(void *dt)
29{ 41{
30 struct boot_param_header *devtree = dt; 42 const struct machine_desc *mdesc;
31 struct machine_desc *mdesc = NULL, *mdesc_best = NULL;
32 unsigned int score, mdesc_score = ~1;
33 unsigned long dt_root; 43 unsigned long dt_root;
34 const char *model, *compat;
35 void *clk; 44 void *clk;
36 char manufacturer[16];
37 unsigned long len; 45 unsigned long len;
38 46
39 /* check device tree validity */ 47 if (!early_init_dt_scan(dt))
40 if (be32_to_cpu(devtree->magic) != OF_DT_HEADER)
41 return NULL; 48 return NULL;
42 49
43 initial_boot_params = devtree; 50 mdesc = of_flat_dt_match_machine(NULL, arch_get_next_mach);
44 dt_root = of_get_flat_dt_root(); 51 if (!mdesc)
45
46 /*
47 * The kernel could be multi-platform enabled, thus could have many
48 * "baked-in" machine descriptors. Search thru all for the best
49 * "compatible" string match.
50 */
51 for_each_machine_desc(mdesc) {
52 score = of_flat_dt_match(dt_root, mdesc->dt_compat);
53 if (score > 0 && score < mdesc_score) {
54 mdesc_best = mdesc;
55 mdesc_score = score;
56 }
57 }
58 if (!mdesc_best) {
59 const char *prop;
60 long size;
61
62 pr_err("\n unrecognized device tree list:\n[ ");
63
64 prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
65 if (prop) {
66 while (size > 0) {
67 printk("'%s' ", prop);
68 size -= strlen(prop) + 1;
69 prop += strlen(prop) + 1;
70 }
71 }
72 printk("]\n\n");
73
74 machine_halt(); 52 machine_halt();
75 }
76
77 /* compat = "<manufacturer>,<model>" */
78 compat = mdesc_best->dt_compat[0];
79
80 model = strchr(compat, ',');
81 if (model)
82 model++;
83
84 strlcpy(manufacturer, compat, model ? model - compat : strlen(compat));
85
86 pr_info("Board \"%s\" from %s (Manufacturer)\n", model, manufacturer);
87
88 /* Retrieve various information from the /chosen node */
89 of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
90
91 /* Initialize {size,address}-cells info */
92 of_scan_flat_dt(early_init_dt_scan_root, NULL);
93
94 /* Setup memory, calling early_init_dt_add_memory_arch */
95 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
96 53
54 dt_root = of_get_flat_dt_root();
97 clk = of_get_flat_dt_prop(dt_root, "clock-frequency", &len); 55 clk = of_get_flat_dt_prop(dt_root, "clock-frequency", &len);
98 if (clk) 56 if (clk)
99 arc_set_core_freq(of_read_ulong(clk, len/4)); 57 arc_set_core_freq(of_read_ulong(clk, len/4));
100 58
101 return mdesc_best; 59 return mdesc;
102}
103
104/*
105 * Copy the flattened DT out of .init since unflattening doesn't copy strings
106 * and the normal DT APIs refs them from orig flat DT
107 */
108void __init copy_devtree(void)
109{
110 void *alloc = early_init_dt_alloc_memory_arch(
111 be32_to_cpu(initial_boot_params->totalsize), 64);
112 if (alloc) {
113 memcpy(alloc, initial_boot_params,
114 be32_to_cpu(initial_boot_params->totalsize));
115 initial_boot_params = alloc;
116 }
117} 60}
diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S
index b908dde8a331..47d09d07f093 100644
--- a/arch/arc/kernel/entry.S
+++ b/arch/arc/kernel/entry.S
@@ -250,6 +250,14 @@ ARC_ENTRY handle_interrupt_level1
250 lr r0, [icause1] 250 lr r0, [icause1]
251 and r0, r0, 0x1f 251 and r0, r0, 0x1f
252 252
253#ifdef CONFIG_TRACE_IRQFLAGS
254 ; icause1 needs to be read early, before calling tracing, which
255 ; can clobber scratch regs, hence use of stack to stash it
256 push r0
257 TRACE_ASM_IRQ_DISABLE
258 pop r0
259#endif
260
253 bl.d @arch_do_IRQ 261 bl.d @arch_do_IRQ
254 mov r1, sp 262 mov r1, sp
255 263
@@ -337,9 +345,9 @@ ARC_ENTRY EV_TLBProtV
337 ; vineetg: Mar 6th: Random Seg Fault issue #1 345 ; vineetg: Mar 6th: Random Seg Fault issue #1
338 ; ecr and efa were not saved in case an Intr sneaks in 346 ; ecr and efa were not saved in case an Intr sneaks in
339 ; after fake rtie 347 ; after fake rtie
340 ; 348
341 lr r2, [ecr] 349 lr r2, [ecr]
342 lr r1, [efa] ; Faulting Data address 350 lr r0, [efa] ; Faulting Data address
343 351
344 ; --------(4) Return from CPU Exception Mode --------- 352 ; --------(4) Return from CPU Exception Mode ---------
345 ; Fake a rtie, but rtie to next label 353 ; Fake a rtie, but rtie to next label
@@ -348,6 +356,8 @@ ARC_ENTRY EV_TLBProtV
348 356
349 FAKE_RET_FROM_EXCPN r9 357 FAKE_RET_FROM_EXCPN r9
350 358
359 mov r1, sp
360
351 ;------ (5) Type of Protection Violation? ---------- 361 ;------ (5) Type of Protection Violation? ----------
352 ; 362 ;
353 ; ProtV Hardware Exception is triggered for Access Faults of 2 types 363 ; ProtV Hardware Exception is triggered for Access Faults of 2 types
@@ -358,16 +368,12 @@ ARC_ENTRY EV_TLBProtV
358 bbit1 r2, ECR_C_BIT_PROTV_MISALIG_DATA, 4f 368 bbit1 r2, ECR_C_BIT_PROTV_MISALIG_DATA, 4f
359 369
360 ;========= (6a) Access Violation Processing ======== 370 ;========= (6a) Access Violation Processing ========
361 mov r0, sp ; pt_regs
362 bl do_page_fault 371 bl do_page_fault
363 b ret_from_exception 372 b ret_from_exception
364 373
365 ;========== (6b) Non aligned access ============ 374 ;========== (6b) Non aligned access ============
3664: 3754:
367 mov r0, r1
368 mov r1, sp ; pt_regs
369 376
370#ifdef CONFIG_ARC_MISALIGN_ACCESS
371 SAVE_CALLEE_SAVED_USER 377 SAVE_CALLEE_SAVED_USER
372 mov r2, sp ; callee_regs 378 mov r2, sp ; callee_regs
373 379
@@ -376,9 +382,6 @@ ARC_ENTRY EV_TLBProtV
376 ; TBD: optimize - do this only if a callee reg was involved 382 ; TBD: optimize - do this only if a callee reg was involved
377 ; either a dst of emulated LD/ST or src with address-writeback 383 ; either a dst of emulated LD/ST or src with address-writeback
378 RESTORE_CALLEE_SAVED_USER 384 RESTORE_CALLEE_SAVED_USER
379#else
380 bl do_misaligned_error
381#endif
382 385
383 b ret_from_exception 386 b ret_from_exception
384 387
@@ -575,6 +578,7 @@ resume_user_mode_begin:
575 ; --- (Slow Path #2) pending signal --- 578 ; --- (Slow Path #2) pending signal ---
576 mov r0, sp ; pt_regs for arg to do_signal()/do_notify_resume() 579 mov r0, sp ; pt_regs for arg to do_signal()/do_notify_resume()
577 580
581 GET_CURR_THR_INFO_FLAGS r9
578 bbit0 r9, TIF_SIGPENDING, .Lchk_notify_resume 582 bbit0 r9, TIF_SIGPENDING, .Lchk_notify_resume
579 583
580 ; Normal Trap/IRQ entry only saves Scratch (caller-saved) regs 584 ; Normal Trap/IRQ entry only saves Scratch (caller-saved) regs
@@ -640,6 +644,8 @@ resume_kernel_mode:
640 644
641restore_regs : 645restore_regs :
642 646
647 TRACE_ASM_IRQ_ENABLE
648
643 lr r10, [status32] 649 lr r10, [status32]
644 650
645 ; Restore REG File. In case multiple Events outstanding, 651 ; Restore REG File. In case multiple Events outstanding,
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
index 0f944f024513..2c878e964a64 100644
--- a/arch/arc/kernel/head.S
+++ b/arch/arc/kernel/head.S
@@ -95,7 +95,7 @@ stext:
95;---------------------------------------------------------------- 95;----------------------------------------------------------------
96; First lines of code run by secondary before jumping to 'C' 96; First lines of code run by secondary before jumping to 'C'
97;---------------------------------------------------------------- 97;----------------------------------------------------------------
98 .section .init.text, "ax",@progbits 98 .section .text, "ax",@progbits
99 .type first_lines_of_secondary, @function 99 .type first_lines_of_secondary, @function
100 .globl first_lines_of_secondary 100 .globl first_lines_of_secondary
101 101
diff --git a/arch/arc/kernel/irq.c b/arch/arc/kernel/irq.c
index 5fc92455da36..a4b141ee9a6a 100644
--- a/arch/arc/kernel/irq.c
+++ b/arch/arc/kernel/irq.c
@@ -39,10 +39,14 @@ void arc_init_IRQ(void)
39 level_mask |= IS_ENABLED(CONFIG_ARC_IRQ5_LV2) << 5; 39 level_mask |= IS_ENABLED(CONFIG_ARC_IRQ5_LV2) << 5;
40 level_mask |= IS_ENABLED(CONFIG_ARC_IRQ6_LV2) << 6; 40 level_mask |= IS_ENABLED(CONFIG_ARC_IRQ6_LV2) << 6;
41 41
42 if (level_mask) { 42 /*
43 * Write to register, even if no LV2 IRQs configured to reset it
44 * in case bootloader had mucked with it
45 */
46 write_aux_reg(AUX_IRQ_LEV, level_mask);
47
48 if (level_mask)
43 pr_info("Level-2 interrupts bitset %x\n", level_mask); 49 pr_info("Level-2 interrupts bitset %x\n", level_mask);
44 write_aux_reg(AUX_IRQ_LEV, level_mask);
45 }
46} 50}
47 51
48/* 52/*
@@ -146,7 +150,7 @@ void arch_do_IRQ(unsigned int irq, struct pt_regs *regs)
146 set_irq_regs(old_regs); 150 set_irq_regs(old_regs);
147} 151}
148 152
149int __init get_hw_config_num_irq(void) 153int get_hw_config_num_irq(void)
150{ 154{
151 uint32_t val = read_aux_reg(ARC_REG_VECBASE_BCR); 155 uint32_t val = read_aux_reg(ARC_REG_VECBASE_BCR);
152 156
diff --git a/arch/arc/kernel/kgdb.c b/arch/arc/kernel/kgdb.c
index a7698fb14818..a2ff5c5d1450 100644
--- a/arch/arc/kernel/kgdb.c
+++ b/arch/arc/kernel/kgdb.c
@@ -196,6 +196,18 @@ void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip)
196 instruction_pointer(regs) = ip; 196 instruction_pointer(regs) = ip;
197} 197}
198 198
199static void kgdb_call_nmi_hook(void *ignored)
200{
201 kgdb_nmicallback(raw_smp_processor_id(), NULL);
202}
203
204void kgdb_roundup_cpus(unsigned long flags)
205{
206 local_irq_enable();
207 smp_call_function(kgdb_call_nmi_hook, NULL, 0);
208 local_irq_disable();
209}
210
199struct kgdb_arch arch_kgdb_ops = { 211struct kgdb_arch arch_kgdb_ops = {
200 /* breakpoint instruction: TRAP_S 0x3 */ 212 /* breakpoint instruction: TRAP_S 0x3 */
201#ifdef CONFIG_CPU_BIG_ENDIAN 213#ifdef CONFIG_CPU_BIG_ENDIAN
diff --git a/arch/arc/kernel/kprobes.c b/arch/arc/kernel/kprobes.c
index 72f97822784a..eb1c2ee5eaf0 100644
--- a/arch/arc/kernel/kprobes.c
+++ b/arch/arc/kernel/kprobes.c
@@ -87,13 +87,13 @@ static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
87 87
88static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) 88static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
89{ 89{
90 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; 90 __this_cpu_write(current_kprobe, kcb->prev_kprobe.kp);
91 kcb->kprobe_status = kcb->prev_kprobe.status; 91 kcb->kprobe_status = kcb->prev_kprobe.status;
92} 92}
93 93
94static inline void __kprobes set_current_kprobe(struct kprobe *p) 94static inline void __kprobes set_current_kprobe(struct kprobe *p)
95{ 95{
96 __get_cpu_var(current_kprobe) = p; 96 __this_cpu_write(current_kprobe, p);
97} 97}
98 98
99static void __kprobes resume_execution(struct kprobe *p, unsigned long addr, 99static void __kprobes resume_execution(struct kprobe *p, unsigned long addr,
@@ -237,7 +237,7 @@ int __kprobes arc_kprobe_handler(unsigned long addr, struct pt_regs *regs)
237 237
238 return 1; 238 return 1;
239 } else if (kprobe_running()) { 239 } else if (kprobe_running()) {
240 p = __get_cpu_var(current_kprobe); 240 p = __this_cpu_read(current_kprobe);
241 if (p->break_handler && p->break_handler(p, regs)) { 241 if (p->break_handler && p->break_handler(p, regs)) {
242 setup_singlestep(p, regs); 242 setup_singlestep(p, regs);
243 kcb->kprobe_status = KPROBE_HIT_SS; 243 kcb->kprobe_status = KPROBE_HIT_SS;
diff --git a/arch/arc/kernel/ptrace.c b/arch/arc/kernel/ptrace.c
index 333238564b67..5d76706139dd 100644
--- a/arch/arc/kernel/ptrace.c
+++ b/arch/arc/kernel/ptrace.c
@@ -102,7 +102,7 @@ static int genregs_set(struct task_struct *target,
102 REG_IGNORE_ONE(pad2); 102 REG_IGNORE_ONE(pad2);
103 REG_IN_CHUNK(callee, efa, cregs); /* callee_regs[r25..r13] */ 103 REG_IN_CHUNK(callee, efa, cregs); /* callee_regs[r25..r13] */
104 REG_IGNORE_ONE(efa); /* efa update invalid */ 104 REG_IGNORE_ONE(efa); /* efa update invalid */
105 REG_IN_ONE(stop_pc, &ptregs->ret); /* stop_pc: PC update */ 105 REG_IGNORE_ONE(stop_pc); /* PC updated via @ret */
106 106
107 return ret; 107 return ret;
108} 108}
diff --git a/arch/arc/kernel/reset.c b/arch/arc/kernel/reset.c
index e227a2b1c943..2768fa1e39b9 100644
--- a/arch/arc/kernel/reset.c
+++ b/arch/arc/kernel/reset.c
@@ -31,3 +31,4 @@ void machine_power_off(void)
31} 31}
32 32
33void (*pm_power_off) (void) = NULL; 33void (*pm_power_off) (void) = NULL;
34EXPORT_SYMBOL(pm_power_off);
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 2c68bc7e6a78..643eae4436e0 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -21,7 +21,6 @@
21#include <asm/setup.h> 21#include <asm/setup.h>
22#include <asm/page.h> 22#include <asm/page.h>
23#include <asm/irq.h> 23#include <asm/irq.h>
24#include <asm/prom.h>
25#include <asm/unwind.h> 24#include <asm/unwind.h>
26#include <asm/clk.h> 25#include <asm/clk.h>
27#include <asm/mach_desc.h> 26#include <asm/mach_desc.h>
@@ -31,14 +30,13 @@
31int running_on_hw = 1; /* vs. on ISS */ 30int running_on_hw = 1; /* vs. on ISS */
32 31
33char __initdata command_line[COMMAND_LINE_SIZE]; 32char __initdata command_line[COMMAND_LINE_SIZE];
34struct machine_desc *machine_desc; 33const struct machine_desc *machine_desc;
35 34
36struct task_struct *_current_task[NR_CPUS]; /* For stack switching */ 35struct task_struct *_current_task[NR_CPUS]; /* For stack switching */
37 36
38struct cpuinfo_arc cpuinfo_arc700[NR_CPUS]; 37struct cpuinfo_arc cpuinfo_arc700[NR_CPUS];
39 38
40 39static void read_arc_build_cfg_regs(void)
41void read_arc_build_cfg_regs(void)
42{ 40{
43 struct bcr_perip uncached_space; 41 struct bcr_perip uncached_space;
44 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 42 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
@@ -106,7 +104,7 @@ static const struct cpuinfo_data arc_cpu_tbl[] = {
106 { {0x00, NULL } } 104 { {0x00, NULL } }
107}; 105};
108 106
109char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len) 107static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len)
110{ 108{
111 int n = 0; 109 int n = 0;
112 struct cpuinfo_arc *cpu = &cpuinfo_arc700[cpu_id]; 110 struct cpuinfo_arc *cpu = &cpuinfo_arc700[cpu_id];
@@ -171,7 +169,7 @@ static const struct id_to_str mac_mul_nm[] = {
171 {0x6, "Dual 16x16 and 32x16"} 169 {0x6, "Dual 16x16 and 32x16"}
172}; 170};
173 171
174char *arc_extn_mumbojumbo(int cpu_id, char *buf, int len) 172static char *arc_extn_mumbojumbo(int cpu_id, char *buf, int len)
175{ 173{
176 int n = 0; 174 int n = 0;
177 struct cpuinfo_arc *cpu = &cpuinfo_arc700[cpu_id]; 175 struct cpuinfo_arc *cpu = &cpuinfo_arc700[cpu_id];
@@ -234,7 +232,7 @@ char *arc_extn_mumbojumbo(int cpu_id, char *buf, int len)
234 return buf; 232 return buf;
235} 233}
236 234
237void arc_chk_ccms(void) 235static void arc_chk_ccms(void)
238{ 236{
239#if defined(CONFIG_ARC_HAS_DCCM) || defined(CONFIG_ARC_HAS_ICCM) 237#if defined(CONFIG_ARC_HAS_DCCM) || defined(CONFIG_ARC_HAS_ICCM)
240 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 238 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
@@ -269,7 +267,7 @@ void arc_chk_ccms(void)
269 * hardware has dedicated regs which need to be saved/restored on ctx-sw 267 * hardware has dedicated regs which need to be saved/restored on ctx-sw
270 * (Single Precision uses core regs), thus kernel is kind of oblivious to it 268 * (Single Precision uses core regs), thus kernel is kind of oblivious to it
271 */ 269 */
272void arc_chk_fpu(void) 270static void arc_chk_fpu(void)
273{ 271{
274 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 272 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
275 273
@@ -346,8 +344,7 @@ void __init setup_arch(char **cmdline_p)
346 setup_arch_memory(); 344 setup_arch_memory();
347 345
348 /* copy flat DT out of .init and then unflatten it */ 346 /* copy flat DT out of .init and then unflatten it */
349 copy_devtree(); 347 unflatten_and_copy_device_tree();
350 unflatten_device_tree();
351 348
352 /* Can be issue if someone passes cmd line arg "ro" 349 /* Can be issue if someone passes cmd line arg "ro"
353 * But that is unlikely so keeping it as it is 350 * But that is unlikely so keeping it as it is
diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c
index ee6ef2f60a28..7e95e1a86510 100644
--- a/arch/arc/kernel/signal.c
+++ b/arch/arc/kernel/signal.c
@@ -101,7 +101,6 @@ SYSCALL_DEFINE0(rt_sigreturn)
101{ 101{
102 struct rt_sigframe __user *sf; 102 struct rt_sigframe __user *sf;
103 unsigned int magic; 103 unsigned int magic;
104 int err;
105 struct pt_regs *regs = current_pt_regs(); 104 struct pt_regs *regs = current_pt_regs();
106 105
107 /* Always make any pending restarted system calls return -EINTR */ 106 /* Always make any pending restarted system calls return -EINTR */
@@ -119,15 +118,16 @@ SYSCALL_DEFINE0(rt_sigreturn)
119 if (!access_ok(VERIFY_READ, sf, sizeof(*sf))) 118 if (!access_ok(VERIFY_READ, sf, sizeof(*sf)))
120 goto badframe; 119 goto badframe;
121 120
122 err = restore_usr_regs(regs, sf); 121 if (__get_user(magic, &sf->sigret_magic))
123 err |= __get_user(magic, &sf->sigret_magic);
124 if (err)
125 goto badframe; 122 goto badframe;
126 123
127 if (unlikely(is_do_ss_needed(magic))) 124 if (unlikely(is_do_ss_needed(magic)))
128 if (restore_altstack(&sf->uc.uc_stack)) 125 if (restore_altstack(&sf->uc.uc_stack))
129 goto badframe; 126 goto badframe;
130 127
128 if (restore_usr_regs(regs, sf))
129 goto badframe;
130
131 /* Don't restart from sigreturn */ 131 /* Don't restart from sigreturn */
132 syscall_wont_restart(regs); 132 syscall_wont_restart(regs);
133 133
@@ -191,6 +191,15 @@ setup_rt_frame(int signo, struct k_sigaction *ka, siginfo_t *info,
191 return 1; 191 return 1;
192 192
193 /* 193 /*
194 * w/o SA_SIGINFO, struct ucontext is partially populated (only
195 * uc_mcontext/uc_sigmask) for kernel's normal user state preservation
196 * during signal handler execution. This works for SA_SIGINFO as well
197 * although the semantics are now overloaded (the same reg state can be
198 * inspected by userland: but are they allowed to fiddle with it ?
199 */
200 err |= stash_usr_regs(sf, regs, set);
201
202 /*
194 * SA_SIGINFO requires 3 args to signal handler: 203 * SA_SIGINFO requires 3 args to signal handler:
195 * #1: sig-no (common to any handler) 204 * #1: sig-no (common to any handler)
196 * #2: struct siginfo 205 * #2: struct siginfo
@@ -213,14 +222,6 @@ setup_rt_frame(int signo, struct k_sigaction *ka, siginfo_t *info,
213 magic = MAGIC_SIGALTSTK; 222 magic = MAGIC_SIGALTSTK;
214 } 223 }
215 224
216 /*
217 * w/o SA_SIGINFO, struct ucontext is partially populated (only
218 * uc_mcontext/uc_sigmask) for kernel's normal user state preservation
219 * during signal handler execution. This works for SA_SIGINFO as well
220 * although the semantics are now overloaded (the same reg state can be
221 * inspected by userland: but are they allowed to fiddle with it ?
222 */
223 err |= stash_usr_regs(sf, regs, set);
224 err |= __put_user(magic, &sf->sigret_magic); 225 err |= __put_user(magic, &sf->sigret_magic);
225 if (err) 226 if (err)
226 return err; 227 return err;
diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c
index bca3052c956d..c2f9ebbc38f6 100644
--- a/arch/arc/kernel/smp.c
+++ b/arch/arc/kernel/smp.c
@@ -95,7 +95,7 @@ void __init smp_cpus_done(unsigned int max_cpus)
95 * If it turns out to be elaborate, it's better to code it in assembly 95 * If it turns out to be elaborate, it's better to code it in assembly
96 * 96 *
97 */ 97 */
98void __attribute__((weak)) arc_platform_smp_wait_to_boot(int cpu) 98void __weak arc_platform_smp_wait_to_boot(int cpu)
99{ 99{
100 /* 100 /*
101 * As a hack for debugging - since debugger will single-step over the 101 * As a hack for debugging - since debugger will single-step over the
@@ -128,6 +128,7 @@ void start_kernel_secondary(void)
128 atomic_inc(&mm->mm_users); 128 atomic_inc(&mm->mm_users);
129 atomic_inc(&mm->mm_count); 129 atomic_inc(&mm->mm_count);
130 current->active_mm = mm; 130 current->active_mm = mm;
131 cpumask_set_cpu(cpu, mm_cpumask(mm));
131 132
132 notify_cpu_starting(cpu); 133 notify_cpu_starting(cpu);
133 set_cpu_online(cpu, true); 134 set_cpu_online(cpu, true);
@@ -210,7 +211,6 @@ enum ipi_msg_type {
210 IPI_NOP = 0, 211 IPI_NOP = 0,
211 IPI_RESCHEDULE = 1, 212 IPI_RESCHEDULE = 1,
212 IPI_CALL_FUNC, 213 IPI_CALL_FUNC,
213 IPI_CALL_FUNC_SINGLE,
214 IPI_CPU_STOP 214 IPI_CPU_STOP
215}; 215};
216 216
@@ -254,7 +254,7 @@ void smp_send_stop(void)
254 254
255void arch_send_call_function_single_ipi(int cpu) 255void arch_send_call_function_single_ipi(int cpu)
256{ 256{
257 ipi_send_msg(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE); 257 ipi_send_msg(cpumask_of(cpu), IPI_CALL_FUNC);
258} 258}
259 259
260void arch_send_call_function_ipi_mask(const struct cpumask *mask) 260void arch_send_call_function_ipi_mask(const struct cpumask *mask)
@@ -286,10 +286,6 @@ static inline void __do_IPI(unsigned long *ops, struct ipi_data *ipi, int cpu)
286 generic_smp_call_function_interrupt(); 286 generic_smp_call_function_interrupt();
287 break; 287 break;
288 288
289 case IPI_CALL_FUNC_SINGLE:
290 generic_smp_call_function_single_interrupt();
291 break;
292
293 case IPI_CPU_STOP: 289 case IPI_CPU_STOP:
294 ipi_cpu_stop(cpu); 290 ipi_cpu_stop(cpu);
295 break; 291 break;
diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c
index f8b7d880304d..9ce47cfe2303 100644
--- a/arch/arc/kernel/stacktrace.c
+++ b/arch/arc/kernel/stacktrace.c
@@ -237,11 +237,14 @@ unsigned int get_wchan(struct task_struct *tsk)
237 */ 237 */
238void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) 238void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
239{ 239{
240 /* Assumes @tsk is sleeping so unwinds from __switch_to */
240 arc_unwind_core(tsk, NULL, __collect_all_but_sched, trace); 241 arc_unwind_core(tsk, NULL, __collect_all_but_sched, trace);
241} 242}
242 243
243void save_stack_trace(struct stack_trace *trace) 244void save_stack_trace(struct stack_trace *trace)
244{ 245{
245 arc_unwind_core(current, NULL, __collect_all, trace); 246 /* Pass NULL for task so it unwinds the current call frame */
247 arc_unwind_core(NULL, NULL, __collect_all, trace);
246} 248}
249EXPORT_SYMBOL_GPL(save_stack_trace);
247#endif 250#endif
diff --git a/arch/arc/kernel/time.c b/arch/arc/kernel/time.c
index 0e51e69cf30d..e5f3a837fb35 100644
--- a/arch/arc/kernel/time.c
+++ b/arch/arc/kernel/time.c
@@ -63,9 +63,10 @@
63 63
64int arc_counter_setup(void) 64int arc_counter_setup(void)
65{ 65{
66 /* RTSC insn taps into cpu clk, needs no setup */ 66 /*
67 67 * For SMP this needs to be 0. However Kconfig glue doesn't
68 /* For SMP, only allowed if cross-core-sync, hence usable as cs */ 68 * enable this option for SMP configs
69 */
69 return 1; 70 return 1;
70} 71}
71 72
@@ -206,7 +207,7 @@ static DEFINE_PER_CPU(struct clock_event_device, arc_clockevent_device) = {
206 207
207static irqreturn_t timer_irq_handler(int irq, void *dev_id) 208static irqreturn_t timer_irq_handler(int irq, void *dev_id)
208{ 209{
209 struct clock_event_device *clk = &__get_cpu_var(arc_clockevent_device); 210 struct clock_event_device *clk = this_cpu_ptr(&arc_clockevent_device);
210 211
211 arc_timer_event_ack(clk->mode == CLOCK_EVT_MODE_PERIODIC); 212 arc_timer_event_ack(clk->mode == CLOCK_EVT_MODE_PERIODIC);
212 clk->event_handler(clk); 213 clk->event_handler(clk);
@@ -223,16 +224,13 @@ static struct irqaction arc_timer_irq = {
223 * Setup the local event timer for @cpu 224 * Setup the local event timer for @cpu
224 * N.B. weak so that some exotic ARC SoCs can completely override it 225 * N.B. weak so that some exotic ARC SoCs can completely override it
225 */ 226 */
226void __attribute__((weak)) arc_local_timer_setup(unsigned int cpu) 227void __weak arc_local_timer_setup(unsigned int cpu)
227{ 228{
228 struct clock_event_device *clk = &per_cpu(arc_clockevent_device, cpu); 229 struct clock_event_device *clk = &per_cpu(arc_clockevent_device, cpu);
229 230
230 clockevents_calc_mult_shift(clk, arc_get_core_freq(), 5);
231
232 clk->max_delta_ns = clockevent_delta2ns(ARC_TIMER_MAX, clk);
233 clk->cpumask = cpumask_of(cpu); 231 clk->cpumask = cpumask_of(cpu);
234 232 clockevents_config_and_register(clk, arc_get_core_freq(),
235 clockevents_register_device(clk); 233 0, ARC_TIMER_MAX);
236 234
237 /* 235 /*
238 * setup the per-cpu timer IRQ handler - for all cpus 236 * setup the per-cpu timer IRQ handler - for all cpus
diff --git a/arch/arc/kernel/traps.c b/arch/arc/kernel/traps.c
index e21692d2fdab..3eadfdabc322 100644
--- a/arch/arc/kernel/traps.c
+++ b/arch/arc/kernel/traps.c
@@ -84,19 +84,18 @@ DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", do_memory_error, BUS_ADRERR)
84DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT) 84DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT)
85DO_ERROR_INFO(SIGBUS, "Misaligned Access", do_misaligned_error, BUS_ADRALN) 85DO_ERROR_INFO(SIGBUS, "Misaligned Access", do_misaligned_error, BUS_ADRALN)
86 86
87#ifdef CONFIG_ARC_MISALIGN_ACCESS
88/* 87/*
89 * Entry Point for Misaligned Data access Exception, for emulating in software 88 * Entry Point for Misaligned Data access Exception, for emulating in software
90 */ 89 */
91int do_misaligned_access(unsigned long address, struct pt_regs *regs, 90int do_misaligned_access(unsigned long address, struct pt_regs *regs,
92 struct callee_regs *cregs) 91 struct callee_regs *cregs)
93{ 92{
93 /* If emulation not enabled, or failed, kill the task */
94 if (misaligned_fixup(address, regs, cregs) != 0) 94 if (misaligned_fixup(address, regs, cregs) != 0)
95 return do_misaligned_error(address, regs); 95 return do_misaligned_error(address, regs);
96 96
97 return 0; 97 return 0;
98} 98}
99#endif
100 99
101/* 100/*
102 * Entry point for miscll errors such as Nested Exceptions 101 * Entry point for miscll errors such as Nested Exceptions
diff --git a/arch/arc/kernel/unaligned.c b/arch/arc/kernel/unaligned.c
index 28d170060747..7ff5b5c183bb 100644
--- a/arch/arc/kernel/unaligned.c
+++ b/arch/arc/kernel/unaligned.c
@@ -245,6 +245,12 @@ int misaligned_fixup(unsigned long address, struct pt_regs *regs,
245 regs->status32 &= ~STATUS_DE_MASK; 245 regs->status32 &= ~STATUS_DE_MASK;
246 } else { 246 } else {
247 regs->ret += state.instr_len; 247 regs->ret += state.instr_len;
248
249 /* handle zero-overhead-loop */
250 if ((regs->ret == regs->lp_end) && (regs->lp_count)) {
251 regs->ret = regs->lp_start;
252 regs->lp_count--;
253 }
248 } 254 }
249 255
250 return 0; 256 return 0;
diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c
index 5a1259cd948c..6b58c1de7577 100644
--- a/arch/arc/mm/cache_arc700.c
+++ b/arch/arc/mm/cache_arc700.c
@@ -182,7 +182,7 @@ void arc_cache_init(void)
182 182
183#ifdef CONFIG_ARC_HAS_ICACHE 183#ifdef CONFIG_ARC_HAS_ICACHE
184 /* 1. Confirm some of I-cache params which Linux assumes */ 184 /* 1. Confirm some of I-cache params which Linux assumes */
185 if (ic->line_len != ARC_ICACHE_LINE_LEN) 185 if (ic->line_len != L1_CACHE_BYTES)
186 panic("Cache H/W doesn't match kernel Config"); 186 panic("Cache H/W doesn't match kernel Config");
187 187
188 if (ic->ver != CONFIG_ARC_MMU_VER) 188 if (ic->ver != CONFIG_ARC_MMU_VER)
@@ -205,7 +205,7 @@ chk_dc:
205 return; 205 return;
206 206
207#ifdef CONFIG_ARC_HAS_DCACHE 207#ifdef CONFIG_ARC_HAS_DCACHE
208 if (dc->line_len != ARC_DCACHE_LINE_LEN) 208 if (dc->line_len != L1_CACHE_BYTES)
209 panic("Cache H/W doesn't match kernel Config"); 209 panic("Cache H/W doesn't match kernel Config");
210 210
211 /* check for D-Cache aliasing */ 211 /* check for D-Cache aliasing */
@@ -240,6 +240,67 @@ chk_dc:
240#define OP_INV 0x1 240#define OP_INV 0x1
241#define OP_FLUSH 0x2 241#define OP_FLUSH 0x2
242#define OP_FLUSH_N_INV 0x3 242#define OP_FLUSH_N_INV 0x3
243#define OP_INV_IC 0x4
244
245/*
246 * Common Helper for Line Operations on {I,D}-Cache
247 */
248static inline void __cache_line_loop(unsigned long paddr, unsigned long vaddr,
249 unsigned long sz, const int cacheop)
250{
251 unsigned int aux_cmd, aux_tag;
252 int num_lines;
253 const int full_page_op = __builtin_constant_p(sz) && sz == PAGE_SIZE;
254
255 if (cacheop == OP_INV_IC) {
256 aux_cmd = ARC_REG_IC_IVIL;
257 aux_tag = ARC_REG_IC_PTAG;
258 }
259 else {
260 /* d$ cmd: INV (discard or wback-n-discard) OR FLUSH (wback) */
261 aux_cmd = cacheop & OP_INV ? ARC_REG_DC_IVDL : ARC_REG_DC_FLDL;
262 aux_tag = ARC_REG_DC_PTAG;
263 }
264
265 /* Ensure we properly floor/ceil the non-line aligned/sized requests
266 * and have @paddr - aligned to cache line and integral @num_lines.
267 * This however can be avoided for page sized since:
268 * -@paddr will be cache-line aligned already (being page aligned)
269 * -@sz will be integral multiple of line size (being page sized).
270 */
271 if (!full_page_op) {
272 sz += paddr & ~CACHE_LINE_MASK;
273 paddr &= CACHE_LINE_MASK;
274 vaddr &= CACHE_LINE_MASK;
275 }
276
277 num_lines = DIV_ROUND_UP(sz, L1_CACHE_BYTES);
278
279#if (CONFIG_ARC_MMU_VER <= 2)
280 /* MMUv2 and before: paddr contains stuffed vaddrs bits */
281 paddr |= (vaddr >> PAGE_SHIFT) & 0x1F;
282#else
283 /* if V-P const for loop, PTAG can be written once outside loop */
284 if (full_page_op)
285 write_aux_reg(ARC_REG_DC_PTAG, paddr);
286#endif
287
288 while (num_lines-- > 0) {
289#if (CONFIG_ARC_MMU_VER > 2)
290 /* MMUv3, cache ops require paddr seperately */
291 if (!full_page_op) {
292 write_aux_reg(aux_tag, paddr);
293 paddr += L1_CACHE_BYTES;
294 }
295
296 write_aux_reg(aux_cmd, vaddr);
297 vaddr += L1_CACHE_BYTES;
298#else
299 write_aux_reg(aux, paddr);
300 paddr += L1_CACHE_BYTES;
301#endif
302 }
303}
243 304
244#ifdef CONFIG_ARC_HAS_DCACHE 305#ifdef CONFIG_ARC_HAS_DCACHE
245 306
@@ -289,53 +350,6 @@ static inline void __dc_entire_op(const int cacheop)
289 write_aux_reg(ARC_REG_DC_CTRL, tmp & ~DC_CTRL_INV_MODE_FLUSH); 350 write_aux_reg(ARC_REG_DC_CTRL, tmp & ~DC_CTRL_INV_MODE_FLUSH);
290} 351}
291 352
292/*
293 * Per Line Operation on D-Cache
294 * Doesn't deal with type-of-op/IRQ-disabling/waiting-for-flush-to-complete
295 * It's sole purpose is to help gcc generate ZOL
296 * (aliasing VIPT dcache flushing needs both vaddr and paddr)
297 */
298static inline void __dc_line_loop(unsigned long paddr, unsigned long vaddr,
299 unsigned long sz, const int aux_reg)
300{
301 int num_lines;
302
303 /* Ensure we properly floor/ceil the non-line aligned/sized requests
304 * and have @paddr - aligned to cache line and integral @num_lines.
305 * This however can be avoided for page sized since:
306 * -@paddr will be cache-line aligned already (being page aligned)
307 * -@sz will be integral multiple of line size (being page sized).
308 */
309 if (!(__builtin_constant_p(sz) && sz == PAGE_SIZE)) {
310 sz += paddr & ~DCACHE_LINE_MASK;
311 paddr &= DCACHE_LINE_MASK;
312 vaddr &= DCACHE_LINE_MASK;
313 }
314
315 num_lines = DIV_ROUND_UP(sz, ARC_DCACHE_LINE_LEN);
316
317#if (CONFIG_ARC_MMU_VER <= 2)
318 paddr |= (vaddr >> PAGE_SHIFT) & 0x1F;
319#endif
320
321 while (num_lines-- > 0) {
322#if (CONFIG_ARC_MMU_VER > 2)
323 /*
324 * Just as for I$, in MMU v3, D$ ops also require
325 * "tag" bits in DC_PTAG, "index" bits in FLDL,IVDL ops
326 */
327 write_aux_reg(ARC_REG_DC_PTAG, paddr);
328
329 write_aux_reg(aux_reg, vaddr);
330 vaddr += ARC_DCACHE_LINE_LEN;
331#else
332 /* paddr contains stuffed vaddrs bits */
333 write_aux_reg(aux_reg, paddr);
334#endif
335 paddr += ARC_DCACHE_LINE_LEN;
336 }
337}
338
339/* For kernel mappings cache operation: index is same as paddr */ 353/* For kernel mappings cache operation: index is same as paddr */
340#define __dc_line_op_k(p, sz, op) __dc_line_op(p, p, sz, op) 354#define __dc_line_op_k(p, sz, op) __dc_line_op(p, p, sz, op)
341 355
@@ -346,7 +360,6 @@ static inline void __dc_line_op(unsigned long paddr, unsigned long vaddr,
346 unsigned long sz, const int cacheop) 360 unsigned long sz, const int cacheop)
347{ 361{
348 unsigned long flags, tmp = tmp; 362 unsigned long flags, tmp = tmp;
349 int aux;
350 363
351 local_irq_save(flags); 364 local_irq_save(flags);
352 365
@@ -361,12 +374,7 @@ static inline void __dc_line_op(unsigned long paddr, unsigned long vaddr,
361 write_aux_reg(ARC_REG_DC_CTRL, tmp | DC_CTRL_INV_MODE_FLUSH); 374 write_aux_reg(ARC_REG_DC_CTRL, tmp | DC_CTRL_INV_MODE_FLUSH);
362 } 375 }
363 376
364 if (cacheop & OP_INV) /* Inv / flush-n-inv use same cmd reg */ 377 __cache_line_loop(paddr, vaddr, sz, cacheop);
365 aux = ARC_REG_DC_IVDL;
366 else
367 aux = ARC_REG_DC_FLDL;
368
369 __dc_line_loop(paddr, vaddr, sz, aux);
370 378
371 if (cacheop & OP_FLUSH) /* flush / flush-n-inv both wait */ 379 if (cacheop & OP_FLUSH) /* flush / flush-n-inv both wait */
372 wait_for_flush(); 380 wait_for_flush();
@@ -438,42 +446,9 @@ static void __ic_line_inv_vaddr(unsigned long paddr, unsigned long vaddr,
438 unsigned long sz) 446 unsigned long sz)
439{ 447{
440 unsigned long flags; 448 unsigned long flags;
441 int num_lines;
442
443 /*
444 * Ensure we properly floor/ceil the non-line aligned/sized requests:
445 * However page sized flushes can be compile time optimised.
446 * -@paddr will be cache-line aligned already (being page aligned)
447 * -@sz will be integral multiple of line size (being page sized).
448 */
449 if (!(__builtin_constant_p(sz) && sz == PAGE_SIZE)) {
450 sz += paddr & ~ICACHE_LINE_MASK;
451 paddr &= ICACHE_LINE_MASK;
452 vaddr &= ICACHE_LINE_MASK;
453 }
454
455 num_lines = DIV_ROUND_UP(sz, ARC_ICACHE_LINE_LEN);
456
457#if (CONFIG_ARC_MMU_VER <= 2)
458 /* bits 17:13 of vaddr go as bits 4:0 of paddr */
459 paddr |= (vaddr >> PAGE_SHIFT) & 0x1F;
460#endif
461 449
462 local_irq_save(flags); 450 local_irq_save(flags);
463 while (num_lines-- > 0) { 451 __cache_line_loop(paddr, vaddr, sz, OP_INV_IC);
464#if (CONFIG_ARC_MMU_VER > 2)
465 /* tag comes from phy addr */
466 write_aux_reg(ARC_REG_IC_PTAG, paddr);
467
468 /* index bits come from vaddr */
469 write_aux_reg(ARC_REG_IC_IVIL, vaddr);
470 vaddr += ARC_ICACHE_LINE_LEN;
471#else
472 /* paddr contains stuffed vaddrs bits */
473 write_aux_reg(ARC_REG_IC_IVIL, paddr);
474#endif
475 paddr += ARC_ICACHE_LINE_LEN;
476 }
477 local_irq_restore(flags); 452 local_irq_restore(flags);
478} 453}
479 454
diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c
index d63f3de0cd5b..9c69552350c4 100644
--- a/arch/arc/mm/fault.c
+++ b/arch/arc/mm/fault.c
@@ -17,7 +17,7 @@
17#include <asm/pgalloc.h> 17#include <asm/pgalloc.h>
18#include <asm/mmu.h> 18#include <asm/mmu.h>
19 19
20static int handle_vmalloc_fault(struct mm_struct *mm, unsigned long address) 20static int handle_vmalloc_fault(unsigned long address)
21{ 21{
22 /* 22 /*
23 * Synchronize this task's top level page-table 23 * Synchronize this task's top level page-table
@@ -27,7 +27,7 @@ static int handle_vmalloc_fault(struct mm_struct *mm, unsigned long address)
27 pud_t *pud, *pud_k; 27 pud_t *pud, *pud_k;
28 pmd_t *pmd, *pmd_k; 28 pmd_t *pmd, *pmd_k;
29 29
30 pgd = pgd_offset_fast(mm, address); 30 pgd = pgd_offset_fast(current->active_mm, address);
31 pgd_k = pgd_offset_k(address); 31 pgd_k = pgd_offset_k(address);
32 32
33 if (!pgd_present(*pgd_k)) 33 if (!pgd_present(*pgd_k))
@@ -52,7 +52,7 @@ bad_area:
52 return 1; 52 return 1;
53} 53}
54 54
55void do_page_fault(struct pt_regs *regs, unsigned long address) 55void do_page_fault(unsigned long address, struct pt_regs *regs)
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;
@@ -72,7 +72,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address)
72 * nothing more. 72 * nothing more.
73 */ 73 */
74 if (address >= VMALLOC_START && address <= VMALLOC_END) { 74 if (address >= VMALLOC_START && address <= VMALLOC_END) {
75 ret = handle_vmalloc_fault(mm, address); 75 ret = handle_vmalloc_fault(address);
76 if (unlikely(ret)) 76 if (unlikely(ret))
77 goto bad_area_nosemaphore; 77 goto bad_area_nosemaphore;
78 else 78 else
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index 81279ec73a6a..55e0a85bea78 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -125,10 +125,3 @@ void __init free_initrd_mem(unsigned long start, unsigned long end)
125 free_reserved_area((void *)start, (void *)end, -1, "initrd"); 125 free_reserved_area((void *)start, (void *)end, -1, "initrd");
126} 126}
127#endif 127#endif
128
129#ifdef CONFIG_OF_FLATTREE
130void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
131{
132 pr_err("%s(%llx, %llx)\n", __func__, start, end);
133}
134#endif /* CONFIG_OF_FLATTREE */
diff --git a/arch/arc/mm/tlb.c b/arch/arc/mm/tlb.c
index 71cb26df4255..e1acf0ce5647 100644
--- a/arch/arc/mm/tlb.c
+++ b/arch/arc/mm/tlb.c
@@ -100,7 +100,7 @@
100 100
101 101
102/* A copy of the ASID from the PID reg is kept in asid_cache */ 102/* A copy of the ASID from the PID reg is kept in asid_cache */
103unsigned int asid_cache = MM_CTXT_FIRST_CYCLE; 103DEFINE_PER_CPU(unsigned int, asid_cache) = MM_CTXT_FIRST_CYCLE;
104 104
105/* 105/*
106 * Utility Routine to erase a J-TLB entry 106 * Utility Routine to erase a J-TLB entry
@@ -274,6 +274,7 @@ noinline void local_flush_tlb_mm(struct mm_struct *mm)
274void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, 274void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
275 unsigned long end) 275 unsigned long end)
276{ 276{
277 const unsigned int cpu = smp_processor_id();
277 unsigned long flags; 278 unsigned long flags;
278 279
279 /* If range @start to @end is more than 32 TLB entries deep, 280 /* If range @start to @end is more than 32 TLB entries deep,
@@ -297,9 +298,9 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
297 298
298 local_irq_save(flags); 299 local_irq_save(flags);
299 300
300 if (vma->vm_mm->context.asid != MM_CTXT_NO_ASID) { 301 if (asid_mm(vma->vm_mm, cpu) != MM_CTXT_NO_ASID) {
301 while (start < end) { 302 while (start < end) {
302 tlb_entry_erase(start | hw_pid(vma->vm_mm)); 303 tlb_entry_erase(start | hw_pid(vma->vm_mm, cpu));
303 start += PAGE_SIZE; 304 start += PAGE_SIZE;
304 } 305 }
305 } 306 }
@@ -346,6 +347,7 @@ void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
346 347
347void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) 348void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
348{ 349{
350 const unsigned int cpu = smp_processor_id();
349 unsigned long flags; 351 unsigned long flags;
350 352
351 /* Note that it is critical that interrupts are DISABLED between 353 /* Note that it is critical that interrupts are DISABLED between
@@ -353,14 +355,87 @@ void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
353 */ 355 */
354 local_irq_save(flags); 356 local_irq_save(flags);
355 357
356 if (vma->vm_mm->context.asid != MM_CTXT_NO_ASID) { 358 if (asid_mm(vma->vm_mm, cpu) != MM_CTXT_NO_ASID) {
357 tlb_entry_erase((page & PAGE_MASK) | hw_pid(vma->vm_mm)); 359 tlb_entry_erase((page & PAGE_MASK) | hw_pid(vma->vm_mm, cpu));
358 utlb_invalidate(); 360 utlb_invalidate();
359 } 361 }
360 362
361 local_irq_restore(flags); 363 local_irq_restore(flags);
362} 364}
363 365
366#ifdef CONFIG_SMP
367
368struct tlb_args {
369 struct vm_area_struct *ta_vma;
370 unsigned long ta_start;
371 unsigned long ta_end;
372};
373
374static inline void ipi_flush_tlb_page(void *arg)
375{
376 struct tlb_args *ta = arg;
377
378 local_flush_tlb_page(ta->ta_vma, ta->ta_start);
379}
380
381static inline void ipi_flush_tlb_range(void *arg)
382{
383 struct tlb_args *ta = arg;
384
385 local_flush_tlb_range(ta->ta_vma, ta->ta_start, ta->ta_end);
386}
387
388static inline void ipi_flush_tlb_kernel_range(void *arg)
389{
390 struct tlb_args *ta = (struct tlb_args *)arg;
391
392 local_flush_tlb_kernel_range(ta->ta_start, ta->ta_end);
393}
394
395void flush_tlb_all(void)
396{
397 on_each_cpu((smp_call_func_t)local_flush_tlb_all, NULL, 1);
398}
399
400void flush_tlb_mm(struct mm_struct *mm)
401{
402 on_each_cpu_mask(mm_cpumask(mm), (smp_call_func_t)local_flush_tlb_mm,
403 mm, 1);
404}
405
406void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
407{
408 struct tlb_args ta = {
409 .ta_vma = vma,
410 .ta_start = uaddr
411 };
412
413 on_each_cpu_mask(mm_cpumask(vma->vm_mm), ipi_flush_tlb_page, &ta, 1);
414}
415
416void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
417 unsigned long end)
418{
419 struct tlb_args ta = {
420 .ta_vma = vma,
421 .ta_start = start,
422 .ta_end = end
423 };
424
425 on_each_cpu_mask(mm_cpumask(vma->vm_mm), ipi_flush_tlb_range, &ta, 1);
426}
427
428void flush_tlb_kernel_range(unsigned long start, unsigned long end)
429{
430 struct tlb_args ta = {
431 .ta_start = start,
432 .ta_end = end
433 };
434
435 on_each_cpu(ipi_flush_tlb_kernel_range, &ta, 1);
436}
437#endif
438
364/* 439/*
365 * Routine to create a TLB entry 440 * Routine to create a TLB entry
366 */ 441 */
@@ -400,7 +475,7 @@ void create_tlb(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
400 475
401 local_irq_save(flags); 476 local_irq_save(flags);
402 477
403 tlb_paranoid_check(vma->vm_mm->context.asid, address); 478 tlb_paranoid_check(asid_mm(vma->vm_mm, smp_processor_id()), address);
404 479
405 address &= PAGE_MASK; 480 address &= PAGE_MASK;
406 481
@@ -610,9 +685,9 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address,
610 struct pt_regs *regs) 685 struct pt_regs *regs)
611{ 686{
612 int set, way, n; 687 int set, way, n;
613 unsigned int pd0[4], pd1[4]; /* assume max 4 ways */
614 unsigned long flags, is_valid; 688 unsigned long flags, is_valid;
615 struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu; 689 struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu;
690 unsigned int pd0[mmu->ways], pd1[mmu->ways];
616 691
617 local_irq_save(flags); 692 local_irq_save(flags);
618 693
@@ -637,7 +712,7 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address,
637 continue; 712 continue;
638 713
639 /* Scan the set for duplicate ways: needs a nested loop */ 714 /* Scan the set for duplicate ways: needs a nested loop */
640 for (way = 0; way < mmu->ways; way++) { 715 for (way = 0; way < mmu->ways - 1; way++) {
641 if (!pd0[way]) 716 if (!pd0[way])
642 continue; 717 continue;
643 718
diff --git a/arch/arc/mm/tlbex.S b/arch/arc/mm/tlbex.S
index cf7d7d9ad695..3fcfdb38d242 100644
--- a/arch/arc/mm/tlbex.S
+++ b/arch/arc/mm/tlbex.S
@@ -369,8 +369,8 @@ do_slow_path_pf:
369 EXCEPTION_PROLOGUE 369 EXCEPTION_PROLOGUE
370 370
371 ; ------- setup args for Linux Page fault Hanlder --------- 371 ; ------- setup args for Linux Page fault Hanlder ---------
372 mov_s r0, sp 372 mov_s r1, sp
373 lr r1, [efa] 373 lr r0, [efa]
374 374
375 ; We don't want exceptions to be disabled while the fault is handled. 375 ; We don't want exceptions to be disabled while the fault is handled.
376 ; Now that we have saved the context we return from exception hence 376 ; Now that we have saved the context we return from exception hence
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7db8abe071f4..214b698cefea 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -6,6 +6,7 @@ config ARM
6 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST 6 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
7 select ARCH_HAVE_CUSTOM_GPIO_H 7 select ARCH_HAVE_CUSTOM_GPIO_H
8 select ARCH_MIGHT_HAVE_PC_PARPORT 8 select ARCH_MIGHT_HAVE_PC_PARPORT
9 select ARCH_USE_CMPXCHG_LOCKREF
9 select ARCH_WANT_IPC_PARSE_VERSION 10 select ARCH_WANT_IPC_PARSE_VERSION
10 select BUILDTIME_EXTABLE_SORT if MMU 11 select BUILDTIME_EXTABLE_SORT if MMU
11 select CLONE_BACKWARDS 12 select CLONE_BACKWARDS
@@ -52,9 +53,12 @@ config ARM
52 select HAVE_MOD_ARCH_SPECIFIC if ARM_UNWIND 53 select HAVE_MOD_ARCH_SPECIFIC if ARM_UNWIND
53 select HAVE_OPROFILE if (HAVE_PERF_EVENTS) 54 select HAVE_OPROFILE if (HAVE_PERF_EVENTS)
54 select HAVE_PERF_EVENTS 55 select HAVE_PERF_EVENTS
56 select HAVE_PERF_REGS
57 select HAVE_PERF_USER_STACK_DUMP
55 select HAVE_REGS_AND_STACK_ACCESS_API 58 select HAVE_REGS_AND_STACK_ACCESS_API
56 select HAVE_SYSCALL_TRACEPOINTS 59 select HAVE_SYSCALL_TRACEPOINTS
57 select HAVE_UID16 60 select HAVE_UID16
61 select HAVE_VIRT_CPU_ACCOUNTING_GEN
58 select IRQ_FORCED_THREADING 62 select IRQ_FORCED_THREADING
59 select KTIME_SCALAR 63 select KTIME_SCALAR
60 select MODULES_USE_ELF_REL 64 select MODULES_USE_ELF_REL
@@ -318,6 +322,7 @@ config ARCH_INTEGRATOR
318 select NEED_MACH_MEMORY_H 322 select NEED_MACH_MEMORY_H
319 select PLAT_VERSATILE 323 select PLAT_VERSATILE
320 select SPARSE_IRQ 324 select SPARSE_IRQ
325 select USE_OF
321 select VERSATILE_FPGA_IRQ 326 select VERSATILE_FPGA_IRQ
322 help 327 help
323 Support for ARM's Integrator platform. 328 Support for ARM's Integrator platform.
@@ -359,7 +364,6 @@ config ARCH_AT91
359 bool "Atmel AT91" 364 bool "Atmel AT91"
360 select ARCH_REQUIRE_GPIOLIB 365 select ARCH_REQUIRE_GPIOLIB
361 select CLKDEV_LOOKUP 366 select CLKDEV_LOOKUP
362 select HAVE_CLK
363 select IRQ_DOMAIN 367 select IRQ_DOMAIN
364 select NEED_MACH_GPIO_H 368 select NEED_MACH_GPIO_H
365 select NEED_MACH_IO_H if PCCARD 369 select NEED_MACH_IO_H if PCCARD
@@ -373,7 +377,6 @@ config ARCH_CLPS711X
373 bool "Cirrus Logic CLPS711x/EP721x/EP731x-based" 377 bool "Cirrus Logic CLPS711x/EP721x/EP731x-based"
374 select ARCH_REQUIRE_GPIOLIB 378 select ARCH_REQUIRE_GPIOLIB
375 select AUTO_ZRELADDR 379 select AUTO_ZRELADDR
376 select CLKDEV_LOOKUP
377 select CLKSRC_MMIO 380 select CLKSRC_MMIO
378 select COMMON_CLK 381 select COMMON_CLK
379 select CPU_ARM720T 382 select CPU_ARM720T
@@ -387,9 +390,9 @@ config ARCH_CLPS711X
387config ARCH_GEMINI 390config ARCH_GEMINI
388 bool "Cortina Systems Gemini" 391 bool "Cortina Systems Gemini"
389 select ARCH_REQUIRE_GPIOLIB 392 select ARCH_REQUIRE_GPIOLIB
390 select ARCH_USES_GETTIMEOFFSET 393 select CLKSRC_MMIO
391 select CPU_FA526 394 select CPU_FA526
392 select NEED_MACH_GPIO_H 395 select GENERIC_CLOCKEVENTS
393 help 396 help
394 Support for the Cortina Systems Gemini family SoCs 397 Support for the Cortina Systems Gemini family SoCs
395 398
@@ -458,7 +461,7 @@ config ARCH_IOP32X
458 depends on MMU 461 depends on MMU
459 select ARCH_REQUIRE_GPIOLIB 462 select ARCH_REQUIRE_GPIOLIB
460 select CPU_XSCALE 463 select CPU_XSCALE
461 select NEED_MACH_GPIO_H 464 select GPIO_IOP
462 select NEED_RET_TO_USER 465 select NEED_RET_TO_USER
463 select PCI 466 select PCI
464 select PLAT_IOP 467 select PLAT_IOP
@@ -471,7 +474,7 @@ config ARCH_IOP33X
471 depends on MMU 474 depends on MMU
472 select ARCH_REQUIRE_GPIOLIB 475 select ARCH_REQUIRE_GPIOLIB
473 select CPU_XSCALE 476 select CPU_XSCALE
474 select NEED_MACH_GPIO_H 477 select GPIO_IOP
475 select NEED_RET_TO_USER 478 select NEED_RET_TO_USER
476 select PCI 479 select PCI
477 select PLAT_IOP 480 select PLAT_IOP
@@ -482,6 +485,7 @@ config ARCH_IXP4XX
482 bool "IXP4xx-based" 485 bool "IXP4xx-based"
483 depends on MMU 486 depends on MMU
484 select ARCH_HAS_DMA_SET_COHERENT_MASK 487 select ARCH_HAS_DMA_SET_COHERENT_MASK
488 select ARCH_SUPPORTS_BIG_ENDIAN
485 select ARCH_REQUIRE_GPIOLIB 489 select ARCH_REQUIRE_GPIOLIB
486 select CLKSRC_MMIO 490 select CLKSRC_MMIO
487 select CPU_XSCALE 491 select CPU_XSCALE
@@ -560,7 +564,6 @@ config ARCH_MMP
560 select GPIO_PXA 564 select GPIO_PXA
561 select IRQ_DOMAIN 565 select IRQ_DOMAIN
562 select MULTI_IRQ_HANDLER 566 select MULTI_IRQ_HANDLER
563 select NEED_MACH_GPIO_H
564 select PINCTRL 567 select PINCTRL
565 select PLAT_PXA 568 select PLAT_PXA
566 select SPARSE_IRQ 569 select SPARSE_IRQ
@@ -623,7 +626,6 @@ config ARCH_PXA
623 select GPIO_PXA 626 select GPIO_PXA
624 select HAVE_IDE 627 select HAVE_IDE
625 select MULTI_IRQ_HANDLER 628 select MULTI_IRQ_HANDLER
626 select NEED_MACH_GPIO_H
627 select PLAT_PXA 629 select PLAT_PXA
628 select SPARSE_IRQ 630 select SPARSE_IRQ
629 help 631 help
@@ -632,7 +634,6 @@ config ARCH_PXA
632config ARCH_MSM 634config ARCH_MSM
633 bool "Qualcomm MSM" 635 bool "Qualcomm MSM"
634 select ARCH_REQUIRE_GPIOLIB 636 select ARCH_REQUIRE_GPIOLIB
635 select CLKDEV_LOOKUP
636 select CLKSRC_OF if OF 637 select CLKSRC_OF if OF
637 select COMMON_CLK 638 select COMMON_CLK
638 select GENERIC_CLOCKEVENTS 639 select GENERIC_CLOCKEVENTS
@@ -650,7 +651,6 @@ config ARCH_SHMOBILE
650 select GENERIC_CLOCKEVENTS 651 select GENERIC_CLOCKEVENTS
651 select HAVE_ARM_SCU if SMP 652 select HAVE_ARM_SCU if SMP
652 select HAVE_ARM_TWD if SMP 653 select HAVE_ARM_TWD if SMP
653 select HAVE_CLK
654 select HAVE_MACH_CLKDEV 654 select HAVE_MACH_CLKDEV
655 select HAVE_SMP 655 select HAVE_SMP
656 select MIGHT_HAVE_CACHE_L2X0 656 select MIGHT_HAVE_CACHE_L2X0
@@ -693,7 +693,6 @@ config ARCH_SA1100
693 select GENERIC_CLOCKEVENTS 693 select GENERIC_CLOCKEVENTS
694 select HAVE_IDE 694 select HAVE_IDE
695 select ISA 695 select ISA
696 select NEED_MACH_GPIO_H
697 select NEED_MACH_MEMORY_H 696 select NEED_MACH_MEMORY_H
698 select SPARSE_IRQ 697 select SPARSE_IRQ
699 help 698 help
@@ -707,7 +706,6 @@ config ARCH_S3C24XX
707 select CLKSRC_SAMSUNG_PWM 706 select CLKSRC_SAMSUNG_PWM
708 select GENERIC_CLOCKEVENTS 707 select GENERIC_CLOCKEVENTS
709 select GPIO_SAMSUNG 708 select GPIO_SAMSUNG
710 select HAVE_CLK
711 select HAVE_S3C2410_I2C if I2C 709 select HAVE_S3C2410_I2C if I2C
712 select HAVE_S3C2410_WATCHDOG if WATCHDOG 710 select HAVE_S3C2410_WATCHDOG if WATCHDOG
713 select HAVE_S3C_RTC if RTC_CLASS 711 select HAVE_S3C_RTC if RTC_CLASS
@@ -728,21 +726,22 @@ config ARCH_S3C64XX
728 select ARM_VIC 726 select ARM_VIC
729 select CLKDEV_LOOKUP 727 select CLKDEV_LOOKUP
730 select CLKSRC_SAMSUNG_PWM 728 select CLKSRC_SAMSUNG_PWM
729 select COMMON_CLK
731 select CPU_V6 730 select CPU_V6
732 select GENERIC_CLOCKEVENTS 731 select GENERIC_CLOCKEVENTS
733 select GPIO_SAMSUNG 732 select GPIO_SAMSUNG
734 select HAVE_CLK
735 select HAVE_S3C2410_I2C if I2C 733 select HAVE_S3C2410_I2C if I2C
736 select HAVE_S3C2410_WATCHDOG if WATCHDOG 734 select HAVE_S3C2410_WATCHDOG if WATCHDOG
737 select HAVE_TCM 735 select HAVE_TCM
738 select NEED_MACH_GPIO_H 736 select NEED_MACH_GPIO_H
739 select NO_IOPORT 737 select NO_IOPORT
740 select PLAT_SAMSUNG 738 select PLAT_SAMSUNG
739 select PM_GENERIC_DOMAINS
741 select S3C_DEV_NAND 740 select S3C_DEV_NAND
742 select S3C_GPIO_TRACK 741 select S3C_GPIO_TRACK
743 select SAMSUNG_ATAGS 742 select SAMSUNG_ATAGS
744 select SAMSUNG_CLKSRC
745 select SAMSUNG_GPIOLIB_4BIT 743 select SAMSUNG_GPIOLIB_4BIT
744 select SAMSUNG_WAKEMASK
746 select SAMSUNG_WDT_RESET 745 select SAMSUNG_WDT_RESET
747 select USB_ARCH_HAS_OHCI 746 select USB_ARCH_HAS_OHCI
748 help 747 help
@@ -755,7 +754,6 @@ config ARCH_S5P64X0
755 select CPU_V6 754 select CPU_V6
756 select GENERIC_CLOCKEVENTS 755 select GENERIC_CLOCKEVENTS
757 select GPIO_SAMSUNG 756 select GPIO_SAMSUNG
758 select HAVE_CLK
759 select HAVE_S3C2410_I2C if I2C 757 select HAVE_S3C2410_I2C if I2C
760 select HAVE_S3C2410_WATCHDOG if WATCHDOG 758 select HAVE_S3C2410_WATCHDOG if WATCHDOG
761 select HAVE_S3C_RTC if RTC_CLASS 759 select HAVE_S3C_RTC if RTC_CLASS
@@ -774,7 +772,6 @@ config ARCH_S5PC100
774 select CPU_V7 772 select CPU_V7
775 select GENERIC_CLOCKEVENTS 773 select GENERIC_CLOCKEVENTS
776 select GPIO_SAMSUNG 774 select GPIO_SAMSUNG
777 select HAVE_CLK
778 select HAVE_S3C2410_I2C if I2C 775 select HAVE_S3C2410_I2C if I2C
779 select HAVE_S3C2410_WATCHDOG if WATCHDOG 776 select HAVE_S3C2410_WATCHDOG if WATCHDOG
780 select HAVE_S3C_RTC if RTC_CLASS 777 select HAVE_S3C_RTC if RTC_CLASS
@@ -794,7 +791,6 @@ config ARCH_S5PV210
794 select CPU_V7 791 select CPU_V7
795 select GENERIC_CLOCKEVENTS 792 select GENERIC_CLOCKEVENTS
796 select GPIO_SAMSUNG 793 select GPIO_SAMSUNG
797 select HAVE_CLK
798 select HAVE_S3C2410_I2C if I2C 794 select HAVE_S3C2410_I2C if I2C
799 select HAVE_S3C2410_WATCHDOG if WATCHDOG 795 select HAVE_S3C2410_WATCHDOG if WATCHDOG
800 select HAVE_S3C_RTC if RTC_CLASS 796 select HAVE_S3C_RTC if RTC_CLASS
@@ -811,11 +807,9 @@ config ARCH_EXYNOS
811 select ARCH_REQUIRE_GPIOLIB 807 select ARCH_REQUIRE_GPIOLIB
812 select ARCH_SPARSEMEM_ENABLE 808 select ARCH_SPARSEMEM_ENABLE
813 select ARM_GIC 809 select ARM_GIC
814 select CLKDEV_LOOKUP
815 select COMMON_CLK 810 select COMMON_CLK
816 select CPU_V7 811 select CPU_V7
817 select GENERIC_CLOCKEVENTS 812 select GENERIC_CLOCKEVENTS
818 select HAVE_CLK
819 select HAVE_S3C2410_I2C if I2C 813 select HAVE_S3C2410_I2C if I2C
820 select HAVE_S3C2410_WATCHDOG if WATCHDOG 814 select HAVE_S3C2410_WATCHDOG if WATCHDOG
821 select HAVE_S3C_RTC if RTC_CLASS 815 select HAVE_S3C_RTC if RTC_CLASS
@@ -825,20 +819,6 @@ config ARCH_EXYNOS
825 help 819 help
826 Support for SAMSUNG's EXYNOS SoCs (EXYNOS4/5) 820 Support for SAMSUNG's EXYNOS SoCs (EXYNOS4/5)
827 821
828config ARCH_SHARK
829 bool "Shark"
830 select ARCH_USES_GETTIMEOFFSET
831 select CPU_SA110
832 select ISA
833 select ISA_DMA
834 select NEED_MACH_MEMORY_H
835 select PCI
836 select VIRT_TO_BUS
837 select ZONE_DMA
838 help
839 Support for the StrongARM based Digital DNARD machine, also known
840 as "Shark" (<http://www.shark-linux.de/shark.html>).
841
842config ARCH_DAVINCI 822config ARCH_DAVINCI
843 bool "TI DaVinci" 823 bool "TI DaVinci"
844 select ARCH_HAS_HOLES_MEMORYMODEL 824 select ARCH_HAS_HOLES_MEMORYMODEL
@@ -848,7 +828,6 @@ config ARCH_DAVINCI
848 select GENERIC_CLOCKEVENTS 828 select GENERIC_CLOCKEVENTS
849 select GENERIC_IRQ_CHIP 829 select GENERIC_IRQ_CHIP
850 select HAVE_IDE 830 select HAVE_IDE
851 select NEED_MACH_GPIO_H
852 select TI_PRIV_EDMA 831 select TI_PRIV_EDMA
853 select USE_OF 832 select USE_OF
854 select ZONE_DMA 833 select ZONE_DMA
@@ -866,7 +845,6 @@ config ARCH_OMAP1
866 select CLKSRC_MMIO 845 select CLKSRC_MMIO
867 select GENERIC_CLOCKEVENTS 846 select GENERIC_CLOCKEVENTS
868 select GENERIC_IRQ_CHIP 847 select GENERIC_IRQ_CHIP
869 select HAVE_CLK
870 select HAVE_IDE 848 select HAVE_IDE
871 select IRQ_DOMAIN 849 select IRQ_DOMAIN
872 select NEED_MACH_IO_H if PCCARD 850 select NEED_MACH_IO_H if PCCARD
@@ -1010,9 +988,7 @@ source "arch/arm/mach-sti/Kconfig"
1010 988
1011source "arch/arm/mach-s3c24xx/Kconfig" 989source "arch/arm/mach-s3c24xx/Kconfig"
1012 990
1013if ARCH_S3C64XX
1014source "arch/arm/mach-s3c64xx/Kconfig" 991source "arch/arm/mach-s3c64xx/Kconfig"
1015endif
1016 992
1017source "arch/arm/mach-s5p64x0/Kconfig" 993source "arch/arm/mach-s5p64x0/Kconfig"
1018 994
@@ -1092,11 +1068,6 @@ config IWMMXT
1092 Enable support for iWMMXt context switching at run time if 1068 Enable support for iWMMXt context switching at run time if
1093 running on a CPU that supports it. 1069 running on a CPU that supports it.
1094 1070
1095config XSCALE_PMU
1096 bool
1097 depends on CPU_XSCALE
1098 default y
1099
1100config MULTI_IRQ_HANDLER 1071config MULTI_IRQ_HANDLER
1101 bool 1072 bool
1102 help 1073 help
@@ -1432,12 +1403,6 @@ config PCI_NANOENGINE
1432config PCI_SYSCALL 1403config PCI_SYSCALL
1433 def_bool PCI 1404 def_bool PCI
1434 1405
1435# Select the host bridge type
1436config PCI_HOST_VIA82C505
1437 bool
1438 depends on PCI && ARCH_SHARK
1439 default y
1440
1441config PCI_HOST_ITE8152 1406config PCI_HOST_ITE8152
1442 bool 1407 bool
1443 depends on PCI && MACH_ARMCORE 1408 depends on PCI && MACH_ARMCORE
@@ -1468,7 +1433,6 @@ config SMP
1468 depends on GENERIC_CLOCKEVENTS 1433 depends on GENERIC_CLOCKEVENTS
1469 depends on HAVE_SMP 1434 depends on HAVE_SMP
1470 depends on MMU || ARM_MPU 1435 depends on MMU || ARM_MPU
1471 select USE_GENERIC_SMP_HELPERS
1472 help 1436 help
1473 This enables support for systems with more than one CPU. If you have 1437 This enables support for systems with more than one CPU. If you have
1474 a system with only one CPU, like most personal computers, say N. If 1438 a system with only one CPU, like most personal computers, say N. If
@@ -1550,6 +1514,32 @@ config MCPM
1550 for (multi-)cluster based systems, such as big.LITTLE based 1514 for (multi-)cluster based systems, such as big.LITTLE based
1551 systems. 1515 systems.
1552 1516
1517config BIG_LITTLE
1518 bool "big.LITTLE support (Experimental)"
1519 depends on CPU_V7 && SMP
1520 select MCPM
1521 help
1522 This option enables support selections for the big.LITTLE
1523 system architecture.
1524
1525config BL_SWITCHER
1526 bool "big.LITTLE switcher support"
1527 depends on BIG_LITTLE && MCPM && HOTPLUG_CPU
1528 select CPU_PM
1529 select ARM_CPU_SUSPEND
1530 help
1531 The big.LITTLE "switcher" provides the core functionality to
1532 transparently handle transition between a cluster of A15's
1533 and a cluster of A7's in a big.LITTLE system.
1534
1535config BL_SWITCHER_DUMMY_IF
1536 tristate "Simple big.LITTLE switcher user interface"
1537 depends on BL_SWITCHER && DEBUG_KERNEL
1538 help
1539 This is a simple and dummy char dev interface to control
1540 the big.LITTLE switcher core code. It is meant for
1541 debugging purposes only.
1542
1553choice 1543choice
1554 prompt "Memory split" 1544 prompt "Memory split"
1555 default VMSPLIT_3G 1545 default VMSPLIT_3G
@@ -1873,6 +1863,12 @@ config CC_STACKPROTECTOR
1873 neutralized via a kernel panic. 1863 neutralized via a kernel panic.
1874 This feature requires gcc version 4.2 or above. 1864 This feature requires gcc version 4.2 or above.
1875 1865
1866config SWIOTLB
1867 def_bool y
1868
1869config IOMMU_HELPER
1870 def_bool SWIOTLB
1871
1876config XEN_DOM0 1872config XEN_DOM0
1877 def_bool y 1873 def_bool y
1878 depends on XEN 1874 depends on XEN
@@ -1883,6 +1879,7 @@ config XEN
1883 depends on CPU_V7 && !CPU_V6 1879 depends on CPU_V7 && !CPU_V6
1884 depends on !GENERIC_ATOMIC64 1880 depends on !GENERIC_ATOMIC64
1885 select ARM_PSCI 1881 select ARM_PSCI
1882 select SWIOTLB_XEN
1886 help 1883 help
1887 Say Y if you want to run Linux in a Virtual Machine on Xen on ARM. 1884 Say Y if you want to run Linux in a Virtual Machine on Xen on ARM.
1888 1885
@@ -2218,8 +2215,7 @@ config NEON
2218 2215
2219config KERNEL_MODE_NEON 2216config KERNEL_MODE_NEON
2220 bool "Support for NEON in kernel mode" 2217 bool "Support for NEON in kernel mode"
2221 default n 2218 depends on NEON && AEABI
2222 depends on NEON
2223 help 2219 help
2224 Say Y to include support for NEON in kernel mode. 2220 Say Y to include support for NEON in kernel mode.
2225 2221
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 9762c84b4198..5765abf5ce84 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -318,6 +318,7 @@ choice
318 config DEBUG_MSM_UART1 318 config DEBUG_MSM_UART1
319 bool "Kernel low-level debugging messages via MSM UART1" 319 bool "Kernel low-level debugging messages via MSM UART1"
320 depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 320 depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50
321 select DEBUG_MSM_UART
321 help 322 help
322 Say Y here if you want the debug print routines to direct 323 Say Y here if you want the debug print routines to direct
323 their output to the first serial port on MSM devices. 324 their output to the first serial port on MSM devices.
@@ -325,6 +326,7 @@ choice
325 config DEBUG_MSM_UART2 326 config DEBUG_MSM_UART2
326 bool "Kernel low-level debugging messages via MSM UART2" 327 bool "Kernel low-level debugging messages via MSM UART2"
327 depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 328 depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50
329 select DEBUG_MSM_UART
328 help 330 help
329 Say Y here if you want the debug print routines to direct 331 Say Y here if you want the debug print routines to direct
330 their output to the second serial port on MSM devices. 332 their output to the second serial port on MSM devices.
@@ -332,6 +334,7 @@ choice
332 config DEBUG_MSM_UART3 334 config DEBUG_MSM_UART3
333 bool "Kernel low-level debugging messages via MSM UART3" 335 bool "Kernel low-level debugging messages via MSM UART3"
334 depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 336 depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50
337 select DEBUG_MSM_UART
335 help 338 help
336 Say Y here if you want the debug print routines to direct 339 Say Y here if you want the debug print routines to direct
337 their output to the third serial port on MSM devices. 340 their output to the third serial port on MSM devices.
@@ -340,6 +343,7 @@ choice
340 bool "Kernel low-level debugging messages via MSM 8660 UART" 343 bool "Kernel low-level debugging messages via MSM 8660 UART"
341 depends on ARCH_MSM8X60 344 depends on ARCH_MSM8X60
342 select MSM_HAS_DEBUG_UART_HS 345 select MSM_HAS_DEBUG_UART_HS
346 select DEBUG_MSM_UART
343 help 347 help
344 Say Y here if you want the debug print routines to direct 348 Say Y here if you want the debug print routines to direct
345 their output to the serial port on MSM 8660 devices. 349 their output to the serial port on MSM 8660 devices.
@@ -348,10 +352,20 @@ choice
348 bool "Kernel low-level debugging messages via MSM 8960 UART" 352 bool "Kernel low-level debugging messages via MSM 8960 UART"
349 depends on ARCH_MSM8960 353 depends on ARCH_MSM8960
350 select MSM_HAS_DEBUG_UART_HS 354 select MSM_HAS_DEBUG_UART_HS
355 select DEBUG_MSM_UART
351 help 356 help
352 Say Y here if you want the debug print routines to direct 357 Say Y here if you want the debug print routines to direct
353 their output to the serial port on MSM 8960 devices. 358 their output to the serial port on MSM 8960 devices.
354 359
360 config DEBUG_MSM8974_UART
361 bool "Kernel low-level debugging messages via MSM 8974 UART"
362 depends on ARCH_MSM8974
363 select MSM_HAS_DEBUG_UART_HS
364 select DEBUG_MSM_UART
365 help
366 Say Y here if you want the debug print routines to direct
367 their output to the serial port on MSM 8974 devices.
368
355 config DEBUG_MVEBU_UART 369 config DEBUG_MVEBU_UART
356 bool "Kernel low-level debugging messages via MVEBU UART (old bootloaders)" 370 bool "Kernel low-level debugging messages via MVEBU UART (old bootloaders)"
357 depends on ARCH_MVEBU 371 depends on ARCH_MVEBU
@@ -386,6 +400,13 @@ choice
386 when u-boot hands over to the kernel, the system 400 when u-boot hands over to the kernel, the system
387 silently crashes, with no serial output at all. 401 silently crashes, with no serial output at all.
388 402
403 config DEBUG_VF_UART
404 bool "Vybrid UART"
405 depends on SOC_VF610
406 help
407 Say Y here if you want kernel low-level debugging support
408 on Vybrid based platforms.
409
389 config DEBUG_NOMADIK_UART 410 config DEBUG_NOMADIK_UART
390 bool "Kernel low-level debugging messages via NOMADIK UART" 411 bool "Kernel low-level debugging messages via NOMADIK UART"
391 depends on ARCH_NOMADIK 412 depends on ARCH_NOMADIK
@@ -834,6 +855,20 @@ choice
834 options; the platform specific options are deprecated 855 options; the platform specific options are deprecated
835 and will be soon removed. 856 and will be soon removed.
836 857
858 config DEBUG_LL_UART_EFM32
859 bool "Kernel low-level debugging via efm32 UART"
860 depends on ARCH_EFM32
861 help
862 Say Y here if you want the debug print routines to direct
863 their output to an UART or USART port on efm32 based
864 machines. Use the following addresses for DEBUG_UART_PHYS:
865
866 0x4000c000 | USART0
867 0x4000c400 | USART1
868 0x4000c800 | USART2
869 0x4000e000 | UART0
870 0x4000e400 | UART1
871
837 config DEBUG_LL_UART_PL01X 872 config DEBUG_LL_UART_PL01X
838 bool "Kernel low-level debugging via ARM Ltd PL01x Primecell UART" 873 bool "Kernel low-level debugging via ARM Ltd PL01x Primecell UART"
839 help 874 help
@@ -880,11 +915,16 @@ config DEBUG_STI_UART
880 bool 915 bool
881 depends on ARCH_STI 916 depends on ARCH_STI
882 917
918config DEBUG_MSM_UART
919 bool
920 depends on ARCH_MSM
921
883config DEBUG_LL_INCLUDE 922config DEBUG_LL_INCLUDE
884 string 923 string
885 default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250 924 default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250
886 default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X 925 default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X
887 default "debug/exynos.S" if DEBUG_EXYNOS_UART 926 default "debug/exynos.S" if DEBUG_EXYNOS_UART
927 default "debug/efm32.S" if DEBUG_LL_UART_EFM32
888 default "debug/icedcc.S" if DEBUG_ICEDCC 928 default "debug/icedcc.S" if DEBUG_ICEDCC
889 default "debug/imx.S" if DEBUG_IMX1_UART || \ 929 default "debug/imx.S" if DEBUG_IMX1_UART || \
890 DEBUG_IMX25_UART || \ 930 DEBUG_IMX25_UART || \
@@ -895,17 +935,14 @@ config DEBUG_LL_INCLUDE
895 DEBUG_IMX53_UART ||\ 935 DEBUG_IMX53_UART ||\
896 DEBUG_IMX6Q_UART || \ 936 DEBUG_IMX6Q_UART || \
897 DEBUG_IMX6SL_UART 937 DEBUG_IMX6SL_UART
898 default "debug/msm.S" if DEBUG_MSM_UART1 || \ 938 default "debug/msm.S" if DEBUG_MSM_UART
899 DEBUG_MSM_UART2 || \
900 DEBUG_MSM_UART3 || \
901 DEBUG_MSM8660_UART || \
902 DEBUG_MSM8960_UART
903 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART 939 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART
904 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1 940 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1
905 default "debug/sti.S" if DEBUG_STI_UART 941 default "debug/sti.S" if DEBUG_STI_UART
906 default "debug/tegra.S" if DEBUG_TEGRA_UART 942 default "debug/tegra.S" if DEBUG_TEGRA_UART
907 default "debug/ux500.S" if DEBUG_UX500_UART 943 default "debug/ux500.S" if DEBUG_UX500_UART
908 default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT 944 default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT
945 default "debug/vf.S" if DEBUG_VF_UART
909 default "debug/vt8500.S" if DEBUG_VT8500_UART0 946 default "debug/vt8500.S" if DEBUG_VT8500_UART0
910 default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1 947 default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1
911 default "mach/debug-macro.S" 948 default "mach/debug-macro.S"
@@ -951,6 +988,7 @@ config DEBUG_UART_PHYS
951 default 0x20064000 if DEBUG_RK29_UART1 || DEBUG_RK3X_UART2 988 default 0x20064000 if DEBUG_RK29_UART1 || DEBUG_RK3X_UART2
952 default 0x20068000 if DEBUG_RK29_UART2 || DEBUG_RK3X_UART3 989 default 0x20068000 if DEBUG_RK29_UART2 || DEBUG_RK3X_UART3
953 default 0x20201000 if DEBUG_BCM2835 990 default 0x20201000 if DEBUG_BCM2835
991 default 0x4000e400 if DEBUG_LL_UART_EFM32
954 default 0x40090000 if ARCH_LPC32XX 992 default 0x40090000 if ARCH_LPC32XX
955 default 0x40100000 if DEBUG_PXA_UART1 993 default 0x40100000 if DEBUG_PXA_UART1
956 default 0x42000000 if ARCH_GEMINI 994 default 0x42000000 if ARCH_GEMINI
@@ -981,6 +1019,7 @@ config DEBUG_UART_PHYS
981 default 0xfff36000 if DEBUG_HIGHBANK_UART 1019 default 0xfff36000 if DEBUG_HIGHBANK_UART
982 default 0xfffff700 if ARCH_IOP33X 1020 default 0xfffff700 if ARCH_IOP33X
983 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ 1021 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
1022 DEBUG_LL_UART_EFM32 || \
984 DEBUG_UART_8250 || DEBUG_UART_PL01X 1023 DEBUG_UART_8250 || DEBUG_UART_PL01X
985 1024
986config DEBUG_UART_VIRT 1025config DEBUG_UART_VIRT
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index a37a50f575a2..c99b1086d83d 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -16,6 +16,7 @@ LDFLAGS :=
16LDFLAGS_vmlinux :=-p --no-undefined -X 16LDFLAGS_vmlinux :=-p --no-undefined -X
17ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) 17ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
18LDFLAGS_vmlinux += --be8 18LDFLAGS_vmlinux += --be8
19LDFLAGS_MODULE += --be8
19endif 20endif
20 21
21OBJCOPYFLAGS :=-O binary -R .comment -S 22OBJCOPYFLAGS :=-O binary -R .comment -S
@@ -188,7 +189,6 @@ machine-$(CONFIG_ARCH_S5P64X0) += s5p64x0
188machine-$(CONFIG_ARCH_S5PC100) += s5pc100 189machine-$(CONFIG_ARCH_S5PC100) += s5pc100
189machine-$(CONFIG_ARCH_S5PV210) += s5pv210 190machine-$(CONFIG_ARCH_S5PV210) += s5pv210
190machine-$(CONFIG_ARCH_SA1100) += sa1100 191machine-$(CONFIG_ARCH_SA1100) += sa1100
191machine-$(CONFIG_ARCH_SHARK) += shark
192machine-$(CONFIG_ARCH_SHMOBILE) += shmobile 192machine-$(CONFIG_ARCH_SHMOBILE) += shmobile
193machine-$(CONFIG_ARCH_SHMOBILE_MULTI) += shmobile 193machine-$(CONFIG_ARCH_SHMOBILE_MULTI) += shmobile
194machine-$(CONFIG_ARCH_SIRF) += prima2 194machine-$(CONFIG_ARCH_SIRF) += prima2
@@ -296,10 +296,15 @@ archprepare:
296# Convert bzImage to zImage 296# Convert bzImage to zImage
297bzImage: zImage 297bzImage: zImage
298 298
299zImage Image xipImage bootpImage uImage: vmlinux 299BOOT_TARGETS = zImage Image xipImage bootpImage uImage
300INSTALL_TARGETS = zinstall uinstall install
301
302PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
303
304$(BOOT_TARGETS): vmlinux
300 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ 305 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
301 306
302zinstall uinstall install: vmlinux 307$(INSTALL_TARGETS):
303 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ 308 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
304 309
305%.dtb: | scripts 310%.dtb: | scripts
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index 84aa2caf07ed..ec2f8065f955 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -95,24 +95,24 @@ initrd:
95 @test "$(INITRD)" != "" || \ 95 @test "$(INITRD)" != "" || \
96 (echo You must specify INITRD; exit -1) 96 (echo You must specify INITRD; exit -1)
97 97
98install: $(obj)/Image 98install:
99 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 99 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
100 $(obj)/Image System.map "$(INSTALL_PATH)" 100 $(obj)/Image System.map "$(INSTALL_PATH)"
101 101
102zinstall: $(obj)/zImage 102zinstall:
103 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 103 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
104 $(obj)/zImage System.map "$(INSTALL_PATH)" 104 $(obj)/zImage System.map "$(INSTALL_PATH)"
105 105
106uinstall: $(obj)/uImage 106uinstall:
107 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 107 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
108 $(obj)/uImage System.map "$(INSTALL_PATH)" 108 $(obj)/uImage System.map "$(INSTALL_PATH)"
109 109
110zi: 110zi:
111 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 111 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
112 $(obj)/zImage System.map "$(INSTALL_PATH)" 112 $(obj)/zImage System.map "$(INSTALL_PATH)"
113 113
114i: 114i:
115 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 115 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
116 $(obj)/Image System.map "$(INSTALL_PATH)" 116 $(obj)/Image System.map "$(INSTALL_PATH)"
117 117
118subdir- := bootp compressed dts 118subdir- := bootp compressed dts
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 7ac1610252ba..e7190bb5998e 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -44,10 +44,6 @@ ifeq ($(CONFIG_ARCH_ACORN),y)
44OBJS += ll_char_wr.o font.o 44OBJS += ll_char_wr.o font.o
45endif 45endif
46 46
47ifeq ($(CONFIG_ARCH_SHARK),y)
48OBJS += head-shark.o ofw-shark.o
49endif
50
51ifeq ($(CONFIG_ARCH_SA1100),y) 47ifeq ($(CONFIG_ARCH_SA1100),y)
52OBJS += head-sa1100.o 48OBJS += head-sa1100.o
53endif 49endif
diff --git a/arch/arm/boot/compressed/head-shark.S b/arch/arm/boot/compressed/head-shark.S
deleted file mode 100644
index 92b56897ed64..000000000000
--- a/arch/arm/boot/compressed/head-shark.S
+++ /dev/null
@@ -1,140 +0,0 @@
1/* The head-file for the Shark
2 * by Alexander Schulz
3 *
4 * Does the following:
5 * - get the memory layout from firmware. This can only be done as long as the mmu
6 * is still on.
7 * - switch the mmu off, so we have physical addresses
8 * - copy the kernel to 0x08508000. This is done to have a fixed address where the
9 * C-parts (misc.c) are executed. This address must be known at compile-time,
10 * but the load-address of the kernel depends on how much memory is installed.
11 * - Jump to this location.
12 * - Set r8 with 0, r7 with the architecture ID for head.S
13 */
14
15#include <linux/linkage.h>
16
17#include <asm/assembler.h>
18
19 .section ".start", "ax"
20
21 .arch armv4
22 b __beginning
23
24__ofw_data: .long 0 @ the number of memory blocks
25 .space 128 @ (startaddr,size) ...
26 .space 128 @ bootargs
27 .align
28
29__beginning: mov r4, r0 @ save the entry to the firmware
30
31 mov r0, #0xC0 @ disable irq and fiq
32 mov r1, r0
33 mrs r3, cpsr
34 bic r2, r3, r0
35 eor r2, r2, r1
36 msr cpsr_c, r2
37
38 mov r0, r4 @ get the Memory layout from firmware
39 adr r1, __ofw_data
40 add r2, r1, #4
41 mov lr, pc
42 b ofw_init
43 mov r1, #0
44
45 adr r2, __mmu_off @ calculate physical address
46 sub r2, r2, #0xf0000000 @ openprom maps us at f000 virt, 0e50 phys
47 adr r0, __ofw_data
48 ldr r0, [r0, #4]
49 add r2, r2, r0
50 add r2, r2, #0x00500000
51
52 mrc p15, 0, r3, c1, c0
53 bic r3, r3, #0xC @ Write Buffer and DCache
54 bic r3, r3, #0x1000 @ ICache
55 mcr p15, 0, r3, c1, c0 @ disabled
56
57 mov r0, #0
58 mcr p15, 0, r0, c7, c7 @ flush I,D caches on v4
59 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4
60 mcr p15, 0, r0, c8, c7 @ flush I,D TLBs on v4
61
62 bic r3, r3, #0x1 @ MMU
63 mcr p15, 0, r3, c1, c0 @ disabled
64
65 mov pc, r2
66
67__copy_target: .long 0x08507FFC
68__copy_end: .long 0x08607FFC
69
70 .word _start
71 .word __bss_start
72
73 .align
74__temp_stack: .space 128
75
76__mmu_off:
77 adr r0, __ofw_data @ read the 1. entry of the memory map
78 ldr r0, [r0, #4]
79 orr r0, r0, #0x00600000
80 sub r0, r0, #4
81
82 ldr r1, __copy_end
83 ldr r3, __copy_target
84
85/* r0 = 0x0e600000 (current end of kernelcode)
86 * r3 = 0x08508000 (where it should begin)
87 * r1 = 0x08608000 (end of copying area, 1MB)
88 * The kernel is compressed, so 1 MB should be enough.
89 * copy the kernel to the beginning of physical memory
90 * We start from the highest address, so we can copy
91 * from 0x08500000 to 0x08508000 if we have only 8MB
92 */
93
94/* As we get more 2.6-kernels it gets more and more
95 * uncomfortable to be bound to kernel images of 1MB only.
96 * So we add a loop here, to be able to copy some more.
97 * Alexander Schulz 2005-07-17
98 */
99
100 mov r4, #3 @ How many megabytes to copy
101
102
103__MoveCode: sub r4, r4, #1
104
105__Copy: ldr r2, [r0], #-4
106 str r2, [r1], #-4
107 teq r1, r3
108 bne __Copy
109
110 /* The firmware maps us in blocks of 1 MB, the next block is
111 _below_ the last one. So our decrementing source pointer
112 ist right here, but the destination pointer must be increased
113 by 2 MB */
114 add r1, r1, #0x00200000
115 add r3, r3, #0x00100000
116
117 teq r4, #0
118 bne __MoveCode
119
120
121 /* and jump to it */
122 adr r2, __go_on @ where we want to jump
123 adr r0, __ofw_data @ read the 1. entry of the memory map
124 ldr r0, [r0, #4]
125 sub r2, r2, r0 @ we are mapped add 0e50 now, sub that (-0e00)
126 sub r2, r2, #0x00500000 @ -0050
127 ldr r0, __copy_target @ and add 0850 8000 instead
128 add r0, r0, #4
129 add r2, r2, r0
130 mov pc, r2 @ and jump there
131
132__go_on:
133 adr sp, __temp_stack
134 add sp, sp, #128
135 adr r0, __ofw_data
136 mov lr, pc
137 b create_params
138
139 mov r8, #0
140 mov r7, #15
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 75189f13cf54..066b03480b63 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -135,6 +135,7 @@ start:
135 .word _edata @ zImage end address 135 .word _edata @ zImage end address
136 THUMB( .thumb ) 136 THUMB( .thumb )
1371: 1371:
138 ARM_BE8( setend be ) @ go BE8 if compiled for BE8
138 mrs r9, cpsr 139 mrs r9, cpsr
139#ifdef CONFIG_ARM_VIRT_EXT 140#ifdef CONFIG_ARM_VIRT_EXT
140 bl __hyp_stub_install @ get into SVC mode, reversibly 141 bl __hyp_stub_install @ get into SVC mode, reversibly
@@ -699,9 +700,7 @@ __armv4_mmu_cache_on:
699 mrc p15, 0, r0, c1, c0, 0 @ read control reg 700 mrc p15, 0, r0, c1, c0, 0 @ read control reg
700 orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement 701 orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement
701 orr r0, r0, #0x0030 702 orr r0, r0, #0x0030
702#ifdef CONFIG_CPU_ENDIAN_BE8 703 ARM_BE8( orr r0, r0, #1 << 25 ) @ big-endian page tables
703 orr r0, r0, #1 << 25 @ big-endian page tables
704#endif
705 bl __common_mmu_cache_on 704 bl __common_mmu_cache_on
706 mov r0, #0 705 mov r0, #0
707 mcr p15, 0, r0, c8, c7, 0 @ flush I,D TLBs 706 mcr p15, 0, r0, c8, c7, 0 @ flush I,D TLBs
@@ -728,9 +727,7 @@ __armv7_mmu_cache_on:
728 orr r0, r0, #1 << 22 @ U (v6 unaligned access model) 727 orr r0, r0, #1 << 22 @ U (v6 unaligned access model)
729 @ (needed for ARM1176) 728 @ (needed for ARM1176)
730#ifdef CONFIG_MMU 729#ifdef CONFIG_MMU
731#ifdef CONFIG_CPU_ENDIAN_BE8 730 ARM_BE8( orr r0, r0, #1 << 25 ) @ big-endian page tables
732 orr r0, r0, #1 << 25 @ big-endian page tables
733#endif
734 mrcne p15, 0, r6, c2, c0, 2 @ read ttb control reg 731 mrcne p15, 0, r6, c2, c0, 2 @ read ttb control reg
735 orrne r0, r0, #1 @ MMU enabled 732 orrne r0, r0, #1 @ MMU enabled
736 movne r1, #0xfffffffd @ domain 0 = client 733 movne r1, #0xfffffffd @ domain 0 = client
diff --git a/arch/arm/boot/compressed/ofw-shark.c b/arch/arm/boot/compressed/ofw-shark.c
deleted file mode 100644
index 465c54b6b128..000000000000
--- a/arch/arm/boot/compressed/ofw-shark.c
+++ /dev/null
@@ -1,260 +0,0 @@
1/*
2 * linux/arch/arm/boot/compressed/ofw-shark.c
3 *
4 * by Alexander Schulz
5 *
6 * This file is used to get some basic information
7 * about the memory layout of the shark we are running
8 * on. Memory is usually divided in blocks a 8 MB.
9 * And bootargs are copied from OpenFirmware.
10 */
11
12
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <asm/setup.h>
16#include <asm/page.h>
17
18
19asmlinkage void
20create_params (unsigned long *buffer)
21{
22 /* Is there a better address? Also change in mach-shark/core.c */
23 struct tag *tag = (struct tag *) 0x08003000;
24 int j,i,m,k,nr_banks,size;
25 unsigned char *c;
26
27 k = 0;
28
29 /* Head of the taglist */
30 tag->hdr.tag = ATAG_CORE;
31 tag->hdr.size = tag_size(tag_core);
32 tag->u.core.flags = 1;
33 tag->u.core.pagesize = PAGE_SIZE;
34 tag->u.core.rootdev = 0;
35
36 /* Build up one tagged block for each memory region */
37 size=0;
38 nr_banks=(unsigned int) buffer[0];
39 for (j=0;j<nr_banks;j++){
40 /* search the lowest address and put it into the next entry */
41 /* not a fast sort algorithm, but there are at most 8 entries */
42 /* and this is used only once anyway */
43 m=0xffffffff;
44 for (i=0;i<(unsigned int) buffer[0];i++){
45 if (buffer[2*i+1]<m) {
46 m=buffer[2*i+1];
47 k=i;
48 }
49 }
50
51 tag = tag_next(tag);
52 tag->hdr.tag = ATAG_MEM;
53 tag->hdr.size = tag_size(tag_mem32);
54 tag->u.mem.size = buffer[2*k+2];
55 tag->u.mem.start = buffer[2*k+1];
56
57 size += buffer[2*k+2];
58
59 buffer[2*k+1]=0xffffffff; /* mark as copied */
60 }
61
62 /* The command line */
63 tag = tag_next(tag);
64 tag->hdr.tag = ATAG_CMDLINE;
65
66 c=(unsigned char *)(&buffer[34]);
67 j=0;
68 while (*c) tag->u.cmdline.cmdline[j++]=*c++;
69
70 tag->u.cmdline.cmdline[j]=0;
71 tag->hdr.size = (j + 7 + sizeof(struct tag_header)) >> 2;
72
73 /* Hardware revision */
74 tag = tag_next(tag);
75 tag->hdr.tag = ATAG_REVISION;
76 tag->hdr.size = tag_size(tag_revision);
77 tag->u.revision.rev = ((unsigned char) buffer[33])-'0';
78
79 /* End of the taglist */
80 tag = tag_next(tag);
81 tag->hdr.tag = 0;
82 tag->hdr.size = 0;
83}
84
85
86typedef int (*ofw_handle_t)(void *);
87
88/* Everything below is called with a wrong MMU setting.
89 * This means: no string constants, no initialization of
90 * arrays, no global variables! This is ugly but I didn't
91 * want to write this in assembler :-)
92 */
93
94int
95of_decode_int(const unsigned char *p)
96{
97 unsigned int i = *p++ << 8;
98 i = (i + *p++) << 8;
99 i = (i + *p++) << 8;
100 return (i + *p);
101}
102
103int
104OF_finddevice(ofw_handle_t openfirmware, char *name)
105{
106 unsigned int args[8];
107 char service[12];
108
109 service[0]='f';
110 service[1]='i';
111 service[2]='n';
112 service[3]='d';
113 service[4]='d';
114 service[5]='e';
115 service[6]='v';
116 service[7]='i';
117 service[8]='c';
118 service[9]='e';
119 service[10]='\0';
120
121 args[0]=(unsigned int)service;
122 args[1]=1;
123 args[2]=1;
124 args[3]=(unsigned int)name;
125
126 if (openfirmware(args) == -1)
127 return -1;
128 return args[4];
129}
130
131int
132OF_getproplen(ofw_handle_t openfirmware, int handle, char *prop)
133{
134 unsigned int args[8];
135 char service[12];
136
137 service[0]='g';
138 service[1]='e';
139 service[2]='t';
140 service[3]='p';
141 service[4]='r';
142 service[5]='o';
143 service[6]='p';
144 service[7]='l';
145 service[8]='e';
146 service[9]='n';
147 service[10]='\0';
148
149 args[0] = (unsigned int)service;
150 args[1] = 2;
151 args[2] = 1;
152 args[3] = (unsigned int)handle;
153 args[4] = (unsigned int)prop;
154
155 if (openfirmware(args) == -1)
156 return -1;
157 return args[5];
158}
159
160int
161OF_getprop(ofw_handle_t openfirmware, int handle, char *prop, void *buf, unsigned int buflen)
162{
163 unsigned int args[8];
164 char service[8];
165
166 service[0]='g';
167 service[1]='e';
168 service[2]='t';
169 service[3]='p';
170 service[4]='r';
171 service[5]='o';
172 service[6]='p';
173 service[7]='\0';
174
175 args[0] = (unsigned int)service;
176 args[1] = 4;
177 args[2] = 1;
178 args[3] = (unsigned int)handle;
179 args[4] = (unsigned int)prop;
180 args[5] = (unsigned int)buf;
181 args[6] = buflen;
182
183 if (openfirmware(args) == -1)
184 return -1;
185 return args[7];
186}
187
188asmlinkage void ofw_init(ofw_handle_t o, int *nomr, int *pointer)
189{
190 int phandle,i,mem_len,buffer[32];
191 char temp[15];
192
193 temp[0]='/';
194 temp[1]='m';
195 temp[2]='e';
196 temp[3]='m';
197 temp[4]='o';
198 temp[5]='r';
199 temp[6]='y';
200 temp[7]='\0';
201
202 phandle=OF_finddevice(o,temp);
203
204 temp[0]='r';
205 temp[1]='e';
206 temp[2]='g';
207 temp[3]='\0';
208
209 mem_len = OF_getproplen(o,phandle, temp);
210 OF_getprop(o,phandle, temp, buffer, mem_len);
211 *nomr=mem_len >> 3;
212
213 for (i=0; i<=mem_len/4; i++) pointer[i]=of_decode_int((const unsigned char *)&buffer[i]);
214
215 temp[0]='/';
216 temp[1]='c';
217 temp[2]='h';
218 temp[3]='o';
219 temp[4]='s';
220 temp[5]='e';
221 temp[6]='n';
222 temp[7]='\0';
223
224 phandle=OF_finddevice(o,temp);
225
226 temp[0]='b';
227 temp[1]='o';
228 temp[2]='o';
229 temp[3]='t';
230 temp[4]='a';
231 temp[5]='r';
232 temp[6]='g';
233 temp[7]='s';
234 temp[8]='\0';
235
236 mem_len = OF_getproplen(o,phandle, temp);
237 OF_getprop(o,phandle, temp, buffer, mem_len);
238 if (mem_len > 128) mem_len=128;
239 for (i=0; i<=mem_len/4; i++) pointer[i+33]=buffer[i];
240 pointer[i+33]=0;
241
242 temp[0]='/';
243 temp[1]='\0';
244 phandle=OF_finddevice(o,temp);
245 temp[0]='b';
246 temp[1]='a';
247 temp[2]='n';
248 temp[3]='n';
249 temp[4]='e';
250 temp[5]='r';
251 temp[6]='-';
252 temp[7]='n';
253 temp[8]='a';
254 temp[9]='m';
255 temp[10]='e';
256 temp[11]='\0';
257 mem_len = OF_getproplen(o,phandle, temp);
258 OF_getprop(o,phandle, temp, buffer, mem_len);
259 * ((unsigned char *) &pointer[32]) = ((unsigned char *) buffer)[mem_len-2];
260}
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index cc0f1fb61753..d57c1a65b24f 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -40,15 +40,17 @@ dtb-$(CONFIG_ARCH_AT91) += sama5d31ek.dtb
40dtb-$(CONFIG_ARCH_AT91) += sama5d33ek.dtb 40dtb-$(CONFIG_ARCH_AT91) += sama5d33ek.dtb
41dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb 41dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb
42dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb 42dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb
43 43dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
44dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb 44dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
45dtb-$(CONFIG_ARCH_BCM) += bcm11351-brt.dtb \ 45dtb-$(CONFIG_ARCH_BCM_MOBILE) += bcm11351-brt.dtb \
46 bcm28155-ap.dtb 46 bcm28155-ap.dtb
47dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
47dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \ 48dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \
48 da850-evm.dtb 49 da850-evm.dtb
49dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \ 50dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \
50 dove-cubox.dtb \ 51 dove-cubox.dtb \
51 dove-d2plug.dtb \ 52 dove-d2plug.dtb \
53 dove-d3plug.dtb \
52 dove-dove-db.dtb 54 dove-dove-db.dtb
53dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \ 55dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
54 exynos4210-smdkv310.dtb \ 56 exynos4210-smdkv310.dtb \
@@ -94,22 +96,25 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
94 kirkwood-ns2mini.dtb \ 96 kirkwood-ns2mini.dtb \
95 kirkwood-nsa310.dtb \ 97 kirkwood-nsa310.dtb \
96 kirkwood-nsa310a.dtb \ 98 kirkwood-nsa310a.dtb \
99 kirkwood-openblocks_a6.dtb \
100 kirkwood-openblocks_a7.dtb \
97 kirkwood-sheevaplug.dtb \ 101 kirkwood-sheevaplug.dtb \
98 kirkwood-sheevaplug-esata.dtb \ 102 kirkwood-sheevaplug-esata.dtb \
99 kirkwood-topkick.dtb \ 103 kirkwood-topkick.dtb \
100 kirkwood-ts219-6281.dtb \ 104 kirkwood-ts219-6281.dtb \
101 kirkwood-ts219-6282.dtb \ 105 kirkwood-ts219-6282.dtb
102 kirkwood-openblocks_a6.dtb
103dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb 106dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb
104dtb-$(CONFIG_ARCH_MSM) += msm8660-surf.dtb \ 107dtb-$(CONFIG_ARCH_MSM) += qcom-msm8660-surf.dtb \
105 msm8960-cdp.dtb 108 qcom-msm8960-cdp.dtb
106dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \ 109dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \
107 armada-370-mirabox.dtb \ 110 armada-370-mirabox.dtb \
108 armada-370-netgear-rn102.dtb \ 111 armada-370-netgear-rn102.dtb \
112 armada-370-netgear-rn104.dtb \
109 armada-370-rd.dtb \ 113 armada-370-rd.dtb \
110 armada-xp-axpwifiap.dtb \ 114 armada-xp-axpwifiap.dtb \
111 armada-xp-db.dtb \ 115 armada-xp-db.dtb \
112 armada-xp-gp.dtb \ 116 armada-xp-gp.dtb \
117 armada-xp-matrix.dtb \
113 armada-xp-openblocks-ax3-4.dtb 118 armada-xp-openblocks-ax3-4.dtb
114dtb-$(CONFIG_ARCH_MXC) += \ 119dtb-$(CONFIG_ARCH_MXC) += \
115 imx25-karo-tx25.dtb \ 120 imx25-karo-tx25.dtb \
@@ -140,8 +145,10 @@ dtb-$(CONFIG_ARCH_MXC) += \
140 imx6q-sabrelite.dtb \ 145 imx6q-sabrelite.dtb \
141 imx6q-sabresd.dtb \ 146 imx6q-sabresd.dtb \
142 imx6q-sbc6x.dtb \ 147 imx6q-sbc6x.dtb \
148 imx6q-udoo.dtb \
143 imx6q-wandboard.dtb \ 149 imx6q-wandboard.dtb \
144 imx6sl-evk.dtb \ 150 imx6sl-evk.dtb \
151 vf610-cosmic.dtb \
145 vf610-twr.dtb 152 vf610-twr.dtb
146dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \ 153dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \
147 imx23-olinuxino.dtb \ 154 imx23-olinuxino.dtb \
@@ -157,6 +164,7 @@ dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \
157 imx28-cfa10057.dtb \ 164 imx28-cfa10057.dtb \
158 imx28-cfa10058.dtb \ 165 imx28-cfa10058.dtb \
159 imx28-evk.dtb \ 166 imx28-evk.dtb \
167 imx28-m28cu3.dtb \
160 imx28-m28evk.dtb \ 168 imx28-m28evk.dtb \
161 imx28-sps1.dtb \ 169 imx28-sps1.dtb \
162 imx28-tx28.dtb 170 imx28-tx28.dtb
@@ -170,9 +178,15 @@ dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \
170 omap3-devkit8000.dtb \ 178 omap3-devkit8000.dtb \
171 omap3-beagle-xm.dtb \ 179 omap3-beagle-xm.dtb \
172 omap3-evm.dtb \ 180 omap3-evm.dtb \
181 omap3-evm-37xx.dtb \
182 omap3-n900.dtb \
183 omap3-n9.dtb \
184 omap3-n950.dtb \
173 omap3-tobi.dtb \ 185 omap3-tobi.dtb \
186 omap3-gta04.dtb \
174 omap3-igep0020.dtb \ 187 omap3-igep0020.dtb \
175 omap3-igep0030.dtb \ 188 omap3-igep0030.dtb \
189 omap3-zoom3.dtb \
176 omap4-panda.dtb \ 190 omap4-panda.dtb \
177 omap4-panda-a4.dtb \ 191 omap4-panda-a4.dtb \
178 omap4-panda-es.dtb \ 192 omap4-panda-es.dtb \
@@ -183,25 +197,34 @@ dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \
183 am335x-evm.dtb \ 197 am335x-evm.dtb \
184 am335x-evmsk.dtb \ 198 am335x-evmsk.dtb \
185 am335x-bone.dtb \ 199 am335x-bone.dtb \
200 am335x-boneblack.dtb \
201 am335x-nano.dtb \
202 am335x-base0033.dtb \
186 am3517-evm.dtb \ 203 am3517-evm.dtb \
187 am3517_mt_ventoux.dtb \ 204 am3517_mt_ventoux.dtb \
188 am43x-epos-evm.dtb 205 am43x-epos-evm.dtb \
206 dra7-evm.dtb
189dtb-$(CONFIG_ARCH_ORION5X) += orion5x-lacie-ethernet-disk-mini-v2.dtb 207dtb-$(CONFIG_ARCH_ORION5X) += orion5x-lacie-ethernet-disk-mini-v2.dtb
190dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb 208dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb
191dtb-$(CONFIG_ARCH_U8500) += ste-snowball.dtb \ 209dtb-$(CONFIG_ARCH_U8500) += ste-snowball.dtb \
192 ste-hrefprev60.dtb \ 210 ste-hrefprev60-stuib.dtb \
193 ste-hrefv60plus.dtb \ 211 ste-hrefprev60-tvk.dtb \
212 ste-hrefv60plus-stuib.dtb \
213 ste-hrefv60plus-tvk.dtb \
194 ste-ccu8540.dtb \ 214 ste-ccu8540.dtb \
195 ste-ccu9540.dtb 215 ste-ccu9540.dtb
196dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb 216dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb
217dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb \
218 s3c6410-smdk6410.dtb
197dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \ 219dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
198 emev2-kzm9d-reference.dtb \ 220 r7s72100-genmai.dtb \
199 r8a7740-armadillo800eva.dtb \ 221 r8a7740-armadillo800eva.dtb \
200 r8a7778-bockw.dtb \ 222 r8a7778-bockw.dtb \
201 r8a7778-bockw-reference.dtb \ 223 r8a7778-bockw-reference.dtb \
202 r8a7740-armadillo800eva-reference.dtb \ 224 r8a7740-armadillo800eva-reference.dtb \
203 r8a7779-marzen.dtb \ 225 r8a7779-marzen.dtb \
204 r8a7779-marzen-reference.dtb \ 226 r8a7779-marzen-reference.dtb \
227 r8a7791-koelsch.dtb \
205 r8a7790-lager.dtb \ 228 r8a7790-lager.dtb \
206 r8a7790-lager-reference.dtb \ 229 r8a7790-lager-reference.dtb \
207 sh73a0-kzm9g.dtb \ 230 sh73a0-kzm9g.dtb \
@@ -209,8 +232,10 @@ dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
209 r8a73a4-ape6evm.dtb \ 232 r8a73a4-ape6evm.dtb \
210 r8a73a4-ape6evm-reference.dtb \ 233 r8a73a4-ape6evm-reference.dtb \
211 sh7372-mackerel.dtb 234 sh7372-mackerel.dtb
212dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d-reference.dtb 235dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb
213dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_cyclone5.dtb \ 236dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_arria5_socdk.dtb \
237 socfpga_cyclone5_socdk.dtb \
238 socfpga_cyclone5_sockit.dtb \
214 socfpga_vt.dtb 239 socfpga_vt.dtb
215dtb-$(CONFIG_ARCH_SPEAR13XX) += spear1310-evb.dtb \ 240dtb-$(CONFIG_ARCH_SPEAR13XX) += spear1310-evb.dtb \
216 spear1340-evb.dtb 241 spear1340-evb.dtb
@@ -232,6 +257,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += \
232 sun5i-a13-olinuxino.dtb \ 257 sun5i-a13-olinuxino.dtb \
233 sun6i-a31-colombus.dtb \ 258 sun6i-a31-colombus.dtb \
234 sun7i-a20-cubieboard2.dtb \ 259 sun7i-a20-cubieboard2.dtb \
260 sun7i-a20-cubietruck.dtb \
235 sun7i-a20-olinuxino-micro.dtb 261 sun7i-a20-olinuxino-micro.dtb
236dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ 262dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
237 tegra20-iris-512.dtb \ 263 tegra20-iris-512.dtb \
@@ -246,7 +272,8 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
246 tegra30-beaver.dtb \ 272 tegra30-beaver.dtb \
247 tegra30-cardhu-a02.dtb \ 273 tegra30-cardhu-a02.dtb \
248 tegra30-cardhu-a04.dtb \ 274 tegra30-cardhu-a04.dtb \
249 tegra114-dalmore.dtb 275 tegra114-dalmore.dtb \
276 tegra124-venice2.dtb
250dtb-$(CONFIG_ARCH_VERSATILE) += versatile-ab.dtb \ 277dtb-$(CONFIG_ARCH_VERSATILE) += versatile-ab.dtb \
251 versatile-pb.dtb 278 versatile-pb.dtb
252dtb-$(CONFIG_ARCH_U300) += ste-u300.dtb 279dtb-$(CONFIG_ARCH_U300) += ste-u300.dtb
diff --git a/arch/arm/boot/dts/am335x-base0033.dts b/arch/arm/boot/dts/am335x-base0033.dts
new file mode 100644
index 000000000000..b4f95c2bbf74
--- /dev/null
+++ b/arch/arm/boot/dts/am335x-base0033.dts
@@ -0,0 +1,16 @@
1/*
2 * am335x-base0033.dts - Device Tree file for IGEP AQUILA EXPANSION
3 *
4 * Copyright (C) 2013 ISEE 2007 SL - http://www.isee.biz
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 "am335x-igep0033.dtsi"
12
13/ {
14 model = "IGEP COM AM335x on AQUILA Expansion";
15 compatible = "isee,am335x-base0033", "isee,am335x-igep0033", "ti,am33xx";
16};
diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
new file mode 100644
index 000000000000..e3f27ec31718
--- /dev/null
+++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
@@ -0,0 +1,299 @@
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
9/ {
10 model = "TI AM335x BeagleBone";
11 compatible = "ti,am335x-bone", "ti,am33xx";
12
13 cpus {
14 cpu@0 {
15 cpu0-supply = <&dcdc2_reg>;
16 };
17 };
18
19 memory {
20 device_type = "memory";
21 reg = <0x80000000 0x10000000>; /* 256 MB */
22 };
23
24 leds {
25 pinctrl-names = "default";
26 pinctrl-0 = <&user_leds_s0>;
27
28 compatible = "gpio-leds";
29
30 led@2 {
31 label = "beaglebone:green:heartbeat";
32 gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>;
33 linux,default-trigger = "heartbeat";
34 default-state = "off";
35 };
36
37 led@3 {
38 label = "beaglebone:green:mmc0";
39 gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
40 linux,default-trigger = "mmc0";
41 default-state = "off";
42 };
43
44 led@4 {
45 label = "beaglebone:green:usr2";
46 gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
47 linux,default-trigger = "cpu0";
48 default-state = "off";
49 };
50
51 led@5 {
52 label = "beaglebone:green:usr3";
53 gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>;
54 linux,default-trigger = "mmc1";
55 default-state = "off";
56 };
57 };
58
59 vmmcsd_fixed: fixedregulator@0 {
60 compatible = "regulator-fixed";
61 regulator-name = "vmmcsd_fixed";
62 regulator-min-microvolt = <3300000>;
63 regulator-max-microvolt = <3300000>;
64 };
65};
66
67&am33xx_pinmux {
68 pinctrl-names = "default";
69 pinctrl-0 = <&clkout2_pin>;
70
71 user_leds_s0: user_leds_s0 {
72 pinctrl-single,pins = <
73 0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a5.gpio1_21 */
74 0x58 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_a6.gpio1_22 */
75 0x5c (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a7.gpio1_23 */
76 0x60 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_a8.gpio1_24 */
77 >;
78 };
79
80 i2c0_pins: pinmux_i2c0_pins {
81 pinctrl-single,pins = <
82 0x188 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */
83 0x18c (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */
84 >;
85 };
86
87 uart0_pins: pinmux_uart0_pins {
88 pinctrl-single,pins = <
89 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
90 0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */
91 >;
92 };
93
94 clkout2_pin: pinmux_clkout2_pin {
95 pinctrl-single,pins = <
96 0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr1.clkout2 */
97 >;
98 };
99
100 cpsw_default: cpsw_default {
101 pinctrl-single,pins = <
102 /* Slave 1 */
103 0x110 (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxerr.mii1_rxerr */
104 0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mii1_txen.mii1_txen */
105 0x118 (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxdv.mii1_rxdv */
106 0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mii1_txd3.mii1_txd3 */
107 0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mii1_txd2.mii1_txd2 */
108 0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mii1_txd1.mii1_txd1 */
109 0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mii1_txd0.mii1_txd0 */
110 0x12c (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_txclk.mii1_txclk */
111 0x130 (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxclk.mii1_rxclk */
112 0x134 (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxd3.mii1_rxd3 */
113 0x138 (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxd2.mii1_rxd2 */
114 0x13c (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxd1.mii1_rxd1 */
115 0x140 (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxd0.mii1_rxd0 */
116 >;
117 };
118
119 cpsw_sleep: cpsw_sleep {
120 pinctrl-single,pins = <
121 /* Slave 1 reset value */
122 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE7)
123 0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
124 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
125 0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
126 0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
127 0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
128 0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
129 0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
130 0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
131 0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
132 0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
133 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
134 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
135 >;
136 };
137
138 davinci_mdio_default: davinci_mdio_default {
139 pinctrl-single,pins = <
140 /* MDIO */
141 0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */
142 0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */
143 >;
144 };
145
146 davinci_mdio_sleep: davinci_mdio_sleep {
147 pinctrl-single,pins = <
148 /* MDIO reset value */
149 0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
150 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
151 >;
152 };
153
154 mmc1_pins: pinmux_mmc1_pins {
155 pinctrl-single,pins = <
156 0x160 (PIN_INPUT | MUX_MODE7) /* GPIO0_6 */
157 >;
158 };
159
160 emmc_pins: pinmux_emmc_pins {
161 pinctrl-single,pins = <
162 0x80 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
163 0x84 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
164 0x00 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
165 0x04 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
166 0x08 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
167 0x0c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
168 0x10 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */
169 0x14 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */
170 0x18 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */
171 0x1c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */
172 >;
173 };
174};
175
176&uart0 {
177 pinctrl-names = "default";
178 pinctrl-0 = <&uart0_pins>;
179
180 status = "okay";
181};
182
183&usb {
184 status = "okay";
185
186 control@44e10000 {
187 status = "okay";
188 };
189
190 usb-phy@47401300 {
191 status = "okay";
192 };
193
194 usb-phy@47401b00 {
195 status = "okay";
196 };
197
198 usb@47401000 {
199 status = "okay";
200 };
201
202 usb@47401800 {
203 status = "okay";
204 dr_mode = "host";
205 };
206
207 dma-controller@07402000 {
208 status = "okay";
209 };
210};
211
212&i2c0 {
213 pinctrl-names = "default";
214 pinctrl-0 = <&i2c0_pins>;
215
216 status = "okay";
217 clock-frequency = <400000>;
218
219 tps: tps@24 {
220 reg = <0x24>;
221 };
222
223};
224
225/include/ "tps65217.dtsi"
226
227&tps {
228 regulators {
229 dcdc1_reg: regulator@0 {
230 regulator-always-on;
231 };
232
233 dcdc2_reg: regulator@1 {
234 /* VDD_MPU voltage limits 0.95V - 1.26V with +/-4% tolerance */
235 regulator-name = "vdd_mpu";
236 regulator-min-microvolt = <925000>;
237 regulator-max-microvolt = <1325000>;
238 regulator-boot-on;
239 regulator-always-on;
240 };
241
242 dcdc3_reg: regulator@2 {
243 /* VDD_CORE voltage limits 0.95V - 1.1V with +/-4% tolerance */
244 regulator-name = "vdd_core";
245 regulator-min-microvolt = <925000>;
246 regulator-max-microvolt = <1150000>;
247 regulator-boot-on;
248 regulator-always-on;
249 };
250
251 ldo1_reg: regulator@3 {
252 regulator-always-on;
253 };
254
255 ldo2_reg: regulator@4 {
256 regulator-always-on;
257 };
258
259 ldo3_reg: regulator@5 {
260 regulator-always-on;
261 };
262
263 ldo4_reg: regulator@6 {
264 regulator-always-on;
265 };
266 };
267};
268
269&cpsw_emac0 {
270 phy_id = <&davinci_mdio>, <0>;
271 phy-mode = "mii";
272};
273
274&cpsw_emac1 {
275 phy_id = <&davinci_mdio>, <1>;
276 phy-mode = "mii";
277};
278
279&mac {
280 pinctrl-names = "default", "sleep";
281 pinctrl-0 = <&cpsw_default>;
282 pinctrl-1 = <&cpsw_sleep>;
283
284};
285
286&davinci_mdio {
287 pinctrl-names = "default", "sleep";
288 pinctrl-0 = <&davinci_mdio_default>;
289 pinctrl-1 = <&davinci_mdio_sleep>;
290};
291
292&mmc1 {
293 status = "okay";
294 bus-width = <0x4>;
295 pinctrl-names = "default";
296 pinctrl-0 = <&mmc1_pins>;
297 cd-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
298 cd-inverted;
299};
diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts
index d318987d44a1..94ee427a6db1 100644
--- a/arch/arm/boot/dts/am335x-bone.dts
+++ b/arch/arm/boot/dts/am335x-bone.dts
@@ -8,258 +8,22 @@
8/dts-v1/; 8/dts-v1/;
9 9
10#include "am33xx.dtsi" 10#include "am33xx.dtsi"
11#include "am335x-bone-common.dtsi"
11 12
12/ { 13&ldo3_reg {
13 model = "TI AM335x BeagleBone"; 14 regulator-min-microvolt = <1800000>;
14 compatible = "ti,am335x-bone", "ti,am33xx"; 15 regulator-max-microvolt = <3300000>;
15 16 regulator-always-on;
16 cpus {
17 cpu@0 {
18 cpu0-supply = <&dcdc2_reg>;
19 };
20 };
21
22 memory {
23 device_type = "memory";
24 reg = <0x80000000 0x10000000>; /* 256 MB */
25 };
26
27 am33xx_pinmux: pinmux@44e10800 {
28 pinctrl-names = "default";
29 pinctrl-0 = <&clkout2_pin>;
30
31 user_leds_s0: user_leds_s0 {
32 pinctrl-single,pins = <
33 0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a5.gpio1_21 */
34 0x58 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_a6.gpio1_22 */
35 0x5c (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a7.gpio1_23 */
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)
111 >;
112 };
113 };
114
115 ocp {
116 uart0: serial@44e09000 {
117 pinctrl-names = "default";
118 pinctrl-0 = <&uart0_pins>;
119
120 status = "okay";
121 };
122
123 musb: usb@47400000 {
124 status = "okay";
125
126 control@44e10000 {
127 status = "okay";
128 };
129
130 usb-phy@47401300 {
131 status = "okay";
132 };
133
134 usb-phy@47401b00 {
135 status = "okay";
136 };
137
138 usb@47401000 {
139 status = "okay";
140 };
141
142 usb@47401800 {
143 status = "okay";
144 dr_mode = "host";
145 };
146
147 dma-controller@07402000 {
148 status = "okay";
149 };
150 };
151
152 i2c0: i2c@44e0b000 {
153 pinctrl-names = "default";
154 pinctrl-0 = <&i2c0_pins>;
155
156 status = "okay";
157 clock-frequency = <400000>;
158
159 tps: tps@24 {
160 reg = <0x24>;
161 };
162
163 };
164 };
165
166 leds {
167 pinctrl-names = "default";
168 pinctrl-0 = <&user_leds_s0>;
169
170 compatible = "gpio-leds";
171
172 led@2 {
173 label = "beaglebone:green:heartbeat";
174 gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>;
175 linux,default-trigger = "heartbeat";
176 default-state = "off";
177 };
178
179 led@3 {
180 label = "beaglebone:green:mmc0";
181 gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
182 linux,default-trigger = "mmc0";
183 default-state = "off";
184 };
185
186 led@4 {
187 label = "beaglebone:green:usr2";
188 gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
189 default-state = "off";
190 };
191
192 led@5 {
193 label = "beaglebone:green:usr3";
194 gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>;
195 default-state = "off";
196 };
197 };
198}; 17};
199 18
200/include/ "tps65217.dtsi" 19&mmc1 {
201 20 vmmc-supply = <&ldo3_reg>;
202&tps {
203 regulators {
204 dcdc1_reg: regulator@0 {
205 regulator-always-on;
206 };
207
208 dcdc2_reg: regulator@1 {
209 /* VDD_MPU voltage limits 0.95V - 1.26V with +/-4% tolerance */
210 regulator-name = "vdd_mpu";
211 regulator-min-microvolt = <925000>;
212 regulator-max-microvolt = <1325000>;
213 regulator-boot-on;
214 regulator-always-on;
215 };
216
217 dcdc3_reg: regulator@2 {
218 /* VDD_CORE voltage limits 0.95V - 1.1V with +/-4% tolerance */
219 regulator-name = "vdd_core";
220 regulator-min-microvolt = <925000>;
221 regulator-max-microvolt = <1150000>;
222 regulator-boot-on;
223 regulator-always-on;
224 };
225
226 ldo1_reg: regulator@3 {
227 regulator-always-on;
228 };
229
230 ldo2_reg: regulator@4 {
231 regulator-always-on;
232 };
233
234 ldo3_reg: regulator@5 {
235 regulator-always-on;
236 };
237
238 ldo4_reg: regulator@6 {
239 regulator-always-on;
240 };
241 };
242}; 21};
243 22
244&cpsw_emac0 { 23&sham {
245 phy_id = <&davinci_mdio>, <0>; 24 status = "okay";
246 phy-mode = "mii";
247};
248
249&cpsw_emac1 {
250 phy_id = <&davinci_mdio>, <1>;
251 phy-mode = "mii";
252};
253
254&mac {
255 pinctrl-names = "default", "sleep";
256 pinctrl-0 = <&cpsw_default>;
257 pinctrl-1 = <&cpsw_sleep>;
258
259}; 25};
260 26
261&davinci_mdio { 27&aes {
262 pinctrl-names = "default", "sleep"; 28 status = "okay";
263 pinctrl-0 = <&davinci_mdio_default>;
264 pinctrl-1 = <&davinci_mdio_sleep>;
265}; 29};
diff --git a/arch/arm/boot/dts/am335x-boneblack.dts b/arch/arm/boot/dts/am335x-boneblack.dts
new file mode 100644
index 000000000000..6b71ad95a5cf
--- /dev/null
+++ b/arch/arm/boot/dts/am335x-boneblack.dts
@@ -0,0 +1,78 @@
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 "am33xx.dtsi"
11#include "am335x-bone-common.dtsi"
12
13&ldo3_reg {
14 regulator-min-microvolt = <1800000>;
15 regulator-max-microvolt = <1800000>;
16 regulator-always-on;
17};
18
19&mmc1 {
20 vmmc-supply = <&vmmcsd_fixed>;
21};
22
23&mmc2 {
24 vmmc-supply = <&vmmcsd_fixed>;
25 pinctrl-names = "default";
26 pinctrl-0 = <&emmc_pins>;
27 bus-width = <8>;
28 status = "okay";
29 ti,vcc-aux-disable-is-sleep;
30};
31
32&am33xx_pinmux {
33 nxp_hdmi_bonelt_pins: nxp_hdmi_bonelt_pins {
34 pinctrl-single,pins = <
35 0x1b0 0x03 /* xdma_event_intr0, OMAP_MUX_MODE3 | AM33XX_PIN_OUTPUT */
36 0xa0 0x08 /* lcd_data0.lcd_data0, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
37 0xa4 0x08 /* lcd_data1.lcd_data1, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
38 0xa8 0x08 /* lcd_data2.lcd_data2, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
39 0xac 0x08 /* lcd_data3.lcd_data3, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
40 0xb0 0x08 /* lcd_data4.lcd_data4, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
41 0xb4 0x08 /* lcd_data5.lcd_data5, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
42 0xb8 0x08 /* lcd_data6.lcd_data6, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
43 0xbc 0x08 /* lcd_data7.lcd_data7, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
44 0xc0 0x08 /* lcd_data8.lcd_data8, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
45 0xc4 0x08 /* lcd_data9.lcd_data9, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
46 0xc8 0x08 /* lcd_data10.lcd_data10, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
47 0xcc 0x08 /* lcd_data11.lcd_data11, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
48 0xd0 0x08 /* lcd_data12.lcd_data12, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
49 0xd4 0x08 /* lcd_data13.lcd_data13, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
50 0xd8 0x08 /* lcd_data14.lcd_data14, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
51 0xdc 0x08 /* lcd_data15.lcd_data15, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
52 0xe0 0x00 /* lcd_vsync.lcd_vsync, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT */
53 0xe4 0x00 /* lcd_hsync.lcd_hsync, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT */
54 0xe8 0x00 /* lcd_pclk.lcd_pclk, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT */
55 0xec 0x00 /* lcd_ac_bias_en.lcd_ac_bias_en, OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT */
56 >;
57 };
58 nxp_hdmi_bonelt_off_pins: nxp_hdmi_bonelt_off_pins {
59 pinctrl-single,pins = <
60 0x1b0 0x03 /* xdma_event_intr0, OMAP_MUX_MODE3 | AM33XX_PIN_OUTPUT */
61 >;
62 };
63};
64
65&lcdc {
66 status = "okay";
67};
68
69/ {
70 hdmi {
71 compatible = "ti,tilcdc,slave";
72 i2c = <&i2c0>;
73 pinctrl-names = "default", "off";
74 pinctrl-0 = <&nxp_hdmi_bonelt_pins>;
75 pinctrl-1 = <&nxp_hdmi_bonelt_off_pins>;
76 status = "okay";
77 };
78};
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index e8ec8756e498..987429436171 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -24,324 +24,6 @@
24 reg = <0x80000000 0x10000000>; /* 256 MB */ 24 reg = <0x80000000 0x10000000>; /* 256 MB */
25 }; 25 };
26 26
27 am33xx_pinmux: pinmux@44e10800 {
28 pinctrl-names = "default";
29 pinctrl-0 = <&matrix_keypad_s0 &volume_keys_s0 &clkout2_pin>;
30
31 matrix_keypad_s0: matrix_keypad_s0 {
32 pinctrl-single,pins = <
33 0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a5.gpio1_21 */
34 0x58 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a6.gpio1_22 */
35 0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_a9.gpio1_25 */
36 0x68 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_a10.gpio1_26 */
37 0x6c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_a11.gpio1_27 */
38 >;
39 };
40
41 volume_keys_s0: volume_keys_s0 {
42 pinctrl-single,pins = <
43 0x150 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* spi0_sclk.gpio0_2 */
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)
150 >;
151 };
152 };
153
154 ocp {
155 uart0: serial@44e09000 {
156 pinctrl-names = "default";
157 pinctrl-0 = <&uart0_pins>;
158
159 status = "okay";
160 };
161
162 i2c0: i2c@44e0b000 {
163 pinctrl-names = "default";
164 pinctrl-0 = <&i2c0_pins>;
165
166 status = "okay";
167 clock-frequency = <400000>;
168
169 tps: tps@2d {
170 reg = <0x2d>;
171 };
172 };
173
174 musb: usb@47400000 {
175 status = "okay";
176
177 control@44e10000 {
178 status = "okay";
179 };
180
181 usb-phy@47401300 {
182 status = "okay";
183 };
184
185 usb-phy@47401b00 {
186 status = "okay";
187 };
188
189 usb@47401000 {
190 status = "okay";
191 };
192
193 usb@47401800 {
194 status = "okay";
195 dr_mode = "host";
196 };
197
198 dma-controller@07402000 {
199 status = "okay";
200 };
201 };
202
203 i2c1: i2c@4802a000 {
204 pinctrl-names = "default";
205 pinctrl-0 = <&i2c1_pins>;
206
207 status = "okay";
208 clock-frequency = <100000>;
209
210 lis331dlh: lis331dlh@18 {
211 compatible = "st,lis331dlh", "st,lis3lv02d";
212 reg = <0x18>;
213 Vdd-supply = <&lis3_reg>;
214 Vdd_IO-supply = <&lis3_reg>;
215
216 st,click-single-x;
217 st,click-single-y;
218 st,click-single-z;
219 st,click-thresh-x = <10>;
220 st,click-thresh-y = <10>;
221 st,click-thresh-z = <10>;
222 st,irq1-click;
223 st,irq2-click;
224 st,wakeup-x-lo;
225 st,wakeup-x-hi;
226 st,wakeup-y-lo;
227 st,wakeup-y-hi;
228 st,wakeup-z-lo;
229 st,wakeup-z-hi;
230 st,min-limit-x = <120>;
231 st,min-limit-y = <120>;
232 st,min-limit-z = <140>;
233 st,max-limit-x = <550>;
234 st,max-limit-y = <550>;
235 st,max-limit-z = <750>;
236 };
237
238 tsl2550: tsl2550@39 {
239 compatible = "taos,tsl2550";
240 reg = <0x39>;
241 };
242
243 tmp275: tmp275@48 {
244 compatible = "ti,tmp275";
245 reg = <0x48>;
246 };
247 };
248
249 elm: elm@48080000 {
250 status = "okay";
251 };
252
253 epwmss0: epwmss@48300000 {
254 status = "okay";
255
256 ecap0: ecap@48300100 {
257 status = "okay";
258 pinctrl-names = "default";
259 pinctrl-0 = <&ecap0_pins>;
260 };
261 };
262
263 gpmc: gpmc@50000000 {
264 status = "okay";
265 pinctrl-names = "default";
266 pinctrl-0 = <&nandflash_pins_s0>;
267 ranges = <0 0 0x08000000 0x10000000>; /* CS0: NAND */
268 nand@0,0 {
269 reg = <0 0 0>; /* CS0, offset 0 */
270 nand-bus-width = <8>;
271 ti,nand-ecc-opt = "bch8";
272 gpmc,device-nand = "true";
273 gpmc,device-width = <1>;
274 gpmc,sync-clk-ps = <0>;
275 gpmc,cs-on-ns = <0>;
276 gpmc,cs-rd-off-ns = <44>;
277 gpmc,cs-wr-off-ns = <44>;
278 gpmc,adv-on-ns = <6>;
279 gpmc,adv-rd-off-ns = <34>;
280 gpmc,adv-wr-off-ns = <44>;
281 gpmc,we-on-ns = <0>;
282 gpmc,we-off-ns = <40>;
283 gpmc,oe-on-ns = <0>;
284 gpmc,oe-off-ns = <54>;
285 gpmc,access-ns = <64>;
286 gpmc,rd-cycle-ns = <82>;
287 gpmc,wr-cycle-ns = <82>;
288 gpmc,wait-on-read = "true";
289 gpmc,wait-on-write = "true";
290 gpmc,bus-turnaround-ns = <0>;
291 gpmc,cycle2cycle-delay-ns = <0>;
292 gpmc,clk-activation-ns = <0>;
293 gpmc,wait-monitoring-ns = <0>;
294 gpmc,wr-access-ns = <40>;
295 gpmc,wr-data-mux-bus-ns = <0>;
296
297 #address-cells = <1>;
298 #size-cells = <1>;
299 elm_id = <&elm>;
300
301 /* MTD partition table */
302 partition@0 {
303 label = "SPL1";
304 reg = <0x00000000 0x000020000>;
305 };
306
307 partition@1 {
308 label = "SPL2";
309 reg = <0x00020000 0x00020000>;
310 };
311
312 partition@2 {
313 label = "SPL3";
314 reg = <0x00040000 0x00020000>;
315 };
316
317 partition@3 {
318 label = "SPL4";
319 reg = <0x00060000 0x00020000>;
320 };
321
322 partition@4 {
323 label = "U-boot";
324 reg = <0x00080000 0x001e0000>;
325 };
326
327 partition@5 {
328 label = "environment";
329 reg = <0x00260000 0x00020000>;
330 };
331
332 partition@6 {
333 label = "Kernel";
334 reg = <0x00280000 0x00500000>;
335 };
336
337 partition@7 {
338 label = "File-System";
339 reg = <0x00780000 0x0F880000>;
340 };
341 };
342 };
343 };
344
345 vbat: fixedregulator@0 { 27 vbat: fixedregulator@0 {
346 compatible = "regulator-fixed"; 28 compatible = "regulator-fixed";
347 regulator-name = "vbat"; 29 regulator-name = "vbat";
@@ -403,10 +85,447 @@
403 brightness-levels = <0 51 53 56 62 75 101 152 255>; 85 brightness-levels = <0 51 53 56 62 75 101 152 255>;
404 default-brightness-level = <8>; 86 default-brightness-level = <8>;
405 }; 87 };
88
89 panel {
90 compatible = "ti,tilcdc,panel";
91 status = "okay";
92 pinctrl-names = "default";
93 pinctrl-0 = <&lcd_pins_s0>;
94 panel-info {
95 ac-bias = <255>;
96 ac-bias-intrpt = <0>;
97 dma-burst-sz = <16>;
98 bpp = <32>;
99 fdd = <0x80>;
100 sync-edge = <0>;
101 sync-ctrl = <1>;
102 raster-order = <0>;
103 fifo-th = <0>;
104 };
105
106 display-timings {
107 800x480p62 {
108 clock-frequency = <30000000>;
109 hactive = <800>;
110 vactive = <480>;
111 hfront-porch = <39>;
112 hback-porch = <39>;
113 hsync-len = <47>;
114 vback-porch = <29>;
115 vfront-porch = <13>;
116 vsync-len = <2>;
117 hsync-active = <1>;
118 vsync-active = <1>;
119 };
120 };
121 };
122
123 sound {
124 compatible = "ti,da830-evm-audio";
125 ti,model = "AM335x-EVM";
126 ti,audio-codec = <&tlv320aic3106>;
127 ti,mcasp-controller = <&mcasp1>;
128 ti,codec-clock-rate = <12000000>;
129 ti,audio-routing =
130 "Headphone Jack", "HPLOUT",
131 "Headphone Jack", "HPROUT",
132 "LINE1L", "Line In",
133 "LINE1R", "Line In";
134 };
135};
136
137&am33xx_pinmux {
138 pinctrl-names = "default";
139 pinctrl-0 = <&matrix_keypad_s0 &volume_keys_s0 &clkout2_pin>;
140
141 matrix_keypad_s0: matrix_keypad_s0 {
142 pinctrl-single,pins = <
143 0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a5.gpio1_21 */
144 0x58 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a6.gpio1_22 */
145 0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_a9.gpio1_25 */
146 0x68 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_a10.gpio1_26 */
147 0x6c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_a11.gpio1_27 */
148 >;
149 };
150
151 volume_keys_s0: volume_keys_s0 {
152 pinctrl-single,pins = <
153 0x150 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* spi0_sclk.gpio0_2 */
154 0x154 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* spi0_d0.gpio0_3 */
155 >;
156 };
157
158 i2c0_pins: pinmux_i2c0_pins {
159 pinctrl-single,pins = <
160 0x188 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */
161 0x18c (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */
162 >;
163 };
164
165 i2c1_pins: pinmux_i2c1_pins {
166 pinctrl-single,pins = <
167 0x158 (PIN_INPUT_PULLUP | MUX_MODE2) /* spi0_d1.i2c1_sda */
168 0x15c (PIN_INPUT_PULLUP | MUX_MODE2) /* spi0_cs0.i2c1_scl */
169 >;
170 };
171
172 uart0_pins: pinmux_uart0_pins {
173 pinctrl-single,pins = <
174 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
175 0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */
176 >;
177 };
178
179 clkout2_pin: pinmux_clkout2_pin {
180 pinctrl-single,pins = <
181 0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr1.clkout2 */
182 >;
183 };
184
185 nandflash_pins_s0: nandflash_pins_s0 {
186 pinctrl-single,pins = <
187 0x0 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad0.gpmc_ad0 */
188 0x4 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad1.gpmc_ad1 */
189 0x8 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad2.gpmc_ad2 */
190 0xc (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad3.gpmc_ad3 */
191 0x10 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad4.gpmc_ad4 */
192 0x14 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad5.gpmc_ad5 */
193 0x18 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad6.gpmc_ad6 */
194 0x1c (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad7.gpmc_ad7 */
195 0x70 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_wait0.gpmc_wait0 */
196 0x74 (PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_wpn.gpio0_30 */
197 0x7c (PIN_OUTPUT | MUX_MODE0) /* gpmc_csn0.gpmc_csn0 */
198 0x90 (PIN_OUTPUT | MUX_MODE0) /* gpmc_advn_ale.gpmc_advn_ale */
199 0x94 (PIN_OUTPUT | MUX_MODE0) /* gpmc_oen_ren.gpmc_oen_ren */
200 0x98 (PIN_OUTPUT | MUX_MODE0) /* gpmc_wen.gpmc_wen */
201 0x9c (PIN_OUTPUT | MUX_MODE0) /* gpmc_be0n_cle.gpmc_be0n_cle */
202 >;
203 };
204
205 ecap0_pins: backlight_pins {
206 pinctrl-single,pins = <
207 0x164 0x0 /* eCAP0_in_PWM0_out.eCAP0_in_PWM0_out MODE0 */
208 >;
209 };
210
211 cpsw_default: cpsw_default {
212 pinctrl-single,pins = <
213 /* Slave 1 */
214 0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txen.rgmii1_tctl */
215 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxdv.rgmii1_rctl */
216 0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd3.rgmii1_td3 */
217 0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd2.rgmii1_td2 */
218 0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd1.rgmii1_td1 */
219 0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd0.rgmii1_td0 */
220 0x12c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txclk.rgmii1_tclk */
221 0x130 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxclk.rgmii1_rclk */
222 0x134 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd3.rgmii1_rd3 */
223 0x138 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd2.rgmii1_rd2 */
224 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd1.rgmii1_rd1 */
225 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd0.rgmii1_rd0 */
226 >;
227 };
228
229 cpsw_sleep: cpsw_sleep {
230 pinctrl-single,pins = <
231 /* Slave 1 reset value */
232 0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
233 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
234 0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
235 0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
236 0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
237 0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
238 0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
239 0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
240 0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
241 0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
242 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
243 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
244 >;
245 };
246
247 davinci_mdio_default: davinci_mdio_default {
248 pinctrl-single,pins = <
249 /* MDIO */
250 0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */
251 0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */
252 >;
253 };
254
255 davinci_mdio_sleep: davinci_mdio_sleep {
256 pinctrl-single,pins = <
257 /* MDIO reset value */
258 0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
259 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
260 >;
261 };
262
263 lcd_pins_s0: lcd_pins_s0 {
264 pinctrl-single,pins = <
265 0x20 0x01 /* gpmc_ad8.lcd_data16, OUTPUT | MODE1 */
266 0x24 0x01 /* gpmc_ad9.lcd_data17, OUTPUT | MODE1 */
267 0x28 0x01 /* gpmc_ad10.lcd_data18, OUTPUT | MODE1 */
268 0x2c 0x01 /* gpmc_ad11.lcd_data19, OUTPUT | MODE1 */
269 0x30 0x01 /* gpmc_ad12.lcd_data20, OUTPUT | MODE1 */
270 0x34 0x01 /* gpmc_ad13.lcd_data21, OUTPUT | MODE1 */
271 0x38 0x01 /* gpmc_ad14.lcd_data22, OUTPUT | MODE1 */
272 0x3c 0x01 /* gpmc_ad15.lcd_data23, OUTPUT | MODE1 */
273 0xa0 0x00 /* lcd_data0.lcd_data0, OUTPUT | MODE0 */
274 0xa4 0x00 /* lcd_data1.lcd_data1, OUTPUT | MODE0 */
275 0xa8 0x00 /* lcd_data2.lcd_data2, OUTPUT | MODE0 */
276 0xac 0x00 /* lcd_data3.lcd_data3, OUTPUT | MODE0 */
277 0xb0 0x00 /* lcd_data4.lcd_data4, OUTPUT | MODE0 */
278 0xb4 0x00 /* lcd_data5.lcd_data5, OUTPUT | MODE0 */
279 0xb8 0x00 /* lcd_data6.lcd_data6, OUTPUT | MODE0 */
280 0xbc 0x00 /* lcd_data7.lcd_data7, OUTPUT | MODE0 */
281 0xc0 0x00 /* lcd_data8.lcd_data8, OUTPUT | MODE0 */
282 0xc4 0x00 /* lcd_data9.lcd_data9, OUTPUT | MODE0 */
283 0xc8 0x00 /* lcd_data10.lcd_data10, OUTPUT | MODE0 */
284 0xcc 0x00 /* lcd_data11.lcd_data11, OUTPUT | MODE0 */
285 0xd0 0x00 /* lcd_data12.lcd_data12, OUTPUT | MODE0 */
286 0xd4 0x00 /* lcd_data13.lcd_data13, OUTPUT | MODE0 */
287 0xd8 0x00 /* lcd_data14.lcd_data14, OUTPUT | MODE0 */
288 0xdc 0x00 /* lcd_data15.lcd_data15, OUTPUT | MODE0 */
289 0xe0 0x00 /* lcd_vsync.lcd_vsync, OUTPUT | MODE0 */
290 0xe4 0x00 /* lcd_hsync.lcd_hsync, OUTPUT | MODE0 */
291 0xe8 0x00 /* lcd_pclk.lcd_pclk, OUTPUT | MODE0 */
292 0xec 0x00 /* lcd_ac_bias_en.lcd_ac_bias_en, OUTPUT | MODE0 */
293 >;
294 };
295
296 am335x_evm_audio_pins: am335x_evm_audio_pins {
297 pinctrl-single,pins = <
298 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rx_dv.mcasp1_aclkx */
299 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_txd3.mcasp1_fsx */
300 0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */
301 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */
302 >;
303 };
304};
305
306&uart0 {
307 pinctrl-names = "default";
308 pinctrl-0 = <&uart0_pins>;
309
310 status = "okay";
311};
312
313&i2c0 {
314 pinctrl-names = "default";
315 pinctrl-0 = <&i2c0_pins>;
316
317 status = "okay";
318 clock-frequency = <400000>;
319
320 tps: tps@2d {
321 reg = <0x2d>;
322 };
323};
324
325&usb {
326 status = "okay";
327
328 control@44e10000 {
329 status = "okay";
330 };
331
332 usb-phy@47401300 {
333 status = "okay";
334 };
335
336 usb-phy@47401b00 {
337 status = "okay";
338 };
339
340 usb@47401000 {
341 status = "okay";
342 };
343
344 usb@47401800 {
345 status = "okay";
346 dr_mode = "host";
347 };
348
349 dma-controller@07402000 {
350 status = "okay";
351 };
352};
353
354&i2c1 {
355 pinctrl-names = "default";
356 pinctrl-0 = <&i2c1_pins>;
357
358 status = "okay";
359 clock-frequency = <100000>;
360
361 lis331dlh: lis331dlh@18 {
362 compatible = "st,lis331dlh", "st,lis3lv02d";
363 reg = <0x18>;
364 Vdd-supply = <&lis3_reg>;
365 Vdd_IO-supply = <&lis3_reg>;
366
367 st,click-single-x;
368 st,click-single-y;
369 st,click-single-z;
370 st,click-thresh-x = <10>;
371 st,click-thresh-y = <10>;
372 st,click-thresh-z = <10>;
373 st,irq1-click;
374 st,irq2-click;
375 st,wakeup-x-lo;
376 st,wakeup-x-hi;
377 st,wakeup-y-lo;
378 st,wakeup-y-hi;
379 st,wakeup-z-lo;
380 st,wakeup-z-hi;
381 st,min-limit-x = <120>;
382 st,min-limit-y = <120>;
383 st,min-limit-z = <140>;
384 st,max-limit-x = <550>;
385 st,max-limit-y = <550>;
386 st,max-limit-z = <750>;
387 };
388
389 tsl2550: tsl2550@39 {
390 compatible = "taos,tsl2550";
391 reg = <0x39>;
392 };
393
394 tmp275: tmp275@48 {
395 compatible = "ti,tmp275";
396 reg = <0x48>;
397 };
398
399 tlv320aic3106: tlv320aic3106@1b {
400 compatible = "ti,tlv320aic3106";
401 reg = <0x1b>;
402 status = "okay";
403
404 /* Regulators */
405 AVDD-supply = <&vaux2_reg>;
406 IOVDD-supply = <&vaux2_reg>;
407 DRVDD-supply = <&vaux2_reg>;
408 DVDD-supply = <&vbat>;
409 };
410};
411
412&lcdc {
413 status = "okay";
414};
415
416&elm {
417 status = "okay";
418};
419
420&epwmss0 {
421 status = "okay";
422
423 ecap0: ecap@48300100 {
424 status = "okay";
425 pinctrl-names = "default";
426 pinctrl-0 = <&ecap0_pins>;
427 };
428};
429
430&gpmc {
431 status = "okay";
432 pinctrl-names = "default";
433 pinctrl-0 = <&nandflash_pins_s0>;
434 ranges = <0 0 0x08000000 0x10000000>; /* CS0: NAND */
435 nand@0,0 {
436 reg = <0 0 0>; /* CS0, offset 0 */
437 nand-bus-width = <8>;
438 ti,nand-ecc-opt = "bch8";
439 gpmc,device-nand = "true";
440 gpmc,device-width = <1>;
441 gpmc,sync-clk-ps = <0>;
442 gpmc,cs-on-ns = <0>;
443 gpmc,cs-rd-off-ns = <44>;
444 gpmc,cs-wr-off-ns = <44>;
445 gpmc,adv-on-ns = <6>;
446 gpmc,adv-rd-off-ns = <34>;
447 gpmc,adv-wr-off-ns = <44>;
448 gpmc,we-on-ns = <0>;
449 gpmc,we-off-ns = <40>;
450 gpmc,oe-on-ns = <0>;
451 gpmc,oe-off-ns = <54>;
452 gpmc,access-ns = <64>;
453 gpmc,rd-cycle-ns = <82>;
454 gpmc,wr-cycle-ns = <82>;
455 gpmc,wait-on-read = "true";
456 gpmc,wait-on-write = "true";
457 gpmc,bus-turnaround-ns = <0>;
458 gpmc,cycle2cycle-delay-ns = <0>;
459 gpmc,clk-activation-ns = <0>;
460 gpmc,wait-monitoring-ns = <0>;
461 gpmc,wr-access-ns = <40>;
462 gpmc,wr-data-mux-bus-ns = <0>;
463
464 #address-cells = <1>;
465 #size-cells = <1>;
466 elm_id = <&elm>;
467
468 /* MTD partition table */
469 partition@0 {
470 label = "SPL1";
471 reg = <0x00000000 0x000020000>;
472 };
473
474 partition@1 {
475 label = "SPL2";
476 reg = <0x00020000 0x00020000>;
477 };
478
479 partition@2 {
480 label = "SPL3";
481 reg = <0x00040000 0x00020000>;
482 };
483
484 partition@3 {
485 label = "SPL4";
486 reg = <0x00060000 0x00020000>;
487 };
488
489 partition@4 {
490 label = "U-boot";
491 reg = <0x00080000 0x001e0000>;
492 };
493
494 partition@5 {
495 label = "environment";
496 reg = <0x00260000 0x00020000>;
497 };
498
499 partition@6 {
500 label = "Kernel";
501 reg = <0x00280000 0x00500000>;
502 };
503
504 partition@7 {
505 label = "File-System";
506 reg = <0x00780000 0x0F880000>;
507 };
508 };
406}; 509};
407 510
408#include "tps65910.dtsi" 511#include "tps65910.dtsi"
409 512
513&mcasp1 {
514 pinctrl-names = "default";
515 pinctrl-0 = <&am335x_evm_audio_pins>;
516
517 status = "okay";
518
519 op-mode = <0>; /* MCASP_IIS_MODE */
520 tdm-slots = <2>;
521 /* 4 serializers */
522 serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
523 0 0 1 2
524 >;
525 tx-num-evt = <1>;
526 rx-num-evt = <1>;
527};
528
410&tps { 529&tps {
411 vcc1-supply = <&vbat>; 530 vcc1-supply = <&vbat>;
412 vcc2-supply = <&vbat>; 531 vcc2-supply = <&vbat>;
@@ -477,6 +596,8 @@
477 }; 596 };
478 597
479 vmmc_reg: regulator@12 { 598 vmmc_reg: regulator@12 {
599 regulator-min-microvolt = <1800000>;
600 regulator-max-microvolt = <3300000>;
480 regulator-always-on; 601 regulator-always-on;
481 }; 602 };
482 }; 603 };
@@ -517,3 +638,17 @@
517 ti,adc-channels = <4 5 6 7>; 638 ti,adc-channels = <4 5 6 7>;
518 }; 639 };
519}; 640};
641
642&mmc1 {
643 status = "okay";
644 vmmc-supply = <&vmmc_reg>;
645 bus-width = <4>;
646};
647
648&sham {
649 status = "okay";
650};
651
652&aes {
653 status = "okay";
654};
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
index 4f339fa91c57..03febf85fd2f 100644
--- a/arch/arm/boot/dts/am335x-evmsk.dts
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -31,210 +31,6 @@
31 reg = <0x80000000 0x10000000>; /* 256 MB */ 31 reg = <0x80000000 0x10000000>; /* 256 MB */
32 }; 32 };
33 33
34 am33xx_pinmux: pinmux@44e10800 {
35 pinctrl-names = "default";
36 pinctrl-0 = <&gpio_keys_s0 &clkout2_pin>;
37
38 user_leds_s0: user_leds_s0 {
39 pinctrl-single,pins = <
40 0x10 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad4.gpio1_4 */
41 0x14 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad5.gpio1_5 */
42 0x18 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad6.gpio1_6 */
43 0x1c (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad7.gpio1_7 */
44 >;
45 };
46
47 gpio_keys_s0: gpio_keys_s0 {
48 pinctrl-single,pins = <
49 0x94 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_oen_ren.gpio2_3 */
50 0x90 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_advn_ale.gpio2_2 */
51 0x70 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_wait0.gpio0_30 */
52 0x9c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ben0_cle.gpio2_5 */
53 >;
54 };
55
56 i2c0_pins: pinmux_i2c0_pins {
57 pinctrl-single,pins = <
58 0x188 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */
59 0x18c (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */
60 >;
61 };
62
63 uart0_pins: pinmux_uart0_pins {
64 pinctrl-single,pins = <
65 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
66 0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */
67 >;
68 };
69
70 clkout2_pin: pinmux_clkout2_pin {
71 pinctrl-single,pins = <
72 0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr1.clkout2 */
73 >;
74 };
75
76 ecap2_pins: backlight_pins {
77 pinctrl-single,pins = <
78 0x19c 0x4 /* mcasp0_ahclkr.ecap2_in_pwm2_out MODE4 */
79 >;
80 };
81
82 cpsw_default: cpsw_default {
83 pinctrl-single,pins = <
84 /* Slave 1 */
85 0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txen.rgmii1_tctl */
86 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxdv.rgmii1_rctl */
87 0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd3.rgmii1_td3 */
88 0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd2.rgmii1_td2 */
89 0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd1.rgmii1_td1 */
90 0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd0.rgmii1_td0 */
91 0x12c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txclk.rgmii1_tclk */
92 0x130 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxclk.rgmii1_rclk */
93 0x134 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd3.rgmii1_rd3 */
94 0x138 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd2.rgmii1_rd2 */
95 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd1.rgmii1_rd1 */
96 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd0.rgmii1_rd0 */
97
98 /* Slave 2 */
99 0x40 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a0.rgmii2_tctl */
100 0x44 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a1.rgmii2_rctl */
101 0x48 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a2.rgmii2_td3 */
102 0x4c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a3.rgmii2_td2 */
103 0x50 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a4.rgmii2_td1 */
104 0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a5.rgmii2_td0 */
105 0x58 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a6.rgmii2_tclk */
106 0x5c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a7.rgmii2_rclk */
107 0x60 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a8.rgmii2_rd3 */
108 0x64 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a9.rgmii2_rd2 */
109 0x68 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a10.rgmii2_rd1 */
110 0x6c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a11.rgmii2_rd0 */
111 >;
112 };
113
114 cpsw_sleep: cpsw_sleep {
115 pinctrl-single,pins = <
116 /* Slave 1 reset value */
117 0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
118 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
119 0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
120 0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
121 0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
122 0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
123 0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
124 0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
125 0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
126 0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
127 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
128 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
129
130 /* Slave 2 reset value*/
131 0x40 (PIN_INPUT_PULLDOWN | MUX_MODE7)
132 0x44 (PIN_INPUT_PULLDOWN | MUX_MODE7)
133 0x48 (PIN_INPUT_PULLDOWN | MUX_MODE7)
134 0x4c (PIN_INPUT_PULLDOWN | MUX_MODE7)
135 0x50 (PIN_INPUT_PULLDOWN | MUX_MODE7)
136 0x54 (PIN_INPUT_PULLDOWN | MUX_MODE7)
137 0x58 (PIN_INPUT_PULLDOWN | MUX_MODE7)
138 0x5c (PIN_INPUT_PULLDOWN | MUX_MODE7)
139 0x60 (PIN_INPUT_PULLDOWN | MUX_MODE7)
140 0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7)
141 0x68 (PIN_INPUT_PULLDOWN | MUX_MODE7)
142 0x6c (PIN_INPUT_PULLDOWN | MUX_MODE7)
143 >;
144 };
145
146 davinci_mdio_default: davinci_mdio_default {
147 pinctrl-single,pins = <
148 /* MDIO */
149 0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */
150 0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */
151 >;
152 };
153
154 davinci_mdio_sleep: davinci_mdio_sleep {
155 pinctrl-single,pins = <
156 /* MDIO reset value */
157 0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
158 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
159 >;
160 };
161 };
162
163 ocp {
164 uart0: serial@44e09000 {
165 pinctrl-names = "default";
166 pinctrl-0 = <&uart0_pins>;
167
168 status = "okay";
169 };
170
171 i2c0: i2c@44e0b000 {
172 pinctrl-names = "default";
173 pinctrl-0 = <&i2c0_pins>;
174
175 status = "okay";
176 clock-frequency = <400000>;
177
178 tps: tps@2d {
179 reg = <0x2d>;
180 };
181
182 lis331dlh: lis331dlh@18 {
183 compatible = "st,lis331dlh", "st,lis3lv02d";
184 reg = <0x18>;
185 Vdd-supply = <&lis3_reg>;
186 Vdd_IO-supply = <&lis3_reg>;
187
188 st,click-single-x;
189 st,click-single-y;
190 st,click-single-z;
191 st,click-thresh-x = <10>;
192 st,click-thresh-y = <10>;
193 st,click-thresh-z = <10>;
194 st,irq1-click;
195 st,irq2-click;
196 st,wakeup-x-lo;
197 st,wakeup-x-hi;
198 st,wakeup-y-lo;
199 st,wakeup-y-hi;
200 st,wakeup-z-lo;
201 st,wakeup-z-hi;
202 st,min-limit-x = <120>;
203 st,min-limit-y = <120>;
204 st,min-limit-z = <140>;
205 st,max-limit-x = <550>;
206 st,max-limit-y = <550>;
207 st,max-limit-z = <750>;
208 };
209 };
210
211 musb: usb@47400000 {
212 status = "okay";
213
214 control@44e10000 {
215 status = "okay";
216 };
217
218 usb-phy@47401300 {
219 status = "okay";
220 };
221
222 usb@47401000 {
223 status = "okay";
224 };
225 };
226
227 epwmss2: epwmss@48304000 {
228 status = "okay";
229
230 ecap2: ecap@48304100 {
231 status = "okay";
232 pinctrl-names = "default";
233 pinctrl-0 = <&ecap2_pins>;
234 };
235 };
236 };
237
238 vbat: fixedregulator@0 { 34 vbat: fixedregulator@0 {
239 compatible = "regulator-fixed"; 35 compatible = "regulator-fixed";
240 regulator-name = "vbat"; 36 regulator-name = "vbat";
@@ -319,6 +115,240 @@
319 brightness-levels = <0 58 61 66 75 90 125 170 255>; 115 brightness-levels = <0 58 61 66 75 90 125 170 255>;
320 default-brightness-level = <8>; 116 default-brightness-level = <8>;
321 }; 117 };
118
119 sound {
120 compatible = "ti,da830-evm-audio";
121 ti,model = "AM335x-EVMSK";
122 ti,audio-codec = <&tlv320aic3106>;
123 ti,mcasp-controller = <&mcasp1>;
124 ti,codec-clock-rate = <24576000>;
125 ti,audio-routing =
126 "Headphone Jack", "HPLOUT",
127 "Headphone Jack", "HPROUT";
128 };
129};
130
131&am33xx_pinmux {
132 pinctrl-names = "default";
133 pinctrl-0 = <&gpio_keys_s0 &clkout2_pin>;
134
135 user_leds_s0: user_leds_s0 {
136 pinctrl-single,pins = <
137 0x10 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad4.gpio1_4 */
138 0x14 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad5.gpio1_5 */
139 0x18 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad6.gpio1_6 */
140 0x1c (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad7.gpio1_7 */
141 >;
142 };
143
144 gpio_keys_s0: gpio_keys_s0 {
145 pinctrl-single,pins = <
146 0x94 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_oen_ren.gpio2_3 */
147 0x90 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_advn_ale.gpio2_2 */
148 0x70 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_wait0.gpio0_30 */
149 0x9c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ben0_cle.gpio2_5 */
150 >;
151 };
152
153 i2c0_pins: pinmux_i2c0_pins {
154 pinctrl-single,pins = <
155 0x188 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */
156 0x18c (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */
157 >;
158 };
159
160 uart0_pins: pinmux_uart0_pins {
161 pinctrl-single,pins = <
162 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
163 0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */
164 >;
165 };
166
167 clkout2_pin: pinmux_clkout2_pin {
168 pinctrl-single,pins = <
169 0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr1.clkout2 */
170 >;
171 };
172
173 ecap2_pins: backlight_pins {
174 pinctrl-single,pins = <
175 0x19c 0x4 /* mcasp0_ahclkr.ecap2_in_pwm2_out MODE4 */
176 >;
177 };
178
179 cpsw_default: cpsw_default {
180 pinctrl-single,pins = <
181 /* Slave 1 */
182 0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txen.rgmii1_tctl */
183 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxdv.rgmii1_rctl */
184 0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd3.rgmii1_td3 */
185 0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd2.rgmii1_td2 */
186 0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd1.rgmii1_td1 */
187 0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd0.rgmii1_td0 */
188 0x12c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txclk.rgmii1_tclk */
189 0x130 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxclk.rgmii1_rclk */
190 0x134 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd3.rgmii1_rd3 */
191 0x138 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd2.rgmii1_rd2 */
192 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd1.rgmii1_rd1 */
193 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd0.rgmii1_rd0 */
194
195 /* Slave 2 */
196 0x40 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a0.rgmii2_tctl */
197 0x44 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a1.rgmii2_rctl */
198 0x48 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a2.rgmii2_td3 */
199 0x4c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a3.rgmii2_td2 */
200 0x50 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a4.rgmii2_td1 */
201 0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a5.rgmii2_td0 */
202 0x58 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a6.rgmii2_tclk */
203 0x5c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a7.rgmii2_rclk */
204 0x60 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a8.rgmii2_rd3 */
205 0x64 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a9.rgmii2_rd2 */
206 0x68 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a10.rgmii2_rd1 */
207 0x6c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a11.rgmii2_rd0 */
208 >;
209 };
210
211 cpsw_sleep: cpsw_sleep {
212 pinctrl-single,pins = <
213 /* Slave 1 reset value */
214 0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
215 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
216 0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
217 0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
218 0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
219 0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
220 0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
221 0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
222 0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
223 0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
224 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
225 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
226
227 /* Slave 2 reset value*/
228 0x40 (PIN_INPUT_PULLDOWN | MUX_MODE7)
229 0x44 (PIN_INPUT_PULLDOWN | MUX_MODE7)
230 0x48 (PIN_INPUT_PULLDOWN | MUX_MODE7)
231 0x4c (PIN_INPUT_PULLDOWN | MUX_MODE7)
232 0x50 (PIN_INPUT_PULLDOWN | MUX_MODE7)
233 0x54 (PIN_INPUT_PULLDOWN | MUX_MODE7)
234 0x58 (PIN_INPUT_PULLDOWN | MUX_MODE7)
235 0x5c (PIN_INPUT_PULLDOWN | MUX_MODE7)
236 0x60 (PIN_INPUT_PULLDOWN | MUX_MODE7)
237 0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7)
238 0x68 (PIN_INPUT_PULLDOWN | MUX_MODE7)
239 0x6c (PIN_INPUT_PULLDOWN | MUX_MODE7)
240 >;
241 };
242
243 davinci_mdio_default: davinci_mdio_default {
244 pinctrl-single,pins = <
245 /* MDIO */
246 0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */
247 0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */
248 >;
249 };
250
251 davinci_mdio_sleep: davinci_mdio_sleep {
252 pinctrl-single,pins = <
253 /* MDIO reset value */
254 0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
255 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
256 >;
257 };
258
259 mcasp1_pins: mcasp1_pins {
260 pinctrl-single,pins = <
261 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_crs.mcasp1_aclkx */
262 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rxerr.mcasp1_fsx */
263 0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */
264 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */
265 >;
266 };
267};
268
269&uart0 {
270 pinctrl-names = "default";
271 pinctrl-0 = <&uart0_pins>;
272
273 status = "okay";
274};
275
276&i2c0 {
277 pinctrl-names = "default";
278 pinctrl-0 = <&i2c0_pins>;
279
280 status = "okay";
281 clock-frequency = <400000>;
282
283 tps: tps@2d {
284 reg = <0x2d>;
285 };
286
287 lis331dlh: lis331dlh@18 {
288 compatible = "st,lis331dlh", "st,lis3lv02d";
289 reg = <0x18>;
290 Vdd-supply = <&lis3_reg>;
291 Vdd_IO-supply = <&lis3_reg>;
292
293 st,click-single-x;
294 st,click-single-y;
295 st,click-single-z;
296 st,click-thresh-x = <10>;
297 st,click-thresh-y = <10>;
298 st,click-thresh-z = <10>;
299 st,irq1-click;
300 st,irq2-click;
301 st,wakeup-x-lo;
302 st,wakeup-x-hi;
303 st,wakeup-y-lo;
304 st,wakeup-y-hi;
305 st,wakeup-z-lo;
306 st,wakeup-z-hi;
307 st,min-limit-x = <120>;
308 st,min-limit-y = <120>;
309 st,min-limit-z = <140>;
310 st,max-limit-x = <550>;
311 st,max-limit-y = <550>;
312 st,max-limit-z = <750>;
313 };
314
315 tlv320aic3106: tlv320aic3106@1b {
316 compatible = "ti,tlv320aic3106";
317 reg = <0x1b>;
318 status = "okay";
319
320 /* Regulators */
321 AVDD-supply = <&vaux2_reg>;
322 IOVDD-supply = <&vaux2_reg>;
323 DRVDD-supply = <&vaux2_reg>;
324 DVDD-supply = <&vbat>;
325 };
326};
327
328&usb {
329 status = "okay";
330
331 control@44e10000 {
332 status = "okay";
333 };
334
335 usb-phy@47401300 {
336 status = "okay";
337 };
338
339 usb@47401000 {
340 status = "okay";
341 };
342};
343
344&epwmss2 {
345 status = "okay";
346
347 ecap2: ecap@48304100 {
348 status = "okay";
349 pinctrl-names = "default";
350 pinctrl-0 = <&ecap2_pins>;
351 };
322}; 352};
323 353
324#include "tps65910.dtsi" 354#include "tps65910.dtsi"
@@ -393,6 +423,8 @@
393 }; 423 };
394 424
395 vmmc_reg: regulator@12 { 425 vmmc_reg: regulator@12 {
426 regulator-min-microvolt = <1800000>;
427 regulator-max-microvolt = <3300000>;
396 regulator-always-on; 428 regulator-always-on;
397 }; 429 };
398 }; 430 };
@@ -419,3 +451,37 @@
419 phy_id = <&davinci_mdio>, <1>; 451 phy_id = <&davinci_mdio>, <1>;
420 phy-mode = "rgmii-txid"; 452 phy-mode = "rgmii-txid";
421}; 453};
454
455&mmc1 {
456 status = "okay";
457 vmmc-supply = <&vmmc_reg>;
458 bus-width = <4>;
459};
460
461&sham {
462 status = "okay";
463};
464
465&aes {
466 status = "okay";
467};
468
469&gpio0 {
470 ti,no-reset-on-init;
471};
472
473&mcasp1 {
474 pinctrl-names = "default";
475 pinctrl-0 = <&mcasp1_pins>;
476
477 status = "okay";
478
479 op-mode = <0>; /* MCASP_IIS_MODE */
480 tdm-slots = <2>;
481 /* 4 serializers */
482 serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
483 0 0 1 2
484 >;
485 tx-num-evt = <1>;
486 rx-num-evt = <1>;
487};
diff --git a/arch/arm/boot/dts/am335x-igep0033.dtsi b/arch/arm/boot/dts/am335x-igep0033.dtsi
new file mode 100644
index 000000000000..619624479311
--- /dev/null
+++ b/arch/arm/boot/dts/am335x-igep0033.dtsi
@@ -0,0 +1,278 @@
1/*
2 * am335x-igep0033.dtsi - Device Tree file for IGEP COM AQUILA AM335x
3 *
4 * Copyright (C) 2013 ISEE 2007 SL - http://www.isee.biz
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 "am33xx.dtsi"
14
15/ {
16 cpus {
17 cpu@0 {
18 cpu0-supply = <&vdd1_reg>;
19 };
20 };
21
22 memory {
23 device_type = "memory";
24 reg = <0x80000000 0x10000000>; /* 256 MB */
25 };
26
27 leds {
28 pinctrl-names = "default";
29 pinctrl-0 = <&leds_pins>;
30
31 compatible = "gpio-leds";
32
33 led@0 {
34 label = "com:green:user";
35 gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
36 default-state = "on";
37 };
38 };
39
40 vbat: fixedregulator@0 {
41 compatible = "regulator-fixed";
42 regulator-name = "vbat";
43 regulator-min-microvolt = <5000000>;
44 regulator-max-microvolt = <5000000>;
45 regulator-boot-on;
46 };
47
48 vmmc: fixedregulator@0 {
49 compatible = "regulator-fixed";
50 regulator-name = "vmmc";
51 regulator-min-microvolt = <3300000>;
52 regulator-max-microvolt = <3300000>;
53 };
54};
55
56&am33xx_pinmux {
57 i2c0_pins: pinmux_i2c0_pins {
58 pinctrl-single,pins = <
59 0x188 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */
60 0x18c (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */
61 >;
62 };
63
64 nandflash_pins: pinmux_nandflash_pins {
65 pinctrl-single,pins = <
66 0x0 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad0.gpmc_ad0 */
67 0x4 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad1.gpmc_ad1 */
68 0x8 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad2.gpmc_ad2 */
69 0xc (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad3.gpmc_ad3 */
70 0x10 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad4.gpmc_ad4 */
71 0x14 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad5.gpmc_ad5 */
72 0x18 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad6.gpmc_ad6 */
73 0x1c (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad7.gpmc_ad7 */
74 0x70 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_wait0.gpmc_wait0 */
75 0x74 (PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_wpn.gpio0_30 */
76 0x7c (PIN_OUTPUT | MUX_MODE0) /* gpmc_csn0.gpmc_csn0 */
77 0x90 (PIN_OUTPUT | MUX_MODE0) /* gpmc_advn_ale.gpmc_advn_ale */
78 0x94 (PIN_OUTPUT | MUX_MODE0) /* gpmc_oen_ren.gpmc_oen_ren */
79 0x98 (PIN_OUTPUT | MUX_MODE0) /* gpmc_wen.gpmc_wen */
80 0x9c (PIN_OUTPUT | MUX_MODE0) /* gpmc_be0n_cle.gpmc_be0n_cle */
81 >;
82 };
83
84 uart0_pins: pinmux_uart0_pins {
85 pinctrl-single,pins = <
86 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
87 0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */
88 >;
89 };
90
91 leds_pins: pinmux_leds_pins {
92 pinctrl-single,pins = <
93 0x5c (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a7.gpio1_23 */
94 >;
95 };
96};
97
98&cpsw_emac0 {
99 phy_id = <&davinci_mdio>, <0>;
100};
101
102&cpsw_emac1 {
103 phy_id = <&davinci_mdio>, <1>;
104};
105
106&elm {
107 status = "okay";
108};
109
110&gpmc {
111 status = "okay";
112 pinctrl-names = "default";
113 pinctrl-0 = <&nandflash_pins>;
114
115 ranges = <0 0 0x08000000 0x10000000>; /* CS0: NAND */
116
117 nand@0,0 {
118 reg = <0 0 0>; /* CS0, offset 0 */
119 nand-bus-width = <8>;
120 ti,nand-ecc-opt = "bch8";
121 gpmc,device-nand = "true";
122 gpmc,device-width = <1>;
123 gpmc,sync-clk-ps = <0>;
124 gpmc,cs-on-ns = <0>;
125 gpmc,cs-rd-off-ns = <44>;
126 gpmc,cs-wr-off-ns = <44>;
127 gpmc,adv-on-ns = <6>;
128 gpmc,adv-rd-off-ns = <34>;
129 gpmc,adv-wr-off-ns = <44>;
130 gpmc,we-on-ns = <0>;
131 gpmc,we-off-ns = <40>;
132 gpmc,oe-on-ns = <0>;
133 gpmc,oe-off-ns = <54>;
134 gpmc,access-ns = <64>;
135 gpmc,rd-cycle-ns = <82>;
136 gpmc,wr-cycle-ns = <82>;
137 gpmc,wait-on-read = "true";
138 gpmc,wait-on-write = "true";
139 gpmc,bus-turnaround-ns = <0>;
140 gpmc,cycle2cycle-delay-ns = <0>;
141 gpmc,clk-activation-ns = <0>;
142 gpmc,wait-monitoring-ns = <0>;
143 gpmc,wr-access-ns = <40>;
144 gpmc,wr-data-mux-bus-ns = <0>;
145
146 #address-cells = <1>;
147 #size-cells = <1>;
148 elm_id = <&elm>;
149
150 /* MTD partition table */
151 partition@0 {
152 label = "SPL";
153 reg = <0x00000000 0x000080000>;
154 };
155
156 partition@1 {
157 label = "U-boot";
158 reg = <0x00080000 0x001e0000>;
159 };
160
161 partition@2 {
162 label = "U-Boot Env";
163 reg = <0x00260000 0x00020000>;
164 };
165
166 partition@3 {
167 label = "Kernel";
168 reg = <0x00280000 0x00500000>;
169 };
170
171 partition@4 {
172 label = "File System";
173 reg = <0x00780000 0x007880000>;
174 };
175 };
176};
177
178&i2c0 {
179 status = "okay";
180 pinctrl-names = "default";
181 pinctrl-0 = <&i2c0_pins>;
182
183 clock-frequency = <400000>;
184
185 tps: tps@2d {
186 reg = <0x2d>;
187 };
188};
189
190&mmc1 {
191 status = "okay";
192 vmmc-supply = <&vmmc>;
193 bus-width = <4>;
194};
195
196&uart0 {
197 status = "okay";
198 pinctrl-names = "default";
199 pinctrl-0 = <&uart0_pins>;
200};
201
202#include "tps65910.dtsi"
203
204&tps {
205 vcc1-supply = <&vbat>;
206 vcc2-supply = <&vbat>;
207 vcc3-supply = <&vbat>;
208 vcc4-supply = <&vbat>;
209 vcc5-supply = <&vbat>;
210 vcc6-supply = <&vbat>;
211 vcc7-supply = <&vbat>;
212 vccio-supply = <&vbat>;
213
214 regulators {
215 vrtc_reg: regulator@0 {
216 regulator-always-on;
217 };
218
219 vio_reg: regulator@1 {
220 regulator-always-on;
221 };
222
223 vdd1_reg: regulator@2 {
224 /* VDD_MPU voltage limits 0.95V - 1.26V with +/-4% tolerance */
225 regulator-name = "vdd_mpu";
226 regulator-min-microvolt = <912500>;
227 regulator-max-microvolt = <1312500>;
228 regulator-boot-on;
229 regulator-always-on;
230 };
231
232 vdd2_reg: regulator@3 {
233 /* VDD_CORE voltage limits 0.95V - 1.1V with +/-4% tolerance */
234 regulator-name = "vdd_core";
235 regulator-min-microvolt = <912500>;
236 regulator-max-microvolt = <1150000>;
237 regulator-boot-on;
238 regulator-always-on;
239 };
240
241 vdd3_reg: regulator@4 {
242 regulator-always-on;
243 };
244
245 vdig1_reg: regulator@5 {
246 regulator-always-on;
247 };
248
249 vdig2_reg: regulator@6 {
250 regulator-always-on;
251 };
252
253 vpll_reg: regulator@7 {
254 regulator-always-on;
255 };
256
257 vdac_reg: regulator@8 {
258 regulator-always-on;
259 };
260
261 vaux1_reg: regulator@9 {
262 regulator-always-on;
263 };
264
265 vaux2_reg: regulator@10 {
266 regulator-always-on;
267 };
268
269 vaux33_reg: regulator@11 {
270 regulator-always-on;
271 };
272
273 vmmc_reg: regulator@12 {
274 regulator-always-on;
275 };
276 };
277};
278
diff --git a/arch/arm/boot/dts/am335x-nano.dts b/arch/arm/boot/dts/am335x-nano.dts
new file mode 100644
index 000000000000..9907b494b99c
--- /dev/null
+++ b/arch/arm/boot/dts/am335x-nano.dts
@@ -0,0 +1,431 @@
1/*
2 * Copyright (C) 2013 Newflow Ltd - http://www.newflow.co.uk/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8/dts-v1/;
9
10#include "am33xx.dtsi"
11
12/ {
13 model = "Newflow AM335x NanoBone";
14 compatible = "ti,am33xx";
15
16 cpus {
17 cpu@0 {
18 cpu0-supply = <&dcdc2_reg>;
19 };
20 };
21
22 memory {
23 device_type = "memory";
24 reg = <0x80000000 0x10000000>; /* 256 MB */
25 };
26
27 leds {
28 compatible = "gpio-leds";
29
30 led@0 {
31 label = "nanobone:green:usr1";
32 gpios = <&gpio1 5 0>;
33 default-state = "off";
34 };
35 };
36};
37
38&am33xx_pinmux {
39 pinctrl-names = "default";
40 pinctrl-0 = <&misc_pins>;
41
42 misc_pins: misc_pins {
43 pinctrl-single,pins = <
44 0x15c (PIN_OUTPUT | MUX_MODE7) /* spi0_cs0.gpio0_5 */
45 >;
46 };
47
48 gpmc_pins: gpmc_pins {
49 pinctrl-single,pins = <
50 0x0 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad0.gpmc_ad0 */
51 0x4 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad1.gpmc_ad1 */
52 0x8 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad2.gpmc_ad2 */
53 0xc (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad3.gpmc_ad3 */
54 0x10 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad4.gpmc_ad4 */
55 0x14 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad5.gpmc_ad5 */
56 0x18 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad6.gpmc_ad6 */
57 0x1c (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad7.gpmc_ad7 */
58 0x20 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad8.gpmc_ad8 */
59 0x24 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad9.gpmc_ad9 */
60 0x28 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad10.gpmc_ad10 */
61 0x2c (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad11.gpmc_ad11 */
62 0x30 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad12.gpmc_ad12 */
63 0x34 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad13.gpmc_ad13 */
64 0x38 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad14.gpmc_ad14 */
65 0x3c (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad15.gpmc_ad15 */
66
67 0x70 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_wait0.gpmc_wait0 */
68 0x7c (PIN_OUTPUT | MUX_MODE0) /* gpmc_csn0.gpmc_csn0 */
69 0x80 (PIN_OUTPUT | MUX_MODE0) /* gpmc_csn1.gpmc_csn1 */
70 0x84 (PIN_OUTPUT | MUX_MODE0) /* gpmc_csn2.gpmc_csn2 */
71 0x88 (PIN_OUTPUT | MUX_MODE0) /* gpmc_csn3.gpmc_csn3 */
72
73 0x90 (PIN_OUTPUT | MUX_MODE0) /* gpmc_advn_ale.gpmc_advn_ale */
74 0x94 (PIN_OUTPUT | MUX_MODE0) /* gpmc_oen_ren.gpmc_oen_ren */
75 0x98 (PIN_OUTPUT | MUX_MODE0) /* gpmc_wen.gpmc_wen */
76 0x9c (PIN_OUTPUT | MUX_MODE0) /* gpmc_ben0_cle.gpmc_ben0_cle */
77
78 0xa4 (PIN_OUTPUT | MUX_MODE1) /* lcd_data1.gpmc_a1 */
79 0xa8 (PIN_OUTPUT | MUX_MODE1) /* lcd_data2.gpmc_a2 */
80 0xac (PIN_OUTPUT | MUX_MODE1) /* lcd_data3.gpmc_a3 */
81 0xb0 (PIN_OUTPUT | MUX_MODE1) /* lcd_data4.gpmc_a4 */
82 0xb4 (PIN_OUTPUT | MUX_MODE1) /* lcd_data5.gpmc_a5 */
83 0xb8 (PIN_OUTPUT | MUX_MODE1) /* lcd_data6.gpmc_a6 */
84 0xbc (PIN_OUTPUT | MUX_MODE1) /* lcd_data7.gpmc_a7 */
85
86 0xe0 (PIN_OUTPUT | MUX_MODE1) /* lcd_vsync.gpmc_a8 */
87 0xe4 (PIN_OUTPUT | MUX_MODE1) /* lcd_hsync.gpmc_a9 */
88 0xe8 (PIN_OUTPUT | MUX_MODE1) /* lcd_pclk.gpmc_a10 */
89 >;
90 };
91
92 i2c0_pins: i2c0_pins {
93 pinctrl-single,pins = <
94 0x188 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* i2c0_sda.i2c0_sda */
95 0x18c (PIN_INPUT_PULLDOWN | MUX_MODE0) /* i2c0_scl.i2c0_scl */
96 >;
97 };
98
99 uart0_pins: uart0_pins {
100 pinctrl-single,pins = <
101 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
102 0x174 (PIN_OUTPUT | MUX_MODE0) /* uart0_txd.uart0_txd */
103 >;
104 };
105
106 uart1_pins: uart1_pins {
107 pinctrl-single,pins = <
108 0x178 (PIN_OUTPUT | MUX_MODE7) /* uart1_ctsn.uart1_ctsn */
109 0x17c (PIN_OUTPUT | MUX_MODE7) /* uart1_rtsn.uart1_rtsn */
110 0x180 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart1_rxd.uart1_rxd */
111 0x184 (PIN_OUTPUT | MUX_MODE0) /* uart1_txd.uart1_txd */
112 >;
113 };
114
115 uart2_pins: uart2_pins {
116 pinctrl-single,pins = <
117 0xc0 (PIN_INPUT_PULLUP | MUX_MODE7) /* lcd_data8.gpio2[14] */
118 0xc4 (PIN_OUTPUT | MUX_MODE7) /* lcd_data9.gpio2[15] */
119 0x150 (PIN_INPUT | MUX_MODE1) /* spi0_sclk.uart2_rxd */
120 0x154 (PIN_OUTPUT | MUX_MODE1) /* spi0_d0.uart2_txd */
121 >;
122 };
123
124 uart3_pins: uart3_pins {
125 pinctrl-single,pins = <
126 0xc8 (PIN_INPUT_PULLUP | MUX_MODE6) /* lcd_data10.uart3_ctsn */
127 0xcc (PIN_OUTPUT | MUX_MODE6) /* lcd_data11.uart3_rtsn */
128 0x160 (PIN_INPUT | MUX_MODE1) /* spi0_cs1.uart3_rxd */
129 0x164 (PIN_OUTPUT | MUX_MODE1) /* ecap0_in_pwm0_out.uart3_txd */
130 >;
131 };
132
133 uart4_pins: uart4_pins {
134 pinctrl-single,pins = <
135 0xd0 (PIN_INPUT_PULLUP | MUX_MODE6) /* lcd_data12.uart4_ctsn */
136 0xd4 (PIN_OUTPUT | MUX_MODE6) /* lcd_data13.uart4_rtsn */
137 0x168 (PIN_INPUT | MUX_MODE1) /* uart0_ctsn.uart4_rxd */
138 0x16c (PIN_OUTPUT | MUX_MODE1) /* uart0_rtsn.uart4_txd */
139 >;
140 };
141
142 uart5_pins: uart5_pins {
143 pinctrl-single,pins = <
144 0xd8 (PIN_INPUT | MUX_MODE4) /* lcd_data14.uart5_rxd */
145 0x144 (PIN_OUTPUT | MUX_MODE3) /* rmiii1_refclk.uart5_txd */
146 >;
147 };
148
149 mmc1_pins: mmc1_pins {
150 pinctrl-single,pins = <
151 0xf0 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat0.mmc0_dat0 */
152 0xf4 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat1.mmc0_dat1 */
153 0xf8 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat2.mmc0_dat2 */
154 0xfc (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat3.mmc0_dat3 */
155 0x100 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_clk.mmc0_clk */
156 0x104 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_cmd.mmc0_cmd */
157 0x1e8 (PIN_INPUT_PULLUP | MUX_MODE7) /* emu1.gpio3[8] */
158 0x1a0 (PIN_INPUT_PULLUP | MUX_MODE7) /* mcasp0_aclkr.gpio3[18] */
159 >;
160 };
161};
162
163&uart0 {
164 pinctrl-names = "default";
165 pinctrl-0 = <&uart0_pins>;
166 status = "okay";
167};
168
169&uart1 {
170 pinctrl-names = "default";
171 pinctrl-0 = <&uart1_pins>;
172 status = "okay";
173 rts-gpio = <&gpio0 13 GPIO_ACTIVE_HIGH>;
174 rs485-rts-active-high;
175 rs485-rx-during-tx;
176 rs485-rts-delay = <1 1>;
177 linux,rs485-enabled-at-boot-time;
178};
179
180&uart2 {
181 pinctrl-names = "default";
182 pinctrl-0 = <&uart2_pins>;
183 status = "okay";
184 rts-gpio = <&gpio2 15 GPIO_ACTIVE_HIGH>;
185 rs485-rts-active-high;
186 rs485-rts-delay = <1 1>;
187 linux,rs485-enabled-at-boot-time;
188};
189
190&uart3 {
191 pinctrl-names = "default";
192 pinctrl-0 = <&uart3_pins>;
193 status = "okay";
194};
195
196&uart4 {
197 pinctrl-names = "default";
198 pinctrl-0 = <&uart4_pins>;
199 status = "okay";
200};
201
202&uart5 {
203 pinctrl-names = "default";
204 pinctrl-0 = <&uart5_pins>;
205 status = "okay";
206};
207
208&i2c0 {
209 status = "okay";
210 pinctrl-names = "default";
211 clock-frequency = <400000>;
212 pinctrl-names = "default";
213 pinctrl-0 = <&i2c0_pins>;
214
215 gpio@20 {
216 compatible = "mcp,mcp23017";
217 reg = <0x20>;
218 };
219
220 tps: tps@24 {
221 reg = <0x24>;
222 };
223
224 eeprom@53 {
225 compatible = "mcp,24c02";
226 reg = <0x53>;
227 pagesize = <8>;
228 };
229
230 rtc@68 {
231 compatible = "dallas,ds1307";
232 reg = <0x68>;
233 };
234};
235
236&elm {
237 status = "okay";
238};
239
240&gpmc {
241 compatible = "ti,am3352-gpmc";
242 ti,hwmods = "gpmc";
243 status = "okay";
244 gpmc,num-waitpins = <2>;
245 pinctrl-names = "default";
246 pinctrl-0 = <&gpmc_pins>;
247
248 #address-cells = <2>;
249 #size-cells = <1>;
250 ranges = <0 0 0x08000000 0x08000000>; /* CS0: NOR 128M */
251
252 nor@0,0 {
253 reg = <0 0x00000000 0x08000000>;
254 compatible = "cfi-flash";
255 linux,mtd-name = "spansion,s29gl010p11t";
256 bank-width = <2>;
257
258 gpmc,mux-add-data = <2>;
259
260 gpmc,sync-clk-ps = <0>;
261 gpmc,cs-on-ns = <0>;
262 gpmc,cs-rd-off-ns = <160>;
263 gpmc,cs-wr-off-ns = <160>;
264 gpmc,adv-on-ns = <10>;
265 gpmc,adv-rd-off-ns = <30>;
266 gpmc,adv-wr-off-ns = <30>;
267 gpmc,oe-on-ns = <40>;
268 gpmc,oe-off-ns = <160>;
269 gpmc,we-on-ns = <40>;
270 gpmc,we-off-ns = <160>;
271 gpmc,rd-cycle-ns = <160>;
272 gpmc,wr-cycle-ns = <160>;
273 gpmc,access-ns = <150>;
274 gpmc,page-burst-access-ns = <10>;
275 gpmc,cycle2cycle-samecsen;
276 gpmc,cycle2cycle-delay-ns = <20>;
277 gpmc,wr-data-mux-bus-ns = <70>;
278 gpmc,wr-access-ns = <80>;
279
280 #address-cells = <1>;
281 #size-cells = <1>;
282
283 /*
284 MTD partition table
285 ===================
286 +------------+-->0x00000000-> U-Boot start
287 | |
288 | |-->0x000BFFFF-> U-Boot end
289 | |-->0x000C0000-> ENV1 start
290 | |
291 | |-->0x000DFFFF-> ENV1 end
292 | |-->0x000E0000-> ENV2 start
293 | |
294 | |-->0x000FFFFF-> ENV2 end
295 | |-->0x00100000-> Kernel start
296 | |
297 | |-->0x004FFFFF-> Kernel end
298 | |-->0x00500000-> File system start
299 | |
300 | |-->0x014FFFFF-> File system end
301 | |-->0x01500000-> User data start
302 | |
303 | |-->0x03FFFFFF-> User data end
304 | |-->0x04000000-> Data storage start
305 | |
306 +------------+-->0x08000000-> NOR end (Free end)
307 */
308 partition@0 {
309 label = "boot";
310 reg = <0x00000000 0x000c0000>; /* 768KB */
311 };
312
313 partition@1 {
314 label = "env1";
315 reg = <0x000c0000 0x00020000>; /* 128KB */
316 };
317
318 partition@2 {
319 label = "env2";
320 reg = <0x000e0000 0x00020000>; /* 128KB */
321 };
322
323 partition@3 {
324 label = "kernel";
325 reg = <0x00100000 0x00400000>; /* 4MB */
326 };
327
328 partition@4 {
329 label = "rootfs";
330 reg = <0x00500000 0x01000000>; /* 16MB */
331 };
332
333 partition@5 {
334 label = "user";
335 reg = <0x01500000 0x02b00000>; /* 43MB */
336 };
337
338 partition@6 {
339 label = "data";
340 reg = <0x04000000 0x04000000>; /* 64MB */
341 };
342 };
343};
344
345&mac {
346 dual_emac = <1>;
347};
348
349&cpsw_emac0 {
350 phy_id = <&davinci_mdio>, <0>;
351 dual_emac_res_vlan = <1>;
352};
353
354&cpsw_emac1 {
355 phy_id = <&davinci_mdio>, <1>;
356 dual_emac_res_vlan = <2>;
357};
358
359&mmc1 {
360 status = "okay";
361 vmmc-supply = <&ldo4_reg>;
362 pinctrl-names = "default";
363 pinctrl-0 = <&mmc1_pins>;
364 bus-width = <4>;
365 cd-gpios = <&gpio3 8 0>;
366 wp-gpios = <&gpio3 18 0>;
367};
368
369#include "tps65217.dtsi"
370
371&tps {
372 regulators {
373 dcdc1_reg: regulator@0 {
374 /* +1.5V voltage with ±4% tolerance */
375 regulator-min-microvolt = <1450000>;
376 regulator-max-microvolt = <1550000>;
377 regulator-boot-on;
378 regulator-always-on;
379 };
380
381 dcdc2_reg: regulator@1 {
382 /* VDD_MPU voltage limits 0.95V - 1.1V with ±4% tolerance */
383 regulator-name = "vdd_mpu";
384 regulator-min-microvolt = <915000>;
385 regulator-max-microvolt = <1140000>;
386 regulator-boot-on;
387 regulator-always-on;
388 };
389
390 dcdc3_reg: regulator@2 {
391 /* VDD_CORE voltage limits 0.95V - 1.1V with ±4% tolerance */
392 regulator-name = "vdd_core";
393 regulator-min-microvolt = <915000>;
394 regulator-max-microvolt = <1140000>;
395 regulator-boot-on;
396 regulator-always-on;
397 };
398
399 ldo1_reg: regulator@3 {
400 /* +1.8V voltage with ±4% tolerance */
401 regulator-min-microvolt = <1750000>;
402 regulator-max-microvolt = <1870000>;
403 regulator-boot-on;
404 regulator-always-on;
405 };
406
407 ldo2_reg: regulator@4 {
408 /* +3.3V voltage with ±4% tolerance */
409 regulator-min-microvolt = <3175000>;
410 regulator-max-microvolt = <3430000>;
411 regulator-boot-on;
412 regulator-always-on;
413 };
414
415 ldo3_reg: regulator@5 {
416 /* +1.8V voltage with ±4% tolerance */
417 regulator-min-microvolt = <1750000>;
418 regulator-max-microvolt = <1870000>;
419 regulator-boot-on;
420 regulator-always-on;
421 };
422
423 ldo4_reg: regulator@6 {
424 /* +3.3V voltage with ±4% tolerance */
425 regulator-min-microvolt = <3175000>;
426 regulator-max-microvolt = <3430000>;
427 regulator-boot-on;
428 regulator-always-on;
429 };
430 };
431};
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index f9c5da9c7fe1..f6d8ffe98d0b 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -18,6 +18,9 @@
18 interrupt-parent = <&intc>; 18 interrupt-parent = <&intc>;
19 19
20 aliases { 20 aliases {
21 i2c0 = &i2c0;
22 i2c1 = &i2c1;
23 i2c2 = &i2c2;
21 serial0 = &uart0; 24 serial0 = &uart0;
22 serial1 = &uart1; 25 serial1 = &uart1;
23 serial2 = &uart2; 26 serial2 = &uart2;
@@ -30,6 +33,8 @@
30 usb1 = &usb1; 33 usb1 = &usb1;
31 phy0 = &usb0_phy; 34 phy0 = &usb0_phy;
32 phy1 = &usb1_phy; 35 phy1 = &usb1_phy;
36 ethernet0 = &cpsw_emac0;
37 ethernet1 = &cpsw_emac1;
33 }; 38 };
34 39
35 cpus { 40 cpus {
@@ -57,6 +62,11 @@
57 }; 62 };
58 }; 63 };
59 64
65 pmu {
66 compatible = "arm,cortex-a8-pmu";
67 interrupts = <3>;
68 };
69
60 /* 70 /*
61 * The soc node represents the soc top level view. It is uses for IPs 71 * The soc node represents the soc top level view. It is uses for IPs
62 * that are not memory mapped in the MPU view or for the MPU itself. 72 * that are not memory mapped in the MPU view or for the MPU itself.
@@ -100,13 +110,25 @@
100 reg = <0x48200000 0x1000>; 110 reg = <0x48200000 0x1000>;
101 }; 111 };
102 112
113 edma: edma@49000000 {
114 compatible = "ti,edma3";
115 ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
116 reg = <0x49000000 0x10000>,
117 <0x44e10f90 0x10>;
118 interrupts = <12 13 14>;
119 #dma-cells = <1>;
120 dma-channels = <64>;
121 ti,edma-regions = <4>;
122 ti,edma-slots = <256>;
123 };
124
103 gpio0: gpio@44e07000 { 125 gpio0: gpio@44e07000 {
104 compatible = "ti,omap4-gpio"; 126 compatible = "ti,omap4-gpio";
105 ti,hwmods = "gpio1"; 127 ti,hwmods = "gpio1";
106 gpio-controller; 128 gpio-controller;
107 #gpio-cells = <2>; 129 #gpio-cells = <2>;
108 interrupt-controller; 130 interrupt-controller;
109 #interrupt-cells = <1>; 131 #interrupt-cells = <2>;
110 reg = <0x44e07000 0x1000>; 132 reg = <0x44e07000 0x1000>;
111 interrupts = <96>; 133 interrupts = <96>;
112 }; 134 };
@@ -117,7 +139,7 @@
117 gpio-controller; 139 gpio-controller;
118 #gpio-cells = <2>; 140 #gpio-cells = <2>;
119 interrupt-controller; 141 interrupt-controller;
120 #interrupt-cells = <1>; 142 #interrupt-cells = <2>;
121 reg = <0x4804c000 0x1000>; 143 reg = <0x4804c000 0x1000>;
122 interrupts = <98>; 144 interrupts = <98>;
123 }; 145 };
@@ -128,7 +150,7 @@
128 gpio-controller; 150 gpio-controller;
129 #gpio-cells = <2>; 151 #gpio-cells = <2>;
130 interrupt-controller; 152 interrupt-controller;
131 #interrupt-cells = <1>; 153 #interrupt-cells = <2>;
132 reg = <0x481ac000 0x1000>; 154 reg = <0x481ac000 0x1000>;
133 interrupts = <32>; 155 interrupts = <32>;
134 }; 156 };
@@ -139,7 +161,7 @@
139 gpio-controller; 161 gpio-controller;
140 #gpio-cells = <2>; 162 #gpio-cells = <2>;
141 interrupt-controller; 163 interrupt-controller;
142 #interrupt-cells = <1>; 164 #interrupt-cells = <2>;
143 reg = <0x481ae000 0x1000>; 165 reg = <0x481ae000 0x1000>;
144 interrupts = <62>; 166 interrupts = <62>;
145 }; 167 };
@@ -228,6 +250,50 @@
228 status = "disabled"; 250 status = "disabled";
229 }; 251 };
230 252
253 mmc1: mmc@48060000 {
254 compatible = "ti,omap4-hsmmc";
255 ti,hwmods = "mmc1";
256 ti,dual-volt;
257 ti,needs-special-reset;
258 ti,needs-special-hs-handling;
259 dmas = <&edma 24
260 &edma 25>;
261 dma-names = "tx", "rx";
262 interrupts = <64>;
263 interrupt-parent = <&intc>;
264 reg = <0x48060000 0x1000>;
265 status = "disabled";
266 };
267
268 mmc2: mmc@481d8000 {
269 compatible = "ti,omap4-hsmmc";
270 ti,hwmods = "mmc2";
271 ti,needs-special-reset;
272 dmas = <&edma 2
273 &edma 3>;
274 dma-names = "tx", "rx";
275 interrupts = <28>;
276 interrupt-parent = <&intc>;
277 reg = <0x481d8000 0x1000>;
278 status = "disabled";
279 };
280
281 mmc3: mmc@47810000 {
282 compatible = "ti,omap4-hsmmc";
283 ti,hwmods = "mmc3";
284 ti,needs-special-reset;
285 interrupts = <29>;
286 interrupt-parent = <&intc>;
287 reg = <0x47810000 0x1000>;
288 status = "disabled";
289 };
290
291 hwspinlock: spinlock@480ca000 {
292 compatible = "ti,omap4-hwspinlock";
293 reg = <0x480ca000 0x1000>;
294 ti,hwmods = "spinlock";
295 };
296
231 wdt2: wdt@44e35000 { 297 wdt2: wdt@44e35000 {
232 compatible = "ti,omap3-wdt"; 298 compatible = "ti,omap3-wdt";
233 ti,hwmods = "wd_timer2"; 299 ti,hwmods = "wd_timer2";
@@ -323,6 +389,11 @@
323 interrupts = <65>; 389 interrupts = <65>;
324 ti,spi-num-cs = <2>; 390 ti,spi-num-cs = <2>;
325 ti,hwmods = "spi0"; 391 ti,hwmods = "spi0";
392 dmas = <&edma 16
393 &edma 17
394 &edma 18
395 &edma 19>;
396 dma-names = "tx0", "rx0", "tx1", "rx1";
326 status = "disabled"; 397 status = "disabled";
327 }; 398 };
328 399
@@ -334,6 +405,11 @@
334 interrupts = <125>; 405 interrupts = <125>;
335 ti,spi-num-cs = <2>; 406 ti,spi-num-cs = <2>;
336 ti,hwmods = "spi1"; 407 ti,hwmods = "spi1";
408 dmas = <&edma 42
409 &edma 43
410 &edma 44
411 &edma 45>;
412 dma-names = "tx0", "rx0", "tx1", "rx1";
337 status = "disabled"; 413 status = "disabled";
338 }; 414 };
339 415
@@ -346,7 +422,7 @@
346 ti,hwmods = "usb_otg_hs"; 422 ti,hwmods = "usb_otg_hs";
347 status = "disabled"; 423 status = "disabled";
348 424
349 ctrl_mod: control@44e10000 { 425 usb_ctrl_mod: control@44e10000 {
350 compatible = "ti,am335x-usb-ctrl-module"; 426 compatible = "ti,am335x-usb-ctrl-module";
351 reg = <0x44e10620 0x10 427 reg = <0x44e10620 0x10
352 0x44e10648 0x4>; 428 0x44e10648 0x4>;
@@ -359,7 +435,7 @@
359 reg = <0x47401300 0x100>; 435 reg = <0x47401300 0x100>;
360 reg-names = "phy"; 436 reg-names = "phy";
361 status = "disabled"; 437 status = "disabled";
362 ti,ctrl_mod = <&ctrl_mod>; 438 ti,ctrl_mod = <&usb_ctrl_mod>;
363 }; 439 };
364 440
365 usb0: usb@47401000 { 441 usb0: usb@47401000 {
@@ -407,7 +483,7 @@
407 reg = <0x47401b00 0x100>; 483 reg = <0x47401b00 0x100>;
408 reg-names = "phy"; 484 reg-names = "phy";
409 status = "disabled"; 485 status = "disabled";
410 ti,ctrl_mod = <&ctrl_mod>; 486 ti,ctrl_mod = <&usb_ctrl_mod>;
411 }; 487 };
412 488
413 usb1: usb@47401800 { 489 usb1: usb@47401800 {
@@ -594,6 +670,12 @@
594 /* Filled in by U-Boot */ 670 /* Filled in by U-Boot */
595 mac-address = [ 00 00 00 00 00 00 ]; 671 mac-address = [ 00 00 00 00 00 00 ];
596 }; 672 };
673
674 phy_sel: cpsw-phy-sel@44e10650 {
675 compatible = "ti,am3352-cpsw-phy-sel";
676 reg= <0x44e10650 0x4>;
677 reg-names = "gmii-sel";
678 };
597 }; 679 };
598 680
599 ocmcram: ocmcram@40300000 { 681 ocmcram: ocmcram@40300000 {
@@ -607,6 +689,7 @@
607 reg = <0x44d00000 0x4000 /* M3 UMEM */ 689 reg = <0x44d00000 0x4000 /* M3 UMEM */
608 0x44d80000 0x2000>; /* M3 DMEM */ 690 0x44d80000 0x2000>; /* M3 DMEM */
609 ti,hwmods = "wkup_m3"; 691 ti,hwmods = "wkup_m3";
692 ti,no-reset-on-init;
610 }; 693 };
611 694
612 elm: elm@48080000 { 695 elm: elm@48080000 {
@@ -617,6 +700,15 @@
617 status = "disabled"; 700 status = "disabled";
618 }; 701 };
619 702
703 lcdc: lcdc@4830e000 {
704 compatible = "ti,am33xx-tilcdc";
705 reg = <0x4830e000 0x1000>;
706 interrupt-parent = <&intc>;
707 interrupts = <36>;
708 ti,hwmods = "lcdc";
709 status = "disabled";
710 };
711
620 tscadc: tscadc@44e0d000 { 712 tscadc: tscadc@44e0d000 {
621 compatible = "ti,am3359-tscadc"; 713 compatible = "ti,am3359-tscadc";
622 reg = <0x44e0d000 0x1000>; 714 reg = <0x44e0d000 0x1000>;
@@ -637,6 +729,7 @@
637 gpmc: gpmc@50000000 { 729 gpmc: gpmc@50000000 {
638 compatible = "ti,am3352-gpmc"; 730 compatible = "ti,am3352-gpmc";
639 ti,hwmods = "gpmc"; 731 ti,hwmods = "gpmc";
732 ti,no-idle-on-init;
640 reg = <0x50000000 0x2000>; 733 reg = <0x50000000 0x2000>;
641 interrupts = <100>; 734 interrupts = <100>;
642 gpmc,num-cs = <7>; 735 gpmc,num-cs = <7>;
@@ -645,5 +738,59 @@
645 #size-cells = <1>; 738 #size-cells = <1>;
646 status = "disabled"; 739 status = "disabled";
647 }; 740 };
741
742 sham: sham@53100000 {
743 compatible = "ti,omap4-sham";
744 ti,hwmods = "sham";
745 reg = <0x53100000 0x200>;
746 interrupts = <109>;
747 dmas = <&edma 36>;
748 dma-names = "rx";
749 };
750
751 aes: aes@53500000 {
752 compatible = "ti,omap4-aes";
753 ti,hwmods = "aes";
754 reg = <0x53500000 0xa0>;
755 interrupts = <103>;
756 dmas = <&edma 6>,
757 <&edma 5>;
758 dma-names = "tx", "rx";
759 };
760
761 mcasp0: mcasp@48038000 {
762 compatible = "ti,am33xx-mcasp-audio";
763 ti,hwmods = "mcasp0";
764 reg = <0x48038000 0x2000>,
765 <0x46000000 0x400000>;
766 reg-names = "mpu", "dat";
767 interrupts = <80>, <81>;
768 interrupts-names = "tx", "rx";
769 status = "disabled";
770 dmas = <&edma 8>,
771 <&edma 9>;
772 dma-names = "tx", "rx";
773 };
774
775 mcasp1: mcasp@4803C000 {
776 compatible = "ti,am33xx-mcasp-audio";
777 ti,hwmods = "mcasp1";
778 reg = <0x4803C000 0x2000>,
779 <0x46400000 0x400000>;
780 reg-names = "mpu", "dat";
781 interrupts = <82>, <83>;
782 interrupts-names = "tx", "rx";
783 status = "disabled";
784 dmas = <&edma 10>,
785 <&edma 11>;
786 dma-names = "tx", "rx";
787 };
788
789 rng: rng@48310000 {
790 compatible = "ti,omap4-rng";
791 ti,hwmods = "rng";
792 reg = <0x48310000 0x2000>;
793 interrupts = <111>;
794 };
648 }; 795 };
649}; 796};
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index ddc1df77ac52..974d103ab3b1 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -18,12 +18,21 @@
18 18
19 19
20 aliases { 20 aliases {
21 i2c0 = &i2c0;
22 i2c1 = &i2c1;
23 i2c2 = &i2c2;
21 serial0 = &uart0; 24 serial0 = &uart0;
25 ethernet0 = &cpsw_emac0;
26 ethernet1 = &cpsw_emac1;
22 }; 27 };
23 28
24 cpus { 29 cpus {
30 #address-cells = <1>;
31 #size-cells = <0>;
25 cpu@0 { 32 cpu@0 {
26 compatible = "arm,cortex-a9"; 33 compatible = "arm,cortex-a9";
34 device_type = "cpu";
35 reg = <0>;
27 }; 36 };
28 }; 37 };
29 38
@@ -35,16 +44,100 @@
35 <0x48240100 0x0100>; 44 <0x48240100 0x0100>;
36 }; 45 };
37 46
47 l2-cache-controller@48242000 {
48 compatible = "arm,pl310-cache";
49 reg = <0x48242000 0x1000>;
50 cache-unified;
51 cache-level = <2>;
52 };
53
54 am43xx_pinmux: pinmux@44e10800 {
55 compatible = "pinctrl-single";
56 reg = <0x44e10800 0x31c>;
57 #address-cells = <1>;
58 #size-cells = <0>;
59 pinctrl-single,register-width = <32>;
60 pinctrl-single,function-mask = <0xffffffff>;
61 };
62
38 ocp { 63 ocp {
39 compatible = "simple-bus"; 64 compatible = "simple-bus";
40 #address-cells = <1>; 65 #address-cells = <1>;
41 #size-cells = <1>; 66 #size-cells = <1>;
42 ranges; 67 ranges;
68 ti,hwmods = "l3_main";
69
70 edma: edma@49000000 {
71 compatible = "ti,edma3";
72 ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
73 reg = <0x49000000 0x10000>,
74 <0x44e10f90 0x10>;
75 interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>,
76 <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
77 <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
78 #dma-cells = <1>;
79 dma-channels = <64>;
80 ti,edma-regions = <4>;
81 ti,edma-slots = <256>;
82 };
43 83
44 uart0: serial@44e09000 { 84 uart0: serial@44e09000 {
45 compatible = "ti,am4372-uart","ti,omap2-uart"; 85 compatible = "ti,am4372-uart","ti,omap2-uart";
46 reg = <0x44e09000 0x2000>; 86 reg = <0x44e09000 0x2000>;
47 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; 87 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
88 ti,hwmods = "uart1";
89 };
90
91 uart1: serial@48022000 {
92 compatible = "ti,am4372-uart","ti,omap2-uart";
93 reg = <0x48022000 0x2000>;
94 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
95 ti,hwmods = "uart2";
96 status = "disabled";
97 };
98
99 uart2: serial@48024000 {
100 compatible = "ti,am4372-uart","ti,omap2-uart";
101 reg = <0x48024000 0x2000>;
102 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
103 ti,hwmods = "uart3";
104 status = "disabled";
105 };
106
107 uart3: serial@481a6000 {
108 compatible = "ti,am4372-uart","ti,omap2-uart";
109 reg = <0x481a6000 0x2000>;
110 interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
111 ti,hwmods = "uart4";
112 status = "disabled";
113 };
114
115 uart4: serial@481a8000 {
116 compatible = "ti,am4372-uart","ti,omap2-uart";
117 reg = <0x481a8000 0x2000>;
118 interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
119 ti,hwmods = "uart5";
120 status = "disabled";
121 };
122
123 uart5: serial@481aa000 {
124 compatible = "ti,am4372-uart","ti,omap2-uart";
125 reg = <0x481aa000 0x2000>;
126 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
127 ti,hwmods = "uart6";
128 status = "disabled";
129 };
130
131 mailbox: mailbox@480C8000 {
132 compatible = "ti,omap4-mailbox";
133 reg = <0x480C8000 0x200>;
134 interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
135 ti,hwmods = "mailbox";
136 ti,mbox-num-users = <4>;
137 ti,mbox-num-fifos = <8>;
138 ti,mbox-names = "wkup_m3";
139 ti,mbox-data = <0 0 0 0>;
140 status = "disabled";
48 }; 141 };
49 142
50 timer1: timer@44e31000 { 143 timer1: timer@44e31000 {
@@ -52,17 +145,523 @@
52 reg = <0x44e31000 0x400>; 145 reg = <0x44e31000 0x400>;
53 interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; 146 interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
54 ti,timer-alwon; 147 ti,timer-alwon;
148 ti,hwmods = "timer1";
55 }; 149 };
56 150
57 timer2: timer@48040000 { 151 timer2: timer@48040000 {
58 compatible = "ti,am4372-timer","ti,am335x-timer"; 152 compatible = "ti,am4372-timer","ti,am335x-timer";
59 reg = <0x48040000 0x400>; 153 reg = <0x48040000 0x400>;
60 interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>; 154 interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
155 ti,hwmods = "timer2";
156 };
157
158 timer3: timer@48042000 {
159 compatible = "ti,am4372-timer","ti,am335x-timer";
160 reg = <0x48042000 0x400>;
161 interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
162 ti,hwmods = "timer3";
163 status = "disabled";
164 };
165
166 timer4: timer@48044000 {
167 compatible = "ti,am4372-timer","ti,am335x-timer";
168 reg = <0x48044000 0x400>;
169 interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
170 ti,timer-pwm;
171 ti,hwmods = "timer4";
172 status = "disabled";
173 };
174
175 timer5: timer@48046000 {
176 compatible = "ti,am4372-timer","ti,am335x-timer";
177 reg = <0x48046000 0x400>;
178 interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
179 ti,timer-pwm;
180 ti,hwmods = "timer5";
181 status = "disabled";
182 };
183
184 timer6: timer@48048000 {
185 compatible = "ti,am4372-timer","ti,am335x-timer";
186 reg = <0x48048000 0x400>;
187 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
188 ti,timer-pwm;
189 ti,hwmods = "timer6";
190 status = "disabled";
191 };
192
193 timer7: timer@4804a000 {
194 compatible = "ti,am4372-timer","ti,am335x-timer";
195 reg = <0x4804a000 0x400>;
196 interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
197 ti,timer-pwm;
198 ti,hwmods = "timer7";
199 status = "disabled";
200 };
201
202 timer8: timer@481c1000 {
203 compatible = "ti,am4372-timer","ti,am335x-timer";
204 reg = <0x481c1000 0x400>;
205 interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>;
206 ti,hwmods = "timer8";
207 status = "disabled";
208 };
209
210 timer9: timer@4833d000 {
211 compatible = "ti,am4372-timer","ti,am335x-timer";
212 reg = <0x4833d000 0x400>;
213 interrupts = <GIC_SPI 132 IRQ_TYPE_LEVEL_HIGH>;
214 ti,hwmods = "timer9";
215 status = "disabled";
216 };
217
218 timer10: timer@4833f000 {
219 compatible = "ti,am4372-timer","ti,am335x-timer";
220 reg = <0x4833f000 0x400>;
221 interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>;
222 ti,hwmods = "timer10";
223 status = "disabled";
224 };
225
226 timer11: timer@48341000 {
227 compatible = "ti,am4372-timer","ti,am335x-timer";
228 reg = <0x48341000 0x400>;
229 interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>;
230 ti,hwmods = "timer11";
231 status = "disabled";
61 }; 232 };
62 233
63 counter32k: counter@44e86000 { 234 counter32k: counter@44e86000 {
64 compatible = "ti,am4372-counter32k","ti,omap-counter32k"; 235 compatible = "ti,am4372-counter32k","ti,omap-counter32k";
65 reg = <0x44e86000 0x40>; 236 reg = <0x44e86000 0x40>;
237 ti,hwmods = "counter_32k";
238 };
239
240 rtc@44e3e000 {
241 compatible = "ti,am4372-rtc","ti,da830-rtc";
242 reg = <0x44e3e000 0x1000>;
243 interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH
244 GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
245 ti,hwmods = "rtc";
246 status = "disabled";
247 };
248
249 wdt@44e35000 {
250 compatible = "ti,am4372-wdt","ti,omap3-wdt";
251 reg = <0x44e35000 0x1000>;
252 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
253 ti,hwmods = "wd_timer2";
254 };
255
256 gpio0: gpio@44e07000 {
257 compatible = "ti,am4372-gpio","ti,omap4-gpio";
258 reg = <0x44e07000 0x1000>;
259 interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
260 gpio-controller;
261 #gpio-cells = <2>;
262 interrupt-controller;
263 #interrupt-cells = <2>;
264 ti,hwmods = "gpio1";
265 status = "disabled";
266 };
267
268 gpio1: gpio@4804c000 {
269 compatible = "ti,am4372-gpio","ti,omap4-gpio";
270 reg = <0x4804c000 0x1000>;
271 interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
272 gpio-controller;
273 #gpio-cells = <2>;
274 interrupt-controller;
275 #interrupt-cells = <2>;
276 ti,hwmods = "gpio2";
277 status = "disabled";
278 };
279
280 gpio2: gpio@481ac000 {
281 compatible = "ti,am4372-gpio","ti,omap4-gpio";
282 reg = <0x481ac000 0x1000>;
283 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
284 gpio-controller;
285 #gpio-cells = <2>;
286 interrupt-controller;
287 #interrupt-cells = <2>;
288 ti,hwmods = "gpio3";
289 status = "disabled";
290 };
291
292 gpio3: gpio@481ae000 {
293 compatible = "ti,am4372-gpio","ti,omap4-gpio";
294 reg = <0x481ae000 0x1000>;
295 interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
296 gpio-controller;
297 #gpio-cells = <2>;
298 interrupt-controller;
299 #interrupt-cells = <2>;
300 ti,hwmods = "gpio4";
301 status = "disabled";
302 };
303
304 gpio4: gpio@48320000 {
305 compatible = "ti,am4372-gpio","ti,omap4-gpio";
306 reg = <0x48320000 0x1000>;
307 interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
308 gpio-controller;
309 #gpio-cells = <2>;
310 interrupt-controller;
311 #interrupt-cells = <2>;
312 ti,hwmods = "gpio5";
313 status = "disabled";
314 };
315
316 gpio5: gpio@48322000 {
317 compatible = "ti,am4372-gpio","ti,omap4-gpio";
318 reg = <0x48322000 0x1000>;
319 interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
320 gpio-controller;
321 #gpio-cells = <2>;
322 interrupt-controller;
323 #interrupt-cells = <2>;
324 ti,hwmods = "gpio6";
325 status = "disabled";
326 };
327
328 i2c0: i2c@44e0b000 {
329 compatible = "ti,am4372-i2c","ti,omap4-i2c";
330 reg = <0x44e0b000 0x1000>;
331 interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
332 ti,hwmods = "i2c1";
333 #address-cells = <1>;
334 #size-cells = <0>;
335 status = "disabled";
336 };
337
338 i2c1: i2c@4802a000 {
339 compatible = "ti,am4372-i2c","ti,omap4-i2c";
340 reg = <0x4802a000 0x1000>;
341 interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
342 ti,hwmods = "i2c2";
343 #address-cells = <1>;
344 #size-cells = <0>;
345 status = "disabled";
346 };
347
348 i2c2: i2c@4819c000 {
349 compatible = "ti,am4372-i2c","ti,omap4-i2c";
350 reg = <0x4819c000 0x1000>;
351 interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
352 ti,hwmods = "i2c3";
353 #address-cells = <1>;
354 #size-cells = <0>;
355 status = "disabled";
356 };
357
358 spi0: spi@48030000 {
359 compatible = "ti,am4372-mcspi","ti,omap4-mcspi";
360 reg = <0x48030000 0x400>;
361 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
362 ti,hwmods = "spi0";
363 #address-cells = <1>;
364 #size-cells = <0>;
365 status = "disabled";
366 };
367
368 mmc1: mmc@48060000 {
369 compatible = "ti,omap4-hsmmc";
370 reg = <0x48060000 0x1000>;
371 ti,hwmods = "mmc1";
372 ti,dual-volt;
373 ti,needs-special-reset;
374 dmas = <&edma 24
375 &edma 25>;
376 dma-names = "tx", "rx";
377 interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
378 status = "disabled";
379 };
380
381 mmc2: mmc@481d8000 {
382 compatible = "ti,omap4-hsmmc";
383 reg = <0x481d8000 0x1000>;
384 ti,hwmods = "mmc2";
385 ti,needs-special-reset;
386 dmas = <&edma 2
387 &edma 3>;
388 dma-names = "tx", "rx";
389 interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
390 status = "disabled";
391 };
392
393 mmc3: mmc@47810000 {
394 compatible = "ti,omap4-hsmmc";
395 reg = <0x47810000 0x1000>;
396 ti,hwmods = "mmc3";
397 ti,needs-special-reset;
398 interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
399 status = "disabled";
400 };
401
402 spi1: spi@481a0000 {
403 compatible = "ti,am4372-mcspi","ti,omap4-mcspi";
404 reg = <0x481a0000 0x400>;
405 interrupts = <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>;
406 ti,hwmods = "spi1";
407 #address-cells = <1>;
408 #size-cells = <0>;
409 status = "disabled";
410 };
411
412 spi2: spi@481a2000 {
413 compatible = "ti,am4372-mcspi","ti,omap4-mcspi";
414 reg = <0x481a2000 0x400>;
415 interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
416 ti,hwmods = "spi2";
417 #address-cells = <1>;
418 #size-cells = <0>;
419 status = "disabled";
420 };
421
422 spi3: spi@481a4000 {
423 compatible = "ti,am4372-mcspi","ti,omap4-mcspi";
424 reg = <0x481a4000 0x400>;
425 interrupts = <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>;
426 ti,hwmods = "spi3";
427 #address-cells = <1>;
428 #size-cells = <0>;
429 status = "disabled";
430 };
431
432 spi4: spi@48345000 {
433 compatible = "ti,am4372-mcspi","ti,omap4-mcspi";
434 reg = <0x48345000 0x400>;
435 interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
436 ti,hwmods = "spi4";
437 #address-cells = <1>;
438 #size-cells = <0>;
439 status = "disabled";
440 };
441
442 mac: ethernet@4a100000 {
443 compatible = "ti,am4372-cpsw","ti,cpsw";
444 reg = <0x4a100000 0x800
445 0x4a101200 0x100>;
446 interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH
447 GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH
448 GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH
449 GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
450 #address-cells = <1>;
451 #size-cells = <1>;
452 ti,hwmods = "cpgmac0";
453 status = "disabled";
454 cpdma_channels = <8>;
455 ale_entries = <1024>;
456 bd_ram_size = <0x2000>;
457 no_bd_ram = <0>;
458 rx_descs = <64>;
459 mac_control = <0x20>;
460 slaves = <2>;
461 active_slave = <0>;
462 cpts_clock_mult = <0x80000000>;
463 cpts_clock_shift = <29>;
464 ranges;
465
466 davinci_mdio: mdio@4a101000 {
467 compatible = "ti,am4372-mdio","ti,davinci_mdio";
468 reg = <0x4a101000 0x100>;
469 #address-cells = <1>;
470 #size-cells = <0>;
471 ti,hwmods = "davinci_mdio";
472 bus_freq = <1000000>;
473 status = "disabled";
474 };
475
476 cpsw_emac0: slave@4a100200 {
477 /* Filled in by U-Boot */
478 mac-address = [ 00 00 00 00 00 00 ];
479 };
480
481 cpsw_emac1: slave@4a100300 {
482 /* Filled in by U-Boot */
483 mac-address = [ 00 00 00 00 00 00 ];
484 };
485 };
486
487 epwmss0: epwmss@48300000 {
488 compatible = "ti,am4372-pwmss","ti,am33xx-pwmss";
489 reg = <0x48300000 0x10>;
490 #address-cells = <1>;
491 #size-cells = <1>;
492 ranges;
493 ti,hwmods = "epwmss0";
494 status = "disabled";
495
496 ecap0: ecap@48300100 {
497 compatible = "ti,am4372-ecap","ti,am33xx-ecap";
498 reg = <0x48300100 0x80>;
499 ti,hwmods = "ecap0";
500 status = "disabled";
501 };
502
503 ehrpwm0: ehrpwm@48300200 {
504 compatible = "ti,am4372-ehrpwm","ti,am33xx-ehrpwm";
505 reg = <0x48300200 0x80>;
506 ti,hwmods = "ehrpwm0";
507 status = "disabled";
508 };
509 };
510
511 epwmss1: epwmss@48302000 {
512 compatible = "ti,am4372-pwmss","ti,am33xx-pwmss";
513 reg = <0x48302000 0x10>;
514 #address-cells = <1>;
515 #size-cells = <1>;
516 ranges;
517 ti,hwmods = "epwmss1";
518 status = "disabled";
519
520 ecap1: ecap@48302100 {
521 compatible = "ti,am4372-ecap","ti,am33xx-ecap";
522 reg = <0x48302100 0x80>;
523 ti,hwmods = "ecap1";
524 status = "disabled";
525 };
526
527 ehrpwm1: ehrpwm@48302200 {
528 compatible = "ti,am4372-ehrpwm","ti,am33xx-ehrpwm";
529 reg = <0x48302200 0x80>;
530 ti,hwmods = "ehrpwm1";
531 status = "disabled";
532 };
533 };
534
535 epwmss2: epwmss@48304000 {
536 compatible = "ti,am4372-pwmss","ti,am33xx-pwmss";
537 reg = <0x48304000 0x10>;
538 #address-cells = <1>;
539 #size-cells = <1>;
540 ranges;
541 ti,hwmods = "epwmss2";
542 status = "disabled";
543
544 ecap2: ecap@48304100 {
545 compatible = "ti,am4372-ecap","ti,am33xx-ecap";
546 reg = <0x48304100 0x80>;
547 ti,hwmods = "ecap2";
548 status = "disabled";
549 };
550
551 ehrpwm2: ehrpwm@48304200 {
552 compatible = "ti,am4372-ehrpwm","ti,am33xx-ehrpwm";
553 reg = <0x48304200 0x80>;
554 ti,hwmods = "ehrpwm2";
555 status = "disabled";
556 };
557 };
558
559 epwmss3: epwmss@48306000 {
560 compatible = "ti,am4372-pwmss","ti,am33xx-pwmss";
561 reg = <0x48306000 0x10>;
562 #address-cells = <1>;
563 #size-cells = <1>;
564 ranges;
565 ti,hwmods = "epwmss3";
566 status = "disabled";
567
568 ehrpwm3: ehrpwm@48306200 {
569 compatible = "ti,am4372-ehrpwm","ti,am33xx-ehrpwm";
570 reg = <0x48306200 0x80>;
571 ti,hwmods = "ehrpwm3";
572 status = "disabled";
573 };
574 };
575
576 epwmss4: epwmss@48308000 {
577 compatible = "ti,am4372-pwmss","ti,am33xx-pwmss";
578 reg = <0x48308000 0x10>;
579 #address-cells = <1>;
580 #size-cells = <1>;
581 ranges;
582 ti,hwmods = "epwmss4";
583 status = "disabled";
584
585 ehrpwm4: ehrpwm@48308200 {
586 compatible = "ti,am4372-ehrpwm","ti,am33xx-ehrpwm";
587 reg = <0x48308200 0x80>;
588 ti,hwmods = "ehrpwm4";
589 status = "disabled";
590 };
591 };
592
593 epwmss5: epwmss@4830a000 {
594 compatible = "ti,am4372-pwmss","ti,am33xx-pwmss";
595 reg = <0x4830a000 0x10>;
596 #address-cells = <1>;
597 #size-cells = <1>;
598 ranges;
599 ti,hwmods = "epwmss5";
600 status = "disabled";
601
602 ehrpwm5: ehrpwm@4830a200 {
603 compatible = "ti,am4372-ehrpwm","ti,am33xx-ehrpwm";
604 reg = <0x4830a200 0x80>;
605 ti,hwmods = "ehrpwm5";
606 status = "disabled";
607 };
608 };
609
610 sham: sham@53100000 {
611 compatible = "ti,omap5-sham";
612 ti,hwmods = "sham";
613 reg = <0x53100000 0x300>;
614 dmas = <&edma 36>;
615 dma-names = "rx";
616 interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
617 };
618
619 aes: aes@53501000 {
620 compatible = "ti,omap4-aes";
621 ti,hwmods = "aes";
622 reg = <0x53501000 0xa0>;
623 interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
624 dmas = <&edma 6
625 &edma 5>;
626 dma-names = "tx", "rx";
627 };
628
629 des: des@53701000 {
630 compatible = "ti,omap4-des";
631 ti,hwmods = "des";
632 reg = <0x53701000 0xa0>;
633 interrupts = <GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>;
634 dmas = <&edma 34
635 &edma 33>;
636 dma-names = "tx", "rx";
637 };
638
639 mcasp0: mcasp@48038000 {
640 compatible = "ti,am33xx-mcasp-audio";
641 ti,hwmods = "mcasp0";
642 reg = <0x48038000 0x2000>,
643 <0x46000000 0x400000>;
644 reg-names = "mpu", "dat";
645 interrupts = <80>, <81>;
646 interrupts-names = "tx", "rx";
647 status = "disabled";
648 dmas = <&edma 8>,
649 <&edma 9>;
650 dma-names = "tx", "rx";
651 };
652
653 mcasp1: mcasp@4803C000 {
654 compatible = "ti,am33xx-mcasp-audio";
655 ti,hwmods = "mcasp1";
656 reg = <0x4803C000 0x2000>,
657 <0x46400000 0x400000>;
658 reg-names = "mpu", "dat";
659 interrupts = <82>, <83>;
660 interrupts-names = "tx", "rx";
661 status = "disabled";
662 dmas = <&edma 10>,
663 <&edma 11>;
664 dma-names = "tx", "rx";
66 }; 665 };
67 }; 666 };
68}; 667};
diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts
index 74174d48f476..fbf9c4c7a94f 100644
--- a/arch/arm/boot/dts/am43x-epos-evm.dts
+++ b/arch/arm/boot/dts/am43x-epos-evm.dts
@@ -11,8 +11,176 @@
11/dts-v1/; 11/dts-v1/;
12 12
13#include "am4372.dtsi" 13#include "am4372.dtsi"
14#include <dt-bindings/pinctrl/am43xx.h>
15#include <dt-bindings/gpio/gpio.h>
14 16
15/ { 17/ {
16 model = "TI AM43x EPOS EVM"; 18 model = "TI AM43x EPOS EVM";
17 compatible = "ti,am43x-epos-evm","ti,am4372","ti,am43"; 19 compatible = "ti,am43x-epos-evm","ti,am4372","ti,am43";
20
21 vmmcsd_fixed: fixedregulator-sd {
22 compatible = "regulator-fixed";
23 regulator-name = "vmmcsd_fixed";
24 regulator-min-microvolt = <3300000>;
25 regulator-max-microvolt = <3300000>;
26 enable-active-high;
27 };
28
29 am43xx_pinmux: pinmux@44e10800 {
30 cpsw_default: cpsw_default {
31 pinctrl-single,pins = <
32 /* Slave 1 */
33 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE1) /* mii1_crs.rmii1_crs */
34 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE1) /* mii1_rxerr.rmii1_rxerr */
35 0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE1) /* mii1_txen.rmii1_txen */
36 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE1) /* mii1_rxdv.rmii1_rxdv */
37 0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE1) /* mii1_txd1.rmii1_txd1 */
38 0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE1) /* mii1_txd0.rmii1_txd0 */
39 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE1) /* mii1_rxd1.rmii1_rxd1 */
40 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE1) /* mii1_rxd0.rmii1_rxd0 */
41 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* rmii1_refclk.rmii1_refclk */
42 >;
43 };
44
45 cpsw_sleep: cpsw_sleep {
46 pinctrl-single,pins = <
47 /* Slave 1 reset value */
48 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE7)
49 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE7)
50 0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
51 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
52 0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
53 0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
54 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
55 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
56 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE7)
57 >;
58 };
59
60 davinci_mdio_default: davinci_mdio_default {
61 pinctrl-single,pins = <
62 /* MDIO */
63 0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */
64 0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */
65 >;
66 };
67
68 davinci_mdio_sleep: davinci_mdio_sleep {
69 pinctrl-single,pins = <
70 /* MDIO reset value */
71 0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
72 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
73 >;
74 };
75
76 i2c0_pins: pinmux_i2c0_pins {
77 pinctrl-single,pins = <
78 0x188 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* i2c0_sda.i2c0_sda */
79 0x18c (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* i2c0_scl.i2c0_scl */
80 >;
81 };
82 };
83
84 matrix_keypad: matrix_keypad@0 {
85 compatible = "gpio-matrix-keypad";
86 debounce-delay-ms = <5>;
87 col-scan-delay-us = <2>;
88
89 row-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH /* Bank0, pin12 */
90 &gpio0 13 GPIO_ACTIVE_HIGH /* Bank0, pin13 */
91 &gpio0 14 GPIO_ACTIVE_HIGH /* Bank0, pin14 */
92 &gpio0 15 GPIO_ACTIVE_HIGH>; /* Bank0, pin15 */
93
94 col-gpios = <&gpio3 9 GPIO_ACTIVE_HIGH /* Bank3, pin9 */
95 &gpio3 10 GPIO_ACTIVE_HIGH /* Bank3, pin10 */
96 &gpio2 18 GPIO_ACTIVE_HIGH /* Bank2, pin18 */
97 &gpio2 19 GPIO_ACTIVE_HIGH>; /* Bank2, pin19 */
98
99 linux,keymap = <0x00000201 /* P1 */
100 0x01000204 /* P4 */
101 0x02000207 /* P7 */
102 0x0300020a /* NUMERIC_STAR */
103 0x00010202 /* P2 */
104 0x01010205 /* P5 */
105 0x02010208 /* P8 */
106 0x03010200 /* P0 */
107 0x00020203 /* P3 */
108 0x01020206 /* P6 */
109 0x02020209 /* P9 */
110 0x0302020b /* NUMERIC_POUND */
111 0x00030067 /* UP */
112 0x0103006a /* RIGHT */
113 0x0203006c /* DOWN */
114 0x03030069>; /* LEFT */
115 };
116};
117
118&mmc1 {
119 status = "okay";
120 vmmc-supply = <&vmmcsd_fixed>;
121 bus-width = <4>;
122};
123
124&mac {
125 pinctrl-names = "default", "sleep";
126 pinctrl-0 = <&cpsw_default>;
127 pinctrl-1 = <&cpsw_sleep>;
128 status = "okay";
129};
130
131&davinci_mdio {
132 pinctrl-names = "default", "sleep";
133 pinctrl-0 = <&davinci_mdio_default>;
134 pinctrl-1 = <&davinci_mdio_sleep>;
135 status = "okay";
136};
137
138&cpsw_emac0 {
139 phy_id = <&davinci_mdio>, <16>;
140 phy-mode = "rmii";
141};
142
143&cpsw_emac1 {
144 phy_id = <&davinci_mdio>, <1>;
145 phy-mode = "rmii";
146};
147
148&i2c0 {
149 status = "okay";
150 pinctrl-names = "default";
151 pinctrl-0 = <&i2c0_pins>;
152
153 at24@50 {
154 compatible = "at24,24c256";
155 pagesize = <64>;
156 reg = <0x50>;
157 };
158
159 pixcir_ts@5c {
160 compatible = "pixcir,pixcir_ts";
161 reg = <0x5c>;
162 interrupt-parent = <&gpio1>;
163 interrupts = <17 0>;
164
165 attb-gpio = <&gpio1 17 GPIO_ACTIVE_HIGH>;
166
167 x-size = <1024>;
168 y-size = <768>;
169 };
170};
171
172&gpio0 {
173 status = "okay";
174};
175
176&gpio1 {
177 status = "okay";
178};
179
180&gpio2 {
181 status = "okay";
182};
183
184&gpio3 {
185 status = "okay";
18}; 186};
diff --git a/arch/arm/boot/dts/armada-370-netgear-rn102.dts b/arch/arm/boot/dts/armada-370-netgear-rn102.dts
index 05e4485a8225..8ac2ac1f69cc 100644
--- a/arch/arm/boot/dts/armada-370-netgear-rn102.dts
+++ b/arch/arm/boot/dts/armada-370-netgear-rn102.dts
@@ -27,6 +27,25 @@
27 }; 27 };
28 28
29 soc { 29 soc {
30 ranges = <MBUS_ID(0xf0, 0x01) 0 0xd0000000 0x100000
31 MBUS_ID(0x01, 0xe0) 0 0xfff00000 0x100000>;
32
33 pcie-controller {
34 status = "okay";
35
36 /* Connected to Marvell SATA controller */
37 pcie@1,0 {
38 /* Port 0, Lane 0 */
39 status = "okay";
40 };
41
42 /* Connected to FL1009 USB 3.0 controller */
43 pcie@2,0 {
44 /* Port 1, Lane 0 */
45 status = "okay";
46 };
47 };
48
30 internal-regs { 49 internal-regs {
31 serial@12000 { 50 serial@12000 {
32 clock-frequency = <200000000>; 51 clock-frequency = <200000000>;
@@ -57,6 +76,11 @@
57 marvell,pins = "mpp56"; 76 marvell,pins = "mpp56";
58 marvell,function = "gpio"; 77 marvell,function = "gpio";
59 }; 78 };
79
80 poweroff: poweroff {
81 marvell,pins = "mpp8";
82 marvell,function = "gpio";
83 };
60 }; 84 };
61 85
62 mdio { 86 mdio {
@@ -89,22 +113,6 @@
89 pwm_polarity = <0>; 113 pwm_polarity = <0>;
90 }; 114 };
91 }; 115 };
92
93 pcie-controller {
94 status = "okay";
95
96 /* Connected to Marvell SATA controller */
97 pcie@1,0 {
98 /* Port 0, Lane 0 */
99 status = "okay";
100 };
101
102 /* Connected to FL1009 USB 3.0 controller */
103 pcie@2,0 {
104 /* Port 1, Lane 0 */
105 status = "okay";
106 };
107 };
108 }; 116 };
109 }; 117 };
110 118
@@ -160,7 +168,7 @@
160 button@1 { 168 button@1 {
161 label = "Power Button"; 169 label = "Power Button";
162 linux,code = <116>; /* KEY_POWER */ 170 linux,code = <116>; /* KEY_POWER */
163 gpios = <&gpio1 30 1>; 171 gpios = <&gpio1 30 0>;
164 }; 172 };
165 173
166 button@2 { 174 button@2 {
@@ -176,4 +184,11 @@
176 }; 184 };
177 }; 185 };
178 186
187 gpio_poweroff {
188 compatible = "gpio-poweroff";
189 pinctrl-0 = <&poweroff>;
190 pinctrl-names = "default";
191 gpios = <&gpio0 8 1>;
192 };
193
179}; 194};
diff --git a/arch/arm/boot/dts/armada-370-netgear-rn104.dts b/arch/arm/boot/dts/armada-370-netgear-rn104.dts
new file mode 100644
index 000000000000..b0b32f5fbeb4
--- /dev/null
+++ b/arch/arm/boot/dts/armada-370-netgear-rn104.dts
@@ -0,0 +1,193 @@
1/*
2 * Device Tree file for NETGEAR ReadyNAS 104
3 *
4 * Copyright (C) 2013, Arnaud EBALARD <arno@natisbad.org>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12/dts-v1/;
13
14#include "armada-370.dtsi"
15
16/ {
17 model = "NETGEAR ReadyNAS 104";
18 compatible = "netgear,readynas-104", "marvell,armada370", "marvell,armada-370-xp";
19
20 chosen {
21 bootargs = "console=ttyS0,115200 earlyprintk";
22 };
23
24 memory {
25 device_type = "memory";
26 reg = <0x00000000 0x20000000>; /* 512 MB */
27 };
28
29 soc {
30 ranges = <MBUS_ID(0xf0, 0x01) 0 0xd0000000 0x100000
31 MBUS_ID(0x01, 0xe0) 0 0xfff00000 0x100000>;
32
33 pcie-controller {
34 status = "okay";
35
36 /* Connected to FL1009 USB 3.0 controller */
37 pcie@1,0 {
38 /* Port 0, Lane 0 */
39 status = "okay";
40 };
41
42 /* Connected to Marvell 88SE9215 SATA controller */
43 pcie@2,0 {
44 /* Port 1, Lane 0 */
45 status = "okay";
46 };
47 };
48
49 internal-regs {
50 serial@12000 {
51 clock-frequency = <200000000>;
52 status = "okay";
53 };
54
55 pinctrl {
56 poweroff: poweroff {
57 marvell,pins = "mpp60";
58 marvell,function = "gpio";
59 };
60
61 backup_key_pin: backup-key-pin {
62 marvell,pins = "mpp52";
63 marvell,function = "gpio";
64 };
65
66 power_key_pin: power-key-pin {
67 marvell,pins = "mpp62";
68 marvell,function = "gpio";
69 };
70
71 backup_led_pin: backup-led-pin {
72 marvell,pins = "mpp63";
73 marvell,function = "gpo";
74 };
75
76 power_led_pin: power-led-pin {
77 marvell,pins = "mpp64";
78 marvell,function = "gpio";
79 };
80
81 reset_key_pin: reset-key-pin {
82 marvell,pins = "mpp65";
83 marvell,function = "gpio";
84 };
85 };
86
87 mdio {
88 phy0: ethernet-phy@0 {
89 reg = <0>;
90 };
91
92 phy1: ethernet-phy@1 {
93 reg = <1>;
94 };
95 };
96
97 ethernet@70000 {
98 status = "okay";
99 phy = <&phy0>;
100 phy-mode = "rgmii-id";
101 };
102
103 ethernet@74000 {
104 status = "okay";
105 phy = <&phy1>;
106 phy-mode = "rgmii-id";
107 };
108
109 usb@50000 {
110 status = "okay";
111 };
112
113 i2c@11000 {
114 compatible = "marvell,mv64xxx-i2c";
115 clock-frequency = <100000>;
116 status = "okay";
117
118 g762: g762@3e {
119 compatible = "gmt,g762";
120 reg = <0x3e>;
121 clocks = <&g762_clk>; /* input clock */
122 fan_gear_mode = <0>;
123 fan_startv = <1>;
124 pwm_polarity = <0>;
125 };
126 };
127 };
128 };
129
130 clocks {
131 #address-cells = <1>;
132 #size-cells = <0>;
133
134 g762_clk: fixedclk {
135 compatible = "fixed-clock";
136 #clock-cells = <0>;
137 clock-frequency = <8192>;
138 };
139 };
140
141 gpio_leds {
142 compatible = "gpio-leds";
143 pinctrl-0 = <&backup_led_pin &power_led_pin>;
144 pinctrl-names = "default";
145
146 blue_backup_led {
147 label = "rn104:blue:backup";
148 gpios = <&gpio1 31 0>; /* GPIO 63 Active High */
149 default-state = "off";
150 };
151
152 blue_power_led {
153 label = "rn104:blue:pwr";
154 gpios = <&gpio2 0 1>; /* GPIO 64 Active Low */
155 linux,default-trigger = "keep";
156 };
157 };
158
159 gpio_keys {
160 compatible = "gpio-keys";
161 #address-cells = <1>;
162 #size-cells = <0>;
163 pinctrl-0 = <&backup_key_pin
164 &power_key_pin
165 &reset_key_pin>;
166 pinctrl-names = "default";
167
168 button@1 {
169 label = "Backup Button";
170 linux,code = <133>; /* KEY_COPY */
171 gpios = <&gpio1 20 1>;
172 };
173
174 button@2 {
175 label = "Power Button";
176 linux,code = <116>; /* KEY_POWER */
177 gpios = <&gpio1 30 0>;
178 };
179
180 button@3 {
181 label = "Reset Button";
182 linux,code = <0x198>; /* KEY_RESTART */
183 gpios = <&gpio2 1 1>;
184 };
185 };
186
187 gpio_poweroff {
188 compatible = "gpio-poweroff";
189 pinctrl-0 = <&poweroff>;
190 pinctrl-names = "default";
191 gpios = <&gpio1 28 1>;
192 };
193};
diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi
index 1de2dae0fdae..00d6a798c705 100644
--- a/arch/arm/boot/dts/armada-370-xp.dtsi
+++ b/arch/arm/boot/dts/armada-370-xp.dtsi
@@ -113,6 +113,7 @@
113 #interrupt-cells = <1>; 113 #interrupt-cells = <1>;
114 #size-cells = <1>; 114 #size-cells = <1>;
115 interrupt-controller; 115 interrupt-controller;
116 msi-controller;
116 }; 117 };
117 118
118 coherency-fabric@20200 { 119 coherency-fabric@20200 {
@@ -137,6 +138,14 @@
137 status = "disabled"; 138 status = "disabled";
138 }; 139 };
139 140
141 coredivclk: corediv-clock@18740 {
142 compatible = "marvell,armada-370-corediv-clock";
143 reg = <0x18740 0xc>;
144 #clock-cells = <1>;
145 clocks = <&mainpll>;
146 clock-output-names = "nand";
147 };
148
140 timer@20300 { 149 timer@20300 {
141 reg = <0x20300 0x30>, <0x21040 0x30>; 150 reg = <0x20300 0x30>, <0x21040 0x30>;
142 interrupts = <37>, <38>, <39>, <40>, <5>, <6>; 151 interrupts = <37>, <38>, <39>, <40>, <5>, <6>;
@@ -176,7 +185,6 @@
176 185
177 i2c0: i2c@11000 { 186 i2c0: i2c@11000 {
178 compatible = "marvell,mv64xxx-i2c"; 187 compatible = "marvell,mv64xxx-i2c";
179 reg = <0x11000 0x20>;
180 #address-cells = <1>; 188 #address-cells = <1>;
181 #size-cells = <0>; 189 #size-cells = <0>;
182 interrupts = <31>; 190 interrupts = <31>;
@@ -187,7 +195,6 @@
187 195
188 i2c1: i2c@11100 { 196 i2c1: i2c@11100 {
189 compatible = "marvell,mv64xxx-i2c"; 197 compatible = "marvell,mv64xxx-i2c";
190 reg = <0x11100 0x20>;
191 #address-cells = <1>; 198 #address-cells = <1>;
192 #size-cells = <0>; 199 #size-cells = <0>;
193 interrupts = <32>; 200 interrupts = <32>;
@@ -252,4 +259,13 @@
252 259
253 }; 260 };
254 }; 261 };
262
263 clocks {
264 /* 2 GHz fixed main PLL */
265 mainpll: mainpll {
266 compatible = "fixed-clock";
267 #clock-cells = <0>;
268 clock-frequency = <2000000000>;
269 };
270 };
255 }; 271 };
diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi
index e134d7a90c9a..7a4b82e71aaf 100644
--- a/arch/arm/boot/dts/armada-370.dtsi
+++ b/arch/arm/boot/dts/armada-370.dtsi
@@ -44,6 +44,7 @@
44 #address-cells = <3>; 44 #address-cells = <3>;
45 #size-cells = <2>; 45 #size-cells = <2>;
46 46
47 msi-parent = <&mpic>;
47 bus-range = <0x00 0xff>; 48 bus-range = <0x00 0xff>;
48 49
49 ranges = 50 ranges =
@@ -218,6 +219,14 @@
218 }; 219 };
219 }; 220 };
220 221
222 i2c0: i2c@11000 {
223 reg = <0x11000 0x20>;
224 };
225
226 i2c1: i2c@11100 {
227 reg = <0x11100 0x20>;
228 };
229
221 usb@50000 { 230 usb@50000 {
222 clocks = <&coreclk 0>; 231 clocks = <&coreclk 0>;
223 }; 232 };
diff --git a/arch/arm/boot/dts/armada-xp-matrix.dts b/arch/arm/boot/dts/armada-xp-matrix.dts
new file mode 100644
index 000000000000..e47c49ecd55c
--- /dev/null
+++ b/arch/arm/boot/dts/armada-xp-matrix.dts
@@ -0,0 +1,75 @@
1/*
2 * Device Tree file for Marvell Armada XP Matrix board
3 *
4 * Copyright (C) 2013 Marvell
5 *
6 * Lior Amsalem <alior@marvell.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/dts-v1/;
14#include "armada-xp-mv78460.dtsi"
15
16/ {
17 model = "Marvell Armada XP Matrix Board";
18 compatible = "marvell,axp-matrix", "marvell,armadaxp-mv78460", "marvell,armadaxp", "marvell,armada-370-xp";
19
20 chosen {
21 bootargs = "console=ttyS0,115200 earlyprintk";
22 };
23
24 memory {
25 device_type = "memory";
26 reg = <0 0x00000000 0 0x80000000>; /* 2 GB */
27 };
28
29 soc {
30 ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000
31 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000>;
32
33 internal-regs {
34 serial@12000 {
35 clock-frequency = <250000000>;
36 status = "okay";
37 };
38 serial@12100 {
39 clock-frequency = <250000000>;
40 status = "okay";
41 };
42 serial@12200 {
43 clock-frequency = <250000000>;
44 status = "okay";
45 };
46 serial@12300 {
47 clock-frequency = <250000000>;
48 status = "okay";
49 };
50
51 sata@a0000 {
52 nr-ports = <2>;
53 status = "okay";
54 };
55
56 ethernet@30000 {
57 status = "okay";
58 phy-mode = "sgmii";
59 };
60
61 pcie-controller {
62 status = "okay";
63
64 pcie@1,0 {
65 /* Port 0, Lane 0 */
66 status = "okay";
67 };
68 };
69
70 usb@50000 {
71 status = "okay";
72 };
73 };
74 };
75};
diff --git a/arch/arm/boot/dts/armada-xp-mv78230.dtsi b/arch/arm/boot/dts/armada-xp-mv78230.dtsi
index 0358a33cba48..3f5e6121c730 100644
--- a/arch/arm/boot/dts/armada-xp-mv78230.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78230.dtsi
@@ -57,6 +57,7 @@
57 #address-cells = <3>; 57 #address-cells = <3>;
58 #size-cells = <2>; 58 #size-cells = <2>;
59 59
60 msi-parent = <&mpic>;
60 bus-range = <0x00 0xff>; 61 bus-range = <0x00 0xff>;
61 62
62 ranges = 63 ranges =
diff --git a/arch/arm/boot/dts/armada-xp-mv78260.dtsi b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
index 0e82c5062243..3e9fd1353f89 100644
--- a/arch/arm/boot/dts/armada-xp-mv78260.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
@@ -58,6 +58,7 @@
58 #address-cells = <3>; 58 #address-cells = <3>;
59 #size-cells = <2>; 59 #size-cells = <2>;
60 60
61 msi-parent = <&mpic>;
61 bus-range = <0x00 0xff>; 62 bus-range = <0x00 0xff>;
62 63
63 ranges = 64 ranges =
diff --git a/arch/arm/boot/dts/armada-xp-mv78460.dtsi b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
index e82c1b80af17..31ba6d8fbadf 100644
--- a/arch/arm/boot/dts/armada-xp-mv78460.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
@@ -74,6 +74,7 @@
74 #address-cells = <3>; 74 #address-cells = <3>;
75 #size-cells = <2>; 75 #size-cells = <2>;
76 76
77 msi-parent = <&mpic>;
77 bus-range = <0x00 0xff>; 78 bus-range = <0x00 0xff>;
78 79
79 ranges = 80 ranges =
diff --git a/arch/arm/boot/dts/armada-xp.dtsi b/arch/arm/boot/dts/armada-xp.dtsi
index def125c0eeaa..281c6447e872 100644
--- a/arch/arm/boot/dts/armada-xp.dtsi
+++ b/arch/arm/boot/dts/armada-xp.dtsi
@@ -70,6 +70,8 @@
70 70
71 timer@20300 { 71 timer@20300 {
72 compatible = "marvell,armada-xp-timer"; 72 compatible = "marvell,armada-xp-timer";
73 clocks = <&coreclk 2>, <&refclk>;
74 clock-names = "nbclk", "fixed";
73 }; 75 };
74 76
75 coreclk: mvebu-sar@18230 { 77 coreclk: mvebu-sar@18230 {
@@ -145,6 +147,16 @@
145 }; 147 };
146 }; 148 };
147 149
150 i2c0: i2c@11000 {
151 compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c";
152 reg = <0x11000 0x100>;
153 };
154
155 i2c1: i2c@11100 {
156 compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c";
157 reg = <0x11100 0x100>;
158 };
159
148 usb@50000 { 160 usb@50000 {
149 clocks = <&gateclk 18>; 161 clocks = <&gateclk 18>;
150 }; 162 };
@@ -169,4 +181,13 @@
169 }; 181 };
170 }; 182 };
171 }; 183 };
184
185 clocks {
186 /* 25 MHz reference crystal */
187 refclk: oscillator {
188 compatible = "fixed-clock";
189 #clock-cells = <0>;
190 clock-frequency = <25000000>;
191 };
192 };
172}; 193};
diff --git a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
index 137354689ad0..cb2c010e08e2 100644
--- a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
@@ -96,7 +96,6 @@
96 }; 96 };
97 97
98 spi0: spi@fffc8000 { 98 spi0: spi@fffc8000 {
99 status = "okay";
100 cs-gpios = <0>, <&pioC 11 0>, <0>, <0>; 99 cs-gpios = <0>, <&pioC 11 0>, <0>, <0>;
101 mtd_dataflash@0 { 100 mtd_dataflash@0 {
102 compatible = "atmel,at45", "atmel,dataflash"; 101 compatible = "atmel,at45", "atmel,dataflash";
diff --git a/arch/arm/boot/dts/at91sam9g25.dtsi b/arch/arm/boot/dts/at91sam9g25.dtsi
index b4ec6fe53fc7..17b879990914 100644
--- a/arch/arm/boot/dts/at91sam9g25.dtsi
+++ b/arch/arm/boot/dts/at91sam9g25.dtsi
@@ -7,6 +7,8 @@
7 */ 7 */
8 8
9#include "at91sam9x5.dtsi" 9#include "at91sam9x5.dtsi"
10#include "at91sam9x5_usart3.dtsi"
11#include "at91sam9x5_macb0.dtsi"
10 12
11/ { 13/ {
12 model = "Atmel AT91SAM9G25 SoC"; 14 model = "Atmel AT91SAM9G25 SoC";
diff --git a/arch/arm/boot/dts/at91sam9g35.dtsi b/arch/arm/boot/dts/at91sam9g35.dtsi
index bebf9f55614b..e35c2fcf8298 100644
--- a/arch/arm/boot/dts/at91sam9g35.dtsi
+++ b/arch/arm/boot/dts/at91sam9g35.dtsi
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include "at91sam9x5.dtsi" 9#include "at91sam9x5.dtsi"
10#include "at91sam9x5_macb0.dtsi"
10 11
11/ { 12/ {
12 model = "Atmel AT91SAM9G35 SoC"; 13 model = "Atmel AT91SAM9G35 SoC";
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index 9fb7ffd32af2..6224f9fe2f2b 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -437,6 +437,9 @@
437 compatible = "atmel,at91sam9g45-ssc"; 437 compatible = "atmel,at91sam9g45-ssc";
438 reg = <0xf0010000 0x4000>; 438 reg = <0xf0010000 0x4000>;
439 interrupts = <28 IRQ_TYPE_LEVEL_HIGH 5>; 439 interrupts = <28 IRQ_TYPE_LEVEL_HIGH 5>;
440 dmas = <&dma 0 AT91_DMA_CFG_PER_ID(21)>,
441 <&dma 0 AT91_DMA_CFG_PER_ID(22)>;
442 dma-names = "tx", "rx";
440 pinctrl-names = "default"; 443 pinctrl-names = "default";
441 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; 444 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
442 status = "disabled"; 445 status = "disabled";
diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts
index 27a9352b9d7a..e9487f6f0166 100644
--- a/arch/arm/boot/dts/at91sam9n12ek.dts
+++ b/arch/arm/boot/dts/at91sam9n12ek.dts
@@ -38,9 +38,18 @@
38 status = "okay"; 38 status = "okay";
39 }; 39 };
40 40
41 ssc0: ssc@f0010000 {
42 status = "okay";
43 };
44
41 i2c0: i2c@f8010000 { 45 i2c0: i2c@f8010000 {
42 status = "okay"; 46 status = "okay";
43 47
48 wm8904: codec@1a {
49 compatible = "wm8904";
50 reg = <0x1a>;
51 };
52
44 qt1070: keyboard@1b { 53 qt1070: keyboard@1b {
45 compatible = "qt1070"; 54 compatible = "qt1070";
46 reg = <0x1b>; 55 reg = <0x1b>;
@@ -82,6 +91,13 @@
82 <AT91_PIOA 2 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; 91 <AT91_PIOA 2 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
83 }; 92 };
84 }; 93 };
94
95 sound {
96 pinctrl_pck0_as_audio_mck: pck0_as_audio_mck {
97 atmel,pins =
98 <AT91_PIOB 10 AT91_PERIPH_B AT91_PINCTRL_NONE>;
99 };
100 };
85 }; 101 };
86 102
87 spi0: spi@f0000000 { 103 spi0: spi@f0000000 {
@@ -142,4 +158,22 @@
142 gpio-key,wakeup; 158 gpio-key,wakeup;
143 }; 159 };
144 }; 160 };
161
162 sound {
163 compatible = "atmel,asoc-wm8904";
164 pinctrl-names = "default";
165 pinctrl-0 = <&pinctrl_pck0_as_audio_mck>;
166
167 atmel,model = "wm8904 @ AT91SAM9N12";
168 atmel,audio-routing =
169 "Headphone Jack", "HPOUTL",
170 "Headphone Jack", "HPOUTR",
171 "IN2L", "Line In Jack",
172 "IN2R", "Line In Jack",
173 "Mic", "MICBIAS",
174 "IN1L", "Mic";
175
176 atmel,ssc-controller = <&ssc0>;
177 atmel,audio-codec = <&wm8904>;
178 };
145}; 179};
diff --git a/arch/arm/boot/dts/at91sam9x25.dtsi b/arch/arm/boot/dts/at91sam9x25.dtsi
index 49e94aba938f..c2554219f7a4 100644
--- a/arch/arm/boot/dts/at91sam9x25.dtsi
+++ b/arch/arm/boot/dts/at91sam9x25.dtsi
@@ -7,6 +7,9 @@
7 */ 7 */
8 8
9#include "at91sam9x5.dtsi" 9#include "at91sam9x5.dtsi"
10#include "at91sam9x5_usart3.dtsi"
11#include "at91sam9x5_macb0.dtsi"
12#include "at91sam9x5_macb1.dtsi"
10 13
11/ { 14/ {
12 model = "Atmel AT91SAM9X25 SoC"; 15 model = "Atmel AT91SAM9X25 SoC";
@@ -22,27 +25,6 @@
22 0x80000000 0xfffd0000 0xb83fffff /* pioC */ 25 0x80000000 0xfffd0000 0xb83fffff /* pioC */
23 0x003fffff 0x003f8000 0x00000000 /* pioD */ 26 0x003fffff 0x003f8000 0x00000000 /* pioD */
24 >; 27 >;
25
26 macb1 {
27 pinctrl_macb1_rmii: macb1_rmii-0 {
28 atmel,pins =
29 <AT91_PIOC 16 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC16 periph B */
30 AT91_PIOC 18 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC18 periph B */
31 AT91_PIOC 19 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC19 periph B */
32 AT91_PIOC 20 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC20 periph B */
33 AT91_PIOC 21 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC21 periph B */
34 AT91_PIOC 27 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC27 periph B */
35 AT91_PIOC 28 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC28 periph B */
36 AT91_PIOC 29 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC29 periph B */
37 AT91_PIOC 30 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC30 periph B */
38 AT91_PIOC 31 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC31 periph B */
39 };
40 };
41 };
42
43 macb1: ethernet@f8030000 {
44 pinctrl-names = "default";
45 pinctrl-0 = <&pinctrl_macb1_rmii>;
46 }; 28 };
47 }; 29 };
48 }; 30 };
diff --git a/arch/arm/boot/dts/at91sam9x35.dtsi b/arch/arm/boot/dts/at91sam9x35.dtsi
index 1a3d525a1f5d..8eac66ce0ab7 100644
--- a/arch/arm/boot/dts/at91sam9x35.dtsi
+++ b/arch/arm/boot/dts/at91sam9x35.dtsi
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include "at91sam9x5.dtsi" 9#include "at91sam9x5.dtsi"
10#include "at91sam9x5_macb0.dtsi"
10 11
11/ { 12/ {
12 model = "Atmel AT91SAM9X35 SoC"; 13 model = "Atmel AT91SAM9X35 SoC";
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index cf78ac0b04b1..40267a116c3c 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -190,12 +190,12 @@
190 AT91_PIOA 8 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA8 periph A */ 190 AT91_PIOA 8 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA8 periph A */
191 }; 191 };
192 192
193 pinctrl_uart2_rts: uart2_rts-0 { 193 pinctrl_usart2_rts: usart2_rts-0 {
194 atmel,pins = 194 atmel,pins =
195 <AT91_PIOB 0 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB0 periph B */ 195 <AT91_PIOB 0 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB0 periph B */
196 }; 196 };
197 197
198 pinctrl_uart2_cts: uart2_cts-0 { 198 pinctrl_usart2_cts: usart2_cts-0 {
199 atmel,pins = 199 atmel,pins =
200 <AT91_PIOB 1 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB1 periph B */ 200 <AT91_PIOB 1 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB1 periph B */
201 }; 201 };
@@ -206,29 +206,6 @@
206 }; 206 };
207 }; 207 };
208 208
209 usart3 {
210 pinctrl_usart3: usart3-0 {
211 atmel,pins =
212 <AT91_PIOC 22 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PC22 periph B with pullup */
213 AT91_PIOC 23 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC23 periph B */
214 };
215
216 pinctrl_usart3_rts: usart3_rts-0 {
217 atmel,pins =
218 <AT91_PIOC 24 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC24 periph B */
219 };
220
221 pinctrl_usart3_cts: usart3_cts-0 {
222 atmel,pins =
223 <AT91_PIOC 25 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC25 periph B */
224 };
225
226 pinctrl_usart3_sck: usart3_sck-0 {
227 atmel,pins =
228 <AT91_PIOC 26 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC26 periph B */
229 };
230 };
231
232 uart0 { 209 uart0 {
233 pinctrl_uart0: uart0-0 { 210 pinctrl_uart0: uart0-0 {
234 atmel,pins = 211 atmel,pins =
@@ -277,34 +254,6 @@
277 }; 254 };
278 }; 255 };
279 256
280 macb0 {
281 pinctrl_macb0_rmii: macb0_rmii-0 {
282 atmel,pins =
283 <AT91_PIOB 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB0 periph A */
284 AT91_PIOB 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB1 periph A */
285 AT91_PIOB 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB2 periph A */
286 AT91_PIOB 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB3 periph A */
287 AT91_PIOB 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB4 periph A */
288 AT91_PIOB 5 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB5 periph A */
289 AT91_PIOB 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB6 periph A */
290 AT91_PIOB 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB7 periph A */
291 AT91_PIOB 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB9 periph A */
292 AT91_PIOB 10 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB10 periph A */
293 };
294
295 pinctrl_macb0_rmii_mii: macb0_rmii_mii-0 {
296 atmel,pins =
297 <AT91_PIOB 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB8 periph A */
298 AT91_PIOB 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB11 periph A */
299 AT91_PIOB 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB12 periph A */
300 AT91_PIOB 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB13 periph A */
301 AT91_PIOB 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB14 periph A */
302 AT91_PIOB 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB15 periph A */
303 AT91_PIOB 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB16 periph A */
304 AT91_PIOB 17 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB17 periph A */
305 };
306 };
307
308 mmc0 { 257 mmc0 {
309 pinctrl_mmc0_slot0_clk_cmd_dat0: mmc0_slot0_clk_cmd_dat0-0 { 258 pinctrl_mmc0_slot0_clk_cmd_dat0: mmc0_slot0_clk_cmd_dat0-0 {
310 atmel,pins = 259 atmel,pins =
@@ -556,6 +505,7 @@
556 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 0>; 505 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 0>;
557 dmas = <&dma0 1 AT91_DMA_CFG_PER_ID(0)>; 506 dmas = <&dma0 1 AT91_DMA_CFG_PER_ID(0)>;
558 dma-names = "rxtx"; 507 dma-names = "rxtx";
508 pinctrl-names = "default";
559 #address-cells = <1>; 509 #address-cells = <1>;
560 #size-cells = <0>; 510 #size-cells = <0>;
561 status = "disabled"; 511 status = "disabled";
@@ -567,6 +517,7 @@
567 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0>; 517 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0>;
568 dmas = <&dma1 1 AT91_DMA_CFG_PER_ID(0)>; 518 dmas = <&dma1 1 AT91_DMA_CFG_PER_ID(0)>;
569 dma-names = "rxtx"; 519 dma-names = "rxtx";
520 pinctrl-names = "default";
570 #address-cells = <1>; 521 #address-cells = <1>;
571 #size-cells = <0>; 522 #size-cells = <0>;
572 status = "disabled"; 523 status = "disabled";
@@ -608,22 +559,6 @@
608 status = "disabled"; 559 status = "disabled";
609 }; 560 };
610 561
611 macb0: ethernet@f802c000 {
612 compatible = "cdns,at32ap7000-macb", "cdns,macb";
613 reg = <0xf802c000 0x100>;
614 interrupts = <24 IRQ_TYPE_LEVEL_HIGH 3>;
615 pinctrl-names = "default";
616 pinctrl-0 = <&pinctrl_macb0_rmii>;
617 status = "disabled";
618 };
619
620 macb1: ethernet@f8030000 {
621 compatible = "cdns,at32ap7000-macb", "cdns,macb";
622 reg = <0xf8030000 0x100>;
623 interrupts = <27 IRQ_TYPE_LEVEL_HIGH 3>;
624 status = "disabled";
625 };
626
627 i2c0: i2c@f8010000 { 562 i2c0: i2c@f8010000 {
628 compatible = "atmel,at91sam9x5-i2c"; 563 compatible = "atmel,at91sam9x5-i2c";
629 reg = <0xf8010000 0x100>; 564 reg = <0xf8010000 0x100>;
diff --git a/arch/arm/boot/dts/at91sam9x5_macb0.dtsi b/arch/arm/boot/dts/at91sam9x5_macb0.dtsi
new file mode 100644
index 000000000000..55731ffba764
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9x5_macb0.dtsi
@@ -0,0 +1,56 @@
1/*
2 * at91sam9x5_macb0.dtsi - Device Tree Include file for AT91SAM9x5 SoC with 1
3 * Ethernet interface.
4 *
5 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
6 *
7 * Licensed under GPLv2.
8 */
9
10#include <dt-bindings/pinctrl/at91.h>
11#include <dt-bindings/interrupt-controller/irq.h>
12
13/ {
14 ahb {
15 apb {
16 pinctrl@fffff400 {
17 macb0 {
18 pinctrl_macb0_rmii: macb0_rmii-0 {
19 atmel,pins =
20 <AT91_PIOB 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB0 periph A */
21 AT91_PIOB 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB1 periph A */
22 AT91_PIOB 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB2 periph A */
23 AT91_PIOB 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB3 periph A */
24 AT91_PIOB 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB4 periph A */
25 AT91_PIOB 5 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB5 periph A */
26 AT91_PIOB 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB6 periph A */
27 AT91_PIOB 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB7 periph A */
28 AT91_PIOB 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB9 periph A */
29 AT91_PIOB 10 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB10 periph A */
30 };
31
32 pinctrl_macb0_rmii_mii: macb0_rmii_mii-0 {
33 atmel,pins =
34 <AT91_PIOB 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB8 periph A */
35 AT91_PIOB 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB11 periph A */
36 AT91_PIOB 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB12 periph A */
37 AT91_PIOB 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB13 periph A */
38 AT91_PIOB 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB14 periph A */
39 AT91_PIOB 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB15 periph A */
40 AT91_PIOB 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB16 periph A */
41 AT91_PIOB 17 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB17 periph A */
42 };
43 };
44 };
45
46 macb0: ethernet@f802c000 {
47 compatible = "cdns,at32ap7000-macb", "cdns,macb";
48 reg = <0xf802c000 0x100>;
49 interrupts = <24 IRQ_TYPE_LEVEL_HIGH 3>;
50 pinctrl-names = "default";
51 pinctrl-0 = <&pinctrl_macb0_rmii>;
52 status = "disabled";
53 };
54 };
55 };
56};
diff --git a/arch/arm/boot/dts/at91sam9x5_macb1.dtsi b/arch/arm/boot/dts/at91sam9x5_macb1.dtsi
new file mode 100644
index 000000000000..77425a627a94
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9x5_macb1.dtsi
@@ -0,0 +1,44 @@
1/*
2 * at91sam9x5_macb1.dtsi - Device Tree Include file for AT91SAM9x5 SoC with 2
3 * Ethernet interfaces.
4 *
5 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
6 *
7 * Licensed under GPLv2.
8 */
9
10#include <dt-bindings/pinctrl/at91.h>
11#include <dt-bindings/interrupt-controller/irq.h>
12
13/ {
14 ahb {
15 apb {
16 pinctrl@fffff400 {
17 macb1 {
18 pinctrl_macb1_rmii: macb1_rmii-0 {
19 atmel,pins =
20 <AT91_PIOC 16 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC16 periph B */
21 AT91_PIOC 18 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC18 periph B */
22 AT91_PIOC 19 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC19 periph B */
23 AT91_PIOC 20 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC20 periph B */
24 AT91_PIOC 21 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC21 periph B */
25 AT91_PIOC 27 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC27 periph B */
26 AT91_PIOC 28 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC28 periph B */
27 AT91_PIOC 29 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC29 periph B */
28 AT91_PIOC 30 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC30 periph B */
29 AT91_PIOC 31 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC31 periph B */
30 };
31 };
32 };
33
34 macb1: ethernet@f8030000 {
35 compatible = "cdns,at32ap7000-macb", "cdns,macb";
36 reg = <0xf8030000 0x100>;
37 interrupts = <27 IRQ_TYPE_LEVEL_HIGH 3>;
38 pinctrl-names = "default";
39 pinctrl-0 = <&pinctrl_macb1_rmii>;
40 status = "disabled";
41 };
42 };
43 };
44};
diff --git a/arch/arm/boot/dts/at91sam9x5_usart3.dtsi b/arch/arm/boot/dts/at91sam9x5_usart3.dtsi
new file mode 100644
index 000000000000..2347e9563cef
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9x5_usart3.dtsi
@@ -0,0 +1,51 @@
1/*
2 * at91sam9x5_usart3.dtsi - Device Tree Include file for AT91SAM9x5 SoC with
3 * 4 USART.
4 *
5 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
6 *
7 * Licensed under GPLv2.
8 */
9
10#include <dt-bindings/pinctrl/at91.h>
11#include <dt-bindings/interrupt-controller/irq.h>
12
13/ {
14 ahb {
15 apb {
16 pinctrl@fffff400 {
17 usart3 {
18 pinctrl_usart3: usart3-0 {
19 atmel,pins =
20 <AT91_PIOC 22 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PC22 periph B with pullup */
21 AT91_PIOC 23 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC23 periph B */
22 };
23
24 pinctrl_usart3_rts: usart3_rts-0 {
25 atmel,pins =
26 <AT91_PIOC 24 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC24 periph B */
27 };
28
29 pinctrl_usart3_cts: usart3_cts-0 {
30 atmel,pins =
31 <AT91_PIOC 25 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC25 periph B */
32 };
33
34 pinctrl_usart3_sck: usart3_sck-0 {
35 atmel,pins =
36 <AT91_PIOC 26 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC26 periph B */
37 };
38 };
39 };
40
41 usart3: serial@f8028000 {
42 compatible = "atmel,at91sam9260-usart";
43 reg = <0xf8028000 0x200>;
44 interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>;
45 pinctrl-names = "default";
46 pinctrl-0 = <&pinctrl_usart3>;
47 status = "disabled";
48 };
49 };
50 };
51};
diff --git a/arch/arm/boot/dts/atlas6.dtsi b/arch/arm/boot/dts/atlas6.dtsi
index 8678e0c11119..978bab4991df 100644
--- a/arch/arm/boot/dts/atlas6.dtsi
+++ b/arch/arm/boot/dts/atlas6.dtsi
@@ -65,6 +65,11 @@
65 compatible = "sirf,prima2-rsc"; 65 compatible = "sirf,prima2-rsc";
66 reg = <0x88020000 0x1000>; 66 reg = <0x88020000 0x1000>;
67 }; 67 };
68
69 cphifbg@88030000 {
70 compatible = "sirf,prima2-cphifbg";
71 reg = <0x88030000 0x1000>;
72 };
68 }; 73 };
69 74
70 mem-iobg { 75 mem-iobg {
@@ -75,10 +80,17 @@
75 80
76 memory-controller@90000000 { 81 memory-controller@90000000 {
77 compatible = "sirf,prima2-memc"; 82 compatible = "sirf,prima2-memc";
78 reg = <0x90000000 0x10000>; 83 reg = <0x90000000 0x2000>;
79 interrupts = <27>; 84 interrupts = <27>;
80 clocks = <&clks 5>; 85 clocks = <&clks 5>;
81 }; 86 };
87
88 memc-monitor {
89 compatible = "sirf,prima2-memcmon";
90 reg = <0x90002000 0x200>;
91 interrupts = <4>;
92 clocks = <&clks 32>;
93 };
82 }; 94 };
83 95
84 disp-iobg { 96 disp-iobg {
@@ -120,6 +132,20 @@
120 }; 132 };
121 }; 133 };
122 134
135 graphics2d-iobg {
136 compatible = "simple-bus";
137 #address-cells = <1>;
138 #size-cells = <1>;
139 ranges = <0xa0000000 0xa0000000 0x8000000>;
140
141 ble@a0000000 {
142 compatible = "sirf,atlas6-ble";
143 reg = <0xa0000000 0x2000>;
144 interrupts = <5>;
145 clocks = <&clks 33>;
146 };
147 };
148
123 dsp-iobg { 149 dsp-iobg {
124 compatible = "simple-bus"; 150 compatible = "simple-bus";
125 #address-cells = <1>; 151 #address-cells = <1>;
@@ -181,6 +207,8 @@
181 interrupts = <17>; 207 interrupts = <17>;
182 fifosize = <128>; 208 fifosize = <128>;
183 clocks = <&clks 13>; 209 clocks = <&clks 13>;
210 sirf,uart-dma-rx-channel = <21>;
211 sirf,uart-dma-tx-channel = <2>;
184 }; 212 };
185 213
186 uart1: uart@b0060000 { 214 uart1: uart@b0060000 {
@@ -199,6 +227,8 @@
199 interrupts = <19>; 227 interrupts = <19>;
200 fifosize = <128>; 228 fifosize = <128>;
201 clocks = <&clks 15>; 229 clocks = <&clks 15>;
230 sirf,uart-dma-rx-channel = <6>;
231 sirf,uart-dma-tx-channel = <7>;
202 }; 232 };
203 233
204 usp0: usp@b0080000 { 234 usp0: usp@b0080000 {
@@ -206,7 +236,10 @@
206 compatible = "sirf,prima2-usp"; 236 compatible = "sirf,prima2-usp";
207 reg = <0xb0080000 0x10000>; 237 reg = <0xb0080000 0x10000>;
208 interrupts = <20>; 238 interrupts = <20>;
239 fifosize = <128>;
209 clocks = <&clks 28>; 240 clocks = <&clks 28>;
241 sirf,usp-dma-rx-channel = <17>;
242 sirf,usp-dma-tx-channel = <18>;
210 }; 243 };
211 244
212 usp1: usp@b0090000 { 245 usp1: usp@b0090000 {
@@ -214,7 +247,10 @@
214 compatible = "sirf,prima2-usp"; 247 compatible = "sirf,prima2-usp";
215 reg = <0xb0090000 0x10000>; 248 reg = <0xb0090000 0x10000>;
216 interrupts = <21>; 249 interrupts = <21>;
250 fifosize = <128>;
217 clocks = <&clks 29>; 251 clocks = <&clks 29>;
252 sirf,usp-dma-rx-channel = <14>;
253 sirf,usp-dma-tx-channel = <15>;
218 }; 254 };
219 255
220 dmac0: dma-controller@b00b0000 { 256 dmac0: dma-controller@b00b0000 {
@@ -237,6 +273,8 @@
237 compatible = "sirf,prima2-vip"; 273 compatible = "sirf,prima2-vip";
238 reg = <0xb00C0000 0x10000>; 274 reg = <0xb00C0000 0x10000>;
239 clocks = <&clks 31>; 275 clocks = <&clks 31>;
276 interrupts = <14>;
277 sirf,vip-dma-rx-channel = <16>;
240 }; 278 };
241 279
242 spi0: spi@b00d0000 { 280 spi0: spi@b00d0000 {
@@ -259,6 +297,11 @@
259 compatible = "sirf,prima2-spi"; 297 compatible = "sirf,prima2-spi";
260 reg = <0xb0170000 0x10000>; 298 reg = <0xb0170000 0x10000>;
261 interrupts = <16>; 299 interrupts = <16>;
300 sirf,spi-num-chipselects = <1>;
301 sirf,spi-dma-rx-channel = <12>;
302 sirf,spi-dma-tx-channel = <13>;
303 #address-cells = <1>;
304 #size-cells = <0>;
262 clocks = <&clks 20>; 305 clocks = <&clks 20>;
263 status = "disabled"; 306 status = "disabled";
264 }; 307 };
@@ -515,6 +558,18 @@
515 sirf,function = "usb1_utmi_drvbus"; 558 sirf,function = "usb1_utmi_drvbus";
516 }; 559 };
517 }; 560 };
561 usb1_dp_dn_pins_a: usb1_dp_dn@0 {
562 usb1_dp_dn {
563 sirf,pins = "usb1_dp_dngrp";
564 sirf,function = "usb1_dp_dn";
565 };
566 };
567 uart1_route_io_usb1_pins_a: uart1_route_io_usb1@0 {
568 uart1_route_io_usb1 {
569 sirf,pins = "uart1_route_io_usb1grp";
570 sirf,function = "uart1_route_io_usb1";
571 };
572 };
518 warm_rst_pins_a: warm_rst@0 { 573 warm_rst_pins_a: warm_rst@0 {
519 warm_rst { 574 warm_rst {
520 sirf,pins = "warm_rstgrp"; 575 sirf,pins = "warm_rstgrp";
diff --git a/arch/arm/boot/dts/bcm11351-brt.dts b/arch/arm/boot/dts/bcm11351-brt.dts
index 9d36eb4e3c41..23cd16d736bf 100644
--- a/arch/arm/boot/dts/bcm11351-brt.dts
+++ b/arch/arm/boot/dts/bcm11351-brt.dts
@@ -40,6 +40,7 @@
40 40
41 sdio4: sdio@3f1b0000 { 41 sdio4: sdio@3f1b0000 {
42 max-frequency = <48000000>; 42 max-frequency = <48000000>;
43 cd-gpios = <&gpio 14 0>;
43 status = "okay"; 44 status = "okay";
44 }; 45 };
45 46
diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi
index 05a5aabe3b2c..b0c0610d1395 100644
--- a/arch/arm/boot/dts/bcm11351.dtsi
+++ b/arch/arm/boot/dts/bcm11351.dtsi
@@ -49,6 +49,36 @@
49 reg-io-width = <4>; 49 reg-io-width = <4>;
50 }; 50 };
51 51
52 uart@3e001000 {
53 compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
54 status = "disabled";
55 reg = <0x3e001000 0x1000>;
56 clock-frequency = <13000000>;
57 interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
58 reg-shift = <2>;
59 reg-io-width = <4>;
60 };
61
62 uart@3e002000 {
63 compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
64 status = "disabled";
65 reg = <0x3e002000 0x1000>;
66 clock-frequency = <13000000>;
67 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
68 reg-shift = <2>;
69 reg-io-width = <4>;
70 };
71
72 uart@3e003000 {
73 compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
74 status = "disabled";
75 reg = <0x3e003000 0x1000>;
76 clock-frequency = <13000000>;
77 interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
78 reg-shift = <2>;
79 reg-io-width = <4>;
80 };
81
52 L2: l2-cache { 82 L2: l2-cache {
53 compatible = "brcm,bcm11351-a2-pl310-cache"; 83 compatible = "brcm,bcm11351-a2-pl310-cache";
54 reg = <0x3ff20000 0x1000>; 84 reg = <0x3ff20000 0x1000>;
@@ -68,31 +98,47 @@
68 clock-frequency = <32768>; 98 clock-frequency = <32768>;
69 }; 99 };
70 100
101 gpio: gpio@35003000 {
102 compatible = "brcm,bcm11351-gpio", "brcm,kona-gpio";
103 reg = <0x35003000 0x800>;
104 interrupts =
105 <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH
106 GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH
107 GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH
108 GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH
109 GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH
110 GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
111 #gpio-cells = <2>;
112 #interrupt-cells = <2>;
113 gpio-controller;
114 interrupt-controller;
115 };
116
71 sdio1: sdio@3f180000 { 117 sdio1: sdio@3f180000 {
72 compatible = "brcm,kona-sdhci"; 118 compatible = "brcm,kona-sdhci";
73 reg = <0x3f180000 0x10000>; 119 reg = <0x3f180000 0x10000>;
74 interrupts = <0x0 77 0x4>; 120 interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
75 status = "disabled"; 121 status = "disabled";
76 }; 122 };
77 123
78 sdio2: sdio@3f190000 { 124 sdio2: sdio@3f190000 {
79 compatible = "brcm,kona-sdhci"; 125 compatible = "brcm,kona-sdhci";
80 reg = <0x3f190000 0x10000>; 126 reg = <0x3f190000 0x10000>;
81 interrupts = <0x0 76 0x4>; 127 interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
82 status = "disabled"; 128 status = "disabled";
83 }; 129 };
84 130
85 sdio3: sdio@3f1a0000 { 131 sdio3: sdio@3f1a0000 {
86 compatible = "brcm,kona-sdhci"; 132 compatible = "brcm,kona-sdhci";
87 reg = <0x3f1a0000 0x10000>; 133 reg = <0x3f1a0000 0x10000>;
88 interrupts = <0x0 74 0x4>; 134 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
89 status = "disabled"; 135 status = "disabled";
90 }; 136 };
91 137
92 sdio4: sdio@3f1b0000 { 138 sdio4: sdio@3f1b0000 {
93 compatible = "brcm,kona-sdhci"; 139 compatible = "brcm,kona-sdhci";
94 reg = <0x3f1b0000 0x10000>; 140 reg = <0x3f1b0000 0x10000>;
95 interrupts = <0x0 73 0x4>; 141 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
96 status = "disabled"; 142 status = "disabled";
97 }; 143 };
98 144
diff --git a/arch/arm/boot/dts/bcm28155-ap.dts b/arch/arm/boot/dts/bcm28155-ap.dts
index 96ae67a2f0d3..08e47c285227 100644
--- a/arch/arm/boot/dts/bcm28155-ap.dts
+++ b/arch/arm/boot/dts/bcm28155-ap.dts
@@ -40,6 +40,7 @@
40 40
41 sdio4: sdio@3f1b0000 { 41 sdio4: sdio@3f1b0000 {
42 max-frequency = <48000000>; 42 max-frequency = <48000000>;
43 cd-gpios = <&gpio 14 0>;
43 status = "okay"; 44 status = "okay";
44 }; 45 };
45}; 46};
diff --git a/arch/arm/boot/dts/dove-cm-a510.dts b/arch/arm/boot/dts/dove-cm-a510.dts
index 61a8062e56de..50c0d6904497 100644
--- a/arch/arm/boot/dts/dove-cm-a510.dts
+++ b/arch/arm/boot/dts/dove-cm-a510.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "dove.dtsi" 3#include "dove.dtsi"
4 4
5/ { 5/ {
6 model = "Compulab CM-A510"; 6 model = "Compulab CM-A510";
diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts
index 022646ef4b38..8349a248ecea 100644
--- a/arch/arm/boot/dts/dove-cubox.dts
+++ b/arch/arm/boot/dts/dove-cubox.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "dove.dtsi" 3#include "dove.dtsi"
4 4
5/ { 5/ {
6 model = "SolidRun CuBox"; 6 model = "SolidRun CuBox";
@@ -99,18 +99,12 @@
99 silabs,pll-master; 99 silabs,pll-master;
100 }; 100 };
101 101
102 clkout1 {
103 reg = <1>;
104 silabs,drive-strength = <8>;
105 silabs,multisynth-source = <1>;
106 silabs,clock-source = <0>;
107 silabs,pll-master;
108 };
109
110 clkout2 { 102 clkout2 {
111 reg = <2>; 103 reg = <2>;
104 silabs,drive-strength = <8>;
112 silabs,multisynth-source = <1>; 105 silabs,multisynth-source = <1>;
113 silabs,clock-source = <0>; 106 silabs,clock-source = <0>;
107 silabs,pll-master;
114 }; 108 };
115 }; 109 };
116}; 110};
@@ -132,3 +126,11 @@
132 reg = <0>; 126 reg = <0>;
133 }; 127 };
134}; 128};
129
130&audio1 {
131 status = "okay";
132 clocks = <&gate_clk 13>, <&si5351 2>;
133 clock-names = "internal", "extclk";
134 pinctrl-0 = <&pmx_audio1_i2s1_spdifo &pmx_audio1_extclk>;
135 pinctrl-names = "default";
136};
diff --git a/arch/arm/boot/dts/dove-d2plug.dts b/arch/arm/boot/dts/dove-d2plug.dts
index e2222ce94f2f..c11d3636c8e5 100644
--- a/arch/arm/boot/dts/dove-d2plug.dts
+++ b/arch/arm/boot/dts/dove-d2plug.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "dove.dtsi" 3#include "dove.dtsi"
4 4
5/ { 5/ {
6 model = "Globalscale D2Plug"; 6 model = "Globalscale D2Plug";
diff --git a/arch/arm/boot/dts/dove-d3plug.dts b/arch/arm/boot/dts/dove-d3plug.dts
new file mode 100644
index 000000000000..f5f59bb5a534
--- /dev/null
+++ b/arch/arm/boot/dts/dove-d3plug.dts
@@ -0,0 +1,103 @@
1/dts-v1/;
2
3#include "dove.dtsi"
4
5/ {
6 model = "Globalscale D3Plug";
7 compatible = "globalscale,d3plug", "marvell,dove";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x40000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200n8 earlyprintk root=/dev/mmcblk0p2 rw rootwait";
16 };
17
18 leds {
19 compatible = "gpio-leds";
20 pinctrl-0 = <&pmx_gpio_0 &pmx_gpio_1 &pmx_gpio_2>;
21 pinctrl-names = "default";
22
23 wlan-act {
24 label = "wlan-act";
25 gpios = <&gpio0 0 1>;
26 };
27
28 wlan-ap {
29 label = "wlan-ap";
30 gpios = <&gpio0 1 1>;
31 };
32
33 status {
34 label = "status";
35 gpios = <&gpio0 2 1>;
36 };
37 };
38
39 regulators {
40 compatible = "simple-bus";
41 #address-cells = <1>;
42 #size-cells = <0>;
43
44 usb_power: regulator@1 {
45 compatible = "regulator-fixed";
46 reg = <1>;
47 regulator-name = "USB Power";
48 regulator-min-microvolt = <5000000>;
49 regulator-max-microvolt = <5000000>;
50 enable-active-high;
51 regulator-always-on;
52 regulator-boot-on;
53 gpio = <&gpio0 8 0>;
54 pinctrl-0 = <&pmx_gpio_8>;
55 pinctrl-names = "default";
56 };
57 };
58};
59
60&uart0 { status = "okay"; };
61&sata0 { status = "okay"; };
62&i2c0 { status = "okay"; };
63
64/* Samsung M8G2F eMMC */
65&sdio0 {
66 status = "okay";
67 non-removable;
68 bus-width = <4>;
69};
70
71/* Marvell SD8787 WLAN/BT */
72&sdio1 {
73 status = "okay";
74 non-removable;
75};
76
77&spi0 {
78 status = "okay";
79
80 /* spi0.0: 2M Flash Macronix MX25L1605D */
81 spi-flash@0 {
82 compatible = "st,m25l1605d";
83 spi-max-frequency = <86000000>;
84 reg = <0>;
85 };
86};
87
88&pcie {
89 status = "okay";
90 /* Fresco Logic USB3.0 xHCI controller */
91 pcie-port@0 {
92 status = "okay";
93 reset-gpios = <&gpio0 26 1>;
94 reset-delay-us = <20000>;
95 pinctrl-0 = <&pmx_camera_gpio>;
96 pinctrl-names = "default";
97 };
98 /* Mini-PCIe slot */
99 pcie-port@1 {
100 status = "okay";
101 reset-gpios = <&gpio0 25 1>;
102 };
103};
diff --git a/arch/arm/boot/dts/dove-dove-db.dts b/arch/arm/boot/dts/dove-dove-db.dts
index e5a920beab45..bb725dca3a10 100644
--- a/arch/arm/boot/dts/dove-dove-db.dts
+++ b/arch/arm/boot/dts/dove-dove-db.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "dove.dtsi" 3#include "dove.dtsi"
4 4
5/ { 5/ {
6 model = "Marvell DB-MV88AP510-BP Development Board"; 6 model = "Marvell DB-MV88AP510-BP Development Board";
diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
index cc279166646f..113a8bc7bee7 100644
--- a/arch/arm/boot/dts/dove.dtsi
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -1,8 +1,11 @@
1/include/ "skeleton.dtsi" 1/include/ "skeleton.dtsi"
2 2
3#define MBUS_ID(target,attributes) (((target) << 24) | ((attributes) << 16))
4
3/ { 5/ {
4 compatible = "marvell,dove"; 6 compatible = "marvell,dove";
5 model = "Marvell Armada 88AP510 SoC"; 7 model = "Marvell Armada 88AP510 SoC";
8 interrupt-parent = <&intc>;
6 9
7 aliases { 10 aliases {
8 gpio0 = &gpio0; 11 gpio0 = &gpio0;
@@ -27,482 +30,576 @@
27 marvell,tauros2-cache-features = <0>; 30 marvell,tauros2-cache-features = <0>;
28 }; 31 };
29 32
30 soc@f1000000 { 33 mbus {
31 compatible = "simple-bus"; 34 compatible = "marvell,dove-mbus", "marvell,mbus", "simple-bus";
32 #address-cells = <1>; 35 #address-cells = <2>;
33 #size-cells = <1>; 36 #size-cells = <1>;
34 interrupt-parent = <&intc>; 37 controller = <&mbusc>;
35 38 pcie-mem-aperture = <0xe0000000 0x10000000>; /* 256M MEM space */
36 ranges = <0xc8000000 0xc8000000 0x0100000 /* CESA SRAM 1M */ 39 pcie-io-aperture = <0xf2000000 0x00200000>; /* 2M I/O space */
37 0xe0000000 0xe0000000 0x8000000 /* PCIe0 Mem 128M */ 40
38 0xe8000000 0xe8000000 0x8000000 /* PCIe1 Mem 128M */ 41 ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x0100000 /* MBUS regs 1M */
39 0xf0000000 0xf0000000 0x0100000 /* ScratchPad 1M */ 42 MBUS_ID(0xf0, 0x02) 0 0xf1800000 0x1000000 /* AXI regs 16M */
40 0x00000000 0xf1000000 0x1000000 /* SB/NB regs 16M */ 43 MBUS_ID(0x01, 0xfd) 0 0xf8000000 0x8000000 /* BootROM 128M */
41 0xf2000000 0xf2000000 0x0100000 /* PCIe0 I/O 1M */ 44 MBUS_ID(0x03, 0x01) 0 0xc8000000 0x0100000 /* CESA SRAM 1M */
42 0xf2100000 0xf2100000 0x0100000 /* PCIe0 I/O 1M */ 45 MBUS_ID(0x0d, 0x00) 0 0xf0000000 0x0100000>; /* PMU SRAM 1M */
43 0xf8000000 0xf8000000 0x8000000>; /* BootROM 128M */ 46
44 47 pcie: pcie-controller {
45 timer: timer@20300 { 48 compatible = "marvell,dove-pcie";
46 compatible = "marvell,orion-timer";
47 reg = <0x20300 0x20>;
48 interrupt-parent = <&bridge_intc>;
49 interrupts = <1>, <2>;
50 clocks = <&core_clk 0>;
51 };
52
53 intc: main-interrupt-ctrl@20200 {
54 compatible = "marvell,orion-intc";
55 interrupt-controller;
56 #interrupt-cells = <1>;
57 reg = <0x20200 0x10>, <0x20210 0x10>;
58 };
59
60 bridge_intc: bridge-interrupt-ctrl@20110 {
61 compatible = "marvell,orion-bridge-intc";
62 interrupt-controller;
63 #interrupt-cells = <1>;
64 reg = <0x20110 0x8>;
65 interrupts = <0>;
66 marvell,#interrupts = <5>;
67 };
68
69 core_clk: core-clocks@d0214 {
70 compatible = "marvell,dove-core-clock";
71 reg = <0xd0214 0x4>;
72 #clock-cells = <1>;
73 };
74
75 gate_clk: clock-gating-ctrl@d0038 {
76 compatible = "marvell,dove-gating-clock";
77 reg = <0xd0038 0x4>;
78 clocks = <&core_clk 0>;
79 #clock-cells = <1>;
80 };
81
82 thermal: thermal-diode@d001c {
83 compatible = "marvell,dove-thermal";
84 reg = <0xd001c 0x0c>, <0xd005c 0x08>;
85 };
86
87 uart0: serial@12000 {
88 compatible = "ns16550a";
89 reg = <0x12000 0x100>;
90 reg-shift = <2>;
91 interrupts = <7>;
92 clocks = <&core_clk 0>;
93 status = "disabled";
94 };
95
96 uart1: serial@12100 {
97 compatible = "ns16550a";
98 reg = <0x12100 0x100>;
99 reg-shift = <2>;
100 interrupts = <8>;
101 clocks = <&core_clk 0>;
102 pinctrl-0 = <&pmx_uart1>;
103 pinctrl-names = "default";
104 status = "disabled";
105 };
106
107 uart2: serial@12200 {
108 compatible = "ns16550a";
109 reg = <0x12000 0x100>;
110 reg-shift = <2>;
111 interrupts = <9>;
112 clocks = <&core_clk 0>;
113 status = "disabled"; 49 status = "disabled";
114 }; 50 device_type = "pci";
115 51 #address-cells = <3>;
116 uart3: serial@12300 { 52 #size-cells = <2>;
117 compatible = "ns16550a"; 53
118 reg = <0x12100 0x100>; 54 msi-parent = <&intc>;
119 reg-shift = <2>; 55 bus-range = <0x00 0xff>;
120 interrupts = <10>; 56
121 clocks = <&core_clk 0>; 57 ranges = <0x82000000 0x0 0x40000 MBUS_ID(0xf0, 0x01) 0x40000 0 0x2000
122 status = "disabled"; 58 0x82000000 0x0 0x80000 MBUS_ID(0xf0, 0x01) 0x80000 0 0x2000
123 }; 59 0x82000000 0x1 0x0 MBUS_ID(0x04, 0xe8) 0 1 0 /* Port 0.0 Mem */
124 60 0x81000000 0x1 0x0 MBUS_ID(0x04, 0xe0) 0 1 0 /* Port 0.0 I/O */
125 gpio0: gpio-ctrl@d0400 { 61 0x82000000 0x2 0x0 MBUS_ID(0x08, 0xe8) 0 1 0 /* Port 1.0 Mem */
126 compatible = "marvell,orion-gpio"; 62 0x81000000 0x2 0x0 MBUS_ID(0x08, 0xe0) 0 1 0>; /* Port 1.0 I/O */
127 #gpio-cells = <2>; 63
128 gpio-controller; 64 pcie-port@0 {
129 reg = <0xd0400 0x20>; 65 device_type = "pci";
130 ngpios = <32>; 66 status = "disabled";
131 interrupt-controller; 67 assigned-addresses = <0x82000800 0 0x40000 0 0x2000>;
132 #interrupt-cells = <2>; 68 reg = <0x0800 0 0 0 0>;
133 interrupts = <12>, <13>, <14>, <60>; 69 clocks = <&gate_clk 4>;
134 }; 70 marvell,pcie-port = <0>;
135 71
136 gpio1: gpio-ctrl@d0420 { 72 #address-cells = <3>;
137 compatible = "marvell,orion-gpio"; 73 #size-cells = <2>;
138 #gpio-cells = <2>; 74 ranges = <0x82000000 0 0 0x82000000 0x1 0 1 0
139 gpio-controller; 75 0x81000000 0 0 0x81000000 0x1 0 1 0>;
140 reg = <0xd0420 0x20>; 76
141 ngpios = <32>; 77 #interrupt-cells = <1>;
142 interrupt-controller; 78 interrupt-map-mask = <0 0 0 0>;
143 #interrupt-cells = <2>; 79 interrupt-map = <0 0 0 0 &intc 16>;
144 interrupts = <61>; 80 };
145 }; 81
146 82 pcie-port@1 {
147 gpio2: gpio-ctrl@e8400 { 83 device_type = "pci";
148 compatible = "marvell,orion-gpio"; 84 status = "disabled";
149 #gpio-cells = <2>; 85 assigned-addresses = <0x82002800 0 0x80000 0 0x2000>;
150 gpio-controller; 86 reg = <0x1000 0 0 0 0>;
151 reg = <0xe8400 0x0c>; 87 clocks = <&gate_clk 5>;
152 ngpios = <8>; 88 marvell,pcie-port = <1>;
153 }; 89
154 90 #address-cells = <3>;
155 pinctrl: pin-ctrl@d0200 { 91 #size-cells = <2>;
156 compatible = "marvell,dove-pinctrl"; 92 ranges = <0x82000000 0 0 0x82000000 0x2 0 1 0
157 reg = <0xd0200 0x10>; 93 0x81000000 0 0 0x81000000 0x2 0 1 0>;
158 clocks = <&gate_clk 22>; 94
159 95 #interrupt-cells = <1>;
160 pmx_gpio_0: pmx-gpio-0 { 96 interrupt-map-mask = <0 0 0 0>;
161 marvell,pins = "mpp0"; 97 interrupt-map = <0 0 0 0 &intc 18>;
162 marvell,function = "gpio";
163 };
164
165 pmx_gpio_1: pmx-gpio-1 {
166 marvell,pins = "mpp1";
167 marvell,function = "gpio";
168 };
169
170 pmx_gpio_2: pmx-gpio-2 {
171 marvell,pins = "mpp2";
172 marvell,function = "gpio";
173 };
174
175 pmx_gpio_3: pmx-gpio-3 {
176 marvell,pins = "mpp3";
177 marvell,function = "gpio";
178 }; 98 };
179
180 pmx_gpio_4: pmx-gpio-4 {
181 marvell,pins = "mpp4";
182 marvell,function = "gpio";
183 };
184
185 pmx_gpio_5: pmx-gpio-5 {
186 marvell,pins = "mpp5";
187 marvell,function = "gpio";
188 };
189
190 pmx_gpio_6: pmx-gpio-6 {
191 marvell,pins = "mpp6";
192 marvell,function = "gpio";
193 };
194
195 pmx_gpio_7: pmx-gpio-7 {
196 marvell,pins = "mpp7";
197 marvell,function = "gpio";
198 };
199
200 pmx_gpio_8: pmx-gpio-8 {
201 marvell,pins = "mpp8";
202 marvell,function = "gpio";
203 };
204
205 pmx_gpio_9: pmx-gpio-9 {
206 marvell,pins = "mpp9";
207 marvell,function = "gpio";
208 };
209
210 pmx_gpio_10: pmx-gpio-10 {
211 marvell,pins = "mpp10";
212 marvell,function = "gpio";
213 };
214
215 pmx_gpio_11: pmx-gpio-11 {
216 marvell,pins = "mpp11";
217 marvell,function = "gpio";
218 };
219
220 pmx_gpio_12: pmx-gpio-12 {
221 marvell,pins = "mpp12";
222 marvell,function = "gpio";
223 };
224
225 pmx_gpio_13: pmx-gpio-13 {
226 marvell,pins = "mpp13";
227 marvell,function = "gpio";
228 };
229
230 pmx_gpio_14: pmx-gpio-14 {
231 marvell,pins = "mpp14";
232 marvell,function = "gpio";
233 };
234
235 pmx_gpio_15: pmx-gpio-15 {
236 marvell,pins = "mpp15";
237 marvell,function = "gpio";
238 };
239
240 pmx_gpio_16: pmx-gpio-16 {
241 marvell,pins = "mpp16";
242 marvell,function = "gpio";
243 };
244
245 pmx_gpio_17: pmx-gpio-17 {
246 marvell,pins = "mpp17";
247 marvell,function = "gpio";
248 };
249
250 pmx_gpio_18: pmx-gpio-18 {
251 marvell,pins = "mpp18";
252 marvell,function = "gpio";
253 };
254
255 pmx_gpio_19: pmx-gpio-19 {
256 marvell,pins = "mpp19";
257 marvell,function = "gpio";
258 };
259
260 pmx_gpio_20: pmx-gpio-20 {
261 marvell,pins = "mpp20";
262 marvell,function = "gpio";
263 };
264
265 pmx_gpio_21: pmx-gpio-21 {
266 marvell,pins = "mpp21";
267 marvell,function = "gpio";
268 };
269
270 pmx_camera: pmx-camera {
271 marvell,pins = "mpp_camera";
272 marvell,function = "camera";
273 };
274
275 pmx_camera_gpio: pmx-camera-gpio {
276 marvell,pins = "mpp_camera";
277 marvell,function = "gpio";
278 };
279
280 pmx_sdio0: pmx-sdio0 {
281 marvell,pins = "mpp_sdio0";
282 marvell,function = "sdio0";
283 };
284
285 pmx_sdio0_gpio: pmx-sdio0-gpio {
286 marvell,pins = "mpp_sdio0";
287 marvell,function = "gpio";
288 };
289
290 pmx_sdio1: pmx-sdio1 {
291 marvell,pins = "mpp_sdio1";
292 marvell,function = "sdio1";
293 };
294
295 pmx_sdio1_gpio: pmx-sdio1-gpio {
296 marvell,pins = "mpp_sdio1";
297 marvell,function = "gpio";
298 };
299
300 pmx_audio1_gpio: pmx-audio1-gpio {
301 marvell,pins = "mpp_audio1";
302 marvell,function = "gpio";
303 };
304
305 pmx_spi0: pmx-spi0 {
306 marvell,pins = "mpp_spi0";
307 marvell,function = "spi0";
308 };
309
310 pmx_spi0_gpio: pmx-spi0-gpio {
311 marvell,pins = "mpp_spi0";
312 marvell,function = "gpio";
313 };
314
315 pmx_uart1: pmx-uart1 {
316 marvell,pins = "mpp_uart1";
317 marvell,function = "uart1";
318 };
319
320 pmx_uart1_gpio: pmx-uart1-gpio {
321 marvell,pins = "mpp_uart1";
322 marvell,function = "gpio";
323 };
324
325 pmx_nand: pmx-nand {
326 marvell,pins = "mpp_nand";
327 marvell,function = "nand";
328 };
329
330 pmx_nand_gpo: pmx-nand-gpo {
331 marvell,pins = "mpp_nand";
332 marvell,function = "gpo";
333 };
334 };
335
336 spi0: spi-ctrl@10600 {
337 compatible = "marvell,orion-spi";
338 #address-cells = <1>;
339 #size-cells = <0>;
340 cell-index = <0>;
341 interrupts = <6>;
342 reg = <0x10600 0x28>;
343 clocks = <&core_clk 0>;
344 pinctrl-0 = <&pmx_spi0>;
345 pinctrl-names = "default";
346 status = "disabled";
347 };
348
349 spi1: spi-ctrl@14600 {
350 compatible = "marvell,orion-spi";
351 #address-cells = <1>;
352 #size-cells = <0>;
353 cell-index = <1>;
354 interrupts = <5>;
355 reg = <0x14600 0x28>;
356 clocks = <&core_clk 0>;
357 status = "disabled";
358 };
359
360 i2c0: i2c-ctrl@11000 {
361 compatible = "marvell,mv64xxx-i2c";
362 reg = <0x11000 0x20>;
363 #address-cells = <1>;
364 #size-cells = <0>;
365 interrupts = <11>;
366 clock-frequency = <400000>;
367 timeout-ms = <1000>;
368 clocks = <&core_clk 0>;
369 status = "disabled";
370 }; 99 };
371 100
372 ehci0: usb-host@50000 { 101 internal-regs {
373 compatible = "marvell,orion-ehci"; 102 compatible = "simple-bus";
374 reg = <0x50000 0x1000>;
375 interrupts = <24>;
376 clocks = <&gate_clk 0>;
377 status = "okay";
378 };
379
380 ehci1: usb-host@51000 {
381 compatible = "marvell,orion-ehci";
382 reg = <0x51000 0x1000>;
383 interrupts = <25>;
384 clocks = <&gate_clk 1>;
385 status = "okay";
386 };
387
388 sdio0: sdio-host@92000 {
389 compatible = "marvell,dove-sdhci";
390 reg = <0x92000 0x100>;
391 interrupts = <35>, <37>;
392 clocks = <&gate_clk 8>;
393 pinctrl-0 = <&pmx_sdio0>;
394 pinctrl-names = "default";
395 status = "disabled";
396 };
397
398 sdio1: sdio-host@90000 {
399 compatible = "marvell,dove-sdhci";
400 reg = <0x90000 0x100>;
401 interrupts = <36>, <38>;
402 clocks = <&gate_clk 9>;
403 pinctrl-0 = <&pmx_sdio1>;
404 pinctrl-names = "default";
405 status = "disabled";
406 };
407
408 sata0: sata-host@a0000 {
409 compatible = "marvell,orion-sata";
410 reg = <0xa0000 0x2400>;
411 interrupts = <62>;
412 clocks = <&gate_clk 3>;
413 nr-ports = <1>;
414 status = "disabled";
415 };
416
417 rtc: real-time-clock@d8500 {
418 compatible = "marvell,orion-rtc";
419 reg = <0xd8500 0x20>;
420 };
421
422 crypto: crypto-engine@30000 {
423 compatible = "marvell,orion-crypto";
424 reg = <0x30000 0x10000>,
425 <0xc8000000 0x800>;
426 reg-names = "regs", "sram";
427 interrupts = <31>;
428 clocks = <&gate_clk 15>;
429 status = "okay";
430 };
431
432 xor0: dma-engine@60800 {
433 compatible = "marvell,orion-xor";
434 reg = <0x60800 0x100
435 0x60a00 0x100>;
436 clocks = <&gate_clk 23>;
437 status = "okay";
438
439 channel0 {
440 interrupts = <39>;
441 dmacap,memcpy;
442 dmacap,xor;
443 };
444
445 channel1 {
446 interrupts = <40>;
447 dmacap,memset;
448 dmacap,memcpy;
449 dmacap,xor;
450 };
451 };
452
453 xor1: dma-engine@60900 {
454 compatible = "marvell,orion-xor";
455 reg = <0x60900 0x100
456 0x60b00 0x100>;
457 clocks = <&gate_clk 24>;
458 status = "okay";
459
460 channel0 {
461 interrupts = <42>;
462 dmacap,memcpy;
463 dmacap,xor;
464 };
465
466 channel1 {
467 interrupts = <43>;
468 dmacap,memset;
469 dmacap,memcpy;
470 dmacap,xor;
471 };
472 };
473
474 mdio: mdio-bus@72004 {
475 compatible = "marvell,orion-mdio";
476 #address-cells = <1>; 103 #address-cells = <1>;
477 #size-cells = <0>; 104 #size-cells = <1>;
478 reg = <0x72004 0x84>; 105 ranges = <0x00000000 MBUS_ID(0xf0, 0x01) 0 0x0100000 /* MBUS regs 1M */
479 interrupts = <30>; 106 0x00800000 MBUS_ID(0xf0, 0x02) 0 0x1000000 /* AXI regs 16M */
480 clocks = <&gate_clk 2>; 107 0xffffe000 MBUS_ID(0x03, 0x01) 0 0x0000800 /* CESA SRAM 2k */
481 status = "disabled"; 108 0xfffff000 MBUS_ID(0x0d, 0x00) 0 0x0000800>; /* PMU SRAM 2k */
482 109
483 ethphy: ethernet-phy { 110 mbusc: mbus-ctrl@20000 {
484 device-type = "ethernet-phy"; 111 compatible = "marvell,mbus-controller";
485 /* set phy address in board file */ 112 reg = <0x20000 0x80>, <0x800100 0x8>;
486 }; 113 };
487 }; 114
488 115 timer: timer@20300 {
489 eth: ethernet-controller@72000 { 116 compatible = "marvell,orion-timer";
490 compatible = "marvell,orion-eth"; 117 reg = <0x20300 0x20>;
491 #address-cells = <1>; 118 interrupt-parent = <&bridge_intc>;
492 #size-cells = <0>; 119 interrupts = <1>, <2>;
493 reg = <0x72000 0x4000>; 120 clocks = <&core_clk 0>;
494 clocks = <&gate_clk 2>; 121 };
495 marvell,tx-checksum-limit = <1600>; 122
496 status = "disabled"; 123 intc: main-interrupt-ctrl@20200 {
497 124 compatible = "marvell,orion-intc";
498 ethernet-port@0 { 125 interrupt-controller;
499 device_type = "network"; 126 #interrupt-cells = <1>;
500 compatible = "marvell,orion-eth-port"; 127 reg = <0x20200 0x10>, <0x20210 0x10>;
501 reg = <0>; 128 };
502 interrupts = <29>; 129
503 /* overwrite MAC address in bootloader */ 130 bridge_intc: bridge-interrupt-ctrl@20110 {
504 local-mac-address = [00 00 00 00 00 00]; 131 compatible = "marvell,orion-bridge-intc";
505 phy-handle = <&ethphy>; 132 interrupt-controller;
133 #interrupt-cells = <1>;
134 reg = <0x20110 0x8>;
135 interrupts = <0>;
136 marvell,#interrupts = <5>;
137 };
138
139 core_clk: core-clocks@d0214 {
140 compatible = "marvell,dove-core-clock";
141 reg = <0xd0214 0x4>;
142 #clock-cells = <1>;
143 };
144
145 gate_clk: clock-gating-ctrl@d0038 {
146 compatible = "marvell,dove-gating-clock";
147 reg = <0xd0038 0x4>;
148 clocks = <&core_clk 0>;
149 #clock-cells = <1>;
150 };
151
152 thermal: thermal-diode@d001c {
153 compatible = "marvell,dove-thermal";
154 reg = <0xd001c 0x0c>, <0xd005c 0x08>;
155 };
156
157 uart0: serial@12000 {
158 compatible = "ns16550a";
159 reg = <0x12000 0x100>;
160 reg-shift = <2>;
161 interrupts = <7>;
162 clocks = <&core_clk 0>;
163 status = "disabled";
164 };
165
166 uart1: serial@12100 {
167 compatible = "ns16550a";
168 reg = <0x12100 0x100>;
169 reg-shift = <2>;
170 interrupts = <8>;
171 clocks = <&core_clk 0>;
172 pinctrl-0 = <&pmx_uart1>;
173 pinctrl-names = "default";
174 status = "disabled";
175 };
176
177 uart2: serial@12200 {
178 compatible = "ns16550a";
179 reg = <0x12000 0x100>;
180 reg-shift = <2>;
181 interrupts = <9>;
182 clocks = <&core_clk 0>;
183 status = "disabled";
184 };
185
186 uart3: serial@12300 {
187 compatible = "ns16550a";
188 reg = <0x12100 0x100>;
189 reg-shift = <2>;
190 interrupts = <10>;
191 clocks = <&core_clk 0>;
192 status = "disabled";
193 };
194
195 gpio0: gpio-ctrl@d0400 {
196 compatible = "marvell,orion-gpio";
197 #gpio-cells = <2>;
198 gpio-controller;
199 reg = <0xd0400 0x20>;
200 ngpios = <32>;
201 interrupt-controller;
202 #interrupt-cells = <2>;
203 interrupts = <12>, <13>, <14>, <60>;
204 };
205
206 gpio1: gpio-ctrl@d0420 {
207 compatible = "marvell,orion-gpio";
208 #gpio-cells = <2>;
209 gpio-controller;
210 reg = <0xd0420 0x20>;
211 ngpios = <32>;
212 interrupt-controller;
213 #interrupt-cells = <2>;
214 interrupts = <61>;
215 };
216
217 gpio2: gpio-ctrl@e8400 {
218 compatible = "marvell,orion-gpio";
219 #gpio-cells = <2>;
220 gpio-controller;
221 reg = <0xe8400 0x0c>;
222 ngpios = <8>;
223 };
224
225 pinctrl: pin-ctrl@d0200 {
226 compatible = "marvell,dove-pinctrl";
227 reg = <0xd0200 0x10>;
228 clocks = <&gate_clk 22>;
229
230 pmx_gpio_0: pmx-gpio-0 {
231 marvell,pins = "mpp0";
232 marvell,function = "gpio";
233 };
234
235 pmx_gpio_1: pmx-gpio-1 {
236 marvell,pins = "mpp1";
237 marvell,function = "gpio";
238 };
239
240 pmx_gpio_2: pmx-gpio-2 {
241 marvell,pins = "mpp2";
242 marvell,function = "gpio";
243 };
244
245 pmx_gpio_3: pmx-gpio-3 {
246 marvell,pins = "mpp3";
247 marvell,function = "gpio";
248 };
249
250 pmx_gpio_4: pmx-gpio-4 {
251 marvell,pins = "mpp4";
252 marvell,function = "gpio";
253 };
254
255 pmx_gpio_5: pmx-gpio-5 {
256 marvell,pins = "mpp5";
257 marvell,function = "gpio";
258 };
259
260 pmx_gpio_6: pmx-gpio-6 {
261 marvell,pins = "mpp6";
262 marvell,function = "gpio";
263 };
264
265 pmx_gpio_7: pmx-gpio-7 {
266 marvell,pins = "mpp7";
267 marvell,function = "gpio";
268 };
269
270 pmx_gpio_8: pmx-gpio-8 {
271 marvell,pins = "mpp8";
272 marvell,function = "gpio";
273 };
274
275 pmx_gpio_9: pmx-gpio-9 {
276 marvell,pins = "mpp9";
277 marvell,function = "gpio";
278 };
279
280 pmx_gpio_10: pmx-gpio-10 {
281 marvell,pins = "mpp10";
282 marvell,function = "gpio";
283 };
284
285 pmx_gpio_11: pmx-gpio-11 {
286 marvell,pins = "mpp11";
287 marvell,function = "gpio";
288 };
289
290 pmx_gpio_12: pmx-gpio-12 {
291 marvell,pins = "mpp12";
292 marvell,function = "gpio";
293 };
294
295 pmx_gpio_13: pmx-gpio-13 {
296 marvell,pins = "mpp13";
297 marvell,function = "gpio";
298 };
299
300 pmx_audio1_extclk: pmx-audio1-extclk {
301 marvell,pins = "mpp13";
302 marvell,function = "audio1";
303 };
304
305 pmx_gpio_14: pmx-gpio-14 {
306 marvell,pins = "mpp14";
307 marvell,function = "gpio";
308 };
309
310 pmx_gpio_15: pmx-gpio-15 {
311 marvell,pins = "mpp15";
312 marvell,function = "gpio";
313 };
314
315 pmx_gpio_16: pmx-gpio-16 {
316 marvell,pins = "mpp16";
317 marvell,function = "gpio";
318 };
319
320 pmx_gpio_17: pmx-gpio-17 {
321 marvell,pins = "mpp17";
322 marvell,function = "gpio";
323 };
324
325 pmx_gpio_18: pmx-gpio-18 {
326 marvell,pins = "mpp18";
327 marvell,function = "gpio";
328 };
329
330 pmx_gpio_19: pmx-gpio-19 {
331 marvell,pins = "mpp19";
332 marvell,function = "gpio";
333 };
334
335 pmx_gpio_20: pmx-gpio-20 {
336 marvell,pins = "mpp20";
337 marvell,function = "gpio";
338 };
339
340 pmx_gpio_21: pmx-gpio-21 {
341 marvell,pins = "mpp21";
342 marvell,function = "gpio";
343 };
344
345 pmx_camera: pmx-camera {
346 marvell,pins = "mpp_camera";
347 marvell,function = "camera";
348 };
349
350 pmx_camera_gpio: pmx-camera-gpio {
351 marvell,pins = "mpp_camera";
352 marvell,function = "gpio";
353 };
354
355 pmx_sdio0: pmx-sdio0 {
356 marvell,pins = "mpp_sdio0";
357 marvell,function = "sdio0";
358 };
359
360 pmx_sdio0_gpio: pmx-sdio0-gpio {
361 marvell,pins = "mpp_sdio0";
362 marvell,function = "gpio";
363 };
364
365 pmx_sdio1: pmx-sdio1 {
366 marvell,pins = "mpp_sdio1";
367 marvell,function = "sdio1";
368 };
369
370 pmx_sdio1_gpio: pmx-sdio1-gpio {
371 marvell,pins = "mpp_sdio1";
372 marvell,function = "gpio";
373 };
374
375 pmx_audio1_gpio: pmx-audio1-gpio {
376 marvell,pins = "mpp_audio1";
377 marvell,function = "gpio";
378 };
379
380 pmx_audio1_i2s1_spdifo: pmx-audio1-i2s1-spdifo {
381 marvell,pins = "mpp_audio1";
382 marvell,function = "i2s1/spdifo";
383 };
384
385 pmx_spi0: pmx-spi0 {
386 marvell,pins = "mpp_spi0";
387 marvell,function = "spi0";
388 };
389
390 pmx_spi0_gpio: pmx-spi0-gpio {
391 marvell,pins = "mpp_spi0";
392 marvell,function = "gpio";
393 };
394
395 pmx_uart1: pmx-uart1 {
396 marvell,pins = "mpp_uart1";
397 marvell,function = "uart1";
398 };
399
400 pmx_uart1_gpio: pmx-uart1-gpio {
401 marvell,pins = "mpp_uart1";
402 marvell,function = "gpio";
403 };
404
405 pmx_nand: pmx-nand {
406 marvell,pins = "mpp_nand";
407 marvell,function = "nand";
408 };
409
410 pmx_nand_gpo: pmx-nand-gpo {
411 marvell,pins = "mpp_nand";
412 marvell,function = "gpo";
413 };
414 };
415
416 spi0: spi-ctrl@10600 {
417 compatible = "marvell,orion-spi";
418 #address-cells = <1>;
419 #size-cells = <0>;
420 cell-index = <0>;
421 interrupts = <6>;
422 reg = <0x10600 0x28>;
423 clocks = <&core_clk 0>;
424 pinctrl-0 = <&pmx_spi0>;
425 pinctrl-names = "default";
426 status = "disabled";
427 };
428
429 spi1: spi-ctrl@14600 {
430 compatible = "marvell,orion-spi";
431 #address-cells = <1>;
432 #size-cells = <0>;
433 cell-index = <1>;
434 interrupts = <5>;
435 reg = <0x14600 0x28>;
436 clocks = <&core_clk 0>;
437 status = "disabled";
438 };
439
440 i2c0: i2c-ctrl@11000 {
441 compatible = "marvell,mv64xxx-i2c";
442 reg = <0x11000 0x20>;
443 #address-cells = <1>;
444 #size-cells = <0>;
445 interrupts = <11>;
446 clock-frequency = <400000>;
447 timeout-ms = <1000>;
448 clocks = <&core_clk 0>;
449 status = "disabled";
450 };
451
452 ehci0: usb-host@50000 {
453 compatible = "marvell,orion-ehci";
454 reg = <0x50000 0x1000>;
455 interrupts = <24>;
456 clocks = <&gate_clk 0>;
457 status = "okay";
458 };
459
460 ehci1: usb-host@51000 {
461 compatible = "marvell,orion-ehci";
462 reg = <0x51000 0x1000>;
463 interrupts = <25>;
464 clocks = <&gate_clk 1>;
465 status = "okay";
466 };
467
468 sdio0: sdio-host@92000 {
469 compatible = "marvell,dove-sdhci";
470 reg = <0x92000 0x100>;
471 interrupts = <35>, <37>;
472 clocks = <&gate_clk 8>;
473 pinctrl-0 = <&pmx_sdio0>;
474 pinctrl-names = "default";
475 status = "disabled";
476 };
477
478 sdio1: sdio-host@90000 {
479 compatible = "marvell,dove-sdhci";
480 reg = <0x90000 0x100>;
481 interrupts = <36>, <38>;
482 clocks = <&gate_clk 9>;
483 pinctrl-0 = <&pmx_sdio1>;
484 pinctrl-names = "default";
485 status = "disabled";
486 };
487
488 sata0: sata-host@a0000 {
489 compatible = "marvell,orion-sata";
490 reg = <0xa0000 0x2400>;
491 interrupts = <62>;
492 clocks = <&gate_clk 3>;
493 nr-ports = <1>;
494 status = "disabled";
495 };
496
497 rtc: real-time-clock@d8500 {
498 compatible = "marvell,orion-rtc";
499 reg = <0xd8500 0x20>;
500 };
501
502 crypto: crypto-engine@30000 {
503 compatible = "marvell,orion-crypto";
504 reg = <0x30000 0x10000>,
505 <0xffffe000 0x800>;
506 reg-names = "regs", "sram";
507 interrupts = <31>;
508 clocks = <&gate_clk 15>;
509 status = "okay";
510 };
511
512 xor0: dma-engine@60800 {
513 compatible = "marvell,orion-xor";
514 reg = <0x60800 0x100
515 0x60a00 0x100>;
516 clocks = <&gate_clk 23>;
517 status = "okay";
518
519 channel0 {
520 interrupts = <39>;
521 dmacap,memcpy;
522 dmacap,xor;
523 };
524
525 channel1 {
526 interrupts = <40>;
527 dmacap,memcpy;
528 dmacap,xor;
529 };
530 };
531
532 xor1: dma-engine@60900 {
533 compatible = "marvell,orion-xor";
534 reg = <0x60900 0x100
535 0x60b00 0x100>;
536 clocks = <&gate_clk 24>;
537 status = "okay";
538
539 channel0 {
540 interrupts = <42>;
541 dmacap,memcpy;
542 dmacap,xor;
543 };
544
545 channel1 {
546 interrupts = <43>;
547 dmacap,memcpy;
548 dmacap,xor;
549 };
550 };
551
552 mdio: mdio-bus@72004 {
553 compatible = "marvell,orion-mdio";
554 #address-cells = <1>;
555 #size-cells = <0>;
556 reg = <0x72004 0x84>;
557 interrupts = <30>;
558 clocks = <&gate_clk 2>;
559 status = "disabled";
560
561 ethphy: ethernet-phy {
562 device-type = "ethernet-phy";
563 /* set phy address in board file */
564 };
565 };
566
567 eth: ethernet-ctrl@72000 {
568 compatible = "marvell,orion-eth";
569 #address-cells = <1>;
570 #size-cells = <0>;
571 reg = <0x72000 0x4000>;
572 clocks = <&gate_clk 2>;
573 marvell,tx-checksum-limit = <1600>;
574 status = "disabled";
575
576 ethernet-port@0 {
577 device_type = "network";
578 compatible = "marvell,orion-eth-port";
579 reg = <0>;
580 interrupts = <29>;
581 /* overwrite MAC address in bootloader */
582 local-mac-address = [00 00 00 00 00 00];
583 phy-handle = <&ethphy>;
584 };
585 };
586
587 audio0: audio-controller@b0000 {
588 compatible = "marvell,dove-audio";
589 reg = <0xb0000 0x2210>;
590 interrupts = <19>, <20>;
591 clocks = <&gate_clk 12>;
592 clock-names = "internal";
593 status = "disabled";
594 };
595
596 audio1: audio-controller@b4000 {
597 compatible = "marvell,dove-audio";
598 reg = <0xb4000 0x2210>;
599 interrupts = <21>, <22>;
600 clocks = <&gate_clk 13>;
601 clock-names = "internal";
602 status = "disabled";
506 }; 603 };
507 }; 604 };
508 }; 605 };
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts
new file mode 100644
index 000000000000..5babba0a3a75
--- /dev/null
+++ b/arch/arm/boot/dts/dra7-evm.dts
@@ -0,0 +1,275 @@
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 "dra7.dtsi"
11
12/ {
13 model = "TI DRA7";
14 compatible = "ti,dra7-evm", "ti,dra752", "ti,dra7";
15
16 memory {
17 device_type = "memory";
18 reg = <0x80000000 0x60000000>; /* 1536 MB */
19 };
20
21 mmc2_3v3: fixedregulator-mmc2 {
22 compatible = "regulator-fixed";
23 regulator-name = "mmc2_3v3";
24 regulator-min-microvolt = <3300000>;
25 regulator-max-microvolt = <3300000>;
26 };
27};
28
29&dra7_pmx_core {
30 i2c1_pins: pinmux_i2c1_pins {
31 pinctrl-single,pins = <
32 0x400 (PIN_INPUT | MUX_MODE0) /* i2c1_sda */
33 0x404 (PIN_INPUT | MUX_MODE0) /* i2c1_scl */
34 >;
35 };
36
37 i2c2_pins: pinmux_i2c2_pins {
38 pinctrl-single,pins = <
39 0x408 (PIN_INPUT | MUX_MODE0) /* i2c2_sda */
40 0x40c (PIN_INPUT | MUX_MODE0) /* i2c2_scl */
41 >;
42 };
43
44 i2c3_pins: pinmux_i2c3_pins {
45 pinctrl-single,pins = <
46 0x410 (PIN_INPUT | MUX_MODE0) /* i2c3_sda */
47 0x414 (PIN_INPUT | MUX_MODE0) /* i2c3_scl */
48 >;
49 };
50
51 mcspi1_pins: pinmux_mcspi1_pins {
52 pinctrl-single,pins = <
53 0x3a4 (PIN_INPUT | MUX_MODE0) /* spi2_clk */
54 0x3a8 (PIN_INPUT | MUX_MODE0) /* spi2_d1 */
55 0x3ac (PIN_INPUT | MUX_MODE0) /* spi2_d0 */
56 0x3b0 (PIN_INPUT_SLEW | MUX_MODE0) /* spi2_cs0 */
57 0x3b4 (PIN_INPUT_SLEW | MUX_MODE0) /* spi2_cs1 */
58 0x3b8 (PIN_INPUT_SLEW | MUX_MODE6) /* spi2_cs2 */
59 0x3bc (PIN_INPUT_SLEW | MUX_MODE6) /* spi2_cs3 */
60 >;
61 };
62
63 mcspi2_pins: pinmux_mcspi2_pins {
64 pinctrl-single,pins = <
65 0x3c0 (PIN_INPUT | MUX_MODE0) /* spi2_sclk */
66 0x3c4 (PIN_INPUT_SLEW | MUX_MODE0) /* spi2_d1 */
67 0x3c8 (PIN_INPUT_SLEW | MUX_MODE0) /* spi2_d1 */
68 0x3cc (PIN_INPUT_SLEW | MUX_MODE0) /* spi2_cs0 */
69 >;
70 };
71
72 uart1_pins: pinmux_uart1_pins {
73 pinctrl-single,pins = <
74 0x3e0 (PIN_INPUT_SLEW | MUX_MODE0) /* uart1_rxd */
75 0x3e4 (PIN_INPUT_SLEW | MUX_MODE0) /* uart1_txd */
76 0x3e8 (PIN_INPUT | MUX_MODE3) /* uart1_ctsn */
77 0x3ec (PIN_INPUT | MUX_MODE3) /* uart1_rtsn */
78 >;
79 };
80
81 uart2_pins: pinmux_uart2_pins {
82 pinctrl-single,pins = <
83 0x3f0 (PIN_INPUT | MUX_MODE0) /* uart2_rxd */
84 0x3f4 (PIN_INPUT | MUX_MODE0) /* uart2_txd */
85 0x3f8 (PIN_INPUT | MUX_MODE0) /* uart2_ctsn */
86 0x3fc (PIN_INPUT | MUX_MODE0) /* uart2_rtsn */
87 >;
88 };
89
90 uart3_pins: pinmux_uart3_pins {
91 pinctrl-single,pins = <
92 0x248 (PIN_INPUT_SLEW | MUX_MODE0) /* uart3_rxd */
93 0x24c (PIN_INPUT_SLEW | MUX_MODE0) /* uart3_txd */
94 >;
95 };
96};
97
98&i2c1 {
99 status = "okay";
100 pinctrl-names = "default";
101 pinctrl-0 = <&i2c1_pins>;
102 clock-frequency = <400000>;
103
104 tps659038: tps659038@58 {
105 compatible = "ti,tps659038";
106 reg = <0x58>;
107
108 tps659038_pmic {
109 compatible = "ti,tps659038-pmic";
110
111 regulators {
112 smps123_reg: smps123 {
113 /* VDD_MPU */
114 regulator-name = "smps123";
115 regulator-min-microvolt = < 850000>;
116 regulator-max-microvolt = <1250000>;
117 regulator-always-on;
118 regulator-boot-on;
119 };
120
121 smps45_reg: smps45 {
122 /* VDD_DSPEVE */
123 regulator-name = "smps45";
124 regulator-min-microvolt = < 850000>;
125 regulator-max-microvolt = <1150000>;
126 regulator-boot-on;
127 };
128
129 smps6_reg: smps6 {
130 /* VDD_GPU - over VDD_SMPS6 */
131 regulator-name = "smps6";
132 regulator-min-microvolt = <850000>;
133 regulator-max-microvolt = <12500000>;
134 regulator-boot-on;
135 };
136
137 smps7_reg: smps7 {
138 /* CORE_VDD */
139 regulator-name = "smps7";
140 regulator-min-microvolt = <850000>;
141 regulator-max-microvolt = <1030000>;
142 regulator-always-on;
143 regulator-boot-on;
144 };
145
146 smps8_reg: smps8 {
147 /* VDD_IVAHD */
148 regulator-name = "smps8";
149 regulator-min-microvolt = < 850000>;
150 regulator-max-microvolt = <1250000>;
151 regulator-boot-on;
152 };
153
154 smps9_reg: smps9 {
155 /* VDDS1V8 */
156 regulator-name = "smps9";
157 regulator-min-microvolt = <1800000>;
158 regulator-max-microvolt = <1800000>;
159 regulator-always-on;
160 regulator-boot-on;
161 };
162
163 ldo1_reg: ldo1 {
164 /* LDO1_OUT --> SDIO */
165 regulator-name = "ldo1";
166 regulator-min-microvolt = <1800000>;
167 regulator-max-microvolt = <3300000>;
168 regulator-boot-on;
169 };
170
171 ldo2_reg: ldo2 {
172 /* VDD_RTCIO */
173 /* LDO2 -> VDDSHV5, LDO2 also goes to CAN_PHY_3V3 */
174 regulator-name = "ldo2";
175 regulator-min-microvolt = <3300000>;
176 regulator-max-microvolt = <3300000>;
177 regulator-boot-on;
178 };
179
180 ldo3_reg: ldo3 {
181 /* VDDA_1V8_PHY */
182 regulator-name = "ldo3";
183 regulator-min-microvolt = <1800000>;
184 regulator-max-microvolt = <1800000>;
185 regulator-boot-on;
186 };
187
188 ldo9_reg: ldo9 {
189 /* VDD_RTC */
190 regulator-name = "ldo9";
191 regulator-min-microvolt = <1050000>;
192 regulator-max-microvolt = <1050000>;
193 regulator-boot-on;
194 };
195
196 ldoln_reg: ldoln {
197 /* VDDA_1V8_PLL */
198 regulator-name = "ldoln";
199 regulator-min-microvolt = <1800000>;
200 regulator-max-microvolt = <1800000>;
201 regulator-always-on;
202 regulator-boot-on;
203 };
204
205 ldousb_reg: ldousb {
206 /* VDDA_3V_USB: VDDA_USBHS33 */
207 regulator-name = "ldousb";
208 regulator-min-microvolt = <3300000>;
209 regulator-max-microvolt = <3300000>;
210 regulator-boot-on;
211 };
212 };
213 };
214 };
215};
216
217&i2c2 {
218 status = "okay";
219 pinctrl-names = "default";
220 pinctrl-0 = <&i2c2_pins>;
221 clock-frequency = <400000>;
222};
223
224&i2c3 {
225 status = "okay";
226 pinctrl-names = "default";
227 pinctrl-0 = <&i2c3_pins>;
228 clock-frequency = <3400000>;
229};
230
231&mcspi1 {
232 status = "okay";
233 pinctrl-names = "default";
234 pinctrl-0 = <&mcspi1_pins>;
235};
236
237&mcspi2 {
238 status = "okay";
239 pinctrl-names = "default";
240 pinctrl-0 = <&mcspi2_pins>;
241};
242
243&uart1 {
244 status = "okay";
245 pinctrl-names = "default";
246 pinctrl-0 = <&uart1_pins>;
247};
248
249&uart2 {
250 status = "okay";
251 pinctrl-names = "default";
252 pinctrl-0 = <&uart2_pins>;
253};
254
255&uart3 {
256 status = "okay";
257 pinctrl-names = "default";
258 pinctrl-0 = <&uart3_pins>;
259};
260
261&mmc1 {
262 status = "okay";
263 vmmc-supply = <&ldo1_reg>;
264 bus-width = <4>;
265};
266
267&mmc2 {
268 status = "okay";
269 vmmc-supply = <&mmc2_3v3>;
270 bus-width = <8>;
271};
272
273&cpu0 {
274 cpu0-supply = <&smps123_reg>;
275};
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
new file mode 100644
index 000000000000..d0df4c4e8b0a
--- /dev/null
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -0,0 +1,586 @@
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 * Based on "omap4.dtsi"
8 */
9
10#include <dt-bindings/interrupt-controller/arm-gic.h>
11#include <dt-bindings/pinctrl/dra.h>
12
13#include "skeleton.dtsi"
14
15/ {
16 #address-cells = <1>;
17 #size-cells = <1>;
18
19 compatible = "ti,dra7xx";
20 interrupt-parent = <&gic>;
21
22 aliases {
23 i2c0 = &i2c1;
24 i2c1 = &i2c2;
25 i2c2 = &i2c3;
26 i2c3 = &i2c4;
27 i2c4 = &i2c5;
28 serial0 = &uart1;
29 serial1 = &uart2;
30 serial2 = &uart3;
31 serial3 = &uart4;
32 serial4 = &uart5;
33 serial5 = &uart6;
34 };
35
36 cpus {
37 #address-cells = <1>;
38 #size-cells = <0>;
39
40 cpu0: cpu@0 {
41 device_type = "cpu";
42 compatible = "arm,cortex-a15";
43 reg = <0>;
44
45 operating-points = <
46 /* kHz uV */
47 1000000 1060000
48 1176000 1160000
49 >;
50 };
51 cpu@1 {
52 device_type = "cpu";
53 compatible = "arm,cortex-a15";
54 reg = <1>;
55 };
56 };
57
58 timer {
59 compatible = "arm,armv7-timer";
60 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
61 <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
62 <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
63 <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>;
64 };
65
66 gic: interrupt-controller@48211000 {
67 compatible = "arm,cortex-a15-gic";
68 interrupt-controller;
69 #interrupt-cells = <3>;
70 reg = <0x48211000 0x1000>,
71 <0x48212000 0x1000>,
72 <0x48214000 0x2000>,
73 <0x48216000 0x2000>;
74 interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;
75 };
76
77 /*
78 * The soc node represents the soc top level view. It is uses for IPs
79 * that are not memory mapped in the MPU view or for the MPU itself.
80 */
81 soc {
82 compatible = "ti,omap-infra";
83 mpu {
84 compatible = "ti,omap5-mpu";
85 ti,hwmods = "mpu";
86 };
87 };
88
89 /*
90 * XXX: Use a flat representation of the SOC interconnect.
91 * The real OMAP interconnect network is quite complex.
92 * Since that will not bring real advantage to represent that in DT for
93 * the moment, just use a fake OCP bus entry to represent the whole bus
94 * hierarchy.
95 */
96 ocp {
97 compatible = "ti,omap4-l3-noc", "simple-bus";
98 #address-cells = <1>;
99 #size-cells = <1>;
100 ranges;
101 ti,hwmods = "l3_main_1", "l3_main_2";
102 reg = <0x44000000 0x2000>,
103 <0x44800000 0x3000>;
104 interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
105 <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
106
107 counter32k: counter@4ae04000 {
108 compatible = "ti,omap-counter32k";
109 reg = <0x4ae04000 0x40>;
110 ti,hwmods = "counter_32k";
111 };
112
113 dra7_pmx_core: pinmux@4a003400 {
114 compatible = "pinctrl-single";
115 reg = <0x4a003400 0x0464>;
116 #address-cells = <1>;
117 #size-cells = <0>;
118 pinctrl-single,register-width = <32>;
119 pinctrl-single,function-mask = <0x3fffffff>;
120 };
121
122 sdma: dma-controller@4a056000 {
123 compatible = "ti,omap4430-sdma";
124 reg = <0x4a056000 0x1000>;
125 interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>,
126 <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
127 <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>,
128 <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
129 #dma-cells = <1>;
130 #dma-channels = <32>;
131 #dma-requests = <127>;
132 };
133
134 gpio1: gpio@4ae10000 {
135 compatible = "ti,omap4-gpio";
136 reg = <0x4ae10000 0x200>;
137 interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
138 ti,hwmods = "gpio1";
139 gpio-controller;
140 #gpio-cells = <2>;
141 interrupt-controller;
142 #interrupt-cells = <1>;
143 };
144
145 gpio2: gpio@48055000 {
146 compatible = "ti,omap4-gpio";
147 reg = <0x48055000 0x200>;
148 interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
149 ti,hwmods = "gpio2";
150 gpio-controller;
151 #gpio-cells = <2>;
152 interrupt-controller;
153 #interrupt-cells = <1>;
154 };
155
156 gpio3: gpio@48057000 {
157 compatible = "ti,omap4-gpio";
158 reg = <0x48057000 0x200>;
159 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
160 ti,hwmods = "gpio3";
161 gpio-controller;
162 #gpio-cells = <2>;
163 interrupt-controller;
164 #interrupt-cells = <1>;
165 };
166
167 gpio4: gpio@48059000 {
168 compatible = "ti,omap4-gpio";
169 reg = <0x48059000 0x200>;
170 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
171 ti,hwmods = "gpio4";
172 gpio-controller;
173 #gpio-cells = <2>;
174 interrupt-controller;
175 #interrupt-cells = <1>;
176 };
177
178 gpio5: gpio@4805b000 {
179 compatible = "ti,omap4-gpio";
180 reg = <0x4805b000 0x200>;
181 interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
182 ti,hwmods = "gpio5";
183 gpio-controller;
184 #gpio-cells = <2>;
185 interrupt-controller;
186 #interrupt-cells = <1>;
187 };
188
189 gpio6: gpio@4805d000 {
190 compatible = "ti,omap4-gpio";
191 reg = <0x4805d000 0x200>;
192 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
193 ti,hwmods = "gpio6";
194 gpio-controller;
195 #gpio-cells = <2>;
196 interrupt-controller;
197 #interrupt-cells = <1>;
198 };
199
200 gpio7: gpio@48051000 {
201 compatible = "ti,omap4-gpio";
202 reg = <0x48051000 0x200>;
203 interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
204 ti,hwmods = "gpio7";
205 gpio-controller;
206 #gpio-cells = <2>;
207 interrupt-controller;
208 #interrupt-cells = <1>;
209 };
210
211 gpio8: gpio@48053000 {
212 compatible = "ti,omap4-gpio";
213 reg = <0x48053000 0x200>;
214 interrupts = <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
215 ti,hwmods = "gpio8";
216 gpio-controller;
217 #gpio-cells = <2>;
218 interrupt-controller;
219 #interrupt-cells = <1>;
220 };
221
222 uart1: serial@4806a000 {
223 compatible = "ti,omap4-uart";
224 reg = <0x4806a000 0x100>;
225 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
226 ti,hwmods = "uart1";
227 clock-frequency = <48000000>;
228 status = "disabled";
229 };
230
231 uart2: serial@4806c000 {
232 compatible = "ti,omap4-uart";
233 reg = <0x4806c000 0x100>;
234 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
235 ti,hwmods = "uart2";
236 clock-frequency = <48000000>;
237 status = "disabled";
238 };
239
240 uart3: serial@48020000 {
241 compatible = "ti,omap4-uart";
242 reg = <0x48020000 0x100>;
243 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
244 ti,hwmods = "uart3";
245 clock-frequency = <48000000>;
246 status = "disabled";
247 };
248
249 uart4: serial@4806e000 {
250 compatible = "ti,omap4-uart";
251 reg = <0x4806e000 0x100>;
252 interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
253 ti,hwmods = "uart4";
254 clock-frequency = <48000000>;
255 status = "disabled";
256 };
257
258 uart5: serial@48066000 {
259 compatible = "ti,omap4-uart";
260 reg = <0x48066000 0x100>;
261 interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
262 ti,hwmods = "uart5";
263 clock-frequency = <48000000>;
264 status = "disabled";
265 };
266
267 uart6: serial@48068000 {
268 compatible = "ti,omap4-uart";
269 reg = <0x48068000 0x100>;
270 interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
271 ti,hwmods = "uart6";
272 clock-frequency = <48000000>;
273 status = "disabled";
274 };
275
276 uart7: serial@48420000 {
277 compatible = "ti,omap4-uart";
278 reg = <0x48420000 0x100>;
279 ti,hwmods = "uart7";
280 clock-frequency = <48000000>;
281 status = "disabled";
282 };
283
284 uart8: serial@48422000 {
285 compatible = "ti,omap4-uart";
286 reg = <0x48422000 0x100>;
287 ti,hwmods = "uart8";
288 clock-frequency = <48000000>;
289 status = "disabled";
290 };
291
292 uart9: serial@48424000 {
293 compatible = "ti,omap4-uart";
294 reg = <0x48424000 0x100>;
295 ti,hwmods = "uart9";
296 clock-frequency = <48000000>;
297 status = "disabled";
298 };
299
300 uart10: serial@4ae2b000 {
301 compatible = "ti,omap4-uart";
302 reg = <0x4ae2b000 0x100>;
303 ti,hwmods = "uart10";
304 clock-frequency = <48000000>;
305 status = "disabled";
306 };
307
308 timer1: timer@4ae18000 {
309 compatible = "ti,omap5430-timer";
310 reg = <0x4ae18000 0x80>;
311 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
312 ti,hwmods = "timer1";
313 ti,timer-alwon;
314 };
315
316 timer2: timer@48032000 {
317 compatible = "ti,omap5430-timer";
318 reg = <0x48032000 0x80>;
319 interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
320 ti,hwmods = "timer2";
321 };
322
323 timer3: timer@48034000 {
324 compatible = "ti,omap5430-timer";
325 reg = <0x48034000 0x80>;
326 interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
327 ti,hwmods = "timer3";
328 };
329
330 timer4: timer@48036000 {
331 compatible = "ti,omap5430-timer";
332 reg = <0x48036000 0x80>;
333 interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
334 ti,hwmods = "timer4";
335 };
336
337 timer5: timer@48820000 {
338 compatible = "ti,omap5430-timer";
339 reg = <0x48820000 0x80>;
340 interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
341 ti,hwmods = "timer5";
342 ti,timer-dsp;
343 };
344
345 timer6: timer@48822000 {
346 compatible = "ti,omap5430-timer";
347 reg = <0x48822000 0x80>;
348 interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
349 ti,hwmods = "timer6";
350 ti,timer-dsp;
351 ti,timer-pwm;
352 };
353
354 timer7: timer@48824000 {
355 compatible = "ti,omap5430-timer";
356 reg = <0x48824000 0x80>;
357 interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
358 ti,hwmods = "timer7";
359 ti,timer-dsp;
360 };
361
362 timer8: timer@48826000 {
363 compatible = "ti,omap5430-timer";
364 reg = <0x48826000 0x80>;
365 interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
366 ti,hwmods = "timer8";
367 ti,timer-dsp;
368 ti,timer-pwm;
369 };
370
371 timer9: timer@4803e000 {
372 compatible = "ti,omap5430-timer";
373 reg = <0x4803e000 0x80>;
374 interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
375 ti,hwmods = "timer9";
376 };
377
378 timer10: timer@48086000 {
379 compatible = "ti,omap5430-timer";
380 reg = <0x48086000 0x80>;
381 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
382 ti,hwmods = "timer10";
383 };
384
385 timer11: timer@48088000 {
386 compatible = "ti,omap5430-timer";
387 reg = <0x48088000 0x80>;
388 interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>;
389 ti,hwmods = "timer11";
390 ti,timer-pwm;
391 };
392
393 timer13: timer@48828000 {
394 compatible = "ti,omap5430-timer";
395 reg = <0x48828000 0x80>;
396 ti,hwmods = "timer13";
397 status = "disabled";
398 };
399
400 timer14: timer@4882a000 {
401 compatible = "ti,omap5430-timer";
402 reg = <0x4882a000 0x80>;
403 ti,hwmods = "timer14";
404 status = "disabled";
405 };
406
407 timer15: timer@4882c000 {
408 compatible = "ti,omap5430-timer";
409 reg = <0x4882c000 0x80>;
410 ti,hwmods = "timer15";
411 status = "disabled";
412 };
413
414 timer16: timer@4882e000 {
415 compatible = "ti,omap5430-timer";
416 reg = <0x4882e000 0x80>;
417 ti,hwmods = "timer16";
418 status = "disabled";
419 };
420
421 wdt2: wdt@4ae14000 {
422 compatible = "ti,omap4-wdt";
423 reg = <0x4ae14000 0x80>;
424 interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
425 ti,hwmods = "wd_timer2";
426 };
427
428 i2c1: i2c@48070000 {
429 compatible = "ti,omap4-i2c";
430 reg = <0x48070000 0x100>;
431 interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
432 #address-cells = <1>;
433 #size-cells = <0>;
434 ti,hwmods = "i2c1";
435 status = "disabled";
436 };
437
438 i2c2: i2c@48072000 {
439 compatible = "ti,omap4-i2c";
440 reg = <0x48072000 0x100>;
441 interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
442 #address-cells = <1>;
443 #size-cells = <0>;
444 ti,hwmods = "i2c2";
445 status = "disabled";
446 };
447
448 i2c3: i2c@48060000 {
449 compatible = "ti,omap4-i2c";
450 reg = <0x48060000 0x100>;
451 interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
452 #address-cells = <1>;
453 #size-cells = <0>;
454 ti,hwmods = "i2c3";
455 status = "disabled";
456 };
457
458 i2c4: i2c@4807a000 {
459 compatible = "ti,omap4-i2c";
460 reg = <0x4807a000 0x100>;
461 interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
462 #address-cells = <1>;
463 #size-cells = <0>;
464 ti,hwmods = "i2c4";
465 status = "disabled";
466 };
467
468 i2c5: i2c@4807c000 {
469 compatible = "ti,omap4-i2c";
470 reg = <0x4807c000 0x100>;
471 interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
472 #address-cells = <1>;
473 #size-cells = <0>;
474 ti,hwmods = "i2c5";
475 status = "disabled";
476 };
477
478 mmc1: mmc@4809c000 {
479 compatible = "ti,omap4-hsmmc";
480 reg = <0x4809c000 0x400>;
481 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
482 ti,hwmods = "mmc1";
483 ti,dual-volt;
484 ti,needs-special-reset;
485 dmas = <&sdma 61>, <&sdma 62>;
486 dma-names = "tx", "rx";
487 status = "disabled";
488 };
489
490 mmc2: mmc@480b4000 {
491 compatible = "ti,omap4-hsmmc";
492 reg = <0x480b4000 0x400>;
493 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
494 ti,hwmods = "mmc2";
495 ti,needs-special-reset;
496 dmas = <&sdma 47>, <&sdma 48>;
497 dma-names = "tx", "rx";
498 status = "disabled";
499 };
500
501 mmc3: mmc@480ad000 {
502 compatible = "ti,omap4-hsmmc";
503 reg = <0x480ad000 0x400>;
504 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
505 ti,hwmods = "mmc3";
506 ti,needs-special-reset;
507 dmas = <&sdma 77>, <&sdma 78>;
508 dma-names = "tx", "rx";
509 status = "disabled";
510 };
511
512 mmc4: mmc@480d1000 {
513 compatible = "ti,omap4-hsmmc";
514 reg = <0x480d1000 0x400>;
515 interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
516 ti,hwmods = "mmc4";
517 ti,needs-special-reset;
518 dmas = <&sdma 57>, <&sdma 58>;
519 dma-names = "tx", "rx";
520 status = "disabled";
521 };
522
523 mcspi1: spi@48098000 {
524 compatible = "ti,omap4-mcspi";
525 reg = <0x48098000 0x200>;
526 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
527 #address-cells = <1>;
528 #size-cells = <0>;
529 ti,hwmods = "mcspi1";
530 ti,spi-num-cs = <4>;
531 dmas = <&sdma 35>,
532 <&sdma 36>,
533 <&sdma 37>,
534 <&sdma 38>,
535 <&sdma 39>,
536 <&sdma 40>,
537 <&sdma 41>,
538 <&sdma 42>;
539 dma-names = "tx0", "rx0", "tx1", "rx1",
540 "tx2", "rx2", "tx3", "rx3";
541 status = "disabled";
542 };
543
544 mcspi2: spi@4809a000 {
545 compatible = "ti,omap4-mcspi";
546 reg = <0x4809a000 0x200>;
547 interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
548 #address-cells = <1>;
549 #size-cells = <0>;
550 ti,hwmods = "mcspi2";
551 ti,spi-num-cs = <2>;
552 dmas = <&sdma 43>,
553 <&sdma 44>,
554 <&sdma 45>,
555 <&sdma 46>;
556 dma-names = "tx0", "rx0", "tx1", "rx1";
557 status = "disabled";
558 };
559
560 mcspi3: spi@480b8000 {
561 compatible = "ti,omap4-mcspi";
562 reg = <0x480b8000 0x200>;
563 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
564 #address-cells = <1>;
565 #size-cells = <0>;
566 ti,hwmods = "mcspi3";
567 ti,spi-num-cs = <2>;
568 dmas = <&sdma 15>, <&sdma 16>;
569 dma-names = "tx0", "rx0";
570 status = "disabled";
571 };
572
573 mcspi4: spi@480ba000 {
574 compatible = "ti,omap4-mcspi";
575 reg = <0x480ba000 0x200>;
576 interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
577 #address-cells = <1>;
578 #size-cells = <0>;
579 ti,hwmods = "mcspi4";
580 ti,spi-num-cs = <1>;
581 dmas = <&sdma 70>, <&sdma 71>;
582 dma-names = "tx0", "rx0";
583 status = "disabled";
584 };
585 };
586};
diff --git a/arch/arm/boot/dts/ecx-common.dtsi b/arch/arm/boot/dts/ecx-common.dtsi
index e8559b753c9d..bc22557d7a6a 100644
--- a/arch/arm/boot/dts/ecx-common.dtsi
+++ b/arch/arm/boot/dts/ecx-common.dtsi
@@ -19,6 +19,14 @@
19 bootargs = "console=ttyAMA0"; 19 bootargs = "console=ttyAMA0";
20 }; 20 };
21 21
22 psci {
23 compatible = "arm,psci";
24 method = "smc";
25 cpu_suspend = <0x84000002>;
26 cpu_off = <0x84000004>;
27 cpu_on = <0x84000006>;
28 };
29
22 soc { 30 soc {
23 #address-cells = <1>; 31 #address-cells = <1>;
24 #size-cells = <1>; 32 #size-cells = <1>;
diff --git a/arch/arm/boot/dts/emev2-kzm9d-reference.dts b/arch/arm/boot/dts/emev2-kzm9d-reference.dts
deleted file mode 100644
index cceefda268b6..000000000000
--- a/arch/arm/boot/dts/emev2-kzm9d-reference.dts
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * Device Tree Source for the KZM9D board
3 *
4 * Copyright (C) 2013 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/dts-v1/;
11
12/include/ "emev2.dtsi"
13
14/ {
15 model = "EMEV2 KZM9D Board";
16 compatible = "renesas,kzm9d-reference", "renesas,emev2";
17
18 memory {
19 device_type = "memory";
20 reg = <0x40000000 0x8000000>;
21 };
22
23 chosen {
24 bootargs = "console=ttyS1,115200n81 ignore_loglevel root=/dev/nfs ip=dhcp";
25 };
26
27 reg_1p8v: regulator@0 {
28 compatible = "regulator-fixed";
29 regulator-name = "fixed-1.8V";
30 regulator-min-microvolt = <1800000>;
31 regulator-max-microvolt = <1800000>;
32 regulator-always-on;
33 regulator-boot-on;
34 };
35
36 reg_3p3v: regulator@1 {
37 compatible = "regulator-fixed";
38 regulator-name = "fixed-3.3V";
39 regulator-min-microvolt = <3300000>;
40 regulator-max-microvolt = <3300000>;
41 regulator-always-on;
42 regulator-boot-on;
43 };
44
45 lan9220@20000000 {
46 compatible = "smsc,lan9220", "smsc,lan9115";
47 reg = <0x20000000 0x10000>;
48 phy-mode = "mii";
49 interrupt-parent = <&gpio0>;
50 interrupts = <1 1>; /* active high */
51 reg-io-width = <4>;
52 smsc,irq-active-high;
53 smsc,irq-push-pull;
54 vddvario-supply = <&reg_1p8v>;
55 vdd33a-supply = <&reg_3p3v>;
56 };
57};
diff --git a/arch/arm/boot/dts/emev2-kzm9d.dts b/arch/arm/boot/dts/emev2-kzm9d.dts
index f92e812fdd9f..861aa7d6fc7d 100644
--- a/arch/arm/boot/dts/emev2-kzm9d.dts
+++ b/arch/arm/boot/dts/emev2-kzm9d.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * Device Tree Source for the KZM9D board 2 * Device Tree Source for the KZM9D board
3 * 3 *
4 * Copyright (C) 2012 Renesas Solutions Corp. 4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * 5 *
6 * This file is licensed under the terms of the GNU General Public License 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 7 * version 2. This program is licensed "as is" without any warranty of any
@@ -23,4 +23,35 @@
23 chosen { 23 chosen {
24 bootargs = "console=ttyS1,115200n81 ignore_loglevel root=/dev/nfs ip=dhcp"; 24 bootargs = "console=ttyS1,115200n81 ignore_loglevel root=/dev/nfs ip=dhcp";
25 }; 25 };
26
27 reg_1p8v: regulator@0 {
28 compatible = "regulator-fixed";
29 regulator-name = "fixed-1.8V";
30 regulator-min-microvolt = <1800000>;
31 regulator-max-microvolt = <1800000>;
32 regulator-always-on;
33 regulator-boot-on;
34 };
35
36 reg_3p3v: regulator@1 {
37 compatible = "regulator-fixed";
38 regulator-name = "fixed-3.3V";
39 regulator-min-microvolt = <3300000>;
40 regulator-max-microvolt = <3300000>;
41 regulator-always-on;
42 regulator-boot-on;
43 };
44
45 lan9220@20000000 {
46 compatible = "smsc,lan9220", "smsc,lan9115";
47 reg = <0x20000000 0x10000>;
48 phy-mode = "mii";
49 interrupt-parent = <&gpio0>;
50 interrupts = <1 1>; /* active high */
51 reg-io-width = <4>;
52 smsc,irq-active-high;
53 smsc,irq-push-pull;
54 vddvario-supply = <&reg_1p8v>;
55 vdd33a-supply = <&reg_3p3v>;
56 };
26}; 57};
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index caadc0257342..a73eeb5f258f 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -49,6 +49,12 @@
49 reg = <0x10000000 0x100>; 49 reg = <0x10000000 0x100>;
50 }; 50 };
51 51
52 mipi_phy: video-phy@10020710 {
53 compatible = "samsung,s5pv210-mipi-video-phy";
54 reg = <0x10020710 8>;
55 #phy-cells = <1>;
56 };
57
52 pd_mfc: mfc-power-domain@10023C40 { 58 pd_mfc: mfc-power-domain@10023C40 {
53 compatible = "samsung,exynos4210-pd"; 59 compatible = "samsung,exynos4210-pd";
54 reg = <0x10023C40 0x20>; 60 reg = <0x10023C40 0x20>;
@@ -161,6 +167,8 @@
161 clock-names = "csis", "sclk_csis"; 167 clock-names = "csis", "sclk_csis";
162 bus-width = <4>; 168 bus-width = <4>;
163 samsung,power-domain = <&pd_cam>; 169 samsung,power-domain = <&pd_cam>;
170 phys = <&mipi_phy 0>;
171 phy-names = "csis";
164 status = "disabled"; 172 status = "disabled";
165 #address-cells = <1>; 173 #address-cells = <1>;
166 #size-cells = <0>; 174 #size-cells = <0>;
@@ -174,6 +182,8 @@
174 clock-names = "csis", "sclk_csis"; 182 clock-names = "csis", "sclk_csis";
175 bus-width = <2>; 183 bus-width = <2>;
176 samsung,power-domain = <&pd_cam>; 184 samsung,power-domain = <&pd_cam>;
185 phys = <&mipi_phy 2>;
186 phy-names = "csis";
177 status = "disabled"; 187 status = "disabled";
178 #address-cells = <1>; 188 #address-cells = <1>;
179 #size-cells = <0>; 189 #size-cells = <0>;
diff --git a/arch/arm/boot/dts/exynos4210-origen.dts b/arch/arm/boot/dts/exynos4210-origen.dts
index 382d8c7e2906..1a12fb23767c 100644
--- a/arch/arm/boot/dts/exynos4210-origen.dts
+++ b/arch/arm/boot/dts/exynos4210-origen.dts
@@ -32,13 +32,20 @@
32 bootargs ="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC2,115200 init=/linuxrc"; 32 bootargs ="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC2,115200 init=/linuxrc";
33 }; 33 };
34 34
35 mmc_reg: voltage-regulator { 35 regulators {
36 compatible = "regulator-fixed"; 36 compatible = "simple-bus";
37 regulator-name = "VMEM_VDD_2.8V"; 37 #address-cells = <1>;
38 regulator-min-microvolt = <2800000>; 38 #size-cells = <0>;
39 regulator-max-microvolt = <2800000>; 39
40 gpio = <&gpx1 1 0>; 40 mmc_reg: regulator@0 {
41 enable-active-high; 41 compatible = "regulator-fixed";
42 reg = <0>;
43 regulator-name = "VMEM_VDD_2.8V";
44 regulator-min-microvolt = <2800000>;
45 regulator-max-microvolt = <2800000>;
46 gpio = <&gpx1 1 0>;
47 enable-active-high;
48 };
42 }; 49 };
43 50
44 tmu@100C0000 { 51 tmu@100C0000 {
@@ -192,7 +199,12 @@
192 }; 199 };
193 200
194 buck1_reg: BUCK1 { 201 buck1_reg: BUCK1 {
195 regulator-name = "VDD_ARM_1.2V"; 202 /*
203 * HACK: The real name is VDD_ARM_1.2V,
204 * but exynos-cpufreq does not support
205 * DT-based regulator lookup yet.
206 */
207 regulator-name = "vdd_arm";
196 regulator-min-microvolt = <950000>; 208 regulator-min-microvolt = <950000>;
197 regulator-max-microvolt = <1350000>; 209 regulator-max-microvolt = <1350000>;
198 regulator-always-on; 210 regulator-always-on;
diff --git a/arch/arm/boot/dts/exynos4210-trats.dts b/arch/arm/boot/dts/exynos4210-trats.dts
index 1c164f234bcc..63cc571ca307 100644
--- a/arch/arm/boot/dts/exynos4210-trats.dts
+++ b/arch/arm/boot/dts/exynos4210-trats.dts
@@ -290,7 +290,12 @@
290 }; 290 };
291 291
292 varm_breg: BUCK1 { 292 varm_breg: BUCK1 {
293 regulator-name = "VARM_1.2V_C210"; 293 /*
294 * HACK: The real name is VARM_1.2V_C210,
295 * but exynos-cpufreq does not support
296 * DT-based regulator lookup yet.
297 */
298 regulator-name = "vdd_arm";
294 regulator-min-microvolt = <900000>; 299 regulator-min-microvolt = <900000>;
295 regulator-max-microvolt = <1350000>; 300 regulator-max-microvolt = <1350000>;
296 regulator-always-on; 301 regulator-always-on;
diff --git a/arch/arm/boot/dts/exynos4210-universal_c210.dts b/arch/arm/boot/dts/exynos4210-universal_c210.dts
index 889cdada1ce9..d2e3f5f5916d 100644
--- a/arch/arm/boot/dts/exynos4210-universal_c210.dts
+++ b/arch/arm/boot/dts/exynos4210-universal_c210.dts
@@ -350,3 +350,7 @@
350 status = "okay"; 350 status = "okay";
351 }; 351 };
352}; 352};
353
354&mdma1 {
355 reg = <0x12840000 0x1000>;
356};
diff --git a/arch/arm/boot/dts/exynos4412-origen.dts b/arch/arm/boot/dts/exynos4412-origen.dts
index 8768b03702e5..d65984c440f6 100644
--- a/arch/arm/boot/dts/exynos4412-origen.dts
+++ b/arch/arm/boot/dts/exynos4412-origen.dts
@@ -32,13 +32,20 @@
32 reg = <0x0203F000 0x1000>; 32 reg = <0x0203F000 0x1000>;
33 }; 33 };
34 34
35 mmc_reg: voltage-regulator { 35 regulators {
36 compatible = "regulator-fixed"; 36 compatible = "simple-bus";
37 regulator-name = "VMEM_VDD_2.8V"; 37 #address-cells = <1>;
38 regulator-min-microvolt = <2800000>; 38 #size-cells = <0>;
39 regulator-max-microvolt = <2800000>; 39
40 gpio = <&gpx1 1 0>; 40 mmc_reg: regulator@0 {
41 enable-active-high; 41 compatible = "regulator-fixed";
42 reg = <0>;
43 regulator-name = "VMEM_VDD_2.8V";
44 regulator-min-microvolt = <2800000>;
45 regulator-max-microvolt = <2800000>;
46 gpio = <&gpx1 1 0>;
47 enable-active-high;
48 };
42 }; 49 };
43 50
44 pinctrl@11000000 { 51 pinctrl@11000000 {
diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
index cee55fa33731..684527087aa4 100644
--- a/arch/arm/boot/dts/exynos5250-arndale.dts
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -324,7 +324,14 @@
324 }; 324 };
325 325
326 i2c@12C80000 { 326 i2c@12C80000 {
327 status = "disabled"; 327 samsung,i2c-sda-delay = <100>;
328 samsung,i2c-max-bus-freq = <66000>;
329 samsung,i2c-slave-addr = <0x50>;
330
331 hdmiddc@50 {
332 compatible = "samsung,exynos4210-hdmiddc";
333 reg = <0x50>;
334 };
328 }; 335 };
329 336
330 i2c@12C90000 { 337 i2c@12C90000 {
@@ -362,6 +369,17 @@
362 status = "disabled"; 369 status = "disabled";
363 }; 370 };
364 371
372 i2c@12CE0000 {
373 samsung,i2c-sda-delay = <100>;
374 samsung,i2c-max-bus-freq = <66000>;
375 samsung,i2c-slave-addr = <0x38>;
376
377 hdmiphy@38 {
378 compatible = "samsung,exynos4212-hdmiphy";
379 reg = <0x38>;
380 };
381 };
382
365 i2c@121D0000 { 383 i2c@121D0000 {
366 status = "disabled"; 384 status = "disabled";
367 }; 385 };
@@ -412,6 +430,10 @@
412 status = "disabled"; 430 status = "disabled";
413 }; 431 };
414 432
433 i2s0: i2s@03830000 {
434 status = "okay";
435 };
436
415 spi_0: spi@12d20000 { 437 spi_0: spi@12d20000 {
416 status = "disabled"; 438 status = "disabled";
417 }; 439 };
@@ -482,13 +504,15 @@
482 #address-cells = <1>; 504 #address-cells = <1>;
483 #size-cells = <0>; 505 #size-cells = <0>;
484 506
485 main_dc_reg: fixedregulator@1 { 507 main_dc_reg: regulator@0 {
486 compatible = "regulator-fixed"; 508 compatible = "regulator-fixed";
509 reg = <0>;
487 regulator-name = "MAIN_DC"; 510 regulator-name = "MAIN_DC";
488 }; 511 };
489 512
490 mmc_reg: voltage-regulator { 513 mmc_reg: regulator@1 {
491 compatible = "regulator-fixed"; 514 compatible = "regulator-fixed";
515 reg = <1>;
492 regulator-name = "VDD_33ON_2.8V"; 516 regulator-name = "VDD_33ON_2.8V";
493 regulator-min-microvolt = <2800000>; 517 regulator-min-microvolt = <2800000>;
494 regulator-max-microvolt = <2800000>; 518 regulator-max-microvolt = <2800000>;
@@ -496,8 +520,9 @@
496 enable-active-high; 520 enable-active-high;
497 }; 521 };
498 522
499 reg_hdmi_en: fixedregulator@0 { 523 reg_hdmi_en: regulator@2 {
500 compatible = "regulator-fixed"; 524 compatible = "regulator-fixed";
525 reg = <2>;
501 regulator-name = "hdmi-en"; 526 regulator-name = "hdmi-en";
502 }; 527 };
503 }; 528 };
diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
index 724a22f9b1c8..9a49e6804ae1 100644
--- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
@@ -210,21 +210,21 @@
210 samsung,pins = "gpa0-2", "gpa0-3"; 210 samsung,pins = "gpa0-2", "gpa0-3";
211 samsung,pin-function = <2>; 211 samsung,pin-function = <2>;
212 samsung,pin-pud = <0>; 212 samsung,pin-pud = <0>;
213 samaung,pin-drv = <0>; 213 samsung,pin-drv = <0>;
214 }; 214 };
215 215
216 i2c2_bus: i2c2-bus { 216 i2c2_bus: i2c2-bus {
217 samsung,pins = "gpa0-6", "gpa0-7"; 217 samsung,pins = "gpa0-6", "gpa0-7";
218 samsung,pin-function = <3>; 218 samsung,pin-function = <3>;
219 samsung,pin-pud = <3>; 219 samsung,pin-pud = <3>;
220 samaung,pin-drv = <0>; 220 samsung,pin-drv = <0>;
221 }; 221 };
222 222
223 i2c2_hs_bus: i2c2-hs-bus { 223 i2c2_hs_bus: i2c2-hs-bus {
224 samsung,pins = "gpa0-6", "gpa0-7"; 224 samsung,pins = "gpa0-6", "gpa0-7";
225 samsung,pin-function = <4>; 225 samsung,pin-function = <4>;
226 samsung,pin-pud = <3>; 226 samsung,pin-pud = <3>;
227 samaung,pin-drv = <0>; 227 samsung,pin-drv = <0>;
228 }; 228 };
229 229
230 uart2_data: uart2-data { 230 uart2_data: uart2-data {
@@ -238,21 +238,21 @@
238 samsung,pins = "gpa1-2", "gpa1-3"; 238 samsung,pins = "gpa1-2", "gpa1-3";
239 samsung,pin-function = <2>; 239 samsung,pin-function = <2>;
240 samsung,pin-pud = <0>; 240 samsung,pin-pud = <0>;
241 samaung,pin-drv = <0>; 241 samsung,pin-drv = <0>;
242 }; 242 };
243 243
244 i2c3_bus: i2c3-bus { 244 i2c3_bus: i2c3-bus {
245 samsung,pins = "gpa1-2", "gpa1-3"; 245 samsung,pins = "gpa1-2", "gpa1-3";
246 samsung,pin-function = <3>; 246 samsung,pin-function = <3>;
247 samsung,pin-pud = <3>; 247 samsung,pin-pud = <3>;
248 samaung,pin-drv = <0>; 248 samsung,pin-drv = <0>;
249 }; 249 };
250 250
251 i2c3_hs_bus: i2c3-hs-bus { 251 i2c3_hs_bus: i2c3-hs-bus {
252 samsung,pins = "gpa1-2", "gpa1-3"; 252 samsung,pins = "gpa1-2", "gpa1-3";
253 samsung,pin-function = <4>; 253 samsung,pin-function = <4>;
254 samsung,pin-pud = <3>; 254 samsung,pin-pud = <3>;
255 samaung,pin-drv = <0>; 255 samsung,pin-drv = <0>;
256 }; 256 };
257 257
258 uart3_data: uart3-data { 258 uart3_data: uart3-data {
@@ -273,14 +273,14 @@
273 samsung,pins = "gpa2-0", "gpa2-1"; 273 samsung,pins = "gpa2-0", "gpa2-1";
274 samsung,pin-function = <3>; 274 samsung,pin-function = <3>;
275 samsung,pin-pud = <3>; 275 samsung,pin-pud = <3>;
276 samaung,pin-drv = <0>; 276 samsung,pin-drv = <0>;
277 }; 277 };
278 278
279 i2c5_bus: i2c5-bus { 279 i2c5_bus: i2c5-bus {
280 samsung,pins = "gpa2-2", "gpa2-3"; 280 samsung,pins = "gpa2-2", "gpa2-3";
281 samsung,pin-function = <3>; 281 samsung,pin-function = <3>;
282 samsung,pin-pud = <3>; 282 samsung,pin-pud = <3>;
283 samaung,pin-drv = <0>; 283 samsung,pin-drv = <0>;
284 }; 284 };
285 285
286 spi1_bus: spi1-bus { 286 spi1_bus: spi1-bus {
@@ -376,14 +376,14 @@
376 samsung,pins = "gpb3-0", "gpb3-1"; 376 samsung,pins = "gpb3-0", "gpb3-1";
377 samsung,pin-function = <4>; 377 samsung,pin-function = <4>;
378 samsung,pin-pud = <3>; 378 samsung,pin-pud = <3>;
379 samaung,pin-drv = <0>; 379 samsung,pin-drv = <0>;
380 }; 380 };
381 381
382 i2c1_hs_bus: i2c1-hs-bus { 382 i2c1_hs_bus: i2c1-hs-bus {
383 samsung,pins = "gpb3-2", "gpb3-3"; 383 samsung,pins = "gpb3-2", "gpb3-3";
384 samsung,pin-function = <4>; 384 samsung,pin-function = <4>;
385 samsung,pin-pud = <3>; 385 samsung,pin-pud = <3>;
386 samaung,pin-drv = <0>; 386 samsung,pin-drv = <0>;
387 }; 387 };
388 388
389 sd0_clk: sd0-clk { 389 sd0_clk: sd0-clk {
@@ -551,14 +551,14 @@
551 samsung,pins = "gpd0-2", "gpd0-3"; 551 samsung,pins = "gpd0-2", "gpd0-3";
552 samsung,pin-function = <2>; 552 samsung,pin-function = <2>;
553 samsung,pin-pud = <0>; 553 samsung,pin-pud = <0>;
554 samaung,pin-drv = <0>; 554 samsung,pin-drv = <0>;
555 }; 555 };
556 556
557 dp_hpd: dp_hpd { 557 dp_hpd: dp_hpd {
558 samsung,pins = "gpx0-7"; 558 samsung,pins = "gpx0-7";
559 samsung,pin-function = <3>; 559 samsung,pin-function = <3>;
560 samsung,pin-pud = <0>; 560 samsung,pin-pud = <0>;
561 samaung,pin-drv = <0>; 561 samsung,pin-drv = <0>;
562 }; 562 };
563 }; 563 };
564 564
@@ -649,42 +649,42 @@
649 "gpf1-0", "gpf1-1", "gpf1-2", "gpf1-3"; 649 "gpf1-0", "gpf1-1", "gpf1-2", "gpf1-3";
650 samsung,pin-function = <3>; 650 samsung,pin-function = <3>;
651 samsung,pin-pud = <0>; 651 samsung,pin-pud = <0>;
652 samaung,pin-drv = <0>; 652 samsung,pin-drv = <0>;
653 }; 653 };
654 654
655 cam_i2c2_bus: cam-i2c2-bus { 655 cam_i2c2_bus: cam-i2c2-bus {
656 samsung,pins = "gpe0-6", "gpe1-0"; 656 samsung,pins = "gpe0-6", "gpe1-0";
657 samsung,pin-function = <4>; 657 samsung,pin-function = <4>;
658 samsung,pin-pud = <3>; 658 samsung,pin-pud = <3>;
659 samaung,pin-drv = <0>; 659 samsung,pin-drv = <0>;
660 }; 660 };
661 661
662 cam_spi1_bus: cam-spi1-bus { 662 cam_spi1_bus: cam-spi1-bus {
663 samsung,pins = "gpe0-4", "gpe0-5", "gpf0-2", "gpf0-3"; 663 samsung,pins = "gpe0-4", "gpe0-5", "gpf0-2", "gpf0-3";
664 samsung,pin-function = <4>; 664 samsung,pin-function = <4>;
665 samsung,pin-pud = <0>; 665 samsung,pin-pud = <0>;
666 samaung,pin-drv = <0>; 666 samsung,pin-drv = <0>;
667 }; 667 };
668 668
669 cam_i2c1_bus: cam-i2c1-bus { 669 cam_i2c1_bus: cam-i2c1-bus {
670 samsung,pins = "gpf0-2", "gpf0-3"; 670 samsung,pins = "gpf0-2", "gpf0-3";
671 samsung,pin-function = <2>; 671 samsung,pin-function = <2>;
672 samsung,pin-pud = <3>; 672 samsung,pin-pud = <3>;
673 samaung,pin-drv = <0>; 673 samsung,pin-drv = <0>;
674 }; 674 };
675 675
676 cam_i2c0_bus: cam-i2c0-bus { 676 cam_i2c0_bus: cam-i2c0-bus {
677 samsung,pins = "gpf0-0", "gpf0-1"; 677 samsung,pins = "gpf0-0", "gpf0-1";
678 samsung,pin-function = <2>; 678 samsung,pin-function = <2>;
679 samsung,pin-pud = <3>; 679 samsung,pin-pud = <3>;
680 samaung,pin-drv = <0>; 680 samsung,pin-drv = <0>;
681 }; 681 };
682 682
683 cam_spi0_bus: cam-spi0-bus { 683 cam_spi0_bus: cam-spi0-bus {
684 samsung,pins = "gpf1-0", "gpf1-1", "gpf1-2", "gpf1-3"; 684 samsung,pins = "gpf1-0", "gpf1-1", "gpf1-2", "gpf1-3";
685 samsung,pin-function = <2>; 685 samsung,pin-function = <2>;
686 samsung,pin-pud = <0>; 686 samsung,pin-pud = <0>;
687 samaung,pin-drv = <0>; 687 samsung,pin-drv = <0>;
688 }; 688 };
689 689
690 cam_bayrgb_bus: cam-bayrgb-bus { 690 cam_bayrgb_bus: cam-bayrgb-bus {
@@ -695,7 +695,7 @@
695 "gpg2-0", "gpg2-1"; 695 "gpg2-0", "gpg2-1";
696 samsung,pin-function = <2>; 696 samsung,pin-function = <2>;
697 samsung,pin-pud = <0>; 697 samsung,pin-pud = <0>;
698 samaung,pin-drv = <0>; 698 samsung,pin-drv = <0>;
699 }; 699 };
700 700
701 cam_port_a: cam-port-a { 701 cam_port_a: cam-port-a {
@@ -704,7 +704,7 @@
704 "gph1-4", "gph1-5", "gph1-6", "gph1-7"; 704 "gph1-4", "gph1-5", "gph1-6", "gph1-7";
705 samsung,pin-function = <2>; 705 samsung,pin-function = <2>;
706 samsung,pin-pud = <0>; 706 samsung,pin-pud = <0>;
707 samaung,pin-drv = <0>; 707 samsung,pin-drv = <0>;
708 }; 708 };
709 }; 709 };
710 710
@@ -756,7 +756,7 @@
756 "gpv1-4", "gpv1-5", "gpv1-6", "gpv1-7"; 756 "gpv1-4", "gpv1-5", "gpv1-6", "gpv1-7";
757 samsung,pin-function = <2>; 757 samsung,pin-function = <2>;
758 samsung,pin-pud = <0>; 758 samsung,pin-pud = <0>;
759 samaung,pin-drv = <0>; 759 samsung,pin-drv = <0>;
760 }; 760 };
761 761
762 c2c_txd: c2c-txd { 762 c2c_txd: c2c-txd {
@@ -766,7 +766,7 @@
766 "gpv3-4", "gpv3-5", "gpv3-6", "gpv3-7"; 766 "gpv3-4", "gpv3-5", "gpv3-6", "gpv3-7";
767 samsung,pin-function = <2>; 767 samsung,pin-function = <2>;
768 samsung,pin-pud = <0>; 768 samsung,pin-pud = <0>;
769 samaung,pin-drv = <0>; 769 samsung,pin-drv = <0>;
770 }; 770 };
771 }; 771 };
772 772
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 2538b329f2ce..f86d56760a45 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -231,14 +231,6 @@
231 status = "okay"; 231 status = "okay";
232 }; 232 };
233 233
234 i2s1: i2s@12D60000 {
235 status = "disabled";
236 };
237
238 i2s2: i2s@12D70000 {
239 status = "disabled";
240 };
241
242 sound { 234 sound {
243 compatible = "samsung,smdk-wm8994"; 235 compatible = "samsung,smdk-wm8994";
244 236
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index 7d7cc777ff7b..9db5047812f3 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -96,6 +96,11 @@
96 <1 14 0xf08>, 96 <1 14 0xf08>,
97 <1 11 0xf08>, 97 <1 11 0xf08>,
98 <1 10 0xf08>; 98 <1 10 0xf08>;
99 /* Unfortunately we need this since some versions of U-Boot
100 * on Exynos don't set the CNTFRQ register, so we need the
101 * value from DT.
102 */
103 clock-frequency = <24000000>;
99 }; 104 };
100 105
101 mct@101C0000 { 106 mct@101C0000 {
@@ -417,6 +422,7 @@
417 422
418 i2s0: i2s@03830000 { 423 i2s0: i2s@03830000 {
419 compatible = "samsung,s5pv210-i2s"; 424 compatible = "samsung,s5pv210-i2s";
425 status = "disabled";
420 reg = <0x03830000 0x100>; 426 reg = <0x03830000 0x100>;
421 dmas = <&pdma0 10 427 dmas = <&pdma0 10
422 &pdma0 9 428 &pdma0 9
@@ -433,6 +439,7 @@
433 439
434 i2s1: i2s@12D60000 { 440 i2s1: i2s@12D60000 {
435 compatible = "samsung,s3c6410-i2s"; 441 compatible = "samsung,s3c6410-i2s";
442 status = "disabled";
436 reg = <0x12D60000 0x100>; 443 reg = <0x12D60000 0x100>;
437 dmas = <&pdma1 12 444 dmas = <&pdma1 12
438 &pdma1 11>; 445 &pdma1 11>;
@@ -445,6 +452,7 @@
445 452
446 i2s2: i2s@12D70000 { 453 i2s2: i2s@12D70000 {
447 compatible = "samsung,s3c6410-i2s"; 454 compatible = "samsung,s3c6410-i2s";
455 status = "disabled";
448 reg = <0x12D70000 0x100>; 456 reg = <0x12D70000 0x100>;
449 dmas = <&pdma0 12 457 dmas = <&pdma0 12
450 &pdma0 11>; 458 &pdma0 11>;
@@ -610,16 +618,18 @@
610 compatible = "samsung,exynos4212-hdmi"; 618 compatible = "samsung,exynos4212-hdmi";
611 reg = <0x14530000 0x70000>; 619 reg = <0x14530000 0x70000>;
612 interrupts = <0 95 0>; 620 interrupts = <0 95 0>;
613 clocks = <&clock 333>, <&clock 136>, <&clock 137>, 621 clocks = <&clock 344>, <&clock 136>, <&clock 137>,
614 <&clock 333>, <&clock 333>; 622 <&clock 159>, <&clock 1024>;
615 clock-names = "hdmi", "sclk_hdmi", "sclk_pixel", 623 clock-names = "hdmi", "sclk_hdmi", "sclk_pixel",
616 "sclk_hdmiphy", "hdmiphy"; 624 "sclk_hdmiphy", "mout_hdmi";
617 }; 625 };
618 626
619 mixer { 627 mixer {
620 compatible = "samsung,exynos5250-mixer"; 628 compatible = "samsung,exynos5250-mixer";
621 reg = <0x14450000 0x10000>; 629 reg = <0x14450000 0x10000>;
622 interrupts = <0 94 0>; 630 interrupts = <0 94 0>;
631 clocks = <&clock 343>, <&clock 136>;
632 clock-names = "mixer", "sclk_hdmi";
623 }; 633 };
624 634
625 dp_phy: video-phy@10040720 { 635 dp_phy: video-phy@10040720 {
diff --git a/arch/arm/boot/dts/exynos5420-smdk5420.dts b/arch/arm/boot/dts/exynos5420-smdk5420.dts
index bafba25ba7c2..79524c74c603 100644
--- a/arch/arm/boot/dts/exynos5420-smdk5420.dts
+++ b/arch/arm/boot/dts/exynos5420-smdk5420.dts
@@ -61,4 +61,30 @@
61 }; 61 };
62 }; 62 };
63 63
64 pinctrl@13400000 {
65 hdmi_hpd_irq: hdmi-hpd-irq {
66 samsung,pins = "gpx3-7";
67 samsung,pin-function = <0>;
68 samsung,pin-pud = <1>;
69 samsung,pin-drv = <0>;
70 };
71 };
72
73 hdmi@14530000 {
74 status = "okay";
75 hpd-gpio = <&gpx3 7 0>;
76 pinctrl-names = "default";
77 pinctrl-0 = <&hdmi_hpd_irq>;
78 };
79
80 i2c_2: i2c@12C80000 {
81 samsung,i2c-sda-delay = <100>;
82 samsung,i2c-max-bus-freq = <66000>;
83 status = "okay";
84
85 hdmiddc@50 {
86 compatible = "samsung,exynos4210-hdmiddc";
87 reg = <0x50>;
88 };
89 };
64}; 90};
diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
index d537cd704e19..09aa06cb3d3a 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -27,6 +27,10 @@
27 pinctrl2 = &pinctrl_2; 27 pinctrl2 = &pinctrl_2;
28 pinctrl3 = &pinctrl_3; 28 pinctrl3 = &pinctrl_3;
29 pinctrl4 = &pinctrl_4; 29 pinctrl4 = &pinctrl_4;
30 i2c0 = &i2c_0;
31 i2c1 = &i2c_1;
32 i2c2 = &i2c_2;
33 i2c3 = &i2c_3;
30 }; 34 };
31 35
32 cpus { 36 cpus {
@@ -235,4 +239,75 @@
235 io-channel-ranges; 239 io-channel-ranges;
236 status = "disabled"; 240 status = "disabled";
237 }; 241 };
242
243 i2c_0: i2c@12C60000 {
244 compatible = "samsung,s3c2440-i2c";
245 reg = <0x12C60000 0x100>;
246 interrupts = <0 56 0>;
247 #address-cells = <1>;
248 #size-cells = <0>;
249 clocks = <&clock 261>;
250 clock-names = "i2c";
251 pinctrl-names = "default";
252 pinctrl-0 = <&i2c0_bus>;
253 status = "disabled";
254 };
255
256 i2c_1: i2c@12C70000 {
257 compatible = "samsung,s3c2440-i2c";
258 reg = <0x12C70000 0x100>;
259 interrupts = <0 57 0>;
260 #address-cells = <1>;
261 #size-cells = <0>;
262 clocks = <&clock 262>;
263 clock-names = "i2c";
264 pinctrl-names = "default";
265 pinctrl-0 = <&i2c1_bus>;
266 status = "disabled";
267 };
268
269 i2c_2: i2c@12C80000 {
270 compatible = "samsung,s3c2440-i2c";
271 reg = <0x12C80000 0x100>;
272 interrupts = <0 58 0>;
273 #address-cells = <1>;
274 #size-cells = <0>;
275 clocks = <&clock 263>;
276 clock-names = "i2c";
277 pinctrl-names = "default";
278 pinctrl-0 = <&i2c2_bus>;
279 status = "disabled";
280 };
281
282 i2c_3: i2c@12C90000 {
283 compatible = "samsung,s3c2440-i2c";
284 reg = <0x12C90000 0x100>;
285 interrupts = <0 59 0>;
286 #address-cells = <1>;
287 #size-cells = <0>;
288 clocks = <&clock 264>;
289 clock-names = "i2c";
290 pinctrl-names = "default";
291 pinctrl-0 = <&i2c3_bus>;
292 status = "disabled";
293 };
294
295 hdmi@14530000 {
296 compatible = "samsung,exynos4212-hdmi";
297 reg = <0x14530000 0x70000>;
298 interrupts = <0 95 0>;
299 clocks = <&clock 413>, <&clock 143>, <&clock 768>,
300 <&clock 158>, <&clock 640>;
301 clock-names = "hdmi", "sclk_hdmi", "sclk_pixel",
302 "sclk_hdmiphy", "mout_hdmi";
303 status = "disabled";
304 };
305
306 mixer@14450000 {
307 compatible = "samsung,exynos5420-mixer";
308 reg = <0x14450000 0x10000>;
309 interrupts = <0 94 0>;
310 clocks = <&clock 431>, <&clock 143>;
311 clock-names = "mixer", "sclk_hdmi";
312 };
238}; 313};
diff --git a/arch/arm/boot/dts/exynos5440-sd5v1.dts b/arch/arm/boot/dts/exynos5440-sd5v1.dts
index 5b22508050da..777fb1c2c70f 100644
--- a/arch/arm/boot/dts/exynos5440-sd5v1.dts
+++ b/arch/arm/boot/dts/exynos5440-sd5v1.dts
@@ -17,7 +17,7 @@
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 mem=6144M@0x100000000 console=ttySAC0,115200"; 20 bootargs = "root=/dev/sda2 rw rootwait ignore_loglevel earlyprintk 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 ede772741f81..d58cb787061a 100644
--- a/arch/arm/boot/dts/exynos5440-ssdk5440.dts
+++ b/arch/arm/boot/dts/exynos5440-ssdk5440.dts
@@ -17,7 +17,7 @@
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 mem=6144M@0x100000000 console=ttySAC0,115200"; 20 bootargs = "root=/dev/sda2 rw rootwait ignore_loglevel earlyprintk no_console_suspend mem=2048M@0x80000000 mem=6144M@0x100000000 console=ttySAC0,115200";
21 }; 21 };
22 22
23 spi_0: spi@D0000 { 23 spi_0: spi@D0000 {
@@ -68,9 +68,11 @@
68 68
69 pcie@290000 { 69 pcie@290000 {
70 reset-gpio = <&pin_ctrl 5 0>; 70 reset-gpio = <&pin_ctrl 5 0>;
71 status = "okay";
71 }; 72 };
72 73
73 pcie@2a0000 { 74 pcie@2a0000 {
74 reset-gpio = <&pin_ctrl 22 0>; 75 reset-gpio = <&pin_ctrl 22 0>;
76 status = "okay";
75 }; 77 };
76}; 78};
diff --git a/arch/arm/boot/dts/exynos5440.dtsi b/arch/arm/boot/dts/exynos5440.dtsi
index 5d6cf4965d6e..8da107088ce4 100644
--- a/arch/arm/boot/dts/exynos5440.dtsi
+++ b/arch/arm/boot/dts/exynos5440.dtsi
@@ -276,6 +276,7 @@
276 interrupt-map-mask = <0 0 0 0>; 276 interrupt-map-mask = <0 0 0 0>;
277 interrupt-map = <0x0 0 &gic 53>; 277 interrupt-map = <0x0 0 &gic 53>;
278 num-lanes = <4>; 278 num-lanes = <4>;
279 status = "disabled";
279 }; 280 };
280 281
281 pcie@2a0000 { 282 pcie@2a0000 {
@@ -296,5 +297,6 @@
296 interrupt-map-mask = <0 0 0 0>; 297 interrupt-map-mask = <0 0 0 0>;
297 interrupt-map = <0x0 0 &gic 56>; 298 interrupt-map = <0x0 0 &gic 56>;
298 num-lanes = <4>; 299 num-lanes = <4>;
300 status = "disabled";
299 }; 301 };
300}; 302};
diff --git a/arch/arm/boot/dts/imx23-evk.dts b/arch/arm/boot/dts/imx23-evk.dts
index 185c7c01102a..1f026adefd45 100644
--- a/arch/arm/boot/dts/imx23-evk.dts
+++ b/arch/arm/boot/dts/imx23-evk.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "imx23.dtsi" 13#include "imx23.dtsi"
14 14
15/ { 15/ {
16 model = "Freescale i.MX23 Evaluation Kit"; 16 model = "Freescale i.MX23 Evaluation Kit";
@@ -45,14 +45,14 @@
45 hog_pins_a: hog@0 { 45 hog_pins_a: hog@0 {
46 reg = <0>; 46 reg = <0>;
47 fsl,pinmux-ids = < 47 fsl,pinmux-ids = <
48 0x1123 /* MX23_PAD_LCD_RESET__GPIO_1_18 */ 48 MX23_PAD_LCD_RESET__GPIO_1_18
49 0x11d3 /* MX23_PAD_PWM3__GPIO_1_29 */ 49 MX23_PAD_PWM3__GPIO_1_29
50 0x11e3 /* MX23_PAD_PWM4__GPIO_1_30 */ 50 MX23_PAD_PWM4__GPIO_1_30
51 0x2010 /* MX23_PAD_SSP1_DETECT__SSP1_DETECT */ 51 MX23_PAD_SSP1_DETECT__SSP1_DETECT
52 >; 52 >;
53 fsl,drive-strength = <0>; 53 fsl,drive-strength = <MXS_DRIVE_4mA>;
54 fsl,voltage = <1>; 54 fsl,voltage = <MXS_VOLTAGE_HIGH>;
55 fsl,pull-up = <0>; 55 fsl,pull-up = <MXS_PULL_DISABLE>;
56 }; 56 };
57 }; 57 };
58 58
diff --git a/arch/arm/boot/dts/imx23-olinuxino.dts b/arch/arm/boot/dts/imx23-olinuxino.dts
index fc766ae12e24..526bfdbd87f9 100644
--- a/arch/arm/boot/dts/imx23-olinuxino.dts
+++ b/arch/arm/boot/dts/imx23-olinuxino.dts
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14/dts-v1/; 14/dts-v1/;
15/include/ "imx23.dtsi" 15#include "imx23.dtsi"
16 16
17/ { 17/ {
18 model = "i.MX23 Olinuxino Low Cost Board"; 18 model = "i.MX23 Olinuxino Low Cost Board";
@@ -40,21 +40,21 @@
40 hog_pins_a: hog@0 { 40 hog_pins_a: hog@0 {
41 reg = <0>; 41 reg = <0>;
42 fsl,pinmux-ids = < 42 fsl,pinmux-ids = <
43 0x0113 /* MX23_PAD_GPMI_ALE__GPIO_0_17 */ 43 MX23_PAD_GPMI_ALE__GPIO_0_17
44 >; 44 >;
45 fsl,drive-strength = <0>; 45 fsl,drive-strength = <MXS_DRIVE_4mA>;
46 fsl,voltage = <1>; 46 fsl,voltage = <MXS_VOLTAGE_HIGH>;
47 fsl,pull-up = <0>; 47 fsl,pull-up = <MXS_PULL_DISABLE>;
48 }; 48 };
49 49
50 led_pin_gpio2_1: led_gpio2_1@0 { 50 led_pin_gpio2_1: led_gpio2_1@0 {
51 reg = <0>; 51 reg = <0>;
52 fsl,pinmux-ids = < 52 fsl,pinmux-ids = <
53 0x2013 /* MX23_PAD_SSP1_DETECT__GPIO_2_1 */ 53 MX23_PAD_SSP1_DETECT__GPIO_2_1
54 >; 54 >;
55 fsl,drive-strength = <0>; 55 fsl,drive-strength = <MXS_DRIVE_4mA>;
56 fsl,voltage = <1>; 56 fsl,voltage = <MXS_VOLTAGE_HIGH>;
57 fsl,pull-up = <0>; 57 fsl,pull-up = <MXS_PULL_DISABLE>;
58 }; 58 };
59 }; 59 };
60 60
diff --git a/arch/arm/boot/dts/imx23-pinfunc.h b/arch/arm/boot/dts/imx23-pinfunc.h
new file mode 100644
index 000000000000..5c0f32ca3a93
--- /dev/null
+++ b/arch/arm/boot/dts/imx23-pinfunc.h
@@ -0,0 +1,333 @@
1/*
2 * Header providing constants for i.MX23 pinctrl bindings.
3 *
4 * Copyright (C) 2013 Lothar Waßmann <LW@KARO-electronics.de>
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 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#ifndef __DT_BINDINGS_MX23_PINCTRL_H__
15#define __DT_BINDINGS_MX23_PINCTRL_H__
16
17#include "mxs-pinfunc.h"
18
19#define MX23_PAD_GPMI_D00__GPMI_D00 0x0000
20#define MX23_PAD_GPMI_D01__GPMI_D01 0x0010
21#define MX23_PAD_GPMI_D02__GPMI_D02 0x0020
22#define MX23_PAD_GPMI_D03__GPMI_D03 0x0030
23#define MX23_PAD_GPMI_D04__GPMI_D04 0x0040
24#define MX23_PAD_GPMI_D05__GPMI_D05 0x0050
25#define MX23_PAD_GPMI_D06__GPMI_D06 0x0060
26#define MX23_PAD_GPMI_D07__GPMI_D07 0x0070
27#define MX23_PAD_GPMI_D08__GPMI_D08 0x0080
28#define MX23_PAD_GPMI_D09__GPMI_D09 0x0090
29#define MX23_PAD_GPMI_D10__GPMI_D10 0x00a0
30#define MX23_PAD_GPMI_D11__GPMI_D11 0x00b0
31#define MX23_PAD_GPMI_D12__GPMI_D12 0x00c0
32#define MX23_PAD_GPMI_D13__GPMI_D13 0x00d0
33#define MX23_PAD_GPMI_D14__GPMI_D14 0x00e0
34#define MX23_PAD_GPMI_D15__GPMI_D15 0x00f0
35#define MX23_PAD_GPMI_CLE__GPMI_CLE 0x0100
36#define MX23_PAD_GPMI_ALE__GPMI_ALE 0x0110
37#define MX23_PAD_GPMI_CE2N__GPMI_CE2N 0x0120
38#define MX23_PAD_GPMI_RDY0__GPMI_RDY0 0x0130
39#define MX23_PAD_GPMI_RDY1__GPMI_RDY1 0x0140
40#define MX23_PAD_GPMI_RDY2__GPMI_RDY2 0x0150
41#define MX23_PAD_GPMI_RDY3__GPMI_RDY3 0x0160
42#define MX23_PAD_GPMI_WPN__GPMI_WPN 0x0170
43#define MX23_PAD_GPMI_WRN__GPMI_WRN 0x0180
44#define MX23_PAD_GPMI_RDN__GPMI_RDN 0x0190
45#define MX23_PAD_AUART1_CTS__AUART1_CTS 0x01a0
46#define MX23_PAD_AUART1_RTS__AUART1_RTS 0x01b0
47#define MX23_PAD_AUART1_RX__AUART1_RX 0x01c0
48#define MX23_PAD_AUART1_TX__AUART1_TX 0x01d0
49#define MX23_PAD_I2C_SCL__I2C_SCL 0x01e0
50#define MX23_PAD_I2C_SDA__I2C_SDA 0x01f0
51#define MX23_PAD_LCD_D00__LCD_D00 0x1000
52#define MX23_PAD_LCD_D01__LCD_D01 0x1010
53#define MX23_PAD_LCD_D02__LCD_D02 0x1020
54#define MX23_PAD_LCD_D03__LCD_D03 0x1030
55#define MX23_PAD_LCD_D04__LCD_D04 0x1040
56#define MX23_PAD_LCD_D05__LCD_D05 0x1050
57#define MX23_PAD_LCD_D06__LCD_D06 0x1060
58#define MX23_PAD_LCD_D07__LCD_D07 0x1070
59#define MX23_PAD_LCD_D08__LCD_D08 0x1080
60#define MX23_PAD_LCD_D09__LCD_D09 0x1090
61#define MX23_PAD_LCD_D10__LCD_D10 0x10a0
62#define MX23_PAD_LCD_D11__LCD_D11 0x10b0
63#define MX23_PAD_LCD_D12__LCD_D12 0x10c0
64#define MX23_PAD_LCD_D13__LCD_D13 0x10d0
65#define MX23_PAD_LCD_D14__LCD_D14 0x10e0
66#define MX23_PAD_LCD_D15__LCD_D15 0x10f0
67#define MX23_PAD_LCD_D16__LCD_D16 0x1100
68#define MX23_PAD_LCD_D17__LCD_D17 0x1110
69#define MX23_PAD_LCD_RESET__LCD_RESET 0x1120
70#define MX23_PAD_LCD_RS__LCD_RS 0x1130
71#define MX23_PAD_LCD_WR__LCD_WR 0x1140
72#define MX23_PAD_LCD_CS__LCD_CS 0x1150
73#define MX23_PAD_LCD_DOTCK__LCD_DOTCK 0x1160
74#define MX23_PAD_LCD_ENABLE__LCD_ENABLE 0x1170
75#define MX23_PAD_LCD_HSYNC__LCD_HSYNC 0x1180
76#define MX23_PAD_LCD_VSYNC__LCD_VSYNC 0x1190
77#define MX23_PAD_PWM0__PWM0 0x11a0
78#define MX23_PAD_PWM1__PWM1 0x11b0
79#define MX23_PAD_PWM2__PWM2 0x11c0
80#define MX23_PAD_PWM3__PWM3 0x11d0
81#define MX23_PAD_PWM4__PWM4 0x11e0
82#define MX23_PAD_SSP1_CMD__SSP1_CMD 0x2000
83#define MX23_PAD_SSP1_DETECT__SSP1_DETECT 0x2010
84#define MX23_PAD_SSP1_DATA0__SSP1_DATA0 0x2020
85#define MX23_PAD_SSP1_DATA1__SSP1_DATA1 0x2030
86#define MX23_PAD_SSP1_DATA2__SSP1_DATA2 0x2040
87#define MX23_PAD_SSP1_DATA3__SSP1_DATA3 0x2050
88#define MX23_PAD_SSP1_SCK__SSP1_SCK 0x2060
89#define MX23_PAD_ROTARYA__ROTARYA 0x2070
90#define MX23_PAD_ROTARYB__ROTARYB 0x2080
91#define MX23_PAD_EMI_A00__EMI_A00 0x2090
92#define MX23_PAD_EMI_A01__EMI_A01 0x20a0
93#define MX23_PAD_EMI_A02__EMI_A02 0x20b0
94#define MX23_PAD_EMI_A03__EMI_A03 0x20c0
95#define MX23_PAD_EMI_A04__EMI_A04 0x20d0
96#define MX23_PAD_EMI_A05__EMI_A05 0x20e0
97#define MX23_PAD_EMI_A06__EMI_A06 0x20f0
98#define MX23_PAD_EMI_A07__EMI_A07 0x2100
99#define MX23_PAD_EMI_A08__EMI_A08 0x2110
100#define MX23_PAD_EMI_A09__EMI_A09 0x2120
101#define MX23_PAD_EMI_A10__EMI_A10 0x2130
102#define MX23_PAD_EMI_A11__EMI_A11 0x2140
103#define MX23_PAD_EMI_A12__EMI_A12 0x2150
104#define MX23_PAD_EMI_BA0__EMI_BA0 0x2160
105#define MX23_PAD_EMI_BA1__EMI_BA1 0x2170
106#define MX23_PAD_EMI_CASN__EMI_CASN 0x2180
107#define MX23_PAD_EMI_CE0N__EMI_CE0N 0x2190
108#define MX23_PAD_EMI_CE1N__EMI_CE1N 0x21a0
109#define MX23_PAD_GPMI_CE1N__GPMI_CE1N 0x21b0
110#define MX23_PAD_GPMI_CE0N__GPMI_CE0N 0x21c0
111#define MX23_PAD_EMI_CKE__EMI_CKE 0x21d0
112#define MX23_PAD_EMI_RASN__EMI_RASN 0x21e0
113#define MX23_PAD_EMI_WEN__EMI_WEN 0x21f0
114#define MX23_PAD_EMI_D00__EMI_D00 0x3000
115#define MX23_PAD_EMI_D01__EMI_D01 0x3010
116#define MX23_PAD_EMI_D02__EMI_D02 0x3020
117#define MX23_PAD_EMI_D03__EMI_D03 0x3030
118#define MX23_PAD_EMI_D04__EMI_D04 0x3040
119#define MX23_PAD_EMI_D05__EMI_D05 0x3050
120#define MX23_PAD_EMI_D06__EMI_D06 0x3060
121#define MX23_PAD_EMI_D07__EMI_D07 0x3070
122#define MX23_PAD_EMI_D08__EMI_D08 0x3080
123#define MX23_PAD_EMI_D09__EMI_D09 0x3090
124#define MX23_PAD_EMI_D10__EMI_D10 0x30a0
125#define MX23_PAD_EMI_D11__EMI_D11 0x30b0
126#define MX23_PAD_EMI_D12__EMI_D12 0x30c0
127#define MX23_PAD_EMI_D13__EMI_D13 0x30d0
128#define MX23_PAD_EMI_D14__EMI_D14 0x30e0
129#define MX23_PAD_EMI_D15__EMI_D15 0x30f0
130#define MX23_PAD_EMI_DQM0__EMI_DQM0 0x3100
131#define MX23_PAD_EMI_DQM1__EMI_DQM1 0x3110
132#define MX23_PAD_EMI_DQS0__EMI_DQS0 0x3120
133#define MX23_PAD_EMI_DQS1__EMI_DQS1 0x3130
134#define MX23_PAD_EMI_CLK__EMI_CLK 0x3140
135#define MX23_PAD_EMI_CLKN__EMI_CLKN 0x3150
136#define MX23_PAD_GPMI_D00__LCD_D8 0x0001
137#define MX23_PAD_GPMI_D01__LCD_D9 0x0011
138#define MX23_PAD_GPMI_D02__LCD_D10 0x0021
139#define MX23_PAD_GPMI_D03__LCD_D11 0x0031
140#define MX23_PAD_GPMI_D04__LCD_D12 0x0041
141#define MX23_PAD_GPMI_D05__LCD_D13 0x0051
142#define MX23_PAD_GPMI_D06__LCD_D14 0x0061
143#define MX23_PAD_GPMI_D07__LCD_D15 0x0071
144#define MX23_PAD_GPMI_D08__LCD_D18 0x0081
145#define MX23_PAD_GPMI_D09__LCD_D19 0x0091
146#define MX23_PAD_GPMI_D10__LCD_D20 0x00a1
147#define MX23_PAD_GPMI_D11__LCD_D21 0x00b1
148#define MX23_PAD_GPMI_D12__LCD_D22 0x00c1
149#define MX23_PAD_GPMI_D13__LCD_D23 0x00d1
150#define MX23_PAD_GPMI_D14__AUART2_RX 0x00e1
151#define MX23_PAD_GPMI_D15__AUART2_TX 0x00f1
152#define MX23_PAD_GPMI_CLE__LCD_D16 0x0101
153#define MX23_PAD_GPMI_ALE__LCD_D17 0x0111
154#define MX23_PAD_GPMI_CE2N__ATA_A2 0x0121
155#define MX23_PAD_AUART1_RTS__IR_CLK 0x01b1
156#define MX23_PAD_AUART1_RX__IR_RX 0x01c1
157#define MX23_PAD_AUART1_TX__IR_TX 0x01d1
158#define MX23_PAD_I2C_SCL__GPMI_RDY2 0x01e1
159#define MX23_PAD_I2C_SDA__GPMI_CE2N 0x01f1
160#define MX23_PAD_LCD_D00__ETM_DA8 0x1001
161#define MX23_PAD_LCD_D01__ETM_DA9 0x1011
162#define MX23_PAD_LCD_D02__ETM_DA10 0x1021
163#define MX23_PAD_LCD_D03__ETM_DA11 0x1031
164#define MX23_PAD_LCD_D04__ETM_DA12 0x1041
165#define MX23_PAD_LCD_D05__ETM_DA13 0x1051
166#define MX23_PAD_LCD_D06__ETM_DA14 0x1061
167#define MX23_PAD_LCD_D07__ETM_DA15 0x1071
168#define MX23_PAD_LCD_D08__ETM_DA0 0x1081
169#define MX23_PAD_LCD_D09__ETM_DA1 0x1091
170#define MX23_PAD_LCD_D10__ETM_DA2 0x10a1
171#define MX23_PAD_LCD_D11__ETM_DA3 0x10b1
172#define MX23_PAD_LCD_D12__ETM_DA4 0x10c1
173#define MX23_PAD_LCD_D13__ETM_DA5 0x10d1
174#define MX23_PAD_LCD_D14__ETM_DA6 0x10e1
175#define MX23_PAD_LCD_D15__ETM_DA7 0x10f1
176#define MX23_PAD_LCD_RESET__ETM_TCTL 0x1121
177#define MX23_PAD_LCD_RS__ETM_TCLK 0x1131
178#define MX23_PAD_LCD_DOTCK__GPMI_RDY3 0x1161
179#define MX23_PAD_LCD_ENABLE__I2C_SCL 0x1171
180#define MX23_PAD_LCD_HSYNC__I2C_SDA 0x1181
181#define MX23_PAD_LCD_VSYNC__LCD_BUSY 0x1191
182#define MX23_PAD_PWM0__ROTARYA 0x11a1
183#define MX23_PAD_PWM1__ROTARYB 0x11b1
184#define MX23_PAD_PWM2__GPMI_RDY3 0x11c1
185#define MX23_PAD_PWM3__ETM_TCTL 0x11d1
186#define MX23_PAD_PWM4__ETM_TCLK 0x11e1
187#define MX23_PAD_SSP1_DETECT__GPMI_CE3N 0x2011
188#define MX23_PAD_SSP1_DATA1__I2C_SCL 0x2031
189#define MX23_PAD_SSP1_DATA2__I2C_SDA 0x2041
190#define MX23_PAD_ROTARYA__AUART2_RTS 0x2071
191#define MX23_PAD_ROTARYB__AUART2_CTS 0x2081
192#define MX23_PAD_GPMI_D00__SSP2_DATA0 0x0002
193#define MX23_PAD_GPMI_D01__SSP2_DATA1 0x0012
194#define MX23_PAD_GPMI_D02__SSP2_DATA2 0x0022
195#define MX23_PAD_GPMI_D03__SSP2_DATA3 0x0032
196#define MX23_PAD_GPMI_D04__SSP2_DATA4 0x0042
197#define MX23_PAD_GPMI_D05__SSP2_DATA5 0x0052
198#define MX23_PAD_GPMI_D06__SSP2_DATA6 0x0062
199#define MX23_PAD_GPMI_D07__SSP2_DATA7 0x0072
200#define MX23_PAD_GPMI_D08__SSP1_DATA4 0x0082
201#define MX23_PAD_GPMI_D09__SSP1_DATA5 0x0092
202#define MX23_PAD_GPMI_D10__SSP1_DATA6 0x00a2
203#define MX23_PAD_GPMI_D11__SSP1_DATA7 0x00b2
204#define MX23_PAD_GPMI_D15__GPMI_CE3N 0x00f2
205#define MX23_PAD_GPMI_RDY0__SSP2_DETECT 0x0132
206#define MX23_PAD_GPMI_RDY1__SSP2_CMD 0x0142
207#define MX23_PAD_GPMI_WRN__SSP2_SCK 0x0182
208#define MX23_PAD_AUART1_CTS__SSP1_DATA4 0x01a2
209#define MX23_PAD_AUART1_RTS__SSP1_DATA5 0x01b2
210#define MX23_PAD_AUART1_RX__SSP1_DATA6 0x01c2
211#define MX23_PAD_AUART1_TX__SSP1_DATA7 0x01d2
212#define MX23_PAD_I2C_SCL__AUART1_TX 0x01e2
213#define MX23_PAD_I2C_SDA__AUART1_RX 0x01f2
214#define MX23_PAD_LCD_D08__SAIF2_SDATA0 0x1082
215#define MX23_PAD_LCD_D09__SAIF1_SDATA0 0x1092
216#define MX23_PAD_LCD_D10__SAIF_MCLK_BITCLK 0x10a2
217#define MX23_PAD_LCD_D11__SAIF_LRCLK 0x10b2
218#define MX23_PAD_LCD_D12__SAIF2_SDATA1 0x10c2
219#define MX23_PAD_LCD_D13__SAIF2_SDATA2 0x10d2
220#define MX23_PAD_LCD_D14__SAIF1_SDATA2 0x10e2
221#define MX23_PAD_LCD_D15__SAIF1_SDATA1 0x10f2
222#define MX23_PAD_LCD_D16__SAIF_ALT_BITCLK 0x1102
223#define MX23_PAD_LCD_RESET__GPMI_CE3N 0x1122
224#define MX23_PAD_PWM0__DUART_RX 0x11a2
225#define MX23_PAD_PWM1__DUART_TX 0x11b2
226#define MX23_PAD_PWM3__AUART1_CTS 0x11d2
227#define MX23_PAD_PWM4__AUART1_RTS 0x11e2
228#define MX23_PAD_SSP1_CMD__JTAG_TDO 0x2002
229#define MX23_PAD_SSP1_DETECT__USB_OTG_ID 0x2012
230#define MX23_PAD_SSP1_DATA0__JTAG_TDI 0x2022
231#define MX23_PAD_SSP1_DATA1__JTAG_TCLK 0x2032
232#define MX23_PAD_SSP1_DATA2__JTAG_RTCK 0x2042
233#define MX23_PAD_SSP1_DATA3__JTAG_TMS 0x2052
234#define MX23_PAD_SSP1_SCK__JTAG_TRST 0x2062
235#define MX23_PAD_ROTARYA__SPDIF 0x2072
236#define MX23_PAD_ROTARYB__GPMI_CE3N 0x2082
237#define MX23_PAD_GPMI_D00__GPIO_0_0 0x0003
238#define MX23_PAD_GPMI_D01__GPIO_0_1 0x0013
239#define MX23_PAD_GPMI_D02__GPIO_0_2 0x0023
240#define MX23_PAD_GPMI_D03__GPIO_0_3 0x0033
241#define MX23_PAD_GPMI_D04__GPIO_0_4 0x0043
242#define MX23_PAD_GPMI_D05__GPIO_0_5 0x0053
243#define MX23_PAD_GPMI_D06__GPIO_0_6 0x0063
244#define MX23_PAD_GPMI_D07__GPIO_0_7 0x0073
245#define MX23_PAD_GPMI_D08__GPIO_0_8 0x0083
246#define MX23_PAD_GPMI_D09__GPIO_0_9 0x0093
247#define MX23_PAD_GPMI_D10__GPIO_0_10 0x00a3
248#define MX23_PAD_GPMI_D11__GPIO_0_11 0x00b3
249#define MX23_PAD_GPMI_D12__GPIO_0_12 0x00c3
250#define MX23_PAD_GPMI_D13__GPIO_0_13 0x00d3
251#define MX23_PAD_GPMI_D14__GPIO_0_14 0x00e3
252#define MX23_PAD_GPMI_D15__GPIO_0_15 0x00f3
253#define MX23_PAD_GPMI_CLE__GPIO_0_16 0x0103
254#define MX23_PAD_GPMI_ALE__GPIO_0_17 0x0113
255#define MX23_PAD_GPMI_CE2N__GPIO_0_18 0x0123
256#define MX23_PAD_GPMI_RDY0__GPIO_0_19 0x0133
257#define MX23_PAD_GPMI_RDY1__GPIO_0_20 0x0143
258#define MX23_PAD_GPMI_RDY2__GPIO_0_21 0x0153
259#define MX23_PAD_GPMI_RDY3__GPIO_0_22 0x0163
260#define MX23_PAD_GPMI_WPN__GPIO_0_23 0x0173
261#define MX23_PAD_GPMI_WRN__GPIO_0_24 0x0183
262#define MX23_PAD_GPMI_RDN__GPIO_0_25 0x0193
263#define MX23_PAD_AUART1_CTS__GPIO_0_26 0x01a3
264#define MX23_PAD_AUART1_RTS__GPIO_0_27 0x01b3
265#define MX23_PAD_AUART1_RX__GPIO_0_28 0x01c3
266#define MX23_PAD_AUART1_TX__GPIO_0_29 0x01d3
267#define MX23_PAD_I2C_SCL__GPIO_0_30 0x01e3
268#define MX23_PAD_I2C_SDA__GPIO_0_31 0x01f3
269#define MX23_PAD_LCD_D00__GPIO_1_0 0x1003
270#define MX23_PAD_LCD_D01__GPIO_1_1 0x1013
271#define MX23_PAD_LCD_D02__GPIO_1_2 0x1023
272#define MX23_PAD_LCD_D03__GPIO_1_3 0x1033
273#define MX23_PAD_LCD_D04__GPIO_1_4 0x1043
274#define MX23_PAD_LCD_D05__GPIO_1_5 0x1053
275#define MX23_PAD_LCD_D06__GPIO_1_6 0x1063
276#define MX23_PAD_LCD_D07__GPIO_1_7 0x1073
277#define MX23_PAD_LCD_D08__GPIO_1_8 0x1083
278#define MX23_PAD_LCD_D09__GPIO_1_9 0x1093
279#define MX23_PAD_LCD_D10__GPIO_1_10 0x10a3
280#define MX23_PAD_LCD_D11__GPIO_1_11 0x10b3
281#define MX23_PAD_LCD_D12__GPIO_1_12 0x10c3
282#define MX23_PAD_LCD_D13__GPIO_1_13 0x10d3
283#define MX23_PAD_LCD_D14__GPIO_1_14 0x10e3
284#define MX23_PAD_LCD_D15__GPIO_1_15 0x10f3
285#define MX23_PAD_LCD_D16__GPIO_1_16 0x1103
286#define MX23_PAD_LCD_D17__GPIO_1_17 0x1113
287#define MX23_PAD_LCD_RESET__GPIO_1_18 0x1123
288#define MX23_PAD_LCD_RS__GPIO_1_19 0x1133
289#define MX23_PAD_LCD_WR__GPIO_1_20 0x1143
290#define MX23_PAD_LCD_CS__GPIO_1_21 0x1153
291#define MX23_PAD_LCD_DOTCK__GPIO_1_22 0x1163
292#define MX23_PAD_LCD_ENABLE__GPIO_1_23 0x1173
293#define MX23_PAD_LCD_HSYNC__GPIO_1_24 0x1183
294#define MX23_PAD_LCD_VSYNC__GPIO_1_25 0x1193
295#define MX23_PAD_PWM0__GPIO_1_26 0x11a3
296#define MX23_PAD_PWM1__GPIO_1_27 0x11b3
297#define MX23_PAD_PWM2__GPIO_1_28 0x11c3
298#define MX23_PAD_PWM3__GPIO_1_29 0x11d3
299#define MX23_PAD_PWM4__GPIO_1_30 0x11e3
300#define MX23_PAD_SSP1_CMD__GPIO_2_0 0x2003
301#define MX23_PAD_SSP1_DETECT__GPIO_2_1 0x2013
302#define MX23_PAD_SSP1_DATA0__GPIO_2_2 0x2023
303#define MX23_PAD_SSP1_DATA1__GPIO_2_3 0x2033
304#define MX23_PAD_SSP1_DATA2__GPIO_2_4 0x2043
305#define MX23_PAD_SSP1_DATA3__GPIO_2_5 0x2053
306#define MX23_PAD_SSP1_SCK__GPIO_2_6 0x2063
307#define MX23_PAD_ROTARYA__GPIO_2_7 0x2073
308#define MX23_PAD_ROTARYB__GPIO_2_8 0x2083
309#define MX23_PAD_EMI_A00__GPIO_2_9 0x2093
310#define MX23_PAD_EMI_A01__GPIO_2_10 0x20a3
311#define MX23_PAD_EMI_A02__GPIO_2_11 0x20b3
312#define MX23_PAD_EMI_A03__GPIO_2_12 0x20c3
313#define MX23_PAD_EMI_A04__GPIO_2_13 0x20d3
314#define MX23_PAD_EMI_A05__GPIO_2_14 0x20e3
315#define MX23_PAD_EMI_A06__GPIO_2_15 0x20f3
316#define MX23_PAD_EMI_A07__GPIO_2_16 0x2103
317#define MX23_PAD_EMI_A08__GPIO_2_17 0x2113
318#define MX23_PAD_EMI_A09__GPIO_2_18 0x2123
319#define MX23_PAD_EMI_A10__GPIO_2_19 0x2133
320#define MX23_PAD_EMI_A11__GPIO_2_20 0x2143
321#define MX23_PAD_EMI_A12__GPIO_2_21 0x2153
322#define MX23_PAD_EMI_BA0__GPIO_2_22 0x2163
323#define MX23_PAD_EMI_BA1__GPIO_2_23 0x2173
324#define MX23_PAD_EMI_CASN__GPIO_2_24 0x2183
325#define MX23_PAD_EMI_CE0N__GPIO_2_25 0x2193
326#define MX23_PAD_EMI_CE1N__GPIO_2_26 0x21a3
327#define MX23_PAD_GPMI_CE1N__GPIO_2_27 0x21b3
328#define MX23_PAD_GPMI_CE0N__GPIO_2_28 0x21c3
329#define MX23_PAD_EMI_CKE__GPIO_2_29 0x21d3
330#define MX23_PAD_EMI_RASN__GPIO_2_30 0x21e3
331#define MX23_PAD_EMI_WEN__GPIO_2_31 0x21f3
332
333#endif /* __DT_BINDINGS_MX23_PINCTRL_H__ */
diff --git a/arch/arm/boot/dts/imx23-stmp378x_devb.dts b/arch/arm/boot/dts/imx23-stmp378x_devb.dts
index 85c3864b6a56..cb64e2b191ea 100644
--- a/arch/arm/boot/dts/imx23-stmp378x_devb.dts
+++ b/arch/arm/boot/dts/imx23-stmp378x_devb.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "imx23.dtsi" 13#include "imx23.dtsi"
14 14
15/ { 15/ {
16 model = "Freescale STMP378x Development Board"; 16 model = "Freescale STMP378x Development Board";
@@ -39,12 +39,12 @@
39 hog_pins_a: hog@0 { 39 hog_pins_a: hog@0 {
40 reg = <0>; 40 reg = <0>;
41 fsl,pinmux-ids = < 41 fsl,pinmux-ids = <
42 0x11d3 /* MX23_PAD_PWM3__GPIO_1_29 */ 42 MX23_PAD_PWM3__GPIO_1_29
43 0x11e3 /* MX23_PAD_PWM4__GPIO_1_30 */ 43 MX23_PAD_PWM4__GPIO_1_30
44 >; 44 >;
45 fsl,drive-strength = <0>; 45 fsl,drive-strength = <MXS_DRIVE_4mA>;
46 fsl,voltage = <1>; 46 fsl,voltage = <MXS_VOLTAGE_HIGH>;
47 fsl,pull-up = <0>; 47 fsl,pull-up = <MXS_PULL_DISABLE>;
48 }; 48 };
49 }; 49 };
50 }; 50 };
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index 28b5ce289662..c96ceaef7ddf 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.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/ "skeleton.dtsi" 12#include "skeleton.dtsi"
13#include "imx23-pinfunc.h"
13 14
14/ { 15/ {
15 interrupt-parent = <&icoll>; 16 interrupt-parent = <&icoll>;
@@ -137,174 +138,174 @@
137 duart_pins_a: duart@0 { 138 duart_pins_a: duart@0 {
138 reg = <0>; 139 reg = <0>;
139 fsl,pinmux-ids = < 140 fsl,pinmux-ids = <
140 0x11a2 /* MX23_PAD_PWM0__DUART_RX */ 141 MX23_PAD_PWM0__DUART_RX
141 0x11b2 /* MX23_PAD_PWM1__DUART_TX */ 142 MX23_PAD_PWM1__DUART_TX
142 >; 143 >;
143 fsl,drive-strength = <0>; 144 fsl,drive-strength = <MXS_DRIVE_4mA>;
144 fsl,voltage = <1>; 145 fsl,voltage = <MXS_VOLTAGE_HIGH>;
145 fsl,pull-up = <0>; 146 fsl,pull-up = <MXS_PULL_DISABLE>;
146 }; 147 };
147 148
148 auart0_pins_a: auart0@0 { 149 auart0_pins_a: auart0@0 {
149 reg = <0>; 150 reg = <0>;
150 fsl,pinmux-ids = < 151 fsl,pinmux-ids = <
151 0x01c0 /* MX23_PAD_AUART1_RX__AUART1_RX */ 152 MX23_PAD_AUART1_RX__AUART1_RX
152 0x01d0 /* MX23_PAD_AUART1_TX__AUART1_TX */ 153 MX23_PAD_AUART1_TX__AUART1_TX
153 0x01a0 /* MX23_PAD_AUART1_CTS__AUART1_CTS */ 154 MX23_PAD_AUART1_CTS__AUART1_CTS
154 0x01b0 /* MX23_PAD_AUART1_RTS__AUART1_RTS */ 155 MX23_PAD_AUART1_RTS__AUART1_RTS
155 >; 156 >;
156 fsl,drive-strength = <0>; 157 fsl,drive-strength = <MXS_DRIVE_4mA>;
157 fsl,voltage = <1>; 158 fsl,voltage = <MXS_VOLTAGE_HIGH>;
158 fsl,pull-up = <0>; 159 fsl,pull-up = <MXS_PULL_DISABLE>;
159 }; 160 };
160 161
161 auart0_2pins_a: auart0-2pins@0 { 162 auart0_2pins_a: auart0-2pins@0 {
162 reg = <0>; 163 reg = <0>;
163 fsl,pinmux-ids = < 164 fsl,pinmux-ids = <
164 0x01e2 /* MX23_PAD_I2C_SCL__AUART1_TX */ 165 MX23_PAD_I2C_SCL__AUART1_TX
165 0x01f2 /* MX23_PAD_I2C_SDA__AUART1_RX */ 166 MX23_PAD_I2C_SDA__AUART1_RX
166 >; 167 >;
167 fsl,drive-strength = <0>; 168 fsl,drive-strength = <MXS_DRIVE_4mA>;
168 fsl,voltage = <1>; 169 fsl,voltage = <MXS_VOLTAGE_HIGH>;
169 fsl,pull-up = <0>; 170 fsl,pull-up = <MXS_PULL_DISABLE>;
170 }; 171 };
171 172
172 gpmi_pins_a: gpmi-nand@0 { 173 gpmi_pins_a: gpmi-nand@0 {
173 reg = <0>; 174 reg = <0>;
174 fsl,pinmux-ids = < 175 fsl,pinmux-ids = <
175 0x0000 /* MX23_PAD_GPMI_D00__GPMI_D00 */ 176 MX23_PAD_GPMI_D00__GPMI_D00
176 0x0010 /* MX23_PAD_GPMI_D01__GPMI_D01 */ 177 MX23_PAD_GPMI_D01__GPMI_D01
177 0x0020 /* MX23_PAD_GPMI_D02__GPMI_D02 */ 178 MX23_PAD_GPMI_D02__GPMI_D02
178 0x0030 /* MX23_PAD_GPMI_D03__GPMI_D03 */ 179 MX23_PAD_GPMI_D03__GPMI_D03
179 0x0040 /* MX23_PAD_GPMI_D04__GPMI_D04 */ 180 MX23_PAD_GPMI_D04__GPMI_D04
180 0x0050 /* MX23_PAD_GPMI_D05__GPMI_D05 */ 181 MX23_PAD_GPMI_D05__GPMI_D05
181 0x0060 /* MX23_PAD_GPMI_D06__GPMI_D06 */ 182 MX23_PAD_GPMI_D06__GPMI_D06
182 0x0070 /* MX23_PAD_GPMI_D07__GPMI_D07 */ 183 MX23_PAD_GPMI_D07__GPMI_D07
183 0x0100 /* MX23_PAD_GPMI_CLE__GPMI_CLE */ 184 MX23_PAD_GPMI_CLE__GPMI_CLE
184 0x0110 /* MX23_PAD_GPMI_ALE__GPMI_ALE */ 185 MX23_PAD_GPMI_ALE__GPMI_ALE
185 0x0130 /* MX23_PAD_GPMI_RDY0__GPMI_RDY0 */ 186 MX23_PAD_GPMI_RDY0__GPMI_RDY0
186 0x0140 /* MX23_PAD_GPMI_RDY1__GPMI_RDY1 */ 187 MX23_PAD_GPMI_RDY1__GPMI_RDY1
187 0x0170 /* MX23_PAD_GPMI_WPN__GPMI_WPN */ 188 MX23_PAD_GPMI_WPN__GPMI_WPN
188 0x0180 /* MX23_PAD_GPMI_WRN__GPMI_WRN */ 189 MX23_PAD_GPMI_WRN__GPMI_WRN
189 0x0190 /* MX23_PAD_GPMI_RDN__GPMI_RDN */ 190 MX23_PAD_GPMI_RDN__GPMI_RDN
190 0x21b0 /* MX23_PAD_GPMI_CE1N__GPMI_CE1N */ 191 MX23_PAD_GPMI_CE1N__GPMI_CE1N
191 0x21c0 /* MX23_PAD_GPMI_CE0N__GPMI_CE0N */ 192 MX23_PAD_GPMI_CE0N__GPMI_CE0N
192 >; 193 >;
193 fsl,drive-strength = <0>; 194 fsl,drive-strength = <MXS_DRIVE_4mA>;
194 fsl,voltage = <1>; 195 fsl,voltage = <MXS_VOLTAGE_HIGH>;
195 fsl,pull-up = <0>; 196 fsl,pull-up = <MXS_PULL_DISABLE>;
196 }; 197 };
197 198
198 gpmi_pins_fixup: gpmi-pins-fixup { 199 gpmi_pins_fixup: gpmi-pins-fixup {
199 fsl,pinmux-ids = < 200 fsl,pinmux-ids = <
200 0x0170 /* MX23_PAD_GPMI_WPN__GPMI_WPN */ 201 MX23_PAD_GPMI_WPN__GPMI_WPN
201 0x0180 /* MX23_PAD_GPMI_WRN__GPMI_WRN */ 202 MX23_PAD_GPMI_WRN__GPMI_WRN
202 0x0190 /* MX23_PAD_GPMI_RDN__GPMI_RDN */ 203 MX23_PAD_GPMI_RDN__GPMI_RDN
203 >; 204 >;
204 fsl,drive-strength = <2>; 205 fsl,drive-strength = <MXS_DRIVE_12mA>;
205 }; 206 };
206 207
207 mmc0_4bit_pins_a: mmc0-4bit@0 { 208 mmc0_4bit_pins_a: mmc0-4bit@0 {
208 reg = <0>; 209 reg = <0>;
209 fsl,pinmux-ids = < 210 fsl,pinmux-ids = <
210 0x2020 /* MX23_PAD_SSP1_DATA0__SSP1_DATA0 */ 211 MX23_PAD_SSP1_DATA0__SSP1_DATA0
211 0x2030 /* MX23_PAD_SSP1_DATA1__SSP1_DATA1 */ 212 MX23_PAD_SSP1_DATA1__SSP1_DATA1
212 0x2040 /* MX23_PAD_SSP1_DATA2__SSP1_DATA2 */ 213 MX23_PAD_SSP1_DATA2__SSP1_DATA2
213 0x2050 /* MX23_PAD_SSP1_DATA3__SSP1_DATA3 */ 214 MX23_PAD_SSP1_DATA3__SSP1_DATA3
214 0x2000 /* MX23_PAD_SSP1_CMD__SSP1_CMD */ 215 MX23_PAD_SSP1_CMD__SSP1_CMD
215 0x2060 /* MX23_PAD_SSP1_SCK__SSP1_SCK */ 216 MX23_PAD_SSP1_SCK__SSP1_SCK
216 >; 217 >;
217 fsl,drive-strength = <1>; 218 fsl,drive-strength = <MXS_DRIVE_8mA>;
218 fsl,voltage = <1>; 219 fsl,voltage = <MXS_VOLTAGE_HIGH>;
219 fsl,pull-up = <1>; 220 fsl,pull-up = <MXS_PULL_ENABLE>;
220 }; 221 };
221 222
222 mmc0_8bit_pins_a: mmc0-8bit@0 { 223 mmc0_8bit_pins_a: mmc0-8bit@0 {
223 reg = <0>; 224 reg = <0>;
224 fsl,pinmux-ids = < 225 fsl,pinmux-ids = <
225 0x2020 /* MX23_PAD_SSP1_DATA0__SSP1_DATA0 */ 226 MX23_PAD_SSP1_DATA0__SSP1_DATA0
226 0x2030 /* MX23_PAD_SSP1_DATA1__SSP1_DATA1 */ 227 MX23_PAD_SSP1_DATA1__SSP1_DATA1
227 0x2040 /* MX23_PAD_SSP1_DATA2__SSP1_DATA2 */ 228 MX23_PAD_SSP1_DATA2__SSP1_DATA2
228 0x2050 /* MX23_PAD_SSP1_DATA3__SSP1_DATA3 */ 229 MX23_PAD_SSP1_DATA3__SSP1_DATA3
229 0x0082 /* MX23_PAD_GPMI_D08__SSP1_DATA4 */ 230 MX23_PAD_GPMI_D08__SSP1_DATA4
230 0x0092 /* MX23_PAD_GPMI_D09__SSP1_DATA5 */ 231 MX23_PAD_GPMI_D09__SSP1_DATA5
231 0x00a2 /* MX23_PAD_GPMI_D10__SSP1_DATA6 */ 232 MX23_PAD_GPMI_D10__SSP1_DATA6
232 0x00b2 /* MX23_PAD_GPMI_D11__SSP1_DATA7 */ 233 MX23_PAD_GPMI_D11__SSP1_DATA7
233 0x2000 /* MX23_PAD_SSP1_CMD__SSP1_CMD */ 234 MX23_PAD_SSP1_CMD__SSP1_CMD
234 0x2010 /* MX23_PAD_SSP1_DETECT__SSP1_DETECT */ 235 MX23_PAD_SSP1_DETECT__SSP1_DETECT
235 0x2060 /* MX23_PAD_SSP1_SCK__SSP1_SCK */ 236 MX23_PAD_SSP1_SCK__SSP1_SCK
236 >; 237 >;
237 fsl,drive-strength = <1>; 238 fsl,drive-strength = <MXS_DRIVE_8mA>;
238 fsl,voltage = <1>; 239 fsl,voltage = <MXS_VOLTAGE_HIGH>;
239 fsl,pull-up = <1>; 240 fsl,pull-up = <MXS_PULL_ENABLE>;
240 }; 241 };
241 242
242 mmc0_pins_fixup: mmc0-pins-fixup { 243 mmc0_pins_fixup: mmc0-pins-fixup {
243 fsl,pinmux-ids = < 244 fsl,pinmux-ids = <
244 0x2010 /* MX23_PAD_SSP1_DETECT__SSP1_DETECT */ 245 MX23_PAD_SSP1_DETECT__SSP1_DETECT
245 0x2060 /* MX23_PAD_SSP1_SCK__SSP1_SCK */ 246 MX23_PAD_SSP1_SCK__SSP1_SCK
246 >; 247 >;
247 fsl,pull-up = <0>; 248 fsl,pull-up = <MXS_PULL_DISABLE>;
248 }; 249 };
249 250
250 pwm2_pins_a: pwm2@0 { 251 pwm2_pins_a: pwm2@0 {
251 reg = <0>; 252 reg = <0>;
252 fsl,pinmux-ids = < 253 fsl,pinmux-ids = <
253 0x11c0 /* MX23_PAD_PWM2__PWM2 */ 254 MX23_PAD_PWM2__PWM2
254 >; 255 >;
255 fsl,drive-strength = <0>; 256 fsl,drive-strength = <MXS_DRIVE_4mA>;
256 fsl,voltage = <1>; 257 fsl,voltage = <MXS_VOLTAGE_HIGH>;
257 fsl,pull-up = <0>; 258 fsl,pull-up = <MXS_PULL_DISABLE>;
258 }; 259 };
259 260
260 lcdif_24bit_pins_a: lcdif-24bit@0 { 261 lcdif_24bit_pins_a: lcdif-24bit@0 {
261 reg = <0>; 262 reg = <0>;
262 fsl,pinmux-ids = < 263 fsl,pinmux-ids = <
263 0x1000 /* MX23_PAD_LCD_D00__LCD_D0 */ 264 MX23_PAD_LCD_D00__LCD_D00
264 0x1010 /* MX23_PAD_LCD_D01__LCD_D1 */ 265 MX23_PAD_LCD_D01__LCD_D01
265 0x1020 /* MX23_PAD_LCD_D02__LCD_D2 */ 266 MX23_PAD_LCD_D02__LCD_D02
266 0x1030 /* MX23_PAD_LCD_D03__LCD_D3 */ 267 MX23_PAD_LCD_D03__LCD_D03
267 0x1040 /* MX23_PAD_LCD_D04__LCD_D4 */ 268 MX23_PAD_LCD_D04__LCD_D04
268 0x1050 /* MX23_PAD_LCD_D05__LCD_D5 */ 269 MX23_PAD_LCD_D05__LCD_D05
269 0x1060 /* MX23_PAD_LCD_D06__LCD_D6 */ 270 MX23_PAD_LCD_D06__LCD_D06
270 0x1070 /* MX23_PAD_LCD_D07__LCD_D7 */ 271 MX23_PAD_LCD_D07__LCD_D07
271 0x1080 /* MX23_PAD_LCD_D08__LCD_D8 */ 272 MX23_PAD_LCD_D08__LCD_D08
272 0x1090 /* MX23_PAD_LCD_D09__LCD_D9 */ 273 MX23_PAD_LCD_D09__LCD_D09
273 0x10a0 /* MX23_PAD_LCD_D10__LCD_D10 */ 274 MX23_PAD_LCD_D10__LCD_D10
274 0x10b0 /* MX23_PAD_LCD_D11__LCD_D11 */ 275 MX23_PAD_LCD_D11__LCD_D11
275 0x10c0 /* MX23_PAD_LCD_D12__LCD_D12 */ 276 MX23_PAD_LCD_D12__LCD_D12
276 0x10d0 /* MX23_PAD_LCD_D13__LCD_D13 */ 277 MX23_PAD_LCD_D13__LCD_D13
277 0x10e0 /* MX23_PAD_LCD_D14__LCD_D14 */ 278 MX23_PAD_LCD_D14__LCD_D14
278 0x10f0 /* MX23_PAD_LCD_D15__LCD_D15 */ 279 MX23_PAD_LCD_D15__LCD_D15
279 0x1100 /* MX23_PAD_LCD_D16__LCD_D16 */ 280 MX23_PAD_LCD_D16__LCD_D16
280 0x1110 /* MX23_PAD_LCD_D17__LCD_D17 */ 281 MX23_PAD_LCD_D17__LCD_D17
281 0x0081 /* MX23_PAD_GPMI_D08__LCD_D18 */ 282 MX23_PAD_GPMI_D08__LCD_D18
282 0x0091 /* MX23_PAD_GPMI_D09__LCD_D19 */ 283 MX23_PAD_GPMI_D09__LCD_D19
283 0x00a1 /* MX23_PAD_GPMI_D10__LCD_D20 */ 284 MX23_PAD_GPMI_D10__LCD_D20
284 0x00b1 /* MX23_PAD_GPMI_D11__LCD_D21 */ 285 MX23_PAD_GPMI_D11__LCD_D21
285 0x00c1 /* MX23_PAD_GPMI_D12__LCD_D22 */ 286 MX23_PAD_GPMI_D12__LCD_D22
286 0x00d1 /* MX23_PAD_GPMI_D13__LCD_D23 */ 287 MX23_PAD_GPMI_D13__LCD_D23
287 0x1160 /* MX23_PAD_LCD_DOTCK__LCD_DOTCK */ 288 MX23_PAD_LCD_DOTCK__LCD_DOTCK
288 0x1170 /* MX23_PAD_LCD_ENABLE__LCD_ENABLE */ 289 MX23_PAD_LCD_ENABLE__LCD_ENABLE
289 0x1180 /* MX23_PAD_LCD_HSYNC__LCD_HSYNC */ 290 MX23_PAD_LCD_HSYNC__LCD_HSYNC
290 0x1190 /* MX23_PAD_LCD_VSYNC__LCD_VSYNC */ 291 MX23_PAD_LCD_VSYNC__LCD_VSYNC
291 >; 292 >;
292 fsl,drive-strength = <0>; 293 fsl,drive-strength = <MXS_DRIVE_4mA>;
293 fsl,voltage = <1>; 294 fsl,voltage = <MXS_VOLTAGE_HIGH>;
294 fsl,pull-up = <0>; 295 fsl,pull-up = <MXS_PULL_DISABLE>;
295 }; 296 };
296 297
297 spi2_pins_a: spi2@0 { 298 spi2_pins_a: spi2@0 {
298 reg = <0>; 299 reg = <0>;
299 fsl,pinmux-ids = < 300 fsl,pinmux-ids = <
300 0x0182 /* MX23_PAD_GPMI_WRN__SSP2_SCK */ 301 MX23_PAD_GPMI_WRN__SSP2_SCK
301 0x0142 /* MX23_PAD_GPMI_RDY1__SSP2_CMD */ 302 MX23_PAD_GPMI_RDY1__SSP2_CMD
302 0x0002 /* MX23_PAD_GPMI_D00__SSP2_DATA0 */ 303 MX23_PAD_GPMI_D00__SSP2_DATA0
303 0x0032 /* MX23_PAD_GPMI_D03__SSP2_DATA3 */ 304 MX23_PAD_GPMI_D03__SSP2_DATA3
304 >; 305 >;
305 fsl,drive-strength = <1>; 306 fsl,drive-strength = <MXS_DRIVE_8mA>;
306 fsl,voltage = <1>; 307 fsl,voltage = <MXS_VOLTAGE_HIGH>;
307 fsl,pull-up = <1>; 308 fsl,pull-up = <MXS_PULL_ENABLE>;
308 }; 309 };
309 }; 310 };
310 311
@@ -430,6 +431,7 @@
430 reg = <0x80050000 0x2000>; 431 reg = <0x80050000 0x2000>;
431 interrupts = <36 37 38 39 40 41 42 43 44>; 432 interrupts = <36 37 38 39 40 41 42 43 44>;
432 status = "disabled"; 433 status = "disabled";
434 clocks = <&clks 26>;
433 }; 435 };
434 436
435 spdif@80054000 { 437 spdif@80054000 {
diff --git a/arch/arm/boot/dts/imx27-apf27dev.dts b/arch/arm/boot/dts/imx27-apf27dev.dts
index 2a377ca1881a..47c8c26012e4 100644
--- a/arch/arm/boot/dts/imx27-apf27dev.dts
+++ b/arch/arm/boot/dts/imx27-apf27dev.dts
@@ -16,6 +16,26 @@
16 model = "Armadeus Systems APF27Dev docking/development board"; 16 model = "Armadeus Systems APF27Dev docking/development board";
17 compatible = "armadeus,imx27-apf27dev", "armadeus,imx27-apf27", "fsl,imx27"; 17 compatible = "armadeus,imx27-apf27dev", "armadeus,imx27-apf27", "fsl,imx27";
18 18
19 display: display {
20 model = "Chimei-LW700AT9003";
21 native-mode = <&timing0>;
22 bits-per-pixel = <16>; /* non-standard but required */
23 fsl,pcr = <0xfae80083>; /* non-standard but required */
24 display-timings {
25 timing0: 640x480 {
26 clock-frequency = <33000033>;
27 hactive = <800>;
28 vactive = <640>;
29 hback-porch = <96>;
30 hfront-porch = <96>;
31 vback-porch = <20>;
32 vfront-porch = <21>;
33 hsync-len = <64>;
34 vsync-len = <4>;
35 };
36 };
37 };
38
19 gpio-keys { 39 gpio-keys {
20 compatible = "gpio-keys"; 40 compatible = "gpio-keys";
21 41
@@ -50,6 +70,12 @@
50 status = "okay"; 70 status = "okay";
51}; 71};
52 72
73&fb {
74 display = <&display>;
75 fsl,dmacr = <0x00020010>;
76 status = "okay";
77};
78
53&i2c1 { 79&i2c1 {
54 clock-frequency = <400000>; 80 clock-frequency = <400000>;
55 status = "okay"; 81 status = "okay";
diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index c037c223619a..826231eb4446 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -123,6 +123,7 @@
123 }; 123 };
124 124
125 pwm: pwm@10006000 { 125 pwm: pwm@10006000 {
126 #pwm-cells = <2>;
126 compatible = "fsl,imx27-pwm"; 127 compatible = "fsl,imx27-pwm";
127 reg = <0x10006000 0x1000>; 128 reg = <0x10006000 0x1000>;
128 interrupts = <23>; 129 interrupts = <23>;
@@ -187,7 +188,7 @@
187 compatible = "fsl,imx27-cspi"; 188 compatible = "fsl,imx27-cspi";
188 reg = <0x1000e000 0x1000>; 189 reg = <0x1000e000 0x1000>;
189 interrupts = <16>; 190 interrupts = <16>;
190 clocks = <&clks 53>, <&clks 53>; 191 clocks = <&clks 53>, <&clks 60>;
191 clock-names = "ipg", "per"; 192 clock-names = "ipg", "per";
192 status = "disabled"; 193 status = "disabled";
193 }; 194 };
@@ -198,7 +199,7 @@
198 compatible = "fsl,imx27-cspi"; 199 compatible = "fsl,imx27-cspi";
199 reg = <0x1000f000 0x1000>; 200 reg = <0x1000f000 0x1000>;
200 interrupts = <15>; 201 interrupts = <15>;
201 clocks = <&clks 52>, <&clks 52>; 202 clocks = <&clks 52>, <&clks 60>;
202 clock-names = "ipg", "per"; 203 clock-names = "ipg", "per";
203 status = "disabled"; 204 status = "disabled";
204 }; 205 };
@@ -309,7 +310,7 @@
309 compatible = "fsl,imx27-cspi"; 310 compatible = "fsl,imx27-cspi";
310 reg = <0x10017000 0x1000>; 311 reg = <0x10017000 0x1000>;
311 interrupts = <6>; 312 interrupts = <6>;
312 clocks = <&clks 51>, <&clks 51>; 313 clocks = <&clks 51>, <&clks 60>;
313 clock-names = "ipg", "per"; 314 clock-names = "ipg", "per";
314 status = "disabled"; 315 status = "disabled";
315 }; 316 };
diff --git a/arch/arm/boot/dts/imx28-apf28.dts b/arch/arm/boot/dts/imx28-apf28.dts
index 7eb075876c4c..7198fe3798c6 100644
--- a/arch/arm/boot/dts/imx28-apf28.dts
+++ b/arch/arm/boot/dts/imx28-apf28.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "imx28.dtsi" 13#include "imx28.dtsi"
14 14
15/ { 15/ {
16 model = "Armadeus Systems APF28 module"; 16 model = "Armadeus Systems APF28 module";
diff --git a/arch/arm/boot/dts/imx28-apf28dev.dts b/arch/arm/boot/dts/imx28-apf28dev.dts
index b602494c152b..e2efd8d89c4f 100644
--- a/arch/arm/boot/dts/imx28-apf28dev.dts
+++ b/arch/arm/boot/dts/imx28-apf28dev.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/* APF28Dev is a docking board for the APF28 SOM */ 12/* APF28Dev is a docking board for the APF28 SOM */
13/include/ "imx28-apf28.dts" 13#include "imx28-apf28.dts"
14 14
15/ { 15/ {
16 model = "Armadeus Systems APF28Dev docking/development board"; 16 model = "Armadeus Systems APF28Dev docking/development board";
@@ -41,30 +41,30 @@
41 hog_pins_apf28dev: hog@0 { 41 hog_pins_apf28dev: hog@0 {
42 reg = <0>; 42 reg = <0>;
43 fsl,pinmux-ids = < 43 fsl,pinmux-ids = <
44 0x1103 /* MX28_PAD_LCD_D16__GPIO_1_16 */ 44 MX28_PAD_LCD_D16__GPIO_1_16
45 0x1113 /* MX28_PAD_LCD_D17__GPIO_1_17 */ 45 MX28_PAD_LCD_D17__GPIO_1_17
46 0x1123 /* MX28_PAD_LCD_D18__GPIO_1_18 */ 46 MX28_PAD_LCD_D18__GPIO_1_18
47 0x1133 /* MX28_PAD_LCD_D19__GPIO_1_19 */ 47 MX28_PAD_LCD_D19__GPIO_1_19
48 0x1143 /* MX28_PAD_LCD_D20__GPIO_1_20 */ 48 MX28_PAD_LCD_D20__GPIO_1_20
49 0x1153 /* MX28_PAD_LCD_D21__GPIO_1_21 */ 49 MX28_PAD_LCD_D21__GPIO_1_21
50 0x1163 /* MX28_PAD_LCD_D22__GPIO_1_22 */ 50 MX28_PAD_LCD_D22__GPIO_1_22
51 >; 51 >;
52 fsl,drive-strength = <0>; 52 fsl,drive-strength = <MXS_DRIVE_4mA>;
53 fsl,voltage = <1>; 53 fsl,voltage = <MXS_VOLTAGE_HIGH>;
54 fsl,pull-up = <0>; 54 fsl,pull-up = <MXS_PULL_DISABLE>;
55 }; 55 };
56 56
57 lcdif_pins_apf28dev: lcdif-apf28dev@0 { 57 lcdif_pins_apf28dev: lcdif-apf28dev@0 {
58 reg = <0>; 58 reg = <0>;
59 fsl,pinmux-ids = < 59 fsl,pinmux-ids = <
60 0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */ 60 MX28_PAD_LCD_RD_E__LCD_VSYNC
61 0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */ 61 MX28_PAD_LCD_WR_RWN__LCD_HSYNC
62 0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */ 62 MX28_PAD_LCD_RS__LCD_DOTCLK
63 0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */ 63 MX28_PAD_LCD_CS__LCD_ENABLE
64 >; 64 >;
65 fsl,drive-strength = <0>; 65 fsl,drive-strength = <MXS_DRIVE_4mA>;
66 fsl,voltage = <1>; 66 fsl,voltage = <MXS_VOLTAGE_HIGH>;
67 fsl,pull-up = <0>; 67 fsl,pull-up = <MXS_PULL_DISABLE>;
68 }; 68 };
69 }; 69 };
70 70
diff --git a/arch/arm/boot/dts/imx28-apx4devkit.dts b/arch/arm/boot/dts/imx28-apx4devkit.dts
index 0e7fed47bd8d..6f254ca816cb 100644
--- a/arch/arm/boot/dts/imx28-apx4devkit.dts
+++ b/arch/arm/boot/dts/imx28-apx4devkit.dts
@@ -1,5 +1,5 @@
1/dts-v1/; 1/dts-v1/;
2/include/ "imx28.dtsi" 2#include "imx28.dtsi"
3 3
4/ { 4/ {
5 model = "Bluegiga APX4 Development Kit"; 5 model = "Bluegiga APX4 Development Kit";
@@ -40,53 +40,53 @@
40 hog_pins_a: hog@0 { 40 hog_pins_a: hog@0 {
41 reg = <0>; 41 reg = <0>;
42 fsl,pinmux-ids = < 42 fsl,pinmux-ids = <
43 0x0113 /* MX28_PAD_GPMI_CE1N__GPIO_0_17 */ 43 MX28_PAD_GPMI_CE1N__GPIO_0_17
44 0x0153 /* MX28_PAD_GPMI_RDY1__GPIO_0_21 */ 44 MX28_PAD_GPMI_RDY1__GPIO_0_21
45 0x2123 /* MX28_PAD_SSP2_MISO__GPIO_2_18 */ 45 MX28_PAD_SSP2_MISO__GPIO_2_18
46 0x2131 /* MX28_PAD_SSP2_SS0__GPIO_2_19 */ 46 MX28_PAD_SSP2_SS0__AUART3_TX /* was: 0x2131 - MX28_PAD_SSP2_SS0__GPIO_2_19 */
47 0x31c3 /* MX28_PAD_PWM3__GPIO_3_28 */ 47 MX28_PAD_PWM3__GPIO_3_28
48 0x31e3 /* MX28_PAD_LCD_RESET__GPIO_3_30 */ 48 MX28_PAD_LCD_RESET__GPIO_3_30
49 0x4143 /* MX28_PAD_JTAG_RTCK__GPIO_4_20 */ 49 MX28_PAD_JTAG_RTCK__GPIO_4_20
50 >; 50 >;
51 fsl,drive-strength = <0>; 51 fsl,drive-strength = <MXS_DRIVE_4mA>;
52 fsl,voltage = <1>; 52 fsl,voltage = <MXS_VOLTAGE_HIGH>;
53 fsl,pull-up = <0>; 53 fsl,pull-up = <MXS_PULL_DISABLE>;
54 }; 54 };
55 55
56 lcdif_pins_apx4: lcdif-apx4@0 { 56 lcdif_pins_apx4: lcdif-apx4@0 {
57 reg = <0>; 57 reg = <0>;
58 fsl,pinmux-ids = < 58 fsl,pinmux-ids = <
59 0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */ 59 MX28_PAD_LCD_RD_E__LCD_VSYNC
60 0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */ 60 MX28_PAD_LCD_WR_RWN__LCD_HSYNC
61 0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */ 61 MX28_PAD_LCD_RS__LCD_DOTCLK
62 0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */ 62 MX28_PAD_LCD_CS__LCD_ENABLE
63 >; 63 >;
64 fsl,drive-strength = <0>; 64 fsl,drive-strength = <MXS_DRIVE_4mA>;
65 fsl,voltage = <1>; 65 fsl,voltage = <MXS_VOLTAGE_HIGH>;
66 fsl,pull-up = <0>; 66 fsl,pull-up = <MXS_PULL_DISABLE>;
67 }; 67 };
68 68
69 mmc2_4bit_pins_apx4: mmc2-4bit-apx4@0 { 69 mmc2_4bit_pins_apx4: mmc2-4bit-apx4@0 {
70 reg = <0>; 70 reg = <0>;
71 fsl,pinmux-ids = < 71 fsl,pinmux-ids = <
72 0x2041 /* MX28_PAD_SSP0_DATA4__SSP2_D0 */ 72 MX28_PAD_SSP0_DATA4__SSP2_D0
73 0x2051 /* MX28_PAD_SSP0_DATA5__SSP2_D3 */ 73 MX28_PAD_SSP0_DATA5__SSP2_D3
74 0x2061 /* MX28_PAD_SSP0_DATA6__SSP2_CMD */ 74 MX28_PAD_SSP0_DATA6__SSP2_CMD
75 0x2071 /* MX28_PAD_SSP0_DATA7__SSP2_SCK */ 75 MX28_PAD_SSP0_DATA7__SSP2_SCK
76 0x2141 /* MX28_PAD_SSP2_SS1__SSP2_D1 */ 76 MX28_PAD_SSP2_SS1__SSP2_D1
77 0x2151 /* MX28_PAD_SSP2_SS2__SSP2_D2 */ 77 MX28_PAD_SSP2_SS2__SSP2_D2
78 >; 78 >;
79 fsl,drive-strength = <1>; 79 fsl,drive-strength = <MXS_DRIVE_8mA>;
80 fsl,voltage = <1>; 80 fsl,voltage = <MXS_VOLTAGE_HIGH>;
81 fsl,pull-up = <1>; 81 fsl,pull-up = <MXS_PULL_ENABLE>;
82 }; 82 };
83 83
84 mmc2_sck_cfg_apx4: mmc2-sck-cfg-apx4 { 84 mmc2_sck_cfg_apx4: mmc2-sck-cfg-apx4 {
85 fsl,pinmux-ids = < 85 fsl,pinmux-ids = <
86 0x2071 /* MX28_PAD_SSP0_DATA7__SSP2_SCK */ 86 MX28_PAD_SSP0_DATA7__SSP2_SCK
87 >; 87 >;
88 fsl,drive-strength = <2>; 88 fsl,drive-strength = <MXS_DRIVE_12mA>;
89 fsl,pull-up = <0>; 89 fsl,pull-up = <MXS_PULL_DISABLE>;
90 }; 90 };
91 }; 91 };
92 92
diff --git a/arch/arm/boot/dts/imx28-cfa10036.dts b/arch/arm/boot/dts/imx28-cfa10036.dts
index 1ec8c94bbac9..cabb6171a19d 100644
--- a/arch/arm/boot/dts/imx28-cfa10036.dts
+++ b/arch/arm/boot/dts/imx28-cfa10036.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "imx28.dtsi" 13#include "imx28.dtsi"
14 14
15/ { 15/ {
16 model = "Crystalfontz CFA-10036 Board"; 16 model = "Crystalfontz CFA-10036 Board";
@@ -26,31 +26,31 @@
26 ssd1306_cfa10036: ssd1306-10036@0 { 26 ssd1306_cfa10036: ssd1306-10036@0 {
27 reg = <0>; 27 reg = <0>;
28 fsl,pinmux-ids = < 28 fsl,pinmux-ids = <
29 0x2073 /* MX28_PAD_SSP0_D7__GPIO_2_7 */ 29 MX28_PAD_SSP0_DATA7__GPIO_2_7
30 >; 30 >;
31 fsl,drive-strength = <0>; 31 fsl,drive-strength = <MXS_DRIVE_4mA>;
32 fsl,voltage = <1>; 32 fsl,voltage = <MXS_VOLTAGE_HIGH>;
33 fsl,pull-up = <0>; 33 fsl,pull-up = <MXS_PULL_DISABLE>;
34 }; 34 };
35 35
36 led_pins_cfa10036: leds-10036@0 { 36 led_pins_cfa10036: leds-10036@0 {
37 reg = <0>; 37 reg = <0>;
38 fsl,pinmux-ids = < 38 fsl,pinmux-ids = <
39 0x3043 /* MX28_PAD_AUART1_RX__GPIO_3_4 */ 39 MX28_PAD_AUART1_RX__GPIO_3_4
40 >; 40 >;
41 fsl,drive-strength = <0>; 41 fsl,drive-strength = <MXS_DRIVE_4mA>;
42 fsl,voltage = <1>; 42 fsl,voltage = <MXS_VOLTAGE_HIGH>;
43 fsl,pull-up = <0>; 43 fsl,pull-up = <MXS_PULL_DISABLE>;
44 }; 44 };
45 45
46 usb0_otg_cfa10036: otg-10036@0 { 46 usb0_otg_cfa10036: otg-10036@0 {
47 reg = <0>; 47 reg = <0>;
48 fsl,pinmux-ids = < 48 fsl,pinmux-ids = <
49 0x0142 /* MX28_PAD_GPMI_READY0__USB0_ID */ 49 MX28_PAD_GPMI_RDY0__USB0_ID
50 >; 50 >;
51 fsl,drive-strength = <0>; 51 fsl,drive-strength = <MXS_DRIVE_4mA>;
52 fsl,voltage = <1>; 52 fsl,voltage = <MXS_VOLTAGE_HIGH>;
53 fsl,pull-up = <0>; 53 fsl,pull-up = <MXS_PULL_DISABLE>;
54 }; 54 };
55 55
56 }; 56 };
diff --git a/arch/arm/boot/dts/imx28-cfa10037.dts b/arch/arm/boot/dts/imx28-cfa10037.dts
index 182b99fe35f3..f93e9a700e52 100644
--- a/arch/arm/boot/dts/imx28-cfa10037.dts
+++ b/arch/arm/boot/dts/imx28-cfa10037.dts
@@ -13,7 +13,7 @@
13 * The CFA-10049 is an expansion board for the CFA-10036 module, thus we 13 * The CFA-10049 is an expansion board for the CFA-10036 module, thus we
14 * need to include the CFA-10036 DTS. 14 * need to include the CFA-10036 DTS.
15 */ 15 */
16/include/ "imx28-cfa10036.dts" 16#include "imx28-cfa10036.dts"
17 17
18/ { 18/ {
19 model = "Crystalfontz CFA-10037 Board"; 19 model = "Crystalfontz CFA-10037 Board";
@@ -25,21 +25,21 @@
25 usb_pins_cfa10037: usb-10037@0 { 25 usb_pins_cfa10037: usb-10037@0 {
26 reg = <0>; 26 reg = <0>;
27 fsl,pinmux-ids = < 27 fsl,pinmux-ids = <
28 0x0073 /* MX28_PAD_GPMI_D7__GPIO_0_7 */ 28 MX28_PAD_GPMI_D07__GPIO_0_7
29 >; 29 >;
30 fsl,drive-strength = <0>; 30 fsl,drive-strength = <MXS_DRIVE_4mA>;
31 fsl,voltage = <1>; 31 fsl,voltage = <MXS_VOLTAGE_HIGH>;
32 fsl,pull-up = <0>; 32 fsl,pull-up = <MXS_PULL_DISABLE>;
33 }; 33 };
34 34
35 mac0_pins_cfa10037: mac0-10037@0 { 35 mac0_pins_cfa10037: mac0-10037@0 {
36 reg = <0>; 36 reg = <0>;
37 fsl,pinmux-ids = < 37 fsl,pinmux-ids = <
38 0x2153 /* MX28_PAD_SSP2_D5__GPIO_2_21 */ 38 MX28_PAD_SSP2_SS2__GPIO_2_21
39 >; 39 >;
40 fsl,drive-strength = <0>; 40 fsl,drive-strength = <MXS_DRIVE_4mA>;
41 fsl,voltage = <1>; 41 fsl,voltage = <MXS_VOLTAGE_HIGH>;
42 fsl,pull-up = <0>; 42 fsl,pull-up = <MXS_PULL_DISABLE>;
43 }; 43 };
44 }; 44 };
45 }; 45 };
diff --git a/arch/arm/boot/dts/imx28-cfa10049.dts b/arch/arm/boot/dts/imx28-cfa10049.dts
index 06e4cfaf7dd2..7087b4bf6a8f 100644
--- a/arch/arm/boot/dts/imx28-cfa10049.dts
+++ b/arch/arm/boot/dts/imx28-cfa10049.dts
@@ -13,7 +13,7 @@
13 * The CFA-10049 is an expansion board for the CFA-10036 module, thus we 13 * The CFA-10049 is an expansion board for the CFA-10036 module, thus we
14 * need to include the CFA-10036 DTS. 14 * need to include the CFA-10036 DTS.
15 */ 15 */
16/include/ "imx28-cfa10036.dts" 16#include "imx28-cfa10036.dts"
17 17
18/ { 18/ {
19 model = "Crystalfontz CFA-10049 Board"; 19 model = "Crystalfontz CFA-10049 Board";
@@ -25,150 +25,150 @@
25 usb_pins_cfa10049: usb-10049@0 { 25 usb_pins_cfa10049: usb-10049@0 {
26 reg = <0>; 26 reg = <0>;
27 fsl,pinmux-ids = < 27 fsl,pinmux-ids = <
28 0x0073 /* MX28_PAD_GPMI_D7__GPIO_0_7 */ 28 MX28_PAD_GPMI_D07__GPIO_0_7
29 >; 29 >;
30 fsl,drive-strength = <0>; 30 fsl,drive-strength = <MXS_DRIVE_4mA>;
31 fsl,voltage = <1>; 31 fsl,voltage = <MXS_VOLTAGE_HIGH>;
32 fsl,pull-up = <0>; 32 fsl,pull-up = <MXS_PULL_DISABLE>;
33 }; 33 };
34 34
35 i2cmux_pins_cfa10049: i2cmux-10049@0 { 35 i2cmux_pins_cfa10049: i2cmux-10049@0 {
36 reg = <0>; 36 reg = <0>;
37 fsl,pinmux-ids = < 37 fsl,pinmux-ids = <
38 0x1163 /* MX28_PAD_LCD_D22__GPIO_1_22 */ 38 MX28_PAD_LCD_D22__GPIO_1_22
39 0x1173 /* MX28_PAD_LCD_D22__GPIO_1_23 */ 39 MX28_PAD_LCD_D23__GPIO_1_23
40 >; 40 >;
41 fsl,drive-strength = <0>; 41 fsl,drive-strength = <MXS_DRIVE_4mA>;
42 fsl,voltage = <1>; 42 fsl,voltage = <MXS_VOLTAGE_HIGH>;
43 fsl,pull-up = <0>; 43 fsl,pull-up = <MXS_PULL_DISABLE>;
44 }; 44 };
45 45
46 mac0_pins_cfa10049: mac0-10049@0 { 46 mac0_pins_cfa10049: mac0-10049@0 {
47 reg = <0>; 47 reg = <0>;
48 fsl,pinmux-ids = < 48 fsl,pinmux-ids = <
49 0x2153 /* MX28_PAD_SSP2_D5__GPIO_2_21 */ 49 MX28_PAD_SSP2_SS2__GPIO_2_21
50 >; 50 >;
51 fsl,drive-strength = <0>; 51 fsl,drive-strength = <MXS_DRIVE_4mA>;
52 fsl,voltage = <1>; 52 fsl,voltage = <MXS_VOLTAGE_HIGH>;
53 fsl,pull-up = <0>; 53 fsl,pull-up = <MXS_PULL_DISABLE>;
54 }; 54 };
55 55
56 pca_pins_cfa10049: pca-10049@0 { 56 pca_pins_cfa10049: pca-10049@0 {
57 reg = <0>; 57 reg = <0>;
58 fsl,pinmux-ids = < 58 fsl,pinmux-ids = <
59 0x2133 /* MX28_PAD_SSP2_D3__GPIO_2_19 */ 59 MX28_PAD_SSP2_SS0__GPIO_2_19
60 >; 60 >;
61 fsl,drive-strength = <0>; 61 fsl,drive-strength = <MXS_DRIVE_4mA>;
62 fsl,voltage = <1>; 62 fsl,voltage = <MXS_VOLTAGE_HIGH>;
63 fsl,pull-up = <1>; 63 fsl,pull-up = <MXS_PULL_ENABLE>;
64 }; 64 };
65 65
66 rotary_pins_cfa10049: rotary-10049@0 { 66 rotary_pins_cfa10049: rotary-10049@0 {
67 reg = <0>; 67 reg = <0>;
68 fsl,pinmux-ids = < 68 fsl,pinmux-ids = <
69 0x3183 /* MX28_PAD_I2C0_SCL__GPIO_3_24 */ 69 MX28_PAD_I2C0_SCL__GPIO_3_24
70 0x3193 /* MX28_PAD_I2C0_SDA__GPIO_3_25 */ 70 MX28_PAD_I2C0_SDA__GPIO_3_25
71 >; 71 >;
72 fsl,drive-strength = <0>; 72 fsl,drive-strength = <MXS_DRIVE_4mA>;
73 fsl,voltage = <1>; 73 fsl,voltage = <MXS_VOLTAGE_HIGH>;
74 fsl,pull-up = <1>; 74 fsl,pull-up = <MXS_PULL_ENABLE>;
75 }; 75 };
76 76
77 rotary_btn_pins_cfa10049: rotary-btn-10049@0 { 77 rotary_btn_pins_cfa10049: rotary-btn-10049@0 {
78 reg = <0>; 78 reg = <0>;
79 fsl,pinmux-ids = < 79 fsl,pinmux-ids = <
80 0x31a3 /* MX28_PAD_SAIF_SDATA0__GPIO_3_26 */ 80 MX28_PAD_SAIF1_SDATA0__GPIO_3_26
81 >; 81 >;
82 fsl,drive-strength = <0>; 82 fsl,drive-strength = <MXS_DRIVE_4mA>;
83 fsl,voltage = <1>; 83 fsl,voltage = <MXS_VOLTAGE_HIGH>;
84 fsl,pull-up = <1>; 84 fsl,pull-up = <MXS_PULL_ENABLE>;
85 }; 85 };
86 86
87 spi2_pins_cfa10049: spi2-cfa10049@0 { 87 spi2_pins_cfa10049: spi2-cfa10049@0 {
88 reg = <0>; 88 reg = <0>;
89 fsl,pinmux-ids = < 89 fsl,pinmux-ids = <
90 0x2103 /* MX28_PAD_SSP2_SCK__GPIO_2_16 */ 90 MX28_PAD_SSP2_SCK__GPIO_2_16
91 0x2113 /* MX28_PAD_SSP2_CMD__GPIO_2_17 */ 91 MX28_PAD_SSP2_MOSI__GPIO_2_17
92 0x2123 /* MX28_PAD_SSP2_D0__GPIO_2_18 */ 92 MX28_PAD_SSP2_MISO__GPIO_2_18
93 0x3053 /* MX28_PAD_AUART1_TX__GPIO_3_5 */ 93 MX28_PAD_AUART1_TX__GPIO_3_5
94 >; 94 >;
95 fsl,drive-strength = <1>; 95 fsl,drive-strength = <MXS_DRIVE_8mA>;
96 fsl,voltage = <1>; 96 fsl,voltage = <MXS_VOLTAGE_HIGH>;
97 fsl,pull-up = <1>; 97 fsl,pull-up = <MXS_PULL_ENABLE>;
98 }; 98 };
99 99
100 spi3_pins_cfa10049: spi3-cfa10049@0 { 100 spi3_pins_cfa10049: spi3-cfa10049@0 {
101 reg = <0>; 101 reg = <0>;
102 fsl,pinmux-ids = < 102 fsl,pinmux-ids = <
103 0x0183 /* MX28_PAD_GPMI_RDN__GPIO_0_24 */ 103 MX28_PAD_GPMI_RDN__GPIO_0_24
104 0x01c3 /* MX28_PAD_GPMI_RESETN__GPIO_0_28 */ 104 MX28_PAD_GPMI_RESETN__GPIO_0_28
105 0x0113 /* MX28_PAD_GPMI_CE1N__GPIO_0_17 */ 105 MX28_PAD_GPMI_CE1N__GPIO_0_17
106 0x01a3 /* MX28_PAD_GPMI_ALE__GPIO_0_26 */ 106 MX28_PAD_GPMI_ALE__GPIO_0_26
107 0x01b3 /* MX28_PAD_GPMI_CLE__GPIO_0_27 */ 107 MX28_PAD_GPMI_CLE__GPIO_0_27
108 >; 108 >;
109 fsl,drive-strength = <1>; 109 fsl,drive-strength = <MXS_DRIVE_8mA>;
110 fsl,voltage = <1>; 110 fsl,voltage = <MXS_VOLTAGE_HIGH>;
111 fsl,pull-up = <1>; 111 fsl,pull-up = <MXS_PULL_ENABLE>;
112 }; 112 };
113 113
114 lcdif_18bit_pins_cfa10049: lcdif-18bit@0 { 114 lcdif_18bit_pins_cfa10049: lcdif-18bit@0 {
115 reg = <0>; 115 reg = <0>;
116 fsl,pinmux-ids = < 116 fsl,pinmux-ids = <
117 0x1000 /* MX28_PAD_LCD_D00__LCD_D0 */ 117 MX28_PAD_LCD_D00__LCD_D0
118 0x1010 /* MX28_PAD_LCD_D01__LCD_D1 */ 118 MX28_PAD_LCD_D01__LCD_D1
119 0x1020 /* MX28_PAD_LCD_D02__LCD_D2 */ 119 MX28_PAD_LCD_D02__LCD_D2
120 0x1030 /* MX28_PAD_LCD_D03__LCD_D3 */ 120 MX28_PAD_LCD_D03__LCD_D3
121 0x1040 /* MX28_PAD_LCD_D04__LCD_D4 */ 121 MX28_PAD_LCD_D04__LCD_D4
122 0x1050 /* MX28_PAD_LCD_D05__LCD_D5 */ 122 MX28_PAD_LCD_D05__LCD_D5
123 0x1060 /* MX28_PAD_LCD_D06__LCD_D6 */ 123 MX28_PAD_LCD_D06__LCD_D6
124 0x1070 /* MX28_PAD_LCD_D07__LCD_D7 */ 124 MX28_PAD_LCD_D07__LCD_D7
125 0x1080 /* MX28_PAD_LCD_D08__LCD_D8 */ 125 MX28_PAD_LCD_D08__LCD_D8
126 0x1090 /* MX28_PAD_LCD_D09__LCD_D9 */ 126 MX28_PAD_LCD_D09__LCD_D9
127 0x10a0 /* MX28_PAD_LCD_D10__LCD_D10 */ 127 MX28_PAD_LCD_D10__LCD_D10
128 0x10b0 /* MX28_PAD_LCD_D11__LCD_D11 */ 128 MX28_PAD_LCD_D11__LCD_D11
129 0x10c0 /* MX28_PAD_LCD_D12__LCD_D12 */ 129 MX28_PAD_LCD_D12__LCD_D12
130 0x10d0 /* MX28_PAD_LCD_D13__LCD_D13 */ 130 MX28_PAD_LCD_D13__LCD_D13
131 0x10e0 /* MX28_PAD_LCD_D14__LCD_D14 */ 131 MX28_PAD_LCD_D14__LCD_D14
132 0x10f0 /* MX28_PAD_LCD_D15__LCD_D15 */ 132 MX28_PAD_LCD_D15__LCD_D15
133 0x1100 /* MX28_PAD_LCD_D16__LCD_D16 */ 133 MX28_PAD_LCD_D16__LCD_D16
134 0x1110 /* MX28_PAD_LCD_D17__LCD_D17 */ 134 MX28_PAD_LCD_D17__LCD_D17
135 >; 135 >;
136 fsl,drive-strength = <0>; 136 fsl,drive-strength = <MXS_DRIVE_4mA>;
137 fsl,voltage = <1>; 137 fsl,voltage = <MXS_VOLTAGE_HIGH>;
138 fsl,pull-up = <0>; 138 fsl,pull-up = <MXS_PULL_DISABLE>;
139 }; 139 };
140 140
141 lcdif_pins_cfa10049: lcdif-evk@0 { 141 lcdif_pins_cfa10049: lcdif-evk@0 {
142 reg = <0>; 142 reg = <0>;
143 fsl,pinmux-ids = < 143 fsl,pinmux-ids = <
144 0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */ 144 MX28_PAD_LCD_RD_E__LCD_VSYNC
145 0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */ 145 MX28_PAD_LCD_WR_RWN__LCD_HSYNC
146 0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */ 146 MX28_PAD_LCD_RS__LCD_DOTCLK
147 0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */ 147 MX28_PAD_LCD_CS__LCD_ENABLE
148 >; 148 >;
149 fsl,drive-strength = <0>; 149 fsl,drive-strength = <MXS_DRIVE_4mA>;
150 fsl,voltage = <1>; 150 fsl,voltage = <MXS_VOLTAGE_HIGH>;
151 fsl,pull-up = <0>; 151 fsl,pull-up = <MXS_PULL_DISABLE>;
152 }; 152 };
153 153
154 lcdif_pins_cfa10049_pullup: lcdif-10049-pullup@0 { 154 lcdif_pins_cfa10049_pullup: lcdif-10049-pullup@0 {
155 reg = <0>; 155 reg = <0>;
156 fsl,pinmux-ids = < 156 fsl,pinmux-ids = <
157 0x31e3 /* MX28_PAD_LCD_RESET__GPIO_3_30 */ 157 MX28_PAD_LCD_RESET__GPIO_3_30
158 >; 158 >;
159 fsl,drive-strength = <0>; 159 fsl,drive-strength = <MXS_DRIVE_4mA>;
160 fsl,voltage = <1>; 160 fsl,voltage = <MXS_VOLTAGE_HIGH>;
161 fsl,pull-up = <1>; 161 fsl,pull-up = <MXS_PULL_ENABLE>;
162 }; 162 };
163 163
164 w1_gpio_pins: w1-gpio@0 { 164 w1_gpio_pins: w1-gpio@0 {
165 reg = <0>; 165 reg = <0>;
166 fsl,pinmux-ids = < 166 fsl,pinmux-ids = <
167 0x1153 /* MX28_PAD_LCD_D21__GPIO_1_21 */ 167 MX28_PAD_LCD_D21__GPIO_1_21
168 >; 168 >;
169 fsl,drive-strength = <1>; 169 fsl,drive-strength = <MXS_DRIVE_8mA>;
170 fsl,voltage = <1>; 170 fsl,voltage = <MXS_VOLTAGE_HIGH>;
171 fsl,pull-up = <0>; /* 0 will enable the keeper */ 171 fsl,pull-up = <MXS_PULL_DISABLE>; /* 0 will enable the keeper */
172 }; 172 };
173 }; 173 };
174 174
diff --git a/arch/arm/boot/dts/imx28-cfa10055.dts b/arch/arm/boot/dts/imx28-cfa10055.dts
index 171bcbe1ec4b..c3900e7ba331 100644
--- a/arch/arm/boot/dts/imx28-cfa10055.dts
+++ b/arch/arm/boot/dts/imx28-cfa10055.dts
@@ -14,7 +14,7 @@
14 * The CFA-10055 is an expansion board for the CFA-10036 module and 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. 15 * CFA-10037, thus we need to include the CFA-10037 DTS.
16 */ 16 */
17/include/ "imx28-cfa10037.dts" 17#include "imx28-cfa10037.dts"
18 18
19/ { 19/ {
20 model = "Crystalfontz CFA-10055 Board"; 20 model = "Crystalfontz CFA-10055 Board";
@@ -26,64 +26,64 @@
26 spi2_pins_cfa10055: spi2-cfa10055@0 { 26 spi2_pins_cfa10055: spi2-cfa10055@0 {
27 reg = <0>; 27 reg = <0>;
28 fsl,pinmux-ids = < 28 fsl,pinmux-ids = <
29 0x2103 /* MX28_PAD_SSP2_SCK__GPIO_2_16 */ 29 MX28_PAD_SSP2_SCK__GPIO_2_16
30 0x2113 /* MX28_PAD_SSP2_CMD__GPIO_2_17 */ 30 MX28_PAD_SSP2_MOSI__GPIO_2_17
31 0x2123 /* MX28_PAD_SSP2_D0__GPIO_2_18 */ 31 MX28_PAD_SSP2_MISO__GPIO_2_18
32 0x3053 /* MX28_PAD_AUART1_TX__GPIO_3_5 */ 32 MX28_PAD_AUART1_TX__GPIO_3_5
33 >; 33 >;
34 fsl,drive-strength = <1>; 34 fsl,drive-strength = <MXS_DRIVE_8mA>;
35 fsl,voltage = <1>; 35 fsl,voltage = <MXS_VOLTAGE_HIGH>;
36 fsl,pull-up = <1>; 36 fsl,pull-up = <MXS_PULL_ENABLE>;
37 }; 37 };
38 38
39 lcdif_18bit_pins_cfa10055: lcdif-18bit@0 { 39 lcdif_18bit_pins_cfa10055: lcdif-18bit@0 {
40 reg = <0>; 40 reg = <0>;
41 fsl,pinmux-ids = < 41 fsl,pinmux-ids = <
42 0x1000 /* MX28_PAD_LCD_D00__LCD_D0 */ 42 MX28_PAD_LCD_D00__LCD_D0
43 0x1010 /* MX28_PAD_LCD_D01__LCD_D1 */ 43 MX28_PAD_LCD_D01__LCD_D1
44 0x1020 /* MX28_PAD_LCD_D02__LCD_D2 */ 44 MX28_PAD_LCD_D02__LCD_D2
45 0x1030 /* MX28_PAD_LCD_D03__LCD_D3 */ 45 MX28_PAD_LCD_D03__LCD_D3
46 0x1040 /* MX28_PAD_LCD_D04__LCD_D4 */ 46 MX28_PAD_LCD_D04__LCD_D4
47 0x1050 /* MX28_PAD_LCD_D05__LCD_D5 */ 47 MX28_PAD_LCD_D05__LCD_D5
48 0x1060 /* MX28_PAD_LCD_D06__LCD_D6 */ 48 MX28_PAD_LCD_D06__LCD_D6
49 0x1070 /* MX28_PAD_LCD_D07__LCD_D7 */ 49 MX28_PAD_LCD_D07__LCD_D7
50 0x1080 /* MX28_PAD_LCD_D08__LCD_D8 */ 50 MX28_PAD_LCD_D08__LCD_D8
51 0x1090 /* MX28_PAD_LCD_D09__LCD_D9 */ 51 MX28_PAD_LCD_D09__LCD_D9
52 0x10a0 /* MX28_PAD_LCD_D10__LCD_D10 */ 52 MX28_PAD_LCD_D10__LCD_D10
53 0x10b0 /* MX28_PAD_LCD_D11__LCD_D11 */ 53 MX28_PAD_LCD_D11__LCD_D11
54 0x10c0 /* MX28_PAD_LCD_D12__LCD_D12 */ 54 MX28_PAD_LCD_D12__LCD_D12
55 0x10d0 /* MX28_PAD_LCD_D13__LCD_D13 */ 55 MX28_PAD_LCD_D13__LCD_D13
56 0x10e0 /* MX28_PAD_LCD_D14__LCD_D14 */ 56 MX28_PAD_LCD_D14__LCD_D14
57 0x10f0 /* MX28_PAD_LCD_D15__LCD_D15 */ 57 MX28_PAD_LCD_D15__LCD_D15
58 0x1100 /* MX28_PAD_LCD_D16__LCD_D16 */ 58 MX28_PAD_LCD_D16__LCD_D16
59 0x1110 /* MX28_PAD_LCD_D17__LCD_D17 */ 59 MX28_PAD_LCD_D17__LCD_D17
60 >; 60 >;
61 fsl,drive-strength = <0>; 61 fsl,drive-strength = <MXS_DRIVE_4mA>;
62 fsl,voltage = <1>; 62 fsl,voltage = <MXS_VOLTAGE_HIGH>;
63 fsl,pull-up = <0>; 63 fsl,pull-up = <MXS_PULL_DISABLE>;
64 }; 64 };
65 65
66 lcdif_pins_cfa10055: lcdif-evk@0 { 66 lcdif_pins_cfa10055: lcdif-evk@0 {
67 reg = <0>; 67 reg = <0>;
68 fsl,pinmux-ids = < 68 fsl,pinmux-ids = <
69 0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */ 69 MX28_PAD_LCD_RD_E__LCD_VSYNC
70 0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */ 70 MX28_PAD_LCD_WR_RWN__LCD_HSYNC
71 0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */ 71 MX28_PAD_LCD_RS__LCD_DOTCLK
72 0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */ 72 MX28_PAD_LCD_CS__LCD_ENABLE
73 >; 73 >;
74 fsl,drive-strength = <0>; 74 fsl,drive-strength = <MXS_DRIVE_4mA>;
75 fsl,voltage = <1>; 75 fsl,voltage = <MXS_VOLTAGE_HIGH>;
76 fsl,pull-up = <0>; 76 fsl,pull-up = <MXS_PULL_DISABLE>;
77 }; 77 };
78 78
79 lcdif_pins_cfa10055_pullup: lcdif-10055-pullup@0 { 79 lcdif_pins_cfa10055_pullup: lcdif-10055-pullup@0 {
80 reg = <0>; 80 reg = <0>;
81 fsl,pinmux-ids = < 81 fsl,pinmux-ids = <
82 0x31e3 /* MX28_PAD_LCD_RESET__GPIO_3_30 */ 82 MX28_PAD_LCD_RESET__GPIO_3_30
83 >; 83 >;
84 fsl,drive-strength = <0>; 84 fsl,drive-strength = <MXS_DRIVE_4mA>;
85 fsl,voltage = <1>; 85 fsl,voltage = <MXS_VOLTAGE_HIGH>;
86 fsl,pull-up = <1>; 86 fsl,pull-up = <MXS_PULL_ENABLE>;
87 }; 87 };
88 }; 88 };
89 89
diff --git a/arch/arm/boot/dts/imx28-cfa10056.dts b/arch/arm/boot/dts/imx28-cfa10056.dts
index b45dd0e4ee57..cef959a97219 100644
--- a/arch/arm/boot/dts/imx28-cfa10056.dts
+++ b/arch/arm/boot/dts/imx28-cfa10056.dts
@@ -13,7 +13,7 @@
13 * The CFA-10055 is an expansion board for the CFA-10036 module and 13 * The CFA-10055 is an expansion board for the CFA-10036 module and
14 * CFA-10037, thus we need to include the CFA-10037 DTS. 14 * CFA-10037, thus we need to include the CFA-10037 DTS.
15 */ 15 */
16/include/ "imx28-cfa10037.dts" 16#include "imx28-cfa10037.dts"
17 17
18/ { 18/ {
19 model = "Crystalfontz CFA-10056 Board"; 19 model = "Crystalfontz CFA-10056 Board";
@@ -25,37 +25,37 @@
25 spi2_pins_cfa10056: spi2-cfa10056@0 { 25 spi2_pins_cfa10056: spi2-cfa10056@0 {
26 reg = <0>; 26 reg = <0>;
27 fsl,pinmux-ids = < 27 fsl,pinmux-ids = <
28 0x2103 /* MX28_PAD_SSP2_SCK__GPIO_2_16 */ 28 MX28_PAD_SSP2_SCK__GPIO_2_16
29 0x2113 /* MX28_PAD_SSP2_CMD__GPIO_2_17 */ 29 MX28_PAD_SSP2_MOSI__GPIO_2_17
30 0x2123 /* MX28_PAD_SSP2_D0__GPIO_2_18 */ 30 MX28_PAD_SSP2_MISO__GPIO_2_18
31 0x3053 /* MX28_PAD_AUART1_TX__GPIO_3_5 */ 31 MX28_PAD_AUART1_TX__GPIO_3_5
32 >; 32 >;
33 fsl,drive-strength = <1>; 33 fsl,drive-strength = <MXS_DRIVE_8mA>;
34 fsl,voltage = <1>; 34 fsl,voltage = <MXS_VOLTAGE_HIGH>;
35 fsl,pull-up = <1>; 35 fsl,pull-up = <MXS_PULL_ENABLE>;
36 }; 36 };
37 37
38 lcdif_pins_cfa10056: lcdif-10056@0 { 38 lcdif_pins_cfa10056: lcdif-10056@0 {
39 reg = <0>; 39 reg = <0>;
40 fsl,pinmux-ids = < 40 fsl,pinmux-ids = <
41 0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */ 41 MX28_PAD_LCD_RD_E__LCD_VSYNC
42 0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */ 42 MX28_PAD_LCD_WR_RWN__LCD_HSYNC
43 0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */ 43 MX28_PAD_LCD_RS__LCD_DOTCLK
44 0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */ 44 MX28_PAD_LCD_CS__LCD_ENABLE
45 >; 45 >;
46 fsl,drive-strength = <0>; 46 fsl,drive-strength = <MXS_DRIVE_4mA>;
47 fsl,voltage = <1>; 47 fsl,voltage = <MXS_VOLTAGE_HIGH>;
48 fsl,pull-up = <0>; 48 fsl,pull-up = <MXS_PULL_DISABLE>;
49 }; 49 };
50 50
51 lcdif_pins_cfa10056_pullup: lcdif-10056-pullup@0 { 51 lcdif_pins_cfa10056_pullup: lcdif-10056-pullup@0 {
52 reg = <0>; 52 reg = <0>;
53 fsl,pinmux-ids = < 53 fsl,pinmux-ids = <
54 0x31e3 /* MX28_PAD_LCD_RESET__GPIO_3_30 */ 54 MX28_PAD_LCD_RESET__GPIO_3_30
55 >; 55 >;
56 fsl,drive-strength = <0>; 56 fsl,drive-strength = <MXS_DRIVE_4mA>;
57 fsl,voltage = <1>; 57 fsl,voltage = <MXS_VOLTAGE_HIGH>;
58 fsl,pull-up = <1>; 58 fsl,pull-up = <MXS_PULL_ENABLE>;
59 }; 59 };
60 }; 60 };
61 61
diff --git a/arch/arm/boot/dts/imx28-cfa10057.dts b/arch/arm/boot/dts/imx28-cfa10057.dts
index 0333c0532f28..3c1312885ae0 100644
--- a/arch/arm/boot/dts/imx28-cfa10057.dts
+++ b/arch/arm/boot/dts/imx28-cfa10057.dts
@@ -14,7 +14,7 @@
14 * The CFA-10057 is an expansion board for the CFA-10036 module, thus we 14 * The CFA-10057 is an expansion board for the CFA-10036 module, thus we
15 * need to include the CFA-10036 DTS. 15 * need to include the CFA-10036 DTS.
16 */ 16 */
17/include/ "imx28-cfa10036.dts" 17#include "imx28-cfa10036.dts"
18 18
19/ { 19/ {
20 model = "Crystalfontz CFA-10057 Board"; 20 model = "Crystalfontz CFA-10057 Board";
@@ -26,51 +26,51 @@
26 usb_pins_cfa10057: usb-10057@0 { 26 usb_pins_cfa10057: usb-10057@0 {
27 reg = <0>; 27 reg = <0>;
28 fsl,pinmux-ids = < 28 fsl,pinmux-ids = <
29 0x0073 /* MX28_PAD_GPMI_D7__GPIO_0_7 */ 29 MX28_PAD_GPMI_D07__GPIO_0_7
30 >; 30 >;
31 fsl,drive-strength = <0>; 31 fsl,drive-strength = <MXS_DRIVE_4mA>;
32 fsl,voltage = <1>; 32 fsl,voltage = <MXS_VOLTAGE_HIGH>;
33 fsl,pull-up = <0>; 33 fsl,pull-up = <MXS_PULL_DISABLE>;
34 }; 34 };
35 35
36 lcdif_18bit_pins_cfa10057: lcdif-18bit@0 { 36 lcdif_18bit_pins_cfa10057: lcdif-18bit@0 {
37 reg = <0>; 37 reg = <0>;
38 fsl,pinmux-ids = < 38 fsl,pinmux-ids = <
39 0x1000 /* MX28_PAD_LCD_D00__LCD_D0 */ 39 MX28_PAD_LCD_D00__LCD_D0
40 0x1010 /* MX28_PAD_LCD_D01__LCD_D1 */ 40 MX28_PAD_LCD_D01__LCD_D1
41 0x1020 /* MX28_PAD_LCD_D02__LCD_D2 */ 41 MX28_PAD_LCD_D02__LCD_D2
42 0x1030 /* MX28_PAD_LCD_D03__LCD_D3 */ 42 MX28_PAD_LCD_D03__LCD_D3
43 0x1040 /* MX28_PAD_LCD_D04__LCD_D4 */ 43 MX28_PAD_LCD_D04__LCD_D4
44 0x1050 /* MX28_PAD_LCD_D05__LCD_D5 */ 44 MX28_PAD_LCD_D05__LCD_D5
45 0x1060 /* MX28_PAD_LCD_D06__LCD_D6 */ 45 MX28_PAD_LCD_D06__LCD_D6
46 0x1070 /* MX28_PAD_LCD_D07__LCD_D7 */ 46 MX28_PAD_LCD_D07__LCD_D7
47 0x1080 /* MX28_PAD_LCD_D08__LCD_D8 */ 47 MX28_PAD_LCD_D08__LCD_D8
48 0x1090 /* MX28_PAD_LCD_D09__LCD_D9 */ 48 MX28_PAD_LCD_D09__LCD_D9
49 0x10a0 /* MX28_PAD_LCD_D10__LCD_D10 */ 49 MX28_PAD_LCD_D10__LCD_D10
50 0x10b0 /* MX28_PAD_LCD_D11__LCD_D11 */ 50 MX28_PAD_LCD_D11__LCD_D11
51 0x10c0 /* MX28_PAD_LCD_D12__LCD_D12 */ 51 MX28_PAD_LCD_D12__LCD_D12
52 0x10d0 /* MX28_PAD_LCD_D13__LCD_D13 */ 52 MX28_PAD_LCD_D13__LCD_D13
53 0x10e0 /* MX28_PAD_LCD_D14__LCD_D14 */ 53 MX28_PAD_LCD_D14__LCD_D14
54 0x10f0 /* MX28_PAD_LCD_D15__LCD_D15 */ 54 MX28_PAD_LCD_D15__LCD_D15
55 0x1100 /* MX28_PAD_LCD_D16__LCD_D16 */ 55 MX28_PAD_LCD_D16__LCD_D16
56 0x1110 /* MX28_PAD_LCD_D17__LCD_D17 */ 56 MX28_PAD_LCD_D17__LCD_D17
57 >; 57 >;
58 fsl,drive-strength = <0>; 58 fsl,drive-strength = <MXS_DRIVE_4mA>;
59 fsl,voltage = <1>; 59 fsl,voltage = <MXS_VOLTAGE_HIGH>;
60 fsl,pull-up = <0>; 60 fsl,pull-up = <MXS_PULL_DISABLE>;
61 }; 61 };
62 62
63 lcdif_pins_cfa10057: lcdif-evk@0 { 63 lcdif_pins_cfa10057: lcdif-evk@0 {
64 reg = <0>; 64 reg = <0>;
65 fsl,pinmux-ids = < 65 fsl,pinmux-ids = <
66 0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */ 66 MX28_PAD_LCD_RD_E__LCD_VSYNC
67 0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */ 67 MX28_PAD_LCD_WR_RWN__LCD_HSYNC
68 0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */ 68 MX28_PAD_LCD_RS__LCD_DOTCLK
69 0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */ 69 MX28_PAD_LCD_CS__LCD_ENABLE
70 >; 70 >;
71 fsl,drive-strength = <0>; 71 fsl,drive-strength = <MXS_DRIVE_4mA>;
72 fsl,voltage = <1>; 72 fsl,voltage = <MXS_VOLTAGE_HIGH>;
73 fsl,pull-up = <0>; 73 fsl,pull-up = <MXS_PULL_DISABLE>;
74 }; 74 };
75 }; 75 };
76 76
diff --git a/arch/arm/boot/dts/imx28-cfa10058.dts b/arch/arm/boot/dts/imx28-cfa10058.dts
index 64c64c55a82a..2469d34df0ae 100644
--- a/arch/arm/boot/dts/imx28-cfa10058.dts
+++ b/arch/arm/boot/dts/imx28-cfa10058.dts
@@ -14,7 +14,7 @@
14 * The CFA-10058 is an expansion board for the CFA-10036 module, thus we 14 * The CFA-10058 is an expansion board for the CFA-10036 module, thus we
15 * need to include the CFA-10036 DTS. 15 * need to include the CFA-10036 DTS.
16 */ 16 */
17/include/ "imx28-cfa10036.dts" 17#include "imx28-cfa10036.dts"
18 18
19/ { 19/ {
20 model = "Crystalfontz CFA-10058 Board"; 20 model = "Crystalfontz CFA-10058 Board";
@@ -26,24 +26,24 @@
26 usb_pins_cfa10058: usb-10058@0 { 26 usb_pins_cfa10058: usb-10058@0 {
27 reg = <0>; 27 reg = <0>;
28 fsl,pinmux-ids = < 28 fsl,pinmux-ids = <
29 0x0073 /* MX28_PAD_GPMI_D7__GPIO_0_7 */ 29 MX28_PAD_GPMI_D07__GPIO_0_7
30 >; 30 >;
31 fsl,drive-strength = <0>; 31 fsl,drive-strength = <MXS_DRIVE_4mA>;
32 fsl,voltage = <1>; 32 fsl,voltage = <MXS_VOLTAGE_HIGH>;
33 fsl,pull-up = <0>; 33 fsl,pull-up = <MXS_PULL_DISABLE>;
34 }; 34 };
35 35
36 lcdif_pins_cfa10058: lcdif-10058@0 { 36 lcdif_pins_cfa10058: lcdif-10058@0 {
37 reg = <0>; 37 reg = <0>;
38 fsl,pinmux-ids = < 38 fsl,pinmux-ids = <
39 0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */ 39 MX28_PAD_LCD_RD_E__LCD_VSYNC
40 0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */ 40 MX28_PAD_LCD_WR_RWN__LCD_HSYNC
41 0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */ 41 MX28_PAD_LCD_RS__LCD_DOTCLK
42 0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */ 42 MX28_PAD_LCD_CS__LCD_ENABLE
43 >; 43 >;
44 fsl,drive-strength = <0>; 44 fsl,drive-strength = <MXS_DRIVE_4mA>;
45 fsl,voltage = <1>; 45 fsl,voltage = <MXS_VOLTAGE_HIGH>;
46 fsl,pull-up = <0>; 46 fsl,pull-up = <MXS_PULL_DISABLE>;
47 }; 47 };
48 }; 48 };
49 49
diff --git a/arch/arm/boot/dts/imx28-evk.dts b/arch/arm/boot/dts/imx28-evk.dts
index 15715d921d14..4267c2b05d60 100644
--- a/arch/arm/boot/dts/imx28-evk.dts
+++ b/arch/arm/boot/dts/imx28-evk.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "imx28.dtsi" 13#include "imx28.dtsi"
14 14
15/ { 15/ {
16 model = "Freescale i.MX28 Evaluation Kit"; 16 model = "Freescale i.MX28 Evaluation Kit";
@@ -70,52 +70,52 @@
70 hog_pins_a: hog@0 { 70 hog_pins_a: hog@0 {
71 reg = <0>; 71 reg = <0>;
72 fsl,pinmux-ids = < 72 fsl,pinmux-ids = <
73 0x20d3 /* MX28_PAD_SSP1_CMD__GPIO_2_13 */ 73 MX28_PAD_SSP1_CMD__GPIO_2_13
74 0x20f3 /* MX28_PAD_SSP1_DATA3__GPIO_2_15 */ 74 MX28_PAD_SSP1_DATA3__GPIO_2_15
75 0x40d3 /* MX28_PAD_ENET0_RX_CLK__GPIO_4_13 */ 75 MX28_PAD_ENET0_RX_CLK__GPIO_4_13
76 0x20c3 /* MX28_PAD_SSP1_SCK__GPIO_2_12 */ 76 MX28_PAD_SSP1_SCK__GPIO_2_12
77 0x31c3 /* MX28_PAD_PWM3__GPIO_3_28 */ 77 MX28_PAD_PWM3__GPIO_3_28
78 0x31e3 /* MX28_PAD_LCD_RESET__GPIO_3_30 */ 78 MX28_PAD_LCD_RESET__GPIO_3_30
79 0x3083 /* MX28_PAD_AUART2_RX__GPIO_3_8 */ 79 MX28_PAD_AUART2_RX__GPIO_3_8
80 0x3093 /* MX28_PAD_AUART2_TX__GPIO_3_9 */ 80 MX28_PAD_AUART2_TX__GPIO_3_9
81 >; 81 >;
82 fsl,drive-strength = <0>; 82 fsl,drive-strength = <MXS_DRIVE_4mA>;
83 fsl,voltage = <1>; 83 fsl,voltage = <MXS_VOLTAGE_HIGH>;
84 fsl,pull-up = <0>; 84 fsl,pull-up = <MXS_PULL_DISABLE>;
85 }; 85 };
86 86
87 led_pin_gpio3_5: led_gpio3_5@0 { 87 led_pin_gpio3_5: led_gpio3_5@0 {
88 reg = <0>; 88 reg = <0>;
89 fsl,pinmux-ids = < 89 fsl,pinmux-ids = <
90 0x3053 /* MX28_PAD_AUART1_TX__GPIO_3_5 */ 90 MX28_PAD_AUART1_TX__GPIO_3_5
91 >; 91 >;
92 fsl,drive-strength = <0>; 92 fsl,drive-strength = <MXS_DRIVE_4mA>;
93 fsl,voltage = <1>; 93 fsl,voltage = <MXS_VOLTAGE_HIGH>;
94 fsl,pull-up = <0>; 94 fsl,pull-up = <MXS_PULL_DISABLE>;
95 }; 95 };
96 96
97 gpmi_pins_evk: gpmi-nand-evk@0 { 97 gpmi_pins_evk: gpmi-nand-evk@0 {
98 reg = <0>; 98 reg = <0>;
99 fsl,pinmux-ids = < 99 fsl,pinmux-ids = <
100 0x0110 /* MX28_PAD_GPMI_CE1N__GPMI_CE1N */ 100 MX28_PAD_GPMI_CE1N__GPMI_CE1N
101 0x0150 /* MX28_PAD_GPMI_RDY1__GPMI_READY1 */ 101 MX28_PAD_GPMI_RDY1__GPMI_READY1
102 >; 102 >;
103 fsl,drive-strength = <0>; 103 fsl,drive-strength = <MXS_DRIVE_4mA>;
104 fsl,voltage = <1>; 104 fsl,voltage = <MXS_VOLTAGE_HIGH>;
105 fsl,pull-up = <0>; 105 fsl,pull-up = <MXS_PULL_DISABLE>;
106 }; 106 };
107 107
108 lcdif_pins_evk: lcdif-evk@0 { 108 lcdif_pins_evk: lcdif-evk@0 {
109 reg = <0>; 109 reg = <0>;
110 fsl,pinmux-ids = < 110 fsl,pinmux-ids = <
111 0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */ 111 MX28_PAD_LCD_RD_E__LCD_VSYNC
112 0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */ 112 MX28_PAD_LCD_WR_RWN__LCD_HSYNC
113 0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */ 113 MX28_PAD_LCD_RS__LCD_DOTCLK
114 0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */ 114 MX28_PAD_LCD_CS__LCD_ENABLE
115 >; 115 >;
116 fsl,drive-strength = <0>; 116 fsl,drive-strength = <MXS_DRIVE_4mA>;
117 fsl,voltage = <1>; 117 fsl,voltage = <MXS_VOLTAGE_HIGH>;
118 fsl,pull-up = <0>; 118 fsl,pull-up = <MXS_PULL_DISABLE>;
119 }; 119 };
120 }; 120 };
121 121
@@ -182,7 +182,12 @@
182 }; 182 };
183 183
184 lradc@80050000 { 184 lradc@80050000 {
185 fsl,lradc-touchscreen-wires = <4>;
185 status = "okay"; 186 status = "okay";
187 fsl,lradc-touchscreen-wires = <4>;
188 fsl,ave-ctrl = <4>;
189 fsl,ave-delay = <2>;
190 fsl,settling = <10>;
186 }; 191 };
187 192
188 i2c0: i2c@80058000 { 193 i2c0: i2c@80058000 {
@@ -242,6 +247,8 @@
242 247
243 ahb@80080000 { 248 ahb@80080000 {
244 usb0: usb@80080000 { 249 usb0: usb@80080000 {
250 pinctrl-names = "default";
251 pinctrl-0 = <&usb0_id_pins_a>;
245 vbus-supply = <&reg_usb0_vbus>; 252 vbus-supply = <&reg_usb0_vbus>;
246 status = "okay"; 253 status = "okay";
247 }; 254 };
diff --git a/arch/arm/boot/dts/imx28-m28cu3.dts b/arch/arm/boot/dts/imx28-m28cu3.dts
new file mode 100644
index 000000000000..d3958da60bd7
--- /dev/null
+++ b/arch/arm/boot/dts/imx28-m28cu3.dts
@@ -0,0 +1,266 @@
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 "imx28.dtsi"
14
15/ {
16 model = "MSR M28CU3";
17 compatible = "msr,m28cu3", "fsl,imx28";
18
19 memory {
20 reg = <0x40000000 0x08000000>;
21 };
22
23 apb@80000000 {
24 apbh@80000000 {
25 gpmi-nand@8000c000 {
26 #address-cells = <1>;
27 #size-cells = <1>;
28 pinctrl-names = "default";
29 pinctrl-0 = <&gpmi_pins_a &gpmi_status_cfg>;
30 status = "okay";
31
32 partition@0 {
33 label = "gpmi-nfc-0-boot";
34 reg = <0x00000000 0x01400000>;
35 read-only;
36 };
37
38 partition@1 {
39 label = "gpmi-nfc-general-use";
40 reg = <0x01400000 0x0ec00000>;
41 };
42 };
43
44 ssp0: ssp@80010000 {
45 compatible = "fsl,imx28-mmc";
46 pinctrl-names = "default";
47 pinctrl-0 = <&mmc0_4bit_pins_a
48 &mmc0_cd_cfg
49 &mmc0_sck_cfg>;
50 bus-width = <4>;
51 vmmc-supply = <&reg_vddio_sd0>;
52 status = "okay";
53 };
54
55 ssp2: ssp@80014000 {
56 compatible = "fsl,imx28-mmc";
57 pinctrl-names = "default";
58 pinctrl-0 = <&mmc2_4bit_pins_a
59 &mmc2_cd_cfg
60 &mmc2_sck_cfg>;
61 bus-width = <4>;
62 vmmc-supply = <&reg_vddio_sd1>;
63 status = "okay";
64 };
65
66 pinctrl@80018000 {
67 pinctrl-names = "default";
68 pinctrl-0 = <&hog_pins_a>;
69
70 hog_pins_a: hog@0 {
71 reg = <0>;
72 fsl,pinmux-ids = <
73 MX28_PAD_SSP2_SS0__GPIO_2_19
74 MX28_PAD_PWM4__GPIO_3_29
75 MX28_PAD_AUART2_RX__GPIO_3_8
76 MX28_PAD_ENET0_RX_CLK__GPIO_4_13
77 >;
78 fsl,drive-strength = <MXS_DRIVE_4mA>;
79 fsl,voltage = <MXS_VOLTAGE_HIGH>;
80 fsl,pull-up = <MXS_PULL_DISABLE>;
81 };
82
83 lcdif_pins_m28: lcdif-m28@0 {
84 reg = <0>;
85 fsl,pinmux-ids = <
86 MX28_PAD_LCD_VSYNC__LCD_VSYNC
87 MX28_PAD_LCD_HSYNC__LCD_HSYNC
88 MX28_PAD_LCD_DOTCLK__LCD_DOTCLK
89 MX28_PAD_LCD_RESET__LCD_RESET
90 MX28_PAD_LCD_CS__LCD_ENABLE
91 MX28_PAD_AUART1_TX__GPIO_3_5
92 >;
93 fsl,drive-strength = <MXS_DRIVE_4mA>;
94 fsl,voltage = <MXS_VOLTAGE_HIGH>;
95 fsl,pull-up = <MXS_PULL_DISABLE>;
96 };
97
98 led_pins_gpio: leds-m28@0 {
99 reg = <0>;
100 fsl,pinmux-ids = <
101 MX28_PAD_SSP3_MISO__GPIO_2_26
102 MX28_PAD_SSP3_SCK__GPIO_2_24
103 >;
104 fsl,drive-strength = <MXS_DRIVE_4mA>;
105 fsl,voltage = <MXS_VOLTAGE_HIGH>;
106 fsl,pull-up = <MXS_PULL_DISABLE>;
107 };
108 };
109
110 ocotp@8002c000 {
111 status = "okay";
112 };
113
114 lcdif@80030000 {
115 pinctrl-names = "default";
116 pinctrl-0 = <&lcdif_24bit_pins_a
117 &lcdif_pins_m28>;
118 display = <&display>;
119 reset-active-high;
120 status = "okay";
121
122 display: display0 {
123 bits-per-pixel = <32>;
124 bus-width = <24>;
125
126 display-timings {
127 native-mode = <&timing0>;
128 timing0: timing0 {
129 clock-frequency = <6410256>;
130 hactive = <320>;
131 vactive = <240>;
132 hback-porch = <38>;
133 hfront-porch = <20>;
134 vback-porch = <15>;
135 vfront-porch = <5>;
136 hsync-len = <30>;
137 vsync-len = <3>;
138 hsync-active = <0>;
139 vsync-active = <0>;
140 de-active = <1>;
141 pixelclk-active = <1>;
142 };
143 };
144 };
145 };
146 };
147
148 apbx@80040000 {
149 duart: serial@80074000 {
150 pinctrl-names = "default";
151 pinctrl-0 = <&duart_pins_b>;
152 status = "okay";
153 };
154
155 usbphy1: usbphy@8007e000 {
156 status = "okay";
157 };
158
159 auart0: serial@8006a000 {
160 pinctrl-names = "default";
161 pinctrl-0 = <&auart0_2pins_a>;
162 status = "okay";
163 };
164
165 auart3: serial@80070000 {
166 pinctrl-names = "default";
167 pinctrl-0 = <&auart3_2pins_b>;
168 status = "okay";
169 };
170
171 pwm: pwm@80064000 {
172 pinctrl-names = "default";
173 pinctrl-0 = <&pwm3_pins_a>;
174 status = "okay";
175 };
176 };
177 };
178
179 ahb@80080000 {
180 usb1: usb@80090000 {
181 vbus-supply = <&reg_usb1_vbus>;
182 pinctrl-names = "default";
183 pinctrl-0 = <&usbphy1_pins_a>;
184 disable-over-current;
185 status = "okay";
186 };
187
188 mac0: ethernet@800f0000 {
189 phy-mode = "rmii";
190 pinctrl-names = "default";
191 pinctrl-0 = <&mac0_pins_a>;
192 phy-reset-gpios = <&gpio4 13 0>;
193 phy-reset-duration = <100>;
194 status = "okay";
195 };
196
197 mac1: ethernet@800f4000 {
198 phy-mode = "rmii";
199 pinctrl-names = "default";
200 pinctrl-0 = <&mac1_pins_a>;
201 status = "okay";
202 };
203 };
204
205 backlight {
206 compatible = "pwm-backlight";
207 pwms = <&pwm 3 5000000>;
208 brightness-levels = <0 4 8 16 32 64 128 255>;
209 default-brightness-level = <6>;
210 };
211
212 leds {
213 compatible = "gpio-leds";
214 pinctrl-names = "default";
215 pinctrl-0 = <&led_pins_gpio>;
216
217 user1 {
218 label = "sd0-led";
219 gpios = <&gpio2 26 0>;
220 linux,default-trigger = "mmc0";
221 };
222
223 user2 {
224 label = "sd1-led";
225 gpios = <&gpio2 24 0>;
226 linux,default-trigger = "mmc2";
227 };
228 };
229
230 regulators {
231 compatible = "simple-bus";
232
233 reg_3p3v: 3p3v {
234 compatible = "regulator-fixed";
235 regulator-name = "3P3V";
236 regulator-min-microvolt = <3300000>;
237 regulator-max-microvolt = <3300000>;
238 regulator-always-on;
239 };
240
241 reg_vddio_sd0: vddio-sd0 {
242 compatible = "regulator-fixed";
243 regulator-name = "vddio-sd0";
244 regulator-min-microvolt = <3300000>;
245 regulator-max-microvolt = <3300000>;
246 gpio = <&gpio3 29 0>;
247 };
248
249 reg_vddio_sd1: vddio-sd1 {
250 compatible = "regulator-fixed";
251 regulator-name = "vddio-sd1";
252 regulator-min-microvolt = <3300000>;
253 regulator-max-microvolt = <3300000>;
254 gpio = <&gpio2 19 0>;
255 };
256
257 reg_usb1_vbus: usb1_vbus {
258 compatible = "regulator-fixed";
259 regulator-name = "usb1_vbus";
260 regulator-min-microvolt = <5000000>;
261 regulator-max-microvolt = <5000000>;
262 gpio = <&gpio3 8 0>;
263 enable-active-high;
264 };
265 };
266};
diff --git a/arch/arm/boot/dts/imx28-m28evk.dts b/arch/arm/boot/dts/imx28-m28evk.dts
index 0d322a2bebaf..8e2477fbe1d7 100644
--- a/arch/arm/boot/dts/imx28-m28evk.dts
+++ b/arch/arm/boot/dts/imx28-m28evk.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "imx28.dtsi" 13#include "imx28.dtsi"
14 14
15/ { 15/ {
16 model = "DENX M28EVK"; 16 model = "DENX M28EVK";
@@ -92,26 +92,26 @@
92 hog_pins_a: hog@0 { 92 hog_pins_a: hog@0 {
93 reg = <0>; 93 reg = <0>;
94 fsl,pinmux-ids = < 94 fsl,pinmux-ids = <
95 0x31c3 /* MX28_PAD_PWM3__GPIO_3_28 */ 95 MX28_PAD_PWM3__GPIO_3_28
96 0x30a3 /* MX28_PAD_AUART2_CTS__GPIO_3_10 */ 96 MX28_PAD_AUART2_CTS__GPIO_3_10
97 0x30b3 /* MX28_PAD_AUART2_RTS__GPIO_3_11 */ 97 MX28_PAD_AUART2_RTS__GPIO_3_11
98 0x30c3 /* MX28_PAD_AUART3_RX__GPIO_3_12 */ 98 MX28_PAD_AUART3_RX__GPIO_3_12
99 0x30d3 /* MX28_PAD_AUART3_TX__GPIO_3_13 */ 99 MX28_PAD_AUART3_TX__GPIO_3_13
100 >; 100 >;
101 fsl,drive-strength = <0>; 101 fsl,drive-strength = <MXS_DRIVE_4mA>;
102 fsl,voltage = <1>; 102 fsl,voltage = <MXS_VOLTAGE_HIGH>;
103 fsl,pull-up = <0>; 103 fsl,pull-up = <MXS_PULL_DISABLE>;
104 }; 104 };
105 105
106 lcdif_pins_m28: lcdif-m28@0 { 106 lcdif_pins_m28: lcdif-m28@0 {
107 reg = <0>; 107 reg = <0>;
108 fsl,pinmux-ids = < 108 fsl,pinmux-ids = <
109 0x11e0 /* MX28_PAD_LCD_DOTCLK__LCD_DOTCLK */ 109 MX28_PAD_LCD_DOTCLK__LCD_DOTCLK
110 0x11f0 /* MX28_PAD_LCD_ENABLE__LCD_ENABLE */ 110 MX28_PAD_LCD_ENABLE__LCD_ENABLE
111 >; 111 >;
112 fsl,drive-strength = <0>; 112 fsl,drive-strength = <MXS_DRIVE_4mA>;
113 fsl,voltage = <1>; 113 fsl,voltage = <MXS_VOLTAGE_HIGH>;
114 fsl,pull-up = <0>; 114 fsl,pull-up = <MXS_PULL_DISABLE>;
115 }; 115 };
116 }; 116 };
117 117
diff --git a/arch/arm/boot/dts/imx28-pinfunc.h b/arch/arm/boot/dts/imx28-pinfunc.h
new file mode 100644
index 000000000000..e11f69ba0fe4
--- /dev/null
+++ b/arch/arm/boot/dts/imx28-pinfunc.h
@@ -0,0 +1,506 @@
1/*
2 * Header providing constants for i.MX28 pinctrl bindings.
3 *
4 * Copyright (C) 2013 Lothar Waßmann <LW@KARO-electronics.de>
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 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#ifndef __DT_BINDINGS_MX28_PINCTRL_H__
15#define __DT_BINDINGS_MX28_PINCTRL_H__
16
17#include "mxs-pinfunc.h"
18
19#define MX28_PAD_GPMI_D00__GPMI_D0 0x0000
20#define MX28_PAD_GPMI_D01__GPMI_D1 0x0010
21#define MX28_PAD_GPMI_D02__GPMI_D2 0x0020
22#define MX28_PAD_GPMI_D03__GPMI_D3 0x0030
23#define MX28_PAD_GPMI_D04__GPMI_D4 0x0040
24#define MX28_PAD_GPMI_D05__GPMI_D5 0x0050
25#define MX28_PAD_GPMI_D06__GPMI_D6 0x0060
26#define MX28_PAD_GPMI_D07__GPMI_D7 0x0070
27#define MX28_PAD_GPMI_CE0N__GPMI_CE0N 0x0100
28#define MX28_PAD_GPMI_CE1N__GPMI_CE1N 0x0110
29#define MX28_PAD_GPMI_CE2N__GPMI_CE2N 0x0120
30#define MX28_PAD_GPMI_CE3N__GPMI_CE3N 0x0130
31#define MX28_PAD_GPMI_RDY0__GPMI_READY0 0x0140
32#define MX28_PAD_GPMI_RDY1__GPMI_READY1 0x0150
33#define MX28_PAD_GPMI_RDY2__GPMI_READY2 0x0160
34#define MX28_PAD_GPMI_RDY3__GPMI_READY3 0x0170
35#define MX28_PAD_GPMI_RDN__GPMI_RDN 0x0180
36#define MX28_PAD_GPMI_WRN__GPMI_WRN 0x0190
37#define MX28_PAD_GPMI_ALE__GPMI_ALE 0x01a0
38#define MX28_PAD_GPMI_CLE__GPMI_CLE 0x01b0
39#define MX28_PAD_GPMI_RESETN__GPMI_RESETN 0x01c0
40#define MX28_PAD_LCD_D00__LCD_D0 0x1000
41#define MX28_PAD_LCD_D01__LCD_D1 0x1010
42#define MX28_PAD_LCD_D02__LCD_D2 0x1020
43#define MX28_PAD_LCD_D03__LCD_D3 0x1030
44#define MX28_PAD_LCD_D04__LCD_D4 0x1040
45#define MX28_PAD_LCD_D05__LCD_D5 0x1050
46#define MX28_PAD_LCD_D06__LCD_D6 0x1060
47#define MX28_PAD_LCD_D07__LCD_D7 0x1070
48#define MX28_PAD_LCD_D08__LCD_D8 0x1080
49#define MX28_PAD_LCD_D09__LCD_D9 0x1090
50#define MX28_PAD_LCD_D10__LCD_D10 0x10a0
51#define MX28_PAD_LCD_D11__LCD_D11 0x10b0
52#define MX28_PAD_LCD_D12__LCD_D12 0x10c0
53#define MX28_PAD_LCD_D13__LCD_D13 0x10d0
54#define MX28_PAD_LCD_D14__LCD_D14 0x10e0
55#define MX28_PAD_LCD_D15__LCD_D15 0x10f0
56#define MX28_PAD_LCD_D16__LCD_D16 0x1100
57#define MX28_PAD_LCD_D17__LCD_D17 0x1110
58#define MX28_PAD_LCD_D18__LCD_D18 0x1120
59#define MX28_PAD_LCD_D19__LCD_D19 0x1130
60#define MX28_PAD_LCD_D20__LCD_D20 0x1140
61#define MX28_PAD_LCD_D21__LCD_D21 0x1150
62#define MX28_PAD_LCD_D22__LCD_D22 0x1160
63#define MX28_PAD_LCD_D23__LCD_D23 0x1170
64#define MX28_PAD_LCD_RD_E__LCD_RD_E 0x1180
65#define MX28_PAD_LCD_WR_RWN__LCD_WR_RWN 0x1190
66#define MX28_PAD_LCD_RS__LCD_RS 0x11a0
67#define MX28_PAD_LCD_CS__LCD_CS 0x11b0
68#define MX28_PAD_LCD_VSYNC__LCD_VSYNC 0x11c0
69#define MX28_PAD_LCD_HSYNC__LCD_HSYNC 0x11d0
70#define MX28_PAD_LCD_DOTCLK__LCD_DOTCLK 0x11e0
71#define MX28_PAD_LCD_ENABLE__LCD_ENABLE 0x11f0
72#define MX28_PAD_SSP0_DATA0__SSP0_D0 0x2000
73#define MX28_PAD_SSP0_DATA1__SSP0_D1 0x2010
74#define MX28_PAD_SSP0_DATA2__SSP0_D2 0x2020
75#define MX28_PAD_SSP0_DATA3__SSP0_D3 0x2030
76#define MX28_PAD_SSP0_DATA4__SSP0_D4 0x2040
77#define MX28_PAD_SSP0_DATA5__SSP0_D5 0x2050
78#define MX28_PAD_SSP0_DATA6__SSP0_D6 0x2060
79#define MX28_PAD_SSP0_DATA7__SSP0_D7 0x2070
80#define MX28_PAD_SSP0_CMD__SSP0_CMD 0x2080
81#define MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT 0x2090
82#define MX28_PAD_SSP0_SCK__SSP0_SCK 0x20a0
83#define MX28_PAD_SSP1_SCK__SSP1_SCK 0x20c0
84#define MX28_PAD_SSP1_CMD__SSP1_CMD 0x20d0
85#define MX28_PAD_SSP1_DATA0__SSP1_D0 0x20e0
86#define MX28_PAD_SSP1_DATA3__SSP1_D3 0x20f0
87#define MX28_PAD_SSP2_SCK__SSP2_SCK 0x2100
88#define MX28_PAD_SSP2_MOSI__SSP2_CMD 0x2110
89#define MX28_PAD_SSP2_MISO__SSP2_D0 0x2120
90#define MX28_PAD_SSP2_SS0__SSP2_D3 0x2130
91#define MX28_PAD_SSP2_SS1__SSP2_D4 0x2140
92#define MX28_PAD_SSP2_SS2__SSP2_D5 0x2150
93#define MX28_PAD_SSP3_SCK__SSP3_SCK 0x2180
94#define MX28_PAD_SSP3_MOSI__SSP3_CMD 0x2190
95#define MX28_PAD_SSP3_MISO__SSP3_D0 0x21a0
96#define MX28_PAD_SSP3_SS0__SSP3_D3 0x21b0
97#define MX28_PAD_AUART0_RX__AUART0_RX 0x3000
98#define MX28_PAD_AUART0_TX__AUART0_TX 0x3010
99#define MX28_PAD_AUART0_CTS__AUART0_CTS 0x3020
100#define MX28_PAD_AUART0_RTS__AUART0_RTS 0x3030
101#define MX28_PAD_AUART1_RX__AUART1_RX 0x3040
102#define MX28_PAD_AUART1_TX__AUART1_TX 0x3050
103#define MX28_PAD_AUART1_CTS__AUART1_CTS 0x3060
104#define MX28_PAD_AUART1_RTS__AUART1_RTS 0x3070
105#define MX28_PAD_AUART2_RX__AUART2_RX 0x3080
106#define MX28_PAD_AUART2_TX__AUART2_TX 0x3090
107#define MX28_PAD_AUART2_CTS__AUART2_CTS 0x30a0
108#define MX28_PAD_AUART2_RTS__AUART2_RTS 0x30b0
109#define MX28_PAD_AUART3_RX__AUART3_RX 0x30c0
110#define MX28_PAD_AUART3_TX__AUART3_TX 0x30d0
111#define MX28_PAD_AUART3_CTS__AUART3_CTS 0x30e0
112#define MX28_PAD_AUART3_RTS__AUART3_RTS 0x30f0
113#define MX28_PAD_PWM0__PWM_0 0x3100
114#define MX28_PAD_PWM1__PWM_1 0x3110
115#define MX28_PAD_PWM2__PWM_2 0x3120
116#define MX28_PAD_SAIF0_MCLK__SAIF0_MCLK 0x3140
117#define MX28_PAD_SAIF0_LRCLK__SAIF0_LRCLK 0x3150
118#define MX28_PAD_SAIF0_BITCLK__SAIF0_BITCLK 0x3160
119#define MX28_PAD_SAIF0_SDATA0__SAIF0_SDATA0 0x3170
120#define MX28_PAD_I2C0_SCL__I2C0_SCL 0x3180
121#define MX28_PAD_I2C0_SDA__I2C0_SDA 0x3190
122#define MX28_PAD_SAIF1_SDATA0__SAIF1_SDATA0 0x31a0
123#define MX28_PAD_SPDIF__SPDIF_TX 0x31b0
124#define MX28_PAD_PWM3__PWM_3 0x31c0
125#define MX28_PAD_PWM4__PWM_4 0x31d0
126#define MX28_PAD_LCD_RESET__LCD_RESET 0x31e0
127#define MX28_PAD_ENET0_MDC__ENET0_MDC 0x4000
128#define MX28_PAD_ENET0_MDIO__ENET0_MDIO 0x4010
129#define MX28_PAD_ENET0_RX_EN__ENET0_RX_EN 0x4020
130#define MX28_PAD_ENET0_RXD0__ENET0_RXD0 0x4030
131#define MX28_PAD_ENET0_RXD1__ENET0_RXD1 0x4040
132#define MX28_PAD_ENET0_TX_CLK__ENET0_TX_CLK 0x4050
133#define MX28_PAD_ENET0_TX_EN__ENET0_TX_EN 0x4060
134#define MX28_PAD_ENET0_TXD0__ENET0_TXD0 0x4070
135#define MX28_PAD_ENET0_TXD1__ENET0_TXD1 0x4080
136#define MX28_PAD_ENET0_RXD2__ENET0_RXD2 0x4090
137#define MX28_PAD_ENET0_RXD3__ENET0_RXD3 0x40a0
138#define MX28_PAD_ENET0_TXD2__ENET0_TXD2 0x40b0
139#define MX28_PAD_ENET0_TXD3__ENET0_TXD3 0x40c0
140#define MX28_PAD_ENET0_RX_CLK__ENET0_RX_CLK 0x40d0
141#define MX28_PAD_ENET0_COL__ENET0_COL 0x40e0
142#define MX28_PAD_ENET0_CRS__ENET0_CRS 0x40f0
143#define MX28_PAD_ENET_CLK__CLKCTRL_ENET 0x4100
144#define MX28_PAD_JTAG_RTCK__JTAG_RTCK 0x4140
145#define MX28_PAD_EMI_D00__EMI_DATA0 0x5000
146#define MX28_PAD_EMI_D01__EMI_DATA1 0x5010
147#define MX28_PAD_EMI_D02__EMI_DATA2 0x5020
148#define MX28_PAD_EMI_D03__EMI_DATA3 0x5030
149#define MX28_PAD_EMI_D04__EMI_DATA4 0x5040
150#define MX28_PAD_EMI_D05__EMI_DATA5 0x5050
151#define MX28_PAD_EMI_D06__EMI_DATA6 0x5060
152#define MX28_PAD_EMI_D07__EMI_DATA7 0x5070
153#define MX28_PAD_EMI_D08__EMI_DATA8 0x5080
154#define MX28_PAD_EMI_D09__EMI_DATA9 0x5090
155#define MX28_PAD_EMI_D10__EMI_DATA10 0x50a0
156#define MX28_PAD_EMI_D11__EMI_DATA11 0x50b0
157#define MX28_PAD_EMI_D12__EMI_DATA12 0x50c0
158#define MX28_PAD_EMI_D13__EMI_DATA13 0x50d0
159#define MX28_PAD_EMI_D14__EMI_DATA14 0x50e0
160#define MX28_PAD_EMI_D15__EMI_DATA15 0x50f0
161#define MX28_PAD_EMI_ODT0__EMI_ODT0 0x5100
162#define MX28_PAD_EMI_DQM0__EMI_DQM0 0x5110
163#define MX28_PAD_EMI_ODT1__EMI_ODT1 0x5120
164#define MX28_PAD_EMI_DQM1__EMI_DQM1 0x5130
165#define MX28_PAD_EMI_DDR_OPEN_FB__EMI_DDR_OPEN_FEEDBACK 0x5140
166#define MX28_PAD_EMI_CLK__EMI_CLK 0x5150
167#define MX28_PAD_EMI_DQS0__EMI_DQS0 0x5160
168#define MX28_PAD_EMI_DQS1__EMI_DQS1 0x5170
169#define MX28_PAD_EMI_DDR_OPEN__EMI_DDR_OPEN 0x51a0
170#define MX28_PAD_EMI_A00__EMI_ADDR0 0x6000
171#define MX28_PAD_EMI_A01__EMI_ADDR1 0x6010
172#define MX28_PAD_EMI_A02__EMI_ADDR2 0x6020
173#define MX28_PAD_EMI_A03__EMI_ADDR3 0x6030
174#define MX28_PAD_EMI_A04__EMI_ADDR4 0x6040
175#define MX28_PAD_EMI_A05__EMI_ADDR5 0x6050
176#define MX28_PAD_EMI_A06__EMI_ADDR6 0x6060
177#define MX28_PAD_EMI_A07__EMI_ADDR7 0x6070
178#define MX28_PAD_EMI_A08__EMI_ADDR8 0x6080
179#define MX28_PAD_EMI_A09__EMI_ADDR9 0x6090
180#define MX28_PAD_EMI_A10__EMI_ADDR10 0x60a0
181#define MX28_PAD_EMI_A11__EMI_ADDR11 0x60b0
182#define MX28_PAD_EMI_A12__EMI_ADDR12 0x60c0
183#define MX28_PAD_EMI_A13__EMI_ADDR13 0x60d0
184#define MX28_PAD_EMI_A14__EMI_ADDR14 0x60e0
185#define MX28_PAD_EMI_BA0__EMI_BA0 0x6100
186#define MX28_PAD_EMI_BA1__EMI_BA1 0x6110
187#define MX28_PAD_EMI_BA2__EMI_BA2 0x6120
188#define MX28_PAD_EMI_CASN__EMI_CASN 0x6130
189#define MX28_PAD_EMI_RASN__EMI_RASN 0x6140
190#define MX28_PAD_EMI_WEN__EMI_WEN 0x6150
191#define MX28_PAD_EMI_CE0N__EMI_CE0N 0x6160
192#define MX28_PAD_EMI_CE1N__EMI_CE1N 0x6170
193#define MX28_PAD_EMI_CKE__EMI_CKE 0x6180
194#define MX28_PAD_GPMI_D00__SSP1_D0 0x0001
195#define MX28_PAD_GPMI_D01__SSP1_D1 0x0011
196#define MX28_PAD_GPMI_D02__SSP1_D2 0x0021
197#define MX28_PAD_GPMI_D03__SSP1_D3 0x0031
198#define MX28_PAD_GPMI_D04__SSP1_D4 0x0041
199#define MX28_PAD_GPMI_D05__SSP1_D5 0x0051
200#define MX28_PAD_GPMI_D06__SSP1_D6 0x0061
201#define MX28_PAD_GPMI_D07__SSP1_D7 0x0071
202#define MX28_PAD_GPMI_CE0N__SSP3_D0 0x0101
203#define MX28_PAD_GPMI_CE1N__SSP3_D3 0x0111
204#define MX28_PAD_GPMI_CE2N__CAN1_TX 0x0121
205#define MX28_PAD_GPMI_CE3N__CAN1_RX 0x0131
206#define MX28_PAD_GPMI_RDY0__SSP1_CARD_DETECT 0x0141
207#define MX28_PAD_GPMI_RDY1__SSP1_CMD 0x0151
208#define MX28_PAD_GPMI_RDY2__CAN0_TX 0x0161
209#define MX28_PAD_GPMI_RDY3__CAN0_RX 0x0171
210#define MX28_PAD_GPMI_RDN__SSP3_SCK 0x0181
211#define MX28_PAD_GPMI_WRN__SSP1_SCK 0x0191
212#define MX28_PAD_GPMI_ALE__SSP3_D1 0x01a1
213#define MX28_PAD_GPMI_CLE__SSP3_D2 0x01b1
214#define MX28_PAD_GPMI_RESETN__SSP3_CMD 0x01c1
215#define MX28_PAD_LCD_D03__ETM_DA8 0x1031
216#define MX28_PAD_LCD_D04__ETM_DA9 0x1041
217#define MX28_PAD_LCD_D08__ETM_DA3 0x1081
218#define MX28_PAD_LCD_D09__ETM_DA4 0x1091
219#define MX28_PAD_LCD_D20__ENET1_1588_EVENT2_OUT 0x1141
220#define MX28_PAD_LCD_D21__ENET1_1588_EVENT2_IN 0x1151
221#define MX28_PAD_LCD_D22__ENET1_1588_EVENT3_OUT 0x1161
222#define MX28_PAD_LCD_D23__ENET1_1588_EVENT3_IN 0x1171
223#define MX28_PAD_LCD_RD_E__LCD_VSYNC 0x1181
224#define MX28_PAD_LCD_WR_RWN__LCD_HSYNC 0x1191
225#define MX28_PAD_LCD_RS__LCD_DOTCLK 0x11a1
226#define MX28_PAD_LCD_CS__LCD_ENABLE 0x11b1
227#define MX28_PAD_LCD_VSYNC__SAIF1_SDATA0 0x11c1
228#define MX28_PAD_LCD_HSYNC__SAIF1_SDATA1 0x11d1
229#define MX28_PAD_LCD_DOTCLK__SAIF1_MCLK 0x11e1
230#define MX28_PAD_SSP0_DATA4__SSP2_D0 0x2041
231#define MX28_PAD_SSP0_DATA5__SSP2_D3 0x2051
232#define MX28_PAD_SSP0_DATA6__SSP2_CMD 0x2061
233#define MX28_PAD_SSP0_DATA7__SSP2_SCK 0x2071
234#define MX28_PAD_SSP1_SCK__SSP2_D1 0x20c1
235#define MX28_PAD_SSP1_CMD__SSP2_D2 0x20d1
236#define MX28_PAD_SSP1_DATA0__SSP2_D6 0x20e1
237#define MX28_PAD_SSP1_DATA3__SSP2_D7 0x20f1
238#define MX28_PAD_SSP2_SCK__AUART2_RX 0x2101
239#define MX28_PAD_SSP2_MOSI__AUART2_TX 0x2111
240#define MX28_PAD_SSP2_MISO__AUART3_RX 0x2121
241#define MX28_PAD_SSP2_SS0__AUART3_TX 0x2131
242#define MX28_PAD_SSP2_SS1__SSP2_D1 0x2141
243#define MX28_PAD_SSP2_SS2__SSP2_D2 0x2151
244#define MX28_PAD_SSP3_SCK__AUART4_TX 0x2181
245#define MX28_PAD_SSP3_MOSI__AUART4_RX 0x2191
246#define MX28_PAD_SSP3_MISO__AUART4_RTS 0x21a1
247#define MX28_PAD_SSP3_SS0__AUART4_CTS 0x21b1
248#define MX28_PAD_AUART0_RX__I2C0_SCL 0x3001
249#define MX28_PAD_AUART0_TX__I2C0_SDA 0x3011
250#define MX28_PAD_AUART0_CTS__AUART4_RX 0x3021
251#define MX28_PAD_AUART0_RTS__AUART4_TX 0x3031
252#define MX28_PAD_AUART1_RX__SSP2_CARD_DETECT 0x3041
253#define MX28_PAD_AUART1_TX__SSP3_CARD_DETECT 0x3051
254#define MX28_PAD_AUART1_CTS__USB0_OVERCURRENT 0x3061
255#define MX28_PAD_AUART1_RTS__USB0_ID 0x3071
256#define MX28_PAD_AUART2_RX__SSP3_D1 0x3081
257#define MX28_PAD_AUART2_TX__SSP3_D2 0x3091
258#define MX28_PAD_AUART2_CTS__I2C1_SCL 0x30a1
259#define MX28_PAD_AUART2_RTS__I2C1_SDA 0x30b1
260#define MX28_PAD_AUART3_RX__CAN0_TX 0x30c1
261#define MX28_PAD_AUART3_TX__CAN0_RX 0x30d1
262#define MX28_PAD_AUART3_CTS__CAN1_TX 0x30e1
263#define MX28_PAD_AUART3_RTS__CAN1_RX 0x30f1
264#define MX28_PAD_PWM0__I2C1_SCL 0x3101
265#define MX28_PAD_PWM1__I2C1_SDA 0x3111
266#define MX28_PAD_PWM2__USB0_ID 0x3121
267#define MX28_PAD_SAIF0_MCLK__PWM_3 0x3141
268#define MX28_PAD_SAIF0_LRCLK__PWM_4 0x3151
269#define MX28_PAD_SAIF0_BITCLK__PWM_5 0x3161
270#define MX28_PAD_SAIF0_SDATA0__PWM_6 0x3171
271#define MX28_PAD_I2C0_SCL__TIMROT_ROTARYA 0x3181
272#define MX28_PAD_I2C0_SDA__TIMROT_ROTARYB 0x3191
273#define MX28_PAD_SAIF1_SDATA0__PWM_7 0x31a1
274#define MX28_PAD_LCD_RESET__LCD_VSYNC 0x31e1
275#define MX28_PAD_ENET0_MDC__GPMI_CE4N 0x4001
276#define MX28_PAD_ENET0_MDIO__GPMI_CE5N 0x4011
277#define MX28_PAD_ENET0_RX_EN__GPMI_CE6N 0x4021
278#define MX28_PAD_ENET0_RXD0__GPMI_CE7N 0x4031
279#define MX28_PAD_ENET0_RXD1__GPMI_READY4 0x4041
280#define MX28_PAD_ENET0_TX_CLK__HSADC_TRIGGER 0x4051
281#define MX28_PAD_ENET0_TX_EN__GPMI_READY5 0x4061
282#define MX28_PAD_ENET0_TXD0__GPMI_READY6 0x4071
283#define MX28_PAD_ENET0_TXD1__GPMI_READY7 0x4081
284#define MX28_PAD_ENET0_RXD2__ENET1_RXD0 0x4091
285#define MX28_PAD_ENET0_RXD3__ENET1_RXD1 0x40a1
286#define MX28_PAD_ENET0_TXD2__ENET1_TXD0 0x40b1
287#define MX28_PAD_ENET0_TXD3__ENET1_TXD1 0x40c1
288#define MX28_PAD_ENET0_RX_CLK__ENET0_RX_ER 0x40d1
289#define MX28_PAD_ENET0_COL__ENET1_TX_EN 0x40e1
290#define MX28_PAD_ENET0_CRS__ENET1_RX_EN 0x40f1
291#define MX28_PAD_GPMI_CE2N__ENET0_RX_ER 0x0122
292#define MX28_PAD_GPMI_CE3N__SAIF1_MCLK 0x0132
293#define MX28_PAD_GPMI_RDY0__USB0_ID 0x0142
294#define MX28_PAD_GPMI_RDY2__ENET0_TX_ER 0x0162
295#define MX28_PAD_GPMI_RDY3__HSADC_TRIGGER 0x0172
296#define MX28_PAD_GPMI_ALE__SSP3_D4 0x01a2
297#define MX28_PAD_GPMI_CLE__SSP3_D5 0x01b2
298#define MX28_PAD_LCD_D00__ETM_DA0 0x1002
299#define MX28_PAD_LCD_D01__ETM_DA1 0x1012
300#define MX28_PAD_LCD_D02__ETM_DA2 0x1022
301#define MX28_PAD_LCD_D03__ETM_DA3 0x1032
302#define MX28_PAD_LCD_D04__ETM_DA4 0x1042
303#define MX28_PAD_LCD_D05__ETM_DA5 0x1052
304#define MX28_PAD_LCD_D06__ETM_DA6 0x1062
305#define MX28_PAD_LCD_D07__ETM_DA7 0x1072
306#define MX28_PAD_LCD_D08__ETM_DA8 0x1082
307#define MX28_PAD_LCD_D09__ETM_DA9 0x1092
308#define MX28_PAD_LCD_D10__ETM_DA10 0x10a2
309#define MX28_PAD_LCD_D11__ETM_DA11 0x10b2
310#define MX28_PAD_LCD_D12__ETM_DA12 0x10c2
311#define MX28_PAD_LCD_D13__ETM_DA13 0x10d2
312#define MX28_PAD_LCD_D14__ETM_DA14 0x10e2
313#define MX28_PAD_LCD_D15__ETM_DA15 0x10f2
314#define MX28_PAD_LCD_D16__ETM_DA7 0x1102
315#define MX28_PAD_LCD_D17__ETM_DA6 0x1112
316#define MX28_PAD_LCD_D18__ETM_DA5 0x1122
317#define MX28_PAD_LCD_D19__ETM_DA4 0x1132
318#define MX28_PAD_LCD_D20__ETM_DA3 0x1142
319#define MX28_PAD_LCD_D21__ETM_DA2 0x1152
320#define MX28_PAD_LCD_D22__ETM_DA1 0x1162
321#define MX28_PAD_LCD_D23__ETM_DA0 0x1172
322#define MX28_PAD_LCD_RD_E__ETM_TCTL 0x1182
323#define MX28_PAD_LCD_WR_RWN__ETM_TCLK 0x1192
324#define MX28_PAD_LCD_HSYNC__ETM_TCTL 0x11d2
325#define MX28_PAD_LCD_DOTCLK__ETM_TCLK 0x11e2
326#define MX28_PAD_SSP1_SCK__ENET0_1588_EVENT2_OUT 0x20c2
327#define MX28_PAD_SSP1_CMD__ENET0_1588_EVENT2_IN 0x20d2
328#define MX28_PAD_SSP1_DATA0__ENET0_1588_EVENT3_OUT 0x20e2
329#define MX28_PAD_SSP1_DATA3__ENET0_1588_EVENT3_IN 0x20f2
330#define MX28_PAD_SSP2_SCK__SAIF0_SDATA1 0x2102
331#define MX28_PAD_SSP2_MOSI__SAIF0_SDATA2 0x2112
332#define MX28_PAD_SSP2_MISO__SAIF1_SDATA1 0x2122
333#define MX28_PAD_SSP2_SS0__SAIF1_SDATA2 0x2132
334#define MX28_PAD_SSP2_SS1__USB1_OVERCURRENT 0x2142
335#define MX28_PAD_SSP2_SS2__USB0_OVERCURRENT 0x2152
336#define MX28_PAD_SSP3_SCK__ENET1_1588_EVENT0_OUT 0x2182
337#define MX28_PAD_SSP3_MOSI__ENET1_1588_EVENT0_IN 0x2192
338#define MX28_PAD_SSP3_MISO__ENET1_1588_EVENT1_OUT 0x21a2
339#define MX28_PAD_SSP3_SS0__ENET1_1588_EVENT1_IN 0x21b2
340#define MX28_PAD_AUART0_RX__DUART_CTS 0x3002
341#define MX28_PAD_AUART0_TX__DUART_RTS 0x3012
342#define MX28_PAD_AUART0_CTS__DUART_RX 0x3022
343#define MX28_PAD_AUART0_RTS__DUART_TX 0x3032
344#define MX28_PAD_AUART1_RX__PWM_0 0x3042
345#define MX28_PAD_AUART1_TX__PWM_1 0x3052
346#define MX28_PAD_AUART1_CTS__TIMROT_ROTARYA 0x3062
347#define MX28_PAD_AUART1_RTS__TIMROT_ROTARYB 0x3072
348#define MX28_PAD_AUART2_RX__SSP3_D4 0x3082
349#define MX28_PAD_AUART2_TX__SSP3_D5 0x3092
350#define MX28_PAD_AUART2_CTS__SAIF1_BITCLK 0x30a2
351#define MX28_PAD_AUART2_RTS__SAIF1_LRCLK 0x30b2
352#define MX28_PAD_AUART3_RX__ENET0_1588_EVENT0_OUT 0x30c2
353#define MX28_PAD_AUART3_TX__ENET0_1588_EVENT0_IN 0x30d2
354#define MX28_PAD_AUART3_CTS__ENET0_1588_EVENT1_OUT 0x30e2
355#define MX28_PAD_AUART3_RTS__ENET0_1588_EVENT1_IN 0x30f2
356#define MX28_PAD_PWM0__DUART_RX 0x3102
357#define MX28_PAD_PWM1__DUART_TX 0x3112
358#define MX28_PAD_PWM2__USB1_OVERCURRENT 0x3122
359#define MX28_PAD_SAIF0_MCLK__AUART4_CTS 0x3142
360#define MX28_PAD_SAIF0_LRCLK__AUART4_RTS 0x3152
361#define MX28_PAD_SAIF0_BITCLK__AUART4_RX 0x3162
362#define MX28_PAD_SAIF0_SDATA0__AUART4_TX 0x3172
363#define MX28_PAD_I2C0_SCL__DUART_RX 0x3182
364#define MX28_PAD_I2C0_SDA__DUART_TX 0x3192
365#define MX28_PAD_SAIF1_SDATA0__SAIF0_SDATA1 0x31a2
366#define MX28_PAD_SPDIF__ENET1_RX_ER 0x31b2
367#define MX28_PAD_ENET0_MDC__SAIF0_SDATA1 0x4002
368#define MX28_PAD_ENET0_MDIO__SAIF0_SDATA2 0x4012
369#define MX28_PAD_ENET0_RX_EN__SAIF1_SDATA1 0x4022
370#define MX28_PAD_ENET0_RXD0__SAIF1_SDATA2 0x4032
371#define MX28_PAD_ENET0_TX_CLK__ENET0_1588_EVENT2_OUT 0x4052
372#define MX28_PAD_ENET0_RXD2__ENET0_1588_EVENT0_OUT 0x4092
373#define MX28_PAD_ENET0_RXD3__ENET0_1588_EVENT0_IN 0x40a2
374#define MX28_PAD_ENET0_TXD2__ENET0_1588_EVENT1_OUT 0x40b2
375#define MX28_PAD_ENET0_TXD3__ENET0_1588_EVENT1_IN 0x40c2
376#define MX28_PAD_ENET0_RX_CLK__ENET0_1588_EVENT2_IN 0x40d2
377#define MX28_PAD_ENET0_COL__ENET0_1588_EVENT3_OUT 0x40e2
378#define MX28_PAD_ENET0_CRS__ENET0_1588_EVENT3_IN 0x40f2
379#define MX28_PAD_GPMI_D00__GPIO_0_0 0x0003
380#define MX28_PAD_GPMI_D01__GPIO_0_1 0x0013
381#define MX28_PAD_GPMI_D02__GPIO_0_2 0x0023
382#define MX28_PAD_GPMI_D03__GPIO_0_3 0x0033
383#define MX28_PAD_GPMI_D04__GPIO_0_4 0x0043
384#define MX28_PAD_GPMI_D05__GPIO_0_5 0x0053
385#define MX28_PAD_GPMI_D06__GPIO_0_6 0x0063
386#define MX28_PAD_GPMI_D07__GPIO_0_7 0x0073
387#define MX28_PAD_GPMI_CE0N__GPIO_0_16 0x0103
388#define MX28_PAD_GPMI_CE1N__GPIO_0_17 0x0113
389#define MX28_PAD_GPMI_CE2N__GPIO_0_18 0x0123
390#define MX28_PAD_GPMI_CE3N__GPIO_0_19 0x0133
391#define MX28_PAD_GPMI_RDY0__GPIO_0_20 0x0143
392#define MX28_PAD_GPMI_RDY1__GPIO_0_21 0x0153
393#define MX28_PAD_GPMI_RDY2__GPIO_0_22 0x0163
394#define MX28_PAD_GPMI_RDY3__GPIO_0_23 0x0173
395#define MX28_PAD_GPMI_RDN__GPIO_0_24 0x0183
396#define MX28_PAD_GPMI_WRN__GPIO_0_25 0x0193
397#define MX28_PAD_GPMI_ALE__GPIO_0_26 0x01a3
398#define MX28_PAD_GPMI_CLE__GPIO_0_27 0x01b3
399#define MX28_PAD_GPMI_RESETN__GPIO_0_28 0x01c3
400#define MX28_PAD_LCD_D00__GPIO_1_0 0x1003
401#define MX28_PAD_LCD_D01__GPIO_1_1 0x1013
402#define MX28_PAD_LCD_D02__GPIO_1_2 0x1023
403#define MX28_PAD_LCD_D03__GPIO_1_3 0x1033
404#define MX28_PAD_LCD_D04__GPIO_1_4 0x1043
405#define MX28_PAD_LCD_D05__GPIO_1_5 0x1053
406#define MX28_PAD_LCD_D06__GPIO_1_6 0x1063
407#define MX28_PAD_LCD_D07__GPIO_1_7 0x1073
408#define MX28_PAD_LCD_D08__GPIO_1_8 0x1083
409#define MX28_PAD_LCD_D09__GPIO_1_9 0x1093
410#define MX28_PAD_LCD_D10__GPIO_1_10 0x10a3
411#define MX28_PAD_LCD_D11__GPIO_1_11 0x10b3
412#define MX28_PAD_LCD_D12__GPIO_1_12 0x10c3
413#define MX28_PAD_LCD_D13__GPIO_1_13 0x10d3
414#define MX28_PAD_LCD_D14__GPIO_1_14 0x10e3
415#define MX28_PAD_LCD_D15__GPIO_1_15 0x10f3
416#define MX28_PAD_LCD_D16__GPIO_1_16 0x1103
417#define MX28_PAD_LCD_D17__GPIO_1_17 0x1113
418#define MX28_PAD_LCD_D18__GPIO_1_18 0x1123
419#define MX28_PAD_LCD_D19__GPIO_1_19 0x1133
420#define MX28_PAD_LCD_D20__GPIO_1_20 0x1143
421#define MX28_PAD_LCD_D21__GPIO_1_21 0x1153
422#define MX28_PAD_LCD_D22__GPIO_1_22 0x1163
423#define MX28_PAD_LCD_D23__GPIO_1_23 0x1173
424#define MX28_PAD_LCD_RD_E__GPIO_1_24 0x1183
425#define MX28_PAD_LCD_WR_RWN__GPIO_1_25 0x1193
426#define MX28_PAD_LCD_RS__GPIO_1_26 0x11a3
427#define MX28_PAD_LCD_CS__GPIO_1_27 0x11b3
428#define MX28_PAD_LCD_VSYNC__GPIO_1_28 0x11c3
429#define MX28_PAD_LCD_HSYNC__GPIO_1_29 0x11d3
430#define MX28_PAD_LCD_DOTCLK__GPIO_1_30 0x11e3
431#define MX28_PAD_LCD_ENABLE__GPIO_1_31 0x11f3
432#define MX28_PAD_SSP0_DATA0__GPIO_2_0 0x2003
433#define MX28_PAD_SSP0_DATA1__GPIO_2_1 0x2013
434#define MX28_PAD_SSP0_DATA2__GPIO_2_2 0x2023
435#define MX28_PAD_SSP0_DATA3__GPIO_2_3 0x2033
436#define MX28_PAD_SSP0_DATA4__GPIO_2_4 0x2043
437#define MX28_PAD_SSP0_DATA5__GPIO_2_5 0x2053
438#define MX28_PAD_SSP0_DATA6__GPIO_2_6 0x2063
439#define MX28_PAD_SSP0_DATA7__GPIO_2_7 0x2073
440#define MX28_PAD_SSP0_CMD__GPIO_2_8 0x2083
441#define MX28_PAD_SSP0_DETECT__GPIO_2_9 0x2093
442#define MX28_PAD_SSP0_SCK__GPIO_2_10 0x20a3
443#define MX28_PAD_SSP1_SCK__GPIO_2_12 0x20c3
444#define MX28_PAD_SSP1_CMD__GPIO_2_13 0x20d3
445#define MX28_PAD_SSP1_DATA0__GPIO_2_14 0x20e3
446#define MX28_PAD_SSP1_DATA3__GPIO_2_15 0x20f3
447#define MX28_PAD_SSP2_SCK__GPIO_2_16 0x2103
448#define MX28_PAD_SSP2_MOSI__GPIO_2_17 0x2113
449#define MX28_PAD_SSP2_MISO__GPIO_2_18 0x2123
450#define MX28_PAD_SSP2_SS0__GPIO_2_19 0x2133
451#define MX28_PAD_SSP2_SS1__GPIO_2_20 0x2143
452#define MX28_PAD_SSP2_SS2__GPIO_2_21 0x2153
453#define MX28_PAD_SSP3_SCK__GPIO_2_24 0x2183
454#define MX28_PAD_SSP3_MOSI__GPIO_2_25 0x2193
455#define MX28_PAD_SSP3_MISO__GPIO_2_26 0x21a3
456#define MX28_PAD_SSP3_SS0__GPIO_2_27 0x21b3
457#define MX28_PAD_AUART0_RX__GPIO_3_0 0x3003
458#define MX28_PAD_AUART0_TX__GPIO_3_1 0x3013
459#define MX28_PAD_AUART0_CTS__GPIO_3_2 0x3023
460#define MX28_PAD_AUART0_RTS__GPIO_3_3 0x3033
461#define MX28_PAD_AUART1_RX__GPIO_3_4 0x3043
462#define MX28_PAD_AUART1_TX__GPIO_3_5 0x3053
463#define MX28_PAD_AUART1_CTS__GPIO_3_6 0x3063
464#define MX28_PAD_AUART1_RTS__GPIO_3_7 0x3073
465#define MX28_PAD_AUART2_RX__GPIO_3_8 0x3083
466#define MX28_PAD_AUART2_TX__GPIO_3_9 0x3093
467#define MX28_PAD_AUART2_CTS__GPIO_3_10 0x30a3
468#define MX28_PAD_AUART2_RTS__GPIO_3_11 0x30b3
469#define MX28_PAD_AUART3_RX__GPIO_3_12 0x30c3
470#define MX28_PAD_AUART3_TX__GPIO_3_13 0x30d3
471#define MX28_PAD_AUART3_CTS__GPIO_3_14 0x30e3
472#define MX28_PAD_AUART3_RTS__GPIO_3_15 0x30f3
473#define MX28_PAD_PWM0__GPIO_3_16 0x3103
474#define MX28_PAD_PWM1__GPIO_3_17 0x3113
475#define MX28_PAD_PWM2__GPIO_3_18 0x3123
476#define MX28_PAD_SAIF0_MCLK__GPIO_3_20 0x3143
477#define MX28_PAD_SAIF0_LRCLK__GPIO_3_21 0x3153
478#define MX28_PAD_SAIF0_BITCLK__GPIO_3_22 0x3163
479#define MX28_PAD_SAIF0_SDATA0__GPIO_3_23 0x3173
480#define MX28_PAD_I2C0_SCL__GPIO_3_24 0x3183
481#define MX28_PAD_I2C0_SDA__GPIO_3_25 0x3193
482#define MX28_PAD_SAIF1_SDATA0__GPIO_3_26 0x31a3
483#define MX28_PAD_SPDIF__GPIO_3_27 0x31b3
484#define MX28_PAD_PWM3__GPIO_3_28 0x31c3
485#define MX28_PAD_PWM4__GPIO_3_29 0x31d3
486#define MX28_PAD_LCD_RESET__GPIO_3_30 0x31e3
487#define MX28_PAD_ENET0_MDC__GPIO_4_0 0x4003
488#define MX28_PAD_ENET0_MDIO__GPIO_4_1 0x4013
489#define MX28_PAD_ENET0_RX_EN__GPIO_4_2 0x4023
490#define MX28_PAD_ENET0_RXD0__GPIO_4_3 0x4033
491#define MX28_PAD_ENET0_RXD1__GPIO_4_4 0x4043
492#define MX28_PAD_ENET0_TX_CLK__GPIO_4_5 0x4053
493#define MX28_PAD_ENET0_TX_EN__GPIO_4_6 0x4063
494#define MX28_PAD_ENET0_TXD0__GPIO_4_7 0x4073
495#define MX28_PAD_ENET0_TXD1__GPIO_4_8 0x4083
496#define MX28_PAD_ENET0_RXD2__GPIO_4_9 0x4093
497#define MX28_PAD_ENET0_RXD3__GPIO_4_10 0x40a3
498#define MX28_PAD_ENET0_TXD2__GPIO_4_11 0x40b3
499#define MX28_PAD_ENET0_TXD3__GPIO_4_12 0x40c3
500#define MX28_PAD_ENET0_RX_CLK__GPIO_4_13 0x40d3
501#define MX28_PAD_ENET0_COL__GPIO_4_14 0x40e3
502#define MX28_PAD_ENET0_CRS__GPIO_4_15 0x40f3
503#define MX28_PAD_ENET_CLK__GPIO_4_16 0x4103
504#define MX28_PAD_JTAG_RTCK__GPIO_4_20 0x4143
505
506#endif /* __DT_BINDINGS_MX28_PINCTRL_H__ */
diff --git a/arch/arm/boot/dts/imx28-sps1.dts b/arch/arm/boot/dts/imx28-sps1.dts
index 6c6a5442800a..4870f07bf56a 100644
--- a/arch/arm/boot/dts/imx28-sps1.dts
+++ b/arch/arm/boot/dts/imx28-sps1.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "imx28.dtsi" 13#include "imx28.dtsi"
14 14
15/ { 15/ {
16 model = "SchulerControl GmbH, SC SPS 1"; 16 model = "SchulerControl GmbH, SC SPS 1";
@@ -29,13 +29,13 @@
29 hog_pins_a: hog-gpios@0 { 29 hog_pins_a: hog-gpios@0 {
30 reg = <0>; 30 reg = <0>;
31 fsl,pinmux-ids = < 31 fsl,pinmux-ids = <
32 0x0003 /* MX28_PAD_GPMI_D00__GPIO_0_0 */ 32 MX28_PAD_GPMI_D00__GPIO_0_0
33 0x0033 /* MX28_PAD_GPMI_D03__GPIO_0_3 */ 33 MX28_PAD_GPMI_D03__GPIO_0_3
34 0x0063 /* MX28_PAD_GPMI_D06__GPIO_0_6 */ 34 MX28_PAD_GPMI_D06__GPIO_0_6
35 >; 35 >;
36 fsl,drive-strength = <0>; 36 fsl,drive-strength = <MXS_DRIVE_4mA>;
37 fsl,voltage = <1>; 37 fsl,voltage = <MXS_VOLTAGE_HIGH>;
38 fsl,pull-up = <0>; 38 fsl,pull-up = <MXS_PULL_DISABLE>;
39 }; 39 };
40 40
41 }; 41 };
diff --git a/arch/arm/boot/dts/imx28-tx28.dts b/arch/arm/boot/dts/imx28-tx28.dts
index 37be532f0055..be5a0550d58c 100644
--- a/arch/arm/boot/dts/imx28-tx28.dts
+++ b/arch/arm/boot/dts/imx28-tx28.dts
@@ -1,106 +1,139 @@
1/*
2 * Copyright 2012 Shawn Guo <shawn.guo@linaro.org>
3 * Copyright 2013 Lothar Waßmann <LW@KARO-electronics.de>
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 at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
1/dts-v1/; 13/dts-v1/;
2/include/ "imx28.dtsi" 14#include "imx28.dtsi"
15#include <dt-bindings/gpio/gpio.h>
3 16
4/ { 17/ {
5 model = "Ka-Ro electronics TX28 module"; 18 model = "Ka-Ro electronics TX28 module";
6 compatible = "karo,tx28", "fsl,imx28"; 19 compatible = "karo,tx28", "fsl,imx28";
7 20
21 aliases {
22 can0 = &can0;
23 can1 = &can1;
24 display = &display;
25 ds1339 = &ds1339;
26 gpio5 = &gpio5;
27 lcdif = &lcdif;
28 lcdif_23bit_pins = &tx28_lcdif_23bit_pins;
29 lcdif_24bit_pins = &lcdif_24bit_pins_a;
30 stk5led = &user_led;
31 usbotg = &usb0;
32 };
33
8 memory { 34 memory {
9 reg = <0x40000000 0x08000000>; 35 reg = <0 0>; /* will be filled in by U-Boot */
10 }; 36 };
11
12 apb@80000000 {
13 apbh@80000000 {
14 ssp0: ssp@80010000 {
15 compatible = "fsl,imx28-mmc";
16 pinctrl-names = "default";
17 pinctrl-0 = <&mmc0_4bit_pins_a
18 &mmc0_cd_cfg
19 &mmc0_sck_cfg>;
20 bus-width = <4>;
21 status = "okay";
22 };
23 37
24 pinctrl@80018000 { 38 onewire {
25 pinctrl-names = "default"; 39 compatible = "w1-gpio";
26 pinctrl-0 = <&hog_pins_a>; 40 gpios = <&gpio2 7 0>;
27 41 status = "disabled";
28 hog_pins_a: hog@0 { 42 };
29 reg = <0>; 43
30 fsl,pinmux-ids = < 44 regulators {
31 0x40a3 /* MX28_PAD_ENET0_RXD3__GPIO_4_10 */ 45 compatible = "simple-bus";
32 >; 46
33 fsl,drive-strength = <0>; 47 reg_usb0_vbus: usb0_vbus {
34 fsl,voltage = <1>; 48 compatible = "regulator-fixed";
35 fsl,pull-up = <0>; 49 regulator-name = "usb0_vbus";
36 }; 50 regulator-min-microvolt = <5000000>;
37 51 regulator-max-microvolt = <5000000>;
38 mac0_pins_gpio: mac0-gpio-mode@0 { 52 gpio = <&gpio0 18 0>;
39 reg = <0>; 53 enable-active-high;
40 fsl,pinmux-ids = <
41 0x4003 /* MX28_PAD_ENET0_MDC__GPIO_4_0 */
42 0x4013 /* MX28_PAD_ENET0_MDIO__GPIO_4_1 */
43 0x4023 /* MX28_PAD_ENET0_RX_EN__GPIO_4_2 */
44 0x4033 /* MX28_PAD_ENET0_RXD0__GPIO_4_3 */
45 0x4043 /* MX28_PAD_ENET0_RXD1__GPIO_4_4 */
46 0x4063 /* MX28_PAD_ENET0_TX_EN__GPIO_4_6 */
47 0x4073 /* MX28_PAD_ENET0_TXD0__GPIO_4_7 */
48 0x4083 /* MX28_PAD_ENET0_TXD1__GPIO_4_8 */
49 0x4103 /* MX28_PAD_ENET_CLK__GPIO_4_16 */
50 >;
51 fsl,drive-strength = <0>;
52 fsl,voltage = <1>;
53 fsl,pull-up = <0>;
54 };
55 };
56 }; 54 };
57 55
58 apbx@80040000 { 56 reg_usb1_vbus: usb1_vbus {
59 i2c0: i2c@80058000 { 57 compatible = "regulator-fixed";
60 pinctrl-names = "default"; 58 regulator-name = "usb1_vbus";
61 pinctrl-0 = <&i2c0_pins_a>; 59 regulator-min-microvolt = <5000000>;
62 status = "okay"; 60 regulator-max-microvolt = <5000000>;
61 gpio = <&gpio3 27 0>;
62 enable-active-high;
63 };
63 64
64 ds1339: rtc@68 { 65 reg_2p5v: 2p5v {
65 compatible = "mxim,ds1339"; 66 compatible = "regulator-fixed";
66 reg = <0x68>; 67 regulator-name = "2P5V";
67 }; 68 regulator-min-microvolt = <2500000>;
68 }; 69 regulator-max-microvolt = <2500000>;
70 regulator-always-on;
71 };
69 72
70 pwm: pwm@80064000 { 73 reg_3p3v: 3p3v {
71 pinctrl-names = "default"; 74 compatible = "regulator-fixed";
72 pinctrl-0 = <&pwm0_pins_a>; 75 regulator-name = "3P3V";
73 status = "okay"; 76 regulator-min-microvolt = <3300000>;
74 }; 77 regulator-max-microvolt = <3300000>;
78 regulator-always-on;
79 };
75 80
76 duart: serial@80074000 { 81 reg_can_xcvr: can-xcvr {
77 pinctrl-names = "default"; 82 compatible = "regulator-fixed";
78 pinctrl-0 = <&duart_4pins_a>; 83 regulator-name = "CAN XCVR";
79 status = "okay"; 84 regulator-min-microvolt = <3300000>;
80 }; 85 regulator-max-microvolt = <3300000>;
86 gpio = <&gpio1 0 0>;
87 enable-active-low;
88 pinctrl-names = "default";
89 pinctrl-0 = <&tx28_flexcan_xcvr_pins>;
90 };
81 91
82 auart1: serial@8006c000 { 92 reg_lcd: lcd-power {
83 pinctrl-names = "default"; 93 compatible = "regulator-fixed";
84 pinctrl-0 = <&auart1_pins_a>; 94 regulator-name = "LCD POWER";
85 status = "okay"; 95 regulator-min-microvolt = <3300000>;
86 }; 96 regulator-max-microvolt = <3300000>;
97 gpio = <&gpio1 31 0>;
98 enable-active-high;
99 };
100
101 reg_lcd_reset: lcd-reset {
102 compatible = "regulator-fixed";
103 regulator-name = "LCD RESET";
104 regulator-min-microvolt = <3300000>;
105 regulator-max-microvolt = <3300000>;
106 gpio = <&gpio3 30 0>;
107 startup-delay-us = <300000>;
108 enable-active-high;
109 regulator-always-on;
110 regulator-boot-on;
87 }; 111 };
88 }; 112 };
89 113
90 ahb@80080000 { 114 clocks {
91 mac0: ethernet@800f0000 { 115 #address-cells = <1>;
92 phy-mode = "rmii"; 116 #size-cells = <0>;
93 pinctrl-names = "default", "gpio_mode"; 117 mclk: clock@0 {
94 pinctrl-0 = <&mac0_pins_a>; 118 compatible = "fixed-clock";
95 pinctrl-1 = <&mac0_pins_gpio>; 119 reg = <0>;
96 status = "okay"; 120 #clock-cells = <0>;
121 clock-frequency = <27000000>;
97 }; 122 };
98 }; 123 };
99 124
125 sound {
126 compatible = "fsl,imx28-tx28-sgtl5000",
127 "fsl,mxs-audio-sgtl5000";
128 model = "imx28-tx28-sgtl5000";
129 saif-controllers = <&saif0 &saif1>;
130 audio-codec = <&sgtl5000>;
131 };
132
100 leds { 133 leds {
101 compatible = "gpio-leds"; 134 compatible = "gpio-leds";
102 135
103 user { 136 user_led: user {
104 label = "Heartbeat"; 137 label = "Heartbeat";
105 gpios = <&gpio4 10 0>; 138 gpios = <&gpio4 10 0>;
106 linux,default-trigger = "heartbeat"; 139 linux,default-trigger = "heartbeat";
@@ -109,8 +142,512 @@
109 142
110 backlight { 143 backlight {
111 compatible = "pwm-backlight"; 144 compatible = "pwm-backlight";
112 pwms = <&pwm 0 5000000>; 145 pwms = <&pwm 0 500000>;
113 brightness-levels = <0 4 8 16 32 64 128 255>; 146 /*
114 default-brightness-level = <6>; 147 * a silly way to create a 1:1 relationship between the
148 * PWM value and the actual duty cycle
149 */
150 brightness-levels = < 0 1 2 3 4 5 6 7 8 9
151 10 11 12 13 14 15 16 17 18 19
152 20 21 22 23 24 25 26 27 28 29
153 30 31 32 33 34 35 36 37 38 39
154 40 41 42 43 44 45 46 47 48 49
155 50 51 52 53 54 55 56 57 58 59
156 60 61 62 63 64 65 66 67 68 69
157 70 71 72 73 74 75 76 77 78 79
158 80 81 82 83 84 85 86 87 88 89
159 90 91 92 93 94 95 96 97 98 99
160 100>;
161 default-brightness-level = <50>;
162 };
163
164 matrix_keypad: matrix-keypad@0 {
165 compatible = "gpio-matrix-keypad";
166 col-gpios = <
167 &gpio5 0 0
168 &gpio5 1 0
169 &gpio5 2 0
170 &gpio5 3 0
171 >;
172 row-gpios = <
173 &gpio5 4 0
174 &gpio5 5 0
175 &gpio5 6 0
176 &gpio5 7 0
177 >;
178 /* sample keymap */
179 linux,keymap = <
180 0x00000074 /* row 0, col 0, KEY_POWER */
181 0x00010052 /* row 0, col 1, KEY_KP0 */
182 0x0002004f /* row 0, col 2, KEY_KP1 */
183 0x00030050 /* row 0, col 3, KEY_KP2 */
184 0x01000051 /* row 1, col 0, KEY_KP3 */
185 0x0101004b /* row 1, col 1, KEY_KP4 */
186 0x0102004c /* row 1, col 2, KEY_KP5 */
187 0x0103004d /* row 1, col 3, KEY_KP6 */
188 0x02000047 /* row 2, col 0, KEY_KP7 */
189 0x02010048 /* row 2, col 1, KEY_KP8 */
190 0x02020049 /* row 2, col 2, KEY_KP9 */
191 >;
192 gpio-activelow;
193 linux,wakeup;
194 debounce-delay-ms = <100>;
195 col-scan-delay-us = <5000>;
196 linux,no-autorepeat;
197 };
198};
199
200/* 2nd TX-Std UART - (A)UART1 */
201&auart1 {
202 pinctrl-names = "default";
203 pinctrl-0 = <&auart1_pins_a>;
204 status = "okay";
205};
206
207/* 3rd TX-Std UART - (A)UART3 */
208&auart3 {
209 pinctrl-names = "default";
210 pinctrl-0 = <&auart3_pins_a>;
211 status = "okay";
212};
213
214&can0 {
215 pinctrl-names = "default";
216 pinctrl-0 = <&can0_pins_a>;
217 xceiver-supply = <&reg_can_xcvr>;
218 status = "okay";
219};
220
221&can1 {
222 pinctrl-names = "default";
223 pinctrl-0 = <&can1_pins_a>;
224 xceiver-supply = <&reg_can_xcvr>;
225 status = "okay";
226};
227
228&digctl {
229 status = "okay";
230};
231
232/* 1st TX-Std UART - (D)UART */
233&duart {
234 pinctrl-names = "default";
235 pinctrl-0 = <&duart_4pins_a>;
236 status = "okay";
237};
238
239&gpmi {
240 pinctrl-0 = <&gpmi_pins_a &gpmi_status_cfg>;
241 nand-on-flash-bbt;
242 status = "okay";
243};
244
245&i2c0 {
246 pinctrl-names = "default";
247 pinctrl-0 = <&i2c0_pins_a>;
248 clock-frequency = <400000>;
249 status = "okay";
250
251 sgtl5000: sgtl5000@0a {
252 compatible = "fsl,sgtl5000";
253 reg = <0x0a>;
254 VDDA-supply = <&reg_2p5v>;
255 VDDIO-supply = <&reg_3p3v>;
256 clocks = <&mclk>;
257 };
258
259 gpio5: pca953x@20 {
260 compatible = "nxp,pca9554";
261 reg = <0x20>;
262 pinctrl-names = "default";
263 pinctrl-0 = <&tx28_pca9554_pins>;
264 interrupt-parent = <&gpio3>;
265 interrupts = <28 0>;
266 gpio-controller;
267 #gpio-cells = <2>;
268 interrupt-controller;
269 #interrupt-cells = <2>;
270 };
271
272 polytouch: edt-ft5x06@38 {
273 compatible = "edt,edt-ft5x06";
274 reg = <0x38>;
275 pinctrl-names = "default";
276 pinctrl-0 = <&tx28_edt_ft5x06_pins>;
277 interrupt-parent = <&gpio2>;
278 interrupts = <5 0>;
279 reset-gpios = <&gpio2 6 1>;
280 wake-gpios = <&gpio4 9 0>;
281 };
282
283 touchscreen: tsc2007@48 {
284 compatible = "ti,tsc2007";
285 reg = <0x48>;
286 pinctrl-names = "default";
287 pinctrl-0 = <&tx28_tsc2007_pins>;
288 interrupt-parent = <&gpio3>;
289 interrupts = <20 0>;
290 pendown-gpio = <&gpio3 20 1>;
291 ti,x-plate-ohms = /bits/ 16 <660>;
292 };
293
294 ds1339: rtc@68 {
295 compatible = "mxim,ds1339";
296 reg = <0x68>;
297 };
298};
299
300&lcdif {
301 pinctrl-names = "default";
302 pinctrl-0 = <&lcdif_24bit_pins_a &lcdif_sync_pins_a &tx28_lcdif_ctrl_pins>;
303 lcd-supply = <&reg_lcd>;
304 display = <&display>;
305 status = "okay";
306
307 display: display@0 {
308 bits-per-pixel = <32>;
309 bus-width = <24>;
310 display-timings {
311 native-mode = <&timing5>;
312 timing0: timing0 {
313 panel-name = "VGA";
314 clock-frequency = <25175000>;
315 hactive = <640>;
316 vactive = <480>;
317 hback-porch = <48>;
318 hsync-len = <96>;
319 hfront-porch = <16>;
320 vback-porch = <33>;
321 vsync-len = <2>;
322 vfront-porch = <10>;
323 hsync-active = <0>;
324 vsync-active = <0>;
325 de-active = <1>;
326 pixelclk-active = <1>;
327 };
328
329 timing1: timing1 {
330 panel-name = "ETV570";
331 clock-frequency = <25175000>;
332 hactive = <640>;
333 vactive = <480>;
334 hback-porch = <114>;
335 hsync-len = <30>;
336 hfront-porch = <16>;
337 vback-porch = <32>;
338 vsync-len = <3>;
339 vfront-porch = <10>;
340 hsync-active = <0>;
341 vsync-active = <0>;
342 de-active = <1>;
343 pixelclk-active = <1>;
344 };
345
346 timing2: timing2 {
347 panel-name = "ET0350";
348 clock-frequency = <6500000>;
349 hactive = <320>;
350 vactive = <240>;
351 hback-porch = <34>;
352 hsync-len = <34>;
353 hfront-porch = <20>;
354 vback-porch = <15>;
355 vsync-len = <3>;
356 vfront-porch = <4>;
357 hsync-active = <0>;
358 vsync-active = <0>;
359 de-active = <1>;
360 pixelclk-active = <1>;
361 };
362
363 timing3: timing3 {
364 panel-name = "ET0430";
365 clock-frequency = <9000000>;
366 hactive = <480>;
367 vactive = <272>;
368 hback-porch = <2>;
369 hsync-len = <41>;
370 hfront-porch = <2>;
371 vback-porch = <2>;
372 vsync-len = <10>;
373 vfront-porch = <2>;
374 hsync-active = <0>;
375 vsync-active = <0>;
376 de-active = <1>;
377 pixelclk-active = <1>;
378 };
379
380 timing4: timing4 {
381 panel-name = "ET0500", "ET0700";
382 clock-frequency = <33260000>;
383 hactive = <800>;
384 vactive = <480>;
385 hback-porch = <88>;
386 hsync-len = <128>;
387 hfront-porch = <40>;
388 vback-porch = <33>;
389 vsync-len = <2>;
390 vfront-porch = <10>;
391 hsync-active = <0>;
392 vsync-active = <0>;
393 de-active = <1>;
394 pixelclk-active = <1>;
395 };
396
397 timing5: timing5 {
398 panel-name = "ETQ570";
399 clock-frequency = <6400000>;
400 hactive = <320>;
401 vactive = <240>;
402 hback-porch = <38>;
403 hsync-len = <30>;
404 hfront-porch = <30>;
405 vback-porch = <16>;
406 vsync-len = <3>;
407 vfront-porch = <4>;
408 hsync-active = <0>;
409 vsync-active = <0>;
410 de-active = <1>;
411 pixelclk-active = <1>;
412 };
413 };
414 };
415};
416
417&lradc {
418 fsl,lradc-touchscreen-wires = <4>;
419 status = "okay";
420};
421
422&mac0 {
423 phy-mode = "rmii";
424 pinctrl-names = "default", "gpio_mode";
425 pinctrl-0 = <&mac0_pins_a>;
426 pinctrl-1 = <&tx28_mac0_pins_gpio>;
427 status = "okay";
428};
429
430&mac1 {
431 phy-mode = "rmii";
432 pinctrl-names = "default";
433 pinctrl-0 = <&mac1_pins_a>;
434 /* not enabled by default */
435};
436
437&mxs_rtc {
438 status = "okay";
439};
440
441&ocotp {
442 status = "okay";
443};
444
445&pwm {
446 pinctrl-names = "default";
447 pinctrl-0 = <&pwm0_pins_a>;
448 status = "okay";
449};
450
451&pinctrl {
452 pinctrl-names = "default";
453 pinctrl-0 = <&hog_pins_a>;
454
455 hog_pins_a: hog@0 {
456 reg = <0>;
457 fsl,pinmux-ids = <
458 MX28_PAD_ENET0_RXD3__GPIO_4_10 /* module LED */
459 >;
460 fsl,drive-strength = <MXS_DRIVE_4mA>;
461 fsl,voltage = <MXS_VOLTAGE_HIGH>;
462 fsl,pull-up = <MXS_PULL_DISABLE>;
463 };
464
465 tx28_edt_ft5x06_pins: tx28-edt-ft5x06-pins {
466 fsl,pinmux-ids = <
467 MX28_PAD_SSP0_DATA6__GPIO_2_6 /* RESET */
468 MX28_PAD_SSP0_DATA5__GPIO_2_5 /* IRQ */
469 MX28_PAD_ENET0_RXD2__GPIO_4_9 /* WAKE */
470 >;
471 fsl,drive-strength = <MXS_DRIVE_4mA>;
472 fsl,voltage = <MXS_VOLTAGE_HIGH>;
473 fsl,pull-up = <MXS_PULL_DISABLE>;
474 };
475
476 tx28_flexcan_xcvr_pins: tx28-flexcan-xcvr-pins {
477 fsl,pinmux-ids = <
478 MX28_PAD_LCD_D00__GPIO_1_0
479 >;
480 fsl,drive-strength = <MXS_DRIVE_4mA>;
481 fsl,voltage = <MXS_VOLTAGE_HIGH>;
482 fsl,pull-up = <MXS_PULL_DISABLE>;
483 };
484
485 tx28_lcdif_23bit_pins: tx28-lcdif-23bit {
486 fsl,pinmux-ids = <
487 /* LCD_D00 may be used as Flexcan Transceiver Enable on STK5-V5 */
488 MX28_PAD_LCD_D01__LCD_D1
489 MX28_PAD_LCD_D02__LCD_D2
490 MX28_PAD_LCD_D03__LCD_D3
491 MX28_PAD_LCD_D04__LCD_D4
492 MX28_PAD_LCD_D05__LCD_D5
493 MX28_PAD_LCD_D06__LCD_D6
494 MX28_PAD_LCD_D07__LCD_D7
495 MX28_PAD_LCD_D08__LCD_D8
496 MX28_PAD_LCD_D09__LCD_D9
497 MX28_PAD_LCD_D10__LCD_D10
498 MX28_PAD_LCD_D11__LCD_D11
499 MX28_PAD_LCD_D12__LCD_D12
500 MX28_PAD_LCD_D13__LCD_D13
501 MX28_PAD_LCD_D14__LCD_D14
502 MX28_PAD_LCD_D15__LCD_D15
503 MX28_PAD_LCD_D16__LCD_D16
504 MX28_PAD_LCD_D17__LCD_D17
505 MX28_PAD_LCD_D18__LCD_D18
506 MX28_PAD_LCD_D19__LCD_D19
507 MX28_PAD_LCD_D20__LCD_D20
508 MX28_PAD_LCD_D21__LCD_D21
509 MX28_PAD_LCD_D22__LCD_D22
510 MX28_PAD_LCD_D23__LCD_D23
511 >;
512 fsl,drive-strength = <MXS_DRIVE_4mA>;
513 fsl,voltage = <MXS_VOLTAGE_HIGH>;
514 fsl,pull-up = <MXS_PULL_DISABLE>;
515 };
516
517 tx28_lcdif_ctrl_pins: tx28-lcdif-ctrl {
518 fsl,pinmux-ids = <
519 MX28_PAD_LCD_ENABLE__GPIO_1_31 /* Enable */
520 MX28_PAD_LCD_RESET__GPIO_3_30 /* Reset */
521 >;
522 fsl,drive-strength = <MXS_DRIVE_4mA>;
523 fsl,voltage = <MXS_VOLTAGE_HIGH>;
524 fsl,pull-up = <MXS_PULL_DISABLE>;
525 };
526
527 tx28_mac0_pins_gpio: tx28-mac0-gpio-pins {
528 fsl,pinmux-ids = <
529 MX28_PAD_ENET0_MDC__GPIO_4_0
530 MX28_PAD_ENET0_MDIO__GPIO_4_1
531 MX28_PAD_ENET0_RX_EN__GPIO_4_2
532 MX28_PAD_ENET0_RXD0__GPIO_4_3
533 MX28_PAD_ENET0_RXD1__GPIO_4_4
534 MX28_PAD_ENET0_TX_EN__GPIO_4_6
535 MX28_PAD_ENET0_TXD0__GPIO_4_7
536 MX28_PAD_ENET0_TXD1__GPIO_4_8
537 MX28_PAD_ENET_CLK__GPIO_4_16
538 >;
539 fsl,drive-strength = <MXS_DRIVE_4mA>;
540 fsl,voltage = <MXS_VOLTAGE_HIGH>;
541 fsl,pull-up = <MXS_PULL_DISABLE>;
542 };
543
544 tx28_pca9554_pins: tx28-pca9554-pins {
545 fsl,pinmux-ids = <
546 MX28_PAD_PWM3__GPIO_3_28
547 >;
548 fsl,drive-strength = <MXS_DRIVE_4mA>;
549 fsl,voltage = <MXS_VOLTAGE_HIGH>;
550 fsl,pull-up = <MXS_PULL_DISABLE>;
551 };
552
553 tx28_tsc2007_pins: tx28-tsc2007-pins {
554 fsl,pinmux-ids = <
555 MX28_PAD_SAIF0_MCLK__GPIO_3_20 /* TSC2007 IRQ */
556 >;
557 fsl,drive-strength = <MXS_DRIVE_4mA>;
558 fsl,voltage = <MXS_VOLTAGE_HIGH>;
559 fsl,pull-up = <MXS_PULL_DISABLE>;
560 };
561
562
563 tx28_usbphy0_pins: tx28-usbphy0-pins {
564 fsl,pinmux-ids = <
565 MX28_PAD_GPMI_CE2N__GPIO_0_18 /* USBOTG_VBUSEN */
566 MX28_PAD_GPMI_CE3N__GPIO_0_19 /* USBOTH_OC */
567 >;
568 fsl,drive-strength = <MXS_DRIVE_12mA>;
569 fsl,voltage = <MXS_VOLTAGE_HIGH>;
570 fsl,pull-up = <MXS_PULL_DISABLE>;
571 };
572
573 tx28_usbphy1_pins: tx28-usbphy1-pins {
574 fsl,pinmux-ids = <
575 MX28_PAD_SPDIF__GPIO_3_27 /* USBH_VBUSEN */
576 MX28_PAD_JTAG_RTCK__GPIO_4_20 /* USBH_OC */
577 >;
578 fsl,drive-strength = <MXS_DRIVE_12mA>;
579 fsl,voltage = <MXS_VOLTAGE_HIGH>;
580 fsl,pull-up = <MXS_PULL_DISABLE>;
581 };
582};
583
584&saif0 {
585 pinctrl-names = "default";
586 pinctrl-0 = <&saif0_pins_b>;
587 fsl,saif-master;
588 status = "okay";
589};
590
591&saif1 {
592 pinctrl-names = "default";
593 pinctrl-0 = <&saif1_pins_a>;
594 status = "okay";
595};
596
597&ssp0 {
598 compatible = "fsl,imx28-mmc";
599 pinctrl-names = "default", "special";
600 pinctrl-0 = <&mmc0_4bit_pins_a
601 &mmc0_cd_cfg
602 &mmc0_sck_cfg>;
603 bus-width = <4>;
604 status = "okay";
605};
606
607&ssp3 {
608 compatible = "fsl,imx28-spi";
609 pinctrl-names = "default";
610 pinctrl-0 = <&spi3_pins_a>;
611 clock-frequency = <57600000>;
612 status = "okay";
613
614 spidev0: spi@0 {
615 compatible = "spidev";
616 reg = <0>;
617 spi-max-frequency = <57600000>;
618 };
619
620 spidev1: spi@1 {
621 compatible = "spidev";
622 reg = <1>;
623 spi-max-frequency = <57600000>;
115 }; 624 };
116}; 625};
626
627&usb0 {
628 vbus-supply = <&reg_usb0_vbus>;
629 disable-over-current;
630 dr_mode = "peripheral";
631 status = "okay";
632};
633
634&usb1 {
635 vbus-supply = <&reg_usb1_vbus>;
636 disable-over-current;
637 dr_mode = "host";
638 status = "okay";
639};
640
641&usbphy0 {
642 pinctrl-names = "default";
643 pinctrl-0 = <&tx28_usbphy0_pins>;
644 phy_type = "utmi";
645 status = "okay";
646};
647
648&usbphy1 {
649 pinctrl-names = "default";
650 pinctrl-0 = <&tx28_usbphy1_pins>;
651 phy_type = "utmi";
652 status = "okay";
653};
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index 7363fded95ee..cda19c8b0a47 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.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/ "skeleton.dtsi" 12#include "skeleton.dtsi"
13#include "imx28-pinfunc.h"
13 14
14/ { 15/ {
15 interrupt-parent = <&icoll>; 16 interrupt-parent = <&icoll>;
@@ -207,538 +208,579 @@
207 duart_pins_a: duart@0 { 208 duart_pins_a: duart@0 {
208 reg = <0>; 209 reg = <0>;
209 fsl,pinmux-ids = < 210 fsl,pinmux-ids = <
210 0x3102 /* MX28_PAD_PWM0__DUART_RX */ 211 MX28_PAD_PWM0__DUART_RX
211 0x3112 /* MX28_PAD_PWM1__DUART_TX */ 212 MX28_PAD_PWM1__DUART_TX
212 >; 213 >;
213 fsl,drive-strength = <0>; 214 fsl,drive-strength = <MXS_DRIVE_4mA>;
214 fsl,voltage = <1>; 215 fsl,voltage = <MXS_VOLTAGE_HIGH>;
215 fsl,pull-up = <0>; 216 fsl,pull-up = <MXS_PULL_DISABLE>;
216 }; 217 };
217 218
218 duart_pins_b: duart@1 { 219 duart_pins_b: duart@1 {
219 reg = <1>; 220 reg = <1>;
220 fsl,pinmux-ids = < 221 fsl,pinmux-ids = <
221 0x3022 /* MX28_PAD_AUART0_CTS__DUART_RX */ 222 MX28_PAD_AUART0_CTS__DUART_RX
222 0x3032 /* MX28_PAD_AUART0_RTS__DUART_TX */ 223 MX28_PAD_AUART0_RTS__DUART_TX
223 >; 224 >;
224 fsl,drive-strength = <0>; 225 fsl,drive-strength = <MXS_DRIVE_4mA>;
225 fsl,voltage = <1>; 226 fsl,voltage = <MXS_VOLTAGE_HIGH>;
226 fsl,pull-up = <0>; 227 fsl,pull-up = <MXS_PULL_DISABLE>;
227 }; 228 };
228 229
229 duart_4pins_a: duart-4pins@0 { 230 duart_4pins_a: duart-4pins@0 {
230 reg = <0>; 231 reg = <0>;
231 fsl,pinmux-ids = < 232 fsl,pinmux-ids = <
232 0x3022 /* MX28_PAD_AUART0_CTS__DUART_RX */ 233 MX28_PAD_AUART0_CTS__DUART_RX
233 0x3032 /* MX28_PAD_AUART0_RTS__DUART_TX */ 234 MX28_PAD_AUART0_RTS__DUART_TX
234 0x3002 /* MX28_PAD_AUART0_RX__DUART_CTS */ 235 MX28_PAD_AUART0_RX__DUART_CTS
235 0x3012 /* MX28_PAD_AUART0_TX__DUART_RTS */ 236 MX28_PAD_AUART0_TX__DUART_RTS
236 >; 237 >;
237 fsl,drive-strength = <0>; 238 fsl,drive-strength = <MXS_DRIVE_4mA>;
238 fsl,voltage = <1>; 239 fsl,voltage = <MXS_VOLTAGE_HIGH>;
239 fsl,pull-up = <0>; 240 fsl,pull-up = <MXS_PULL_DISABLE>;
240 }; 241 };
241 242
242 gpmi_pins_a: gpmi-nand@0 { 243 gpmi_pins_a: gpmi-nand@0 {
243 reg = <0>; 244 reg = <0>;
244 fsl,pinmux-ids = < 245 fsl,pinmux-ids = <
245 0x0000 /* MX28_PAD_GPMI_D00__GPMI_D0 */ 246 MX28_PAD_GPMI_D00__GPMI_D0
246 0x0010 /* MX28_PAD_GPMI_D01__GPMI_D1 */ 247 MX28_PAD_GPMI_D01__GPMI_D1
247 0x0020 /* MX28_PAD_GPMI_D02__GPMI_D2 */ 248 MX28_PAD_GPMI_D02__GPMI_D2
248 0x0030 /* MX28_PAD_GPMI_D03__GPMI_D3 */ 249 MX28_PAD_GPMI_D03__GPMI_D3
249 0x0040 /* MX28_PAD_GPMI_D04__GPMI_D4 */ 250 MX28_PAD_GPMI_D04__GPMI_D4
250 0x0050 /* MX28_PAD_GPMI_D05__GPMI_D5 */ 251 MX28_PAD_GPMI_D05__GPMI_D5
251 0x0060 /* MX28_PAD_GPMI_D06__GPMI_D6 */ 252 MX28_PAD_GPMI_D06__GPMI_D6
252 0x0070 /* MX28_PAD_GPMI_D07__GPMI_D7 */ 253 MX28_PAD_GPMI_D07__GPMI_D7
253 0x0100 /* MX28_PAD_GPMI_CE0N__GPMI_CE0N */ 254 MX28_PAD_GPMI_CE0N__GPMI_CE0N
254 0x0140 /* MX28_PAD_GPMI_RDY0__GPMI_READY0 */ 255 MX28_PAD_GPMI_RDY0__GPMI_READY0
255 0x0180 /* MX28_PAD_GPMI_RDN__GPMI_RDN */ 256 MX28_PAD_GPMI_RDN__GPMI_RDN
256 0x0190 /* MX28_PAD_GPMI_WRN__GPMI_WRN */ 257 MX28_PAD_GPMI_WRN__GPMI_WRN
257 0x01a0 /* MX28_PAD_GPMI_ALE__GPMI_ALE */ 258 MX28_PAD_GPMI_ALE__GPMI_ALE
258 0x01b0 /* MX28_PAD_GPMI_CLE__GPMI_CLE */ 259 MX28_PAD_GPMI_CLE__GPMI_CLE
259 0x01c0 /* MX28_PAD_GPMI_RESETN__GPMI_RESETN */ 260 MX28_PAD_GPMI_RESETN__GPMI_RESETN
260 >; 261 >;
261 fsl,drive-strength = <0>; 262 fsl,drive-strength = <MXS_DRIVE_4mA>;
262 fsl,voltage = <1>; 263 fsl,voltage = <MXS_VOLTAGE_HIGH>;
263 fsl,pull-up = <0>; 264 fsl,pull-up = <MXS_PULL_DISABLE>;
264 }; 265 };
265 266
266 gpmi_status_cfg: gpmi-status-cfg { 267 gpmi_status_cfg: gpmi-status-cfg {
267 fsl,pinmux-ids = < 268 fsl,pinmux-ids = <
268 0x0180 /* MX28_PAD_GPMI_RDN__GPMI_RDN */ 269 MX28_PAD_GPMI_RDN__GPMI_RDN
269 0x0190 /* MX28_PAD_GPMI_WRN__GPMI_WRN */ 270 MX28_PAD_GPMI_WRN__GPMI_WRN
270 0x01c0 /* MX28_PAD_GPMI_RESETN__GPMI_RESETN */ 271 MX28_PAD_GPMI_RESETN__GPMI_RESETN
271 >; 272 >;
272 fsl,drive-strength = <2>; 273 fsl,drive-strength = <MXS_DRIVE_12mA>;
273 }; 274 };
274 275
275 auart0_pins_a: auart0@0 { 276 auart0_pins_a: auart0@0 {
276 reg = <0>; 277 reg = <0>;
277 fsl,pinmux-ids = < 278 fsl,pinmux-ids = <
278 0x3000 /* MX28_PAD_AUART0_RX__AUART0_RX */ 279 MX28_PAD_AUART0_RX__AUART0_RX
279 0x3010 /* MX28_PAD_AUART0_TX__AUART0_TX */ 280 MX28_PAD_AUART0_TX__AUART0_TX
280 0x3020 /* MX28_PAD_AUART0_CTS__AUART0_CTS */ 281 MX28_PAD_AUART0_CTS__AUART0_CTS
281 0x3030 /* MX28_PAD_AUART0_RTS__AUART0_RTS */ 282 MX28_PAD_AUART0_RTS__AUART0_RTS
282 >; 283 >;
283 fsl,drive-strength = <0>; 284 fsl,drive-strength = <MXS_DRIVE_4mA>;
284 fsl,voltage = <1>; 285 fsl,voltage = <MXS_VOLTAGE_HIGH>;
285 fsl,pull-up = <0>; 286 fsl,pull-up = <MXS_PULL_DISABLE>;
286 }; 287 };
287 288
288 auart0_2pins_a: auart0-2pins@0 { 289 auart0_2pins_a: auart0-2pins@0 {
289 reg = <0>; 290 reg = <0>;
290 fsl,pinmux-ids = < 291 fsl,pinmux-ids = <
291 0x3000 /* MX28_PAD_AUART0_RX__AUART0_RX */ 292 MX28_PAD_AUART0_RX__AUART0_RX
292 0x3010 /* MX28_PAD_AUART0_TX__AUART0_TX */ 293 MX28_PAD_AUART0_TX__AUART0_TX
293 >; 294 >;
294 fsl,drive-strength = <0>; 295 fsl,drive-strength = <MXS_DRIVE_4mA>;
295 fsl,voltage = <1>; 296 fsl,voltage = <MXS_VOLTAGE_HIGH>;
296 fsl,pull-up = <0>; 297 fsl,pull-up = <MXS_PULL_DISABLE>;
297 }; 298 };
298 299
299 auart1_pins_a: auart1@0 { 300 auart1_pins_a: auart1@0 {
300 reg = <0>; 301 reg = <0>;
301 fsl,pinmux-ids = < 302 fsl,pinmux-ids = <
302 0x3040 /* MX28_PAD_AUART1_RX__AUART1_RX */ 303 MX28_PAD_AUART1_RX__AUART1_RX
303 0x3050 /* MX28_PAD_AUART1_TX__AUART1_TX */ 304 MX28_PAD_AUART1_TX__AUART1_TX
304 0x3060 /* MX28_PAD_AUART1_CTS__AUART1_CTS */ 305 MX28_PAD_AUART1_CTS__AUART1_CTS
305 0x3070 /* MX28_PAD_AUART1_RTS__AUART1_RTS */ 306 MX28_PAD_AUART1_RTS__AUART1_RTS
306 >; 307 >;
307 fsl,drive-strength = <0>; 308 fsl,drive-strength = <MXS_DRIVE_4mA>;
308 fsl,voltage = <1>; 309 fsl,voltage = <MXS_VOLTAGE_HIGH>;
309 fsl,pull-up = <0>; 310 fsl,pull-up = <MXS_PULL_DISABLE>;
310 }; 311 };
311 312
312 auart1_2pins_a: auart1-2pins@0 { 313 auart1_2pins_a: auart1-2pins@0 {
313 reg = <0>; 314 reg = <0>;
314 fsl,pinmux-ids = < 315 fsl,pinmux-ids = <
315 0x3040 /* MX28_PAD_AUART1_RX__AUART1_RX */ 316 MX28_PAD_AUART1_RX__AUART1_RX
316 0x3050 /* MX28_PAD_AUART1_TX__AUART1_TX */ 317 MX28_PAD_AUART1_TX__AUART1_TX
317 >; 318 >;
318 fsl,drive-strength = <0>; 319 fsl,drive-strength = <MXS_DRIVE_4mA>;
319 fsl,voltage = <1>; 320 fsl,voltage = <MXS_VOLTAGE_HIGH>;
320 fsl,pull-up = <0>; 321 fsl,pull-up = <MXS_PULL_DISABLE>;
321 }; 322 };
322 323
323 auart2_2pins_a: auart2-2pins@0 { 324 auart2_2pins_a: auart2-2pins@0 {
324 reg = <0>; 325 reg = <0>;
325 fsl,pinmux-ids = < 326 fsl,pinmux-ids = <
326 0x2101 /* MX28_PAD_SSP2_SCK__AUART2_RX */ 327 MX28_PAD_SSP2_SCK__AUART2_RX
327 0x2111 /* MX28_PAD_SSP2_MOSI__AUART2_TX */ 328 MX28_PAD_SSP2_MOSI__AUART2_TX
328 >; 329 >;
329 fsl,drive-strength = <0>; 330 fsl,drive-strength = <MXS_DRIVE_4mA>;
330 fsl,voltage = <1>; 331 fsl,voltage = <MXS_VOLTAGE_HIGH>;
331 fsl,pull-up = <0>; 332 fsl,pull-up = <MXS_PULL_DISABLE>;
332 }; 333 };
333 334
334 auart2_2pins_b: auart2-2pins@1 { 335 auart2_2pins_b: auart2-2pins@1 {
335 reg = <1>; 336 reg = <1>;
336 fsl,pinmux-ids = < 337 fsl,pinmux-ids = <
337 0x3080 /* MX28_PAD_AUART2_RX__AUART2_RX */ 338 MX28_PAD_AUART2_RX__AUART2_RX
338 0x3090 /* MX28_PAD_AUART2_TX__AUART2_TX */ 339 MX28_PAD_AUART2_TX__AUART2_TX
339 >; 340 >;
340 fsl,drive-strength = <0>; 341 fsl,drive-strength = <MXS_DRIVE_4mA>;
341 fsl,voltage = <1>; 342 fsl,voltage = <MXS_VOLTAGE_HIGH>;
342 fsl,pull-up = <0>; 343 fsl,pull-up = <MXS_PULL_DISABLE>;
343 }; 344 };
344 345
345 auart3_pins_a: auart3@0 { 346 auart3_pins_a: auart3@0 {
346 reg = <0>; 347 reg = <0>;
347 fsl,pinmux-ids = < 348 fsl,pinmux-ids = <
348 0x30c0 /* MX28_PAD_AUART3_RX__AUART3_RX */ 349 MX28_PAD_AUART3_RX__AUART3_RX
349 0x30d0 /* MX28_PAD_AUART3_TX__AUART3_TX */ 350 MX28_PAD_AUART3_TX__AUART3_TX
350 0x30e0 /* MX28_PAD_AUART3_CTS__AUART3_CTS */ 351 MX28_PAD_AUART3_CTS__AUART3_CTS
351 0x30f0 /* MX28_PAD_AUART3_RTS__AUART3_RTS */ 352 MX28_PAD_AUART3_RTS__AUART3_RTS
352 >; 353 >;
353 fsl,drive-strength = <0>; 354 fsl,drive-strength = <MXS_DRIVE_4mA>;
354 fsl,voltage = <1>; 355 fsl,voltage = <MXS_VOLTAGE_HIGH>;
355 fsl,pull-up = <0>; 356 fsl,pull-up = <MXS_PULL_DISABLE>;
356 }; 357 };
357 358
358 auart3_2pins_a: auart3-2pins@0 { 359 auart3_2pins_a: auart3-2pins@0 {
359 reg = <0>; 360 reg = <0>;
360 fsl,pinmux-ids = < 361 fsl,pinmux-ids = <
361 0x2121 /* MX28_PAD_SSP2_MISO__AUART3_RX */ 362 MX28_PAD_SSP2_MISO__AUART3_RX
362 0x2131 /* MX28_PAD_SSP2_SS0__AUART3_TX */ 363 MX28_PAD_SSP2_SS0__AUART3_TX
363 >; 364 >;
364 fsl,drive-strength = <0>; 365 fsl,drive-strength = <MXS_DRIVE_4mA>;
365 fsl,voltage = <1>; 366 fsl,voltage = <MXS_VOLTAGE_HIGH>;
366 fsl,pull-up = <0>; 367 fsl,pull-up = <MXS_PULL_DISABLE>;
367 }; 368 };
368 369
369 auart3_2pins_b: auart3-2pins@1 { 370 auart3_2pins_b: auart3-2pins@1 {
370 reg = <1>; 371 reg = <1>;
371 fsl,pinmux-ids = < 372 fsl,pinmux-ids = <
372 0x30c0 /* MX28_PAD_AUART3_RX__AUART3_RX */ 373 MX28_PAD_AUART3_RX__AUART3_RX
373 0x30d0 /* MX28_PAD_AUART3_TX__AUART3_TX */ 374 MX28_PAD_AUART3_TX__AUART3_TX
374 >; 375 >;
375 fsl,drive-strength = <0>; 376 fsl,drive-strength = <MXS_DRIVE_4mA>;
376 fsl,voltage = <1>; 377 fsl,voltage = <MXS_VOLTAGE_HIGH>;
377 fsl,pull-up = <0>; 378 fsl,pull-up = <MXS_PULL_DISABLE>;
378 }; 379 };
379 380
380 auart4_2pins_a: auart4@0 { 381 auart4_2pins_a: auart4@0 {
381 reg = <0>; 382 reg = <0>;
382 fsl,pinmux-ids = < 383 fsl,pinmux-ids = <
383 0x2181 /* MX28_PAD_SSP3_SCK__AUART4_TX */ 384 MX28_PAD_SSP3_SCK__AUART4_TX
384 0x2191 /* MX28_PAD_SSP3_MOSI__AUART4_RX */ 385 MX28_PAD_SSP3_MOSI__AUART4_RX
385 >; 386 >;
386 fsl,drive-strength = <0>; 387 fsl,drive-strength = <MXS_DRIVE_4mA>;
387 fsl,voltage = <1>; 388 fsl,voltage = <MXS_VOLTAGE_HIGH>;
388 fsl,pull-up = <0>; 389 fsl,pull-up = <MXS_PULL_DISABLE>;
389 }; 390 };
390 391
391 mac0_pins_a: mac0@0 { 392 mac0_pins_a: mac0@0 {
392 reg = <0>; 393 reg = <0>;
393 fsl,pinmux-ids = < 394 fsl,pinmux-ids = <
394 0x4000 /* MX28_PAD_ENET0_MDC__ENET0_MDC */ 395 MX28_PAD_ENET0_MDC__ENET0_MDC
395 0x4010 /* MX28_PAD_ENET0_MDIO__ENET0_MDIO */ 396 MX28_PAD_ENET0_MDIO__ENET0_MDIO
396 0x4020 /* MX28_PAD_ENET0_RX_EN__ENET0_RX_EN */ 397 MX28_PAD_ENET0_RX_EN__ENET0_RX_EN
397 0x4030 /* MX28_PAD_ENET0_RXD0__ENET0_RXD0 */ 398 MX28_PAD_ENET0_RXD0__ENET0_RXD0
398 0x4040 /* MX28_PAD_ENET0_RXD1__ENET0_RXD1 */ 399 MX28_PAD_ENET0_RXD1__ENET0_RXD1
399 0x4060 /* MX28_PAD_ENET0_TX_EN__ENET0_TX_EN */ 400 MX28_PAD_ENET0_TX_EN__ENET0_TX_EN
400 0x4070 /* MX28_PAD_ENET0_TXD0__ENET0_TXD0 */ 401 MX28_PAD_ENET0_TXD0__ENET0_TXD0
401 0x4080 /* MX28_PAD_ENET0_TXD1__ENET0_TXD1 */ 402 MX28_PAD_ENET0_TXD1__ENET0_TXD1
402 0x4100 /* MX28_PAD_ENET_CLK__CLKCTRL_ENET */ 403 MX28_PAD_ENET_CLK__CLKCTRL_ENET
403 >; 404 >;
404 fsl,drive-strength = <1>; 405 fsl,drive-strength = <MXS_DRIVE_8mA>;
405 fsl,voltage = <1>; 406 fsl,voltage = <MXS_VOLTAGE_HIGH>;
406 fsl,pull-up = <1>; 407 fsl,pull-up = <MXS_PULL_ENABLE>;
407 }; 408 };
408 409
409 mac1_pins_a: mac1@0 { 410 mac1_pins_a: mac1@0 {
410 reg = <0>; 411 reg = <0>;
411 fsl,pinmux-ids = < 412 fsl,pinmux-ids = <
412 0x40f1 /* MX28_PAD_ENET0_CRS__ENET1_RX_EN */ 413 MX28_PAD_ENET0_CRS__ENET1_RX_EN
413 0x4091 /* MX28_PAD_ENET0_RXD2__ENET1_RXD0 */ 414 MX28_PAD_ENET0_RXD2__ENET1_RXD0
414 0x40a1 /* MX28_PAD_ENET0_RXD3__ENET1_RXD1 */ 415 MX28_PAD_ENET0_RXD3__ENET1_RXD1
415 0x40e1 /* MX28_PAD_ENET0_COL__ENET1_TX_EN */ 416 MX28_PAD_ENET0_COL__ENET1_TX_EN
416 0x40b1 /* MX28_PAD_ENET0_TXD2__ENET1_TXD0 */ 417 MX28_PAD_ENET0_TXD2__ENET1_TXD0
417 0x40c1 /* MX28_PAD_ENET0_TXD3__ENET1_TXD1 */ 418 MX28_PAD_ENET0_TXD3__ENET1_TXD1
418 >; 419 >;
419 fsl,drive-strength = <1>; 420 fsl,drive-strength = <MXS_DRIVE_8mA>;
420 fsl,voltage = <1>; 421 fsl,voltage = <MXS_VOLTAGE_HIGH>;
421 fsl,pull-up = <1>; 422 fsl,pull-up = <MXS_PULL_ENABLE>;
422 }; 423 };
423 424
424 mmc0_8bit_pins_a: mmc0-8bit@0 { 425 mmc0_8bit_pins_a: mmc0-8bit@0 {
425 reg = <0>; 426 reg = <0>;
426 fsl,pinmux-ids = < 427 fsl,pinmux-ids = <
427 0x2000 /* MX28_PAD_SSP0_DATA0__SSP0_D0 */ 428 MX28_PAD_SSP0_DATA0__SSP0_D0
428 0x2010 /* MX28_PAD_SSP0_DATA1__SSP0_D1 */ 429 MX28_PAD_SSP0_DATA1__SSP0_D1
429 0x2020 /* MX28_PAD_SSP0_DATA2__SSP0_D2 */ 430 MX28_PAD_SSP0_DATA2__SSP0_D2
430 0x2030 /* MX28_PAD_SSP0_DATA3__SSP0_D3 */ 431 MX28_PAD_SSP0_DATA3__SSP0_D3
431 0x2040 /* MX28_PAD_SSP0_DATA4__SSP0_D4 */ 432 MX28_PAD_SSP0_DATA4__SSP0_D4
432 0x2050 /* MX28_PAD_SSP0_DATA5__SSP0_D5 */ 433 MX28_PAD_SSP0_DATA5__SSP0_D5
433 0x2060 /* MX28_PAD_SSP0_DATA6__SSP0_D6 */ 434 MX28_PAD_SSP0_DATA6__SSP0_D6
434 0x2070 /* MX28_PAD_SSP0_DATA7__SSP0_D7 */ 435 MX28_PAD_SSP0_DATA7__SSP0_D7
435 0x2080 /* MX28_PAD_SSP0_CMD__SSP0_CMD */ 436 MX28_PAD_SSP0_CMD__SSP0_CMD
436 0x2090 /* MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT */ 437 MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT
437 0x20a0 /* MX28_PAD_SSP0_SCK__SSP0_SCK */ 438 MX28_PAD_SSP0_SCK__SSP0_SCK
438 >; 439 >;
439 fsl,drive-strength = <1>; 440 fsl,drive-strength = <MXS_DRIVE_8mA>;
440 fsl,voltage = <1>; 441 fsl,voltage = <MXS_VOLTAGE_HIGH>;
441 fsl,pull-up = <1>; 442 fsl,pull-up = <MXS_PULL_ENABLE>;
442 }; 443 };
443 444
444 mmc0_4bit_pins_a: mmc0-4bit@0 { 445 mmc0_4bit_pins_a: mmc0-4bit@0 {
445 reg = <0>; 446 reg = <0>;
446 fsl,pinmux-ids = < 447 fsl,pinmux-ids = <
447 0x2000 /* MX28_PAD_SSP0_DATA0__SSP0_D0 */ 448 MX28_PAD_SSP0_DATA0__SSP0_D0
448 0x2010 /* MX28_PAD_SSP0_DATA1__SSP0_D1 */ 449 MX28_PAD_SSP0_DATA1__SSP0_D1
449 0x2020 /* MX28_PAD_SSP0_DATA2__SSP0_D2 */ 450 MX28_PAD_SSP0_DATA2__SSP0_D2
450 0x2030 /* MX28_PAD_SSP0_DATA3__SSP0_D3 */ 451 MX28_PAD_SSP0_DATA3__SSP0_D3
451 0x2080 /* MX28_PAD_SSP0_CMD__SSP0_CMD */ 452 MX28_PAD_SSP0_CMD__SSP0_CMD
452 0x2090 /* MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT */ 453 MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT
453 0x20a0 /* MX28_PAD_SSP0_SCK__SSP0_SCK */ 454 MX28_PAD_SSP0_SCK__SSP0_SCK
454 >; 455 >;
455 fsl,drive-strength = <1>; 456 fsl,drive-strength = <MXS_DRIVE_8mA>;
456 fsl,voltage = <1>; 457 fsl,voltage = <MXS_VOLTAGE_HIGH>;
457 fsl,pull-up = <1>; 458 fsl,pull-up = <MXS_PULL_ENABLE>;
458 }; 459 };
459 460
460 mmc0_cd_cfg: mmc0-cd-cfg { 461 mmc0_cd_cfg: mmc0-cd-cfg {
461 fsl,pinmux-ids = < 462 fsl,pinmux-ids = <
462 0x2090 /* MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT */ 463 MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT
463 >; 464 >;
464 fsl,pull-up = <0>; 465 fsl,pull-up = <MXS_PULL_DISABLE>;
465 }; 466 };
466 467
467 mmc0_sck_cfg: mmc0-sck-cfg { 468 mmc0_sck_cfg: mmc0-sck-cfg {
468 fsl,pinmux-ids = < 469 fsl,pinmux-ids = <
469 0x20a0 /* MX28_PAD_SSP0_SCK__SSP0_SCK */ 470 MX28_PAD_SSP0_SCK__SSP0_SCK
470 >; 471 >;
471 fsl,drive-strength = <2>; 472 fsl,drive-strength = <MXS_DRIVE_12mA>;
472 fsl,pull-up = <0>; 473 fsl,pull-up = <MXS_PULL_DISABLE>;
474 };
475
476 mmc2_4bit_pins_a: mmc2-4bit@0 {
477 reg = <0>;
478 fsl,pinmux-ids = <
479 MX28_PAD_SSP0_DATA4__SSP2_D0
480 MX28_PAD_SSP1_SCK__SSP2_D1
481 MX28_PAD_SSP1_CMD__SSP2_D2
482 MX28_PAD_SSP0_DATA5__SSP2_D3
483 MX28_PAD_SSP0_DATA6__SSP2_CMD
484 MX28_PAD_AUART1_RX__SSP2_CARD_DETECT
485 MX28_PAD_SSP0_DATA7__SSP2_SCK
486 >;
487 fsl,drive-strength = <MXS_DRIVE_8mA>;
488 fsl,voltage = <MXS_VOLTAGE_HIGH>;
489 fsl,pull-up = <MXS_PULL_ENABLE>;
490 };
491
492 mmc2_cd_cfg: mmc2-cd-cfg {
493 fsl,pinmux-ids = <
494 MX28_PAD_AUART1_RX__SSP2_CARD_DETECT
495 >;
496 fsl,pull-up = <MXS_PULL_DISABLE>;
497 };
498
499 mmc2_sck_cfg: mmc2-sck-cfg {
500 fsl,pinmux-ids = <
501 MX28_PAD_SSP0_DATA7__SSP2_SCK
502 >;
503 fsl,drive-strength = <MXS_DRIVE_12mA>;
504 fsl,pull-up = <MXS_PULL_DISABLE>;
473 }; 505 };
474 506
475 i2c0_pins_a: i2c0@0 { 507 i2c0_pins_a: i2c0@0 {
476 reg = <0>; 508 reg = <0>;
477 fsl,pinmux-ids = < 509 fsl,pinmux-ids = <
478 0x3180 /* MX28_PAD_I2C0_SCL__I2C0_SCL */ 510 MX28_PAD_I2C0_SCL__I2C0_SCL
479 0x3190 /* MX28_PAD_I2C0_SDA__I2C0_SDA */ 511 MX28_PAD_I2C0_SDA__I2C0_SDA
480 >; 512 >;
481 fsl,drive-strength = <1>; 513 fsl,drive-strength = <MXS_DRIVE_8mA>;
482 fsl,voltage = <1>; 514 fsl,voltage = <MXS_VOLTAGE_HIGH>;
483 fsl,pull-up = <1>; 515 fsl,pull-up = <MXS_PULL_ENABLE>;
484 }; 516 };
485 517
486 i2c0_pins_b: i2c0@1 { 518 i2c0_pins_b: i2c0@1 {
487 reg = <1>; 519 reg = <1>;
488 fsl,pinmux-ids = < 520 fsl,pinmux-ids = <
489 0x3001 /* MX28_PAD_AUART0_RX__I2C0_SCL */ 521 MX28_PAD_AUART0_RX__I2C0_SCL
490 0x3011 /* MX28_PAD_AUART0_TX__I2C0_SDA */ 522 MX28_PAD_AUART0_TX__I2C0_SDA
491 >; 523 >;
492 fsl,drive-strength = <1>; 524 fsl,drive-strength = <MXS_DRIVE_8mA>;
493 fsl,voltage = <1>; 525 fsl,voltage = <MXS_VOLTAGE_HIGH>;
494 fsl,pull-up = <1>; 526 fsl,pull-up = <MXS_PULL_ENABLE>;
495 }; 527 };
496 528
497 i2c1_pins_a: i2c1@0 { 529 i2c1_pins_a: i2c1@0 {
498 reg = <0>; 530 reg = <0>;
499 fsl,pinmux-ids = < 531 fsl,pinmux-ids = <
500 0x3101 /* MX28_PAD_PWM0__I2C1_SCL */ 532 MX28_PAD_PWM0__I2C1_SCL
501 0x3111 /* MX28_PAD_PWM1__I2C1_SDA */ 533 MX28_PAD_PWM1__I2C1_SDA
502 >; 534 >;
503 fsl,drive-strength = <1>; 535 fsl,drive-strength = <MXS_DRIVE_8mA>;
504 fsl,voltage = <1>; 536 fsl,voltage = <MXS_VOLTAGE_HIGH>;
505 fsl,pull-up = <1>; 537 fsl,pull-up = <MXS_PULL_ENABLE>;
506 }; 538 };
507 539
508 saif0_pins_a: saif0@0 { 540 saif0_pins_a: saif0@0 {
509 reg = <0>; 541 reg = <0>;
510 fsl,pinmux-ids = < 542 fsl,pinmux-ids = <
511 0x3140 /* MX28_PAD_SAIF0_MCLK__SAIF0_MCLK */ 543 MX28_PAD_SAIF0_MCLK__SAIF0_MCLK
512 0x3150 /* MX28_PAD_SAIF0_LRCLK__SAIF0_LRCLK */ 544 MX28_PAD_SAIF0_LRCLK__SAIF0_LRCLK
513 0x3160 /* MX28_PAD_SAIF0_BITCLK__SAIF0_BITCLK */ 545 MX28_PAD_SAIF0_BITCLK__SAIF0_BITCLK
514 0x3170 /* MX28_PAD_SAIF0_SDATA0__SAIF0_SDATA0 */ 546 MX28_PAD_SAIF0_SDATA0__SAIF0_SDATA0
515 >; 547 >;
516 fsl,drive-strength = <2>; 548 fsl,drive-strength = <MXS_DRIVE_12mA>;
517 fsl,voltage = <1>; 549 fsl,voltage = <MXS_VOLTAGE_HIGH>;
518 fsl,pull-up = <1>; 550 fsl,pull-up = <MXS_PULL_ENABLE>;
519 }; 551 };
520 552
521 saif0_pins_b: saif0@1 { 553 saif0_pins_b: saif0@1 {
522 reg = <1>; 554 reg = <1>;
523 fsl,pinmux-ids = < 555 fsl,pinmux-ids = <
524 0x3150 /* MX28_PAD_SAIF0_LRCLK__SAIF0_LRCLK */ 556 MX28_PAD_SAIF0_LRCLK__SAIF0_LRCLK
525 0x3160 /* MX28_PAD_SAIF0_BITCLK__SAIF0_BITCLK */ 557 MX28_PAD_SAIF0_BITCLK__SAIF0_BITCLK
526 0x3170 /* MX28_PAD_SAIF0_SDATA0__SAIF0_SDATA0 */ 558 MX28_PAD_SAIF0_SDATA0__SAIF0_SDATA0
527 >; 559 >;
528 fsl,drive-strength = <2>; 560 fsl,drive-strength = <MXS_DRIVE_12mA>;
529 fsl,voltage = <1>; 561 fsl,voltage = <MXS_VOLTAGE_HIGH>;
530 fsl,pull-up = <1>; 562 fsl,pull-up = <MXS_PULL_ENABLE>;
531 }; 563 };
532 564
533 saif1_pins_a: saif1@0 { 565 saif1_pins_a: saif1@0 {
534 reg = <0>; 566 reg = <0>;
535 fsl,pinmux-ids = < 567 fsl,pinmux-ids = <
536 0x31a0 /* MX28_PAD_SAIF1_SDATA0__SAIF1_SDATA0 */ 568 MX28_PAD_SAIF1_SDATA0__SAIF1_SDATA0
537 >; 569 >;
538 fsl,drive-strength = <2>; 570 fsl,drive-strength = <MXS_DRIVE_12mA>;
539 fsl,voltage = <1>; 571 fsl,voltage = <MXS_VOLTAGE_HIGH>;
540 fsl,pull-up = <1>; 572 fsl,pull-up = <MXS_PULL_ENABLE>;
541 }; 573 };
542 574
543 pwm0_pins_a: pwm0@0 { 575 pwm0_pins_a: pwm0@0 {
544 reg = <0>; 576 reg = <0>;
545 fsl,pinmux-ids = < 577 fsl,pinmux-ids = <
546 0x3100 /* MX28_PAD_PWM0__PWM_0 */ 578 MX28_PAD_PWM0__PWM_0
547 >; 579 >;
548 fsl,drive-strength = <0>; 580 fsl,drive-strength = <MXS_DRIVE_4mA>;
549 fsl,voltage = <1>; 581 fsl,voltage = <MXS_VOLTAGE_HIGH>;
550 fsl,pull-up = <0>; 582 fsl,pull-up = <MXS_PULL_DISABLE>;
551 }; 583 };
552 584
553 pwm2_pins_a: pwm2@0 { 585 pwm2_pins_a: pwm2@0 {
554 reg = <0>; 586 reg = <0>;
555 fsl,pinmux-ids = < 587 fsl,pinmux-ids = <
556 0x3120 /* MX28_PAD_PWM2__PWM_2 */ 588 MX28_PAD_PWM2__PWM_2
557 >; 589 >;
558 fsl,drive-strength = <0>; 590 fsl,drive-strength = <MXS_DRIVE_4mA>;
559 fsl,voltage = <1>; 591 fsl,voltage = <MXS_VOLTAGE_HIGH>;
560 fsl,pull-up = <0>; 592 fsl,pull-up = <MXS_PULL_DISABLE>;
561 }; 593 };
562 594
563 pwm3_pins_a: pwm3@0 { 595 pwm3_pins_a: pwm3@0 {
564 reg = <0>; 596 reg = <0>;
565 fsl,pinmux-ids = < 597 fsl,pinmux-ids = <
566 0x31c0 /* MX28_PAD_PWM3__PWM_3 */ 598 MX28_PAD_PWM3__PWM_3
567 >; 599 >;
568 fsl,drive-strength = <0>; 600 fsl,drive-strength = <MXS_DRIVE_4mA>;
569 fsl,voltage = <1>; 601 fsl,voltage = <MXS_VOLTAGE_HIGH>;
570 fsl,pull-up = <0>; 602 fsl,pull-up = <MXS_PULL_DISABLE>;
571 }; 603 };
572 604
573 pwm3_pins_b: pwm3@1 { 605 pwm3_pins_b: pwm3@1 {
574 reg = <1>; 606 reg = <1>;
575 fsl,pinmux-ids = < 607 fsl,pinmux-ids = <
576 0x3141 /* MX28_PAD_SAIF0_MCLK__PWM3 */ 608 MX28_PAD_SAIF0_MCLK__PWM_3
577 >; 609 >;
578 fsl,drive-strength = <0>; 610 fsl,drive-strength = <MXS_DRIVE_4mA>;
579 fsl,voltage = <1>; 611 fsl,voltage = <MXS_VOLTAGE_HIGH>;
580 fsl,pull-up = <0>; 612 fsl,pull-up = <MXS_PULL_DISABLE>;
581 }; 613 };
582 614
583 pwm4_pins_a: pwm4@0 { 615 pwm4_pins_a: pwm4@0 {
584 reg = <0>; 616 reg = <0>;
585 fsl,pinmux-ids = < 617 fsl,pinmux-ids = <
586 0x31d0 /* MX28_PAD_PWM4__PWM_4 */ 618 MX28_PAD_PWM4__PWM_4
587 >; 619 >;
588 fsl,drive-strength = <0>; 620 fsl,drive-strength = <MXS_DRIVE_4mA>;
589 fsl,voltage = <1>; 621 fsl,voltage = <MXS_VOLTAGE_HIGH>;
590 fsl,pull-up = <0>; 622 fsl,pull-up = <MXS_PULL_DISABLE>;
591 }; 623 };
592 624
593 lcdif_24bit_pins_a: lcdif-24bit@0 { 625 lcdif_24bit_pins_a: lcdif-24bit@0 {
594 reg = <0>; 626 reg = <0>;
595 fsl,pinmux-ids = < 627 fsl,pinmux-ids = <
596 0x1000 /* MX28_PAD_LCD_D00__LCD_D0 */ 628 MX28_PAD_LCD_D00__LCD_D0
597 0x1010 /* MX28_PAD_LCD_D01__LCD_D1 */ 629 MX28_PAD_LCD_D01__LCD_D1
598 0x1020 /* MX28_PAD_LCD_D02__LCD_D2 */ 630 MX28_PAD_LCD_D02__LCD_D2
599 0x1030 /* MX28_PAD_LCD_D03__LCD_D3 */ 631 MX28_PAD_LCD_D03__LCD_D3
600 0x1040 /* MX28_PAD_LCD_D04__LCD_D4 */ 632 MX28_PAD_LCD_D04__LCD_D4
601 0x1050 /* MX28_PAD_LCD_D05__LCD_D5 */ 633 MX28_PAD_LCD_D05__LCD_D5
602 0x1060 /* MX28_PAD_LCD_D06__LCD_D6 */ 634 MX28_PAD_LCD_D06__LCD_D6
603 0x1070 /* MX28_PAD_LCD_D07__LCD_D7 */ 635 MX28_PAD_LCD_D07__LCD_D7
604 0x1080 /* MX28_PAD_LCD_D08__LCD_D8 */ 636 MX28_PAD_LCD_D08__LCD_D8
605 0x1090 /* MX28_PAD_LCD_D09__LCD_D9 */ 637 MX28_PAD_LCD_D09__LCD_D9
606 0x10a0 /* MX28_PAD_LCD_D10__LCD_D10 */ 638 MX28_PAD_LCD_D10__LCD_D10
607 0x10b0 /* MX28_PAD_LCD_D11__LCD_D11 */ 639 MX28_PAD_LCD_D11__LCD_D11
608 0x10c0 /* MX28_PAD_LCD_D12__LCD_D12 */ 640 MX28_PAD_LCD_D12__LCD_D12
609 0x10d0 /* MX28_PAD_LCD_D13__LCD_D13 */ 641 MX28_PAD_LCD_D13__LCD_D13
610 0x10e0 /* MX28_PAD_LCD_D14__LCD_D14 */ 642 MX28_PAD_LCD_D14__LCD_D14
611 0x10f0 /* MX28_PAD_LCD_D15__LCD_D15 */ 643 MX28_PAD_LCD_D15__LCD_D15
612 0x1100 /* MX28_PAD_LCD_D16__LCD_D16 */ 644 MX28_PAD_LCD_D16__LCD_D16
613 0x1110 /* MX28_PAD_LCD_D17__LCD_D17 */ 645 MX28_PAD_LCD_D17__LCD_D17
614 0x1120 /* MX28_PAD_LCD_D18__LCD_D18 */ 646 MX28_PAD_LCD_D18__LCD_D18
615 0x1130 /* MX28_PAD_LCD_D19__LCD_D19 */ 647 MX28_PAD_LCD_D19__LCD_D19
616 0x1140 /* MX28_PAD_LCD_D20__LCD_D20 */ 648 MX28_PAD_LCD_D20__LCD_D20
617 0x1150 /* MX28_PAD_LCD_D21__LCD_D21 */ 649 MX28_PAD_LCD_D21__LCD_D21
618 0x1160 /* MX28_PAD_LCD_D22__LCD_D22 */ 650 MX28_PAD_LCD_D22__LCD_D22
619 0x1170 /* MX28_PAD_LCD_D23__LCD_D23 */ 651 MX28_PAD_LCD_D23__LCD_D23
620 >; 652 >;
621 fsl,drive-strength = <0>; 653 fsl,drive-strength = <MXS_DRIVE_4mA>;
622 fsl,voltage = <1>; 654 fsl,voltage = <MXS_VOLTAGE_HIGH>;
623 fsl,pull-up = <0>; 655 fsl,pull-up = <MXS_PULL_DISABLE>;
624 }; 656 };
625 657
626 lcdif_16bit_pins_a: lcdif-16bit@0 { 658 lcdif_16bit_pins_a: lcdif-16bit@0 {
627 reg = <0>; 659 reg = <0>;
628 fsl,pinmux-ids = < 660 fsl,pinmux-ids = <
629 0x1000 /* MX28_PAD_LCD_D00__LCD_D0 */ 661 MX28_PAD_LCD_D00__LCD_D0
630 0x1010 /* MX28_PAD_LCD_D01__LCD_D1 */ 662 MX28_PAD_LCD_D01__LCD_D1
631 0x1020 /* MX28_PAD_LCD_D02__LCD_D2 */ 663 MX28_PAD_LCD_D02__LCD_D2
632 0x1030 /* MX28_PAD_LCD_D03__LCD_D3 */ 664 MX28_PAD_LCD_D03__LCD_D3
633 0x1040 /* MX28_PAD_LCD_D04__LCD_D4 */ 665 MX28_PAD_LCD_D04__LCD_D4
634 0x1050 /* MX28_PAD_LCD_D05__LCD_D5 */ 666 MX28_PAD_LCD_D05__LCD_D5
635 0x1060 /* MX28_PAD_LCD_D06__LCD_D6 */ 667 MX28_PAD_LCD_D06__LCD_D6
636 0x1070 /* MX28_PAD_LCD_D07__LCD_D7 */ 668 MX28_PAD_LCD_D07__LCD_D7
637 0x1080 /* MX28_PAD_LCD_D08__LCD_D8 */ 669 MX28_PAD_LCD_D08__LCD_D8
638 0x1090 /* MX28_PAD_LCD_D09__LCD_D9 */ 670 MX28_PAD_LCD_D09__LCD_D9
639 0x10a0 /* MX28_PAD_LCD_D10__LCD_D10 */ 671 MX28_PAD_LCD_D10__LCD_D10
640 0x10b0 /* MX28_PAD_LCD_D11__LCD_D11 */ 672 MX28_PAD_LCD_D11__LCD_D11
641 0x10c0 /* MX28_PAD_LCD_D12__LCD_D12 */ 673 MX28_PAD_LCD_D12__LCD_D12
642 0x10d0 /* MX28_PAD_LCD_D13__LCD_D13 */ 674 MX28_PAD_LCD_D13__LCD_D13
643 0x10e0 /* MX28_PAD_LCD_D14__LCD_D14 */ 675 MX28_PAD_LCD_D14__LCD_D14
644 0x10f0 /* MX28_PAD_LCD_D15__LCD_D15 */ 676 MX28_PAD_LCD_D15__LCD_D15
645 >; 677 >;
646 fsl,drive-strength = <0>; 678 fsl,drive-strength = <MXS_DRIVE_4mA>;
647 fsl,voltage = <1>; 679 fsl,voltage = <MXS_VOLTAGE_HIGH>;
648 fsl,pull-up = <0>; 680 fsl,pull-up = <MXS_PULL_DISABLE>;
649 }; 681 };
650 682
651 lcdif_sync_pins_a: lcdif-sync@0 { 683 lcdif_sync_pins_a: lcdif-sync@0 {
652 reg = <0>; 684 reg = <0>;
653 fsl,pinmux-ids = < 685 fsl,pinmux-ids = <
654 0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */ 686 MX28_PAD_LCD_RS__LCD_DOTCLK
655 0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */ 687 MX28_PAD_LCD_CS__LCD_ENABLE
656 0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */ 688 MX28_PAD_LCD_RD_E__LCD_VSYNC
657 0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */ 689 MX28_PAD_LCD_WR_RWN__LCD_HSYNC
658 >; 690 >;
659 fsl,drive-strength = <0>; 691 fsl,drive-strength = <MXS_DRIVE_4mA>;
660 fsl,voltage = <1>; 692 fsl,voltage = <MXS_VOLTAGE_HIGH>;
661 fsl,pull-up = <0>; 693 fsl,pull-up = <MXS_PULL_DISABLE>;
662 }; 694 };
663 695
664 can0_pins_a: can0@0 { 696 can0_pins_a: can0@0 {
665 reg = <0>; 697 reg = <0>;
666 fsl,pinmux-ids = < 698 fsl,pinmux-ids = <
667 0x0161 /* MX28_PAD_GPMI_RDY2__CAN0_TX */ 699 MX28_PAD_GPMI_RDY2__CAN0_TX
668 0x0171 /* MX28_PAD_GPMI_RDY3__CAN0_RX */ 700 MX28_PAD_GPMI_RDY3__CAN0_RX
669 >; 701 >;
670 fsl,drive-strength = <0>; 702 fsl,drive-strength = <MXS_DRIVE_4mA>;
671 fsl,voltage = <1>; 703 fsl,voltage = <MXS_VOLTAGE_HIGH>;
672 fsl,pull-up = <0>; 704 fsl,pull-up = <MXS_PULL_DISABLE>;
673 }; 705 };
674 706
675 can1_pins_a: can1@0 { 707 can1_pins_a: can1@0 {
676 reg = <0>; 708 reg = <0>;
677 fsl,pinmux-ids = < 709 fsl,pinmux-ids = <
678 0x0121 /* MX28_PAD_GPMI_CE2N__CAN1_TX */ 710 MX28_PAD_GPMI_CE2N__CAN1_TX
679 0x0131 /* MX28_PAD_GPMI_CE3N__CAN1_RX */ 711 MX28_PAD_GPMI_CE3N__CAN1_RX
680 >; 712 >;
681 fsl,drive-strength = <0>; 713 fsl,drive-strength = <MXS_DRIVE_4mA>;
682 fsl,voltage = <1>; 714 fsl,voltage = <MXS_VOLTAGE_HIGH>;
683 fsl,pull-up = <0>; 715 fsl,pull-up = <MXS_PULL_DISABLE>;
684 }; 716 };
685 717
686 spi2_pins_a: spi2@0 { 718 spi2_pins_a: spi2@0 {
687 reg = <0>; 719 reg = <0>;
688 fsl,pinmux-ids = < 720 fsl,pinmux-ids = <
689 0x2100 /* MX28_PAD_SSP2_SCK__SSP2_SCK */ 721 MX28_PAD_SSP2_SCK__SSP2_SCK
690 0x2110 /* MX28_PAD_SSP2_MOSI__SSP2_CMD */ 722 MX28_PAD_SSP2_MOSI__SSP2_CMD
691 0x2120 /* MX28_PAD_SSP2_MISO__SSP2_D0 */ 723 MX28_PAD_SSP2_MISO__SSP2_D0
692 0x2130 /* MX28_PAD_SSP2_SS0__SSP2_D3 */ 724 MX28_PAD_SSP2_SS0__SSP2_D3
693 >; 725 >;
694 fsl,drive-strength = <1>; 726 fsl,drive-strength = <MXS_DRIVE_8mA>;
695 fsl,voltage = <1>; 727 fsl,voltage = <MXS_VOLTAGE_HIGH>;
696 fsl,pull-up = <1>; 728 fsl,pull-up = <MXS_PULL_ENABLE>;
697 }; 729 };
698 730
699 spi3_pins_a: spi3@0 { 731 spi3_pins_a: spi3@0 {
700 reg = <0>; 732 reg = <0>;
701 fsl,pinmux-ids = < 733 fsl,pinmux-ids = <
702 0x3082 /* MX28_PAD_AUART2_RX__SSP3_D4 */ 734 MX28_PAD_AUART2_RX__SSP3_D4
703 0x3092 /* MX28_PAD_AUART2_TX__SSP3_D5 */ 735 MX28_PAD_AUART2_TX__SSP3_D5
704 0x2180 /* MX28_PAD_SSP3_SCK__SSP3_SCK */ 736 MX28_PAD_SSP3_SCK__SSP3_SCK
705 0x2190 /* MX28_PAD_SSP3_MOSI__SSP3_CMD */ 737 MX28_PAD_SSP3_MOSI__SSP3_CMD
706 0x21A0 /* MX28_PAD_SSP3_MISO__SSP3_D0 */ 738 MX28_PAD_SSP3_MISO__SSP3_D0
707 0x21B0 /* MX28_PAD_SSP3_SS0__SSP3_D3 */ 739 MX28_PAD_SSP3_SS0__SSP3_D3
708 >; 740 >;
709 fsl,drive-strength = <1>; 741 fsl,drive-strength = <MXS_DRIVE_8mA>;
710 fsl,voltage = <1>; 742 fsl,voltage = <MXS_VOLTAGE_HIGH>;
711 fsl,pull-up = <0>; 743 fsl,pull-up = <MXS_PULL_DISABLE>;
712 }; 744 };
713 745
714 usbphy0_pins_a: usbphy0@0 { 746 usbphy0_pins_a: usbphy0@0 {
715 reg = <0>; 747 reg = <0>;
716 fsl,pinmux-ids = < 748 fsl,pinmux-ids = <
717 0x2152 /* MX28_PAD_SSP2_SS2__USB0_OVERCURRENT */ 749 MX28_PAD_SSP2_SS2__USB0_OVERCURRENT
718 >; 750 >;
719 fsl,drive-strength = <2>; 751 fsl,drive-strength = <MXS_DRIVE_12mA>;
720 fsl,voltage = <1>; 752 fsl,voltage = <MXS_VOLTAGE_HIGH>;
721 fsl,pull-up = <0>; 753 fsl,pull-up = <MXS_PULL_DISABLE>;
722 }; 754 };
723 755
724 usbphy0_pins_b: usbphy0@1 { 756 usbphy0_pins_b: usbphy0@1 {
725 reg = <1>; 757 reg = <1>;
726 fsl,pinmux-ids = < 758 fsl,pinmux-ids = <
727 0x3061 /* MX28_PAD_AUART1_CTS__USB0_OVERCURRENT */ 759 MX28_PAD_AUART1_CTS__USB0_OVERCURRENT
728 >; 760 >;
729 fsl,drive-strength = <2>; 761 fsl,drive-strength = <MXS_DRIVE_12mA>;
730 fsl,voltage = <1>; 762 fsl,voltage = <MXS_VOLTAGE_HIGH>;
731 fsl,pull-up = <0>; 763 fsl,pull-up = <MXS_PULL_DISABLE>;
732 }; 764 };
733 765
734 usbphy1_pins_a: usbphy1@0 { 766 usbphy1_pins_a: usbphy1@0 {
735 reg = <0>; 767 reg = <0>;
736 fsl,pinmux-ids = < 768 fsl,pinmux-ids = <
737 0x2142 /* MX28_PAD_SSP2_SS1__USB1_OVERCURRENT */ 769 MX28_PAD_SSP2_SS1__USB1_OVERCURRENT
770 >;
771 fsl,drive-strength = <MXS_DRIVE_12mA>;
772 fsl,voltage = <MXS_VOLTAGE_HIGH>;
773 fsl,pull-up = <MXS_PULL_DISABLE>;
774 };
775
776 usb0_id_pins_a: usb0id@0 {
777 reg = <0>;
778 fsl,pinmux-ids = <
779 MX28_PAD_AUART1_RTS__USB0_ID
738 >; 780 >;
739 fsl,drive-strength = <2>; 781 fsl,drive-strength = <MXS_DRIVE_12mA>;
740 fsl,voltage = <1>; 782 fsl,voltage = <MXS_VOLTAGE_HIGH>;
741 fsl,pull-up = <0>; 783 fsl,pull-up = <MXS_PULL_ENABLE>;
742 }; 784 };
743 }; 785 };
744 786
@@ -902,6 +944,7 @@
902 interrupts = <10 14 15 16 17 18 19 944 interrupts = <10 14 15 16 17 18 19
903 20 21 22 23 24 25>; 945 20 21 22 23 24 25>;
904 status = "disabled"; 946 status = "disabled";
947 clocks = <&clks 41>;
905 }; 948 };
906 949
907 spdif: spdif@80054000 { 950 spdif: spdif@80054000 {
diff --git a/arch/arm/boot/dts/imx51-apf51dev.dts b/arch/arm/boot/dts/imx51-apf51dev.dts
index 123fe84e0e8c..5a7f552786a1 100644
--- a/arch/arm/boot/dts/imx51-apf51dev.dts
+++ b/arch/arm/boot/dts/imx51-apf51dev.dts
@@ -16,6 +16,33 @@
16 model = "Armadeus Systems APF51Dev docking/development board"; 16 model = "Armadeus Systems APF51Dev docking/development board";
17 compatible = "armadeus,imx51-apf51dev", "armadeus,imx51-apf51", "fsl,imx51"; 17 compatible = "armadeus,imx51-apf51dev", "armadeus,imx51-apf51", "fsl,imx51";
18 18
19 display@di1 {
20 compatible = "fsl,imx-parallel-display";
21 crtcs = <&ipu 0>;
22 interface-pix-fmt = "bgr666";
23 pinctrl-names = "default";
24 pinctrl-0 = <&pinctrl_ipu_disp1_1>;
25
26 display-timings {
27 lw700 {
28 native-mode;
29 clock-frequency = <33000033>;
30 hactive = <800>;
31 vactive = <480>;
32 hback-porch = <96>;
33 hfront-porch = <96>;
34 vback-porch = <20>;
35 vfront-porch = <21>;
36 hsync-len = <64>;
37 vsync-len = <4>;
38 hsync-active = <1>;
39 vsync-active = <1>;
40 de-active = <1>;
41 pixelclk-active = <0>;
42 };
43 };
44 };
45
19 gpio-keys { 46 gpio-keys {
20 compatible = "gpio-keys"; 47 compatible = "gpio-keys";
21 48
diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts
index 1d337d99ecd5..be1407cf5abd 100644
--- a/arch/arm/boot/dts/imx51-babbage.dts
+++ b/arch/arm/boot/dts/imx51-babbage.dts
@@ -27,6 +27,20 @@
27 interface-pix-fmt = "rgb24"; 27 interface-pix-fmt = "rgb24";
28 pinctrl-names = "default"; 28 pinctrl-names = "default";
29 pinctrl-0 = <&pinctrl_ipu_disp1_1>; 29 pinctrl-0 = <&pinctrl_ipu_disp1_1>;
30 display-timings {
31 native-mode = <&timing0>;
32 timing0: dvi {
33 clock-frequency = <65000000>;
34 hactive = <1024>;
35 vactive = <768>;
36 hback-porch = <220>;
37 hfront-porch = <40>;
38 vback-porch = <21>;
39 vfront-porch = <7>;
40 hsync-len = <60>;
41 vsync-len = <10>;
42 };
43 };
30 }; 44 };
31 45
32 display@di1 { 46 display@di1 {
@@ -35,6 +49,25 @@
35 interface-pix-fmt = "rgb565"; 49 interface-pix-fmt = "rgb565";
36 pinctrl-names = "default"; 50 pinctrl-names = "default";
37 pinctrl-0 = <&pinctrl_ipu_disp2_1>; 51 pinctrl-0 = <&pinctrl_ipu_disp2_1>;
52 status = "disabled";
53 display-timings {
54 native-mode = <&timing1>;
55 timing1: claawvga {
56 clock-frequency = <27000000>;
57 hactive = <800>;
58 vactive = <480>;
59 hback-porch = <40>;
60 hfront-porch = <60>;
61 vback-porch = <10>;
62 vfront-porch = <10>;
63 hsync-len = <20>;
64 vsync-len = <10>;
65 hsync-active = <0>;
66 vsync-active = <0>;
67 de-active = <1>;
68 pixelclk-active = <0>;
69 };
70 };
38 }; 71 };
39 72
40 gpio-keys { 73 gpio-keys {
@@ -95,7 +128,7 @@
95 128
96&uart3 { 129&uart3 {
97 pinctrl-names = "default"; 130 pinctrl-names = "default";
98 pinctrl-0 = <&pinctrl_uart3_1>; 131 pinctrl-0 = <&pinctrl_uart3_1 &pinctrl_uart3_rtscts_1>;
99 fsl,uart-has-rtscts; 132 fsl,uart-has-rtscts;
100 status = "okay"; 133 status = "okay";
101}; 134};
@@ -252,7 +285,7 @@
252 285
253&uart1 { 286&uart1 {
254 pinctrl-names = "default"; 287 pinctrl-names = "default";
255 pinctrl-0 = <&pinctrl_uart1_1>; 288 pinctrl-0 = <&pinctrl_uart1_1 &pinctrl_uart1_rtscts_1>;
256 fsl,uart-has-rtscts; 289 fsl,uart-has-rtscts;
257 status = "okay"; 290 status = "okay";
258}; 291};
diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
index a85abb424c34..f4dcff3a9969 100644
--- a/arch/arm/boot/dts/imx51.dtsi
+++ b/arch/arm/boot/dts/imx51.dtsi
@@ -86,6 +86,11 @@
86 interrupt-parent = <&tzic>; 86 interrupt-parent = <&tzic>;
87 ranges; 87 ranges;
88 88
89 iram: iram@1ffe0000 {
90 compatible = "mmio-sram";
91 reg = <0x1ffe0000 0x20000>;
92 };
93
89 ipu: ipu@40000000 { 94 ipu: ipu@40000000 {
90 #crtc-cells = <1>; 95 #crtc-cells = <1>;
91 compatible = "fsl,imx51-ipu"; 96 compatible = "fsl,imx51-ipu";
@@ -374,6 +379,14 @@
374 clocks = <&clks 107>; 379 clocks = <&clks 107>;
375 }; 380 };
376 381
382 owire: owire@83fa4000 {
383 compatible = "fsl,imx51-owire", "fsl,imx21-owire";
384 reg = <0x83fa4000 0x4000>;
385 interrupts = <88>;
386 clocks = <&clks 159>;
387 status = "disabled";
388 };
389
377 ecspi2: ecspi@83fac000 { 390 ecspi2: ecspi@83fac000 {
378 #address-cells = <1>; 391 #address-cells = <1>;
379 #size-cells = <0>; 392 #size-cells = <0>;
@@ -474,7 +487,7 @@
474 compatible = "fsl,imx51-pata", "fsl,imx27-pata"; 487 compatible = "fsl,imx51-pata", "fsl,imx27-pata";
475 reg = <0x83fe0000 0x4000>; 488 reg = <0x83fe0000 0x4000>;
476 interrupts = <70>; 489 interrupts = <70>;
477 clocks = <&clks 161>; 490 clocks = <&clks 172>;
478 status = "disabled"; 491 status = "disabled";
479 }; 492 };
480 493
@@ -747,6 +760,11 @@
747 fsl,pins = < 760 fsl,pins = <
748 MX51_PAD_UART1_RXD__UART1_RXD 0x1c5 761 MX51_PAD_UART1_RXD__UART1_RXD 0x1c5
749 MX51_PAD_UART1_TXD__UART1_TXD 0x1c5 762 MX51_PAD_UART1_TXD__UART1_TXD 0x1c5
763 >;
764 };
765
766 pinctrl_uart1_rtscts_1: uart1rtscts-1 {
767 fsl,pins = <
750 MX51_PAD_UART1_RTS__UART1_RTS 0x1c5 768 MX51_PAD_UART1_RTS__UART1_RTS 0x1c5
751 MX51_PAD_UART1_CTS__UART1_CTS 0x1c5 769 MX51_PAD_UART1_CTS__UART1_CTS 0x1c5
752 >; 770 >;
@@ -767,6 +785,11 @@
767 fsl,pins = < 785 fsl,pins = <
768 MX51_PAD_EIM_D25__UART3_RXD 0x1c5 786 MX51_PAD_EIM_D25__UART3_RXD 0x1c5
769 MX51_PAD_EIM_D26__UART3_TXD 0x1c5 787 MX51_PAD_EIM_D26__UART3_TXD 0x1c5
788 >;
789 };
790
791 pinctrl_uart3_rtscts_1: uart3rtscts-1 {
792 fsl,pins = <
770 MX51_PAD_EIM_D27__UART3_RTS 0x1c5 793 MX51_PAD_EIM_D27__UART3_RTS 0x1c5
771 MX51_PAD_EIM_D24__UART3_CTS 0x1c5 794 MX51_PAD_EIM_D24__UART3_CTS 0x1c5
772 >; 795 >;
diff --git a/arch/arm/boot/dts/imx53-qsb.dts b/arch/arm/boot/dts/imx53-qsb.dts
index e97ddae09d74..91a5935a4aac 100644
--- a/arch/arm/boot/dts/imx53-qsb.dts
+++ b/arch/arm/boot/dts/imx53-qsb.dts
@@ -55,19 +55,20 @@
55 label = "Power Button"; 55 label = "Power Button";
56 gpios = <&gpio1 8 0>; 56 gpios = <&gpio1 8 0>;
57 linux,code = <116>; /* KEY_POWER */ 57 linux,code = <116>; /* KEY_POWER */
58 gpio-key,wakeup;
59 }; 58 };
60 59
61 volume-up { 60 volume-up {
62 label = "Volume Up"; 61 label = "Volume Up";
63 gpios = <&gpio2 14 0>; 62 gpios = <&gpio2 14 0>;
64 linux,code = <115>; /* KEY_VOLUMEUP */ 63 linux,code = <115>; /* KEY_VOLUMEUP */
64 gpio-key,wakeup;
65 }; 65 };
66 66
67 volume-down { 67 volume-down {
68 label = "Volume Down"; 68 label = "Volume Down";
69 gpios = <&gpio2 15 0>; 69 gpios = <&gpio2 15 0>;
70 linux,code = <114>; /* KEY_VOLUMEDOWN */ 70 linux,code = <114>; /* KEY_VOLUMEDOWN */
71 gpio-key,wakeup;
71 }; 72 };
72 }; 73 };
73 74
@@ -122,7 +123,6 @@
122&esdhc1 { 123&esdhc1 {
123 pinctrl-names = "default"; 124 pinctrl-names = "default";
124 pinctrl-0 = <&pinctrl_esdhc1_1>; 125 pinctrl-0 = <&pinctrl_esdhc1_1>;
125 cd-gpios = <&gpio3 13 0>;
126 status = "okay"; 126 status = "okay";
127}; 127};
128 128
@@ -136,6 +136,7 @@
136 pinctrl-0 = <&pinctrl_esdhc3_1>; 136 pinctrl-0 = <&pinctrl_esdhc3_1>;
137 cd-gpios = <&gpio3 11 0>; 137 cd-gpios = <&gpio3 11 0>;
138 wp-gpios = <&gpio3 12 0>; 138 wp-gpios = <&gpio3 12 0>;
139 bus-width = <8>;
139 status = "okay"; 140 status = "okay";
140}; 141};
141 142
@@ -152,7 +153,6 @@
152 MX53_PAD_PATA_DATA15__GPIO2_15 0x80000000 153 MX53_PAD_PATA_DATA15__GPIO2_15 0x80000000
153 MX53_PAD_EIM_DA11__GPIO3_11 0x80000000 154 MX53_PAD_EIM_DA11__GPIO3_11 0x80000000
154 MX53_PAD_EIM_DA12__GPIO3_12 0x80000000 155 MX53_PAD_EIM_DA12__GPIO3_12 0x80000000
155 MX53_PAD_EIM_DA13__GPIO3_13 0x80000000
156 MX53_PAD_PATA_DA_0__GPIO7_6 0x80000000 156 MX53_PAD_PATA_DA_0__GPIO7_6 0x80000000
157 MX53_PAD_PATA_DA_2__GPIO7_8 0x80000000 157 MX53_PAD_PATA_DA_2__GPIO7_8 0x80000000
158 MX53_PAD_GPIO_16__GPIO7_11 0x80000000 158 MX53_PAD_GPIO_16__GPIO7_11 0x80000000
@@ -318,5 +318,6 @@
318}; 318};
319 319
320&usbotg { 320&usbotg {
321 status = "okay"; 321 dr_mode = "peripheral";
322 status = "okay";
322}; 323};
diff --git a/arch/arm/boot/dts/imx6q-pinfunc.h b/arch/arm/boot/dts/imx6q-pinfunc.h
index c0e38a45e4bb..97ed0816a6e0 100644
--- a/arch/arm/boot/dts/imx6q-pinfunc.h
+++ b/arch/arm/boot/dts/imx6q-pinfunc.h
@@ -207,8 +207,8 @@
207#define MX6QDL_PAD_EIM_D29__ECSPI4_SS0 0x0c8 0x3dc 0x824 0x2 0x1 207#define MX6QDL_PAD_EIM_D29__ECSPI4_SS0 0x0c8 0x3dc 0x824 0x2 0x1
208#define MX6QDL_PAD_EIM_D29__UART2_RTS_B 0x0c8 0x3dc 0x924 0x4 0x1 208#define MX6QDL_PAD_EIM_D29__UART2_RTS_B 0x0c8 0x3dc 0x924 0x4 0x1
209#define MX6QDL_PAD_EIM_D29__UART2_CTS_B 0x0c8 0x3dc 0x000 0x4 0x0 209#define MX6QDL_PAD_EIM_D29__UART2_CTS_B 0x0c8 0x3dc 0x000 0x4 0x0
210#define MX6QDL_PAD_EIM_D29__UART2_DTE_RTS_B 0x0c4 0x3dc 0x000 0x4 0x0 210#define MX6QDL_PAD_EIM_D29__UART2_DTE_RTS_B 0x0c8 0x3dc 0x000 0x4 0x0
211#define MX6QDL_PAD_EIM_D29__UART2_DTE_CTS_B 0x0c4 0x3dc 0x924 0x4 0x1 211#define MX6QDL_PAD_EIM_D29__UART2_DTE_CTS_B 0x0c8 0x3dc 0x924 0x4 0x1
212#define MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x0c8 0x3dc 0x000 0x5 0x0 212#define MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x0c8 0x3dc 0x000 0x5 0x0
213#define MX6QDL_PAD_EIM_D29__IPU2_CSI1_VSYNC 0x0c8 0x3dc 0x8e4 0x6 0x0 213#define MX6QDL_PAD_EIM_D29__IPU2_CSI1_VSYNC 0x0c8 0x3dc 0x8e4 0x6 0x0
214#define MX6QDL_PAD_EIM_D29__IPU1_DI0_PIN14 0x0c8 0x3dc 0x000 0x7 0x0 214#define MX6QDL_PAD_EIM_D29__IPU1_DI0_PIN14 0x0c8 0x3dc 0x000 0x7 0x0
@@ -536,7 +536,7 @@
536#define MX6QDL_PAD_ENET_REF_CLK__ESAI_RX_FS 0x1d4 0x4e8 0x85c 0x2 0x0 536#define MX6QDL_PAD_ENET_REF_CLK__ESAI_RX_FS 0x1d4 0x4e8 0x85c 0x2 0x0
537#define MX6QDL_PAD_ENET_REF_CLK__GPIO1_IO23 0x1d4 0x4e8 0x000 0x5 0x0 537#define MX6QDL_PAD_ENET_REF_CLK__GPIO1_IO23 0x1d4 0x4e8 0x000 0x5 0x0
538#define MX6QDL_PAD_ENET_REF_CLK__SPDIF_SR_CLK 0x1d4 0x4e8 0x000 0x6 0x0 538#define MX6QDL_PAD_ENET_REF_CLK__SPDIF_SR_CLK 0x1d4 0x4e8 0x000 0x6 0x0
539#define MX6QDL_PAD_ENET_RX_ER__USB_OTG_ID 0x1d8 0x4ec 0x000 0x0 0x0 539#define MX6QDL_PAD_ENET_RX_ER__USB_OTG_ID 0x1d8 0x4ec 0x004 0x0 0xff0d0100
540#define MX6QDL_PAD_ENET_RX_ER__ENET_RX_ER 0x1d8 0x4ec 0x000 0x1 0x0 540#define MX6QDL_PAD_ENET_RX_ER__ENET_RX_ER 0x1d8 0x4ec 0x000 0x1 0x0
541#define MX6QDL_PAD_ENET_RX_ER__ESAI_RX_HF_CLK 0x1d8 0x4ec 0x864 0x2 0x0 541#define MX6QDL_PAD_ENET_RX_ER__ESAI_RX_HF_CLK 0x1d8 0x4ec 0x864 0x2 0x0
542#define MX6QDL_PAD_ENET_RX_ER__SPDIF_IN 0x1d8 0x4ec 0x914 0x3 0x1 542#define MX6QDL_PAD_ENET_RX_ER__SPDIF_IN 0x1d8 0x4ec 0x914 0x3 0x1
@@ -654,7 +654,7 @@
654#define MX6QDL_PAD_GPIO_1__ESAI_RX_CLK 0x224 0x5f4 0x86c 0x0 0x1 654#define MX6QDL_PAD_GPIO_1__ESAI_RX_CLK 0x224 0x5f4 0x86c 0x0 0x1
655#define MX6QDL_PAD_GPIO_1__WDOG2_B 0x224 0x5f4 0x000 0x1 0x0 655#define MX6QDL_PAD_GPIO_1__WDOG2_B 0x224 0x5f4 0x000 0x1 0x0
656#define MX6QDL_PAD_GPIO_1__KEY_ROW5 0x224 0x5f4 0x8f4 0x2 0x0 656#define MX6QDL_PAD_GPIO_1__KEY_ROW5 0x224 0x5f4 0x8f4 0x2 0x0
657#define MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x224 0x5f4 0x000 0x3 0x0 657#define MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x224 0x5f4 0x004 0x3 0xff0d0101
658#define MX6QDL_PAD_GPIO_1__PWM2_OUT 0x224 0x5f4 0x000 0x4 0x0 658#define MX6QDL_PAD_GPIO_1__PWM2_OUT 0x224 0x5f4 0x000 0x4 0x0
659#define MX6QDL_PAD_GPIO_1__GPIO1_IO01 0x224 0x5f4 0x000 0x5 0x0 659#define MX6QDL_PAD_GPIO_1__GPIO1_IO01 0x224 0x5f4 0x000 0x5 0x0
660#define MX6QDL_PAD_GPIO_1__SD1_CD_B 0x224 0x5f4 0x000 0x6 0x0 660#define MX6QDL_PAD_GPIO_1__SD1_CD_B 0x224 0x5f4 0x000 0x6 0x0
diff --git a/arch/arm/boot/dts/imx6q-sabrelite.dts b/arch/arm/boot/dts/imx6q-sabrelite.dts
index 3530280f5150..f004913f7d80 100644
--- a/arch/arm/boot/dts/imx6q-sabrelite.dts
+++ b/arch/arm/boot/dts/imx6q-sabrelite.dts
@@ -65,8 +65,10 @@
65 }; 65 };
66}; 66};
67 67
68&sata { 68&audmux {
69 status = "okay"; 69 status = "okay";
70 pinctrl-names = "default";
71 pinctrl-0 = <&pinctrl_audmux_1>;
70}; 72};
71 73
72&ecspi1 { 74&ecspi1 {
@@ -83,11 +85,29 @@
83 }; 85 };
84}; 86};
85 87
86&ssi1 { 88&fec {
87 fsl,mode = "i2s-slave"; 89 pinctrl-names = "default";
90 pinctrl-0 = <&pinctrl_enet_1>;
91 phy-mode = "rgmii";
92 phy-reset-gpios = <&gpio3 23 0>;
88 status = "okay"; 93 status = "okay";
89}; 94};
90 95
96&i2c1 {
97 status = "okay";
98 clock-frequency = <100000>;
99 pinctrl-names = "default";
100 pinctrl-0 = <&pinctrl_i2c1_1>;
101
102 codec: sgtl5000@0a {
103 compatible = "fsl,sgtl5000";
104 reg = <0x0a>;
105 clocks = <&clks 201>;
106 VDDA-supply = <&reg_2p5v>;
107 VDDIO-supply = <&reg_3p3v>;
108 };
109};
110
91&iomuxc { 111&iomuxc {
92 pinctrl-names = "default"; 112 pinctrl-names = "default";
93 pinctrl-0 = <&pinctrl_hog>; 113 pinctrl-0 = <&pinctrl_hog>;
@@ -103,28 +123,61 @@
103 MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x80000000 123 MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x80000000
104 MX6QDL_PAD_SD3_DAT4__GPIO7_IO01 0x1f0b0 124 MX6QDL_PAD_SD3_DAT4__GPIO7_IO01 0x1f0b0
105 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x80000000 125 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x80000000
126 MX6QDL_PAD_EIM_D23__GPIO3_IO23 0x80000000
106 >; 127 >;
107 }; 128 };
108 }; 129 };
109}; 130};
110 131
111&usbotg { 132&ldb {
112 vbus-supply = <&reg_usb_otg_vbus>; 133 status = "okay";
113 pinctrl-names = "default"; 134
114 pinctrl-0 = <&pinctrl_usbotg_1>; 135 lvds-channel@0 {
115 disable-over-current; 136 fsl,data-mapping = "spwg";
137 fsl,data-width = <18>;
138 status = "okay";
139
140 display-timings {
141 native-mode = <&timing0>;
142 timing0: hsd100pxn1 {
143 clock-frequency = <65000000>;
144 hactive = <1024>;
145 vactive = <768>;
146 hback-porch = <220>;
147 hfront-porch = <40>;
148 vback-porch = <21>;
149 vfront-porch = <7>;
150 hsync-len = <60>;
151 vsync-len = <10>;
152 };
153 };
154 };
155};
156
157&sata {
158 status = "okay";
159};
160
161&ssi1 {
162 fsl,mode = "i2s-slave";
116 status = "okay"; 163 status = "okay";
117}; 164};
118 165
166&uart2 {
167 status = "okay";
168 pinctrl-names = "default";
169 pinctrl-0 = <&pinctrl_uart2_1>;
170};
171
119&usbh1 { 172&usbh1 {
120 status = "okay"; 173 status = "okay";
121}; 174};
122 175
123&fec { 176&usbotg {
177 vbus-supply = <&reg_usb_otg_vbus>;
124 pinctrl-names = "default"; 178 pinctrl-names = "default";
125 pinctrl-0 = <&pinctrl_enet_1>; 179 pinctrl-0 = <&pinctrl_usbotg_1>;
126 phy-mode = "rgmii"; 180 disable-over-current;
127 phy-reset-gpios = <&gpio3 23 0>;
128 status = "okay"; 181 status = "okay";
129}; 182};
130 183
@@ -145,30 +198,3 @@
145 vmmc-supply = <&reg_3p3v>; 198 vmmc-supply = <&reg_3p3v>;
146 status = "okay"; 199 status = "okay";
147}; 200};
148
149&audmux {
150 status = "okay";
151 pinctrl-names = "default";
152 pinctrl-0 = <&pinctrl_audmux_1>;
153};
154
155&uart2 {
156 status = "okay";
157 pinctrl-names = "default";
158 pinctrl-0 = <&pinctrl_uart2_1>;
159};
160
161&i2c1 {
162 status = "okay";
163 clock-frequency = <100000>;
164 pinctrl-names = "default";
165 pinctrl-0 = <&pinctrl_i2c1_1>;
166
167 codec: sgtl5000@0a {
168 compatible = "fsl,sgtl5000";
169 reg = <0x0a>;
170 clocks = <&clks 201>;
171 VDDA-supply = <&reg_2p5v>;
172 VDDIO-supply = <&reg_3p3v>;
173 };
174};
diff --git a/arch/arm/boot/dts/imx6q-udoo.dts b/arch/arm/boot/dts/imx6q-udoo.dts
new file mode 100644
index 000000000000..6e1ccdc019a7
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-udoo.dts
@@ -0,0 +1,39 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 *
4 * Author: Fabio Estevam <fabio.estevam@freescale.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12/dts-v1/;
13#include "imx6q.dtsi"
14
15/ {
16 model = "Udoo i.MX6 Quad Board";
17 compatible = "udoo,imx6q-udoo", "fsl,imx6q";
18
19 memory {
20 reg = <0x10000000 0x40000000>;
21 };
22};
23
24&sata {
25 status = "okay";
26};
27
28&uart2 {
29 pinctrl-names = "default";
30 pinctrl-0 = <&pinctrl_uart2_1>;
31 status = "okay";
32};
33
34&usdhc3 {
35 pinctrl-names = "default";
36 pinctrl-0 = <&pinctrl_usdhc3_2>;
37 non-removable;
38 status = "okay";
39};
diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
index 1cbbc5160d27..ff6f1e8f2dd9 100644
--- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
@@ -54,6 +54,7 @@
54 fsl,pins = < 54 fsl,pins = <
55 MX6QDL_PAD_NANDF_CS2__GPIO6_IO15 0x80000000 55 MX6QDL_PAD_NANDF_CS2__GPIO6_IO15 0x80000000
56 MX6QDL_PAD_SD2_DAT2__GPIO1_IO13 0x80000000 56 MX6QDL_PAD_SD2_DAT2__GPIO1_IO13 0x80000000
57 MX6QDL_PAD_GPIO_18__SD3_VSELECT 0x17059
57 >; 58 >;
58 }; 59 };
59 }; 60 };
@@ -74,8 +75,10 @@
74}; 75};
75 76
76&usdhc3 { 77&usdhc3 {
77 pinctrl-names = "default"; 78 pinctrl-names = "default", "state_100mhz", "state_200mhz";
78 pinctrl-0 = <&pinctrl_usdhc3_1>; 79 pinctrl-0 = <&pinctrl_usdhc3_1>;
80 pinctrl-1 = <&pinctrl_usdhc3_1_100mhz>;
81 pinctrl-2 = <&pinctrl_usdhc3_1_200mhz>;
79 cd-gpios = <&gpio6 15 0>; 82 cd-gpios = <&gpio6 15 0>;
80 wp-gpios = <&gpio1 13 0>; 83 wp-gpios = <&gpio1 13 0>;
81 status = "okay"; 84 status = "okay";
diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index 39eafc222a2e..e75e11b36dff 100644
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -80,6 +80,14 @@
80 mux-int-port = <2>; 80 mux-int-port = <2>;
81 mux-ext-port = <3>; 81 mux-ext-port = <3>;
82 }; 82 };
83
84 backlight {
85 compatible = "pwm-backlight";
86 pwms = <&pwm1 0 5000000>;
87 brightness-levels = <0 4 8 16 32 64 128 255>;
88 default-brightness-level = <7>;
89 status = "okay";
90 };
83}; 91};
84 92
85&audmux { 93&audmux {
@@ -108,6 +116,7 @@
108 pinctrl-names = "default"; 116 pinctrl-names = "default";
109 pinctrl-0 = <&pinctrl_enet_1>; 117 pinctrl-0 = <&pinctrl_enet_1>;
110 phy-mode = "rgmii"; 118 phy-mode = "rgmii";
119 phy-reset-gpios = <&gpio1 25 0>;
111 status = "okay"; 120 status = "okay";
112}; 121};
113 122
@@ -172,6 +181,7 @@
172 MX6QDL_PAD_NANDF_CLE__GPIO6_IO07 0x80000000 181 MX6QDL_PAD_NANDF_CLE__GPIO6_IO07 0x80000000
173 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000 182 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000
174 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x80000000 183 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x80000000
184 MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25 0x80000000
175 >; 185 >;
176 }; 186 };
177 }; 187 };
@@ -202,6 +212,12 @@
202 }; 212 };
203}; 213};
204 214
215&pwm1 {
216 pinctrl-names = "default";
217 pinctrl-0 = <&pinctrl_pwm0_1>;
218 status = "okay";
219};
220
205&ssi2 { 221&ssi2 {
206 fsl,mode = "i2s-slave"; 222 fsl,mode = "i2s-slave";
207 status = "okay"; 223 status = "okay";
@@ -229,6 +245,7 @@
229&usdhc2 { 245&usdhc2 {
230 pinctrl-names = "default"; 246 pinctrl-names = "default";
231 pinctrl-0 = <&pinctrl_usdhc2_1>; 247 pinctrl-0 = <&pinctrl_usdhc2_1>;
248 bus-width = <8>;
232 cd-gpios = <&gpio2 2 0>; 249 cd-gpios = <&gpio2 2 0>;
233 wp-gpios = <&gpio2 3 0>; 250 wp-gpios = <&gpio2 3 0>;
234 status = "okay"; 251 status = "okay";
@@ -237,6 +254,7 @@
237&usdhc3 { 254&usdhc3 {
238 pinctrl-names = "default"; 255 pinctrl-names = "default";
239 pinctrl-0 = <&pinctrl_usdhc3_1>; 256 pinctrl-0 = <&pinctrl_usdhc3_1>;
257 bus-width = <8>;
240 cd-gpios = <&gpio2 0 0>; 258 cd-gpios = <&gpio2 0 0>;
241 wp-gpios = <&gpio2 1 0>; 259 wp-gpios = <&gpio2 1 0>;
242 status = "okay"; 260 status = "okay";
diff --git a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
index a55113e65bcb..35f547929167 100644
--- a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
@@ -43,6 +43,13 @@
43 mux-int-port = <1>; 43 mux-int-port = <1>;
44 mux-ext-port = <3>; 44 mux-ext-port = <3>;
45 }; 45 };
46
47 sound-spdif {
48 compatible = "fsl,imx-audio-spdif";
49 model = "imx-spdif";
50 spdif-controller = <&spdif>;
51 spdif-out;
52 };
46}; 53};
47 54
48&audmux { 55&audmux {
@@ -81,6 +88,7 @@
81 MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x80000000 /* WL_REG_ON */ 88 MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x80000000 /* WL_REG_ON */
82 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000 /* WL_HOST_WAKE */ 89 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000 /* WL_HOST_WAKE */
83 MX6QDL_PAD_ENET_TXD0__GPIO1_IO30 0x80000000 /* WL_WAKE */ 90 MX6QDL_PAD_ENET_TXD0__GPIO1_IO30 0x80000000 /* WL_WAKE */
91 MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x80000000
84 >; 92 >;
85 }; 93 };
86 }; 94 };
@@ -90,6 +98,13 @@
90 pinctrl-names = "default"; 98 pinctrl-names = "default";
91 pinctrl-0 = <&pinctrl_enet_1>; 99 pinctrl-0 = <&pinctrl_enet_1>;
92 phy-mode = "rgmii"; 100 phy-mode = "rgmii";
101 phy-reset-gpios = <&gpio3 29 0>;
102 status = "okay";
103};
104
105&spdif {
106 pinctrl-names = "default";
107 pinctrl-0 = <&pinctrl_spdif_3>;
93 status = "okay"; 108 status = "okay";
94}; 109};
95 110
@@ -115,6 +130,14 @@
115 status = "okay"; 130 status = "okay";
116}; 131};
117 132
133&usbotg {
134 pinctrl-names = "default";
135 pinctrl-0 = <&pinctrl_usbotg_1>;
136 disable-over-current;
137 dr_mode = "peripheral";
138 status = "okay";
139};
140
118&usdhc1 { 141&usdhc1 {
119 pinctrl-names = "default"; 142 pinctrl-names = "default";
120 pinctrl-0 = <&pinctrl_usdhc1_2>; 143 pinctrl-0 = <&pinctrl_usdhc1_2>;
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index ccd55c2fdb67..59154dc15fe4 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -116,6 +116,22 @@
116 arm,data-latency = <4 2 3>; 116 arm,data-latency = <4 2 3>;
117 }; 117 };
118 118
119 pcie: pcie@0x01000000 {
120 compatible = "fsl,imx6q-pcie", "snps,dw-pcie";
121 reg = <0x01ffc000 0x4000>; /* DBI */
122 #address-cells = <3>;
123 #size-cells = <2>;
124 device_type = "pci";
125 ranges = <0x00000800 0 0x01f00000 0x01f00000 0 0x00080000 /* configuration space */
126 0x81000000 0 0 0x01f80000 0 0x00010000 /* downstream I/O */
127 0x82000000 0 0x01000000 0x01000000 0 0x00f00000>; /* non-prefetchable memory */
128 num-lanes = <1>;
129 interrupts = <0 123 0x04>;
130 clocks = <&clks 189>, <&clks 187>, <&clks 206>, <&clks 144>;
131 clock-names = "pcie_ref_125m", "sata_ref_100m", "lvds_gate", "pcie_axi";
132 status = "disabled";
133 };
134
119 pmu { 135 pmu {
120 compatible = "arm,cortex-a9-pmu"; 136 compatible = "arm,cortex-a9-pmu";
121 interrupts = <0 94 0x04>; 137 interrupts = <0 94 0x04>;
@@ -136,8 +152,23 @@
136 ranges; 152 ranges;
137 153
138 spdif: spdif@02004000 { 154 spdif: spdif@02004000 {
155 compatible = "fsl,imx35-spdif";
139 reg = <0x02004000 0x4000>; 156 reg = <0x02004000 0x4000>;
140 interrupts = <0 52 0x04>; 157 interrupts = <0 52 0x04>;
158 dmas = <&sdma 14 18 0>,
159 <&sdma 15 18 0>;
160 dma-names = "rx", "tx";
161 clocks = <&clks 197>, <&clks 3>,
162 <&clks 197>, <&clks 107>,
163 <&clks 0>, <&clks 118>,
164 <&clks 62>, <&clks 139>,
165 <&clks 0>;
166 clock-names = "core", "rxtx0",
167 "rxtx1", "rxtx2",
168 "rxtx3", "rxtx4",
169 "rxtx5", "rxtx6",
170 "rxtx7";
171 status = "disabled";
141 }; 172 };
142 173
143 ecspi1: ecspi@02008000 { 174 ecspi1: ecspi@02008000 {
@@ -1010,6 +1041,12 @@
1010 MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x1b0b0 1041 MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x1b0b0
1011 >; 1042 >;
1012 }; 1043 };
1044
1045 pinctrl_spdif_3: spdifgrp-3 {
1046 fsl,pins = <
1047 MX6QDL_PAD_ENET_RXD0__SPDIF_OUT 0x1b0b0
1048 >;
1049 };
1013 }; 1050 };
1014 1051
1015 uart1 { 1052 uart1 {
@@ -1184,6 +1221,36 @@
1184 >; 1221 >;
1185 }; 1222 };
1186 1223
1224 pinctrl_usdhc3_1_100mhz: usdhc3grp-1-100mhz { /* 100Mhz */
1225 fsl,pins = <
1226 MX6QDL_PAD_SD3_CMD__SD3_CMD 0x170b9
1227 MX6QDL_PAD_SD3_CLK__SD3_CLK 0x100b9
1228 MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x170b9
1229 MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x170b9
1230 MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x170b9
1231 MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x170b9
1232 MX6QDL_PAD_SD3_DAT4__SD3_DATA4 0x170b9
1233 MX6QDL_PAD_SD3_DAT5__SD3_DATA5 0x170b9
1234 MX6QDL_PAD_SD3_DAT6__SD3_DATA6 0x170b9
1235 MX6QDL_PAD_SD3_DAT7__SD3_DATA7 0x170b9
1236 >;
1237 };
1238
1239 pinctrl_usdhc3_1_200mhz: usdhc3grp-1-200mhz { /* 200Mhz */
1240 fsl,pins = <
1241 MX6QDL_PAD_SD3_CMD__SD3_CMD 0x170f9
1242 MX6QDL_PAD_SD3_CLK__SD3_CLK 0x100f9
1243 MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x170f9
1244 MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x170f9
1245 MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x170f9
1246 MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x170f9
1247 MX6QDL_PAD_SD3_DAT4__SD3_DATA4 0x170f9
1248 MX6QDL_PAD_SD3_DAT5__SD3_DATA5 0x170f9
1249 MX6QDL_PAD_SD3_DAT6__SD3_DATA6 0x170f9
1250 MX6QDL_PAD_SD3_DAT7__SD3_DATA7 0x170f9
1251 >;
1252 };
1253
1187 pinctrl_usdhc3_2: usdhc3grp-2 { 1254 pinctrl_usdhc3_2: usdhc3grp-2 {
1188 fsl,pins = < 1255 fsl,pins = <
1189 MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059 1256 MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059
diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts
index 2886a590823d..cc68e19c5163 100644
--- a/arch/arm/boot/dts/imx6sl-evk.dts
+++ b/arch/arm/boot/dts/imx6sl-evk.dts
@@ -17,6 +17,44 @@
17 memory { 17 memory {
18 reg = <0x80000000 0x40000000>; 18 reg = <0x80000000 0x40000000>;
19 }; 19 };
20
21 regulators {
22 compatible = "simple-bus";
23
24 reg_usb_otg1_vbus: usb_otg1_vbus {
25 compatible = "regulator-fixed";
26 regulator-name = "usb_otg1_vbus";
27 regulator-min-microvolt = <5000000>;
28 regulator-max-microvolt = <5000000>;
29 gpio = <&gpio4 0 0>;
30 enable-active-high;
31 };
32
33 reg_usb_otg2_vbus: usb_otg2_vbus {
34 compatible = "regulator-fixed";
35 regulator-name = "usb_otg2_vbus";
36 regulator-min-microvolt = <5000000>;
37 regulator-max-microvolt = <5000000>;
38 gpio = <&gpio4 2 0>;
39 enable-active-high;
40 };
41 };
42};
43
44&ecspi1 {
45 fsl,spi-num-chipselects = <1>;
46 cs-gpios = <&gpio4 11 0>;
47 pinctrl-names = "default";
48 pinctrl-0 = <&pinctrl_ecspi1_1>;
49 status = "okay";
50
51 flash: m25p80@0 {
52 #address-cells = <1>;
53 #size-cells = <1>;
54 compatible = "st,m25p32";
55 spi-max-frequency = <20000000>;
56 reg = <0>;
57 };
20}; 58};
21 59
22&fec { 60&fec {
@@ -38,6 +76,8 @@
38 MX6SL_PAD_SD2_DAT7__GPIO5_IO00 0x17059 76 MX6SL_PAD_SD2_DAT7__GPIO5_IO00 0x17059
39 MX6SL_PAD_SD2_DAT6__GPIO4_IO29 0x17059 77 MX6SL_PAD_SD2_DAT6__GPIO4_IO29 0x17059
40 MX6SL_PAD_REF_CLK_32K__GPIO3_IO22 0x17059 78 MX6SL_PAD_REF_CLK_32K__GPIO3_IO22 0x17059
79 MX6SL_PAD_KEY_COL4__GPIO4_IO00 0x80000000
80 MX6SL_PAD_KEY_COL5__GPIO4_IO02 0x80000000
41 >; 81 >;
42 }; 82 };
43 }; 83 };
@@ -49,9 +89,26 @@
49 status = "okay"; 89 status = "okay";
50}; 90};
51 91
52&usdhc1 { 92&usbotg1 {
93 vbus-supply = <&reg_usb_otg1_vbus>;
53 pinctrl-names = "default"; 94 pinctrl-names = "default";
95 pinctrl-0 = <&pinctrl_usbotg1_1>;
96 disable-over-current;
97 status = "okay";
98};
99
100&usbotg2 {
101 vbus-supply = <&reg_usb_otg2_vbus>;
102 dr_mode = "host";
103 disable-over-current;
104 status = "okay";
105};
106
107&usdhc1 {
108 pinctrl-names = "default", "state_100mhz", "state_200mhz";
54 pinctrl-0 = <&pinctrl_usdhc1_1>; 109 pinctrl-0 = <&pinctrl_usdhc1_1>;
110 pinctrl-1 = <&pinctrl_usdhc1_1_100mhz>;
111 pinctrl-2 = <&pinctrl_usdhc1_1_200mhz>;
55 bus-width = <8>; 112 bus-width = <8>;
56 cd-gpios = <&gpio4 7 0>; 113 cd-gpios = <&gpio4 7 0>;
57 wp-gpios = <&gpio4 6 0>; 114 wp-gpios = <&gpio4 6 0>;
@@ -59,16 +116,20 @@
59}; 116};
60 117
61&usdhc2 { 118&usdhc2 {
62 pinctrl-names = "default"; 119 pinctrl-names = "default", "state_100mhz", "state_200mhz";
63 pinctrl-0 = <&pinctrl_usdhc2_1>; 120 pinctrl-0 = <&pinctrl_usdhc2_1>;
121 pinctrl-1 = <&pinctrl_usdhc2_1_100mhz>;
122 pinctrl-2 = <&pinctrl_usdhc2_1_200mhz>;
64 cd-gpios = <&gpio5 0 0>; 123 cd-gpios = <&gpio5 0 0>;
65 wp-gpios = <&gpio4 29 0>; 124 wp-gpios = <&gpio4 29 0>;
66 status = "okay"; 125 status = "okay";
67}; 126};
68 127
69&usdhc3 { 128&usdhc3 {
70 pinctrl-names = "default"; 129 pinctrl-names = "default", "state_100mhz", "state_200mhz";
71 pinctrl-0 = <&pinctrl_usdhc3_1>; 130 pinctrl-0 = <&pinctrl_usdhc3_1>;
131 pinctrl-1 = <&pinctrl_usdhc3_1_100mhz>;
132 pinctrl-2 = <&pinctrl_usdhc3_1_200mhz>;
72 cd-gpios = <&gpio3 22 0>; 133 cd-gpios = <&gpio3 22 0>;
73 status = "okay"; 134 status = "okay";
74}; 135};
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index c46651e4d966..28558f1aaf2d 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -13,16 +13,20 @@
13 13
14/ { 14/ {
15 aliases { 15 aliases {
16 serial0 = &uart1;
17 serial1 = &uart2;
18 serial2 = &uart3;
19 serial3 = &uart4;
20 serial4 = &uart5;
21 gpio0 = &gpio1; 16 gpio0 = &gpio1;
22 gpio1 = &gpio2; 17 gpio1 = &gpio2;
23 gpio2 = &gpio3; 18 gpio2 = &gpio3;
24 gpio3 = &gpio4; 19 gpio3 = &gpio4;
25 gpio4 = &gpio5; 20 gpio4 = &gpio5;
21 serial0 = &uart1;
22 serial1 = &uart2;
23 serial2 = &uart3;
24 serial3 = &uart4;
25 serial4 = &uart5;
26 spi0 = &ecspi1;
27 spi1 = &ecspi2;
28 spi2 = &ecspi3;
29 spi3 = &ecspi4;
26 }; 30 };
27 31
28 cpus { 32 cpus {
@@ -380,7 +384,9 @@
380 }; 384 };
381 385
382 anatop: anatop@020c8000 { 386 anatop: anatop@020c8000 {
383 compatible = "fsl,imx6sl-anatop", "syscon", "simple-bus"; 387 compatible = "fsl,imx6sl-anatop",
388 "fsl,imx6q-anatop",
389 "syscon", "simple-bus";
384 reg = <0x020c8000 0x1000>; 390 reg = <0x020c8000 0x1000>;
385 interrupts = <0 49 0x04 0 54 0x04 0 127 0x04>; 391 interrupts = <0 49 0x04 0 54 0x04 0 127 0x04>;
386 392
@@ -528,10 +534,26 @@
528 interrupts = <0 89 0x04>; 534 interrupts = <0 89 0x04>;
529 }; 535 };
530 536
537 gpr: iomuxc-gpr@020e0000 {
538 compatible = "fsl,imx6sl-iomuxc-gpr",
539 "fsl,imx6q-iomuxc-gpr", "syscon";
540 reg = <0x020e0000 0x38>;
541 };
542
531 iomuxc: iomuxc@020e0000 { 543 iomuxc: iomuxc@020e0000 {
532 compatible = "fsl,imx6sl-iomuxc"; 544 compatible = "fsl,imx6sl-iomuxc";
533 reg = <0x020e0000 0x4000>; 545 reg = <0x020e0000 0x4000>;
534 546
547 ecspi1 {
548 pinctrl_ecspi1_1: ecspi1grp-1 {
549 fsl,pins = <
550 MX6SL_PAD_ECSPI1_MISO__ECSPI1_MISO 0x100b1
551 MX6SL_PAD_ECSPI1_MOSI__ECSPI1_MOSI 0x100b1
552 MX6SL_PAD_ECSPI1_SCLK__ECSPI1_SCLK 0x100b1
553 >;
554 };
555 };
556
535 fec { 557 fec {
536 pinctrl_fec_1: fecgrp-1 { 558 pinctrl_fec_1: fecgrp-1 {
537 fsl,pins = < 559 fsl,pins = <
@@ -557,6 +579,64 @@
557 }; 579 };
558 }; 580 };
559 581
582 usbotg1 {
583 pinctrl_usbotg1_1: usbotg1grp-1 {
584 fsl,pins = <
585 MX6SL_PAD_EPDC_PWRCOM__USB_OTG1_ID 0x17059
586 >;
587 };
588
589 pinctrl_usbotg1_2: usbotg1grp-2 {
590 fsl,pins = <
591 MX6SL_PAD_FEC_RXD0__USB_OTG1_ID 0x17059
592 >;
593 };
594
595 pinctrl_usbotg1_3: usbotg1grp-3 {
596 fsl,pins = <
597 MX6SL_PAD_LCD_DAT1__USB_OTG1_ID 0x17059
598 >;
599 };
600
601 pinctrl_usbotg1_4: usbotg1grp-4 {
602 fsl,pins = <
603 MX6SL_PAD_REF_CLK_32K__USB_OTG1_ID 0x17059
604 >;
605 };
606
607 pinctrl_usbotg1_5: usbotg1grp-5 {
608 fsl,pins = <
609 MX6SL_PAD_SD3_DAT0__USB_OTG1_ID 0x17059
610 >;
611 };
612 };
613
614 usbotg2 {
615 pinctrl_usbotg2_1: usbotg2grp-1 {
616 fsl,pins = <
617 MX6SL_PAD_ECSPI1_SCLK__USB_OTG2_OC 0x17059
618 >;
619 };
620
621 pinctrl_usbotg2_2: usbotg2grp-2 {
622 fsl,pins = <
623 MX6SL_PAD_ECSPI2_SCLK__USB_OTG2_OC 0x17059
624 >;
625 };
626
627 pinctrl_usbotg2_3: usbotg2grp-3 {
628 fsl,pins = <
629 MX6SL_PAD_KEY_ROW5__USB_OTG2_OC 0x17059
630 >;
631 };
632
633 pinctrl_usbotg2_4: usbotg2grp-4 {
634 fsl,pins = <
635 MX6SL_PAD_SD3_DAT2__USB_OTG2_OC 0x17059
636 >;
637 };
638 };
639
560 usdhc1 { 640 usdhc1 {
561 pinctrl_usdhc1_1: usdhc1grp-1 { 641 pinctrl_usdhc1_1: usdhc1grp-1 {
562 fsl,pins = < 642 fsl,pins = <
@@ -572,6 +652,38 @@
572 MX6SL_PAD_SD1_DAT7__SD1_DATA7 0x17059 652 MX6SL_PAD_SD1_DAT7__SD1_DATA7 0x17059
573 >; 653 >;
574 }; 654 };
655
656 pinctrl_usdhc1_1_100mhz: usdhc1grp-1-100mhz {
657 fsl,pins = <
658 MX6SL_PAD_SD1_CMD__SD1_CMD 0x170b9
659 MX6SL_PAD_SD1_CLK__SD1_CLK 0x100b9
660 MX6SL_PAD_SD1_DAT0__SD1_DATA0 0x170b9
661 MX6SL_PAD_SD1_DAT1__SD1_DATA1 0x170b9
662 MX6SL_PAD_SD1_DAT2__SD1_DATA2 0x170b9
663 MX6SL_PAD_SD1_DAT3__SD1_DATA3 0x170b9
664 MX6SL_PAD_SD1_DAT4__SD1_DATA4 0x170b9
665 MX6SL_PAD_SD1_DAT5__SD1_DATA5 0x170b9
666 MX6SL_PAD_SD1_DAT6__SD1_DATA6 0x170b9
667 MX6SL_PAD_SD1_DAT7__SD1_DATA7 0x170b9
668 >;
669 };
670
671 pinctrl_usdhc1_1_200mhz: usdhc1grp-1-200mhz {
672 fsl,pins = <
673 MX6SL_PAD_SD1_CMD__SD1_CMD 0x170f9
674 MX6SL_PAD_SD1_CLK__SD1_CLK 0x100f9
675 MX6SL_PAD_SD1_DAT0__SD1_DATA0 0x170f9
676 MX6SL_PAD_SD1_DAT1__SD1_DATA1 0x170f9
677 MX6SL_PAD_SD1_DAT2__SD1_DATA2 0x170f9
678 MX6SL_PAD_SD1_DAT3__SD1_DATA3 0x170f9
679 MX6SL_PAD_SD1_DAT4__SD1_DATA4 0x170f9
680 MX6SL_PAD_SD1_DAT5__SD1_DATA5 0x170f9
681 MX6SL_PAD_SD1_DAT6__SD1_DATA6 0x170f9
682 MX6SL_PAD_SD1_DAT7__SD1_DATA7 0x170f9
683 >;
684 };
685
686
575 }; 687 };
576 688
577 usdhc2 { 689 usdhc2 {
@@ -585,6 +697,29 @@
585 MX6SL_PAD_SD2_DAT3__SD2_DATA3 0x17059 697 MX6SL_PAD_SD2_DAT3__SD2_DATA3 0x17059
586 >; 698 >;
587 }; 699 };
700
701 pinctrl_usdhc2_1_100mhz: usdhc2grp-1-100mhz {
702 fsl,pins = <
703 MX6SL_PAD_SD2_CMD__SD2_CMD 0x170b9
704 MX6SL_PAD_SD2_CLK__SD2_CLK 0x100b9
705 MX6SL_PAD_SD2_DAT0__SD2_DATA0 0x170b9
706 MX6SL_PAD_SD2_DAT1__SD2_DATA1 0x170b9
707 MX6SL_PAD_SD2_DAT2__SD2_DATA2 0x170b9
708 MX6SL_PAD_SD2_DAT3__SD2_DATA3 0x170b9
709 >;
710 };
711
712 pinctrl_usdhc2_1_200mhz: usdhc2grp-1-200mhz {
713 fsl,pins = <
714 MX6SL_PAD_SD2_CMD__SD2_CMD 0x170f9
715 MX6SL_PAD_SD2_CLK__SD2_CLK 0x100f9
716 MX6SL_PAD_SD2_DAT0__SD2_DATA0 0x170f9
717 MX6SL_PAD_SD2_DAT1__SD2_DATA1 0x170f9
718 MX6SL_PAD_SD2_DAT2__SD2_DATA2 0x170f9
719 MX6SL_PAD_SD2_DAT3__SD2_DATA3 0x170f9
720 >;
721 };
722
588 }; 723 };
589 724
590 usdhc3 { 725 usdhc3 {
@@ -598,6 +733,28 @@
598 MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x17059 733 MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x17059
599 >; 734 >;
600 }; 735 };
736
737 pinctrl_usdhc3_1_100mhz: usdhc3grp-1-100mhz {
738 fsl,pins = <
739 MX6SL_PAD_SD3_CMD__SD3_CMD 0x170b9
740 MX6SL_PAD_SD3_CLK__SD3_CLK 0x100b9
741 MX6SL_PAD_SD3_DAT0__SD3_DATA0 0x170b9
742 MX6SL_PAD_SD3_DAT1__SD3_DATA1 0x170b9
743 MX6SL_PAD_SD3_DAT2__SD3_DATA2 0x170b9
744 MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x170b9
745 >;
746 };
747
748 pinctrl_usdhc3_1_200mhz: usdhc3grp-1-200mhz {
749 fsl,pins = <
750 MX6SL_PAD_SD3_CMD__SD3_CMD 0x170f9
751 MX6SL_PAD_SD3_CLK__SD3_CLK 0x100f9
752 MX6SL_PAD_SD3_DAT0__SD3_DATA0 0x170f9
753 MX6SL_PAD_SD3_DAT1__SD3_DATA1 0x170f9
754 MX6SL_PAD_SD3_DAT2__SD3_DATA2 0x170f9
755 MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x170f9
756 >;
757 };
601 }; 758 };
602 }; 759 };
603 760
@@ -619,7 +776,8 @@
619 <&clks IMX6SL_CLK_SDMA>; 776 <&clks IMX6SL_CLK_SDMA>;
620 clock-names = "ipg", "ahb"; 777 clock-names = "ipg", "ahb";
621 #dma-cells = <3>; 778 #dma-cells = <3>;
622 fsl,sdma-ram-script-name = "imx/sdma/sdma-imx6sl.bin"; 779 /* imx6sl reuses imx6q sdma firmware */
780 fsl,sdma-ram-script-name = "imx/sdma/sdma-imx6q.bin";
623 }; 781 };
624 782
625 pxp: pxp@020f0000 { 783 pxp: pxp@020f0000 {
@@ -663,7 +821,7 @@
663 usbotg2: usb@02184200 { 821 usbotg2: usb@02184200 {
664 compatible = "fsl,imx6sl-usb", "fsl,imx27-usb"; 822 compatible = "fsl,imx6sl-usb", "fsl,imx27-usb";
665 reg = <0x02184200 0x200>; 823 reg = <0x02184200 0x200>;
666 interrupts = <0 40 0x04>; 824 interrupts = <0 42 0x04>;
667 clocks = <&clks IMX6SL_CLK_USBOH3>; 825 clocks = <&clks IMX6SL_CLK_USBOH3>;
668 fsl,usbphy = <&usbphy2>; 826 fsl,usbphy = <&usbphy2>;
669 fsl,usbmisc = <&usbmisc 1>; 827 fsl,usbmisc = <&usbmisc 1>;
@@ -673,7 +831,7 @@
673 usbh: usb@02184400 { 831 usbh: usb@02184400 {
674 compatible = "fsl,imx6sl-usb", "fsl,imx27-usb"; 832 compatible = "fsl,imx6sl-usb", "fsl,imx27-usb";
675 reg = <0x02184400 0x200>; 833 reg = <0x02184400 0x200>;
676 interrupts = <0 42 0x04>; 834 interrupts = <0 40 0x04>;
677 clocks = <&clks IMX6SL_CLK_USBOH3>; 835 clocks = <&clks IMX6SL_CLK_USBOH3>;
678 fsl,usbmisc = <&usbmisc 2>; 836 fsl,usbmisc = <&usbmisc 2>;
679 status = "disabled"; 837 status = "disabled";
diff --git a/arch/arm/boot/dts/integrator.dtsi b/arch/arm/boot/dts/integrator.dtsi
index 813b91d7bea2..0f06f8687b0b 100644
--- a/arch/arm/boot/dts/integrator.dtsi
+++ b/arch/arm/boot/dts/integrator.dtsi
@@ -5,6 +5,11 @@
5/include/ "skeleton.dtsi" 5/include/ "skeleton.dtsi"
6 6
7/ { 7/ {
8 core-module@10000000 {
9 compatible = "arm,core-module-integrator";
10 reg = <0x10000000 0x200>;
11 };
12
8 timer@13000000 { 13 timer@13000000 {
9 reg = <0x13000000 0x100>; 14 reg = <0x13000000 0x100>;
10 interrupt-parent = <&pic>; 15 interrupt-parent = <&pic>;
diff --git a/arch/arm/boot/dts/integratorap.dts b/arch/arm/boot/dts/integratorap.dts
index b6b82eca8d1e..e6be9315ff0a 100644
--- a/arch/arm/boot/dts/integratorap.dts
+++ b/arch/arm/boot/dts/integratorap.dts
@@ -19,8 +19,11 @@
19 }; 19 };
20 20
21 syscon { 21 syscon {
22 /* AP system controller registers */ 22 compatible = "arm,integrator-ap-syscon";
23 reg = <0x11000000 0x100>; 23 reg = <0x11000000 0x100>;
24 interrupt-parent = <&pic>;
25 /* These are the logical module IRQs */
26 interrupts = <9>, <10>, <11>, <12>;
24 }; 27 };
25 28
26 timer0: timer@13000000 { 29 timer0: timer@13000000 {
diff --git a/arch/arm/boot/dts/integratorcp.dts b/arch/arm/boot/dts/integratorcp.dts
index ff1aea0ee043..7deb3a3182b4 100644
--- a/arch/arm/boot/dts/integratorcp.dts
+++ b/arch/arm/boot/dts/integratorcp.dts
@@ -9,29 +9,28 @@
9 model = "ARM Integrator/CP"; 9 model = "ARM Integrator/CP";
10 compatible = "arm,integrator-cp"; 10 compatible = "arm,integrator-cp";
11 11
12 aliases {
13 arm,timer-primary = &timer2;
14 arm,timer-secondary = &timer1;
15 };
16
17 chosen { 12 chosen {
18 bootargs = "root=/dev/ram0 console=ttyAMA0,38400n8 earlyprintk"; 13 bootargs = "root=/dev/ram0 console=ttyAMA0,38400n8 earlyprintk";
19 }; 14 };
20 15
21 cpcon { 16 syscon {
22 /* CP controller registers */ 17 compatible = "arm,integrator-cp-syscon";
23 reg = <0xcb000000 0x100>; 18 reg = <0xcb000000 0x100>;
24 }; 19 };
25 20
26 timer0: timer@13000000 { 21 timer0: timer@13000000 {
22 /* TIMER0 runs @ 25MHz */
27 compatible = "arm,integrator-cp-timer"; 23 compatible = "arm,integrator-cp-timer";
24 status = "disabled";
28 }; 25 };
29 26
30 timer1: timer@13000100 { 27 timer1: timer@13000100 {
28 /* TIMER1 runs @ 1MHz */
31 compatible = "arm,integrator-cp-timer"; 29 compatible = "arm,integrator-cp-timer";
32 }; 30 };
33 31
34 timer2: timer@13000200 { 32 timer2: timer@13000200 {
33 /* TIMER2 runs @ 1MHz */
35 compatible = "arm,integrator-cp-timer"; 34 compatible = "arm,integrator-cp-timer";
36 }; 35 };
37 36
diff --git a/arch/arm/boot/dts/keystone-clocks.dtsi b/arch/arm/boot/dts/keystone-clocks.dtsi
new file mode 100644
index 000000000000..d6713b113258
--- /dev/null
+++ b/arch/arm/boot/dts/keystone-clocks.dtsi
@@ -0,0 +1,821 @@
1/*
2 * Device Tree Source for Keystone 2 clock tree
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11clocks {
12 #address-cells = <1>;
13 #size-cells = <1>;
14 ranges;
15
16 refclkmain: refclkmain {
17 #clock-cells = <0>;
18 compatible = "fixed-clock";
19 clock-frequency = <122880000>;
20 clock-output-names = "refclk-main";
21 };
22
23 mainpllclk: mainpllclk@2310110 {
24 #clock-cells = <0>;
25 compatible = "ti,keystone,main-pll-clock";
26 clocks = <&refclkmain>;
27 reg = <0x02620350 4>, <0x02310110 4>;
28 reg-names = "control", "multiplier";
29 fixed-postdiv = <2>;
30 };
31
32 papllclk: papllclk@2620358 {
33 #clock-cells = <0>;
34 compatible = "ti,keystone,pll-clock";
35 clocks = <&refclkmain>;
36 clock-output-names = "pa-pll-clk";
37 reg = <0x02620358 4>;
38 reg-names = "control";
39 fixed-postdiv = <6>;
40 };
41
42 ddr3allclk: ddr3apllclk@2620360 {
43 #clock-cells = <0>;
44 compatible = "ti,keystone,pll-clock";
45 clocks = <&refclkmain>;
46 clock-output-names = "ddr-3a-pll-clk";
47 reg = <0x02620360 4>;
48 reg-names = "control";
49 fixed-postdiv = <6>;
50 };
51
52 ddr3bllclk: ddr3bpllclk@2620368 {
53 #clock-cells = <0>;
54 compatible = "ti,keystone,pll-clock";
55 clocks = <&refclkmain>;
56 clock-output-names = "ddr-3b-pll-clk";
57 reg = <0x02620368 4>;
58 reg-names = "control";
59 fixed-postdiv = <6>;
60 };
61
62 armpllclk: armpllclk@2620370 {
63 #clock-cells = <0>;
64 compatible = "ti,keystone,pll-clock";
65 clocks = <&refclkmain>;
66 clock-output-names = "arm-pll-clk";
67 reg = <0x02620370 4>;
68 reg-names = "control";
69 fixed-postdiv = <6>;
70 };
71
72 mainmuxclk: mainmuxclk@2310108 {
73 #clock-cells = <0>;
74 compatible = "ti,keystone,pll-mux-clock";
75 clocks = <&mainpllclk>, <&refclkmain>;
76 reg = <0x02310108 4>;
77 bit-shift = <23>;
78 bit-mask = <1>;
79 clock-output-names = "mainmuxclk";
80 };
81
82 chipclk1: chipclk1 {
83 #clock-cells = <0>;
84 compatible = "fixed-factor-clock";
85 clocks = <&mainmuxclk>;
86 clock-div = <1>;
87 clock-mult = <1>;
88 clock-output-names = "chipclk1";
89 };
90
91 chipclk1rstiso: chipclk1rstiso {
92 #clock-cells = <0>;
93 compatible = "fixed-factor-clock";
94 clocks = <&mainmuxclk>;
95 clock-div = <1>;
96 clock-mult = <1>;
97 clock-output-names = "chipclk1rstiso";
98 };
99
100 gemtraceclk: gemtraceclk@2310120 {
101 #clock-cells = <0>;
102 compatible = "ti,keystone,pll-divider-clock";
103 clocks = <&mainmuxclk>;
104 reg = <0x02310120 4>;
105 bit-shift = <0>;
106 bit-mask = <8>;
107 clock-output-names = "gemtraceclk";
108 };
109
110 chipstmxptclk: chipstmxptclk {
111 #clock-cells = <0>;
112 compatible = "ti,keystone,pll-divider-clock";
113 clocks = <&mainmuxclk>;
114 reg = <0x02310164 4>;
115 bit-shift = <0>;
116 bit-mask = <8>;
117 clock-output-names = "chipstmxptclk";
118 };
119
120 chipclk12: chipclk12 {
121 #clock-cells = <0>;
122 compatible = "fixed-factor-clock";
123 clocks = <&chipclk1>;
124 clock-div = <2>;
125 clock-mult = <1>;
126 clock-output-names = "chipclk12";
127 };
128
129 chipclk13: chipclk13 {
130 #clock-cells = <0>;
131 compatible = "fixed-factor-clock";
132 clocks = <&chipclk1>;
133 clock-div = <3>;
134 clock-mult = <1>;
135 clock-output-names = "chipclk13";
136 };
137
138 chipclk14: chipclk14 {
139 #clock-cells = <0>;
140 compatible = "fixed-factor-clock";
141 clocks = <&chipclk1>;
142 clock-div = <4>;
143 clock-mult = <1>;
144 clock-output-names = "chipclk14";
145 };
146
147 chipclk16: chipclk16 {
148 #clock-cells = <0>;
149 compatible = "fixed-factor-clock";
150 clocks = <&chipclk1>;
151 clock-div = <6>;
152 clock-mult = <1>;
153 clock-output-names = "chipclk16";
154 };
155
156 chipclk112: chipclk112 {
157 #clock-cells = <0>;
158 compatible = "fixed-factor-clock";
159 clocks = <&chipclk1>;
160 clock-div = <12>;
161 clock-mult = <1>;
162 clock-output-names = "chipclk112";
163 };
164
165 chipclk124: chipclk124 {
166 #clock-cells = <0>;
167 compatible = "fixed-factor-clock";
168 clocks = <&chipclk1>;
169 clock-div = <24>;
170 clock-mult = <1>;
171 clock-output-names = "chipclk114";
172 };
173
174 chipclk1rstiso13: chipclk1rstiso13 {
175 #clock-cells = <0>;
176 compatible = "fixed-factor-clock";
177 clocks = <&chipclk1rstiso>;
178 clock-div = <3>;
179 clock-mult = <1>;
180 clock-output-names = "chipclk1rstiso13";
181 };
182
183 chipclk1rstiso14: chipclk1rstiso14 {
184 #clock-cells = <0>;
185 compatible = "fixed-factor-clock";
186 clocks = <&chipclk1rstiso>;
187 clock-div = <4>;
188 clock-mult = <1>;
189 clock-output-names = "chipclk1rstiso14";
190 };
191
192 chipclk1rstiso16: chipclk1rstiso16 {
193 #clock-cells = <0>;
194 compatible = "fixed-factor-clock";
195 clocks = <&chipclk1rstiso>;
196 clock-div = <6>;
197 clock-mult = <1>;
198 clock-output-names = "chipclk1rstiso16";
199 };
200
201 chipclk1rstiso112: chipclk1rstiso112 {
202 #clock-cells = <0>;
203 compatible = "fixed-factor-clock";
204 clocks = <&chipclk1rstiso>;
205 clock-div = <12>;
206 clock-mult = <1>;
207 clock-output-names = "chipclk1rstiso112";
208 };
209
210 clkmodrst0: clkmodrst0 {
211 #clock-cells = <0>;
212 compatible = "ti,keystone,psc-clock";
213 clocks = <&chipclk16>;
214 clock-output-names = "modrst0";
215 reg = <0x02350000 0xb00>, <0x02350000 0x400>;
216 reg-names = "control", "domain";
217 domain-id = <0>;
218 };
219
220
221 clkusb: clkusb {
222 #clock-cells = <0>;
223 compatible = "ti,keystone,psc-clock";
224 clocks = <&chipclk16>;
225 clock-output-names = "usb";
226 reg = <0x02350008 0xb00>, <0x02350000 0x400>;
227 reg-names = "control", "domain";
228 domain-id = <0>;
229 };
230
231 clkaemifspi: clkaemifspi {
232 #clock-cells = <0>;
233 compatible = "ti,keystone,psc-clock";
234 clocks = <&chipclk16>;
235 clock-output-names = "aemif-spi";
236 reg = <0x0235000c 0xb00>, <0x02350000 0x400>;
237 reg-names = "control", "domain";
238 domain-id = <0>;
239 };
240
241
242 clkdebugsstrc: clkdebugsstrc {
243 #clock-cells = <0>;
244 compatible = "ti,keystone,psc-clock";
245 clocks = <&chipclk13>;
246 clock-output-names = "debugss-trc";
247 reg = <0x02350014 0xb00>, <0x02350000 0x400>;
248 reg-names = "control", "domain";
249 domain-id = <0>;
250 };
251
252 clktetbtrc: clktetbtrc {
253 #clock-cells = <0>;
254 compatible = "ti,keystone,psc-clock";
255 clocks = <&chipclk13>;
256 clock-output-names = "tetb-trc";
257 reg = <0x02350018 0xb00>, <0x02350004 0x400>;
258 reg-names = "control", "domain";
259 domain-id = <1>;
260 };
261
262 clkpa: clkpa {
263 #clock-cells = <0>;
264 compatible = "ti,keystone,psc-clock";
265 clocks = <&chipclk16>;
266 clock-output-names = "pa";
267 reg = <0x0235001c 0xb00>, <0x02350008 0x400>;
268 reg-names = "control", "domain";
269 domain-id = <2>;
270 };
271
272 clkcpgmac: clkcpgmac {
273 #clock-cells = <0>;
274 compatible = "ti,keystone,psc-clock";
275 clocks = <&clkpa>;
276 clock-output-names = "cpgmac";
277 reg = <0x02350020 0xb00>, <0x02350008 0x400>;
278 reg-names = "control", "domain";
279 domain-id = <2>;
280 };
281
282 clksa: clksa {
283 #clock-cells = <0>;
284 compatible = "ti,keystone,psc-clock";
285 clocks = <&clkpa>;
286 clock-output-names = "sa";
287 reg = <0x02350024 0xb00>, <0x02350008 0x400>;
288 reg-names = "control", "domain";
289 domain-id = <2>;
290 };
291
292 clkpcie: clkpcie {
293 #clock-cells = <0>;
294 compatible = "ti,keystone,psc-clock";
295 clocks = <&chipclk12>;
296 clock-output-names = "pcie";
297 reg = <0x02350028 0xb00>, <0x0235000c 0x400>;
298 reg-names = "control", "domain";
299 domain-id = <3>;
300 };
301
302 clksrio: clksrio {
303 #clock-cells = <0>;
304 compatible = "ti,keystone,psc-clock";
305 clocks = <&chipclk1rstiso13>;
306 clock-output-names = "srio";
307 reg = <0x0235002c 0xb00>, <0x02350010 0x400>;
308 reg-names = "control", "domain";
309 domain-id = <4>;
310 };
311
312 clkhyperlink0: clkhyperlink0 {
313 #clock-cells = <0>;
314 compatible = "ti,keystone,psc-clock";
315 clocks = <&chipclk12>;
316 clock-output-names = "hyperlink-0";
317 reg = <0x02350030 0xb00>, <0x02350014 0x400>;
318 reg-names = "control", "domain";
319 domain-id = <5>;
320 };
321
322 clksr: clksr {
323 #clock-cells = <0>;
324 compatible = "ti,keystone,psc-clock";
325 clocks = <&chipclk1rstiso112>;
326 clock-output-names = "sr";
327 reg = <0x02350034 0xb00>, <0x02350018 0x400>;
328 reg-names = "control", "domain";
329 domain-id = <6>;
330 };
331
332 clkmsmcsram: clkmsmcsram {
333 #clock-cells = <0>;
334 compatible = "ti,keystone,psc-clock";
335 clocks = <&chipclk1>;
336 clock-output-names = "msmcsram";
337 reg = <0x02350038 0xb00>, <0x0235001c 0x400>;
338 reg-names = "control", "domain";
339 domain-id = <7>;
340 };
341
342 clkgem0: clkgem0 {
343 #clock-cells = <0>;
344 compatible = "ti,keystone,psc-clock";
345 clocks = <&chipclk1>;
346 clock-output-names = "gem0";
347 reg = <0x0235003c 0xb00>, <0x02350020 0x400>;
348 reg-names = "control", "domain";
349 domain-id = <8>;
350 };
351
352 clkgem1: clkgem1 {
353 #clock-cells = <0>;
354 compatible = "ti,keystone,psc-clock";
355 clocks = <&chipclk1>;
356 clock-output-names = "gem1";
357 reg = <0x02350040 0xb00>, <0x02350024 0x400>;
358 reg-names = "control", "domain";
359 domain-id = <9>;
360 };
361
362 clkgem2: clkgem2 {
363 #clock-cells = <0>;
364 compatible = "ti,keystone,psc-clock";
365 clocks = <&chipclk1>;
366 clock-output-names = "gem2";
367 reg = <0x02350044 0xb00>, <0x02350028 0x400>;
368 reg-names = "control", "domain";
369 domain-id = <10>;
370 };
371
372 clkgem3: clkgem3 {
373 #clock-cells = <0>;
374 compatible = "ti,keystone,psc-clock";
375 clocks = <&chipclk1>;
376 clock-output-names = "gem3";
377 reg = <0x02350048 0xb00>, <0x0235002c 0x400>;
378 reg-names = "control", "domain";
379 domain-id = <11>;
380 };
381
382 clkgem4: clkgem4 {
383 #clock-cells = <0>;
384 compatible = "ti,keystone,psc-clock";
385 clocks = <&chipclk1>;
386 clock-output-names = "gem4";
387 reg = <0x0235004c 0xb00>, <0x02350030 0x400>;
388 reg-names = "control", "domain";
389 domain-id = <12>;
390 };
391
392 clkgem5: clkgem5 {
393 #clock-cells = <0>;
394 compatible = "ti,keystone,psc-clock";
395 clocks = <&chipclk1>;
396 clock-output-names = "gem5";
397 reg = <0x02350050 0xb00>, <0x02350034 0x400>;
398 reg-names = "control", "domain";
399 domain-id = <13>;
400 };
401
402 clkgem6: clkgem6 {
403 #clock-cells = <0>;
404 compatible = "ti,keystone,psc-clock";
405 clocks = <&chipclk1>;
406 clock-output-names = "gem6";
407 reg = <0x02350054 0xb00>, <0x02350038 0x400>;
408 reg-names = "control", "domain";
409 domain-id = <14>;
410 };
411
412 clkgem7: clkgem7 {
413 #clock-cells = <0>;
414 compatible = "ti,keystone,psc-clock";
415 clocks = <&chipclk1>;
416 clock-output-names = "gem7";
417 reg = <0x02350058 0xb00>, <0x0235003c 0x400>;
418 reg-names = "control", "domain";
419 domain-id = <15>;
420 };
421
422 clkddr30: clkddr30 {
423 #clock-cells = <0>;
424 compatible = "ti,keystone,psc-clock";
425 clocks = <&chipclk12>;
426 clock-output-names = "ddr3-0";
427 reg = <0x0235005c 0xb00>, <0x02350040 0x400>;
428 reg-names = "control", "domain";
429 domain-id = <16>;
430 };
431
432 clkddr31: clkddr31 {
433 #clock-cells = <0>;
434 compatible = "ti,keystone,psc-clock";
435 clocks = <&chipclk13>;
436 clock-output-names = "ddr3-1";
437 reg = <0x02350060 0xb00>, <0x02350040 0x400>;
438 reg-names = "control", "domain";
439 domain-id = <16>;
440 };
441
442 clktac: clktac {
443 #clock-cells = <0>;
444 compatible = "ti,keystone,psc-clock";
445 clocks = <&chipclk13>;
446 clock-output-names = "tac";
447 reg = <0x02350064 0xb00>, <0x02350044 0x400>;
448 reg-names = "control", "domain";
449 domain-id = <17>;
450 };
451
452 clkrac01: clktac01 {
453 #clock-cells = <0>;
454 compatible = "ti,keystone,psc-clock";
455 clocks = <&chipclk13>;
456 clock-output-names = "rac-01";
457 reg = <0x02350068 0xb00>, <0x02350044 0x400>;
458 reg-names = "control", "domain";
459 domain-id = <17>;
460 };
461
462 clkrac23: clktac23 {
463 #clock-cells = <0>;
464 compatible = "ti,keystone,psc-clock";
465 clocks = <&chipclk13>;
466 clock-output-names = "rac-23";
467 reg = <0x0235006c 0xb00>, <0x02350048 0x400>;
468 reg-names = "control", "domain";
469 domain-id = <18>;
470 };
471
472 clkfftc0: clkfftc0 {
473 #clock-cells = <0>;
474 compatible = "ti,keystone,psc-clock";
475 clocks = <&chipclk13>;
476 clock-output-names = "fftc-0";
477 reg = <0x02350070 0xb00>, <0x0235004c 0x400>;
478 reg-names = "control", "domain";
479 domain-id = <19>;
480 };
481
482 clkfftc1: clkfftc1 {
483 #clock-cells = <0>;
484 compatible = "ti,keystone,psc-clock";
485 clocks = <&chipclk13>;
486 clock-output-names = "fftc-1";
487 reg = <0x02350074 0xb00>, <0x023504c0 0x400>;
488 reg-names = "control", "domain";
489 domain-id = <19>;
490 };
491
492 clkfftc2: clkfftc2 {
493 #clock-cells = <0>;
494 compatible = "ti,keystone,psc-clock";
495 clocks = <&chipclk13>;
496 clock-output-names = "fftc-2";
497 reg = <0x02350078 0xb00>, <0x02350050 0x400>;
498 reg-names = "control", "domain";
499 domain-id = <20>;
500 };
501
502 clkfftc3: clkfftc3 {
503 #clock-cells = <0>;
504 compatible = "ti,keystone,psc-clock";
505 clocks = <&chipclk13>;
506 clock-output-names = "fftc-3";
507 reg = <0x0235007c 0xb00>, <0x02350050 0x400>;
508 reg-names = "control", "domain";
509 domain-id = <20>;
510 };
511
512 clkfftc4: clkfftc4 {
513 #clock-cells = <0>;
514 compatible = "ti,keystone,psc-clock";
515 clocks = <&chipclk13>;
516 clock-output-names = "fftc-4";
517 reg = <0x02350080 0xb00>, <0x02350050 0x400>;
518 reg-names = "control", "domain";
519 domain-id = <20>;
520 };
521
522 clkfftc5: clkfftc5 {
523 #clock-cells = <0>;
524 compatible = "ti,keystone,psc-clock";
525 clocks = <&chipclk13>;
526 clock-output-names = "fftc-5";
527 reg = <0x02350084 0xb00>, <0x02350050 0x400>;
528 reg-names = "control", "domain";
529 domain-id = <20>;
530 };
531
532 clkaif: clkaif {
533 #clock-cells = <0>;
534 compatible = "ti,keystone,psc-clock";
535 clocks = <&chipclk13>;
536 clock-output-names = "aif";
537 reg = <0x02350088 0xb00>, <0x02350054 0x400>;
538 reg-names = "control", "domain";
539 domain-id = <21>;
540 };
541
542 clktcp3d0: clktcp3d0 {
543 #clock-cells = <0>;
544 compatible = "ti,keystone,psc-clock";
545 clocks = <&chipclk13>;
546 clock-output-names = "tcp3d-0";
547 reg = <0x0235008c 0xb00>, <0x02350058 0x400>;
548 reg-names = "control", "domain";
549 domain-id = <22>;
550 };
551
552 clktcp3d1: clktcp3d1 {
553 #clock-cells = <0>;
554 compatible = "ti,keystone,psc-clock";
555 clocks = <&chipclk13>;
556 clock-output-names = "tcp3d-1";
557 reg = <0x02350090 0xb00>, <0x02350058 0x400>;
558 reg-names = "control", "domain";
559 domain-id = <22>;
560 };
561
562 clktcp3d2: clktcp3d2 {
563 #clock-cells = <0>;
564 compatible = "ti,keystone,psc-clock";
565 clocks = <&chipclk13>;
566 clock-output-names = "tcp3d-2";
567 reg = <0x02350094 0xb00>, <0x0235005c 0x400>;
568 reg-names = "control", "domain";
569 domain-id = <23>;
570 };
571
572 clktcp3d3: clktcp3d3 {
573 #clock-cells = <0>;
574 compatible = "ti,keystone,psc-clock";
575 clocks = <&chipclk13>;
576 clock-output-names = "tcp3d-3";
577 reg = <0x02350098 0xb00>, <0x0235005c 0x400>;
578 reg-names = "control", "domain";
579 domain-id = <23>;
580 };
581
582 clkvcp0: clkvcp0 {
583 #clock-cells = <0>;
584 compatible = "ti,keystone,psc-clock";
585 clocks = <&chipclk13>;
586 clock-output-names = "vcp-0";
587 reg = <0x0235009c 0xb00>, <0x02350060 0x400>;
588 reg-names = "control", "domain";
589 domain-id = <24>;
590 };
591
592 clkvcp1: clkvcp1 {
593 #clock-cells = <0>;
594 compatible = "ti,keystone,psc-clock";
595 clocks = <&chipclk13>;
596 clock-output-names = "vcp-1";
597 reg = <0x023500a0 0xb00>, <0x02350060 0x400>;
598 reg-names = "control", "domain";
599 domain-id = <24>;
600 };
601
602 clkvcp2: clkvcp2 {
603 #clock-cells = <0>;
604 compatible = "ti,keystone,psc-clock";
605 clocks = <&chipclk13>;
606 clock-output-names = "vcp-2";
607 reg = <0x023500a4 0xb00>, <0x02350060 0x400>;
608 reg-names = "control", "domain";
609 domain-id = <24>;
610 };
611
612 clkvcp3: clkvcp3 {
613 #clock-cells = <0>;
614 compatible = "ti,keystone,psc-clock";
615 clocks = <&chipclk13>;
616 clock-output-names = "vcp-3";
617 reg = <0x0235000a8 0xb00>, <0x02350060 0x400>;
618 reg-names = "control", "domain";
619 domain-id = <24>;
620 };
621
622 clkvcp4: clkvcp4 {
623 #clock-cells = <0>;
624 compatible = "ti,keystone,psc-clock";
625 clocks = <&chipclk13>;
626 clock-output-names = "vcp-4";
627 reg = <0x023500ac 0xb00>, <0x02350064 0x400>;
628 reg-names = "control", "domain";
629 domain-id = <25>;
630 };
631
632 clkvcp5: clkvcp5 {
633 #clock-cells = <0>;
634 compatible = "ti,keystone,psc-clock";
635 clocks = <&chipclk13>;
636 clock-output-names = "vcp-5";
637 reg = <0x023500b0 0xb00>, <0x02350064 0x400>;
638 reg-names = "control", "domain";
639 domain-id = <25>;
640 };
641
642 clkvcp6: clkvcp6 {
643 #clock-cells = <0>;
644 compatible = "ti,keystone,psc-clock";
645 clocks = <&chipclk13>;
646 clock-output-names = "vcp-6";
647 reg = <0x023500b4 0xb00>, <0x02350064 0x400>;
648 reg-names = "control", "domain";
649 domain-id = <25>;
650 };
651
652 clkvcp7: clkvcp7 {
653 #clock-cells = <0>;
654 compatible = "ti,keystone,psc-clock";
655 clocks = <&chipclk13>;
656 clock-output-names = "vcp-7";
657 reg = <0x023500b8 0xb00>, <0x02350064 0x400>;
658 reg-names = "control", "domain";
659 domain-id = <25>;
660 };
661
662 clkbcp: clkbcp {
663 #clock-cells = <0>;
664 compatible = "ti,keystone,psc-clock";
665 clocks = <&chipclk13>;
666 clock-output-names = "bcp";
667 reg = <0x023500bc 0xb00>, <0x02350068 0x400>;
668 reg-names = "control", "domain";
669 domain-id = <26>;
670 };
671
672 clkdxb: clkdxb {
673 #clock-cells = <0>;
674 compatible = "ti,keystone,psc-clock";
675 clocks = <&chipclk13>;
676 clock-output-names = "dxb";
677 reg = <0x023500c0 0xb00>, <0x0235006c 0x400>;
678 reg-names = "control", "domain";
679 domain-id = <27>;
680 };
681
682 clkhyperlink1: clkhyperlink1 {
683 #clock-cells = <0>;
684 compatible = "ti,keystone,psc-clock";
685 clocks = <&chipclk12>;
686 clock-output-names = "hyperlink-1";
687 reg = <0x023500c4 0xb00>, <0x02350070 0x400>;
688 reg-names = "control", "domain";
689 domain-id = <28>;
690 };
691
692 clkxge: clkxge {
693 #clock-cells = <0>;
694 compatible = "ti,keystone,psc-clock";
695 clocks = <&chipclk13>;
696 clock-output-names = "xge";
697 reg = <0x023500c8 0xb00>, <0x02350074 0x400>;
698 reg-names = "control", "domain";
699 domain-id = <29>;
700 };
701
702 clkwdtimer0: clkwdtimer0 {
703 #clock-cells = <0>;
704 compatible = "ti,keystone,psc-clock";
705 clocks = <&clkmodrst0>;
706 clock-output-names = "timer0";
707 reg = <0x02350000 0xb00>, <0x02350000 0x400>;
708 reg-names = "control", "domain";
709 domain-id = <0>;
710 };
711
712 clkwdtimer1: clkwdtimer1 {
713 #clock-cells = <0>;
714 compatible = "ti,keystone,psc-clock";
715 clocks = <&clkmodrst0>;
716 clock-output-names = "timer1";
717 reg = <0x02350000 0xb00>, <0x02350000 0x400>;
718 reg-names = "control", "domain";
719 domain-id = <0>;
720 };
721
722 clkwdtimer2: clkwdtimer2 {
723 #clock-cells = <0>;
724 compatible = "ti,keystone,psc-clock";
725 clocks = <&clkmodrst0>;
726 clock-output-names = "timer2";
727 reg = <0x02350000 0xb00>, <0x02350000 0x400>;
728 reg-names = "control", "domain";
729 domain-id = <0>;
730 };
731
732 clkwdtimer3: clkwdtimer3 {
733 #clock-cells = <0>;
734 compatible = "ti,keystone,psc-clock";
735 clocks = <&clkmodrst0>;
736 clock-output-names = "timer3";
737 reg = <0x02350000 0xb00>, <0x02350000 0x400>;
738 reg-names = "control", "domain";
739 domain-id = <0>;
740 };
741
742 clkuart0: clkuart0 {
743 #clock-cells = <0>;
744 compatible = "ti,keystone,psc-clock";
745 clocks = <&clkmodrst0>;
746 clock-output-names = "uart0";
747 reg = <0x02350000 0xb00>, <0x02350000 0x400>;
748 reg-names = "control", "domain";
749 domain-id = <0>;
750 };
751
752 clkuart1: clkuart1 {
753 #clock-cells = <0>;
754 compatible = "ti,keystone,psc-clock";
755 clocks = <&clkmodrst0>;
756 clock-output-names = "uart1";
757 reg = <0x02350000 0xb00>, <0x02350000 0x400>;
758 reg-names = "control", "domain";
759 domain-id = <0>;
760 };
761
762 clkaemif: clkaemif {
763 #clock-cells = <0>;
764 compatible = "ti,keystone,psc-clock";
765 clocks = <&clkaemifspi>;
766 clock-output-names = "aemif";
767 reg = <0x02350000 0xb00>, <0x02350000 0x400>;
768 reg-names = "control", "domain";
769 domain-id = <0>;
770 };
771
772 clkusim: clkusim {
773 #clock-cells = <0>;
774 compatible = "ti,keystone,psc-clock";
775 clocks = <&clkmodrst0>;
776 clock-output-names = "usim";
777 reg = <0x02350000 0xb00>, <0x02350000 0x400>;
778 reg-names = "control", "domain";
779 domain-id = <0>;
780 };
781
782 clki2c: clki2c {
783 #clock-cells = <0>;
784 compatible = "ti,keystone,psc-clock";
785 clocks = <&clkmodrst0>;
786 clock-output-names = "i2c";
787 reg = <0x02350000 0xb00>, <0x02350000 0x400>;
788 reg-names = "control", "domain";
789 domain-id = <0>;
790 };
791
792 clkspi: clkspi {
793 #clock-cells = <0>;
794 compatible = "ti,keystone,psc-clock";
795 clocks = <&clkaemifspi>;
796 clock-output-names = "spi";
797 reg = <0x02350000 0xb00>, <0x02350000 0x400>;
798 reg-names = "control", "domain";
799 domain-id = <0>;
800 };
801
802 clkgpio: clkgpio {
803 #clock-cells = <0>;
804 compatible = "ti,keystone,psc-clock";
805 clocks = <&clkmodrst0>;
806 clock-output-names = "gpio";
807 reg = <0x02350000 0xb00>, <0x02350000 0x400>;
808 reg-names = "control", "domain";
809 domain-id = <0>;
810 };
811
812 clkkeymgr: clkkeymgr {
813 #clock-cells = <0>;
814 compatible = "ti,keystone,psc-clock";
815 clocks = <&clkmodrst0>;
816 clock-output-names = "keymgr";
817 reg = <0x02350000 0xb00>, <0x02350000 0x400>;
818 reg-names = "control", "domain";
819 domain-id = <0>;
820 };
821};
diff --git a/arch/arm/boot/dts/keystone.dts b/arch/arm/boot/dts/keystone.dts
index a68e34bbecb2..100bdf52b847 100644
--- a/arch/arm/boot/dts/keystone.dts
+++ b/arch/arm/boot/dts/keystone.dts
@@ -100,13 +100,15 @@
100 reg = <0x023100e8 4>; /* pll reset control reg */ 100 reg = <0x023100e8 4>; /* pll reset control reg */
101 }; 101 };
102 102
103 /include/ "keystone-clocks.dtsi"
104
103 uart0: serial@02530c00 { 105 uart0: serial@02530c00 {
104 compatible = "ns16550a"; 106 compatible = "ns16550a";
105 current-speed = <115200>; 107 current-speed = <115200>;
106 reg-shift = <2>; 108 reg-shift = <2>;
107 reg-io-width = <4>; 109 reg-io-width = <4>;
108 reg = <0x02530c00 0x100>; 110 reg = <0x02530c00 0x100>;
109 clock-frequency = <133120000>; 111 clocks = <&clkuart0>;
110 interrupts = <GIC_SPI 277 IRQ_TYPE_EDGE_RISING>; 112 interrupts = <GIC_SPI 277 IRQ_TYPE_EDGE_RISING>;
111 }; 113 };
112 114
@@ -116,9 +118,66 @@
116 reg-shift = <2>; 118 reg-shift = <2>;
117 reg-io-width = <4>; 119 reg-io-width = <4>;
118 reg = <0x02531000 0x100>; 120 reg = <0x02531000 0x100>;
119 clock-frequency = <133120000>; 121 clocks = <&clkuart1>;
120 interrupts = <GIC_SPI 280 IRQ_TYPE_EDGE_RISING>; 122 interrupts = <GIC_SPI 280 IRQ_TYPE_EDGE_RISING>;
121 }; 123 };
122 124
125 i2c0: i2c@2530000 {
126 compatible = "ti,davinci-i2c";
127 reg = <0x02530000 0x400>;
128 clock-frequency = <100000>;
129 clocks = <&clki2c>;
130 interrupts = <GIC_SPI 283 IRQ_TYPE_EDGE_RISING>;
131 #address-cells = <1>;
132 #size-cells = <0>;
133
134 dtt@50 {
135 compatible = "at,24c1024";
136 reg = <0x50>;
137 };
138 };
139
140 i2c1: i2c@2530400 {
141 compatible = "ti,davinci-i2c";
142 reg = <0x02530400 0x400>;
143 clock-frequency = <100000>;
144 clocks = <&clki2c>;
145 interrupts = <GIC_SPI 286 IRQ_TYPE_EDGE_RISING>;
146 };
147
148 i2c2: i2c@2530800 {
149 compatible = "ti,davinci-i2c";
150 reg = <0x02530800 0x400>;
151 clock-frequency = <100000>;
152 clocks = <&clki2c>;
153 interrupts = <GIC_SPI 289 IRQ_TYPE_EDGE_RISING>;
154 };
155
156 spi0: spi@21000400 {
157 compatible = "ti,dm6441-spi";
158 reg = <0x21000400 0x200>;
159 num-cs = <4>;
160 ti,davinci-spi-intr-line = <0>;
161 interrupts = <GIC_SPI 292 IRQ_TYPE_EDGE_RISING>;
162 clocks = <&clkspi>;
163 };
164
165 spi1: spi@21000600 {
166 compatible = "ti,dm6441-spi";
167 reg = <0x21000600 0x200>;
168 num-cs = <4>;
169 ti,davinci-spi-intr-line = <0>;
170 interrupts = <GIC_SPI 296 IRQ_TYPE_EDGE_RISING>;
171 clocks = <&clkspi>;
172 };
173
174 spi2: spi@21000800 {
175 compatible = "ti,dm6441-spi";
176 reg = <0x21000800 0x200>;
177 num-cs = <4>;
178 ti,davinci-spi-intr-line = <0>;
179 interrupts = <GIC_SPI 300 IRQ_TYPE_EDGE_RISING>;
180 clocks = <&clkspi>;
181 };
123 }; 182 };
124}; 183};
diff --git a/arch/arm/boot/dts/kirkwood-db-88f6281.dts b/arch/arm/boot/dts/kirkwood-db-88f6281.dts
index 72c4b0a0366f..c39dd766c75a 100644
--- a/arch/arm/boot/dts/kirkwood-db-88f6281.dts
+++ b/arch/arm/boot/dts/kirkwood-db-88f6281.dts
@@ -19,7 +19,6 @@
19 compatible = "marvell,db-88f6281-bp", "marvell,kirkwood-88f6281", "marvell,kirkwood"; 19 compatible = "marvell,db-88f6281-bp", "marvell,kirkwood-88f6281", "marvell,kirkwood";
20 20
21 mbus { 21 mbus {
22 ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>;
23 pcie-controller { 22 pcie-controller {
24 status = "okay"; 23 status = "okay";
25 24
diff --git a/arch/arm/boot/dts/kirkwood-db-88f6282.dts b/arch/arm/boot/dts/kirkwood-db-88f6282.dts
index 36c411d34926..701c6b6cdaa2 100644
--- a/arch/arm/boot/dts/kirkwood-db-88f6282.dts
+++ b/arch/arm/boot/dts/kirkwood-db-88f6282.dts
@@ -19,7 +19,6 @@
19 compatible = "marvell,db-88f6282-bp", "marvell,kirkwood-88f6282", "marvell,kirkwood"; 19 compatible = "marvell,db-88f6282-bp", "marvell,kirkwood-88f6282", "marvell,kirkwood";
20 20
21 mbus { 21 mbus {
22 ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>;
23 pcie-controller { 22 pcie-controller {
24 status = "okay"; 23 status = "okay";
25 24
diff --git a/arch/arm/boot/dts/kirkwood-db.dtsi b/arch/arm/boot/dts/kirkwood-db.dtsi
index c0e2a5879174..053aa20fb30f 100644
--- a/arch/arm/boot/dts/kirkwood-db.dtsi
+++ b/arch/arm/boot/dts/kirkwood-db.dtsi
@@ -39,28 +39,6 @@
39 status = "ok"; 39 status = "ok";
40 }; 40 };
41 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 { 42 sata@80000 {
65 nr-ports = <2>; 43 nr-ports = <2>;
66 status = "okay"; 44 status = "okay";
@@ -80,6 +58,28 @@
80 }; 58 };
81}; 59};
82 60
61&nand {
62 pinctrl-0 = <&pmx_nand>;
63 pinctrl-names = "default";
64 chip-delay = <25>;
65 status = "okay";
66
67 partition@0 {
68 label = "uboot";
69 reg = <0x0 0x100000>;
70 };
71
72 partition@100000 {
73 label = "uImage";
74 reg = <0x100000 0x400000>;
75 };
76
77 partition@500000 {
78 label = "root";
79 reg = <0x500000 0x1fb00000>;
80 };
81};
82
83&mdio { 83&mdio {
84 status = "okay"; 84 status = "okay";
85 85
diff --git a/arch/arm/boot/dts/kirkwood-dnskw.dtsi b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
index d544f77a4ca4..aefa375a550d 100644
--- a/arch/arm/boot/dts/kirkwood-dnskw.dtsi
+++ b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
@@ -148,44 +148,6 @@
148 status = "okay"; 148 status = "okay";
149 nr-ports = <2>; 149 nr-ports = <2>;
150 }; 150 };
151
152 nand@3000000 {
153 pinctrl-0 = <&pmx_nand>;
154 pinctrl-names = "default";
155 status = "okay";
156 chip-delay = <35>;
157
158 partition@0 {
159 label = "u-boot";
160 reg = <0x0000000 0x100000>;
161 read-only;
162 };
163
164 partition@100000 {
165 label = "uImage";
166 reg = <0x0100000 0x500000>;
167 };
168
169 partition@600000 {
170 label = "ramdisk";
171 reg = <0x0600000 0x500000>;
172 };
173
174 partition@b00000 {
175 label = "image";
176 reg = <0x0b00000 0x6600000>;
177 };
178
179 partition@7100000 {
180 label = "mini firmware";
181 reg = <0x7100000 0xa00000>;
182 };
183
184 partition@7b00000 {
185 label = "config";
186 reg = <0x7b00000 0x500000>;
187 };
188 };
189 }; 151 };
190 152
191 regulators { 153 regulators {
@@ -220,6 +182,44 @@
220 }; 182 };
221}; 183};
222 184
185&nand {
186 pinctrl-0 = <&pmx_nand>;
187 pinctrl-names = "default";
188 status = "okay";
189 chip-delay = <35>;
190
191 partition@0 {
192 label = "u-boot";
193 reg = <0x0000000 0x100000>;
194 read-only;
195 };
196
197 partition@100000 {
198 label = "uImage";
199 reg = <0x0100000 0x500000>;
200 };
201
202 partition@600000 {
203 label = "ramdisk";
204 reg = <0x0600000 0x500000>;
205 };
206
207 partition@b00000 {
208 label = "image";
209 reg = <0x0b00000 0x6600000>;
210 };
211
212 partition@7100000 {
213 label = "mini firmware";
214 reg = <0x7100000 0xa00000>;
215 };
216
217 partition@7b00000 {
218 label = "config";
219 reg = <0x7b00000 0x500000>;
220 };
221};
222
223&mdio { 223&mdio {
224 status = "okay"; 224 status = "okay";
225 225
diff --git a/arch/arm/boot/dts/kirkwood-dockstar.dts b/arch/arm/boot/dts/kirkwood-dockstar.dts
index 59a2117c35a7..33ff368fbfa5 100644
--- a/arch/arm/boot/dts/kirkwood-dockstar.dts
+++ b/arch/arm/boot/dts/kirkwood-dockstar.dts
@@ -34,26 +34,6 @@
34 serial@12000 { 34 serial@12000 {
35 status = "ok"; 35 status = "ok";
36 }; 36 };
37
38 nand@3000000 {
39 status = "okay";
40
41 partition@0 {
42 label = "u-boot";
43 reg = <0x0000000 0x100000>;
44 read-only;
45 };
46
47 partition@100000 {
48 label = "uImage";
49 reg = <0x0100000 0x400000>;
50 };
51
52 partition@500000 {
53 label = "data";
54 reg = <0x0500000 0xfb00000>;
55 };
56 };
57 }; 37 };
58 gpio-leds { 38 gpio-leds {
59 compatible = "gpio-leds"; 39 compatible = "gpio-leds";
@@ -91,6 +71,26 @@
91 }; 71 };
92}; 72};
93 73
74&nand {
75 status = "okay";
76
77 partition@0 {
78 label = "u-boot";
79 reg = <0x0000000 0x100000>;
80 read-only;
81 };
82
83 partition@100000 {
84 label = "uImage";
85 reg = <0x0100000 0x400000>;
86 };
87
88 partition@500000 {
89 label = "data";
90 reg = <0x0500000 0xfb00000>;
91 };
92};
93
94&mdio { 94&mdio {
95 status = "okay"; 95 status = "okay";
96 96
diff --git a/arch/arm/boot/dts/kirkwood-goflexnet.dts b/arch/arm/boot/dts/kirkwood-goflexnet.dts
index 6f7c7d7ecf2a..a43bebb25110 100644
--- a/arch/arm/boot/dts/kirkwood-goflexnet.dts
+++ b/arch/arm/boot/dts/kirkwood-goflexnet.dts
@@ -67,31 +67,6 @@
67 status = "ok"; 67 status = "ok";
68 }; 68 };
69 69
70 nand@3000000 {
71 chip-delay = <40>;
72 status = "okay";
73
74 partition@0 {
75 label = "u-boot";
76 reg = <0x0000000 0x100000>;
77 read-only;
78 };
79
80 partition@100000 {
81 label = "uImage";
82 reg = <0x0100000 0x400000>;
83 };
84
85 partition@500000 {
86 label = "pogoplug";
87 reg = <0x0500000 0x2000000>;
88 };
89
90 partition@2500000 {
91 label = "root";
92 reg = <0x02500000 0xd800000>;
93 };
94 };
95 sata@80000 { 70 sata@80000 {
96 status = "okay"; 71 status = "okay";
97 nr-ports = <2>; 72 nr-ports = <2>;
@@ -171,6 +146,32 @@
171 }; 146 };
172}; 147};
173 148
149&nand {
150 chip-delay = <40>;
151 status = "okay";
152
153 partition@0 {
154 label = "u-boot";
155 reg = <0x0000000 0x100000>;
156 read-only;
157 };
158
159 partition@100000 {
160 label = "uImage";
161 reg = <0x0100000 0x400000>;
162 };
163
164 partition@500000 {
165 label = "pogoplug";
166 reg = <0x0500000 0x2000000>;
167 };
168
169 partition@2500000 {
170 label = "root";
171 reg = <0x02500000 0xd800000>;
172 };
173};
174
174&mdio { 175&mdio {
175 status = "okay"; 176 status = "okay";
176 177
diff --git a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
index 6548b9dc6855..d30a91a5047d 100644
--- a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
+++ b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
@@ -40,26 +40,6 @@
40 status = "ok"; 40 status = "ok";
41 }; 41 };
42 42
43 nand@3000000 {
44 status = "okay";
45
46 partition@0 {
47 label = "u-boot";
48 reg = <0x00000000 0x00100000>;
49 read-only;
50 };
51
52 partition@100000 {
53 label = "uImage";
54 reg = <0x00100000 0x00400000>;
55 };
56
57 partition@500000 {
58 label = "data";
59 reg = <0x00500000 0x1fb00000>;
60 };
61 };
62
63 sata@80000 { 43 sata@80000 {
64 status = "okay"; 44 status = "okay";
65 nr-ports = <1>; 45 nr-ports = <1>;
@@ -97,6 +77,26 @@
97 }; 77 };
98}; 78};
99 79
80&nand {
81 status = "okay";
82
83 partition@0 {
84 label = "u-boot";
85 reg = <0x00000000 0x00100000>;
86 read-only;
87 };
88
89 partition@100000 {
90 label = "uImage";
91 reg = <0x00100000 0x00400000>;
92 };
93
94 partition@500000 {
95 label = "data";
96 reg = <0x00500000 0x1fb00000>;
97 };
98};
99
100&mdio { 100&mdio {
101 status = "okay"; 101 status = "okay";
102 102
diff --git a/arch/arm/boot/dts/kirkwood-ib62x0.dts b/arch/arm/boot/dts/kirkwood-ib62x0.dts
index cb711a3bd983..c5fb02f7ebc3 100644
--- a/arch/arm/boot/dts/kirkwood-ib62x0.dts
+++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts
@@ -5,7 +5,7 @@
5 5
6/ { 6/ {
7 model = "RaidSonic ICY BOX IB-NAS62x0 (Rev B)"; 7 model = "RaidSonic ICY BOX IB-NAS62x0 (Rev B)";
8 compatible = "raidsonic,ib-nas6210-b", "raidsonic,ib-nas6220-b", "raidsonic,ib-nas6210", "raidsonic,ib-nas6220", "raidsonic,ib-nas62x0", "marvell,kirkwood-88f6281", "marvell,kirkwood"; 8 compatible = "raidsonic,ib-nas6210-b", "raidsonic,ib-nas6220-b", "raidsonic,ib-nas6210", "raidsonic,ib-nas6220", "raidsonic,ib-nas62x0", "marvell,kirkwood-88f6281", "marvell,kirkwood";
9 9
10 memory { 10 memory {
11 device_type = "memory"; 11 device_type = "memory";
@@ -43,6 +43,7 @@
43 marvell,function = "gpio"; 43 marvell,function = "gpio";
44 }; 44 };
45 }; 45 };
46
46 serial@12000 { 47 serial@12000 {
47 status = "okay"; 48 status = "okay";
48 }; 49 };
@@ -51,28 +52,6 @@
51 status = "okay"; 52 status = "okay";
52 nr-ports = <2>; 53 nr-ports = <2>;
53 }; 54 };
54
55 nand@3000000 {
56 status = "okay";
57 pinctrl-0 = <&pmx_nand>;
58 pinctrl-names = "default";
59
60 partition@0 {
61 label = "u-boot";
62 reg = <0x0000000 0x100000>;
63 };
64
65 partition@100000 {
66 label = "uImage";
67 reg = <0x0100000 0x600000>;
68 };
69
70 partition@700000 {
71 label = "root";
72 reg = <0x0700000 0xf900000>;
73 };
74
75 };
76 }; 55 };
77 56
78 gpio_keys { 57 gpio_keys {
@@ -93,6 +72,7 @@
93 gpios = <&gpio0 28 1>; 72 gpios = <&gpio0 28 1>;
94 }; 73 };
95 }; 74 };
75
96 gpio-leds { 76 gpio-leds {
97 compatible = "gpio-leds"; 77 compatible = "gpio-leds";
98 pinctrl-0 = <&pmx_led_os_red &pmx_led_os_green 78 pinctrl-0 = <&pmx_led_os_red &pmx_led_os_green
@@ -113,13 +93,39 @@
113 gpios = <&gpio0 27 0>; 93 gpios = <&gpio0 27 0>;
114 }; 94 };
115 }; 95 };
96
116 gpio_poweroff { 97 gpio_poweroff {
117 compatible = "gpio-poweroff"; 98 compatible = "gpio-poweroff";
118 pinctrl-0 = <&pmx_power_off>; 99 pinctrl-0 = <&pmx_power_off>;
119 pinctrl-names = "default"; 100 pinctrl-names = "default";
120 gpios = <&gpio0 24 0>; 101 gpios = <&gpio0 24 0>;
121 }; 102 };
103};
104
105&nand {
106 status = "okay";
107 pinctrl-0 = <&pmx_nand>;
108 pinctrl-names = "default";
109
110 partition@0 {
111 label = "u-boot";
112 reg = <0x0000000 0xe0000>;
113 };
122 114
115 partition@e0000 {
116 label = "u-boot environment";
117 reg = <0xe0000 0x100000>;
118 };
119
120 partition@100000 {
121 label = "uImage";
122 reg = <0x0100000 0x600000>;
123 };
124
125 partition@700000 {
126 label = "root";
127 reg = <0x0700000 0xf900000>;
128 };
123 129
124}; 130};
125 131
@@ -134,6 +140,7 @@
134 140
135&eth0 { 141&eth0 {
136 status = "okay"; 142 status = "okay";
143
137 ethernet0-port@0 { 144 ethernet0-port@0 {
138 phy-handle = <&ethphy0>; 145 phy-handle = <&ethphy0>;
139 }; 146 };
diff --git a/arch/arm/boot/dts/kirkwood-iconnect.dts b/arch/arm/boot/dts/kirkwood-iconnect.dts
index 0323f017eeed..4a62b206f680 100644
--- a/arch/arm/boot/dts/kirkwood-iconnect.dts
+++ b/arch/arm/boot/dts/kirkwood-iconnect.dts
@@ -19,7 +19,6 @@
19 }; 19 };
20 20
21 mbus { 21 mbus {
22 ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>;
23 pcie-controller { 22 pcie-controller {
24 status = "okay"; 23 status = "okay";
25 24
@@ -83,35 +82,6 @@
83 serial@12000 { 82 serial@12000 {
84 status = "ok"; 83 status = "ok";
85 }; 84 };
86
87 nand@3000000 {
88 status = "okay";
89
90 partition@0 {
91 label = "uboot";
92 reg = <0x0000000 0xc0000>;
93 };
94
95 partition@a0000 {
96 label = "env";
97 reg = <0xa0000 0x20000>;
98 };
99
100 partition@100000 {
101 label = "zImage";
102 reg = <0x100000 0x300000>;
103 };
104
105 partition@540000 {
106 label = "initrd";
107 reg = <0x540000 0x300000>;
108 };
109
110 partition@980000 {
111 label = "boot";
112 reg = <0x980000 0x1f400000>;
113 };
114 };
115 }; 85 };
116 86
117 gpio-leds { 87 gpio-leds {
@@ -180,6 +150,35 @@
180 }; 150 };
181}; 151};
182 152
153&nand {
154 status = "okay";
155
156 partition@0 {
157 label = "uboot";
158 reg = <0x0000000 0xc0000>;
159 };
160
161 partition@a0000 {
162 label = "env";
163 reg = <0xa0000 0x20000>;
164 };
165
166 partition@100000 {
167 label = "zImage";
168 reg = <0x100000 0x300000>;
169 };
170
171 partition@540000 {
172 label = "initrd";
173 reg = <0x540000 0x300000>;
174 };
175
176 partition@980000 {
177 label = "boot";
178 reg = <0x980000 0x1f400000>;
179 };
180};
181
183&mdio { 182&mdio {
184 status = "okay"; 183 status = "okay";
185 184
diff --git a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
index df8447442b37..d15395d671ed 100644
--- a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
+++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
@@ -113,31 +113,6 @@
113 status = "ok"; 113 status = "ok";
114 }; 114 };
115 115
116 nand@3000000 {
117 status = "okay";
118
119 partition@0 {
120 label = "u-boot";
121 reg = <0x0000000 0x100000>;
122 read-only;
123 };
124
125 partition@a0000 {
126 label = "env";
127 reg = <0xa0000 0x20000>;
128 read-only;
129 };
130
131 partition@100000 {
132 label = "uImage";
133 reg = <0x100000 0x300000>;
134 };
135
136 partition@400000 {
137 label = "uInitrd";
138 reg = <0x540000 0x1000000>;
139 };
140 };
141 sata@80000 { 116 sata@80000 {
142 status = "okay"; 117 status = "okay";
143 nr-ports = <2>; 118 nr-ports = <2>;
@@ -195,6 +170,32 @@
195 }; 170 };
196}; 171};
197 172
173&nand {
174 status = "okay";
175
176 partition@0 {
177 label = "u-boot";
178 reg = <0x0000000 0x100000>;
179 read-only;
180 };
181
182 partition@a0000 {
183 label = "env";
184 reg = <0xa0000 0x20000>;
185 read-only;
186 };
187
188 partition@100000 {
189 label = "uImage";
190 reg = <0x100000 0x300000>;
191 };
192
193 partition@400000 {
194 label = "uInitrd";
195 reg = <0x540000 0x1000000>;
196 };
197};
198
198&mdio { 199&mdio {
199 status = "okay"; 200 status = "okay";
200 201
diff --git a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
index 6899408482d2..cd44f37e54b5 100644
--- a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
+++ b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
@@ -34,13 +34,6 @@
34 serial@12000 { 34 serial@12000 {
35 status = "ok"; 35 status = "ok";
36 }; 36 };
37
38 nand@3000000 {
39 pinctrl-0 = <&pmx_nand>;
40 pinctrl-names = "default";
41 status = "ok";
42 chip-delay = <25>;
43 };
44 }; 37 };
45 38
46 i2c@0 { 39 i2c@0 {
@@ -51,6 +44,13 @@
51 }; 44 };
52}; 45};
53 46
47&nand {
48 pinctrl-0 = <&pmx_nand>;
49 pinctrl-names = "default";
50 status = "ok";
51 chip-delay = <25>;
52};
53
54&mdio { 54&mdio {
55 status = "okay"; 55 status = "okay";
56 56
diff --git a/arch/arm/boot/dts/kirkwood-mplcec4.dts b/arch/arm/boot/dts/kirkwood-mplcec4.dts
index ce2b94b513db..6c1ec2786e6e 100644
--- a/arch/arm/boot/dts/kirkwood-mplcec4.dts
+++ b/arch/arm/boot/dts/kirkwood-mplcec4.dts
@@ -17,7 +17,6 @@
17 }; 17 };
18 18
19 mbus { 19 mbus {
20 ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>;
21 pcie-controller { 20 pcie-controller {
22 status = "okay"; 21 status = "okay";
23 22
@@ -96,37 +95,6 @@
96 pinctrl-names = "default"; 95 pinctrl-names = "default";
97 }; 96 };
98 97
99 nand@3000000 {
100 pinctrl-0 = <&pmx_nand>;
101 pinctrl-names = "default";
102 status = "okay";
103
104 partition@0 {
105 label = "uboot";
106 reg = <0x0000000 0x100000>;
107 };
108
109 partition@100000 {
110 label = "env";
111 reg = <0x100000 0x80000>;
112 };
113
114 partition@180000 {
115 label = "fdt";
116 reg = <0x180000 0x80000>;
117 };
118
119 partition@200000 {
120 label = "kernel";
121 reg = <0x200000 0x400000>;
122 };
123
124 partition@600000 {
125 label = "rootfs";
126 reg = <0x600000 0x1fa00000>;
127 };
128 };
129
130 rtc@10300 { 98 rtc@10300 {
131 status = "disabled"; 99 status = "disabled";
132 }; 100 };
@@ -194,6 +162,37 @@
194 }; 162 };
195}; 163};
196 164
165&nand {
166 pinctrl-0 = <&pmx_nand>;
167 pinctrl-names = "default";
168 status = "okay";
169
170 partition@0 {
171 label = "uboot";
172 reg = <0x0000000 0x100000>;
173 };
174
175 partition@100000 {
176 label = "env";
177 reg = <0x100000 0x80000>;
178 };
179
180 partition@180000 {
181 label = "fdt";
182 reg = <0x180000 0x80000>;
183 };
184
185 partition@200000 {
186 label = "kernel";
187 reg = <0x200000 0x400000>;
188 };
189
190 partition@600000 {
191 label = "rootfs";
192 reg = <0x600000 0x1fa00000>;
193 };
194};
195
197&mdio { 196&mdio {
198 status = "okay"; 197 status = "okay";
199 198
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 874857ea9cb8..e6a102cf424c 100644
--- a/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
+++ b/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
@@ -17,7 +17,6 @@
17 }; 17 };
18 18
19 mbus { 19 mbus {
20 ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>;
21 pcie-controller { 20 pcie-controller {
22 status = "okay"; 21 status = "okay";
23 22
@@ -98,36 +97,6 @@
98 status = "okay"; 97 status = "okay";
99 }; 98 };
100 99
101 nand@3000000 {
102 status = "okay";
103
104 partition@0 {
105 label = "u-boot";
106 reg = <0x0000000 0x180000>;
107 read-only;
108 };
109
110 partition@180000 {
111 label = "u-boot-env";
112 reg = <0x180000 0x20000>;
113 };
114
115 partition@200000 {
116 label = "uImage";
117 reg = <0x0200000 0x600000>;
118 };
119
120 partition@800000 {
121 label = "minirootfs";
122 reg = <0x0800000 0x1000000>;
123 };
124
125 partition@1800000 {
126 label = "jffs2";
127 reg = <0x1800000 0x6800000>;
128 };
129 };
130
131 sata@80000 { 100 sata@80000 {
132 status = "okay"; 101 status = "okay";
133 nr-ports = <2>; 102 nr-ports = <2>;
@@ -208,6 +177,36 @@
208 }; 177 };
209}; 178};
210 179
180&nand {
181 status = "okay";
182
183 partition@0 {
184 label = "u-boot";
185 reg = <0x0000000 0x180000>;
186 read-only;
187 };
188
189 partition@180000 {
190 label = "u-boot-env";
191 reg = <0x180000 0x20000>;
192 };
193
194 partition@200000 {
195 label = "uImage";
196 reg = <0x0200000 0x600000>;
197 };
198
199 partition@800000 {
200 label = "minirootfs";
201 reg = <0x0800000 0x1000000>;
202 };
203
204 partition@1800000 {
205 label = "jffs2";
206 reg = <0x1800000 0x6800000>;
207 };
208};
209
211&mdio { 210&mdio {
212 status = "okay"; 211 status = "okay";
213 212
diff --git a/arch/arm/boot/dts/kirkwood-nsa310-common.dtsi b/arch/arm/boot/dts/kirkwood-nsa310-common.dtsi
index 06267a91de38..e3f915defd3d 100644
--- a/arch/arm/boot/dts/kirkwood-nsa310-common.dtsi
+++ b/arch/arm/boot/dts/kirkwood-nsa310-common.dtsi
@@ -27,49 +27,6 @@
27 nr-ports = <2>; 27 nr-ports = <2>;
28 }; 28 };
29 29
30 nand@3000000 {
31 status = "okay";
32 chip-delay = <35>;
33
34 partition@0 {
35 label = "uboot";
36 reg = <0x0000000 0x0100000>;
37 read-only;
38 };
39 partition@100000 {
40 label = "uboot_env";
41 reg = <0x0100000 0x0080000>;
42 };
43 partition@180000 {
44 label = "key_store";
45 reg = <0x0180000 0x0080000>;
46 };
47 partition@200000 {
48 label = "info";
49 reg = <0x0200000 0x0080000>;
50 };
51 partition@280000 {
52 label = "etc";
53 reg = <0x0280000 0x0a00000>;
54 };
55 partition@c80000 {
56 label = "kernel_1";
57 reg = <0x0c80000 0x0a00000>;
58 };
59 partition@1680000 {
60 label = "rootfs1";
61 reg = <0x1680000 0x2fc0000>;
62 };
63 partition@4640000 {
64 label = "kernel_2";
65 reg = <0x4640000 0x0a00000>;
66 };
67 partition@5040000 {
68 label = "rootfs2";
69 reg = <0x5040000 0x2fc0000>;
70 };
71 };
72
73 pcie-controller { 30 pcie-controller {
74 status = "okay"; 31 status = "okay";
75 32
@@ -105,3 +62,46 @@
105 }; 62 };
106 }; 63 };
107}; 64};
65
66&nand {
67 status = "okay";
68 chip-delay = <35>;
69
70 partition@0 {
71 label = "uboot";
72 reg = <0x0000000 0x0100000>;
73 read-only;
74 };
75 partition@100000 {
76 label = "uboot_env";
77 reg = <0x0100000 0x0080000>;
78 };
79 partition@180000 {
80 label = "key_store";
81 reg = <0x0180000 0x0080000>;
82 };
83 partition@200000 {
84 label = "info";
85 reg = <0x0200000 0x0080000>;
86 };
87 partition@280000 {
88 label = "etc";
89 reg = <0x0280000 0x0a00000>;
90 };
91 partition@c80000 {
92 label = "kernel_1";
93 reg = <0x0c80000 0x0a00000>;
94 };
95 partition@1680000 {
96 label = "rootfs1";
97 reg = <0x1680000 0x2fc0000>;
98 };
99 partition@4640000 {
100 label = "kernel_2";
101 reg = <0x4640000 0x0a00000>;
102 };
103 partition@5040000 {
104 label = "rootfs2";
105 reg = <0x5040000 0x2fc0000>;
106 };
107};
diff --git a/arch/arm/boot/dts/kirkwood-nsa310.dts b/arch/arm/boot/dts/kirkwood-nsa310.dts
index 7aeae0c2c1f4..b5418bcaecce 100644
--- a/arch/arm/boot/dts/kirkwood-nsa310.dts
+++ b/arch/arm/boot/dts/kirkwood-nsa310.dts
@@ -15,7 +15,6 @@
15 }; 15 };
16 16
17 mbus { 17 mbus {
18 ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>;
19 pcie-controller { 18 pcie-controller {
20 status = "okay"; 19 status = "okay";
21 20
diff --git a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
index 85ccf8d8abb1..f0e3d213604c 100644
--- a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
+++ b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
@@ -29,43 +29,6 @@
29 pinctrl-names = "default"; 29 pinctrl-names = "default";
30 }; 30 };
31 31
32 nand@3000000 {
33 chip-delay = <25>;
34 status = "okay";
35 pinctrl-0 = <&pmx_nand>;
36 pinctrl-names = "default";
37
38 partition@0 {
39 label = "uboot";
40 reg = <0x0 0x90000>;
41 };
42
43 partition@90000 {
44 label = "env";
45 reg = <0x90000 0x44000>;
46 };
47
48 partition@d4000 {
49 label = "test";
50 reg = <0xd4000 0x24000>;
51 };
52
53 partition@f4000 {
54 label = "conf";
55 reg = <0xf4000 0x400000>;
56 };
57
58 partition@4f4000 {
59 label = "linux";
60 reg = <0x4f4000 0x1d20000>;
61 };
62
63 partition@2214000 {
64 label = "user";
65 reg = <0x2214000 0x1dec000>;
66 };
67 };
68
69 sata@80000 { 32 sata@80000 {
70 nr-ports = <1>; 33 nr-ports = <1>;
71 status = "okay"; 34 status = "okay";
@@ -167,6 +130,43 @@
167 }; 130 };
168}; 131};
169 132
133&nand {
134 chip-delay = <25>;
135 status = "okay";
136 pinctrl-0 = <&pmx_nand>;
137 pinctrl-names = "default";
138
139 partition@0 {
140 label = "uboot";
141 reg = <0x0 0x90000>;
142 };
143
144 partition@90000 {
145 label = "env";
146 reg = <0x90000 0x44000>;
147 };
148
149 partition@d4000 {
150 label = "test";
151 reg = <0xd4000 0x24000>;
152 };
153
154 partition@f4000 {
155 label = "conf";
156 reg = <0xf4000 0x400000>;
157 };
158
159 partition@4f4000 {
160 label = "linux";
161 reg = <0x4f4000 0x1d20000>;
162 };
163
164 partition@2214000 {
165 label = "user";
166 reg = <0x2214000 0x1dec000>;
167 };
168};
169
170&mdio { 170&mdio {
171 status = "okay"; 171 status = "okay";
172 172
diff --git a/arch/arm/boot/dts/kirkwood-openblocks_a7.dts b/arch/arm/boot/dts/kirkwood-openblocks_a7.dts
new file mode 100644
index 000000000000..851fb2a60f20
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-openblocks_a7.dts
@@ -0,0 +1,223 @@
1/*
2 * Device Tree file for OpenBlocks A7 board
3 *
4 * Copyright (C) 2013 Free Electrons
5 *
6 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13/dts-v1/;
14
15#include "kirkwood.dtsi"
16#include "kirkwood-6282.dtsi"
17
18/ {
19 model = "Plat'Home OpenBlocksA7";
20 compatible = "plathome,openblocks-a7", "marvell,kirkwood-88f6283", "marvell,kirkwood";
21
22 memory {
23 device_type = "memory";
24 reg = <0x00000000 0x40000000>; /* 1 GB */
25 };
26
27 chosen {
28 bootargs = "console=ttyS0,115200n8 earlyprintk";
29 };
30
31 ocp@f1000000 {
32 serial@12000 {
33 status = "ok";
34 pinctrl-0 = <&pmx_uart0>;
35 pinctrl-names = "default";
36 };
37
38 serial@12100 {
39 status = "ok";
40 pinctrl-0 = <&pmx_uart1>;
41 pinctrl-names = "default";
42 };
43
44 sata@80000 {
45 nr-ports = <1>;
46 status = "okay";
47 };
48
49 i2c@11100 {
50 status = "okay";
51 pinctrl-0 = <&pmx_twsi1>;
52 pinctrl-names = "default";
53
54 s24c02: s24c02@50 {
55 compatible = "24c02";
56 reg = <0x50>;
57 };
58 };
59
60 pinctrl: pinctrl@10000 {
61 pinctrl-0 = <&pmx_dip_switches &pmx_gpio_header>;
62 pinctrl-names = "default";
63
64 pmx_uart0: pmx-uart0 {
65 marvell,pins = "mpp10", "mpp11", "mpp15",
66 "mpp16";
67 marvell,function = "uart0";
68 };
69
70 pmx_uart1: pmx-uart1 {
71 marvell,pins = "mpp13", "mpp14", "mpp8",
72 "mpp9";
73 marvell,function = "uart1";
74 };
75
76 pmx_sysrst: pmx-sysrst {
77 marvell,pins = "mpp6";
78 marvell,function = "sysrst";
79 };
80
81 pmx_dip_switches: pmx-dip-switches {
82 marvell,pins = "mpp44", "mpp45", "mpp46", "mpp47";
83 marvell,function = "gpio";
84 };
85
86 /*
87 * Accessible on connector J202. The MPP
88 * listed below are pin 1-7, pin 8 is unused,
89 * pin 9 is external reset input and pin 10 is
90 * ground.
91 */
92 pmx_gpio_header: pmx-gpio-header {
93 marvell,pins = "mpp17", "mpp7", "mpp29", "mpp28",
94 "mpp35", "mpp34", "mpp40";
95 marvell,function = "gpio";
96 };
97
98 pmx_gpio_init: pmx-init {
99 marvell,pins = "mpp38";
100 marvell,function = "gpio";
101 };
102
103 pmx_usb_oc: pmx-usb-oc {
104 marvell,pins = "mpp39";
105 marvell,function = "gpio";
106 };
107
108 pmx_leds: pmx-leds {
109 marvell,pins = "mpp41", "mpp42", "mpp43";
110 marvell,function = "gpio";
111 };
112
113 pmx_ge1: pmx-ge1 {
114 marvell,pins = "mpp20", "mpp21", "mpp22", "mpp23",
115 "mpp24", "mpp25", "mpp26", "mpp27",
116 "mpp30", "mpp31", "mpp32", "mpp33";
117 marvell,function = "ge1";
118 };
119 };
120 };
121
122 gpio-leds {
123 compatible = "gpio-leds";
124 pinctrl-0 = <&pmx_leds>;
125 pinctrl-names = "default";
126
127 led-red {
128 label = "obsa7:red:stat";
129 gpios = <&gpio1 9 1>;
130 };
131
132 led-green {
133 label = "obsa7:green:stat";
134 gpios = <&gpio1 10 1>;
135 };
136
137 led-yellow {
138 label = "obsa7:yellow:stat";
139 gpios = <&gpio1 11 1>;
140 };
141 };
142
143 gpio_keys {
144 compatible = "gpio-keys";
145 pinctrl-0 = <&pmx_gpio_init>;
146 pinctrl-names = "default";
147 #address-cells = <1>;
148 #size-cells = <0>;
149
150 button@1 {
151 label = "Init Button";
152 linux,code = <116>;
153 gpios = <&gpio1 6 0>;
154 };
155 };
156};
157
158&nand {
159 chip-delay = <25>;
160 status = "okay";
161 pinctrl-0 = <&pmx_nand>;
162 pinctrl-names = "default";
163
164 partition@0 {
165 label = "uboot";
166 reg = <0x0 0x1c0000>;
167 };
168
169 partition@1c0000 {
170 label = "env";
171 reg = <0x1c0000 0x2c0000>;
172 };
173
174 partition@480000 {
175 label = "test";
176 reg = <0x480000 0x160000>;
177 };
178
179 partition@5e0000 {
180 label = "conf";
181 reg = <0x5e0000 0x540000>;
182 };
183
184 partition@b20000 {
185 label = "linux";
186 reg = <0xb20000 0x3d40000>;
187 };
188
189 partition@4860000 {
190 label = "user";
191 reg = <0x4860000 0xb7a0000>;
192 };
193};
194
195&mdio {
196 status = "okay";
197
198 ethphy0: ethernet-phy@0 {
199 device_type = "ethernet-phy";
200 reg = <0>;
201 };
202
203 ethphy1: ethernet-phy@1 {
204 device_type = "ethernet-phy";
205 reg = <1>;
206 };
207};
208
209&eth0 {
210 status = "okay";
211 ethernet0-port@0 {
212 phy-handle = <&ethphy0>;
213 };
214};
215
216&eth1 {
217 status = "okay";
218 pinctrl-0 = <&pmx_ge1>;
219 pinctrl-names = "default";
220 ethernet1-port@0 {
221 phy-handle = <&ethphy1>;
222 };
223};
diff --git a/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi b/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi
index 5696b630b70b..1173d7fb31b2 100644
--- a/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi
+++ b/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi
@@ -48,27 +48,6 @@
48 pinctrl-names = "default"; 48 pinctrl-names = "default";
49 status = "okay"; 49 status = "okay";
50 }; 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 }; 51 };
73 52
74 regulators { 53 regulators {
@@ -92,6 +71,27 @@
92 }; 71 };
93}; 72};
94 73
74&nand {
75 pinctrl-0 = <&pmx_nand>;
76 pinctrl-names = "default";
77 status = "okay";
78
79 partition@0 {
80 label = "u-boot";
81 reg = <0x0000000 0x100000>;
82 };
83
84 partition@100000 {
85 label = "uImage";
86 reg = <0x0100000 0x400000>;
87 };
88
89 partition@500000 {
90 label = "root";
91 reg = <0x0500000 0x1fb00000>;
92 };
93};
94
95&mdio { 95&mdio {
96 status = "okay"; 96 status = "okay";
97 97
diff --git a/arch/arm/boot/dts/kirkwood-topkick.dts b/arch/arm/boot/dts/kirkwood-topkick.dts
index 30842b4ff293..320da677b984 100644
--- a/arch/arm/boot/dts/kirkwood-topkick.dts
+++ b/arch/arm/boot/dts/kirkwood-topkick.dts
@@ -90,37 +90,6 @@
90 pinctrl-names = "default"; 90 pinctrl-names = "default";
91 }; 91 };
92 92
93 nand@3000000 {
94 status = "okay";
95 pinctrl-0 = <&pmx_nand>;
96 pinctrl-names = "default";
97
98 partition@0 {
99 label = "u-boot";
100 reg = <0x0000000 0x180000>;
101 };
102
103 partition@180000 {
104 label = "u-boot env";
105 reg = <0x0180000 0x20000>;
106 };
107
108 partition@200000 {
109 label = "uImage";
110 reg = <0x0200000 0x600000>;
111 };
112
113 partition@800000 {
114 label = "uInitrd";
115 reg = <0x0800000 0x1000000>;
116 };
117
118 partition@1800000 {
119 label = "rootfs";
120 reg = <0x1800000 0xe800000>;
121 };
122 };
123
124 sata@80000 { 93 sata@80000 {
125 status = "okay"; 94 status = "okay";
126 nr-ports = <1>; 95 nr-ports = <1>;
@@ -204,6 +173,37 @@
204 }; 173 };
205}; 174};
206 175
176&nand {
177 status = "okay";
178 pinctrl-0 = <&pmx_nand>;
179 pinctrl-names = "default";
180
181 partition@0 {
182 label = "u-boot";
183 reg = <0x0000000 0x180000>;
184 };
185
186 partition@180000 {
187 label = "u-boot env";
188 reg = <0x0180000 0x20000>;
189 };
190
191 partition@200000 {
192 label = "uImage";
193 reg = <0x0200000 0x600000>;
194 };
195
196 partition@800000 {
197 label = "uInitrd";
198 reg = <0x0800000 0x1000000>;
199 };
200
201 partition@1800000 {
202 label = "rootfs";
203 reg = <0x1800000 0xe800000>;
204 };
205};
206
207&mdio { 207&mdio {
208 status = "okay"; 208 status = "okay";
209 209
diff --git a/arch/arm/boot/dts/kirkwood-ts219-6282.dts b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
index 9efcd2dc79d3..345562f75891 100644
--- a/arch/arm/boot/dts/kirkwood-ts219-6282.dts
+++ b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
@@ -6,7 +6,6 @@
6 6
7/ { 7/ {
8 mbus { 8 mbus {
9 ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>;
10 pcie-controller { 9 pcie-controller {
11 status = "okay"; 10 status = "okay";
12 11
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index cf7aeaf89e9c..8b73c80f1dad 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -13,6 +13,7 @@
13 cpu@0 { 13 cpu@0 {
14 device_type = "cpu"; 14 device_type = "cpu";
15 compatible = "marvell,feroceon"; 15 compatible = "marvell,feroceon";
16 reg = <0>;
16 clocks = <&core_clk 1>, <&core_clk 3>, <&gate_clk 11>; 17 clocks = <&core_clk 1>, <&core_clk 3>, <&gate_clk 11>;
17 clock-names = "cpu_clk", "ddrclk", "powersave"; 18 clock-names = "cpu_clk", "ddrclk", "powersave";
18 }; 19 };
@@ -27,16 +28,43 @@
27 compatible = "marvell,kirkwood-mbus", "simple-bus"; 28 compatible = "marvell,kirkwood-mbus", "simple-bus";
28 #address-cells = <2>; 29 #address-cells = <2>;
29 #size-cells = <1>; 30 #size-cells = <1>;
31 /* If a board file needs to change this ranges it must replace it completely */
32 ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000 /* internal-regs */
33 MBUS_ID(0x01, 0x2f) 0 0xf4000000 0x10000 /* nand flash */
34 MBUS_ID(0x03, 0x01) 0 0xf5000000 0x10000 /* crypto sram */
35 >;
30 controller = <&mbusc>; 36 controller = <&mbusc>;
31 pcie-mem-aperture = <0xe0000000 0x10000000>; /* 256 MiB memory space */ 37 pcie-mem-aperture = <0xe0000000 0x10000000>; /* 256 MiB memory space */
32 pcie-io-aperture = <0xf2000000 0x100000>; /* 1 MiB I/O space */ 38 pcie-io-aperture = <0xf2000000 0x100000>; /* 1 MiB I/O space */
39
40 crypto@0301 {
41 compatible = "marvell,orion-crypto";
42 reg = <MBUS_ID(0xf0, 0x01) 0x30000 0x10000>,
43 <MBUS_ID(0x03, 0x01) 0 0x800>;
44 reg-names = "regs", "sram";
45 interrupts = <22>;
46 clocks = <&gate_clk 17>;
47 status = "okay";
48 };
49
50 nand: nand@012f {
51 #address-cells = <1>;
52 #size-cells = <1>;
53 cle = <0>;
54 ale = <1>;
55 bank-width = <1>;
56 compatible = "marvell,orion-nand";
57 reg = <MBUS_ID(0x01, 0x2f) 0 0x400>;
58 chip-delay = <25>;
59 /* set partition map and/or chip-delay in board dts */
60 clocks = <&gate_clk 7>;
61 status = "disabled";
62 };
33 }; 63 };
34 64
35 ocp@f1000000 { 65 ocp@f1000000 {
36 compatible = "simple-bus"; 66 compatible = "simple-bus";
37 ranges = <0x00000000 0xf1000000 0x0100000 67 ranges = <0x00000000 0xf1000000 0x0100000>;
38 0xf4000000 0xf4000000 0x0000400
39 0xf5000000 0xf5000000 0x0000400>;
40 #address-cells = <1>; 68 #address-cells = <1>;
41 #size-cells = <1>; 69 #size-cells = <1>;
42 70
@@ -167,7 +195,7 @@
167 xor@60900 { 195 xor@60900 {
168 compatible = "marvell,orion-xor"; 196 compatible = "marvell,orion-xor";
169 reg = <0x60900 0x100 197 reg = <0x60900 0x100
170 0xd0B00 0x100>; 198 0x60B00 0x100>;
171 status = "okay"; 199 status = "okay";
172 clocks = <&gate_clk 16>; 200 clocks = <&gate_clk 16>;
173 201
@@ -192,20 +220,6 @@
192 status = "okay"; 220 status = "okay";
193 }; 221 };
194 222
195 nand@3000000 {
196 #address-cells = <1>;
197 #size-cells = <1>;
198 cle = <0>;
199 ale = <1>;
200 bank-width = <1>;
201 compatible = "marvell,orion-nand";
202 reg = <0xf4000000 0x400>;
203 chip-delay = <25>;
204 /* set partition map and/or chip-delay in board dts */
205 clocks = <&gate_clk 7>;
206 status = "disabled";
207 };
208
209 i2c@11000 { 223 i2c@11000 {
210 compatible = "marvell,mv64xxx-i2c"; 224 compatible = "marvell,mv64xxx-i2c";
211 reg = <0x11000 0x20>; 225 reg = <0x11000 0x20>;
@@ -217,16 +231,6 @@
217 status = "disabled"; 231 status = "disabled";
218 }; 232 };
219 233
220 crypto@30000 {
221 compatible = "marvell,orion-crypto";
222 reg = <0x30000 0x10000>,
223 <0xf5000000 0x800>;
224 reg-names = "regs", "sram";
225 interrupts = <22>;
226 clocks = <&gate_clk 17>;
227 status = "okay";
228 };
229
230 mdio: mdio-bus@72004 { 234 mdio: mdio-bus@72004 {
231 compatible = "marvell,orion-mdio"; 235 compatible = "marvell,orion-mdio";
232 #address-cells = <1>; 236 #address-cells = <1>;
diff --git a/arch/arm/boot/dts/mxs-pinfunc.h b/arch/arm/boot/dts/mxs-pinfunc.h
new file mode 100644
index 000000000000..c6da987b20cb
--- /dev/null
+++ b/arch/arm/boot/dts/mxs-pinfunc.h
@@ -0,0 +1,31 @@
1/*
2 * Header providing constants for i.MX28 pinctrl bindings.
3 *
4 * Copyright (C) 2013 Lothar Waßmann <LW@KARO-electronics.de>
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 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#ifndef __DT_BINDINGS_MXS_PINCTRL_H__
15#define __DT_BINDINGS_MXS_PINCTRL_H__
16
17/* fsl,drive-strength property */
18#define MXS_DRIVE_4mA 0
19#define MXS_DRIVE_8mA 1
20#define MXS_DRIVE_12mA 2
21#define MXS_DRIVE_16mA 3
22
23/* fsl,voltage property */
24#define MXS_VOLTAGE_LOW 0
25#define MXS_VOLTAGE_HIGH 1
26
27/* fsl,pull-up property */
28#define MXS_PULL_DISABLE 0
29#define MXS_PULL_ENABLE 1
30
31#endif /* __DT_BINDINGS_MXS_PINCTRL_H__ */
diff --git a/arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi b/arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi
new file mode 100644
index 000000000000..9c18adf788f7
--- /dev/null
+++ b/arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi
@@ -0,0 +1,52 @@
1/*
2 * Common file for GPMC connected smsc911x on omaps
3 *
4 * Note that the board specifc DTS file needs to specify
5 * ranges, pinctrl, reg, interrupt parent and interrupts.
6 */
7
8/ {
9 vddvario: regulator-vddvario {
10 compatible = "regulator-fixed";
11 regulator-name = "vddvario";
12 regulator-always-on;
13 };
14
15 vdd33a: regulator-vdd33a {
16 compatible = "regulator-fixed";
17 regulator-name = "vdd33a";
18 regulator-always-on;
19 };
20};
21
22&gpmc {
23 ethernet@gpmc {
24 compatible = "smsc,lan9221", "smsc,lan9115";
25 bank-width = <2>;
26 gpmc,mux-add-data;
27 gpmc,cs-on-ns = <0>;
28 gpmc,cs-rd-off-ns = <186>;
29 gpmc,cs-wr-off-ns = <186>;
30 gpmc,adv-on-ns = <12>;
31 gpmc,adv-rd-off-ns = <48>;
32 gpmc,adv-wr-off-ns = <48>;
33 gpmc,oe-on-ns = <54>;
34 gpmc,oe-off-ns = <168>;
35 gpmc,we-on-ns = <54>;
36 gpmc,we-off-ns = <168>;
37 gpmc,rd-cycle-ns = <186>;
38 gpmc,wr-cycle-ns = <186>;
39 gpmc,access-ns = <114>;
40 gpmc,page-burst-access-ns = <6>;
41 gpmc,bus-turnaround-ns = <12>;
42 gpmc,cycle2cycle-delay-ns = <18>;
43 gpmc,wr-data-mux-bus-ns = <90>;
44 gpmc,wr-access-ns = <186>;
45 gpmc,cycle2cycle-samecsen;
46 gpmc,cycle2cycle-diffcsen;
47 vmmc-supply = <&vddvario>;
48 vmmc_aux-supply = <&vdd33a>;
49 reg-io-width = <4>;
50 smsc,save-mac-address;
51 };
52};
diff --git a/arch/arm/boot/dts/omap-zoom-common.dtsi b/arch/arm/boot/dts/omap-zoom-common.dtsi
new file mode 100644
index 000000000000..b0ee342598f0
--- /dev/null
+++ b/arch/arm/boot/dts/omap-zoom-common.dtsi
@@ -0,0 +1,33 @@
1/*
2 * Common features on the Zoom debug board
3 */
4
5#include "omap-gpmc-smsc911x.dtsi"
6
7&gpmc {
8 ranges = <3 0 0x10000000 0x00000400>,
9 <7 0 0x2c000000 0x01000000>;
10
11 /*
12 * Four port TL16CP754C serial port on GPMC,
13 * they probably share the same GPIO IRQ
14 * REVISIT: Add timing support from slls644g.pdf
15 */
16 8250@3,0 {
17 compatible = "ns16550a";
18 reg = <3 0 0x100>;
19 bank-width = <2>;
20 reg-shift = <1>;
21 reg-io-width = <1>;
22 interrupt-parent = <&gpio4>;
23 interrupts = <6 IRQ_TYPE_EDGE_RISING>; /* gpio102 */
24 clock-frequency = <1843200>;
25 current-speed = <115200>;
26 };
27
28 ethernet@gpmc {
29 reg = <7 0 0xff>;
30 interrupt-parent = <&gpio5>;
31 interrupts = <30 IRQ_TYPE_LEVEL_LOW>; /* gpio158 */
32 };
33};
diff --git a/arch/arm/boot/dts/omap2420-h4.dts b/arch/arm/boot/dts/omap2420-h4.dts
index 224c08f472f4..34cdecb4fdda 100644
--- a/arch/arm/boot/dts/omap2420-h4.dts
+++ b/arch/arm/boot/dts/omap2420-h4.dts
@@ -50,15 +50,15 @@
50 label = "bootloader"; 50 label = "bootloader";
51 reg = <0 0x20000>; 51 reg = <0 0x20000>;
52 }; 52 };
53 partition@0x20000 { 53 partition@20000 {
54 label = "params"; 54 label = "params";
55 reg = <0x20000 0x20000>; 55 reg = <0x20000 0x20000>;
56 }; 56 };
57 partition@0x40000 { 57 partition@40000 {
58 label = "kernel"; 58 label = "kernel";
59 reg = <0x40000 0x200000>; 59 reg = <0x40000 0x200000>;
60 }; 60 };
61 partition@0x240000 { 61 partition@240000 {
62 label = "file-system"; 62 label = "file-system";
63 reg = <0x240000 0x3dc0000>; 63 reg = <0x240000 0x3dc0000>;
64 }; 64 };
diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts b/arch/arm/boot/dts/omap3-beagle-xm.dts
index afdb16417d4e..31a632f7effb 100644
--- a/arch/arm/boot/dts/omap3-beagle-xm.dts
+++ b/arch/arm/boot/dts/omap3-beagle-xm.dts
@@ -11,7 +11,7 @@
11 11
12/ { 12/ {
13 model = "TI OMAP3 BeagleBoard xM"; 13 model = "TI OMAP3 BeagleBoard xM";
14 compatible = "ti,omap3-beagle-xm, ti,omap3-beagle", "ti,omap3"; 14 compatible = "ti,omap3-beagle-xm", "ti,omap36xx", "ti,omap3";
15 15
16 cpus { 16 cpus {
17 cpu@0 { 17 cpu@0 {
@@ -69,6 +69,23 @@
69 }; 69 };
70 70
71 }; 71 };
72
73 /* HS USB Port 2 Power */
74 hsusb2_power: hsusb2_power_reg {
75 compatible = "regulator-fixed";
76 regulator-name = "hsusb2_vbus";
77 regulator-min-microvolt = <3300000>;
78 regulator-max-microvolt = <3300000>;
79 gpio = <&twl_gpio 18 0>; /* GPIO LEDA */
80 startup-delay-us = <70000>;
81 };
82
83 /* HS USB Host PHY on PORT 2 */
84 hsusb2_phy: hsusb2_phy {
85 compatible = "usb-nop-xceiv";
86 reset-gpios = <&gpio5 19 GPIO_ACTIVE_LOW>; /* gpio_147 */
87 vcc-supply = <&hsusb2_power>;
88 };
72}; 89};
73 90
74&omap3_pmx_wkup { 91&omap3_pmx_wkup {
@@ -79,6 +96,37 @@
79 }; 96 };
80}; 97};
81 98
99&omap3_pmx_core {
100 pinctrl-names = "default";
101 pinctrl-0 = <
102 &hsusbb2_pins
103 >;
104
105 uart3_pins: pinmux_uart3_pins {
106 pinctrl-single,pins = <
107 0x16e (PIN_INPUT | PIN_OFF_WAKEUPENABLE | MUX_MODE0) /* uart3_rx_irrx.uart3_rx_irrx */
108 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx.uart3_tx_irtx OUTPUT | MODE0 */
109 >;
110 };
111
112 hsusbb2_pins: pinmux_hsusbb2_pins {
113 pinctrl-single,pins = <
114 0x5c0 (PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */
115 0x5c2 (PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */
116 0x5c4 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */
117 0x5c6 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */
118 0x5c8 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */
119 0x5cA (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */
120 0x1a4 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi1_cs3.hsusb2_data2 */
121 0x1a6 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_clk.hsusb2_data7 */
122 0x1a8 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_simo.hsusb2_data4 */
123 0x1aa (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_somi.hsusb2_data5 */
124 0x1ac (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs0.hsusb2_data6 */
125 0x1ae (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs1.hsusb2_data3 */
126 >;
127 };
128};
129
82&i2c1 { 130&i2c1 {
83 clock-frequency = <2600000>; 131 clock-frequency = <2600000>;
84 132
@@ -144,19 +192,12 @@
144&usb_otg_hs { 192&usb_otg_hs {
145 interface-type = <0>; 193 interface-type = <0>;
146 usb-phy = <&usb2_phy>; 194 usb-phy = <&usb2_phy>;
195 phys = <&usb2_phy>;
196 phy-names = "usb2-phy";
147 mode = <3>; 197 mode = <3>;
148 power = <50>; 198 power = <50>;
149}; 199};
150 200
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 { 201&uart3 {
161 pinctrl-names = "default"; 202 pinctrl-names = "default";
162 pinctrl-0 = <&uart3_pins>; 203 pinctrl-0 = <&uart3_pins>;
@@ -166,3 +207,11 @@
166 pinctrl-names = "default"; 207 pinctrl-names = "default";
167 pinctrl-0 = <&gpio1_pins>; 208 pinctrl-0 = <&gpio1_pins>;
168}; 209};
210
211&usbhshost {
212 port2-mode = "ehci-phy";
213};
214
215&usbhsehci {
216 phys = <0 &hsusb2_phy>;
217};
diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
index dfd83103657a..fa532aaacc68 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -44,17 +44,6 @@
44 }; 44 };
45 }; 45 };
46 46
47 /* HS USB Port 2 RESET */
48 hsusb2_reset: hsusb2_reset_reg {
49 compatible = "regulator-fixed";
50 regulator-name = "hsusb2_reset";
51 regulator-min-microvolt = <3300000>;
52 regulator-max-microvolt = <3300000>;
53 gpio = <&gpio5 19 0>; /* gpio_147 */
54 startup-delay-us = <70000>;
55 enable-active-high;
56 };
57
58 /* HS USB Port 2 Power */ 47 /* HS USB Port 2 Power */
59 hsusb2_power: hsusb2_power_reg { 48 hsusb2_power: hsusb2_power_reg {
60 compatible = "regulator-fixed"; 49 compatible = "regulator-fixed";
@@ -68,7 +57,7 @@
68 /* HS USB Host PHY on PORT 2 */ 57 /* HS USB Host PHY on PORT 2 */
69 hsusb2_phy: hsusb2_phy { 58 hsusb2_phy: hsusb2_phy {
70 compatible = "usb-nop-xceiv"; 59 compatible = "usb-nop-xceiv";
71 reset-supply = <&hsusb2_reset>; 60 reset-gpios = <&gpio5 19 GPIO_ACTIVE_LOW>; /* gpio_147 */
72 vcc-supply = <&hsusb2_power>; 61 vcc-supply = <&hsusb2_power>;
73 }; 62 };
74 63
@@ -101,18 +90,18 @@
101 90
102 hsusbb2_pins: pinmux_hsusbb2_pins { 91 hsusbb2_pins: pinmux_hsusbb2_pins {
103 pinctrl-single,pins = < 92 pinctrl-single,pins = <
104 0x5c0 (PIN_OUTPUT | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_clk */ 93 0x5c0 (PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */
105 0x5c2 (PIN_OUTPUT | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_stp */ 94 0x5c2 (PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */
106 0x5c4 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dir */ 95 0x5c4 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */
107 0x5c6 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_nxt */ 96 0x5c6 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */
108 0x5c8 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat0 */ 97 0x5c8 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */
109 0x5cA (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat1 */ 98 0x5cA (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */
110 0x1a4 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat2 */ 99 0x1a4 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi1_cs3.hsusb2_data2 */
111 0x1a6 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat3 */ 100 0x1a6 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_clk.hsusb2_data7 */
112 0x1a8 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat4 */ 101 0x1a8 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_simo.hsusb2_data4 */
113 0x1aa (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat5 */ 102 0x1aa (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_somi.hsusb2_data5 */
114 0x1ac (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat6 */ 103 0x1ac (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs0.hsusb2_data6 */
115 0x1ae (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat7 */ 104 0x1ae (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs1.hsusb2_data3 */
116 >; 105 >;
117 }; 106 };
118 107
@@ -180,3 +169,12 @@
180 pinctrl-names = "default"; 169 pinctrl-names = "default";
181 pinctrl-0 = <&gpio1_pins>; 170 pinctrl-0 = <&gpio1_pins>;
182}; 171};
172
173&usb_otg_hs {
174 interface-type = <0>;
175 usb-phy = <&usb2_phy>;
176 phys = <&usb2_phy>;
177 phy-names = "usb2-phy";
178 mode = <3>;
179 power = <50>;
180};
diff --git a/arch/arm/boot/dts/omap3-devkit8000.dts b/arch/arm/boot/dts/omap3-devkit8000.dts
index 7ef282795dd4..4665421bb7bc 100644
--- a/arch/arm/boot/dts/omap3-devkit8000.dts
+++ b/arch/arm/boot/dts/omap3-devkit8000.dts
@@ -125,7 +125,7 @@
125 nand-bus-width = <16>; 125 nand-bus-width = <16>;
126 126
127 gpmc,device-nand; 127 gpmc,device-nand;
128 gpmc,sync-clki-ps = <0>; 128 gpmc,sync-clk-ps = <0>;
129 gpmc,cs-on-ns = <0>; 129 gpmc,cs-on-ns = <0>;
130 gpmc,cs-rd-off-ns = <44>; 130 gpmc,cs-rd-off-ns = <44>;
131 gpmc,cs-wr-off-ns = <44>; 131 gpmc,cs-wr-off-ns = <44>;
diff --git a/arch/arm/boot/dts/omap3-evm-37xx.dts b/arch/arm/boot/dts/omap3-evm-37xx.dts
new file mode 100644
index 000000000000..4df68ad3736a
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-evm-37xx.dts
@@ -0,0 +1,151 @@
1/*
2 * Copyright (C) 2011 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 "omap36xx.dtsi"
11#include "omap3-evm-common.dtsi"
12
13
14/ {
15 model = "TI OMAP37XX EVM (TMDSEVM3730)";
16 compatible = "ti,omap3-evm-37xx", "ti,omap36xx";
17
18 memory {
19 device_type = "memory";
20 reg = <0x80000000 0x10000000>; /* 256 MB */
21 };
22
23 wl12xx_vmmc: wl12xx_vmmc {
24 pinctrl-names = "default";
25 pinctrl-0 = <&wl12xx_gpio>;
26 };
27};
28
29&omap3_pmx_core {
30 mmc1_pins: pinmux_mmc1_pins {
31 pinctrl-single,pins = <
32 0x114 (PIN_OUTPUT_PULLUP | MUX_MODE0) /* sdmmc1_clk.sdmmc1_clk */
33 0x116 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_cmd.sdmmc1_cmd */
34 0x118 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat0.sdmmc1_dat0 */
35 0x11a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat1.sdmmc1_dat1 */
36 0x11c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat2.sdmmc1_dat2 */
37 0x11e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat3.sdmmc1_dat3 */
38 0x120 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat4.sdmmc1_dat4 */
39 0x122 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat5.sdmmc1_dat5 */
40 0x124 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat6.sdmmc1_dat6 */
41 0x126 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat7.sdmmc1_dat7 */
42 >;
43 };
44
45 /* NOTE: Clocked externally, needs INPUT also for sdmmc2_clk.sdmmc2_clk */
46 mmc2_pins: pinmux_mmc2_pins {
47 pinctrl-single,pins = <
48 0x128 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_clk.sdmmc2_clk */
49 0x12a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_cmd.sdmmc2_cmd */
50 0x12c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat0.sdmmc2_dat0 */
51 0x12e (WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat1.sdmmc2_dat1 */
52 0x130 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat2.sdmmc2_dat2 */
53 0x132 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat3.sdmmc2_dat3 */
54 >;
55 };
56
57 uart3_pins: pinmux_uart3_pins {
58 pinctrl-single,pins = <
59 0x16e (WAKEUP_EN | PIN_INPUT | MUX_MODE0) /* uart3_rx_irrx.uart3_rx_irrx */
60 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx.uart3_tx_irtx */
61 >;
62 };
63
64 wl12xx_gpio: pinmux_wl12xx_gpio {
65 pinctrl-single,pins = <
66 0x150 (PIN_OUTPUT | MUX_MODE4) /* uart1_cts.gpio_150 */
67 0x14e (PIN_INPUT | MUX_MODE4) /* uart1_rts.gpio_149 */
68 >;
69 };
70
71 smsc911x_pins: pinmux_smsc911x_pins {
72 pinctrl-single,pins = <
73 0x1a2 (PIN_INPUT | MUX_MODE4) /* mcspi1_cs2.gpio_176 */
74 >;
75 };
76};
77
78&mmc1 {
79 pinctrl-names = "default";
80 pinctrl-0 = <&mmc1_pins>;
81};
82
83&mmc2 {
84 pinctrl-names = "default";
85 pinctrl-0 = <&mmc2_pins>;
86};
87
88&mmc3 {
89 status = "disabled";
90};
91
92&uart3 {
93 pinctrl-names = "default";
94 pinctrl-0 = <&uart3_pins>;
95};
96
97&gpmc {
98 ranges = <0 0 0x00000000 0x20000000>,
99 <5 0 0x2c000000 0x01000000>;
100
101 nand@0,0 {
102 linux,mtd-name= "hynix,h8kds0un0mer-4em";
103 reg = <0 0 0>;
104 nand-bus-width = <16>;
105 ti,nand-ecc-opt = "bch8";
106
107 gpmc,sync-clk-ps = <0>;
108 gpmc,cs-on-ns = <0>;
109 gpmc,cs-rd-off-ns = <44>;
110 gpmc,cs-wr-off-ns = <44>;
111 gpmc,adv-on-ns = <6>;
112 gpmc,adv-rd-off-ns = <34>;
113 gpmc,adv-wr-off-ns = <44>;
114 gpmc,we-off-ns = <40>;
115 gpmc,oe-off-ns = <54>;
116 gpmc,access-ns = <64>;
117 gpmc,rd-cycle-ns = <82>;
118 gpmc,wr-cycle-ns = <82>;
119 gpmc,wr-access-ns = <40>;
120 gpmc,wr-data-mux-bus-ns = <0>;
121
122 #address-cells = <1>;
123 #size-cells = <1>;
124
125 partition@0 {
126 label = "X-Loader";
127 reg = <0 0x80000>;
128 };
129 partition@0x80000 {
130 label = "U-Boot";
131 reg = <0x80000 0x1c0000>;
132 };
133 partition@0x1c0000 {
134 label = "Environment";
135 reg = <0x240000 0x40000>;
136 };
137 partition@0x280000 {
138 label = "Kernel";
139 reg = <0x280000 0x500000>;
140 };
141 partition@0x780000 {
142 label = "Filesystem";
143 reg = <0x780000 0x1f880000>;
144 };
145 };
146
147 ethernet@gpmc {
148 pinctrl-names = "default";
149 pinctrl-0 = <&smsc911x_pins>;
150 };
151};
diff --git a/arch/arm/boot/dts/omap3-evm-common.dtsi b/arch/arm/boot/dts/omap3-evm-common.dtsi
new file mode 100644
index 000000000000..3007e79c9cd6
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-evm-common.dtsi
@@ -0,0 +1,96 @@
1/*
2 * Common support for omap3 EVM boards
3 */
4
5#include "omap-gpmc-smsc911x.dtsi"
6
7/ {
8 cpus {
9 cpu@0 {
10 cpu0-supply = <&vcc>;
11 };
12 };
13
14 leds {
15 compatible = "gpio-leds";
16 ledb {
17 label = "omap3evm::ledb";
18 gpios = <&twl_gpio 19 GPIO_ACTIVE_HIGH>; /* LEDB */
19 linux,default-trigger = "default-on";
20 };
21 };
22
23 wl12xx_vmmc: wl12xx_vmmc {
24 compatible = "regulator-fixed";
25 regulator-name = "vwl1271";
26 regulator-min-microvolt = <1800000>;
27 regulator-max-microvolt = <1800000>;
28 gpio = <&gpio5 22 0>; /* gpio150 */
29 startup-delay-us = <70000>;
30 enable-active-high;
31 vin-supply = <&vmmc2>;
32 };
33};
34
35&i2c1 {
36 clock-frequency = <2600000>;
37
38 twl: twl@48 {
39 reg = <0x48>;
40 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
41 interrupt-parent = <&intc>;
42 };
43};
44
45#include "twl4030.dtsi"
46#include "twl4030_omap3.dtsi"
47
48&i2c2 {
49 clock-frequency = <400000>;
50};
51
52&i2c3 {
53 clock-frequency = <400000>;
54
55 /*
56 * TVP5146 Video decoder-in for analog input support.
57 */
58 tvp5146@5c {
59 compatible = "ti,tvp5146m2";
60 reg = <0x5c>;
61 };
62};
63
64&mmc1 {
65 vmmc-supply = <&vmmc1>;
66 vmmc_aux-supply = <&vsim>;
67 bus-width = <8>;
68};
69
70&mmc2 {
71 vmmc-supply = <&wl12xx_vmmc>;
72 non-removable;
73 bus-width = <4>;
74 cap-power-off-card;
75};
76
77&twl_gpio {
78 ti,use-leds;
79};
80
81&usb_otg_hs {
82 interface-type = <0>;
83 usb-phy = <&usb2_phy>;
84 phys = <&usb2_phy>;
85 phy-names = "usb2-phy";
86 mode = <3>;
87 power = <50>;
88};
89
90&gpmc {
91 ethernet@gpmc {
92 interrupt-parent = <&gpio6>;
93 interrupts = <16 8>;
94 reg = <5 0 0xff>;
95 };
96};
diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts
index 7d4329d179c4..e10dcd0fa539 100644
--- a/arch/arm/boot/dts/omap3-evm.dts
+++ b/arch/arm/boot/dts/omap3-evm.dts
@@ -8,68 +8,14 @@
8/dts-v1/; 8/dts-v1/;
9 9
10#include "omap34xx.dtsi" 10#include "omap34xx.dtsi"
11#include "omap3-evm-common.dtsi"
11 12
12/ { 13/ {
13 model = "TI OMAP3 EVM (OMAP3530, AM/DM37x)"; 14 model = "TI OMAP35XX EVM (TMDSEVM3530)";
14 compatible = "ti,omap3-evm", "ti,omap3"; 15 compatible = "ti,omap3-evm", "ti,omap3";
15 16
16 cpus {
17 cpu@0 {
18 cpu0-supply = <&vcc>;
19 };
20 };
21
22 memory { 17 memory {
23 device_type = "memory"; 18 device_type = "memory";
24 reg = <0x80000000 0x10000000>; /* 256 MB */ 19 reg = <0x80000000 0x10000000>; /* 256 MB */
25 }; 20 };
26
27 leds {
28 compatible = "gpio-leds";
29 ledb {
30 label = "omap3evm::ledb";
31 gpios = <&twl_gpio 19 GPIO_ACTIVE_HIGH>; /* LEDB */
32 linux,default-trigger = "default-on";
33 };
34 };
35};
36
37&i2c1 {
38 clock-frequency = <2600000>;
39
40 twl: twl@48 {
41 reg = <0x48>;
42 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
43 interrupt-parent = <&intc>;
44 };
45};
46
47#include "twl4030.dtsi"
48#include "twl4030_omap3.dtsi"
49
50&i2c2 {
51 clock-frequency = <400000>;
52};
53
54&i2c3 {
55 clock-frequency = <400000>;
56
57 /*
58 * TVP5146 Video decoder-in for analog input support.
59 */
60 tvp5146@5c {
61 compatible = "ti,tvp5146m2";
62 reg = <0x5c>;
63 };
64};
65
66&twl_gpio {
67 ti,use-leds;
68};
69
70&usb_otg_hs {
71 interface-type = <0>;
72 usb-phy = <&usb2_phy>;
73 mode = <3>;
74 power = <50>;
75}; 21};
diff --git a/arch/arm/boot/dts/omap3-gta04.dts b/arch/arm/boot/dts/omap3-gta04.dts
new file mode 100644
index 000000000000..b9b55c95a566
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-gta04.dts
@@ -0,0 +1,170 @@
1/*
2 * Copyright (C) 2013 Marek Belisko <marek@goldelico.com>
3 *
4 * Based on omap3-beagle-xm.dts
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/dts-v1/;
11
12#include "omap36xx.dtsi"
13
14/ {
15 model = "OMAP3 GTA04";
16 compatible = "ti,omap3-gta04", "ti,omap3";
17
18 cpus {
19 cpu@0 {
20 cpu0-supply = <&vcc>;
21 };
22 };
23
24 memory {
25 device_type = "memory";
26 reg = <0x80000000 0x20000000>; /* 512 MB */
27 };
28
29 gpio-keys {
30 compatible = "gpio-keys";
31
32 aux-button {
33 label = "aux";
34 linux,code = <169>;
35 gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
36 gpio-key,wakeup;
37 };
38 };
39};
40
41&omap3_pmx_core {
42 uart1_pins: pinmux_uart1_pins {
43 pinctrl-single,pins = <
44 0x152 (PIN_INPUT | MUX_MODE0) /* uart1_rx.uart1_rx */
45 0x14c (PIN_OUTPUT |MUX_MODE0) /* uart1_tx.uart1_tx */
46 >;
47 };
48
49 uart2_pins: pinmux_uart2_pins {
50 pinctrl-single,pins = <
51 0x14a (PIN_INPUT | MUX_MODE0) /* uart2_rx.uart2_rx */
52 0x148 (PIN_OUTPUT | MUX_MODE0) /* uart2_tx.uart2_tx */
53 >;
54 };
55
56 uart3_pins: pinmux_uart3_pins {
57 pinctrl-single,pins = <
58 0x16e (PIN_INPUT | MUX_MODE0) /* uart3_rx.uart3_rx */
59 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx.uart3_tx */
60 >;
61 };
62
63 mmc1_pins: pinmux_mmc1_pins {
64 pinctrl-single,pins = <
65 0x114 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_clk.sdmmc1_clk */
66 0x116 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_cmd.sdmmc1_cmd */
67 0x118 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat0.sdmmc1_dat0 */
68 0x11a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat1.sdmmc1_dat1 */
69 0x11c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat2.sdmmc1_dat2 */
70 0x11e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat3.sdmmc1_dat3 */
71 >;
72 };
73};
74
75&i2c1 {
76 clock-frequency = <2600000>;
77
78 twl: twl@48 {
79 reg = <0x48>;
80 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
81 interrupt-parent = <&intc>;
82 };
83};
84
85#include "twl4030.dtsi"
86#include "twl4030_omap3.dtsi"
87
88&i2c2 {
89 clock-frequency = <400000>;
90
91 /* pressure sensor */
92 bmp085@77 {
93 compatible = "bosch,bmp085";
94 reg = <0x77>;
95 };
96
97 /* leds */
98 tca6507@45 {
99 compatible = "ti,tca6507";
100 #address-cells = <1>;
101 #size-cells = <0>;
102 reg = <0x45>;
103
104 gta04_led0: red_aux@0 {
105 label = "gta04:red:aux";
106 reg = <0x0>;
107 };
108
109 gta04_led1: green_aux@1 {
110 label = "gta04:green:aux";
111 reg = <0x1>;
112 };
113
114 gta04_led3: red_power@3 {
115 label = "gta04:red:power";
116 reg = <0x3>;
117 linux,default-trigger = "default-on";
118 };
119
120 gta04_led4: green_power@4 {
121 label = "gta04:green:power";
122 reg = <0x4>;
123 };
124 };
125};
126
127&i2c3 {
128 clock-frequency = <100000>;
129};
130
131&usb_otg_hs {
132 interface-type = <0>;
133 usb-phy = <&usb2_phy>;
134 phys = <&usb2_phy>;
135 phy-names = "usb2-phy";
136 mode = <3>;
137 power = <50>;
138};
139
140&mmc1 {
141 pinctrl-names = "default";
142 pinctrl-0 = <&mmc1_pins>;
143 vmmc-supply = <&vmmc1>;
144 vmmc_aux-supply = <&vsim>;
145 bus-width = <4>;
146};
147
148&mmc2 {
149 status = "disabled";
150};
151
152&mmc3 {
153 status = "disabled";
154};
155
156&uart1 {
157 pinctrl-names = "default";
158 pinctrl-0 = <&uart1_pins>;
159};
160
161&uart2 {
162 pinctrl-names = "default";
163 pinctrl-0 = <&uart2_pins>;
164};
165
166&uart3 {
167 pinctrl-names = "default";
168 pinctrl-0 = <&uart3_pins>;
169};
170
diff --git a/arch/arm/boot/dts/omap3-igep.dtsi b/arch/arm/boot/dts/omap3-igep.dtsi
index bc48b114eae6..ba1e58b7b7e3 100644
--- a/arch/arm/boot/dts/omap3-igep.dtsi
+++ b/arch/arm/boot/dts/omap3-igep.dtsi
@@ -48,6 +48,15 @@
48 >; 48 >;
49 }; 49 };
50 50
51 mcbsp2_pins: pinmux_mcbsp2_pins {
52 pinctrl-single,pins = <
53 0x10c (PIN_INPUT | MUX_MODE0) /* mcbsp2_fsx.mcbsp2_fsx */
54 0x10e (PIN_INPUT | MUX_MODE0) /* mcbsp2_clkx.mcbsp2_clkx */
55 0x110 (PIN_INPUT | MUX_MODE0) /* mcbsp2_dr.mcbsp2.dr */
56 0x112 (PIN_OUTPUT | MUX_MODE0) /* mcbsp2_dx.mcbsp2_dx */
57 >;
58 };
59
51 mmc1_pins: pinmux_mmc1_pins { 60 mmc1_pins: pinmux_mmc1_pins {
52 pinctrl-single,pins = < 61 pinctrl-single,pins = <
53 0x114 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_clk.sdmmc1_clk */ 62 0x114 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_clk.sdmmc1_clk */
@@ -68,6 +77,8 @@
68 0x1a2 (PIN_INPUT | MUX_MODE4) /* mcspi1_cs2.gpio_176 */ 77 0x1a2 (PIN_INPUT | MUX_MODE4) /* mcspi1_cs2.gpio_176 */
69 >; 78 >;
70 }; 79 };
80
81 leds_pins: pinmux_leds_pins { };
71}; 82};
72 83
73&i2c1 { 84&i2c1 {
@@ -93,6 +104,11 @@
93 clock-frequency = <400000>; 104 clock-frequency = <400000>;
94}; 105};
95 106
107&mcbsp2 {
108 pinctrl-names = "default";
109 pinctrl-0 = <&mcbsp2_pins>;
110};
111
96&mmc1 { 112&mmc1 {
97 pinctrl-names = "default"; 113 pinctrl-names = "default";
98 pinctrl-0 = <&mmc1_pins>; 114 pinctrl-0 = <&mmc1_pins>;
@@ -127,3 +143,12 @@
127&twl_gpio { 143&twl_gpio {
128 ti,use-leds; 144 ti,use-leds;
129}; 145};
146
147&usb_otg_hs {
148 interface-type = <0>;
149 usb-phy = <&usb2_phy>;
150 phys = <&usb2_phy>;
151 phy-names = "usb2-phy";
152 mode = <3>;
153 power = <50>;
154};
diff --git a/arch/arm/boot/dts/omap3-igep0020.dts b/arch/arm/boot/dts/omap3-igep0020.dts
index e8c48284587c..d5cc79267250 100644
--- a/arch/arm/boot/dts/omap3-igep0020.dts
+++ b/arch/arm/boot/dts/omap3-igep0020.dts
@@ -10,13 +10,17 @@
10 */ 10 */
11 11
12#include "omap3-igep.dtsi" 12#include "omap3-igep.dtsi"
13#include "omap-gpmc-smsc911x.dtsi"
13 14
14/ { 15/ {
15 model = "IGEPv2"; 16 model = "IGEPv2";
16 compatible = "isee,omap3-igep0020", "ti,omap3"; 17 compatible = "isee,omap3-igep0020", "ti,omap3";
17 18
18 leds { 19 leds {
20 pinctrl-names = "default";
21 pinctrl-0 = <&leds_pins>;
19 compatible = "gpio-leds"; 22 compatible = "gpio-leds";
23
20 boot { 24 boot {
21 label = "omap3:green:boot"; 25 label = "omap3:green:boot";
22 gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>; 26 gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
@@ -41,19 +45,56 @@
41 }; 45 };
42 }; 46 };
43 47
44 vddvario: regulator-vddvario { 48 /* HS USB Port 1 Power */
45 compatible = "regulator-fixed"; 49 hsusb1_power: hsusb1_power_reg {
46 regulator-name = "vddvario"; 50 compatible = "regulator-fixed";
47 regulator-always-on; 51 regulator-name = "hsusb1_vbus";
52 regulator-min-microvolt = <3300000>;
53 regulator-max-microvolt = <3300000>;
54 gpio = <&twl_gpio 18 GPIO_ACTIVE_LOW>; /* GPIO LEDA */
55 startup-delay-us = <70000>;
56 };
57
58 /* HS USB Host PHY on PORT 1 */
59 hsusb1_phy: hsusb1_phy {
60 compatible = "usb-nop-xceiv";
61 reset-gpios = <&gpio1 24 GPIO_ACTIVE_LOW>; /* gpio_24 */
62 vcc-supply = <&hsusb1_power>;
48 }; 63 };
64};
49 65
50 vdd33a: regulator-vdd33a { 66&omap3_pmx_core {
51 compatible = "regulator-fixed"; 67 pinctrl-names = "default";
52 regulator-name = "vdd33a"; 68 pinctrl-0 = <
53 regulator-always-on; 69 &hsusbb1_pins
70 >;
71
72 hsusbb1_pins: pinmux_hsusbb1_pins {
73 pinctrl-single,pins = <
74 0x5aa (PIN_OUTPUT | MUX_MODE3) /* etk_ctl.hsusb1_clk */
75 0x5a8 (PIN_OUTPUT | MUX_MODE3) /* etk_clk.hsusb1_stp */
76 0x5bc (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d8.hsusb1_dir */
77 0x5be (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d9.hsusb1_nxt */
78 0x5ac (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d0.hsusb1_data0 */
79 0x5ae (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d1.hsusb1_data1 */
80 0x5b0 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d2.hsusb1_data2 */
81 0x5b2 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d3.hsusb1_data7 */
82 0x5b4 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d4.hsusb1_data4 */
83 0x5b6 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d5.hsusb1_data5 */
84 0x5b8 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d6.hsusb1_data6 */
85 0x5ba (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d7.hsusb1_data3 */
86 >;
54 }; 87 };
55}; 88};
56 89
90&leds_pins {
91 pinctrl-single,pins = <
92 0x5c4 (PIN_OUTPUT | MUX_MODE4) /* etk_d12.gpio_26 */
93 0x5c6 (PIN_OUTPUT | MUX_MODE4) /* etk_d13.gpio_27 */
94 0x5c8 (PIN_OUTPUT | MUX_MODE4) /* etk_d14.gpio_28 */
95 >;
96};
97
57&i2c3 { 98&i2c3 {
58 clock-frequency = <100000>; 99 clock-frequency = <100000>;
59 100
@@ -99,59 +140,37 @@
99 label = "SPL"; 140 label = "SPL";
100 reg = <0 0x100000>; 141 reg = <0 0x100000>;
101 }; 142 };
102 partition@0x80000 { 143 partition@80000 {
103 label = "U-Boot"; 144 label = "U-Boot";
104 reg = <0x100000 0x180000>; 145 reg = <0x100000 0x180000>;
105 }; 146 };
106 partition@0x1c0000 { 147 partition@1c0000 {
107 label = "Environment"; 148 label = "Environment";
108 reg = <0x280000 0x100000>; 149 reg = <0x280000 0x100000>;
109 }; 150 };
110 partition@0x280000 { 151 partition@280000 {
111 label = "Kernel"; 152 label = "Kernel";
112 reg = <0x380000 0x300000>; 153 reg = <0x380000 0x300000>;
113 }; 154 };
114 partition@0x780000 { 155 partition@780000 {
115 label = "Filesystem"; 156 label = "Filesystem";
116 reg = <0x680000 0x1f980000>; 157 reg = <0x680000 0x1f980000>;
117 }; 158 };
118 }; 159 };
119 160
120 ethernet@5,0 { 161 ethernet@gpmc {
121 pinctrl-names = "default"; 162 pinctrl-names = "default";
122 pinctrl-0 = <&smsc911x_pins>; 163 pinctrl-0 = <&smsc911x_pins>;
123 compatible = "smsc,lan9221", "smsc,lan9115";
124 reg = <5 0 0xff>; 164 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>; 165 interrupt-parent = <&gpio6>;
150 interrupts = <16 8>; 166 interrupts = <16 IRQ_TYPE_LEVEL_LOW>;
151 vmmc-supply = <&vddvario>;
152 vmmc_aux-supply = <&vdd33a>;
153 reg-io-width = <4>;
154
155 smsc,save-mac-address;
156 }; 167 };
157}; 168};
169
170&usbhshost {
171 port1-mode = "ehci-phy";
172};
173
174&usbhsehci {
175 phys = <&hsusb1_phy>;
176};
diff --git a/arch/arm/boot/dts/omap3-igep0030.dts b/arch/arm/boot/dts/omap3-igep0030.dts
index 644d05383836..525e6d9b0978 100644
--- a/arch/arm/boot/dts/omap3-igep0030.dts
+++ b/arch/arm/boot/dts/omap3-igep0030.dts
@@ -16,7 +16,10 @@
16 compatible = "isee,omap3-igep0030", "ti,omap3"; 16 compatible = "isee,omap3-igep0030", "ti,omap3";
17 17
18 leds { 18 leds {
19 pinctrl-names = "default";
20 pinctrl-0 = <&leds_pins>;
19 compatible = "gpio-leds"; 21 compatible = "gpio-leds";
22
20 boot { 23 boot {
21 label = "omap3:green:boot"; 24 label = "omap3:green:boot";
22 gpios = <&twl_gpio 13 GPIO_ACTIVE_LOW>; 25 gpios = <&twl_gpio 13 GPIO_ACTIVE_LOW>;
@@ -43,6 +46,12 @@
43 }; 46 };
44}; 47};
45 48
49&leds_pins {
50 pinctrl-single,pins = <
51 0x5b0 (PIN_OUTPUT | MUX_MODE4) /* etk_d2.gpio_16 */
52 >;
53};
54
46&gpmc { 55&gpmc {
47 ranges = <0 0 0x00000000 0x20000000>; 56 ranges = <0 0 0x00000000 0x20000000>;
48 57
@@ -74,19 +83,19 @@
74 label = "SPL"; 83 label = "SPL";
75 reg = <0 0x100000>; 84 reg = <0 0x100000>;
76 }; 85 };
77 partition@0x80000 { 86 partition@80000 {
78 label = "U-Boot"; 87 label = "U-Boot";
79 reg = <0x100000 0x180000>; 88 reg = <0x100000 0x180000>;
80 }; 89 };
81 partition@0x1c0000 { 90 partition@1c0000 {
82 label = "Environment"; 91 label = "Environment";
83 reg = <0x280000 0x100000>; 92 reg = <0x280000 0x100000>;
84 }; 93 };
85 partition@0x280000 { 94 partition@280000 {
86 label = "Kernel"; 95 label = "Kernel";
87 reg = <0x380000 0x300000>; 96 reg = <0x380000 0x300000>;
88 }; 97 };
89 partition@0x780000 { 98 partition@780000 {
90 label = "Filesystem"; 99 label = "Filesystem";
91 reg = <0x680000 0x1f980000>; 100 reg = <0x680000 0x1f980000>;
92 }; 101 };
diff --git a/arch/arm/boot/dts/omap3-n9.dts b/arch/arm/boot/dts/omap3-n9.dts
new file mode 100644
index 000000000000..39828ce464ee
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-n9.dts
@@ -0,0 +1,18 @@
1/*
2 * omap3-n9.dts - Device Tree file for Nokia N9
3 *
4 * Written by: Aaro Koskinen <aaro.koskinen@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 version 2 as
8 * published by the Free Software Foundation.
9 */
10
11/dts-v1/;
12
13#include "omap3-n950-n9.dtsi"
14
15/ {
16 model = "Nokia N9";
17 compatible = "nokia,omap3-n9", "ti,omap3";
18};
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts
new file mode 100644
index 000000000000..c4f20bfe4cce
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-n900.dts
@@ -0,0 +1,484 @@
1/*
2 * Copyright (C) 2013 Pavel Machek <pavel@ucw.cz>
3 * Copyright 2013 Aaro Koskinen <aaro.koskinen@iki.fi>
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 (or later) as
7 * published by the Free Software Foundation.
8 */
9
10/dts-v1/;
11
12#include "omap34xx.dtsi"
13
14/ {
15 model = "Nokia N900";
16 compatible = "nokia,omap3-n900", "ti,omap3";
17
18 cpus {
19 cpu@0 {
20 cpu0-supply = <&vcc>;
21 };
22 };
23
24 memory {
25 device_type = "memory";
26 reg = <0x80000000 0x10000000>; /* 256 MB */
27 };
28
29 gpio_keys {
30 compatible = "gpio-keys";
31
32 camera_lens_cover {
33 label = "Camera Lens Cover";
34 gpios = <&gpio4 14 GPIO_ACTIVE_LOW>; /* 110 */
35 linux,input-type = <5>; /* EV_SW */
36 linux,code = <0x09>; /* SW_CAMERA_LENS_COVER */
37 gpio-key,wakeup;
38 };
39
40 camera_focus {
41 label = "Camera Focus";
42 gpios = <&gpio3 4 GPIO_ACTIVE_LOW>; /* 68 */
43 linux,code = <0x210>; /* KEY_CAMERA_FOCUS */
44 gpio-key,wakeup;
45 };
46
47 camera_capture {
48 label = "Camera Capture";
49 gpios = <&gpio3 5 GPIO_ACTIVE_LOW>; /* 69 */
50 linux,code = <0xd4>; /* KEY_CAMERA */
51 gpio-key,wakeup;
52 };
53
54 lock_button {
55 label = "Lock Button";
56 gpios = <&gpio4 17 GPIO_ACTIVE_LOW>; /* 113 */
57 linux,code = <0x98>; /* KEY_SCREENLOCK */
58 gpio-key,wakeup;
59 };
60
61 keypad_slide {
62 label = "Keypad Slide";
63 gpios = <&gpio3 7 GPIO_ACTIVE_LOW>; /* 71 */
64 linux,input-type = <5>; /* EV_SW */
65 linux,code = <0x0a>; /* SW_KEYPAD_SLIDE */
66 gpio-key,wakeup;
67 };
68
69 proximity_sensor {
70 label = "Proximity Sensor";
71 gpios = <&gpio3 25 GPIO_ACTIVE_HIGH>; /* 89 */
72 linux,input-type = <5>; /* EV_SW */
73 linux,code = <0x0b>; /* SW_FRONT_PROXIMITY */
74 };
75 };
76
77};
78
79&omap3_pmx_core {
80 pinctrl-names = "default";
81
82 uart2_pins: pinmux_uart2_pins {
83 pinctrl-single,pins = <
84 0x14a (PIN_INPUT | MUX_MODE0) /* uart2_rx */
85 0x148 (PIN_OUTPUT | MUX_MODE0) /* uart2_tx */
86 >;
87 };
88
89 uart3_pins: pinmux_uart3_pins {
90 pinctrl-single,pins = <
91 0x16e (PIN_INPUT | MUX_MODE0) /* uart3_rx */
92 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx */
93 >;
94 };
95
96 i2c1_pins: pinmux_i2c1_pins {
97 pinctrl-single,pins = <
98 0x18a (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_scl */
99 0x18c (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_sda */
100 >;
101 };
102
103 i2c2_pins: pinmux_i2c2_pins {
104 pinctrl-single,pins = <
105 0x18e (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c2_scl */
106 0x190 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c2_sda */
107 >;
108 };
109
110 i2c3_pins: pinmux_i2c3_pins {
111 pinctrl-single,pins = <
112 0x192 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_scl */
113 0x194 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_sda */
114 >;
115 };
116
117 mmc1_pins: pinmux_mmc1_pins {
118 pinctrl-single,pins = <
119 0x114 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_clk */
120 0x116 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_cmd */
121 0x118 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat0 */
122 0x11a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat1 */
123 0x11c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat2 */
124 0x11e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat3 */
125 >;
126 };
127
128 display_pins: pinmux_display_pins {
129 pinctrl-single,pins = <
130 0x0d4 (PIN_OUTPUT | MUX_MODE4) /* RX51_LCD_RESET_GPIO */
131 >;
132 };
133};
134
135&i2c1 {
136 pinctrl-names = "default";
137 pinctrl-0 = <&i2c1_pins>;
138
139 clock-frequency = <2200000>;
140
141 twl: twl@48 {
142 reg = <0x48>;
143 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
144 interrupt-parent = <&intc>;
145 };
146};
147
148#include "twl4030.dtsi"
149#include "twl4030_omap3.dtsi"
150
151&vaux1 {
152 regulator-name = "V28";
153 regulator-min-microvolt = <2800000>;
154 regulator-max-microvolt = <2800000>;
155 regulator-always-on; /* due battery cover sensor */
156};
157
158&vaux2 {
159 regulator-name = "VCSI";
160 regulator-min-microvolt = <1800000>;
161 regulator-max-microvolt = <1800000>;
162};
163
164&vaux3 {
165 regulator-name = "VMMC2_30";
166 regulator-min-microvolt = <2800000>;
167 regulator-max-microvolt = <3000000>;
168};
169
170&vaux4 {
171 regulator-name = "VCAM_ANA_28";
172 regulator-min-microvolt = <2800000>;
173 regulator-max-microvolt = <2800000>;
174};
175
176&vmmc1 {
177 regulator-name = "VMMC1";
178 regulator-min-microvolt = <1850000>;
179 regulator-max-microvolt = <3150000>;
180};
181
182&vmmc2 {
183 regulator-name = "V28_A";
184 regulator-min-microvolt = <2800000>;
185 regulator-max-microvolt = <3000000>;
186 regulator-always-on; /* due VIO leak to AIC34 VDDs */
187};
188
189&vpll1 {
190 regulator-name = "VPLL";
191 regulator-min-microvolt = <1800000>;
192 regulator-max-microvolt = <1800000>;
193 regulator-always-on;
194};
195
196&vpll2 {
197 regulator-name = "VSDI_CSI";
198 regulator-min-microvolt = <1800000>;
199 regulator-max-microvolt = <1800000>;
200 regulator-always-on;
201};
202
203&vsim {
204 regulator-name = "VMMC2_IO_18";
205 regulator-min-microvolt = <1800000>;
206 regulator-max-microvolt = <1800000>;
207};
208
209&vio {
210 regulator-name = "VIO";
211 regulator-min-microvolt = <1800000>;
212 regulator-max-microvolt = <1800000>;
213
214};
215
216&vintana1 {
217 regulator-name = "VINTANA1";
218 /* fixed to 1500000 */
219 regulator-always-on;
220};
221
222&vintana2 {
223 regulator-name = "VINTANA2";
224 regulator-min-microvolt = <2750000>;
225 regulator-max-microvolt = <2750000>;
226 regulator-always-on;
227};
228
229&vintdig {
230 regulator-name = "VINTDIG";
231 /* fixed to 1500000 */
232 regulator-always-on;
233};
234
235&twl {
236 twl_audio: audio {
237 compatible = "ti,twl4030-audio";
238 ti,enable-vibra = <1>;
239 };
240};
241
242&twl_gpio {
243 ti,pullups = <0x0>;
244 ti,pulldowns = <0x03ff3f>; /* BIT(0..5) | BIT(8..17) */
245};
246
247&i2c2 {
248 pinctrl-names = "default";
249 pinctrl-0 = <&i2c2_pins>;
250
251 clock-frequency = <100000>;
252
253 tlv320aic3x: tlv320aic3x@18 {
254 compatible = "ti,tlv320aic3x";
255 reg = <0x18>;
256 gpio-reset = <&gpio2 28 GPIO_ACTIVE_HIGH>; /* 60 */
257 ai3x-gpio-func = <
258 0 /* AIC3X_GPIO1_FUNC_DISABLED */
259 5 /* AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT */
260 >;
261
262 AVDD-supply = <&vmmc2>;
263 DRVDD-supply = <&vmmc2>;
264 IOVDD-supply = <&vio>;
265 DVDD-supply = <&vio>;
266 };
267
268 tlv320aic3x_aux: tlv320aic3x@19 {
269 compatible = "ti,tlv320aic3x";
270 reg = <0x19>;
271 gpio-reset = <&gpio2 28 GPIO_ACTIVE_HIGH>; /* 60 */
272
273 AVDD-supply = <&vmmc2>;
274 DRVDD-supply = <&vmmc2>;
275 IOVDD-supply = <&vio>;
276 DVDD-supply = <&vio>;
277 };
278
279 lp5523: lp5523@32 {
280 compatible = "national,lp5523";
281 reg = <0x32>;
282 clock-mode = /bits/ 8 <0>; /* LP55XX_CLOCK_AUTO */
283 enable-gpio = <&gpio2 9 GPIO_ACTIVE_HIGH>; /* 41 */
284
285 chan0 {
286 chan-name = "lp5523:kb1";
287 led-cur = /bits/ 8 <50>;
288 max-cur = /bits/ 8 <100>;
289 };
290
291 chan1 {
292 chan-name = "lp5523:kb2";
293 led-cur = /bits/ 8 <50>;
294 max-cur = /bits/ 8 <100>;
295 };
296
297 chan2 {
298 chan-name = "lp5523:kb3";
299 led-cur = /bits/ 8 <50>;
300 max-cur = /bits/ 8 <100>;
301 };
302
303 chan3 {
304 chan-name = "lp5523:kb4";
305 led-cur = /bits/ 8 <50>;
306 max-cur = /bits/ 8 <100>;
307 };
308
309 chan4 {
310 chan-name = "lp5523:b";
311 led-cur = /bits/ 8 <50>;
312 max-cur = /bits/ 8 <100>;
313 };
314
315 chan5 {
316 chan-name = "lp5523:g";
317 led-cur = /bits/ 8 <50>;
318 max-cur = /bits/ 8 <100>;
319 };
320
321 chan6 {
322 chan-name = "lp5523:r";
323 led-cur = /bits/ 8 <50>;
324 max-cur = /bits/ 8 <100>;
325 };
326
327 chan7 {
328 chan-name = "lp5523:kb5";
329 led-cur = /bits/ 8 <50>;
330 max-cur = /bits/ 8 <100>;
331 };
332
333 chan8 {
334 chan-name = "lp5523:kb6";
335 led-cur = /bits/ 8 <50>;
336 max-cur = /bits/ 8 <100>;
337 };
338 };
339
340 bq27200: bq27200@55 {
341 compatible = "ti,bq27200";
342 reg = <0x55>;
343 };
344};
345
346&i2c3 {
347 pinctrl-names = "default";
348 pinctrl-0 = <&i2c3_pins>;
349
350 clock-frequency = <400000>;
351};
352
353&mmc1 {
354 pinctrl-names = "default";
355 pinctrl-0 = <&mmc1_pins>;
356 vmmc-supply = <&vmmc1>;
357 bus-width = <4>;
358 cd-gpios = <&gpio6 0 GPIO_ACTIVE_HIGH>; /* 160 */
359};
360
361&mmc2 {
362 status = "disabled";
363};
364
365&mmc3 {
366 status = "disabled";
367};
368
369&gpmc {
370 ranges = <0 0 0x04000000 0x10000000>; /* 256MB */
371
372 /* gpio-irq for dma: 65 */
373
374 onenand@0,0 {
375 #address-cells = <1>;
376 #size-cells = <1>;
377 reg = <0 0 0x10000000>;
378
379 gpmc,sync-read;
380 gpmc,sync-write;
381 gpmc,burst-length = <16>;
382 gpmc,burst-read;
383 gpmc,burst-wrap;
384 gpmc,burst-write;
385 gpmc,device-width = <2>; /* GPMC_DEVWIDTH_16BIT */
386 gpmc,mux-add-data = <2>; /* GPMC_MUX_AD */
387 gpmc,cs-on-ns = <0>;
388 gpmc,cs-rd-off-ns = <87>;
389 gpmc,cs-wr-off-ns = <87>;
390 gpmc,adv-on-ns = <0>;
391 gpmc,adv-rd-off-ns = <10>;
392 gpmc,adv-wr-off-ns = <10>;
393 gpmc,oe-on-ns = <15>;
394 gpmc,oe-off-ns = <87>;
395 gpmc,we-on-ns = <0>;
396 gpmc,we-off-ns = <87>;
397 gpmc,rd-cycle-ns = <112>;
398 gpmc,wr-cycle-ns = <112>;
399 gpmc,access-ns = <81>;
400 gpmc,page-burst-access-ns = <15>;
401 gpmc,bus-turnaround-ns = <0>;
402 gpmc,cycle2cycle-delay-ns = <0>;
403 gpmc,wait-monitoring-ns = <0>;
404 gpmc,clk-activation-ns = <5>;
405 gpmc,wr-data-mux-bus-ns = <30>;
406 gpmc,wr-access-ns = <81>;
407 gpmc,sync-clk-ps = <15000>;
408
409 /*
410 * MTD partition table corresponding to Nokia's
411 * Maemo 5 (Fremantle) release.
412 */
413 partition@0 {
414 label = "bootloader";
415 reg = <0x00000000 0x00020000>;
416 read-only;
417 };
418 partition@1 {
419 label = "config";
420 reg = <0x00020000 0x00060000>;
421 };
422 partition@2 {
423 label = "log";
424 reg = <0x00080000 0x00040000>;
425 };
426 partition@3 {
427 label = "kernel";
428 reg = <0x000c0000 0x00200000>;
429 };
430 partition@4 {
431 label = "initfs";
432 reg = <0x002c0000 0x00200000>;
433 };
434 partition@5 {
435 label = "rootfs";
436 reg = <0x004c0000 0x0fb40000>;
437 };
438 };
439};
440
441&mcspi1 {
442 /*
443 * For some reason, touchscreen is necessary for screen to work at
444 * all on real hw. It works well without it on emulator.
445 *
446 * Also... order in the device tree actually matters here.
447 */
448 tsc2005@0 {
449 compatible = "tsc2005";
450 spi-max-frequency = <6000000>;
451 reg = <0>;
452 };
453 mipid@2 {
454 compatible = "acx565akm";
455 spi-max-frequency = <6000000>;
456 reg = <2>;
457
458 pinctrl-names = "default";
459 pinctrl-0 = <&display_pins>;
460 };
461};
462
463&usb_otg_hs {
464 interface-type = <0>;
465 usb-phy = <&usb2_phy>;
466 phys = <&usb2_phy>;
467 phy-names = "usb2-phy";
468 mode = <2>;
469 power = <50>;
470};
471
472&uart1 {
473 status = "disabled";
474};
475
476&uart2 {
477 pinctrl-names = "default";
478 pinctrl-0 = <&uart2_pins>;
479};
480
481&uart3 {
482 pinctrl-names = "default";
483 pinctrl-0 = <&uart3_pins>;
484};
diff --git a/arch/arm/boot/dts/omap3-n950-n9.dtsi b/arch/arm/boot/dts/omap3-n950-n9.dtsi
new file mode 100644
index 000000000000..94eb77d3b9dd
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-n950-n9.dtsi
@@ -0,0 +1,174 @@
1/*
2 * omap3-n950-n9.dtsi - Device Tree file for Nokia N950 & N9 (common stuff)
3 *
4 * Written by: Aaro Koskinen <aaro.koskinen@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 version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include "omap36xx.dtsi"
12
13/ {
14 cpus {
15 cpu@0 {
16 cpu0-supply = <&vcc>;
17 };
18 };
19
20 memory {
21 device_type = "memory";
22 reg = <0x80000000 0x40000000>; /* 1 GB */
23 };
24
25 vemmc: fixedregulator@0 {
26 compatible = "regulator-fixed";
27 regulator-name = "VEMMC";
28 regulator-min-microvolt = <2900000>;
29 regulator-max-microvolt = <2900000>;
30 gpio = <&gpio5 29 0>; /* gpio line 157 */
31 startup-delay-us = <150>;
32 enable-active-high;
33 };
34};
35
36&omap3_pmx_core {
37 mmc2_pins: pinmux_mmc2_pins {
38 pinctrl-single,pins = <
39 0x128 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_clk */
40 0x12a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_cmd */
41 0x12c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat0 */
42 0x12e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat1 */
43 0x130 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat2 */
44 0x132 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat3 */
45 >;
46 };
47};
48
49&i2c1 {
50 clock-frequency = <2900000>;
51
52 twl: twl@48 {
53 reg = <0x48>;
54 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
55 interrupt-parent = <&intc>;
56 };
57};
58
59/include/ "twl4030.dtsi"
60
61&twl {
62 compatible = "ti,twl5031";
63};
64
65&twl_gpio {
66 ti,pullups = <0x000001>; /* BIT(0) */
67 ti,pulldowns = <0x008106>; /* BIT(1) | BIT(2) | BIT(8) | BIT(15) */
68};
69
70&i2c2 {
71 clock-frequency = <400000>;
72};
73
74&i2c3 {
75 clock-frequency = <400000>;
76};
77
78&mmc1 {
79 status = "disabled";
80};
81
82&mmc2 {
83 pinctrl-names = "default";
84 pinctrl-0 = <&mmc2_pins>;
85 vmmc-supply = <&vemmc>;
86 bus-width = <4>;
87 ti,non-removable;
88};
89
90&mmc3 {
91 status = "disabled";
92};
93
94&usb_otg_hs {
95 interface-type = <0>;
96 usb-phy = <&usb2_phy>;
97 phys = <&usb2_phy>;
98 phy-names = "usb2-phy";
99 mode = <3>;
100 power = <50>;
101};
102
103&gpmc {
104 ranges = <0 0 0x04000000 0x20000000>;
105
106 onenand@0,0 {
107 #address-cells = <1>;
108 #size-cells = <1>;
109 reg = <0 0 0x20000000>;
110
111 gpmc,sync-read;
112 gpmc,sync-write;
113 gpmc,burst-length = <16>;
114 gpmc,burst-read;
115 gpmc,burst-wrap;
116 gpmc,burst-write;
117 gpmc,device-width = <2>;
118 gpmc,mux-add-data = <2>;
119 gpmc,cs-on-ns = <0>;
120 gpmc,cs-rd-off-ns = <87>;
121 gpmc,cs-wr-off-ns = <87>;
122 gpmc,adv-on-ns = <0>;
123 gpmc,adv-rd-off-ns = <10>;
124 gpmc,adv-wr-off-ns = <10>;
125 gpmc,oe-on-ns = <15>;
126 gpmc,oe-off-ns = <87>;
127 gpmc,we-on-ns = <0>;
128 gpmc,we-off-ns = <87>;
129 gpmc,rd-cycle-ns = <112>;
130 gpmc,wr-cycle-ns = <112>;
131 gpmc,access-ns = <81>;
132 gpmc,page-burst-access-ns = <15>;
133 gpmc,bus-turnaround-ns = <0>;
134 gpmc,cycle2cycle-delay-ns = <0>;
135 gpmc,wait-monitoring-ns = <0>;
136 gpmc,clk-activation-ns = <5>;
137 gpmc,wr-data-mux-bus-ns = <30>;
138 gpmc,wr-access-ns = <81>;
139 gpmc,sync-clk-ps = <15000>;
140
141 /*
142 * MTD partition table corresponding to Nokia's MeeGo 1.2
143 * Harmattan release.
144 */
145 partition@0 {
146 label = "bootloader";
147 reg = <0x00000000 0x00100000>;
148 };
149 partition@1 {
150 label = "config";
151 reg = <0x00100000 0x002c0000>;
152 };
153 partition@2 {
154 label = "kernel";
155 reg = <0x003c0000 0x01000000>;
156 };
157 partition@3 {
158 label = "log";
159 reg = <0x013c0000 0x00200000>;
160 };
161 partition@4 {
162 label = "var";
163 reg = <0x015c0000 0x1ca40000>;
164 };
165 partition@5 {
166 label = "moslo";
167 reg = <0x1e000000 0x02000000>;
168 };
169 partition@6 {
170 label = "omap2-onenand";
171 reg = <0x00000000 0x20000000>;
172 };
173 };
174};
diff --git a/arch/arm/boot/dts/omap3-n950.dts b/arch/arm/boot/dts/omap3-n950.dts
new file mode 100644
index 000000000000..b076a526b999
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-n950.dts
@@ -0,0 +1,18 @@
1/*
2 * omap3-n950.dts - Device Tree file for Nokia N950
3 *
4 * Written by: Aaro Koskinen <aaro.koskinen@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 version 2 as
8 * published by the Free Software Foundation.
9 */
10
11/dts-v1/;
12
13#include "omap3-n950-n9.dtsi"
14
15/ {
16 model = "Nokia N950";
17 compatible = "nokia,omap3-n950", "ti,omap3";
18};
diff --git a/arch/arm/boot/dts/omap3-overo.dtsi b/arch/arm/boot/dts/omap3-overo.dtsi
index 8f1abec78275..a461d2fd1fb0 100644
--- a/arch/arm/boot/dts/omap3-overo.dtsi
+++ b/arch/arm/boot/dts/omap3-overo.dtsi
@@ -76,6 +76,8 @@
76&usb_otg_hs { 76&usb_otg_hs {
77 interface-type = <0>; 77 interface-type = <0>;
78 usb-phy = <&usb2_phy>; 78 usb-phy = <&usb2_phy>;
79 phys = <&usb2_phy>;
80 phy-names = "usb2-phy";
79 mode = <3>; 81 mode = <3>;
80 power = <50>; 82 power = <50>;
81}; 83};
diff --git a/arch/arm/boot/dts/omap3-zoom3.dts b/arch/arm/boot/dts/omap3-zoom3.dts
new file mode 100644
index 000000000000..15eb9fe5169c
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-zoom3.dts
@@ -0,0 +1,217 @@
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 "omap36xx.dtsi"
11#include "omap-zoom-common.dtsi"
12
13/ {
14 model = "TI Zoom3";
15 compatible = "ti,omap3-zoom3", "ti,omap36xx", "ti,omap3";
16
17 cpus {
18 cpu@0 {
19 cpu0-supply = <&vcc>;
20 };
21 };
22
23 memory {
24 device_type = "memory";
25 reg = <0x80000000 0x20000000>; /* 512 MB */
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 wl12xx_vmmc: wl12xx_vmmc {
41 pinctrl-names = "default";
42 pinctrl-0 = <&wl12xx_gpio>;
43 compatible = "regulator-fixed";
44 regulator-name = "vwl1271";
45 regulator-min-microvolt = <1800000>;
46 regulator-max-microvolt = <1800000>;
47 gpio = <&gpio4 5 0>; /* gpio101 */
48 startup-delay-us = <70000>;
49 enable-active-high;
50 };
51};
52
53&omap3_pmx_core {
54 /* REVISIT: twl gpio0 is mmc0_cd */
55 mmc1_pins: pinmux_mmc1_pins {
56 pinctrl-single,pins = <
57 0x114 (PIN_OUTPUT_PULLUP | MUX_MODE0) /* sdmmc1_clk.sdmmc1_clk */
58 0x116 (PIN_OUTPUT_PULLUP | MUX_MODE0) /* sdmmc1_cmd.sdmmc1_cmd */
59 0x118 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat0.sdmmc1_dat0 */
60 0x11a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat1.sdmmc1_dat1 */
61 0x11c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat2.sdmmc1_dat2 */
62 0x11e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat3.sdmmc1_dat3 */
63 >;
64 };
65
66 mmc2_pins: pinmux_mmc2_pins {
67 pinctrl-single,pins = <
68 0x128 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_clk.sdmmc2_clk */
69 0x12a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_cmd.sdmmc2_cmd */
70 0x12c (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat0.sdmmc2_dat0 */
71 0x12e (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat1.sdmmc2_dat1 */
72 0x130 (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat2.sdmmc2_dat2 */
73 0x132 (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat3.sdmmc2_dat3 */
74 0x134 (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat4.sdmmc2_dat4 */
75 0x136 (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat5.sdmmc2_dat5 */
76 0x138 (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat6.sdmmc2_dat6 */
77 0x13a (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat7.sdmmc2_dat7 */
78 >;
79 };
80
81 mmc3_pins: pinmux_mmc3_pins {
82 pinctrl-single,pins = <
83 0x168 (PIN_INPUT | MUX_MODE4) /* mcbsp1_clkx.gpio_162 WLAN IRQ */
84 0x1a0 (PIN_INPUT_PULLUP | MUX_MODE3) /* mcspi1_cs1.sdmmc3_cmd */
85 0x5a8 (PIN_INPUT_PULLUP | MUX_MODE2) /* etk_clk.sdmmc3_clk */
86 0x5b4 (PIN_INPUT_PULLUP | MUX_MODE2) /* etk_d4.sdmmc3_dat0 */
87 0x5b6 (WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE2) /* etk_d5.sdmmc3_dat1 */
88 0x5b8 (PIN_INPUT_PULLUP | MUX_MODE2) /* etk_d6.sdmmc3_dat2 */
89 0x5b2 (PIN_INPUT_PULLUP | MUX_MODE2) /* etk_d3.sdmmc3_dat3 */
90 >;
91 };
92
93 uart1_pins: pinmux_uart1_pins {
94 pinctrl-single,pins = <
95 0x150 (PIN_INPUT | MUX_MODE0) /* uart1_cts.uart1_cts */
96 0x14e (PIN_OUTPUT | MUX_MODE0) /* uart1_rts.uart1_rts */
97 0x152 (WAKEUP_EN | PIN_INPUT | MUX_MODE0) /* uart1_rx.uart1_rx */
98 0x14c (PIN_OUTPUT | MUX_MODE0) /* uart1_tx.uart1_tx */
99 >;
100 };
101
102 uart2_pins: pinmux_uart2_pins {
103 pinctrl-single,pins = <
104 0x144 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart2_cts.uart2_cts */
105 0x146 (PIN_OUTPUT | MUX_MODE0) /* uart2_rts.uart2_rts */
106 0x14a (WAKEUP_EN | PIN_INPUT | MUX_MODE0) /* uart2_rx.uart2_rx */
107 0x148 (PIN_OUTPUT | MUX_MODE0) /* uart2_tx.uart2_tx */
108 >;
109 };
110
111 uart3_pins: pinmux_uart3_pins {
112 pinctrl-single,pins = <
113 0x16a (PIN_INPUT_PULLDOWN | MUX_MODE0) /* uart3_cts_rctx.uart3_cts_rctx */
114 0x16c (PIN_OUTPUT | MUX_MODE0) /* uart3_rts_sd.uart3_rts_sd */
115 0x16e (WAKEUP_EN | PIN_INPUT | MUX_MODE0) /* uart3_rx_irrx.uart3_rx_irrx */
116 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx.uart3_tx_irtx */
117 >;
118 };
119
120 /* wl12xx GPIO output for WLAN_EN */
121 wl12xx_gpio: pinmux_wl12xx_gpio {
122 pinctrl-single,pins = <
123 0xea (PIN_OUTPUT| MUX_MODE4) /* cam_d2.gpio_101 */
124 >;
125 };
126};
127
128&omap3_pmx_wkup {
129 wlan_host_wkup: pinmux_wlan_host_wkup_pins {
130 pinctrl-single,pins = <
131 0x1a (PIN_INPUT_PULLUP | MUX_MODE4) /* sys_clkout1.gpio_10 WLAN_HOST_WKUP */
132 >;
133 };
134};
135
136&i2c1 {
137 clock-frequency = <2600000>;
138
139 twl: twl@48 {
140 reg = <0x48>;
141 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
142 interrupt-parent = <&intc>;
143 };
144};
145
146#include "twl4030.dtsi"
147
148&i2c2 {
149 clock-frequency = <400000>;
150};
151
152&i2c3 {
153 clock-frequency = <400000>;
154
155 /*
156 * TVP5146 Video decoder-in for analog input support.
157 */
158 tvp5146@5c {
159 compatible = "ti,tvp5146m2";
160 reg = <0x5c>;
161 };
162};
163
164&twl_gpio {
165 ti,use-leds;
166};
167
168&mmc1 {
169 vmmc-supply = <&vmmc1>;
170 vmmc_aux-supply = <&vsim>;
171 bus-width = <4>;
172 pinctrl-names = "default";
173 pinctrl-0 = <&mmc1_pins>;
174};
175/*
176&mmc2 {
177 vmmc-supply = <&vmmc2>;
178 ti,non-removable;
179 bus-width = <8>;
180 pinctrl-names = "default";
181 pinctrl-0 = <&mmc2_pins>;
182};
183*/
184&mmc3 {
185 vmmc-supply = <&wl12xx_vmmc>;
186 non-removable;
187 bus-width = <4>;
188 cap-power-off-card;
189 pinctrl-names = "default";
190 pinctrl-0 = <&mmc3_pins>;
191};
192
193&uart1 {
194 pinctrl-names = "default";
195 pinctrl-0 = <&uart1_pins>;
196};
197
198&uart2 {
199 pinctrl-names = "default";
200 pinctrl-0 = <&uart2_pins>;
201};
202
203&uart3 {
204 pinctrl-names = "default";
205 pinctrl-0 = <&uart3_pins>;
206};
207
208&uart4 {
209 status = "disabled";
210};
211
212&usb_otg_hs {
213 interface-type = <0>;
214 usb-phy = <&usb2_phy>;
215 mode = <3>;
216 power = <50>;
217};
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 7d95cda1fae4..f3a0c26ed0c2 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -19,6 +19,9 @@
19 interrupt-parent = <&intc>; 19 interrupt-parent = <&intc>;
20 20
21 aliases { 21 aliases {
22 i2c0 = &i2c1;
23 i2c1 = &i2c2;
24 i2c2 = &i2c3;
22 serial0 = &uart1; 25 serial0 = &uart1;
23 serial1 = &uart2; 26 serial1 = &uart2;
24 serial2 = &uart3; 27 serial2 = &uart3;
@@ -37,6 +40,7 @@
37 40
38 pmu { 41 pmu {
39 compatible = "arm,cortex-a8-pmu"; 42 compatible = "arm,cortex-a8-pmu";
43 reg = <0x54000000 0x800000>;
40 interrupts = <3>; 44 interrupts = <3>;
41 ti,hwmods = "debugss"; 45 ti,hwmods = "debugss";
42 }; 46 };
@@ -71,6 +75,8 @@
71 */ 75 */
72 ocp { 76 ocp {
73 compatible = "simple-bus"; 77 compatible = "simple-bus";
78 reg = <0x68000000 0x10000>;
79 interrupts = <9 10>;
74 #address-cells = <1>; 80 #address-cells = <1>;
75 #size-cells = <1>; 81 #size-cells = <1>;
76 ranges; 82 ranges;
@@ -107,17 +113,21 @@
107 reg = <0x48002030 0x05cc>; 113 reg = <0x48002030 0x05cc>;
108 #address-cells = <1>; 114 #address-cells = <1>;
109 #size-cells = <0>; 115 #size-cells = <0>;
116 #interrupt-cells = <1>;
117 interrupt-controller;
110 pinctrl-single,register-width = <16>; 118 pinctrl-single,register-width = <16>;
111 pinctrl-single,function-mask = <0x7f1f>; 119 pinctrl-single,function-mask = <0xff1f>;
112 }; 120 };
113 121
114 omap3_pmx_wkup: pinmux@0x48002a00 { 122 omap3_pmx_wkup: pinmux@48002a00 {
115 compatible = "ti,omap3-padconf", "pinctrl-single"; 123 compatible = "ti,omap3-padconf", "pinctrl-single";
116 reg = <0x48002a00 0x5c>; 124 reg = <0x48002a00 0x5c>;
117 #address-cells = <1>; 125 #address-cells = <1>;
118 #size-cells = <0>; 126 #size-cells = <0>;
127 #interrupt-cells = <1>;
128 interrupt-controller;
119 pinctrl-single,register-width = <16>; 129 pinctrl-single,register-width = <16>;
120 pinctrl-single,function-mask = <0x7f1f>; 130 pinctrl-single,function-mask = <0xff1f>;
121 }; 131 };
122 132
123 gpio1: gpio@48310000 { 133 gpio1: gpio@48310000 {
@@ -189,24 +199,40 @@
189 199
190 uart1: serial@4806a000 { 200 uart1: serial@4806a000 {
191 compatible = "ti,omap3-uart"; 201 compatible = "ti,omap3-uart";
202 reg = <0x4806a000 0x2000>;
203 interrupts = <72>;
204 dmas = <&sdma 49 &sdma 50>;
205 dma-names = "tx", "rx";
192 ti,hwmods = "uart1"; 206 ti,hwmods = "uart1";
193 clock-frequency = <48000000>; 207 clock-frequency = <48000000>;
194 }; 208 };
195 209
196 uart2: serial@4806c000 { 210 uart2: serial@4806c000 {
197 compatible = "ti,omap3-uart"; 211 compatible = "ti,omap3-uart";
212 reg = <0x4806c000 0x400>;
213 interrupts = <73>;
214 dmas = <&sdma 51 &sdma 52>;
215 dma-names = "tx", "rx";
198 ti,hwmods = "uart2"; 216 ti,hwmods = "uart2";
199 clock-frequency = <48000000>; 217 clock-frequency = <48000000>;
200 }; 218 };
201 219
202 uart3: serial@49020000 { 220 uart3: serial@49020000 {
203 compatible = "ti,omap3-uart"; 221 compatible = "ti,omap3-uart";
222 reg = <0x49020000 0x400>;
223 interrupts = <74>;
224 dmas = <&sdma 53 &sdma 54>;
225 dma-names = "tx", "rx";
204 ti,hwmods = "uart3"; 226 ti,hwmods = "uart3";
205 clock-frequency = <48000000>; 227 clock-frequency = <48000000>;
206 }; 228 };
207 229
208 i2c1: i2c@48070000 { 230 i2c1: i2c@48070000 {
209 compatible = "ti,omap3-i2c"; 231 compatible = "ti,omap3-i2c";
232 reg = <0x48070000 0x80>;
233 interrupts = <56>;
234 dmas = <&sdma 27 &sdma 28>;
235 dma-names = "tx", "rx";
210 #address-cells = <1>; 236 #address-cells = <1>;
211 #size-cells = <0>; 237 #size-cells = <0>;
212 ti,hwmods = "i2c1"; 238 ti,hwmods = "i2c1";
@@ -214,6 +240,10 @@
214 240
215 i2c2: i2c@48072000 { 241 i2c2: i2c@48072000 {
216 compatible = "ti,omap3-i2c"; 242 compatible = "ti,omap3-i2c";
243 reg = <0x48072000 0x80>;
244 interrupts = <57>;
245 dmas = <&sdma 29 &sdma 30>;
246 dma-names = "tx", "rx";
217 #address-cells = <1>; 247 #address-cells = <1>;
218 #size-cells = <0>; 248 #size-cells = <0>;
219 ti,hwmods = "i2c2"; 249 ti,hwmods = "i2c2";
@@ -221,6 +251,10 @@
221 251
222 i2c3: i2c@48060000 { 252 i2c3: i2c@48060000 {
223 compatible = "ti,omap3-i2c"; 253 compatible = "ti,omap3-i2c";
254 reg = <0x48060000 0x80>;
255 interrupts = <61>;
256 dmas = <&sdma 25 &sdma 26>;
257 dma-names = "tx", "rx";
224 #address-cells = <1>; 258 #address-cells = <1>;
225 #size-cells = <0>; 259 #size-cells = <0>;
226 ti,hwmods = "i2c3"; 260 ti,hwmods = "i2c3";
@@ -228,6 +262,8 @@
228 262
229 mcspi1: spi@48098000 { 263 mcspi1: spi@48098000 {
230 compatible = "ti,omap2-mcspi"; 264 compatible = "ti,omap2-mcspi";
265 reg = <0x48098000 0x100>;
266 interrupts = <65>;
231 #address-cells = <1>; 267 #address-cells = <1>;
232 #size-cells = <0>; 268 #size-cells = <0>;
233 ti,hwmods = "mcspi1"; 269 ti,hwmods = "mcspi1";
@@ -246,6 +282,8 @@
246 282
247 mcspi2: spi@4809a000 { 283 mcspi2: spi@4809a000 {
248 compatible = "ti,omap2-mcspi"; 284 compatible = "ti,omap2-mcspi";
285 reg = <0x4809a000 0x100>;
286 interrupts = <66>;
249 #address-cells = <1>; 287 #address-cells = <1>;
250 #size-cells = <0>; 288 #size-cells = <0>;
251 ti,hwmods = "mcspi2"; 289 ti,hwmods = "mcspi2";
@@ -259,6 +297,8 @@
259 297
260 mcspi3: spi@480b8000 { 298 mcspi3: spi@480b8000 {
261 compatible = "ti,omap2-mcspi"; 299 compatible = "ti,omap2-mcspi";
300 reg = <0x480b8000 0x100>;
301 interrupts = <91>;
262 #address-cells = <1>; 302 #address-cells = <1>;
263 #size-cells = <0>; 303 #size-cells = <0>;
264 ti,hwmods = "mcspi3"; 304 ti,hwmods = "mcspi3";
@@ -272,6 +312,8 @@
272 312
273 mcspi4: spi@480ba000 { 313 mcspi4: spi@480ba000 {
274 compatible = "ti,omap2-mcspi"; 314 compatible = "ti,omap2-mcspi";
315 reg = <0x480ba000 0x100>;
316 interrupts = <48>;
275 #address-cells = <1>; 317 #address-cells = <1>;
276 #size-cells = <0>; 318 #size-cells = <0>;
277 ti,hwmods = "mcspi4"; 319 ti,hwmods = "mcspi4";
@@ -280,8 +322,17 @@
280 dma-names = "tx0", "rx0"; 322 dma-names = "tx0", "rx0";
281 }; 323 };
282 324
325 hdqw1w: 1w@480b2000 {
326 compatible = "ti,omap3-1w";
327 reg = <0x480b2000 0x1000>;
328 interrupts = <58>;
329 ti,hwmods = "hdq1w";
330 };
331
283 mmc1: mmc@4809c000 { 332 mmc1: mmc@4809c000 {
284 compatible = "ti,omap3-hsmmc"; 333 compatible = "ti,omap3-hsmmc";
334 reg = <0x4809c000 0x200>;
335 interrupts = <83>;
285 ti,hwmods = "mmc1"; 336 ti,hwmods = "mmc1";
286 ti,dual-volt; 337 ti,dual-volt;
287 dmas = <&sdma 61>, <&sdma 62>; 338 dmas = <&sdma 61>, <&sdma 62>;
@@ -290,6 +341,8 @@
290 341
291 mmc2: mmc@480b4000 { 342 mmc2: mmc@480b4000 {
292 compatible = "ti,omap3-hsmmc"; 343 compatible = "ti,omap3-hsmmc";
344 reg = <0x480b4000 0x200>;
345 interrupts = <86>;
293 ti,hwmods = "mmc2"; 346 ti,hwmods = "mmc2";
294 dmas = <&sdma 47>, <&sdma 48>; 347 dmas = <&sdma 47>, <&sdma 48>;
295 dma-names = "tx", "rx"; 348 dma-names = "tx", "rx";
@@ -297,6 +350,8 @@
297 350
298 mmc3: mmc@480ad000 { 351 mmc3: mmc@480ad000 {
299 compatible = "ti,omap3-hsmmc"; 352 compatible = "ti,omap3-hsmmc";
353 reg = <0x480ad000 0x200>;
354 interrupts = <94>;
300 ti,hwmods = "mmc3"; 355 ti,hwmods = "mmc3";
301 dmas = <&sdma 77>, <&sdma 78>; 356 dmas = <&sdma 77>, <&sdma 78>;
302 dma-names = "tx", "rx"; 357 dma-names = "tx", "rx";
@@ -304,6 +359,7 @@
304 359
305 wdt2: wdt@48314000 { 360 wdt2: wdt@48314000 {
306 compatible = "ti,omap3-wdt"; 361 compatible = "ti,omap3-wdt";
362 reg = <0x48314000 0x80>;
307 ti,hwmods = "wd_timer2"; 363 ti,hwmods = "wd_timer2";
308 }; 364 };
309 365
diff --git a/arch/arm/boot/dts/omap3430-sdp.dts b/arch/arm/boot/dts/omap3430-sdp.dts
index e2249bcc3e63..281914ed0151 100644
--- a/arch/arm/boot/dts/omap3430-sdp.dts
+++ b/arch/arm/boot/dts/omap3430-sdp.dts
@@ -84,15 +84,15 @@
84 label = "bootloader-nor"; 84 label = "bootloader-nor";
85 reg = <0 0x40000>; 85 reg = <0 0x40000>;
86 }; 86 };
87 partition@0x40000 { 87 partition@40000 {
88 label = "params-nor"; 88 label = "params-nor";
89 reg = <0x40000 0x40000>; 89 reg = <0x40000 0x40000>;
90 }; 90 };
91 partition@0x80000 { 91 partition@80000 {
92 label = "kernel-nor"; 92 label = "kernel-nor";
93 reg = <0x80000 0x200000>; 93 reg = <0x80000 0x200000>;
94 }; 94 };
95 partition@0x280000 { 95 partition@280000 {
96 label = "filesystem-nor"; 96 label = "filesystem-nor";
97 reg = <0x240000 0x7d80000>; 97 reg = <0x240000 0x7d80000>;
98 }; 98 };
@@ -125,19 +125,19 @@
125 label = "xloader-nand"; 125 label = "xloader-nand";
126 reg = <0 0x80000>; 126 reg = <0 0x80000>;
127 }; 127 };
128 partition@0x80000 { 128 partition@80000 {
129 label = "bootloader-nand"; 129 label = "bootloader-nand";
130 reg = <0x80000 0x140000>; 130 reg = <0x80000 0x140000>;
131 }; 131 };
132 partition@0x1c0000 { 132 partition@1c0000 {
133 label = "params-nand"; 133 label = "params-nand";
134 reg = <0x1c0000 0xc0000>; 134 reg = <0x1c0000 0xc0000>;
135 }; 135 };
136 partition@0x280000 { 136 partition@280000 {
137 label = "kernel-nand"; 137 label = "kernel-nand";
138 reg = <0x280000 0x500000>; 138 reg = <0x280000 0x500000>;
139 }; 139 };
140 partition@0x780000 { 140 partition@780000 {
141 label = "filesystem-nand"; 141 label = "filesystem-nand";
142 reg = <0x780000 0x7880000>; 142 reg = <0x780000 0x7880000>;
143 }; 143 };
@@ -170,19 +170,19 @@
170 label = "xloader-onenand"; 170 label = "xloader-onenand";
171 reg = <0 0x80000>; 171 reg = <0 0x80000>;
172 }; 172 };
173 partition@0x80000 { 173 partition@80000 {
174 label = "bootloader-onenand"; 174 label = "bootloader-onenand";
175 reg = <0x80000 0x40000>; 175 reg = <0x80000 0x40000>;
176 }; 176 };
177 partition@0xc0000 { 177 partition@c0000 {
178 label = "params-onenand"; 178 label = "params-onenand";
179 reg = <0xc0000 0x20000>; 179 reg = <0xc0000 0x20000>;
180 }; 180 };
181 partition@0xe0000 { 181 partition@e0000 {
182 label = "kernel-onenand"; 182 label = "kernel-onenand";
183 reg = <0xe0000 0x200000>; 183 reg = <0xe0000 0x200000>;
184 }; 184 };
185 partition@0x2e0000 { 185 partition@2e0000 {
186 label = "filesystem-onenand"; 186 label = "filesystem-onenand";
187 reg = <0x2e0000 0xfd20000>; 187 reg = <0x2e0000 0xfd20000>;
188 }; 188 };
diff --git a/arch/arm/boot/dts/omap36xx.dtsi b/arch/arm/boot/dts/omap36xx.dtsi
index f8b3765eb9be..380c22eb468e 100644
--- a/arch/arm/boot/dts/omap36xx.dtsi
+++ b/arch/arm/boot/dts/omap36xx.dtsi
@@ -31,6 +31,10 @@
31 ocp { 31 ocp {
32 uart4: serial@49042000 { 32 uart4: serial@49042000 {
33 compatible = "ti,omap3-uart"; 33 compatible = "ti,omap3-uart";
34 reg = <0x49042000 0x400>;
35 interrupts = <80>;
36 dmas = <&sdma 81 &sdma 82>;
37 dma-names = "tx", "rx";
34 ti,hwmods = "uart4"; 38 ti,hwmods = "uart4";
35 clock-frequency = <48000000>; 39 clock-frequency = <48000000>;
36 }; 40 };
diff --git a/arch/arm/boot/dts/omap4-panda-common.dtsi b/arch/arm/boot/dts/omap4-panda-common.dtsi
index faa95b5b242e..298e85020e1b 100644
--- a/arch/arm/boot/dts/omap4-panda-common.dtsi
+++ b/arch/arm/boot/dts/omap4-panda-common.dtsi
@@ -60,22 +60,6 @@
60 "AFMR", "Line In"; 60 "AFMR", "Line In";
61 }; 61 };
62 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 */ 63 /* HS USB Port 1 Power */
80 hsusb1_power: hsusb1_power_reg { 64 hsusb1_power: hsusb1_power_reg {
81 compatible = "regulator-fixed"; 65 compatible = "regulator-fixed";
@@ -97,7 +81,7 @@
97 /* HS USB Host PHY on PORT 1 */ 81 /* HS USB Host PHY on PORT 1 */
98 hsusb1_phy: hsusb1_phy { 82 hsusb1_phy: hsusb1_phy {
99 compatible = "usb-nop-xceiv"; 83 compatible = "usb-nop-xceiv";
100 reset-supply = <&hsusb1_reset>; 84 reset-gpios = <&gpio2 30 GPIO_ACTIVE_LOW>; /* gpio_62 */
101 vcc-supply = <&hsusb1_power>; 85 vcc-supply = <&hsusb1_power>;
102 /** 86 /**
103 * FIXME: 87 * FIXME:
@@ -107,39 +91,34 @@
107 */ 91 */
108 clock-frequency = <19200000>; 92 clock-frequency = <19200000>;
109 }; 93 };
110};
111
112&omap4_pmx_wkup {
113 pinctrl-names = "default";
114 pinctrl-0 = <
115 &twl6030_wkup_pins
116 >;
117 94
118 twl6030_wkup_pins: pinmux_twl6030_wkup_pins { 95 /* regulator for wl12xx on sdio5 */
119 pinctrl-single,pins = < 96 wl12xx_vmmc: wl12xx_vmmc {
120 0x14 (PIN_OUTPUT | MUX_MODE2) /* fref_clk0_out.sys_drm_msecure */ 97 pinctrl-names = "default";
121 >; 98 pinctrl-0 = <&wl12xx_gpio>;
99 compatible = "regulator-fixed";
100 regulator-name = "vwl1271";
101 regulator-min-microvolt = <1800000>;
102 regulator-max-microvolt = <1800000>;
103 gpio = <&gpio2 11 0>;
104 startup-delay-us = <70000>;
105 enable-active-high;
122 }; 106 };
123}; 107};
124 108
125&omap4_pmx_core { 109&omap4_pmx_core {
126 pinctrl-names = "default"; 110 pinctrl-names = "default";
127 pinctrl-0 = < 111 pinctrl-0 = <
128 &twl6030_pins
129 &twl6040_pins 112 &twl6040_pins
130 &mcpdm_pins 113 &mcpdm_pins
131 &mcbsp1_pins 114 &mcbsp1_pins
115 &dss_dpi_pins
116 &tfp410_pins
132 &dss_hdmi_pins 117 &dss_hdmi_pins
133 &tpd12s015_pins 118 &tpd12s015_pins
134 &hsusbb1_pins 119 &hsusbb1_pins
135 >; 120 >;
136 121
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
143 twl6040_pins: pinmux_twl6040_pins { 122 twl6040_pins: pinmux_twl6040_pins {
144 pinctrl-single,pins = < 123 pinctrl-single,pins = <
145 0xe0 (PIN_OUTPUT | MUX_MODE3) /* hdq_sio.gpio_127 */ 124 0xe0 (PIN_OUTPUT | MUX_MODE3) /* hdq_sio.gpio_127 */
@@ -166,6 +145,47 @@
166 >; 145 >;
167 }; 146 };
168 147
148 dss_dpi_pins: pinmux_dss_dpi_pins {
149 pinctrl-single,pins = <
150 0x122 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data23 */
151 0x124 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data22 */
152 0x126 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data21 */
153 0x128 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data20 */
154 0x12a (PIN_OUTPUT | MUX_MODE5) /* dispc2_data19 */
155 0x12c (PIN_OUTPUT | MUX_MODE5) /* dispc2_data18 */
156 0x12e (PIN_OUTPUT | MUX_MODE5) /* dispc2_data15 */
157 0x130 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data14 */
158 0x132 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data13 */
159 0x134 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data12 */
160 0x136 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data11 */
161
162 0x174 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data10 */
163 0x176 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data9 */
164 0x178 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data16 */
165 0x17a (PIN_OUTPUT | MUX_MODE5) /* dispc2_data17 */
166 0x17c (PIN_OUTPUT | MUX_MODE5) /* dispc2_hsync */
167 0x17e (PIN_OUTPUT | MUX_MODE5) /* dispc2_pclk */
168 0x180 (PIN_OUTPUT | MUX_MODE5) /* dispc2_vsync */
169 0x182 (PIN_OUTPUT | MUX_MODE5) /* dispc2_de */
170 0x184 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data8 */
171 0x186 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data7 */
172 0x188 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data6 */
173 0x18a (PIN_OUTPUT | MUX_MODE5) /* dispc2_data5 */
174 0x18c (PIN_OUTPUT | MUX_MODE5) /* dispc2_data4 */
175 0x18e (PIN_OUTPUT | MUX_MODE5) /* dispc2_data3 */
176
177 0x190 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data2 */
178 0x192 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data1 */
179 0x194 (PIN_OUTPUT | MUX_MODE5) /* dispc2_data0 */
180 >;
181 };
182
183 tfp410_pins: pinmux_tfp410_pins {
184 pinctrl-single,pins = <
185 0x144 (PIN_OUTPUT | MUX_MODE3) /* gpio_0 */
186 >;
187 };
188
169 dss_hdmi_pins: pinmux_dss_hdmi_pins { 189 dss_hdmi_pins: pinmux_dss_hdmi_pins {
170 pinctrl-single,pins = < 190 pinctrl-single,pins = <
171 0x5a (PIN_INPUT_PULLUP | MUX_MODE0) /* hdmi_cec.hdmi_cec */ 191 0x5a (PIN_INPUT_PULLUP | MUX_MODE0) /* hdmi_cec.hdmi_cec */
@@ -235,6 +255,33 @@
235 0x1c (PIN_OUTPUT | MUX_MODE3) /* gpio_wk8 */ 255 0x1c (PIN_OUTPUT | MUX_MODE3) /* gpio_wk8 */
236 >; 256 >;
237 }; 257 };
258
259 /*
260 * wl12xx GPIO outputs for WLAN_EN, BT_EN, FM_EN, BT_WAKEUP
261 * REVISIT: Are the pull-ups needed for GPIO 48 and 49?
262 */
263 wl12xx_gpio: pinmux_wl12xx_gpio {
264 pinctrl-single,pins = <
265 0x26 (PIN_OUTPUT | MUX_MODE3) /* gpmc_a19.gpio_43 */
266 0x2c (PIN_OUTPUT | MUX_MODE3) /* gpmc_a22.gpio_46 */
267 0x30 (PIN_OUTPUT_PULLUP | MUX_MODE3) /* gpmc_a24.gpio_48 */
268 0x32 (PIN_OUTPUT_PULLUP | MUX_MODE3) /* gpmc_a25.gpio_49 */
269 >;
270 };
271
272 /* wl12xx GPIO inputs and SDIO pins */
273 wl12xx_pins: pinmux_wl12xx_pins {
274 pinctrl-single,pins = <
275 0x38 (PIN_INPUT | MUX_MODE3) /* gpmc_ncs2.gpio_52 */
276 0x3a (PIN_INPUT | MUX_MODE3) /* gpmc_ncs3.gpio_53 */
277 0x108 (PIN_OUTPUT | MUX_MODE0) /* sdmmc5_clk.sdmmc5_clk */
278 0x10a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_cmd.sdmmc5_cmd */
279 0x10c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat0.sdmmc5_dat0 */
280 0x10e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat1.sdmmc5_dat1 */
281 0x110 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat2.sdmmc5_dat2 */
282 0x112 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat3.sdmmc5_dat3 */
283 >;
284 };
238}; 285};
239 286
240&i2c1 { 287&i2c1 {
@@ -265,6 +312,7 @@
265}; 312};
266 313
267#include "twl6030.dtsi" 314#include "twl6030.dtsi"
315#include "twl6030_omap4.dtsi"
268 316
269&i2c2 { 317&i2c2 {
270 pinctrl-names = "default"; 318 pinctrl-names = "default";
@@ -314,8 +362,12 @@
314}; 362};
315 363
316&mmc5 { 364&mmc5 {
317 ti,non-removable; 365 pinctrl-names = "default";
366 pinctrl-0 = <&wl12xx_pins>;
367 vmmc-supply = <&wl12xx_vmmc>;
368 non-removable;
318 bus-width = <4>; 369 bus-width = <4>;
370 cap-power-off-card;
319}; 371};
320 372
321&emif1 { 373&emif1 {
diff --git a/arch/arm/boot/dts/omap4-panda-es.dts b/arch/arm/boot/dts/omap4-panda-es.dts
index 56c435468e94..816d1c95b592 100644
--- a/arch/arm/boot/dts/omap4-panda-es.dts
+++ b/arch/arm/boot/dts/omap4-panda-es.dts
@@ -62,3 +62,7 @@
62 gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; 62 gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
63 }; 63 };
64}; 64};
65
66&gpio1 {
67 ti,no-reset-on-init;
68};
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 7951b4ea500a..5fc3f43c5a81 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -140,25 +140,24 @@
140 "DMic", "Digital Mic", 140 "DMic", "Digital Mic",
141 "Digital Mic", "Digital Mic1 Bias"; 141 "Digital Mic", "Digital Mic1 Bias";
142 }; 142 };
143};
144
145&omap4_pmx_wkup {
146 pinctrl-names = "default";
147 pinctrl-0 = <
148 &twl6030_wkup_pins
149 >;
150 143
151 twl6030_wkup_pins: pinmux_twl6030_wkup_pins { 144 /* regulator for wl12xx on sdio5 */
152 pinctrl-single,pins = < 145 wl12xx_vmmc: wl12xx_vmmc {
153 0x14 (PIN_OUTPUT | MUX_MODE2) /* fref_clk0_out.sys_drm_msecure */ 146 pinctrl-names = "default";
154 >; 147 pinctrl-0 = <&wl12xx_gpio>;
148 compatible = "regulator-fixed";
149 regulator-name = "vwl1271";
150 regulator-min-microvolt = <1800000>;
151 regulator-max-microvolt = <1800000>;
152 gpio = <&gpio2 22 0>;
153 startup-delay-us = <70000>;
154 enable-active-high;
155 }; 155 };
156}; 156};
157 157
158&omap4_pmx_core { 158&omap4_pmx_core {
159 pinctrl-names = "default"; 159 pinctrl-names = "default";
160 pinctrl-0 = < 160 pinctrl-0 = <
161 &twl6030_pins
162 &twl6040_pins 161 &twl6040_pins
163 &mcpdm_pins 162 &mcpdm_pins
164 &dmic_pins 163 &dmic_pins
@@ -193,12 +192,6 @@
193 >; 192 >;
194 }; 193 };
195 194
196 twl6030_pins: pinmux_twl6030_pins {
197 pinctrl-single,pins = <
198 0x15e (WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE0) /* sys_nirq1.sys_nirq1 */
199 >;
200 };
201
202 twl6040_pins: pinmux_twl6040_pins { 195 twl6040_pins: pinmux_twl6040_pins {
203 pinctrl-single,pins = < 196 pinctrl-single,pins = <
204 0xe0 (PIN_OUTPUT | MUX_MODE3) /* hdq_sio.gpio_127 */ 197 0xe0 (PIN_OUTPUT | MUX_MODE3) /* hdq_sio.gpio_127 */
@@ -295,6 +288,26 @@
295 0xf0 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c4_sda */ 288 0xf0 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c4_sda */
296 >; 289 >;
297 }; 290 };
291
292 /* wl12xx GPIO output for WLAN_EN */
293 wl12xx_gpio: pinmux_wl12xx_gpio {
294 pinctrl-single,pins = <
295 0x3c (PIN_OUTPUT | MUX_MODE3) /* gpmc_nwp.gpio_54 */
296 >;
297 };
298
299 /* wl12xx GPIO inputs and SDIO pins */
300 wl12xx_pins: pinmux_wl12xx_pins {
301 pinctrl-single,pins = <
302 0x3a (PIN_INPUT | MUX_MODE3) /* gpmc_ncs3.gpio_53 */
303 0x108 (PIN_OUTPUT | MUX_MODE3) /* sdmmc5_clk.sdmmc5_clk */
304 0x10a (PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc5_cmd.sdmmc5_cmd */
305 0x10c (PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc5_dat0.sdmmc5_dat0 */
306 0x10e (PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc5_dat1.sdmmc5_dat1 */
307 0x110 (PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc5_dat2.sdmmc5_dat2 */
308 0x112 (PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc5_dat3.sdmmc5_dat3 */
309 >;
310 };
298}; 311};
299 312
300&i2c1 { 313&i2c1 {
@@ -337,6 +350,7 @@
337}; 350};
338 351
339#include "twl6030.dtsi" 352#include "twl6030.dtsi"
353#include "twl6030_omap4.dtsi"
340 354
341&i2c2 { 355&i2c2 {
342 pinctrl-names = "default"; 356 pinctrl-names = "default";
@@ -420,8 +434,12 @@
420}; 434};
421 435
422&mmc5 { 436&mmc5 {
437 pinctrl-names = "default";
438 pinctrl-0 = <&wl12xx_pins>;
439 vmmc-supply = <&wl12xx_vmmc>;
440 non-removable;
423 bus-width = <4>; 441 bus-width = <4>;
424 ti,non-removable; 442 cap-power-off-card;
425}; 443};
426 444
427&emif1 { 445&emif1 {
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 22d9f2b593d4..a1e05853afcd 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -17,6 +17,10 @@
17 interrupt-parent = <&gic>; 17 interrupt-parent = <&gic>;
18 18
19 aliases { 19 aliases {
20 i2c0 = &i2c1;
21 i2c1 = &i2c2;
22 i2c2 = &i2c3;
23 i2c3 = &i2c4;
20 serial0 = &uart1; 24 serial0 = &uart1;
21 serial1 = &uart2; 25 serial1 = &uart2;
22 serial2 = &uart3; 26 serial2 = &uart3;
@@ -56,7 +60,7 @@
56 cache-level = <2>; 60 cache-level = <2>;
57 }; 61 };
58 62
59 local-timer@0x48240600 { 63 local-timer@48240600 {
60 compatible = "arm,cortex-a9-twd-timer"; 64 compatible = "arm,cortex-a9-twd-timer";
61 reg = <0x48240600 0x20>; 65 reg = <0x48240600 0x20>;
62 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_HIGH)>; 66 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_HIGH)>;
@@ -114,6 +118,8 @@
114 reg = <0x4a100040 0x0196>; 118 reg = <0x4a100040 0x0196>;
115 #address-cells = <1>; 119 #address-cells = <1>;
116 #size-cells = <0>; 120 #size-cells = <0>;
121 #interrupt-cells = <1>;
122 interrupt-controller;
117 pinctrl-single,register-width = <16>; 123 pinctrl-single,register-width = <16>;
118 pinctrl-single,function-mask = <0x7fff>; 124 pinctrl-single,function-mask = <0x7fff>;
119 }; 125 };
@@ -122,6 +128,8 @@
122 reg = <0x4a31e040 0x0038>; 128 reg = <0x4a31e040 0x0038>;
123 #address-cells = <1>; 129 #address-cells = <1>;
124 #size-cells = <0>; 130 #size-cells = <0>;
131 #interrupt-cells = <1>;
132 interrupt-controller;
125 pinctrl-single,register-width = <16>; 133 pinctrl-single,register-width = <16>;
126 pinctrl-single,function-mask = <0x7fff>; 134 pinctrl-single,function-mask = <0x7fff>;
127 }; 135 };
@@ -214,6 +222,7 @@
214 gpmc,num-cs = <8>; 222 gpmc,num-cs = <8>;
215 gpmc,num-waitpins = <4>; 223 gpmc,num-waitpins = <4>;
216 ti,hwmods = "gpmc"; 224 ti,hwmods = "gpmc";
225 ti,no-idle-on-init;
217 }; 226 };
218 227
219 uart1: serial@4806a000 { 228 uart1: serial@4806a000 {
@@ -248,6 +257,12 @@
248 clock-frequency = <48000000>; 257 clock-frequency = <48000000>;
249 }; 258 };
250 259
260 hwspinlock: spinlock@4a0f6000 {
261 compatible = "ti,omap4-hwspinlock";
262 reg = <0x4a0f6000 0x1000>;
263 ti,hwmods = "spinlock";
264 };
265
251 i2c1: i2c@48070000 { 266 i2c1: i2c@48070000 {
252 compatible = "ti,omap4-i2c"; 267 compatible = "ti,omap4-i2c";
253 reg = <0x48070000 0x100>; 268 reg = <0x48070000 0x100>;
@@ -492,6 +507,7 @@
492 reg = <0x4c000000 0x100>; 507 reg = <0x4c000000 0x100>;
493 interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>; 508 interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
494 ti,hwmods = "emif1"; 509 ti,hwmods = "emif1";
510 ti,no-idle-on-init;
495 phy-type = <1>; 511 phy-type = <1>;
496 hw-caps-read-idle-ctrl; 512 hw-caps-read-idle-ctrl;
497 hw-caps-ll-interface; 513 hw-caps-ll-interface;
@@ -503,6 +519,7 @@
503 reg = <0x4d000000 0x100>; 519 reg = <0x4d000000 0x100>;
504 interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>; 520 interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
505 ti,hwmods = "emif2"; 521 ti,hwmods = "emif2";
522 ti,no-idle-on-init;
506 phy-type = <1>; 523 phy-type = <1>;
507 hw-caps-read-idle-ctrl; 524 hw-caps-read-idle-ctrl;
508 hw-caps-ll-interface; 525 hw-caps-ll-interface;
@@ -519,7 +536,8 @@
519 usb2_phy: usb2phy@4a0ad080 { 536 usb2_phy: usb2phy@4a0ad080 {
520 compatible = "ti,omap-usb2"; 537 compatible = "ti,omap-usb2";
521 reg = <0x4a0ad080 0x58>; 538 reg = <0x4a0ad080 0x58>;
522 ctrl-module = <&omap_control_usb>; 539 ctrl-module = <&omap_control_usb2phy>;
540 #phy-cells = <0>;
523 }; 541 };
524 }; 542 };
525 543
@@ -643,12 +661,16 @@
643 }; 661 };
644 }; 662 };
645 663
646 omap_control_usb: omap-control-usb@4a002300 { 664 omap_control_usb2phy: control-phy@4a002300 {
647 compatible = "ti,omap-control-usb"; 665 compatible = "ti,control-phy-usb2";
648 reg = <0x4a002300 0x4>, 666 reg = <0x4a002300 0x4>;
649 <0x4a00233c 0x4>; 667 reg-names = "power";
650 reg-names = "control_dev_conf", "otghs_control"; 668 };
651 ti,type = <1>; 669
670 omap_control_usbotg: control-phy@4a00233c {
671 compatible = "ti,control-phy-otghs";
672 reg = <0x4a00233c 0x4>;
673 reg-names = "otghs_control";
652 }; 674 };
653 675
654 usb_otg_hs: usb_otg_hs@4a0ab000 { 676 usb_otg_hs: usb_otg_hs@4a0ab000 {
@@ -658,10 +680,30 @@
658 interrupt-names = "mc", "dma"; 680 interrupt-names = "mc", "dma";
659 ti,hwmods = "usb_otg_hs"; 681 ti,hwmods = "usb_otg_hs";
660 usb-phy = <&usb2_phy>; 682 usb-phy = <&usb2_phy>;
683 phys = <&usb2_phy>;
684 phy-names = "usb2-phy";
661 multipoint = <1>; 685 multipoint = <1>;
662 num-eps = <16>; 686 num-eps = <16>;
663 ram-bits = <12>; 687 ram-bits = <12>;
664 ti,has-mailbox; 688 ctrl-module = <&omap_control_usbotg>;
689 };
690
691 aes: aes@4b501000 {
692 compatible = "ti,omap4-aes";
693 ti,hwmods = "aes";
694 reg = <0x4b501000 0xa0>;
695 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
696 dmas = <&sdma 111>, <&sdma 110>;
697 dma-names = "tx", "rx";
698 };
699
700 des: des@480a5000 {
701 compatible = "ti,omap4-des";
702 ti,hwmods = "des";
703 reg = <0x480a5000 0xa0>;
704 interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
705 dmas = <&sdma 117>, <&sdma 116>;
706 dma-names = "tx", "rx";
665 }; 707 };
666 }; 708 };
667}; 709};
diff --git a/arch/arm/boot/dts/omap5-uevm.dts b/arch/arm/boot/dts/omap5-uevm.dts
index 65d7b601651c..002fa70180a5 100644
--- a/arch/arm/boot/dts/omap5-uevm.dts
+++ b/arch/arm/boot/dts/omap5-uevm.dts
@@ -27,21 +27,10 @@
27 regulator-max-microvolt = <3000000>; 27 regulator-max-microvolt = <3000000>;
28 }; 28 };
29 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 */ 30 /* HS USB Host PHY on PORT 2 */
42 hsusb2_phy: hsusb2_phy { 31 hsusb2_phy: hsusb2_phy {
43 compatible = "usb-nop-xceiv"; 32 compatible = "usb-nop-xceiv";
44 reset-supply = <&hsusb2_reset>; 33 reset-gpios = <&gpio3 16 GPIO_ACTIVE_LOW>; /* gpio3_80 HUB_NRESET */
45 /** 34 /**
46 * FIXME 35 * FIXME
47 * Put the right clock phandle here when available 36 * Put the right clock phandle here when available
@@ -51,21 +40,10 @@
51 clock-frequency = <19200000>; 40 clock-frequency = <19200000>;
52 }; 41 };
53 42
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 */ 43 /* HS USB Host PHY on PORT 3 */
66 hsusb3_phy: hsusb3_phy { 44 hsusb3_phy: hsusb3_phy {
67 compatible = "usb-nop-xceiv"; 45 compatible = "usb-nop-xceiv";
68 reset-supply = <&hsusb3_reset>; 46 reset-gpios = <&gpio3 15 GPIO_ACTIVE_LOW>; /* gpio3_79 ETH_NRESET */
69 }; 47 };
70 48
71 leds { 49 leds {
@@ -84,7 +62,6 @@
84 pinctrl-0 = < 62 pinctrl-0 = <
85 &twl6040_pins 63 &twl6040_pins
86 &mcpdm_pins 64 &mcpdm_pins
87 &dmic_pins
88 &mcbsp1_pins 65 &mcbsp1_pins
89 &mcbsp2_pins 66 &mcbsp2_pins
90 &usbhost_pins 67 &usbhost_pins
@@ -93,7 +70,7 @@
93 70
94 twl6040_pins: pinmux_twl6040_pins { 71 twl6040_pins: pinmux_twl6040_pins {
95 pinctrl-single,pins = < 72 pinctrl-single,pins = <
96 0x18a (PIN_OUTPUT | MUX_MODE6) /* perslimbus2_clock.gpio5_145 */ 73 0x17e (PIN_OUTPUT | MUX_MODE6) /* mcspi1_somi.gpio5_141 */
97 >; 74 >;
98 }; 75 };
99 76
@@ -107,15 +84,6 @@
107 >; 84 >;
108 }; 85 };
109 86
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 { 87 mcbsp1_pins: pinmux_mcbsp1_pins {
120 pinctrl-single,pins = < 88 pinctrl-single,pins = <
121 0x14c (PIN_INPUT | MUX_MODE1) /* abedmic_clk2.abemcbsp1_fsx */ 89 0x14c (PIN_INPUT | MUX_MODE1) /* abedmic_clk2.abemcbsp1_fsx */
@@ -153,25 +121,25 @@
153 0xbc (PIN_INPUT | MUX_MODE0) /* mcspi2_clk */ 121 0xbc (PIN_INPUT | MUX_MODE0) /* mcspi2_clk */
154 0xbe (PIN_INPUT | MUX_MODE0) /* mcspi2_simo */ 122 0xbe (PIN_INPUT | MUX_MODE0) /* mcspi2_simo */
155 0xc0 (PIN_INPUT_PULLUP | MUX_MODE0) /* mcspi2_somi */ 123 0xc0 (PIN_INPUT_PULLUP | MUX_MODE0) /* mcspi2_somi */
156 0xc2 (PIN_OUTPUT | MUX_MODE0) /* mcspi2_cs */ 124 0xc2 (PIN_OUTPUT | MUX_MODE0) /* mcspi2_cs0 */
157 >; 125 >;
158 }; 126 };
159 127
160 mcspi3_pins: pinmux_mcspi3_pins { 128 mcspi3_pins: pinmux_mcspi3_pins {
161 pinctrl-single,pins = < 129 pinctrl-single,pins = <
162 0x78 (PIN_INPUT | MUX_MODE1) /* mcspi2_somi */ 130 0x78 (PIN_INPUT | MUX_MODE1) /* mcspi3_somi */
163 0x7a (PIN_INPUT | MUX_MODE1) /* mcspi2_cs */ 131 0x7a (PIN_INPUT | MUX_MODE1) /* mcspi3_cs0 */
164 0x7c (PIN_INPUT | MUX_MODE1) /* mcspi2_simo */ 132 0x7c (PIN_INPUT | MUX_MODE1) /* mcspi3_simo */
165 0x7e (PIN_INPUT | MUX_MODE1) /* mcspi2_clk */ 133 0x7e (PIN_INPUT | MUX_MODE1) /* mcspi3_clk */
166 >; 134 >;
167 }; 135 };
168 136
169 mcspi4_pins: pinmux_mcspi4_pins { 137 mcspi4_pins: pinmux_mcspi4_pins {
170 pinctrl-single,pins = < 138 pinctrl-single,pins = <
171 0x164 (PIN_INPUT | MUX_MODE1) /* mcspi2_clk */ 139 0x164 (PIN_INPUT | MUX_MODE1) /* mcspi4_clk */
172 0x168 (PIN_INPUT | MUX_MODE1) /* mcspi2_simo */ 140 0x168 (PIN_INPUT | MUX_MODE1) /* mcspi4_simo */
173 0x16a (PIN_INPUT | MUX_MODE1) /* mcspi2_somi */ 141 0x16a (PIN_INPUT | MUX_MODE1) /* mcspi4_somi */
174 0x16c (PIN_INPUT | MUX_MODE1) /* mcspi2_cs */ 142 0x16c (PIN_INPUT | MUX_MODE1) /* mcspi4_cs0 */
175 >; 143 >;
176 }; 144 };
177 145
@@ -271,6 +239,14 @@
271 reg = <0x48>; 239 reg = <0x48>;
272 interrupt-controller; 240 interrupt-controller;
273 #interrupt-cells = <2>; 241 #interrupt-cells = <2>;
242 ti,system-power-controller;
243
244 extcon_usb3: palmas_usb {
245 compatible = "ti,palmas-usb-vid";
246 ti,enable-vbus-detection;
247 ti,enable-id-detection;
248 ti,wakeup;
249 };
274 250
275 palmas_pmic { 251 palmas_pmic {
276 compatible = "ti,palmas-pmic"; 252 compatible = "ti,palmas-pmic";
@@ -334,15 +310,22 @@
334 ti,smps-range = <0x80>; 310 ti,smps-range = <0x80>;
335 }; 311 };
336 312
337 smps10_reg: smps10 { 313 smps10_out2_reg: smps10_out2 {
338 /* VBUS_5V_OTG */ 314 /* VBUS_5V_OTG */
339 regulator-name = "smps10"; 315 regulator-name = "smps10_out2";
340 regulator-min-microvolt = <5000000>; 316 regulator-min-microvolt = <5000000>;
341 regulator-max-microvolt = <5000000>; 317 regulator-max-microvolt = <5000000>;
342 regulator-always-on; 318 regulator-always-on;
343 regulator-boot-on; 319 regulator-boot-on;
344 }; 320 };
345 321
322 smps10_out1_reg: smps10_out1 {
323 /* VBUS_5V_OTG */
324 regulator-name = "smps10_out1";
325 regulator-min-microvolt = <5000000>;
326 regulator-max-microvolt = <5000000>;
327 };
328
346 ldo1_reg: ldo1 { 329 ldo1_reg: ldo1 {
347 /* VDDAPHY_CAM: vdda_csiport */ 330 /* VDDAPHY_CAM: vdda_csiport */
348 regulator-name = "ldo1"; 331 regulator-name = "ldo1";
@@ -470,6 +453,11 @@
470 phys = <0 &hsusb2_phy &hsusb3_phy>; 453 phys = <0 &hsusb2_phy &hsusb3_phy>;
471}; 454};
472 455
456&usb3 {
457 extcon = <&extcon_usb3>;
458 vbus-supply = <&smps10_out1_reg>;
459};
460
473&mcspi1 { 461&mcspi1 {
474 462
475}; 463};
@@ -503,3 +491,7 @@
503 pinctrl-names = "default"; 491 pinctrl-names = "default";
504 pinctrl-0 = <&uart5_pins>; 492 pinctrl-0 = <&uart5_pins>;
505}; 493};
494
495&cpu0 {
496 cpu0-supply = <&smps123_reg>;
497};
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 07be2cd7b318..fc3fad563861 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -21,6 +21,11 @@
21 interrupt-parent = <&gic>; 21 interrupt-parent = <&gic>;
22 22
23 aliases { 23 aliases {
24 i2c0 = &i2c1;
25 i2c1 = &i2c2;
26 i2c2 = &i2c3;
27 i2c3 = &i2c4;
28 i2c4 = &i2c5;
24 serial0 = &uart1; 29 serial0 = &uart1;
25 serial1 = &uart2; 30 serial1 = &uart2;
26 serial2 = &uart3; 31 serial2 = &uart3;
@@ -33,10 +38,17 @@
33 #address-cells = <1>; 38 #address-cells = <1>;
34 #size-cells = <0>; 39 #size-cells = <0>;
35 40
36 cpu@0 { 41 cpu0: cpu@0 {
37 device_type = "cpu"; 42 device_type = "cpu";
38 compatible = "arm,cortex-a15"; 43 compatible = "arm,cortex-a15";
39 reg = <0x0>; 44 reg = <0x0>;
45
46 operating-points = <
47 /* kHz uV */
48 500000 880000
49 1000000 1060000
50 1500000 1250000
51 >;
40 }; 52 };
41 cpu@1 { 53 cpu@1 {
42 device_type = "cpu"; 54 device_type = "cpu";
@@ -52,7 +64,6 @@
52 <GIC_PPI 14 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, 64 <GIC_PPI 14 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>,
53 <GIC_PPI 11 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, 65 <GIC_PPI 11 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>,
54 <GIC_PPI 10 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>; 66 <GIC_PPI 10 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>;
55 clock-frequency = <6144000>;
56 }; 67 };
57 68
58 gic: interrupt-controller@48211000 { 69 gic: interrupt-controller@48211000 {
@@ -276,6 +287,12 @@
276 ti,hwmods = "i2c5"; 287 ti,hwmods = "i2c5";
277 }; 288 };
278 289
290 hwspinlock: spinlock@4a0f6000 {
291 compatible = "ti,omap4-hwspinlock";
292 reg = <0x4a0f6000 0x1000>;
293 ti,hwmods = "spinlock";
294 };
295
279 mcspi1: spi@48098000 { 296 mcspi1: spi@48098000 {
280 compatible = "ti,omap4-mcspi"; 297 compatible = "ti,omap4-mcspi";
281 reg = <0x48098000 0x200>; 298 reg = <0x48098000 0x200>;
@@ -604,9 +621,10 @@
604 ti,hwmods = "wd_timer2"; 621 ti,hwmods = "wd_timer2";
605 }; 622 };
606 623
607 emif1: emif@0x4c000000 { 624 emif1: emif@4c000000 {
608 compatible = "ti,emif-4d5"; 625 compatible = "ti,emif-4d5";
609 ti,hwmods = "emif1"; 626 ti,hwmods = "emif1";
627 ti,no-idle-on-init;
610 phy-type = <2>; /* DDR PHY type: Intelli PHY */ 628 phy-type = <2>; /* DDR PHY type: Intelli PHY */
611 reg = <0x4c000000 0x400>; 629 reg = <0x4c000000 0x400>;
612 interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>; 630 interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
@@ -615,9 +633,10 @@
615 hw-caps-temp-alert; 633 hw-caps-temp-alert;
616 }; 634 };
617 635
618 emif2: emif@0x4d000000 { 636 emif2: emif@4d000000 {
619 compatible = "ti,emif-4d5"; 637 compatible = "ti,emif-4d5";
620 ti,hwmods = "emif2"; 638 ti,hwmods = "emif2";
639 ti,no-idle-on-init;
621 phy-type = <2>; /* DDR PHY type: Intelli PHY */ 640 phy-type = <2>; /* DDR PHY type: Intelli PHY */
622 reg = <0x4d000000 0x400>; 641 reg = <0x4d000000 0x400>;
623 interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>; 642 interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
@@ -626,18 +645,22 @@
626 hw-caps-temp-alert; 645 hw-caps-temp-alert;
627 }; 646 };
628 647
629 omap_control_usb: omap-control-usb@4a002300 { 648 omap_control_usb2phy: control-phy@4a002300 {
630 compatible = "ti,omap-control-usb"; 649 compatible = "ti,control-phy-usb2";
631 reg = <0x4a002300 0x4>, 650 reg = <0x4a002300 0x4>;
632 <0x4a002370 0x4>; 651 reg-names = "power";
633 reg-names = "control_dev_conf", "phy_power_usb"; 652 };
634 ti,type = <2>; 653
654 omap_control_usb3phy: control-phy@4a002370 {
655 compatible = "ti,control-phy-pipe3";
656 reg = <0x4a002370 0x4>;
657 reg-names = "power";
635 }; 658 };
636 659
637 omap_dwc3@4a020000 { 660 usb3: omap_dwc3@4a020000 {
638 compatible = "ti,dwc3"; 661 compatible = "ti,dwc3";
639 ti,hwmods = "usb_otg_ss"; 662 ti,hwmods = "usb_otg_ss";
640 reg = <0x4a020000 0x1000>; 663 reg = <0x4a020000 0x10000>;
641 interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>; 664 interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
642 #address-cells = <1>; 665 #address-cells = <1>;
643 #size-cells = <1>; 666 #size-cells = <1>;
@@ -645,23 +668,25 @@
645 ranges; 668 ranges;
646 dwc3@4a030000 { 669 dwc3@4a030000 {
647 compatible = "snps,dwc3"; 670 compatible = "snps,dwc3";
648 reg = <0x4a030000 0x1000>; 671 reg = <0x4a030000 0x10000>;
649 interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>; 672 interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
650 usb-phy = <&usb2_phy>, <&usb3_phy>; 673 usb-phy = <&usb2_phy>, <&usb3_phy>;
674 dr_mode = "peripheral";
651 tx-fifo-resize; 675 tx-fifo-resize;
652 }; 676 };
653 }; 677 };
654 678
655 ocp2scp { 679 ocp2scp@4a080000 {
656 compatible = "ti,omap-ocp2scp"; 680 compatible = "ti,omap-ocp2scp";
657 #address-cells = <1>; 681 #address-cells = <1>;
658 #size-cells = <1>; 682 #size-cells = <1>;
683 reg = <0x4a080000 0x20>;
659 ranges; 684 ranges;
660 ti,hwmods = "ocp2scp1"; 685 ti,hwmods = "ocp2scp1";
661 usb2_phy: usb2phy@4a084000 { 686 usb2_phy: usb2phy@4a084000 {
662 compatible = "ti,omap-usb2"; 687 compatible = "ti,omap-usb2";
663 reg = <0x4a084000 0x7c>; 688 reg = <0x4a084000 0x7c>;
664 ctrl-module = <&omap_control_usb>; 689 ctrl-module = <&omap_control_usb2phy>;
665 }; 690 };
666 691
667 usb3_phy: usb3phy@4a084400 { 692 usb3_phy: usb3phy@4a084400 {
@@ -670,7 +695,7 @@
670 <0x4a084800 0x64>, 695 <0x4a084800 0x64>,
671 <0x4a084c00 0x40>; 696 <0x4a084c00 0x40>;
672 reg-names = "phy_rx", "phy_tx", "pll_ctrl"; 697 reg-names = "phy_rx", "phy_tx", "pll_ctrl";
673 ctrl-module = <&omap_control_usb>; 698 ctrl-module = <&omap_control_usb3phy>;
674 }; 699 };
675 }; 700 };
676 701
diff --git a/arch/arm/boot/dts/prima2.dtsi b/arch/arm/boot/dts/prima2.dtsi
index bbeb623fc2c6..daee58944e15 100644
--- a/arch/arm/boot/dts/prima2.dtsi
+++ b/arch/arm/boot/dts/prima2.dtsi
@@ -76,6 +76,11 @@
76 compatible = "sirf,prima2-rsc"; 76 compatible = "sirf,prima2-rsc";
77 reg = <0x88020000 0x1000>; 77 reg = <0x88020000 0x1000>;
78 }; 78 };
79
80 cphifbg@88030000 {
81 compatible = "sirf,prima2-cphifbg";
82 reg = <0x88030000 0x1000>;
83 };
79 }; 84 };
80 85
81 mem-iobg { 86 mem-iobg {
@@ -86,10 +91,17 @@
86 91
87 memory-controller@90000000 { 92 memory-controller@90000000 {
88 compatible = "sirf,prima2-memc"; 93 compatible = "sirf,prima2-memc";
89 reg = <0x90000000 0x10000>; 94 reg = <0x90000000 0x2000>;
90 interrupts = <27>; 95 interrupts = <27>;
91 clocks = <&clks 5>; 96 clocks = <&clks 5>;
92 }; 97 };
98
99 memc-monitor {
100 compatible = "sirf,prima2-memcmon";
101 reg = <0x90002000 0x200>;
102 interrupts = <4>;
103 clocks = <&clks 32>;
104 };
93 }; 105 };
94 106
95 disp-iobg { 107 disp-iobg {
@@ -171,7 +183,8 @@
171 compatible = "simple-bus"; 183 compatible = "simple-bus";
172 #address-cells = <1>; 184 #address-cells = <1>;
173 #size-cells = <1>; 185 #size-cells = <1>;
174 ranges = <0xb0000000 0xb0000000 0x180000>; 186 ranges = <0xb0000000 0xb0000000 0x180000>,
187 <0x56000000 0x56000000 0x1b00000>;
175 188
176 timer@b0020000 { 189 timer@b0020000 {
177 compatible = "sirf,prima2-tick"; 190 compatible = "sirf,prima2-tick";
@@ -196,25 +209,32 @@
196 uart0: uart@b0050000 { 209 uart0: uart@b0050000 {
197 cell-index = <0>; 210 cell-index = <0>;
198 compatible = "sirf,prima2-uart"; 211 compatible = "sirf,prima2-uart";
199 reg = <0xb0050000 0x10000>; 212 reg = <0xb0050000 0x1000>;
200 interrupts = <17>; 213 interrupts = <17>;
214 fifosize = <128>;
201 clocks = <&clks 13>; 215 clocks = <&clks 13>;
216 sirf,uart-dma-rx-channel = <21>;
217 sirf,uart-dma-tx-channel = <2>;
202 }; 218 };
203 219
204 uart1: uart@b0060000 { 220 uart1: uart@b0060000 {
205 cell-index = <1>; 221 cell-index = <1>;
206 compatible = "sirf,prima2-uart"; 222 compatible = "sirf,prima2-uart";
207 reg = <0xb0060000 0x10000>; 223 reg = <0xb0060000 0x1000>;
208 interrupts = <18>; 224 interrupts = <18>;
225 fifosize = <32>;
209 clocks = <&clks 14>; 226 clocks = <&clks 14>;
210 }; 227 };
211 228
212 uart2: uart@b0070000 { 229 uart2: uart@b0070000 {
213 cell-index = <2>; 230 cell-index = <2>;
214 compatible = "sirf,prima2-uart"; 231 compatible = "sirf,prima2-uart";
215 reg = <0xb0070000 0x10000>; 232 reg = <0xb0070000 0x1000>;
216 interrupts = <19>; 233 interrupts = <19>;
234 fifosize = <128>;
217 clocks = <&clks 15>; 235 clocks = <&clks 15>;
236 sirf,uart-dma-rx-channel = <6>;
237 sirf,uart-dma-tx-channel = <7>;
218 }; 238 };
219 239
220 usp0: usp@b0080000 { 240 usp0: usp@b0080000 {
@@ -222,7 +242,10 @@
222 compatible = "sirf,prima2-usp"; 242 compatible = "sirf,prima2-usp";
223 reg = <0xb0080000 0x10000>; 243 reg = <0xb0080000 0x10000>;
224 interrupts = <20>; 244 interrupts = <20>;
245 fifosize = <128>;
225 clocks = <&clks 28>; 246 clocks = <&clks 28>;
247 sirf,usp-dma-rx-channel = <17>;
248 sirf,usp-dma-tx-channel = <18>;
226 }; 249 };
227 250
228 usp1: usp@b0090000 { 251 usp1: usp@b0090000 {
@@ -230,7 +253,10 @@
230 compatible = "sirf,prima2-usp"; 253 compatible = "sirf,prima2-usp";
231 reg = <0xb0090000 0x10000>; 254 reg = <0xb0090000 0x10000>;
232 interrupts = <21>; 255 interrupts = <21>;
256 fifosize = <128>;
233 clocks = <&clks 29>; 257 clocks = <&clks 29>;
258 sirf,usp-dma-rx-channel = <14>;
259 sirf,usp-dma-tx-channel = <15>;
234 }; 260 };
235 261
236 usp2: usp@b00a0000 { 262 usp2: usp@b00a0000 {
@@ -238,7 +264,10 @@
238 compatible = "sirf,prima2-usp"; 264 compatible = "sirf,prima2-usp";
239 reg = <0xb00a0000 0x10000>; 265 reg = <0xb00a0000 0x10000>;
240 interrupts = <22>; 266 interrupts = <22>;
267 fifosize = <128>;
241 clocks = <&clks 30>; 268 clocks = <&clks 30>;
269 sirf,usp-dma-rx-channel = <10>;
270 sirf,usp-dma-tx-channel = <11>;
242 }; 271 };
243 272
244 dmac0: dma-controller@b00b0000 { 273 dmac0: dma-controller@b00b0000 {
@@ -261,6 +290,8 @@
261 compatible = "sirf,prima2-vip"; 290 compatible = "sirf,prima2-vip";
262 reg = <0xb00C0000 0x10000>; 291 reg = <0xb00C0000 0x10000>;
263 clocks = <&clks 31>; 292 clocks = <&clks 31>;
293 interrupts = <14>;
294 sirf,vip-dma-rx-channel = <16>;
264 }; 295 };
265 296
266 spi0: spi@b00d0000 { 297 spi0: spi@b00d0000 {
@@ -268,7 +299,13 @@
268 compatible = "sirf,prima2-spi"; 299 compatible = "sirf,prima2-spi";
269 reg = <0xb00d0000 0x10000>; 300 reg = <0xb00d0000 0x10000>;
270 interrupts = <15>; 301 interrupts = <15>;
302 sirf,spi-num-chipselects = <1>;
303 sirf,spi-dma-rx-channel = <25>;
304 sirf,spi-dma-tx-channel = <20>;
305 #address-cells = <1>;
306 #size-cells = <0>;
271 clocks = <&clks 19>; 307 clocks = <&clks 19>;
308 status = "disabled";
272 }; 309 };
273 310
274 spi1: spi@b0170000 { 311 spi1: spi@b0170000 {
@@ -276,7 +313,13 @@
276 compatible = "sirf,prima2-spi"; 313 compatible = "sirf,prima2-spi";
277 reg = <0xb0170000 0x10000>; 314 reg = <0xb0170000 0x10000>;
278 interrupts = <16>; 315 interrupts = <16>;
316 sirf,spi-num-chipselects = <1>;
317 sirf,spi-dma-rx-channel = <12>;
318 sirf,spi-dma-tx-channel = <13>;
319 #address-cells = <1>;
320 #size-cells = <0>;
279 clocks = <&clks 20>; 321 clocks = <&clks 20>;
322 status = "disabled";
280 }; 323 };
281 324
282 i2c0: i2c@b00e0000 { 325 i2c0: i2c@b00e0000 {
@@ -285,6 +328,8 @@
285 reg = <0xb00e0000 0x10000>; 328 reg = <0xb00e0000 0x10000>;
286 interrupts = <24>; 329 interrupts = <24>;
287 clocks = <&clks 17>; 330 clocks = <&clks 17>;
331 #address-cells = <1>;
332 #size-cells = <0>;
288 }; 333 };
289 334
290 i2c1: i2c@b00f0000 { 335 i2c1: i2c@b00f0000 {
@@ -293,6 +338,8 @@
293 reg = <0xb00f0000 0x10000>; 338 reg = <0xb00f0000 0x10000>;
294 interrupts = <25>; 339 interrupts = <25>;
295 clocks = <&clks 18>; 340 clocks = <&clks 18>;
341 #address-cells = <1>;
342 #size-cells = <0>;
296 }; 343 };
297 344
298 tsc@b0110000 { 345 tsc@b0110000 {
@@ -341,6 +388,12 @@
341 sirf,function = "uart0"; 388 sirf,function = "uart0";
342 }; 389 };
343 }; 390 };
391 uart0_noflow_pins_a: uart0@1 {
392 uart {
393 sirf,pins = "uart0_nostreamctrlgrp";
394 sirf,function = "uart0_nostreamctrl";
395 };
396 };
344 uart1_pins_a: uart1@0 { 397 uart1_pins_a: uart1@0 {
345 uart { 398 uart {
346 sirf,pins = "uart1grp"; 399 sirf,pins = "uart1grp";
@@ -479,18 +532,42 @@
479 sirf,function = "usp0"; 532 sirf,function = "usp0";
480 }; 533 };
481 }; 534 };
535 usp0_uart_nostreamctrl_pins_a: usp0@1 {
536 usp0 {
537 sirf,pins =
538 "usp0_uart_nostreamctrl_grp";
539 sirf,function =
540 "usp0_uart_nostreamctrl";
541 };
542 };
482 usp1_pins_a: usp1@0 { 543 usp1_pins_a: usp1@0 {
483 usp1 { 544 usp1 {
484 sirf,pins = "usp1grp"; 545 sirf,pins = "usp1grp";
485 sirf,function = "usp1"; 546 sirf,function = "usp1";
486 }; 547 };
487 }; 548 };
549 usp1_uart_nostreamctrl_pins_a: usp1@1 {
550 usp1 {
551 sirf,pins =
552 "usp1_uart_nostreamctrl_grp";
553 sirf,function =
554 "usp1_uart_nostreamctrl";
555 };
556 };
488 usp2_pins_a: usp2@0 { 557 usp2_pins_a: usp2@0 {
489 usp2 { 558 usp2 {
490 sirf,pins = "usp2grp"; 559 sirf,pins = "usp2grp";
491 sirf,function = "usp2"; 560 sirf,function = "usp2";
492 }; 561 };
493 }; 562 };
563 usp2_uart_nostreamctrl_pins_a: usp2@1 {
564 usp2 {
565 sirf,pins =
566 "usp2_uart_nostreamctrl_grp";
567 sirf,function =
568 "usp2_uart_nostreamctrl";
569 };
570 };
494 usb0_utmi_drvbus_pins_a: usb0_utmi_drvbus@0 { 571 usb0_utmi_drvbus_pins_a: usb0_utmi_drvbus@0 {
495 usb0_utmi_drvbus { 572 usb0_utmi_drvbus {
496 sirf,pins = "usb0_utmi_drvbusgrp"; 573 sirf,pins = "usb0_utmi_drvbusgrp";
@@ -503,6 +580,18 @@
503 sirf,function = "usb1_utmi_drvbus"; 580 sirf,function = "usb1_utmi_drvbus";
504 }; 581 };
505 }; 582 };
583 usb1_dp_dn_pins_a: usb1_dp_dn@0 {
584 usb1_dp_dn {
585 sirf,pins = "usb1_dp_dngrp";
586 sirf,function = "usb1_dp_dn";
587 };
588 };
589 uart1_route_io_usb1_pins_a: uart1_route_io_usb1@0 {
590 uart1_route_io_usb1 {
591 sirf,pins = "uart1_route_io_usb1grp";
592 sirf,function = "uart1_route_io_usb1";
593 };
594 };
506 warm_rst_pins_a: warm_rst@0 { 595 warm_rst_pins_a: warm_rst@0 {
507 warm_rst { 596 warm_rst {
508 sirf,pins = "warm_rstgrp"; 597 sirf,pins = "warm_rstgrp";
diff --git a/arch/arm/boot/dts/msm8660-surf.dts b/arch/arm/boot/dts/qcom-msm8660-surf.dts
index 386d42870215..386d42870215 100644
--- a/arch/arm/boot/dts/msm8660-surf.dts
+++ b/arch/arm/boot/dts/qcom-msm8660-surf.dts
diff --git a/arch/arm/boot/dts/msm8960-cdp.dts b/arch/arm/boot/dts/qcom-msm8960-cdp.dts
index 93e9f7e0b7ad..93e9f7e0b7ad 100644
--- a/arch/arm/boot/dts/msm8960-cdp.dts
+++ b/arch/arm/boot/dts/qcom-msm8960-cdp.dts
diff --git a/arch/arm/boot/dts/r7s72100-genmai.dts b/arch/arm/boot/dts/r7s72100-genmai.dts
new file mode 100644
index 000000000000..1fb20f2333cc
--- /dev/null
+++ b/arch/arm/boot/dts/r7s72100-genmai.dts
@@ -0,0 +1,31 @@
1/*
2 * Device Tree Source for the Genmai board
3 *
4 * Copyright (C) 2013 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/ "r7s72100.dtsi"
13
14/ {
15 model = "Genmai";
16 compatible = "renesas,genmai", "renesas,r7s72100";
17
18 chosen {
19 bootargs = "console=ttySC2,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp";
20 };
21
22 memory {
23 device_type = "memory";
24 reg = <0x08000000 0x08000000>;
25 };
26
27 lbsc {
28 #address-cells = <1>;
29 #size-cells = <1>;
30 };
31};
diff --git a/arch/arm/boot/dts/r7s72100.dtsi b/arch/arm/boot/dts/r7s72100.dtsi
new file mode 100644
index 000000000000..46b82aa7dc4e
--- /dev/null
+++ b/arch/arm/boot/dts/r7s72100.dtsi
@@ -0,0 +1,36 @@
1/*
2 * Device Tree Source for the r7s72100 SoC
3 *
4 * Copyright (C) 2013 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/ {
12 compatible = "renesas,r7s72100";
13 interrupt-parent = <&gic>;
14 #address-cells = <1>;
15 #size-cells = <1>;
16
17 cpus {
18 #address-cells = <1>;
19 #size-cells = <0>;
20
21 cpu@0 {
22 device_type = "cpu";
23 compatible = "arm,cortex-a9";
24 reg = <0>;
25 };
26 };
27
28 gic: interrupt-controller@e8201000 {
29 compatible = "arm,cortex-a9-gic";
30 #interrupt-cells = <3>;
31 #address-cells = <0>;
32 interrupt-controller;
33 reg = <0xe8201000 0x1000>,
34 <0xe8202000 0x1000>;
35 };
36};
diff --git a/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts b/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
index f444624eb097..9443e93d3cac 100644
--- a/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
+++ b/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
@@ -10,6 +10,7 @@
10 10
11/dts-v1/; 11/dts-v1/;
12/include/ "r8a73a4.dtsi" 12/include/ "r8a73a4.dtsi"
13#include <dt-bindings/gpio/gpio.h>
13 14
14/ { 15/ {
15 model = "APE6EVM"; 16 model = "APE6EVM";
@@ -24,6 +25,34 @@
24 reg = <0 0x40000000 0 0x40000000>; 25 reg = <0 0x40000000 0 0x40000000>;
25 }; 26 };
26 27
28 vcc_mmc0: regulator@0 {
29 compatible = "regulator-fixed";
30 regulator-name = "MMC0 Vcc";
31 regulator-min-microvolt = <2800000>;
32 regulator-max-microvolt = <2800000>;
33 regulator-always-on;
34 };
35
36 vcc_sdhi0: regulator@1 {
37 compatible = "regulator-fixed";
38
39 regulator-name = "SDHI0 Vcc";
40 regulator-min-microvolt = <3300000>;
41 regulator-max-microvolt = <3300000>;
42
43 gpio = <&pfc 76 GPIO_ACTIVE_HIGH>;
44 enable-active-high;
45 };
46
47 /* Common 3.3V rail, used by several devices on APE6EVM */
48 ape6evm_fixed_3v3: regulator@2 {
49 compatible = "regulator-fixed";
50 regulator-name = "3V3";
51 regulator-min-microvolt = <3300000>;
52 regulator-max-microvolt = <3300000>;
53 regulator-always-on;
54 };
55
27 lbsc { 56 lbsc {
28 compatible = "simple-bus"; 57 compatible = "simple-bus";
29 #address-cells = <1>; 58 #address-cells = <1>;
@@ -33,6 +62,7 @@
33}; 62};
34 63
35&i2c5 { 64&i2c5 {
65 status = "okay";
36 vdd_dvfs: max8973@1b { 66 vdd_dvfs: max8973@1b {
37 compatible = "maxim,max8973"; 67 compatible = "maxim,max8973";
38 reg = <0x1b>; 68 reg = <0x1b>;
@@ -62,4 +92,47 @@
62 renesas,groups = "scifa0_data"; 92 renesas,groups = "scifa0_data";
63 renesas,function = "scifa0"; 93 renesas,function = "scifa0";
64 }; 94 };
95
96 mmc0_pins: mmcif {
97 renesas,groups = "mmc0_data8", "mmc0_ctrl";
98 renesas,function = "mmc0";
99 };
100
101 sdhi0_pins: sdhi0 {
102 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd";
103 renesas,function = "sdhi0";
104 };
105
106 sdhi1_pins: sdhi1 {
107 renesas,groups = "sdhi1_data4", "sdhi1_ctrl";
108 renesas,function = "sdhi1";
109 };
110};
111
112&mmcif0 {
113 vmmc-supply = <&vcc_mmc0>;
114 bus-width = <8>;
115 non-removable;
116 pinctrl-names = "default";
117 pinctrl-0 = <&mmc0_pins>;
118 status = "okay";
119};
120
121&sdhi0 {
122 vmmc-supply = <&vcc_sdhi0>;
123 bus-width = <4>;
124 toshiba,mmc-wrprotect-disable;
125 pinctrl-names = "default";
126 pinctrl-0 = <&sdhi0_pins>;
127 status = "okay";
128};
129
130&sdhi1 {
131 vmmc-supply = <&ape6evm_fixed_3v3>;
132 bus-width = <4>;
133 broken-cd;
134 toshiba,mmc-wrprotect-disable;
135 pinctrl-names = "default";
136 pinctrl-0 = <&sdhi1_pins>;
137 status = "okay";
65}; 138};
diff --git a/arch/arm/boot/dts/r8a73a4-ape6evm.dts b/arch/arm/boot/dts/r8a73a4-ape6evm.dts
index 72f867e65791..91436b58016f 100644
--- a/arch/arm/boot/dts/r8a73a4-ape6evm.dts
+++ b/arch/arm/boot/dts/r8a73a4-ape6evm.dts
@@ -52,6 +52,7 @@
52}; 52};
53 53
54&i2c5 { 54&i2c5 {
55 status = "okay";
55 vdd_dvfs: max8973@1b { 56 vdd_dvfs: max8973@1b {
56 compatible = "maxim,max8973"; 57 compatible = "maxim,max8973";
57 reg = <0x1b>; 58 reg = <0x1b>;
diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
index 6c26caa880f2..287e047592a0 100644
--- a/arch/arm/boot/dts/r8a73a4.dtsi
+++ b/arch/arm/boot/dts/r8a73a4.dtsi
@@ -78,6 +78,49 @@
78 <0 56 4>, <0 57 4>; 78 <0 56 4>, <0 57 4>;
79 }; 79 };
80 80
81 dmac: dma-multiplexer@0 {
82 compatible = "renesas,shdma-mux";
83 #dma-cells = <1>;
84 dma-channels = <20>;
85 dma-requests = <256>;
86 #address-cells = <2>;
87 #size-cells = <2>;
88 ranges;
89
90 dma0: dma-controller@e6700020 {
91 compatible = "renesas,shdma-r8a73a4";
92 reg = <0 0xe6700020 0 0x89e0>;
93 interrupt-parent = <&gic>;
94 interrupts = <0 220 4
95 0 200 4
96 0 201 4
97 0 202 4
98 0 203 4
99 0 204 4
100 0 205 4
101 0 206 4
102 0 207 4
103 0 208 4
104 0 209 4
105 0 210 4
106 0 211 4
107 0 212 4
108 0 213 4
109 0 214 4
110 0 215 4
111 0 216 4
112 0 217 4
113 0 218 4
114 0 219 4>;
115 interrupt-names = "error",
116 "ch0", "ch1", "ch2", "ch3",
117 "ch4", "ch5", "ch6", "ch7",
118 "ch8", "ch9", "ch10", "ch11",
119 "ch12", "ch13", "ch14", "ch15",
120 "ch16", "ch17", "ch18", "ch19";
121 };
122 };
123
81 thermal@e61f0000 { 124 thermal@e61f0000 {
82 compatible = "renesas,rcar-thermal"; 125 compatible = "renesas,rcar-thermal";
83 reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>, 126 reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>,
@@ -93,6 +136,7 @@
93 reg = <0 0xe6500000 0 0x428>; 136 reg = <0 0xe6500000 0 0x428>;
94 interrupt-parent = <&gic>; 137 interrupt-parent = <&gic>;
95 interrupts = <0 174 0x4>; 138 interrupts = <0 174 0x4>;
139 status = "disabled";
96 }; 140 };
97 141
98 i2c1: i2c@e6510000 { 142 i2c1: i2c@e6510000 {
@@ -102,6 +146,7 @@
102 reg = <0 0xe6510000 0 0x428>; 146 reg = <0 0xe6510000 0 0x428>;
103 interrupt-parent = <&gic>; 147 interrupt-parent = <&gic>;
104 interrupts = <0 175 0x4>; 148 interrupts = <0 175 0x4>;
149 status = "disabled";
105 }; 150 };
106 151
107 i2c2: i2c@e6520000 { 152 i2c2: i2c@e6520000 {
@@ -111,6 +156,7 @@
111 reg = <0 0xe6520000 0 0x428>; 156 reg = <0 0xe6520000 0 0x428>;
112 interrupt-parent = <&gic>; 157 interrupt-parent = <&gic>;
113 interrupts = <0 176 0x4>; 158 interrupts = <0 176 0x4>;
159 status = "disabled";
114 }; 160 };
115 161
116 i2c3: i2c@e6530000 { 162 i2c3: i2c@e6530000 {
@@ -120,6 +166,7 @@
120 reg = <0 0xe6530000 0 0x428>; 166 reg = <0 0xe6530000 0 0x428>;
121 interrupt-parent = <&gic>; 167 interrupt-parent = <&gic>;
122 interrupts = <0 177 0x4>; 168 interrupts = <0 177 0x4>;
169 status = "disabled";
123 }; 170 };
124 171
125 i2c4: i2c@e6540000 { 172 i2c4: i2c@e6540000 {
@@ -129,6 +176,7 @@
129 reg = <0 0xe6540000 0 0x428>; 176 reg = <0 0xe6540000 0 0x428>;
130 interrupt-parent = <&gic>; 177 interrupt-parent = <&gic>;
131 interrupts = <0 178 0x4>; 178 interrupts = <0 178 0x4>;
179 status = "disabled";
132 }; 180 };
133 181
134 i2c5: i2c@e60b0000 { 182 i2c5: i2c@e60b0000 {
@@ -138,6 +186,7 @@
138 reg = <0 0xe60b0000 0 0x428>; 186 reg = <0 0xe60b0000 0 0x428>;
139 interrupt-parent = <&gic>; 187 interrupt-parent = <&gic>;
140 interrupts = <0 179 0x4>; 188 interrupts = <0 179 0x4>;
189 status = "disabled";
141 }; 190 };
142 191
143 i2c6: i2c@e6550000 { 192 i2c6: i2c@e6550000 {
@@ -147,6 +196,7 @@
147 reg = <0 0xe6550000 0 0x428>; 196 reg = <0 0xe6550000 0 0x428>;
148 interrupt-parent = <&gic>; 197 interrupt-parent = <&gic>;
149 interrupts = <0 184 0x4>; 198 interrupts = <0 184 0x4>;
199 status = "disabled";
150 }; 200 };
151 201
152 i2c7: i2c@e6560000 { 202 i2c7: i2c@e6560000 {
@@ -156,6 +206,7 @@
156 reg = <0 0xe6560000 0 0x428>; 206 reg = <0 0xe6560000 0 0x428>;
157 interrupt-parent = <&gic>; 207 interrupt-parent = <&gic>;
158 interrupts = <0 185 0x4>; 208 interrupts = <0 185 0x4>;
209 status = "disabled";
159 }; 210 };
160 211
161 i2c8: i2c@e6570000 { 212 i2c8: i2c@e6570000 {
@@ -165,6 +216,7 @@
165 reg = <0 0xe6570000 0 0x428>; 216 reg = <0 0xe6570000 0 0x428>;
166 interrupt-parent = <&gic>; 217 interrupt-parent = <&gic>;
167 interrupts = <0 173 0x4>; 218 interrupts = <0 173 0x4>;
219 status = "disabled";
168 }; 220 };
169 221
170 mmcif0: mmcif@ee200000 { 222 mmcif0: mmcif@ee200000 {
@@ -193,7 +245,7 @@
193 }; 245 };
194 246
195 sdhi0: sdhi@ee100000 { 247 sdhi0: sdhi@ee100000 {
196 compatible = "renesas,r8a73a4-sdhi"; 248 compatible = "renesas,sdhi-r8a73a4";
197 reg = <0 0xee100000 0 0x100>; 249 reg = <0 0xee100000 0 0x100>;
198 interrupt-parent = <&gic>; 250 interrupt-parent = <&gic>;
199 interrupts = <0 165 4>; 251 interrupts = <0 165 4>;
@@ -202,7 +254,7 @@
202 }; 254 };
203 255
204 sdhi1: sdhi@ee120000 { 256 sdhi1: sdhi@ee120000 {
205 compatible = "renesas,r8a73a4-sdhi"; 257 compatible = "renesas,sdhi-r8a73a4";
206 reg = <0 0xee120000 0 0x100>; 258 reg = <0 0xee120000 0 0x100>;
207 interrupt-parent = <&gic>; 259 interrupt-parent = <&gic>;
208 interrupts = <0 166 4>; 260 interrupts = <0 166 4>;
@@ -211,7 +263,7 @@
211 }; 263 };
212 264
213 sdhi2: sdhi@ee140000 { 265 sdhi2: sdhi@ee140000 {
214 compatible = "renesas,r8a73a4-sdhi"; 266 compatible = "renesas,sdhi-r8a73a4";
215 reg = <0 0xee140000 0 0x100>; 267 reg = <0 0xee140000 0 0x100>;
216 interrupt-parent = <&gic>; 268 interrupt-parent = <&gic>;
217 interrupts = <0 167 4>; 269 interrupts = <0 167 4>;
diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
index c638e4ab91b8..1c56c5e56950 100644
--- a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
+++ b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
@@ -11,6 +11,7 @@
11/dts-v1/; 11/dts-v1/;
12/include/ "r8a7740.dtsi" 12/include/ "r8a7740.dtsi"
13#include <dt-bindings/gpio/gpio.h> 13#include <dt-bindings/gpio/gpio.h>
14#include <dt-bindings/pwm/pwm.h>
14 15
15/ { 16/ {
16 model = "armadillo 800 eva reference"; 17 model = "armadillo 800 eva reference";
@@ -34,6 +35,33 @@
34 regulator-boot-on; 35 regulator-boot-on;
35 }; 36 };
36 37
38 vcc_sdhi0: regulator@1 {
39 compatible = "regulator-fixed";
40
41 regulator-name = "SDHI0 Vcc";
42 regulator-min-microvolt = <3300000>;
43 regulator-max-microvolt = <3300000>;
44
45 gpio = <&pfc 75 GPIO_ACTIVE_HIGH>;
46 enable-active-high;
47 };
48
49 vccq_sdhi0: regulator@2 {
50 compatible = "regulator-gpio";
51
52 regulator-name = "SDHI0 VccQ";
53 regulator-min-microvolt = <1800000>;
54 regulator-max-microvolt = <3300000>;
55 vin-supply = <&vcc_sdhi0>;
56
57 enable-gpio = <&pfc 74 GPIO_ACTIVE_HIGH>;
58 gpios = <&pfc 17 GPIO_ACTIVE_HIGH>;
59 states = <3300000 0
60 1800000 1>;
61
62 enable-active-high;
63 };
64
37 leds { 65 leds {
38 compatible = "gpio-leds"; 66 compatible = "gpio-leds";
39 led1 { 67 led1 {
@@ -49,9 +77,19 @@
49 gpios = <&pfc 177 GPIO_ACTIVE_HIGH>; 77 gpios = <&pfc 177 GPIO_ACTIVE_HIGH>;
50 }; 78 };
51 }; 79 };
80
81 backlight {
82 compatible = "pwm-backlight";
83 pwms = <&tpu 2 33333 PWM_POLARITY_INVERTED>;
84 brightness-levels = <0 1 2 4 8 16 32 64 128 255>;
85 default-brightness-level = <9>;
86 pinctrl-0 = <&backlight_pins>;
87 pinctrl-names = "default";
88 };
52}; 89};
53 90
54&i2c0 { 91&i2c0 {
92 status = "okay";
55 touchscreen: st1232@55 { 93 touchscreen: st1232@55 {
56 compatible = "sitronix,st1232"; 94 compatible = "sitronix,st1232";
57 reg = <0x55>; 95 reg = <0x55>;
@@ -76,4 +114,44 @@
76 renesas,groups = "intc_irq10"; 114 renesas,groups = "intc_irq10";
77 renesas,function = "intc"; 115 renesas,function = "intc";
78 }; 116 };
117
118 backlight_pins: backlight {
119 renesas,groups = "tpu0_to2_1";
120 renesas,function = "tpu0";
121 };
122
123 mmc0_pins: mmc0 {
124 renesas,groups = "mmc0_data8_1", "mmc0_ctrl_1";
125 renesas,function = "mmc0";
126 };
127
128 sdhi0_pins: sdhi0 {
129 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_wp";
130 renesas,function = "sdhi0";
131 };
132};
133
134&tpu {
135 status = "okay";
136};
137
138&mmcif0 {
139 pinctrl-0 = <&mmc0_pins>;
140 pinctrl-names = "default";
141
142 vmmc-supply = <&reg_3p3v>;
143 bus-width = <8>;
144 non-removable;
145 status = "okay";
146};
147
148&sdhi0 {
149 pinctrl-0 = <&sdhi0_pins>;
150 pinctrl-names = "default";
151
152 vmmc-supply = <&vcc_sdhi0>;
153 vqmmc-supply = <&vccq_sdhi0>;
154 bus-width = <4>;
155 cd-gpios = <&pfc 167 GPIO_ACTIVE_LOW>;
156 status = "okay";
79}; 157};
diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index 44d3d520e01f..ae1e230f711d 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -131,6 +131,7 @@
131 0 202 0x4 131 0 202 0x4
132 0 203 0x4 132 0 203 0x4
133 0 204 0x4>; 133 0 204 0x4>;
134 status = "disabled";
134 }; 135 };
135 136
136 i2c1: i2c@e6c20000 { 137 i2c1: i2c@e6c20000 {
@@ -143,6 +144,7 @@
143 0 71 0x4 144 0 71 0x4
144 0 72 0x4 145 0 72 0x4
145 0 73 0x4>; 146 0 73 0x4>;
147 status = "disabled";
146 }; 148 };
147 149
148 pfc: pfc@e6050000 { 150 pfc: pfc@e6050000 {
@@ -159,4 +161,37 @@
159 status = "disabled"; 161 status = "disabled";
160 #pwm-cells = <3>; 162 #pwm-cells = <3>;
161 }; 163 };
164
165 mmcif0: mmcif@e6bd0000 {
166 compatible = "renesas,sh-mmcif";
167 reg = <0xe6bd0000 0x100>;
168 interrupt-parent = <&gic>;
169 interrupts = <0 56 4
170 0 57 4>;
171 status = "disabled";
172 };
173
174 sdhi0: sdhi@e6850000 {
175 compatible = "renesas,sdhi-r8a7740";
176 reg = <0xe6850000 0x100>;
177 interrupt-parent = <&gic>;
178 interrupts = <0 117 4
179 0 118 4
180 0 119 4>;
181 cap-sd-highspeed;
182 cap-sdio-irq;
183 status = "disabled";
184 };
185
186 sdhi1: sdhi@e6860000 {
187 compatible = "renesas,sdhi-r8a7740";
188 reg = <0xe6860000 0x100>;
189 interrupt-parent = <&gic>;
190 interrupts = <0 121 4
191 0 122 4
192 0 123 4>;
193 cap-sd-highspeed;
194 cap-sdio-irq;
195 status = "disabled";
196 };
162}; 197};
diff --git a/arch/arm/boot/dts/r8a7778-bockw-reference.dts b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
index 9bb903a3230d..969e386e852c 100644
--- a/arch/arm/boot/dts/r8a7778-bockw-reference.dts
+++ b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
@@ -22,11 +22,36 @@
22 compatible = "renesas,bockw-reference", "renesas,r8a7778"; 22 compatible = "renesas,bockw-reference", "renesas,r8a7778";
23 23
24 chosen { 24 chosen {
25 bootargs = "console=ttySC0,115200 ignore_loglevel rw"; 25 bootargs = "console=ttySC0,115200 ignore_loglevel root=/dev/nfs ip=dhcp rw";
26 }; 26 };
27 27
28 memory { 28 memory {
29 device_type = "memory"; 29 device_type = "memory";
30 reg = <0x60000000 0x10000000>; 30 reg = <0x60000000 0x10000000>;
31 }; 31 };
32
33 fixedregulator3v3: fixedregulator@0 {
34 compatible = "regulator-fixed";
35 regulator-name = "fixed-3.3V";
36 regulator-min-microvolt = <3300000>;
37 regulator-max-microvolt = <3300000>;
38 regulator-boot-on;
39 regulator-always-on;
40 };
41
42 ethernet@18300000 {
43 compatible = "smsc,lan9220", "smsc,lan9115";
44 reg = <0x18300000 0x1000>;
45
46 phy-mode = "mii";
47 interrupt-parent = <&irqpin>;
48 interrupts = <0 0>; /* IRQ0: hwirq 0 on irqpin */
49 reg-io-width = <4>;
50 vddvario-supply = <&fixedregulator3v3>;
51 vdd33a-supply = <&fixedregulator3v3>;
52 };
53};
54
55&irqpin {
56 status = "okay";
32}; 57};
diff --git a/arch/arm/boot/dts/r8a7778.dtsi b/arch/arm/boot/dts/r8a7778.dtsi
index 45ac404ab6d8..a6308a399e2d 100644
--- a/arch/arm/boot/dts/r8a7778.dtsi
+++ b/arch/arm/boot/dts/r8a7778.dtsi
@@ -33,6 +33,25 @@
33 <0xfe430000 0x100>; 33 <0xfe430000 0x100>;
34 }; 34 };
35 35
36 /* irqpin: IRQ0 - IRQ3 */
37 irqpin: irqpin@fe78001c {
38 compatible = "renesas,intc-irqpin";
39 #interrupt-cells = <2>;
40 interrupt-controller;
41 status = "disabled"; /* default off */
42 reg = <0xfe78001c 4>,
43 <0xfe780010 4>,
44 <0xfe780024 4>,
45 <0xfe780044 4>,
46 <0xfe780064 4>;
47 interrupt-parent = <&gic>;
48 interrupts = <0 27 0x4
49 0 28 0x4
50 0 29 0x4
51 0 30 0x4>;
52 sense-bitfield-width = <2>;
53 };
54
36 gpio0: gpio@ffc40000 { 55 gpio0: gpio@ffc40000 {
37 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar"; 56 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
38 reg = <0xffc40000 0x2c>; 57 reg = <0xffc40000 0x2c>;
@@ -96,6 +115,5 @@
96 pfc: pfc@fffc0000 { 115 pfc: pfc@fffc0000 {
97 compatible = "renesas,pfc-r8a7778"; 116 compatible = "renesas,pfc-r8a7778";
98 reg = <0xfffc000 0x118>; 117 reg = <0xfffc000 0x118>;
99 #gpio-range-cells = <3>;
100 }; 118 };
101}; 119};
diff --git a/arch/arm/boot/dts/r8a7779-marzen-reference.dts b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
index 6d5508392252..ab4110aa3c3b 100644
--- a/arch/arm/boot/dts/r8a7779-marzen-reference.dts
+++ b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
@@ -42,8 +42,8 @@
42 pinctrl-names = "default"; 42 pinctrl-names = "default";
43 43
44 phy-mode = "mii"; 44 phy-mode = "mii";
45 interrupt-parent = <&gic>; 45 interrupt-parent = <&irqpin0>;
46 interrupts = <0 28 0x4>; 46 interrupts = <1 0>; /* IRQ1: hwirq 1 on irqpin0 */
47 reg-io-width = <4>; 47 reg-io-width = <4>;
48 vddvario-supply = <&fixedregulator3v3>; 48 vddvario-supply = <&fixedregulator3v3>;
49 vdd33a-supply = <&fixedregulator3v3>; 49 vdd33a-supply = <&fixedregulator3v3>;
@@ -63,6 +63,10 @@
63 }; 63 };
64}; 64};
65 65
66&irqpin0 {
67 status = "okay";
68};
69
66&pfc { 70&pfc {
67 pinctrl-0 = <&scif2_pins &scif4_pins &sdhi0_pins>; 71 pinctrl-0 = <&scif2_pins &scif4_pins &sdhi0_pins>;
68 pinctrl-names = "default"; 72 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index 23a62447359c..19faeac3fd2e 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -135,6 +135,7 @@
135 irqpin0: irqpin@fe780010 { 135 irqpin0: irqpin@fe780010 {
136 compatible = "renesas,intc-irqpin"; 136 compatible = "renesas,intc-irqpin";
137 #interrupt-cells = <2>; 137 #interrupt-cells = <2>;
138 status = "disabled";
138 interrupt-controller; 139 interrupt-controller;
139 reg = <0xfe78001c 4>, 140 reg = <0xfe78001c 4>,
140 <0xfe780010 4>, 141 <0xfe780010 4>,
@@ -156,6 +157,7 @@
156 reg = <0xffc70000 0x1000>; 157 reg = <0xffc70000 0x1000>;
157 interrupt-parent = <&gic>; 158 interrupt-parent = <&gic>;
158 interrupts = <0 79 0x4>; 159 interrupts = <0 79 0x4>;
160 status = "disabled";
159 }; 161 };
160 162
161 i2c1: i2c@ffc71000 { 163 i2c1: i2c@ffc71000 {
@@ -165,6 +167,7 @@
165 reg = <0xffc71000 0x1000>; 167 reg = <0xffc71000 0x1000>;
166 interrupt-parent = <&gic>; 168 interrupt-parent = <&gic>;
167 interrupts = <0 82 0x4>; 169 interrupts = <0 82 0x4>;
170 status = "disabled";
168 }; 171 };
169 172
170 i2c2: i2c@ffc72000 { 173 i2c2: i2c@ffc72000 {
@@ -174,6 +177,7 @@
174 reg = <0xffc72000 0x1000>; 177 reg = <0xffc72000 0x1000>;
175 interrupt-parent = <&gic>; 178 interrupt-parent = <&gic>;
176 interrupts = <0 80 0x4>; 179 interrupts = <0 80 0x4>;
180 status = "disabled";
177 }; 181 };
178 182
179 i2c3: i2c@ffc73000 { 183 i2c3: i2c@ffc73000 {
@@ -183,12 +187,12 @@
183 reg = <0xffc73000 0x1000>; 187 reg = <0xffc73000 0x1000>;
184 interrupt-parent = <&gic>; 188 interrupt-parent = <&gic>;
185 interrupts = <0 81 0x4>; 189 interrupts = <0 81 0x4>;
190 status = "disabled";
186 }; 191 };
187 192
188 pfc: pfc@fffc0000 { 193 pfc: pfc@fffc0000 {
189 compatible = "renesas,pfc-r8a7779"; 194 compatible = "renesas,pfc-r8a7779";
190 reg = <0xfffc0000 0x23c>; 195 reg = <0xfffc0000 0x23c>;
191 #gpio-range-cells = <3>;
192 }; 196 };
193 197
194 thermal@ffc48000 { 198 thermal@ffc48000 {
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 3b879e7c697c..ee845fad939b 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -24,6 +24,55 @@
24 reg = <0>; 24 reg = <0>;
25 clock-frequency = <1300000000>; 25 clock-frequency = <1300000000>;
26 }; 26 };
27
28 cpu1: cpu@1 {
29 device_type = "cpu";
30 compatible = "arm,cortex-a15";
31 reg = <1>;
32 clock-frequency = <1300000000>;
33 };
34
35 cpu2: cpu@2 {
36 device_type = "cpu";
37 compatible = "arm,cortex-a15";
38 reg = <2>;
39 clock-frequency = <1300000000>;
40 };
41
42 cpu3: cpu@3 {
43 device_type = "cpu";
44 compatible = "arm,cortex-a15";
45 reg = <3>;
46 clock-frequency = <1300000000>;
47 };
48
49 cpu4: cpu@4 {
50 device_type = "cpu";
51 compatible = "arm,cortex-a7";
52 reg = <0x100>;
53 clock-frequency = <780000000>;
54 };
55
56 cpu5: cpu@5 {
57 device_type = "cpu";
58 compatible = "arm,cortex-a7";
59 reg = <0x101>;
60 clock-frequency = <780000000>;
61 };
62
63 cpu6: cpu@6 {
64 device_type = "cpu";
65 compatible = "arm,cortex-a7";
66 reg = <0x102>;
67 clock-frequency = <780000000>;
68 };
69
70 cpu7: cpu@7 {
71 device_type = "cpu";
72 compatible = "arm,cortex-a7";
73 reg = <0x103>;
74 clock-frequency = <780000000>;
75 };
27 }; 76 };
28 77
29 gic: interrupt-controller@f1001000 { 78 gic: interrupt-controller@f1001000 {
@@ -127,6 +176,46 @@
127 interrupts = <0 0 4>, <0 1 4>, <0 2 4>, <0 3 4>; 176 interrupts = <0 0 4>, <0 1 4>, <0 2 4>, <0 3 4>;
128 }; 177 };
129 178
179 i2c0: i2c@e6508000 {
180 #address-cells = <1>;
181 #size-cells = <0>;
182 compatible = "renesas,i2c-r8a7790";
183 reg = <0 0xe6508000 0 0x40>;
184 interrupt-parent = <&gic>;
185 interrupts = <0 287 0x4>;
186 status = "disabled";
187 };
188
189 i2c1: i2c@e6518000 {
190 #address-cells = <1>;
191 #size-cells = <0>;
192 compatible = "renesas,i2c-r8a7790";
193 reg = <0 0xe6518000 0 0x40>;
194 interrupt-parent = <&gic>;
195 interrupts = <0 288 0x4>;
196 status = "disabled";
197 };
198
199 i2c2: i2c@e6530000 {
200 #address-cells = <1>;
201 #size-cells = <0>;
202 compatible = "renesas,i2c-r8a7790";
203 reg = <0 0xe6530000 0 0x40>;
204 interrupt-parent = <&gic>;
205 interrupts = <0 286 0x4>;
206 status = "disabled";
207 };
208
209 i2c3: i2c@e6540000 {
210 #address-cells = <1>;
211 #size-cells = <0>;
212 compatible = "renesas,i2c-r8a7790";
213 reg = <0 0xe6540000 0 0x40>;
214 interrupt-parent = <&gic>;
215 interrupts = <0 290 0x4>;
216 status = "disabled";
217 };
218
130 mmcif0: mmcif@ee200000 { 219 mmcif0: mmcif@ee200000 {
131 compatible = "renesas,sh-mmcif"; 220 compatible = "renesas,sh-mmcif";
132 reg = <0 0xee200000 0 0x80>; 221 reg = <0 0xee200000 0 0x80>;
@@ -148,11 +237,10 @@
148 pfc: pfc@e6060000 { 237 pfc: pfc@e6060000 {
149 compatible = "renesas,pfc-r8a7790"; 238 compatible = "renesas,pfc-r8a7790";
150 reg = <0 0xe6060000 0 0x250>; 239 reg = <0 0xe6060000 0 0x250>;
151 #gpio-range-cells = <3>;
152 }; 240 };
153 241
154 sdhi0: sdhi@ee100000 { 242 sdhi0: sdhi@ee100000 {
155 compatible = "renesas,r8a7790-sdhi"; 243 compatible = "renesas,sdhi-r8a7790";
156 reg = <0 0xee100000 0 0x100>; 244 reg = <0 0xee100000 0 0x100>;
157 interrupt-parent = <&gic>; 245 interrupt-parent = <&gic>;
158 interrupts = <0 165 4>; 246 interrupts = <0 165 4>;
@@ -161,7 +249,7 @@
161 }; 249 };
162 250
163 sdhi1: sdhi@ee120000 { 251 sdhi1: sdhi@ee120000 {
164 compatible = "renesas,r8a7790-sdhi"; 252 compatible = "renesas,sdhi-r8a7790";
165 reg = <0 0xee120000 0 0x100>; 253 reg = <0 0xee120000 0 0x100>;
166 interrupt-parent = <&gic>; 254 interrupt-parent = <&gic>;
167 interrupts = <0 166 4>; 255 interrupts = <0 166 4>;
@@ -170,7 +258,7 @@
170 }; 258 };
171 259
172 sdhi2: sdhi@ee140000 { 260 sdhi2: sdhi@ee140000 {
173 compatible = "renesas,r8a7790-sdhi"; 261 compatible = "renesas,sdhi-r8a7790";
174 reg = <0 0xee140000 0 0x100>; 262 reg = <0 0xee140000 0 0x100>;
175 interrupt-parent = <&gic>; 263 interrupt-parent = <&gic>;
176 interrupts = <0 167 4>; 264 interrupts = <0 167 4>;
@@ -179,7 +267,7 @@
179 }; 267 };
180 268
181 sdhi3: sdhi@ee160000 { 269 sdhi3: sdhi@ee160000 {
182 compatible = "renesas,r8a7790-sdhi"; 270 compatible = "renesas,sdhi-r8a7790";
183 reg = <0 0xee160000 0 0x100>; 271 reg = <0 0xee160000 0 0x100>;
184 interrupt-parent = <&gic>; 272 interrupt-parent = <&gic>;
185 interrupts = <0 168 4>; 273 interrupts = <0 168 4>;
diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
new file mode 100644
index 000000000000..1ce5250ec278
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -0,0 +1,32 @@
1/*
2 * Device Tree Source for the Koelsch board
3 *
4 * Copyright (C) 2013 Renesas Electronics Corporation
5 * Copyright (C) 2013 Renesas Solutions Corp.
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12/dts-v1/;
13/include/ "r8a7791.dtsi"
14
15/ {
16 model = "Koelsch";
17 compatible = "renesas,koelsch", "renesas,r8a7791";
18
19 chosen {
20 bootargs = "console=ttySC6,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp";
21 };
22
23 memory@40000000 {
24 device_type = "memory";
25 reg = <0 0x40000000 0 0x80000000>;
26 };
27
28 lbsc {
29 #address-cells = <1>;
30 #size-cells = <1>;
31 };
32};
diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
new file mode 100644
index 000000000000..fea5cfef4691
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -0,0 +1,74 @@
1/*
2 * Device Tree Source for the r8a7791 SoC
3 *
4 * Copyright (C) 2013 Renesas Electronics Corporation
5 * Copyright (C) 2013 Renesas Solutions Corp.
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12/ {
13 compatible = "renesas,r8a7791";
14 interrupt-parent = <&gic>;
15 #address-cells = <2>;
16 #size-cells = <2>;
17
18 cpus {
19 #address-cells = <1>;
20 #size-cells = <0>;
21
22 cpu0: cpu@0 {
23 device_type = "cpu";
24 compatible = "arm,cortex-a15";
25 reg = <0>;
26 clock-frequency = <1300000000>;
27 };
28
29 cpu1: cpu@1 {
30 device_type = "cpu";
31 compatible = "arm,cortex-a15";
32 reg = <1>;
33 clock-frequency = <1300000000>;
34 };
35 };
36
37 gic: interrupt-controller@f1001000 {
38 compatible = "arm,cortex-a15-gic";
39 #interrupt-cells = <3>;
40 #address-cells = <0>;
41 interrupt-controller;
42 reg = <0 0xf1001000 0 0x1000>,
43 <0 0xf1002000 0 0x1000>,
44 <0 0xf1004000 0 0x2000>,
45 <0 0xf1006000 0 0x2000>;
46 interrupts = <1 9 0xf04>;
47 };
48
49 timer {
50 compatible = "arm,armv7-timer";
51 interrupts = <1 13 0xf08>,
52 <1 14 0xf08>,
53 <1 11 0xf08>,
54 <1 10 0xf08>;
55 };
56
57 irqc0: interrupt-controller@e61c0000 {
58 compatible = "renesas,irqc";
59 #interrupt-cells = <2>;
60 interrupt-controller;
61 reg = <0 0xe61c0000 0 0x200>;
62 interrupt-parent = <&gic>;
63 interrupts = <0 0 4>,
64 <0 1 4>,
65 <0 2 4>,
66 <0 3 4>,
67 <0 12 4>,
68 <0 13 4>,
69 <0 14 4>,
70 <0 15 4>,
71 <0 16 4>,
72 <0 17 4>;
73 };
74};
diff --git a/arch/arm/boot/dts/rk3066a-bqcurie2.dts b/arch/arm/boot/dts/rk3066a-bqcurie2.dts
new file mode 100644
index 000000000000..035df4053c21
--- /dev/null
+++ b/arch/arm/boot/dts/rk3066a-bqcurie2.dts
@@ -0,0 +1,109 @@
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/dts-v1/;
17#include "rk3066a.dtsi"
18
19/ {
20 model = "bq Curie 2";
21
22 memory {
23 reg = <0x60000000 0x40000000>;
24 };
25
26 soc {
27 uart0: serial@10124000 {
28 status = "okay";
29 };
30
31 uart1: serial@10126000 {
32 status = "okay";
33 };
34
35 uart2: serial@20064000 {
36 pinctrl-names = "default";
37 pinctrl-0 = <&uart2_xfer>;
38 status = "okay";
39 };
40
41 uart3: serial@20068000 {
42 status = "okay";
43 };
44
45 vcc_sd0: fixed-regulator {
46 compatible = "regulator-fixed";
47 regulator-name = "sdmmc-supply";
48 regulator-min-microvolt = <3000000>;
49 regulator-max-microvolt = <3000000>;
50 gpio = <&gpio3 7 GPIO_ACTIVE_LOW>;
51 startup-delay-us = <100000>;
52 };
53
54 dwmmc@10214000 { /* sdmmc */
55 num-slots = <1>;
56 status = "okay";
57
58 pinctrl-names = "default";
59 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_cd &sd0_bus4>;
60 vmmc-supply = <&vcc_sd0>;
61
62 slot@0 {
63 reg = <0>;
64 bus-width = <4>;
65 disable-wp;
66 };
67 };
68
69 dwmmc@10218000 { /* wifi */
70 num-slots = <1>;
71 status = "okay";
72 non-removable;
73
74 pinctrl-names = "default";
75 pinctrl-0 = <&sd1_clk &sd1_cmd &sd1_bus4>;
76
77 slot@0 {
78 reg = <0>;
79 bus-width = <4>;
80 disable-wp;
81 };
82 };
83
84 gpio-keys {
85 compatible = "gpio-keys";
86 #address-cells = <1>;
87 #size-cells = <0>;
88 autorepeat;
89
90 button@0 {
91 gpios = <&gpio6 2 GPIO_ACTIVE_LOW>; /* GPIO6_A2 */
92 linux,code = <116>;
93 label = "GPIO Key Power";
94 linux,input-type = <1>;
95 gpio-key,wakeup = <1>;
96 debounce-interval = <100>;
97 };
98 button@1 {
99 gpios = <&gpio4 21 GPIO_ACTIVE_LOW>; /* GPIO4_C5 */
100 linux,code = <104>;
101 label = "GPIO Key Vol-";
102 linux,input-type = <1>;
103 gpio-key,wakeup = <0>;
104 debounce-interval = <100>;
105 };
106 /* VOL+ comes somehow thru the ADC */
107 };
108 };
109};
diff --git a/arch/arm/boot/dts/rk3066a.dtsi b/arch/arm/boot/dts/rk3066a.dtsi
index 56bfac93d3f6..be5d2b09a363 100644
--- a/arch/arm/boot/dts/rk3066a.dtsi
+++ b/arch/arm/boot/dts/rk3066a.dtsi
@@ -14,15 +14,12 @@
14 */ 14 */
15 15
16#include <dt-bindings/gpio/gpio.h> 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> 17#include <dt-bindings/pinctrl/rockchip.h>
20#include "skeleton.dtsi" 18#include "rk3xxx.dtsi"
21#include "rk3066a-clocks.dtsi" 19#include "rk3066a-clocks.dtsi"
22 20
23/ { 21/ {
24 compatible = "rockchip,rk3066a"; 22 compatible = "rockchip,rk3066a";
25 interrupt-parent = <&gic>;
26 23
27 cpus { 24 cpus {
28 #address-cells = <1>; 25 #address-cells = <1>;
@@ -43,33 +40,6 @@
43 }; 40 };
44 41
45 soc { 42 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 { 43 timer@20038000 {
74 compatible = "snps,dw-apb-timer-osc"; 44 compatible = "snps,dw-apb-timer-osc";
75 reg = <0x20038000 0x100>; 45 reg = <0x20038000 0x100>;
@@ -191,17 +161,14 @@
191 uart0_xfer: uart0-xfer { 161 uart0_xfer: uart0-xfer {
192 rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_default>, 162 rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_default>,
193 <RK_GPIO1 1 RK_FUNC_1 &pcfg_pull_default>; 163 <RK_GPIO1 1 RK_FUNC_1 &pcfg_pull_default>;
194 rockchip,config = <&pcfg_pull_default>;
195 }; 164 };
196 165
197 uart0_cts: uart0-cts { 166 uart0_cts: uart0-cts {
198 rockchip,pins = <RK_GPIO1 2 RK_FUNC_1 &pcfg_pull_default>; 167 rockchip,pins = <RK_GPIO1 2 RK_FUNC_1 &pcfg_pull_default>;
199 rockchip,config = <&pcfg_pull_default>;
200 }; 168 };
201 169
202 uart0_rts: uart0-rts { 170 uart0_rts: uart0-rts {
203 rockchip,pins = <RK_GPIO1 3 RK_FUNC_1 &pcfg_pull_default>; 171 rockchip,pins = <RK_GPIO1 3 RK_FUNC_1 &pcfg_pull_default>;
204 rockchip,config = <&pcfg_pull_default>;
205 }; 172 };
206 }; 173 };
207 174
@@ -209,17 +176,14 @@
209 uart1_xfer: uart1-xfer { 176 uart1_xfer: uart1-xfer {
210 rockchip,pins = <RK_GPIO1 4 RK_FUNC_1 &pcfg_pull_default>, 177 rockchip,pins = <RK_GPIO1 4 RK_FUNC_1 &pcfg_pull_default>,
211 <RK_GPIO1 5 RK_FUNC_1 &pcfg_pull_default>; 178 <RK_GPIO1 5 RK_FUNC_1 &pcfg_pull_default>;
212 rockchip,config = <&pcfg_pull_default>;
213 }; 179 };
214 180
215 uart1_cts: uart1-cts { 181 uart1_cts: uart1-cts {
216 rockchip,pins = <RK_GPIO1 6 RK_FUNC_1 &pcfg_pull_default>; 182 rockchip,pins = <RK_GPIO1 6 RK_FUNC_1 &pcfg_pull_default>;
217 rockchip,config = <&pcfg_pull_default>;
218 }; 183 };
219 184
220 uart1_rts: uart1-rts { 185 uart1_rts: uart1-rts {
221 rockchip,pins = <RK_GPIO1 7 RK_FUNC_1 &pcfg_pull_default>; 186 rockchip,pins = <RK_GPIO1 7 RK_FUNC_1 &pcfg_pull_default>;
222 rockchip,config = <&pcfg_pull_default>;
223 }; 187 };
224 }; 188 };
225 189
@@ -227,7 +191,6 @@
227 uart2_xfer: uart2-xfer { 191 uart2_xfer: uart2-xfer {
228 rockchip,pins = <RK_GPIO1 8 RK_FUNC_1 &pcfg_pull_default>, 192 rockchip,pins = <RK_GPIO1 8 RK_FUNC_1 &pcfg_pull_default>,
229 <RK_GPIO1 9 RK_FUNC_1 &pcfg_pull_default>; 193 <RK_GPIO1 9 RK_FUNC_1 &pcfg_pull_default>;
230 rockchip,config = <&pcfg_pull_default>;
231 }; 194 };
232 /* no rts / cts for uart2 */ 195 /* no rts / cts for uart2 */
233 }; 196 };
@@ -236,44 +199,36 @@
236 uart3_xfer: uart3-xfer { 199 uart3_xfer: uart3-xfer {
237 rockchip,pins = <RK_GPIO3 27 RK_FUNC_1 &pcfg_pull_default>, 200 rockchip,pins = <RK_GPIO3 27 RK_FUNC_1 &pcfg_pull_default>,
238 <RK_GPIO3 28 RK_FUNC_1 &pcfg_pull_default>; 201 <RK_GPIO3 28 RK_FUNC_1 &pcfg_pull_default>;
239 rockchip,config = <&pcfg_pull_default>;
240 }; 202 };
241 203
242 uart3_cts: uart3-cts { 204 uart3_cts: uart3-cts {
243 rockchip,pins = <RK_GPIO3 29 RK_FUNC_1 &pcfg_pull_default>; 205 rockchip,pins = <RK_GPIO3 29 RK_FUNC_1 &pcfg_pull_default>;
244 rockchip,config = <&pcfg_pull_default>;
245 }; 206 };
246 207
247 uart3_rts: uart3-rts { 208 uart3_rts: uart3-rts {
248 rockchip,pins = <RK_GPIO3 30 RK_FUNC_1 &pcfg_pull_default>; 209 rockchip,pins = <RK_GPIO3 30 RK_FUNC_1 &pcfg_pull_default>;
249 rockchip,config = <&pcfg_pull_default>;
250 }; 210 };
251 }; 211 };
252 212
253 sd0 { 213 sd0 {
254 sd0_clk: sd0-clk { 214 sd0_clk: sd0-clk {
255 rockchip,pins = <RK_GPIO3 8 RK_FUNC_1 &pcfg_pull_default>; 215 rockchip,pins = <RK_GPIO3 8 RK_FUNC_1 &pcfg_pull_default>;
256 rockchip,config = <&pcfg_pull_default>;
257 }; 216 };
258 217
259 sd0_cmd: sd0-cmd { 218 sd0_cmd: sd0-cmd {
260 rockchip,pins = <RK_GPIO3 9 RK_FUNC_1 &pcfg_pull_default>; 219 rockchip,pins = <RK_GPIO3 9 RK_FUNC_1 &pcfg_pull_default>;
261 rockchip,config = <&pcfg_pull_default>;
262 }; 220 };
263 221
264 sd0_cd: sd0-cd { 222 sd0_cd: sd0-cd {
265 rockchip,pins = <RK_GPIO3 14 RK_FUNC_1 &pcfg_pull_default>; 223 rockchip,pins = <RK_GPIO3 14 RK_FUNC_1 &pcfg_pull_default>;
266 rockchip,config = <&pcfg_pull_default>;
267 }; 224 };
268 225
269 sd0_wp: sd0-wp { 226 sd0_wp: sd0-wp {
270 rockchip,pins = <RK_GPIO3 15 RK_FUNC_1 &pcfg_pull_default>; 227 rockchip,pins = <RK_GPIO3 15 RK_FUNC_1 &pcfg_pull_default>;
271 rockchip,config = <&pcfg_pull_default>;
272 }; 228 };
273 229
274 sd0_bus1: sd0-bus-width1 { 230 sd0_bus1: sd0-bus-width1 {
275 rockchip,pins = <RK_GPIO3 10 RK_FUNC_1 &pcfg_pull_default>; 231 rockchip,pins = <RK_GPIO3 10 RK_FUNC_1 &pcfg_pull_default>;
276 rockchip,config = <&pcfg_pull_default>;
277 }; 232 };
278 233
279 sd0_bus4: sd0-bus-width4 { 234 sd0_bus4: sd0-bus-width4 {
@@ -281,34 +236,28 @@
281 <RK_GPIO3 11 RK_FUNC_1 &pcfg_pull_default>, 236 <RK_GPIO3 11 RK_FUNC_1 &pcfg_pull_default>,
282 <RK_GPIO3 12 RK_FUNC_1 &pcfg_pull_default>, 237 <RK_GPIO3 12 RK_FUNC_1 &pcfg_pull_default>,
283 <RK_GPIO3 13 RK_FUNC_1 &pcfg_pull_default>; 238 <RK_GPIO3 13 RK_FUNC_1 &pcfg_pull_default>;
284 rockchip,config = <&pcfg_pull_default>;
285 }; 239 };
286 }; 240 };
287 241
288 sd1 { 242 sd1 {
289 sd1_clk: sd1-clk { 243 sd1_clk: sd1-clk {
290 rockchip,pins = <RK_GPIO3 21 RK_FUNC_1 &pcfg_pull_default>; 244 rockchip,pins = <RK_GPIO3 21 RK_FUNC_1 &pcfg_pull_default>;
291 rockchip,config = <&pcfg_pull_default>;
292 }; 245 };
293 246
294 sd1_cmd: sd1-cmd { 247 sd1_cmd: sd1-cmd {
295 rockchip,pins = <RK_GPIO3 16 RK_FUNC_1 &pcfg_pull_default>; 248 rockchip,pins = <RK_GPIO3 16 RK_FUNC_1 &pcfg_pull_default>;
296 rockchip,config = <&pcfg_pull_default>;
297 }; 249 };
298 250
299 sd1_cd: sd1-cd { 251 sd1_cd: sd1-cd {
300 rockchip,pins = <RK_GPIO3 22 RK_FUNC_1 &pcfg_pull_default>; 252 rockchip,pins = <RK_GPIO3 22 RK_FUNC_1 &pcfg_pull_default>;
301 rockchip,config = <&pcfg_pull_default>;
302 }; 253 };
303 254
304 sd1_wp: sd1-wp { 255 sd1_wp: sd1-wp {
305 rockchip,pins = <RK_GPIO3 23 RK_FUNC_1 &pcfg_pull_default>; 256 rockchip,pins = <RK_GPIO3 23 RK_FUNC_1 &pcfg_pull_default>;
306 rockchip,config = <&pcfg_pull_default>;
307 }; 257 };
308 258
309 sd1_bus1: sd1-bus-width1 { 259 sd1_bus1: sd1-bus-width1 {
310 rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_default>; 260 rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_default>;
311 rockchip,config = <&pcfg_pull_default>;
312 }; 261 };
313 262
314 sd1_bus4: sd1-bus-width4 { 263 sd1_bus4: sd1-bus-width4 {
@@ -316,75 +265,8 @@
316 <RK_GPIO3 18 RK_FUNC_1 &pcfg_pull_default>, 265 <RK_GPIO3 18 RK_FUNC_1 &pcfg_pull_default>,
317 <RK_GPIO3 19 RK_FUNC_1 &pcfg_pull_default>, 266 <RK_GPIO3 19 RK_FUNC_1 &pcfg_pull_default>,
318 <RK_GPIO3 20 RK_FUNC_1 &pcfg_pull_default>; 267 <RK_GPIO3 20 RK_FUNC_1 &pcfg_pull_default>;
319 rockchip,config = <&pcfg_pull_default>;
320 }; 268 };
321 }; 269 };
322 }; 270 };
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 }; 271 };
390}; 272};
diff --git a/arch/arm/boot/dts/rk3188-clocks.dtsi b/arch/arm/boot/dts/rk3188-clocks.dtsi
new file mode 100644
index 000000000000..b1b92dc245ce
--- /dev/null
+++ b/arch/arm/boot/dts/rk3188-clocks.dtsi
@@ -0,0 +1,289 @@
1/*
2 * Copyright (c) 2013 MundoReader S.L.
3 * Author: Heiko Stuebner <heiko@sntech.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16/ {
17 clocks {
18 #address-cells = <1>;
19 #size-cells = <1>;
20 ranges;
21
22 /*
23 * This is a dummy clock, to be used as placeholder on
24 * other mux clocks when a specific parent clock is not
25 * yet implemented. It should be dropped when the driver
26 * is complete.
27 */
28 dummy: dummy {
29 compatible = "fixed-clock";
30 clock-frequency = <0>;
31 #clock-cells = <0>;
32 };
33
34 xin24m: xin24m {
35 compatible = "fixed-clock";
36 clock-frequency = <24000000>;
37 #clock-cells = <0>;
38 };
39
40 dummy48m: dummy48m {
41 compatible = "fixed-clock";
42 clock-frequency = <48000000>;
43 #clock-cells = <0>;
44 };
45
46 dummy150m: dummy150m {
47 compatible = "fixed-clock";
48 clock-frequency = <150000000>;
49 #clock-cells = <0>;
50 };
51
52 clk_gates0: gate-clk@200000d0 {
53 compatible = "rockchip,rk2928-gate-clk";
54 reg = <0x200000d0 0x4>;
55 clocks = <&dummy150m>, <&dummy>,
56 <&dummy>, <&dummy>,
57 <&dummy>, <&dummy>,
58 <&dummy>, <&dummy>,
59 <&dummy>, <&dummy>,
60 <&dummy>, <&dummy>,
61 <&dummy>, <&dummy>,
62 <&dummy>, <&dummy>;
63
64 clock-output-names =
65 "gate_core_periph", "gate_cpu_gpll",
66 "gate_ddrphy", "gate_aclk_cpu",
67 "gate_hclk_cpu", "gate_pclk_cpu",
68 "gate_atclk_cpu", "gate_aclk_core",
69 "reserved", "gate_i2s0",
70 "gate_i2s0_frac", "reserved",
71 "reserved", "gate_spdif",
72 "gate_spdif_frac", "gate_testclk";
73
74 #clock-cells = <1>;
75 };
76
77 clk_gates1: gate-clk@200000d4 {
78 compatible = "rockchip,rk2928-gate-clk";
79 reg = <0x200000d4 0x4>;
80 clocks = <&xin24m>, <&xin24m>,
81 <&xin24m>, <&dummy>,
82 <&dummy>, <&xin24m>,
83 <&xin24m>, <&dummy>,
84 <&xin24m>, <&dummy>,
85 <&xin24m>, <&dummy>,
86 <&xin24m>, <&dummy>,
87 <&xin24m>, <&dummy>;
88
89 clock-output-names =
90 "gate_timer0", "gate_timer1",
91 "gate_timer3", "gate_jtag",
92 "gate_aclk_lcdc1_src", "gate_otgphy0",
93 "gate_otgphy1", "gate_ddr_gpll",
94 "gate_uart0", "gate_frac_uart0",
95 "gate_uart1", "gate_frac_uart1",
96 "gate_uart2", "gate_frac_uart2",
97 "gate_uart3", "gate_frac_uart3";
98
99 #clock-cells = <1>;
100 };
101
102 clk_gates2: gate-clk@200000d8 {
103 compatible = "rockchip,rk2928-gate-clk";
104 reg = <0x200000d8 0x4>;
105 clocks = <&clk_gates2 1>, <&dummy>,
106 <&dummy>, <&dummy>,
107 <&dummy>, <&dummy>,
108 <&clk_gates2 3>, <&dummy>,
109 <&dummy>, <&dummy>,
110 <&dummy>, <&dummy48m>,
111 <&dummy>, <&dummy48m>,
112 <&dummy>, <&dummy>;
113
114 clock-output-names =
115 "gate_periph_src", "gate_aclk_periph",
116 "gate_hclk_periph", "gate_pclk_periph",
117 "gate_smc", "gate_mac",
118 "gate_hsadc", "gate_hsadc_frac",
119 "gate_saradc", "gate_spi0",
120 "gate_spi1", "gate_mmc0",
121 "gate_mac_lbtest", "gate_mmc1",
122 "gate_emmc", "reserved";
123
124 #clock-cells = <1>;
125 };
126
127 clk_gates3: gate-clk@200000dc {
128 compatible = "rockchip,rk2928-gate-clk";
129 reg = <0x200000dc 0x4>;
130 clocks = <&dummy>, <&dummy>,
131 <&dummy>, <&dummy>,
132 <&xin24m>, <&xin24m>,
133 <&dummy>, <&dummy>,
134 <&xin24m>, <&dummy>,
135 <&dummy>, <&dummy>,
136 <&dummy>, <&dummy>,
137 <&xin24m>, <&dummy>;
138
139 clock-output-names =
140 "gate_aclk_lcdc0_src", "gate_dclk_lcdc0",
141 "gate_dclk_lcdc1", "gate_pclkin_cif0",
142 "gate_timer2", "gate_timer4",
143 "gate_hsicphy", "gate_cif0_out",
144 "gate_timer5", "gate_aclk_vepu",
145 "gate_hclk_vepu", "gate_aclk_vdpu",
146 "gate_hclk_vdpu", "reserved",
147 "gate_timer6", "gate_aclk_gpu_src";
148
149 #clock-cells = <1>;
150 };
151
152 clk_gates4: gate-clk@200000e0 {
153 compatible = "rockchip,rk2928-gate-clk";
154 reg = <0x200000e0 0x4>;
155 clocks = <&clk_gates2 2>, <&clk_gates2 3>,
156 <&clk_gates2 1>, <&clk_gates2 1>,
157 <&clk_gates2 1>, <&clk_gates2 2>,
158 <&clk_gates2 2>, <&clk_gates2 2>,
159 <&clk_gates0 4>, <&clk_gates0 4>,
160 <&clk_gates0 3>, <&dummy>,
161 <&clk_gates0 3>, <&dummy>,
162 <&dummy>, <&dummy>;
163
164 clock-output-names =
165 "gate_hclk_peri_axi_matrix", "gate_pclk_peri_axi_matrix",
166 "gate_aclk_cpu_peri", "gate_aclk_peri_axi_matrix",
167 "gate_aclk_pei_niu", "gate_hclk_usb_peri",
168 "gate_hclk_peri_ahb_arbi", "gate_hclk_emem_peri",
169 "gate_hclk_cpubus", "gate_hclk_ahb2apb",
170 "gate_aclk_strc_sys", "reserved",
171 "gate_aclk_intmem", "reserved",
172 "gate_hclk_imem1", "gate_hclk_imem0";
173
174 #clock-cells = <1>;
175 };
176
177 clk_gates5: gate-clk@200000e4 {
178 compatible = "rockchip,rk2928-gate-clk";
179 reg = <0x200000e4 0x4>;
180 clocks = <&clk_gates0 3>, <&clk_gates2 1>,
181 <&clk_gates0 5>, <&clk_gates0 5>,
182 <&clk_gates0 5>, <&clk_gates0 5>,
183 <&clk_gates0 4>, <&clk_gates0 5>,
184 <&clk_gates2 1>, <&clk_gates2 2>,
185 <&clk_gates2 2>, <&clk_gates2 2>,
186 <&clk_gates2 2>, <&clk_gates4 5>;
187
188 clock-output-names =
189 "gate_aclk_dmac1", "gate_aclk_dmac2",
190 "gate_pclk_efuse", "gate_pclk_tzpc",
191 "gate_pclk_grf", "gate_pclk_pmu",
192 "gate_hclk_rom", "gate_pclk_ddrupctl",
193 "gate_aclk_smc", "gate_hclk_nandc",
194 "gate_hclk_mmc0", "gate_hclk_mmc1",
195 "gate_hclk_emmc", "gate_hclk_otg0";
196
197 #clock-cells = <1>;
198 };
199
200 clk_gates6: gate-clk@200000e8 {
201 compatible = "rockchip,rk2928-gate-clk";
202 reg = <0x200000e8 0x4>;
203 clocks = <&clk_gates3 0>, <&clk_gates0 4>,
204 <&clk_gates0 4>, <&clk_gates1 4>,
205 <&clk_gates0 4>, <&clk_gates3 0>,
206 <&dummy>, <&dummy>,
207 <&clk_gates3 0>, <&clk_gates0 4>,
208 <&clk_gates0 4>, <&clk_gates1 4>,
209 <&clk_gates0 4>, <&clk_gates3 0>;
210
211 clock-output-names =
212 "gate_aclk_lcdc0", "gate_hclk_lcdc0",
213 "gate_hclk_lcdc1", "gate_aclk_lcdc1",
214 "gate_hclk_cif0", "gate_aclk_cif0",
215 "reserved", "reserved",
216 "gate_aclk_ipp", "gate_hclk_ipp",
217 "gate_hclk_rga", "gate_aclk_rga",
218 "gate_hclk_vio_bus", "gate_aclk_vio0";
219
220 #clock-cells = <1>;
221 };
222
223 clk_gates7: gate-clk@200000ec {
224 compatible = "rockchip,rk2928-gate-clk";
225 reg = <0x200000ec 0x4>;
226 clocks = <&clk_gates2 2>, <&clk_gates0 4>,
227 <&clk_gates0 4>, <&dummy>,
228 <&dummy>, <&clk_gates2 2>,
229 <&clk_gates2 2>, <&clk_gates0 5>,
230 <&dummy>, <&clk_gates0 5>,
231 <&clk_gates0 5>, <&clk_gates2 3>,
232 <&clk_gates2 3>, <&clk_gates2 3>,
233 <&clk_gates2 3>, <&clk_gates2 3>;
234
235 clock-output-names =
236 "gate_hclk_emac", "gate_hclk_spdif",
237 "gate_hclk_i2s0_2ch", "gate_hclk_otg1",
238 "gate_hclk_hsic", "gate_hclk_hsadc",
239 "gate_hclk_pidf", "gate_pclk_timer0",
240 "reserved", "gate_pclk_timer2",
241 "gate_pclk_pwm01", "gate_pclk_pwm23",
242 "gate_pclk_spi0", "gate_pclk_spi1",
243 "gate_pclk_saradc", "gate_pclk_wdt";
244
245 #clock-cells = <1>;
246 };
247
248 clk_gates8: gate-clk@200000f0 {
249 compatible = "rockchip,rk2928-gate-clk";
250 reg = <0x200000f0 0x4>;
251 clocks = <&clk_gates0 5>, <&clk_gates0 5>,
252 <&clk_gates2 3>, <&clk_gates2 3>,
253 <&clk_gates0 5>, <&clk_gates0 5>,
254 <&clk_gates2 3>, <&clk_gates2 3>,
255 <&clk_gates2 3>, <&clk_gates0 5>,
256 <&clk_gates0 5>, <&clk_gates0 5>,
257 <&clk_gates2 3>, <&dummy>;
258
259 clock-output-names =
260 "gate_pclk_uart0", "gate_pclk_uart1",
261 "gate_pclk_uart2", "gate_pclk_uart3",
262 "gate_pclk_i2c0", "gate_pclk_i2c1",
263 "gate_pclk_i2c2", "gate_pclk_i2c3",
264 "gate_pclk_i2c4", "gate_pclk_gpio0",
265 "gate_pclk_gpio1", "gate_pclk_gpio2",
266 "gate_pclk_gpio3", "gate_aclk_gps";
267
268 #clock-cells = <1>;
269 };
270
271 clk_gates9: gate-clk@200000f4 {
272 compatible = "rockchip,rk2928-gate-clk";
273 reg = <0x200000f4 0x4>;
274 clocks = <&dummy>, <&dummy>,
275 <&dummy>, <&dummy>,
276 <&dummy>, <&dummy>,
277 <&dummy>, <&dummy>;
278
279 clock-output-names =
280 "gate_clk_core_dbg", "gate_pclk_dbg",
281 "gate_clk_trace", "gate_atclk",
282 "gate_clk_l2c", "gate_aclk_vio1",
283 "gate_pclk_publ", "gate_aclk_gpu";
284
285 #clock-cells = <1>;
286 };
287 };
288
289};
diff --git a/arch/arm/boot/dts/rk3188-radxarock.dts b/arch/arm/boot/dts/rk3188-radxarock.dts
new file mode 100644
index 000000000000..3ba1968a70ab
--- /dev/null
+++ b/arch/arm/boot/dts/rk3188-radxarock.dts
@@ -0,0 +1,80 @@
1/*
2 * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15/dts-v1/;
16#include "rk3188.dtsi"
17
18/ {
19 model = "Radxa Rock";
20
21 memory {
22 reg = <0x60000000 0x80000000>;
23 };
24
25 soc {
26 uart0: serial@10124000 {
27 status = "okay";
28 };
29
30 uart1: serial@10126000 {
31 status = "okay";
32 };
33
34 uart2: serial@20064000 {
35 pinctrl-names = "default";
36 pinctrl-0 = <&uart2_xfer>;
37 status = "okay";
38 };
39
40 uart3: serial@20068000 {
41 status = "okay";
42 };
43
44 gpio-keys {
45 compatible = "gpio-keys";
46 #address-cells = <1>;
47 #size-cells = <0>;
48 autorepeat;
49
50 button@0 {
51 gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
52 linux,code = <116>;
53 label = "GPIO Key Power";
54 linux,input-type = <1>;
55 gpio-key,wakeup = <1>;
56 debounce-interval = <100>;
57 };
58 };
59
60 gpio-leds {
61 compatible = "gpio-leds";
62
63 green {
64 gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
65 default-state = "off";
66 };
67
68 yellow {
69 gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
70 default-state = "off";
71 };
72
73 sleep {
74 gpios = <&gpio0 15 0>;
75 default-state = "off";
76 };
77 };
78
79 };
80};
diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi
new file mode 100644
index 000000000000..1a26b03b3649
--- /dev/null
+++ b/arch/arm/boot/dts/rk3188.dtsi
@@ -0,0 +1,253 @@
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/pinctrl/rockchip.h>
18#include "rk3xxx.dtsi"
19#include "rk3188-clocks.dtsi"
20
21/ {
22 compatible = "rockchip,rk3188";
23
24 cpus {
25 #address-cells = <1>;
26 #size-cells = <0>;
27
28 cpu@0 {
29 device_type = "cpu";
30 compatible = "arm,cortex-a9";
31 next-level-cache = <&L2>;
32 reg = <0x0>;
33 };
34 cpu@1 {
35 device_type = "cpu";
36 compatible = "arm,cortex-a9";
37 next-level-cache = <&L2>;
38 reg = <0x1>;
39 };
40 cpu@2 {
41 device_type = "cpu";
42 compatible = "arm,cortex-a9";
43 next-level-cache = <&L2>;
44 reg = <0x2>;
45 };
46 cpu@3 {
47 device_type = "cpu";
48 compatible = "arm,cortex-a9";
49 next-level-cache = <&L2>;
50 reg = <0x3>;
51 };
52 };
53
54 soc {
55 global-timer@1013c200 {
56 interrupts = <GIC_PPI 11 0xf04>;
57 };
58
59 local-timer@1013c600 {
60 interrupts = <GIC_PPI 13 0xf04>;
61 };
62
63 pinctrl@20008000 {
64 compatible = "rockchip,rk3188-pinctrl";
65 reg = <0x20008000 0xa0>,
66 <0x20008164 0x1a0>;
67 reg-names = "base", "pull";
68 #address-cells = <1>;
69 #size-cells = <1>;
70 ranges;
71
72 gpio0: gpio0@0x2000a000 {
73 compatible = "rockchip,rk3188-gpio-bank0";
74 reg = <0x2000a000 0x100>,
75 <0x20004064 0x8>;
76 interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
77 clocks = <&clk_gates8 9>;
78
79 gpio-controller;
80 #gpio-cells = <2>;
81
82 interrupt-controller;
83 #interrupt-cells = <2>;
84 };
85
86 gpio1: gpio1@0x2003c000 {
87 compatible = "rockchip,gpio-bank";
88 reg = <0x2003c000 0x100>;
89 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
90 clocks = <&clk_gates8 10>;
91
92 gpio-controller;
93 #gpio-cells = <2>;
94
95 interrupt-controller;
96 #interrupt-cells = <2>;
97 };
98
99 gpio2: gpio2@2003e000 {
100 compatible = "rockchip,gpio-bank";
101 reg = <0x2003e000 0x100>;
102 interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
103 clocks = <&clk_gates8 11>;
104
105 gpio-controller;
106 #gpio-cells = <2>;
107
108 interrupt-controller;
109 #interrupt-cells = <2>;
110 };
111
112 gpio3: gpio3@20080000 {
113 compatible = "rockchip,gpio-bank";
114 reg = <0x20080000 0x100>;
115 interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
116 clocks = <&clk_gates8 12>;
117
118 gpio-controller;
119 #gpio-cells = <2>;
120
121 interrupt-controller;
122 #interrupt-cells = <2>;
123 };
124
125 pcfg_pull_up: pcfg_pull_up {
126 bias-pull-up;
127 };
128
129 pcfg_pull_down: pcfg_pull_down {
130 bias-pull-down;
131 };
132
133 pcfg_pull_none: pcfg_pull_none {
134 bias-disable;
135 };
136
137 uart0 {
138 uart0_xfer: uart0-xfer {
139 rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_none>,
140 <RK_GPIO1 1 RK_FUNC_1 &pcfg_pull_none>;
141 };
142
143 uart0_cts: uart0-cts {
144 rockchip,pins = <RK_GPIO1 2 RK_FUNC_1 &pcfg_pull_none>;
145 };
146
147 uart0_rts: uart0-rts {
148 rockchip,pins = <RK_GPIO1 3 RK_FUNC_1 &pcfg_pull_none>;
149 };
150 };
151
152 uart1 {
153 uart1_xfer: uart1-xfer {
154 rockchip,pins = <RK_GPIO1 4 RK_FUNC_1 &pcfg_pull_none>,
155 <RK_GPIO1 5 RK_FUNC_1 &pcfg_pull_none>;
156 };
157
158 uart1_cts: uart1-cts {
159 rockchip,pins = <RK_GPIO1 6 RK_FUNC_1 &pcfg_pull_none>;
160 };
161
162 uart1_rts: uart1-rts {
163 rockchip,pins = <RK_GPIO1 7 RK_FUNC_1 &pcfg_pull_none>;
164 };
165 };
166
167 uart2 {
168 uart2_xfer: uart2-xfer {
169 rockchip,pins = <RK_GPIO1 8 RK_FUNC_1 &pcfg_pull_none>,
170 <RK_GPIO1 9 RK_FUNC_1 &pcfg_pull_none>;
171 };
172 /* no rts / cts for uart2 */
173 };
174
175 uart3 {
176 uart3_xfer: uart3-xfer {
177 rockchip,pins = <RK_GPIO1 10 RK_FUNC_1 &pcfg_pull_none>,
178 <RK_GPIO1 11 RK_FUNC_1 &pcfg_pull_none>;
179 };
180
181 uart3_cts: uart3-cts {
182 rockchip,pins = <RK_GPIO1 12 RK_FUNC_1 &pcfg_pull_none>;
183 };
184
185 uart3_rts: uart3-rts {
186 rockchip,pins = <RK_GPIO1 13 RK_FUNC_1 &pcfg_pull_none>;
187 };
188 };
189
190 sd0 {
191 sd0_clk: sd0-clk {
192 rockchip,pins = <RK_GPIO3 2 RK_FUNC_1 &pcfg_pull_none>;
193 };
194
195 sd0_cmd: sd0-cmd {
196 rockchip,pins = <RK_GPIO3 3 RK_FUNC_1 &pcfg_pull_none>;
197 };
198
199 sd0_cd: sd0-cd {
200 rockchip,pins = <RK_GPIO3 8 RK_FUNC_1 &pcfg_pull_none>;
201 };
202
203 sd0_wp: sd0-wp {
204 rockchip,pins = <RK_GPIO3 9 RK_FUNC_1 &pcfg_pull_none>;
205 };
206
207 sd0_pwr: sd0-pwr {
208 rockchip,pins = <RK_GPIO3 1 RK_FUNC_1 &pcfg_pull_none>;
209 };
210
211 sd0_bus1: sd0-bus-width1 {
212 rockchip,pins = <RK_GPIO3 4 RK_FUNC_1 &pcfg_pull_none>;
213 };
214
215 sd0_bus4: sd0-bus-width4 {
216 rockchip,pins = <RK_GPIO3 4 RK_FUNC_1 &pcfg_pull_none>,
217 <RK_GPIO3 5 RK_FUNC_1 &pcfg_pull_none>,
218 <RK_GPIO3 6 RK_FUNC_1 &pcfg_pull_none>,
219 <RK_GPIO3 7 RK_FUNC_1 &pcfg_pull_none>;
220 };
221 };
222
223 sd1 {
224 sd1_clk: sd1-clk {
225 rockchip,pins = <RK_GPIO3 21 RK_FUNC_1 &pcfg_pull_none>;
226 };
227
228 sd1_cmd: sd1-cmd {
229 rockchip,pins = <RK_GPIO3 16 RK_FUNC_1 &pcfg_pull_none>;
230 };
231
232 sd1_cd: sd1-cd {
233 rockchip,pins = <RK_GPIO3 22 RK_FUNC_1 &pcfg_pull_none>;
234 };
235
236 sd1_wp: sd1-wp {
237 rockchip,pins = <RK_GPIO3 23 RK_FUNC_1 &pcfg_pull_none>;
238 };
239
240 sd1_bus1: sd1-bus-width1 {
241 rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_none>;
242 };
243
244 sd1_bus4: sd1-bus-width4 {
245 rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_none>,
246 <RK_GPIO3 18 RK_FUNC_1 &pcfg_pull_none>,
247 <RK_GPIO3 19 RK_FUNC_1 &pcfg_pull_none>,
248 <RK_GPIO3 20 RK_FUNC_1 &pcfg_pull_none>;
249 };
250 };
251 };
252 };
253};
diff --git a/arch/arm/boot/dts/rk3xxx.dtsi b/arch/arm/boot/dts/rk3xxx.dtsi
new file mode 100644
index 000000000000..0fcbcfd67de2
--- /dev/null
+++ b/arch/arm/boot/dts/rk3xxx.dtsi
@@ -0,0 +1,124 @@
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/interrupt-controller/irq.h>
17#include <dt-bindings/interrupt-controller/arm-gic.h>
18#include "skeleton.dtsi"
19
20/ {
21 interrupt-parent = <&gic>;
22
23 soc {
24 #address-cells = <1>;
25 #size-cells = <1>;
26 compatible = "simple-bus";
27 ranges;
28
29 gic: interrupt-controller@1013d000 {
30 compatible = "arm,cortex-a9-gic";
31 interrupt-controller;
32 #interrupt-cells = <3>;
33 reg = <0x1013d000 0x1000>,
34 <0x1013c100 0x0100>;
35 };
36
37 L2: l2-cache-controller@10138000 {
38 compatible = "arm,pl310-cache";
39 reg = <0x10138000 0x1000>;
40 cache-unified;
41 cache-level = <2>;
42 };
43
44 global-timer@1013c200 {
45 compatible = "arm,cortex-a9-global-timer";
46 reg = <0x1013c200 0x20>;
47 interrupts = <GIC_PPI 11 0x304>;
48 clocks = <&dummy150m>;
49 };
50
51 local-timer@1013c600 {
52 compatible = "arm,cortex-a9-twd-timer";
53 reg = <0x1013c600 0x20>;
54 interrupts = <GIC_PPI 13 0x304>;
55 clocks = <&dummy150m>;
56 };
57
58 uart0: serial@10124000 {
59 compatible = "snps,dw-apb-uart";
60 reg = <0x10124000 0x400>;
61 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
62 reg-shift = <2>;
63 reg-io-width = <1>;
64 clocks = <&clk_gates1 8>;
65 status = "disabled";
66 };
67
68 uart1: serial@10126000 {
69 compatible = "snps,dw-apb-uart";
70 reg = <0x10126000 0x400>;
71 interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
72 reg-shift = <2>;
73 reg-io-width = <1>;
74 clocks = <&clk_gates1 10>;
75 status = "disabled";
76 };
77
78 uart2: serial@20064000 {
79 compatible = "snps,dw-apb-uart";
80 reg = <0x20064000 0x400>;
81 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
82 reg-shift = <2>;
83 reg-io-width = <1>;
84 clocks = <&clk_gates1 12>;
85 status = "disabled";
86 };
87
88 uart3: serial@20068000 {
89 compatible = "snps,dw-apb-uart";
90 reg = <0x20068000 0x400>;
91 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
92 reg-shift = <2>;
93 reg-io-width = <1>;
94 clocks = <&clk_gates1 14>;
95 status = "disabled";
96 };
97
98 dwmmc@10214000 {
99 compatible = "rockchip,rk2928-dw-mshc";
100 reg = <0x10214000 0x1000>;
101 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
102 #address-cells = <1>;
103 #size-cells = <0>;
104
105 clocks = <&clk_gates5 10>, <&clk_gates2 11>;
106 clock-names = "biu", "ciu";
107
108 status = "disabled";
109 };
110
111 dwmmc@10218000 {
112 compatible = "rockchip,rk2928-dw-mshc";
113 reg = <0x10218000 0x1000>;
114 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
115 #address-cells = <1>;
116 #size-cells = <0>;
117
118 clocks = <&clk_gates5 11>, <&clk_gates2 13>;
119 clock-names = "biu", "ciu";
120
121 status = "disabled";
122 };
123 };
124};
diff --git a/arch/arm/boot/dts/s3c6400.dtsi b/arch/arm/boot/dts/s3c6400.dtsi
new file mode 100644
index 000000000000..a7d1c8ec150d
--- /dev/null
+++ b/arch/arm/boot/dts/s3c6400.dtsi
@@ -0,0 +1,41 @@
1/*
2 * Samsung's S3C6400 SoC device tree source
3 *
4 * Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
5 *
6 * Samsung's S3C6400 SoC device nodes are listed in this file. S3C6400
7 * based board files can include this file and provide values for board specfic
8 * bindings.
9 *
10 * Note: This file does not include device nodes for all the controllers in
11 * S3C6400 SoC. As device tree coverage for S3C6400 increases, additional
12 * nodes can be added to this file.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17*/
18
19#include "s3c64xx.dtsi"
20
21/ {
22 compatible = "samsung,s3c6400";
23};
24
25&vic0 {
26 valid-mask = <0xfffffe1f>;
27 valid-wakeup-mask = <0x00200004>;
28};
29
30&vic1 {
31 valid-mask = <0xffffffff>;
32 valid-wakeup-mask = <0x53020000>;
33};
34
35&soc {
36 clocks: clock-controller@7e00f000 {
37 compatible = "samsung,s3c6400-clock";
38 reg = <0x7e00f000 0x1000>;
39 #clock-cells = <1>;
40 };
41};
diff --git a/arch/arm/boot/dts/s3c6410-mini6410.dts b/arch/arm/boot/dts/s3c6410-mini6410.dts
new file mode 100644
index 000000000000..57e00f9bce99
--- /dev/null
+++ b/arch/arm/boot/dts/s3c6410-mini6410.dts
@@ -0,0 +1,228 @@
1/*
2 * Samsung's S3C6410 based Mini6410 board device tree source
3 *
4 * Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
5 *
6 * Device tree source file for FriendlyARM Mini6410 board which is based on
7 * Samsung's S3C6410 SoC.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14/dts-v1/;
15
16#include <dt-bindings/gpio/gpio.h>
17#include <dt-bindings/interrupt-controller/irq.h>
18
19#include "s3c6410.dtsi"
20
21/ {
22 model = "FriendlyARM Mini6410 board based on S3C6410";
23 compatible = "friendlyarm,mini6410", "samsung,s3c6410";
24
25 memory {
26 reg = <0x50000000 0x10000000>;
27 };
28
29 chosen {
30 bootargs = "console=ttySAC0,115200n8 earlyprintk rootwait root=/dev/mmcblk0p1";
31 };
32
33 clocks {
34 compatible = "simple-bus";
35 #address-cells = <1>;
36 #size-cells = <0>;
37
38 fin_pll: oscillator@0 {
39 compatible = "fixed-clock";
40 reg = <0>;
41 clock-frequency = <12000000>;
42 clock-output-names = "fin_pll";
43 #clock-cells = <0>;
44 };
45
46 xusbxti: oscillator@1 {
47 compatible = "fixed-clock";
48 reg = <1>;
49 clock-output-names = "xusbxti";
50 clock-frequency = <48000000>;
51 #clock-cells = <0>;
52 };
53 };
54
55 srom-cs1@18000000 {
56 compatible = "simple-bus";
57 #address-cells = <1>;
58 #size-cells = <1>;
59 reg = <0x18000000 0x8000000>;
60 ranges;
61
62 ethernet@18000000 {
63 compatible = "davicom,dm9000";
64 reg = <0x18000000 0x2 0x18000004 0x2>;
65 interrupt-parent = <&gpn>;
66 interrupts = <7 IRQ_TYPE_LEVEL_HIGH>;
67 davicom,no-eeprom;
68 };
69 };
70
71 gpio-keys {
72 compatible = "gpio-keys";
73 pinctrl-names = "default";
74 pinctrl-0 = <&gpio_keys>;
75 autorepeat;
76
77 button-k1 {
78 label = "K1";
79 gpios = <&gpn 0 GPIO_ACTIVE_LOW>;
80 linux,code = <2>;
81 debounce-interval = <20>;
82 };
83
84 button-k2 {
85 label = "K2";
86 gpios = <&gpn 1 GPIO_ACTIVE_LOW>;
87 linux,code = <3>;
88 debounce-interval = <20>;
89 };
90
91 button-k3 {
92 label = "K3";
93 gpios = <&gpn 2 GPIO_ACTIVE_LOW>;
94 linux,code = <4>;
95 debounce-interval = <20>;
96 };
97
98 button-k4 {
99 label = "K4";
100 gpios = <&gpn 3 GPIO_ACTIVE_LOW>;
101 linux,code = <5>;
102 debounce-interval = <20>;
103 };
104
105 button-k5 {
106 label = "K5";
107 gpios = <&gpn 4 GPIO_ACTIVE_LOW>;
108 linux,code = <6>;
109 debounce-interval = <20>;
110 };
111
112 button-k6 {
113 label = "K6";
114 gpios = <&gpn 5 GPIO_ACTIVE_LOW>;
115 linux,code = <7>;
116 debounce-interval = <20>;
117 };
118
119 button-k7 {
120 label = "K7";
121 gpios = <&gpl 11 GPIO_ACTIVE_LOW>;
122 linux,code = <8>;
123 debounce-interval = <20>;
124 };
125
126 button-k8 {
127 label = "K8";
128 gpios = <&gpl 12 GPIO_ACTIVE_LOW>;
129 linux,code = <9>;
130 debounce-interval = <20>;
131 };
132 };
133
134 leds {
135 compatible = "gpio-leds";
136 pinctrl-names = "default";
137 pinctrl-0 = <&gpio_leds>;
138
139 led-1 {
140 label = "LED1";
141 gpios = <&gpk 4 GPIO_ACTIVE_LOW>;
142 linux,default-trigger = "heartbeat";
143 };
144
145 led-2 {
146 label = "LED2";
147 gpios = <&gpk 5 GPIO_ACTIVE_LOW>;
148 linux,default-trigger = "mmc0";
149 };
150
151 led-3 {
152 label = "LED3";
153 gpios = <&gpk 6 GPIO_ACTIVE_LOW>;
154 };
155
156 led-4 {
157 label = "LED4";
158 gpios = <&gpk 7 GPIO_ACTIVE_LOW>;
159 };
160 };
161
162 buzzer {
163 compatible = "pwm-beeper";
164 pwms = <&pwm 0 1000000 0>;
165 pinctrl-names = "default";
166 pinctrl-0 = <&pwm0_out>;
167 };
168};
169
170&sdhci0 {
171 pinctrl-names = "default";
172 pinctrl-0 = <&sd0_clk>, <&sd0_cmd>, <&sd0_cd>, <&sd0_bus4>;
173 bus-width = <4>;
174 status = "okay";
175};
176
177&uart0 {
178 pinctrl-names = "default";
179 pinctrl-0 = <&uart0_data>;
180 status = "okay";
181};
182
183&uart1 {
184 pinctrl-names = "default";
185 pinctrl-0 = <&uart1_data>, <&uart1_fctl>;
186 status = "okay";
187};
188
189&uart2 {
190 pinctrl-names = "default";
191 pinctrl-0 = <&uart2_data>;
192 status = "okay";
193};
194
195&uart3 {
196 pinctrl-names = "default";
197 pinctrl-0 = <&uart3_data>;
198 status = "okay";
199};
200
201&pwm {
202 status = "okay";
203};
204
205&pinctrl0 {
206 gpio_leds: gpio-leds {
207 samsung,pins = "gpk-4", "gpk-5", "gpk-6", "gpk-7";
208 samsung,pin-pud = <PIN_PULL_NONE>;
209 };
210
211 gpio_keys: gpio-keys {
212 samsung,pins = "gpn-0", "gpn-1", "gpn-2", "gpn-3",
213 "gpn-4", "gpn-5", "gpl-11", "gpl-12";
214 samsung,pin-pud = <PIN_PULL_NONE>;
215 };
216};
217
218&i2c0 {
219 pinctrl-names = "default";
220 pinctrl-0 = <&i2c0_bus>;
221 status = "okay";
222
223 eeprom@50 {
224 compatible = "atmel,24c08";
225 reg = <0x50>;
226 pagesize = <16>;
227 };
228};
diff --git a/arch/arm/boot/dts/s3c6410-smdk6410.dts b/arch/arm/boot/dts/s3c6410-smdk6410.dts
new file mode 100644
index 000000000000..ecf35ec466f7
--- /dev/null
+++ b/arch/arm/boot/dts/s3c6410-smdk6410.dts
@@ -0,0 +1,103 @@
1/*
2 * Samsung S3C6410 based SMDK6410 board device tree source.
3 *
4 * Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
5 *
6 * Device tree source file for SAMSUNG SMDK6410 board which is based on
7 * Samsung's S3C6410 SoC.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14/dts-v1/;
15
16#include <dt-bindings/gpio/gpio.h>
17#include <dt-bindings/interrupt-controller/irq.h>
18
19#include "s3c6410.dtsi"
20
21/ {
22 model = "SAMSUNG SMDK6410 board based on S3C6410";
23 compatible = "samsung,mini6410", "samsung,s3c6410";
24
25 memory {
26 reg = <0x50000000 0x8000000>;
27 };
28
29 chosen {
30 bootargs = "console=ttySAC0,115200n8 earlyprintk rootwait root=/dev/mmcblk0p1";
31 };
32
33 clocks {
34 compatible = "simple-bus";
35 #address-cells = <1>;
36 #size-cells = <0>;
37
38 fin_pll: oscillator@0 {
39 compatible = "fixed-clock";
40 reg = <0>;
41 clock-frequency = <12000000>;
42 clock-output-names = "fin_pll";
43 #clock-cells = <0>;
44 };
45
46 xusbxti: oscillator@1 {
47 compatible = "fixed-clock";
48 reg = <1>;
49 clock-output-names = "xusbxti";
50 clock-frequency = <48000000>;
51 #clock-cells = <0>;
52 };
53 };
54
55 srom-cs1@18000000 {
56 compatible = "simple-bus";
57 #address-cells = <1>;
58 #size-cells = <1>;
59 reg = <0x18000000 0x8000000>;
60 ranges;
61
62 ethernet@18000000 {
63 compatible = "smsc,lan9115";
64 reg = <0x18000000 0x10000>;
65 interrupt-parent = <&gpn>;
66 interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
67 phy-mode = "mii";
68 reg-io-width = <4>;
69 smsc,force-internal-phy;
70 };
71 };
72};
73
74&sdhci0 {
75 pinctrl-names = "default";
76 pinctrl-0 = <&sd0_clk>, <&sd0_cmd>, <&sd0_cd>, <&sd0_bus4>;
77 bus-width = <4>;
78 status = "okay";
79};
80
81&uart0 {
82 pinctrl-names = "default";
83 pinctrl-0 = <&uart0_data>, <&uart0_fctl>;
84 status = "okay";
85};
86
87&uart1 {
88 pinctrl-names = "default";
89 pinctrl-0 = <&uart1_data>;
90 status = "okay";
91};
92
93&uart2 {
94 pinctrl-names = "default";
95 pinctrl-0 = <&uart2_data>;
96 status = "okay";
97};
98
99&uart3 {
100 pinctrl-names = "default";
101 pinctrl-0 = <&uart3_data>;
102 status = "okay";
103};
diff --git a/arch/arm/boot/dts/s3c6410.dtsi b/arch/arm/boot/dts/s3c6410.dtsi
new file mode 100644
index 000000000000..eb4226b3407c
--- /dev/null
+++ b/arch/arm/boot/dts/s3c6410.dtsi
@@ -0,0 +1,57 @@
1/*
2 * Samsung's S3C6410 SoC device tree source
3 *
4 * Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
5 *
6 * Samsung's S3C6410 SoC device nodes are listed in this file. S3C6410
7 * based board files can include this file and provide values for board specfic
8 * bindings.
9 *
10 * Note: This file does not include device nodes for all the controllers in
11 * S3C6410 SoC. As device tree coverage for S3C6410 increases, additional
12 * nodes can be added to this file.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17*/
18
19#include "s3c64xx.dtsi"
20
21/ {
22 compatible = "samsung,s3c6410";
23
24 aliases {
25 i2c1 = &i2c1;
26 };
27};
28
29&vic0 {
30 valid-mask = <0xffffff7f>;
31 valid-wakeup-mask = <0x00200004>;
32};
33
34&vic1 {
35 valid-mask = <0xffffffff>;
36 valid-wakeup-mask = <0x53020000>;
37};
38
39&soc {
40 clocks: clock-controller@7e00f000 {
41 compatible = "samsung,s3c6410-clock";
42 reg = <0x7e00f000 0x1000>;
43 #clock-cells = <1>;
44 };
45
46 i2c1: i2c@7f00f000 {
47 compatible = "samsung,s3c2440-i2c";
48 reg = <0x7f00f000 0x1000>;
49 interrupt-parent = <&vic0>;
50 interrupts = <5>;
51 clock-names = "i2c";
52 clocks = <&clocks PCLK_IIC1>;
53 status = "disabled";
54 #address-cells = <1>;
55 #size-cells = <0>;
56 };
57};
diff --git a/arch/arm/boot/dts/s3c64xx-pinctrl.dtsi b/arch/arm/boot/dts/s3c64xx-pinctrl.dtsi
new file mode 100644
index 000000000000..b1197d8b04de
--- /dev/null
+++ b/arch/arm/boot/dts/s3c64xx-pinctrl.dtsi
@@ -0,0 +1,687 @@
1/*
2 * Samsung's S3C64xx SoC series common device tree source
3 * - pin control-related definitions
4 *
5 * Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
6 *
7 * Samsung's S3C64xx SoCs pin banks, pin-mux and pin-config options are
8 * listed as device tree nodes 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#define PIN_PULL_NONE 0
16#define PIN_PULL_DOWN 1
17#define PIN_PULL_UP 2
18
19&pinctrl0 {
20 /*
21 * Pin banks
22 */
23
24 gpa: gpa {
25 gpio-controller;
26 #gpio-cells = <2>;
27 interrupt-controller;
28 #interrupt-cells = <2>;
29 };
30
31 gpb: gpb {
32 gpio-controller;
33 #gpio-cells = <2>;
34 interrupt-controller;
35 #interrupt-cells = <2>;
36 };
37
38 gpc: gpc {
39 gpio-controller;
40 #gpio-cells = <2>;
41 interrupt-controller;
42 #interrupt-cells = <2>;
43 };
44
45 gpd: gpd {
46 gpio-controller;
47 #gpio-cells = <2>;
48 interrupt-controller;
49 #interrupt-cells = <2>;
50 };
51
52 gpe: gpe {
53 gpio-controller;
54 #gpio-cells = <2>;
55 };
56
57 gpf: gpf {
58 gpio-controller;
59 #gpio-cells = <2>;
60 interrupt-controller;
61 #interrupt-cells = <2>;
62 };
63
64 gpg: gpg {
65 gpio-controller;
66 #gpio-cells = <2>;
67 interrupt-controller;
68 #interrupt-cells = <2>;
69 };
70
71 gph: gph {
72 gpio-controller;
73 #gpio-cells = <2>;
74 interrupt-controller;
75 #interrupt-cells = <2>;
76 };
77
78 gpi: gpi {
79 gpio-controller;
80 #gpio-cells = <2>;
81 };
82
83 gpj: gpj {
84 gpio-controller;
85 #gpio-cells = <2>;
86 };
87
88 gpk: gpk {
89 gpio-controller;
90 #gpio-cells = <2>;
91 };
92
93 gpl: gpl {
94 gpio-controller;
95 #gpio-cells = <2>;
96 interrupt-controller;
97 #interrupt-cells = <2>;
98 };
99
100 gpm: gpm {
101 gpio-controller;
102 #gpio-cells = <2>;
103 interrupt-controller;
104 #interrupt-cells = <2>;
105 };
106
107 gpn: gpn {
108 gpio-controller;
109 #gpio-cells = <2>;
110 interrupt-controller;
111 #interrupt-cells = <2>;
112 };
113
114 gpo: gpo {
115 gpio-controller;
116 #gpio-cells = <2>;
117 interrupt-controller;
118 #interrupt-cells = <2>;
119 };
120
121 gpp: gpp {
122 gpio-controller;
123 #gpio-cells = <2>;
124 interrupt-controller;
125 #interrupt-cells = <2>;
126 };
127
128 gpq: gpq {
129 gpio-controller;
130 #gpio-cells = <2>;
131 interrupt-controller;
132 #interrupt-cells = <2>;
133 };
134
135 /*
136 * Pin groups
137 */
138
139 uart0_data: uart0-data {
140 samsung,pins = "gpa-0", "gpa-1";
141 samsung,pin-function = <2>;
142 samsung,pin-pud = <PIN_PULL_NONE>;
143 };
144
145 uart0_fctl: uart0-fctl {
146 samsung,pins = "gpa-2", "gpa-3";
147 samsung,pin-function = <2>;
148 samsung,pin-pud = <PIN_PULL_NONE>;
149 };
150
151 uart1_data: uart1-data {
152 samsung,pins = "gpa-4", "gpa-5";
153 samsung,pin-function = <2>;
154 samsung,pin-pud = <PIN_PULL_NONE>;
155 };
156
157 uart1_fctl: uart1-fctl {
158 samsung,pins = "gpa-6", "gpa-7";
159 samsung,pin-function = <2>;
160 samsung,pin-pud = <PIN_PULL_NONE>;
161 };
162
163 uart2_data: uart2-data {
164 samsung,pins = "gpb-0", "gpb-1";
165 samsung,pin-function = <2>;
166 samsung,pin-pud = <PIN_PULL_NONE>;
167 };
168
169 uart3_data: uart3-data {
170 samsung,pins = "gpb-2", "gpb-3";
171 samsung,pin-function = <2>;
172 samsung,pin-pud = <PIN_PULL_NONE>;
173 };
174
175 ext_dma_0: ext-dma-0 {
176 samsung,pins = "gpb-0", "gpb-1";
177 samsung,pin-function = <3>;
178 samsung,pin-pud = <PIN_PULL_NONE>;
179 };
180
181 ext_dma_1: ext-dma-1 {
182 samsung,pins = "gpb-2", "gpb-3";
183 samsung,pin-function = <4>;
184 samsung,pin-pud = <PIN_PULL_NONE>;
185 };
186
187 irda_data_0: irda-data-0 {
188 samsung,pins = "gpb-0", "gpb-1";
189 samsung,pin-function = <4>;
190 samsung,pin-pud = <PIN_PULL_NONE>;
191 };
192
193 irda_data_1: irda-data-1 {
194 samsung,pins = "gpb-2", "gpb-3";
195 samsung,pin-function = <3>;
196 samsung,pin-pud = <PIN_PULL_NONE>;
197 };
198
199 irda_sdbw: irda-sdbw {
200 samsung,pins = "gpb-4";
201 samsung,pin-function = <2>;
202 samsung,pin-pud = <PIN_PULL_NONE>;
203 };
204
205 i2c0_bus: i2c0-bus {
206 samsung,pins = "gpb-5", "gpb-6";
207 samsung,pin-function = <2>;
208 samsung,pin-pud = <PIN_PULL_UP>;
209 };
210
211 i2c1_bus: i2c1-bus {
212 /* S3C6410-only */
213 samsung,pins = "gpb-2", "gpb-3";
214 samsung,pin-function = <6>;
215 samsung,pin-pud = <PIN_PULL_UP>;
216 };
217
218 spi0_bus: spi0-bus {
219 samsung,pins = "gpc-0", "gpc-1", "gpc-2";
220 samsung,pin-function = <2>;
221 samsung,pin-pud = <PIN_PULL_UP>;
222 };
223
224 spi0_cs: spi0-cs {
225 samsung,pins = "gpc-3";
226 samsung,pin-function = <2>;
227 samsung,pin-pud = <PIN_PULL_NONE>;
228 };
229
230 spi1_bus: spi1-bus {
231 samsung,pins = "gpc-4", "gpc-5", "gpc-6";
232 samsung,pin-function = <2>;
233 samsung,pin-pud = <PIN_PULL_UP>;
234 };
235
236 spi1_cs: spi1-cs {
237 samsung,pins = "gpc-7";
238 samsung,pin-function = <2>;
239 samsung,pin-pud = <PIN_PULL_NONE>;
240 };
241
242 sd0_cmd: sd0-cmd {
243 samsung,pins = "gpg-1";
244 samsung,pin-function = <2>;
245 samsung,pin-pud = <PIN_PULL_NONE>;
246 };
247
248 sd0_clk: sd0-clk {
249 samsung,pins = "gpg-0";
250 samsung,pin-function = <2>;
251 samsung,pin-pud = <PIN_PULL_NONE>;
252 };
253
254 sd0_bus1: sd0-bus1 {
255 samsung,pins = "gpg-2";
256 samsung,pin-function = <2>;
257 samsung,pin-pud = <PIN_PULL_NONE>;
258 };
259
260 sd0_bus4: sd0-bus4 {
261 samsung,pins = "gpg-2", "gpg-3", "gpg-4", "gpg-5";
262 samsung,pin-function = <2>;
263 samsung,pin-pud = <PIN_PULL_NONE>;
264 };
265
266 sd0_cd: sd0-cd {
267 samsung,pins = "gpg-6";
268 samsung,pin-function = <2>;
269 samsung,pin-pud = <PIN_PULL_UP>;
270 };
271
272 sd1_cmd: sd1-cmd {
273 samsung,pins = "gph-1";
274 samsung,pin-function = <2>;
275 samsung,pin-pud = <PIN_PULL_NONE>;
276 };
277
278 sd1_clk: sd1-clk {
279 samsung,pins = "gph-0";
280 samsung,pin-function = <2>;
281 samsung,pin-pud = <PIN_PULL_NONE>;
282 };
283
284 sd1_bus1: sd1-bus1 {
285 samsung,pins = "gph-2";
286 samsung,pin-function = <2>;
287 samsung,pin-pud = <PIN_PULL_NONE>;
288 };
289
290 sd1_bus4: sd1-bus4 {
291 samsung,pins = "gph-2", "gph-3", "gph-4", "gph-5";
292 samsung,pin-function = <2>;
293 samsung,pin-pud = <PIN_PULL_NONE>;
294 };
295
296 sd1_bus8: sd1-bus8 {
297 samsung,pins = "gph-2", "gph-3", "gph-4", "gph-5",
298 "gph-6", "gph-7", "gph-8", "gph-9";
299 samsung,pin-function = <2>;
300 samsung,pin-pud = <PIN_PULL_NONE>;
301 };
302
303 sd1_cd: sd1-cd {
304 samsung,pins = "gpg-6";
305 samsung,pin-function = <3>;
306 samsung,pin-pud = <PIN_PULL_UP>;
307 };
308
309 sd2_cmd: sd2-cmd {
310 samsung,pins = "gpc-4";
311 samsung,pin-function = <3>;
312 samsung,pin-pud = <PIN_PULL_NONE>;
313 };
314
315 sd2_clk: sd2-clk {
316 samsung,pins = "gpc-5";
317 samsung,pin-function = <3>;
318 samsung,pin-pud = <PIN_PULL_NONE>;
319 };
320
321 sd2_bus1: sd2-bus1 {
322 samsung,pins = "gph-6";
323 samsung,pin-function = <3>;
324 samsung,pin-pud = <PIN_PULL_NONE>;
325 };
326
327 sd2_bus4: sd2-bus4 {
328 samsung,pins = "gph-6", "gph-7", "gph-8", "gph-9";
329 samsung,pin-function = <3>;
330 samsung,pin-pud = <PIN_PULL_NONE>;
331 };
332
333 i2s0_bus: i2s0-bus {
334 samsung,pins = "gpd-0", "gpd-2", "gpd-3", "gpd-4";
335 samsung,pin-function = <3>;
336 samsung,pin-pud = <PIN_PULL_NONE>;
337 };
338
339 i2s0_cdclk: i2s0-cdclk {
340 samsung,pins = "gpd-1";
341 samsung,pin-function = <3>;
342 samsung,pin-pud = <PIN_PULL_NONE>;
343 };
344
345 i2s1_bus: i2s1-bus {
346 samsung,pins = "gpe-0", "gpe-2", "gpe-3", "gpe-4";
347 samsung,pin-function = <3>;
348 samsung,pin-pud = <PIN_PULL_NONE>;
349 };
350
351 i2s1_cdclk: i2s1-cdclk {
352 samsung,pins = "gpe-1";
353 samsung,pin-function = <3>;
354 samsung,pin-pud = <PIN_PULL_NONE>;
355 };
356
357 i2s2_bus: i2s2-bus {
358 /* S3C6410-only */
359 samsung,pins = "gpc-4", "gpc-5", "gpc-6", "gph-6",
360 "gph-8", "gph-9";
361 samsung,pin-function = <5>;
362 samsung,pin-pud = <PIN_PULL_NONE>;
363 };
364
365 i2s2_cdclk: i2s2-cdclk {
366 /* S3C6410-only */
367 samsung,pins = "gph-7";
368 samsung,pin-function = <5>;
369 samsung,pin-pud = <PIN_PULL_NONE>;
370 };
371
372 pcm0_bus: pcm0-bus {
373 samsung,pins = "gpd-0", "gpd-2", "gpd-3", "gpd-4";
374 samsung,pin-function = <2>;
375 samsung,pin-pud = <PIN_PULL_NONE>;
376 };
377
378 pcm0_extclk: pcm0-extclk {
379 samsung,pins = "gpd-1";
380 samsung,pin-function = <2>;
381 samsung,pin-pud = <PIN_PULL_NONE>;
382 };
383
384 pcm1_bus: pcm1-bus {
385 samsung,pins = "gpe-0", "gpe-2", "gpe-3", "gpe-4";
386 samsung,pin-function = <2>;
387 samsung,pin-pud = <PIN_PULL_NONE>;
388 };
389
390 pcm1_extclk: pcm1-extclk {
391 samsung,pins = "gpe-1";
392 samsung,pin-function = <2>;
393 samsung,pin-pud = <PIN_PULL_NONE>;
394 };
395
396 ac97_bus_0: ac97-bus-0 {
397 samsung,pins = "gpd-0", "gpd-1", "gpd-2", "gpd-3", "gpd-4";
398 samsung,pin-function = <4>;
399 samsung,pin-pud = <PIN_PULL_NONE>;
400 };
401
402 ac97_bus_1: ac97-bus-1 {
403 samsung,pins = "gpe-0", "gpe-1", "gpe-2", "gpe-3", "gpe-4";
404 samsung,pin-function = <4>;
405 samsung,pin-pud = <PIN_PULL_NONE>;
406 };
407
408 cam_port: cam-port {
409 samsung,pins = "gpf-0", "gpf-1", "gpf-2", "gpf-4",
410 "gpf-5", "gpf-6", "gpf-7", "gpf-8",
411 "gpf-9", "gpf-10", "gpf-11", "gpf-12";
412 samsung,pin-function = <2>;
413 samsung,pin-pud = <PIN_PULL_NONE>;
414 };
415
416 cam_rst: cam-rst {
417 samsung,pins = "gpf-3";
418 samsung,pin-function = <2>;
419 samsung,pin-pud = <PIN_PULL_NONE>;
420 };
421
422 cam_field: cam-field {
423 /* S3C6410-only */
424 samsung,pins = "gpb-4";
425 samsung,pin-function = <3>;
426 samsung,pin-pud = <PIN_PULL_NONE>;
427 };
428
429 pwm_extclk: pwm-extclk {
430 samsung,pins = "gpf-13";
431 samsung,pin-function = <2>;
432 samsung,pin-pud = <PIN_PULL_NONE>;
433 };
434
435 pwm0_out: pwm0-out {
436 samsung,pins = "gpf-14";
437 samsung,pin-function = <2>;
438 samsung,pin-pud = <PIN_PULL_NONE>;
439 };
440
441 pwm1_out: pwm1-out {
442 samsung,pins = "gpf-15";
443 samsung,pin-function = <2>;
444 samsung,pin-pud = <PIN_PULL_NONE>;
445 };
446
447 clkout0: clkout-0 {
448 samsung,pins = "gpf-14";
449 samsung,pin-function = <3>;
450 samsung,pin-pud = <PIN_PULL_NONE>;
451 };
452
453 keypad_col0_0: keypad-col0-0 {
454 samsung,pins = "gph-0";
455 samsung,pin-function = <4>;
456 samsung,pin-pud = <PIN_PULL_NONE>;
457 };
458
459 keypad_col1_0: keypad-col1-0 {
460 samsung,pins = "gph-1";
461 samsung,pin-function = <4>;
462 samsung,pin-pud = <PIN_PULL_NONE>;
463 };
464
465 keypad_col2_0: keypad-col2-0 {
466 samsung,pins = "gph-2";
467 samsung,pin-function = <4>;
468 samsung,pin-pud = <PIN_PULL_NONE>;
469 };
470
471 keypad_col3_0: keypad-col3-0 {
472 samsung,pins = "gph-3";
473 samsung,pin-function = <4>;
474 samsung,pin-pud = <PIN_PULL_NONE>;
475 };
476
477 keypad_col4_0: keypad-col4-0 {
478 samsung,pins = "gph-4";
479 samsung,pin-function = <4>;
480 samsung,pin-pud = <PIN_PULL_NONE>;
481 };
482
483 keypad_col5_0: keypad-col5-0 {
484 samsung,pins = "gph-5";
485 samsung,pin-function = <4>;
486 samsung,pin-pud = <PIN_PULL_NONE>;
487 };
488
489 keypad_col6_0: keypad-col6-0 {
490 samsung,pins = "gph-6";
491 samsung,pin-function = <4>;
492 samsung,pin-pud = <PIN_PULL_NONE>;
493 };
494
495 keypad_col7_0: keypad-col7-0 {
496 samsung,pins = "gph-7";
497 samsung,pin-function = <4>;
498 samsung,pin-pud = <PIN_PULL_NONE>;
499 };
500
501 keypad_col0_1: keypad-col0-1 {
502 samsung,pins = "gpl-0";
503 samsung,pin-function = <3>;
504 samsung,pin-pud = <PIN_PULL_NONE>;
505 };
506
507 keypad_col1_1: keypad-col1-1 {
508 samsung,pins = "gpl-1";
509 samsung,pin-function = <3>;
510 samsung,pin-pud = <PIN_PULL_NONE>;
511 };
512
513 keypad_col2_1: keypad-col2-1 {
514 samsung,pins = "gpl-2";
515 samsung,pin-function = <3>;
516 samsung,pin-pud = <PIN_PULL_NONE>;
517 };
518
519 keypad_col3_1: keypad-col3-1 {
520 samsung,pins = "gpl-3";
521 samsung,pin-function = <3>;
522 samsung,pin-pud = <PIN_PULL_NONE>;
523 };
524
525 keypad_col4_1: keypad-col4-1 {
526 samsung,pins = "gpl-4";
527 samsung,pin-function = <3>;
528 samsung,pin-pud = <PIN_PULL_NONE>;
529 };
530
531 keypad_col5_1: keypad-col5-1 {
532 samsung,pins = "gpl-5";
533 samsung,pin-function = <3>;
534 samsung,pin-pud = <PIN_PULL_NONE>;
535 };
536
537 keypad_col6_1: keypad-col6-1 {
538 samsung,pins = "gpl-6";
539 samsung,pin-function = <3>;
540 samsung,pin-pud = <PIN_PULL_NONE>;
541 };
542
543 keypad_col7_1: keypad-col7-1 {
544 samsung,pins = "gpl-7";
545 samsung,pin-function = <3>;
546 samsung,pin-pud = <PIN_PULL_NONE>;
547 };
548
549 keypad_row0_0: keypad-row0-0 {
550 samsung,pins = "gpk-8";
551 samsung,pin-function = <3>;
552 samsung,pin-pud = <PIN_PULL_NONE>;
553 };
554
555 keypad_row1_0: keypad-row1-0 {
556 samsung,pins = "gpk-9";
557 samsung,pin-function = <3>;
558 samsung,pin-pud = <PIN_PULL_NONE>;
559 };
560
561 keypad_row2_0: keypad-row2-0 {
562 samsung,pins = "gpk-10";
563 samsung,pin-function = <3>;
564 samsung,pin-pud = <PIN_PULL_NONE>;
565 };
566
567 keypad_row3_0: keypad-row3-0 {
568 samsung,pins = "gpk-11";
569 samsung,pin-function = <3>;
570 samsung,pin-pud = <PIN_PULL_NONE>;
571 };
572
573 keypad_row4_0: keypad-row4-0 {
574 samsung,pins = "gpk-12";
575 samsung,pin-function = <3>;
576 samsung,pin-pud = <PIN_PULL_NONE>;
577 };
578
579 keypad_row5_0: keypad-row5-0 {
580 samsung,pins = "gpk-13";
581 samsung,pin-function = <3>;
582 samsung,pin-pud = <PIN_PULL_NONE>;
583 };
584
585 keypad_row6_0: keypad-row6-0 {
586 samsung,pins = "gpk-14";
587 samsung,pin-function = <3>;
588 samsung,pin-pud = <PIN_PULL_NONE>;
589 };
590
591 keypad_row7_0: keypad-row7-0 {
592 samsung,pins = "gpk-15";
593 samsung,pin-function = <3>;
594 samsung,pin-pud = <PIN_PULL_NONE>;
595 };
596
597 keypad_row0_1: keypad-row0-1 {
598 samsung,pins = "gpn-0";
599 samsung,pin-function = <3>;
600 samsung,pin-pud = <PIN_PULL_NONE>;
601 };
602
603 keypad_row1_1: keypad-row1-1 {
604 samsung,pins = "gpn-1";
605 samsung,pin-function = <3>;
606 samsung,pin-pud = <PIN_PULL_NONE>;
607 };
608
609 keypad_row2_1: keypad-row2-1 {
610 samsung,pins = "gpn-2";
611 samsung,pin-function = <3>;
612 samsung,pin-pud = <PIN_PULL_NONE>;
613 };
614
615 keypad_row3_1: keypad-row3-1 {
616 samsung,pins = "gpn-3";
617 samsung,pin-function = <3>;
618 samsung,pin-pud = <PIN_PULL_NONE>;
619 };
620
621 keypad_row4_1: keypad-row4-1 {
622 samsung,pins = "gpn-4";
623 samsung,pin-function = <3>;
624 samsung,pin-pud = <PIN_PULL_NONE>;
625 };
626
627 keypad_row5_1: keypad-row5-1 {
628 samsung,pins = "gpn-5";
629 samsung,pin-function = <3>;
630 samsung,pin-pud = <PIN_PULL_NONE>;
631 };
632
633 keypad_row6_1: keypad-row6-1 {
634 samsung,pins = "gpn-6";
635 samsung,pin-function = <3>;
636 samsung,pin-pud = <PIN_PULL_NONE>;
637 };
638
639 keypad_row7_1: keypad-row7-1 {
640 samsung,pins = "gpn-7";
641 samsung,pin-function = <3>;
642 samsung,pin-pud = <PIN_PULL_NONE>;
643 };
644
645 lcd_ctrl: lcd-ctrl {
646 samsung,pins = "gpj-8", "gpj-9", "gpj-10", "gpj-11";
647 samsung,pin-function = <2>;
648 samsung,pin-pud = <PIN_PULL_NONE>;
649 };
650
651 lcd_data16: lcd-data-width16 {
652 samsung,pins = "gpi-3", "gpi-4", "gpi-5", "gpi-6",
653 "gpi-7", "gpi-10", "gpi-11", "gpi-12",
654 "gpi-13", "gpi-14", "gpi-15", "gpj-3",
655 "gpj-4", "gpj-5", "gpj-6", "gpj-7";
656 samsung,pin-function = <2>;
657 samsung,pin-pud = <PIN_PULL_NONE>;
658 };
659
660 lcd_data18: lcd-data-width18 {
661 samsung,pins = "gpi-2", "gpi-3", "gpi-4", "gpi-5",
662 "gpi-6", "gpi-7", "gpi-10", "gpi-11",
663 "gpi-12", "gpi-13", "gpi-14", "gpi-15",
664 "gpj-2", "gpj-3", "gpj-4", "gpj-5",
665 "gpj-6", "gpj-7";
666 samsung,pin-function = <2>;
667 samsung,pin-pud = <PIN_PULL_NONE>;
668 };
669
670 lcd_data24: lcd-data-width24 {
671 samsung,pins = "gpi-0", "gpi-1", "gpi-2", "gpi-3",
672 "gpi-4", "gpi-5", "gpi-6", "gpi-7",
673 "gpi-8", "gpi-9", "gpi-10", "gpi-11",
674 "gpi-12", "gpi-13", "gpi-14", "gpi-15",
675 "gpj-0", "gpj-1", "gpj-2", "gpj-3",
676 "gpj-4", "gpj-5", "gpj-6", "gpj-7";
677 samsung,pin-function = <2>;
678 samsung,pin-pud = <PIN_PULL_NONE>;
679 };
680
681 hsi_bus: hsi-bus {
682 samsung,pins = "gpk-0", "gpk-1", "gpk-2", "gpk-3",
683 "gpk-4", "gpk-5", "gpk-6", "gpk-7";
684 samsung,pin-function = <3>;
685 samsung,pin-pud = <PIN_PULL_NONE>;
686 };
687};
diff --git a/arch/arm/boot/dts/s3c64xx.dtsi b/arch/arm/boot/dts/s3c64xx.dtsi
new file mode 100644
index 000000000000..4e3be4d3493d
--- /dev/null
+++ b/arch/arm/boot/dts/s3c64xx.dtsi
@@ -0,0 +1,199 @@
1/*
2 * Samsung's S3C64xx SoC series common device tree source
3 *
4 * Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
5 *
6 * Samsung's S3C64xx SoC series device nodes are listed in this file.
7 * Particular SoCs from S3C64xx series can include this file and provide
8 * values for SoCs specfic bindings.
9 *
10 * Note: This file does not include device nodes for all the controllers in
11 * S3C64xx SoCs. As device tree coverage for S3C64xx increases, additional
12 * nodes can be added to this file.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18
19#include "skeleton.dtsi"
20#include <dt-bindings/clock/samsung,s3c64xx-clock.h>
21
22/ {
23 aliases {
24 i2c0 = &i2c0;
25 pinctrl0 = &pinctrl0;
26 };
27
28 cpus {
29 #address-cells = <1>;
30 #size-cells = <0>;
31
32 cpu@0 {
33 device_type = "cpu";
34 compatible = "arm,arm1176jzf-s", "arm,arm1176";
35 reg = <0x0>;
36 };
37 };
38
39 soc: soc {
40 compatible = "simple-bus";
41 #address-cells = <1>;
42 #size-cells = <1>;
43 ranges;
44
45 vic0: interrupt-controller@71200000 {
46 compatible = "arm,pl192-vic";
47 interrupt-controller;
48 reg = <0x71200000 0x1000>;
49 #interrupt-cells = <1>;
50 };
51
52 vic1: interrupt-controller@71300000 {
53 compatible = "arm,pl192-vic";
54 interrupt-controller;
55 reg = <0x71300000 0x1000>;
56 #interrupt-cells = <1>;
57 };
58
59 sdhci0: sdhci@7c200000 {
60 compatible = "samsung,s3c6410-sdhci";
61 reg = <0x7c200000 0x100>;
62 interrupt-parent = <&vic1>;
63 interrupts = <24>;
64 clock-names = "hsmmc", "mmc_busclk.0", "mmc_busclk.2";
65 clocks = <&clocks HCLK_HSMMC0>, <&clocks HCLK_HSMMC0>,
66 <&clocks SCLK_MMC0>;
67 status = "disabled";
68 };
69
70 sdhci1: sdhci@7c300000 {
71 compatible = "samsung,s3c6410-sdhci";
72 reg = <0x7c300000 0x100>;
73 interrupt-parent = <&vic1>;
74 interrupts = <25>;
75 clock-names = "hsmmc", "mmc_busclk.0", "mmc_busclk.2";
76 clocks = <&clocks HCLK_HSMMC1>, <&clocks HCLK_HSMMC1>,
77 <&clocks SCLK_MMC1>;
78 status = "disabled";
79 };
80
81 sdhci2: sdhci@7c400000 {
82 compatible = "samsung,s3c6410-sdhci";
83 reg = <0x7c400000 0x100>;
84 interrupt-parent = <&vic1>;
85 interrupts = <17>;
86 clock-names = "hsmmc", "mmc_busclk.0", "mmc_busclk.2";
87 clocks = <&clocks HCLK_HSMMC2>, <&clocks HCLK_HSMMC2>,
88 <&clocks SCLK_MMC2>;
89 status = "disabled";
90 };
91
92 watchdog: watchdog@7e004000 {
93 compatible = "samsung,s3c2410-wdt";
94 reg = <0x7e004000 0x1000>;
95 interrupt-parent = <&vic0>;
96 interrupts = <26>;
97 clock-names = "watchdog";
98 clocks = <&clocks PCLK_WDT>;
99 status = "disabled";
100 };
101
102 i2c0: i2c@7f004000 {
103 compatible = "samsung,s3c2440-i2c";
104 reg = <0x7f004000 0x1000>;
105 interrupt-parent = <&vic1>;
106 interrupts = <18>;
107 clock-names = "i2c";
108 clocks = <&clocks PCLK_IIC0>;
109 status = "disabled";
110 #address-cells = <1>;
111 #size-cells = <0>;
112 };
113
114 uart0: serial@7f005000 {
115 compatible = "samsung,s3c6400-uart";
116 reg = <0x7f005000 0x100>;
117 interrupt-parent = <&vic1>;
118 interrupts = <5>;
119 clock-names = "uart", "clk_uart_baud2",
120 "clk_uart_baud3";
121 clocks = <&clocks PCLK_UART0>, <&clocks PCLK_UART0>,
122 <&clocks SCLK_UART>;
123 status = "disabled";
124 };
125
126 uart1: serial@7f005400 {
127 compatible = "samsung,s3c6400-uart";
128 reg = <0x7f005400 0x100>;
129 interrupt-parent = <&vic1>;
130 interrupts = <6>;
131 clock-names = "uart", "clk_uart_baud2",
132 "clk_uart_baud3";
133 clocks = <&clocks PCLK_UART1>, <&clocks PCLK_UART1>,
134 <&clocks SCLK_UART>;
135 status = "disabled";
136 };
137
138 uart2: serial@7f005800 {
139 compatible = "samsung,s3c6400-uart";
140 reg = <0x7f005800 0x100>;
141 interrupt-parent = <&vic1>;
142 interrupts = <7>;
143 clock-names = "uart", "clk_uart_baud2",
144 "clk_uart_baud3";
145 clocks = <&clocks PCLK_UART2>, <&clocks PCLK_UART2>,
146 <&clocks SCLK_UART>;
147 status = "disabled";
148 };
149
150 uart3: serial@7f005c00 {
151 compatible = "samsung,s3c6400-uart";
152 reg = <0x7f005c00 0x100>;
153 interrupt-parent = <&vic1>;
154 interrupts = <8>;
155 clock-names = "uart", "clk_uart_baud2",
156 "clk_uart_baud3";
157 clocks = <&clocks PCLK_UART3>, <&clocks PCLK_UART3>,
158 <&clocks SCLK_UART>;
159 status = "disabled";
160 };
161
162 pwm: pwm@7f006000 {
163 compatible = "samsung,s3c6400-pwm";
164 reg = <0x7f006000 0x1000>;
165 interrupt-parent = <&vic0>;
166 interrupts = <23>, <24>, <25>, <27>, <28>;
167 clock-names = "timers";
168 clocks = <&clocks PCLK_PWM>;
169 samsung,pwm-outputs = <0>, <1>;
170 #pwm-cells = <3>;
171 status = "disabled";
172 };
173
174 pinctrl0: pinctrl@7f008000 {
175 compatible = "samsung,s3c64xx-pinctrl";
176 reg = <0x7f008000 0x1000>;
177 interrupt-parent = <&vic1>;
178 interrupts = <21>;
179
180 pctrl_int_map: pinctrl-interrupt-map {
181 interrupt-map = <0 &vic0 0>,
182 <1 &vic0 1>,
183 <2 &vic1 0>,
184 <3 &vic1 1>;
185 #address-cells = <0>;
186 #size-cells = <0>;
187 #interrupt-cells = <1>;
188 };
189
190 wakeup-interrupt-controller {
191 compatible = "samsung,s3c64xx-wakeup-eint";
192 interrupts = <0>, <1>, <2>, <3>;
193 interrupt-parent = <&pctrl_int_map>;
194 };
195 };
196 };
197};
198
199#include "s3c64xx-pinctrl.dtsi"
diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index b7f49615120d..5cdaba4cea86 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -31,7 +31,6 @@
31 gpio3 = &pioD; 31 gpio3 = &pioD;
32 gpio4 = &pioE; 32 gpio4 = &pioE;
33 tcb0 = &tcb0; 33 tcb0 = &tcb0;
34 tcb1 = &tcb1;
35 i2c0 = &i2c0; 34 i2c0 = &i2c0;
36 i2c1 = &i2c1; 35 i2c1 = &i2c1;
37 i2c2 = &i2c2; 36 i2c2 = &i2c2;
@@ -105,15 +104,6 @@
105 status = "disabled"; 104 status = "disabled";
106 }; 105 };
107 106
108 can0: can@f000c000 {
109 compatible = "atmel,at91sam9x5-can";
110 reg = <0xf000c000 0x300>;
111 interrupts = <40 IRQ_TYPE_LEVEL_HIGH 3>;
112 pinctrl-names = "default";
113 pinctrl-0 = <&pinctrl_can0_rx_tx>;
114 status = "disabled";
115 };
116
117 tcb0: timer@f0010000 { 107 tcb0: timer@f0010000 {
118 compatible = "atmel,at91sam9x5-tcb"; 108 compatible = "atmel,at91sam9x5-tcb";
119 reg = <0xf0010000 0x100>; 109 reg = <0xf0010000 0x100>;
@@ -166,15 +156,6 @@
166 status = "disabled"; 156 status = "disabled";
167 }; 157 };
168 158
169 macb0: ethernet@f0028000 {
170 compatible = "cdns,pc302-gem", "cdns,gem";
171 reg = <0xf0028000 0x100>;
172 interrupts = <34 IRQ_TYPE_LEVEL_HIGH 3>;
173 pinctrl-names = "default";
174 pinctrl-0 = <&pinctrl_macb0_data_rgmii &pinctrl_macb0_signal_rgmii>;
175 status = "disabled";
176 };
177
178 isi: isi@f0034000 { 159 isi: isi@f0034000 {
179 compatible = "atmel,at91sam9g45-isi"; 160 compatible = "atmel,at91sam9g45-isi";
180 reg = <0xf0034000 0x4000>; 161 reg = <0xf0034000 0x4000>;
@@ -195,19 +176,6 @@
195 #size-cells = <0>; 176 #size-cells = <0>;
196 }; 177 };
197 178
198 mmc2: mmc@f8004000 {
199 compatible = "atmel,hsmci";
200 reg = <0xf8004000 0x600>;
201 interrupts = <23 IRQ_TYPE_LEVEL_HIGH 0>;
202 dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(1)>;
203 dma-names = "rxtx";
204 pinctrl-names = "default";
205 pinctrl-0 = <&pinctrl_mmc2_clk_cmd_dat0 &pinctrl_mmc2_dat1_3>;
206 status = "disabled";
207 #address-cells = <1>;
208 #size-cells = <0>;
209 };
210
211 spi1: spi@f8008000 { 179 spi1: spi@f8008000 {
212 #address-cells = <1>; 180 #address-cells = <1>;
213 #size-cells = <0>; 181 #size-cells = <0>;
@@ -231,20 +199,6 @@
231 status = "disabled"; 199 status = "disabled";
232 }; 200 };
233 201
234 can1: can@f8010000 {
235 compatible = "atmel,at91sam9x5-can";
236 reg = <0xf8010000 0x300>;
237 interrupts = <41 IRQ_TYPE_LEVEL_HIGH 3>;
238 pinctrl-names = "default";
239 pinctrl-0 = <&pinctrl_can1_rx_tx>;
240 };
241
242 tcb1: timer@f8014000 {
243 compatible = "atmel,at91sam9x5-tcb";
244 reg = <0xf8014000 0x100>;
245 interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>;
246 };
247
248 adc0: adc@f8018000 { 202 adc0: adc@f8018000 {
249 compatible = "atmel,at91sam9260-adc"; 203 compatible = "atmel,at91sam9260-adc";
250 reg = <0xf8018000 0x100>; 204 reg = <0xf8018000 0x100>;
@@ -341,15 +295,6 @@
341 status = "disabled"; 295 status = "disabled";
342 }; 296 };
343 297
344 macb1: ethernet@f802c000 {
345 compatible = "cdns,at32ap7000-macb", "cdns,macb";
346 reg = <0xf802c000 0x100>;
347 interrupts = <35 IRQ_TYPE_LEVEL_HIGH 3>;
348 pinctrl-names = "default";
349 pinctrl-0 = <&pinctrl_macb1_rmii>;
350 status = "disabled";
351 };
352
353 sha@f8034000 { 298 sha@f8034000 {
354 compatible = "atmel,sam9g46-sha"; 299 compatible = "atmel,sam9g46-sha";
355 reg = <0xf8034000 0x100>; 300 reg = <0xf8034000 0x100>;
@@ -474,22 +419,6 @@
474 }; 419 };
475 }; 420 };
476 421
477 can0 {
478 pinctrl_can0_rx_tx: can0_rx_tx {
479 atmel,pins =
480 <AT91_PIOD 14 AT91_PERIPH_C AT91_PINCTRL_NONE /* PD14 periph C RX, conflicts with SCK0, SPI0_NPCS1 */
481 AT91_PIOD 15 AT91_PERIPH_C AT91_PINCTRL_NONE>; /* PD15 periph C TX, conflicts with CTS0, SPI0_NPCS2 */
482 };
483 };
484
485 can1 {
486 pinctrl_can1_rx_tx: can1_rx_tx {
487 atmel,pins =
488 <AT91_PIOB 14 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB14 periph B RX, conflicts with GCRS */
489 AT91_PIOB 15 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB15 periph B TX, conflicts with GCOL */
490 };
491 };
492
493 dbgu { 422 dbgu {
494 pinctrl_dbgu: dbgu-0 { 423 pinctrl_dbgu: dbgu-0 {
495 atmel,pins = 424 atmel,pins =
@@ -537,107 +466,6 @@
537 }; 466 };
538 }; 467 };
539 468
540 lcd {
541 pinctrl_lcd: lcd-0 {
542 atmel,pins =
543 <AT91_PIOA 24 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA24 periph A LCDPWM */
544 AT91_PIOA 26 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA26 periph A LCDVSYNC */
545 AT91_PIOA 27 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA27 periph A LCDHSYNC */
546 AT91_PIOA 25 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA25 periph A LCDDISP */
547 AT91_PIOA 29 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA29 periph A LCDDEN */
548 AT91_PIOA 28 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA28 periph A LCDPCK */
549 AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA0 periph A LCDD0 pin */
550 AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA1 periph A LCDD1 pin */
551 AT91_PIOA 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA2 periph A LCDD2 pin */
552 AT91_PIOA 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA3 periph A LCDD3 pin */
553 AT91_PIOA 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA4 periph A LCDD4 pin */
554 AT91_PIOA 5 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA5 periph A LCDD5 pin */
555 AT91_PIOA 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA6 periph A LCDD6 pin */
556 AT91_PIOA 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA7 periph A LCDD7 pin */
557 AT91_PIOA 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA8 periph A LCDD8 pin */
558 AT91_PIOA 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA9 periph A LCDD9 pin */
559 AT91_PIOA 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA10 periph A LCDD10 pin */
560 AT91_PIOA 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA11 periph A LCDD11 pin */
561 AT91_PIOA 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA12 periph A LCDD12 pin */
562 AT91_PIOA 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA13 periph A LCDD13 pin */
563 AT91_PIOA 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA14 periph A LCDD14 pin */
564 AT91_PIOA 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA15 periph A LCDD15 pin */
565 AT91_PIOC 14 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC14 periph C LCDD16 pin */
566 AT91_PIOC 13 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC13 periph C LCDD17 pin */
567 AT91_PIOC 12 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC12 periph C LCDD18 pin */
568 AT91_PIOC 11 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC11 periph C LCDD19 pin */
569 AT91_PIOC 10 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC10 periph C LCDD20 pin */
570 AT91_PIOC 15 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC15 periph C LCDD21 pin */
571 AT91_PIOE 27 AT91_PERIPH_C AT91_PINCTRL_NONE /* PE27 periph C LCDD22 pin */
572 AT91_PIOE 28 AT91_PERIPH_C AT91_PINCTRL_NONE>; /* PE28 periph C LCDD23 pin */
573 };
574 };
575
576 macb0 {
577 pinctrl_macb0_data_rgmii: macb0_data_rgmii {
578 atmel,pins =
579 <AT91_PIOB 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB0 periph A GTX0, conflicts with PWMH0 */
580 AT91_PIOB 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB1 periph A GTX1, conflicts with PWML0 */
581 AT91_PIOB 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB2 periph A GTX2, conflicts with TK1 */
582 AT91_PIOB 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB3 periph A GTX3, conflicts with TF1 */
583 AT91_PIOB 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB4 periph A GRX0, conflicts with PWMH1 */
584 AT91_PIOB 5 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB5 periph A GRX1, conflicts with PWML1 */
585 AT91_PIOB 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB6 periph A GRX2, conflicts with TD1 */
586 AT91_PIOB 7 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB7 periph A GRX3, conflicts with RK1 */
587 };
588 pinctrl_macb0_data_gmii: macb0_data_gmii {
589 atmel,pins =
590 <AT91_PIOB 19 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB19 periph B GTX4, conflicts with MCI1_CDA */
591 AT91_PIOB 20 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB20 periph B GTX5, conflicts with MCI1_DA0 */
592 AT91_PIOB 21 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB21 periph B GTX6, conflicts with MCI1_DA1 */
593 AT91_PIOB 22 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB22 periph B GTX7, conflicts with MCI1_DA2 */
594 AT91_PIOB 23 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB23 periph B GRX4, conflicts with MCI1_DA3 */
595 AT91_PIOB 24 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB24 periph B GRX5, conflicts with MCI1_CK */
596 AT91_PIOB 25 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB25 periph B GRX6, conflicts with SCK1 */
597 AT91_PIOB 26 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB26 periph B GRX7, conflicts with CTS1 */
598 };
599 pinctrl_macb0_signal_rgmii: macb0_signal_rgmii {
600 atmel,pins =
601 <AT91_PIOB 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB8 periph A GTXCK, conflicts with PWMH2 */
602 AT91_PIOB 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB9 periph A GTXEN, conflicts with PWML2 */
603 AT91_PIOB 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB11 periph A GRXCK, conflicts with RD1 */
604 AT91_PIOB 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB13 periph A GRXER, conflicts with PWML3 */
605 AT91_PIOB 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB16 periph A GMDC */
606 AT91_PIOB 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB17 periph A GMDIO */
607 AT91_PIOB 18 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB18 periph A G125CK */
608 };
609 pinctrl_macb0_signal_gmii: macb0_signal_gmii {
610 atmel,pins =
611 <AT91_PIOB 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB9 periph A GTXEN, conflicts with PWML2 */
612 AT91_PIOB 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB10 periph A GTXER, conflicts with RF1 */
613 AT91_PIOB 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB11 periph A GRXCK, conflicts with RD1 */
614 AT91_PIOB 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB12 periph A GRXDV, conflicts with PWMH3 */
615 AT91_PIOB 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB13 periph A GRXER, conflicts with PWML3 */
616 AT91_PIOB 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB14 periph A GCRS, conflicts with CANRX1 */
617 AT91_PIOB 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB15 periph A GCOL, conflicts with CANTX1 */
618 AT91_PIOB 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB16 periph A GMDC */
619 AT91_PIOB 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB17 periph A GMDIO */
620 AT91_PIOB 27 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB27 periph B G125CKO */
621 };
622
623 };
624
625 macb1 {
626 pinctrl_macb1_rmii: macb1_rmii-0 {
627 atmel,pins =
628 <AT91_PIOC 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC0 periph A ETX0, conflicts with TIOA3 */
629 AT91_PIOC 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC1 periph A ETX1, conflicts with TIOB3 */
630 AT91_PIOC 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC2 periph A ERX0, conflicts with TCLK3 */
631 AT91_PIOC 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC3 periph A ERX1, conflicts with TIOA4 */
632 AT91_PIOC 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC4 periph A ETXEN, conflicts with TIOB4 */
633 AT91_PIOC 5 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC5 periph A ECRSDV,conflicts with TCLK4 */
634 AT91_PIOC 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC6 periph A ERXER, conflicts with TIOA5 */
635 AT91_PIOC 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC7 periph A EREFCK, conflicts with TIOB5 */
636 AT91_PIOC 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC8 periph A EMDC, conflicts with TCLK5 */
637 AT91_PIOC 9 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PC9 periph A EMDIO */
638 };
639 };
640
641 mmc0 { 469 mmc0 {
642 pinctrl_mmc0_clk_cmd_dat0: mmc0_clk_cmd_dat0 { 470 pinctrl_mmc0_clk_cmd_dat0: mmc0_clk_cmd_dat0 {
643 atmel,pins = 471 atmel,pins =
@@ -675,21 +503,6 @@
675 }; 503 };
676 }; 504 };
677 505
678 mmc2 {
679 pinctrl_mmc2_clk_cmd_dat0: mmc2_clk_cmd_dat0 {
680 atmel,pins =
681 <AT91_PIOC 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC15 periph A MCI2_CK, conflicts with PCK2 */
682 AT91_PIOC 10 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PC10 periph A MCI2_CDA with pullup */
683 AT91_PIOC 11 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PC11 periph A MCI2_DA0 with pullup */
684 };
685 pinctrl_mmc2_dat1_3: mmc2_dat1_3 {
686 atmel,pins =
687 <AT91_PIOC 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC12 periph A MCI2_DA1 with pullup, conflicts with TIOA1 */
688 AT91_PIOC 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC13 periph A MCI2_DA2 with pullup, conflicts with TIOB1 */
689 AT91_PIOC 14 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PC14 periph A MCI2_DA3 with pullup, conflicts with TCLK1 */
690 };
691 };
692
693 nand0 { 506 nand0 {
694 pinctrl_nand0_ale_cle: nand0_ale_cle-0 { 507 pinctrl_nand0_ale_cle: nand0_ale_cle-0 {
695 atmel,pins = 508 atmel,pins =
@@ -748,22 +561,6 @@
748 }; 561 };
749 }; 562 };
750 563
751 uart0 {
752 pinctrl_uart0: uart0-0 {
753 atmel,pins =
754 <AT91_PIOC 29 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC29 periph A, conflicts with PWMFI2, ISI_D8 */
755 AT91_PIOC 30 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PC30 periph A with pullup, conflicts with ISI_PCK */
756 };
757 };
758
759 uart1 {
760 pinctrl_uart1: uart1-0 {
761 atmel,pins =
762 <AT91_PIOA 30 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA30 periph B, conflicts with TWD0, ISI_VSYNC */
763 AT91_PIOA 31 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>; /* PA31 periph B with pullup, conflicts with TWCK0, ISI_HSYNC */
764 };
765 };
766
767 usart0 { 564 usart0 {
768 pinctrl_usart0: usart0-0 { 565 pinctrl_usart0: usart0-0 {
769 atmel,pins = 566 atmel,pins =
diff --git a/arch/arm/boot/dts/sama5d31.dtsi b/arch/arm/boot/dts/sama5d31.dtsi
new file mode 100644
index 000000000000..7997dc9863ed
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d31.dtsi
@@ -0,0 +1,16 @@
1/*
2 * sama5d31.dtsi - Device Tree Include file for SAMA5D31 SoC
3 *
4 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
5 *
6 * Licensed under GPLv2 or later.
7 */
8#include "sama5d3.dtsi"
9#include "sama5d3_lcd.dtsi"
10#include "sama5d3_emac.dtsi"
11#include "sama5d3_mci2.dtsi"
12#include "sama5d3_uart.dtsi"
13
14/ {
15 compatible = "atmel,samad31", "atmel,sama5d3", "atmel,sama5";
16};
diff --git a/arch/arm/boot/dts/sama5d31ek.dts b/arch/arm/boot/dts/sama5d31ek.dts
index 027bac7510b6..04eec0dfcf7d 100644
--- a/arch/arm/boot/dts/sama5d31ek.dts
+++ b/arch/arm/boot/dts/sama5d31ek.dts
@@ -7,12 +7,13 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10#include "sama5d31.dtsi"
10#include "sama5d3xmb.dtsi" 11#include "sama5d3xmb.dtsi"
11#include "sama5d3xdm.dtsi" 12#include "sama5d3xdm.dtsi"
12 13
13/ { 14/ {
14 model = "Atmel SAMA5D31-EK"; 15 model = "Atmel SAMA5D31-EK";
15 compatible = "atmel,sama5d31ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5"; 16 compatible = "atmel,sama5d31ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d31", "atmel,sama5d3", "atmel,sama5";
16 17
17 ahb { 18 ahb {
18 apb { 19 apb {
diff --git a/arch/arm/boot/dts/sama5d33.dtsi b/arch/arm/boot/dts/sama5d33.dtsi
new file mode 100644
index 000000000000..39f832253caf
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d33.dtsi
@@ -0,0 +1,14 @@
1/*
2 * sama5d33.dtsi - Device Tree Include file for SAMA5D33 SoC
3 *
4 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
5 *
6 * Licensed under GPLv2 or later.
7 */
8#include "sama5d3.dtsi"
9#include "sama5d3_lcd.dtsi"
10#include "sama5d3_gmac.dtsi"
11
12/ {
13 compatible = "atmel,samad33", "atmel,sama5d3", "atmel,sama5";
14};
diff --git a/arch/arm/boot/dts/sama5d33ek.dts b/arch/arm/boot/dts/sama5d33ek.dts
index 99bd0c8e0471..cbd6a3ff1545 100644
--- a/arch/arm/boot/dts/sama5d33ek.dts
+++ b/arch/arm/boot/dts/sama5d33ek.dts
@@ -7,12 +7,13 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10#include "sama5d33.dtsi"
10#include "sama5d3xmb.dtsi" 11#include "sama5d3xmb.dtsi"
11#include "sama5d3xdm.dtsi" 12#include "sama5d3xdm.dtsi"
12 13
13/ { 14/ {
14 model = "Atmel SAMA5D33-EK"; 15 model = "Atmel SAMA5D33-EK";
15 compatible = "atmel,sama5d33ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5"; 16 compatible = "atmel,sama5d33ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d33", "atmel,sama5d3", "atmel,sama5";
16 17
17 ahb { 18 ahb {
18 apb { 19 apb {
diff --git a/arch/arm/boot/dts/sama5d34.dtsi b/arch/arm/boot/dts/sama5d34.dtsi
new file mode 100644
index 000000000000..89cda2c0da39
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d34.dtsi
@@ -0,0 +1,16 @@
1/*
2 * sama5d34.dtsi - Device Tree Include file for SAMA5D34 SoC
3 *
4 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
5 *
6 * Licensed under GPLv2 or later.
7 */
8#include "sama5d3.dtsi"
9#include "sama5d3_lcd.dtsi"
10#include "sama5d3_gmac.dtsi"
11#include "sama5d3_can.dtsi"
12#include "sama5d3_mci2.dtsi"
13
14/ {
15 compatible = "atmel,samad34", "atmel,sama5d3", "atmel,sama5";
16};
diff --git a/arch/arm/boot/dts/sama5d34ek.dts b/arch/arm/boot/dts/sama5d34ek.dts
index fb8ee11cf282..878aa164275a 100644
--- a/arch/arm/boot/dts/sama5d34ek.dts
+++ b/arch/arm/boot/dts/sama5d34ek.dts
@@ -7,12 +7,13 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10#include "sama5d34.dtsi"
10#include "sama5d3xmb.dtsi" 11#include "sama5d3xmb.dtsi"
11#include "sama5d3xdm.dtsi" 12#include "sama5d3xdm.dtsi"
12 13
13/ { 14/ {
14 model = "Atmel SAMA5D34-EK"; 15 model = "Atmel SAMA5D34-EK";
15 compatible = "atmel,sama5d34ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5"; 16 compatible = "atmel,sama5d34ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d34", "atmel,sama5d3", "atmel,sama5";
16 17
17 ahb { 18 ahb {
18 apb { 19 apb {
diff --git a/arch/arm/boot/dts/sama5d35.dtsi b/arch/arm/boot/dts/sama5d35.dtsi
new file mode 100644
index 000000000000..d20cd71b5f0e
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d35.dtsi
@@ -0,0 +1,18 @@
1/*
2 * sama5d35.dtsi - Device Tree Include file for SAMA5D35 SoC
3 *
4 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
5 *
6 * Licensed under GPLv2 or later.
7 */
8#include "sama5d3.dtsi"
9#include "sama5d3_gmac.dtsi"
10#include "sama5d3_emac.dtsi"
11#include "sama5d3_can.dtsi"
12#include "sama5d3_mci2.dtsi"
13#include "sama5d3_uart.dtsi"
14#include "sama5d3_tcb1.dtsi"
15
16/ {
17 compatible = "atmel,samad35", "atmel,sama5d3", "atmel,sama5";
18};
diff --git a/arch/arm/boot/dts/sama5d35ek.dts b/arch/arm/boot/dts/sama5d35ek.dts
index 509a53d9cc7b..9089c7c6cea8 100644
--- a/arch/arm/boot/dts/sama5d35ek.dts
+++ b/arch/arm/boot/dts/sama5d35ek.dts
@@ -7,11 +7,12 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10#include "sama5d35.dtsi"
10#include "sama5d3xmb.dtsi" 11#include "sama5d3xmb.dtsi"
11 12
12/ { 13/ {
13 model = "Atmel SAMA5D35-EK"; 14 model = "Atmel SAMA5D35-EK";
14 compatible = "atmel,sama5d35ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5"; 15 compatible = "atmel,sama5d35ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d35", "atmel,sama5d3", "atmel,sama5";
15 16
16 ahb { 17 ahb {
17 apb { 18 apb {
diff --git a/arch/arm/boot/dts/sama5d3_can.dtsi b/arch/arm/boot/dts/sama5d3_can.dtsi
new file mode 100644
index 000000000000..8ed3260cef66
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d3_can.dtsi
@@ -0,0 +1,54 @@
1/*
2 * at91sama5d3_can.dtsi - Device Tree Include file for AT91SAM9x5 SoC with
3 * CAN support
4 *
5 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
6 *
7 * Licensed under GPLv2.
8 */
9
10#include <dt-bindings/pinctrl/at91.h>
11#include <dt-bindings/interrupt-controller/irq.h>
12
13/ {
14 ahb {
15 apb {
16 pinctrl@fffff200 {
17 can0 {
18 pinctrl_can0_rx_tx: can0_rx_tx {
19 atmel,pins =
20 <AT91_PIOD 14 AT91_PERIPH_C AT91_PINCTRL_NONE /* PD14 periph C RX, conflicts with SCK0, SPI0_NPCS1 */
21 AT91_PIOD 15 AT91_PERIPH_C AT91_PINCTRL_NONE>; /* PD15 periph C TX, conflicts with CTS0, SPI0_NPCS2 */
22 };
23 };
24
25 can1 {
26 pinctrl_can1_rx_tx: can1_rx_tx {
27 atmel,pins =
28 <AT91_PIOB 14 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB14 periph B RX, conflicts with GCRS */
29 AT91_PIOB 15 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB15 periph B TX, conflicts with GCOL */
30 };
31 };
32
33 };
34
35 can0: can@f000c000 {
36 compatible = "atmel,at91sam9x5-can";
37 reg = <0xf000c000 0x300>;
38 interrupts = <40 IRQ_TYPE_LEVEL_HIGH 3>;
39 pinctrl-names = "default";
40 pinctrl-0 = <&pinctrl_can0_rx_tx>;
41 status = "disabled";
42 };
43
44 can1: can@f8010000 {
45 compatible = "atmel,at91sam9x5-can";
46 reg = <0xf8010000 0x300>;
47 interrupts = <41 IRQ_TYPE_LEVEL_HIGH 3>;
48 pinctrl-names = "default";
49 pinctrl-0 = <&pinctrl_can1_rx_tx>;
50 status = "disabled";
51 };
52 };
53 };
54};
diff --git a/arch/arm/boot/dts/sama5d3_emac.dtsi b/arch/arm/boot/dts/sama5d3_emac.dtsi
new file mode 100644
index 000000000000..4d4f351f1f9f
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d3_emac.dtsi
@@ -0,0 +1,44 @@
1/*
2 * at91sama5d3_emac.dtsi - Device Tree Include file for AT91SAM9x5 SoC with
3 * Ethernet.
4 *
5 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
6 *
7 * Licensed under GPLv2.
8 */
9
10#include <dt-bindings/pinctrl/at91.h>
11#include <dt-bindings/interrupt-controller/irq.h>
12
13/ {
14 ahb {
15 apb {
16 pinctrl@fffff200 {
17 macb1 {
18 pinctrl_macb1_rmii: macb1_rmii-0 {
19 atmel,pins =
20 <AT91_PIOC 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC0 periph A ETX0, conflicts with TIOA3 */
21 AT91_PIOC 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC1 periph A ETX1, conflicts with TIOB3 */
22 AT91_PIOC 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC2 periph A ERX0, conflicts with TCLK3 */
23 AT91_PIOC 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC3 periph A ERX1, conflicts with TIOA4 */
24 AT91_PIOC 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC4 periph A ETXEN, conflicts with TIOB4 */
25 AT91_PIOC 5 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC5 periph A ECRSDV,conflicts with TCLK4 */
26 AT91_PIOC 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC6 periph A ERXER, conflicts with TIOA5 */
27 AT91_PIOC 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC7 periph A EREFCK, conflicts with TIOB5 */
28 AT91_PIOC 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC8 periph A EMDC, conflicts with TCLK5 */
29 AT91_PIOC 9 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PC9 periph A EMDIO */
30 };
31 };
32 };
33
34 macb1: ethernet@f802c000 {
35 compatible = "cdns,at32ap7000-macb", "cdns,macb";
36 reg = <0xf802c000 0x100>;
37 interrupts = <35 IRQ_TYPE_LEVEL_HIGH 3>;
38 pinctrl-names = "default";
39 pinctrl-0 = <&pinctrl_macb1_rmii>;
40 status = "disabled";
41 };
42 };
43 };
44};
diff --git a/arch/arm/boot/dts/sama5d3_gmac.dtsi b/arch/arm/boot/dts/sama5d3_gmac.dtsi
new file mode 100644
index 000000000000..0ba8be30ccd8
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d3_gmac.dtsi
@@ -0,0 +1,77 @@
1/*
2 * at91sama5d3_gmac.dtsi - Device Tree Include file for AT91SAM9x5 SoC with
3 * Gigabit Ethernet.
4 *
5 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
6 *
7 * Licensed under GPLv2.
8 */
9
10#include <dt-bindings/pinctrl/at91.h>
11#include <dt-bindings/interrupt-controller/irq.h>
12
13/ {
14 ahb {
15 apb {
16 pinctrl@fffff200 {
17 macb0 {
18 pinctrl_macb0_data_rgmii: macb0_data_rgmii {
19 atmel,pins =
20 <AT91_PIOB 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB0 periph A GTX0, conflicts with PWMH0 */
21 AT91_PIOB 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB1 periph A GTX1, conflicts with PWML0 */
22 AT91_PIOB 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB2 periph A GTX2, conflicts with TK1 */
23 AT91_PIOB 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB3 periph A GTX3, conflicts with TF1 */
24 AT91_PIOB 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB4 periph A GRX0, conflicts with PWMH1 */
25 AT91_PIOB 5 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB5 periph A GRX1, conflicts with PWML1 */
26 AT91_PIOB 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB6 periph A GRX2, conflicts with TD1 */
27 AT91_PIOB 7 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB7 periph A GRX3, conflicts with RK1 */
28 };
29 pinctrl_macb0_data_gmii: macb0_data_gmii {
30 atmel,pins =
31 <AT91_PIOB 19 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB19 periph B GTX4, conflicts with MCI1_CDA */
32 AT91_PIOB 20 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB20 periph B GTX5, conflicts with MCI1_DA0 */
33 AT91_PIOB 21 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB21 periph B GTX6, conflicts with MCI1_DA1 */
34 AT91_PIOB 22 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB22 periph B GTX7, conflicts with MCI1_DA2 */
35 AT91_PIOB 23 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB23 periph B GRX4, conflicts with MCI1_DA3 */
36 AT91_PIOB 24 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB24 periph B GRX5, conflicts with MCI1_CK */
37 AT91_PIOB 25 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB25 periph B GRX6, conflicts with SCK1 */
38 AT91_PIOB 26 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB26 periph B GRX7, conflicts with CTS1 */
39 };
40 pinctrl_macb0_signal_rgmii: macb0_signal_rgmii {
41 atmel,pins =
42 <AT91_PIOB 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB8 periph A GTXCK, conflicts with PWMH2 */
43 AT91_PIOB 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB9 periph A GTXEN, conflicts with PWML2 */
44 AT91_PIOB 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB11 periph A GRXCK, conflicts with RD1 */
45 AT91_PIOB 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB13 periph A GRXER, conflicts with PWML3 */
46 AT91_PIOB 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB16 periph A GMDC */
47 AT91_PIOB 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB17 periph A GMDIO */
48 AT91_PIOB 18 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB18 periph A G125CK */
49 };
50 pinctrl_macb0_signal_gmii: macb0_signal_gmii {
51 atmel,pins =
52 <AT91_PIOB 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB9 periph A GTXEN, conflicts with PWML2 */
53 AT91_PIOB 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB10 periph A GTXER, conflicts with RF1 */
54 AT91_PIOB 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB11 periph A GRXCK, conflicts with RD1 */
55 AT91_PIOB 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB12 periph A GRXDV, conflicts with PWMH3 */
56 AT91_PIOB 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB13 periph A GRXER, conflicts with PWML3 */
57 AT91_PIOB 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB14 periph A GCRS, conflicts with CANRX1 */
58 AT91_PIOB 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB15 periph A GCOL, conflicts with CANTX1 */
59 AT91_PIOB 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB16 periph A GMDC */
60 AT91_PIOB 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB17 periph A GMDIO */
61 AT91_PIOB 27 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB27 periph B G125CKO */
62 };
63
64 };
65 };
66
67 macb0: ethernet@f0028000 {
68 compatible = "cdns,pc302-gem", "cdns,gem";
69 reg = <0xf0028000 0x100>;
70 interrupts = <34 IRQ_TYPE_LEVEL_HIGH 3>;
71 pinctrl-names = "default";
72 pinctrl-0 = <&pinctrl_macb0_data_rgmii &pinctrl_macb0_signal_rgmii>;
73 status = "disabled";
74 };
75 };
76 };
77};
diff --git a/arch/arm/boot/dts/sama5d3_lcd.dtsi b/arch/arm/boot/dts/sama5d3_lcd.dtsi
new file mode 100644
index 000000000000..01f52a79f8ba
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d3_lcd.dtsi
@@ -0,0 +1,55 @@
1/*
2 * at91sama5d3_lcd.dtsi - Device Tree Include file for AT91SAM9x5 SoC with
3 * LCD support
4 *
5 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
6 *
7 * Licensed under GPLv2.
8 */
9
10#include <dt-bindings/pinctrl/at91.h>
11#include <dt-bindings/interrupt-controller/irq.h>
12
13/ {
14 ahb {
15 apb {
16 pinctrl@fffff200 {
17 lcd {
18 pinctrl_lcd: lcd-0 {
19 atmel,pins =
20 <AT91_PIOA 24 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA24 periph A LCDPWM */
21 AT91_PIOA 26 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA26 periph A LCDVSYNC */
22 AT91_PIOA 27 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA27 periph A LCDHSYNC */
23 AT91_PIOA 25 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA25 periph A LCDDISP */
24 AT91_PIOA 29 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA29 periph A LCDDEN */
25 AT91_PIOA 28 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA28 periph A LCDPCK */
26 AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA0 periph A LCDD0 pin */
27 AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA1 periph A LCDD1 pin */
28 AT91_PIOA 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA2 periph A LCDD2 pin */
29 AT91_PIOA 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA3 periph A LCDD3 pin */
30 AT91_PIOA 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA4 periph A LCDD4 pin */
31 AT91_PIOA 5 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA5 periph A LCDD5 pin */
32 AT91_PIOA 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA6 periph A LCDD6 pin */
33 AT91_PIOA 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA7 periph A LCDD7 pin */
34 AT91_PIOA 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA8 periph A LCDD8 pin */
35 AT91_PIOA 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA9 periph A LCDD9 pin */
36 AT91_PIOA 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA10 periph A LCDD10 pin */
37 AT91_PIOA 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA11 periph A LCDD11 pin */
38 AT91_PIOA 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA12 periph A LCDD12 pin */
39 AT91_PIOA 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA13 periph A LCDD13 pin */
40 AT91_PIOA 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA14 periph A LCDD14 pin */
41 AT91_PIOA 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA15 periph A LCDD15 pin */
42 AT91_PIOC 14 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC14 periph C LCDD16 pin */
43 AT91_PIOC 13 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC13 periph C LCDD17 pin */
44 AT91_PIOC 12 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC12 periph C LCDD18 pin */
45 AT91_PIOC 11 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC11 periph C LCDD19 pin */
46 AT91_PIOC 10 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC10 periph C LCDD20 pin */
47 AT91_PIOC 15 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC15 periph C LCDD21 pin */
48 AT91_PIOE 27 AT91_PERIPH_C AT91_PINCTRL_NONE /* PE27 periph C LCDD22 pin */
49 AT91_PIOE 28 AT91_PERIPH_C AT91_PINCTRL_NONE>; /* PE28 periph C LCDD23 pin */
50 };
51 };
52 };
53 };
54 };
55};
diff --git a/arch/arm/boot/dts/sama5d3_mci2.dtsi b/arch/arm/boot/dts/sama5d3_mci2.dtsi
new file mode 100644
index 000000000000..38e88e39e551
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d3_mci2.dtsi
@@ -0,0 +1,47 @@
1/*
2 * at91sama5d3_mci2.dtsi - Device Tree Include file for AT91SAM9x5 SoC with
3 * 3 MMC ports
4 *
5 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
6 *
7 * Licensed under GPLv2.
8 */
9
10#include <dt-bindings/pinctrl/at91.h>
11#include <dt-bindings/interrupt-controller/irq.h>
12
13/ {
14 ahb {
15 apb {
16 pinctrl@fffff200 {
17 mmc2 {
18 pinctrl_mmc2_clk_cmd_dat0: mmc2_clk_cmd_dat0 {
19 atmel,pins =
20 <AT91_PIOC 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC15 periph A MCI2_CK, conflicts with PCK2 */
21 AT91_PIOC 10 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PC10 periph A MCI2_CDA with pullup */
22 AT91_PIOC 11 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PC11 periph A MCI2_DA0 with pullup */
23 };
24 pinctrl_mmc2_dat1_3: mmc2_dat1_3 {
25 atmel,pins =
26 <AT91_PIOC 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC12 periph A MCI2_DA1 with pullup, conflicts with TIOA1 */
27 AT91_PIOC 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC13 periph A MCI2_DA2 with pullup, conflicts with TIOB1 */
28 AT91_PIOC 14 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PC14 periph A MCI2_DA3 with pullup, conflicts with TCLK1 */
29 };
30 };
31 };
32
33 mmc2: mmc@f8004000 {
34 compatible = "atmel,hsmci";
35 reg = <0xf8004000 0x600>;
36 interrupts = <23 IRQ_TYPE_LEVEL_HIGH 0>;
37 dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(1)>;
38 dma-names = "rxtx";
39 pinctrl-names = "default";
40 pinctrl-0 = <&pinctrl_mmc2_clk_cmd_dat0 &pinctrl_mmc2_dat1_3>;
41 status = "disabled";
42 #address-cells = <1>;
43 #size-cells = <0>;
44 };
45 };
46 };
47};
diff --git a/arch/arm/boot/dts/sama5d3_tcb1.dtsi b/arch/arm/boot/dts/sama5d3_tcb1.dtsi
new file mode 100644
index 000000000000..5264bb4a6998
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d3_tcb1.dtsi
@@ -0,0 +1,27 @@
1/*
2 * at91sama5d3_tcb1.dtsi - Device Tree Include file for AT91SAM9x5 SoC with
3 * 2 TC blocks.
4 *
5 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
6 *
7 * Licensed under GPLv2.
8 */
9
10#include <dt-bindings/pinctrl/at91.h>
11#include <dt-bindings/interrupt-controller/irq.h>
12
13/ {
14 aliases {
15 tcb1 = &tcb1;
16 };
17
18 ahb {
19 apb {
20 tcb1: timer@f8014000 {
21 compatible = "atmel,at91sam9x5-tcb";
22 reg = <0xf8014000 0x100>;
23 interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>;
24 };
25 };
26 };
27};
diff --git a/arch/arm/boot/dts/sama5d3_uart.dtsi b/arch/arm/boot/dts/sama5d3_uart.dtsi
new file mode 100644
index 000000000000..98fcb2d57446
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d3_uart.dtsi
@@ -0,0 +1,53 @@
1/*
2 * at91sama5d3_uart.dtsi - Device Tree Include file for AT91SAM9x5 SoC with
3 * UART support
4 *
5 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
6 *
7 * Licensed under GPLv2.
8 */
9
10#include <dt-bindings/pinctrl/at91.h>
11#include <dt-bindings/interrupt-controller/irq.h>
12
13/ {
14 ahb {
15 apb {
16 pinctrl@fffff200 {
17 uart0 {
18 pinctrl_uart0: uart0-0 {
19 atmel,pins =
20 <AT91_PIOC 29 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC29 periph A, conflicts with PWMFI2, ISI_D8 */
21 AT91_PIOC 30 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PC30 periph A with pullup, conflicts with ISI_PCK */
22 };
23 };
24
25 uart1 {
26 pinctrl_uart1: uart1-0 {
27 atmel,pins =
28 <AT91_PIOA 30 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA30 periph B, conflicts with TWD0, ISI_VSYNC */
29 AT91_PIOA 31 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>; /* PA31 periph B with pullup, conflicts with TWCK0, ISI_HSYNC */
30 };
31 };
32 };
33
34 uart0: serial@f0024000 {
35 compatible = "atmel,at91sam9260-usart";
36 reg = <0xf0024000 0x200>;
37 interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>;
38 pinctrl-names = "default";
39 pinctrl-0 = <&pinctrl_uart0>;
40 status = "disabled";
41 };
42
43 uart1: serial@f8028000 {
44 compatible = "atmel,at91sam9260-usart";
45 reg = <0xf8028000 0x200>;
46 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 5>;
47 pinctrl-names = "default";
48 pinctrl-0 = <&pinctrl_uart1>;
49 status = "disabled";
50 };
51 };
52 };
53};
diff --git a/arch/arm/boot/dts/sama5d3xcm.dtsi b/arch/arm/boot/dts/sama5d3xcm.dtsi
index 31ed9e3bb649..726a0f35100c 100644
--- a/arch/arm/boot/dts/sama5d3xcm.dtsi
+++ b/arch/arm/boot/dts/sama5d3xcm.dtsi
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9#include "sama5d3.dtsi"
10 9
11/ { 10/ {
12 compatible = "atmel,samad3xcm", "atmel,sama5d3", "atmel,sama5"; 11 compatible = "atmel,samad3xcm", "atmel,sama5d3", "atmel,sama5";
diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
index 212230629f27..8ee06dd81799 100644
--- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -108,6 +108,7 @@
108}; 108};
109 109
110&i2c0 { 110&i2c0 {
111 status = "okay";
111 as3711@40 { 112 as3711@40 {
112 compatible = "ams,as3711"; 113 compatible = "ams,as3711";
113 reg = <0x40>; 114 reg = <0x40>;
@@ -183,6 +184,7 @@
183&i2c3 { 184&i2c3 {
184 pinctrl-0 = <&i2c3_pins>; 185 pinctrl-0 = <&i2c3_pins>;
185 pinctrl-names = "default"; 186 pinctrl-names = "default";
187 status = "okay";
186}; 188};
187 189
188&mmcif { 190&mmcif {
diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
index ba59a5875a10..fcf26889a8a0 100644
--- a/arch/arm/boot/dts/sh73a0.dtsi
+++ b/arch/arm/boot/dts/sh73a0.dtsi
@@ -135,6 +135,7 @@
135 0 168 0x4 135 0 168 0x4
136 0 169 0x4 136 0 169 0x4
137 0 170 0x4>; 137 0 170 0x4>;
138 status = "disabled";
138 }; 139 };
139 140
140 i2c1: i2c@e6822000 { 141 i2c1: i2c@e6822000 {
@@ -147,6 +148,7 @@
147 0 52 0x4 148 0 52 0x4
148 0 53 0x4 149 0 53 0x4
149 0 54 0x4>; 150 0 54 0x4>;
151 status = "disabled";
150 }; 152 };
151 153
152 i2c2: i2c@e6824000 { 154 i2c2: i2c@e6824000 {
@@ -159,6 +161,7 @@
159 0 172 0x4 161 0 172 0x4
160 0 173 0x4 162 0 173 0x4
161 0 174 0x4>; 163 0 174 0x4>;
164 status = "disabled";
162 }; 165 };
163 166
164 i2c3: i2c@e6826000 { 167 i2c3: i2c@e6826000 {
@@ -171,6 +174,7 @@
171 0 184 0x4 174 0 184 0x4
172 0 185 0x4 175 0 185 0x4
173 0 186 0x4>; 176 0 186 0x4>;
177 status = "disabled";
174 }; 178 };
175 179
176 i2c4: i2c@e6828000 { 180 i2c4: i2c@e6828000 {
@@ -183,6 +187,7 @@
183 0 188 0x4 187 0 188 0x4
184 0 189 0x4 188 0 189 0x4
185 0 190 0x4>; 189 0 190 0x4>;
190 status = "disabled";
186 }; 191 };
187 192
188 mmcif: mmcif@e6bd0000 { 193 mmcif: mmcif@e6bd0000 {
@@ -196,7 +201,7 @@
196 }; 201 };
197 202
198 sdhi0: sdhi@ee100000 { 203 sdhi0: sdhi@ee100000 {
199 compatible = "renesas,r8a7740-sdhi"; 204 compatible = "renesas,sdhi-r8a7740";
200 reg = <0xee100000 0x100>; 205 reg = <0xee100000 0x100>;
201 interrupt-parent = <&gic>; 206 interrupt-parent = <&gic>;
202 interrupts = <0 83 4 207 interrupts = <0 83 4
@@ -208,7 +213,7 @@
208 213
209 /* SDHI1 and SDHI2 have no CD pins, no need for CD IRQ */ 214 /* SDHI1 and SDHI2 have no CD pins, no need for CD IRQ */
210 sdhi1: sdhi@ee120000 { 215 sdhi1: sdhi@ee120000 {
211 compatible = "renesas,r8a7740-sdhi"; 216 compatible = "renesas,sdhi-r8a7740";
212 reg = <0xee120000 0x100>; 217 reg = <0xee120000 0x100>;
213 interrupt-parent = <&gic>; 218 interrupt-parent = <&gic>;
214 interrupts = <0 88 4 219 interrupts = <0 88 4
@@ -219,7 +224,7 @@
219 }; 224 };
220 225
221 sdhi2: sdhi@ee140000 { 226 sdhi2: sdhi@ee140000 {
222 compatible = "renesas,r8a7740-sdhi"; 227 compatible = "renesas,sdhi-r8a7740";
223 reg = <0xee140000 0x100>; 228 reg = <0xee140000 0x100>;
224 interrupt-parent = <&gic>; 229 interrupt-parent = <&gic>;
225 interrupts = <0 104 4 230 interrupts = <0 104 4
diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
index e273fa993b8c..6d09b8d42fdd 100644
--- a/arch/arm/boot/dts/socfpga.dtsi
+++ b/arch/arm/boot/dts/socfpga.dtsi
@@ -147,7 +147,7 @@
147 reg = <0x58>; 147 reg = <0x58>;
148 }; 148 };
149 149
150 cfg_s2f_usr0_clk: cfg_s2f_usr0_clk { 150 cfg_h2f_usr0_clk: cfg_h2f_usr0_clk {
151 #clock-cells = <0>; 151 #clock-cells = <0>;
152 compatible = "altr,socfpga-perip-clk"; 152 compatible = "altr,socfpga-perip-clk";
153 clocks = <&main_pll>; 153 clocks = <&main_pll>;
@@ -198,7 +198,7 @@
198 reg = <0x98>; 198 reg = <0x98>;
199 }; 199 };
200 200
201 s2f_usr1_clk: s2f_usr1_clk { 201 h2f_usr1_clk: h2f_usr1_clk {
202 #clock-cells = <0>; 202 #clock-cells = <0>;
203 compatible = "altr,socfpga-perip-clk"; 203 compatible = "altr,socfpga-perip-clk";
204 clocks = <&periph_pll>; 204 clocks = <&periph_pll>;
@@ -235,7 +235,7 @@
235 reg = <0xD0>; 235 reg = <0xD0>;
236 }; 236 };
237 237
238 s2f_usr2_clk: s2f_usr2_clk { 238 h2f_usr2_clk: h2f_usr2_clk {
239 #clock-cells = <0>; 239 #clock-cells = <0>;
240 compatible = "altr,socfpga-perip-clk"; 240 compatible = "altr,socfpga-perip-clk";
241 clocks = <&sdram_pll>; 241 clocks = <&sdram_pll>;
@@ -243,197 +243,197 @@
243 }; 243 };
244 }; 244 };
245 245
246 mpu_periph_clk: mpu_periph_clk { 246 mpu_periph_clk: mpu_periph_clk {
247 #clock-cells = <0>; 247 #clock-cells = <0>;
248 compatible = "altr,socfpga-gate-clk"; 248 compatible = "altr,socfpga-gate-clk";
249 clocks = <&mpuclk>; 249 clocks = <&mpuclk>;
250 fixed-divider = <4>; 250 fixed-divider = <4>;
251 }; 251 };
252 252
253 mpu_l2_ram_clk: mpu_l2_ram_clk { 253 mpu_l2_ram_clk: mpu_l2_ram_clk {
254 #clock-cells = <0>; 254 #clock-cells = <0>;
255 compatible = "altr,socfpga-gate-clk"; 255 compatible = "altr,socfpga-gate-clk";
256 clocks = <&mpuclk>; 256 clocks = <&mpuclk>;
257 fixed-divider = <2>; 257 fixed-divider = <2>;
258 }; 258 };
259 259
260 l4_main_clk: l4_main_clk { 260 l4_main_clk: l4_main_clk {
261 #clock-cells = <0>; 261 #clock-cells = <0>;
262 compatible = "altr,socfpga-gate-clk"; 262 compatible = "altr,socfpga-gate-clk";
263 clocks = <&mainclk>; 263 clocks = <&mainclk>;
264 clk-gate = <0x60 0>; 264 clk-gate = <0x60 0>;
265 }; 265 };
266 266
267 l3_main_clk: l3_main_clk { 267 l3_main_clk: l3_main_clk {
268 #clock-cells = <0>; 268 #clock-cells = <0>;
269 compatible = "altr,socfpga-gate-clk"; 269 compatible = "altr,socfpga-gate-clk";
270 clocks = <&mainclk>; 270 clocks = <&mainclk>;
271 }; 271 };
272 272
273 l3_mp_clk: l3_mp_clk { 273 l3_mp_clk: l3_mp_clk {
274 #clock-cells = <0>; 274 #clock-cells = <0>;
275 compatible = "altr,socfpga-gate-clk"; 275 compatible = "altr,socfpga-gate-clk";
276 clocks = <&mainclk>; 276 clocks = <&mainclk>;
277 div-reg = <0x64 0 2>; 277 div-reg = <0x64 0 2>;
278 clk-gate = <0x60 1>; 278 clk-gate = <0x60 1>;
279 }; 279 };
280 280
281 l3_sp_clk: l3_sp_clk { 281 l3_sp_clk: l3_sp_clk {
282 #clock-cells = <0>; 282 #clock-cells = <0>;
283 compatible = "altr,socfpga-gate-clk"; 283 compatible = "altr,socfpga-gate-clk";
284 clocks = <&mainclk>; 284 clocks = <&mainclk>;
285 div-reg = <0x64 2 2>; 285 div-reg = <0x64 2 2>;
286 }; 286 };
287 287
288 l4_mp_clk: l4_mp_clk { 288 l4_mp_clk: l4_mp_clk {
289 #clock-cells = <0>; 289 #clock-cells = <0>;
290 compatible = "altr,socfpga-gate-clk"; 290 compatible = "altr,socfpga-gate-clk";
291 clocks = <&mainclk>, <&per_base_clk>; 291 clocks = <&mainclk>, <&per_base_clk>;
292 div-reg = <0x64 4 3>; 292 div-reg = <0x64 4 3>;
293 clk-gate = <0x60 2>; 293 clk-gate = <0x60 2>;
294 }; 294 };
295 295
296 l4_sp_clk: l4_sp_clk { 296 l4_sp_clk: l4_sp_clk {
297 #clock-cells = <0>; 297 #clock-cells = <0>;
298 compatible = "altr,socfpga-gate-clk"; 298 compatible = "altr,socfpga-gate-clk";
299 clocks = <&mainclk>, <&per_base_clk>; 299 clocks = <&mainclk>, <&per_base_clk>;
300 div-reg = <0x64 7 3>; 300 div-reg = <0x64 7 3>;
301 clk-gate = <0x60 3>; 301 clk-gate = <0x60 3>;
302 }; 302 };
303 303
304 dbg_at_clk: dbg_at_clk { 304 dbg_at_clk: dbg_at_clk {
305 #clock-cells = <0>; 305 #clock-cells = <0>;
306 compatible = "altr,socfpga-gate-clk"; 306 compatible = "altr,socfpga-gate-clk";
307 clocks = <&dbg_base_clk>; 307 clocks = <&dbg_base_clk>;
308 div-reg = <0x68 0 2>; 308 div-reg = <0x68 0 2>;
309 clk-gate = <0x60 4>; 309 clk-gate = <0x60 4>;
310 }; 310 };
311 311
312 dbg_clk: dbg_clk { 312 dbg_clk: dbg_clk {
313 #clock-cells = <0>; 313 #clock-cells = <0>;
314 compatible = "altr,socfpga-gate-clk"; 314 compatible = "altr,socfpga-gate-clk";
315 clocks = <&dbg_base_clk>; 315 clocks = <&dbg_base_clk>;
316 div-reg = <0x68 2 2>; 316 div-reg = <0x68 2 2>;
317 clk-gate = <0x60 5>; 317 clk-gate = <0x60 5>;
318 }; 318 };
319 319
320 dbg_trace_clk: dbg_trace_clk { 320 dbg_trace_clk: dbg_trace_clk {
321 #clock-cells = <0>; 321 #clock-cells = <0>;
322 compatible = "altr,socfpga-gate-clk"; 322 compatible = "altr,socfpga-gate-clk";
323 clocks = <&dbg_base_clk>; 323 clocks = <&dbg_base_clk>;
324 div-reg = <0x6C 0 3>; 324 div-reg = <0x6C 0 3>;
325 clk-gate = <0x60 6>; 325 clk-gate = <0x60 6>;
326 }; 326 };
327 327
328 dbg_timer_clk: dbg_timer_clk { 328 dbg_timer_clk: dbg_timer_clk {
329 #clock-cells = <0>; 329 #clock-cells = <0>;
330 compatible = "altr,socfpga-gate-clk"; 330 compatible = "altr,socfpga-gate-clk";
331 clocks = <&dbg_base_clk>; 331 clocks = <&dbg_base_clk>;
332 clk-gate = <0x60 7>; 332 clk-gate = <0x60 7>;
333 }; 333 };
334 334
335 cfg_clk: cfg_clk { 335 cfg_clk: cfg_clk {
336 #clock-cells = <0>; 336 #clock-cells = <0>;
337 compatible = "altr,socfpga-gate-clk"; 337 compatible = "altr,socfpga-gate-clk";
338 clocks = <&cfg_s2f_usr0_clk>; 338 clocks = <&cfg_h2f_usr0_clk>;
339 clk-gate = <0x60 8>; 339 clk-gate = <0x60 8>;
340 }; 340 };
341 341
342 s2f_user0_clk: s2f_user0_clk { 342 h2f_user0_clk: h2f_user0_clk {
343 #clock-cells = <0>; 343 #clock-cells = <0>;
344 compatible = "altr,socfpga-gate-clk"; 344 compatible = "altr,socfpga-gate-clk";
345 clocks = <&cfg_s2f_usr0_clk>; 345 clocks = <&cfg_h2f_usr0_clk>;
346 clk-gate = <0x60 9>; 346 clk-gate = <0x60 9>;
347 }; 347 };
348 348
349 emac_0_clk: emac_0_clk { 349 emac_0_clk: emac_0_clk {
350 #clock-cells = <0>; 350 #clock-cells = <0>;
351 compatible = "altr,socfpga-gate-clk"; 351 compatible = "altr,socfpga-gate-clk";
352 clocks = <&emac0_clk>; 352 clocks = <&emac0_clk>;
353 clk-gate = <0xa0 0>; 353 clk-gate = <0xa0 0>;
354 }; 354 };
355 355
356 emac_1_clk: emac_1_clk { 356 emac_1_clk: emac_1_clk {
357 #clock-cells = <0>; 357 #clock-cells = <0>;
358 compatible = "altr,socfpga-gate-clk"; 358 compatible = "altr,socfpga-gate-clk";
359 clocks = <&emac1_clk>; 359 clocks = <&emac1_clk>;
360 clk-gate = <0xa0 1>; 360 clk-gate = <0xa0 1>;
361 }; 361 };
362 362
363 usb_mp_clk: usb_mp_clk { 363 usb_mp_clk: usb_mp_clk {
364 #clock-cells = <0>; 364 #clock-cells = <0>;
365 compatible = "altr,socfpga-gate-clk"; 365 compatible = "altr,socfpga-gate-clk";
366 clocks = <&per_base_clk>; 366 clocks = <&per_base_clk>;
367 clk-gate = <0xa0 2>; 367 clk-gate = <0xa0 2>;
368 div-reg = <0xa4 0 3>; 368 div-reg = <0xa4 0 3>;
369 }; 369 };
370 370
371 spi_m_clk: spi_m_clk { 371 spi_m_clk: spi_m_clk {
372 #clock-cells = <0>; 372 #clock-cells = <0>;
373 compatible = "altr,socfpga-gate-clk"; 373 compatible = "altr,socfpga-gate-clk";
374 clocks = <&per_base_clk>; 374 clocks = <&per_base_clk>;
375 clk-gate = <0xa0 3>; 375 clk-gate = <0xa0 3>;
376 div-reg = <0xa4 3 3>; 376 div-reg = <0xa4 3 3>;
377 }; 377 };
378 378
379 can0_clk: can0_clk { 379 can0_clk: can0_clk {
380 #clock-cells = <0>; 380 #clock-cells = <0>;
381 compatible = "altr,socfpga-gate-clk"; 381 compatible = "altr,socfpga-gate-clk";
382 clocks = <&per_base_clk>; 382 clocks = <&per_base_clk>;
383 clk-gate = <0xa0 4>; 383 clk-gate = <0xa0 4>;
384 div-reg = <0xa4 6 3>; 384 div-reg = <0xa4 6 3>;
385 }; 385 };
386 386
387 can1_clk: can1_clk { 387 can1_clk: can1_clk {
388 #clock-cells = <0>; 388 #clock-cells = <0>;
389 compatible = "altr,socfpga-gate-clk"; 389 compatible = "altr,socfpga-gate-clk";
390 clocks = <&per_base_clk>; 390 clocks = <&per_base_clk>;
391 clk-gate = <0xa0 5>; 391 clk-gate = <0xa0 5>;
392 div-reg = <0xa4 9 3>; 392 div-reg = <0xa4 9 3>;
393 }; 393 };
394 394
395 gpio_db_clk: gpio_db_clk { 395 gpio_db_clk: gpio_db_clk {
396 #clock-cells = <0>; 396 #clock-cells = <0>;
397 compatible = "altr,socfpga-gate-clk"; 397 compatible = "altr,socfpga-gate-clk";
398 clocks = <&per_base_clk>; 398 clocks = <&per_base_clk>;
399 clk-gate = <0xa0 6>; 399 clk-gate = <0xa0 6>;
400 div-reg = <0xa8 0 24>; 400 div-reg = <0xa8 0 24>;
401 }; 401 };
402 402
403 s2f_user1_clk: s2f_user1_clk { 403 h2f_user1_clk: h2f_user1_clk {
404 #clock-cells = <0>; 404 #clock-cells = <0>;
405 compatible = "altr,socfpga-gate-clk"; 405 compatible = "altr,socfpga-gate-clk";
406 clocks = <&s2f_usr1_clk>; 406 clocks = <&h2f_usr1_clk>;
407 clk-gate = <0xa0 7>; 407 clk-gate = <0xa0 7>;
408 }; 408 };
409 409
410 sdmmc_clk: sdmmc_clk { 410 sdmmc_clk: sdmmc_clk {
411 #clock-cells = <0>; 411 #clock-cells = <0>;
412 compatible = "altr,socfpga-gate-clk"; 412 compatible = "altr,socfpga-gate-clk";
413 clocks = <&f2s_periph_ref_clk>, <&main_nand_sdmmc_clk>, <&per_nand_mmc_clk>; 413 clocks = <&f2s_periph_ref_clk>, <&main_nand_sdmmc_clk>, <&per_nand_mmc_clk>;
414 clk-gate = <0xa0 8>; 414 clk-gate = <0xa0 8>;
415 }; 415 };
416 416
417 nand_x_clk: nand_x_clk { 417 nand_x_clk: nand_x_clk {
418 #clock-cells = <0>; 418 #clock-cells = <0>;
419 compatible = "altr,socfpga-gate-clk"; 419 compatible = "altr,socfpga-gate-clk";
420 clocks = <&f2s_periph_ref_clk>, <&main_nand_sdmmc_clk>, <&per_nand_mmc_clk>; 420 clocks = <&f2s_periph_ref_clk>, <&main_nand_sdmmc_clk>, <&per_nand_mmc_clk>;
421 clk-gate = <0xa0 9>; 421 clk-gate = <0xa0 9>;
422 }; 422 };
423 423
424 nand_clk: nand_clk { 424 nand_clk: nand_clk {
425 #clock-cells = <0>; 425 #clock-cells = <0>;
426 compatible = "altr,socfpga-gate-clk"; 426 compatible = "altr,socfpga-gate-clk";
427 clocks = <&f2s_periph_ref_clk>, <&main_nand_sdmmc_clk>, <&per_nand_mmc_clk>; 427 clocks = <&f2s_periph_ref_clk>, <&main_nand_sdmmc_clk>, <&per_nand_mmc_clk>;
428 clk-gate = <0xa0 10>; 428 clk-gate = <0xa0 10>;
429 fixed-divider = <4>; 429 fixed-divider = <4>;
430 }; 430 };
431 431
432 qspi_clk: qspi_clk { 432 qspi_clk: qspi_clk {
433 #clock-cells = <0>; 433 #clock-cells = <0>;
434 compatible = "altr,socfpga-gate-clk"; 434 compatible = "altr,socfpga-gate-clk";
435 clocks = <&f2s_periph_ref_clk>, <&main_qspi_clk>, <&per_qspi_clk>; 435 clocks = <&f2s_periph_ref_clk>, <&main_qspi_clk>, <&per_qspi_clk>;
436 clk-gate = <0xa0 11>; 436 clk-gate = <0xa0 11>;
437 }; 437 };
438 }; 438 };
439 }; 439 };
@@ -473,6 +473,7 @@
473 compatible = "arm,cortex-a9-twd-timer"; 473 compatible = "arm,cortex-a9-twd-timer";
474 reg = <0xfffec600 0x100>; 474 reg = <0xfffec600 0x100>;
475 interrupts = <1 13 0xf04>; 475 interrupts = <1 13 0xf04>;
476 clocks = <&mpu_periph_clk>;
476 }; 477 };
477 478
478 timer0: timer0@ffc08000 { 479 timer0: timer0@ffc08000 {
@@ -516,9 +517,9 @@
516 }; 517 };
517 518
518 rstmgr@ffd05000 { 519 rstmgr@ffd05000 {
519 compatible = "altr,rst-mgr"; 520 compatible = "altr,rst-mgr";
520 reg = <0xffd05000 0x1000>; 521 reg = <0xffd05000 0x1000>;
521 }; 522 };
522 523
523 sysmgr@ffd08000 { 524 sysmgr@ffd08000 {
524 compatible = "altr,sys-mgr"; 525 compatible = "altr,sys-mgr";
diff --git a/arch/arm/boot/dts/socfpga_arria5.dtsi b/arch/arm/boot/dts/socfpga_arria5.dtsi
new file mode 100644
index 000000000000..a85b4043f888
--- /dev/null
+++ b/arch/arm/boot/dts/socfpga_arria5.dtsi
@@ -0,0 +1,58 @@
1/*
2 * Copyright (C) 2013 Altera Corporation <www.altera.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17/dts-v1/;
18/include/ "socfpga.dtsi"
19
20/ {
21 soc {
22 clkmgr@ffd04000 {
23 clocks {
24 osc1 {
25 clock-frequency = <25000000>;
26 };
27 };
28 };
29
30 serial0@ffc02000 {
31 clock-frequency = <100000000>;
32 };
33
34 serial1@ffc03000 {
35 clock-frequency = <100000000>;
36 };
37
38 sysmgr@ffd08000 {
39 cpu1-start-addr = <0xffd080c4>;
40 };
41
42 timer0@ffc08000 {
43 clock-frequency = <100000000>;
44 };
45
46 timer1@ffc09000 {
47 clock-frequency = <100000000>;
48 };
49
50 timer2@ffd00000 {
51 clock-frequency = <25000000>;
52 };
53
54 timer3@ffd01000 {
55 clock-frequency = <25000000>;
56 };
57 };
58};
diff --git a/arch/mips/include/asm/mach-powertv/powertv-clock.h b/arch/arm/boot/dts/socfpga_arria5_socdk.dts
index 6f3e9a0fcf8c..5beffb2265f4 100644
--- a/arch/mips/include/asm/mach-powertv/powertv-clock.h
+++ b/arch/arm/boot/dts/socfpga_arria5_socdk.dts
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2009 Cisco Systems, Inc. 2 * Copyright (C) 2013 Altera Corporation <www.altera.com>
3 * 3 *
4 * 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
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
@@ -12,18 +12,29 @@
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
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, write to the Free Software 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18/*
19 * Local definitions for the powertv PCI code
20 */ 16 */
21 17
22#ifndef _POWERTV_PCI_POWERTV_PCI_H_ 18/include/ "socfpga_arria5.dtsi"
23#define _POWERTV_PCI_POWERTV_PCI_H_ 19
24extern int asic_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); 20/ {
25extern int asic_pcie_init(void); 21 model = "Altera SOCFPGA Arria V SoC Development Kit";
26extern int asic_pcie_init(void); 22 compatible = "altr,socfpga-arria5", "altr,socfpga";
23
24 chosen {
25 bootargs = "console=ttyS0,115200";
26 };
27
28 memory {
29 name = "memory";
30 device_type = "memory";
31 reg = <0x0 0x40000000>; /* 1GB */
32 };
27 33
28extern int log_level; 34 aliases {
29#endif 35 /* this allow the ethaddr uboot environmnet variable contents
36 * to be added to the gmac1 device tree blob.
37 */
38 ethernet0 = &gmac1;
39 };
40};
diff --git a/arch/arm/boot/dts/socfpga_cyclone5.dts b/arch/arm/boot/dts/socfpga_cyclone5.dtsi
index 973999d2c697..a8716f6dbe2e 100644
--- a/arch/arm/boot/dts/socfpga_cyclone5.dts
+++ b/arch/arm/boot/dts/socfpga_cyclone5.dtsi
@@ -19,26 +19,6 @@
19/include/ "socfpga.dtsi" 19/include/ "socfpga.dtsi"
20 20
21/ { 21/ {
22 model = "Altera SOCFPGA Cyclone V";
23 compatible = "altr,socfpga-cyclone5", "altr,socfpga";
24
25 chosen {
26 bootargs = "console=ttyS0,57600";
27 };
28
29 memory {
30 name = "memory";
31 device_type = "memory";
32 reg = <0x0 0x40000000>; /* 1GB */
33 };
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
42 soc { 22 soc {
43 clkmgr@ffd04000 { 23 clkmgr@ffd04000 {
44 clocks { 24 clocks {
diff --git a/arch/arm/boot/dts/socfpga_cyclone5_socdk.dts b/arch/arm/boot/dts/socfpga_cyclone5_socdk.dts
new file mode 100644
index 000000000000..2ee52ab8cabb
--- /dev/null
+++ b/arch/arm/boot/dts/socfpga_cyclone5_socdk.dts
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2012 Altera Corporation <www.altera.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/include/ "socfpga_cyclone5.dtsi"
19
20/ {
21 model = "Altera SOCFPGA Cyclone V SoC Development Kit";
22 compatible = "altr,socfpga-cyclone5", "altr,socfpga";
23
24 chosen {
25 bootargs = "console=ttyS0,115200";
26 };
27
28 memory {
29 name = "memory";
30 device_type = "memory";
31 reg = <0x0 0x40000000>; /* 1GB */
32 };
33
34 aliases {
35 /* this allow the ethaddr uboot environmnet variable contents
36 * to be added to the gmac1 device tree blob.
37 */
38 ethernet0 = &gmac1;
39 };
40};
diff --git a/arch/mips/include/asm/mach-powertv/irq.h b/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts
index 4bd5d0c61a91..50b99a2c12ae 100644
--- a/arch/mips/include/asm/mach-powertv/irq.h
+++ b/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2009 Cisco Systems, Inc. 2 * Copyright (C) 2013 Steffen Trumtrar <s.trumtrar@pengutronix.de>
3 * 3 *
4 * 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
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
@@ -12,14 +12,26 @@
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
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, write to the Free Software 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 16 */
18 17
19#ifndef _ASM_MACH_POWERTV_IRQ_H 18/include/ "socfpga_cyclone5.dtsi"
20#define _ASM_MACH_POWERTV_IRQ_H
21#include <asm/mach-powertv/interrupts.h>
22 19
23#define MIPS_CPU_IRQ_BASE ibase 20/ {
24#define NR_IRQS 127 21 model = "Terasic SoCkit";
25#endif 22 compatible = "altr,socfpga-cyclone5", "altr,socfpga";
23
24 chosen {
25 bootargs = "console=ttyS0,115200";
26 };
27
28 memory {
29 name = "memory";
30 device_type = "memory";
31 reg = <0x0 0x40000000>; /* 1GB */
32 };
33};
34
35&gmac1 {
36 status = "okay";
37};
diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi
index 1c1091eedade..7da99fe497e1 100644
--- a/arch/arm/boot/dts/ste-dbx5x0.dtsi
+++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <dt-bindings/interrupt-controller/irq.h> 12#include <dt-bindings/interrupt-controller/irq.h>
13#include <dt-bindings/mfd/dbx500-prcmu.h>
13#include "skeleton.dtsi" 14#include "skeleton.dtsi"
14 15
15/ { 16/ {
@@ -42,16 +43,56 @@
42 interrupts = <0 7 IRQ_TYPE_LEVEL_HIGH>; 43 interrupts = <0 7 IRQ_TYPE_LEVEL_HIGH>;
43 }; 44 };
44 45
46
47 clocks {
48 compatible = "stericsson,u8500-clks";
49
50 prcmu_clk: prcmu-clock {
51 #clock-cells = <1>;
52 };
53
54 prcc_pclk: prcc-periph-clock {
55 #clock-cells = <2>;
56 };
57
58 prcc_kclk: prcc-kernel-clock {
59 #clock-cells = <2>;
60 };
61
62 rtc_clk: rtc32k-clock {
63 #clock-cells = <0>;
64 };
65
66 smp_twd_clk: smp-twd-clock {
67 #clock-cells = <0>;
68 };
69 };
70
71 mtu@a03c6000 {
72 /* Nomadik System Timer */
73 compatible = "st,nomadik-mtu";
74 reg = <0xa03c6000 0x1000>;
75 interrupts = <0 4 IRQ_TYPE_LEVEL_HIGH>;
76
77 clocks = <&prcmu_clk PRCMU_TIMCLK>, <&prcc_pclk 6 6>;
78 clock-names = "timclk", "apb_pclk";
79 };
80
45 timer@a0410600 { 81 timer@a0410600 {
46 compatible = "arm,cortex-a9-twd-timer"; 82 compatible = "arm,cortex-a9-twd-timer";
47 reg = <0xa0410600 0x20>; 83 reg = <0xa0410600 0x20>;
48 interrupts = <1 13 0x304>; /* IRQ level high per-CPU */ 84 interrupts = <1 13 0x304>; /* IRQ level high per-CPU */
85
86 clocks = <&smp_twd_clk>;
49 }; 87 };
50 88
51 rtc@80154000 { 89 rtc@80154000 {
52 compatible = "arm,rtc-pl031", "arm,primecell"; 90 compatible = "arm,rtc-pl031", "arm,primecell";
53 reg = <0x80154000 0x1000>; 91 reg = <0x80154000 0x1000>;
54 interrupts = <0 18 IRQ_TYPE_LEVEL_HIGH>; 92 interrupts = <0 18 IRQ_TYPE_LEVEL_HIGH>;
93
94 clocks = <&rtc_clk>;
95 clock-names = "apb_pclk";
55 }; 96 };
56 97
57 gpio0: gpio@8012e000 { 98 gpio0: gpio@8012e000 {
@@ -65,6 +106,8 @@
65 gpio-controller; 106 gpio-controller;
66 #gpio-cells = <2>; 107 #gpio-cells = <2>;
67 gpio-bank = <0>; 108 gpio-bank = <0>;
109
110 clocks = <&prcc_pclk 1 9>;
68 }; 111 };
69 112
70 gpio1: gpio@8012e080 { 113 gpio1: gpio@8012e080 {
@@ -78,6 +121,8 @@
78 gpio-controller; 121 gpio-controller;
79 #gpio-cells = <2>; 122 #gpio-cells = <2>;
80 gpio-bank = <1>; 123 gpio-bank = <1>;
124
125 clocks = <&prcc_pclk 1 9>;
81 }; 126 };
82 127
83 gpio2: gpio@8000e000 { 128 gpio2: gpio@8000e000 {
@@ -91,6 +136,8 @@
91 gpio-controller; 136 gpio-controller;
92 #gpio-cells = <2>; 137 #gpio-cells = <2>;
93 gpio-bank = <2>; 138 gpio-bank = <2>;
139
140 clocks = <&prcc_pclk 3 8>;
94 }; 141 };
95 142
96 gpio3: gpio@8000e080 { 143 gpio3: gpio@8000e080 {
@@ -104,6 +151,8 @@
104 gpio-controller; 151 gpio-controller;
105 #gpio-cells = <2>; 152 #gpio-cells = <2>;
106 gpio-bank = <3>; 153 gpio-bank = <3>;
154
155 clocks = <&prcc_pclk 3 8>;
107 }; 156 };
108 157
109 gpio4: gpio@8000e100 { 158 gpio4: gpio@8000e100 {
@@ -117,6 +166,8 @@
117 gpio-controller; 166 gpio-controller;
118 #gpio-cells = <2>; 167 #gpio-cells = <2>;
119 gpio-bank = <4>; 168 gpio-bank = <4>;
169
170 clocks = <&prcc_pclk 3 8>;
120 }; 171 };
121 172
122 gpio5: gpio@8000e180 { 173 gpio5: gpio@8000e180 {
@@ -130,6 +181,8 @@
130 gpio-controller; 181 gpio-controller;
131 #gpio-cells = <2>; 182 #gpio-cells = <2>;
132 gpio-bank = <5>; 183 gpio-bank = <5>;
184
185 clocks = <&prcc_pclk 3 8>;
133 }; 186 };
134 187
135 gpio6: gpio@8011e000 { 188 gpio6: gpio@8011e000 {
@@ -143,6 +196,8 @@
143 gpio-controller; 196 gpio-controller;
144 #gpio-cells = <2>; 197 #gpio-cells = <2>;
145 gpio-bank = <6>; 198 gpio-bank = <6>;
199
200 clocks = <&prcc_pclk 2 11>;
146 }; 201 };
147 202
148 gpio7: gpio@8011e080 { 203 gpio7: gpio@8011e080 {
@@ -156,6 +211,8 @@
156 gpio-controller; 211 gpio-controller;
157 #gpio-cells = <2>; 212 #gpio-cells = <2>;
158 gpio-bank = <7>; 213 gpio-bank = <7>;
214
215 clocks = <&prcc_pclk 2 11>;
159 }; 216 };
160 217
161 gpio8: gpio@a03fe000 { 218 gpio8: gpio@a03fe000 {
@@ -169,6 +226,8 @@
169 gpio-controller; 226 gpio-controller;
170 #gpio-cells = <2>; 227 #gpio-cells = <2>;
171 gpio-bank = <8>; 228 gpio-bank = <8>;
229
230 clocks = <&prcc_pclk 5 1>;
172 }; 231 };
173 232
174 pinctrl { 233 pinctrl {
@@ -177,8 +236,7 @@
177 }; 236 };
178 237
179 usb_per5@a03e0000 { 238 usb_per5@a03e0000 {
180 compatible = "stericsson,db8500-musb", 239 compatible = "stericsson,db8500-musb";
181 "mentor,musb";
182 reg = <0xa03e0000 0x10000>; 240 reg = <0xa03e0000 0x10000>;
183 interrupts = <0 23 IRQ_TYPE_LEVEL_HIGH>; 241 interrupts = <0 23 IRQ_TYPE_LEVEL_HIGH>;
184 interrupt-names = "mc"; 242 interrupt-names = "mc";
@@ -210,6 +268,8 @@
210 "iep_6_14", "oep_6_14", 268 "iep_6_14", "oep_6_14",
211 "iep_7_15", "oep_7_15", 269 "iep_7_15", "oep_7_15",
212 "iep_8", "oep_8"; 270 "iep_8", "oep_8";
271
272 clocks = <&prcc_pclk 5 0>;
213 }; 273 };
214 274
215 dma: dma-controller@801C0000 { 275 dma: dma-controller@801C0000 {
@@ -220,6 +280,8 @@
220 280
221 #dma-cells = <3>; 281 #dma-cells = <3>;
222 memcpy-channels = <56 57 58 59 60>; 282 memcpy-channels = <56 57 58 59 60>;
283
284 clocks = <&prcmu_clk PRCMU_DMACLK>;
223 }; 285 };
224 286
225 prcmu: prcmu@80157000 { 287 prcmu: prcmu@80157000 {
@@ -238,6 +300,13 @@
238 reg = <0x80157450 0xC>; 300 reg = <0x80157450 0xC>;
239 }; 301 };
240 302
303 cpufreq {
304 compatible = "stericsson,cpufreq-ux500";
305 clocks = <&prcmu_clk PRCMU_ARMSS>;
306 clock-names = "armss";
307 status = "disabled";
308 };
309
241 thermal@801573c0 { 310 thermal@801573c0 {
242 compatible = "stericsson,db8500-thermal"; 311 compatible = "stericsson,db8500-thermal";
243 reg = <0x801573c0 0x40>; 312 reg = <0x801573c0 0x40>;
@@ -559,65 +628,74 @@
559 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; 628 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
560 reg = <0x80004000 0x1000>; 629 reg = <0x80004000 0x1000>;
561 interrupts = <0 21 IRQ_TYPE_LEVEL_HIGH>; 630 interrupts = <0 21 IRQ_TYPE_LEVEL_HIGH>;
562 arm,primecell-periphid = <0x180024>;
563 631
564 #address-cells = <1>; 632 #address-cells = <1>;
565 #size-cells = <0>; 633 #size-cells = <0>;
566 v-i2c-supply = <&db8500_vape_reg>; 634 v-i2c-supply = <&db8500_vape_reg>;
567 635
568 clock-frequency = <400000>; 636 clock-frequency = <400000>;
637 clocks = <&prcc_kclk 3 3>, <&prcc_pclk 3 3>;
638 clock-names = "i2cclk", "apb_pclk";
569 }; 639 };
570 640
571 i2c@80122000 { 641 i2c@80122000 {
572 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; 642 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
573 reg = <0x80122000 0x1000>; 643 reg = <0x80122000 0x1000>;
574 interrupts = <0 22 IRQ_TYPE_LEVEL_HIGH>; 644 interrupts = <0 22 IRQ_TYPE_LEVEL_HIGH>;
575 arm,primecell-periphid = <0x180024>;
576 645
577 #address-cells = <1>; 646 #address-cells = <1>;
578 #size-cells = <0>; 647 #size-cells = <0>;
579 v-i2c-supply = <&db8500_vape_reg>; 648 v-i2c-supply = <&db8500_vape_reg>;
580 649
581 clock-frequency = <400000>; 650 clock-frequency = <400000>;
651
652 clocks = <&prcc_kclk 1 2>, <&prcc_pclk 1 2>;
653 clock-names = "i2cclk", "apb_pclk";
582 }; 654 };
583 655
584 i2c@80128000 { 656 i2c@80128000 {
585 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; 657 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
586 reg = <0x80128000 0x1000>; 658 reg = <0x80128000 0x1000>;
587 interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>; 659 interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>;
588 arm,primecell-periphid = <0x180024>;
589 660
590 #address-cells = <1>; 661 #address-cells = <1>;
591 #size-cells = <0>; 662 #size-cells = <0>;
592 v-i2c-supply = <&db8500_vape_reg>; 663 v-i2c-supply = <&db8500_vape_reg>;
593 664
594 clock-frequency = <400000>; 665 clock-frequency = <400000>;
666
667 clocks = <&prcc_kclk 1 6>, <&prcc_pclk 1 6>;
668 clock-names = "i2cclk", "apb_pclk";
595 }; 669 };
596 670
597 i2c@80110000 { 671 i2c@80110000 {
598 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; 672 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
599 reg = <0x80110000 0x1000>; 673 reg = <0x80110000 0x1000>;
600 interrupts = <0 12 IRQ_TYPE_LEVEL_HIGH>; 674 interrupts = <0 12 IRQ_TYPE_LEVEL_HIGH>;
601 arm,primecell-periphid = <0x180024>;
602 675
603 #address-cells = <1>; 676 #address-cells = <1>;
604 #size-cells = <0>; 677 #size-cells = <0>;
605 v-i2c-supply = <&db8500_vape_reg>; 678 v-i2c-supply = <&db8500_vape_reg>;
606 679
607 clock-frequency = <400000>; 680 clock-frequency = <400000>;
681
682 clocks = <&prcc_kclk 2 0>, <&prcc_pclk 2 0>;
683 clock-names = "i2cclk", "apb_pclk";
608 }; 684 };
609 685
610 i2c@8012a000 { 686 i2c@8012a000 {
611 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; 687 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
612 reg = <0x8012a000 0x1000>; 688 reg = <0x8012a000 0x1000>;
613 interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH>; 689 interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH>;
614 arm,primecell-periphid = <0x180024>;
615 690
616 #address-cells = <1>; 691 #address-cells = <1>;
617 #size-cells = <0>; 692 #size-cells = <0>;
618 v-i2c-supply = <&db8500_vape_reg>; 693 v-i2c-supply = <&db8500_vape_reg>;
619 694
620 clock-frequency = <400000>; 695 clock-frequency = <400000>;
696
697 clocks = <&prcc_kclk 1 9>, <&prcc_pclk 1 10>;
698 clock-names = "i2cclk", "apb_pclk";
621 }; 699 };
622 700
623 ssp@80002000 { 701 ssp@80002000 {
@@ -626,7 +704,80 @@
626 interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>; 704 interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>;
627 #address-cells = <1>; 705 #address-cells = <1>;
628 #size-cells = <0>; 706 #size-cells = <0>;
629 status = "disabled"; 707 clocks = <&prcc_kclk 3 1>, <&prcc_pclk 3 1>;
708 clock-names = "ssp0clk", "apb_pclk";
709 dmas = <&dma 8 0 0x2>, /* Logical - DevToMem */
710 <&dma 8 0 0x0>; /* Logical - MemToDev */
711 dma-names = "rx", "tx";
712 };
713
714 ssp@80003000 {
715 compatible = "arm,pl022", "arm,primecell";
716 reg = <0x80003000 0x1000>;
717 interrupts = <0 52 IRQ_TYPE_LEVEL_HIGH>;
718 #address-cells = <1>;
719 #size-cells = <0>;
720 clocks = <&prcc_kclk 3 2>, <&prcc_pclk 3 2>;
721 clock-names = "ssp1clk", "apb_pclk";
722 dmas = <&dma 9 0 0x2>, /* Logical - DevToMem */
723 <&dma 9 0 0x0>; /* Logical - MemToDev */
724 dma-names = "rx", "tx";
725 };
726
727 spi@8011a000 {
728 compatible = "arm,pl022", "arm,primecell";
729 reg = <0x8011a000 0x1000>;
730 interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>;
731 #address-cells = <1>;
732 #size-cells = <0>;
733 /* Same clock wired to kernel and pclk */
734 clocks = <&prcc_pclk 2 8>, <&prcc_pclk 2 8>;
735 clock-names = "spi0clk", "apb_pclk";
736 dmas = <&dma 0 0 0x2>, /* Logical - DevToMem */
737 <&dma 0 0 0x0>; /* Logical - MemToDev */
738 dma-names = "rx", "tx";
739 };
740
741 spi@80112000 {
742 compatible = "arm,pl022", "arm,primecell";
743 reg = <0x80112000 0x1000>;
744 interrupts = <0 96 IRQ_TYPE_LEVEL_HIGH>;
745 #address-cells = <1>;
746 #size-cells = <0>;
747 /* Same clock wired to kernel and pclk */
748 clocks = <&prcc_pclk 2 2>, <&prcc_pclk 2 2>;
749 clock-names = "spi1clk", "apb_pclk";
750 dmas = <&dma 35 0 0x2>, /* Logical - DevToMem */
751 <&dma 35 0 0x0>; /* Logical - MemToDev */
752 dma-names = "rx", "tx";
753 };
754
755 spi@80111000 {
756 compatible = "arm,pl022", "arm,primecell";
757 reg = <0x80111000 0x1000>;
758 interrupts = <0 6 IRQ_TYPE_LEVEL_HIGH>;
759 #address-cells = <1>;
760 #size-cells = <0>;
761 /* Same clock wired to kernel and pclk */
762 clocks = <&prcc_pclk 2 1>, <&prcc_pclk 2 1>;
763 clock-names = "spi2clk", "apb_pclk";
764 dmas = <&dma 33 0 0x2>, /* Logical - DevToMem */
765 <&dma 33 0 0x0>; /* Logical - MemToDev */
766 dma-names = "rx", "tx";
767 };
768
769 spi@80129000 {
770 compatible = "arm,pl022", "arm,primecell";
771 reg = <0x80129000 0x1000>;
772 interrupts = <0 49 IRQ_TYPE_LEVEL_HIGH>;
773 #address-cells = <1>;
774 #size-cells = <0>;
775 /* Same clock wired to kernel and pclk */
776 clocks = <&prcc_pclk 1 7>, <&prcc_pclk 1 7>;
777 clock-names = "spi3clk", "apb_pclk";
778 dmas = <&dma 40 0 0x2>, /* Logical - DevToMem */
779 <&dma 40 0 0x0>; /* Logical - MemToDev */
780 dma-names = "rx", "tx";
630 }; 781 };
631 782
632 uart@80120000 { 783 uart@80120000 {
@@ -638,6 +789,9 @@
638 <&dma 13 0 0x0>; /* Logical - MemToDev */ 789 <&dma 13 0 0x0>; /* Logical - MemToDev */
639 dma-names = "rx", "tx"; 790 dma-names = "rx", "tx";
640 791
792 clocks = <&prcc_kclk 1 0>, <&prcc_pclk 1 0>;
793 clock-names = "uart", "apb_pclk";
794
641 status = "disabled"; 795 status = "disabled";
642 }; 796 };
643 797
@@ -650,6 +804,9 @@
650 <&dma 12 0 0x0>; /* Logical - MemToDev */ 804 <&dma 12 0 0x0>; /* Logical - MemToDev */
651 dma-names = "rx", "tx"; 805 dma-names = "rx", "tx";
652 806
807 clocks = <&prcc_kclk 1 1>, <&prcc_pclk 1 1>;
808 clock-names = "uart", "apb_pclk";
809
653 status = "disabled"; 810 status = "disabled";
654 }; 811 };
655 812
@@ -662,6 +819,9 @@
662 <&dma 11 0 0x0>; /* Logical - MemToDev */ 819 <&dma 11 0 0x0>; /* Logical - MemToDev */
663 dma-names = "rx", "tx"; 820 dma-names = "rx", "tx";
664 821
822 clocks = <&prcc_kclk 3 6>, <&prcc_pclk 3 6>;
823 clock-names = "uart", "apb_pclk";
824
665 status = "disabled"; 825 status = "disabled";
666 }; 826 };
667 827
@@ -674,6 +834,9 @@
674 <&dma 29 0 0x0>; /* Logical - MemToDev */ 834 <&dma 29 0 0x0>; /* Logical - MemToDev */
675 dma-names = "rx", "tx"; 835 dma-names = "rx", "tx";
676 836
837 clocks = <&prcc_kclk 1 5>, <&prcc_pclk 1 5>;
838 clock-names = "sdi", "apb_pclk";
839
677 status = "disabled"; 840 status = "disabled";
678 }; 841 };
679 842
@@ -686,6 +849,9 @@
686 <&dma 32 0 0x0>; /* Logical - MemToDev */ 849 <&dma 32 0 0x0>; /* Logical - MemToDev */
687 dma-names = "rx", "tx"; 850 dma-names = "rx", "tx";
688 851
852 clocks = <&prcc_kclk 2 4>, <&prcc_pclk 2 6>;
853 clock-names = "sdi", "apb_pclk";
854
689 status = "disabled"; 855 status = "disabled";
690 }; 856 };
691 857
@@ -698,6 +864,9 @@
698 <&dma 28 0 0x0>; /* Logical - MemToDev */ 864 <&dma 28 0 0x0>; /* Logical - MemToDev */
699 dma-names = "rx", "tx"; 865 dma-names = "rx", "tx";
700 866
867 clocks = <&prcc_kclk 3 4>, <&prcc_pclk 3 4>;
868 clock-names = "sdi", "apb_pclk";
869
701 status = "disabled"; 870 status = "disabled";
702 }; 871 };
703 872
@@ -705,6 +874,10 @@
705 compatible = "arm,pl18x", "arm,primecell"; 874 compatible = "arm,pl18x", "arm,primecell";
706 reg = <0x80119000 0x1000>; 875 reg = <0x80119000 0x1000>;
707 interrupts = <0 59 IRQ_TYPE_LEVEL_HIGH>; 876 interrupts = <0 59 IRQ_TYPE_LEVEL_HIGH>;
877
878 clocks = <&prcc_kclk 2 5>, <&prcc_pclk 2 7>;
879 clock-names = "sdi", "apb_pclk";
880
708 status = "disabled"; 881 status = "disabled";
709 }; 882 };
710 883
@@ -717,6 +890,9 @@
717 <&dma 42 0 0x0>; /* Logical - MemToDev */ 890 <&dma 42 0 0x0>; /* Logical - MemToDev */
718 dma-names = "rx", "tx"; 891 dma-names = "rx", "tx";
719 892
893 clocks = <&prcc_kclk 2 2>, <&prcc_pclk 2 4>;
894 clock-names = "sdi", "apb_pclk";
895
720 status = "disabled"; 896 status = "disabled";
721 }; 897 };
722 898
@@ -724,6 +900,10 @@
724 compatible = "arm,pl18x", "arm,primecell"; 900 compatible = "arm,pl18x", "arm,primecell";
725 reg = <0x80008000 0x1000>; 901 reg = <0x80008000 0x1000>;
726 interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>; 902 interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
903
904 clocks = <&prcc_kclk 3 7>, <&prcc_pclk 3 7>;
905 clock-names = "sdi", "apb_pclk";
906
727 status = "disabled"; 907 status = "disabled";
728 }; 908 };
729 909
@@ -732,6 +912,10 @@
732 reg = <0x80123000 0x1000>; 912 reg = <0x80123000 0x1000>;
733 interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>; 913 interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>;
734 v-ape-supply = <&db8500_vape_reg>; 914 v-ape-supply = <&db8500_vape_reg>;
915
916 clocks = <&prcc_kclk 1 3>, <&prcc_pclk 1 3>;
917 clock-names = "msp", "apb_pclk";
918
735 status = "disabled"; 919 status = "disabled";
736 }; 920 };
737 921
@@ -740,6 +924,10 @@
740 reg = <0x80124000 0x1000>; 924 reg = <0x80124000 0x1000>;
741 interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>; 925 interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>;
742 v-ape-supply = <&db8500_vape_reg>; 926 v-ape-supply = <&db8500_vape_reg>;
927
928 clocks = <&prcc_kclk 1 4>, <&prcc_pclk 1 4>;
929 clock-names = "msp", "apb_pclk";
930
743 status = "disabled"; 931 status = "disabled";
744 }; 932 };
745 933
@@ -749,6 +937,10 @@
749 reg = <0x80117000 0x1000>; 937 reg = <0x80117000 0x1000>;
750 interrupts = <0 98 IRQ_TYPE_LEVEL_HIGH>; 938 interrupts = <0 98 IRQ_TYPE_LEVEL_HIGH>;
751 v-ape-supply = <&db8500_vape_reg>; 939 v-ape-supply = <&db8500_vape_reg>;
940
941 clocks = <&prcc_kclk 2 3>, <&prcc_pclk 2 5>;
942 clock-names = "msp", "apb_pclk";
943
752 status = "disabled"; 944 status = "disabled";
753 }; 945 };
754 946
@@ -757,6 +949,10 @@
757 reg = <0x80125000 0x1000>; 949 reg = <0x80125000 0x1000>;
758 interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>; 950 interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>;
759 v-ape-supply = <&db8500_vape_reg>; 951 v-ape-supply = <&db8500_vape_reg>;
952
953 clocks = <&prcc_kclk 1 10>, <&prcc_pclk 1 11>;
954 clock-names = "msp", "apb_pclk";
955
760 status = "disabled"; 956 status = "disabled";
761 }; 957 };
762 958
@@ -772,7 +968,7 @@
772 cpufreq-cooling { 968 cpufreq-cooling {
773 compatible = "stericsson,db8500-cpufreq-cooling"; 969 compatible = "stericsson,db8500-cpufreq-cooling";
774 status = "disabled"; 970 status = "disabled";
775 }; 971 };
776 972
777 vmmci: regulator-gpio { 973 vmmci: regulator-gpio {
778 compatible = "regulator-gpio"; 974 compatible = "regulator-gpio";
@@ -797,6 +993,7 @@
797 interrupts = <0 15 IRQ_TYPE_LEVEL_HIGH>; 993 interrupts = <0 15 IRQ_TYPE_LEVEL_HIGH>;
798 994
799 v-ape-supply = <&db8500_vape_reg>; 995 v-ape-supply = <&db8500_vape_reg>;
996 clocks = <&prcc_pclk 6 1>;
800 }; 997 };
801 998
802 hash@a03c2000 { 999 hash@a03c2000 {
@@ -804,6 +1001,7 @@
804 reg = <0xa03c2000 0x1000>; 1001 reg = <0xa03c2000 0x1000>;
805 1002
806 v-ape-supply = <&db8500_vape_reg>; 1003 v-ape-supply = <&db8500_vape_reg>;
1004 clocks = <&prcc_pclk 6 2>;
807 }; 1005 };
808 }; 1006 };
809}; 1007};
diff --git a/arch/arm/boot/dts/ste-stuib.dtsi b/arch/arm/boot/dts/ste-href-stuib.dtsi
index 524e33240ad4..76704ec0ffcc 100644
--- a/arch/arm/boot/dts/ste-stuib.dtsi
+++ b/arch/arm/boot/dts/ste-href-stuib.dtsi
@@ -57,7 +57,6 @@
57 bu21013_tp@5c { 57 bu21013_tp@5c {
58 compatible = "rohm,bu21013_tp"; 58 compatible = "rohm,bu21013_tp";
59 reg = <0x5c>; 59 reg = <0x5c>;
60 touch-gpio = <&gpio2 20 0x4>;
61 avdd-supply = <&ab8500_ldo_aux1_reg>; 60 avdd-supply = <&ab8500_ldo_aux1_reg>;
62 61
63 rohm,touch-max-x = <384>; 62 rohm,touch-max-x = <384>;
@@ -68,7 +67,6 @@
68 bu21013_tp@5d { 67 bu21013_tp@5d {
69 compatible = "rohm,bu21013_tp"; 68 compatible = "rohm,bu21013_tp";
70 reg = <0x5d>; 69 reg = <0x5d>;
71 touch-gpio = <&gpio2 20 0x4>;
72 avdd-supply = <&ab8500_ldo_aux1_reg>; 70 avdd-supply = <&ab8500_ldo_aux1_reg>;
73 71
74 rohm,touch-max-x = <384>; 72 rohm,touch-max-x = <384>;
diff --git a/arch/arm/boot/dts/ste-href-tvk1281618.dtsi b/arch/arm/boot/dts/ste-href-tvk1281618.dtsi
new file mode 100644
index 000000000000..76d3ef13175f
--- /dev/null
+++ b/arch/arm/boot/dts/ste-href-tvk1281618.dtsi
@@ -0,0 +1,41 @@
1/*
2 * Copyright 2012 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 * Device Tree for the TVK1281618 UIB
12 */
13
14#include <dt-bindings/interrupt-controller/irq.h>
15
16/ {
17 soc {
18 /* Add Synaptics touch screen, TC35892 keypad etc here */
19 i2c@80004000 {
20 tc3589x@44 {
21 compatible = "tc3589x";
22 reg = <0x44>;
23 interrupt-parent = <&gpio6>;
24 interrupts = <26 IRQ_TYPE_EDGE_RISING>;
25
26 interrupt-controller;
27 #interrupt-cells = <2>;
28
29 tc3589x_gpio {
30 compatible = "tc3589x-gpio";
31 interrupts = <0 IRQ_TYPE_EDGE_RISING>;
32
33 interrupt-controller;
34 #interrupt-cells = <2>;
35 gpio-controller;
36 #gpio-cells = <2>;
37 };
38 };
39 };
40 };
41};
diff --git a/arch/arm/boot/dts/ste-href.dtsi b/arch/arm/boot/dts/ste-href.dtsi
index 370e03f5e7b2..aa3f02060fdd 100644
--- a/arch/arm/boot/dts/ste-href.dtsi
+++ b/arch/arm/boot/dts/ste-href.dtsi
@@ -41,28 +41,6 @@
41 status = "okay"; 41 status = "okay";
42 }; 42 };
43 43
44 i2c@80004000 {
45 tc3589x@42 {
46 compatible = "tc3589x";
47 reg = <0x42>;
48 interrupt-parent = <&gpio6>;
49 interrupts = <25 IRQ_TYPE_EDGE_RISING>;
50
51 interrupt-controller;
52 #interrupt-cells = <2>;
53
54 tc3589x_gpio: tc3589x_gpio {
55 compatible = "tc3589x-gpio";
56 interrupts = <0 IRQ_TYPE_EDGE_RISING>;
57
58 interrupt-controller;
59 #interrupt-cells = <2>;
60 gpio-controller;
61 #gpio-cells = <2>;
62 };
63 };
64 };
65
66 i2c@80128000 { 44 i2c@80128000 {
67 lp5521@33 { 45 lp5521@33 {
68 compatible = "national,lp5521"; 46 compatible = "national,lp5521";
@@ -72,6 +50,7 @@
72 chan0 { 50 chan0 {
73 led-cur = /bits/ 8 <0x2f>; 51 led-cur = /bits/ 8 <0x2f>;
74 max-cur = /bits/ 8 <0x5f>; 52 max-cur = /bits/ 8 <0x5f>;
53 linux,default-trigger = "heartbeat";
75 }; 54 };
76 chan1 { 55 chan1 {
77 led-cur = /bits/ 8 <0x2f>; 56 led-cur = /bits/ 8 <0x2f>;
@@ -102,7 +81,7 @@
102 }; 81 };
103 bh1780@29 { 82 bh1780@29 {
104 compatible = "rohm,bh1780gli"; 83 compatible = "rohm,bh1780gli";
105 reg = <0x33>; 84 reg = <0x29>;
106 }; 85 };
107 }; 86 };
108 87
@@ -167,89 +146,11 @@
167 }; 146 };
168 147
169 prcmu@80157000 { 148 prcmu@80157000 {
170 db8500-prcmu-regulators { 149 ab8500 {
171 db8500_vape_reg: db8500_vape { 150 ab8500-gpio {
172 regulator-name = "db8500-vape"; 151 compatible = "stericsson,ab8500-gpio";
173 };
174
175 db8500_varm_reg: db8500_varm {
176 regulator-name = "db8500-varm";
177 };
178
179 db8500_vmodem_reg: db8500_vmodem {
180 regulator-name = "db8500-vmodem";
181 };
182
183 db8500_vpll_reg: db8500_vpll {
184 regulator-name = "db8500-vpll";
185 };
186
187 db8500_vsmps1_reg: db8500_vsmps1 {
188 regulator-name = "db8500-vsmps1";
189 };
190
191 db8500_vsmps2_reg: db8500_vsmps2 {
192 regulator-name = "db8500-vsmps2";
193 };
194
195 db8500_vsmps3_reg: db8500_vsmps3 {
196 regulator-name = "db8500-vsmps3";
197 };
198
199 db8500_vrf1_reg: db8500_vrf1 {
200 regulator-name = "db8500-vrf1";
201 };
202
203 db8500_sva_mmdsp_reg: db8500_sva_mmdsp {
204 regulator-name = "db8500-sva-mmdsp";
205 };
206
207 db8500_sva_mmdsp_ret_reg: db8500_sva_mmdsp_ret {
208 regulator-name = "db8500-sva-mmdsp-ret";
209 };
210
211 db8500_sva_pipe_reg: db8500_sva_pipe {
212 regulator-name = "db8500_sva_pipe";
213 };
214
215 db8500_sia_mmdsp_reg: db8500_sia_mmdsp {
216 regulator-name = "db8500_sia_mmdsp";
217 };
218
219 db8500_sia_mmdsp_ret_reg: db8500_sia_mmdsp_ret {
220 regulator-name = "db8500-sia-mmdsp-ret";
221 };
222
223 db8500_sia_pipe_reg: db8500_sia_pipe {
224 regulator-name = "db8500-sia-pipe";
225 };
226
227 db8500_sga_reg: db8500_sga {
228 regulator-name = "db8500-sga";
229 };
230
231 db8500_b2r2_mcde_reg: db8500_b2r2_mcde {
232 regulator-name = "db8500-b2r2-mcde";
233 };
234
235 db8500_esram12_reg: db8500_esram12 {
236 regulator-name = "db8500-esram12";
237 };
238
239 db8500_esram12_ret_reg: db8500_esram12_ret {
240 regulator-name = "db8500-esram12-ret";
241 };
242
243 db8500_esram34_reg: db8500_esram34 {
244 regulator-name = "db8500-esram34";
245 }; 152 };
246 153
247 db8500_esram34_ret_reg: db8500_esram34_ret {
248 regulator-name = "db8500-esram34-ret";
249 };
250 };
251
252 ab8500 {
253 ab8500-regulators { 154 ab8500-regulators {
254 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { 155 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
255 regulator-name = "V-DISPLAY"; 156 regulator-name = "V-DISPLAY";
diff --git a/arch/arm/boot/dts/ste-hrefprev60-stuib.dts b/arch/arm/boot/dts/ste-hrefprev60-stuib.dts
new file mode 100644
index 000000000000..2b1cb5b584b6
--- /dev/null
+++ b/arch/arm/boot/dts/ste-hrefprev60-stuib.dts
@@ -0,0 +1,34 @@
1/*
2 * Copyright 2012 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 "ste-hrefprev60.dtsi"
14#include "ste-href-stuib.dtsi"
15
16/ {
17 model = "ST-Ericsson HREF (pre-v60) and ST UIB";
18 compatible = "st-ericsson,mop500", "st-ericsson,u8500";
19
20 soc {
21 /* Reset line for the BU21013 touchscreen */
22 i2c@80110000 {
23 /* Only one of these will be used */
24 bu21013_tp@5c {
25 touch-gpio = <&gpio2 12 0x4>;
26 reset-gpio = <&tc3589x_gpio 13 0x4>;
27 };
28 bu21013_tp@5d {
29 touch-gpio = <&gpio2 12 0x4>;
30 reset-gpio = <&tc3589x_gpio 13 0x4>;
31 };
32 };
33 };
34};
diff --git a/arch/arm/boot/dts/ste-hrefprev60-tvk.dts b/arch/arm/boot/dts/ste-hrefprev60-tvk.dts
new file mode 100644
index 000000000000..59523f866812
--- /dev/null
+++ b/arch/arm/boot/dts/ste-hrefprev60-tvk.dts
@@ -0,0 +1,19 @@
1/*
2 * Copyright 2012 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 "ste-hrefprev60.dtsi"
14#include "ste-href-tvk1281618.dtsi"
15
16/ {
17 model = "ST-Ericsson HREF (pre-v60) and TVK1281618 UIB";
18 compatible = "st-ericsson,mop500", "st-ericsson,u8500";
19};
diff --git a/arch/arm/boot/dts/ste-hrefprev60.dts b/arch/arm/boot/dts/ste-hrefprev60.dtsi
index d8d3b99ab007..b2cd7bc2752f 100644
--- a/arch/arm/boot/dts/ste-hrefprev60.dts
+++ b/arch/arm/boot/dts/ste-hrefprev60.dtsi
@@ -7,17 +7,14 @@
7 * 7 *
8 * http://www.opensource.org/licenses/gpl-license.html 8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html 9 * http://www.gnu.org/copyleft/gpl.html
10 *
11 * Device Tree for the HREF+ prior to the v60 variant.
10 */ 12 */
11 13
12/dts-v1/;
13#include "ste-dbx5x0.dtsi" 14#include "ste-dbx5x0.dtsi"
14#include "ste-href.dtsi" 15#include "ste-href.dtsi"
15#include "ste-stuib.dtsi"
16 16
17/ { 17/ {
18 model = "ST-Ericsson HREF (pre-v60) platform with Device Tree";
19 compatible = "st-ericsson,mop500", "st-ericsson,u8500";
20
21 gpio_keys { 18 gpio_keys {
22 button@1 { 19 button@1 {
23 gpios = <&tc3589x_gpio 7 0x4>; 20 gpios = <&tc3589x_gpio 7 0x4>;
@@ -25,24 +22,30 @@
25 }; 22 };
26 23
27 soc { 24 soc {
28 prcmu@80157000 {
29 ab8500@5 {
30 ab8500-gpio {
31 compatible = "stericsson,ab8500-gpio";
32 };
33 };
34 };
35
36 i2c@80004000 { 25 i2c@80004000 {
37 tps61052@33 { 26 tps61052@33 {
38 compatible = "tps61052"; 27 compatible = "tps61052";
39 reg = <0x33>; 28 reg = <0x33>;
40 }; 29 };
41 };
42 30
43 i2c@80110000 { 31 tc3589x@42 {
44 bu21013_tp@5c { 32 compatible = "tc3589x";
45 reset-gpio = <&tc3589x_gpio 13 0x4>; 33 reg = <0x42>;
34 interrupt-parent = <&gpio6>;
35 interrupts = <25 IRQ_TYPE_EDGE_RISING>;
36
37 interrupt-controller;
38 #interrupt-cells = <2>;
39
40 tc3589x_gpio: tc3589x_gpio {
41 compatible = "tc3589x-gpio";
42 interrupts = <0 IRQ_TYPE_EDGE_RISING>;
43
44 interrupt-controller;
45 #interrupt-cells = <2>;
46 gpio-controller;
47 #gpio-cells = <2>;
48 };
46 }; 49 };
47 }; 50 };
48 51
diff --git a/arch/arm/boot/dts/ste-hrefv60plus-stuib.dts b/arch/arm/boot/dts/ste-hrefv60plus-stuib.dts
new file mode 100644
index 000000000000..8c6a2de56cf1
--- /dev/null
+++ b/arch/arm/boot/dts/ste-hrefv60plus-stuib.dts
@@ -0,0 +1,36 @@
1/*
2 * Copyright 2012 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 * Device Tree for the HREF version 60 or later with the ST UIB
12 */
13
14/dts-v1/;
15#include "ste-hrefv60plus.dtsi"
16#include "ste-href-stuib.dtsi"
17
18/ {
19 model = "ST-Ericsson HREF (v60+) and ST UIB";
20 compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500";
21
22 soc {
23 /* Reset line for the BU21013 touchscreen */
24 i2c@80110000 {
25 /* Only one of these will be used */
26 bu21013_tp@5c {
27 touch-gpio = <&gpio2 20 0x4>;
28 reset-gpio = <&gpio4 17 0x4>;
29 };
30 bu21013_tp@5d {
31 touch-gpio = <&gpio2 20 0x4>;
32 reset-gpio = <&gpio4 17 0x4>;
33 };
34 };
35 };
36};
diff --git a/arch/arm/boot/dts/ste-hrefv60plus-tvk.dts b/arch/arm/boot/dts/ste-hrefv60plus-tvk.dts
new file mode 100644
index 000000000000..d53cccdce776
--- /dev/null
+++ b/arch/arm/boot/dts/ste-hrefv60plus-tvk.dts
@@ -0,0 +1,21 @@
1/*
2 * Copyright 2012 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 * Device Tree for the HREF version 60 or later with the TVK1281618 UIB
12 */
13
14/dts-v1/;
15#include "ste-hrefv60plus.dtsi"
16#include "ste-href-tvk1281618.dtsi"
17
18/ {
19 model = "ST-Ericsson HREF (v60+) and TVK1281618 UIB";
20 compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500";
21};
diff --git a/arch/arm/boot/dts/ste-hrefv60plus.dts b/arch/arm/boot/dts/ste-hrefv60plus.dts
deleted file mode 100644
index 6e52ebbf113f..000000000000
--- a/arch/arm/boot/dts/ste-hrefv60plus.dts
+++ /dev/null
@@ -1,210 +0,0 @@
1/*
2 * Copyright 2012 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 "ste-dbx5x0.dtsi"
14#include "ste-href.dtsi"
15#include "ste-stuib.dtsi"
16
17/ {
18 model = "ST-Ericsson HREF (v60+) platform with Device Tree";
19 compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500";
20
21 gpio_keys {
22 button@1 {
23 gpios = <&gpio6 25 0x4>;
24 };
25 };
26
27 soc {
28 i2c@80110000 {
29 bu21013_tp@0x5c {
30 reset-gpio = <&gpio4 15 0x4>;
31 };
32 };
33
34 // External Micro SD slot
35 sdi0_per1@80126000 {
36 arm,primecell-periphid = <0x10480180>;
37 max-frequency = <100000000>;
38 bus-width = <4>;
39 mmc-cap-sd-highspeed;
40 mmc-cap-mmc-highspeed;
41 vmmc-supply = <&ab8500_ldo_aux3_reg>;
42
43 cd-gpios = <&tc3589x_gpio 3 0x4>;
44
45 status = "okay";
46 };
47
48 // WLAN SDIO channel
49 sdi1_per2@80118000 {
50 arm,primecell-periphid = <0x10480180>;
51 max-frequency = <100000000>;
52 bus-width = <4>;
53
54 status = "okay";
55 };
56
57 // PoP:ed eMMC
58 sdi2_per3@80005000 {
59 arm,primecell-periphid = <0x10480180>;
60 max-frequency = <100000000>;
61 bus-width = <8>;
62 mmc-cap-mmc-highspeed;
63
64 status = "okay";
65 };
66
67 // On-board eMMC
68 sdi4_per2@80114000 {
69 arm,primecell-periphid = <0x10480180>;
70 max-frequency = <100000000>;
71 bus-width = <8>;
72 mmc-cap-mmc-highspeed;
73 vmmc-supply = <&ab8500_ldo_aux2_reg>;
74
75 status = "okay";
76 };
77
78 prcmu@80157000 {
79 db8500-prcmu-regulators {
80 db8500_vape_reg: db8500_vape {
81 regulator-name = "db8500-vape";
82 };
83
84 db8500_varm_reg: db8500_varm {
85 regulator-name = "db8500-varm";
86 };
87
88 db8500_vmodem_reg: db8500_vmodem {
89 regulator-name = "db8500-vmodem";
90 };
91
92 db8500_vpll_reg: db8500_vpll {
93 regulator-name = "db8500-vpll";
94 };
95
96 db8500_vsmps1_reg: db8500_vsmps1 {
97 regulator-name = "db8500-vsmps1";
98 };
99
100 db8500_vsmps2_reg: db8500_vsmps2 {
101 regulator-name = "db8500-vsmps2";
102 };
103
104 db8500_vsmps3_reg: db8500_vsmps3 {
105 regulator-name = "db8500-vsmps3";
106 };
107
108 db8500_vrf1_reg: db8500_vrf1 {
109 regulator-name = "db8500-vrf1";
110 };
111
112 db8500_sva_mmdsp_reg: db8500_sva_mmdsp {
113 regulator-name = "db8500-sva-mmdsp";
114 };
115
116 db8500_sva_mmdsp_ret_reg: db8500_sva_mmdsp_ret {
117 regulator-name = "db8500-sva-mmdsp-ret";
118 };
119
120 db8500_sva_pipe_reg: db8500_sva_pipe {
121 regulator-name = "db8500_sva_pipe";
122 };
123
124 db8500_sia_mmdsp_reg: db8500_sia_mmdsp {
125 regulator-name = "db8500_sia_mmdsp";
126 };
127
128 db8500_sia_mmdsp_ret_reg: db8500_sia_mmdsp_ret {
129 regulator-name = "db8500-sia-mmdsp-ret";
130 };
131
132 db8500_sia_pipe_reg: db8500_sia_pipe {
133 regulator-name = "db8500-sia-pipe";
134 };
135
136 db8500_sga_reg: db8500_sga {
137 regulator-name = "db8500-sga";
138 };
139
140 db8500_b2r2_mcde_reg: db8500_b2r2_mcde {
141 regulator-name = "db8500-b2r2-mcde";
142 };
143
144 db8500_esram12_reg: db8500_esram12 {
145 regulator-name = "db8500-esram12";
146 };
147
148 db8500_esram12_ret_reg: db8500_esram12_ret {
149 regulator-name = "db8500-esram12-ret";
150 };
151
152 db8500_esram34_reg: db8500_esram34 {
153 regulator-name = "db8500-esram34";
154 };
155
156 db8500_esram34_ret_reg: db8500_esram34_ret {
157 regulator-name = "db8500-esram34-ret";
158 };
159 };
160
161 ab8500 {
162 ab8500-regulators {
163 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
164 regulator-name = "V-DISPLAY";
165 };
166
167 ab8500_ldo_aux2_reg: ab8500_ldo_aux2 {
168 regulator-name = "V-eMMC1";
169 };
170
171 ab8500_ldo_aux3_reg: ab8500_ldo_aux3 {
172 regulator-name = "V-MMC-SD";
173 };
174
175 ab8500_ldo_intcore_reg: ab8500_ldo_intcore {
176 regulator-name = "V-INTCORE";
177 };
178
179 ab8500_ldo_tvout_reg: ab8500_ldo_tvout {
180 regulator-name = "V-TVOUT";
181 };
182
183 ab8500_ldo_usb_reg: ab8500_ldo_usb {
184 regulator-name = "dummy";
185 };
186
187 ab8500_ldo_audio_reg: ab8500_ldo_audio {
188 regulator-name = "V-AUD";
189 };
190
191 ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 {
192 regulator-name = "V-AMIC1";
193 };
194
195 ab8500_ldo_anamic2_reg: ab8500_ldo_anamic2 {
196 regulator-name = "V-AMIC2";
197 };
198
199 ab8500_ldo_dmic_reg: ab8500_ldo_dmic {
200 regulator-name = "V-DMIC";
201 };
202
203 ab8500_ldo_ana_reg: ab8500_ldo_ana {
204 regulator-name = "V-CSI/DSI";
205 };
206 };
207 };
208 };
209 };
210};
diff --git a/arch/arm/boot/dts/ste-hrefv60plus.dtsi b/arch/arm/boot/dts/ste-hrefv60plus.dtsi
new file mode 100644
index 000000000000..aed511b47a9e
--- /dev/null
+++ b/arch/arm/boot/dts/ste-hrefv60plus.dtsi
@@ -0,0 +1,70 @@
1/*
2 * Copyright 2012 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#include "ste-dbx5x0.dtsi"
13#include "ste-href.dtsi"
14
15/ {
16 model = "ST-Ericsson HREF (v60+) platform with Device Tree";
17 compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500";
18
19 gpio_keys {
20 button@1 {
21 gpios = <&gpio5 25 0x4>;
22 };
23 };
24
25 soc {
26 // External Micro SD slot
27 sdi0_per1@80126000 {
28 arm,primecell-periphid = <0x10480180>;
29 max-frequency = <100000000>;
30 bus-width = <4>;
31 mmc-cap-sd-highspeed;
32 mmc-cap-mmc-highspeed;
33 vmmc-supply = <&ab8500_ldo_aux3_reg>;
34
35 cd-gpios = <&gpio2 31 0x4>; // 95
36
37 status = "okay";
38 };
39
40 // WLAN SDIO channel
41 sdi1_per2@80118000 {
42 arm,primecell-periphid = <0x10480180>;
43 max-frequency = <100000000>;
44 bus-width = <4>;
45
46 status = "okay";
47 };
48
49 // PoP:ed eMMC
50 sdi2_per3@80005000 {
51 arm,primecell-periphid = <0x10480180>;
52 max-frequency = <100000000>;
53 bus-width = <8>;
54 mmc-cap-mmc-highspeed;
55
56 status = "okay";
57 };
58
59 // On-board eMMC
60 sdi4_per2@80114000 {
61 arm,primecell-periphid = <0x10480180>;
62 max-frequency = <100000000>;
63 bus-width = <8>;
64 mmc-cap-mmc-highspeed;
65 vmmc-supply = <&ab8500_ldo_aux2_reg>;
66
67 status = "okay";
68 };
69 };
70};
diff --git a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
index 9169d3025f39..79425e3836ce 100644
--- a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
+++ b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
@@ -653,6 +653,7 @@
653 reg-names = "fsmc_regs", "nand_data", "nand_addr", "nand_cmd"; 653 reg-names = "fsmc_regs", "nand_data", "nand_addr", "nand_cmd";
654 clocks = <&hclksmc>; 654 clocks = <&hclksmc>;
655 status = "okay"; 655 status = "okay";
656 timings = /bits/ 8 <0 0 0 0x10 0x0a 0>;
656 657
657 partition@0 { 658 partition@0 {
658 label = "X-Loader(NAND)"; 659 label = "X-Loader(NAND)";
@@ -707,8 +708,14 @@
707 pinctrl-0 = <&i2c0_default_mux>, <&i2c0_default_mode>; 708 pinctrl-0 = <&i2c0_default_mux>, <&i2c0_default_mode>;
708 709
709 stw4811@2d { 710 stw4811@2d {
710 compatible = "st,stw4811"; 711 compatible = "st,stw4811";
711 reg = <0x2d>; 712 reg = <0x2d>;
713 vmmc_regulator: vmmc {
714 compatible = "st,stw481x-vmmc";
715 regulator-name = "VMMC";
716 regulator-min-microvolt = <1800000>;
717 regulator-max-microvolt = <3300000>;
718 };
712 }; 719 };
713 }; 720 };
714 721
@@ -839,6 +846,7 @@
839 cd-inverted; 846 cd-inverted;
840 pinctrl-names = "default"; 847 pinctrl-names = "default";
841 pinctrl-0 = <&mmcsd_default_mux>, <&mmcsd_default_mode>; 848 pinctrl-0 = <&mmcsd_default_mux>, <&mmcsd_default_mode>;
849 vmmc-supply = <&vmmc_regulator>;
842 }; 850 };
843 }; 851 };
844}; 852};
diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index f1fc128e249d..f0b39f835914 100644
--- a/arch/arm/boot/dts/ste-snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -111,12 +111,13 @@
111 vdd33a-supply = <&en_3v3_reg>; 111 vdd33a-supply = <&en_3v3_reg>;
112 vddvario-supply = <&db8500_vape_reg>; 112 vddvario-supply = <&db8500_vape_reg>;
113 113
114
115 reg-shift = <1>; 114 reg-shift = <1>;
116 reg-io-width = <2>; 115 reg-io-width = <2>;
117 smsc,force-internal-phy; 116 smsc,force-internal-phy;
118 smsc,irq-active-high; 117 smsc,irq-active-high;
119 smsc,irq-push-pull; 118 smsc,irq-push-pull;
119
120 clocks = <&prcc_pclk 3 0>;
120 }; 121 };
121 }; 122 };
122 123
@@ -170,86 +171,8 @@
170 }; 171 };
171 172
172 prcmu@80157000 { 173 prcmu@80157000 {
173 db8500-prcmu-regulators { 174 cpufreq {
174 db8500_vape_reg: db8500_vape { 175 status = "okay";
175 regulator-name = "db8500-vape";
176 };
177
178 db8500_varm_reg: db8500_varm {
179 regulator-name = "db8500-varm";
180 };
181
182 db8500_vmodem_reg: db8500_vmodem {
183 regulator-name = "db8500-vmodem";
184 };
185
186 db8500_vpll_reg: db8500_vpll {
187 regulator-name = "db8500-vpll";
188 };
189
190 db8500_vsmps1_reg: db8500_vsmps1 {
191 regulator-name = "db8500-vsmps1";
192 };
193
194 db8500_vsmps2_reg: db8500_vsmps2 {
195 regulator-name = "db8500-vsmps2";
196 };
197
198 db8500_vsmps3_reg: db8500_vsmps3 {
199 regulator-name = "db8500-vsmps3";
200 };
201
202 db8500_vrf1_reg: db8500_vrf1 {
203 regulator-name = "db8500-vrf1";
204 };
205
206 db8500_sva_mmdsp_reg: db8500_sva_mmdsp {
207 regulator-name = "db8500-sva-mmdsp";
208 };
209
210 db8500_sva_mmdsp_ret_reg: db8500_sva_mmdsp_ret {
211 regulator-name = "db8500-sva-mmdsp-ret";
212 };
213
214 db8500_sva_pipe_reg: db8500_sva_pipe {
215 regulator-name = "db8500_sva_pipe";
216 };
217
218 db8500_sia_mmdsp_reg: db8500_sia_mmdsp {
219 regulator-name = "db8500_sia_mmdsp";
220 };
221
222 db8500_sia_mmdsp_ret_reg: db8500_sia_mmdsp_ret {
223 regulator-name = "db8500-sia-mmdsp-ret";
224 };
225
226 db8500_sia_pipe_reg: db8500_sia_pipe {
227 regulator-name = "db8500-sia-pipe";
228 };
229
230 db8500_sga_reg: db8500_sga {
231 regulator-name = "db8500-sga";
232 };
233
234 db8500_b2r2_mcde_reg: db8500_b2r2_mcde {
235 regulator-name = "db8500-b2r2-mcde";
236 };
237
238 db8500_esram12_reg: db8500_esram12 {
239 regulator-name = "db8500-esram12";
240 };
241
242 db8500_esram12_ret_reg: db8500_esram12_ret {
243 regulator-name = "db8500-esram12-ret";
244 };
245
246 db8500_esram34_reg: db8500_esram34 {
247 regulator-name = "db8500-esram34";
248 };
249
250 db8500_esram34_ret_reg: db8500_esram34_ret {
251 regulator-name = "db8500-esram34-ret";
252 };
253 }; 176 };
254 177
255 thermal@801573c0 { 178 thermal@801573c0 {
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index c32770a28acf..319cc6b509da 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -266,6 +266,11 @@
266 reg = <0x01c20c90 0x10>; 266 reg = <0x01c20c90 0x10>;
267 }; 267 };
268 268
269 sid: eeprom@01c23800 {
270 compatible = "allwinner,sun4i-sid";
271 reg = <0x01c23800 0x10>;
272 };
273
269 uart0: serial@01c28000 { 274 uart0: serial@01c28000 {
270 compatible = "snps,dw-apb-uart"; 275 compatible = "snps,dw-apb-uart";
271 reg = <0x01c28000 0x400>; 276 reg = <0x01c28000 0x400>;
diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
index 3b4a0574f068..52476742a104 100644
--- a/arch/arm/boot/dts/sun5i-a10s.dtsi
+++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
@@ -255,6 +255,11 @@
255 reg = <0x01c20c90 0x10>; 255 reg = <0x01c20c90 0x10>;
256 }; 256 };
257 257
258 sid: eeprom@01c23800 {
259 compatible = "allwinner,sun4i-sid";
260 reg = <0x01c23800 0x10>;
261 };
262
258 uart0: serial@01c28000 { 263 uart0: serial@01c28000 {
259 compatible = "snps,dw-apb-uart"; 264 compatible = "snps,dw-apb-uart";
260 reg = <0x01c28000 0x400>; 265 reg = <0x01c28000 0x400>;
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
index f6091dc0936c..ce8ef2a45be0 100644
--- a/arch/arm/boot/dts/sun5i-a13.dtsi
+++ b/arch/arm/boot/dts/sun5i-a13.dtsi
@@ -222,6 +222,11 @@
222 reg = <0x01c20c90 0x10>; 222 reg = <0x01c20c90 0x10>;
223 }; 223 };
224 224
225 sid: eeprom@01c23800 {
226 compatible = "allwinner,sun4i-sid";
227 reg = <0x01c23800 0x10>;
228 };
229
225 uart1: serial@01c28400 { 230 uart1: serial@01c28400 {
226 compatible = "snps,dw-apb-uart"; 231 compatible = "snps,dw-apb-uart";
227 reg = <0x01c28400 0x400>; 232 reg = <0x01c28400 0x400>;
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi
index f244f5f02365..c1751a64889a 100644
--- a/arch/arm/boot/dts/sun6i-a31.dtsi
+++ b/arch/arm/boot/dts/sun6i-a31.dtsi
@@ -175,7 +175,7 @@
175 apb2_gates: apb2_gates@01c2006c { 175 apb2_gates: apb2_gates@01c2006c {
176 #clock-cells = <1>; 176 #clock-cells = <1>;
177 compatible = "allwinner,sun6i-a31-apb2-gates-clk"; 177 compatible = "allwinner,sun6i-a31-apb2-gates-clk";
178 reg = <0x01c2006c 0x8>; 178 reg = <0x01c2006c 0x4>;
179 clocks = <&apb2>; 179 clocks = <&apb2>;
180 clock-output-names = "apb2_i2c0", "apb2_i2c1", 180 clock-output-names = "apb2_i2c0", "apb2_i2c1",
181 "apb2_i2c2", "apb2_i2c3", "apb2_uart0", 181 "apb2_i2c2", "apb2_i2c3", "apb2_uart0",
diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
index 15e625eca312..5c51cb8a98b0 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
@@ -48,6 +48,18 @@
48 pinctrl-0 = <&uart0_pins_a>; 48 pinctrl-0 = <&uart0_pins_a>;
49 status = "okay"; 49 status = "okay";
50 }; 50 };
51
52 i2c0: i2c@01c2ac00 {
53 pinctrl-names = "default";
54 pinctrl-0 = <&i2c0_pins_a>;
55 status = "okay";
56 };
57
58 i2c1: i2c@01c2b000 {
59 pinctrl-names = "default";
60 pinctrl-0 = <&i2c1_pins_a>;
61 status = "okay";
62 };
51 }; 63 };
52 64
53 leds { 65 leds {
diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
new file mode 100644
index 000000000000..8a1009d6c829
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
@@ -0,0 +1,63 @@
1/*
2 * Copyright 2013 Oliver Schinagl
3 *
4 * Oliver Schinagl <oliver@schinagl.nl>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/dts-v1/;
15/include/ "sun7i-a20.dtsi"
16
17/ {
18 model = "Cubietech Cubietruck";
19 compatible = "cubietech,cubietruck", "allwinner,sun7i-a20";
20
21 soc@01c00000 {
22 pinctrl@01c20800 {
23 led_pins_cubietruck: led_pins@0 {
24 allwinner,pins = "PH7", "PH11", "PH20", "PH21";
25 allwinner,function = "gpio_out";
26 allwinner,drive = <0>;
27 allwinner,pull = <0>;
28 };
29 };
30
31 uart0: serial@01c28000 {
32 pinctrl-names = "default";
33 pinctrl-0 = <&uart0_pins_a>;
34 status = "okay";
35 };
36 };
37
38 leds {
39 compatible = "gpio-leds";
40 pinctrl-names = "default";
41 pinctrl-0 = <&led_pins_cubietruck>;
42
43 blue {
44 label = "cubietruck:blue:usr";
45 gpios = <&pio 7 21 0>;
46 };
47
48 orange {
49 label = "cubietruck:orange:usr";
50 gpios = <&pio 7 20 0>;
51 };
52
53 white {
54 label = "cubietruck:white:usr";
55 gpios = <&pio 7 11 0>;
56 };
57
58 green {
59 label = "cubietruck:green:usr";
60 gpios = <&pio 7 7 0>;
61 };
62 };
63};
diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
index 9e778557fadb..ead3013f9aca 100644
--- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
@@ -60,6 +60,24 @@
60 pinctrl-0 = <&uart7_pins_a>; 60 pinctrl-0 = <&uart7_pins_a>;
61 status = "okay"; 61 status = "okay";
62 }; 62 };
63
64 i2c0: i2c@01c2ac00 {
65 pinctrl-names = "default";
66 pinctrl-0 = <&i2c0_pins_a>;
67 status = "okay";
68 };
69
70 i2c1: i2c@01c2b000 {
71 pinctrl-names = "default";
72 pinctrl-0 = <&i2c1_pins_a>;
73 status = "okay";
74 };
75
76 i2c2: i2c@01c2b400 {
77 pinctrl-names = "default";
78 pinctrl-0 = <&i2c2_pins_a>;
79 status = "okay";
80 };
63 }; 81 };
64 82
65 leds { 83 leds {
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 80559cbdbc87..e46cfedde74c 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -215,6 +215,27 @@
215 allwinner,pull = <0>; 215 allwinner,pull = <0>;
216 }; 216 };
217 217
218 i2c0_pins_a: i2c0@0 {
219 allwinner,pins = "PB0", "PB1";
220 allwinner,function = "i2c0";
221 allwinner,drive = <0>;
222 allwinner,pull = <0>;
223 };
224
225 i2c1_pins_a: i2c1@0 {
226 allwinner,pins = "PB18", "PB19";
227 allwinner,function = "i2c1";
228 allwinner,drive = <0>;
229 allwinner,pull = <0>;
230 };
231
232 i2c2_pins_a: i2c2@0 {
233 allwinner,pins = "PB20", "PB21";
234 allwinner,function = "i2c2";
235 allwinner,drive = <0>;
236 allwinner,pull = <0>;
237 };
238
218 emac_pins_a: emac0@0 { 239 emac_pins_a: emac0@0 {
219 allwinner,pins = "PA0", "PA1", "PA2", 240 allwinner,pins = "PA0", "PA1", "PA2",
220 "PA3", "PA4", "PA5", "PA6", 241 "PA3", "PA4", "PA5", "PA6",
@@ -244,6 +265,11 @@
244 reg = <0x01c20c90 0x10>; 265 reg = <0x01c20c90 0x10>;
245 }; 266 };
246 267
268 sid: eeprom@01c23800 {
269 compatible = "allwinner,sun7i-a20-sid";
270 reg = <0x01c23800 0x200>;
271 };
272
247 uart0: serial@01c28000 { 273 uart0: serial@01c28000 {
248 compatible = "snps,dw-apb-uart"; 274 compatible = "snps,dw-apb-uart";
249 reg = <0x01c28000 0x400>; 275 reg = <0x01c28000 0x400>;
@@ -324,6 +350,51 @@
324 status = "disabled"; 350 status = "disabled";
325 }; 351 };
326 352
353 i2c0: i2c@01c2ac00 {
354 compatible = "allwinner,sun4i-i2c";
355 reg = <0x01c2ac00 0x400>;
356 interrupts = <0 7 1>;
357 clocks = <&apb1_gates 0>;
358 clock-frequency = <100000>;
359 status = "disabled";
360 };
361
362 i2c1: i2c@01c2b000 {
363 compatible = "allwinner,sun4i-i2c";
364 reg = <0x01c2b000 0x400>;
365 interrupts = <0 8 1>;
366 clocks = <&apb1_gates 1>;
367 clock-frequency = <100000>;
368 status = "disabled";
369 };
370
371 i2c2: i2c@01c2b400 {
372 compatible = "allwinner,sun4i-i2c";
373 reg = <0x01c2b400 0x400>;
374 interrupts = <0 9 1>;
375 clocks = <&apb1_gates 2>;
376 clock-frequency = <100000>;
377 status = "disabled";
378 };
379
380 i2c3: i2c@01c2b800 {
381 compatible = "allwinner,sun4i-i2c";
382 reg = <0x01c2b800 0x400>;
383 interrupts = <0 88 1>;
384 clocks = <&apb1_gates 3>;
385 clock-frequency = <100000>;
386 status = "disabled";
387 };
388
389 i2c4: i2c@01c2bc00 {
390 compatible = "allwinner,sun4i-i2c";
391 reg = <0x01c2bc00 0x400>;
392 interrupts = <0 89 1>;
393 clocks = <&apb1_gates 15>;
394 clock-frequency = <100000>;
395 status = "disabled";
396 };
397
327 gic: interrupt-controller@01c81000 { 398 gic: interrupt-controller@01c81000 {
328 compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic"; 399 compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
329 reg = <0x01c81000 0x1000>, 400 reg = <0x01c81000 0x1000>,
diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts b/arch/arm/boot/dts/tegra114-dalmore.dts
index 60230288884b..cb5ec23b03a7 100644
--- a/arch/arm/boot/dts/tegra114-dalmore.dts
+++ b/arch/arm/boot/dts/tegra114-dalmore.dts
@@ -1,5 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3#include <dt-bindings/input/input.h>
3#include "tegra114.dtsi" 4#include "tegra114.dtsi"
4 5
5/ { 6/ {
@@ -738,6 +739,14 @@
738 realtek,ldo1-en-gpios = 739 realtek,ldo1-en-gpios =
739 <&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_HIGH>; 740 <&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_HIGH>;
740 }; 741 };
742
743 temperature-sensor@4c {
744 compatible = "onnn,nct1008";
745 reg = <0x4c>;
746 vcc-supply = <&palmas_ldo6_reg>;
747 interrupt-parent = <&gpio>;
748 interrupts = <TEGRA_GPIO(O, 4) IRQ_TYPE_LEVEL_LOW>;
749 };
741 }; 750 };
742 751
743 i2c@7000d000 { 752 i2c@7000d000 {
@@ -947,7 +956,7 @@
947 regulator-max-microvolt = <1800000>; 956 regulator-max-microvolt = <1800000>;
948 }; 957 };
949 958
950 ldo6 { 959 palmas_ldo6_reg: ldo6 {
951 regulator-name = "vdd-sensor-2v85"; 960 regulator-name = "vdd-sensor-2v85";
952 regulator-min-microvolt = <2850000>; 961 regulator-min-microvolt = <2850000>;
953 regulator-max-microvolt = <2850000>; 962 regulator-max-microvolt = <2850000>;
@@ -1011,6 +1020,19 @@
1011 interrupt-parent = <&palmas>; 1020 interrupt-parent = <&palmas>;
1012 interrupts = <8 0>; 1021 interrupts = <8 0>;
1013 }; 1022 };
1023
1024 pinmux {
1025 compatible = "ti,tps65913-pinctrl";
1026 pinctrl-names = "default";
1027 pinctrl-0 = <&palmas_default>;
1028
1029 palmas_default: pinmux {
1030 pin_gpio6 {
1031 pins = "gpio6";
1032 function = "gpio";
1033 };
1034 };
1035 };
1014 }; 1036 };
1015 }; 1037 };
1016 1038
@@ -1081,26 +1103,26 @@
1081 home { 1103 home {
1082 label = "Home"; 1104 label = "Home";
1083 gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>; 1105 gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
1084 linux,code = <102>; /* KEY_HOME */ 1106 linux,code = <KEY_HOME>;
1085 }; 1107 };
1086 1108
1087 power { 1109 power {
1088 label = "Power"; 1110 label = "Power";
1089 gpios = <&gpio TEGRA_GPIO(Q, 0) GPIO_ACTIVE_LOW>; 1111 gpios = <&gpio TEGRA_GPIO(Q, 0) GPIO_ACTIVE_LOW>;
1090 linux,code = <116>; /* KEY_POWER */ 1112 linux,code = <KEY_POWER>;
1091 gpio-key,wakeup; 1113 gpio-key,wakeup;
1092 }; 1114 };
1093 1115
1094 volume_down { 1116 volume_down {
1095 label = "Volume Down"; 1117 label = "Volume Down";
1096 gpios = <&gpio TEGRA_GPIO(R, 1) GPIO_ACTIVE_LOW>; 1118 gpios = <&gpio TEGRA_GPIO(R, 1) GPIO_ACTIVE_LOW>;
1097 linux,code = <114>; /* KEY_VOLUMEDOWN */ 1119 linux,code = <KEY_VOLUMEDOWN>;
1098 }; 1120 };
1099 1121
1100 volume_up { 1122 volume_up {
1101 label = "Volume Up"; 1123 label = "Volume Up";
1102 gpios = <&gpio TEGRA_GPIO(R, 2) GPIO_ACTIVE_LOW>; 1124 gpios = <&gpio TEGRA_GPIO(R, 2) GPIO_ACTIVE_LOW>;
1103 linux,code = <115>; /* KEY_VOLUMEUP */ 1125 linux,code = <KEY_VOLUMEUP>;
1104 }; 1126 };
1105 }; 1127 };
1106 1128
diff --git a/arch/arm/boot/dts/tegra114.dtsi b/arch/arm/boot/dts/tegra114.dtsi
index 2905145d8e59..8d42787c8ff1 100644
--- a/arch/arm/boot/dts/tegra114.dtsi
+++ b/arch/arm/boot/dts/tegra114.dtsi
@@ -318,9 +318,9 @@
318 318
319 iommu { 319 iommu {
320 compatible = "nvidia,tegra114-smmu", "nvidia,tegra30-smmu"; 320 compatible = "nvidia,tegra114-smmu", "nvidia,tegra30-smmu";
321 reg = <0x7000f010 0x02c 321 reg = <0x70019010 0x02c
322 0x7000f1f0 0x010 322 0x700191f0 0x010
323 0x7000f228 0x074>; 323 0x70019228 0x074>;
324 nvidia,#asids = <4>; 324 nvidia,#asids = <4>;
325 dma-window = <0 0x40000000>; 325 dma-window = <0 0x40000000>;
326 nvidia,swgroups = <0x18659fe>; 326 nvidia,swgroups = <0x18659fe>;
diff --git a/arch/arm/boot/dts/tegra124-venice2.dts b/arch/arm/boot/dts/tegra124-venice2.dts
new file mode 100644
index 000000000000..431d67a2b413
--- /dev/null
+++ b/arch/arm/boot/dts/tegra124-venice2.dts
@@ -0,0 +1,27 @@
1/dts-v1/;
2
3#include "tegra124.dtsi"
4
5/ {
6 model = "NVIDIA Tegra124 Venice2";
7 compatible = "nvidia,venice2", "nvidia,tegra124";
8
9 memory {
10 reg = <0x80000000 0x80000000>;
11 };
12
13 serial@70006000 {
14 status = "okay";
15 };
16
17 pmc@7000e400 {
18 nvidia,invert-interrupt;
19 nvidia,suspend-mode = <1>;
20 nvidia,cpu-pwr-good-time = <500>;
21 nvidia,cpu-pwr-off-time = <300>;
22 nvidia,core-pwr-good-time = <641 3845>;
23 nvidia,core-pwr-off-time = <61036>;
24 nvidia,core-power-req-active-high;
25 nvidia,sys-clock-req-active-high;
26 };
27};
diff --git a/arch/arm/boot/dts/tegra124.dtsi b/arch/arm/boot/dts/tegra124.dtsi
new file mode 100644
index 000000000000..b7413004ee77
--- /dev/null
+++ b/arch/arm/boot/dts/tegra124.dtsi
@@ -0,0 +1,149 @@
1#include <dt-bindings/gpio/tegra-gpio.h>
2#include <dt-bindings/interrupt-controller/arm-gic.h>
3
4#include "skeleton.dtsi"
5
6/ {
7 compatible = "nvidia,tegra124";
8 interrupt-parent = <&gic>;
9
10 gic: interrupt-controller@50041000 {
11 compatible = "arm,cortex-a15-gic";
12 #interrupt-cells = <3>;
13 interrupt-controller;
14 reg = <0x50041000 0x1000>,
15 <0x50042000 0x1000>,
16 <0x50044000 0x2000>,
17 <0x50046000 0x2000>;
18 interrupts = <GIC_PPI 9
19 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
20 };
21
22 timer@60005000 {
23 compatible = "nvidia,tegra124-timer", "nvidia,tegra20-timer";
24 reg = <0x60005000 0x400>;
25 interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
26 <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
27 <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>,
28 <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>,
29 <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
30 <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>;
31 };
32
33 gpio: gpio@6000d000 {
34 compatible = "nvidia,tegra124-gpio", "nvidia,tegra30-gpio";
35 reg = <0x6000d000 0x1000>;
36 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
37 <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
38 <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
39 <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>,
40 <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>,
41 <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>,
42 <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>,
43 <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>;
44 #gpio-cells = <2>;
45 gpio-controller;
46 #interrupt-cells = <2>;
47 interrupt-controller;
48 };
49
50 /*
51 * There are two serial driver i.e. 8250 based simple serial
52 * driver and APB DMA based serial driver for higher baudrate
53 * and performace. To enable the 8250 based driver, the compatible
54 * is "nvidia,tegra124-uart", "nvidia,tegra20-uart" and to enable
55 * the APB DMA based serial driver, the comptible is
56 * "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart".
57 */
58 serial@70006000 {
59 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart";
60 reg = <0x70006000 0x40>;
61 reg-shift = <2>;
62 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
63 status = "disabled";
64 };
65
66 serial@70006040 {
67 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart";
68 reg = <0x70006040 0x40>;
69 reg-shift = <2>;
70 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
71 status = "disabled";
72 };
73
74 serial@70006200 {
75 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart";
76 reg = <0x70006200 0x40>;
77 reg-shift = <2>;
78 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
79 status = "disabled";
80 };
81
82 serial@70006300 {
83 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart";
84 reg = <0x70006300 0x40>;
85 reg-shift = <2>;
86 interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
87 status = "disabled";
88 };
89
90 serial@70006400 {
91 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart";
92 reg = <0x70006400 0x40>;
93 reg-shift = <2>;
94 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
95 status = "disabled";
96 };
97
98 rtc@7000e000 {
99 compatible = "nvidia,tegra124-rtc", "nvidia,tegra20-rtc";
100 reg = <0x7000e000 0x100>;
101 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
102 };
103
104 pmc@7000e400 {
105 compatible = "nvidia,tegra124-pmc";
106 reg = <0x7000e400 0x400>;
107 };
108
109 cpus {
110 #address-cells = <1>;
111 #size-cells = <0>;
112
113 cpu@0 {
114 device_type = "cpu";
115 compatible = "arm,cortex-a15";
116 reg = <0>;
117 };
118
119 cpu@1 {
120 device_type = "cpu";
121 compatible = "arm,cortex-a15";
122 reg = <1>;
123 };
124
125 cpu@2 {
126 device_type = "cpu";
127 compatible = "arm,cortex-a15";
128 reg = <2>;
129 };
130
131 cpu@3 {
132 device_type = "cpu";
133 compatible = "arm,cortex-a15";
134 reg = <3>;
135 };
136 };
137
138 timer {
139 compatible = "arm,armv7-timer";
140 interrupts = <GIC_PPI 13
141 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
142 <GIC_PPI 14
143 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
144 <GIC_PPI 11
145 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
146 <GIC_PPI 10
147 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
148 };
149};
diff --git a/arch/arm/boot/dts/tegra30-cardhu.dtsi b/arch/arm/boot/dts/tegra30-cardhu.dtsi
index e19dbf238e5c..5ea7dfa4d9fa 100644
--- a/arch/arm/boot/dts/tegra30-cardhu.dtsi
+++ b/arch/arm/boot/dts/tegra30-cardhu.dtsi
@@ -294,9 +294,10 @@
294 }; 294 };
295 }; 295 };
296 296
297 nct1008 { 297 temperature-sensor@4c {
298 compatible = "onnn,nct1008"; 298 compatible = "onnn,nct1008";
299 reg = <0x4c>; 299 reg = <0x4c>;
300 vcc-supply = <&sys_3v3_reg>;
300 interrupt-parent = <&gpio>; 301 interrupt-parent = <&gpio>;
301 interrupts = <TEGRA_GPIO(CC, 2) IRQ_TYPE_LEVEL_LOW>; 302 interrupts = <TEGRA_GPIO(CC, 2) IRQ_TYPE_LEVEL_LOW>;
302 }; 303 };
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index 0022c127e1d9..2bd55cfd88ad 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -136,12 +136,13 @@
136 gr3d { 136 gr3d {
137 compatible = "nvidia,tegra30-gr3d"; 137 compatible = "nvidia,tegra30-gr3d";
138 reg = <0x54180000 0x00040000>; 138 reg = <0x54180000 0x00040000>;
139 clocks = <&tegra_car 24 &tegra_car 98>; 139 clocks = <&tegra_car TEGRA30_CLK_GR3D
140 &tegra_car TEGRA30_CLK_GR3D2>;
140 clock-names = "3d", "3d2"; 141 clock-names = "3d", "3d2";
141 }; 142 };
142 143
143 dc@54200000 { 144 dc@54200000 {
144 compatible = "nvidia,tegra30-dc"; 145 compatible = "nvidia,tegra30-dc", "nvidia,tegra20-dc";
145 reg = <0x54200000 0x00040000>; 146 reg = <0x54200000 0x00040000>;
146 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; 147 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
147 clocks = <&tegra_car TEGRA30_CLK_DISP1>, 148 clocks = <&tegra_car TEGRA30_CLK_DISP1>,
diff --git a/arch/arm/boot/dts/testcases/tests-interrupts.dtsi b/arch/arm/boot/dts/testcases/tests-interrupts.dtsi
new file mode 100644
index 000000000000..c843720bd3e5
--- /dev/null
+++ b/arch/arm/boot/dts/testcases/tests-interrupts.dtsi
@@ -0,0 +1,58 @@
1
2/ {
3 testcase-data {
4 interrupts {
5 #address-cells = <1>;
6 #size-cells = <1>;
7 test_intc0: intc0 {
8 interrupt-controller;
9 #interrupt-cells = <1>;
10 };
11
12 test_intc1: intc1 {
13 interrupt-controller;
14 #interrupt-cells = <3>;
15 };
16
17 test_intc2: intc2 {
18 interrupt-controller;
19 #interrupt-cells = <2>;
20 };
21
22 test_intmap0: intmap0 {
23 #interrupt-cells = <1>;
24 #address-cells = <0>;
25 interrupt-map = <1 &test_intc0 9>,
26 <2 &test_intc1 10 11 12>,
27 <3 &test_intc2 13 14>,
28 <4 &test_intc2 15 16>;
29 };
30
31 test_intmap1: intmap1 {
32 #interrupt-cells = <2>;
33 interrupt-map = <0x5000 1 2 &test_intc0 15>;
34 };
35
36 interrupts0 {
37 interrupt-parent = <&test_intc0>;
38 interrupts = <1>, <2>, <3>, <4>;
39 };
40
41 interrupts1 {
42 interrupt-parent = <&test_intmap0>;
43 interrupts = <1>, <2>, <3>, <4>;
44 };
45
46 interrupts-extended0 {
47 reg = <0x5000 0x100>;
48 interrupts-extended = <&test_intc0 1>,
49 <&test_intc1 2 3 4>,
50 <&test_intc2 5 6>,
51 <&test_intmap0 1>,
52 <&test_intmap0 2>,
53 <&test_intmap0 3>,
54 <&test_intmap1 1 2>;
55 };
56 };
57 };
58};
diff --git a/arch/arm/boot/dts/testcases/tests.dtsi b/arch/arm/boot/dts/testcases/tests.dtsi
index a7c5067622e8..3f123ecc9dd7 100644
--- a/arch/arm/boot/dts/testcases/tests.dtsi
+++ b/arch/arm/boot/dts/testcases/tests.dtsi
@@ -1 +1,2 @@
1/include/ "tests-phandle.dtsi" 1/include/ "tests-phandle.dtsi"
2/include/ "tests-interrupts.dtsi"
diff --git a/arch/arm/boot/dts/twl4030.dtsi b/arch/arm/boot/dts/twl4030.dtsi
index ae6a17aed9ee..fb1b2ec8eaa9 100644
--- a/arch/arm/boot/dts/twl4030.dtsi
+++ b/arch/arm/boot/dts/twl4030.dtsi
@@ -23,6 +23,22 @@
23 compatible = "ti,twl4030-wdt"; 23 compatible = "ti,twl4030-wdt";
24 }; 24 };
25 25
26 vaux1: regulator-vaux1 {
27 compatible = "ti,twl4030-vaux1";
28 };
29
30 vaux2: regulator-vaux2 {
31 compatible = "ti,twl4030-vaux2";
32 };
33
34 vaux3: regulator-vaux3 {
35 compatible = "ti,twl4030-vaux3";
36 };
37
38 vaux4: regulator-vaux4 {
39 compatible = "ti,twl4030-vaux4";
40 };
41
26 vcc: regulator-vdd1 { 42 vcc: regulator-vdd1 {
27 compatible = "ti,twl4030-vdd1"; 43 compatible = "ti,twl4030-vdd1";
28 regulator-min-microvolt = <600000>; 44 regulator-min-microvolt = <600000>;
@@ -35,10 +51,20 @@
35 regulator-max-microvolt = <1800000>; 51 regulator-max-microvolt = <1800000>;
36 }; 52 };
37 53
38 vpll2: regulator-vpll2 { 54 vio: regulator-vio {
39 compatible = "ti,twl4030-vpll2"; 55 compatible = "ti,twl4030-vio";
40 regulator-min-microvolt = <1800000>; 56 };
41 regulator-max-microvolt = <1800000>; 57
58 vintana1: regulator-vintana1 {
59 compatible = "ti,twl4030-vintana1";
60 };
61
62 vintana2: regulator-vintana2 {
63 compatible = "ti,twl4030-vintana2";
64 };
65
66 vintdig: regulator-vintdig {
67 compatible = "ti,twl4030-vintdig";
42 }; 68 };
43 69
44 vmmc1: regulator-vmmc1 { 70 vmmc1: regulator-vmmc1 {
@@ -65,6 +91,16 @@
65 compatible = "ti,twl4030-vusb3v1"; 91 compatible = "ti,twl4030-vusb3v1";
66 }; 92 };
67 93
94 vpll1: regulator-vpll1 {
95 compatible = "ti,twl4030-vpll1";
96 };
97
98 vpll2: regulator-vpll2 {
99 compatible = "ti,twl4030-vpll2";
100 regulator-min-microvolt = <1800000>;
101 regulator-max-microvolt = <1800000>;
102 };
103
68 vsim: regulator-vsim { 104 vsim: regulator-vsim {
69 compatible = "ti,twl4030-vsim"; 105 compatible = "ti,twl4030-vsim";
70 regulator-min-microvolt = <1800000>; 106 regulator-min-microvolt = <1800000>;
@@ -86,6 +122,7 @@
86 usb1v8-supply = <&vusb1v8>; 122 usb1v8-supply = <&vusb1v8>;
87 usb3v1-supply = <&vusb3v1>; 123 usb3v1-supply = <&vusb3v1>;
88 usb_mode = <1>; 124 usb_mode = <1>;
125 #phy-cells = <0>;
89 }; 126 };
90 127
91 twl_pwm: pwm { 128 twl_pwm: pwm {
@@ -97,4 +134,9 @@
97 compatible = "ti,twl4030-pwmled"; 134 compatible = "ti,twl4030-pwmled";
98 #pwm-cells = <2>; 135 #pwm-cells = <2>;
99 }; 136 };
137
138 twl_pwrbutton: pwrbutton {
139 compatible = "ti,twl4030-pwrbutton";
140 interrupts = <8>;
141 };
100}; 142};
diff --git a/arch/arm/boot/dts/twl6030_omap4.dtsi b/arch/arm/boot/dts/twl6030_omap4.dtsi
new file mode 100644
index 000000000000..a4fa5703c42b
--- /dev/null
+++ b/arch/arm/boot/dts/twl6030_omap4.dtsi
@@ -0,0 +1,38 @@
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&twl {
10 /*
11 * On most OMAP4 platforms, the twl6030 IRQ line is connected
12 * to the SYS_NIRQ1 line on OMAP and the twl6030 MSECURE line is
13 * connected to the fref_clk0_out.sys_drm_msecure line.
14 * Therefore, configure the defaults for the SYS_NIRQ1 and
15 * fref_clk0_out.sys_drm_msecure pins here.
16 */
17 pinctrl-names = "default";
18 pinctrl-0 = <
19 &twl6030_pins
20 &twl6030_wkup_pins
21 >;
22};
23
24&omap4_pmx_wkup {
25 twl6030_wkup_pins: pinmux_twl6030_wkup_pins {
26 pinctrl-single,pins = <
27 0x14 (PIN_OUTPUT | MUX_MODE2) /* fref_clk0_out.sys_drm_msecure */
28 >;
29 };
30};
31
32&omap4_pmx_core {
33 twl6030_pins: pinmux_twl6030_pins {
34 pinctrl-single,pins = <
35 0x15e (WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE0) /* sys_nirq1.sys_nirq1 */
36 >;
37 };
38};
diff --git a/arch/arm/boot/dts/versatile-ab.dts b/arch/arm/boot/dts/versatile-ab.dts
index dde75ae8b4b1..e01e5a081def 100644
--- a/arch/arm/boot/dts/versatile-ab.dts
+++ b/arch/arm/boot/dts/versatile-ab.dts
@@ -185,7 +185,7 @@
185 mmc@5000 { 185 mmc@5000 {
186 compatible = "arm,primecell"; 186 compatible = "arm,primecell";
187 reg = < 0x5000 0x1000>; 187 reg = < 0x5000 0x1000>;
188 interrupts = <22 34>; 188 interrupts-extended = <&vic 22 &sic 2>;
189 }; 189 };
190 kmi@6000 { 190 kmi@6000 {
191 compatible = "arm,pl050", "arm,primecell"; 191 compatible = "arm,pl050", "arm,primecell";
diff --git a/arch/arm/boot/dts/versatile-pb.dts b/arch/arm/boot/dts/versatile-pb.dts
index 7e8175269064..f43907c40c93 100644
--- a/arch/arm/boot/dts/versatile-pb.dts
+++ b/arch/arm/boot/dts/versatile-pb.dts
@@ -41,7 +41,7 @@
41 mmc@b000 { 41 mmc@b000 {
42 compatible = "arm,primecell"; 42 compatible = "arm,primecell";
43 reg = <0xb000 0x1000>; 43 reg = <0xb000 0x1000>;
44 interrupts = <23 34>; 44 interrupts-extended = <&vic 23 &sic 2>;
45 }; 45 };
46 }; 46 };
47 }; 47 };
diff --git a/arch/arm/boot/dts/vf610-cosmic.dts b/arch/arm/boot/dts/vf610-cosmic.dts
new file mode 100644
index 000000000000..c42e4f938dcd
--- /dev/null
+++ b/arch/arm/boot/dts/vf610-cosmic.dts
@@ -0,0 +1,47 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 * Copyright 2013 Linaro Limited
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 */
10
11/dts-v1/;
12#include "vf610.dtsi"
13
14/ {
15 model = "PHYTEC Cosmic/Cosmic+ Board";
16 compatible = "phytec,vf610-cosmic", "fsl,vf610";
17
18 chosen {
19 bootargs = "console=ttyLP1,115200";
20 };
21
22 memory {
23 reg = <0x80000000 0x10000000>;
24 };
25
26 clocks {
27 enet_ext {
28 compatible = "fixed-clock";
29 #clock-cells = <0>;
30 clock-frequency = <50000000>;
31 };
32 };
33
34};
35
36&fec1 {
37 phy-mode = "rmii";
38 pinctrl-names = "default";
39 pinctrl-0 = <&pinctrl_fec1_1>;
40 status = "okay";
41};
42
43&uart1 {
44 pinctrl-names = "default";
45 pinctrl-0 = <&pinctrl_uart1_1>;
46 status = "okay";
47};
diff --git a/arch/arm/boot/dts/vf610-twr.dts b/arch/arm/boot/dts/vf610-twr.dts
index 1a58678b93fa..c8047ca16501 100644
--- a/arch/arm/boot/dts/vf610-twr.dts
+++ b/arch/arm/boot/dts/vf610-twr.dts
@@ -36,6 +36,23 @@
36 36
37}; 37};
38 38
39&dspi0 {
40 bus-num = <0>;
41 pinctrl-names = "default";
42 pinctrl-0 = <&pinctrl_dspi0_1>;
43 status = "okay";
44
45 sflash: at26df081a@0 {
46 #address-cells = <1>;
47 #size-cells = <1>;
48 compatible = "atmel,at26df081a";
49 spi-max-frequency = <16000000>;
50 spi-cpol;
51 spi-cpha;
52 reg = <0>;
53 };
54};
55
39&fec0 { 56&fec0 {
40 phy-mode = "rmii"; 57 phy-mode = "rmii";
41 pinctrl-names = "default"; 58 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi
index 67d929cf9804..d31ce1b4a7b0 100644
--- a/arch/arm/boot/dts/vf610.dtsi
+++ b/arch/arm/boot/dts/vf610.dtsi
@@ -123,6 +123,18 @@
123 status = "disabled"; 123 status = "disabled";
124 }; 124 };
125 125
126 dspi0: dspi0@4002c000 {
127 #address-cells = <1>;
128 #size-cells = <0>;
129 compatible = "fsl,vf610-dspi";
130 reg = <0x4002c000 0x1000>;
131 interrupts = <0 67 0x04>;
132 clocks = <&clks VF610_CLK_DSPI0>;
133 clock-names = "dspi";
134 spi-num-chipselects = <5>;
135 status = "disabled";
136 };
137
126 sai2: sai@40031000 { 138 sai2: sai@40031000 {
127 compatible = "fsl,vf610-sai"; 139 compatible = "fsl,vf610-sai";
128 reg = <0x40031000 0x1000>; 140 reg = <0x40031000 0x1000>;
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
index e32b92b949d2..e7f73b2e4550 100644
--- a/arch/arm/boot/dts/zynq-7000.dtsi
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -92,6 +92,14 @@
92 }; 92 };
93 }; 93 };
94 94
95 global_timer: timer@f8f00200 {
96 compatible = "arm,cortex-a9-global-timer";
97 reg = <0xf8f00200 0x20>;
98 interrupts = <1 11 0x301>;
99 interrupt-parent = <&intc>;
100 clocks = <&clkc 4>;
101 };
102
95 ttc0: ttc0@f8001000 { 103 ttc0: ttc0@f8001000 {
96 interrupt-parent = <&intc>; 104 interrupt-parent = <&intc>;
97 interrupts = < 0 10 4 0 11 4 0 12 4 >; 105 interrupts = < 0 10 4 0 11 4 0 12 4 >;
diff --git a/arch/arm/boot/install.sh b/arch/arm/boot/install.sh
index 06ea7d42ce8e..2a45092a40e3 100644
--- a/arch/arm/boot/install.sh
+++ b/arch/arm/boot/install.sh
@@ -20,6 +20,20 @@
20# $4 - default install path (blank if root directory) 20# $4 - default install path (blank if root directory)
21# 21#
22 22
23verify () {
24 if [ ! -f "$1" ]; then
25 echo "" 1>&2
26 echo " *** Missing file: $1" 1>&2
27 echo ' *** You need to run "make" before "make install".' 1>&2
28 echo "" 1>&2
29 exit 1
30 fi
31}
32
33# Make sure the files actually exist
34verify "$2"
35verify "$3"
36
23# User may have a custom install script 37# User may have a custom install script
24if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi 38if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
25if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi 39if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index 8c60f473e976..4bdc41622c36 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -6,7 +6,6 @@ obj-y += firmware.o
6 6
7obj-$(CONFIG_ICST) += icst.o 7obj-$(CONFIG_ICST) += icst.o
8obj-$(CONFIG_SA1111) += sa1111.o 8obj-$(CONFIG_SA1111) += sa1111.o
9obj-$(CONFIG_PCI_HOST_VIA82C505) += via82c505.o
10obj-$(CONFIG_DMABOUNCE) += dmabounce.o 9obj-$(CONFIG_DMABOUNCE) += dmabounce.o
11obj-$(CONFIG_SHARP_LOCOMO) += locomo.o 10obj-$(CONFIG_SHARP_LOCOMO) += locomo.o
12obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o 11obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o
@@ -17,3 +16,5 @@ obj-$(CONFIG_MCPM) += mcpm_head.o mcpm_entry.o mcpm_platsmp.o vlock.o
17AFLAGS_mcpm_head.o := -march=armv7-a 16AFLAGS_mcpm_head.o := -march=armv7-a
18AFLAGS_vlock.o := -march=armv7-a 17AFLAGS_vlock.o := -march=armv7-a
19obj-$(CONFIG_TI_PRIV_EDMA) += edma.o 18obj-$(CONFIG_TI_PRIV_EDMA) += edma.o
19obj-$(CONFIG_BL_SWITCHER) += bL_switcher.o
20obj-$(CONFIG_BL_SWITCHER_DUMMY_IF) += bL_switcher_dummy_if.o
diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c
new file mode 100644
index 000000000000..5774b6ea7ad5
--- /dev/null
+++ b/arch/arm/common/bL_switcher.c
@@ -0,0 +1,822 @@
1/*
2 * arch/arm/common/bL_switcher.c -- big.LITTLE cluster switcher core driver
3 *
4 * Created by: Nicolas Pitre, March 2012
5 * Copyright: (C) 2012-2013 Linaro Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/atomic.h>
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/module.h>
16#include <linux/sched.h>
17#include <linux/interrupt.h>
18#include <linux/cpu_pm.h>
19#include <linux/cpu.h>
20#include <linux/cpumask.h>
21#include <linux/kthread.h>
22#include <linux/wait.h>
23#include <linux/time.h>
24#include <linux/clockchips.h>
25#include <linux/hrtimer.h>
26#include <linux/tick.h>
27#include <linux/notifier.h>
28#include <linux/mm.h>
29#include <linux/mutex.h>
30#include <linux/smp.h>
31#include <linux/spinlock.h>
32#include <linux/string.h>
33#include <linux/sysfs.h>
34#include <linux/irqchip/arm-gic.h>
35#include <linux/moduleparam.h>
36
37#include <asm/smp_plat.h>
38#include <asm/cputype.h>
39#include <asm/suspend.h>
40#include <asm/mcpm.h>
41#include <asm/bL_switcher.h>
42
43#define CREATE_TRACE_POINTS
44#include <trace/events/power_cpu_migrate.h>
45
46
47/*
48 * Use our own MPIDR accessors as the generic ones in asm/cputype.h have
49 * __attribute_const__ and we don't want the compiler to assume any
50 * constness here as the value _does_ change along some code paths.
51 */
52
53static int read_mpidr(void)
54{
55 unsigned int id;
56 asm volatile ("mrc p15, 0, %0, c0, c0, 5" : "=r" (id));
57 return id & MPIDR_HWID_BITMASK;
58}
59
60/*
61 * Get a global nanosecond time stamp for tracing.
62 */
63static s64 get_ns(void)
64{
65 struct timespec ts;
66 getnstimeofday(&ts);
67 return timespec_to_ns(&ts);
68}
69
70/*
71 * bL switcher core code.
72 */
73
74static void bL_do_switch(void *_arg)
75{
76 unsigned ib_mpidr, ib_cpu, ib_cluster;
77 long volatile handshake, **handshake_ptr = _arg;
78
79 pr_debug("%s\n", __func__);
80
81 ib_mpidr = cpu_logical_map(smp_processor_id());
82 ib_cpu = MPIDR_AFFINITY_LEVEL(ib_mpidr, 0);
83 ib_cluster = MPIDR_AFFINITY_LEVEL(ib_mpidr, 1);
84
85 /* Advertise our handshake location */
86 if (handshake_ptr) {
87 handshake = 0;
88 *handshake_ptr = &handshake;
89 } else
90 handshake = -1;
91
92 /*
93 * Our state has been saved at this point. Let's release our
94 * inbound CPU.
95 */
96 mcpm_set_entry_vector(ib_cpu, ib_cluster, cpu_resume);
97 sev();
98
99 /*
100 * From this point, we must assume that our counterpart CPU might
101 * have taken over in its parallel world already, as if execution
102 * just returned from cpu_suspend(). It is therefore important to
103 * be very careful not to make any change the other guy is not
104 * expecting. This is why we need stack isolation.
105 *
106 * Fancy under cover tasks could be performed here. For now
107 * we have none.
108 */
109
110 /*
111 * Let's wait until our inbound is alive.
112 */
113 while (!handshake) {
114 wfe();
115 smp_mb();
116 }
117
118 /* Let's put ourself down. */
119 mcpm_cpu_power_down();
120
121 /* should never get here */
122 BUG();
123}
124
125/*
126 * Stack isolation. To ensure 'current' remains valid, we just use another
127 * piece of our thread's stack space which should be fairly lightly used.
128 * The selected area starts just above the thread_info structure located
129 * at the very bottom of the stack, aligned to a cache line, and indexed
130 * with the cluster number.
131 */
132#define STACK_SIZE 512
133extern void call_with_stack(void (*fn)(void *), void *arg, void *sp);
134static int bL_switchpoint(unsigned long _arg)
135{
136 unsigned int mpidr = read_mpidr();
137 unsigned int clusterid = MPIDR_AFFINITY_LEVEL(mpidr, 1);
138 void *stack = current_thread_info() + 1;
139 stack = PTR_ALIGN(stack, L1_CACHE_BYTES);
140 stack += clusterid * STACK_SIZE + STACK_SIZE;
141 call_with_stack(bL_do_switch, (void *)_arg, stack);
142 BUG();
143}
144
145/*
146 * Generic switcher interface
147 */
148
149static unsigned int bL_gic_id[MAX_CPUS_PER_CLUSTER][MAX_NR_CLUSTERS];
150static int bL_switcher_cpu_pairing[NR_CPUS];
151
152/*
153 * bL_switch_to - Switch to a specific cluster for the current CPU
154 * @new_cluster_id: the ID of the cluster to switch to.
155 *
156 * This function must be called on the CPU to be switched.
157 * Returns 0 on success, else a negative status code.
158 */
159static int bL_switch_to(unsigned int new_cluster_id)
160{
161 unsigned int mpidr, this_cpu, that_cpu;
162 unsigned int ob_mpidr, ob_cpu, ob_cluster, ib_mpidr, ib_cpu, ib_cluster;
163 struct completion inbound_alive;
164 struct tick_device *tdev;
165 enum clock_event_mode tdev_mode;
166 long volatile *handshake_ptr;
167 int ipi_nr, ret;
168
169 this_cpu = smp_processor_id();
170 ob_mpidr = read_mpidr();
171 ob_cpu = MPIDR_AFFINITY_LEVEL(ob_mpidr, 0);
172 ob_cluster = MPIDR_AFFINITY_LEVEL(ob_mpidr, 1);
173 BUG_ON(cpu_logical_map(this_cpu) != ob_mpidr);
174
175 if (new_cluster_id == ob_cluster)
176 return 0;
177
178 that_cpu = bL_switcher_cpu_pairing[this_cpu];
179 ib_mpidr = cpu_logical_map(that_cpu);
180 ib_cpu = MPIDR_AFFINITY_LEVEL(ib_mpidr, 0);
181 ib_cluster = MPIDR_AFFINITY_LEVEL(ib_mpidr, 1);
182
183 pr_debug("before switch: CPU %d MPIDR %#x -> %#x\n",
184 this_cpu, ob_mpidr, ib_mpidr);
185
186 this_cpu = smp_processor_id();
187
188 /* Close the gate for our entry vectors */
189 mcpm_set_entry_vector(ob_cpu, ob_cluster, NULL);
190 mcpm_set_entry_vector(ib_cpu, ib_cluster, NULL);
191
192 /* Install our "inbound alive" notifier. */
193 init_completion(&inbound_alive);
194 ipi_nr = register_ipi_completion(&inbound_alive, this_cpu);
195 ipi_nr |= ((1 << 16) << bL_gic_id[ob_cpu][ob_cluster]);
196 mcpm_set_early_poke(ib_cpu, ib_cluster, gic_get_sgir_physaddr(), ipi_nr);
197
198 /*
199 * Let's wake up the inbound CPU now in case it requires some delay
200 * to come online, but leave it gated in our entry vector code.
201 */
202 ret = mcpm_cpu_power_up(ib_cpu, ib_cluster);
203 if (ret) {
204 pr_err("%s: mcpm_cpu_power_up() returned %d\n", __func__, ret);
205 return ret;
206 }
207
208 /*
209 * Raise a SGI on the inbound CPU to make sure it doesn't stall
210 * in a possible WFI, such as in bL_power_down().
211 */
212 gic_send_sgi(bL_gic_id[ib_cpu][ib_cluster], 0);
213
214 /*
215 * Wait for the inbound to come up. This allows for other
216 * tasks to be scheduled in the mean time.
217 */
218 wait_for_completion(&inbound_alive);
219 mcpm_set_early_poke(ib_cpu, ib_cluster, 0, 0);
220
221 /*
222 * From this point we are entering the switch critical zone
223 * and can't take any interrupts anymore.
224 */
225 local_irq_disable();
226 local_fiq_disable();
227 trace_cpu_migrate_begin(get_ns(), ob_mpidr);
228
229 /* redirect GIC's SGIs to our counterpart */
230 gic_migrate_target(bL_gic_id[ib_cpu][ib_cluster]);
231
232 tdev = tick_get_device(this_cpu);
233 if (tdev && !cpumask_equal(tdev->evtdev->cpumask, cpumask_of(this_cpu)))
234 tdev = NULL;
235 if (tdev) {
236 tdev_mode = tdev->evtdev->mode;
237 clockevents_set_mode(tdev->evtdev, CLOCK_EVT_MODE_SHUTDOWN);
238 }
239
240 ret = cpu_pm_enter();
241
242 /* we can not tolerate errors at this point */
243 if (ret)
244 panic("%s: cpu_pm_enter() returned %d\n", __func__, ret);
245
246 /* Swap the physical CPUs in the logical map for this logical CPU. */
247 cpu_logical_map(this_cpu) = ib_mpidr;
248 cpu_logical_map(that_cpu) = ob_mpidr;
249
250 /* Let's do the actual CPU switch. */
251 ret = cpu_suspend((unsigned long)&handshake_ptr, bL_switchpoint);
252 if (ret > 0)
253 panic("%s: cpu_suspend() returned %d\n", __func__, ret);
254
255 /* We are executing on the inbound CPU at this point */
256 mpidr = read_mpidr();
257 pr_debug("after switch: CPU %d MPIDR %#x\n", this_cpu, mpidr);
258 BUG_ON(mpidr != ib_mpidr);
259
260 mcpm_cpu_powered_up();
261
262 ret = cpu_pm_exit();
263
264 if (tdev) {
265 clockevents_set_mode(tdev->evtdev, tdev_mode);
266 clockevents_program_event(tdev->evtdev,
267 tdev->evtdev->next_event, 1);
268 }
269
270 trace_cpu_migrate_finish(get_ns(), ib_mpidr);
271 local_fiq_enable();
272 local_irq_enable();
273
274 *handshake_ptr = 1;
275 dsb_sev();
276
277 if (ret)
278 pr_err("%s exiting with error %d\n", __func__, ret);
279 return ret;
280}
281
282struct bL_thread {
283 spinlock_t lock;
284 struct task_struct *task;
285 wait_queue_head_t wq;
286 int wanted_cluster;
287 struct completion started;
288 bL_switch_completion_handler completer;
289 void *completer_cookie;
290};
291
292static struct bL_thread bL_threads[NR_CPUS];
293
294static int bL_switcher_thread(void *arg)
295{
296 struct bL_thread *t = arg;
297 struct sched_param param = { .sched_priority = 1 };
298 int cluster;
299 bL_switch_completion_handler completer;
300 void *completer_cookie;
301
302 sched_setscheduler_nocheck(current, SCHED_FIFO, &param);
303 complete(&t->started);
304
305 do {
306 if (signal_pending(current))
307 flush_signals(current);
308 wait_event_interruptible(t->wq,
309 t->wanted_cluster != -1 ||
310 kthread_should_stop());
311
312 spin_lock(&t->lock);
313 cluster = t->wanted_cluster;
314 completer = t->completer;
315 completer_cookie = t->completer_cookie;
316 t->wanted_cluster = -1;
317 t->completer = NULL;
318 spin_unlock(&t->lock);
319
320 if (cluster != -1) {
321 bL_switch_to(cluster);
322
323 if (completer)
324 completer(completer_cookie);
325 }
326 } while (!kthread_should_stop());
327
328 return 0;
329}
330
331static struct task_struct *bL_switcher_thread_create(int cpu, void *arg)
332{
333 struct task_struct *task;
334
335 task = kthread_create_on_node(bL_switcher_thread, arg,
336 cpu_to_node(cpu), "kswitcher_%d", cpu);
337 if (!IS_ERR(task)) {
338 kthread_bind(task, cpu);
339 wake_up_process(task);
340 } else
341 pr_err("%s failed for CPU %d\n", __func__, cpu);
342 return task;
343}
344
345/*
346 * bL_switch_request_cb - Switch to a specific cluster for the given CPU,
347 * with completion notification via a callback
348 *
349 * @cpu: the CPU to switch
350 * @new_cluster_id: the ID of the cluster to switch to.
351 * @completer: switch completion callback. if non-NULL,
352 * @completer(@completer_cookie) will be called on completion of
353 * the switch, in non-atomic context.
354 * @completer_cookie: opaque context argument for @completer.
355 *
356 * This function causes a cluster switch on the given CPU by waking up
357 * the appropriate switcher thread. This function may or may not return
358 * before the switch has occurred.
359 *
360 * If a @completer callback function is supplied, it will be called when
361 * the switch is complete. This can be used to determine asynchronously
362 * when the switch is complete, regardless of when bL_switch_request()
363 * returns. When @completer is supplied, no new switch request is permitted
364 * for the affected CPU until after the switch is complete, and @completer
365 * has returned.
366 */
367int bL_switch_request_cb(unsigned int cpu, unsigned int new_cluster_id,
368 bL_switch_completion_handler completer,
369 void *completer_cookie)
370{
371 struct bL_thread *t;
372
373 if (cpu >= ARRAY_SIZE(bL_threads)) {
374 pr_err("%s: cpu %d out of bounds\n", __func__, cpu);
375 return -EINVAL;
376 }
377
378 t = &bL_threads[cpu];
379
380 if (IS_ERR(t->task))
381 return PTR_ERR(t->task);
382 if (!t->task)
383 return -ESRCH;
384
385 spin_lock(&t->lock);
386 if (t->completer) {
387 spin_unlock(&t->lock);
388 return -EBUSY;
389 }
390 t->completer = completer;
391 t->completer_cookie = completer_cookie;
392 t->wanted_cluster = new_cluster_id;
393 spin_unlock(&t->lock);
394 wake_up(&t->wq);
395 return 0;
396}
397EXPORT_SYMBOL_GPL(bL_switch_request_cb);
398
399/*
400 * Activation and configuration code.
401 */
402
403static DEFINE_MUTEX(bL_switcher_activation_lock);
404static BLOCKING_NOTIFIER_HEAD(bL_activation_notifier);
405static unsigned int bL_switcher_active;
406static unsigned int bL_switcher_cpu_original_cluster[NR_CPUS];
407static cpumask_t bL_switcher_removed_logical_cpus;
408
409int bL_switcher_register_notifier(struct notifier_block *nb)
410{
411 return blocking_notifier_chain_register(&bL_activation_notifier, nb);
412}
413EXPORT_SYMBOL_GPL(bL_switcher_register_notifier);
414
415int bL_switcher_unregister_notifier(struct notifier_block *nb)
416{
417 return blocking_notifier_chain_unregister(&bL_activation_notifier, nb);
418}
419EXPORT_SYMBOL_GPL(bL_switcher_unregister_notifier);
420
421static int bL_activation_notify(unsigned long val)
422{
423 int ret;
424
425 ret = blocking_notifier_call_chain(&bL_activation_notifier, val, NULL);
426 if (ret & NOTIFY_STOP_MASK)
427 pr_err("%s: notifier chain failed with status 0x%x\n",
428 __func__, ret);
429 return notifier_to_errno(ret);
430}
431
432static void bL_switcher_restore_cpus(void)
433{
434 int i;
435
436 for_each_cpu(i, &bL_switcher_removed_logical_cpus)
437 cpu_up(i);
438}
439
440static int bL_switcher_halve_cpus(void)
441{
442 int i, j, cluster_0, gic_id, ret;
443 unsigned int cpu, cluster, mask;
444 cpumask_t available_cpus;
445
446 /* First pass to validate what we have */
447 mask = 0;
448 for_each_online_cpu(i) {
449 cpu = MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 0);
450 cluster = MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 1);
451 if (cluster >= 2) {
452 pr_err("%s: only dual cluster systems are supported\n", __func__);
453 return -EINVAL;
454 }
455 if (WARN_ON(cpu >= MAX_CPUS_PER_CLUSTER))
456 return -EINVAL;
457 mask |= (1 << cluster);
458 }
459 if (mask != 3) {
460 pr_err("%s: no CPU pairing possible\n", __func__);
461 return -EINVAL;
462 }
463
464 /*
465 * Now let's do the pairing. We match each CPU with another CPU
466 * from a different cluster. To get a uniform scheduling behavior
467 * without fiddling with CPU topology and compute capacity data,
468 * we'll use logical CPUs initially belonging to the same cluster.
469 */
470 memset(bL_switcher_cpu_pairing, -1, sizeof(bL_switcher_cpu_pairing));
471 cpumask_copy(&available_cpus, cpu_online_mask);
472 cluster_0 = -1;
473 for_each_cpu(i, &available_cpus) {
474 int match = -1;
475 cluster = MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 1);
476 if (cluster_0 == -1)
477 cluster_0 = cluster;
478 if (cluster != cluster_0)
479 continue;
480 cpumask_clear_cpu(i, &available_cpus);
481 for_each_cpu(j, &available_cpus) {
482 cluster = MPIDR_AFFINITY_LEVEL(cpu_logical_map(j), 1);
483 /*
484 * Let's remember the last match to create "odd"
485 * pairings on purpose in order for other code not
486 * to assume any relation between physical and
487 * logical CPU numbers.
488 */
489 if (cluster != cluster_0)
490 match = j;
491 }
492 if (match != -1) {
493 bL_switcher_cpu_pairing[i] = match;
494 cpumask_clear_cpu(match, &available_cpus);
495 pr_info("CPU%d paired with CPU%d\n", i, match);
496 }
497 }
498
499 /*
500 * Now we disable the unwanted CPUs i.e. everything that has no
501 * pairing information (that includes the pairing counterparts).
502 */
503 cpumask_clear(&bL_switcher_removed_logical_cpus);
504 for_each_online_cpu(i) {
505 cpu = MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 0);
506 cluster = MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 1);
507
508 /* Let's take note of the GIC ID for this CPU */
509 gic_id = gic_get_cpu_id(i);
510 if (gic_id < 0) {
511 pr_err("%s: bad GIC ID for CPU %d\n", __func__, i);
512 bL_switcher_restore_cpus();
513 return -EINVAL;
514 }
515 bL_gic_id[cpu][cluster] = gic_id;
516 pr_info("GIC ID for CPU %u cluster %u is %u\n",
517 cpu, cluster, gic_id);
518
519 if (bL_switcher_cpu_pairing[i] != -1) {
520 bL_switcher_cpu_original_cluster[i] = cluster;
521 continue;
522 }
523
524 ret = cpu_down(i);
525 if (ret) {
526 bL_switcher_restore_cpus();
527 return ret;
528 }
529 cpumask_set_cpu(i, &bL_switcher_removed_logical_cpus);
530 }
531
532 return 0;
533}
534
535/* Determine the logical CPU a given physical CPU is grouped on. */
536int bL_switcher_get_logical_index(u32 mpidr)
537{
538 int cpu;
539
540 if (!bL_switcher_active)
541 return -EUNATCH;
542
543 mpidr &= MPIDR_HWID_BITMASK;
544 for_each_online_cpu(cpu) {
545 int pairing = bL_switcher_cpu_pairing[cpu];
546 if (pairing == -1)
547 continue;
548 if ((mpidr == cpu_logical_map(cpu)) ||
549 (mpidr == cpu_logical_map(pairing)))
550 return cpu;
551 }
552 return -EINVAL;
553}
554
555static void bL_switcher_trace_trigger_cpu(void *__always_unused info)
556{
557 trace_cpu_migrate_current(get_ns(), read_mpidr());
558}
559
560int bL_switcher_trace_trigger(void)
561{
562 int ret;
563
564 preempt_disable();
565
566 bL_switcher_trace_trigger_cpu(NULL);
567 ret = smp_call_function(bL_switcher_trace_trigger_cpu, NULL, true);
568
569 preempt_enable();
570
571 return ret;
572}
573EXPORT_SYMBOL_GPL(bL_switcher_trace_trigger);
574
575static int bL_switcher_enable(void)
576{
577 int cpu, ret;
578
579 mutex_lock(&bL_switcher_activation_lock);
580 lock_device_hotplug();
581 if (bL_switcher_active) {
582 unlock_device_hotplug();
583 mutex_unlock(&bL_switcher_activation_lock);
584 return 0;
585 }
586
587 pr_info("big.LITTLE switcher initializing\n");
588
589 ret = bL_activation_notify(BL_NOTIFY_PRE_ENABLE);
590 if (ret)
591 goto error;
592
593 ret = bL_switcher_halve_cpus();
594 if (ret)
595 goto error;
596
597 bL_switcher_trace_trigger();
598
599 for_each_online_cpu(cpu) {
600 struct bL_thread *t = &bL_threads[cpu];
601 spin_lock_init(&t->lock);
602 init_waitqueue_head(&t->wq);
603 init_completion(&t->started);
604 t->wanted_cluster = -1;
605 t->task = bL_switcher_thread_create(cpu, t);
606 }
607
608 bL_switcher_active = 1;
609 bL_activation_notify(BL_NOTIFY_POST_ENABLE);
610 pr_info("big.LITTLE switcher initialized\n");
611 goto out;
612
613error:
614 pr_warn("big.LITTLE switcher initialization failed\n");
615 bL_activation_notify(BL_NOTIFY_POST_DISABLE);
616
617out:
618 unlock_device_hotplug();
619 mutex_unlock(&bL_switcher_activation_lock);
620 return ret;
621}
622
623#ifdef CONFIG_SYSFS
624
625static void bL_switcher_disable(void)
626{
627 unsigned int cpu, cluster;
628 struct bL_thread *t;
629 struct task_struct *task;
630
631 mutex_lock(&bL_switcher_activation_lock);
632 lock_device_hotplug();
633
634 if (!bL_switcher_active)
635 goto out;
636
637 if (bL_activation_notify(BL_NOTIFY_PRE_DISABLE) != 0) {
638 bL_activation_notify(BL_NOTIFY_POST_ENABLE);
639 goto out;
640 }
641
642 bL_switcher_active = 0;
643
644 /*
645 * To deactivate the switcher, we must shut down the switcher
646 * threads to prevent any other requests from being accepted.
647 * Then, if the final cluster for given logical CPU is not the
648 * same as the original one, we'll recreate a switcher thread
649 * just for the purpose of switching the CPU back without any
650 * possibility for interference from external requests.
651 */
652 for_each_online_cpu(cpu) {
653 t = &bL_threads[cpu];
654 task = t->task;
655 t->task = NULL;
656 if (!task || IS_ERR(task))
657 continue;
658 kthread_stop(task);
659 /* no more switch may happen on this CPU at this point */
660 cluster = MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 1);
661 if (cluster == bL_switcher_cpu_original_cluster[cpu])
662 continue;
663 init_completion(&t->started);
664 t->wanted_cluster = bL_switcher_cpu_original_cluster[cpu];
665 task = bL_switcher_thread_create(cpu, t);
666 if (!IS_ERR(task)) {
667 wait_for_completion(&t->started);
668 kthread_stop(task);
669 cluster = MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 1);
670 if (cluster == bL_switcher_cpu_original_cluster[cpu])
671 continue;
672 }
673 /* If execution gets here, we're in trouble. */
674 pr_crit("%s: unable to restore original cluster for CPU %d\n",
675 __func__, cpu);
676 pr_crit("%s: CPU %d can't be restored\n",
677 __func__, bL_switcher_cpu_pairing[cpu]);
678 cpumask_clear_cpu(bL_switcher_cpu_pairing[cpu],
679 &bL_switcher_removed_logical_cpus);
680 }
681
682 bL_switcher_restore_cpus();
683 bL_switcher_trace_trigger();
684
685 bL_activation_notify(BL_NOTIFY_POST_DISABLE);
686
687out:
688 unlock_device_hotplug();
689 mutex_unlock(&bL_switcher_activation_lock);
690}
691
692static ssize_t bL_switcher_active_show(struct kobject *kobj,
693 struct kobj_attribute *attr, char *buf)
694{
695 return sprintf(buf, "%u\n", bL_switcher_active);
696}
697
698static ssize_t bL_switcher_active_store(struct kobject *kobj,
699 struct kobj_attribute *attr, const char *buf, size_t count)
700{
701 int ret;
702
703 switch (buf[0]) {
704 case '0':
705 bL_switcher_disable();
706 ret = 0;
707 break;
708 case '1':
709 ret = bL_switcher_enable();
710 break;
711 default:
712 ret = -EINVAL;
713 }
714
715 return (ret >= 0) ? count : ret;
716}
717
718static ssize_t bL_switcher_trace_trigger_store(struct kobject *kobj,
719 struct kobj_attribute *attr, const char *buf, size_t count)
720{
721 int ret = bL_switcher_trace_trigger();
722
723 return ret ? ret : count;
724}
725
726static struct kobj_attribute bL_switcher_active_attr =
727 __ATTR(active, 0644, bL_switcher_active_show, bL_switcher_active_store);
728
729static struct kobj_attribute bL_switcher_trace_trigger_attr =
730 __ATTR(trace_trigger, 0200, NULL, bL_switcher_trace_trigger_store);
731
732static struct attribute *bL_switcher_attrs[] = {
733 &bL_switcher_active_attr.attr,
734 &bL_switcher_trace_trigger_attr.attr,
735 NULL,
736};
737
738static struct attribute_group bL_switcher_attr_group = {
739 .attrs = bL_switcher_attrs,
740};
741
742static struct kobject *bL_switcher_kobj;
743
744static int __init bL_switcher_sysfs_init(void)
745{
746 int ret;
747
748 bL_switcher_kobj = kobject_create_and_add("bL_switcher", kernel_kobj);
749 if (!bL_switcher_kobj)
750 return -ENOMEM;
751 ret = sysfs_create_group(bL_switcher_kobj, &bL_switcher_attr_group);
752 if (ret)
753 kobject_put(bL_switcher_kobj);
754 return ret;
755}
756
757#endif /* CONFIG_SYSFS */
758
759bool bL_switcher_get_enabled(void)
760{
761 mutex_lock(&bL_switcher_activation_lock);
762
763 return bL_switcher_active;
764}
765EXPORT_SYMBOL_GPL(bL_switcher_get_enabled);
766
767void bL_switcher_put_enabled(void)
768{
769 mutex_unlock(&bL_switcher_activation_lock);
770}
771EXPORT_SYMBOL_GPL(bL_switcher_put_enabled);
772
773/*
774 * Veto any CPU hotplug operation on those CPUs we've removed
775 * while the switcher is active.
776 * We're just not ready to deal with that given the trickery involved.
777 */
778static int bL_switcher_hotplug_callback(struct notifier_block *nfb,
779 unsigned long action, void *hcpu)
780{
781 if (bL_switcher_active) {
782 int pairing = bL_switcher_cpu_pairing[(unsigned long)hcpu];
783 switch (action & 0xf) {
784 case CPU_UP_PREPARE:
785 case CPU_DOWN_PREPARE:
786 if (pairing == -1)
787 return NOTIFY_BAD;
788 }
789 }
790 return NOTIFY_DONE;
791}
792
793static bool no_bL_switcher;
794core_param(no_bL_switcher, no_bL_switcher, bool, 0644);
795
796static int __init bL_switcher_init(void)
797{
798 int ret;
799
800 if (MAX_NR_CLUSTERS != 2) {
801 pr_err("%s: only dual cluster systems are supported\n", __func__);
802 return -EINVAL;
803 }
804
805 cpu_notifier(bL_switcher_hotplug_callback, 0);
806
807 if (!no_bL_switcher) {
808 ret = bL_switcher_enable();
809 if (ret)
810 return ret;
811 }
812
813#ifdef CONFIG_SYSFS
814 ret = bL_switcher_sysfs_init();
815 if (ret)
816 pr_err("%s: unable to create sysfs entry\n", __func__);
817#endif
818
819 return 0;
820}
821
822late_initcall(bL_switcher_init);
diff --git a/arch/arm/common/bL_switcher_dummy_if.c b/arch/arm/common/bL_switcher_dummy_if.c
new file mode 100644
index 000000000000..3f47f1203c6b
--- /dev/null
+++ b/arch/arm/common/bL_switcher_dummy_if.c
@@ -0,0 +1,71 @@
1/*
2 * arch/arm/common/bL_switcher_dummy_if.c -- b.L switcher dummy interface
3 *
4 * Created by: Nicolas Pitre, November 2012
5 * Copyright: (C) 2012-2013 Linaro Limited
6 *
7 * Dummy interface to user space for debugging purpose only.
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/fs.h>
17#include <linux/miscdevice.h>
18#include <asm/uaccess.h>
19#include <asm/bL_switcher.h>
20
21static ssize_t bL_switcher_write(struct file *file, const char __user *buf,
22 size_t len, loff_t *pos)
23{
24 unsigned char val[3];
25 unsigned int cpu, cluster;
26 int ret;
27
28 pr_debug("%s\n", __func__);
29
30 if (len < 3)
31 return -EINVAL;
32
33 if (copy_from_user(val, buf, 3))
34 return -EFAULT;
35
36 /* format: <cpu#>,<cluster#> */
37 if (val[0] < '0' || val[0] > '9' ||
38 val[1] != ',' ||
39 val[2] < '0' || val[2] > '1')
40 return -EINVAL;
41
42 cpu = val[0] - '0';
43 cluster = val[2] - '0';
44 ret = bL_switch_request(cpu, cluster);
45
46 return ret ? : len;
47}
48
49static const struct file_operations bL_switcher_fops = {
50 .write = bL_switcher_write,
51 .owner = THIS_MODULE,
52};
53
54static struct miscdevice bL_switcher_device = {
55 MISC_DYNAMIC_MINOR,
56 "b.L_switcher",
57 &bL_switcher_fops
58};
59
60static int __init bL_switcher_dummy_if_init(void)
61{
62 return misc_register(&bL_switcher_device);
63}
64
65static void __exit bL_switcher_dummy_if_exit(void)
66{
67 misc_deregister(&bL_switcher_device);
68}
69
70module_init(bL_switcher_dummy_if_init);
71module_exit(bL_switcher_dummy_if_exit);
diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c
index 117f955a2a06..8e1a0245907f 100644
--- a/arch/arm/common/edma.c
+++ b/arch/arm/common/edma.c
@@ -269,6 +269,11 @@ static const struct edmacc_param dummy_paramset = {
269 .ccnt = 1, 269 .ccnt = 1,
270}; 270};
271 271
272static const struct of_device_id edma_of_ids[] = {
273 { .compatible = "ti,edma3", },
274 {}
275};
276
272/*****************************************************************************/ 277/*****************************************************************************/
273 278
274static void map_dmach_queue(unsigned ctlr, unsigned ch_no, 279static void map_dmach_queue(unsigned ctlr, unsigned ch_no,
@@ -560,14 +565,38 @@ static int reserve_contiguous_slots(int ctlr, unsigned int id,
560static int prepare_unused_channel_list(struct device *dev, void *data) 565static int prepare_unused_channel_list(struct device *dev, void *data)
561{ 566{
562 struct platform_device *pdev = to_platform_device(dev); 567 struct platform_device *pdev = to_platform_device(dev);
563 int i, ctlr; 568 int i, count, ctlr;
569 struct of_phandle_args dma_spec;
564 570
571 if (dev->of_node) {
572 count = of_property_count_strings(dev->of_node, "dma-names");
573 if (count < 0)
574 return 0;
575 for (i = 0; i < count; i++) {
576 if (of_parse_phandle_with_args(dev->of_node, "dmas",
577 "#dma-cells", i,
578 &dma_spec))
579 continue;
580
581 if (!of_match_node(edma_of_ids, dma_spec.np)) {
582 of_node_put(dma_spec.np);
583 continue;
584 }
585
586 clear_bit(EDMA_CHAN_SLOT(dma_spec.args[0]),
587 edma_cc[0]->edma_unused);
588 of_node_put(dma_spec.np);
589 }
590 return 0;
591 }
592
593 /* For non-OF case */
565 for (i = 0; i < pdev->num_resources; i++) { 594 for (i = 0; i < pdev->num_resources; i++) {
566 if ((pdev->resource[i].flags & IORESOURCE_DMA) && 595 if ((pdev->resource[i].flags & IORESOURCE_DMA) &&
567 (int)pdev->resource[i].start >= 0) { 596 (int)pdev->resource[i].start >= 0) {
568 ctlr = EDMA_CTLR(pdev->resource[i].start); 597 ctlr = EDMA_CTLR(pdev->resource[i].start);
569 clear_bit(EDMA_CHAN_SLOT(pdev->resource[i].start), 598 clear_bit(EDMA_CHAN_SLOT(pdev->resource[i].start),
570 edma_cc[ctlr]->edma_unused); 599 edma_cc[ctlr]->edma_unused);
571 } 600 }
572 } 601 }
573 602
@@ -1762,11 +1791,6 @@ static int edma_probe(struct platform_device *pdev)
1762 return 0; 1791 return 0;
1763} 1792}
1764 1793
1765static const struct of_device_id edma_of_ids[] = {
1766 { .compatible = "ti,edma3", },
1767 {}
1768};
1769
1770static struct platform_driver edma_driver = { 1794static struct platform_driver edma_driver = {
1771 .driver = { 1795 .driver = {
1772 .name = "edma", 1796 .name = "edma",
diff --git a/arch/arm/common/mcpm_entry.c b/arch/arm/common/mcpm_entry.c
index 370236dd1a03..26020a03f659 100644
--- a/arch/arm/common/mcpm_entry.c
+++ b/arch/arm/common/mcpm_entry.c
@@ -27,6 +27,18 @@ void mcpm_set_entry_vector(unsigned cpu, unsigned cluster, void *ptr)
27 sync_cache_w(&mcpm_entry_vectors[cluster][cpu]); 27 sync_cache_w(&mcpm_entry_vectors[cluster][cpu]);
28} 28}
29 29
30extern unsigned long mcpm_entry_early_pokes[MAX_NR_CLUSTERS][MAX_CPUS_PER_CLUSTER][2];
31
32void mcpm_set_early_poke(unsigned cpu, unsigned cluster,
33 unsigned long poke_phys_addr, unsigned long poke_val)
34{
35 unsigned long *poke = &mcpm_entry_early_pokes[cluster][cpu][0];
36 poke[0] = poke_phys_addr;
37 poke[1] = poke_val;
38 __cpuc_flush_dcache_area((void *)poke, 8);
39 outer_clean_range(__pa(poke), __pa(poke + 2));
40}
41
30static const struct mcpm_platform_ops *platform_ops; 42static const struct mcpm_platform_ops *platform_ops;
31 43
32int __init mcpm_platform_register(const struct mcpm_platform_ops *ops) 44int __init mcpm_platform_register(const struct mcpm_platform_ops *ops)
@@ -51,7 +63,8 @@ void mcpm_cpu_power_down(void)
51{ 63{
52 phys_reset_t phys_reset; 64 phys_reset_t phys_reset;
53 65
54 BUG_ON(!platform_ops); 66 if (WARN_ON_ONCE(!platform_ops || !platform_ops->power_down))
67 return;
55 BUG_ON(!irqs_disabled()); 68 BUG_ON(!irqs_disabled());
56 69
57 /* 70 /*
@@ -89,11 +102,27 @@ void mcpm_cpu_power_down(void)
89 BUG(); 102 BUG();
90} 103}
91 104
105int mcpm_cpu_power_down_finish(unsigned int cpu, unsigned int cluster)
106{
107 int ret;
108
109 if (WARN_ON_ONCE(!platform_ops || !platform_ops->power_down_finish))
110 return -EUNATCH;
111
112 ret = platform_ops->power_down_finish(cpu, cluster);
113 if (ret)
114 pr_warn("%s: cpu %u, cluster %u failed to power down (%d)\n",
115 __func__, cpu, cluster, ret);
116
117 return ret;
118}
119
92void mcpm_cpu_suspend(u64 expected_residency) 120void mcpm_cpu_suspend(u64 expected_residency)
93{ 121{
94 phys_reset_t phys_reset; 122 phys_reset_t phys_reset;
95 123
96 BUG_ON(!platform_ops); 124 if (WARN_ON_ONCE(!platform_ops || !platform_ops->suspend))
125 return;
97 BUG_ON(!irqs_disabled()); 126 BUG_ON(!irqs_disabled());
98 127
99 /* Very similar to mcpm_cpu_power_down() */ 128 /* Very similar to mcpm_cpu_power_down() */
diff --git a/arch/arm/common/mcpm_head.S b/arch/arm/common/mcpm_head.S
index 39c96df3477a..e02db4b81a66 100644
--- a/arch/arm/common/mcpm_head.S
+++ b/arch/arm/common/mcpm_head.S
@@ -15,6 +15,7 @@
15 15
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <asm/mcpm.h> 17#include <asm/mcpm.h>
18#include <asm/assembler.h>
18 19
19#include "vlock.h" 20#include "vlock.h"
20 21
@@ -47,6 +48,7 @@
47 48
48ENTRY(mcpm_entry_point) 49ENTRY(mcpm_entry_point)
49 50
51 ARM_BE8(setend be)
50 THUMB( adr r12, BSYM(1f) ) 52 THUMB( adr r12, BSYM(1f) )
51 THUMB( bx r12 ) 53 THUMB( bx r12 )
52 THUMB( .thumb ) 54 THUMB( .thumb )
@@ -71,12 +73,19 @@ ENTRY(mcpm_entry_point)
71 * position independent way. 73 * position independent way.
72 */ 74 */
73 adr r5, 3f 75 adr r5, 3f
74 ldmia r5, {r6, r7, r8, r11} 76 ldmia r5, {r0, r6, r7, r8, r11}
77 add r0, r5, r0 @ r0 = mcpm_entry_early_pokes
75 add r6, r5, r6 @ r6 = mcpm_entry_vectors 78 add r6, r5, r6 @ r6 = mcpm_entry_vectors
76 ldr r7, [r5, r7] @ r7 = mcpm_power_up_setup_phys 79 ldr r7, [r5, r7] @ r7 = mcpm_power_up_setup_phys
77 add r8, r5, r8 @ r8 = mcpm_sync 80 add r8, r5, r8 @ r8 = mcpm_sync
78 add r11, r5, r11 @ r11 = first_man_locks 81 add r11, r5, r11 @ r11 = first_man_locks
79 82
83 @ Perform an early poke, if any
84 add r0, r0, r4, lsl #3
85 ldmia r0, {r0, r1}
86 teq r0, #0
87 strne r1, [r0]
88
80 mov r0, #MCPM_SYNC_CLUSTER_SIZE 89 mov r0, #MCPM_SYNC_CLUSTER_SIZE
81 mla r8, r0, r10, r8 @ r8 = sync cluster base 90 mla r8, r0, r10, r8 @ r8 = sync cluster base
82 91
@@ -195,7 +204,8 @@ mcpm_entry_gated:
195 204
196 .align 2 205 .align 2
197 206
1983: .word mcpm_entry_vectors - . 2073: .word mcpm_entry_early_pokes - .
208 .word mcpm_entry_vectors - 3b
199 .word mcpm_power_up_setup_phys - 3b 209 .word mcpm_power_up_setup_phys - 3b
200 .word mcpm_sync - 3b 210 .word mcpm_sync - 3b
201 .word first_man_locks - 3b 211 .word first_man_locks - 3b
@@ -214,6 +224,10 @@ first_man_locks:
214ENTRY(mcpm_entry_vectors) 224ENTRY(mcpm_entry_vectors)
215 .space 4 * MAX_NR_CLUSTERS * MAX_CPUS_PER_CLUSTER 225 .space 4 * MAX_NR_CLUSTERS * MAX_CPUS_PER_CLUSTER
216 226
227 .type mcpm_entry_early_pokes, #object
228ENTRY(mcpm_entry_early_pokes)
229 .space 8 * MAX_NR_CLUSTERS * MAX_CPUS_PER_CLUSTER
230
217 .type mcpm_power_up_setup_phys, #object 231 .type mcpm_power_up_setup_phys, #object
218ENTRY(mcpm_power_up_setup_phys) 232ENTRY(mcpm_power_up_setup_phys)
219 .space 4 @ set by mcpm_sync_init() 233 .space 4 @ set by mcpm_sync_init()
diff --git a/arch/arm/common/mcpm_platsmp.c b/arch/arm/common/mcpm_platsmp.c
index 1bc34c7567fd..177251a4dd9a 100644
--- a/arch/arm/common/mcpm_platsmp.c
+++ b/arch/arm/common/mcpm_platsmp.c
@@ -19,14 +19,23 @@
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 cpu_to_pcpu(unsigned int cpu,
23 unsigned int *pcpu, unsigned int *pcluster)
24{
25 unsigned int mpidr;
26
27 mpidr = cpu_logical_map(cpu);
28 *pcpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
29 *pcluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
30}
31
22static int mcpm_boot_secondary(unsigned int cpu, struct task_struct *idle) 32static int mcpm_boot_secondary(unsigned int cpu, struct task_struct *idle)
23{ 33{
24 unsigned int mpidr, pcpu, pcluster, ret; 34 unsigned int pcpu, pcluster, ret;
25 extern void secondary_startup(void); 35 extern void secondary_startup(void);
26 36
27 mpidr = cpu_logical_map(cpu); 37 cpu_to_pcpu(cpu, &pcpu, &pcluster);
28 pcpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); 38
29 pcluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
30 pr_debug("%s: logical CPU %d is physical CPU %d cluster %d\n", 39 pr_debug("%s: logical CPU %d is physical CPU %d cluster %d\n",
31 __func__, cpu, pcpu, pcluster); 40 __func__, cpu, pcpu, pcluster);
32 41
@@ -47,6 +56,15 @@ static void mcpm_secondary_init(unsigned int cpu)
47 56
48#ifdef CONFIG_HOTPLUG_CPU 57#ifdef CONFIG_HOTPLUG_CPU
49 58
59static int mcpm_cpu_kill(unsigned int cpu)
60{
61 unsigned int pcpu, pcluster;
62
63 cpu_to_pcpu(cpu, &pcpu, &pcluster);
64
65 return !mcpm_cpu_power_down_finish(pcpu, pcluster);
66}
67
50static int mcpm_cpu_disable(unsigned int cpu) 68static int mcpm_cpu_disable(unsigned int cpu)
51{ 69{
52 /* 70 /*
@@ -73,6 +91,7 @@ static struct smp_operations __initdata mcpm_smp_ops = {
73 .smp_boot_secondary = mcpm_boot_secondary, 91 .smp_boot_secondary = mcpm_boot_secondary,
74 .smp_secondary_init = mcpm_secondary_init, 92 .smp_secondary_init = mcpm_secondary_init,
75#ifdef CONFIG_HOTPLUG_CPU 93#ifdef CONFIG_HOTPLUG_CPU
94 .cpu_kill = mcpm_cpu_kill,
76 .cpu_disable = mcpm_cpu_disable, 95 .cpu_disable = mcpm_cpu_disable,
77 .cpu_die = mcpm_cpu_die, 96 .cpu_die = mcpm_cpu_die,
78#endif 97#endif
diff --git a/arch/arm/common/sharpsl_param.c b/arch/arm/common/sharpsl_param.c
index d56c932580eb..025f6ce38596 100644
--- a/arch/arm/common/sharpsl_param.c
+++ b/arch/arm/common/sharpsl_param.c
@@ -15,6 +15,7 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <asm/mach/sharpsl_param.h> 17#include <asm/mach/sharpsl_param.h>
18#include <asm/memory.h>
18 19
19/* 20/*
20 * Certain hardware parameters determined at the time of device manufacture, 21 * Certain hardware parameters determined at the time of device manufacture,
@@ -25,8 +26,10 @@
25 */ 26 */
26#ifdef CONFIG_ARCH_SA1100 27#ifdef CONFIG_ARCH_SA1100
27#define PARAM_BASE 0xe8ffc000 28#define PARAM_BASE 0xe8ffc000
29#define param_start(x) (void *)(x)
28#else 30#else
29#define PARAM_BASE 0xa0000a00 31#define PARAM_BASE 0xa0000a00
32#define param_start(x) __va(x)
30#endif 33#endif
31#define MAGIC_CHG(a,b,c,d) ( ( d << 24 ) | ( c << 16 ) | ( b << 8 ) | a ) 34#define MAGIC_CHG(a,b,c,d) ( ( d << 24 ) | ( c << 16 ) | ( b << 8 ) | a )
32 35
@@ -41,7 +44,7 @@ EXPORT_SYMBOL(sharpsl_param);
41 44
42void sharpsl_save_param(void) 45void sharpsl_save_param(void)
43{ 46{
44 memcpy(&sharpsl_param, (void *)PARAM_BASE, sizeof(struct sharpsl_param_info)); 47 memcpy(&sharpsl_param, param_start(PARAM_BASE), sizeof(struct sharpsl_param_info));
45 48
46 if (sharpsl_param.comadj_keyword != COMADJ_MAGIC) 49 if (sharpsl_param.comadj_keyword != COMADJ_MAGIC)
47 sharpsl_param.comadj=-1; 50 sharpsl_param.comadj=-1;
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index e901d0f3e0bb..ce922d0ea7aa 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -175,7 +175,7 @@ static struct clock_event_device sp804_clockevent = {
175 175
176static struct irqaction sp804_timer_irq = { 176static struct irqaction sp804_timer_irq = {
177 .name = "timer", 177 .name = "timer",
178 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 178 .flags = IRQF_TIMER | IRQF_IRQPOLL,
179 .handler = sp804_timer_interrupt, 179 .handler = sp804_timer_interrupt,
180 .dev_id = &sp804_clockevent, 180 .dev_id = &sp804_clockevent,
181}; 181};
diff --git a/arch/arm/common/via82c505.c b/arch/arm/common/via82c505.c
deleted file mode 100644
index 6cb362e56d29..000000000000
--- a/arch/arm/common/via82c505.c
+++ /dev/null
@@ -1,83 +0,0 @@
1#include <linux/kernel.h>
2#include <linux/pci.h>
3#include <linux/interrupt.h>
4#include <linux/mm.h>
5#include <linux/init.h>
6#include <linux/ioport.h>
7#include <linux/io.h>
8
9
10#include <asm/mach/pci.h>
11
12#define MAX_SLOTS 7
13
14#define CONFIG_CMD(bus, devfn, where) (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3))
15
16static int
17via82c505_read_config(struct pci_bus *bus, unsigned int devfn, int where,
18 int size, u32 *value)
19{
20 outl(CONFIG_CMD(bus,devfn,where),0xCF8);
21 switch (size) {
22 case 1:
23 *value=inb(0xCFC + (where&3));
24 break;
25 case 2:
26 *value=inw(0xCFC + (where&2));
27 break;
28 case 4:
29 *value=inl(0xCFC);
30 break;
31 }
32 return PCIBIOS_SUCCESSFUL;
33}
34
35static int
36via82c505_write_config(struct pci_bus *bus, unsigned int devfn, int where,
37 int size, u32 value)
38{
39 outl(CONFIG_CMD(bus,devfn,where),0xCF8);
40 switch (size) {
41 case 1:
42 outb(value, 0xCFC + (where&3));
43 break;
44 case 2:
45 outw(value, 0xCFC + (where&2));
46 break;
47 case 4:
48 outl(value, 0xCFC);
49 break;
50 }
51 return PCIBIOS_SUCCESSFUL;
52}
53
54struct pci_ops via82c505_ops = {
55 .read = via82c505_read_config,
56 .write = via82c505_write_config,
57};
58
59void __init via82c505_preinit(void)
60{
61 printk(KERN_DEBUG "PCI: VIA 82c505\n");
62 if (!request_region(0xA8,2,"via config")) {
63 printk(KERN_WARNING"VIA 82c505: Unable to request region 0xA8\n");
64 return;
65 }
66 if (!request_region(0xCF8,8,"pci config")) {
67 printk(KERN_WARNING"VIA 82c505: Unable to request region 0xCF8\n");
68 release_region(0xA8, 2);
69 return;
70 }
71
72 /* Enable compatible Mode */
73 outb(0x96,0xA8);
74 outb(0x18,0xA9);
75 outb(0x93,0xA8);
76 outb(0xd0,0xA9);
77
78}
79
80int __init via82c505_setup(int nr, struct pci_sys_data *sys)
81{
82 return (nr == 0);
83}
diff --git a/arch/arm/configs/bcm_defconfig b/arch/arm/configs/bcm_defconfig
index 6e4931097dd4..287ac1d7aac7 100644
--- a/arch/arm/configs/bcm_defconfig
+++ b/arch/arm/configs/bcm_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,10 +24,9 @@ CONFIG_MODULES=y
25CONFIG_MODULE_UNLOAD=y 24CONFIG_MODULE_UNLOAD=y
26# CONFIG_BLK_DEV_BSG is not set 25# CONFIG_BLK_DEV_BSG is not set
27CONFIG_PARTITION_ADVANCED=y 26CONFIG_PARTITION_ADVANCED=y
28CONFIG_EFI_PARTITION=y
29CONFIG_ARCH_BCM=y 27CONFIG_ARCH_BCM=y
28CONFIG_ARCH_BCM_MOBILE=y
30CONFIG_ARM_THUMBEE=y 29CONFIG_ARM_THUMBEE=y
31CONFIG_ARM_ERRATA_743622=y
32CONFIG_PREEMPT=y 30CONFIG_PREEMPT=y
33CONFIG_AEABI=y 31CONFIG_AEABI=y
34# CONFIG_OABI_COMPAT is not set 32# CONFIG_OABI_COMPAT is not set
@@ -50,7 +48,6 @@ CONFIG_UNIX_DIAG=y
50CONFIG_NET_KEY=y 48CONFIG_NET_KEY=y
51CONFIG_INET=y 49CONFIG_INET=y
52CONFIG_IP_MULTICAST=y 50CONFIG_IP_MULTICAST=y
53CONFIG_ARPD=y
54CONFIG_SYN_COOKIES=y 51CONFIG_SYN_COOKIES=y
55CONFIG_TCP_MD5SIG=y 52CONFIG_TCP_MD5SIG=y
56CONFIG_IPV6=y 53CONFIG_IPV6=y
@@ -95,7 +92,6 @@ CONFIG_MMC_UNSAFE_RESUME=y
95CONFIG_MMC_BLOCK_MINORS=32 92CONFIG_MMC_BLOCK_MINORS=32
96CONFIG_MMC_TEST=y 93CONFIG_MMC_TEST=y
97CONFIG_MMC_SDHCI=y 94CONFIG_MMC_SDHCI=y
98CONFIG_MMC_SDHCI_PLTFM=y
99CONFIG_MMC_SDHCI_BCM_KONA=y 95CONFIG_MMC_SDHCI_BCM_KONA=y
100CONFIG_NEW_LEDS=y 96CONFIG_NEW_LEDS=y
101CONFIG_LEDS_CLASS=y 97CONFIG_LEDS_CLASS=y
@@ -117,12 +113,12 @@ CONFIG_CONFIGFS_FS=y
117CONFIG_NLS_CODEPAGE_437=y 113CONFIG_NLS_CODEPAGE_437=y
118CONFIG_NLS_ISO8859_1=y 114CONFIG_NLS_ISO8859_1=y
119CONFIG_PRINTK_TIME=y 115CONFIG_PRINTK_TIME=y
120CONFIG_MAGIC_SYSRQ=y 116CONFIG_DEBUG_INFO=y
121CONFIG_DEBUG_FS=y 117CONFIG_DEBUG_FS=y
118CONFIG_MAGIC_SYSRQ=y
122CONFIG_DETECT_HUNG_TASK=y 119CONFIG_DETECT_HUNG_TASK=y
123CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=110 120CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=110
124CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y 121CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y
125CONFIG_DEBUG_INFO=y
126# CONFIG_FTRACE is not set 122# CONFIG_FTRACE is not set
127CONFIG_CRC_CCITT=y 123CONFIG_CRC_CCITT=y
128CONFIG_CRC_T10DIF=y 124CONFIG_CRC_T10DIF=y
diff --git a/arch/arm/configs/bockw_defconfig b/arch/arm/configs/bockw_defconfig
index e7e94948d194..b38cd107f82d 100644
--- a/arch/arm/configs/bockw_defconfig
+++ b/arch/arm/configs/bockw_defconfig
@@ -91,6 +91,10 @@ CONFIG_VIDEO_RCAR_VIN=y
91CONFIG_VIDEO_ML86V7667=y 91CONFIG_VIDEO_ML86V7667=y
92CONFIG_SPI=y 92CONFIG_SPI=y
93CONFIG_SPI_SH_HSPI=y 93CONFIG_SPI_SH_HSPI=y
94CONFIG_SOUND=y
95CONFIG_SND=y
96CONFIG_SND_SOC=y
97CONFIG_SND_SOC_RCAR=y
94CONFIG_USB=y 98CONFIG_USB=y
95CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 99CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
96CONFIG_USB_EHCI_HCD=y 100CONFIG_USB_EHCI_HCD=y
diff --git a/arch/arm/configs/ep93xx_defconfig b/arch/arm/configs/ep93xx_defconfig
index 806005a4c4c1..6ac5ea73bd0a 100644
--- a/arch/arm/configs/ep93xx_defconfig
+++ b/arch/arm/configs/ep93xx_defconfig
@@ -1,15 +1,14 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y 2CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 3CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_EXPERT=y 5CONFIG_EXPERT=y
8CONFIG_SLAB=y 6CONFIG_SLAB=y
9CONFIG_MODULES=y 7CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 8CONFIG_MODULE_UNLOAD=y
11CONFIG_MODULE_FORCE_UNLOAD=y 9CONFIG_MODULE_FORCE_UNLOAD=y
12# CONFIG_BLK_DEV_BSG is not set 10# CONFIG_BLK_DEV_BSG is not set
11CONFIG_PARTITION_ADVANCED=y
13# CONFIG_IOSCHED_CFQ is not set 12# CONFIG_IOSCHED_CFQ is not set
14CONFIG_ARCH_EP93XX=y 13CONFIG_ARCH_EP93XX=y
15CONFIG_CRUNCH=y 14CONFIG_CRUNCH=y
@@ -47,11 +46,8 @@ CONFIG_IPV6=y
47CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 46CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
48# CONFIG_FW_LOADER is not set 47# CONFIG_FW_LOADER is not set
49CONFIG_MTD=y 48CONFIG_MTD=y
50CONFIG_MTD_CONCAT=y
51CONFIG_MTD_PARTITIONS=y
52CONFIG_MTD_REDBOOT_PARTS=y 49CONFIG_MTD_REDBOOT_PARTS=y
53CONFIG_MTD_CMDLINE_PARTS=y 50CONFIG_MTD_CMDLINE_PARTS=y
54CONFIG_MTD_CHAR=y
55CONFIG_MTD_BLOCK=y 51CONFIG_MTD_BLOCK=y
56CONFIG_MTD_CFI=y 52CONFIG_MTD_CFI=y
57CONFIG_MTD_CFI_ADV_OPTIONS=y 53CONFIG_MTD_CFI_ADV_OPTIONS=y
@@ -67,15 +63,14 @@ CONFIG_SCSI=y
67# CONFIG_SCSI_PROC_FS is not set 63# CONFIG_SCSI_PROC_FS is not set
68CONFIG_BLK_DEV_SD=y 64CONFIG_BLK_DEV_SD=y
69CONFIG_NETDEVICES=y 65CONFIG_NETDEVICES=y
70CONFIG_NET_ETHERNET=y
71CONFIG_EP93XX_ETH=y 66CONFIG_EP93XX_ETH=y
72CONFIG_USB_RTL8150=y 67CONFIG_USB_RTL8150=y
73# CONFIG_INPUT is not set 68# CONFIG_INPUT is not set
74# CONFIG_SERIO is not set 69# CONFIG_SERIO is not set
75# CONFIG_VT is not set 70# CONFIG_VT is not set
71# CONFIG_LEGACY_PTYS is not set
76CONFIG_SERIAL_AMBA_PL010=y 72CONFIG_SERIAL_AMBA_PL010=y
77CONFIG_SERIAL_AMBA_PL010_CONSOLE=y 73CONFIG_SERIAL_AMBA_PL010_CONSOLE=y
78# CONFIG_LEGACY_PTYS is not set
79# CONFIG_HW_RANDOM is not set 74# CONFIG_HW_RANDOM is not set
80CONFIG_I2C=y 75CONFIG_I2C=y
81CONFIG_I2C_CHARDEV=y 76CONFIG_I2C_CHARDEV=y
@@ -86,9 +81,9 @@ CONFIG_WATCHDOG=y
86CONFIG_EP93XX_WATCHDOG=y 81CONFIG_EP93XX_WATCHDOG=y
87CONFIG_USB=y 82CONFIG_USB=y
88CONFIG_USB_DEBUG=y 83CONFIG_USB_DEBUG=y
89CONFIG_USB_DEVICEFS=y
90CONFIG_USB_DYNAMIC_MINORS=y 84CONFIG_USB_DYNAMIC_MINORS=y
91CONFIG_USB_OHCI_HCD=y 85CONFIG_USB_OHCI_HCD=y
86CONFIG_USB_OHCI_HCD_PLATFORM=y
92CONFIG_USB_STORAGE=y 87CONFIG_USB_STORAGE=y
93CONFIG_USB_SERIAL=y 88CONFIG_USB_SERIAL=y
94CONFIG_USB_SERIAL_CONSOLE=y 89CONFIG_USB_SERIAL_CONSOLE=y
@@ -100,24 +95,18 @@ CONFIG_RTC_DRV_EP93XX=y
100CONFIG_EXT2_FS=y 95CONFIG_EXT2_FS=y
101CONFIG_EXT3_FS=y 96CONFIG_EXT3_FS=y
102# CONFIG_EXT3_FS_XATTR is not set 97# CONFIG_EXT3_FS_XATTR is not set
103CONFIG_INOTIFY=y
104CONFIG_VFAT_FS=y 98CONFIG_VFAT_FS=y
105CONFIG_TMPFS=y 99CONFIG_TMPFS=y
106CONFIG_JFFS2_FS=y 100CONFIG_JFFS2_FS=y
107CONFIG_NFS_FS=y 101CONFIG_NFS_FS=y
108CONFIG_NFS_V3=y
109CONFIG_ROOT_NFS=y 102CONFIG_ROOT_NFS=y
110CONFIG_PARTITION_ADVANCED=y
111CONFIG_NLS_CODEPAGE_437=y 103CONFIG_NLS_CODEPAGE_437=y
112CONFIG_NLS_ISO8859_1=y 104CONFIG_NLS_ISO8859_1=y
113CONFIG_MAGIC_SYSRQ=y 105CONFIG_MAGIC_SYSRQ=y
114CONFIG_DEBUG_KERNEL=y
115CONFIG_DEBUG_SLAB=y 106CONFIG_DEBUG_SLAB=y
116CONFIG_DEBUG_SPINLOCK=y 107CONFIG_DEBUG_SPINLOCK=y
117CONFIG_DEBUG_MUTEXES=y 108CONFIG_DEBUG_MUTEXES=y
118# CONFIG_RCU_CPU_STALL_DETECTOR is not set
119CONFIG_DEBUG_USER=y 109CONFIG_DEBUG_USER=y
120CONFIG_DEBUG_ERRORS=y
121CONFIG_DEBUG_LL=y 110CONFIG_DEBUG_LL=y
122# CONFIG_CRYPTO_ANSI_CPRNG is not set 111# CONFIG_CRYPTO_ANSI_CPRNG is not set
123CONFIG_LIBCRC32C=y 112CONFIG_LIBCRC32C=y
diff --git a/arch/arm/configs/h3600_defconfig b/arch/arm/configs/h3600_defconfig
index 317960f12488..0142ec37e0be 100644
--- a/arch/arm/configs/h3600_defconfig
+++ b/arch/arm/configs/h3600_defconfig
@@ -1,5 +1,6 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
2CONFIG_NO_HZ_IDLE=y
3CONFIG_HIGH_RES_TIMERS=y
3CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
5CONFIG_MODULES=y 6CONFIG_MODULES=y
@@ -11,11 +12,11 @@ CONFIG_ARCH_SA1100=y
11CONFIG_SA1100_H3600=y 12CONFIG_SA1100_H3600=y
12CONFIG_PCCARD=y 13CONFIG_PCCARD=y
13CONFIG_PCMCIA_SA1100=y 14CONFIG_PCMCIA_SA1100=y
15CONFIG_PREEMPT=y
14CONFIG_ZBOOT_ROM_TEXT=0x0 16CONFIG_ZBOOT_ROM_TEXT=0x0
15CONFIG_ZBOOT_ROM_BSS=0x0 17CONFIG_ZBOOT_ROM_BSS=0x0
16# CONFIG_CPU_FREQ_STAT is not set 18# CONFIG_CPU_FREQ_STAT is not set
17CONFIG_FPE_NWFPE=y 19CONFIG_FPE_NWFPE=y
18CONFIG_PM=y
19CONFIG_NET=y 20CONFIG_NET=y
20CONFIG_UNIX=y 21CONFIG_UNIX=y
21CONFIG_INET=y 22CONFIG_INET=y
@@ -24,13 +25,10 @@ CONFIG_IRDA=m
24CONFIG_IRLAN=m 25CONFIG_IRLAN=m
25CONFIG_IRNET=m 26CONFIG_IRNET=m
26CONFIG_IRCOMM=m 27CONFIG_IRCOMM=m
27CONFIG_SA1100_FIR=m
28# CONFIG_WIRELESS is not set 28# CONFIG_WIRELESS is not set
29CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 29CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
30CONFIG_MTD=y 30CONFIG_MTD=y
31CONFIG_MTD_PARTITIONS=y
32CONFIG_MTD_REDBOOT_PARTS=y 31CONFIG_MTD_REDBOOT_PARTS=y
33CONFIG_MTD_CHAR=y
34CONFIG_MTD_BLOCK=y 32CONFIG_MTD_BLOCK=y
35CONFIG_MTD_CFI=y 33CONFIG_MTD_CFI=y
36CONFIG_MTD_CFI_ADV_OPTIONS=y 34CONFIG_MTD_CFI_ADV_OPTIONS=y
@@ -41,19 +39,15 @@ CONFIG_MTD_SA1100=y
41CONFIG_BLK_DEV_LOOP=m 39CONFIG_BLK_DEV_LOOP=m
42CONFIG_BLK_DEV_RAM=y 40CONFIG_BLK_DEV_RAM=y
43CONFIG_BLK_DEV_RAM_SIZE=8192 41CONFIG_BLK_DEV_RAM_SIZE=8192
44# CONFIG_MISC_DEVICES is not set
45CONFIG_IDE=y 42CONFIG_IDE=y
46CONFIG_BLK_DEV_IDECS=y 43CONFIG_BLK_DEV_IDECS=y
47CONFIG_NETDEVICES=y 44CONFIG_NETDEVICES=y
48# CONFIG_NETDEV_1000 is not set
49# CONFIG_NETDEV_10000 is not set
50# CONFIG_WLAN is not set
51CONFIG_NET_PCMCIA=y
52CONFIG_PCMCIA_PCNET=y 45CONFIG_PCMCIA_PCNET=y
53CONFIG_PPP=m 46CONFIG_PPP=m
54CONFIG_PPP_ASYNC=m
55CONFIG_PPP_DEFLATE=m
56CONFIG_PPP_BSDCOMP=m 47CONFIG_PPP_BSDCOMP=m
48CONFIG_PPP_DEFLATE=m
49CONFIG_PPP_ASYNC=m
50# CONFIG_WLAN is not set
57# CONFIG_KEYBOARD_ATKBD is not set 51# CONFIG_KEYBOARD_ATKBD is not set
58CONFIG_KEYBOARD_GPIO=y 52CONFIG_KEYBOARD_GPIO=y
59# CONFIG_INPUT_MOUSE is not set 53# CONFIG_INPUT_MOUSE is not set
@@ -64,8 +58,6 @@ CONFIG_SERIAL_SA1100_CONSOLE=y
64# CONFIG_HWMON is not set 58# CONFIG_HWMON is not set
65CONFIG_FB=y 59CONFIG_FB=y
66CONFIG_FB_SA1100=y 60CONFIG_FB_SA1100=y
67# CONFIG_VGA_CONSOLE is not set
68# CONFIG_HID_SUPPORT is not set
69# CONFIG_USB_SUPPORT is not set 61# CONFIG_USB_SUPPORT is not set
70CONFIG_EXT2_FS=y 62CONFIG_EXT2_FS=y
71CONFIG_MSDOS_FS=m 63CONFIG_MSDOS_FS=m
@@ -74,6 +66,4 @@ CONFIG_JFFS2_FS=y
74CONFIG_CRAMFS=m 66CONFIG_CRAMFS=m
75CONFIG_NFS_FS=y 67CONFIG_NFS_FS=y
76CONFIG_NFSD=m 68CONFIG_NFSD=m
77CONFIG_SMB_FS=m
78CONFIG_NLS=y 69CONFIG_NLS=y
79# CONFIG_RCU_CPU_STALL_DETECTOR is not set
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 5d488c24b132..8d0c5a018ed7 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -132,7 +132,6 @@ CONFIG_TOUCHSCREEN_MC13783=y
132CONFIG_INPUT_MISC=y 132CONFIG_INPUT_MISC=y
133CONFIG_INPUT_MMA8450=y 133CONFIG_INPUT_MMA8450=y
134CONFIG_SERIO_SERPORT=m 134CONFIG_SERIO_SERPORT=m
135CONFIG_VT_HW_CONSOLE_BINDING=y
136# CONFIG_LEGACY_PTYS is not set 135# CONFIG_LEGACY_PTYS is not set
137# CONFIG_DEVKMEM is not set 136# CONFIG_DEVKMEM is not set
138CONFIG_SERIAL_IMX=y 137CONFIG_SERIAL_IMX=y
@@ -188,22 +187,33 @@ CONFIG_SND_SOC_PHYCORE_AC97=y
188CONFIG_SND_SOC_EUKREA_TLV320=y 187CONFIG_SND_SOC_EUKREA_TLV320=y
189CONFIG_SND_SOC_IMX_WM8962=y 188CONFIG_SND_SOC_IMX_WM8962=y
190CONFIG_SND_SOC_IMX_SGTL5000=y 189CONFIG_SND_SOC_IMX_SGTL5000=y
190CONFIG_SND_SOC_IMX_SPDIF=y
191CONFIG_SND_SOC_IMX_MC13783=y 191CONFIG_SND_SOC_IMX_MC13783=y
192CONFIG_USB=y 192CONFIG_USB=y
193CONFIG_USB_EHCI_HCD=y 193CONFIG_USB_EHCI_HCD=y
194CONFIG_USB_EHCI_MXC=y 194CONFIG_USB_EHCI_MXC=y
195CONFIG_USB_STORAGE=y 195CONFIG_USB_STORAGE=y
196CONFIG_USB_CHIPIDEA=y 196CONFIG_USB_CHIPIDEA=y
197CONFIG_USB_CHIPIDEA_UDC=y
197CONFIG_USB_CHIPIDEA_HOST=y 198CONFIG_USB_CHIPIDEA_HOST=y
198CONFIG_USB_PHY=y
199CONFIG_NOP_USB_XCEIV=y 199CONFIG_NOP_USB_XCEIV=y
200CONFIG_USB_MXS_PHY=y 200CONFIG_USB_MXS_PHY=y
201CONFIG_USB_GADGET=y
202CONFIG_USB_ETH=m
203CONFIG_USB_MASS_STORAGE=m
201CONFIG_MMC=y 204CONFIG_MMC=y
202CONFIG_MMC_SDHCI=y 205CONFIG_MMC_SDHCI=y
203CONFIG_MMC_SDHCI_PLTFM=y 206CONFIG_MMC_SDHCI_PLTFM=y
204CONFIG_MMC_SDHCI_ESDHC_IMX=y 207CONFIG_MMC_SDHCI_ESDHC_IMX=y
205CONFIG_NEW_LEDS=y 208CONFIG_NEW_LEDS=y
206CONFIG_LEDS_CLASS=y 209CONFIG_LEDS_CLASS=y
210CONFIG_LEDS_GPIO=y
211CONFIG_LEDS_TRIGGERS=y
212CONFIG_LEDS_TRIGGER_TIMER=y
213CONFIG_LEDS_TRIGGER_ONESHOT=y
214CONFIG_LEDS_TRIGGER_HEARTBEAT=y
215CONFIG_LEDS_TRIGGER_BACKLIGHT=y
216CONFIG_LEDS_TRIGGER_GPIO=y
207CONFIG_RTC_CLASS=y 217CONFIG_RTC_CLASS=y
208CONFIG_RTC_INTF_DEV_UIE_EMUL=y 218CONFIG_RTC_INTF_DEV_UIE_EMUL=y
209CONFIG_RTC_DRV_MC13XXX=y 219CONFIG_RTC_DRV_MC13XXX=y
@@ -246,7 +256,6 @@ CONFIG_UDF_FS=m
246CONFIG_MSDOS_FS=m 256CONFIG_MSDOS_FS=m
247CONFIG_VFAT_FS=y 257CONFIG_VFAT_FS=y
248CONFIG_TMPFS=y 258CONFIG_TMPFS=y
249CONFIG_CONFIGFS_FS=m
250CONFIG_JFFS2_FS=y 259CONFIG_JFFS2_FS=y
251CONFIG_UBIFS_FS=y 260CONFIG_UBIFS_FS=y
252CONFIG_NFS_FS=y 261CONFIG_NFS_FS=y
@@ -261,6 +270,7 @@ CONFIG_NLS_ISO8859_15=m
261CONFIG_NLS_UTF8=y 270CONFIG_NLS_UTF8=y
262CONFIG_MAGIC_SYSRQ=y 271CONFIG_MAGIC_SYSRQ=y
263# CONFIG_SCHED_DEBUG is not set 272# CONFIG_SCHED_DEBUG is not set
273CONFIG_PROVE_LOCKING=y
264# CONFIG_DEBUG_BUGVERBOSE is not set 274# CONFIG_DEBUG_BUGVERBOSE is not set
265# CONFIG_FTRACE is not set 275# CONFIG_FTRACE is not set
266# CONFIG_ARM_UNWIND is not set 276# CONFIG_ARM_UNWIND is not set
diff --git a/arch/arm/configs/integrator_defconfig b/arch/arm/configs/integrator_defconfig
index a8314c3ee84d..5bae19557591 100644
--- a/arch/arm/configs/integrator_defconfig
+++ b/arch/arm/configs/integrator_defconfig
@@ -1,15 +1,17 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
3CONFIG_TINY_RCU=y 2CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y
4CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
5CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
10CONFIG_PARTITION_ADVANCED=y
10CONFIG_ARCH_INTEGRATOR=y 11CONFIG_ARCH_INTEGRATOR=y
11CONFIG_ARCH_INTEGRATOR_AP=y 12CONFIG_ARCH_INTEGRATOR_AP=y
12CONFIG_ARCH_INTEGRATOR_CP=y 13CONFIG_ARCH_INTEGRATOR_CP=y
14CONFIG_INTEGRATOR_IMPD1=y
13CONFIG_CPU_ARM720T=y 15CONFIG_CPU_ARM720T=y
14CONFIG_CPU_ARM920T=y 16CONFIG_CPU_ARM920T=y
15CONFIG_CPU_ARM922T=y 17CONFIG_CPU_ARM922T=y
@@ -18,12 +20,9 @@ CONFIG_CPU_ARM1020=y
18CONFIG_CPU_ARM1022=y 20CONFIG_CPU_ARM1022=y
19CONFIG_CPU_ARM1026=y 21CONFIG_CPU_ARM1026=y
20CONFIG_PCI=y 22CONFIG_PCI=y
21CONFIG_NO_HZ=y
22CONFIG_HIGH_RES_TIMERS=y
23CONFIG_PREEMPT=y 23CONFIG_PREEMPT=y
24CONFIG_AEABI=y 24CONFIG_AEABI=y
25CONFIG_LEDS=y 25# CONFIG_ATAGS is not set
26CONFIG_LEDS_CPU=y
27CONFIG_ZBOOT_ROM_TEXT=0x0 26CONFIG_ZBOOT_ROM_TEXT=0x0
28CONFIG_ZBOOT_ROM_BSS=0x0 27CONFIG_ZBOOT_ROM_BSS=0x0
29CONFIG_CMDLINE="console=ttyAM0,38400n8 root=/dev/nfs ip=bootp" 28CONFIG_CMDLINE="console=ttyAM0,38400n8 root=/dev/nfs ip=bootp"
@@ -44,24 +43,20 @@ CONFIG_IP_PNP_BOOTP=y
44CONFIG_MTD=y 43CONFIG_MTD=y
45CONFIG_MTD_CMDLINE_PARTS=y 44CONFIG_MTD_CMDLINE_PARTS=y
46CONFIG_MTD_AFS_PARTS=y 45CONFIG_MTD_AFS_PARTS=y
47CONFIG_MTD_CHAR=y
48CONFIG_MTD_BLOCK=y 46CONFIG_MTD_BLOCK=y
49CONFIG_MTD_CFI=y 47CONFIG_MTD_CFI=y
50CONFIG_MTD_CFI_ADV_OPTIONS=y 48CONFIG_MTD_CFI_ADV_OPTIONS=y
51CONFIG_MTD_CFI_INTELEXT=y 49CONFIG_MTD_CFI_INTELEXT=y
52CONFIG_MTD_PHYSMAP=y 50CONFIG_MTD_PHYSMAP=y
51CONFIG_PROC_DEVICETREE=y
53CONFIG_BLK_DEV_LOOP=y 52CONFIG_BLK_DEV_LOOP=y
54CONFIG_BLK_DEV_RAM=y 53CONFIG_BLK_DEV_RAM=y
55CONFIG_BLK_DEV_RAM_SIZE=8192 54CONFIG_BLK_DEV_RAM_SIZE=8192
56CONFIG_NETDEVICES=y 55CONFIG_NETDEVICES=y
57CONFIG_NET_ETHERNET=y
58CONFIG_NET_PCI=y
59CONFIG_E100=y 56CONFIG_E100=y
60CONFIG_SMC91X=y 57CONFIG_SMC91X=y
61# CONFIG_KEYBOARD_ATKBD is not set 58# CONFIG_KEYBOARD_ATKBD is not set
62# CONFIG_SERIO_SERPORT is not set 59# CONFIG_SERIO_SERPORT is not set
63CONFIG_SERIAL_AMBA_PL010=y
64CONFIG_SERIAL_AMBA_PL010_CONSOLE=y
65CONFIG_FB=y 60CONFIG_FB=y
66CONFIG_FB_MODE_HELPERS=y 61CONFIG_FB_MODE_HELPERS=y
67CONFIG_FB_ARMCLCD=y 62CONFIG_FB_ARMCLCD=y
@@ -71,19 +66,23 @@ CONFIG_FB_MATROX_MYSTIQUE=y
71# CONFIG_VGA_CONSOLE is not set 66# CONFIG_VGA_CONSOLE is not set
72CONFIG_MMC=y 67CONFIG_MMC=y
73CONFIG_MMC_ARMMMCI=y 68CONFIG_MMC_ARMMMCI=y
69CONFIG_NEW_LEDS=y
70CONFIG_LEDS_CLASS=y
71CONFIG_LEDS_TRIGGERS=y
72CONFIG_LEDS_TRIGGER_HEARTBEAT=y
73CONFIG_LEDS_TRIGGER_CPU=y
74CONFIG_RTC_CLASS=y 74CONFIG_RTC_CLASS=y
75CONFIG_RTC_DRV_PL030=y 75CONFIG_RTC_DRV_PL030=y
76CONFIG_COMMON_CLK_DEBUG=y
76CONFIG_EXT2_FS=y 77CONFIG_EXT2_FS=y
77CONFIG_VFAT_FS=y 78CONFIG_VFAT_FS=y
78CONFIG_TMPFS=y 79CONFIG_TMPFS=y
79CONFIG_JFFS2_FS=y 80CONFIG_JFFS2_FS=y
80CONFIG_CRAMFS=y 81CONFIG_CRAMFS=y
81CONFIG_NFS_FS=y 82CONFIG_NFS_FS=y
82CONFIG_NFS_V3=y
83CONFIG_ROOT_NFS=y 83CONFIG_ROOT_NFS=y
84CONFIG_NFSD=y 84CONFIG_NFSD=y
85CONFIG_NFSD_V3=y 85CONFIG_NFSD_V3=y
86CONFIG_PARTITION_ADVANCED=y
87CONFIG_NLS_CODEPAGE_437=y 86CONFIG_NLS_CODEPAGE_437=y
88CONFIG_NLS_ISO8859_1=y 87CONFIG_NLS_ISO8859_1=y
89CONFIG_MAGIC_SYSRQ=y 88CONFIG_MAGIC_SYSRQ=y
diff --git a/arch/arm/configs/keystone_defconfig b/arch/arm/configs/keystone_defconfig
index 1f36b823905f..9943e5da74f1 100644
--- a/arch/arm/configs/keystone_defconfig
+++ b/arch/arm/configs/keystone_defconfig
@@ -123,7 +123,9 @@ CONFIG_SERIAL_OF_PLATFORM=y
123CONFIG_I2C=y 123CONFIG_I2C=y
124# CONFIG_I2C_COMPAT is not set 124# CONFIG_I2C_COMPAT is not set
125CONFIG_I2C_CHARDEV=y 125CONFIG_I2C_CHARDEV=y
126CONFIG_I2C_DAVINCI=y
126CONFIG_SPI=y 127CONFIG_SPI=y
128CONFIG_SPI_DAVINCI=y
127CONFIG_SPI_SPIDEV=y 129CONFIG_SPI_SPIDEV=y
128# CONFIG_HWMON is not set 130# CONFIG_HWMON is not set
129CONFIG_WATCHDOG=y 131CONFIG_WATCHDOG=y
diff --git a/arch/arm/configs/koelsch_defconfig b/arch/arm/configs/koelsch_defconfig
new file mode 100644
index 000000000000..825c16dee8a0
--- /dev/null
+++ b/arch/arm/configs/koelsch_defconfig
@@ -0,0 +1,54 @@
1CONFIG_SYSVIPC=y
2CONFIG_NO_HZ=y
3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16
6CONFIG_CC_OPTIMIZE_FOR_SIZE=y
7CONFIG_SYSCTL_SYSCALL=y
8CONFIG_EMBEDDED=y
9CONFIG_PERF_EVENTS=y
10CONFIG_SLAB=y
11# CONFIG_BLOCK is not set
12CONFIG_ARCH_SHMOBILE=y
13CONFIG_ARCH_R8A7791=y
14CONFIG_MACH_KOELSCH=y
15# CONFIG_SWP_EMULATE is not set
16CONFIG_CPU_BPREDICT_DISABLE=y
17CONFIG_PL310_ERRATA_588369=y
18CONFIG_ARM_ERRATA_754322=y
19CONFIG_SMP=y
20CONFIG_SCHED_MC=y
21CONFIG_NR_CPUS=8
22CONFIG_AEABI=y
23CONFIG_ZBOOT_ROM_TEXT=0x0
24CONFIG_ZBOOT_ROM_BSS=0x0
25CONFIG_ARM_APPENDED_DTB=y
26CONFIG_KEXEC=y
27CONFIG_AUTO_ZRELADDR=y
28CONFIG_VFP=y
29CONFIG_NEON=y
30# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
31CONFIG_PM_RUNTIME=y
32CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
33# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
34# CONFIG_INPUT_MOUSE is not set
35# CONFIG_LEGACY_PTYS is not set
36CONFIG_SERIAL_SH_SCI=y
37CONFIG_SERIAL_SH_SCI_NR_UARTS=20
38CONFIG_SERIAL_SH_SCI_CONSOLE=y
39# CONFIG_HWMON is not set
40CONFIG_THERMAL=y
41CONFIG_RCAR_THERMAL=y
42# CONFIG_HID is not set
43# CONFIG_USB_SUPPORT is not set
44CONFIG_NEW_LEDS=y
45CONFIG_LEDS_CLASS=y
46# CONFIG_IOMMU_SUPPORT is not set
47# CONFIG_DNOTIFY is not set
48# CONFIG_INOTIFY_USER is not set
49CONFIG_TMPFS=y
50CONFIG_CONFIGFS_FS=y
51# CONFIG_MISC_FILESYSTEMS is not set
52# CONFIG_ENABLE_WARN_DEPRECATED is not set
53# CONFIG_ENABLE_MUST_CHECK is not set
54# CONFIG_ARM_UNWIND is not set
diff --git a/arch/arm/configs/lager_defconfig b/arch/arm/configs/lager_defconfig
index e777ef22b801..35bff5e0d57a 100644
--- a/arch/arm/configs/lager_defconfig
+++ b/arch/arm/configs/lager_defconfig
@@ -89,6 +89,8 @@ CONFIG_THERMAL=y
89CONFIG_RCAR_THERMAL=y 89CONFIG_RCAR_THERMAL=y
90CONFIG_REGULATOR=y 90CONFIG_REGULATOR=y
91CONFIG_REGULATOR_FIXED_VOLTAGE=y 91CONFIG_REGULATOR_FIXED_VOLTAGE=y
92CONFIG_DRM=y
93CONFIG_DRM_RCAR_DU=y
92# CONFIG_USB_SUPPORT is not set 94# CONFIG_USB_SUPPORT is not set
93CONFIG_MMC=y 95CONFIG_MMC=y
94CONFIG_MMC_SDHI=y 96CONFIG_MMC_SDHI=y
diff --git a/arch/arm/configs/marzen_defconfig b/arch/arm/configs/marzen_defconfig
index 000e9205b2b9..5cc6360340b1 100644
--- a/arch/arm/configs/marzen_defconfig
+++ b/arch/arm/configs/marzen_defconfig
@@ -92,6 +92,8 @@ CONFIG_SOC_CAMERA=y
92CONFIG_VIDEO_RCAR_VIN=y 92CONFIG_VIDEO_RCAR_VIN=y
93# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set 93# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
94CONFIG_VIDEO_ADV7180=y 94CONFIG_VIDEO_ADV7180=y
95CONFIG_DRM=y
96CONFIG_DRM_RCAR_DU=y
95CONFIG_USB=y 97CONFIG_USB=y
96CONFIG_USB_RCAR_PHY=y 98CONFIG_USB_RCAR_PHY=y
97CONFIG_MMC=y 99CONFIG_MMC=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 6e572c64cf5a..4a5903e04827 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -6,6 +6,7 @@ CONFIG_ARCH_MVEBU=y
6CONFIG_MACH_ARMADA_370=y 6CONFIG_MACH_ARMADA_370=y
7CONFIG_MACH_ARMADA_XP=y 7CONFIG_MACH_ARMADA_XP=y
8CONFIG_ARCH_BCM=y 8CONFIG_ARCH_BCM=y
9CONFIG_ARCH_BCM_MOBILE=y
9CONFIG_GPIO_PCA953X=y 10CONFIG_GPIO_PCA953X=y
10CONFIG_ARCH_HIGHBANK=y 11CONFIG_ARCH_HIGHBANK=y
11CONFIG_ARCH_KEYSTONE=y 12CONFIG_ARCH_KEYSTONE=y
@@ -36,6 +37,7 @@ CONFIG_ARCH_TEGRA_114_SOC=y
36CONFIG_TEGRA_PCI=y 37CONFIG_TEGRA_PCI=y
37CONFIG_TEGRA_EMC_SCALING_ENABLE=y 38CONFIG_TEGRA_EMC_SCALING_ENABLE=y
38CONFIG_ARCH_U8500=y 39CONFIG_ARCH_U8500=y
40CONFIG_MACH_HREFV60=y
39CONFIG_MACH_SNOWBALL=y 41CONFIG_MACH_SNOWBALL=y
40CONFIG_MACH_UX500_DT=y 42CONFIG_MACH_UX500_DT=y
41CONFIG_ARCH_VEXPRESS=y 43CONFIG_ARCH_VEXPRESS=y
@@ -46,6 +48,7 @@ CONFIG_ARCH_ZYNQ=y
46CONFIG_SMP=y 48CONFIG_SMP=y
47CONFIG_HIGHPTE=y 49CONFIG_HIGHPTE=y
48CONFIG_ARM_APPENDED_DTB=y 50CONFIG_ARM_APPENDED_DTB=y
51CONFIG_ARM_ATAG_DTB_COMPAT=y
49CONFIG_NET=y 52CONFIG_NET=y
50CONFIG_UNIX=y 53CONFIG_UNIX=y
51CONFIG_INET=y 54CONFIG_INET=y
@@ -133,6 +136,7 @@ CONFIG_MMC=y
133CONFIG_MMC_ARMMMCI=y 136CONFIG_MMC_ARMMMCI=y
134CONFIG_MMC_SDHCI=y 137CONFIG_MMC_SDHCI=y
135CONFIG_MMC_SDHCI_PLTFM=y 138CONFIG_MMC_SDHCI_PLTFM=y
139CONFIG_MMC_SDHCI_ESDHC_IMX=y
136CONFIG_MMC_SDHCI_TEGRA=y 140CONFIG_MMC_SDHCI_TEGRA=y
137CONFIG_MMC_SDHCI_SPEAR=y 141CONFIG_MMC_SDHCI_SPEAR=y
138CONFIG_MMC_OMAP=y 142CONFIG_MMC_OMAP=y
diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig
index 4555c025629a..6150108e15de 100644
--- a/arch/arm/configs/mxs_defconfig
+++ b/arch/arm/configs/mxs_defconfig
@@ -76,7 +76,6 @@ CONFIG_INPUT_EVDEV=y
76CONFIG_INPUT_TOUCHSCREEN=y 76CONFIG_INPUT_TOUCHSCREEN=y
77CONFIG_TOUCHSCREEN_TSC2007=m 77CONFIG_TOUCHSCREEN_TSC2007=m
78# CONFIG_SERIO is not set 78# CONFIG_SERIO is not set
79CONFIG_VT_HW_CONSOLE_BINDING=y
80CONFIG_DEVPTS_MULTIPLE_INSTANCES=y 79CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
81# CONFIG_LEGACY_PTYS is not set 80# CONFIG_LEGACY_PTYS is not set
82# CONFIG_DEVKMEM is not set 81# CONFIG_DEVKMEM is not set
@@ -91,7 +90,6 @@ CONFIG_I2C_MXS=y
91CONFIG_SPI=y 90CONFIG_SPI=y
92CONFIG_SPI_GPIO=m 91CONFIG_SPI_GPIO=m
93CONFIG_SPI_MXS=y 92CONFIG_SPI_MXS=y
94CONFIG_DEBUG_GPIO=y
95CONFIG_GPIO_SYSFS=y 93CONFIG_GPIO_SYSFS=y
96# CONFIG_HWMON is not set 94# CONFIG_HWMON is not set
97CONFIG_WATCHDOG=y 95CONFIG_WATCHDOG=y
@@ -115,9 +113,12 @@ CONFIG_USB=y
115CONFIG_USB_EHCI_HCD=y 113CONFIG_USB_EHCI_HCD=y
116CONFIG_USB_STORAGE=y 114CONFIG_USB_STORAGE=y
117CONFIG_USB_CHIPIDEA=y 115CONFIG_USB_CHIPIDEA=y
116CONFIG_USB_CHIPIDEA_UDC=y
118CONFIG_USB_CHIPIDEA_HOST=y 117CONFIG_USB_CHIPIDEA_HOST=y
119CONFIG_USB_PHY=y
120CONFIG_USB_MXS_PHY=y 118CONFIG_USB_MXS_PHY=y
119CONFIG_USB_GADGET=y
120CONFIG_USB_ETH=m
121CONFIG_USB_MASS_STORAGE=m
121CONFIG_MMC=y 122CONFIG_MMC=y
122CONFIG_MMC_UNSAFE_RESUME=y 123CONFIG_MMC_UNSAFE_RESUME=y
123CONFIG_MMC_MXS=y 124CONFIG_MMC_MXS=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 254cf0539439..98a50c309b90 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -1,14 +1,13 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y 2CONFIG_POSIX_MQUEUE=y
3CONFIG_NO_HZ=y
4CONFIG_HIGH_RES_TIMERS=y
4CONFIG_BSD_PROCESS_ACCT=y 5CONFIG_BSD_PROCESS_ACCT=y
5CONFIG_IKCONFIG=y 6CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 7CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=16 8CONFIG_LOG_BUF_SHIFT=16
8CONFIG_BLK_DEV_INITRD=y 9CONFIG_BLK_DEV_INITRD=y
9CONFIG_EXPERT=y 10CONFIG_EXPERT=y
10# CONFIG_SYSCTL_SYSCALL is not set
11CONFIG_KALLSYMS_EXTRA_PASS=y
12CONFIG_SLAB=y 11CONFIG_SLAB=y
13CONFIG_PROFILING=y 12CONFIG_PROFILING=y
14CONFIG_OPROFILE=y 13CONFIG_OPROFILE=y
@@ -20,22 +19,21 @@ CONFIG_MODULE_FORCE_UNLOAD=y
20CONFIG_MODVERSIONS=y 19CONFIG_MODVERSIONS=y
21CONFIG_MODULE_SRCVERSION_ALL=y 20CONFIG_MODULE_SRCVERSION_ALL=y
22# CONFIG_BLK_DEV_BSG is not set 21# CONFIG_BLK_DEV_BSG is not set
22CONFIG_PARTITION_ADVANCED=y
23CONFIG_ARCH_MULTI_V6=y 23CONFIG_ARCH_MULTI_V6=y
24CONFIG_ARCH_OMAP2PLUS=y 24CONFIG_OMAP_RESET_CLOCKS=y
25CONFIG_OMAP_MUX_DEBUG=y
25CONFIG_ARCH_OMAP2=y 26CONFIG_ARCH_OMAP2=y
26CONFIG_ARCH_OMAP3=y 27CONFIG_ARCH_OMAP3=y
27CONFIG_ARCH_OMAP4=y 28CONFIG_ARCH_OMAP4=y
29CONFIG_SOC_OMAP5=y
28CONFIG_SOC_AM33XX=y 30CONFIG_SOC_AM33XX=y
29CONFIG_OMAP_RESET_CLOCKS=y 31CONFIG_SOC_DRA7XX=y
30CONFIG_OMAP_MUX_DEBUG=y
31CONFIG_ARCH_VEXPRESS_CA9X4=y
32CONFIG_ARM_THUMBEE=y 32CONFIG_ARM_THUMBEE=y
33CONFIG_ARM_ERRATA_411920=y 33CONFIG_ARM_ERRATA_411920=y
34CONFIG_NO_HZ=y
35CONFIG_HIGH_RES_TIMERS=y
36CONFIG_SMP=y 34CONFIG_SMP=y
37CONFIG_NR_CPUS=2 35CONFIG_NR_CPUS=2
38CONFIG_LEDS=y 36CONFIG_CMA=y
39CONFIG_ZBOOT_ROM_TEXT=0x0 37CONFIG_ZBOOT_ROM_TEXT=0x0
40CONFIG_ZBOOT_ROM_BSS=0x0 38CONFIG_ZBOOT_ROM_BSS=0x0
41CONFIG_ARM_APPENDED_DTB=y 39CONFIG_ARM_APPENDED_DTB=y
@@ -61,8 +59,6 @@ CONFIG_IP_PNP_RARP=y
61# CONFIG_IPV6 is not set 59# CONFIG_IPV6 is not set
62CONFIG_NETFILTER=y 60CONFIG_NETFILTER=y
63CONFIG_CAN=m 61CONFIG_CAN=m
64CONFIG_CAN_RAW=m
65CONFIG_CAN_BCM=m
66CONFIG_CAN_C_CAN=m 62CONFIG_CAN_C_CAN=m
67CONFIG_CAN_C_CAN_PLATFORM=m 63CONFIG_CAN_C_CAN_PLATFORM=m
68CONFIG_BT=m 64CONFIG_BT=m
@@ -77,14 +73,13 @@ CONFIG_MAC80211=m
77CONFIG_MAC80211_RC_PID=y 73CONFIG_MAC80211_RC_PID=y
78CONFIG_MAC80211_RC_DEFAULT_PID=y 74CONFIG_MAC80211_RC_DEFAULT_PID=y
79CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 75CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
80CONFIG_CMA=y
81CONFIG_DMA_CMA=y
82CONFIG_CONNECTOR=y
83CONFIG_DEVTMPFS=y 76CONFIG_DEVTMPFS=y
84CONFIG_DEVTMPFS_MOUNT=y 77CONFIG_DEVTMPFS_MOUNT=y
78CONFIG_DMA_CMA=y
79CONFIG_OMAP_OCP2SCP=y
80CONFIG_CONNECTOR=y
85CONFIG_MTD=y 81CONFIG_MTD=y
86CONFIG_MTD_CMDLINE_PARTS=y 82CONFIG_MTD_CMDLINE_PARTS=y
87CONFIG_MTD_CHAR=y
88CONFIG_MTD_BLOCK=y 83CONFIG_MTD_BLOCK=y
89CONFIG_MTD_OOPS=y 84CONFIG_MTD_OOPS=y
90CONFIG_MTD_CFI=y 85CONFIG_MTD_CFI=y
@@ -98,32 +93,40 @@ CONFIG_MTD_UBI=y
98CONFIG_BLK_DEV_LOOP=y 93CONFIG_BLK_DEV_LOOP=y
99CONFIG_BLK_DEV_RAM=y 94CONFIG_BLK_DEV_RAM=y
100CONFIG_BLK_DEV_RAM_SIZE=16384 95CONFIG_BLK_DEV_RAM_SIZE=16384
101CONFIG_SENSORS_LIS3LV02D=m
102CONFIG_SENSORS_TSL2550=m 96CONFIG_SENSORS_TSL2550=m
103CONFIG_SENSORS_LIS3_I2C=m
104CONFIG_BMP085_I2C=m 97CONFIG_BMP085_I2C=m
98CONFIG_SENSORS_LIS3_I2C=m
105CONFIG_SCSI=y 99CONFIG_SCSI=y
106CONFIG_BLK_DEV_SD=y 100CONFIG_BLK_DEV_SD=y
107CONFIG_SCSI_MULTI_LUN=y 101CONFIG_SCSI_MULTI_LUN=y
108CONFIG_SCSI_SCAN_ASYNC=y 102CONFIG_SCSI_SCAN_ASYNC=y
109CONFIG_MD=y 103CONFIG_MD=y
110CONFIG_NETDEVICES=y 104CONFIG_NETDEVICES=y
111CONFIG_SMSC_PHY=y
112CONFIG_NET_ETHERNET=y
113CONFIG_SMC91X=y
114CONFIG_SMSC911X=y
115CONFIG_KS8851=y 105CONFIG_KS8851=y
116CONFIG_KS8851_MLL=y 106CONFIG_KS8851_MLL=y
117CONFIG_LIBERTAS=m 107CONFIG_SMC91X=y
118CONFIG_LIBERTAS_USB=m 108CONFIG_SMSC911X=y
119CONFIG_LIBERTAS_SDIO=m 109CONFIG_TI_CPSW=y
120CONFIG_LIBERTAS_DEBUG=y 110CONFIG_AT803X_PHY=y
111CONFIG_SMSC_PHY=y
121CONFIG_USB_USBNET=y 112CONFIG_USB_USBNET=y
122CONFIG_USB_NET_SMSC95XX=y 113CONFIG_USB_NET_SMSC95XX=y
123CONFIG_USB_ALI_M5632=y 114CONFIG_USB_ALI_M5632=y
124CONFIG_USB_AN2720=y 115CONFIG_USB_AN2720=y
125CONFIG_USB_EPSON2888=y 116CONFIG_USB_EPSON2888=y
126CONFIG_USB_KC2190=y 117CONFIG_USB_KC2190=y
118CONFIG_LIBERTAS=m
119CONFIG_LIBERTAS_USB=m
120CONFIG_LIBERTAS_SDIO=m
121CONFIG_LIBERTAS_DEBUG=y
122CONFIG_WL_TI=y
123CONFIG_WL12XX=m
124CONFIG_WL18XX=m
125CONFIG_WLCORE_SPI=m
126CONFIG_WLCORE_SDIO=m
127CONFIG_MWIFIEX=m
128CONFIG_MWIFIEX_SDIO=m
129CONFIG_MWIFIEX_USB=m
127CONFIG_INPUT_JOYDEV=y 130CONFIG_INPUT_JOYDEV=y
128CONFIG_INPUT_EVDEV=y 131CONFIG_INPUT_EVDEV=y
129CONFIG_KEYBOARD_GPIO=y 132CONFIG_KEYBOARD_GPIO=y
@@ -133,7 +136,6 @@ CONFIG_INPUT_TOUCHSCREEN=y
133CONFIG_TOUCHSCREEN_ADS7846=y 136CONFIG_TOUCHSCREEN_ADS7846=y
134CONFIG_INPUT_MISC=y 137CONFIG_INPUT_MISC=y
135CONFIG_INPUT_TWL4030_PWRBUTTON=y 138CONFIG_INPUT_TWL4030_PWRBUTTON=y
136CONFIG_VT_HW_CONSOLE_BINDING=y
137# CONFIG_LEGACY_PTYS is not set 139# CONFIG_LEGACY_PTYS is not set
138CONFIG_SERIAL_8250=y 140CONFIG_SERIAL_8250=y
139CONFIG_SERIAL_8250_CONSOLE=y 141CONFIG_SERIAL_8250_CONSOLE=y
@@ -143,8 +145,7 @@ CONFIG_SERIAL_8250_MANY_PORTS=y
143CONFIG_SERIAL_8250_SHARE_IRQ=y 145CONFIG_SERIAL_8250_SHARE_IRQ=y
144CONFIG_SERIAL_8250_DETECT_IRQ=y 146CONFIG_SERIAL_8250_DETECT_IRQ=y
145CONFIG_SERIAL_8250_RSA=y 147CONFIG_SERIAL_8250_RSA=y
146CONFIG_SERIAL_AMBA_PL011=y 148CONFIG_SERIAL_OF_PLATFORM=y
147CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
148CONFIG_SERIAL_OMAP=y 149CONFIG_SERIAL_OMAP=y
149CONFIG_SERIAL_OMAP_CONSOLE=y 150CONFIG_SERIAL_OMAP_CONSOLE=y
150CONFIG_HW_RANDOM=y 151CONFIG_HW_RANDOM=y
@@ -158,31 +159,31 @@ CONFIG_GPIO_TWL4030=y
158CONFIG_W1=y 159CONFIG_W1=y
159CONFIG_POWER_SUPPLY=y 160CONFIG_POWER_SUPPLY=y
160CONFIG_SENSORS_LM75=m 161CONFIG_SENSORS_LM75=m
161CONFIG_WATCHDOG=y
162CONFIG_THERMAL=y 162CONFIG_THERMAL=y
163CONFIG_THERMAL_HWMON=y
164CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
165CONFIG_THERMAL_GOV_FAIR_SHARE=y 163CONFIG_THERMAL_GOV_FAIR_SHARE=y
166CONFIG_THERMAL_GOV_STEP_WISE=y
167CONFIG_THERMAL_GOV_USER_SPACE=y 164CONFIG_THERMAL_GOV_USER_SPACE=y
168CONFIG_CPU_THERMAL=y 165CONFIG_TI_SOC_THERMAL=y
166CONFIG_OMAP4_THERMAL=y
167CONFIG_OMAP5_THERMAL=y
168CONFIG_DRA752_THERMAL=y
169CONFIG_WATCHDOG=y
169CONFIG_OMAP_WATCHDOG=y 170CONFIG_OMAP_WATCHDOG=y
170CONFIG_TWL4030_WATCHDOG=y 171CONFIG_TWL4030_WATCHDOG=y
172CONFIG_MFD_PALMAS=y
171CONFIG_MFD_TPS65217=y 173CONFIG_MFD_TPS65217=y
172CONFIG_MFD_TPS65910=y 174CONFIG_MFD_TPS65910=y
173CONFIG_TWL6040_CORE=y 175CONFIG_TWL6040_CORE=y
174CONFIG_REGULATOR_TWL4030=y 176CONFIG_REGULATOR_PALMAS=y
175CONFIG_REGULATOR_TPS65023=y 177CONFIG_REGULATOR_TPS65023=y
176CONFIG_REGULATOR_TPS6507X=y 178CONFIG_REGULATOR_TPS6507X=y
177CONFIG_REGULATOR_TPS65217=y 179CONFIG_REGULATOR_TPS65217=y
178CONFIG_REGULATOR_TPS65910=y 180CONFIG_REGULATOR_TPS65910=y
181CONFIG_REGULATOR_TWL4030=y
179CONFIG_FB=y 182CONFIG_FB=y
180CONFIG_FIRMWARE_EDID=y 183CONFIG_FIRMWARE_EDID=y
181CONFIG_FB_MODE_HELPERS=y 184CONFIG_FB_MODE_HELPERS=y
182CONFIG_FB_TILEBLITTING=y 185CONFIG_FB_TILEBLITTING=y
183CONFIG_FB_OMAP_LCD_VGA=y
184CONFIG_OMAP2_DSS=m 186CONFIG_OMAP2_DSS=m
185CONFIG_OMAP2_DSS_RFBI=y
186CONFIG_OMAP2_DSS_SDI=y 187CONFIG_OMAP2_DSS_SDI=y
187CONFIG_OMAP2_DSS_DSI=y 188CONFIG_OMAP2_DSS_DSI=y
188CONFIG_FB_OMAP2=m 189CONFIG_FB_OMAP2=m
@@ -194,12 +195,8 @@ CONFIG_DISPLAY_PANEL_DPI=m
194CONFIG_BACKLIGHT_LCD_SUPPORT=y 195CONFIG_BACKLIGHT_LCD_SUPPORT=y
195CONFIG_LCD_CLASS_DEVICE=y 196CONFIG_LCD_CLASS_DEVICE=y
196CONFIG_LCD_PLATFORM=y 197CONFIG_LCD_PLATFORM=y
197CONFIG_DISPLAY_SUPPORT=y
198CONFIG_FRAMEBUFFER_CONSOLE=y 198CONFIG_FRAMEBUFFER_CONSOLE=y
199CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y 199CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
200CONFIG_FONTS=y
201CONFIG_FONT_8x8=y
202CONFIG_FONT_8x16=y
203CONFIG_LOGO=y 200CONFIG_LOGO=y
204CONFIG_SOUND=m 201CONFIG_SOUND=m
205CONFIG_SND=m 202CONFIG_SND=m
@@ -216,14 +213,14 @@ CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m
216CONFIG_USB=y 213CONFIG_USB=y
217CONFIG_USB_DEBUG=y 214CONFIG_USB_DEBUG=y
218CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 215CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
219CONFIG_USB_DEVICEFS=y
220CONFIG_USB_MON=y 216CONFIG_USB_MON=y
221CONFIG_USB_WDM=y 217CONFIG_USB_WDM=y
222CONFIG_USB_STORAGE=y 218CONFIG_USB_STORAGE=y
223CONFIG_USB_LIBUSUAL=y 219CONFIG_USB_DWC3=m
224CONFIG_USB_TEST=y 220CONFIG_USB_TEST=y
225CONFIG_USB_PHY=y
226CONFIG_NOP_USB_XCEIV=y 221CONFIG_NOP_USB_XCEIV=y
222CONFIG_OMAP_USB2=y
223CONFIG_OMAP_USB3=y
227CONFIG_USB_GADGET=y 224CONFIG_USB_GADGET=y
228CONFIG_USB_GADGET_DEBUG=y 225CONFIG_USB_GADGET_DEBUG=y
229CONFIG_USB_GADGET_DEBUG_FILES=y 226CONFIG_USB_GADGET_DEBUG_FILES=y
@@ -232,7 +229,6 @@ CONFIG_USB_ZERO=m
232CONFIG_MMC=y 229CONFIG_MMC=y
233CONFIG_MMC_UNSAFE_RESUME=y 230CONFIG_MMC_UNSAFE_RESUME=y
234CONFIG_SDIO_UART=y 231CONFIG_SDIO_UART=y
235CONFIG_MMC_ARMMMCI=y
236CONFIG_MMC_OMAP=y 232CONFIG_MMC_OMAP=y
237CONFIG_MMC_OMAP_HS=y 233CONFIG_MMC_OMAP_HS=y
238CONFIG_NEW_LEDS=y 234CONFIG_NEW_LEDS=y
@@ -252,11 +248,8 @@ CONFIG_RTC_DRV_OMAP=y
252CONFIG_DMADEVICES=y 248CONFIG_DMADEVICES=y
253CONFIG_TI_EDMA=y 249CONFIG_TI_EDMA=y
254CONFIG_DMA_OMAP=y 250CONFIG_DMA_OMAP=y
255CONFIG_TI_SOC_THERMAL=y 251CONFIG_EXTCON=y
256CONFIG_TI_THERMAL=y 252CONFIG_EXTCON_PALMAS=y
257CONFIG_OMAP4_THERMAL=y
258CONFIG_OMAP5_THERMAL=y
259CONFIG_DRA752_THERMAL=y
260CONFIG_EXT2_FS=y 253CONFIG_EXT2_FS=y
261CONFIG_EXT3_FS=y 254CONFIG_EXT3_FS=y
262# CONFIG_EXT3_FS_XATTR is not set 255# CONFIG_EXT3_FS_XATTR is not set
@@ -275,23 +268,18 @@ CONFIG_JFFS2_RUBIN=y
275CONFIG_UBIFS_FS=y 268CONFIG_UBIFS_FS=y
276CONFIG_CRAMFS=y 269CONFIG_CRAMFS=y
277CONFIG_NFS_FS=y 270CONFIG_NFS_FS=y
278CONFIG_NFS_V3=y
279CONFIG_NFS_V3_ACL=y 271CONFIG_NFS_V3_ACL=y
280CONFIG_NFS_V4=y 272CONFIG_NFS_V4=y
281CONFIG_ROOT_NFS=y 273CONFIG_ROOT_NFS=y
282CONFIG_PARTITION_ADVANCED=y
283CONFIG_NLS_CODEPAGE_437=y 274CONFIG_NLS_CODEPAGE_437=y
284CONFIG_NLS_ISO8859_1=y 275CONFIG_NLS_ISO8859_1=y
285CONFIG_PRINTK_TIME=y 276CONFIG_PRINTK_TIME=y
277CONFIG_DEBUG_INFO=y
286CONFIG_MAGIC_SYSRQ=y 278CONFIG_MAGIC_SYSRQ=y
287CONFIG_DEBUG_KERNEL=y
288CONFIG_SCHEDSTATS=y 279CONFIG_SCHEDSTATS=y
289CONFIG_TIMER_STATS=y 280CONFIG_TIMER_STATS=y
290CONFIG_PROVE_LOCKING=y 281CONFIG_PROVE_LOCKING=y
291CONFIG_DEBUG_SPINLOCK_SLEEP=y
292# CONFIG_DEBUG_BUGVERBOSE is not set 282# CONFIG_DEBUG_BUGVERBOSE is not set
293CONFIG_DEBUG_INFO=y
294# CONFIG_RCU_CPU_STALL_DETECTOR is not set
295CONFIG_SECURITY=y 283CONFIG_SECURITY=y
296CONFIG_CRYPTO_MICHAEL_MIC=y 284CONFIG_CRYPTO_MICHAEL_MIC=y
297# CONFIG_CRYPTO_ANSI_CPRNG is not set 285# CONFIG_CRYPTO_ANSI_CPRNG is not set
@@ -300,9 +288,6 @@ CONFIG_CRC_T10DIF=y
300CONFIG_CRC_ITU_T=y 288CONFIG_CRC_ITU_T=y
301CONFIG_CRC7=y 289CONFIG_CRC7=y
302CONFIG_LIBCRC32C=y 290CONFIG_LIBCRC32C=y
303CONFIG_SOC_OMAP5=y 291CONFIG_FONTS=y
304CONFIG_TI_DAVINCI_MDIO=y 292CONFIG_FONT_8x8=y
305CONFIG_TI_DAVINCI_CPDMA=y 293CONFIG_FONT_8x16=y
306CONFIG_TI_CPSW=y
307CONFIG_AT803X_PHY=y
308CONFIG_SOC_DRA7XX=y
diff --git a/arch/arm/configs/shark_defconfig b/arch/arm/configs/shark_defconfig
deleted file mode 100644
index e319b2c56f11..000000000000
--- a/arch/arm/configs/shark_defconfig
+++ /dev/null
@@ -1,80 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_SYSFS_DEPRECATED_V2=y
6CONFIG_SLAB=y
7CONFIG_MODULES=y
8CONFIG_MODULE_UNLOAD=y
9CONFIG_MODULE_FORCE_UNLOAD=y
10# CONFIG_BLK_DEV_BSG is not set
11CONFIG_ARCH_SHARK=y
12CONFIG_LEDS=y
13CONFIG_LEDS_TIMER=y
14CONFIG_ZBOOT_ROM_TEXT=0x0
15CONFIG_ZBOOT_ROM_BSS=0x0
16CONFIG_FPE_NWFPE=y
17CONFIG_NET=y
18CONFIG_PACKET=y
19CONFIG_UNIX=y
20CONFIG_INET=y
21# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
22# CONFIG_INET_XFRM_MODE_TUNNEL is not set
23# CONFIG_INET_XFRM_MODE_BEET is not set
24# CONFIG_INET_LRO is not set
25# CONFIG_INET_DIAG is not set
26# CONFIG_IPV6 is not set
27CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
28# CONFIG_STANDALONE is not set
29# CONFIG_FIRMWARE_IN_KERNEL is not set
30CONFIG_PARPORT=m
31CONFIG_PARPORT_PC=m
32CONFIG_BLK_DEV_LOOP=y
33CONFIG_BLK_DEV_RAM=y
34CONFIG_IDE=y
35CONFIG_BLK_DEV_IDECD=m
36CONFIG_SCSI=m
37CONFIG_BLK_DEV_SD=m
38CONFIG_CHR_DEV_ST=m
39CONFIG_BLK_DEV_SR=m
40CONFIG_CHR_DEV_SG=m
41CONFIG_NETDEVICES=y
42CONFIG_NET_ETHERNET=y
43CONFIG_NET_PCI=y
44CONFIG_CS89x0=y
45# CONFIG_SERIO_SERPORT is not set
46CONFIG_SERIAL_8250=y
47CONFIG_SERIAL_8250_CONSOLE=y
48CONFIG_PRINTER=m
49# CONFIG_HWMON is not set
50CONFIG_FB=y
51CONFIG_FB_CYBER2000=y
52# CONFIG_VGA_CONSOLE is not set
53CONFIG_FRAMEBUFFER_CONSOLE=y
54CONFIG_LOGO=y
55# CONFIG_LOGO_LINUX_MONO is not set
56# CONFIG_LOGO_LINUX_VGA16 is not set
57CONFIG_SOUND=m
58CONFIG_SOUND_PRIME=m
59CONFIG_SOUND_OSS=m
60CONFIG_SOUND_SB=m
61CONFIG_RTC_CLASS=y
62CONFIG_RTC_DRV_CMOS=y
63CONFIG_EXT2_FS=y
64CONFIG_EXT3_FS=y
65CONFIG_ISO9660_FS=m
66CONFIG_JOLIET=y
67CONFIG_MSDOS_FS=m
68CONFIG_VFAT_FS=m
69CONFIG_NFS_FS=y
70CONFIG_NFS_V3=y
71CONFIG_NFSD=m
72CONFIG_PARTITION_ADVANCED=y
73CONFIG_NLS_CODEPAGE_437=m
74CONFIG_NLS_CODEPAGE_850=m
75CONFIG_NLS_ISO8859_1=m
76# CONFIG_ENABLE_MUST_CHECK is not set
77CONFIG_DEBUG_KERNEL=y
78# CONFIG_SCHED_DEBUG is not set
79# CONFIG_RCU_CPU_STALL_DETECTOR is not set
80CONFIG_DEBUG_USER=y
diff --git a/arch/arm/configs/sunxi_defconfig b/arch/arm/configs/sunxi_defconfig
new file mode 100644
index 000000000000..d57a85badb5e
--- /dev/null
+++ b/arch/arm/configs/sunxi_defconfig
@@ -0,0 +1,61 @@
1CONFIG_NO_HZ=y
2CONFIG_HIGH_RES_TIMERS=y
3CONFIG_BLK_DEV_INITRD=y
4CONFIG_ARCH_SUNXI=y
5CONFIG_SMP=y
6CONFIG_AEABI=y
7CONFIG_HIGHMEM=y
8CONFIG_HIGHPTE=y
9CONFIG_VFP=y
10CONFIG_NEON=y
11CONFIG_NET=y
12CONFIG_PACKET=y
13CONFIG_UNIX=y
14CONFIG_INET=y
15# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
16# CONFIG_INET_XFRM_MODE_TUNNEL is not set
17# CONFIG_INET_XFRM_MODE_BEET is not set
18# CONFIG_INET_LRO is not set
19# CONFIG_INET_DIAG is not set
20# CONFIG_IPV6 is not set
21# CONFIG_WIRELESS is not set
22CONFIG_DEVTMPFS=y
23CONFIG_DEVTMPFS_MOUNT=y
24CONFIG_NETDEVICES=y
25CONFIG_SUN4I_EMAC=y
26# CONFIG_NET_CADENCE is not set
27# CONFIG_NET_VENDOR_BROADCOM is not set
28# CONFIG_NET_VENDOR_CIRRUS is not set
29# CONFIG_NET_VENDOR_FARADAY is not set
30# CONFIG_NET_VENDOR_INTEL is not set
31# CONFIG_NET_VENDOR_MARVELL is not set
32# CONFIG_NET_VENDOR_MICREL is not set
33# CONFIG_NET_VENDOR_NATSEMI is not set
34# CONFIG_NET_VENDOR_SEEQ is not set
35# CONFIG_NET_VENDOR_SMSC is not set
36# CONFIG_NET_VENDOR_STMICRO is not set
37# CONFIG_NET_VENDOR_WIZNET is not set
38# CONFIG_WLAN is not set
39CONFIG_SERIAL_8250=y
40CONFIG_SERIAL_8250_CONSOLE=y
41CONFIG_SERIAL_8250_NR_UARTS=8
42CONFIG_SERIAL_8250_RUNTIME_UARTS=8
43CONFIG_SERIAL_8250_DW=y
44CONFIG_I2C=y
45# CONFIG_I2C_COMPAT is not set
46CONFIG_I2C_CHARDEV=y
47CONFIG_I2C_MV64XXX=y
48CONFIG_GPIO_SYSFS=y
49# CONFIG_HWMON is not set
50CONFIG_WATCHDOG=y
51CONFIG_SUNXI_WATCHDOG=y
52# CONFIG_USB_SUPPORT is not set
53CONFIG_NEW_LEDS=y
54CONFIG_LEDS_CLASS=y
55CONFIG_LEDS_GPIO=y
56CONFIG_LEDS_TRIGGERS=y
57CONFIG_LEDS_TRIGGER_HEARTBEAT=y
58CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
59CONFIG_COMMON_CLK_DEBUG=y
60# CONFIG_IOMMU_SUPPORT is not set
61CONFIG_NLS=y
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index ea042e80e54d..4934295bb4f0 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -27,6 +27,7 @@ CONFIG_ARCH_TEGRA=y
27CONFIG_ARCH_TEGRA_2x_SOC=y 27CONFIG_ARCH_TEGRA_2x_SOC=y
28CONFIG_ARCH_TEGRA_3x_SOC=y 28CONFIG_ARCH_TEGRA_3x_SOC=y
29CONFIG_ARCH_TEGRA_114_SOC=y 29CONFIG_ARCH_TEGRA_114_SOC=y
30CONFIG_ARCH_TEGRA_124_SOC=y
30CONFIG_TEGRA_EMC_SCALING_ENABLE=y 31CONFIG_TEGRA_EMC_SCALING_ENABLE=y
31CONFIG_PCI=y 32CONFIG_PCI=y
32CONFIG_PCI_MSI=y 33CONFIG_PCI_MSI=y
@@ -41,9 +42,11 @@ CONFIG_ZBOOT_ROM_TEXT=0x0
41CONFIG_ZBOOT_ROM_BSS=0x0 42CONFIG_ZBOOT_ROM_BSS=0x0
42CONFIG_KEXEC=y 43CONFIG_KEXEC=y
43CONFIG_CPU_FREQ=y 44CONFIG_CPU_FREQ=y
45CONFIG_CPU_FREQ_STAT_DETAILS=y
44CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 46CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
45CONFIG_CPU_IDLE=y 47CONFIG_CPU_IDLE=y
46CONFIG_VFP=y 48CONFIG_VFP=y
49CONFIG_NEON=y
47CONFIG_PM_RUNTIME=y 50CONFIG_PM_RUNTIME=y
48CONFIG_NET=y 51CONFIG_NET=y
49CONFIG_PACKET=y 52CONFIG_PACKET=y
@@ -129,6 +132,7 @@ CONFIG_SPI=y
129CONFIG_SPI_TEGRA114=y 132CONFIG_SPI_TEGRA114=y
130CONFIG_SPI_TEGRA20_SFLASH=y 133CONFIG_SPI_TEGRA20_SFLASH=y
131CONFIG_SPI_TEGRA20_SLINK=y 134CONFIG_SPI_TEGRA20_SLINK=y
135CONFIG_PINCTRL_PALMAS=y
132CONFIG_GPIO_PCA953X_IRQ=y 136CONFIG_GPIO_PCA953X_IRQ=y
133CONFIG_GPIO_PALMAS=y 137CONFIG_GPIO_PALMAS=y
134CONFIG_GPIO_TPS6586X=y 138CONFIG_GPIO_TPS6586X=y
@@ -223,6 +227,7 @@ CONFIG_KEYBOARD_NVEC=y
223CONFIG_SERIO_NVEC_PS2=y 227CONFIG_SERIO_NVEC_PS2=y
224CONFIG_NVEC_POWER=y 228CONFIG_NVEC_POWER=y
225CONFIG_NVEC_PAZ00=y 229CONFIG_NVEC_PAZ00=y
230CONFIG_COMMON_CLK_DEBUG=y
226CONFIG_TEGRA_IOMMU_GART=y 231CONFIG_TEGRA_IOMMU_GART=y
227CONFIG_TEGRA_IOMMU_SMMU=y 232CONFIG_TEGRA_IOMMU_SMMU=y
228CONFIG_MEMORY=y 233CONFIG_MEMORY=y
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index a0025dc13021..ac632cc38f24 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -1,4 +1,3 @@
1CONFIG_HIGHMEM=y
2# CONFIG_SWAP is not set 1# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
4CONFIG_NO_HZ=y 3CONFIG_NO_HZ=y
@@ -16,6 +15,9 @@ CONFIG_SMP=y
16CONFIG_NR_CPUS=2 15CONFIG_NR_CPUS=2
17CONFIG_PREEMPT=y 16CONFIG_PREEMPT=y
18CONFIG_AEABI=y 17CONFIG_AEABI=y
18CONFIG_HIGHMEM=y
19CONFIG_ARM_APPENDED_DTB=y
20CONFIG_ARM_ATAG_DTB_COMPAT=y
19CONFIG_CMDLINE="root=/dev/ram0 console=ttyAMA2,115200n8" 21CONFIG_CMDLINE="root=/dev/ram0 console=ttyAMA2,115200n8"
20CONFIG_CPU_FREQ=y 22CONFIG_CPU_FREQ=y
21CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 23CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
@@ -68,8 +70,8 @@ CONFIG_CPU_THERMAL=y
68CONFIG_WATCHDOG=y 70CONFIG_WATCHDOG=y
69CONFIG_MFD_STMPE=y 71CONFIG_MFD_STMPE=y
70CONFIG_MFD_TC3589X=y 72CONFIG_MFD_TC3589X=y
71CONFIG_REGULATOR_GPIO=y
72CONFIG_REGULATOR_AB8500=y 73CONFIG_REGULATOR_AB8500=y
74CONFIG_REGULATOR_GPIO=y
73CONFIG_SOUND=y 75CONFIG_SOUND=y
74CONFIG_SND=y 76CONFIG_SND=y
75CONFIG_SND_SOC=y 77CONFIG_SND_SOC=y
@@ -78,10 +80,8 @@ CONFIG_SND_SOC_UX500_MACH_MOP500=y
78CONFIG_USB=y 80CONFIG_USB=y
79CONFIG_USB_MUSB_HDRC=y 81CONFIG_USB_MUSB_HDRC=y
80CONFIG_USB_MUSB_UX500=y 82CONFIG_USB_MUSB_UX500=y
81CONFIG_USB_PHY=y
82CONFIG_AB8500_USB=y 83CONFIG_AB8500_USB=y
83CONFIG_USB_GADGET=y 84CONFIG_USB_GADGET=y
84CONFIG_USB_GADGET_MUSB_HDRC=y
85CONFIG_USB_ETH=m 85CONFIG_USB_ETH=m
86CONFIG_MMC=y 86CONFIG_MMC=y
87CONFIG_MMC_UNSAFE_RESUME=y 87CONFIG_MMC_UNSAFE_RESUME=y
@@ -116,12 +116,12 @@ CONFIG_NFS_FS=y
116CONFIG_ROOT_NFS=y 116CONFIG_ROOT_NFS=y
117CONFIG_NLS_CODEPAGE_437=y 117CONFIG_NLS_CODEPAGE_437=y
118CONFIG_NLS_ISO8859_1=y 118CONFIG_NLS_ISO8859_1=y
119CONFIG_MAGIC_SYSRQ=y 119CONFIG_DEBUG_INFO=y
120CONFIG_DEBUG_FS=y 120CONFIG_DEBUG_FS=y
121CONFIG_MAGIC_SYSRQ=y
121CONFIG_DEBUG_KERNEL=y 122CONFIG_DEBUG_KERNEL=y
122# CONFIG_SCHED_DEBUG is not set 123# CONFIG_SCHED_DEBUG is not set
123# CONFIG_DEBUG_PREEMPT is not set 124# CONFIG_DEBUG_PREEMPT is not set
124CONFIG_DEBUG_INFO=y
125# CONFIG_FTRACE is not set 125# CONFIG_FTRACE is not set
126CONFIG_DEBUG_USER=y 126CONFIG_DEBUG_USER=y
127CONFIG_CRYPTO_DEV_UX500=y 127CONFIG_CRYPTO_DEV_UX500=y
diff --git a/arch/arm/configs/vexpress_defconfig b/arch/arm/configs/vexpress_defconfig
index f2de51f0bd18..f489fdaa19b8 100644
--- a/arch/arm/configs/vexpress_defconfig
+++ b/arch/arm/configs/vexpress_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
4CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
@@ -8,11 +7,9 @@ CONFIG_CGROUPS=y
8CONFIG_CPUSETS=y 7CONFIG_CPUSETS=y
9# CONFIG_UTS_NS is not set 8# CONFIG_UTS_NS is not set
10# CONFIG_IPC_NS is not set 9# CONFIG_IPC_NS is not set
11# CONFIG_USER_NS is not set
12# CONFIG_PID_NS is not set 10# CONFIG_PID_NS is not set
13# CONFIG_NET_NS is not set 11# CONFIG_NET_NS is not set
14CONFIG_BLK_DEV_INITRD=y 12CONFIG_BLK_DEV_INITRD=y
15# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
16CONFIG_PROFILING=y 13CONFIG_PROFILING=y
17CONFIG_OPROFILE=y 14CONFIG_OPROFILE=y
18CONFIG_MODULES=y 15CONFIG_MODULES=y
@@ -23,14 +20,22 @@ CONFIG_MODULE_UNLOAD=y
23# CONFIG_IOSCHED_CFQ is not set 20# CONFIG_IOSCHED_CFQ is not set
24CONFIG_ARCH_VEXPRESS=y 21CONFIG_ARCH_VEXPRESS=y
25CONFIG_ARCH_VEXPRESS_CA9X4=y 22CONFIG_ARCH_VEXPRESS_CA9X4=y
23CONFIG_ARCH_VEXPRESS_DCSCB=y
24CONFIG_ARCH_VEXPRESS_TC2_PM=y
26# CONFIG_SWP_EMULATE is not set 25# CONFIG_SWP_EMULATE is not set
27CONFIG_SMP=y 26CONFIG_SMP=y
27CONFIG_HAVE_ARM_ARCH_TIMER=y
28CONFIG_MCPM=y
28CONFIG_VMSPLIT_2G=y 29CONFIG_VMSPLIT_2G=y
29CONFIG_HOTPLUG_CPU=y 30CONFIG_NR_CPUS=8
31CONFIG_ARM_PSCI=y
30CONFIG_AEABI=y 32CONFIG_AEABI=y
33CONFIG_CMA=y
31CONFIG_ZBOOT_ROM_TEXT=0x0 34CONFIG_ZBOOT_ROM_TEXT=0x0
32CONFIG_ZBOOT_ROM_BSS=0x0 35CONFIG_ZBOOT_ROM_BSS=0x0
33CONFIG_CMDLINE="root=/dev/nfs nfsroot=10.1.69.3:/work/nfsroot ip=dhcp console=ttyAMA0 mem=128M" 36CONFIG_CMDLINE="console=ttyAMA0"
37CONFIG_CPU_IDLE=y
38CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y
34CONFIG_VFP=y 39CONFIG_VFP=y
35CONFIG_NEON=y 40CONFIG_NEON=y
36# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 41# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
@@ -44,37 +49,46 @@ CONFIG_IP_PNP_BOOTP=y
44# CONFIG_INET_LRO is not set 49# CONFIG_INET_LRO is not set
45# CONFIG_IPV6 is not set 50# CONFIG_IPV6 is not set
46# CONFIG_WIRELESS is not set 51# CONFIG_WIRELESS is not set
52CONFIG_NET_9P=y
53CONFIG_NET_9P_VIRTIO=y
47CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 54CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
55CONFIG_DEVTMPFS=y
48CONFIG_MTD=y 56CONFIG_MTD=y
49CONFIG_MTD_CONCAT=y
50CONFIG_MTD_PARTITIONS=y
51CONFIG_MTD_CMDLINE_PARTS=y 57CONFIG_MTD_CMDLINE_PARTS=y
52CONFIG_MTD_CHAR=y
53CONFIG_MTD_BLOCK=y 58CONFIG_MTD_BLOCK=y
54CONFIG_MTD_CFI=y 59CONFIG_MTD_CFI=y
55CONFIG_MTD_CFI_INTELEXT=y 60CONFIG_MTD_CFI_INTELEXT=y
56CONFIG_MTD_CFI_AMDSTD=y 61CONFIG_MTD_CFI_AMDSTD=y
57CONFIG_MTD_ARM_INTEGRATOR=y 62CONFIG_MTD_PHYSMAP=y
58CONFIG_MISC_DEVICES=y 63CONFIG_MTD_PHYSMAP_OF=y
64CONFIG_MTD_PLATRAM=y
65CONFIG_MTD_UBI=y
66CONFIG_PROC_DEVICETREE=y
67CONFIG_VIRTIO_BLK=y
59# CONFIG_SCSI_PROC_FS is not set 68# CONFIG_SCSI_PROC_FS is not set
60CONFIG_BLK_DEV_SD=y 69CONFIG_BLK_DEV_SD=y
61# CONFIG_SCSI_LOWLEVEL is not set 70CONFIG_SCSI_VIRTIO=y
62CONFIG_ATA=y 71CONFIG_ATA=y
63# CONFIG_SATA_PMP is not set 72# CONFIG_SATA_PMP is not set
64CONFIG_NETDEVICES=y 73CONFIG_NETDEVICES=y
65CONFIG_NET_ETHERNET=y 74CONFIG_VIRTIO_NET=y
75CONFIG_SMC91X=y
66CONFIG_SMSC911X=y 76CONFIG_SMSC911X=y
67# CONFIG_NETDEV_1000 is not set
68# CONFIG_NETDEV_10000 is not set
69# CONFIG_WLAN is not set 77# CONFIG_WLAN is not set
70CONFIG_INPUT_EVDEV=y 78CONFIG_INPUT_EVDEV=y
71# CONFIG_SERIO_SERPORT is not set 79# CONFIG_SERIO_SERPORT is not set
72CONFIG_SERIO_AMBAKMI=y 80CONFIG_SERIO_AMBAKMI=y
81CONFIG_LEGACY_PTY_COUNT=16
73CONFIG_SERIAL_AMBA_PL011=y 82CONFIG_SERIAL_AMBA_PL011=y
74CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 83CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
75CONFIG_LEGACY_PTY_COUNT=16 84CONFIG_VIRTIO_CONSOLE=y
76# CONFIG_HW_RANDOM is not set 85CONFIG_HW_RANDOM=y
77# CONFIG_HWMON is not set 86CONFIG_HW_RANDOM_VIRTIO=y
87CONFIG_I2C=y
88CONFIG_I2C_VERSATILE=y
89CONFIG_SENSORS_VEXPRESS=y
90CONFIG_REGULATOR=y
91CONFIG_REGULATOR_VEXPRESS=y
78CONFIG_FB=y 92CONFIG_FB=y
79CONFIG_FB_ARMCLCD=y 93CONFIG_FB_ARMCLCD=y
80CONFIG_FRAMEBUFFER_CONSOLE=y 94CONFIG_FRAMEBUFFER_CONSOLE=y
@@ -103,38 +117,45 @@ CONFIG_HID_THRUSTMASTER=y
103CONFIG_HID_ZEROPLUS=y 117CONFIG_HID_ZEROPLUS=y
104CONFIG_USB=y 118CONFIG_USB=y
105CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 119CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
106# CONFIG_USB_DEVICE_CLASS is not set
107CONFIG_USB_MON=y 120CONFIG_USB_MON=y
108CONFIG_USB_ISP1760_HCD=y 121CONFIG_USB_ISP1760_HCD=y
109CONFIG_USB_STORAGE=y 122CONFIG_USB_STORAGE=y
110CONFIG_MMC=y 123CONFIG_MMC=y
111CONFIG_MMC_ARMMMCI=y 124CONFIG_MMC_ARMMMCI=y
125CONFIG_NEW_LEDS=y
126CONFIG_LEDS_CLASS=y
127CONFIG_LEDS_GPIO=y
128CONFIG_LEDS_TRIGGERS=y
129CONFIG_LEDS_TRIGGER_HEARTBEAT=y
130CONFIG_LEDS_TRIGGER_CPU=y
112CONFIG_RTC_CLASS=y 131CONFIG_RTC_CLASS=y
113CONFIG_RTC_DRV_PL031=y 132CONFIG_RTC_DRV_PL031=y
133CONFIG_VIRTIO_BALLOON=y
134CONFIG_VIRTIO_MMIO=y
135CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
114CONFIG_EXT2_FS=y 136CONFIG_EXT2_FS=y
115CONFIG_EXT3_FS=y 137CONFIG_EXT3_FS=y
116# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 138# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
117# CONFIG_EXT3_FS_XATTR is not set 139# CONFIG_EXT3_FS_XATTR is not set
140CONFIG_EXT4_FS=y
118CONFIG_VFAT_FS=y 141CONFIG_VFAT_FS=y
119CONFIG_TMPFS=y 142CONFIG_TMPFS=y
120CONFIG_JFFS2_FS=y 143CONFIG_JFFS2_FS=y
144CONFIG_UBIFS_FS=y
121CONFIG_CRAMFS=y 145CONFIG_CRAMFS=y
146CONFIG_SQUASHFS=y
147CONFIG_SQUASHFS_LZO=y
122CONFIG_NFS_FS=y 148CONFIG_NFS_FS=y
123CONFIG_NFS_V3=y
124CONFIG_ROOT_NFS=y 149CONFIG_ROOT_NFS=y
125# CONFIG_RPCSEC_GSS_KRB5 is not set 150CONFIG_9P_FS=y
126CONFIG_NLS_CODEPAGE_437=y 151CONFIG_NLS_CODEPAGE_437=y
127CONFIG_NLS_ISO8859_1=y 152CONFIG_NLS_ISO8859_1=y
128CONFIG_MAGIC_SYSRQ=y 153CONFIG_DEBUG_INFO=y
129CONFIG_DEBUG_FS=y 154CONFIG_DEBUG_FS=y
155CONFIG_MAGIC_SYSRQ=y
130CONFIG_DEBUG_KERNEL=y 156CONFIG_DEBUG_KERNEL=y
131CONFIG_DETECT_HUNG_TASK=y 157CONFIG_DETECT_HUNG_TASK=y
132# CONFIG_SCHED_DEBUG is not set 158# CONFIG_SCHED_DEBUG is not set
133CONFIG_DEBUG_INFO=y
134# CONFIG_RCU_CPU_STALL_DETECTOR is not set
135CONFIG_DEBUG_USER=y 159CONFIG_DEBUG_USER=y
136CONFIG_DEBUG_ERRORS=y
137CONFIG_DEBUG_LL=y
138CONFIG_EARLY_PRINTK=y
139# CONFIG_CRYPTO_ANSI_CPRNG is not set 160# CONFIG_CRYPTO_ANSI_CPRNG is not set
140# CONFIG_CRYPTO_HW is not set 161# CONFIG_CRYPTO_HW is not set
diff --git a/arch/arm/crypto/.gitignore b/arch/arm/crypto/.gitignore
new file mode 100644
index 000000000000..6231d36b3635
--- /dev/null
+++ b/arch/arm/crypto/.gitignore
@@ -0,0 +1 @@
aesbs-core.S
diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile
index a2c83851bc90..81cda39860c5 100644
--- a/arch/arm/crypto/Makefile
+++ b/arch/arm/crypto/Makefile
@@ -3,7 +3,17 @@
3# 3#
4 4
5obj-$(CONFIG_CRYPTO_AES_ARM) += aes-arm.o 5obj-$(CONFIG_CRYPTO_AES_ARM) += aes-arm.o
6obj-$(CONFIG_CRYPTO_AES_ARM_BS) += aes-arm-bs.o
6obj-$(CONFIG_CRYPTO_SHA1_ARM) += sha1-arm.o 7obj-$(CONFIG_CRYPTO_SHA1_ARM) += sha1-arm.o
7 8
8aes-arm-y := aes-armv4.o aes_glue.o 9aes-arm-y := aes-armv4.o aes_glue.o
9sha1-arm-y := sha1-armv4-large.o sha1_glue.o 10aes-arm-bs-y := aesbs-core.o aesbs-glue.o
11sha1-arm-y := sha1-armv4-large.o sha1_glue.o
12
13quiet_cmd_perl = PERL $@
14 cmd_perl = $(PERL) $(<) > $(@)
15
16$(src)/aesbs-core.S_shipped: $(src)/bsaes-armv7.pl
17 $(call cmd,perl)
18
19.PRECIOUS: $(obj)/aesbs-core.S
diff --git a/arch/arm/crypto/aes-armv4.S b/arch/arm/crypto/aes-armv4.S
index 19d6cd6f29f9..3a14ea8fe97e 100644
--- a/arch/arm/crypto/aes-armv4.S
+++ b/arch/arm/crypto/aes-armv4.S
@@ -148,7 +148,7 @@ AES_Te:
148@ const AES_KEY *key) { 148@ const AES_KEY *key) {
149.align 5 149.align 5
150ENTRY(AES_encrypt) 150ENTRY(AES_encrypt)
151 sub r3,pc,#8 @ AES_encrypt 151 adr r3,AES_encrypt
152 stmdb sp!,{r1,r4-r12,lr} 152 stmdb sp!,{r1,r4-r12,lr}
153 mov r12,r0 @ inp 153 mov r12,r0 @ inp
154 mov r11,r2 154 mov r11,r2
@@ -381,7 +381,7 @@ _armv4_AES_encrypt:
381.align 5 381.align 5
382ENTRY(private_AES_set_encrypt_key) 382ENTRY(private_AES_set_encrypt_key)
383_armv4_AES_set_encrypt_key: 383_armv4_AES_set_encrypt_key:
384 sub r3,pc,#8 @ AES_set_encrypt_key 384 adr r3,_armv4_AES_set_encrypt_key
385 teq r0,#0 385 teq r0,#0
386 moveq r0,#-1 386 moveq r0,#-1
387 beq .Labrt 387 beq .Labrt
@@ -843,7 +843,7 @@ AES_Td:
843@ const AES_KEY *key) { 843@ const AES_KEY *key) {
844.align 5 844.align 5
845ENTRY(AES_decrypt) 845ENTRY(AES_decrypt)
846 sub r3,pc,#8 @ AES_decrypt 846 adr r3,AES_decrypt
847 stmdb sp!,{r1,r4-r12,lr} 847 stmdb sp!,{r1,r4-r12,lr}
848 mov r12,r0 @ inp 848 mov r12,r0 @ inp
849 mov r11,r2 849 mov r11,r2
diff --git a/arch/arm/crypto/aes_glue.c b/arch/arm/crypto/aes_glue.c
index 59f7877ead6a..3003fa1f6fb4 100644
--- a/arch/arm/crypto/aes_glue.c
+++ b/arch/arm/crypto/aes_glue.c
@@ -6,22 +6,12 @@
6#include <linux/crypto.h> 6#include <linux/crypto.h>
7#include <crypto/aes.h> 7#include <crypto/aes.h>
8 8
9#define AES_MAXNR 14 9#include "aes_glue.h"
10 10
11typedef struct { 11EXPORT_SYMBOL(AES_encrypt);
12 unsigned int rd_key[4 *(AES_MAXNR + 1)]; 12EXPORT_SYMBOL(AES_decrypt);
13 int rounds; 13EXPORT_SYMBOL(private_AES_set_encrypt_key);
14} AES_KEY; 14EXPORT_SYMBOL(private_AES_set_decrypt_key);
15
16struct AES_CTX {
17 AES_KEY enc_key;
18 AES_KEY dec_key;
19};
20
21asmlinkage void AES_encrypt(const u8 *in, u8 *out, AES_KEY *ctx);
22asmlinkage void AES_decrypt(const u8 *in, u8 *out, AES_KEY *ctx);
23asmlinkage int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key);
24asmlinkage int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key);
25 15
26static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) 16static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
27{ 17{
@@ -81,7 +71,7 @@ static struct crypto_alg aes_alg = {
81 .cipher = { 71 .cipher = {
82 .cia_min_keysize = AES_MIN_KEY_SIZE, 72 .cia_min_keysize = AES_MIN_KEY_SIZE,
83 .cia_max_keysize = AES_MAX_KEY_SIZE, 73 .cia_max_keysize = AES_MAX_KEY_SIZE,
84 .cia_setkey = aes_set_key, 74 .cia_setkey = aes_set_key,
85 .cia_encrypt = aes_encrypt, 75 .cia_encrypt = aes_encrypt,
86 .cia_decrypt = aes_decrypt 76 .cia_decrypt = aes_decrypt
87 } 77 }
diff --git a/arch/arm/crypto/aes_glue.h b/arch/arm/crypto/aes_glue.h
new file mode 100644
index 000000000000..cca3e51eb606
--- /dev/null
+++ b/arch/arm/crypto/aes_glue.h
@@ -0,0 +1,19 @@
1
2#define AES_MAXNR 14
3
4struct AES_KEY {
5 unsigned int rd_key[4 * (AES_MAXNR + 1)];
6 int rounds;
7};
8
9struct AES_CTX {
10 struct AES_KEY enc_key;
11 struct AES_KEY dec_key;
12};
13
14asmlinkage void AES_encrypt(const u8 *in, u8 *out, struct AES_KEY *ctx);
15asmlinkage void AES_decrypt(const u8 *in, u8 *out, struct AES_KEY *ctx);
16asmlinkage int private_AES_set_decrypt_key(const unsigned char *userKey,
17 const int bits, struct AES_KEY *key);
18asmlinkage int private_AES_set_encrypt_key(const unsigned char *userKey,
19 const int bits, struct AES_KEY *key);
diff --git a/arch/arm/crypto/aesbs-core.S_shipped b/arch/arm/crypto/aesbs-core.S_shipped
new file mode 100644
index 000000000000..64205d453260
--- /dev/null
+++ b/arch/arm/crypto/aesbs-core.S_shipped
@@ -0,0 +1,2544 @@
1
2@ ====================================================================
3@ Written by Andy Polyakov <appro@openssl.org> for the OpenSSL
4@ project. The module is, however, dual licensed under OpenSSL and
5@ CRYPTOGAMS licenses depending on where you obtain it. For further
6@ details see http://www.openssl.org/~appro/cryptogams/.
7@
8@ Specific modes and adaptation for Linux kernel by Ard Biesheuvel
9@ <ard.biesheuvel@linaro.org>. Permission to use under GPL terms is
10@ granted.
11@ ====================================================================
12
13@ Bit-sliced AES for ARM NEON
14@
15@ February 2012.
16@
17@ This implementation is direct adaptation of bsaes-x86_64 module for
18@ ARM NEON. Except that this module is endian-neutral [in sense that
19@ it can be compiled for either endianness] by courtesy of vld1.8's
20@ neutrality. Initial version doesn't implement interface to OpenSSL,
21@ only low-level primitives and unsupported entry points, just enough
22@ to collect performance results, which for Cortex-A8 core are:
23@
24@ encrypt 19.5 cycles per byte processed with 128-bit key
25@ decrypt 22.1 cycles per byte processed with 128-bit key
26@ key conv. 440 cycles per 128-bit key/0.18 of 8x block
27@
28@ Snapdragon S4 encrypts byte in 17.6 cycles and decrypts in 19.7,
29@ which is [much] worse than anticipated (for further details see
30@ http://www.openssl.org/~appro/Snapdragon-S4.html).
31@
32@ Cortex-A15 manages in 14.2/16.1 cycles [when integer-only code
33@ manages in 20.0 cycles].
34@
35@ When comparing to x86_64 results keep in mind that NEON unit is
36@ [mostly] single-issue and thus can't [fully] benefit from
37@ instruction-level parallelism. And when comparing to aes-armv4
38@ results keep in mind key schedule conversion overhead (see
39@ bsaes-x86_64.pl for further details)...
40@
41@ <appro@openssl.org>
42
43@ April-August 2013
44@
45@ Add CBC, CTR and XTS subroutines, adapt for kernel use.
46@
47@ <ard.biesheuvel@linaro.org>
48
49#ifndef __KERNEL__
50# include "arm_arch.h"
51
52# define VFP_ABI_PUSH vstmdb sp!,{d8-d15}
53# define VFP_ABI_POP vldmia sp!,{d8-d15}
54# define VFP_ABI_FRAME 0x40
55#else
56# define VFP_ABI_PUSH
57# define VFP_ABI_POP
58# define VFP_ABI_FRAME 0
59# define BSAES_ASM_EXTENDED_KEY
60# define XTS_CHAIN_TWEAK
61# define __ARM_ARCH__ __LINUX_ARM_ARCH__
62#endif
63
64#ifdef __thumb__
65# define adrl adr
66#endif
67
68#if __ARM_ARCH__>=7
69.text
70.syntax unified @ ARMv7-capable assembler is expected to handle this
71#ifdef __thumb2__
72.thumb
73#else
74.code 32
75#endif
76
77.fpu neon
78
79.type _bsaes_decrypt8,%function
80.align 4
81_bsaes_decrypt8:
82 adr r6,_bsaes_decrypt8
83 vldmia r4!, {q9} @ round 0 key
84 add r6,r6,#.LM0ISR-_bsaes_decrypt8
85
86 vldmia r6!, {q8} @ .LM0ISR
87 veor q10, q0, q9 @ xor with round0 key
88 veor q11, q1, q9
89 vtbl.8 d0, {q10}, d16
90 vtbl.8 d1, {q10}, d17
91 veor q12, q2, q9
92 vtbl.8 d2, {q11}, d16
93 vtbl.8 d3, {q11}, d17
94 veor q13, q3, q9
95 vtbl.8 d4, {q12}, d16
96 vtbl.8 d5, {q12}, d17
97 veor q14, q4, q9
98 vtbl.8 d6, {q13}, d16
99 vtbl.8 d7, {q13}, d17
100 veor q15, q5, q9
101 vtbl.8 d8, {q14}, d16
102 vtbl.8 d9, {q14}, d17
103 veor q10, q6, q9
104 vtbl.8 d10, {q15}, d16
105 vtbl.8 d11, {q15}, d17
106 veor q11, q7, q9
107 vtbl.8 d12, {q10}, d16
108 vtbl.8 d13, {q10}, d17
109 vtbl.8 d14, {q11}, d16
110 vtbl.8 d15, {q11}, d17
111 vmov.i8 q8,#0x55 @ compose .LBS0
112 vmov.i8 q9,#0x33 @ compose .LBS1
113 vshr.u64 q10, q6, #1
114 vshr.u64 q11, q4, #1
115 veor q10, q10, q7
116 veor q11, q11, q5
117 vand q10, q10, q8
118 vand q11, q11, q8
119 veor q7, q7, q10
120 vshl.u64 q10, q10, #1
121 veor q5, q5, q11
122 vshl.u64 q11, q11, #1
123 veor q6, q6, q10
124 veor q4, q4, q11
125 vshr.u64 q10, q2, #1
126 vshr.u64 q11, q0, #1
127 veor q10, q10, q3
128 veor q11, q11, q1
129 vand q10, q10, q8
130 vand q11, q11, q8
131 veor q3, q3, q10
132 vshl.u64 q10, q10, #1
133 veor q1, q1, q11
134 vshl.u64 q11, q11, #1
135 veor q2, q2, q10
136 veor q0, q0, q11
137 vmov.i8 q8,#0x0f @ compose .LBS2
138 vshr.u64 q10, q5, #2
139 vshr.u64 q11, q4, #2
140 veor q10, q10, q7
141 veor q11, q11, q6
142 vand q10, q10, q9
143 vand q11, q11, q9
144 veor q7, q7, q10
145 vshl.u64 q10, q10, #2
146 veor q6, q6, q11
147 vshl.u64 q11, q11, #2
148 veor q5, q5, q10
149 veor q4, q4, q11
150 vshr.u64 q10, q1, #2
151 vshr.u64 q11, q0, #2
152 veor q10, q10, q3
153 veor q11, q11, q2
154 vand q10, q10, q9
155 vand q11, q11, q9
156 veor q3, q3, q10
157 vshl.u64 q10, q10, #2
158 veor q2, q2, q11
159 vshl.u64 q11, q11, #2
160 veor q1, q1, q10
161 veor q0, q0, q11
162 vshr.u64 q10, q3, #4
163 vshr.u64 q11, q2, #4
164 veor q10, q10, q7
165 veor q11, q11, q6
166 vand q10, q10, q8
167 vand q11, q11, q8
168 veor q7, q7, q10
169 vshl.u64 q10, q10, #4
170 veor q6, q6, q11
171 vshl.u64 q11, q11, #4
172 veor q3, q3, q10
173 veor q2, q2, q11
174 vshr.u64 q10, q1, #4
175 vshr.u64 q11, q0, #4
176 veor q10, q10, q5
177 veor q11, q11, q4
178 vand q10, q10, q8
179 vand q11, q11, q8
180 veor q5, q5, q10
181 vshl.u64 q10, q10, #4
182 veor q4, q4, q11
183 vshl.u64 q11, q11, #4
184 veor q1, q1, q10
185 veor q0, q0, q11
186 sub r5,r5,#1
187 b .Ldec_sbox
188.align 4
189.Ldec_loop:
190 vldmia r4!, {q8-q11}
191 veor q8, q8, q0
192 veor q9, q9, q1
193 vtbl.8 d0, {q8}, d24
194 vtbl.8 d1, {q8}, d25
195 vldmia r4!, {q8}
196 veor q10, q10, q2
197 vtbl.8 d2, {q9}, d24
198 vtbl.8 d3, {q9}, d25
199 vldmia r4!, {q9}
200 veor q11, q11, q3
201 vtbl.8 d4, {q10}, d24
202 vtbl.8 d5, {q10}, d25
203 vldmia r4!, {q10}
204 vtbl.8 d6, {q11}, d24
205 vtbl.8 d7, {q11}, d25
206 vldmia r4!, {q11}
207 veor q8, q8, q4
208 veor q9, q9, q5
209 vtbl.8 d8, {q8}, d24
210 vtbl.8 d9, {q8}, d25
211 veor q10, q10, q6
212 vtbl.8 d10, {q9}, d24
213 vtbl.8 d11, {q9}, d25
214 veor q11, q11, q7
215 vtbl.8 d12, {q10}, d24
216 vtbl.8 d13, {q10}, d25
217 vtbl.8 d14, {q11}, d24
218 vtbl.8 d15, {q11}, d25
219.Ldec_sbox:
220 veor q1, q1, q4
221 veor q3, q3, q4
222
223 veor q4, q4, q7
224 veor q1, q1, q6
225 veor q2, q2, q7
226 veor q6, q6, q4
227
228 veor q0, q0, q1
229 veor q2, q2, q5
230 veor q7, q7, q6
231 veor q3, q3, q0
232 veor q5, q5, q0
233 veor q1, q1, q3
234 veor q11, q3, q0
235 veor q10, q7, q4
236 veor q9, q1, q6
237 veor q13, q4, q0
238 vmov q8, q10
239 veor q12, q5, q2
240
241 vorr q10, q10, q9
242 veor q15, q11, q8
243 vand q14, q11, q12
244 vorr q11, q11, q12
245 veor q12, q12, q9
246 vand q8, q8, q9
247 veor q9, q6, q2
248 vand q15, q15, q12
249 vand q13, q13, q9
250 veor q9, q3, q7
251 veor q12, q1, q5
252 veor q11, q11, q13
253 veor q10, q10, q13
254 vand q13, q9, q12
255 vorr q9, q9, q12
256 veor q11, q11, q15
257 veor q8, q8, q13
258 veor q10, q10, q14
259 veor q9, q9, q15
260 veor q8, q8, q14
261 vand q12, q4, q6
262 veor q9, q9, q14
263 vand q13, q0, q2
264 vand q14, q7, q1
265 vorr q15, q3, q5
266 veor q11, q11, q12
267 veor q9, q9, q14
268 veor q8, q8, q15
269 veor q10, q10, q13
270
271 @ Inv_GF16 0, 1, 2, 3, s0, s1, s2, s3
272
273 @ new smaller inversion
274
275 vand q14, q11, q9
276 vmov q12, q8
277
278 veor q13, q10, q14
279 veor q15, q8, q14
280 veor q14, q8, q14 @ q14=q15
281
282 vbsl q13, q9, q8
283 vbsl q15, q11, q10
284 veor q11, q11, q10
285
286 vbsl q12, q13, q14
287 vbsl q8, q14, q13
288
289 vand q14, q12, q15
290 veor q9, q9, q8
291
292 veor q14, q14, q11
293 veor q12, q5, q2
294 veor q8, q1, q6
295 veor q10, q15, q14
296 vand q10, q10, q5
297 veor q5, q5, q1
298 vand q11, q1, q15
299 vand q5, q5, q14
300 veor q1, q11, q10
301 veor q5, q5, q11
302 veor q15, q15, q13
303 veor q14, q14, q9
304 veor q11, q15, q14
305 veor q10, q13, q9
306 vand q11, q11, q12
307 vand q10, q10, q2
308 veor q12, q12, q8
309 veor q2, q2, q6
310 vand q8, q8, q15
311 vand q6, q6, q13
312 vand q12, q12, q14
313 vand q2, q2, q9
314 veor q8, q8, q12
315 veor q2, q2, q6
316 veor q12, q12, q11
317 veor q6, q6, q10
318 veor q5, q5, q12
319 veor q2, q2, q12
320 veor q1, q1, q8
321 veor q6, q6, q8
322
323 veor q12, q3, q0
324 veor q8, q7, q4
325 veor q11, q15, q14
326 veor q10, q13, q9
327 vand q11, q11, q12
328 vand q10, q10, q0
329 veor q12, q12, q8
330 veor q0, q0, q4
331 vand q8, q8, q15
332 vand q4, q4, q13
333 vand q12, q12, q14
334 vand q0, q0, q9
335 veor q8, q8, q12
336 veor q0, q0, q4
337 veor q12, q12, q11
338 veor q4, q4, q10
339 veor q15, q15, q13
340 veor q14, q14, q9
341 veor q10, q15, q14
342 vand q10, q10, q3
343 veor q3, q3, q7
344 vand q11, q7, q15
345 vand q3, q3, q14
346 veor q7, q11, q10
347 veor q3, q3, q11
348 veor q3, q3, q12
349 veor q0, q0, q12
350 veor q7, q7, q8
351 veor q4, q4, q8
352 veor q1, q1, q7
353 veor q6, q6, q5
354
355 veor q4, q4, q1
356 veor q2, q2, q7
357 veor q5, q5, q7
358 veor q4, q4, q2
359 veor q7, q7, q0
360 veor q4, q4, q5
361 veor q3, q3, q6
362 veor q6, q6, q1
363 veor q3, q3, q4
364
365 veor q4, q4, q0
366 veor q7, q7, q3
367 subs r5,r5,#1
368 bcc .Ldec_done
369 @ multiplication by 0x05-0x00-0x04-0x00
370 vext.8 q8, q0, q0, #8
371 vext.8 q14, q3, q3, #8
372 vext.8 q15, q5, q5, #8
373 veor q8, q8, q0
374 vext.8 q9, q1, q1, #8
375 veor q14, q14, q3
376 vext.8 q10, q6, q6, #8
377 veor q15, q15, q5
378 vext.8 q11, q4, q4, #8
379 veor q9, q9, q1
380 vext.8 q12, q2, q2, #8
381 veor q10, q10, q6
382 vext.8 q13, q7, q7, #8
383 veor q11, q11, q4
384 veor q12, q12, q2
385 veor q13, q13, q7
386
387 veor q0, q0, q14
388 veor q1, q1, q14
389 veor q6, q6, q8
390 veor q2, q2, q10
391 veor q4, q4, q9
392 veor q1, q1, q15
393 veor q6, q6, q15
394 veor q2, q2, q14
395 veor q7, q7, q11
396 veor q4, q4, q14
397 veor q3, q3, q12
398 veor q2, q2, q15
399 veor q7, q7, q15
400 veor q5, q5, q13
401 vext.8 q8, q0, q0, #12 @ x0 <<< 32
402 vext.8 q9, q1, q1, #12
403 veor q0, q0, q8 @ x0 ^ (x0 <<< 32)
404 vext.8 q10, q6, q6, #12
405 veor q1, q1, q9
406 vext.8 q11, q4, q4, #12
407 veor q6, q6, q10
408 vext.8 q12, q2, q2, #12
409 veor q4, q4, q11
410 vext.8 q13, q7, q7, #12
411 veor q2, q2, q12
412 vext.8 q14, q3, q3, #12
413 veor q7, q7, q13
414 vext.8 q15, q5, q5, #12
415 veor q3, q3, q14
416
417 veor q9, q9, q0
418 veor q5, q5, q15
419 vext.8 q0, q0, q0, #8 @ (x0 ^ (x0 <<< 32)) <<< 64)
420 veor q10, q10, q1
421 veor q8, q8, q5
422 veor q9, q9, q5
423 vext.8 q1, q1, q1, #8
424 veor q13, q13, q2
425 veor q0, q0, q8
426 veor q14, q14, q7
427 veor q1, q1, q9
428 vext.8 q8, q2, q2, #8
429 veor q12, q12, q4
430 vext.8 q9, q7, q7, #8
431 veor q15, q15, q3
432 vext.8 q2, q4, q4, #8
433 veor q11, q11, q6
434 vext.8 q7, q5, q5, #8
435 veor q12, q12, q5
436 vext.8 q4, q3, q3, #8
437 veor q11, q11, q5
438 vext.8 q3, q6, q6, #8
439 veor q5, q9, q13
440 veor q11, q11, q2
441 veor q7, q7, q15
442 veor q6, q4, q14
443 veor q4, q8, q12
444 veor q2, q3, q10
445 vmov q3, q11
446 @ vmov q5, q9
447 vldmia r6, {q12} @ .LISR
448 ite eq @ Thumb2 thing, sanity check in ARM
449 addeq r6,r6,#0x10
450 bne .Ldec_loop
451 vldmia r6, {q12} @ .LISRM0
452 b .Ldec_loop
453.align 4
454.Ldec_done:
455 vmov.i8 q8,#0x55 @ compose .LBS0
456 vmov.i8 q9,#0x33 @ compose .LBS1
457 vshr.u64 q10, q3, #1
458 vshr.u64 q11, q2, #1
459 veor q10, q10, q5
460 veor q11, q11, q7
461 vand q10, q10, q8
462 vand q11, q11, q8
463 veor q5, q5, q10
464 vshl.u64 q10, q10, #1
465 veor q7, q7, q11
466 vshl.u64 q11, q11, #1
467 veor q3, q3, q10
468 veor q2, q2, q11
469 vshr.u64 q10, q6, #1
470 vshr.u64 q11, q0, #1
471 veor q10, q10, q4
472 veor q11, q11, q1
473 vand q10, q10, q8
474 vand q11, q11, q8
475 veor q4, q4, q10
476 vshl.u64 q10, q10, #1
477 veor q1, q1, q11
478 vshl.u64 q11, q11, #1
479 veor q6, q6, q10
480 veor q0, q0, q11
481 vmov.i8 q8,#0x0f @ compose .LBS2
482 vshr.u64 q10, q7, #2
483 vshr.u64 q11, q2, #2
484 veor q10, q10, q5
485 veor q11, q11, q3
486 vand q10, q10, q9
487 vand q11, q11, q9
488 veor q5, q5, q10
489 vshl.u64 q10, q10, #2
490 veor q3, q3, q11
491 vshl.u64 q11, q11, #2
492 veor q7, q7, q10
493 veor q2, q2, q11
494 vshr.u64 q10, q1, #2
495 vshr.u64 q11, q0, #2
496 veor q10, q10, q4
497 veor q11, q11, q6
498 vand q10, q10, q9
499 vand q11, q11, q9
500 veor q4, q4, q10
501 vshl.u64 q10, q10, #2
502 veor q6, q6, q11
503 vshl.u64 q11, q11, #2
504 veor q1, q1, q10
505 veor q0, q0, q11
506 vshr.u64 q10, q4, #4
507 vshr.u64 q11, q6, #4
508 veor q10, q10, q5
509 veor q11, q11, q3
510 vand q10, q10, q8
511 vand q11, q11, q8
512 veor q5, q5, q10
513 vshl.u64 q10, q10, #4
514 veor q3, q3, q11
515 vshl.u64 q11, q11, #4
516 veor q4, q4, q10
517 veor q6, q6, q11
518 vshr.u64 q10, q1, #4
519 vshr.u64 q11, q0, #4
520 veor q10, q10, q7
521 veor q11, q11, q2
522 vand q10, q10, q8
523 vand q11, q11, q8
524 veor q7, q7, q10
525 vshl.u64 q10, q10, #4
526 veor q2, q2, q11
527 vshl.u64 q11, q11, #4
528 veor q1, q1, q10
529 veor q0, q0, q11
530 vldmia r4, {q8} @ last round key
531 veor q6, q6, q8
532 veor q4, q4, q8
533 veor q2, q2, q8
534 veor q7, q7, q8
535 veor q3, q3, q8
536 veor q5, q5, q8
537 veor q0, q0, q8
538 veor q1, q1, q8
539 bx lr
540.size _bsaes_decrypt8,.-_bsaes_decrypt8
541
542.type _bsaes_const,%object
543.align 6
544_bsaes_const:
545.LM0ISR: @ InvShiftRows constants
546 .quad 0x0a0e0206070b0f03, 0x0004080c0d010509
547.LISR:
548 .quad 0x0504070602010003, 0x0f0e0d0c080b0a09
549.LISRM0:
550 .quad 0x01040b0e0205080f, 0x0306090c00070a0d
551.LM0SR: @ ShiftRows constants
552 .quad 0x0a0e02060f03070b, 0x0004080c05090d01
553.LSR:
554 .quad 0x0504070600030201, 0x0f0e0d0c0a09080b
555.LSRM0:
556 .quad 0x0304090e00050a0f, 0x01060b0c0207080d
557.LM0:
558 .quad 0x02060a0e03070b0f, 0x0004080c0105090d
559.LREVM0SR:
560 .quad 0x090d01050c000408, 0x03070b0f060a0e02
561.asciz "Bit-sliced AES for NEON, CRYPTOGAMS by <appro@openssl.org>"
562.align 6
563.size _bsaes_const,.-_bsaes_const
564
565.type _bsaes_encrypt8,%function
566.align 4
567_bsaes_encrypt8:
568 adr r6,_bsaes_encrypt8
569 vldmia r4!, {q9} @ round 0 key
570 sub r6,r6,#_bsaes_encrypt8-.LM0SR
571
572 vldmia r6!, {q8} @ .LM0SR
573_bsaes_encrypt8_alt:
574 veor q10, q0, q9 @ xor with round0 key
575 veor q11, q1, q9
576 vtbl.8 d0, {q10}, d16
577 vtbl.8 d1, {q10}, d17
578 veor q12, q2, q9
579 vtbl.8 d2, {q11}, d16
580 vtbl.8 d3, {q11}, d17
581 veor q13, q3, q9
582 vtbl.8 d4, {q12}, d16
583 vtbl.8 d5, {q12}, d17
584 veor q14, q4, q9
585 vtbl.8 d6, {q13}, d16
586 vtbl.8 d7, {q13}, d17
587 veor q15, q5, q9
588 vtbl.8 d8, {q14}, d16
589 vtbl.8 d9, {q14}, d17
590 veor q10, q6, q9
591 vtbl.8 d10, {q15}, d16
592 vtbl.8 d11, {q15}, d17
593 veor q11, q7, q9
594 vtbl.8 d12, {q10}, d16
595 vtbl.8 d13, {q10}, d17
596 vtbl.8 d14, {q11}, d16
597 vtbl.8 d15, {q11}, d17
598_bsaes_encrypt8_bitslice:
599 vmov.i8 q8,#0x55 @ compose .LBS0
600 vmov.i8 q9,#0x33 @ compose .LBS1
601 vshr.u64 q10, q6, #1
602 vshr.u64 q11, q4, #1
603 veor q10, q10, q7
604 veor q11, q11, q5
605 vand q10, q10, q8
606 vand q11, q11, q8
607 veor q7, q7, q10
608 vshl.u64 q10, q10, #1
609 veor q5, q5, q11
610 vshl.u64 q11, q11, #1
611 veor q6, q6, q10
612 veor q4, q4, q11
613 vshr.u64 q10, q2, #1
614 vshr.u64 q11, q0, #1
615 veor q10, q10, q3
616 veor q11, q11, q1
617 vand q10, q10, q8
618 vand q11, q11, q8
619 veor q3, q3, q10
620 vshl.u64 q10, q10, #1
621 veor q1, q1, q11
622 vshl.u64 q11, q11, #1
623 veor q2, q2, q10
624 veor q0, q0, q11
625 vmov.i8 q8,#0x0f @ compose .LBS2
626 vshr.u64 q10, q5, #2
627 vshr.u64 q11, q4, #2
628 veor q10, q10, q7
629 veor q11, q11, q6
630 vand q10, q10, q9
631 vand q11, q11, q9
632 veor q7, q7, q10
633 vshl.u64 q10, q10, #2
634 veor q6, q6, q11
635 vshl.u64 q11, q11, #2
636 veor q5, q5, q10
637 veor q4, q4, q11
638 vshr.u64 q10, q1, #2
639 vshr.u64 q11, q0, #2
640 veor q10, q10, q3
641 veor q11, q11, q2
642 vand q10, q10, q9
643 vand q11, q11, q9
644 veor q3, q3, q10
645 vshl.u64 q10, q10, #2
646 veor q2, q2, q11
647 vshl.u64 q11, q11, #2
648 veor q1, q1, q10
649 veor q0, q0, q11
650 vshr.u64 q10, q3, #4
651 vshr.u64 q11, q2, #4
652 veor q10, q10, q7
653 veor q11, q11, q6
654 vand q10, q10, q8
655 vand q11, q11, q8
656 veor q7, q7, q10
657 vshl.u64 q10, q10, #4
658 veor q6, q6, q11
659 vshl.u64 q11, q11, #4
660 veor q3, q3, q10
661 veor q2, q2, q11
662 vshr.u64 q10, q1, #4
663 vshr.u64 q11, q0, #4
664 veor q10, q10, q5
665 veor q11, q11, q4
666 vand q10, q10, q8
667 vand q11, q11, q8
668 veor q5, q5, q10
669 vshl.u64 q10, q10, #4
670 veor q4, q4, q11
671 vshl.u64 q11, q11, #4
672 veor q1, q1, q10
673 veor q0, q0, q11
674 sub r5,r5,#1
675 b .Lenc_sbox
676.align 4
677.Lenc_loop:
678 vldmia r4!, {q8-q11}
679 veor q8, q8, q0
680 veor q9, q9, q1
681 vtbl.8 d0, {q8}, d24
682 vtbl.8 d1, {q8}, d25
683 vldmia r4!, {q8}
684 veor q10, q10, q2
685 vtbl.8 d2, {q9}, d24
686 vtbl.8 d3, {q9}, d25
687 vldmia r4!, {q9}
688 veor q11, q11, q3
689 vtbl.8 d4, {q10}, d24
690 vtbl.8 d5, {q10}, d25
691 vldmia r4!, {q10}
692 vtbl.8 d6, {q11}, d24
693 vtbl.8 d7, {q11}, d25
694 vldmia r4!, {q11}
695 veor q8, q8, q4
696 veor q9, q9, q5
697 vtbl.8 d8, {q8}, d24
698 vtbl.8 d9, {q8}, d25
699 veor q10, q10, q6
700 vtbl.8 d10, {q9}, d24
701 vtbl.8 d11, {q9}, d25
702 veor q11, q11, q7
703 vtbl.8 d12, {q10}, d24
704 vtbl.8 d13, {q10}, d25
705 vtbl.8 d14, {q11}, d24
706 vtbl.8 d15, {q11}, d25
707.Lenc_sbox:
708 veor q2, q2, q1
709 veor q5, q5, q6
710 veor q3, q3, q0
711 veor q6, q6, q2
712 veor q5, q5, q0
713
714 veor q6, q6, q3
715 veor q3, q3, q7
716 veor q7, q7, q5
717 veor q3, q3, q4
718 veor q4, q4, q5
719
720 veor q2, q2, q7
721 veor q3, q3, q1
722 veor q1, q1, q5
723 veor q11, q7, q4
724 veor q10, q1, q2
725 veor q9, q5, q3
726 veor q13, q2, q4
727 vmov q8, q10
728 veor q12, q6, q0
729
730 vorr q10, q10, q9
731 veor q15, q11, q8
732 vand q14, q11, q12
733 vorr q11, q11, q12
734 veor q12, q12, q9
735 vand q8, q8, q9
736 veor q9, q3, q0
737 vand q15, q15, q12
738 vand q13, q13, q9
739 veor q9, q7, q1
740 veor q12, q5, q6
741 veor q11, q11, q13
742 veor q10, q10, q13
743 vand q13, q9, q12
744 vorr q9, q9, q12
745 veor q11, q11, q15
746 veor q8, q8, q13
747 veor q10, q10, q14
748 veor q9, q9, q15
749 veor q8, q8, q14
750 vand q12, q2, q3
751 veor q9, q9, q14
752 vand q13, q4, q0
753 vand q14, q1, q5
754 vorr q15, q7, q6
755 veor q11, q11, q12
756 veor q9, q9, q14
757 veor q8, q8, q15
758 veor q10, q10, q13
759
760 @ Inv_GF16 0, 1, 2, 3, s0, s1, s2, s3
761
762 @ new smaller inversion
763
764 vand q14, q11, q9
765 vmov q12, q8
766
767 veor q13, q10, q14
768 veor q15, q8, q14
769 veor q14, q8, q14 @ q14=q15
770
771 vbsl q13, q9, q8
772 vbsl q15, q11, q10
773 veor q11, q11, q10
774
775 vbsl q12, q13, q14
776 vbsl q8, q14, q13
777
778 vand q14, q12, q15
779 veor q9, q9, q8
780
781 veor q14, q14, q11
782 veor q12, q6, q0
783 veor q8, q5, q3
784 veor q10, q15, q14
785 vand q10, q10, q6
786 veor q6, q6, q5
787 vand q11, q5, q15
788 vand q6, q6, q14
789 veor q5, q11, q10
790 veor q6, q6, q11
791 veor q15, q15, q13
792 veor q14, q14, q9
793 veor q11, q15, q14
794 veor q10, q13, q9
795 vand q11, q11, q12
796 vand q10, q10, q0
797 veor q12, q12, q8
798 veor q0, q0, q3
799 vand q8, q8, q15
800 vand q3, q3, q13
801 vand q12, q12, q14
802 vand q0, q0, q9
803 veor q8, q8, q12
804 veor q0, q0, q3
805 veor q12, q12, q11
806 veor q3, q3, q10
807 veor q6, q6, q12
808 veor q0, q0, q12
809 veor q5, q5, q8
810 veor q3, q3, q8
811
812 veor q12, q7, q4
813 veor q8, q1, q2
814 veor q11, q15, q14
815 veor q10, q13, q9
816 vand q11, q11, q12
817 vand q10, q10, q4
818 veor q12, q12, q8
819 veor q4, q4, q2
820 vand q8, q8, q15
821 vand q2, q2, q13
822 vand q12, q12, q14
823 vand q4, q4, q9
824 veor q8, q8, q12
825 veor q4, q4, q2
826 veor q12, q12, q11
827 veor q2, q2, q10
828 veor q15, q15, q13
829 veor q14, q14, q9
830 veor q10, q15, q14
831 vand q10, q10, q7
832 veor q7, q7, q1
833 vand q11, q1, q15
834 vand q7, q7, q14
835 veor q1, q11, q10
836 veor q7, q7, q11
837 veor q7, q7, q12
838 veor q4, q4, q12
839 veor q1, q1, q8
840 veor q2, q2, q8
841 veor q7, q7, q0
842 veor q1, q1, q6
843 veor q6, q6, q0
844 veor q4, q4, q7
845 veor q0, q0, q1
846
847 veor q1, q1, q5
848 veor q5, q5, q2
849 veor q2, q2, q3
850 veor q3, q3, q5
851 veor q4, q4, q5
852
853 veor q6, q6, q3
854 subs r5,r5,#1
855 bcc .Lenc_done
856 vext.8 q8, q0, q0, #12 @ x0 <<< 32
857 vext.8 q9, q1, q1, #12
858 veor q0, q0, q8 @ x0 ^ (x0 <<< 32)
859 vext.8 q10, q4, q4, #12
860 veor q1, q1, q9
861 vext.8 q11, q6, q6, #12
862 veor q4, q4, q10
863 vext.8 q12, q3, q3, #12
864 veor q6, q6, q11
865 vext.8 q13, q7, q7, #12
866 veor q3, q3, q12
867 vext.8 q14, q2, q2, #12
868 veor q7, q7, q13
869 vext.8 q15, q5, q5, #12
870 veor q2, q2, q14
871
872 veor q9, q9, q0
873 veor q5, q5, q15
874 vext.8 q0, q0, q0, #8 @ (x0 ^ (x0 <<< 32)) <<< 64)
875 veor q10, q10, q1
876 veor q8, q8, q5
877 veor q9, q9, q5
878 vext.8 q1, q1, q1, #8
879 veor q13, q13, q3
880 veor q0, q0, q8
881 veor q14, q14, q7
882 veor q1, q1, q9
883 vext.8 q8, q3, q3, #8
884 veor q12, q12, q6
885 vext.8 q9, q7, q7, #8
886 veor q15, q15, q2
887 vext.8 q3, q6, q6, #8
888 veor q11, q11, q4
889 vext.8 q7, q5, q5, #8
890 veor q12, q12, q5
891 vext.8 q6, q2, q2, #8
892 veor q11, q11, q5
893 vext.8 q2, q4, q4, #8
894 veor q5, q9, q13
895 veor q4, q8, q12
896 veor q3, q3, q11
897 veor q7, q7, q15
898 veor q6, q6, q14
899 @ vmov q4, q8
900 veor q2, q2, q10
901 @ vmov q5, q9
902 vldmia r6, {q12} @ .LSR
903 ite eq @ Thumb2 thing, samity check in ARM
904 addeq r6,r6,#0x10
905 bne .Lenc_loop
906 vldmia r6, {q12} @ .LSRM0
907 b .Lenc_loop
908.align 4
909.Lenc_done:
910 vmov.i8 q8,#0x55 @ compose .LBS0
911 vmov.i8 q9,#0x33 @ compose .LBS1
912 vshr.u64 q10, q2, #1
913 vshr.u64 q11, q3, #1
914 veor q10, q10, q5
915 veor q11, q11, q7
916 vand q10, q10, q8
917 vand q11, q11, q8
918 veor q5, q5, q10
919 vshl.u64 q10, q10, #1
920 veor q7, q7, q11
921 vshl.u64 q11, q11, #1
922 veor q2, q2, q10
923 veor q3, q3, q11
924 vshr.u64 q10, q4, #1
925 vshr.u64 q11, q0, #1
926 veor q10, q10, q6
927 veor q11, q11, q1
928 vand q10, q10, q8
929 vand q11, q11, q8
930 veor q6, q6, q10
931 vshl.u64 q10, q10, #1
932 veor q1, q1, q11
933 vshl.u64 q11, q11, #1
934 veor q4, q4, q10
935 veor q0, q0, q11
936 vmov.i8 q8,#0x0f @ compose .LBS2
937 vshr.u64 q10, q7, #2
938 vshr.u64 q11, q3, #2
939 veor q10, q10, q5
940 veor q11, q11, q2
941 vand q10, q10, q9
942 vand q11, q11, q9
943 veor q5, q5, q10
944 vshl.u64 q10, q10, #2
945 veor q2, q2, q11
946 vshl.u64 q11, q11, #2
947 veor q7, q7, q10
948 veor q3, q3, q11
949 vshr.u64 q10, q1, #2
950 vshr.u64 q11, q0, #2
951 veor q10, q10, q6
952 veor q11, q11, q4
953 vand q10, q10, q9
954 vand q11, q11, q9
955 veor q6, q6, q10
956 vshl.u64 q10, q10, #2
957 veor q4, q4, q11
958 vshl.u64 q11, q11, #2
959 veor q1, q1, q10
960 veor q0, q0, q11
961 vshr.u64 q10, q6, #4
962 vshr.u64 q11, q4, #4
963 veor q10, q10, q5
964 veor q11, q11, q2
965 vand q10, q10, q8
966 vand q11, q11, q8
967 veor q5, q5, q10
968 vshl.u64 q10, q10, #4
969 veor q2, q2, q11
970 vshl.u64 q11, q11, #4
971 veor q6, q6, q10
972 veor q4, q4, q11
973 vshr.u64 q10, q1, #4
974 vshr.u64 q11, q0, #4
975 veor q10, q10, q7
976 veor q11, q11, q3
977 vand q10, q10, q8
978 vand q11, q11, q8
979 veor q7, q7, q10
980 vshl.u64 q10, q10, #4
981 veor q3, q3, q11
982 vshl.u64 q11, q11, #4
983 veor q1, q1, q10
984 veor q0, q0, q11
985 vldmia r4, {q8} @ last round key
986 veor q4, q4, q8
987 veor q6, q6, q8
988 veor q3, q3, q8
989 veor q7, q7, q8
990 veor q2, q2, q8
991 veor q5, q5, q8
992 veor q0, q0, q8
993 veor q1, q1, q8
994 bx lr
995.size _bsaes_encrypt8,.-_bsaes_encrypt8
996.type _bsaes_key_convert,%function
997.align 4
998_bsaes_key_convert:
999 adr r6,_bsaes_key_convert
1000 vld1.8 {q7}, [r4]! @ load round 0 key
1001 sub r6,r6,#_bsaes_key_convert-.LM0
1002 vld1.8 {q15}, [r4]! @ load round 1 key
1003
1004 vmov.i8 q8, #0x01 @ bit masks
1005 vmov.i8 q9, #0x02
1006 vmov.i8 q10, #0x04
1007 vmov.i8 q11, #0x08
1008 vmov.i8 q12, #0x10
1009 vmov.i8 q13, #0x20
1010 vldmia r6, {q14} @ .LM0
1011
1012#ifdef __ARMEL__
1013 vrev32.8 q7, q7
1014 vrev32.8 q15, q15
1015#endif
1016 sub r5,r5,#1
1017 vstmia r12!, {q7} @ save round 0 key
1018 b .Lkey_loop
1019
1020.align 4
1021.Lkey_loop:
1022 vtbl.8 d14,{q15},d28
1023 vtbl.8 d15,{q15},d29
1024 vmov.i8 q6, #0x40
1025 vmov.i8 q15, #0x80
1026
1027 vtst.8 q0, q7, q8
1028 vtst.8 q1, q7, q9
1029 vtst.8 q2, q7, q10
1030 vtst.8 q3, q7, q11
1031 vtst.8 q4, q7, q12
1032 vtst.8 q5, q7, q13
1033 vtst.8 q6, q7, q6
1034 vtst.8 q7, q7, q15
1035 vld1.8 {q15}, [r4]! @ load next round key
1036 vmvn q0, q0 @ "pnot"
1037 vmvn q1, q1
1038 vmvn q5, q5
1039 vmvn q6, q6
1040#ifdef __ARMEL__
1041 vrev32.8 q15, q15
1042#endif
1043 subs r5,r5,#1
1044 vstmia r12!,{q0-q7} @ write bit-sliced round key
1045 bne .Lkey_loop
1046
1047 vmov.i8 q7,#0x63 @ compose .L63
1048 @ don't save last round key
1049 bx lr
1050.size _bsaes_key_convert,.-_bsaes_key_convert
1051.extern AES_cbc_encrypt
1052.extern AES_decrypt
1053
1054.global bsaes_cbc_encrypt
1055.type bsaes_cbc_encrypt,%function
1056.align 5
1057bsaes_cbc_encrypt:
1058#ifndef __KERNEL__
1059 cmp r2, #128
1060#ifndef __thumb__
1061 blo AES_cbc_encrypt
1062#else
1063 bhs 1f
1064 b AES_cbc_encrypt
10651:
1066#endif
1067#endif
1068
1069 @ it is up to the caller to make sure we are called with enc == 0
1070
1071 mov ip, sp
1072 stmdb sp!, {r4-r10, lr}
1073 VFP_ABI_PUSH
1074 ldr r8, [ip] @ IV is 1st arg on the stack
1075 mov r2, r2, lsr#4 @ len in 16 byte blocks
1076 sub sp, #0x10 @ scratch space to carry over the IV
1077 mov r9, sp @ save sp
1078
1079 ldr r10, [r3, #240] @ get # of rounds
1080#ifndef BSAES_ASM_EXTENDED_KEY
1081 @ allocate the key schedule on the stack
1082 sub r12, sp, r10, lsl#7 @ 128 bytes per inner round key
1083 add r12, #96 @ sifze of bit-slices key schedule
1084
1085 @ populate the key schedule
1086 mov r4, r3 @ pass key
1087 mov r5, r10 @ pass # of rounds
1088 mov sp, r12 @ sp is sp
1089 bl _bsaes_key_convert
1090 vldmia sp, {q6}
1091 vstmia r12, {q15} @ save last round key
1092 veor q7, q7, q6 @ fix up round 0 key
1093 vstmia sp, {q7}
1094#else
1095 ldr r12, [r3, #244]
1096 eors r12, #1
1097 beq 0f
1098
1099 @ populate the key schedule
1100 str r12, [r3, #244]
1101 mov r4, r3 @ pass key
1102 mov r5, r10 @ pass # of rounds
1103 add r12, r3, #248 @ pass key schedule
1104 bl _bsaes_key_convert
1105 add r4, r3, #248
1106 vldmia r4, {q6}
1107 vstmia r12, {q15} @ save last round key
1108 veor q7, q7, q6 @ fix up round 0 key
1109 vstmia r4, {q7}
1110
1111.align 2
11120:
1113#endif
1114
1115 vld1.8 {q15}, [r8] @ load IV
1116 b .Lcbc_dec_loop
1117
1118.align 4
1119.Lcbc_dec_loop:
1120 subs r2, r2, #0x8
1121 bmi .Lcbc_dec_loop_finish
1122
1123 vld1.8 {q0-q1}, [r0]! @ load input
1124 vld1.8 {q2-q3}, [r0]!
1125#ifndef BSAES_ASM_EXTENDED_KEY
1126 mov r4, sp @ pass the key
1127#else
1128 add r4, r3, #248
1129#endif
1130 vld1.8 {q4-q5}, [r0]!
1131 mov r5, r10
1132 vld1.8 {q6-q7}, [r0]
1133 sub r0, r0, #0x60
1134 vstmia r9, {q15} @ put aside IV
1135
1136 bl _bsaes_decrypt8
1137
1138 vldmia r9, {q14} @ reload IV
1139 vld1.8 {q8-q9}, [r0]! @ reload input
1140 veor q0, q0, q14 @ ^= IV
1141 vld1.8 {q10-q11}, [r0]!
1142 veor q1, q1, q8
1143 veor q6, q6, q9
1144 vld1.8 {q12-q13}, [r0]!
1145 veor q4, q4, q10
1146 veor q2, q2, q11
1147 vld1.8 {q14-q15}, [r0]!
1148 veor q7, q7, q12
1149 vst1.8 {q0-q1}, [r1]! @ write output
1150 veor q3, q3, q13
1151 vst1.8 {q6}, [r1]!
1152 veor q5, q5, q14
1153 vst1.8 {q4}, [r1]!
1154 vst1.8 {q2}, [r1]!
1155 vst1.8 {q7}, [r1]!
1156 vst1.8 {q3}, [r1]!
1157 vst1.8 {q5}, [r1]!
1158
1159 b .Lcbc_dec_loop
1160
1161.Lcbc_dec_loop_finish:
1162 adds r2, r2, #8
1163 beq .Lcbc_dec_done
1164
1165 vld1.8 {q0}, [r0]! @ load input
1166 cmp r2, #2
1167 blo .Lcbc_dec_one
1168 vld1.8 {q1}, [r0]!
1169#ifndef BSAES_ASM_EXTENDED_KEY
1170 mov r4, sp @ pass the key
1171#else
1172 add r4, r3, #248
1173#endif
1174 mov r5, r10
1175 vstmia r9, {q15} @ put aside IV
1176 beq .Lcbc_dec_two
1177 vld1.8 {q2}, [r0]!
1178 cmp r2, #4
1179 blo .Lcbc_dec_three
1180 vld1.8 {q3}, [r0]!
1181 beq .Lcbc_dec_four
1182 vld1.8 {q4}, [r0]!
1183 cmp r2, #6
1184 blo .Lcbc_dec_five
1185 vld1.8 {q5}, [r0]!
1186 beq .Lcbc_dec_six
1187 vld1.8 {q6}, [r0]!
1188 sub r0, r0, #0x70
1189
1190 bl _bsaes_decrypt8
1191
1192 vldmia r9, {q14} @ reload IV
1193 vld1.8 {q8-q9}, [r0]! @ reload input
1194 veor q0, q0, q14 @ ^= IV
1195 vld1.8 {q10-q11}, [r0]!
1196 veor q1, q1, q8
1197 veor q6, q6, q9
1198 vld1.8 {q12-q13}, [r0]!
1199 veor q4, q4, q10
1200 veor q2, q2, q11
1201 vld1.8 {q15}, [r0]!
1202 veor q7, q7, q12
1203 vst1.8 {q0-q1}, [r1]! @ write output
1204 veor q3, q3, q13
1205 vst1.8 {q6}, [r1]!
1206 vst1.8 {q4}, [r1]!
1207 vst1.8 {q2}, [r1]!
1208 vst1.8 {q7}, [r1]!
1209 vst1.8 {q3}, [r1]!
1210 b .Lcbc_dec_done
1211.align 4
1212.Lcbc_dec_six:
1213 sub r0, r0, #0x60
1214 bl _bsaes_decrypt8
1215 vldmia r9,{q14} @ reload IV
1216 vld1.8 {q8-q9}, [r0]! @ reload input
1217 veor q0, q0, q14 @ ^= IV
1218 vld1.8 {q10-q11}, [r0]!
1219 veor q1, q1, q8
1220 veor q6, q6, q9
1221 vld1.8 {q12}, [r0]!
1222 veor q4, q4, q10
1223 veor q2, q2, q11
1224 vld1.8 {q15}, [r0]!
1225 veor q7, q7, q12
1226 vst1.8 {q0-q1}, [r1]! @ write output
1227 vst1.8 {q6}, [r1]!
1228 vst1.8 {q4}, [r1]!
1229 vst1.8 {q2}, [r1]!
1230 vst1.8 {q7}, [r1]!
1231 b .Lcbc_dec_done
1232.align 4
1233.Lcbc_dec_five:
1234 sub r0, r0, #0x50
1235 bl _bsaes_decrypt8
1236 vldmia r9, {q14} @ reload IV
1237 vld1.8 {q8-q9}, [r0]! @ reload input
1238 veor q0, q0, q14 @ ^= IV
1239 vld1.8 {q10-q11}, [r0]!
1240 veor q1, q1, q8
1241 veor q6, q6, q9
1242 vld1.8 {q15}, [r0]!
1243 veor q4, q4, q10
1244 vst1.8 {q0-q1}, [r1]! @ write output
1245 veor q2, q2, q11
1246 vst1.8 {q6}, [r1]!
1247 vst1.8 {q4}, [r1]!
1248 vst1.8 {q2}, [r1]!
1249 b .Lcbc_dec_done
1250.align 4
1251.Lcbc_dec_four:
1252 sub r0, r0, #0x40
1253 bl _bsaes_decrypt8
1254 vldmia r9, {q14} @ reload IV
1255 vld1.8 {q8-q9}, [r0]! @ reload input
1256 veor q0, q0, q14 @ ^= IV
1257 vld1.8 {q10}, [r0]!
1258 veor q1, q1, q8
1259 veor q6, q6, q9
1260 vld1.8 {q15}, [r0]!
1261 veor q4, q4, q10
1262 vst1.8 {q0-q1}, [r1]! @ write output
1263 vst1.8 {q6}, [r1]!
1264 vst1.8 {q4}, [r1]!
1265 b .Lcbc_dec_done
1266.align 4
1267.Lcbc_dec_three:
1268 sub r0, r0, #0x30
1269 bl _bsaes_decrypt8
1270 vldmia r9, {q14} @ reload IV
1271 vld1.8 {q8-q9}, [r0]! @ reload input
1272 veor q0, q0, q14 @ ^= IV
1273 vld1.8 {q15}, [r0]!
1274 veor q1, q1, q8
1275 veor q6, q6, q9
1276 vst1.8 {q0-q1}, [r1]! @ write output
1277 vst1.8 {q6}, [r1]!
1278 b .Lcbc_dec_done
1279.align 4
1280.Lcbc_dec_two:
1281 sub r0, r0, #0x20
1282 bl _bsaes_decrypt8
1283 vldmia r9, {q14} @ reload IV
1284 vld1.8 {q8}, [r0]! @ reload input
1285 veor q0, q0, q14 @ ^= IV
1286 vld1.8 {q15}, [r0]! @ reload input
1287 veor q1, q1, q8
1288 vst1.8 {q0-q1}, [r1]! @ write output
1289 b .Lcbc_dec_done
1290.align 4
1291.Lcbc_dec_one:
1292 sub r0, r0, #0x10
1293 mov r10, r1 @ save original out pointer
1294 mov r1, r9 @ use the iv scratch space as out buffer
1295 mov r2, r3
1296 vmov q4,q15 @ just in case ensure that IV
1297 vmov q5,q0 @ and input are preserved
1298 bl AES_decrypt
1299 vld1.8 {q0}, [r9,:64] @ load result
1300 veor q0, q0, q4 @ ^= IV
1301 vmov q15, q5 @ q5 holds input
1302 vst1.8 {q0}, [r10] @ write output
1303
1304.Lcbc_dec_done:
1305#ifndef BSAES_ASM_EXTENDED_KEY
1306 vmov.i32 q0, #0
1307 vmov.i32 q1, #0
1308.Lcbc_dec_bzero: @ wipe key schedule [if any]
1309 vstmia sp!, {q0-q1}
1310 cmp sp, r9
1311 bne .Lcbc_dec_bzero
1312#endif
1313
1314 mov sp, r9
1315 add sp, #0x10 @ add sp,r9,#0x10 is no good for thumb
1316 vst1.8 {q15}, [r8] @ return IV
1317 VFP_ABI_POP
1318 ldmia sp!, {r4-r10, pc}
1319.size bsaes_cbc_encrypt,.-bsaes_cbc_encrypt
1320.extern AES_encrypt
1321.global bsaes_ctr32_encrypt_blocks
1322.type bsaes_ctr32_encrypt_blocks,%function
1323.align 5
1324bsaes_ctr32_encrypt_blocks:
1325 cmp r2, #8 @ use plain AES for
1326 blo .Lctr_enc_short @ small sizes
1327
1328 mov ip, sp
1329 stmdb sp!, {r4-r10, lr}
1330 VFP_ABI_PUSH
1331 ldr r8, [ip] @ ctr is 1st arg on the stack
1332 sub sp, sp, #0x10 @ scratch space to carry over the ctr
1333 mov r9, sp @ save sp
1334
1335 ldr r10, [r3, #240] @ get # of rounds
1336#ifndef BSAES_ASM_EXTENDED_KEY
1337 @ allocate the key schedule on the stack
1338 sub r12, sp, r10, lsl#7 @ 128 bytes per inner round key
1339 add r12, #96 @ size of bit-sliced key schedule
1340
1341 @ populate the key schedule
1342 mov r4, r3 @ pass key
1343 mov r5, r10 @ pass # of rounds
1344 mov sp, r12 @ sp is sp
1345 bl _bsaes_key_convert
1346 veor q7,q7,q15 @ fix up last round key
1347 vstmia r12, {q7} @ save last round key
1348
1349 vld1.8 {q0}, [r8] @ load counter
1350 add r8, r6, #.LREVM0SR-.LM0 @ borrow r8
1351 vldmia sp, {q4} @ load round0 key
1352#else
1353 ldr r12, [r3, #244]
1354 eors r12, #1
1355 beq 0f
1356
1357 @ populate the key schedule
1358 str r12, [r3, #244]
1359 mov r4, r3 @ pass key
1360 mov r5, r10 @ pass # of rounds
1361 add r12, r3, #248 @ pass key schedule
1362 bl _bsaes_key_convert
1363 veor q7,q7,q15 @ fix up last round key
1364 vstmia r12, {q7} @ save last round key
1365
1366.align 2
13670: add r12, r3, #248
1368 vld1.8 {q0}, [r8] @ load counter
1369 adrl r8, .LREVM0SR @ borrow r8
1370 vldmia r12, {q4} @ load round0 key
1371 sub sp, #0x10 @ place for adjusted round0 key
1372#endif
1373
1374 vmov.i32 q8,#1 @ compose 1<<96
1375 veor q9,q9,q9
1376 vrev32.8 q0,q0
1377 vext.8 q8,q9,q8,#4
1378 vrev32.8 q4,q4
1379 vadd.u32 q9,q8,q8 @ compose 2<<96
1380 vstmia sp, {q4} @ save adjusted round0 key
1381 b .Lctr_enc_loop
1382
1383.align 4
1384.Lctr_enc_loop:
1385 vadd.u32 q10, q8, q9 @ compose 3<<96
1386 vadd.u32 q1, q0, q8 @ +1
1387 vadd.u32 q2, q0, q9 @ +2
1388 vadd.u32 q3, q0, q10 @ +3
1389 vadd.u32 q4, q1, q10
1390 vadd.u32 q5, q2, q10
1391 vadd.u32 q6, q3, q10
1392 vadd.u32 q7, q4, q10
1393 vadd.u32 q10, q5, q10 @ next counter
1394
1395 @ Borrow prologue from _bsaes_encrypt8 to use the opportunity
1396 @ to flip byte order in 32-bit counter
1397
1398 vldmia sp, {q9} @ load round0 key
1399#ifndef BSAES_ASM_EXTENDED_KEY
1400 add r4, sp, #0x10 @ pass next round key
1401#else
1402 add r4, r3, #264
1403#endif
1404 vldmia r8, {q8} @ .LREVM0SR
1405 mov r5, r10 @ pass rounds
1406 vstmia r9, {q10} @ save next counter
1407 sub r6, r8, #.LREVM0SR-.LSR @ pass constants
1408
1409 bl _bsaes_encrypt8_alt
1410
1411 subs r2, r2, #8
1412 blo .Lctr_enc_loop_done
1413
1414 vld1.8 {q8-q9}, [r0]! @ load input
1415 vld1.8 {q10-q11}, [r0]!
1416 veor q0, q8
1417 veor q1, q9
1418 vld1.8 {q12-q13}, [r0]!
1419 veor q4, q10
1420 veor q6, q11
1421 vld1.8 {q14-q15}, [r0]!
1422 veor q3, q12
1423 vst1.8 {q0-q1}, [r1]! @ write output
1424 veor q7, q13
1425 veor q2, q14
1426 vst1.8 {q4}, [r1]!
1427 veor q5, q15
1428 vst1.8 {q6}, [r1]!
1429 vmov.i32 q8, #1 @ compose 1<<96
1430 vst1.8 {q3}, [r1]!
1431 veor q9, q9, q9
1432 vst1.8 {q7}, [r1]!
1433 vext.8 q8, q9, q8, #4
1434 vst1.8 {q2}, [r1]!
1435 vadd.u32 q9,q8,q8 @ compose 2<<96
1436 vst1.8 {q5}, [r1]!
1437 vldmia r9, {q0} @ load counter
1438
1439 bne .Lctr_enc_loop
1440 b .Lctr_enc_done
1441
1442.align 4
1443.Lctr_enc_loop_done:
1444 add r2, r2, #8
1445 vld1.8 {q8}, [r0]! @ load input
1446 veor q0, q8
1447 vst1.8 {q0}, [r1]! @ write output
1448 cmp r2, #2
1449 blo .Lctr_enc_done
1450 vld1.8 {q9}, [r0]!
1451 veor q1, q9
1452 vst1.8 {q1}, [r1]!
1453 beq .Lctr_enc_done
1454 vld1.8 {q10}, [r0]!
1455 veor q4, q10
1456 vst1.8 {q4}, [r1]!
1457 cmp r2, #4
1458 blo .Lctr_enc_done
1459 vld1.8 {q11}, [r0]!
1460 veor q6, q11
1461 vst1.8 {q6}, [r1]!
1462 beq .Lctr_enc_done
1463 vld1.8 {q12}, [r0]!
1464 veor q3, q12
1465 vst1.8 {q3}, [r1]!
1466 cmp r2, #6
1467 blo .Lctr_enc_done
1468 vld1.8 {q13}, [r0]!
1469 veor q7, q13
1470 vst1.8 {q7}, [r1]!
1471 beq .Lctr_enc_done
1472 vld1.8 {q14}, [r0]
1473 veor q2, q14
1474 vst1.8 {q2}, [r1]!
1475
1476.Lctr_enc_done:
1477 vmov.i32 q0, #0
1478 vmov.i32 q1, #0
1479#ifndef BSAES_ASM_EXTENDED_KEY
1480.Lctr_enc_bzero: @ wipe key schedule [if any]
1481 vstmia sp!, {q0-q1}
1482 cmp sp, r9
1483 bne .Lctr_enc_bzero
1484#else
1485 vstmia sp, {q0-q1}
1486#endif
1487
1488 mov sp, r9
1489 add sp, #0x10 @ add sp,r9,#0x10 is no good for thumb
1490 VFP_ABI_POP
1491 ldmia sp!, {r4-r10, pc} @ return
1492
1493.align 4
1494.Lctr_enc_short:
1495 ldr ip, [sp] @ ctr pointer is passed on stack
1496 stmdb sp!, {r4-r8, lr}
1497
1498 mov r4, r0 @ copy arguments
1499 mov r5, r1
1500 mov r6, r2
1501 mov r7, r3
1502 ldr r8, [ip, #12] @ load counter LSW
1503 vld1.8 {q1}, [ip] @ load whole counter value
1504#ifdef __ARMEL__
1505 rev r8, r8
1506#endif
1507 sub sp, sp, #0x10
1508 vst1.8 {q1}, [sp,:64] @ copy counter value
1509 sub sp, sp, #0x10
1510
1511.Lctr_enc_short_loop:
1512 add r0, sp, #0x10 @ input counter value
1513 mov r1, sp @ output on the stack
1514 mov r2, r7 @ key
1515
1516 bl AES_encrypt
1517
1518 vld1.8 {q0}, [r4]! @ load input
1519 vld1.8 {q1}, [sp,:64] @ load encrypted counter
1520 add r8, r8, #1
1521#ifdef __ARMEL__
1522 rev r0, r8
1523 str r0, [sp, #0x1c] @ next counter value
1524#else
1525 str r8, [sp, #0x1c] @ next counter value
1526#endif
1527 veor q0,q0,q1
1528 vst1.8 {q0}, [r5]! @ store output
1529 subs r6, r6, #1
1530 bne .Lctr_enc_short_loop
1531
1532 vmov.i32 q0, #0
1533 vmov.i32 q1, #0
1534 vstmia sp!, {q0-q1}
1535
1536 ldmia sp!, {r4-r8, pc}
1537.size bsaes_ctr32_encrypt_blocks,.-bsaes_ctr32_encrypt_blocks
1538.globl bsaes_xts_encrypt
1539.type bsaes_xts_encrypt,%function
1540.align 4
1541bsaes_xts_encrypt:
1542 mov ip, sp
1543 stmdb sp!, {r4-r10, lr} @ 0x20
1544 VFP_ABI_PUSH
1545 mov r6, sp @ future r3
1546
1547 mov r7, r0
1548 mov r8, r1
1549 mov r9, r2
1550 mov r10, r3
1551
1552 sub r0, sp, #0x10 @ 0x10
1553 bic r0, #0xf @ align at 16 bytes
1554 mov sp, r0
1555
1556#ifdef XTS_CHAIN_TWEAK
1557 ldr r0, [ip] @ pointer to input tweak
1558#else
1559 @ generate initial tweak
1560 ldr r0, [ip, #4] @ iv[]
1561 mov r1, sp
1562 ldr r2, [ip, #0] @ key2
1563 bl AES_encrypt
1564 mov r0,sp @ pointer to initial tweak
1565#endif
1566
1567 ldr r1, [r10, #240] @ get # of rounds
1568 mov r3, r6
1569#ifndef BSAES_ASM_EXTENDED_KEY
1570 @ allocate the key schedule on the stack
1571 sub r12, sp, r1, lsl#7 @ 128 bytes per inner round key
1572 @ add r12, #96 @ size of bit-sliced key schedule
1573 sub r12, #48 @ place for tweak[9]
1574
1575 @ populate the key schedule
1576 mov r4, r10 @ pass key
1577 mov r5, r1 @ pass # of rounds
1578 mov sp, r12
1579 add r12, #0x90 @ pass key schedule
1580 bl _bsaes_key_convert
1581 veor q7, q7, q15 @ fix up last round key
1582 vstmia r12, {q7} @ save last round key
1583#else
1584 ldr r12, [r10, #244]
1585 eors r12, #1
1586 beq 0f
1587
1588 str r12, [r10, #244]
1589 mov r4, r10 @ pass key
1590 mov r5, r1 @ pass # of rounds
1591 add r12, r10, #248 @ pass key schedule
1592 bl _bsaes_key_convert
1593 veor q7, q7, q15 @ fix up last round key
1594 vstmia r12, {q7}
1595
1596.align 2
15970: sub sp, #0x90 @ place for tweak[9]
1598#endif
1599
1600 vld1.8 {q8}, [r0] @ initial tweak
1601 adr r2, .Lxts_magic
1602
1603 subs r9, #0x80
1604 blo .Lxts_enc_short
1605 b .Lxts_enc_loop
1606
1607.align 4
1608.Lxts_enc_loop:
1609 vldmia r2, {q5} @ load XTS magic
1610 vshr.s64 q6, q8, #63
1611 mov r0, sp
1612 vand q6, q6, q5
1613 vadd.u64 q9, q8, q8
1614 vst1.64 {q8}, [r0,:128]!
1615 vswp d13,d12
1616 vshr.s64 q7, q9, #63
1617 veor q9, q9, q6
1618 vand q7, q7, q5
1619 vadd.u64 q10, q9, q9
1620 vst1.64 {q9}, [r0,:128]!
1621 vswp d15,d14
1622 vshr.s64 q6, q10, #63
1623 veor q10, q10, q7
1624 vand q6, q6, q5
1625 vld1.8 {q0}, [r7]!
1626 vadd.u64 q11, q10, q10
1627 vst1.64 {q10}, [r0,:128]!
1628 vswp d13,d12
1629 vshr.s64 q7, q11, #63
1630 veor q11, q11, q6
1631 vand q7, q7, q5
1632 vld1.8 {q1}, [r7]!
1633 veor q0, q0, q8
1634 vadd.u64 q12, q11, q11
1635 vst1.64 {q11}, [r0,:128]!
1636 vswp d15,d14
1637 vshr.s64 q6, q12, #63
1638 veor q12, q12, q7
1639 vand q6, q6, q5
1640 vld1.8 {q2}, [r7]!
1641 veor q1, q1, q9
1642 vadd.u64 q13, q12, q12
1643 vst1.64 {q12}, [r0,:128]!
1644 vswp d13,d12
1645 vshr.s64 q7, q13, #63
1646 veor q13, q13, q6
1647 vand q7, q7, q5
1648 vld1.8 {q3}, [r7]!
1649 veor q2, q2, q10
1650 vadd.u64 q14, q13, q13
1651 vst1.64 {q13}, [r0,:128]!
1652 vswp d15,d14
1653 vshr.s64 q6, q14, #63
1654 veor q14, q14, q7
1655 vand q6, q6, q5
1656 vld1.8 {q4}, [r7]!
1657 veor q3, q3, q11
1658 vadd.u64 q15, q14, q14
1659 vst1.64 {q14}, [r0,:128]!
1660 vswp d13,d12
1661 vshr.s64 q7, q15, #63
1662 veor q15, q15, q6
1663 vand q7, q7, q5
1664 vld1.8 {q5}, [r7]!
1665 veor q4, q4, q12
1666 vadd.u64 q8, q15, q15
1667 vst1.64 {q15}, [r0,:128]!
1668 vswp d15,d14
1669 veor q8, q8, q7
1670 vst1.64 {q8}, [r0,:128] @ next round tweak
1671
1672 vld1.8 {q6-q7}, [r7]!
1673 veor q5, q5, q13
1674#ifndef BSAES_ASM_EXTENDED_KEY
1675 add r4, sp, #0x90 @ pass key schedule
1676#else
1677 add r4, r10, #248 @ pass key schedule
1678#endif
1679 veor q6, q6, q14
1680 mov r5, r1 @ pass rounds
1681 veor q7, q7, q15
1682 mov r0, sp
1683
1684 bl _bsaes_encrypt8
1685
1686 vld1.64 {q8-q9}, [r0,:128]!
1687 vld1.64 {q10-q11}, [r0,:128]!
1688 veor q0, q0, q8
1689 vld1.64 {q12-q13}, [r0,:128]!
1690 veor q1, q1, q9
1691 veor q8, q4, q10
1692 vst1.8 {q0-q1}, [r8]!
1693 veor q9, q6, q11
1694 vld1.64 {q14-q15}, [r0,:128]!
1695 veor q10, q3, q12
1696 vst1.8 {q8-q9}, [r8]!
1697 veor q11, q7, q13
1698 veor q12, q2, q14
1699 vst1.8 {q10-q11}, [r8]!
1700 veor q13, q5, q15
1701 vst1.8 {q12-q13}, [r8]!
1702
1703 vld1.64 {q8}, [r0,:128] @ next round tweak
1704
1705 subs r9, #0x80
1706 bpl .Lxts_enc_loop
1707
1708.Lxts_enc_short:
1709 adds r9, #0x70
1710 bmi .Lxts_enc_done
1711
1712 vldmia r2, {q5} @ load XTS magic
1713 vshr.s64 q7, q8, #63
1714 mov r0, sp
1715 vand q7, q7, q5
1716 vadd.u64 q9, q8, q8
1717 vst1.64 {q8}, [r0,:128]!
1718 vswp d15,d14
1719 vshr.s64 q6, q9, #63
1720 veor q9, q9, q7
1721 vand q6, q6, q5
1722 vadd.u64 q10, q9, q9
1723 vst1.64 {q9}, [r0,:128]!
1724 vswp d13,d12
1725 vshr.s64 q7, q10, #63
1726 veor q10, q10, q6
1727 vand q7, q7, q5
1728 vld1.8 {q0}, [r7]!
1729 subs r9, #0x10
1730 bmi .Lxts_enc_1
1731 vadd.u64 q11, q10, q10
1732 vst1.64 {q10}, [r0,:128]!
1733 vswp d15,d14
1734 vshr.s64 q6, q11, #63
1735 veor q11, q11, q7
1736 vand q6, q6, q5
1737 vld1.8 {q1}, [r7]!
1738 subs r9, #0x10
1739 bmi .Lxts_enc_2
1740 veor q0, q0, q8
1741 vadd.u64 q12, q11, q11
1742 vst1.64 {q11}, [r0,:128]!
1743 vswp d13,d12
1744 vshr.s64 q7, q12, #63
1745 veor q12, q12, q6
1746 vand q7, q7, q5
1747 vld1.8 {q2}, [r7]!
1748 subs r9, #0x10
1749 bmi .Lxts_enc_3
1750 veor q1, q1, q9
1751 vadd.u64 q13, q12, q12
1752 vst1.64 {q12}, [r0,:128]!
1753 vswp d15,d14
1754 vshr.s64 q6, q13, #63
1755 veor q13, q13, q7
1756 vand q6, q6, q5
1757 vld1.8 {q3}, [r7]!
1758 subs r9, #0x10
1759 bmi .Lxts_enc_4
1760 veor q2, q2, q10
1761 vadd.u64 q14, q13, q13
1762 vst1.64 {q13}, [r0,:128]!
1763 vswp d13,d12
1764 vshr.s64 q7, q14, #63
1765 veor q14, q14, q6
1766 vand q7, q7, q5
1767 vld1.8 {q4}, [r7]!
1768 subs r9, #0x10
1769 bmi .Lxts_enc_5
1770 veor q3, q3, q11
1771 vadd.u64 q15, q14, q14
1772 vst1.64 {q14}, [r0,:128]!
1773 vswp d15,d14
1774 vshr.s64 q6, q15, #63
1775 veor q15, q15, q7
1776 vand q6, q6, q5
1777 vld1.8 {q5}, [r7]!
1778 subs r9, #0x10
1779 bmi .Lxts_enc_6
1780 veor q4, q4, q12
1781 sub r9, #0x10
1782 vst1.64 {q15}, [r0,:128] @ next round tweak
1783
1784 vld1.8 {q6}, [r7]!
1785 veor q5, q5, q13
1786#ifndef BSAES_ASM_EXTENDED_KEY
1787 add r4, sp, #0x90 @ pass key schedule
1788#else
1789 add r4, r10, #248 @ pass key schedule
1790#endif
1791 veor q6, q6, q14
1792 mov r5, r1 @ pass rounds
1793 mov r0, sp
1794
1795 bl _bsaes_encrypt8
1796
1797 vld1.64 {q8-q9}, [r0,:128]!
1798 vld1.64 {q10-q11}, [r0,:128]!
1799 veor q0, q0, q8
1800 vld1.64 {q12-q13}, [r0,:128]!
1801 veor q1, q1, q9
1802 veor q8, q4, q10
1803 vst1.8 {q0-q1}, [r8]!
1804 veor q9, q6, q11
1805 vld1.64 {q14}, [r0,:128]!
1806 veor q10, q3, q12
1807 vst1.8 {q8-q9}, [r8]!
1808 veor q11, q7, q13
1809 veor q12, q2, q14
1810 vst1.8 {q10-q11}, [r8]!
1811 vst1.8 {q12}, [r8]!
1812
1813 vld1.64 {q8}, [r0,:128] @ next round tweak
1814 b .Lxts_enc_done
1815.align 4
1816.Lxts_enc_6:
1817 vst1.64 {q14}, [r0,:128] @ next round tweak
1818
1819 veor q4, q4, q12
1820#ifndef BSAES_ASM_EXTENDED_KEY
1821 add r4, sp, #0x90 @ pass key schedule
1822#else
1823 add r4, r10, #248 @ pass key schedule
1824#endif
1825 veor q5, q5, q13
1826 mov r5, r1 @ pass rounds
1827 mov r0, sp
1828
1829 bl _bsaes_encrypt8
1830
1831 vld1.64 {q8-q9}, [r0,:128]!
1832 vld1.64 {q10-q11}, [r0,:128]!
1833 veor q0, q0, q8
1834 vld1.64 {q12-q13}, [r0,:128]!
1835 veor q1, q1, q9
1836 veor q8, q4, q10
1837 vst1.8 {q0-q1}, [r8]!
1838 veor q9, q6, q11
1839 veor q10, q3, q12
1840 vst1.8 {q8-q9}, [r8]!
1841 veor q11, q7, q13
1842 vst1.8 {q10-q11}, [r8]!
1843
1844 vld1.64 {q8}, [r0,:128] @ next round tweak
1845 b .Lxts_enc_done
1846
1847@ put this in range for both ARM and Thumb mode adr instructions
1848.align 5
1849.Lxts_magic:
1850 .quad 1, 0x87
1851
1852.align 5
1853.Lxts_enc_5:
1854 vst1.64 {q13}, [r0,:128] @ next round tweak
1855
1856 veor q3, q3, q11
1857#ifndef BSAES_ASM_EXTENDED_KEY
1858 add r4, sp, #0x90 @ pass key schedule
1859#else
1860 add r4, r10, #248 @ pass key schedule
1861#endif
1862 veor q4, q4, q12
1863 mov r5, r1 @ pass rounds
1864 mov r0, sp
1865
1866 bl _bsaes_encrypt8
1867
1868 vld1.64 {q8-q9}, [r0,:128]!
1869 vld1.64 {q10-q11}, [r0,:128]!
1870 veor q0, q0, q8
1871 vld1.64 {q12}, [r0,:128]!
1872 veor q1, q1, q9
1873 veor q8, q4, q10
1874 vst1.8 {q0-q1}, [r8]!
1875 veor q9, q6, q11
1876 veor q10, q3, q12
1877 vst1.8 {q8-q9}, [r8]!
1878 vst1.8 {q10}, [r8]!
1879
1880 vld1.64 {q8}, [r0,:128] @ next round tweak
1881 b .Lxts_enc_done
1882.align 4
1883.Lxts_enc_4:
1884 vst1.64 {q12}, [r0,:128] @ next round tweak
1885
1886 veor q2, q2, q10
1887#ifndef BSAES_ASM_EXTENDED_KEY
1888 add r4, sp, #0x90 @ pass key schedule
1889#else
1890 add r4, r10, #248 @ pass key schedule
1891#endif
1892 veor q3, q3, q11
1893 mov r5, r1 @ pass rounds
1894 mov r0, sp
1895
1896 bl _bsaes_encrypt8
1897
1898 vld1.64 {q8-q9}, [r0,:128]!
1899 vld1.64 {q10-q11}, [r0,:128]!
1900 veor q0, q0, q8
1901 veor q1, q1, q9
1902 veor q8, q4, q10
1903 vst1.8 {q0-q1}, [r8]!
1904 veor q9, q6, q11
1905 vst1.8 {q8-q9}, [r8]!
1906
1907 vld1.64 {q8}, [r0,:128] @ next round tweak
1908 b .Lxts_enc_done
1909.align 4
1910.Lxts_enc_3:
1911 vst1.64 {q11}, [r0,:128] @ next round tweak
1912
1913 veor q1, q1, q9
1914#ifndef BSAES_ASM_EXTENDED_KEY
1915 add r4, sp, #0x90 @ pass key schedule
1916#else
1917 add r4, r10, #248 @ pass key schedule
1918#endif
1919 veor q2, q2, q10
1920 mov r5, r1 @ pass rounds
1921 mov r0, sp
1922
1923 bl _bsaes_encrypt8
1924
1925 vld1.64 {q8-q9}, [r0,:128]!
1926 vld1.64 {q10}, [r0,:128]!
1927 veor q0, q0, q8
1928 veor q1, q1, q9
1929 veor q8, q4, q10
1930 vst1.8 {q0-q1}, [r8]!
1931 vst1.8 {q8}, [r8]!
1932
1933 vld1.64 {q8}, [r0,:128] @ next round tweak
1934 b .Lxts_enc_done
1935.align 4
1936.Lxts_enc_2:
1937 vst1.64 {q10}, [r0,:128] @ next round tweak
1938
1939 veor q0, q0, q8
1940#ifndef BSAES_ASM_EXTENDED_KEY
1941 add r4, sp, #0x90 @ pass key schedule
1942#else
1943 add r4, r10, #248 @ pass key schedule
1944#endif
1945 veor q1, q1, q9
1946 mov r5, r1 @ pass rounds
1947 mov r0, sp
1948
1949 bl _bsaes_encrypt8
1950
1951 vld1.64 {q8-q9}, [r0,:128]!
1952 veor q0, q0, q8
1953 veor q1, q1, q9
1954 vst1.8 {q0-q1}, [r8]!
1955
1956 vld1.64 {q8}, [r0,:128] @ next round tweak
1957 b .Lxts_enc_done
1958.align 4
1959.Lxts_enc_1:
1960 mov r0, sp
1961 veor q0, q8
1962 mov r1, sp
1963 vst1.8 {q0}, [sp,:128]
1964 mov r2, r10
1965 mov r4, r3 @ preserve fp
1966
1967 bl AES_encrypt
1968
1969 vld1.8 {q0}, [sp,:128]
1970 veor q0, q0, q8
1971 vst1.8 {q0}, [r8]!
1972 mov r3, r4
1973
1974 vmov q8, q9 @ next round tweak
1975
1976.Lxts_enc_done:
1977#ifndef XTS_CHAIN_TWEAK
1978 adds r9, #0x10
1979 beq .Lxts_enc_ret
1980 sub r6, r8, #0x10
1981
1982.Lxts_enc_steal:
1983 ldrb r0, [r7], #1
1984 ldrb r1, [r8, #-0x10]
1985 strb r0, [r8, #-0x10]
1986 strb r1, [r8], #1
1987
1988 subs r9, #1
1989 bhi .Lxts_enc_steal
1990
1991 vld1.8 {q0}, [r6]
1992 mov r0, sp
1993 veor q0, q0, q8
1994 mov r1, sp
1995 vst1.8 {q0}, [sp,:128]
1996 mov r2, r10
1997 mov r4, r3 @ preserve fp
1998
1999 bl AES_encrypt
2000
2001 vld1.8 {q0}, [sp,:128]
2002 veor q0, q0, q8
2003 vst1.8 {q0}, [r6]
2004 mov r3, r4
2005#endif
2006
2007.Lxts_enc_ret:
2008 bic r0, r3, #0xf
2009 vmov.i32 q0, #0
2010 vmov.i32 q1, #0
2011#ifdef XTS_CHAIN_TWEAK
2012 ldr r1, [r3, #0x20+VFP_ABI_FRAME] @ chain tweak
2013#endif
2014.Lxts_enc_bzero: @ wipe key schedule [if any]
2015 vstmia sp!, {q0-q1}
2016 cmp sp, r0
2017 bne .Lxts_enc_bzero
2018
2019 mov sp, r3
2020#ifdef XTS_CHAIN_TWEAK
2021 vst1.8 {q8}, [r1]
2022#endif
2023 VFP_ABI_POP
2024 ldmia sp!, {r4-r10, pc} @ return
2025
2026.size bsaes_xts_encrypt,.-bsaes_xts_encrypt
2027
2028.globl bsaes_xts_decrypt
2029.type bsaes_xts_decrypt,%function
2030.align 4
2031bsaes_xts_decrypt:
2032 mov ip, sp
2033 stmdb sp!, {r4-r10, lr} @ 0x20
2034 VFP_ABI_PUSH
2035 mov r6, sp @ future r3
2036
2037 mov r7, r0
2038 mov r8, r1
2039 mov r9, r2
2040 mov r10, r3
2041
2042 sub r0, sp, #0x10 @ 0x10
2043 bic r0, #0xf @ align at 16 bytes
2044 mov sp, r0
2045
2046#ifdef XTS_CHAIN_TWEAK
2047 ldr r0, [ip] @ pointer to input tweak
2048#else
2049 @ generate initial tweak
2050 ldr r0, [ip, #4] @ iv[]
2051 mov r1, sp
2052 ldr r2, [ip, #0] @ key2
2053 bl AES_encrypt
2054 mov r0, sp @ pointer to initial tweak
2055#endif
2056
2057 ldr r1, [r10, #240] @ get # of rounds
2058 mov r3, r6
2059#ifndef BSAES_ASM_EXTENDED_KEY
2060 @ allocate the key schedule on the stack
2061 sub r12, sp, r1, lsl#7 @ 128 bytes per inner round key
2062 @ add r12, #96 @ size of bit-sliced key schedule
2063 sub r12, #48 @ place for tweak[9]
2064
2065 @ populate the key schedule
2066 mov r4, r10 @ pass key
2067 mov r5, r1 @ pass # of rounds
2068 mov sp, r12
2069 add r12, #0x90 @ pass key schedule
2070 bl _bsaes_key_convert
2071 add r4, sp, #0x90
2072 vldmia r4, {q6}
2073 vstmia r12, {q15} @ save last round key
2074 veor q7, q7, q6 @ fix up round 0 key
2075 vstmia r4, {q7}
2076#else
2077 ldr r12, [r10, #244]
2078 eors r12, #1
2079 beq 0f
2080
2081 str r12, [r10, #244]
2082 mov r4, r10 @ pass key
2083 mov r5, r1 @ pass # of rounds
2084 add r12, r10, #248 @ pass key schedule
2085 bl _bsaes_key_convert
2086 add r4, r10, #248
2087 vldmia r4, {q6}
2088 vstmia r12, {q15} @ save last round key
2089 veor q7, q7, q6 @ fix up round 0 key
2090 vstmia r4, {q7}
2091
2092.align 2
20930: sub sp, #0x90 @ place for tweak[9]
2094#endif
2095 vld1.8 {q8}, [r0] @ initial tweak
2096 adr r2, .Lxts_magic
2097
2098 tst r9, #0xf @ if not multiple of 16
2099 it ne @ Thumb2 thing, sanity check in ARM
2100 subne r9, #0x10 @ subtract another 16 bytes
2101 subs r9, #0x80
2102
2103 blo .Lxts_dec_short
2104 b .Lxts_dec_loop
2105
2106.align 4
2107.Lxts_dec_loop:
2108 vldmia r2, {q5} @ load XTS magic
2109 vshr.s64 q6, q8, #63
2110 mov r0, sp
2111 vand q6, q6, q5
2112 vadd.u64 q9, q8, q8
2113 vst1.64 {q8}, [r0,:128]!
2114 vswp d13,d12
2115 vshr.s64 q7, q9, #63
2116 veor q9, q9, q6
2117 vand q7, q7, q5
2118 vadd.u64 q10, q9, q9
2119 vst1.64 {q9}, [r0,:128]!
2120 vswp d15,d14
2121 vshr.s64 q6, q10, #63
2122 veor q10, q10, q7
2123 vand q6, q6, q5
2124 vld1.8 {q0}, [r7]!
2125 vadd.u64 q11, q10, q10
2126 vst1.64 {q10}, [r0,:128]!
2127 vswp d13,d12
2128 vshr.s64 q7, q11, #63
2129 veor q11, q11, q6
2130 vand q7, q7, q5
2131 vld1.8 {q1}, [r7]!
2132 veor q0, q0, q8
2133 vadd.u64 q12, q11, q11
2134 vst1.64 {q11}, [r0,:128]!
2135 vswp d15,d14
2136 vshr.s64 q6, q12, #63
2137 veor q12, q12, q7
2138 vand q6, q6, q5
2139 vld1.8 {q2}, [r7]!
2140 veor q1, q1, q9
2141 vadd.u64 q13, q12, q12
2142 vst1.64 {q12}, [r0,:128]!
2143 vswp d13,d12
2144 vshr.s64 q7, q13, #63
2145 veor q13, q13, q6
2146 vand q7, q7, q5
2147 vld1.8 {q3}, [r7]!
2148 veor q2, q2, q10
2149 vadd.u64 q14, q13, q13
2150 vst1.64 {q13}, [r0,:128]!
2151 vswp d15,d14
2152 vshr.s64 q6, q14, #63
2153 veor q14, q14, q7
2154 vand q6, q6, q5
2155 vld1.8 {q4}, [r7]!
2156 veor q3, q3, q11
2157 vadd.u64 q15, q14, q14
2158 vst1.64 {q14}, [r0,:128]!
2159 vswp d13,d12
2160 vshr.s64 q7, q15, #63
2161 veor q15, q15, q6
2162 vand q7, q7, q5
2163 vld1.8 {q5}, [r7]!
2164 veor q4, q4, q12
2165 vadd.u64 q8, q15, q15
2166 vst1.64 {q15}, [r0,:128]!
2167 vswp d15,d14
2168 veor q8, q8, q7
2169 vst1.64 {q8}, [r0,:128] @ next round tweak
2170
2171 vld1.8 {q6-q7}, [r7]!
2172 veor q5, q5, q13
2173#ifndef BSAES_ASM_EXTENDED_KEY
2174 add r4, sp, #0x90 @ pass key schedule
2175#else
2176 add r4, r10, #248 @ pass key schedule
2177#endif
2178 veor q6, q6, q14
2179 mov r5, r1 @ pass rounds
2180 veor q7, q7, q15
2181 mov r0, sp
2182
2183 bl _bsaes_decrypt8
2184
2185 vld1.64 {q8-q9}, [r0,:128]!
2186 vld1.64 {q10-q11}, [r0,:128]!
2187 veor q0, q0, q8
2188 vld1.64 {q12-q13}, [r0,:128]!
2189 veor q1, q1, q9
2190 veor q8, q6, q10
2191 vst1.8 {q0-q1}, [r8]!
2192 veor q9, q4, q11
2193 vld1.64 {q14-q15}, [r0,:128]!
2194 veor q10, q2, q12
2195 vst1.8 {q8-q9}, [r8]!
2196 veor q11, q7, q13
2197 veor q12, q3, q14
2198 vst1.8 {q10-q11}, [r8]!
2199 veor q13, q5, q15
2200 vst1.8 {q12-q13}, [r8]!
2201
2202 vld1.64 {q8}, [r0,:128] @ next round tweak
2203
2204 subs r9, #0x80
2205 bpl .Lxts_dec_loop
2206
2207.Lxts_dec_short:
2208 adds r9, #0x70
2209 bmi .Lxts_dec_done
2210
2211 vldmia r2, {q5} @ load XTS magic
2212 vshr.s64 q7, q8, #63
2213 mov r0, sp
2214 vand q7, q7, q5
2215 vadd.u64 q9, q8, q8
2216 vst1.64 {q8}, [r0,:128]!
2217 vswp d15,d14
2218 vshr.s64 q6, q9, #63
2219 veor q9, q9, q7
2220 vand q6, q6, q5
2221 vadd.u64 q10, q9, q9
2222 vst1.64 {q9}, [r0,:128]!
2223 vswp d13,d12
2224 vshr.s64 q7, q10, #63
2225 veor q10, q10, q6
2226 vand q7, q7, q5
2227 vld1.8 {q0}, [r7]!
2228 subs r9, #0x10
2229 bmi .Lxts_dec_1
2230 vadd.u64 q11, q10, q10
2231 vst1.64 {q10}, [r0,:128]!
2232 vswp d15,d14
2233 vshr.s64 q6, q11, #63
2234 veor q11, q11, q7
2235 vand q6, q6, q5
2236 vld1.8 {q1}, [r7]!
2237 subs r9, #0x10
2238 bmi .Lxts_dec_2
2239 veor q0, q0, q8
2240 vadd.u64 q12, q11, q11
2241 vst1.64 {q11}, [r0,:128]!
2242 vswp d13,d12
2243 vshr.s64 q7, q12, #63
2244 veor q12, q12, q6
2245 vand q7, q7, q5
2246 vld1.8 {q2}, [r7]!
2247 subs r9, #0x10
2248 bmi .Lxts_dec_3
2249 veor q1, q1, q9
2250 vadd.u64 q13, q12, q12
2251 vst1.64 {q12}, [r0,:128]!
2252 vswp d15,d14
2253 vshr.s64 q6, q13, #63
2254 veor q13, q13, q7
2255 vand q6, q6, q5
2256 vld1.8 {q3}, [r7]!
2257 subs r9, #0x10
2258 bmi .Lxts_dec_4
2259 veor q2, q2, q10
2260 vadd.u64 q14, q13, q13
2261 vst1.64 {q13}, [r0,:128]!
2262 vswp d13,d12
2263 vshr.s64 q7, q14, #63
2264 veor q14, q14, q6
2265 vand q7, q7, q5
2266 vld1.8 {q4}, [r7]!
2267 subs r9, #0x10
2268 bmi .Lxts_dec_5
2269 veor q3, q3, q11
2270 vadd.u64 q15, q14, q14
2271 vst1.64 {q14}, [r0,:128]!
2272 vswp d15,d14
2273 vshr.s64 q6, q15, #63
2274 veor q15, q15, q7
2275 vand q6, q6, q5
2276 vld1.8 {q5}, [r7]!
2277 subs r9, #0x10
2278 bmi .Lxts_dec_6
2279 veor q4, q4, q12
2280 sub r9, #0x10
2281 vst1.64 {q15}, [r0,:128] @ next round tweak
2282
2283 vld1.8 {q6}, [r7]!
2284 veor q5, q5, q13
2285#ifndef BSAES_ASM_EXTENDED_KEY
2286 add r4, sp, #0x90 @ pass key schedule
2287#else
2288 add r4, r10, #248 @ pass key schedule
2289#endif
2290 veor q6, q6, q14
2291 mov r5, r1 @ pass rounds
2292 mov r0, sp
2293
2294 bl _bsaes_decrypt8
2295
2296 vld1.64 {q8-q9}, [r0,:128]!
2297 vld1.64 {q10-q11}, [r0,:128]!
2298 veor q0, q0, q8
2299 vld1.64 {q12-q13}, [r0,:128]!
2300 veor q1, q1, q9
2301 veor q8, q6, q10
2302 vst1.8 {q0-q1}, [r8]!
2303 veor q9, q4, q11
2304 vld1.64 {q14}, [r0,:128]!
2305 veor q10, q2, q12
2306 vst1.8 {q8-q9}, [r8]!
2307 veor q11, q7, q13
2308 veor q12, q3, q14
2309 vst1.8 {q10-q11}, [r8]!
2310 vst1.8 {q12}, [r8]!
2311
2312 vld1.64 {q8}, [r0,:128] @ next round tweak
2313 b .Lxts_dec_done
2314.align 4
2315.Lxts_dec_6:
2316 vst1.64 {q14}, [r0,:128] @ next round tweak
2317
2318 veor q4, q4, q12
2319#ifndef BSAES_ASM_EXTENDED_KEY
2320 add r4, sp, #0x90 @ pass key schedule
2321#else
2322 add r4, r10, #248 @ pass key schedule
2323#endif
2324 veor q5, q5, q13
2325 mov r5, r1 @ pass rounds
2326 mov r0, sp
2327
2328 bl _bsaes_decrypt8
2329
2330 vld1.64 {q8-q9}, [r0,:128]!
2331 vld1.64 {q10-q11}, [r0,:128]!
2332 veor q0, q0, q8
2333 vld1.64 {q12-q13}, [r0,:128]!
2334 veor q1, q1, q9
2335 veor q8, q6, q10
2336 vst1.8 {q0-q1}, [r8]!
2337 veor q9, q4, q11
2338 veor q10, q2, q12
2339 vst1.8 {q8-q9}, [r8]!
2340 veor q11, q7, q13
2341 vst1.8 {q10-q11}, [r8]!
2342
2343 vld1.64 {q8}, [r0,:128] @ next round tweak
2344 b .Lxts_dec_done
2345.align 4
2346.Lxts_dec_5:
2347 vst1.64 {q13}, [r0,:128] @ next round tweak
2348
2349 veor q3, q3, q11
2350#ifndef BSAES_ASM_EXTENDED_KEY
2351 add r4, sp, #0x90 @ pass key schedule
2352#else
2353 add r4, r10, #248 @ pass key schedule
2354#endif
2355 veor q4, q4, q12
2356 mov r5, r1 @ pass rounds
2357 mov r0, sp
2358
2359 bl _bsaes_decrypt8
2360
2361 vld1.64 {q8-q9}, [r0,:128]!
2362 vld1.64 {q10-q11}, [r0,:128]!
2363 veor q0, q0, q8
2364 vld1.64 {q12}, [r0,:128]!
2365 veor q1, q1, q9
2366 veor q8, q6, q10
2367 vst1.8 {q0-q1}, [r8]!
2368 veor q9, q4, q11
2369 veor q10, q2, q12
2370 vst1.8 {q8-q9}, [r8]!
2371 vst1.8 {q10}, [r8]!
2372
2373 vld1.64 {q8}, [r0,:128] @ next round tweak
2374 b .Lxts_dec_done
2375.align 4
2376.Lxts_dec_4:
2377 vst1.64 {q12}, [r0,:128] @ next round tweak
2378
2379 veor q2, q2, q10
2380#ifndef BSAES_ASM_EXTENDED_KEY
2381 add r4, sp, #0x90 @ pass key schedule
2382#else
2383 add r4, r10, #248 @ pass key schedule
2384#endif
2385 veor q3, q3, q11
2386 mov r5, r1 @ pass rounds
2387 mov r0, sp
2388
2389 bl _bsaes_decrypt8
2390
2391 vld1.64 {q8-q9}, [r0,:128]!
2392 vld1.64 {q10-q11}, [r0,:128]!
2393 veor q0, q0, q8
2394 veor q1, q1, q9
2395 veor q8, q6, q10
2396 vst1.8 {q0-q1}, [r8]!
2397 veor q9, q4, q11
2398 vst1.8 {q8-q9}, [r8]!
2399
2400 vld1.64 {q8}, [r0,:128] @ next round tweak
2401 b .Lxts_dec_done
2402.align 4
2403.Lxts_dec_3:
2404 vst1.64 {q11}, [r0,:128] @ next round tweak
2405
2406 veor q1, q1, q9
2407#ifndef BSAES_ASM_EXTENDED_KEY
2408 add r4, sp, #0x90 @ pass key schedule
2409#else
2410 add r4, r10, #248 @ pass key schedule
2411#endif
2412 veor q2, q2, q10
2413 mov r5, r1 @ pass rounds
2414 mov r0, sp
2415
2416 bl _bsaes_decrypt8
2417
2418 vld1.64 {q8-q9}, [r0,:128]!
2419 vld1.64 {q10}, [r0,:128]!
2420 veor q0, q0, q8
2421 veor q1, q1, q9
2422 veor q8, q6, q10
2423 vst1.8 {q0-q1}, [r8]!
2424 vst1.8 {q8}, [r8]!
2425
2426 vld1.64 {q8}, [r0,:128] @ next round tweak
2427 b .Lxts_dec_done
2428.align 4
2429.Lxts_dec_2:
2430 vst1.64 {q10}, [r0,:128] @ next round tweak
2431
2432 veor q0, q0, q8
2433#ifndef BSAES_ASM_EXTENDED_KEY
2434 add r4, sp, #0x90 @ pass key schedule
2435#else
2436 add r4, r10, #248 @ pass key schedule
2437#endif
2438 veor q1, q1, q9
2439 mov r5, r1 @ pass rounds
2440 mov r0, sp
2441
2442 bl _bsaes_decrypt8
2443
2444 vld1.64 {q8-q9}, [r0,:128]!
2445 veor q0, q0, q8
2446 veor q1, q1, q9
2447 vst1.8 {q0-q1}, [r8]!
2448
2449 vld1.64 {q8}, [r0,:128] @ next round tweak
2450 b .Lxts_dec_done
2451.align 4
2452.Lxts_dec_1:
2453 mov r0, sp
2454 veor q0, q8
2455 mov r1, sp
2456 vst1.8 {q0}, [sp,:128]
2457 mov r2, r10
2458 mov r4, r3 @ preserve fp
2459 mov r5, r2 @ preserve magic
2460
2461 bl AES_decrypt
2462
2463 vld1.8 {q0}, [sp,:128]
2464 veor q0, q0, q8
2465 vst1.8 {q0}, [r8]!
2466 mov r3, r4
2467 mov r2, r5
2468
2469 vmov q8, q9 @ next round tweak
2470
2471.Lxts_dec_done:
2472#ifndef XTS_CHAIN_TWEAK
2473 adds r9, #0x10
2474 beq .Lxts_dec_ret
2475
2476 @ calculate one round of extra tweak for the stolen ciphertext
2477 vldmia r2, {q5}
2478 vshr.s64 q6, q8, #63
2479 vand q6, q6, q5
2480 vadd.u64 q9, q8, q8
2481 vswp d13,d12
2482 veor q9, q9, q6
2483
2484 @ perform the final decryption with the last tweak value
2485 vld1.8 {q0}, [r7]!
2486 mov r0, sp
2487 veor q0, q0, q9
2488 mov r1, sp
2489 vst1.8 {q0}, [sp,:128]
2490 mov r2, r10
2491 mov r4, r3 @ preserve fp
2492
2493 bl AES_decrypt
2494
2495 vld1.8 {q0}, [sp,:128]
2496 veor q0, q0, q9
2497 vst1.8 {q0}, [r8]
2498
2499 mov r6, r8
2500.Lxts_dec_steal:
2501 ldrb r1, [r8]
2502 ldrb r0, [r7], #1
2503 strb r1, [r8, #0x10]
2504 strb r0, [r8], #1
2505
2506 subs r9, #1
2507 bhi .Lxts_dec_steal
2508
2509 vld1.8 {q0}, [r6]
2510 mov r0, sp
2511 veor q0, q8
2512 mov r1, sp
2513 vst1.8 {q0}, [sp,:128]
2514 mov r2, r10
2515
2516 bl AES_decrypt
2517
2518 vld1.8 {q0}, [sp,:128]
2519 veor q0, q0, q8
2520 vst1.8 {q0}, [r6]
2521 mov r3, r4
2522#endif
2523
2524.Lxts_dec_ret:
2525 bic r0, r3, #0xf
2526 vmov.i32 q0, #0
2527 vmov.i32 q1, #0
2528#ifdef XTS_CHAIN_TWEAK
2529 ldr r1, [r3, #0x20+VFP_ABI_FRAME] @ chain tweak
2530#endif
2531.Lxts_dec_bzero: @ wipe key schedule [if any]
2532 vstmia sp!, {q0-q1}
2533 cmp sp, r0
2534 bne .Lxts_dec_bzero
2535
2536 mov sp, r3
2537#ifdef XTS_CHAIN_TWEAK
2538 vst1.8 {q8}, [r1]
2539#endif
2540 VFP_ABI_POP
2541 ldmia sp!, {r4-r10, pc} @ return
2542
2543.size bsaes_xts_decrypt,.-bsaes_xts_decrypt
2544#endif
diff --git a/arch/arm/crypto/aesbs-glue.c b/arch/arm/crypto/aesbs-glue.c
new file mode 100644
index 000000000000..4522366da759
--- /dev/null
+++ b/arch/arm/crypto/aesbs-glue.c
@@ -0,0 +1,434 @@
1/*
2 * linux/arch/arm/crypto/aesbs-glue.c - glue code for NEON bit sliced AES
3 *
4 * Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <asm/neon.h>
12#include <crypto/aes.h>
13#include <crypto/ablk_helper.h>
14#include <crypto/algapi.h>
15#include <linux/module.h>
16
17#include "aes_glue.h"
18
19#define BIT_SLICED_KEY_MAXSIZE (128 * (AES_MAXNR - 1) + 2 * AES_BLOCK_SIZE)
20
21struct BS_KEY {
22 struct AES_KEY rk;
23 int converted;
24 u8 __aligned(8) bs[BIT_SLICED_KEY_MAXSIZE];
25} __aligned(8);
26
27asmlinkage void bsaes_enc_key_convert(u8 out[], struct AES_KEY const *in);
28asmlinkage void bsaes_dec_key_convert(u8 out[], struct AES_KEY const *in);
29
30asmlinkage void bsaes_cbc_encrypt(u8 const in[], u8 out[], u32 bytes,
31 struct BS_KEY *key, u8 iv[]);
32
33asmlinkage void bsaes_ctr32_encrypt_blocks(u8 const in[], u8 out[], u32 blocks,
34 struct BS_KEY *key, u8 const iv[]);
35
36asmlinkage void bsaes_xts_encrypt(u8 const in[], u8 out[], u32 bytes,
37 struct BS_KEY *key, u8 tweak[]);
38
39asmlinkage void bsaes_xts_decrypt(u8 const in[], u8 out[], u32 bytes,
40 struct BS_KEY *key, u8 tweak[]);
41
42struct aesbs_cbc_ctx {
43 struct AES_KEY enc;
44 struct BS_KEY dec;
45};
46
47struct aesbs_ctr_ctx {
48 struct BS_KEY enc;
49};
50
51struct aesbs_xts_ctx {
52 struct BS_KEY enc;
53 struct BS_KEY dec;
54 struct AES_KEY twkey;
55};
56
57static int aesbs_cbc_set_key(struct crypto_tfm *tfm, const u8 *in_key,
58 unsigned int key_len)
59{
60 struct aesbs_cbc_ctx *ctx = crypto_tfm_ctx(tfm);
61 int bits = key_len * 8;
62
63 if (private_AES_set_encrypt_key(in_key, bits, &ctx->enc)) {
64 tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
65 return -EINVAL;
66 }
67 ctx->dec.rk = ctx->enc;
68 private_AES_set_decrypt_key(in_key, bits, &ctx->dec.rk);
69 ctx->dec.converted = 0;
70 return 0;
71}
72
73static int aesbs_ctr_set_key(struct crypto_tfm *tfm, const u8 *in_key,
74 unsigned int key_len)
75{
76 struct aesbs_ctr_ctx *ctx = crypto_tfm_ctx(tfm);
77 int bits = key_len * 8;
78
79 if (private_AES_set_encrypt_key(in_key, bits, &ctx->enc.rk)) {
80 tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
81 return -EINVAL;
82 }
83 ctx->enc.converted = 0;
84 return 0;
85}
86
87static int aesbs_xts_set_key(struct crypto_tfm *tfm, const u8 *in_key,
88 unsigned int key_len)
89{
90 struct aesbs_xts_ctx *ctx = crypto_tfm_ctx(tfm);
91 int bits = key_len * 4;
92
93 if (private_AES_set_encrypt_key(in_key, bits, &ctx->enc.rk)) {
94 tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
95 return -EINVAL;
96 }
97 ctx->dec.rk = ctx->enc.rk;
98 private_AES_set_decrypt_key(in_key, bits, &ctx->dec.rk);
99 private_AES_set_encrypt_key(in_key + key_len / 2, bits, &ctx->twkey);
100 ctx->enc.converted = ctx->dec.converted = 0;
101 return 0;
102}
103
104static int aesbs_cbc_encrypt(struct blkcipher_desc *desc,
105 struct scatterlist *dst,
106 struct scatterlist *src, unsigned int nbytes)
107{
108 struct aesbs_cbc_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
109 struct blkcipher_walk walk;
110 int err;
111
112 blkcipher_walk_init(&walk, dst, src, nbytes);
113 err = blkcipher_walk_virt(desc, &walk);
114
115 while (walk.nbytes) {
116 u32 blocks = walk.nbytes / AES_BLOCK_SIZE;
117 u8 *src = walk.src.virt.addr;
118
119 if (walk.dst.virt.addr == walk.src.virt.addr) {
120 u8 *iv = walk.iv;
121
122 do {
123 crypto_xor(src, iv, AES_BLOCK_SIZE);
124 AES_encrypt(src, src, &ctx->enc);
125 iv = src;
126 src += AES_BLOCK_SIZE;
127 } while (--blocks);
128 memcpy(walk.iv, iv, AES_BLOCK_SIZE);
129 } else {
130 u8 *dst = walk.dst.virt.addr;
131
132 do {
133 crypto_xor(walk.iv, src, AES_BLOCK_SIZE);
134 AES_encrypt(walk.iv, dst, &ctx->enc);
135 memcpy(walk.iv, dst, AES_BLOCK_SIZE);
136 src += AES_BLOCK_SIZE;
137 dst += AES_BLOCK_SIZE;
138 } while (--blocks);
139 }
140 err = blkcipher_walk_done(desc, &walk, 0);
141 }
142 return err;
143}
144
145static int aesbs_cbc_decrypt(struct blkcipher_desc *desc,
146 struct scatterlist *dst,
147 struct scatterlist *src, unsigned int nbytes)
148{
149 struct aesbs_cbc_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
150 struct blkcipher_walk walk;
151 int err;
152
153 blkcipher_walk_init(&walk, dst, src, nbytes);
154 err = blkcipher_walk_virt_block(desc, &walk, 8 * AES_BLOCK_SIZE);
155
156 while ((walk.nbytes / AES_BLOCK_SIZE) >= 8) {
157 kernel_neon_begin();
158 bsaes_cbc_encrypt(walk.src.virt.addr, walk.dst.virt.addr,
159 walk.nbytes, &ctx->dec, walk.iv);
160 kernel_neon_end();
161 err = blkcipher_walk_done(desc, &walk, 0);
162 }
163 while (walk.nbytes) {
164 u32 blocks = walk.nbytes / AES_BLOCK_SIZE;
165 u8 *dst = walk.dst.virt.addr;
166 u8 *src = walk.src.virt.addr;
167 u8 bk[2][AES_BLOCK_SIZE];
168 u8 *iv = walk.iv;
169
170 do {
171 if (walk.dst.virt.addr == walk.src.virt.addr)
172 memcpy(bk[blocks & 1], src, AES_BLOCK_SIZE);
173
174 AES_decrypt(src, dst, &ctx->dec.rk);
175 crypto_xor(dst, iv, AES_BLOCK_SIZE);
176
177 if (walk.dst.virt.addr == walk.src.virt.addr)
178 iv = bk[blocks & 1];
179 else
180 iv = src;
181
182 dst += AES_BLOCK_SIZE;
183 src += AES_BLOCK_SIZE;
184 } while (--blocks);
185 err = blkcipher_walk_done(desc, &walk, 0);
186 }
187 return err;
188}
189
190static void inc_be128_ctr(__be32 ctr[], u32 addend)
191{
192 int i;
193
194 for (i = 3; i >= 0; i--, addend = 1) {
195 u32 n = be32_to_cpu(ctr[i]) + addend;
196
197 ctr[i] = cpu_to_be32(n);
198 if (n >= addend)
199 break;
200 }
201}
202
203static int aesbs_ctr_encrypt(struct blkcipher_desc *desc,
204 struct scatterlist *dst, struct scatterlist *src,
205 unsigned int nbytes)
206{
207 struct aesbs_ctr_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
208 struct blkcipher_walk walk;
209 u32 blocks;
210 int err;
211
212 blkcipher_walk_init(&walk, dst, src, nbytes);
213 err = blkcipher_walk_virt_block(desc, &walk, 8 * AES_BLOCK_SIZE);
214
215 while ((blocks = walk.nbytes / AES_BLOCK_SIZE)) {
216 u32 tail = walk.nbytes % AES_BLOCK_SIZE;
217 __be32 *ctr = (__be32 *)walk.iv;
218 u32 headroom = UINT_MAX - be32_to_cpu(ctr[3]);
219
220 /* avoid 32 bit counter overflow in the NEON code */
221 if (unlikely(headroom < blocks)) {
222 blocks = headroom + 1;
223 tail = walk.nbytes - blocks * AES_BLOCK_SIZE;
224 }
225 kernel_neon_begin();
226 bsaes_ctr32_encrypt_blocks(walk.src.virt.addr,
227 walk.dst.virt.addr, blocks,
228 &ctx->enc, walk.iv);
229 kernel_neon_end();
230 inc_be128_ctr(ctr, blocks);
231
232 nbytes -= blocks * AES_BLOCK_SIZE;
233 if (nbytes && nbytes == tail && nbytes <= AES_BLOCK_SIZE)
234 break;
235
236 err = blkcipher_walk_done(desc, &walk, tail);
237 }
238 if (walk.nbytes) {
239 u8 *tdst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE;
240 u8 *tsrc = walk.src.virt.addr + blocks * AES_BLOCK_SIZE;
241 u8 ks[AES_BLOCK_SIZE];
242
243 AES_encrypt(walk.iv, ks, &ctx->enc.rk);
244 if (tdst != tsrc)
245 memcpy(tdst, tsrc, nbytes);
246 crypto_xor(tdst, ks, nbytes);
247 err = blkcipher_walk_done(desc, &walk, 0);
248 }
249 return err;
250}
251
252static int aesbs_xts_encrypt(struct blkcipher_desc *desc,
253 struct scatterlist *dst,
254 struct scatterlist *src, unsigned int nbytes)
255{
256 struct aesbs_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
257 struct blkcipher_walk walk;
258 int err;
259
260 blkcipher_walk_init(&walk, dst, src, nbytes);
261 err = blkcipher_walk_virt_block(desc, &walk, 8 * AES_BLOCK_SIZE);
262
263 /* generate the initial tweak */
264 AES_encrypt(walk.iv, walk.iv, &ctx->twkey);
265
266 while (walk.nbytes) {
267 kernel_neon_begin();
268 bsaes_xts_encrypt(walk.src.virt.addr, walk.dst.virt.addr,
269 walk.nbytes, &ctx->enc, walk.iv);
270 kernel_neon_end();
271 err = blkcipher_walk_done(desc, &walk, 0);
272 }
273 return err;
274}
275
276static int aesbs_xts_decrypt(struct blkcipher_desc *desc,
277 struct scatterlist *dst,
278 struct scatterlist *src, unsigned int nbytes)
279{
280 struct aesbs_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
281 struct blkcipher_walk walk;
282 int err;
283
284 blkcipher_walk_init(&walk, dst, src, nbytes);
285 err = blkcipher_walk_virt_block(desc, &walk, 8 * AES_BLOCK_SIZE);
286
287 /* generate the initial tweak */
288 AES_encrypt(walk.iv, walk.iv, &ctx->twkey);
289
290 while (walk.nbytes) {
291 kernel_neon_begin();
292 bsaes_xts_decrypt(walk.src.virt.addr, walk.dst.virt.addr,
293 walk.nbytes, &ctx->dec, walk.iv);
294 kernel_neon_end();
295 err = blkcipher_walk_done(desc, &walk, 0);
296 }
297 return err;
298}
299
300static struct crypto_alg aesbs_algs[] = { {
301 .cra_name = "__cbc-aes-neonbs",
302 .cra_driver_name = "__driver-cbc-aes-neonbs",
303 .cra_priority = 0,
304 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
305 .cra_blocksize = AES_BLOCK_SIZE,
306 .cra_ctxsize = sizeof(struct aesbs_cbc_ctx),
307 .cra_alignmask = 7,
308 .cra_type = &crypto_blkcipher_type,
309 .cra_module = THIS_MODULE,
310 .cra_blkcipher = {
311 .min_keysize = AES_MIN_KEY_SIZE,
312 .max_keysize = AES_MAX_KEY_SIZE,
313 .ivsize = AES_BLOCK_SIZE,
314 .setkey = aesbs_cbc_set_key,
315 .encrypt = aesbs_cbc_encrypt,
316 .decrypt = aesbs_cbc_decrypt,
317 },
318}, {
319 .cra_name = "__ctr-aes-neonbs",
320 .cra_driver_name = "__driver-ctr-aes-neonbs",
321 .cra_priority = 0,
322 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
323 .cra_blocksize = 1,
324 .cra_ctxsize = sizeof(struct aesbs_ctr_ctx),
325 .cra_alignmask = 7,
326 .cra_type = &crypto_blkcipher_type,
327 .cra_module = THIS_MODULE,
328 .cra_blkcipher = {
329 .min_keysize = AES_MIN_KEY_SIZE,
330 .max_keysize = AES_MAX_KEY_SIZE,
331 .ivsize = AES_BLOCK_SIZE,
332 .setkey = aesbs_ctr_set_key,
333 .encrypt = aesbs_ctr_encrypt,
334 .decrypt = aesbs_ctr_encrypt,
335 },
336}, {
337 .cra_name = "__xts-aes-neonbs",
338 .cra_driver_name = "__driver-xts-aes-neonbs",
339 .cra_priority = 0,
340 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
341 .cra_blocksize = AES_BLOCK_SIZE,
342 .cra_ctxsize = sizeof(struct aesbs_xts_ctx),
343 .cra_alignmask = 7,
344 .cra_type = &crypto_blkcipher_type,
345 .cra_module = THIS_MODULE,
346 .cra_blkcipher = {
347 .min_keysize = 2 * AES_MIN_KEY_SIZE,
348 .max_keysize = 2 * AES_MAX_KEY_SIZE,
349 .ivsize = AES_BLOCK_SIZE,
350 .setkey = aesbs_xts_set_key,
351 .encrypt = aesbs_xts_encrypt,
352 .decrypt = aesbs_xts_decrypt,
353 },
354}, {
355 .cra_name = "cbc(aes)",
356 .cra_driver_name = "cbc-aes-neonbs",
357 .cra_priority = 300,
358 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER|CRYPTO_ALG_ASYNC,
359 .cra_blocksize = AES_BLOCK_SIZE,
360 .cra_ctxsize = sizeof(struct async_helper_ctx),
361 .cra_alignmask = 7,
362 .cra_type = &crypto_ablkcipher_type,
363 .cra_module = THIS_MODULE,
364 .cra_init = ablk_init,
365 .cra_exit = ablk_exit,
366 .cra_ablkcipher = {
367 .min_keysize = AES_MIN_KEY_SIZE,
368 .max_keysize = AES_MAX_KEY_SIZE,
369 .ivsize = AES_BLOCK_SIZE,
370 .setkey = ablk_set_key,
371 .encrypt = __ablk_encrypt,
372 .decrypt = ablk_decrypt,
373 }
374}, {
375 .cra_name = "ctr(aes)",
376 .cra_driver_name = "ctr-aes-neonbs",
377 .cra_priority = 300,
378 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER|CRYPTO_ALG_ASYNC,
379 .cra_blocksize = 1,
380 .cra_ctxsize = sizeof(struct async_helper_ctx),
381 .cra_alignmask = 7,
382 .cra_type = &crypto_ablkcipher_type,
383 .cra_module = THIS_MODULE,
384 .cra_init = ablk_init,
385 .cra_exit = ablk_exit,
386 .cra_ablkcipher = {
387 .min_keysize = AES_MIN_KEY_SIZE,
388 .max_keysize = AES_MAX_KEY_SIZE,
389 .ivsize = AES_BLOCK_SIZE,
390 .setkey = ablk_set_key,
391 .encrypt = ablk_encrypt,
392 .decrypt = ablk_decrypt,
393 }
394}, {
395 .cra_name = "xts(aes)",
396 .cra_driver_name = "xts-aes-neonbs",
397 .cra_priority = 300,
398 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER|CRYPTO_ALG_ASYNC,
399 .cra_blocksize = AES_BLOCK_SIZE,
400 .cra_ctxsize = sizeof(struct async_helper_ctx),
401 .cra_alignmask = 7,
402 .cra_type = &crypto_ablkcipher_type,
403 .cra_module = THIS_MODULE,
404 .cra_init = ablk_init,
405 .cra_exit = ablk_exit,
406 .cra_ablkcipher = {
407 .min_keysize = 2 * AES_MIN_KEY_SIZE,
408 .max_keysize = 2 * AES_MAX_KEY_SIZE,
409 .ivsize = AES_BLOCK_SIZE,
410 .setkey = ablk_set_key,
411 .encrypt = ablk_encrypt,
412 .decrypt = ablk_decrypt,
413 }
414} };
415
416static int __init aesbs_mod_init(void)
417{
418 if (!cpu_has_neon())
419 return -ENODEV;
420
421 return crypto_register_algs(aesbs_algs, ARRAY_SIZE(aesbs_algs));
422}
423
424static void __exit aesbs_mod_exit(void)
425{
426 crypto_unregister_algs(aesbs_algs, ARRAY_SIZE(aesbs_algs));
427}
428
429module_init(aesbs_mod_init);
430module_exit(aesbs_mod_exit);
431
432MODULE_DESCRIPTION("Bit sliced AES in CBC/CTR/XTS modes using NEON");
433MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@linaro.org>");
434MODULE_LICENSE("GPL");
diff --git a/arch/arm/crypto/bsaes-armv7.pl b/arch/arm/crypto/bsaes-armv7.pl
new file mode 100644
index 000000000000..f3d96d932573
--- /dev/null
+++ b/arch/arm/crypto/bsaes-armv7.pl
@@ -0,0 +1,2467 @@
1#!/usr/bin/env perl
2
3# ====================================================================
4# Written by Andy Polyakov <appro@openssl.org> for the OpenSSL
5# project. The module is, however, dual licensed under OpenSSL and
6# CRYPTOGAMS licenses depending on where you obtain it. For further
7# details see http://www.openssl.org/~appro/cryptogams/.
8#
9# Specific modes and adaptation for Linux kernel by Ard Biesheuvel
10# <ard.biesheuvel@linaro.org>. Permission to use under GPL terms is
11# granted.
12# ====================================================================
13
14# Bit-sliced AES for ARM NEON
15#
16# February 2012.
17#
18# This implementation is direct adaptation of bsaes-x86_64 module for
19# ARM NEON. Except that this module is endian-neutral [in sense that
20# it can be compiled for either endianness] by courtesy of vld1.8's
21# neutrality. Initial version doesn't implement interface to OpenSSL,
22# only low-level primitives and unsupported entry points, just enough
23# to collect performance results, which for Cortex-A8 core are:
24#
25# encrypt 19.5 cycles per byte processed with 128-bit key
26# decrypt 22.1 cycles per byte processed with 128-bit key
27# key conv. 440 cycles per 128-bit key/0.18 of 8x block
28#
29# Snapdragon S4 encrypts byte in 17.6 cycles and decrypts in 19.7,
30# which is [much] worse than anticipated (for further details see
31# http://www.openssl.org/~appro/Snapdragon-S4.html).
32#
33# Cortex-A15 manages in 14.2/16.1 cycles [when integer-only code
34# manages in 20.0 cycles].
35#
36# When comparing to x86_64 results keep in mind that NEON unit is
37# [mostly] single-issue and thus can't [fully] benefit from
38# instruction-level parallelism. And when comparing to aes-armv4
39# results keep in mind key schedule conversion overhead (see
40# bsaes-x86_64.pl for further details)...
41#
42# <appro@openssl.org>
43
44# April-August 2013
45#
46# Add CBC, CTR and XTS subroutines, adapt for kernel use.
47#
48# <ard.biesheuvel@linaro.org>
49
50while (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
51open STDOUT,">$output";
52
53my ($inp,$out,$len,$key)=("r0","r1","r2","r3");
54my @XMM=map("q$_",(0..15));
55
56{
57my ($key,$rounds,$const)=("r4","r5","r6");
58
59sub Dlo() { shift=~m|q([1]?[0-9])|?"d".($1*2):""; }
60sub Dhi() { shift=~m|q([1]?[0-9])|?"d".($1*2+1):""; }
61
62sub Sbox {
63# input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb
64# output in lsb > [b0, b1, b4, b6, b3, b7, b2, b5] < msb
65my @b=@_[0..7];
66my @t=@_[8..11];
67my @s=@_[12..15];
68 &InBasisChange (@b);
69 &Inv_GF256 (@b[6,5,0,3,7,1,4,2],@t,@s);
70 &OutBasisChange (@b[7,1,4,2,6,5,0,3]);
71}
72
73sub InBasisChange {
74# input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb
75# output in lsb > [b6, b5, b0, b3, b7, b1, b4, b2] < msb
76my @b=@_[0..7];
77$code.=<<___;
78 veor @b[2], @b[2], @b[1]
79 veor @b[5], @b[5], @b[6]
80 veor @b[3], @b[3], @b[0]
81 veor @b[6], @b[6], @b[2]
82 veor @b[5], @b[5], @b[0]
83
84 veor @b[6], @b[6], @b[3]
85 veor @b[3], @b[3], @b[7]
86 veor @b[7], @b[7], @b[5]
87 veor @b[3], @b[3], @b[4]
88 veor @b[4], @b[4], @b[5]
89
90 veor @b[2], @b[2], @b[7]
91 veor @b[3], @b[3], @b[1]
92 veor @b[1], @b[1], @b[5]
93___
94}
95
96sub OutBasisChange {
97# input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb
98# output in lsb > [b6, b1, b2, b4, b7, b0, b3, b5] < msb
99my @b=@_[0..7];
100$code.=<<___;
101 veor @b[0], @b[0], @b[6]
102 veor @b[1], @b[1], @b[4]
103 veor @b[4], @b[4], @b[6]
104 veor @b[2], @b[2], @b[0]
105 veor @b[6], @b[6], @b[1]
106
107 veor @b[1], @b[1], @b[5]
108 veor @b[5], @b[5], @b[3]
109 veor @b[3], @b[3], @b[7]
110 veor @b[7], @b[7], @b[5]
111 veor @b[2], @b[2], @b[5]
112
113 veor @b[4], @b[4], @b[7]
114___
115}
116
117sub InvSbox {
118# input in lsb > [b0, b1, b2, b3, b4, b5, b6, b7] < msb
119# output in lsb > [b0, b1, b6, b4, b2, b7, b3, b5] < msb
120my @b=@_[0..7];
121my @t=@_[8..11];
122my @s=@_[12..15];
123 &InvInBasisChange (@b);
124 &Inv_GF256 (@b[5,1,2,6,3,7,0,4],@t,@s);
125 &InvOutBasisChange (@b[3,7,0,4,5,1,2,6]);
126}
127
128sub InvInBasisChange { # OutBasisChange in reverse (with twist)
129my @b=@_[5,1,2,6,3,7,0,4];
130$code.=<<___
131 veor @b[1], @b[1], @b[7]
132 veor @b[4], @b[4], @b[7]
133
134 veor @b[7], @b[7], @b[5]
135 veor @b[1], @b[1], @b[3]
136 veor @b[2], @b[2], @b[5]
137 veor @b[3], @b[3], @b[7]
138
139 veor @b[6], @b[6], @b[1]
140 veor @b[2], @b[2], @b[0]
141 veor @b[5], @b[5], @b[3]
142 veor @b[4], @b[4], @b[6]
143 veor @b[0], @b[0], @b[6]
144 veor @b[1], @b[1], @b[4]
145___
146}
147
148sub InvOutBasisChange { # InBasisChange in reverse
149my @b=@_[2,5,7,3,6,1,0,4];
150$code.=<<___;
151 veor @b[1], @b[1], @b[5]
152 veor @b[2], @b[2], @b[7]
153
154 veor @b[3], @b[3], @b[1]
155 veor @b[4], @b[4], @b[5]
156 veor @b[7], @b[7], @b[5]
157 veor @b[3], @b[3], @b[4]
158 veor @b[5], @b[5], @b[0]
159 veor @b[3], @b[3], @b[7]
160 veor @b[6], @b[6], @b[2]
161 veor @b[2], @b[2], @b[1]
162 veor @b[6], @b[6], @b[3]
163
164 veor @b[3], @b[3], @b[0]
165 veor @b[5], @b[5], @b[6]
166___
167}
168
169sub Mul_GF4 {
170#;*************************************************************
171#;* Mul_GF4: Input x0-x1,y0-y1 Output x0-x1 Temp t0 (8) *
172#;*************************************************************
173my ($x0,$x1,$y0,$y1,$t0,$t1)=@_;
174$code.=<<___;
175 veor $t0, $y0, $y1
176 vand $t0, $t0, $x0
177 veor $x0, $x0, $x1
178 vand $t1, $x1, $y0
179 vand $x0, $x0, $y1
180 veor $x1, $t1, $t0
181 veor $x0, $x0, $t1
182___
183}
184
185sub Mul_GF4_N { # not used, see next subroutine
186# multiply and scale by N
187my ($x0,$x1,$y0,$y1,$t0)=@_;
188$code.=<<___;
189 veor $t0, $y0, $y1
190 vand $t0, $t0, $x0
191 veor $x0, $x0, $x1
192 vand $x1, $x1, $y0
193 vand $x0, $x0, $y1
194 veor $x1, $x1, $x0
195 veor $x0, $x0, $t0
196___
197}
198
199sub Mul_GF4_N_GF4 {
200# interleaved Mul_GF4_N and Mul_GF4
201my ($x0,$x1,$y0,$y1,$t0,
202 $x2,$x3,$y2,$y3,$t1)=@_;
203$code.=<<___;
204 veor $t0, $y0, $y1
205 veor $t1, $y2, $y3
206 vand $t0, $t0, $x0
207 vand $t1, $t1, $x2
208 veor $x0, $x0, $x1
209 veor $x2, $x2, $x3
210 vand $x1, $x1, $y0
211 vand $x3, $x3, $y2
212 vand $x0, $x0, $y1
213 vand $x2, $x2, $y3
214 veor $x1, $x1, $x0
215 veor $x2, $x2, $x3
216 veor $x0, $x0, $t0
217 veor $x3, $x3, $t1
218___
219}
220sub Mul_GF16_2 {
221my @x=@_[0..7];
222my @y=@_[8..11];
223my @t=@_[12..15];
224$code.=<<___;
225 veor @t[0], @x[0], @x[2]
226 veor @t[1], @x[1], @x[3]
227___
228 &Mul_GF4 (@x[0], @x[1], @y[0], @y[1], @t[2..3]);
229$code.=<<___;
230 veor @y[0], @y[0], @y[2]
231 veor @y[1], @y[1], @y[3]
232___
233 Mul_GF4_N_GF4 (@t[0], @t[1], @y[0], @y[1], @t[3],
234 @x[2], @x[3], @y[2], @y[3], @t[2]);
235$code.=<<___;
236 veor @x[0], @x[0], @t[0]
237 veor @x[2], @x[2], @t[0]
238 veor @x[1], @x[1], @t[1]
239 veor @x[3], @x[3], @t[1]
240
241 veor @t[0], @x[4], @x[6]
242 veor @t[1], @x[5], @x[7]
243___
244 &Mul_GF4_N_GF4 (@t[0], @t[1], @y[0], @y[1], @t[3],
245 @x[6], @x[7], @y[2], @y[3], @t[2]);
246$code.=<<___;
247 veor @y[0], @y[0], @y[2]
248 veor @y[1], @y[1], @y[3]
249___
250 &Mul_GF4 (@x[4], @x[5], @y[0], @y[1], @t[2..3]);
251$code.=<<___;
252 veor @x[4], @x[4], @t[0]
253 veor @x[6], @x[6], @t[0]
254 veor @x[5], @x[5], @t[1]
255 veor @x[7], @x[7], @t[1]
256___
257}
258sub Inv_GF256 {
259#;********************************************************************
260#;* Inv_GF256: Input x0-x7 Output x0-x7 Temp t0-t3,s0-s3 (144) *
261#;********************************************************************
262my @x=@_[0..7];
263my @t=@_[8..11];
264my @s=@_[12..15];
265# direct optimizations from hardware
266$code.=<<___;
267 veor @t[3], @x[4], @x[6]
268 veor @t[2], @x[5], @x[7]
269 veor @t[1], @x[1], @x[3]
270 veor @s[1], @x[7], @x[6]
271 vmov @t[0], @t[2]
272 veor @s[0], @x[0], @x[2]
273
274 vorr @t[2], @t[2], @t[1]
275 veor @s[3], @t[3], @t[0]
276 vand @s[2], @t[3], @s[0]
277 vorr @t[3], @t[3], @s[0]
278 veor @s[0], @s[0], @t[1]
279 vand @t[0], @t[0], @t[1]
280 veor @t[1], @x[3], @x[2]
281 vand @s[3], @s[3], @s[0]
282 vand @s[1], @s[1], @t[1]
283 veor @t[1], @x[4], @x[5]
284 veor @s[0], @x[1], @x[0]
285 veor @t[3], @t[3], @s[1]
286 veor @t[2], @t[2], @s[1]
287 vand @s[1], @t[1], @s[0]
288 vorr @t[1], @t[1], @s[0]
289 veor @t[3], @t[3], @s[3]
290 veor @t[0], @t[0], @s[1]
291 veor @t[2], @t[2], @s[2]
292 veor @t[1], @t[1], @s[3]
293 veor @t[0], @t[0], @s[2]
294 vand @s[0], @x[7], @x[3]
295 veor @t[1], @t[1], @s[2]
296 vand @s[1], @x[6], @x[2]
297 vand @s[2], @x[5], @x[1]
298 vorr @s[3], @x[4], @x[0]
299 veor @t[3], @t[3], @s[0]
300 veor @t[1], @t[1], @s[2]
301 veor @t[0], @t[0], @s[3]
302 veor @t[2], @t[2], @s[1]
303
304 @ Inv_GF16 \t0, \t1, \t2, \t3, \s0, \s1, \s2, \s3
305
306 @ new smaller inversion
307
308 vand @s[2], @t[3], @t[1]
309 vmov @s[0], @t[0]
310
311 veor @s[1], @t[2], @s[2]
312 veor @s[3], @t[0], @s[2]
313 veor @s[2], @t[0], @s[2] @ @s[2]=@s[3]
314
315 vbsl @s[1], @t[1], @t[0]
316 vbsl @s[3], @t[3], @t[2]
317 veor @t[3], @t[3], @t[2]
318
319 vbsl @s[0], @s[1], @s[2]
320 vbsl @t[0], @s[2], @s[1]
321
322 vand @s[2], @s[0], @s[3]
323 veor @t[1], @t[1], @t[0]
324
325 veor @s[2], @s[2], @t[3]
326___
327# output in s3, s2, s1, t1
328
329# Mul_GF16_2 \x0, \x1, \x2, \x3, \x4, \x5, \x6, \x7, \t2, \t3, \t0, \t1, \s0, \s1, \s2, \s3
330
331# Mul_GF16_2 \x0, \x1, \x2, \x3, \x4, \x5, \x6, \x7, \s3, \s2, \s1, \t1, \s0, \t0, \t2, \t3
332 &Mul_GF16_2(@x,@s[3,2,1],@t[1],@s[0],@t[0,2,3]);
333
334### output msb > [x3,x2,x1,x0,x7,x6,x5,x4] < lsb
335}
336
337# AES linear components
338
339sub ShiftRows {
340my @x=@_[0..7];
341my @t=@_[8..11];
342my $mask=pop;
343$code.=<<___;
344 vldmia $key!, {@t[0]-@t[3]}
345 veor @t[0], @t[0], @x[0]
346 veor @t[1], @t[1], @x[1]
347 vtbl.8 `&Dlo(@x[0])`, {@t[0]}, `&Dlo($mask)`
348 vtbl.8 `&Dhi(@x[0])`, {@t[0]}, `&Dhi($mask)`
349 vldmia $key!, {@t[0]}
350 veor @t[2], @t[2], @x[2]
351 vtbl.8 `&Dlo(@x[1])`, {@t[1]}, `&Dlo($mask)`
352 vtbl.8 `&Dhi(@x[1])`, {@t[1]}, `&Dhi($mask)`
353 vldmia $key!, {@t[1]}
354 veor @t[3], @t[3], @x[3]
355 vtbl.8 `&Dlo(@x[2])`, {@t[2]}, `&Dlo($mask)`
356 vtbl.8 `&Dhi(@x[2])`, {@t[2]}, `&Dhi($mask)`
357 vldmia $key!, {@t[2]}
358 vtbl.8 `&Dlo(@x[3])`, {@t[3]}, `&Dlo($mask)`
359 vtbl.8 `&Dhi(@x[3])`, {@t[3]}, `&Dhi($mask)`
360 vldmia $key!, {@t[3]}
361 veor @t[0], @t[0], @x[4]
362 veor @t[1], @t[1], @x[5]
363 vtbl.8 `&Dlo(@x[4])`, {@t[0]}, `&Dlo($mask)`
364 vtbl.8 `&Dhi(@x[4])`, {@t[0]}, `&Dhi($mask)`
365 veor @t[2], @t[2], @x[6]
366 vtbl.8 `&Dlo(@x[5])`, {@t[1]}, `&Dlo($mask)`
367 vtbl.8 `&Dhi(@x[5])`, {@t[1]}, `&Dhi($mask)`
368 veor @t[3], @t[3], @x[7]
369 vtbl.8 `&Dlo(@x[6])`, {@t[2]}, `&Dlo($mask)`
370 vtbl.8 `&Dhi(@x[6])`, {@t[2]}, `&Dhi($mask)`
371 vtbl.8 `&Dlo(@x[7])`, {@t[3]}, `&Dlo($mask)`
372 vtbl.8 `&Dhi(@x[7])`, {@t[3]}, `&Dhi($mask)`
373___
374}
375
376sub MixColumns {
377# modified to emit output in order suitable for feeding back to aesenc[last]
378my @x=@_[0..7];
379my @t=@_[8..15];
380my $inv=@_[16]; # optional
381$code.=<<___;
382 vext.8 @t[0], @x[0], @x[0], #12 @ x0 <<< 32
383 vext.8 @t[1], @x[1], @x[1], #12
384 veor @x[0], @x[0], @t[0] @ x0 ^ (x0 <<< 32)
385 vext.8 @t[2], @x[2], @x[2], #12
386 veor @x[1], @x[1], @t[1]
387 vext.8 @t[3], @x[3], @x[3], #12
388 veor @x[2], @x[2], @t[2]
389 vext.8 @t[4], @x[4], @x[4], #12
390 veor @x[3], @x[3], @t[3]
391 vext.8 @t[5], @x[5], @x[5], #12
392 veor @x[4], @x[4], @t[4]
393 vext.8 @t[6], @x[6], @x[6], #12
394 veor @x[5], @x[5], @t[5]
395 vext.8 @t[7], @x[7], @x[7], #12
396 veor @x[6], @x[6], @t[6]
397
398 veor @t[1], @t[1], @x[0]
399 veor @x[7], @x[7], @t[7]
400 vext.8 @x[0], @x[0], @x[0], #8 @ (x0 ^ (x0 <<< 32)) <<< 64)
401 veor @t[2], @t[2], @x[1]
402 veor @t[0], @t[0], @x[7]
403 veor @t[1], @t[1], @x[7]
404 vext.8 @x[1], @x[1], @x[1], #8
405 veor @t[5], @t[5], @x[4]
406 veor @x[0], @x[0], @t[0]
407 veor @t[6], @t[6], @x[5]
408 veor @x[1], @x[1], @t[1]
409 vext.8 @t[0], @x[4], @x[4], #8
410 veor @t[4], @t[4], @x[3]
411 vext.8 @t[1], @x[5], @x[5], #8
412 veor @t[7], @t[7], @x[6]
413 vext.8 @x[4], @x[3], @x[3], #8
414 veor @t[3], @t[3], @x[2]
415 vext.8 @x[5], @x[7], @x[7], #8
416 veor @t[4], @t[4], @x[7]
417 vext.8 @x[3], @x[6], @x[6], #8
418 veor @t[3], @t[3], @x[7]
419 vext.8 @x[6], @x[2], @x[2], #8
420 veor @x[7], @t[1], @t[5]
421___
422$code.=<<___ if (!$inv);
423 veor @x[2], @t[0], @t[4]
424 veor @x[4], @x[4], @t[3]
425 veor @x[5], @x[5], @t[7]
426 veor @x[3], @x[3], @t[6]
427 @ vmov @x[2], @t[0]
428 veor @x[6], @x[6], @t[2]
429 @ vmov @x[7], @t[1]
430___
431$code.=<<___ if ($inv);
432 veor @t[3], @t[3], @x[4]
433 veor @x[5], @x[5], @t[7]
434 veor @x[2], @x[3], @t[6]
435 veor @x[3], @t[0], @t[4]
436 veor @x[4], @x[6], @t[2]
437 vmov @x[6], @t[3]
438 @ vmov @x[7], @t[1]
439___
440}
441
442sub InvMixColumns_orig {
443my @x=@_[0..7];
444my @t=@_[8..15];
445
446$code.=<<___;
447 @ multiplication by 0x0e
448 vext.8 @t[7], @x[7], @x[7], #12
449 vmov @t[2], @x[2]
450 veor @x[2], @x[2], @x[5] @ 2 5
451 veor @x[7], @x[7], @x[5] @ 7 5
452 vext.8 @t[0], @x[0], @x[0], #12
453 vmov @t[5], @x[5]
454 veor @x[5], @x[5], @x[0] @ 5 0 [1]
455 veor @x[0], @x[0], @x[1] @ 0 1
456 vext.8 @t[1], @x[1], @x[1], #12
457 veor @x[1], @x[1], @x[2] @ 1 25
458 veor @x[0], @x[0], @x[6] @ 01 6 [2]
459 vext.8 @t[3], @x[3], @x[3], #12
460 veor @x[1], @x[1], @x[3] @ 125 3 [4]
461 veor @x[2], @x[2], @x[0] @ 25 016 [3]
462 veor @x[3], @x[3], @x[7] @ 3 75
463 veor @x[7], @x[7], @x[6] @ 75 6 [0]
464 vext.8 @t[6], @x[6], @x[6], #12
465 vmov @t[4], @x[4]
466 veor @x[6], @x[6], @x[4] @ 6 4
467 veor @x[4], @x[4], @x[3] @ 4 375 [6]
468 veor @x[3], @x[3], @x[7] @ 375 756=36
469 veor @x[6], @x[6], @t[5] @ 64 5 [7]
470 veor @x[3], @x[3], @t[2] @ 36 2
471 vext.8 @t[5], @t[5], @t[5], #12
472 veor @x[3], @x[3], @t[4] @ 362 4 [5]
473___
474 my @y = @x[7,5,0,2,1,3,4,6];
475$code.=<<___;
476 @ multiplication by 0x0b
477 veor @y[1], @y[1], @y[0]
478 veor @y[0], @y[0], @t[0]
479 vext.8 @t[2], @t[2], @t[2], #12
480 veor @y[1], @y[1], @t[1]
481 veor @y[0], @y[0], @t[5]
482 vext.8 @t[4], @t[4], @t[4], #12
483 veor @y[1], @y[1], @t[6]
484 veor @y[0], @y[0], @t[7]
485 veor @t[7], @t[7], @t[6] @ clobber t[7]
486
487 veor @y[3], @y[3], @t[0]
488 veor @y[1], @y[1], @y[0]
489 vext.8 @t[0], @t[0], @t[0], #12
490 veor @y[2], @y[2], @t[1]
491 veor @y[4], @y[4], @t[1]
492 vext.8 @t[1], @t[1], @t[1], #12
493 veor @y[2], @y[2], @t[2]
494 veor @y[3], @y[3], @t[2]
495 veor @y[5], @y[5], @t[2]
496 veor @y[2], @y[2], @t[7]
497 vext.8 @t[2], @t[2], @t[2], #12
498 veor @y[3], @y[3], @t[3]
499 veor @y[6], @y[6], @t[3]
500 veor @y[4], @y[4], @t[3]
501 veor @y[7], @y[7], @t[4]
502 vext.8 @t[3], @t[3], @t[3], #12
503 veor @y[5], @y[5], @t[4]
504 veor @y[7], @y[7], @t[7]
505 veor @t[7], @t[7], @t[5] @ clobber t[7] even more
506 veor @y[3], @y[3], @t[5]
507 veor @y[4], @y[4], @t[4]
508
509 veor @y[5], @y[5], @t[7]
510 vext.8 @t[4], @t[4], @t[4], #12
511 veor @y[6], @y[6], @t[7]
512 veor @y[4], @y[4], @t[7]
513
514 veor @t[7], @t[7], @t[5]
515 vext.8 @t[5], @t[5], @t[5], #12
516
517 @ multiplication by 0x0d
518 veor @y[4], @y[4], @y[7]
519 veor @t[7], @t[7], @t[6] @ restore t[7]
520 veor @y[7], @y[7], @t[4]
521 vext.8 @t[6], @t[6], @t[6], #12
522 veor @y[2], @y[2], @t[0]
523 veor @y[7], @y[7], @t[5]
524 vext.8 @t[7], @t[7], @t[7], #12
525 veor @y[2], @y[2], @t[2]
526
527 veor @y[3], @y[3], @y[1]
528 veor @y[1], @y[1], @t[1]
529 veor @y[0], @y[0], @t[0]
530 veor @y[3], @y[3], @t[0]
531 veor @y[1], @y[1], @t[5]
532 veor @y[0], @y[0], @t[5]
533 vext.8 @t[0], @t[0], @t[0], #12
534 veor @y[1], @y[1], @t[7]
535 veor @y[0], @y[0], @t[6]
536 veor @y[3], @y[3], @y[1]
537 veor @y[4], @y[4], @t[1]
538 vext.8 @t[1], @t[1], @t[1], #12
539
540 veor @y[7], @y[7], @t[7]
541 veor @y[4], @y[4], @t[2]
542 veor @y[5], @y[5], @t[2]
543 veor @y[2], @y[2], @t[6]
544 veor @t[6], @t[6], @t[3] @ clobber t[6]
545 vext.8 @t[2], @t[2], @t[2], #12
546 veor @y[4], @y[4], @y[7]
547 veor @y[3], @y[3], @t[6]
548
549 veor @y[6], @y[6], @t[6]
550 veor @y[5], @y[5], @t[5]
551 vext.8 @t[5], @t[5], @t[5], #12
552 veor @y[6], @y[6], @t[4]
553 vext.8 @t[4], @t[4], @t[4], #12
554 veor @y[5], @y[5], @t[6]
555 veor @y[6], @y[6], @t[7]
556 vext.8 @t[7], @t[7], @t[7], #12
557 veor @t[6], @t[6], @t[3] @ restore t[6]
558 vext.8 @t[3], @t[3], @t[3], #12
559
560 @ multiplication by 0x09
561 veor @y[4], @y[4], @y[1]
562 veor @t[1], @t[1], @y[1] @ t[1]=y[1]
563 veor @t[0], @t[0], @t[5] @ clobber t[0]
564 vext.8 @t[6], @t[6], @t[6], #12
565 veor @t[1], @t[1], @t[5]
566 veor @y[3], @y[3], @t[0]
567 veor @t[0], @t[0], @y[0] @ t[0]=y[0]
568 veor @t[1], @t[1], @t[6]
569 veor @t[6], @t[6], @t[7] @ clobber t[6]
570 veor @y[4], @y[4], @t[1]
571 veor @y[7], @y[7], @t[4]
572 veor @y[6], @y[6], @t[3]
573 veor @y[5], @y[5], @t[2]
574 veor @t[4], @t[4], @y[4] @ t[4]=y[4]
575 veor @t[3], @t[3], @y[3] @ t[3]=y[3]
576 veor @t[5], @t[5], @y[5] @ t[5]=y[5]
577 veor @t[2], @t[2], @y[2] @ t[2]=y[2]
578 veor @t[3], @t[3], @t[7]
579 veor @XMM[5], @t[5], @t[6]
580 veor @XMM[6], @t[6], @y[6] @ t[6]=y[6]
581 veor @XMM[2], @t[2], @t[6]
582 veor @XMM[7], @t[7], @y[7] @ t[7]=y[7]
583
584 vmov @XMM[0], @t[0]
585 vmov @XMM[1], @t[1]
586 @ vmov @XMM[2], @t[2]
587 vmov @XMM[3], @t[3]
588 vmov @XMM[4], @t[4]
589 @ vmov @XMM[5], @t[5]
590 @ vmov @XMM[6], @t[6]
591 @ vmov @XMM[7], @t[7]
592___
593}
594
595sub InvMixColumns {
596my @x=@_[0..7];
597my @t=@_[8..15];
598
599# Thanks to Jussi Kivilinna for providing pointer to
600#
601# | 0e 0b 0d 09 | | 02 03 01 01 | | 05 00 04 00 |
602# | 09 0e 0b 0d | = | 01 02 03 01 | x | 00 05 00 04 |
603# | 0d 09 0e 0b | | 01 01 02 03 | | 04 00 05 00 |
604# | 0b 0d 09 0e | | 03 01 01 02 | | 00 04 00 05 |
605
606$code.=<<___;
607 @ multiplication by 0x05-0x00-0x04-0x00
608 vext.8 @t[0], @x[0], @x[0], #8
609 vext.8 @t[6], @x[6], @x[6], #8
610 vext.8 @t[7], @x[7], @x[7], #8
611 veor @t[0], @t[0], @x[0]
612 vext.8 @t[1], @x[1], @x[1], #8
613 veor @t[6], @t[6], @x[6]
614 vext.8 @t[2], @x[2], @x[2], #8
615 veor @t[7], @t[7], @x[7]
616 vext.8 @t[3], @x[3], @x[3], #8
617 veor @t[1], @t[1], @x[1]
618 vext.8 @t[4], @x[4], @x[4], #8
619 veor @t[2], @t[2], @x[2]
620 vext.8 @t[5], @x[5], @x[5], #8
621 veor @t[3], @t[3], @x[3]
622 veor @t[4], @t[4], @x[4]
623 veor @t[5], @t[5], @x[5]
624
625 veor @x[0], @x[0], @t[6]
626 veor @x[1], @x[1], @t[6]
627 veor @x[2], @x[2], @t[0]
628 veor @x[4], @x[4], @t[2]
629 veor @x[3], @x[3], @t[1]
630 veor @x[1], @x[1], @t[7]
631 veor @x[2], @x[2], @t[7]
632 veor @x[4], @x[4], @t[6]
633 veor @x[5], @x[5], @t[3]
634 veor @x[3], @x[3], @t[6]
635 veor @x[6], @x[6], @t[4]
636 veor @x[4], @x[4], @t[7]
637 veor @x[5], @x[5], @t[7]
638 veor @x[7], @x[7], @t[5]
639___
640 &MixColumns (@x,@t,1); # flipped 2<->3 and 4<->6
641}
642
643sub swapmove {
644my ($a,$b,$n,$mask,$t)=@_;
645$code.=<<___;
646 vshr.u64 $t, $b, #$n
647 veor $t, $t, $a
648 vand $t, $t, $mask
649 veor $a, $a, $t
650 vshl.u64 $t, $t, #$n
651 veor $b, $b, $t
652___
653}
654sub swapmove2x {
655my ($a0,$b0,$a1,$b1,$n,$mask,$t0,$t1)=@_;
656$code.=<<___;
657 vshr.u64 $t0, $b0, #$n
658 vshr.u64 $t1, $b1, #$n
659 veor $t0, $t0, $a0
660 veor $t1, $t1, $a1
661 vand $t0, $t0, $mask
662 vand $t1, $t1, $mask
663 veor $a0, $a0, $t0
664 vshl.u64 $t0, $t0, #$n
665 veor $a1, $a1, $t1
666 vshl.u64 $t1, $t1, #$n
667 veor $b0, $b0, $t0
668 veor $b1, $b1, $t1
669___
670}
671
672sub bitslice {
673my @x=reverse(@_[0..7]);
674my ($t0,$t1,$t2,$t3)=@_[8..11];
675$code.=<<___;
676 vmov.i8 $t0,#0x55 @ compose .LBS0
677 vmov.i8 $t1,#0x33 @ compose .LBS1
678___
679 &swapmove2x(@x[0,1,2,3],1,$t0,$t2,$t3);
680 &swapmove2x(@x[4,5,6,7],1,$t0,$t2,$t3);
681$code.=<<___;
682 vmov.i8 $t0,#0x0f @ compose .LBS2
683___
684 &swapmove2x(@x[0,2,1,3],2,$t1,$t2,$t3);
685 &swapmove2x(@x[4,6,5,7],2,$t1,$t2,$t3);
686
687 &swapmove2x(@x[0,4,1,5],4,$t0,$t2,$t3);
688 &swapmove2x(@x[2,6,3,7],4,$t0,$t2,$t3);
689}
690
691$code.=<<___;
692#ifndef __KERNEL__
693# include "arm_arch.h"
694
695# define VFP_ABI_PUSH vstmdb sp!,{d8-d15}
696# define VFP_ABI_POP vldmia sp!,{d8-d15}
697# define VFP_ABI_FRAME 0x40
698#else
699# define VFP_ABI_PUSH
700# define VFP_ABI_POP
701# define VFP_ABI_FRAME 0
702# define BSAES_ASM_EXTENDED_KEY
703# define XTS_CHAIN_TWEAK
704# define __ARM_ARCH__ __LINUX_ARM_ARCH__
705#endif
706
707#ifdef __thumb__
708# define adrl adr
709#endif
710
711#if __ARM_ARCH__>=7
712.text
713.syntax unified @ ARMv7-capable assembler is expected to handle this
714#ifdef __thumb2__
715.thumb
716#else
717.code 32
718#endif
719
720.fpu neon
721
722.type _bsaes_decrypt8,%function
723.align 4
724_bsaes_decrypt8:
725 adr $const,_bsaes_decrypt8
726 vldmia $key!, {@XMM[9]} @ round 0 key
727 add $const,$const,#.LM0ISR-_bsaes_decrypt8
728
729 vldmia $const!, {@XMM[8]} @ .LM0ISR
730 veor @XMM[10], @XMM[0], @XMM[9] @ xor with round0 key
731 veor @XMM[11], @XMM[1], @XMM[9]
732 vtbl.8 `&Dlo(@XMM[0])`, {@XMM[10]}, `&Dlo(@XMM[8])`
733 vtbl.8 `&Dhi(@XMM[0])`, {@XMM[10]}, `&Dhi(@XMM[8])`
734 veor @XMM[12], @XMM[2], @XMM[9]
735 vtbl.8 `&Dlo(@XMM[1])`, {@XMM[11]}, `&Dlo(@XMM[8])`
736 vtbl.8 `&Dhi(@XMM[1])`, {@XMM[11]}, `&Dhi(@XMM[8])`
737 veor @XMM[13], @XMM[3], @XMM[9]
738 vtbl.8 `&Dlo(@XMM[2])`, {@XMM[12]}, `&Dlo(@XMM[8])`
739 vtbl.8 `&Dhi(@XMM[2])`, {@XMM[12]}, `&Dhi(@XMM[8])`
740 veor @XMM[14], @XMM[4], @XMM[9]
741 vtbl.8 `&Dlo(@XMM[3])`, {@XMM[13]}, `&Dlo(@XMM[8])`
742 vtbl.8 `&Dhi(@XMM[3])`, {@XMM[13]}, `&Dhi(@XMM[8])`
743 veor @XMM[15], @XMM[5], @XMM[9]
744 vtbl.8 `&Dlo(@XMM[4])`, {@XMM[14]}, `&Dlo(@XMM[8])`
745 vtbl.8 `&Dhi(@XMM[4])`, {@XMM[14]}, `&Dhi(@XMM[8])`
746 veor @XMM[10], @XMM[6], @XMM[9]
747 vtbl.8 `&Dlo(@XMM[5])`, {@XMM[15]}, `&Dlo(@XMM[8])`
748 vtbl.8 `&Dhi(@XMM[5])`, {@XMM[15]}, `&Dhi(@XMM[8])`
749 veor @XMM[11], @XMM[7], @XMM[9]
750 vtbl.8 `&Dlo(@XMM[6])`, {@XMM[10]}, `&Dlo(@XMM[8])`
751 vtbl.8 `&Dhi(@XMM[6])`, {@XMM[10]}, `&Dhi(@XMM[8])`
752 vtbl.8 `&Dlo(@XMM[7])`, {@XMM[11]}, `&Dlo(@XMM[8])`
753 vtbl.8 `&Dhi(@XMM[7])`, {@XMM[11]}, `&Dhi(@XMM[8])`
754___
755 &bitslice (@XMM[0..7, 8..11]);
756$code.=<<___;
757 sub $rounds,$rounds,#1
758 b .Ldec_sbox
759.align 4
760.Ldec_loop:
761___
762 &ShiftRows (@XMM[0..7, 8..12]);
763$code.=".Ldec_sbox:\n";
764 &InvSbox (@XMM[0..7, 8..15]);
765$code.=<<___;
766 subs $rounds,$rounds,#1
767 bcc .Ldec_done
768___
769 &InvMixColumns (@XMM[0,1,6,4,2,7,3,5, 8..15]);
770$code.=<<___;
771 vldmia $const, {@XMM[12]} @ .LISR
772 ite eq @ Thumb2 thing, sanity check in ARM
773 addeq $const,$const,#0x10
774 bne .Ldec_loop
775 vldmia $const, {@XMM[12]} @ .LISRM0
776 b .Ldec_loop
777.align 4
778.Ldec_done:
779___
780 &bitslice (@XMM[0,1,6,4,2,7,3,5, 8..11]);
781$code.=<<___;
782 vldmia $key, {@XMM[8]} @ last round key
783 veor @XMM[6], @XMM[6], @XMM[8]
784 veor @XMM[4], @XMM[4], @XMM[8]
785 veor @XMM[2], @XMM[2], @XMM[8]
786 veor @XMM[7], @XMM[7], @XMM[8]
787 veor @XMM[3], @XMM[3], @XMM[8]
788 veor @XMM[5], @XMM[5], @XMM[8]
789 veor @XMM[0], @XMM[0], @XMM[8]
790 veor @XMM[1], @XMM[1], @XMM[8]
791 bx lr
792.size _bsaes_decrypt8,.-_bsaes_decrypt8
793
794.type _bsaes_const,%object
795.align 6
796_bsaes_const:
797.LM0ISR: @ InvShiftRows constants
798 .quad 0x0a0e0206070b0f03, 0x0004080c0d010509
799.LISR:
800 .quad 0x0504070602010003, 0x0f0e0d0c080b0a09
801.LISRM0:
802 .quad 0x01040b0e0205080f, 0x0306090c00070a0d
803.LM0SR: @ ShiftRows constants
804 .quad 0x0a0e02060f03070b, 0x0004080c05090d01
805.LSR:
806 .quad 0x0504070600030201, 0x0f0e0d0c0a09080b
807.LSRM0:
808 .quad 0x0304090e00050a0f, 0x01060b0c0207080d
809.LM0:
810 .quad 0x02060a0e03070b0f, 0x0004080c0105090d
811.LREVM0SR:
812 .quad 0x090d01050c000408, 0x03070b0f060a0e02
813.asciz "Bit-sliced AES for NEON, CRYPTOGAMS by <appro\@openssl.org>"
814.align 6
815.size _bsaes_const,.-_bsaes_const
816
817.type _bsaes_encrypt8,%function
818.align 4
819_bsaes_encrypt8:
820 adr $const,_bsaes_encrypt8
821 vldmia $key!, {@XMM[9]} @ round 0 key
822 sub $const,$const,#_bsaes_encrypt8-.LM0SR
823
824 vldmia $const!, {@XMM[8]} @ .LM0SR
825_bsaes_encrypt8_alt:
826 veor @XMM[10], @XMM[0], @XMM[9] @ xor with round0 key
827 veor @XMM[11], @XMM[1], @XMM[9]
828 vtbl.8 `&Dlo(@XMM[0])`, {@XMM[10]}, `&Dlo(@XMM[8])`
829 vtbl.8 `&Dhi(@XMM[0])`, {@XMM[10]}, `&Dhi(@XMM[8])`
830 veor @XMM[12], @XMM[2], @XMM[9]
831 vtbl.8 `&Dlo(@XMM[1])`, {@XMM[11]}, `&Dlo(@XMM[8])`
832 vtbl.8 `&Dhi(@XMM[1])`, {@XMM[11]}, `&Dhi(@XMM[8])`
833 veor @XMM[13], @XMM[3], @XMM[9]
834 vtbl.8 `&Dlo(@XMM[2])`, {@XMM[12]}, `&Dlo(@XMM[8])`
835 vtbl.8 `&Dhi(@XMM[2])`, {@XMM[12]}, `&Dhi(@XMM[8])`
836 veor @XMM[14], @XMM[4], @XMM[9]
837 vtbl.8 `&Dlo(@XMM[3])`, {@XMM[13]}, `&Dlo(@XMM[8])`
838 vtbl.8 `&Dhi(@XMM[3])`, {@XMM[13]}, `&Dhi(@XMM[8])`
839 veor @XMM[15], @XMM[5], @XMM[9]
840 vtbl.8 `&Dlo(@XMM[4])`, {@XMM[14]}, `&Dlo(@XMM[8])`
841 vtbl.8 `&Dhi(@XMM[4])`, {@XMM[14]}, `&Dhi(@XMM[8])`
842 veor @XMM[10], @XMM[6], @XMM[9]
843 vtbl.8 `&Dlo(@XMM[5])`, {@XMM[15]}, `&Dlo(@XMM[8])`
844 vtbl.8 `&Dhi(@XMM[5])`, {@XMM[15]}, `&Dhi(@XMM[8])`
845 veor @XMM[11], @XMM[7], @XMM[9]
846 vtbl.8 `&Dlo(@XMM[6])`, {@XMM[10]}, `&Dlo(@XMM[8])`
847 vtbl.8 `&Dhi(@XMM[6])`, {@XMM[10]}, `&Dhi(@XMM[8])`
848 vtbl.8 `&Dlo(@XMM[7])`, {@XMM[11]}, `&Dlo(@XMM[8])`
849 vtbl.8 `&Dhi(@XMM[7])`, {@XMM[11]}, `&Dhi(@XMM[8])`
850_bsaes_encrypt8_bitslice:
851___
852 &bitslice (@XMM[0..7, 8..11]);
853$code.=<<___;
854 sub $rounds,$rounds,#1
855 b .Lenc_sbox
856.align 4
857.Lenc_loop:
858___
859 &ShiftRows (@XMM[0..7, 8..12]);
860$code.=".Lenc_sbox:\n";
861 &Sbox (@XMM[0..7, 8..15]);
862$code.=<<___;
863 subs $rounds,$rounds,#1
864 bcc .Lenc_done
865___
866 &MixColumns (@XMM[0,1,4,6,3,7,2,5, 8..15]);
867$code.=<<___;
868 vldmia $const, {@XMM[12]} @ .LSR
869 ite eq @ Thumb2 thing, samity check in ARM
870 addeq $const,$const,#0x10
871 bne .Lenc_loop
872 vldmia $const, {@XMM[12]} @ .LSRM0
873 b .Lenc_loop
874.align 4
875.Lenc_done:
876___
877 # output in lsb > [t0, t1, t4, t6, t3, t7, t2, t5] < msb
878 &bitslice (@XMM[0,1,4,6,3,7,2,5, 8..11]);
879$code.=<<___;
880 vldmia $key, {@XMM[8]} @ last round key
881 veor @XMM[4], @XMM[4], @XMM[8]
882 veor @XMM[6], @XMM[6], @XMM[8]
883 veor @XMM[3], @XMM[3], @XMM[8]
884 veor @XMM[7], @XMM[7], @XMM[8]
885 veor @XMM[2], @XMM[2], @XMM[8]
886 veor @XMM[5], @XMM[5], @XMM[8]
887 veor @XMM[0], @XMM[0], @XMM[8]
888 veor @XMM[1], @XMM[1], @XMM[8]
889 bx lr
890.size _bsaes_encrypt8,.-_bsaes_encrypt8
891___
892}
893{
894my ($out,$inp,$rounds,$const)=("r12","r4","r5","r6");
895
896sub bitslice_key {
897my @x=reverse(@_[0..7]);
898my ($bs0,$bs1,$bs2,$t2,$t3)=@_[8..12];
899
900 &swapmove (@x[0,1],1,$bs0,$t2,$t3);
901$code.=<<___;
902 @ &swapmove(@x[2,3],1,$t0,$t2,$t3);
903 vmov @x[2], @x[0]
904 vmov @x[3], @x[1]
905___
906 #&swapmove2x(@x[4,5,6,7],1,$t0,$t2,$t3);
907
908 &swapmove2x (@x[0,2,1,3],2,$bs1,$t2,$t3);
909$code.=<<___;
910 @ &swapmove2x(@x[4,6,5,7],2,$t1,$t2,$t3);
911 vmov @x[4], @x[0]
912 vmov @x[6], @x[2]
913 vmov @x[5], @x[1]
914 vmov @x[7], @x[3]
915___
916 &swapmove2x (@x[0,4,1,5],4,$bs2,$t2,$t3);
917 &swapmove2x (@x[2,6,3,7],4,$bs2,$t2,$t3);
918}
919
920$code.=<<___;
921.type _bsaes_key_convert,%function
922.align 4
923_bsaes_key_convert:
924 adr $const,_bsaes_key_convert
925 vld1.8 {@XMM[7]}, [$inp]! @ load round 0 key
926 sub $const,$const,#_bsaes_key_convert-.LM0
927 vld1.8 {@XMM[15]}, [$inp]! @ load round 1 key
928
929 vmov.i8 @XMM[8], #0x01 @ bit masks
930 vmov.i8 @XMM[9], #0x02
931 vmov.i8 @XMM[10], #0x04
932 vmov.i8 @XMM[11], #0x08
933 vmov.i8 @XMM[12], #0x10
934 vmov.i8 @XMM[13], #0x20
935 vldmia $const, {@XMM[14]} @ .LM0
936
937#ifdef __ARMEL__
938 vrev32.8 @XMM[7], @XMM[7]
939 vrev32.8 @XMM[15], @XMM[15]
940#endif
941 sub $rounds,$rounds,#1
942 vstmia $out!, {@XMM[7]} @ save round 0 key
943 b .Lkey_loop
944
945.align 4
946.Lkey_loop:
947 vtbl.8 `&Dlo(@XMM[7])`,{@XMM[15]},`&Dlo(@XMM[14])`
948 vtbl.8 `&Dhi(@XMM[7])`,{@XMM[15]},`&Dhi(@XMM[14])`
949 vmov.i8 @XMM[6], #0x40
950 vmov.i8 @XMM[15], #0x80
951
952 vtst.8 @XMM[0], @XMM[7], @XMM[8]
953 vtst.8 @XMM[1], @XMM[7], @XMM[9]
954 vtst.8 @XMM[2], @XMM[7], @XMM[10]
955 vtst.8 @XMM[3], @XMM[7], @XMM[11]
956 vtst.8 @XMM[4], @XMM[7], @XMM[12]
957 vtst.8 @XMM[5], @XMM[7], @XMM[13]
958 vtst.8 @XMM[6], @XMM[7], @XMM[6]
959 vtst.8 @XMM[7], @XMM[7], @XMM[15]
960 vld1.8 {@XMM[15]}, [$inp]! @ load next round key
961 vmvn @XMM[0], @XMM[0] @ "pnot"
962 vmvn @XMM[1], @XMM[1]
963 vmvn @XMM[5], @XMM[5]
964 vmvn @XMM[6], @XMM[6]
965#ifdef __ARMEL__
966 vrev32.8 @XMM[15], @XMM[15]
967#endif
968 subs $rounds,$rounds,#1
969 vstmia $out!,{@XMM[0]-@XMM[7]} @ write bit-sliced round key
970 bne .Lkey_loop
971
972 vmov.i8 @XMM[7],#0x63 @ compose .L63
973 @ don't save last round key
974 bx lr
975.size _bsaes_key_convert,.-_bsaes_key_convert
976___
977}
978
979if (0) { # following four functions are unsupported interface
980 # used for benchmarking...
981$code.=<<___;
982.globl bsaes_enc_key_convert
983.type bsaes_enc_key_convert,%function
984.align 4
985bsaes_enc_key_convert:
986 stmdb sp!,{r4-r6,lr}
987 vstmdb sp!,{d8-d15} @ ABI specification says so
988
989 ldr r5,[$inp,#240] @ pass rounds
990 mov r4,$inp @ pass key
991 mov r12,$out @ pass key schedule
992 bl _bsaes_key_convert
993 veor @XMM[7],@XMM[7],@XMM[15] @ fix up last round key
994 vstmia r12, {@XMM[7]} @ save last round key
995
996 vldmia sp!,{d8-d15}
997 ldmia sp!,{r4-r6,pc}
998.size bsaes_enc_key_convert,.-bsaes_enc_key_convert
999
1000.globl bsaes_encrypt_128
1001.type bsaes_encrypt_128,%function
1002.align 4
1003bsaes_encrypt_128:
1004 stmdb sp!,{r4-r6,lr}
1005 vstmdb sp!,{d8-d15} @ ABI specification says so
1006.Lenc128_loop:
1007 vld1.8 {@XMM[0]-@XMM[1]}, [$inp]! @ load input
1008 vld1.8 {@XMM[2]-@XMM[3]}, [$inp]!
1009 mov r4,$key @ pass the key
1010 vld1.8 {@XMM[4]-@XMM[5]}, [$inp]!
1011 mov r5,#10 @ pass rounds
1012 vld1.8 {@XMM[6]-@XMM[7]}, [$inp]!
1013
1014 bl _bsaes_encrypt8
1015
1016 vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output
1017 vst1.8 {@XMM[4]}, [$out]!
1018 vst1.8 {@XMM[6]}, [$out]!
1019 vst1.8 {@XMM[3]}, [$out]!
1020 vst1.8 {@XMM[7]}, [$out]!
1021 vst1.8 {@XMM[2]}, [$out]!
1022 subs $len,$len,#0x80
1023 vst1.8 {@XMM[5]}, [$out]!
1024 bhi .Lenc128_loop
1025
1026 vldmia sp!,{d8-d15}
1027 ldmia sp!,{r4-r6,pc}
1028.size bsaes_encrypt_128,.-bsaes_encrypt_128
1029
1030.globl bsaes_dec_key_convert
1031.type bsaes_dec_key_convert,%function
1032.align 4
1033bsaes_dec_key_convert:
1034 stmdb sp!,{r4-r6,lr}
1035 vstmdb sp!,{d8-d15} @ ABI specification says so
1036
1037 ldr r5,[$inp,#240] @ pass rounds
1038 mov r4,$inp @ pass key
1039 mov r12,$out @ pass key schedule
1040 bl _bsaes_key_convert
1041 vldmia $out, {@XMM[6]}
1042 vstmia r12, {@XMM[15]} @ save last round key
1043 veor @XMM[7], @XMM[7], @XMM[6] @ fix up round 0 key
1044 vstmia $out, {@XMM[7]}
1045
1046 vldmia sp!,{d8-d15}
1047 ldmia sp!,{r4-r6,pc}
1048.size bsaes_dec_key_convert,.-bsaes_dec_key_convert
1049
1050.globl bsaes_decrypt_128
1051.type bsaes_decrypt_128,%function
1052.align 4
1053bsaes_decrypt_128:
1054 stmdb sp!,{r4-r6,lr}
1055 vstmdb sp!,{d8-d15} @ ABI specification says so
1056.Ldec128_loop:
1057 vld1.8 {@XMM[0]-@XMM[1]}, [$inp]! @ load input
1058 vld1.8 {@XMM[2]-@XMM[3]}, [$inp]!
1059 mov r4,$key @ pass the key
1060 vld1.8 {@XMM[4]-@XMM[5]}, [$inp]!
1061 mov r5,#10 @ pass rounds
1062 vld1.8 {@XMM[6]-@XMM[7]}, [$inp]!
1063
1064 bl _bsaes_decrypt8
1065
1066 vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output
1067 vst1.8 {@XMM[6]}, [$out]!
1068 vst1.8 {@XMM[4]}, [$out]!
1069 vst1.8 {@XMM[2]}, [$out]!
1070 vst1.8 {@XMM[7]}, [$out]!
1071 vst1.8 {@XMM[3]}, [$out]!
1072 subs $len,$len,#0x80
1073 vst1.8 {@XMM[5]}, [$out]!
1074 bhi .Ldec128_loop
1075
1076 vldmia sp!,{d8-d15}
1077 ldmia sp!,{r4-r6,pc}
1078.size bsaes_decrypt_128,.-bsaes_decrypt_128
1079___
1080}
1081{
1082my ($inp,$out,$len,$key, $ivp,$fp,$rounds)=map("r$_",(0..3,8..10));
1083my ($keysched)=("sp");
1084
1085$code.=<<___;
1086.extern AES_cbc_encrypt
1087.extern AES_decrypt
1088
1089.global bsaes_cbc_encrypt
1090.type bsaes_cbc_encrypt,%function
1091.align 5
1092bsaes_cbc_encrypt:
1093#ifndef __KERNEL__
1094 cmp $len, #128
1095#ifndef __thumb__
1096 blo AES_cbc_encrypt
1097#else
1098 bhs 1f
1099 b AES_cbc_encrypt
11001:
1101#endif
1102#endif
1103
1104 @ it is up to the caller to make sure we are called with enc == 0
1105
1106 mov ip, sp
1107 stmdb sp!, {r4-r10, lr}
1108 VFP_ABI_PUSH
1109 ldr $ivp, [ip] @ IV is 1st arg on the stack
1110 mov $len, $len, lsr#4 @ len in 16 byte blocks
1111 sub sp, #0x10 @ scratch space to carry over the IV
1112 mov $fp, sp @ save sp
1113
1114 ldr $rounds, [$key, #240] @ get # of rounds
1115#ifndef BSAES_ASM_EXTENDED_KEY
1116 @ allocate the key schedule on the stack
1117 sub r12, sp, $rounds, lsl#7 @ 128 bytes per inner round key
1118 add r12, #`128-32` @ sifze of bit-slices key schedule
1119
1120 @ populate the key schedule
1121 mov r4, $key @ pass key
1122 mov r5, $rounds @ pass # of rounds
1123 mov sp, r12 @ sp is $keysched
1124 bl _bsaes_key_convert
1125 vldmia $keysched, {@XMM[6]}
1126 vstmia r12, {@XMM[15]} @ save last round key
1127 veor @XMM[7], @XMM[7], @XMM[6] @ fix up round 0 key
1128 vstmia $keysched, {@XMM[7]}
1129#else
1130 ldr r12, [$key, #244]
1131 eors r12, #1
1132 beq 0f
1133
1134 @ populate the key schedule
1135 str r12, [$key, #244]
1136 mov r4, $key @ pass key
1137 mov r5, $rounds @ pass # of rounds
1138 add r12, $key, #248 @ pass key schedule
1139 bl _bsaes_key_convert
1140 add r4, $key, #248
1141 vldmia r4, {@XMM[6]}
1142 vstmia r12, {@XMM[15]} @ save last round key
1143 veor @XMM[7], @XMM[7], @XMM[6] @ fix up round 0 key
1144 vstmia r4, {@XMM[7]}
1145
1146.align 2
11470:
1148#endif
1149
1150 vld1.8 {@XMM[15]}, [$ivp] @ load IV
1151 b .Lcbc_dec_loop
1152
1153.align 4
1154.Lcbc_dec_loop:
1155 subs $len, $len, #0x8
1156 bmi .Lcbc_dec_loop_finish
1157
1158 vld1.8 {@XMM[0]-@XMM[1]}, [$inp]! @ load input
1159 vld1.8 {@XMM[2]-@XMM[3]}, [$inp]!
1160#ifndef BSAES_ASM_EXTENDED_KEY
1161 mov r4, $keysched @ pass the key
1162#else
1163 add r4, $key, #248
1164#endif
1165 vld1.8 {@XMM[4]-@XMM[5]}, [$inp]!
1166 mov r5, $rounds
1167 vld1.8 {@XMM[6]-@XMM[7]}, [$inp]
1168 sub $inp, $inp, #0x60
1169 vstmia $fp, {@XMM[15]} @ put aside IV
1170
1171 bl _bsaes_decrypt8
1172
1173 vldmia $fp, {@XMM[14]} @ reload IV
1174 vld1.8 {@XMM[8]-@XMM[9]}, [$inp]! @ reload input
1175 veor @XMM[0], @XMM[0], @XMM[14] @ ^= IV
1176 vld1.8 {@XMM[10]-@XMM[11]}, [$inp]!
1177 veor @XMM[1], @XMM[1], @XMM[8]
1178 veor @XMM[6], @XMM[6], @XMM[9]
1179 vld1.8 {@XMM[12]-@XMM[13]}, [$inp]!
1180 veor @XMM[4], @XMM[4], @XMM[10]
1181 veor @XMM[2], @XMM[2], @XMM[11]
1182 vld1.8 {@XMM[14]-@XMM[15]}, [$inp]!
1183 veor @XMM[7], @XMM[7], @XMM[12]
1184 vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output
1185 veor @XMM[3], @XMM[3], @XMM[13]
1186 vst1.8 {@XMM[6]}, [$out]!
1187 veor @XMM[5], @XMM[5], @XMM[14]
1188 vst1.8 {@XMM[4]}, [$out]!
1189 vst1.8 {@XMM[2]}, [$out]!
1190 vst1.8 {@XMM[7]}, [$out]!
1191 vst1.8 {@XMM[3]}, [$out]!
1192 vst1.8 {@XMM[5]}, [$out]!
1193
1194 b .Lcbc_dec_loop
1195
1196.Lcbc_dec_loop_finish:
1197 adds $len, $len, #8
1198 beq .Lcbc_dec_done
1199
1200 vld1.8 {@XMM[0]}, [$inp]! @ load input
1201 cmp $len, #2
1202 blo .Lcbc_dec_one
1203 vld1.8 {@XMM[1]}, [$inp]!
1204#ifndef BSAES_ASM_EXTENDED_KEY
1205 mov r4, $keysched @ pass the key
1206#else
1207 add r4, $key, #248
1208#endif
1209 mov r5, $rounds
1210 vstmia $fp, {@XMM[15]} @ put aside IV
1211 beq .Lcbc_dec_two
1212 vld1.8 {@XMM[2]}, [$inp]!
1213 cmp $len, #4
1214 blo .Lcbc_dec_three
1215 vld1.8 {@XMM[3]}, [$inp]!
1216 beq .Lcbc_dec_four
1217 vld1.8 {@XMM[4]}, [$inp]!
1218 cmp $len, #6
1219 blo .Lcbc_dec_five
1220 vld1.8 {@XMM[5]}, [$inp]!
1221 beq .Lcbc_dec_six
1222 vld1.8 {@XMM[6]}, [$inp]!
1223 sub $inp, $inp, #0x70
1224
1225 bl _bsaes_decrypt8
1226
1227 vldmia $fp, {@XMM[14]} @ reload IV
1228 vld1.8 {@XMM[8]-@XMM[9]}, [$inp]! @ reload input
1229 veor @XMM[0], @XMM[0], @XMM[14] @ ^= IV
1230 vld1.8 {@XMM[10]-@XMM[11]}, [$inp]!
1231 veor @XMM[1], @XMM[1], @XMM[8]
1232 veor @XMM[6], @XMM[6], @XMM[9]
1233 vld1.8 {@XMM[12]-@XMM[13]}, [$inp]!
1234 veor @XMM[4], @XMM[4], @XMM[10]
1235 veor @XMM[2], @XMM[2], @XMM[11]
1236 vld1.8 {@XMM[15]}, [$inp]!
1237 veor @XMM[7], @XMM[7], @XMM[12]
1238 vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output
1239 veor @XMM[3], @XMM[3], @XMM[13]
1240 vst1.8 {@XMM[6]}, [$out]!
1241 vst1.8 {@XMM[4]}, [$out]!
1242 vst1.8 {@XMM[2]}, [$out]!
1243 vst1.8 {@XMM[7]}, [$out]!
1244 vst1.8 {@XMM[3]}, [$out]!
1245 b .Lcbc_dec_done
1246.align 4
1247.Lcbc_dec_six:
1248 sub $inp, $inp, #0x60
1249 bl _bsaes_decrypt8
1250 vldmia $fp,{@XMM[14]} @ reload IV
1251 vld1.8 {@XMM[8]-@XMM[9]}, [$inp]! @ reload input
1252 veor @XMM[0], @XMM[0], @XMM[14] @ ^= IV
1253 vld1.8 {@XMM[10]-@XMM[11]}, [$inp]!
1254 veor @XMM[1], @XMM[1], @XMM[8]
1255 veor @XMM[6], @XMM[6], @XMM[9]
1256 vld1.8 {@XMM[12]}, [$inp]!
1257 veor @XMM[4], @XMM[4], @XMM[10]
1258 veor @XMM[2], @XMM[2], @XMM[11]
1259 vld1.8 {@XMM[15]}, [$inp]!
1260 veor @XMM[7], @XMM[7], @XMM[12]
1261 vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output
1262 vst1.8 {@XMM[6]}, [$out]!
1263 vst1.8 {@XMM[4]}, [$out]!
1264 vst1.8 {@XMM[2]}, [$out]!
1265 vst1.8 {@XMM[7]}, [$out]!
1266 b .Lcbc_dec_done
1267.align 4
1268.Lcbc_dec_five:
1269 sub $inp, $inp, #0x50
1270 bl _bsaes_decrypt8
1271 vldmia $fp, {@XMM[14]} @ reload IV
1272 vld1.8 {@XMM[8]-@XMM[9]}, [$inp]! @ reload input
1273 veor @XMM[0], @XMM[0], @XMM[14] @ ^= IV
1274 vld1.8 {@XMM[10]-@XMM[11]}, [$inp]!
1275 veor @XMM[1], @XMM[1], @XMM[8]
1276 veor @XMM[6], @XMM[6], @XMM[9]
1277 vld1.8 {@XMM[15]}, [$inp]!
1278 veor @XMM[4], @XMM[4], @XMM[10]
1279 vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output
1280 veor @XMM[2], @XMM[2], @XMM[11]
1281 vst1.8 {@XMM[6]}, [$out]!
1282 vst1.8 {@XMM[4]}, [$out]!
1283 vst1.8 {@XMM[2]}, [$out]!
1284 b .Lcbc_dec_done
1285.align 4
1286.Lcbc_dec_four:
1287 sub $inp, $inp, #0x40
1288 bl _bsaes_decrypt8
1289 vldmia $fp, {@XMM[14]} @ reload IV
1290 vld1.8 {@XMM[8]-@XMM[9]}, [$inp]! @ reload input
1291 veor @XMM[0], @XMM[0], @XMM[14] @ ^= IV
1292 vld1.8 {@XMM[10]}, [$inp]!
1293 veor @XMM[1], @XMM[1], @XMM[8]
1294 veor @XMM[6], @XMM[6], @XMM[9]
1295 vld1.8 {@XMM[15]}, [$inp]!
1296 veor @XMM[4], @XMM[4], @XMM[10]
1297 vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output
1298 vst1.8 {@XMM[6]}, [$out]!
1299 vst1.8 {@XMM[4]}, [$out]!
1300 b .Lcbc_dec_done
1301.align 4
1302.Lcbc_dec_three:
1303 sub $inp, $inp, #0x30
1304 bl _bsaes_decrypt8
1305 vldmia $fp, {@XMM[14]} @ reload IV
1306 vld1.8 {@XMM[8]-@XMM[9]}, [$inp]! @ reload input
1307 veor @XMM[0], @XMM[0], @XMM[14] @ ^= IV
1308 vld1.8 {@XMM[15]}, [$inp]!
1309 veor @XMM[1], @XMM[1], @XMM[8]
1310 veor @XMM[6], @XMM[6], @XMM[9]
1311 vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output
1312 vst1.8 {@XMM[6]}, [$out]!
1313 b .Lcbc_dec_done
1314.align 4
1315.Lcbc_dec_two:
1316 sub $inp, $inp, #0x20
1317 bl _bsaes_decrypt8
1318 vldmia $fp, {@XMM[14]} @ reload IV
1319 vld1.8 {@XMM[8]}, [$inp]! @ reload input
1320 veor @XMM[0], @XMM[0], @XMM[14] @ ^= IV
1321 vld1.8 {@XMM[15]}, [$inp]! @ reload input
1322 veor @XMM[1], @XMM[1], @XMM[8]
1323 vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output
1324 b .Lcbc_dec_done
1325.align 4
1326.Lcbc_dec_one:
1327 sub $inp, $inp, #0x10
1328 mov $rounds, $out @ save original out pointer
1329 mov $out, $fp @ use the iv scratch space as out buffer
1330 mov r2, $key
1331 vmov @XMM[4],@XMM[15] @ just in case ensure that IV
1332 vmov @XMM[5],@XMM[0] @ and input are preserved
1333 bl AES_decrypt
1334 vld1.8 {@XMM[0]}, [$fp,:64] @ load result
1335 veor @XMM[0], @XMM[0], @XMM[4] @ ^= IV
1336 vmov @XMM[15], @XMM[5] @ @XMM[5] holds input
1337 vst1.8 {@XMM[0]}, [$rounds] @ write output
1338
1339.Lcbc_dec_done:
1340#ifndef BSAES_ASM_EXTENDED_KEY
1341 vmov.i32 q0, #0
1342 vmov.i32 q1, #0
1343.Lcbc_dec_bzero: @ wipe key schedule [if any]
1344 vstmia $keysched!, {q0-q1}
1345 cmp $keysched, $fp
1346 bne .Lcbc_dec_bzero
1347#endif
1348
1349 mov sp, $fp
1350 add sp, #0x10 @ add sp,$fp,#0x10 is no good for thumb
1351 vst1.8 {@XMM[15]}, [$ivp] @ return IV
1352 VFP_ABI_POP
1353 ldmia sp!, {r4-r10, pc}
1354.size bsaes_cbc_encrypt,.-bsaes_cbc_encrypt
1355___
1356}
1357{
1358my ($inp,$out,$len,$key, $ctr,$fp,$rounds)=(map("r$_",(0..3,8..10)));
1359my $const = "r6"; # shared with _bsaes_encrypt8_alt
1360my $keysched = "sp";
1361
1362$code.=<<___;
1363.extern AES_encrypt
1364.global bsaes_ctr32_encrypt_blocks
1365.type bsaes_ctr32_encrypt_blocks,%function
1366.align 5
1367bsaes_ctr32_encrypt_blocks:
1368 cmp $len, #8 @ use plain AES for
1369 blo .Lctr_enc_short @ small sizes
1370
1371 mov ip, sp
1372 stmdb sp!, {r4-r10, lr}
1373 VFP_ABI_PUSH
1374 ldr $ctr, [ip] @ ctr is 1st arg on the stack
1375 sub sp, sp, #0x10 @ scratch space to carry over the ctr
1376 mov $fp, sp @ save sp
1377
1378 ldr $rounds, [$key, #240] @ get # of rounds
1379#ifndef BSAES_ASM_EXTENDED_KEY
1380 @ allocate the key schedule on the stack
1381 sub r12, sp, $rounds, lsl#7 @ 128 bytes per inner round key
1382 add r12, #`128-32` @ size of bit-sliced key schedule
1383
1384 @ populate the key schedule
1385 mov r4, $key @ pass key
1386 mov r5, $rounds @ pass # of rounds
1387 mov sp, r12 @ sp is $keysched
1388 bl _bsaes_key_convert
1389 veor @XMM[7],@XMM[7],@XMM[15] @ fix up last round key
1390 vstmia r12, {@XMM[7]} @ save last round key
1391
1392 vld1.8 {@XMM[0]}, [$ctr] @ load counter
1393 add $ctr, $const, #.LREVM0SR-.LM0 @ borrow $ctr
1394 vldmia $keysched, {@XMM[4]} @ load round0 key
1395#else
1396 ldr r12, [$key, #244]
1397 eors r12, #1
1398 beq 0f
1399
1400 @ populate the key schedule
1401 str r12, [$key, #244]
1402 mov r4, $key @ pass key
1403 mov r5, $rounds @ pass # of rounds
1404 add r12, $key, #248 @ pass key schedule
1405 bl _bsaes_key_convert
1406 veor @XMM[7],@XMM[7],@XMM[15] @ fix up last round key
1407 vstmia r12, {@XMM[7]} @ save last round key
1408
1409.align 2
14100: add r12, $key, #248
1411 vld1.8 {@XMM[0]}, [$ctr] @ load counter
1412 adrl $ctr, .LREVM0SR @ borrow $ctr
1413 vldmia r12, {@XMM[4]} @ load round0 key
1414 sub sp, #0x10 @ place for adjusted round0 key
1415#endif
1416
1417 vmov.i32 @XMM[8],#1 @ compose 1<<96
1418 veor @XMM[9],@XMM[9],@XMM[9]
1419 vrev32.8 @XMM[0],@XMM[0]
1420 vext.8 @XMM[8],@XMM[9],@XMM[8],#4
1421 vrev32.8 @XMM[4],@XMM[4]
1422 vadd.u32 @XMM[9],@XMM[8],@XMM[8] @ compose 2<<96
1423 vstmia $keysched, {@XMM[4]} @ save adjusted round0 key
1424 b .Lctr_enc_loop
1425
1426.align 4
1427.Lctr_enc_loop:
1428 vadd.u32 @XMM[10], @XMM[8], @XMM[9] @ compose 3<<96
1429 vadd.u32 @XMM[1], @XMM[0], @XMM[8] @ +1
1430 vadd.u32 @XMM[2], @XMM[0], @XMM[9] @ +2
1431 vadd.u32 @XMM[3], @XMM[0], @XMM[10] @ +3
1432 vadd.u32 @XMM[4], @XMM[1], @XMM[10]
1433 vadd.u32 @XMM[5], @XMM[2], @XMM[10]
1434 vadd.u32 @XMM[6], @XMM[3], @XMM[10]
1435 vadd.u32 @XMM[7], @XMM[4], @XMM[10]
1436 vadd.u32 @XMM[10], @XMM[5], @XMM[10] @ next counter
1437
1438 @ Borrow prologue from _bsaes_encrypt8 to use the opportunity
1439 @ to flip byte order in 32-bit counter
1440
1441 vldmia $keysched, {@XMM[9]} @ load round0 key
1442#ifndef BSAES_ASM_EXTENDED_KEY
1443 add r4, $keysched, #0x10 @ pass next round key
1444#else
1445 add r4, $key, #`248+16`
1446#endif
1447 vldmia $ctr, {@XMM[8]} @ .LREVM0SR
1448 mov r5, $rounds @ pass rounds
1449 vstmia $fp, {@XMM[10]} @ save next counter
1450 sub $const, $ctr, #.LREVM0SR-.LSR @ pass constants
1451
1452 bl _bsaes_encrypt8_alt
1453
1454 subs $len, $len, #8
1455 blo .Lctr_enc_loop_done
1456
1457 vld1.8 {@XMM[8]-@XMM[9]}, [$inp]! @ load input
1458 vld1.8 {@XMM[10]-@XMM[11]}, [$inp]!
1459 veor @XMM[0], @XMM[8]
1460 veor @XMM[1], @XMM[9]
1461 vld1.8 {@XMM[12]-@XMM[13]}, [$inp]!
1462 veor @XMM[4], @XMM[10]
1463 veor @XMM[6], @XMM[11]
1464 vld1.8 {@XMM[14]-@XMM[15]}, [$inp]!
1465 veor @XMM[3], @XMM[12]
1466 vst1.8 {@XMM[0]-@XMM[1]}, [$out]! @ write output
1467 veor @XMM[7], @XMM[13]
1468 veor @XMM[2], @XMM[14]
1469 vst1.8 {@XMM[4]}, [$out]!
1470 veor @XMM[5], @XMM[15]
1471 vst1.8 {@XMM[6]}, [$out]!
1472 vmov.i32 @XMM[8], #1 @ compose 1<<96
1473 vst1.8 {@XMM[3]}, [$out]!
1474 veor @XMM[9], @XMM[9], @XMM[9]
1475 vst1.8 {@XMM[7]}, [$out]!
1476 vext.8 @XMM[8], @XMM[9], @XMM[8], #4
1477 vst1.8 {@XMM[2]}, [$out]!
1478 vadd.u32 @XMM[9],@XMM[8],@XMM[8] @ compose 2<<96
1479 vst1.8 {@XMM[5]}, [$out]!
1480 vldmia $fp, {@XMM[0]} @ load counter
1481
1482 bne .Lctr_enc_loop
1483 b .Lctr_enc_done
1484
1485.align 4
1486.Lctr_enc_loop_done:
1487 add $len, $len, #8
1488 vld1.8 {@XMM[8]}, [$inp]! @ load input
1489 veor @XMM[0], @XMM[8]
1490 vst1.8 {@XMM[0]}, [$out]! @ write output
1491 cmp $len, #2
1492 blo .Lctr_enc_done
1493 vld1.8 {@XMM[9]}, [$inp]!
1494 veor @XMM[1], @XMM[9]
1495 vst1.8 {@XMM[1]}, [$out]!
1496 beq .Lctr_enc_done
1497 vld1.8 {@XMM[10]}, [$inp]!
1498 veor @XMM[4], @XMM[10]
1499 vst1.8 {@XMM[4]}, [$out]!
1500 cmp $len, #4
1501 blo .Lctr_enc_done
1502 vld1.8 {@XMM[11]}, [$inp]!
1503 veor @XMM[6], @XMM[11]
1504 vst1.8 {@XMM[6]}, [$out]!
1505 beq .Lctr_enc_done
1506 vld1.8 {@XMM[12]}, [$inp]!
1507 veor @XMM[3], @XMM[12]
1508 vst1.8 {@XMM[3]}, [$out]!
1509 cmp $len, #6
1510 blo .Lctr_enc_done
1511 vld1.8 {@XMM[13]}, [$inp]!
1512 veor @XMM[7], @XMM[13]
1513 vst1.8 {@XMM[7]}, [$out]!
1514 beq .Lctr_enc_done
1515 vld1.8 {@XMM[14]}, [$inp]
1516 veor @XMM[2], @XMM[14]
1517 vst1.8 {@XMM[2]}, [$out]!
1518
1519.Lctr_enc_done:
1520 vmov.i32 q0, #0
1521 vmov.i32 q1, #0
1522#ifndef BSAES_ASM_EXTENDED_KEY
1523.Lctr_enc_bzero: @ wipe key schedule [if any]
1524 vstmia $keysched!, {q0-q1}
1525 cmp $keysched, $fp
1526 bne .Lctr_enc_bzero
1527#else
1528 vstmia $keysched, {q0-q1}
1529#endif
1530
1531 mov sp, $fp
1532 add sp, #0x10 @ add sp,$fp,#0x10 is no good for thumb
1533 VFP_ABI_POP
1534 ldmia sp!, {r4-r10, pc} @ return
1535
1536.align 4
1537.Lctr_enc_short:
1538 ldr ip, [sp] @ ctr pointer is passed on stack
1539 stmdb sp!, {r4-r8, lr}
1540
1541 mov r4, $inp @ copy arguments
1542 mov r5, $out
1543 mov r6, $len
1544 mov r7, $key
1545 ldr r8, [ip, #12] @ load counter LSW
1546 vld1.8 {@XMM[1]}, [ip] @ load whole counter value
1547#ifdef __ARMEL__
1548 rev r8, r8
1549#endif
1550 sub sp, sp, #0x10
1551 vst1.8 {@XMM[1]}, [sp,:64] @ copy counter value
1552 sub sp, sp, #0x10
1553
1554.Lctr_enc_short_loop:
1555 add r0, sp, #0x10 @ input counter value
1556 mov r1, sp @ output on the stack
1557 mov r2, r7 @ key
1558
1559 bl AES_encrypt
1560
1561 vld1.8 {@XMM[0]}, [r4]! @ load input
1562 vld1.8 {@XMM[1]}, [sp,:64] @ load encrypted counter
1563 add r8, r8, #1
1564#ifdef __ARMEL__
1565 rev r0, r8
1566 str r0, [sp, #0x1c] @ next counter value
1567#else
1568 str r8, [sp, #0x1c] @ next counter value
1569#endif
1570 veor @XMM[0],@XMM[0],@XMM[1]
1571 vst1.8 {@XMM[0]}, [r5]! @ store output
1572 subs r6, r6, #1
1573 bne .Lctr_enc_short_loop
1574
1575 vmov.i32 q0, #0
1576 vmov.i32 q1, #0
1577 vstmia sp!, {q0-q1}
1578
1579 ldmia sp!, {r4-r8, pc}
1580.size bsaes_ctr32_encrypt_blocks,.-bsaes_ctr32_encrypt_blocks
1581___
1582}
1583{
1584######################################################################
1585# void bsaes_xts_[en|de]crypt(const char *inp,char *out,size_t len,
1586# const AES_KEY *key1, const AES_KEY *key2,
1587# const unsigned char iv[16]);
1588#
1589my ($inp,$out,$len,$key,$rounds,$magic,$fp)=(map("r$_",(7..10,1..3)));
1590my $const="r6"; # returned by _bsaes_key_convert
1591my $twmask=@XMM[5];
1592my @T=@XMM[6..7];
1593
1594$code.=<<___;
1595.globl bsaes_xts_encrypt
1596.type bsaes_xts_encrypt,%function
1597.align 4
1598bsaes_xts_encrypt:
1599 mov ip, sp
1600 stmdb sp!, {r4-r10, lr} @ 0x20
1601 VFP_ABI_PUSH
1602 mov r6, sp @ future $fp
1603
1604 mov $inp, r0
1605 mov $out, r1
1606 mov $len, r2
1607 mov $key, r3
1608
1609 sub r0, sp, #0x10 @ 0x10
1610 bic r0, #0xf @ align at 16 bytes
1611 mov sp, r0
1612
1613#ifdef XTS_CHAIN_TWEAK
1614 ldr r0, [ip] @ pointer to input tweak
1615#else
1616 @ generate initial tweak
1617 ldr r0, [ip, #4] @ iv[]
1618 mov r1, sp
1619 ldr r2, [ip, #0] @ key2
1620 bl AES_encrypt
1621 mov r0,sp @ pointer to initial tweak
1622#endif
1623
1624 ldr $rounds, [$key, #240] @ get # of rounds
1625 mov $fp, r6
1626#ifndef BSAES_ASM_EXTENDED_KEY
1627 @ allocate the key schedule on the stack
1628 sub r12, sp, $rounds, lsl#7 @ 128 bytes per inner round key
1629 @ add r12, #`128-32` @ size of bit-sliced key schedule
1630 sub r12, #`32+16` @ place for tweak[9]
1631
1632 @ populate the key schedule
1633 mov r4, $key @ pass key
1634 mov r5, $rounds @ pass # of rounds
1635 mov sp, r12
1636 add r12, #0x90 @ pass key schedule
1637 bl _bsaes_key_convert
1638 veor @XMM[7], @XMM[7], @XMM[15] @ fix up last round key
1639 vstmia r12, {@XMM[7]} @ save last round key
1640#else
1641 ldr r12, [$key, #244]
1642 eors r12, #1
1643 beq 0f
1644
1645 str r12, [$key, #244]
1646 mov r4, $key @ pass key
1647 mov r5, $rounds @ pass # of rounds
1648 add r12, $key, #248 @ pass key schedule
1649 bl _bsaes_key_convert
1650 veor @XMM[7], @XMM[7], @XMM[15] @ fix up last round key
1651 vstmia r12, {@XMM[7]}
1652
1653.align 2
16540: sub sp, #0x90 @ place for tweak[9]
1655#endif
1656
1657 vld1.8 {@XMM[8]}, [r0] @ initial tweak
1658 adr $magic, .Lxts_magic
1659
1660 subs $len, #0x80
1661 blo .Lxts_enc_short
1662 b .Lxts_enc_loop
1663
1664.align 4
1665.Lxts_enc_loop:
1666 vldmia $magic, {$twmask} @ load XTS magic
1667 vshr.s64 @T[0], @XMM[8], #63
1668 mov r0, sp
1669 vand @T[0], @T[0], $twmask
1670___
1671for($i=9;$i<16;$i++) {
1672$code.=<<___;
1673 vadd.u64 @XMM[$i], @XMM[$i-1], @XMM[$i-1]
1674 vst1.64 {@XMM[$i-1]}, [r0,:128]!
1675 vswp `&Dhi("@T[0]")`,`&Dlo("@T[0]")`
1676 vshr.s64 @T[1], @XMM[$i], #63
1677 veor @XMM[$i], @XMM[$i], @T[0]
1678 vand @T[1], @T[1], $twmask
1679___
1680 @T=reverse(@T);
1681
1682$code.=<<___ if ($i>=10);
1683 vld1.8 {@XMM[$i-10]}, [$inp]!
1684___
1685$code.=<<___ if ($i>=11);
1686 veor @XMM[$i-11], @XMM[$i-11], @XMM[$i-3]
1687___
1688}
1689$code.=<<___;
1690 vadd.u64 @XMM[8], @XMM[15], @XMM[15]
1691 vst1.64 {@XMM[15]}, [r0,:128]!
1692 vswp `&Dhi("@T[0]")`,`&Dlo("@T[0]")`
1693 veor @XMM[8], @XMM[8], @T[0]
1694 vst1.64 {@XMM[8]}, [r0,:128] @ next round tweak
1695
1696 vld1.8 {@XMM[6]-@XMM[7]}, [$inp]!
1697 veor @XMM[5], @XMM[5], @XMM[13]
1698#ifndef BSAES_ASM_EXTENDED_KEY
1699 add r4, sp, #0x90 @ pass key schedule
1700#else
1701 add r4, $key, #248 @ pass key schedule
1702#endif
1703 veor @XMM[6], @XMM[6], @XMM[14]
1704 mov r5, $rounds @ pass rounds
1705 veor @XMM[7], @XMM[7], @XMM[15]
1706 mov r0, sp
1707
1708 bl _bsaes_encrypt8
1709
1710 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]!
1711 vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]!
1712 veor @XMM[0], @XMM[0], @XMM[ 8]
1713 vld1.64 {@XMM[12]-@XMM[13]}, [r0,:128]!
1714 veor @XMM[1], @XMM[1], @XMM[ 9]
1715 veor @XMM[8], @XMM[4], @XMM[10]
1716 vst1.8 {@XMM[0]-@XMM[1]}, [$out]!
1717 veor @XMM[9], @XMM[6], @XMM[11]
1718 vld1.64 {@XMM[14]-@XMM[15]}, [r0,:128]!
1719 veor @XMM[10], @XMM[3], @XMM[12]
1720 vst1.8 {@XMM[8]-@XMM[9]}, [$out]!
1721 veor @XMM[11], @XMM[7], @XMM[13]
1722 veor @XMM[12], @XMM[2], @XMM[14]
1723 vst1.8 {@XMM[10]-@XMM[11]}, [$out]!
1724 veor @XMM[13], @XMM[5], @XMM[15]
1725 vst1.8 {@XMM[12]-@XMM[13]}, [$out]!
1726
1727 vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak
1728
1729 subs $len, #0x80
1730 bpl .Lxts_enc_loop
1731
1732.Lxts_enc_short:
1733 adds $len, #0x70
1734 bmi .Lxts_enc_done
1735
1736 vldmia $magic, {$twmask} @ load XTS magic
1737 vshr.s64 @T[0], @XMM[8], #63
1738 mov r0, sp
1739 vand @T[0], @T[0], $twmask
1740___
1741for($i=9;$i<16;$i++) {
1742$code.=<<___;
1743 vadd.u64 @XMM[$i], @XMM[$i-1], @XMM[$i-1]
1744 vst1.64 {@XMM[$i-1]}, [r0,:128]!
1745 vswp `&Dhi("@T[0]")`,`&Dlo("@T[0]")`
1746 vshr.s64 @T[1], @XMM[$i], #63
1747 veor @XMM[$i], @XMM[$i], @T[0]
1748 vand @T[1], @T[1], $twmask
1749___
1750 @T=reverse(@T);
1751
1752$code.=<<___ if ($i>=10);
1753 vld1.8 {@XMM[$i-10]}, [$inp]!
1754 subs $len, #0x10
1755 bmi .Lxts_enc_`$i-9`
1756___
1757$code.=<<___ if ($i>=11);
1758 veor @XMM[$i-11], @XMM[$i-11], @XMM[$i-3]
1759___
1760}
1761$code.=<<___;
1762 sub $len, #0x10
1763 vst1.64 {@XMM[15]}, [r0,:128] @ next round tweak
1764
1765 vld1.8 {@XMM[6]}, [$inp]!
1766 veor @XMM[5], @XMM[5], @XMM[13]
1767#ifndef BSAES_ASM_EXTENDED_KEY
1768 add r4, sp, #0x90 @ pass key schedule
1769#else
1770 add r4, $key, #248 @ pass key schedule
1771#endif
1772 veor @XMM[6], @XMM[6], @XMM[14]
1773 mov r5, $rounds @ pass rounds
1774 mov r0, sp
1775
1776 bl _bsaes_encrypt8
1777
1778 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]!
1779 vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]!
1780 veor @XMM[0], @XMM[0], @XMM[ 8]
1781 vld1.64 {@XMM[12]-@XMM[13]}, [r0,:128]!
1782 veor @XMM[1], @XMM[1], @XMM[ 9]
1783 veor @XMM[8], @XMM[4], @XMM[10]
1784 vst1.8 {@XMM[0]-@XMM[1]}, [$out]!
1785 veor @XMM[9], @XMM[6], @XMM[11]
1786 vld1.64 {@XMM[14]}, [r0,:128]!
1787 veor @XMM[10], @XMM[3], @XMM[12]
1788 vst1.8 {@XMM[8]-@XMM[9]}, [$out]!
1789 veor @XMM[11], @XMM[7], @XMM[13]
1790 veor @XMM[12], @XMM[2], @XMM[14]
1791 vst1.8 {@XMM[10]-@XMM[11]}, [$out]!
1792 vst1.8 {@XMM[12]}, [$out]!
1793
1794 vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak
1795 b .Lxts_enc_done
1796.align 4
1797.Lxts_enc_6:
1798 vst1.64 {@XMM[14]}, [r0,:128] @ next round tweak
1799
1800 veor @XMM[4], @XMM[4], @XMM[12]
1801#ifndef BSAES_ASM_EXTENDED_KEY
1802 add r4, sp, #0x90 @ pass key schedule
1803#else
1804 add r4, $key, #248 @ pass key schedule
1805#endif
1806 veor @XMM[5], @XMM[5], @XMM[13]
1807 mov r5, $rounds @ pass rounds
1808 mov r0, sp
1809
1810 bl _bsaes_encrypt8
1811
1812 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]!
1813 vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]!
1814 veor @XMM[0], @XMM[0], @XMM[ 8]
1815 vld1.64 {@XMM[12]-@XMM[13]}, [r0,:128]!
1816 veor @XMM[1], @XMM[1], @XMM[ 9]
1817 veor @XMM[8], @XMM[4], @XMM[10]
1818 vst1.8 {@XMM[0]-@XMM[1]}, [$out]!
1819 veor @XMM[9], @XMM[6], @XMM[11]
1820 veor @XMM[10], @XMM[3], @XMM[12]
1821 vst1.8 {@XMM[8]-@XMM[9]}, [$out]!
1822 veor @XMM[11], @XMM[7], @XMM[13]
1823 vst1.8 {@XMM[10]-@XMM[11]}, [$out]!
1824
1825 vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak
1826 b .Lxts_enc_done
1827
1828@ put this in range for both ARM and Thumb mode adr instructions
1829.align 5
1830.Lxts_magic:
1831 .quad 1, 0x87
1832
1833.align 5
1834.Lxts_enc_5:
1835 vst1.64 {@XMM[13]}, [r0,:128] @ next round tweak
1836
1837 veor @XMM[3], @XMM[3], @XMM[11]
1838#ifndef BSAES_ASM_EXTENDED_KEY
1839 add r4, sp, #0x90 @ pass key schedule
1840#else
1841 add r4, $key, #248 @ pass key schedule
1842#endif
1843 veor @XMM[4], @XMM[4], @XMM[12]
1844 mov r5, $rounds @ pass rounds
1845 mov r0, sp
1846
1847 bl _bsaes_encrypt8
1848
1849 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]!
1850 vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]!
1851 veor @XMM[0], @XMM[0], @XMM[ 8]
1852 vld1.64 {@XMM[12]}, [r0,:128]!
1853 veor @XMM[1], @XMM[1], @XMM[ 9]
1854 veor @XMM[8], @XMM[4], @XMM[10]
1855 vst1.8 {@XMM[0]-@XMM[1]}, [$out]!
1856 veor @XMM[9], @XMM[6], @XMM[11]
1857 veor @XMM[10], @XMM[3], @XMM[12]
1858 vst1.8 {@XMM[8]-@XMM[9]}, [$out]!
1859 vst1.8 {@XMM[10]}, [$out]!
1860
1861 vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak
1862 b .Lxts_enc_done
1863.align 4
1864.Lxts_enc_4:
1865 vst1.64 {@XMM[12]}, [r0,:128] @ next round tweak
1866
1867 veor @XMM[2], @XMM[2], @XMM[10]
1868#ifndef BSAES_ASM_EXTENDED_KEY
1869 add r4, sp, #0x90 @ pass key schedule
1870#else
1871 add r4, $key, #248 @ pass key schedule
1872#endif
1873 veor @XMM[3], @XMM[3], @XMM[11]
1874 mov r5, $rounds @ pass rounds
1875 mov r0, sp
1876
1877 bl _bsaes_encrypt8
1878
1879 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]!
1880 vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]!
1881 veor @XMM[0], @XMM[0], @XMM[ 8]
1882 veor @XMM[1], @XMM[1], @XMM[ 9]
1883 veor @XMM[8], @XMM[4], @XMM[10]
1884 vst1.8 {@XMM[0]-@XMM[1]}, [$out]!
1885 veor @XMM[9], @XMM[6], @XMM[11]
1886 vst1.8 {@XMM[8]-@XMM[9]}, [$out]!
1887
1888 vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak
1889 b .Lxts_enc_done
1890.align 4
1891.Lxts_enc_3:
1892 vst1.64 {@XMM[11]}, [r0,:128] @ next round tweak
1893
1894 veor @XMM[1], @XMM[1], @XMM[9]
1895#ifndef BSAES_ASM_EXTENDED_KEY
1896 add r4, sp, #0x90 @ pass key schedule
1897#else
1898 add r4, $key, #248 @ pass key schedule
1899#endif
1900 veor @XMM[2], @XMM[2], @XMM[10]
1901 mov r5, $rounds @ pass rounds
1902 mov r0, sp
1903
1904 bl _bsaes_encrypt8
1905
1906 vld1.64 {@XMM[8]-@XMM[9]}, [r0,:128]!
1907 vld1.64 {@XMM[10]}, [r0,:128]!
1908 veor @XMM[0], @XMM[0], @XMM[ 8]
1909 veor @XMM[1], @XMM[1], @XMM[ 9]
1910 veor @XMM[8], @XMM[4], @XMM[10]
1911 vst1.8 {@XMM[0]-@XMM[1]}, [$out]!
1912 vst1.8 {@XMM[8]}, [$out]!
1913
1914 vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak
1915 b .Lxts_enc_done
1916.align 4
1917.Lxts_enc_2:
1918 vst1.64 {@XMM[10]}, [r0,:128] @ next round tweak
1919
1920 veor @XMM[0], @XMM[0], @XMM[8]
1921#ifndef BSAES_ASM_EXTENDED_KEY
1922 add r4, sp, #0x90 @ pass key schedule
1923#else
1924 add r4, $key, #248 @ pass key schedule
1925#endif
1926 veor @XMM[1], @XMM[1], @XMM[9]
1927 mov r5, $rounds @ pass rounds
1928 mov r0, sp
1929
1930 bl _bsaes_encrypt8
1931
1932 vld1.64 {@XMM[8]-@XMM[9]}, [r0,:128]!
1933 veor @XMM[0], @XMM[0], @XMM[ 8]
1934 veor @XMM[1], @XMM[1], @XMM[ 9]
1935 vst1.8 {@XMM[0]-@XMM[1]}, [$out]!
1936
1937 vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak
1938 b .Lxts_enc_done
1939.align 4
1940.Lxts_enc_1:
1941 mov r0, sp
1942 veor @XMM[0], @XMM[8]
1943 mov r1, sp
1944 vst1.8 {@XMM[0]}, [sp,:128]
1945 mov r2, $key
1946 mov r4, $fp @ preserve fp
1947
1948 bl AES_encrypt
1949
1950 vld1.8 {@XMM[0]}, [sp,:128]
1951 veor @XMM[0], @XMM[0], @XMM[8]
1952 vst1.8 {@XMM[0]}, [$out]!
1953 mov $fp, r4
1954
1955 vmov @XMM[8], @XMM[9] @ next round tweak
1956
1957.Lxts_enc_done:
1958#ifndef XTS_CHAIN_TWEAK
1959 adds $len, #0x10
1960 beq .Lxts_enc_ret
1961 sub r6, $out, #0x10
1962
1963.Lxts_enc_steal:
1964 ldrb r0, [$inp], #1
1965 ldrb r1, [$out, #-0x10]
1966 strb r0, [$out, #-0x10]
1967 strb r1, [$out], #1
1968
1969 subs $len, #1
1970 bhi .Lxts_enc_steal
1971
1972 vld1.8 {@XMM[0]}, [r6]
1973 mov r0, sp
1974 veor @XMM[0], @XMM[0], @XMM[8]
1975 mov r1, sp
1976 vst1.8 {@XMM[0]}, [sp,:128]
1977 mov r2, $key
1978 mov r4, $fp @ preserve fp
1979
1980 bl AES_encrypt
1981
1982 vld1.8 {@XMM[0]}, [sp,:128]
1983 veor @XMM[0], @XMM[0], @XMM[8]
1984 vst1.8 {@XMM[0]}, [r6]
1985 mov $fp, r4
1986#endif
1987
1988.Lxts_enc_ret:
1989 bic r0, $fp, #0xf
1990 vmov.i32 q0, #0
1991 vmov.i32 q1, #0
1992#ifdef XTS_CHAIN_TWEAK
1993 ldr r1, [$fp, #0x20+VFP_ABI_FRAME] @ chain tweak
1994#endif
1995.Lxts_enc_bzero: @ wipe key schedule [if any]
1996 vstmia sp!, {q0-q1}
1997 cmp sp, r0
1998 bne .Lxts_enc_bzero
1999
2000 mov sp, $fp
2001#ifdef XTS_CHAIN_TWEAK
2002 vst1.8 {@XMM[8]}, [r1]
2003#endif
2004 VFP_ABI_POP
2005 ldmia sp!, {r4-r10, pc} @ return
2006
2007.size bsaes_xts_encrypt,.-bsaes_xts_encrypt
2008
2009.globl bsaes_xts_decrypt
2010.type bsaes_xts_decrypt,%function
2011.align 4
2012bsaes_xts_decrypt:
2013 mov ip, sp
2014 stmdb sp!, {r4-r10, lr} @ 0x20
2015 VFP_ABI_PUSH
2016 mov r6, sp @ future $fp
2017
2018 mov $inp, r0
2019 mov $out, r1
2020 mov $len, r2
2021 mov $key, r3
2022
2023 sub r0, sp, #0x10 @ 0x10
2024 bic r0, #0xf @ align at 16 bytes
2025 mov sp, r0
2026
2027#ifdef XTS_CHAIN_TWEAK
2028 ldr r0, [ip] @ pointer to input tweak
2029#else
2030 @ generate initial tweak
2031 ldr r0, [ip, #4] @ iv[]
2032 mov r1, sp
2033 ldr r2, [ip, #0] @ key2
2034 bl AES_encrypt
2035 mov r0, sp @ pointer to initial tweak
2036#endif
2037
2038 ldr $rounds, [$key, #240] @ get # of rounds
2039 mov $fp, r6
2040#ifndef BSAES_ASM_EXTENDED_KEY
2041 @ allocate the key schedule on the stack
2042 sub r12, sp, $rounds, lsl#7 @ 128 bytes per inner round key
2043 @ add r12, #`128-32` @ size of bit-sliced key schedule
2044 sub r12, #`32+16` @ place for tweak[9]
2045
2046 @ populate the key schedule
2047 mov r4, $key @ pass key
2048 mov r5, $rounds @ pass # of rounds
2049 mov sp, r12
2050 add r12, #0x90 @ pass key schedule
2051 bl _bsaes_key_convert
2052 add r4, sp, #0x90
2053 vldmia r4, {@XMM[6]}
2054 vstmia r12, {@XMM[15]} @ save last round key
2055 veor @XMM[7], @XMM[7], @XMM[6] @ fix up round 0 key
2056 vstmia r4, {@XMM[7]}
2057#else
2058 ldr r12, [$key, #244]
2059 eors r12, #1
2060 beq 0f
2061
2062 str r12, [$key, #244]
2063 mov r4, $key @ pass key
2064 mov r5, $rounds @ pass # of rounds
2065 add r12, $key, #248 @ pass key schedule
2066 bl _bsaes_key_convert
2067 add r4, $key, #248
2068 vldmia r4, {@XMM[6]}
2069 vstmia r12, {@XMM[15]} @ save last round key
2070 veor @XMM[7], @XMM[7], @XMM[6] @ fix up round 0 key
2071 vstmia r4, {@XMM[7]}
2072
2073.align 2
20740: sub sp, #0x90 @ place for tweak[9]
2075#endif
2076 vld1.8 {@XMM[8]}, [r0] @ initial tweak
2077 adr $magic, .Lxts_magic
2078
2079 tst $len, #0xf @ if not multiple of 16
2080 it ne @ Thumb2 thing, sanity check in ARM
2081 subne $len, #0x10 @ subtract another 16 bytes
2082 subs $len, #0x80
2083
2084 blo .Lxts_dec_short
2085 b .Lxts_dec_loop
2086
2087.align 4
2088.Lxts_dec_loop:
2089 vldmia $magic, {$twmask} @ load XTS magic
2090 vshr.s64 @T[0], @XMM[8], #63
2091 mov r0, sp
2092 vand @T[0], @T[0], $twmask
2093___
2094for($i=9;$i<16;$i++) {
2095$code.=<<___;
2096 vadd.u64 @XMM[$i], @XMM[$i-1], @XMM[$i-1]
2097 vst1.64 {@XMM[$i-1]}, [r0,:128]!
2098 vswp `&Dhi("@T[0]")`,`&Dlo("@T[0]")`
2099 vshr.s64 @T[1], @XMM[$i], #63
2100 veor @XMM[$i], @XMM[$i], @T[0]
2101 vand @T[1], @T[1], $twmask
2102___
2103 @T=reverse(@T);
2104
2105$code.=<<___ if ($i>=10);
2106 vld1.8 {@XMM[$i-10]}, [$inp]!
2107___
2108$code.=<<___ if ($i>=11);
2109 veor @XMM[$i-11], @XMM[$i-11], @XMM[$i-3]
2110___
2111}
2112$code.=<<___;
2113 vadd.u64 @XMM[8], @XMM[15], @XMM[15]
2114 vst1.64 {@XMM[15]}, [r0,:128]!
2115 vswp `&Dhi("@T[0]")`,`&Dlo("@T[0]")`
2116 veor @XMM[8], @XMM[8], @T[0]
2117 vst1.64 {@XMM[8]}, [r0,:128] @ next round tweak
2118
2119 vld1.8 {@XMM[6]-@XMM[7]}, [$inp]!
2120 veor @XMM[5], @XMM[5], @XMM[13]
2121#ifndef BSAES_ASM_EXTENDED_KEY
2122 add r4, sp, #0x90 @ pass key schedule
2123#else
2124 add r4, $key, #248 @ pass key schedule
2125#endif
2126 veor @XMM[6], @XMM[6], @XMM[14]
2127 mov r5, $rounds @ pass rounds
2128 veor @XMM[7], @XMM[7], @XMM[15]
2129 mov r0, sp
2130
2131 bl _bsaes_decrypt8
2132
2133 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]!
2134 vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]!
2135 veor @XMM[0], @XMM[0], @XMM[ 8]
2136 vld1.64 {@XMM[12]-@XMM[13]}, [r0,:128]!
2137 veor @XMM[1], @XMM[1], @XMM[ 9]
2138 veor @XMM[8], @XMM[6], @XMM[10]
2139 vst1.8 {@XMM[0]-@XMM[1]}, [$out]!
2140 veor @XMM[9], @XMM[4], @XMM[11]
2141 vld1.64 {@XMM[14]-@XMM[15]}, [r0,:128]!
2142 veor @XMM[10], @XMM[2], @XMM[12]
2143 vst1.8 {@XMM[8]-@XMM[9]}, [$out]!
2144 veor @XMM[11], @XMM[7], @XMM[13]
2145 veor @XMM[12], @XMM[3], @XMM[14]
2146 vst1.8 {@XMM[10]-@XMM[11]}, [$out]!
2147 veor @XMM[13], @XMM[5], @XMM[15]
2148 vst1.8 {@XMM[12]-@XMM[13]}, [$out]!
2149
2150 vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak
2151
2152 subs $len, #0x80
2153 bpl .Lxts_dec_loop
2154
2155.Lxts_dec_short:
2156 adds $len, #0x70
2157 bmi .Lxts_dec_done
2158
2159 vldmia $magic, {$twmask} @ load XTS magic
2160 vshr.s64 @T[0], @XMM[8], #63
2161 mov r0, sp
2162 vand @T[0], @T[0], $twmask
2163___
2164for($i=9;$i<16;$i++) {
2165$code.=<<___;
2166 vadd.u64 @XMM[$i], @XMM[$i-1], @XMM[$i-1]
2167 vst1.64 {@XMM[$i-1]}, [r0,:128]!
2168 vswp `&Dhi("@T[0]")`,`&Dlo("@T[0]")`
2169 vshr.s64 @T[1], @XMM[$i], #63
2170 veor @XMM[$i], @XMM[$i], @T[0]
2171 vand @T[1], @T[1], $twmask
2172___
2173 @T=reverse(@T);
2174
2175$code.=<<___ if ($i>=10);
2176 vld1.8 {@XMM[$i-10]}, [$inp]!
2177 subs $len, #0x10
2178 bmi .Lxts_dec_`$i-9`
2179___
2180$code.=<<___ if ($i>=11);
2181 veor @XMM[$i-11], @XMM[$i-11], @XMM[$i-3]
2182___
2183}
2184$code.=<<___;
2185 sub $len, #0x10
2186 vst1.64 {@XMM[15]}, [r0,:128] @ next round tweak
2187
2188 vld1.8 {@XMM[6]}, [$inp]!
2189 veor @XMM[5], @XMM[5], @XMM[13]
2190#ifndef BSAES_ASM_EXTENDED_KEY
2191 add r4, sp, #0x90 @ pass key schedule
2192#else
2193 add r4, $key, #248 @ pass key schedule
2194#endif
2195 veor @XMM[6], @XMM[6], @XMM[14]
2196 mov r5, $rounds @ pass rounds
2197 mov r0, sp
2198
2199 bl _bsaes_decrypt8
2200
2201 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]!
2202 vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]!
2203 veor @XMM[0], @XMM[0], @XMM[ 8]
2204 vld1.64 {@XMM[12]-@XMM[13]}, [r0,:128]!
2205 veor @XMM[1], @XMM[1], @XMM[ 9]
2206 veor @XMM[8], @XMM[6], @XMM[10]
2207 vst1.8 {@XMM[0]-@XMM[1]}, [$out]!
2208 veor @XMM[9], @XMM[4], @XMM[11]
2209 vld1.64 {@XMM[14]}, [r0,:128]!
2210 veor @XMM[10], @XMM[2], @XMM[12]
2211 vst1.8 {@XMM[8]-@XMM[9]}, [$out]!
2212 veor @XMM[11], @XMM[7], @XMM[13]
2213 veor @XMM[12], @XMM[3], @XMM[14]
2214 vst1.8 {@XMM[10]-@XMM[11]}, [$out]!
2215 vst1.8 {@XMM[12]}, [$out]!
2216
2217 vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak
2218 b .Lxts_dec_done
2219.align 4
2220.Lxts_dec_6:
2221 vst1.64 {@XMM[14]}, [r0,:128] @ next round tweak
2222
2223 veor @XMM[4], @XMM[4], @XMM[12]
2224#ifndef BSAES_ASM_EXTENDED_KEY
2225 add r4, sp, #0x90 @ pass key schedule
2226#else
2227 add r4, $key, #248 @ pass key schedule
2228#endif
2229 veor @XMM[5], @XMM[5], @XMM[13]
2230 mov r5, $rounds @ pass rounds
2231 mov r0, sp
2232
2233 bl _bsaes_decrypt8
2234
2235 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]!
2236 vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]!
2237 veor @XMM[0], @XMM[0], @XMM[ 8]
2238 vld1.64 {@XMM[12]-@XMM[13]}, [r0,:128]!
2239 veor @XMM[1], @XMM[1], @XMM[ 9]
2240 veor @XMM[8], @XMM[6], @XMM[10]
2241 vst1.8 {@XMM[0]-@XMM[1]}, [$out]!
2242 veor @XMM[9], @XMM[4], @XMM[11]
2243 veor @XMM[10], @XMM[2], @XMM[12]
2244 vst1.8 {@XMM[8]-@XMM[9]}, [$out]!
2245 veor @XMM[11], @XMM[7], @XMM[13]
2246 vst1.8 {@XMM[10]-@XMM[11]}, [$out]!
2247
2248 vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak
2249 b .Lxts_dec_done
2250.align 4
2251.Lxts_dec_5:
2252 vst1.64 {@XMM[13]}, [r0,:128] @ next round tweak
2253
2254 veor @XMM[3], @XMM[3], @XMM[11]
2255#ifndef BSAES_ASM_EXTENDED_KEY
2256 add r4, sp, #0x90 @ pass key schedule
2257#else
2258 add r4, $key, #248 @ pass key schedule
2259#endif
2260 veor @XMM[4], @XMM[4], @XMM[12]
2261 mov r5, $rounds @ pass rounds
2262 mov r0, sp
2263
2264 bl _bsaes_decrypt8
2265
2266 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]!
2267 vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]!
2268 veor @XMM[0], @XMM[0], @XMM[ 8]
2269 vld1.64 {@XMM[12]}, [r0,:128]!
2270 veor @XMM[1], @XMM[1], @XMM[ 9]
2271 veor @XMM[8], @XMM[6], @XMM[10]
2272 vst1.8 {@XMM[0]-@XMM[1]}, [$out]!
2273 veor @XMM[9], @XMM[4], @XMM[11]
2274 veor @XMM[10], @XMM[2], @XMM[12]
2275 vst1.8 {@XMM[8]-@XMM[9]}, [$out]!
2276 vst1.8 {@XMM[10]}, [$out]!
2277
2278 vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak
2279 b .Lxts_dec_done
2280.align 4
2281.Lxts_dec_4:
2282 vst1.64 {@XMM[12]}, [r0,:128] @ next round tweak
2283
2284 veor @XMM[2], @XMM[2], @XMM[10]
2285#ifndef BSAES_ASM_EXTENDED_KEY
2286 add r4, sp, #0x90 @ pass key schedule
2287#else
2288 add r4, $key, #248 @ pass key schedule
2289#endif
2290 veor @XMM[3], @XMM[3], @XMM[11]
2291 mov r5, $rounds @ pass rounds
2292 mov r0, sp
2293
2294 bl _bsaes_decrypt8
2295
2296 vld1.64 {@XMM[ 8]-@XMM[ 9]}, [r0,:128]!
2297 vld1.64 {@XMM[10]-@XMM[11]}, [r0,:128]!
2298 veor @XMM[0], @XMM[0], @XMM[ 8]
2299 veor @XMM[1], @XMM[1], @XMM[ 9]
2300 veor @XMM[8], @XMM[6], @XMM[10]
2301 vst1.8 {@XMM[0]-@XMM[1]}, [$out]!
2302 veor @XMM[9], @XMM[4], @XMM[11]
2303 vst1.8 {@XMM[8]-@XMM[9]}, [$out]!
2304
2305 vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak
2306 b .Lxts_dec_done
2307.align 4
2308.Lxts_dec_3:
2309 vst1.64 {@XMM[11]}, [r0,:128] @ next round tweak
2310
2311 veor @XMM[1], @XMM[1], @XMM[9]
2312#ifndef BSAES_ASM_EXTENDED_KEY
2313 add r4, sp, #0x90 @ pass key schedule
2314#else
2315 add r4, $key, #248 @ pass key schedule
2316#endif
2317 veor @XMM[2], @XMM[2], @XMM[10]
2318 mov r5, $rounds @ pass rounds
2319 mov r0, sp
2320
2321 bl _bsaes_decrypt8
2322
2323 vld1.64 {@XMM[8]-@XMM[9]}, [r0,:128]!
2324 vld1.64 {@XMM[10]}, [r0,:128]!
2325 veor @XMM[0], @XMM[0], @XMM[ 8]
2326 veor @XMM[1], @XMM[1], @XMM[ 9]
2327 veor @XMM[8], @XMM[6], @XMM[10]
2328 vst1.8 {@XMM[0]-@XMM[1]}, [$out]!
2329 vst1.8 {@XMM[8]}, [$out]!
2330
2331 vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak
2332 b .Lxts_dec_done
2333.align 4
2334.Lxts_dec_2:
2335 vst1.64 {@XMM[10]}, [r0,:128] @ next round tweak
2336
2337 veor @XMM[0], @XMM[0], @XMM[8]
2338#ifndef BSAES_ASM_EXTENDED_KEY
2339 add r4, sp, #0x90 @ pass key schedule
2340#else
2341 add r4, $key, #248 @ pass key schedule
2342#endif
2343 veor @XMM[1], @XMM[1], @XMM[9]
2344 mov r5, $rounds @ pass rounds
2345 mov r0, sp
2346
2347 bl _bsaes_decrypt8
2348
2349 vld1.64 {@XMM[8]-@XMM[9]}, [r0,:128]!
2350 veor @XMM[0], @XMM[0], @XMM[ 8]
2351 veor @XMM[1], @XMM[1], @XMM[ 9]
2352 vst1.8 {@XMM[0]-@XMM[1]}, [$out]!
2353
2354 vld1.64 {@XMM[8]}, [r0,:128] @ next round tweak
2355 b .Lxts_dec_done
2356.align 4
2357.Lxts_dec_1:
2358 mov r0, sp
2359 veor @XMM[0], @XMM[8]
2360 mov r1, sp
2361 vst1.8 {@XMM[0]}, [sp,:128]
2362 mov r2, $key
2363 mov r4, $fp @ preserve fp
2364 mov r5, $magic @ preserve magic
2365
2366 bl AES_decrypt
2367
2368 vld1.8 {@XMM[0]}, [sp,:128]
2369 veor @XMM[0], @XMM[0], @XMM[8]
2370 vst1.8 {@XMM[0]}, [$out]!
2371 mov $fp, r4
2372 mov $magic, r5
2373
2374 vmov @XMM[8], @XMM[9] @ next round tweak
2375
2376.Lxts_dec_done:
2377#ifndef XTS_CHAIN_TWEAK
2378 adds $len, #0x10
2379 beq .Lxts_dec_ret
2380
2381 @ calculate one round of extra tweak for the stolen ciphertext
2382 vldmia $magic, {$twmask}
2383 vshr.s64 @XMM[6], @XMM[8], #63
2384 vand @XMM[6], @XMM[6], $twmask
2385 vadd.u64 @XMM[9], @XMM[8], @XMM[8]
2386 vswp `&Dhi("@XMM[6]")`,`&Dlo("@XMM[6]")`
2387 veor @XMM[9], @XMM[9], @XMM[6]
2388
2389 @ perform the final decryption with the last tweak value
2390 vld1.8 {@XMM[0]}, [$inp]!
2391 mov r0, sp
2392 veor @XMM[0], @XMM[0], @XMM[9]
2393 mov r1, sp
2394 vst1.8 {@XMM[0]}, [sp,:128]
2395 mov r2, $key
2396 mov r4, $fp @ preserve fp
2397
2398 bl AES_decrypt
2399
2400 vld1.8 {@XMM[0]}, [sp,:128]
2401 veor @XMM[0], @XMM[0], @XMM[9]
2402 vst1.8 {@XMM[0]}, [$out]
2403
2404 mov r6, $out
2405.Lxts_dec_steal:
2406 ldrb r1, [$out]
2407 ldrb r0, [$inp], #1
2408 strb r1, [$out, #0x10]
2409 strb r0, [$out], #1
2410
2411 subs $len, #1
2412 bhi .Lxts_dec_steal
2413
2414 vld1.8 {@XMM[0]}, [r6]
2415 mov r0, sp
2416 veor @XMM[0], @XMM[8]
2417 mov r1, sp
2418 vst1.8 {@XMM[0]}, [sp,:128]
2419 mov r2, $key
2420
2421 bl AES_decrypt
2422
2423 vld1.8 {@XMM[0]}, [sp,:128]
2424 veor @XMM[0], @XMM[0], @XMM[8]
2425 vst1.8 {@XMM[0]}, [r6]
2426 mov $fp, r4
2427#endif
2428
2429.Lxts_dec_ret:
2430 bic r0, $fp, #0xf
2431 vmov.i32 q0, #0
2432 vmov.i32 q1, #0
2433#ifdef XTS_CHAIN_TWEAK
2434 ldr r1, [$fp, #0x20+VFP_ABI_FRAME] @ chain tweak
2435#endif
2436.Lxts_dec_bzero: @ wipe key schedule [if any]
2437 vstmia sp!, {q0-q1}
2438 cmp sp, r0
2439 bne .Lxts_dec_bzero
2440
2441 mov sp, $fp
2442#ifdef XTS_CHAIN_TWEAK
2443 vst1.8 {@XMM[8]}, [r1]
2444#endif
2445 VFP_ABI_POP
2446 ldmia sp!, {r4-r10, pc} @ return
2447
2448.size bsaes_xts_decrypt,.-bsaes_xts_decrypt
2449___
2450}
2451$code.=<<___;
2452#endif
2453___
2454
2455$code =~ s/\`([^\`]*)\`/eval($1)/gem;
2456
2457open SELF,$0;
2458while(<SELF>) {
2459 next if (/^#!/);
2460 last if (!s/^#/@/ and !/^$/);
2461 print;
2462}
2463close SELF;
2464
2465print $code;
2466
2467close STDOUT;
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index d3db39860b9c..c38b58c80202 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -24,6 +24,7 @@ generic-y += sembuf.h
24generic-y += serial.h 24generic-y += serial.h
25generic-y += shmbuf.h 25generic-y += shmbuf.h
26generic-y += siginfo.h 26generic-y += siginfo.h
27generic-y += simd.h
27generic-y += sizes.h 28generic-y += sizes.h
28generic-y += socket.h 29generic-y += socket.h
29generic-y += sockios.h 30generic-y += sockios.h
@@ -31,5 +32,5 @@ generic-y += termbits.h
31generic-y += termios.h 32generic-y += termios.h
32generic-y += timex.h 33generic-y += timex.h
33generic-y += trace_clock.h 34generic-y += trace_clock.h
34generic-y += types.h
35generic-y += unaligned.h 35generic-y += unaligned.h
36generic-y += preempt.h
diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h
index 5665134bfa3e..0704e0cf5571 100644
--- a/arch/arm/include/asm/arch_timer.h
+++ b/arch/arm/include/asm/arch_timer.h
@@ -87,17 +87,43 @@ static inline u64 arch_counter_get_cntvct(void)
87 return cval; 87 return cval;
88} 88}
89 89
90static inline void arch_counter_set_user_access(void) 90static inline u32 arch_timer_get_cntkctl(void)
91{ 91{
92 u32 cntkctl; 92 u32 cntkctl;
93
94 asm volatile("mrc p15, 0, %0, c14, c1, 0" : "=r" (cntkctl)); 93 asm volatile("mrc p15, 0, %0, c14, c1, 0" : "=r" (cntkctl));
94 return cntkctl;
95}
95 96
96 /* disable user access to everything */ 97static inline void arch_timer_set_cntkctl(u32 cntkctl)
97 cntkctl &= ~((3 << 8) | (7 << 0)); 98{
98
99 asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl)); 99 asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl));
100} 100}
101
102static inline void arch_counter_set_user_access(void)
103{
104 u32 cntkctl = arch_timer_get_cntkctl();
105
106 /* Disable user access to both physical/virtual counters/timers */
107 /* Also disable virtual event stream */
108 cntkctl &= ~(ARCH_TIMER_USR_PT_ACCESS_EN
109 | ARCH_TIMER_USR_VT_ACCESS_EN
110 | ARCH_TIMER_VIRT_EVT_EN
111 | ARCH_TIMER_USR_VCT_ACCESS_EN
112 | ARCH_TIMER_USR_PCT_ACCESS_EN);
113 arch_timer_set_cntkctl(cntkctl);
114}
115
116static inline void arch_timer_evtstrm_enable(int divider)
117{
118 u32 cntkctl = arch_timer_get_cntkctl();
119 cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK;
120 /* Set the divider and enable virtual event stream */
121 cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT)
122 | ARCH_TIMER_VIRT_EVT_EN;
123 arch_timer_set_cntkctl(cntkctl);
124 elf_hwcap |= HWCAP_EVTSTRM;
125}
126
101#endif 127#endif
102 128
103#endif 129#endif
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index fcc1b5bf6979..5c2285160575 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -53,6 +53,13 @@
53#define put_byte_3 lsl #0 53#define put_byte_3 lsl #0
54#endif 54#endif
55 55
56/* Select code for any configuration running in BE8 mode */
57#ifdef CONFIG_CPU_ENDIAN_BE8
58#define ARM_BE8(code...) code
59#else
60#define ARM_BE8(code...)
61#endif
62
56/* 63/*
57 * Data preload for architectures that support it 64 * Data preload for architectures that support it
58 */ 65 */
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
index da1c77d39327..62d2cb53b069 100644
--- a/arch/arm/include/asm/atomic.h
+++ b/arch/arm/include/asm/atomic.h
@@ -12,6 +12,7 @@
12#define __ASM_ARM_ATOMIC_H 12#define __ASM_ARM_ATOMIC_H
13 13
14#include <linux/compiler.h> 14#include <linux/compiler.h>
15#include <linux/prefetch.h>
15#include <linux/types.h> 16#include <linux/types.h>
16#include <linux/irqflags.h> 17#include <linux/irqflags.h>
17#include <asm/barrier.h> 18#include <asm/barrier.h>
@@ -41,6 +42,7 @@ static inline void atomic_add(int i, atomic_t *v)
41 unsigned long tmp; 42 unsigned long tmp;
42 int result; 43 int result;
43 44
45 prefetchw(&v->counter);
44 __asm__ __volatile__("@ atomic_add\n" 46 __asm__ __volatile__("@ atomic_add\n"
45"1: ldrex %0, [%3]\n" 47"1: ldrex %0, [%3]\n"
46" add %0, %0, %4\n" 48" add %0, %0, %4\n"
@@ -79,6 +81,7 @@ static inline void atomic_sub(int i, atomic_t *v)
79 unsigned long tmp; 81 unsigned long tmp;
80 int result; 82 int result;
81 83
84 prefetchw(&v->counter);
82 __asm__ __volatile__("@ atomic_sub\n" 85 __asm__ __volatile__("@ atomic_sub\n"
83"1: ldrex %0, [%3]\n" 86"1: ldrex %0, [%3]\n"
84" sub %0, %0, %4\n" 87" sub %0, %0, %4\n"
@@ -114,7 +117,8 @@ static inline int atomic_sub_return(int i, atomic_t *v)
114 117
115static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new) 118static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new)
116{ 119{
117 unsigned long oldval, res; 120 int oldval;
121 unsigned long res;
118 122
119 smp_mb(); 123 smp_mb();
120 124
@@ -134,21 +138,6 @@ static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new)
134 return oldval; 138 return oldval;
135} 139}
136 140
137static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
138{
139 unsigned long tmp, tmp2;
140
141 __asm__ __volatile__("@ atomic_clear_mask\n"
142"1: ldrex %0, [%3]\n"
143" bic %0, %0, %4\n"
144" strex %1, %0, [%3]\n"
145" teq %1, #0\n"
146" bne 1b"
147 : "=&r" (tmp), "=&r" (tmp2), "+Qo" (*addr)
148 : "r" (addr), "Ir" (mask)
149 : "cc");
150}
151
152#else /* ARM_ARCH_6 */ 141#else /* ARM_ARCH_6 */
153 142
154#ifdef CONFIG_SMP 143#ifdef CONFIG_SMP
@@ -197,15 +186,6 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
197 return ret; 186 return ret;
198} 187}
199 188
200static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
201{
202 unsigned long flags;
203
204 raw_local_irq_save(flags);
205 *addr &= ~mask;
206 raw_local_irq_restore(flags);
207}
208
209#endif /* __LINUX_ARM_ARCH__ */ 189#endif /* __LINUX_ARM_ARCH__ */
210 190
211#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 191#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
@@ -238,15 +218,15 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u)
238 218
239#ifndef CONFIG_GENERIC_ATOMIC64 219#ifndef CONFIG_GENERIC_ATOMIC64
240typedef struct { 220typedef struct {
241 u64 __aligned(8) counter; 221 long long counter;
242} atomic64_t; 222} atomic64_t;
243 223
244#define ATOMIC64_INIT(i) { (i) } 224#define ATOMIC64_INIT(i) { (i) }
245 225
246#ifdef CONFIG_ARM_LPAE 226#ifdef CONFIG_ARM_LPAE
247static inline u64 atomic64_read(const atomic64_t *v) 227static inline long long atomic64_read(const atomic64_t *v)
248{ 228{
249 u64 result; 229 long long result;
250 230
251 __asm__ __volatile__("@ atomic64_read\n" 231 __asm__ __volatile__("@ atomic64_read\n"
252" ldrd %0, %H0, [%1]" 232" ldrd %0, %H0, [%1]"
@@ -257,7 +237,7 @@ static inline u64 atomic64_read(const atomic64_t *v)
257 return result; 237 return result;
258} 238}
259 239
260static inline void atomic64_set(atomic64_t *v, u64 i) 240static inline void atomic64_set(atomic64_t *v, long long i)
261{ 241{
262 __asm__ __volatile__("@ atomic64_set\n" 242 __asm__ __volatile__("@ atomic64_set\n"
263" strd %2, %H2, [%1]" 243" strd %2, %H2, [%1]"
@@ -266,9 +246,9 @@ static inline void atomic64_set(atomic64_t *v, u64 i)
266 ); 246 );
267} 247}
268#else 248#else
269static inline u64 atomic64_read(const atomic64_t *v) 249static inline long long atomic64_read(const atomic64_t *v)
270{ 250{
271 u64 result; 251 long long result;
272 252
273 __asm__ __volatile__("@ atomic64_read\n" 253 __asm__ __volatile__("@ atomic64_read\n"
274" ldrexd %0, %H0, [%1]" 254" ldrexd %0, %H0, [%1]"
@@ -279,10 +259,11 @@ static inline u64 atomic64_read(const atomic64_t *v)
279 return result; 259 return result;
280} 260}
281 261
282static inline void atomic64_set(atomic64_t *v, u64 i) 262static inline void atomic64_set(atomic64_t *v, long long i)
283{ 263{
284 u64 tmp; 264 long long tmp;
285 265
266 prefetchw(&v->counter);
286 __asm__ __volatile__("@ atomic64_set\n" 267 __asm__ __volatile__("@ atomic64_set\n"
287"1: ldrexd %0, %H0, [%2]\n" 268"1: ldrexd %0, %H0, [%2]\n"
288" strexd %0, %3, %H3, [%2]\n" 269" strexd %0, %3, %H3, [%2]\n"
@@ -294,15 +275,16 @@ static inline void atomic64_set(atomic64_t *v, u64 i)
294} 275}
295#endif 276#endif
296 277
297static inline void atomic64_add(u64 i, atomic64_t *v) 278static inline void atomic64_add(long long i, atomic64_t *v)
298{ 279{
299 u64 result; 280 long long result;
300 unsigned long tmp; 281 unsigned long tmp;
301 282
283 prefetchw(&v->counter);
302 __asm__ __volatile__("@ atomic64_add\n" 284 __asm__ __volatile__("@ atomic64_add\n"
303"1: ldrexd %0, %H0, [%3]\n" 285"1: ldrexd %0, %H0, [%3]\n"
304" adds %0, %0, %4\n" 286" adds %Q0, %Q0, %Q4\n"
305" adc %H0, %H0, %H4\n" 287" adc %R0, %R0, %R4\n"
306" strexd %1, %0, %H0, [%3]\n" 288" strexd %1, %0, %H0, [%3]\n"
307" teq %1, #0\n" 289" teq %1, #0\n"
308" bne 1b" 290" bne 1b"
@@ -311,17 +293,17 @@ static inline void atomic64_add(u64 i, atomic64_t *v)
311 : "cc"); 293 : "cc");
312} 294}
313 295
314static inline u64 atomic64_add_return(u64 i, atomic64_t *v) 296static inline long long atomic64_add_return(long long i, atomic64_t *v)
315{ 297{
316 u64 result; 298 long long result;
317 unsigned long tmp; 299 unsigned long tmp;
318 300
319 smp_mb(); 301 smp_mb();
320 302
321 __asm__ __volatile__("@ atomic64_add_return\n" 303 __asm__ __volatile__("@ atomic64_add_return\n"
322"1: ldrexd %0, %H0, [%3]\n" 304"1: ldrexd %0, %H0, [%3]\n"
323" adds %0, %0, %4\n" 305" adds %Q0, %Q0, %Q4\n"
324" adc %H0, %H0, %H4\n" 306" adc %R0, %R0, %R4\n"
325" strexd %1, %0, %H0, [%3]\n" 307" strexd %1, %0, %H0, [%3]\n"
326" teq %1, #0\n" 308" teq %1, #0\n"
327" bne 1b" 309" bne 1b"
@@ -334,15 +316,16 @@ static inline u64 atomic64_add_return(u64 i, atomic64_t *v)
334 return result; 316 return result;
335} 317}
336 318
337static inline void atomic64_sub(u64 i, atomic64_t *v) 319static inline void atomic64_sub(long long i, atomic64_t *v)
338{ 320{
339 u64 result; 321 long long result;
340 unsigned long tmp; 322 unsigned long tmp;
341 323
324 prefetchw(&v->counter);
342 __asm__ __volatile__("@ atomic64_sub\n" 325 __asm__ __volatile__("@ atomic64_sub\n"
343"1: ldrexd %0, %H0, [%3]\n" 326"1: ldrexd %0, %H0, [%3]\n"
344" subs %0, %0, %4\n" 327" subs %Q0, %Q0, %Q4\n"
345" sbc %H0, %H0, %H4\n" 328" sbc %R0, %R0, %R4\n"
346" strexd %1, %0, %H0, [%3]\n" 329" strexd %1, %0, %H0, [%3]\n"
347" teq %1, #0\n" 330" teq %1, #0\n"
348" bne 1b" 331" bne 1b"
@@ -351,17 +334,17 @@ static inline void atomic64_sub(u64 i, atomic64_t *v)
351 : "cc"); 334 : "cc");
352} 335}
353 336
354static inline u64 atomic64_sub_return(u64 i, atomic64_t *v) 337static inline long long atomic64_sub_return(long long i, atomic64_t *v)
355{ 338{
356 u64 result; 339 long long result;
357 unsigned long tmp; 340 unsigned long tmp;
358 341
359 smp_mb(); 342 smp_mb();
360 343
361 __asm__ __volatile__("@ atomic64_sub_return\n" 344 __asm__ __volatile__("@ atomic64_sub_return\n"
362"1: ldrexd %0, %H0, [%3]\n" 345"1: ldrexd %0, %H0, [%3]\n"
363" subs %0, %0, %4\n" 346" subs %Q0, %Q0, %Q4\n"
364" sbc %H0, %H0, %H4\n" 347" sbc %R0, %R0, %R4\n"
365" strexd %1, %0, %H0, [%3]\n" 348" strexd %1, %0, %H0, [%3]\n"
366" teq %1, #0\n" 349" teq %1, #0\n"
367" bne 1b" 350" bne 1b"
@@ -374,9 +357,10 @@ static inline u64 atomic64_sub_return(u64 i, atomic64_t *v)
374 return result; 357 return result;
375} 358}
376 359
377static inline u64 atomic64_cmpxchg(atomic64_t *ptr, u64 old, u64 new) 360static inline long long atomic64_cmpxchg(atomic64_t *ptr, long long old,
361 long long new)
378{ 362{
379 u64 oldval; 363 long long oldval;
380 unsigned long res; 364 unsigned long res;
381 365
382 smp_mb(); 366 smp_mb();
@@ -398,9 +382,9 @@ static inline u64 atomic64_cmpxchg(atomic64_t *ptr, u64 old, u64 new)
398 return oldval; 382 return oldval;
399} 383}
400 384
401static inline u64 atomic64_xchg(atomic64_t *ptr, u64 new) 385static inline long long atomic64_xchg(atomic64_t *ptr, long long new)
402{ 386{
403 u64 result; 387 long long result;
404 unsigned long tmp; 388 unsigned long tmp;
405 389
406 smp_mb(); 390 smp_mb();
@@ -419,18 +403,18 @@ static inline u64 atomic64_xchg(atomic64_t *ptr, u64 new)
419 return result; 403 return result;
420} 404}
421 405
422static inline u64 atomic64_dec_if_positive(atomic64_t *v) 406static inline long long atomic64_dec_if_positive(atomic64_t *v)
423{ 407{
424 u64 result; 408 long long result;
425 unsigned long tmp; 409 unsigned long tmp;
426 410
427 smp_mb(); 411 smp_mb();
428 412
429 __asm__ __volatile__("@ atomic64_dec_if_positive\n" 413 __asm__ __volatile__("@ atomic64_dec_if_positive\n"
430"1: ldrexd %0, %H0, [%3]\n" 414"1: ldrexd %0, %H0, [%3]\n"
431" subs %0, %0, #1\n" 415" subs %Q0, %Q0, #1\n"
432" sbc %H0, %H0, #0\n" 416" sbc %R0, %R0, #0\n"
433" teq %H0, #0\n" 417" teq %R0, #0\n"
434" bmi 2f\n" 418" bmi 2f\n"
435" strexd %1, %0, %H0, [%3]\n" 419" strexd %1, %0, %H0, [%3]\n"
436" teq %1, #0\n" 420" teq %1, #0\n"
@@ -445,9 +429,9 @@ static inline u64 atomic64_dec_if_positive(atomic64_t *v)
445 return result; 429 return result;
446} 430}
447 431
448static inline int atomic64_add_unless(atomic64_t *v, u64 a, u64 u) 432static inline int atomic64_add_unless(atomic64_t *v, long long a, long long u)
449{ 433{
450 u64 val; 434 long long val;
451 unsigned long tmp; 435 unsigned long tmp;
452 int ret = 1; 436 int ret = 1;
453 437
@@ -459,8 +443,8 @@ static inline int atomic64_add_unless(atomic64_t *v, u64 a, u64 u)
459" teqeq %H0, %H5\n" 443" teqeq %H0, %H5\n"
460" moveq %1, #0\n" 444" moveq %1, #0\n"
461" beq 2f\n" 445" beq 2f\n"
462" adds %0, %0, %6\n" 446" adds %Q0, %Q0, %Q6\n"
463" adc %H0, %H0, %H6\n" 447" adc %R0, %R0, %R6\n"
464" strexd %2, %0, %H0, [%4]\n" 448" strexd %2, %0, %H0, [%4]\n"
465" teq %2, #0\n" 449" teq %2, #0\n"
466" bne 1b\n" 450" bne 1b\n"
diff --git a/arch/arm/include/asm/bL_switcher.h b/arch/arm/include/asm/bL_switcher.h
new file mode 100644
index 000000000000..1714800fa113
--- /dev/null
+++ b/arch/arm/include/asm/bL_switcher.h
@@ -0,0 +1,77 @@
1/*
2 * arch/arm/include/asm/bL_switcher.h
3 *
4 * Created by: Nicolas Pitre, April 2012
5 * Copyright: (C) 2012-2013 Linaro Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef ASM_BL_SWITCHER_H
13#define ASM_BL_SWITCHER_H
14
15#include <linux/compiler.h>
16#include <linux/types.h>
17
18typedef void (*bL_switch_completion_handler)(void *cookie);
19
20int bL_switch_request_cb(unsigned int cpu, unsigned int new_cluster_id,
21 bL_switch_completion_handler completer,
22 void *completer_cookie);
23static inline int bL_switch_request(unsigned int cpu, unsigned int new_cluster_id)
24{
25 return bL_switch_request_cb(cpu, new_cluster_id, NULL, NULL);
26}
27
28/*
29 * Register here to be notified about runtime enabling/disabling of
30 * the switcher.
31 *
32 * The notifier chain is called with the switcher activation lock held:
33 * the switcher will not be enabled or disabled during callbacks.
34 * Callbacks must not call bL_switcher_{get,put}_enabled().
35 */
36#define BL_NOTIFY_PRE_ENABLE 0
37#define BL_NOTIFY_POST_ENABLE 1
38#define BL_NOTIFY_PRE_DISABLE 2
39#define BL_NOTIFY_POST_DISABLE 3
40
41#ifdef CONFIG_BL_SWITCHER
42
43int bL_switcher_register_notifier(struct notifier_block *nb);
44int bL_switcher_unregister_notifier(struct notifier_block *nb);
45
46/*
47 * Use these functions to temporarily prevent enabling/disabling of
48 * the switcher.
49 * bL_switcher_get_enabled() returns true if the switcher is currently
50 * enabled. Each call to bL_switcher_get_enabled() must be followed
51 * by a call to bL_switcher_put_enabled(). These functions are not
52 * recursive.
53 */
54bool bL_switcher_get_enabled(void);
55void bL_switcher_put_enabled(void);
56
57int bL_switcher_trace_trigger(void);
58int bL_switcher_get_logical_index(u32 mpidr);
59
60#else
61static inline int bL_switcher_register_notifier(struct notifier_block *nb)
62{
63 return 0;
64}
65
66static inline int bL_switcher_unregister_notifier(struct notifier_block *nb)
67{
68 return 0;
69}
70
71static inline bool bL_switcher_get_enabled(void) { return false; }
72static inline void bL_switcher_put_enabled(void) { }
73static inline int bL_switcher_trace_trigger(void) { return 0; }
74static inline int bL_switcher_get_logical_index(u32 mpidr) { return -EUNATCH; }
75#endif /* CONFIG_BL_SWITCHER */
76
77#endif
diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
index 7af5c6c3653a..b274bde24905 100644
--- a/arch/arm/include/asm/bug.h
+++ b/arch/arm/include/asm/bug.h
@@ -2,6 +2,8 @@
2#define _ASMARM_BUG_H 2#define _ASMARM_BUG_H
3 3
4#include <linux/linkage.h> 4#include <linux/linkage.h>
5#include <linux/types.h>
6#include <asm/opcodes.h>
5 7
6#ifdef CONFIG_BUG 8#ifdef CONFIG_BUG
7 9
@@ -12,10 +14,10 @@
12 */ 14 */
13#ifdef CONFIG_THUMB2_KERNEL 15#ifdef CONFIG_THUMB2_KERNEL
14#define BUG_INSTR_VALUE 0xde02 16#define BUG_INSTR_VALUE 0xde02
15#define BUG_INSTR_TYPE ".hword " 17#define BUG_INSTR(__value) __inst_thumb16(__value)
16#else 18#else
17#define BUG_INSTR_VALUE 0xe7f001f2 19#define BUG_INSTR_VALUE 0xe7f001f2
18#define BUG_INSTR_TYPE ".word " 20#define BUG_INSTR(__value) __inst_arm(__value)
19#endif 21#endif
20 22
21 23
@@ -33,7 +35,7 @@
33 35
34#define __BUG(__file, __line, __value) \ 36#define __BUG(__file, __line, __value) \
35do { \ 37do { \
36 asm volatile("1:\t" BUG_INSTR_TYPE #__value "\n" \ 38 asm volatile("1:\t" BUG_INSTR(__value) "\n" \
37 ".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \ 39 ".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \
38 "2:\t.asciz " #__file "\n" \ 40 "2:\t.asciz " #__file "\n" \
39 ".popsection\n" \ 41 ".popsection\n" \
@@ -48,7 +50,7 @@ do { \
48 50
49#define __BUG(__file, __line, __value) \ 51#define __BUG(__file, __line, __value) \
50do { \ 52do { \
51 asm volatile(BUG_INSTR_TYPE #__value); \ 53 asm volatile(BUG_INSTR(__value) "\n"); \
52 unreachable(); \ 54 unreachable(); \
53} while (0) 55} while (0)
54#endif /* CONFIG_DEBUG_BUGVERBOSE */ 56#endif /* CONFIG_DEBUG_BUGVERBOSE */
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index 15f2d5bf8875..ee753f1749cd 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -435,4 +435,50 @@ static inline void __sync_cache_range_r(volatile void *p, size_t size)
435#define sync_cache_w(ptr) __sync_cache_range_w(ptr, sizeof *(ptr)) 435#define sync_cache_w(ptr) __sync_cache_range_w(ptr, sizeof *(ptr))
436#define sync_cache_r(ptr) __sync_cache_range_r(ptr, sizeof *(ptr)) 436#define sync_cache_r(ptr) __sync_cache_range_r(ptr, sizeof *(ptr))
437 437
438/*
439 * Disabling cache access for one CPU in an ARMv7 SMP system is tricky.
440 * To do so we must:
441 *
442 * - Clear the SCTLR.C bit to prevent further cache allocations
443 * - Flush the desired level of cache
444 * - Clear the ACTLR "SMP" bit to disable local coherency
445 *
446 * ... and so without any intervening memory access in between those steps,
447 * not even to the stack.
448 *
449 * WARNING -- After this has been called:
450 *
451 * - No ldrex/strex (and similar) instructions must be used.
452 * - The CPU is obviously no longer coherent with the other CPUs.
453 * - This is unlikely to work as expected if Linux is running non-secure.
454 *
455 * Note:
456 *
457 * - This is known to apply to several ARMv7 processor implementations,
458 * however some exceptions may exist. Caveat emptor.
459 *
460 * - The clobber list is dictated by the call to v7_flush_dcache_*.
461 * fp is preserved to the stack explicitly prior disabling the cache
462 * since adding it to the clobber list is incompatible with having
463 * CONFIG_FRAME_POINTER=y. ip is saved as well if ever r12-clobbering
464 * trampoline are inserted by the linker and to keep sp 64-bit aligned.
465 */
466#define v7_exit_coherency_flush(level) \
467 asm volatile( \
468 "stmfd sp!, {fp, ip} \n\t" \
469 "mrc p15, 0, r0, c1, c0, 0 @ get SCTLR \n\t" \
470 "bic r0, r0, #"__stringify(CR_C)" \n\t" \
471 "mcr p15, 0, r0, c1, c0, 0 @ set SCTLR \n\t" \
472 "isb \n\t" \
473 "bl v7_flush_dcache_"__stringify(level)" \n\t" \
474 "clrex \n\t" \
475 "mrc p15, 0, r0, c1, c0, 1 @ get ACTLR \n\t" \
476 "bic r0, r0, #(1 << 6) @ disable local coherency \n\t" \
477 "mcr p15, 0, r0, c1, c0, 1 @ set ACTLR \n\t" \
478 "isb \n\t" \
479 "dsb \n\t" \
480 "ldmfd sp!, {fp, ip}" \
481 : : : "r0","r1","r2","r3","r4","r5","r6","r7", \
482 "r9","r10","lr","memory" )
483
438#endif 484#endif
diff --git a/arch/arm/include/asm/cmpxchg.h b/arch/arm/include/asm/cmpxchg.h
index 4f009c10540d..df2fbba7efc8 100644
--- a/arch/arm/include/asm/cmpxchg.h
+++ b/arch/arm/include/asm/cmpxchg.h
@@ -223,6 +223,42 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
223 return ret; 223 return ret;
224} 224}
225 225
226static inline unsigned long long __cmpxchg64(unsigned long long *ptr,
227 unsigned long long old,
228 unsigned long long new)
229{
230 unsigned long long oldval;
231 unsigned long res;
232
233 __asm__ __volatile__(
234"1: ldrexd %1, %H1, [%3]\n"
235" teq %1, %4\n"
236" teqeq %H1, %H4\n"
237" bne 2f\n"
238" strexd %0, %5, %H5, [%3]\n"
239" teq %0, #0\n"
240" bne 1b\n"
241"2:"
242 : "=&r" (res), "=&r" (oldval), "+Qo" (*ptr)
243 : "r" (ptr), "r" (old), "r" (new)
244 : "cc");
245
246 return oldval;
247}
248
249static inline unsigned long long __cmpxchg64_mb(unsigned long long *ptr,
250 unsigned long long old,
251 unsigned long long new)
252{
253 unsigned long long ret;
254
255 smp_mb();
256 ret = __cmpxchg64(ptr, old, new);
257 smp_mb();
258
259 return ret;
260}
261
226#define cmpxchg_local(ptr,o,n) \ 262#define cmpxchg_local(ptr,o,n) \
227 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), \ 263 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), \
228 (unsigned long)(o), \ 264 (unsigned long)(o), \
@@ -230,18 +266,16 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
230 sizeof(*(ptr)))) 266 sizeof(*(ptr))))
231 267
232#define cmpxchg64(ptr, o, n) \ 268#define cmpxchg64(ptr, o, n) \
233 ((__typeof__(*(ptr)))atomic64_cmpxchg(container_of((ptr), \ 269 ((__typeof__(*(ptr)))__cmpxchg64_mb((ptr), \
234 atomic64_t, \ 270 (unsigned long long)(o), \
235 counter), \ 271 (unsigned long long)(n)))
236 (unsigned long long)(o), \ 272
237 (unsigned long long)(n))) 273#define cmpxchg64_relaxed(ptr, o, n) \
238 274 ((__typeof__(*(ptr)))__cmpxchg64((ptr), \
239#define cmpxchg64_local(ptr, o, n) \ 275 (unsigned long long)(o), \
240 ((__typeof__(*(ptr)))local64_cmpxchg(container_of((ptr), \ 276 (unsigned long long)(n)))
241 local64_t, \ 277
242 a), \ 278#define cmpxchg64_local(ptr, o, n) cmpxchg64_relaxed((ptr), (o), (n))
243 (unsigned long long)(o), \
244 (unsigned long long)(n)))
245 279
246#endif /* __LINUX_ARM_ARCH__ >= 6 */ 280#endif /* __LINUX_ARM_ARCH__ >= 6 */
247 281
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index 9672e978d50d..acdde76b39bb 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -10,6 +10,7 @@
10#define CPUID_TLBTYPE 3 10#define CPUID_TLBTYPE 3
11#define CPUID_MPUIR 4 11#define CPUID_MPUIR 4
12#define CPUID_MPIDR 5 12#define CPUID_MPIDR 5
13#define CPUID_REVIDR 6
13 14
14#ifdef CONFIG_CPU_V7M 15#ifdef CONFIG_CPU_V7M
15#define CPUID_EXT_PFR0 0x40 16#define CPUID_EXT_PFR0 0x40
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 5b579b951503..e701a4d9aa59 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -11,17 +11,28 @@
11#include <asm-generic/dma-coherent.h> 11#include <asm-generic/dma-coherent.h>
12#include <asm/memory.h> 12#include <asm/memory.h>
13 13
14#include <xen/xen.h>
15#include <asm/xen/hypervisor.h>
16
14#define DMA_ERROR_CODE (~0) 17#define DMA_ERROR_CODE (~0)
15extern struct dma_map_ops arm_dma_ops; 18extern struct dma_map_ops arm_dma_ops;
16extern struct dma_map_ops arm_coherent_dma_ops; 19extern struct dma_map_ops arm_coherent_dma_ops;
17 20
18static inline struct dma_map_ops *get_dma_ops(struct device *dev) 21static inline struct dma_map_ops *__generic_dma_ops(struct device *dev)
19{ 22{
20 if (dev && dev->archdata.dma_ops) 23 if (dev && dev->archdata.dma_ops)
21 return dev->archdata.dma_ops; 24 return dev->archdata.dma_ops;
22 return &arm_dma_ops; 25 return &arm_dma_ops;
23} 26}
24 27
28static inline struct dma_map_ops *get_dma_ops(struct device *dev)
29{
30 if (xen_initial_domain())
31 return xen_dma_ops;
32 else
33 return __generic_dma_ops(dev);
34}
35
25static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops) 36static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
26{ 37{
27 BUG_ON(!dev); 38 BUG_ON(!dev);
@@ -64,6 +75,7 @@ static inline dma_addr_t virt_to_dma(struct device *dev, void *addr)
64{ 75{
65 return (dma_addr_t)__virt_to_bus((unsigned long)(addr)); 76 return (dma_addr_t)__virt_to_bus((unsigned long)(addr));
66} 77}
78
67#else 79#else
68static inline dma_addr_t pfn_to_dma(struct device *dev, unsigned long pfn) 80static inline dma_addr_t pfn_to_dma(struct device *dev, unsigned long pfn)
69{ 81{
@@ -86,6 +98,46 @@ static inline dma_addr_t virt_to_dma(struct device *dev, void *addr)
86} 98}
87#endif 99#endif
88 100
101/* The ARM override for dma_max_pfn() */
102static inline unsigned long dma_max_pfn(struct device *dev)
103{
104 return PHYS_PFN_OFFSET + dma_to_pfn(dev, *dev->dma_mask);
105}
106#define dma_max_pfn(dev) dma_max_pfn(dev)
107
108static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
109{
110 unsigned int offset = paddr & ~PAGE_MASK;
111 return pfn_to_dma(dev, __phys_to_pfn(paddr)) + offset;
112}
113
114static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dev_addr)
115{
116 unsigned int offset = dev_addr & ~PAGE_MASK;
117 return __pfn_to_phys(dma_to_pfn(dev, dev_addr)) + offset;
118}
119
120static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
121{
122 u64 limit, mask;
123
124 if (!dev->dma_mask)
125 return 0;
126
127 mask = *dev->dma_mask;
128
129 limit = (mask + 1) & ~mask;
130 if (limit && size > limit)
131 return 0;
132
133 if ((addr | (addr + size - 1)) & ~mask)
134 return 0;
135
136 return 1;
137}
138
139static inline void dma_mark_clean(void *addr, size_t size) { }
140
89/* 141/*
90 * DMA errors are defined by all-bits-set in the DMA address. 142 * DMA errors are defined by all-bits-set in the DMA address.
91 */ 143 */
diff --git a/arch/arm/include/asm/hardirq.h b/arch/arm/include/asm/hardirq.h
index 2740c2a2df63..fe3ea776dc34 100644
--- a/arch/arm/include/asm/hardirq.h
+++ b/arch/arm/include/asm/hardirq.h
@@ -5,7 +5,7 @@
5#include <linux/threads.h> 5#include <linux/threads.h>
6#include <asm/irq.h> 6#include <asm/irq.h>
7 7
8#define NR_IPI 6 8#define NR_IPI 8
9 9
10typedef struct { 10typedef struct {
11 unsigned int __softirq_pending; 11 unsigned int __softirq_pending;
diff --git a/arch/arm/include/asm/hardware/coresight.h b/arch/arm/include/asm/hardware/coresight.h
index 0cf7a6b842ff..ad774f37c47c 100644
--- a/arch/arm/include/asm/hardware/coresight.h
+++ b/arch/arm/include/asm/hardware/coresight.h
@@ -24,8 +24,8 @@
24#define TRACER_TIMEOUT 10000 24#define TRACER_TIMEOUT 10000
25 25
26#define etm_writel(t, v, x) \ 26#define etm_writel(t, v, x) \
27 (__raw_writel((v), (t)->etm_regs + (x))) 27 (writel_relaxed((v), (t)->etm_regs + (x)))
28#define etm_readl(t, x) (__raw_readl((t)->etm_regs + (x))) 28#define etm_readl(t, x) (readl_relaxed((t)->etm_regs + (x)))
29 29
30/* CoreSight Management Registers */ 30/* CoreSight Management Registers */
31#define CSMR_LOCKACCESS 0xfb0 31#define CSMR_LOCKACCESS 0xfb0
@@ -142,8 +142,8 @@
142#define ETBFF_TRIGFL BIT(10) 142#define ETBFF_TRIGFL BIT(10)
143 143
144#define etb_writel(t, v, x) \ 144#define etb_writel(t, v, x) \
145 (__raw_writel((v), (t)->etb_regs + (x))) 145 (writel_relaxed((v), (t)->etb_regs + (x)))
146#define etb_readl(t, x) (__raw_readl((t)->etb_regs + (x))) 146#define etb_readl(t, x) (readl_relaxed((t)->etb_regs + (x)))
147 147
148#define etm_lock(t) do { etm_writel((t), 0, CSMR_LOCKACCESS); } while (0) 148#define etm_lock(t) do { etm_writel((t), 0, CSMR_LOCKACCESS); } while (0)
149#define etm_unlock(t) \ 149#define etm_unlock(t) \
diff --git a/arch/arm/include/asm/hardware/iop3xx-gpio.h b/arch/arm/include/asm/hardware/iop3xx-gpio.h
deleted file mode 100644
index 9eda7dc92ad8..000000000000
--- a/arch/arm/include/asm/hardware/iop3xx-gpio.h
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * arch/arm/include/asm/hardware/iop3xx-gpio.h
3 *
4 * IOP3xx GPIO wrappers
5 *
6 * Copyright (c) 2008 Arnaud Patard <arnaud.patard@rtp-net.org>
7 * Based on IXP4XX gpio.h file
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#ifndef __ASM_ARM_HARDWARE_IOP3XX_GPIO_H
26#define __ASM_ARM_HARDWARE_IOP3XX_GPIO_H
27
28#include <mach/hardware.h>
29#include <asm-generic/gpio.h>
30
31#define __ARM_GPIOLIB_COMPLEX
32
33#define IOP3XX_N_GPIOS 8
34
35static inline int gpio_get_value(unsigned gpio)
36{
37 if (gpio > IOP3XX_N_GPIOS)
38 return __gpio_get_value(gpio);
39
40 return gpio_line_get(gpio);
41}
42
43static inline void gpio_set_value(unsigned gpio, int value)
44{
45 if (gpio > IOP3XX_N_GPIOS) {
46 __gpio_set_value(gpio, value);
47 return;
48 }
49 gpio_line_set(gpio, value);
50}
51
52static inline int gpio_cansleep(unsigned gpio)
53{
54 if (gpio < IOP3XX_N_GPIOS)
55 return 0;
56 else
57 return __gpio_cansleep(gpio);
58}
59
60/*
61 * The GPIOs are not generating any interrupt
62 * Note : manuals are not clear about this
63 */
64static inline int gpio_to_irq(int gpio)
65{
66 return -EINVAL;
67}
68
69static inline int irq_to_gpio(int gpio)
70{
71 return -EINVAL;
72}
73
74#endif
75
diff --git a/arch/arm/include/asm/hardware/iop3xx.h b/arch/arm/include/asm/hardware/iop3xx.h
index 423744bf18eb..2594a95ff19a 100644
--- a/arch/arm/include/asm/hardware/iop3xx.h
+++ b/arch/arm/include/asm/hardware/iop3xx.h
@@ -18,16 +18,9 @@
18/* 18/*
19 * IOP3XX GPIO handling 19 * IOP3XX GPIO handling
20 */ 20 */
21#define GPIO_IN 0
22#define GPIO_OUT 1
23#define GPIO_LOW 0
24#define GPIO_HIGH 1
25#define IOP3XX_GPIO_LINE(x) (x) 21#define IOP3XX_GPIO_LINE(x) (x)
26 22
27#ifndef __ASSEMBLY__ 23#ifndef __ASSEMBLY__
28extern void gpio_line_config(int line, int direction);
29extern int gpio_line_get(int line);
30extern void gpio_line_set(int line, int value);
31extern int init_atu; 24extern int init_atu;
32extern int iop3xx_get_init_atu(void); 25extern int iop3xx_get_init_atu(void);
33#endif 26#endif
@@ -168,11 +161,6 @@ extern int iop3xx_get_init_atu(void);
168/* PERCR0 DOESN'T EXIST - index from 1! */ 161/* PERCR0 DOESN'T EXIST - index from 1! */
169#define IOP3XX_PERCR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0710) 162#define IOP3XX_PERCR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0710)
170 163
171/* General Purpose I/O */
172#define IOP3XX_GPOE (volatile u32 *)IOP3XX_GPIO_REG(0x0000)
173#define IOP3XX_GPID (volatile u32 *)IOP3XX_GPIO_REG(0x0004)
174#define IOP3XX_GPOD (volatile u32 *)IOP3XX_GPIO_REG(0x0008)
175
176/* Timers */ 164/* Timers */
177#define IOP3XX_TU_TMR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0000) 165#define IOP3XX_TU_TMR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0000)
178#define IOP3XX_TU_TMR1 (volatile u32 *)IOP3XX_TIMER_REG(0x0004) 166#define IOP3XX_TU_TMR1 (volatile u32 *)IOP3XX_TIMER_REG(0x0004)
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index d070741b2b37..3c597c222ef2 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -24,9 +24,11 @@
24#ifdef __KERNEL__ 24#ifdef __KERNEL__
25 25
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/blk_types.h>
27#include <asm/byteorder.h> 28#include <asm/byteorder.h>
28#include <asm/memory.h> 29#include <asm/memory.h>
29#include <asm-generic/pci_iomap.h> 30#include <asm-generic/pci_iomap.h>
31#include <xen/xen.h>
30 32
31/* 33/*
32 * ISA I/O bus memory addresses are 1:1 with the physical address. 34 * ISA I/O bus memory addresses are 1:1 with the physical address.
@@ -372,6 +374,13 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
372#define BIOVEC_MERGEABLE(vec1, vec2) \ 374#define BIOVEC_MERGEABLE(vec1, vec2) \
373 ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2))) 375 ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2)))
374 376
377struct bio_vec;
378extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
379 const struct bio_vec *vec2);
380#define BIOVEC_PHYS_MERGEABLE(vec1, vec2) \
381 (__BIOVEC_PHYS_MERGEABLE(vec1, vec2) && \
382 (!xen_domain() || xen_biovec_phys_mergeable(vec1, vec2)))
383
375#ifdef CONFIG_MMU 384#ifdef CONFIG_MMU
376#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 385#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
377extern int valid_phys_addr_range(phys_addr_t addr, size_t size); 386extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
diff --git a/arch/arm/include/asm/jump_label.h b/arch/arm/include/asm/jump_label.h
index bfc198c75913..863c892b4aaa 100644
--- a/arch/arm/include/asm/jump_label.h
+++ b/arch/arm/include/asm/jump_label.h
@@ -16,7 +16,7 @@
16 16
17static __always_inline bool arch_static_branch(struct static_key *key) 17static __always_inline bool arch_static_branch(struct static_key *key)
18{ 18{
19 asm goto("1:\n\t" 19 asm_volatile_goto("1:\n\t"
20 JUMP_LABEL_NOP "\n\t" 20 JUMP_LABEL_NOP "\n\t"
21 ".pushsection __jump_table, \"aw\"\n\t" 21 ".pushsection __jump_table, \"aw\"\n\t"
22 ".word 1b, %l[l_yes], %c0\n\t" 22 ".word 1b, %l[l_yes], %c0\n\t"
diff --git a/arch/arm/include/asm/kgdb.h b/arch/arm/include/asm/kgdb.h
index 48066ce9ea34..0a9d5dd93294 100644
--- a/arch/arm/include/asm/kgdb.h
+++ b/arch/arm/include/asm/kgdb.h
@@ -11,6 +11,7 @@
11#define __ARM_KGDB_H__ 11#define __ARM_KGDB_H__
12 12
13#include <linux/ptrace.h> 13#include <linux/ptrace.h>
14#include <asm/opcodes.h>
14 15
15/* 16/*
16 * GDB assumes that we're a user process being debugged, so 17 * GDB assumes that we're a user process being debugged, so
@@ -41,7 +42,7 @@
41 42
42static inline void arch_kgdb_breakpoint(void) 43static inline void arch_kgdb_breakpoint(void)
43{ 44{
44 asm(".word 0xe7ffdeff"); 45 asm(__inst_arm(0xe7ffdeff));
45} 46}
46 47
47extern void kgdb_handle_bus_error(void); 48extern void kgdb_handle_bus_error(void);
diff --git a/arch/arm/include/asm/kvm_arm.h b/arch/arm/include/asm/kvm_arm.h
index 64e96960de29..1d3153c7eb41 100644
--- a/arch/arm/include/asm/kvm_arm.h
+++ b/arch/arm/include/asm/kvm_arm.h
@@ -57,6 +57,7 @@
57 * TSC: Trap SMC 57 * TSC: Trap SMC
58 * TSW: Trap cache operations by set/way 58 * TSW: Trap cache operations by set/way
59 * TWI: Trap WFI 59 * TWI: Trap WFI
60 * TWE: Trap WFE
60 * TIDCP: Trap L2CTLR/L2ECTLR 61 * TIDCP: Trap L2CTLR/L2ECTLR
61 * BSU_IS: Upgrade barriers to the inner shareable domain 62 * BSU_IS: Upgrade barriers to the inner shareable domain
62 * FB: Force broadcast of all maintainance operations 63 * FB: Force broadcast of all maintainance operations
@@ -67,7 +68,7 @@
67 */ 68 */
68#define HCR_GUEST_MASK (HCR_TSC | HCR_TSW | HCR_TWI | HCR_VM | HCR_BSU_IS | \ 69#define HCR_GUEST_MASK (HCR_TSC | HCR_TSW | HCR_TWI | HCR_VM | HCR_BSU_IS | \
69 HCR_FB | HCR_TAC | HCR_AMO | HCR_IMO | HCR_FMO | \ 70 HCR_FB | HCR_TAC | HCR_AMO | HCR_IMO | HCR_FMO | \
70 HCR_SWIO | HCR_TIDCP) 71 HCR_TWE | HCR_SWIO | HCR_TIDCP)
71#define HCR_VIRT_EXCP_MASK (HCR_VA | HCR_VI | HCR_VF) 72#define HCR_VIRT_EXCP_MASK (HCR_VA | HCR_VI | HCR_VF)
72 73
73/* System Control Register (SCTLR) bits */ 74/* System Control Register (SCTLR) bits */
@@ -95,12 +96,12 @@
95#define TTBCR_IRGN1 (3 << 24) 96#define TTBCR_IRGN1 (3 << 24)
96#define TTBCR_EPD1 (1 << 23) 97#define TTBCR_EPD1 (1 << 23)
97#define TTBCR_A1 (1 << 22) 98#define TTBCR_A1 (1 << 22)
98#define TTBCR_T1SZ (3 << 16) 99#define TTBCR_T1SZ (7 << 16)
99#define TTBCR_SH0 (3 << 12) 100#define TTBCR_SH0 (3 << 12)
100#define TTBCR_ORGN0 (3 << 10) 101#define TTBCR_ORGN0 (3 << 10)
101#define TTBCR_IRGN0 (3 << 8) 102#define TTBCR_IRGN0 (3 << 8)
102#define TTBCR_EPD0 (1 << 7) 103#define TTBCR_EPD0 (1 << 7)
103#define TTBCR_T0SZ 3 104#define TTBCR_T0SZ (7 << 0)
104#define HTCR_MASK (TTBCR_T0SZ | TTBCR_IRGN0 | TTBCR_ORGN0 | TTBCR_SH0) 105#define HTCR_MASK (TTBCR_T0SZ | TTBCR_IRGN0 | TTBCR_ORGN0 | TTBCR_SH0)
105 106
106/* Hyp System Trap Register */ 107/* Hyp System Trap Register */
@@ -208,6 +209,8 @@
208#define HSR_EC_DABT (0x24) 209#define HSR_EC_DABT (0x24)
209#define HSR_EC_DABT_HYP (0x25) 210#define HSR_EC_DABT_HYP (0x25)
210 211
212#define HSR_WFI_IS_WFE (1U << 0)
213
211#define HSR_HVC_IMM_MASK ((1UL << 16) - 1) 214#define HSR_HVC_IMM_MASK ((1UL << 16) - 1)
212 215
213#define HSR_DABT_S1PTW (1U << 7) 216#define HSR_DABT_S1PTW (1U << 7)
diff --git a/arch/arm/include/asm/kvm_asm.h b/arch/arm/include/asm/kvm_asm.h
index a2f43ddcc300..661da11f76f4 100644
--- a/arch/arm/include/asm/kvm_asm.h
+++ b/arch/arm/include/asm/kvm_asm.h
@@ -39,7 +39,7 @@
39#define c6_IFAR 17 /* Instruction Fault Address Register */ 39#define c6_IFAR 17 /* Instruction Fault Address Register */
40#define c7_PAR 18 /* Physical Address Register */ 40#define c7_PAR 18 /* Physical Address Register */
41#define c7_PAR_high 19 /* PAR top 32 bits */ 41#define c7_PAR_high 19 /* PAR top 32 bits */
42#define c9_L2CTLR 20 /* Cortex A15 L2 Control Register */ 42#define c9_L2CTLR 20 /* Cortex A15/A7 L2 Control Register */
43#define c10_PRRR 21 /* Primary Region Remap Register */ 43#define c10_PRRR 21 /* Primary Region Remap Register */
44#define c10_NMRR 22 /* Normal Memory Remap Register */ 44#define c10_NMRR 22 /* Normal Memory Remap Register */
45#define c12_VBAR 23 /* Vector Base Address Register */ 45#define c12_VBAR 23 /* Vector Base Address Register */
diff --git a/arch/arm/include/asm/kvm_emulate.h b/arch/arm/include/asm/kvm_emulate.h
index a464e8d7b6c5..0fa90c962ac8 100644
--- a/arch/arm/include/asm/kvm_emulate.h
+++ b/arch/arm/include/asm/kvm_emulate.h
@@ -157,4 +157,55 @@ static inline u32 kvm_vcpu_hvc_get_imm(struct kvm_vcpu *vcpu)
157 return kvm_vcpu_get_hsr(vcpu) & HSR_HVC_IMM_MASK; 157 return kvm_vcpu_get_hsr(vcpu) & HSR_HVC_IMM_MASK;
158} 158}
159 159
160static inline unsigned long kvm_vcpu_get_mpidr(struct kvm_vcpu *vcpu)
161{
162 return vcpu->arch.cp15[c0_MPIDR];
163}
164
165static inline void kvm_vcpu_set_be(struct kvm_vcpu *vcpu)
166{
167 *vcpu_cpsr(vcpu) |= PSR_E_BIT;
168}
169
170static inline bool kvm_vcpu_is_be(struct kvm_vcpu *vcpu)
171{
172 return !!(*vcpu_cpsr(vcpu) & PSR_E_BIT);
173}
174
175static inline unsigned long vcpu_data_guest_to_host(struct kvm_vcpu *vcpu,
176 unsigned long data,
177 unsigned int len)
178{
179 if (kvm_vcpu_is_be(vcpu)) {
180 switch (len) {
181 case 1:
182 return data & 0xff;
183 case 2:
184 return be16_to_cpu(data & 0xffff);
185 default:
186 return be32_to_cpu(data);
187 }
188 }
189
190 return data; /* Leave LE untouched */
191}
192
193static inline unsigned long vcpu_data_host_to_guest(struct kvm_vcpu *vcpu,
194 unsigned long data,
195 unsigned int len)
196{
197 if (kvm_vcpu_is_be(vcpu)) {
198 switch (len) {
199 case 1:
200 return data & 0xff;
201 case 2:
202 return cpu_to_be16(data & 0xffff);
203 default:
204 return cpu_to_be32(data);
205 }
206 }
207
208 return data; /* Leave LE untouched */
209}
210
160#endif /* __ARM_KVM_EMULATE_H__ */ 211#endif /* __ARM_KVM_EMULATE_H__ */
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index 7d22517d8071..8a6f6db14ee4 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -38,11 +38,6 @@
38 38
39#define KVM_VCPU_MAX_FEATURES 1 39#define KVM_VCPU_MAX_FEATURES 1
40 40
41/* We don't currently support large pages. */
42#define KVM_HPAGE_GFN_SHIFT(x) 0
43#define KVM_NR_PAGE_SIZES 1
44#define KVM_PAGES_PER_HPAGE(x) (1UL<<31)
45
46#include <kvm/arm_vgic.h> 41#include <kvm/arm_vgic.h>
47 42
48struct kvm_vcpu; 43struct kvm_vcpu;
@@ -154,6 +149,7 @@ struct kvm_vcpu_stat {
154struct kvm_vcpu_init; 149struct kvm_vcpu_init;
155int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, 150int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
156 const struct kvm_vcpu_init *init); 151 const struct kvm_vcpu_init *init);
152int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init);
157unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu); 153unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
158int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices); 154int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
159struct kvm_one_reg; 155struct kvm_one_reg;
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h
index 9b28c41f4ba9..77de4a41cc50 100644
--- a/arch/arm/include/asm/kvm_mmu.h
+++ b/arch/arm/include/asm/kvm_mmu.h
@@ -62,6 +62,12 @@ phys_addr_t kvm_get_idmap_vector(void);
62int kvm_mmu_init(void); 62int kvm_mmu_init(void);
63void kvm_clear_hyp_idmap(void); 63void kvm_clear_hyp_idmap(void);
64 64
65static inline void kvm_set_pmd(pmd_t *pmd, pmd_t new_pmd)
66{
67 *pmd = new_pmd;
68 flush_pmd_entry(pmd);
69}
70
65static inline void kvm_set_pte(pte_t *pte, pte_t new_pte) 71static inline void kvm_set_pte(pte_t *pte, pte_t new_pte)
66{ 72{
67 *pte = new_pte; 73 *pte = new_pte;
@@ -103,9 +109,15 @@ static inline void kvm_set_s2pte_writable(pte_t *pte)
103 pte_val(*pte) |= L_PTE_S2_RDWR; 109 pte_val(*pte) |= L_PTE_S2_RDWR;
104} 110}
105 111
112static inline void kvm_set_s2pmd_writable(pmd_t *pmd)
113{
114 pmd_val(*pmd) |= L_PMD_S2_RDWR;
115}
116
106struct kvm; 117struct kvm;
107 118
108static inline void coherent_icache_guest_page(struct kvm *kvm, gfn_t gfn) 119static inline void coherent_icache_guest_page(struct kvm *kvm, hva_t hva,
120 unsigned long size)
109{ 121{
110 /* 122 /*
111 * If we are going to insert an instruction page and the icache is 123 * If we are going to insert an instruction page and the icache is
@@ -120,8 +132,7 @@ static inline void coherent_icache_guest_page(struct kvm *kvm, gfn_t gfn)
120 * need any kind of flushing (DDI 0406C.b - Page B3-1392). 132 * need any kind of flushing (DDI 0406C.b - Page B3-1392).
121 */ 133 */
122 if (icache_is_pipt()) { 134 if (icache_is_pipt()) {
123 unsigned long hva = gfn_to_hva(kvm, gfn); 135 __cpuc_coherent_user_range(hva, hva + size);
124 __cpuc_coherent_user_range(hva, hva + PAGE_SIZE);
125 } else if (!icache_is_vivt_asid_tagged()) { 136 } else if (!icache_is_vivt_asid_tagged()) {
126 /* any kind of VIPT cache */ 137 /* any kind of VIPT cache */
127 __flush_icache_all(); 138 __flush_icache_all();
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index 402a2bc6aa68..17a3fa2979e8 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -49,6 +49,7 @@ struct machine_desc {
49 bool (*smp_init)(void); 49 bool (*smp_init)(void);
50 void (*fixup)(struct tag *, char **, 50 void (*fixup)(struct tag *, char **,
51 struct meminfo *); 51 struct meminfo *);
52 void (*init_meminfo)(void);
52 void (*reserve)(void);/* reserve mem blocks */ 53 void (*reserve)(void);/* reserve mem blocks */
53 void (*map_io)(void);/* IO mapping function */ 54 void (*map_io)(void);/* IO mapping function */
54 void (*init_early)(void); 55 void (*init_early)(void);
diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h
index 454d642a4070..7fc42784becb 100644
--- a/arch/arm/include/asm/mach/pci.h
+++ b/arch/arm/include/asm/mach/pci.h
@@ -106,8 +106,4 @@ extern int dc21285_setup(int nr, struct pci_sys_data *);
106extern void dc21285_preinit(void); 106extern void dc21285_preinit(void);
107extern void dc21285_postinit(void); 107extern void dc21285_postinit(void);
108 108
109extern struct pci_ops via82c505_ops;
110extern int via82c505_setup(int nr, struct pci_sys_data *);
111extern void via82c505_init(void *sysdata);
112
113#endif /* __ASM_MACH_PCI_H */ 109#endif /* __ASM_MACH_PCI_H */
diff --git a/arch/arm/include/asm/mcpm.h b/arch/arm/include/asm/mcpm.h
index 0f7b7620e9a5..608516ebabfe 100644
--- a/arch/arm/include/asm/mcpm.h
+++ b/arch/arm/include/asm/mcpm.h
@@ -42,6 +42,14 @@ extern void mcpm_entry_point(void);
42void mcpm_set_entry_vector(unsigned cpu, unsigned cluster, void *ptr); 42void mcpm_set_entry_vector(unsigned cpu, unsigned cluster, void *ptr);
43 43
44/* 44/*
45 * This sets an early poke i.e a value to be poked into some address
46 * from very early assembly code before the CPU is ungated. The
47 * address must be physical, and if 0 then nothing will happen.
48 */
49void mcpm_set_early_poke(unsigned cpu, unsigned cluster,
50 unsigned long poke_phys_addr, unsigned long poke_val);
51
52/*
45 * CPU/cluster power operations API for higher subsystems to use. 53 * CPU/cluster power operations API for higher subsystems to use.
46 */ 54 */
47 55
@@ -76,12 +84,45 @@ int mcpm_cpu_power_up(unsigned int cpu, unsigned int cluster);
76 * 84 *
77 * This must be called with interrupts disabled. 85 * This must be called with interrupts disabled.
78 * 86 *
79 * This does not return. Re-entry in the kernel is expected via 87 * On success this does not return. Re-entry in the kernel is expected
80 * mcpm_entry_point. 88 * via mcpm_entry_point.
89 *
90 * This will return if mcpm_platform_register() has not been called
91 * previously in which case the caller should take appropriate action.
92 *
93 * On success, the CPU is not guaranteed to be truly halted until
94 * mcpm_cpu_power_down_finish() subsequently returns non-zero for the
95 * specified cpu. Until then, other CPUs should make sure they do not
96 * trash memory the target CPU might be executing/accessing.
81 */ 97 */
82void mcpm_cpu_power_down(void); 98void mcpm_cpu_power_down(void);
83 99
84/** 100/**
101 * mcpm_cpu_power_down_finish - wait for a specified CPU to halt, and
102 * make sure it is powered off
103 *
104 * @cpu: CPU number within given cluster
105 * @cluster: cluster number for the CPU
106 *
107 * Call this function to ensure that a pending powerdown has taken
108 * effect and the CPU is safely parked before performing non-mcpm
109 * operations that may affect the CPU (such as kexec trashing the
110 * kernel text).
111 *
112 * It is *not* necessary to call this function if you only need to
113 * serialise a pending powerdown with mcpm_cpu_power_up() or a wakeup
114 * event.
115 *
116 * Do not call this function unless the specified CPU has already
117 * called mcpm_cpu_power_down() or has committed to doing so.
118 *
119 * @return:
120 * - zero if the CPU is in a safely parked state
121 * - nonzero otherwise (e.g., timeout)
122 */
123int mcpm_cpu_power_down_finish(unsigned int cpu, unsigned int cluster);
124
125/**
85 * mcpm_cpu_suspend - bring the calling CPU in a suspended state 126 * mcpm_cpu_suspend - bring the calling CPU in a suspended state
86 * 127 *
87 * @expected_residency: duration in microseconds the CPU is expected 128 * @expected_residency: duration in microseconds the CPU is expected
@@ -98,8 +139,11 @@ void mcpm_cpu_power_down(void);
98 * 139 *
99 * This must be called with interrupts disabled. 140 * This must be called with interrupts disabled.
100 * 141 *
101 * This does not return. Re-entry in the kernel is expected via 142 * On success this does not return. Re-entry in the kernel is expected
102 * mcpm_entry_point. 143 * via mcpm_entry_point.
144 *
145 * This will return if mcpm_platform_register() has not been called
146 * previously in which case the caller should take appropriate action.
103 */ 147 */
104void mcpm_cpu_suspend(u64 expected_residency); 148void mcpm_cpu_suspend(u64 expected_residency);
105 149
@@ -120,6 +164,7 @@ int mcpm_cpu_powered_up(void);
120struct mcpm_platform_ops { 164struct mcpm_platform_ops {
121 int (*power_up)(unsigned int cpu, unsigned int cluster); 165 int (*power_up)(unsigned int cpu, unsigned int cluster);
122 void (*power_down)(void); 166 void (*power_down)(void);
167 int (*power_down_finish)(unsigned int cpu, unsigned int cluster);
123 void (*suspend)(u64); 168 void (*suspend)(u64);
124 void (*powered_up)(void); 169 void (*powered_up)(void);
125}; 170};
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index e750a938fd3c..4dd21457ef9d 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -172,8 +172,13 @@
172 * so that all we need to do is modify the 8-bit constant field. 172 * so that all we need to do is modify the 8-bit constant field.
173 */ 173 */
174#define __PV_BITS_31_24 0x81000000 174#define __PV_BITS_31_24 0x81000000
175#define __PV_BITS_7_0 0x81
176
177extern u64 __pv_phys_offset;
178extern u64 __pv_offset;
179extern void fixup_pv_table(const void *, unsigned long);
180extern const void *__pv_table_begin, *__pv_table_end;
175 181
176extern unsigned long __pv_phys_offset;
177#define PHYS_OFFSET __pv_phys_offset 182#define PHYS_OFFSET __pv_phys_offset
178 183
179#define __pv_stub(from,to,instr,type) \ 184#define __pv_stub(from,to,instr,type) \
@@ -185,22 +190,58 @@ extern unsigned long __pv_phys_offset;
185 : "=r" (to) \ 190 : "=r" (to) \
186 : "r" (from), "I" (type)) 191 : "r" (from), "I" (type))
187 192
188static inline unsigned long __virt_to_phys(unsigned long x) 193#define __pv_stub_mov_hi(t) \
194 __asm__ volatile("@ __pv_stub_mov\n" \
195 "1: mov %R0, %1\n" \
196 " .pushsection .pv_table,\"a\"\n" \
197 " .long 1b\n" \
198 " .popsection\n" \
199 : "=r" (t) \
200 : "I" (__PV_BITS_7_0))
201
202#define __pv_add_carry_stub(x, y) \
203 __asm__ volatile("@ __pv_add_carry_stub\n" \
204 "1: adds %Q0, %1, %2\n" \
205 " adc %R0, %R0, #0\n" \
206 " .pushsection .pv_table,\"a\"\n" \
207 " .long 1b\n" \
208 " .popsection\n" \
209 : "+r" (y) \
210 : "r" (x), "I" (__PV_BITS_31_24) \
211 : "cc")
212
213static inline phys_addr_t __virt_to_phys(unsigned long x)
189{ 214{
190 unsigned long t; 215 phys_addr_t t;
191 __pv_stub(x, t, "add", __PV_BITS_31_24); 216
217 if (sizeof(phys_addr_t) == 4) {
218 __pv_stub(x, t, "add", __PV_BITS_31_24);
219 } else {
220 __pv_stub_mov_hi(t);
221 __pv_add_carry_stub(x, t);
222 }
192 return t; 223 return t;
193} 224}
194 225
195static inline unsigned long __phys_to_virt(unsigned long x) 226static inline unsigned long __phys_to_virt(phys_addr_t x)
196{ 227{
197 unsigned long t; 228 unsigned long t;
198 __pv_stub(x, t, "sub", __PV_BITS_31_24); 229 __pv_stub(x, t, "sub", __PV_BITS_31_24);
199 return t; 230 return t;
200} 231}
232
201#else 233#else
202#define __virt_to_phys(x) ((x) - PAGE_OFFSET + PHYS_OFFSET) 234
203#define __phys_to_virt(x) ((x) - PHYS_OFFSET + PAGE_OFFSET) 235static inline phys_addr_t __virt_to_phys(unsigned long x)
236{
237 return (phys_addr_t)x - PAGE_OFFSET + PHYS_OFFSET;
238}
239
240static inline unsigned long __phys_to_virt(phys_addr_t x)
241{
242 return x - PHYS_OFFSET + PAGE_OFFSET;
243}
244
204#endif 245#endif
205#endif 246#endif
206#endif /* __ASSEMBLY__ */ 247#endif /* __ASSEMBLY__ */
@@ -238,16 +279,33 @@ static inline phys_addr_t virt_to_phys(const volatile void *x)
238 279
239static inline void *phys_to_virt(phys_addr_t x) 280static inline void *phys_to_virt(phys_addr_t x)
240{ 281{
241 return (void *)(__phys_to_virt((unsigned long)(x))); 282 return (void *)__phys_to_virt(x);
242} 283}
243 284
244/* 285/*
245 * Drivers should NOT use these either. 286 * Drivers should NOT use these either.
246 */ 287 */
247#define __pa(x) __virt_to_phys((unsigned long)(x)) 288#define __pa(x) __virt_to_phys((unsigned long)(x))
248#define __va(x) ((void *)__phys_to_virt((unsigned long)(x))) 289#define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x)))
249#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 290#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
250 291
292extern phys_addr_t (*arch_virt_to_idmap)(unsigned long x);
293
294/*
295 * These are for systems that have a hardware interconnect supported alias of
296 * physical memory for idmap purposes. Most cases should leave these
297 * untouched.
298 */
299static inline phys_addr_t __virt_to_idmap(unsigned long x)
300{
301 if (arch_virt_to_idmap)
302 return arch_virt_to_idmap(x);
303 else
304 return __virt_to_phys(x);
305}
306
307#define virt_to_idmap(x) __virt_to_idmap((unsigned long)(x))
308
251/* 309/*
252 * Virtual <-> DMA view memory address translations 310 * Virtual <-> DMA view memory address translations
253 * Again, these are *only* valid on the kernel direct mapped RAM 311 * Again, these are *only* valid on the kernel direct mapped RAM
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
index 6f18da09668b..64fd15159b7d 100644
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -16,7 +16,7 @@ typedef struct {
16#ifdef CONFIG_CPU_HAS_ASID 16#ifdef CONFIG_CPU_HAS_ASID
17#define ASID_BITS 8 17#define ASID_BITS 8
18#define ASID_MASK ((~0ULL) << ASID_BITS) 18#define ASID_MASK ((~0ULL) << ASID_BITS)
19#define ASID(mm) ((mm)->context.id.counter & ~ASID_MASK) 19#define ASID(mm) ((unsigned int)((mm)->context.id.counter & ~ASID_MASK))
20#else 20#else
21#define ASID(mm) (0) 21#define ASID(mm) (0)
22#endif 22#endif
diff --git a/arch/arm/include/asm/pgalloc.h b/arch/arm/include/asm/pgalloc.h
index 943504f53f57..78a779361682 100644
--- a/arch/arm/include/asm/pgalloc.h
+++ b/arch/arm/include/asm/pgalloc.h
@@ -102,12 +102,14 @@ pte_alloc_one(struct mm_struct *mm, unsigned long addr)
102#else 102#else
103 pte = alloc_pages(PGALLOC_GFP, 0); 103 pte = alloc_pages(PGALLOC_GFP, 0);
104#endif 104#endif
105 if (pte) { 105 if (!pte)
106 if (!PageHighMem(pte)) 106 return NULL;
107 clean_pte_table(page_address(pte)); 107 if (!PageHighMem(pte))
108 pgtable_page_ctor(pte); 108 clean_pte_table(page_address(pte));
109 if (!pgtable_page_ctor(pte)) {
110 __free_page(pte);
111 return NULL;
109 } 112 }
110
111 return pte; 113 return pte;
112} 114}
113 115
diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
index f97ee02386ee..86a659a19526 100644
--- a/arch/arm/include/asm/pgtable-2level.h
+++ b/arch/arm/include/asm/pgtable-2level.h
@@ -181,6 +181,13 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
181 181
182#define set_pte_ext(ptep,pte,ext) cpu_set_pte_ext(ptep,pte,ext) 182#define set_pte_ext(ptep,pte,ext) cpu_set_pte_ext(ptep,pte,ext)
183 183
184/*
185 * We don't have huge page support for short descriptors, for the moment
186 * define empty stubs for use by pin_page_for_write.
187 */
188#define pmd_hugewillfault(pmd) (0)
189#define pmd_thp_or_huge(pmd) (0)
190
184#endif /* __ASSEMBLY__ */ 191#endif /* __ASSEMBLY__ */
185 192
186#endif /* _ASM_PGTABLE_2LEVEL_H */ 193#endif /* _ASM_PGTABLE_2LEVEL_H */
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
index 5689c18c85f5..4f9503908dca 100644
--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
@@ -126,6 +126,8 @@
126#define L_PTE_S2_RDONLY (_AT(pteval_t, 1) << 6) /* HAP[1] */ 126#define L_PTE_S2_RDONLY (_AT(pteval_t, 1) << 6) /* HAP[1] */
127#define L_PTE_S2_RDWR (_AT(pteval_t, 3) << 6) /* HAP[2:1] */ 127#define L_PTE_S2_RDWR (_AT(pteval_t, 3) << 6) /* HAP[2:1] */
128 128
129#define L_PMD_S2_RDWR (_AT(pmdval_t, 3) << 6) /* HAP[2:1] */
130
129/* 131/*
130 * Hyp-mode PL2 PTE definitions for LPAE. 132 * Hyp-mode PL2 PTE definitions for LPAE.
131 */ 133 */
@@ -206,6 +208,9 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
206#define __HAVE_ARCH_PMD_WRITE 208#define __HAVE_ARCH_PMD_WRITE
207#define pmd_write(pmd) (!(pmd_val(pmd) & PMD_SECT_RDONLY)) 209#define pmd_write(pmd) (!(pmd_val(pmd) & PMD_SECT_RDONLY))
208 210
211#define pmd_hugewillfault(pmd) (!pmd_young(pmd) || !pmd_write(pmd))
212#define pmd_thp_or_huge(pmd) (pmd_huge(pmd) || pmd_trans_huge(pmd))
213
209#ifdef CONFIG_TRANSPARENT_HUGEPAGE 214#ifdef CONFIG_TRANSPARENT_HUGEPAGE
210#define pmd_trans_huge(pmd) (pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT)) 215#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) 216#define pmd_trans_splitting(pmd) (pmd_val(pmd) & PMD_SECT_SPLITTING)
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h
index 413f3876341c..c3d5fc124a05 100644
--- a/arch/arm/include/asm/processor.h
+++ b/arch/arm/include/asm/processor.h
@@ -22,6 +22,7 @@
22#include <asm/hw_breakpoint.h> 22#include <asm/hw_breakpoint.h>
23#include <asm/ptrace.h> 23#include <asm/ptrace.h>
24#include <asm/types.h> 24#include <asm/types.h>
25#include <asm/unified.h>
25 26
26#ifdef __KERNEL__ 27#ifdef __KERNEL__
27#define STACK_TOP ((current->personality & ADDR_LIMIT_32BIT) ? \ 28#define STACK_TOP ((current->personality & ADDR_LIMIT_32BIT) ? \
@@ -87,6 +88,17 @@ unsigned long get_wchan(struct task_struct *p);
87#define KSTK_EIP(tsk) task_pt_regs(tsk)->ARM_pc 88#define KSTK_EIP(tsk) task_pt_regs(tsk)->ARM_pc
88#define KSTK_ESP(tsk) task_pt_regs(tsk)->ARM_sp 89#define KSTK_ESP(tsk) task_pt_regs(tsk)->ARM_sp
89 90
91#ifdef CONFIG_SMP
92#define __ALT_SMP_ASM(smp, up) \
93 "9998: " smp "\n" \
94 " .pushsection \".alt.smp.init\", \"a\"\n" \
95 " .long 9998b\n" \
96 " " up "\n" \
97 " .popsection\n"
98#else
99#define __ALT_SMP_ASM(smp, up) up
100#endif
101
90/* 102/*
91 * Prefetching support - only ARMv5. 103 * Prefetching support - only ARMv5.
92 */ 104 */
@@ -97,17 +109,22 @@ static inline void prefetch(const void *ptr)
97{ 109{
98 __asm__ __volatile__( 110 __asm__ __volatile__(
99 "pld\t%a0" 111 "pld\t%a0"
100 : 112 :: "p" (ptr));
101 : "p" (ptr)
102 : "cc");
103} 113}
104 114
115#if __LINUX_ARM_ARCH__ >= 7 && defined(CONFIG_SMP)
105#define ARCH_HAS_PREFETCHW 116#define ARCH_HAS_PREFETCHW
106#define prefetchw(ptr) prefetch(ptr) 117static inline void prefetchw(const void *ptr)
107 118{
108#define ARCH_HAS_SPINLOCK_PREFETCH 119 __asm__ __volatile__(
109#define spin_lock_prefetch(x) do { } while (0) 120 ".arch_extension mp\n"
110 121 __ALT_SMP_ASM(
122 WASM(pldw) "\t%a0",
123 WASM(pld) "\t%a0"
124 )
125 :: "p" (ptr));
126}
127#endif
111#endif 128#endif
112 129
113#define HAVE_ARCH_PICK_MMAP_LAYOUT 130#define HAVE_ARCH_PICK_MMAP_LAYOUT
diff --git a/arch/arm/include/asm/prom.h b/arch/arm/include/asm/prom.h
index 4a2985e21969..b681575ad3de 100644
--- a/arch/arm/include/asm/prom.h
+++ b/arch/arm/include/asm/prom.h
@@ -11,8 +11,6 @@
11#ifndef __ASMARM_PROM_H 11#ifndef __ASMARM_PROM_H
12#define __ASMARM_PROM_H 12#define __ASMARM_PROM_H
13 13
14#define HAVE_ARCH_DEVTREE_FIXUPS
15
16#ifdef CONFIG_OF 14#ifdef CONFIG_OF
17 15
18extern const struct machine_desc *setup_machine_fdt(unsigned int dt_phys); 16extern const struct machine_desc *setup_machine_fdt(unsigned int dt_phys);
diff --git a/arch/arm/include/asm/sched_clock.h b/arch/arm/include/asm/sched_clock.h
deleted file mode 100644
index 2389b71a8e7c..000000000000
--- a/arch/arm/include/asm/sched_clock.h
+++ /dev/null
@@ -1,4 +0,0 @@
1/* You shouldn't include this file. Use linux/sched_clock.h instead.
2 * Temporary file until all asm/sched_clock.h users are gone
3 */
4#include <linux/sched_clock.h>
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
index c50f05609501..8d6a089dfb76 100644
--- a/arch/arm/include/asm/setup.h
+++ b/arch/arm/include/asm/setup.h
@@ -49,7 +49,7 @@ extern struct meminfo meminfo;
49#define bank_phys_end(bank) ((bank)->start + (bank)->size) 49#define bank_phys_end(bank) ((bank)->start + (bank)->size)
50#define bank_phys_size(bank) (bank)->size 50#define bank_phys_size(bank) (bank)->size
51 51
52extern int arm_add_memory(phys_addr_t start, phys_addr_t size); 52extern int arm_add_memory(u64 start, u64 size);
53extern void early_print(const char *str, ...); 53extern void early_print(const char *str, ...);
54extern void dump_machine_table(void); 54extern void dump_machine_table(void);
55 55
diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
index a8cae71caceb..22a3b9b5d4a1 100644
--- a/arch/arm/include/asm/smp.h
+++ b/arch/arm/include/asm/smp.h
@@ -84,6 +84,8 @@ extern void arch_send_call_function_single_ipi(int cpu);
84extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 84extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
85extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask); 85extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask);
86 86
87extern int register_ipi_completion(struct completion *completion, int cpu);
88
87struct smp_operations { 89struct smp_operations {
88#ifdef CONFIG_SMP 90#ifdef CONFIG_SMP
89 /* 91 /*
diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
index 4f2c28060c9a..ef3c6072aa45 100644
--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -5,21 +5,13 @@
5#error SMP not supported on pre-ARMv6 CPUs 5#error SMP not supported on pre-ARMv6 CPUs
6#endif 6#endif
7 7
8#include <asm/processor.h> 8#include <linux/prefetch.h>
9 9
10/* 10/*
11 * sev and wfe are ARMv6K extensions. Uniprocessor ARMv6 may not have the K 11 * sev and wfe are ARMv6K extensions. Uniprocessor ARMv6 may not have the K
12 * extensions, so when running on UP, we have to patch these instructions away. 12 * extensions, so when running on UP, we have to patch these instructions away.
13 */ 13 */
14#define ALT_SMP(smp, up) \
15 "9998: " smp "\n" \
16 " .pushsection \".alt.smp.init\", \"a\"\n" \
17 " .long 9998b\n" \
18 " " up "\n" \
19 " .popsection\n"
20
21#ifdef CONFIG_THUMB2_KERNEL 14#ifdef CONFIG_THUMB2_KERNEL
22#define SEV ALT_SMP("sev.w", "nop.w")
23/* 15/*
24 * For Thumb-2, special care is needed to ensure that the conditional WFE 16 * For Thumb-2, special care is needed to ensure that the conditional WFE
25 * instruction really does assemble to exactly 4 bytes (as required by 17 * instruction really does assemble to exactly 4 bytes (as required by
@@ -31,17 +23,18 @@
31 * the assembler won't change IT instructions which are explicitly present 23 * the assembler won't change IT instructions which are explicitly present
32 * in the input. 24 * in the input.
33 */ 25 */
34#define WFE(cond) ALT_SMP( \ 26#define WFE(cond) __ALT_SMP_ASM( \
35 "it " cond "\n\t" \ 27 "it " cond "\n\t" \
36 "wfe" cond ".n", \ 28 "wfe" cond ".n", \
37 \ 29 \
38 "nop.w" \ 30 "nop.w" \
39) 31)
40#else 32#else
41#define SEV ALT_SMP("sev", "nop") 33#define WFE(cond) __ALT_SMP_ASM("wfe" cond, "nop")
42#define WFE(cond) ALT_SMP("wfe" cond, "nop")
43#endif 34#endif
44 35
36#define SEV __ALT_SMP_ASM(WASM(sev), WASM(nop))
37
45static inline void dsb_sev(void) 38static inline void dsb_sev(void)
46{ 39{
47#if __LINUX_ARM_ARCH__ >= 7 40#if __LINUX_ARM_ARCH__ >= 7
@@ -77,6 +70,7 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
77 u32 newval; 70 u32 newval;
78 arch_spinlock_t lockval; 71 arch_spinlock_t lockval;
79 72
73 prefetchw(&lock->slock);
80 __asm__ __volatile__( 74 __asm__ __volatile__(
81"1: ldrex %0, [%3]\n" 75"1: ldrex %0, [%3]\n"
82" add %1, %0, %4\n" 76" add %1, %0, %4\n"
@@ -100,6 +94,7 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)
100 unsigned long contended, res; 94 unsigned long contended, res;
101 u32 slock; 95 u32 slock;
102 96
97 prefetchw(&lock->slock);
103 do { 98 do {
104 __asm__ __volatile__( 99 __asm__ __volatile__(
105 " ldrex %0, [%3]\n" 100 " ldrex %0, [%3]\n"
@@ -127,10 +122,14 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)
127 dsb_sev(); 122 dsb_sev();
128} 123}
129 124
125static inline int arch_spin_value_unlocked(arch_spinlock_t lock)
126{
127 return lock.tickets.owner == lock.tickets.next;
128}
129
130static inline int arch_spin_is_locked(arch_spinlock_t *lock) 130static inline int arch_spin_is_locked(arch_spinlock_t *lock)
131{ 131{
132 struct __raw_tickets tickets = ACCESS_ONCE(lock->tickets); 132 return !arch_spin_value_unlocked(ACCESS_ONCE(*lock));
133 return tickets.owner != tickets.next;
134} 133}
135 134
136static inline int arch_spin_is_contended(arch_spinlock_t *lock) 135static inline int arch_spin_is_contended(arch_spinlock_t *lock)
@@ -152,6 +151,7 @@ static inline void arch_write_lock(arch_rwlock_t *rw)
152{ 151{
153 unsigned long tmp; 152 unsigned long tmp;
154 153
154 prefetchw(&rw->lock);
155 __asm__ __volatile__( 155 __asm__ __volatile__(
156"1: ldrex %0, [%1]\n" 156"1: ldrex %0, [%1]\n"
157" teq %0, #0\n" 157" teq %0, #0\n"
@@ -170,6 +170,7 @@ static inline int arch_write_trylock(arch_rwlock_t *rw)
170{ 170{
171 unsigned long contended, res; 171 unsigned long contended, res;
172 172
173 prefetchw(&rw->lock);
173 do { 174 do {
174 __asm__ __volatile__( 175 __asm__ __volatile__(
175 " ldrex %0, [%2]\n" 176 " ldrex %0, [%2]\n"
@@ -203,7 +204,7 @@ static inline void arch_write_unlock(arch_rwlock_t *rw)
203} 204}
204 205
205/* write_can_lock - would write_trylock() succeed? */ 206/* write_can_lock - would write_trylock() succeed? */
206#define arch_write_can_lock(x) ((x)->lock == 0) 207#define arch_write_can_lock(x) (ACCESS_ONCE((x)->lock) == 0)
207 208
208/* 209/*
209 * Read locks are a bit more hairy: 210 * Read locks are a bit more hairy:
@@ -221,6 +222,7 @@ static inline void arch_read_lock(arch_rwlock_t *rw)
221{ 222{
222 unsigned long tmp, tmp2; 223 unsigned long tmp, tmp2;
223 224
225 prefetchw(&rw->lock);
224 __asm__ __volatile__( 226 __asm__ __volatile__(
225"1: ldrex %0, [%2]\n" 227"1: ldrex %0, [%2]\n"
226" adds %0, %0, #1\n" 228" adds %0, %0, #1\n"
@@ -241,6 +243,7 @@ static inline void arch_read_unlock(arch_rwlock_t *rw)
241 243
242 smp_mb(); 244 smp_mb();
243 245
246 prefetchw(&rw->lock);
244 __asm__ __volatile__( 247 __asm__ __volatile__(
245"1: ldrex %0, [%2]\n" 248"1: ldrex %0, [%2]\n"
246" sub %0, %0, #1\n" 249" sub %0, %0, #1\n"
@@ -259,6 +262,7 @@ static inline int arch_read_trylock(arch_rwlock_t *rw)
259{ 262{
260 unsigned long contended, res; 263 unsigned long contended, res;
261 264
265 prefetchw(&rw->lock);
262 do { 266 do {
263 __asm__ __volatile__( 267 __asm__ __volatile__(
264 " ldrex %0, [%2]\n" 268 " ldrex %0, [%2]\n"
@@ -280,7 +284,7 @@ static inline int arch_read_trylock(arch_rwlock_t *rw)
280} 284}
281 285
282/* read_can_lock - would read_trylock() succeed? */ 286/* read_can_lock - would read_trylock() succeed? */
283#define arch_read_can_lock(x) ((x)->lock < 0x80000000) 287#define arch_read_can_lock(x) (ACCESS_ONCE((x)->lock) < 0x80000000)
284 288
285#define arch_read_lock_flags(lock, flags) arch_read_lock(lock) 289#define arch_read_lock_flags(lock, flags) arch_read_lock(lock)
286#define arch_write_lock_flags(lock, flags) arch_write_lock(lock) 290#define arch_write_lock_flags(lock, flags) arch_write_lock(lock)
diff --git a/arch/arm/include/asm/spinlock_types.h b/arch/arm/include/asm/spinlock_types.h
index b262d2f8b478..47663fcb10ad 100644
--- a/arch/arm/include/asm/spinlock_types.h
+++ b/arch/arm/include/asm/spinlock_types.h
@@ -25,7 +25,7 @@ typedef struct {
25#define __ARCH_SPIN_LOCK_UNLOCKED { { 0 } } 25#define __ARCH_SPIN_LOCK_UNLOCKED { { 0 } }
26 26
27typedef struct { 27typedef struct {
28 volatile unsigned int lock; 28 u32 lock;
29} arch_rwlock_t; 29} arch_rwlock_t;
30 30
31#define __ARCH_RW_LOCK_UNLOCKED { 0 } 31#define __ARCH_RW_LOCK_UNLOCKED { 0 }
diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h
index f1d96d4e8092..73ddd7239b33 100644
--- a/arch/arm/include/asm/syscall.h
+++ b/arch/arm/include/asm/syscall.h
@@ -57,6 +57,9 @@ static inline void syscall_get_arguments(struct task_struct *task,
57 unsigned int i, unsigned int n, 57 unsigned int i, unsigned int n,
58 unsigned long *args) 58 unsigned long *args)
59{ 59{
60 if (n == 0)
61 return;
62
60 if (i + n > SYSCALL_MAX_ARGS) { 63 if (i + n > SYSCALL_MAX_ARGS) {
61 unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i; 64 unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;
62 unsigned int n_bad = n + i - SYSCALL_MAX_ARGS; 65 unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;
@@ -81,6 +84,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
81 unsigned int i, unsigned int n, 84 unsigned int i, unsigned int n,
82 const unsigned long *args) 85 const unsigned long *args)
83{ 86{
87 if (n == 0)
88 return;
89
84 if (i + n > SYSCALL_MAX_ARGS) { 90 if (i + n > SYSCALL_MAX_ARGS) {
85 pr_warning("%s called with max args %d, handling only %d\n", 91 pr_warning("%s called with max args %d, handling only %d\n",
86 __func__, i + n, SYSCALL_MAX_ARGS); 92 __func__, i + n, SYSCALL_MAX_ARGS);
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
index 38960264040c..def9e570199f 100644
--- a/arch/arm/include/asm/tlbflush.h
+++ b/arch/arm/include/asm/tlbflush.h
@@ -560,37 +560,6 @@ static inline void __flush_bp_all(void)
560 asm("mcr p15, 0, %0, c7, c1, 6" : : "r" (zero)); 560 asm("mcr p15, 0, %0, c7, c1, 6" : : "r" (zero));
561} 561}
562 562
563#include <asm/cputype.h>
564#ifdef CONFIG_ARM_ERRATA_798181
565static inline int erratum_a15_798181(void)
566{
567 unsigned int midr = read_cpuid_id();
568
569 /* Cortex-A15 r0p0..r3p2 affected */
570 if ((midr & 0xff0ffff0) != 0x410fc0f0 || midr > 0x413fc0f2)
571 return 0;
572 return 1;
573}
574
575static inline void dummy_flush_tlb_a15_erratum(void)
576{
577 /*
578 * Dummy TLBIMVAIS. Using the unmapped address 0 and ASID 0.
579 */
580 asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (0));
581 dsb(ish);
582}
583#else
584static inline int erratum_a15_798181(void)
585{
586 return 0;
587}
588
589static inline void dummy_flush_tlb_a15_erratum(void)
590{
591}
592#endif
593
594/* 563/*
595 * flush_pmd_entry 564 * flush_pmd_entry
596 * 565 *
@@ -697,4 +666,21 @@ extern void flush_bp_all(void);
697 666
698#endif 667#endif
699 668
669#ifndef __ASSEMBLY__
670#ifdef CONFIG_ARM_ERRATA_798181
671extern void erratum_a15_798181_init(void);
672#else
673static inline void erratum_a15_798181_init(void) {}
674#endif
675extern bool (*erratum_a15_798181_handler)(void);
676
677static inline bool erratum_a15_798181(void)
678{
679 if (unlikely(IS_ENABLED(CONFIG_ARM_ERRATA_798181) &&
680 erratum_a15_798181_handler))
681 return erratum_a15_798181_handler();
682 return false;
683}
684#endif
685
700#endif 686#endif
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index 7e1f76027f66..72abdc541f38 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -19,6 +19,13 @@
19#include <asm/unified.h> 19#include <asm/unified.h>
20#include <asm/compiler.h> 20#include <asm/compiler.h>
21 21
22#if __LINUX_ARM_ARCH__ < 6
23#include <asm-generic/uaccess-unaligned.h>
24#else
25#define __get_user_unaligned __get_user
26#define __put_user_unaligned __put_user
27#endif
28
22#define VERIFY_READ 0 29#define VERIFY_READ 0
23#define VERIFY_WRITE 1 30#define VERIFY_WRITE 1
24 31
diff --git a/arch/arm/include/asm/unified.h b/arch/arm/include/asm/unified.h
index f5989f46b4d2..b88beaba6b4a 100644
--- a/arch/arm/include/asm/unified.h
+++ b/arch/arm/include/asm/unified.h
@@ -38,6 +38,8 @@
38#ifdef __ASSEMBLY__ 38#ifdef __ASSEMBLY__
39#define W(instr) instr.w 39#define W(instr) instr.w
40#define BSYM(sym) sym + 1 40#define BSYM(sym) sym + 1
41#else
42#define WASM(instr) #instr ".w"
41#endif 43#endif
42 44
43#else /* !CONFIG_THUMB2_KERNEL */ 45#else /* !CONFIG_THUMB2_KERNEL */
@@ -50,6 +52,8 @@
50#ifdef __ASSEMBLY__ 52#ifdef __ASSEMBLY__
51#define W(instr) instr 53#define W(instr) instr
52#define BSYM(sym) sym 54#define BSYM(sym) sym
55#else
56#define WASM(instr) #instr
53#endif 57#endif
54 58
55#endif /* CONFIG_THUMB2_KERNEL */ 59#endif /* CONFIG_THUMB2_KERNEL */
diff --git a/arch/arm/include/asm/xen/hypervisor.h b/arch/arm/include/asm/xen/hypervisor.h
index d7ab99a0c9eb..1317ee40f4df 100644
--- a/arch/arm/include/asm/xen/hypervisor.h
+++ b/arch/arm/include/asm/xen/hypervisor.h
@@ -16,4 +16,6 @@ static inline enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
16 return PARAVIRT_LAZY_NONE; 16 return PARAVIRT_LAZY_NONE;
17} 17}
18 18
19extern struct dma_map_ops *xen_dma_ops;
20
19#endif /* _ASM_ARM_XEN_HYPERVISOR_H */ 21#endif /* _ASM_ARM_XEN_HYPERVISOR_H */
diff --git a/arch/arm/include/asm/xen/page-coherent.h b/arch/arm/include/asm/xen/page-coherent.h
new file mode 100644
index 000000000000..1109017499e5
--- /dev/null
+++ b/arch/arm/include/asm/xen/page-coherent.h
@@ -0,0 +1,50 @@
1#ifndef _ASM_ARM_XEN_PAGE_COHERENT_H
2#define _ASM_ARM_XEN_PAGE_COHERENT_H
3
4#include <asm/page.h>
5#include <linux/dma-attrs.h>
6#include <linux/dma-mapping.h>
7
8static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size,
9 dma_addr_t *dma_handle, gfp_t flags,
10 struct dma_attrs *attrs)
11{
12 return __generic_dma_ops(hwdev)->alloc(hwdev, size, dma_handle, flags, attrs);
13}
14
15static inline void xen_free_coherent_pages(struct device *hwdev, size_t size,
16 void *cpu_addr, dma_addr_t dma_handle,
17 struct dma_attrs *attrs)
18{
19 __generic_dma_ops(hwdev)->free(hwdev, size, cpu_addr, dma_handle, attrs);
20}
21
22static inline void xen_dma_map_page(struct device *hwdev, struct page *page,
23 unsigned long offset, size_t size, enum dma_data_direction dir,
24 struct dma_attrs *attrs)
25{
26 __generic_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs);
27}
28
29static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle,
30 size_t size, enum dma_data_direction dir,
31 struct dma_attrs *attrs)
32{
33 if (__generic_dma_ops(hwdev)->unmap_page)
34 __generic_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs);
35}
36
37static inline void xen_dma_sync_single_for_cpu(struct device *hwdev,
38 dma_addr_t handle, size_t size, enum dma_data_direction dir)
39{
40 if (__generic_dma_ops(hwdev)->sync_single_for_cpu)
41 __generic_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir);
42}
43
44static inline void xen_dma_sync_single_for_device(struct device *hwdev,
45 dma_addr_t handle, size_t size, enum dma_data_direction dir)
46{
47 if (__generic_dma_ops(hwdev)->sync_single_for_device)
48 __generic_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir);
49}
50#endif /* _ASM_ARM_XEN_PAGE_COHERENT_H */
diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h
index 359a7b50b158..75579a9d6f76 100644
--- a/arch/arm/include/asm/xen/page.h
+++ b/arch/arm/include/asm/xen/page.h
@@ -6,12 +6,12 @@
6 6
7#include <linux/pfn.h> 7#include <linux/pfn.h>
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/dma-mapping.h>
9 10
11#include <xen/xen.h>
10#include <xen/interface/grant_table.h> 12#include <xen/interface/grant_table.h>
11 13
12#define pfn_to_mfn(pfn) (pfn)
13#define phys_to_machine_mapping_valid(pfn) (1) 14#define phys_to_machine_mapping_valid(pfn) (1)
14#define mfn_to_pfn(mfn) (mfn)
15#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT)) 15#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
16 16
17#define pte_mfn pte_pfn 17#define pte_mfn pte_pfn
@@ -32,6 +32,38 @@ typedef struct xpaddr {
32 32
33#define INVALID_P2M_ENTRY (~0UL) 33#define INVALID_P2M_ENTRY (~0UL)
34 34
35unsigned long __pfn_to_mfn(unsigned long pfn);
36unsigned long __mfn_to_pfn(unsigned long mfn);
37extern struct rb_root phys_to_mach;
38
39static inline unsigned long pfn_to_mfn(unsigned long pfn)
40{
41 unsigned long mfn;
42
43 if (phys_to_mach.rb_node != NULL) {
44 mfn = __pfn_to_mfn(pfn);
45 if (mfn != INVALID_P2M_ENTRY)
46 return mfn;
47 }
48
49 return pfn;
50}
51
52static inline unsigned long mfn_to_pfn(unsigned long mfn)
53{
54 unsigned long pfn;
55
56 if (phys_to_mach.rb_node != NULL) {
57 pfn = __mfn_to_pfn(mfn);
58 if (pfn != INVALID_P2M_ENTRY)
59 return pfn;
60 }
61
62 return mfn;
63}
64
65#define mfn_to_local_pfn(mfn) mfn_to_pfn(mfn)
66
35static inline xmaddr_t phys_to_machine(xpaddr_t phys) 67static inline xmaddr_t phys_to_machine(xpaddr_t phys)
36{ 68{
37 unsigned offset = phys.paddr & ~PAGE_MASK; 69 unsigned offset = phys.paddr & ~PAGE_MASK;
@@ -76,11 +108,9 @@ static inline int m2p_remove_override(struct page *page, bool clear_pte)
76 return 0; 108 return 0;
77} 109}
78 110
79static inline bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn) 111bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn);
80{ 112bool __set_phys_to_machine_multi(unsigned long pfn, unsigned long mfn,
81 BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY); 113 unsigned long nr_pages);
82 return true;
83}
84 114
85static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn) 115static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
86{ 116{
diff --git a/arch/arm/include/debug/efm32.S b/arch/arm/include/debug/efm32.S
new file mode 100644
index 000000000000..2265a199280c
--- /dev/null
+++ b/arch/arm/include/debug/efm32.S
@@ -0,0 +1,45 @@
1/*
2 * Copyright (C) 2013 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#define UARTn_CMD 0x000c
11#define UARTn_CMD_TXEN 0x0004
12
13#define UARTn_STATUS 0x0010
14#define UARTn_STATUS_TXC 0x0020
15#define UARTn_STATUS_TXBL 0x0040
16
17#define UARTn_TXDATA 0x0034
18
19 .macro addruart, rx, tmp
20 ldr \rx, =(CONFIG_DEBUG_UART_PHYS)
21
22 /*
23 * enable TX. The driver might disable it to save energy. We
24 * don't care about disabling at the end as during debug power
25 * consumption isn't that important.
26 */
27 ldr \tmp, =(UARTn_CMD_TXEN)
28 str \tmp, [\rx, #UARTn_CMD]
29 .endm
30
31 .macro senduart,rd,rx
32 strb \rd, [\rx, #UARTn_TXDATA]
33 .endm
34
35 .macro waituart,rd,rx
361001: ldr \rd, [\rx, #UARTn_STATUS]
37 tst \rd, #UARTn_STATUS_TXBL
38 beq 1001b
39 .endm
40
41 .macro busyuart,rd,rx
421001: ldr \rd, [\rx, UARTn_STATUS]
43 tst \rd, #UARTn_STATUS_TXC
44 bne 1001b
45 .endm
diff --git a/arch/arm/include/debug/msm.S b/arch/arm/include/debug/msm.S
index 9166e1bc470e..9d653d475903 100644
--- a/arch/arm/include/debug/msm.S
+++ b/arch/arm/include/debug/msm.S
@@ -46,6 +46,11 @@
46#define MSM_DEBUG_UART_PHYS 0x16440000 46#define MSM_DEBUG_UART_PHYS 0x16440000
47#endif 47#endif
48 48
49#ifdef CONFIG_DEBUG_MSM8974_UART
50#define MSM_DEBUG_UART_BASE 0xFA71E000
51#define MSM_DEBUG_UART_PHYS 0xF991E000
52#endif
53
49 .macro addruart, rp, rv, tmp 54 .macro addruart, rp, rv, tmp
50#ifdef MSM_DEBUG_UART_PHYS 55#ifdef MSM_DEBUG_UART_PHYS
51 ldr \rp, =MSM_DEBUG_UART_PHYS 56 ldr \rp, =MSM_DEBUG_UART_PHYS
diff --git a/arch/arm/include/debug/pl01x.S b/arch/arm/include/debug/pl01x.S
index 37c6895b87e6..92ef808a2337 100644
--- a/arch/arm/include/debug/pl01x.S
+++ b/arch/arm/include/debug/pl01x.S
@@ -25,12 +25,14 @@
25 25
26 .macro waituart,rd,rx 26 .macro waituart,rd,rx
271001: ldr \rd, [\rx, #UART01x_FR] 271001: ldr \rd, [\rx, #UART01x_FR]
28 ARM_BE8( rev \rd, \rd )
28 tst \rd, #UART01x_FR_TXFF 29 tst \rd, #UART01x_FR_TXFF
29 bne 1001b 30 bne 1001b
30 .endm 31 .endm
31 32
32 .macro busyuart,rd,rx 33 .macro busyuart,rd,rx
331001: ldr \rd, [\rx, #UART01x_FR] 341001: ldr \rd, [\rx, #UART01x_FR]
35 ARM_BE8( rev \rd, \rd )
34 tst \rd, #UART01x_FR_BUSY 36 tst \rd, #UART01x_FR_BUSY
35 bne 1001b 37 bne 1001b
36 .endm 38 .endm
diff --git a/arch/arm/include/debug/vf.S b/arch/arm/include/debug/vf.S
new file mode 100644
index 000000000000..ba12cc44b2cb
--- /dev/null
+++ b/arch/arm/include/debug/vf.S
@@ -0,0 +1,26 @@
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 .macro addruart, rp, rv, tmp
11 ldr \rp, =0x40028000 @ physical
12 ldr \rv, =0xfe028000 @ virtual
13 .endm
14
15 .macro senduart, rd, rx
16 strb \rd, [\rx, #0x7] @ Data Register
17 .endm
18
19 .macro busyuart, rd, rx
201001: ldrb \rd, [\rx, #0x4] @ Status Register 1
21 tst \rd, #1 << 6 @ TC
22 beq 1001b @ wait until transmit done
23 .endm
24
25 .macro waituart,rd,rx
26 .endm
diff --git a/arch/arm/include/uapi/asm/Kbuild b/arch/arm/include/uapi/asm/Kbuild
index 18d76fd5a2af..70a1c9da30ca 100644
--- a/arch/arm/include/uapi/asm/Kbuild
+++ b/arch/arm/include/uapi/asm/Kbuild
@@ -7,6 +7,7 @@ header-y += hwcap.h
7header-y += ioctls.h 7header-y += ioctls.h
8header-y += kvm_para.h 8header-y += kvm_para.h
9header-y += mman.h 9header-y += mman.h
10header-y += perf_regs.h
10header-y += posix_types.h 11header-y += posix_types.h
11header-y += ptrace.h 12header-y += ptrace.h
12header-y += setup.h 13header-y += setup.h
diff --git a/arch/arm/include/uapi/asm/hwcap.h b/arch/arm/include/uapi/asm/hwcap.h
index 6d34d080372a..7dcc10d67253 100644
--- a/arch/arm/include/uapi/asm/hwcap.h
+++ b/arch/arm/include/uapi/asm/hwcap.h
@@ -26,5 +26,6 @@
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#define HWCAP_LPAE (1 << 20) 28#define HWCAP_LPAE (1 << 20)
29#define HWCAP_EVTSTRM (1 << 21)
29 30
30#endif /* _UAPI__ASMARM_HWCAP_H */ 31#endif /* _UAPI__ASMARM_HWCAP_H */
diff --git a/arch/arm/include/uapi/asm/kvm.h b/arch/arm/include/uapi/asm/kvm.h
index c1ee007523d7..c498b60c0505 100644
--- a/arch/arm/include/uapi/asm/kvm.h
+++ b/arch/arm/include/uapi/asm/kvm.h
@@ -63,7 +63,8 @@ struct kvm_regs {
63 63
64/* Supported Processor Types */ 64/* Supported Processor Types */
65#define KVM_ARM_TARGET_CORTEX_A15 0 65#define KVM_ARM_TARGET_CORTEX_A15 0
66#define KVM_ARM_NUM_TARGETS 1 66#define KVM_ARM_TARGET_CORTEX_A7 1
67#define KVM_ARM_NUM_TARGETS 2
67 68
68/* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */ 69/* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */
69#define KVM_ARM_DEVICE_TYPE_SHIFT 0 70#define KVM_ARM_DEVICE_TYPE_SHIFT 0
diff --git a/arch/arm/include/uapi/asm/perf_regs.h b/arch/arm/include/uapi/asm/perf_regs.h
new file mode 100644
index 000000000000..ce59448458b2
--- /dev/null
+++ b/arch/arm/include/uapi/asm/perf_regs.h
@@ -0,0 +1,23 @@
1#ifndef _ASM_ARM_PERF_REGS_H
2#define _ASM_ARM_PERF_REGS_H
3
4enum perf_event_arm_regs {
5 PERF_REG_ARM_R0,
6 PERF_REG_ARM_R1,
7 PERF_REG_ARM_R2,
8 PERF_REG_ARM_R3,
9 PERF_REG_ARM_R4,
10 PERF_REG_ARM_R5,
11 PERF_REG_ARM_R6,
12 PERF_REG_ARM_R7,
13 PERF_REG_ARM_R8,
14 PERF_REG_ARM_R9,
15 PERF_REG_ARM_R10,
16 PERF_REG_ARM_FP,
17 PERF_REG_ARM_IP,
18 PERF_REG_ARM_SP,
19 PERF_REG_ARM_LR,
20 PERF_REG_ARM_PC,
21 PERF_REG_ARM_MAX,
22};
23#endif /* _ASM_ARM_PERF_REGS_H */
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 5140df5f23aa..a30fc9be9e9e 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -17,7 +17,8 @@ CFLAGS_REMOVE_return_address.o = -pg
17 17
18obj-y := elf.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 \ 19 process.o ptrace.o return_address.o \
20 setup.o signal.o stacktrace.o sys_arm.o time.o traps.o 20 setup.o signal.o sigreturn_codes.o \
21 stacktrace.o sys_arm.o time.o traps.o
21 22
22obj-$(CONFIG_ATAGS) += atags_parse.o 23obj-$(CONFIG_ATAGS) += atags_parse.o
23obj-$(CONFIG_ATAGS_PROC) += atags_proc.o 24obj-$(CONFIG_ATAGS_PROC) += atags_proc.o
@@ -78,6 +79,7 @@ obj-$(CONFIG_CPU_XSC3) += xscale-cp0.o
78obj-$(CONFIG_CPU_MOHAWK) += xscale-cp0.o 79obj-$(CONFIG_CPU_MOHAWK) += xscale-cp0.o
79obj-$(CONFIG_CPU_PJ4) += pj4-cp0.o 80obj-$(CONFIG_CPU_PJ4) += pj4-cp0.o
80obj-$(CONFIG_IWMMXT) += iwmmxt.o 81obj-$(CONFIG_IWMMXT) += iwmmxt.o
82obj-$(CONFIG_PERF_EVENTS) += perf_regs.o
81obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o perf_event_cpu.o 83obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o perf_event_cpu.o
82AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt 84AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt
83obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o 85obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o
diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index 221f07b11ccb..1791f12c180b 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -11,7 +11,6 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/sched_clock.h>
15 14
16#include <asm/delay.h> 15#include <asm/delay.h>
17 16
@@ -22,13 +21,6 @@ static unsigned long arch_timer_read_counter_long(void)
22 return arch_timer_read_counter(); 21 return arch_timer_read_counter();
23} 22}
24 23
25static u32 sched_clock_mult __read_mostly;
26
27static unsigned long long notrace arch_timer_sched_clock(void)
28{
29 return arch_timer_read_counter() * sched_clock_mult;
30}
31
32static struct delay_timer arch_delay_timer; 24static struct delay_timer arch_delay_timer;
33 25
34static void __init arch_timer_delay_timer_register(void) 26static void __init arch_timer_delay_timer_register(void)
@@ -48,11 +40,5 @@ int __init arch_timer_arch_init(void)
48 40
49 arch_timer_delay_timer_register(); 41 arch_timer_delay_timer_register();
50 42
51 /* Cache the sched_clock multiplier to save a divide in the hot path. */
52 sched_clock_mult = NSEC_PER_SEC / arch_timer_rate;
53 sched_clock_func = arch_timer_sched_clock;
54 pr_info("sched_clock: ARM arch timer >56 bits at %ukHz, resolution %uns\n",
55 arch_timer_rate / 1000, sched_clock_mult);
56
57 return 0; 43 return 0;
58} 44}
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index 60d3b738d420..1f031ddd0667 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -155,4 +155,5 @@ EXPORT_SYMBOL(__gnu_mcount_nc);
155 155
156#ifdef CONFIG_ARM_PATCH_PHYS_VIRT 156#ifdef CONFIG_ARM_PATCH_PHYS_VIRT
157EXPORT_SYMBOL(__pv_phys_offset); 157EXPORT_SYMBOL(__pv_phys_offset);
158EXPORT_SYMBOL(__pv_offset);
158#endif 159#endif
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index f35906b3d8c9..739c3dfc1da2 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -174,6 +174,19 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
174 return (phys_id & MPIDR_HWID_BITMASK) == cpu_logical_map(cpu); 174 return (phys_id & MPIDR_HWID_BITMASK) == cpu_logical_map(cpu);
175} 175}
176 176
177static const void * __init arch_get_next_mach(const char *const **match)
178{
179 static const struct machine_desc *mdesc = __arch_info_begin;
180 const struct machine_desc *m = mdesc;
181
182 if (m >= __arch_info_end)
183 return NULL;
184
185 mdesc++;
186 *match = m->dt_compat;
187 return m;
188}
189
177/** 190/**
178 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel 191 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
179 * @dt_phys: physical address of dt blob 192 * @dt_phys: physical address of dt blob
@@ -183,11 +196,7 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
183 */ 196 */
184const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) 197const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
185{ 198{
186 struct boot_param_header *devtree;
187 const struct machine_desc *mdesc, *mdesc_best = NULL; 199 const struct machine_desc *mdesc, *mdesc_best = NULL;
188 unsigned int score, mdesc_score = ~1;
189 unsigned long dt_root;
190 const char *model;
191 200
192#ifdef CONFIG_ARCH_MULTIPLATFORM 201#ifdef CONFIG_ARCH_MULTIPLATFORM
193 DT_MACHINE_START(GENERIC_DT, "Generic DT based system") 202 DT_MACHINE_START(GENERIC_DT, "Generic DT based system")
@@ -196,32 +205,20 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
196 mdesc_best = &__mach_desc_GENERIC_DT; 205 mdesc_best = &__mach_desc_GENERIC_DT;
197#endif 206#endif
198 207
199 if (!dt_phys) 208 if (!dt_phys || !early_init_dt_scan(phys_to_virt(dt_phys)))
200 return NULL; 209 return NULL;
201 210
202 devtree = phys_to_virt(dt_phys); 211 mdesc = of_flat_dt_match_machine(mdesc_best, arch_get_next_mach);
203 212
204 /* check device tree validity */ 213 if (!mdesc) {
205 if (be32_to_cpu(devtree->magic) != OF_DT_HEADER)
206 return NULL;
207
208 /* Search the mdescs for the 'best' compatible value match */
209 initial_boot_params = devtree;
210 dt_root = of_get_flat_dt_root();
211 for_each_machine_desc(mdesc) {
212 score = of_flat_dt_match(dt_root, mdesc->dt_compat);
213 if (score > 0 && score < mdesc_score) {
214 mdesc_best = mdesc;
215 mdesc_score = score;
216 }
217 }
218 if (!mdesc_best) {
219 const char *prop; 214 const char *prop;
220 long size; 215 long size;
216 unsigned long dt_root;
221 217
222 early_print("\nError: unrecognized/unsupported " 218 early_print("\nError: unrecognized/unsupported "
223 "device tree compatible list:\n[ "); 219 "device tree compatible list:\n[ ");
224 220
221 dt_root = of_get_flat_dt_root();
225 prop = of_get_flat_dt_prop(dt_root, "compatible", &size); 222 prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
226 while (size > 0) { 223 while (size > 0) {
227 early_print("'%s' ", prop); 224 early_print("'%s' ", prop);
@@ -233,22 +230,8 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
233 dump_machine_table(); /* does not return */ 230 dump_machine_table(); /* does not return */
234 } 231 }
235 232
236 model = of_get_flat_dt_prop(dt_root, "model", NULL);
237 if (!model)
238 model = of_get_flat_dt_prop(dt_root, "compatible", NULL);
239 if (!model)
240 model = "<unknown>";
241 pr_info("Machine: %s, model: %s\n", mdesc_best->name, model);
242
243 /* Retrieve various information from the /chosen node */
244 of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
245 /* Initialize {size,address}-cells info */
246 of_scan_flat_dt(early_init_dt_scan_root, NULL);
247 /* Setup memory, calling early_init_dt_add_memory_arch */
248 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
249
250 /* Change machine number to match the mdesc we're using */ 233 /* Change machine number to match the mdesc we're using */
251 __machine_arch_type = mdesc_best->nr; 234 __machine_arch_type = mdesc->nr;
252 235
253 return mdesc_best; 236 return mdesc;
254} 237}
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 9cbe70c8b0ef..b3fb8c9e1ff2 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -192,6 +192,7 @@ __dabt_svc:
192 svc_entry 192 svc_entry
193 mov r2, sp 193 mov r2, sp
194 dabt_helper 194 dabt_helper
195 THUMB( ldr r5, [sp, #S_PSR] ) @ potentially updated CPSR
195 svc_exit r5 @ return from exception 196 svc_exit r5 @ return from exception
196 UNWIND(.fnend ) 197 UNWIND(.fnend )
197ENDPROC(__dabt_svc) 198ENDPROC(__dabt_svc)
@@ -416,9 +417,8 @@ __und_usr:
416 bne __und_usr_thumb 417 bne __und_usr_thumb
417 sub r4, r2, #4 @ ARM instr at LR - 4 418 sub r4, r2, #4 @ ARM instr at LR - 4
4181: ldrt r0, [r4] 4191: ldrt r0, [r4]
419#ifdef CONFIG_CPU_ENDIAN_BE8 420 ARM_BE8(rev r0, r0) @ little endian instruction
420 rev r0, r0 @ little endian instruction 421
421#endif
422 @ r0 = 32-bit ARM instruction which caused the exception 422 @ r0 = 32-bit ARM instruction which caused the exception
423 @ r2 = PC value for the following instruction (:= regs->ARM_pc) 423 @ r2 = PC value for the following instruction (:= regs->ARM_pc)
424 @ r4 = PC value for the faulting instruction 424 @ r4 = PC value for the faulting instruction
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 74ad15d1a065..a2dcafdf1bc8 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -393,9 +393,7 @@ ENTRY(vector_swi)
393#else 393#else
394 USER( ldr r10, [lr, #-4] ) @ get SWI instruction 394 USER( ldr r10, [lr, #-4] ) @ get SWI instruction
395#endif 395#endif
396#ifdef CONFIG_CPU_ENDIAN_BE8 396 ARM_BE8(rev r10, r10) @ little endian instruction
397 rev r10, r10 @ little endian instruction
398#endif
399 397
400#elif defined(CONFIG_AEABI) 398#elif defined(CONFIG_AEABI)
401 399
@@ -442,10 +440,10 @@ local_restart:
442 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine 440 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine
443 441
444 add r1, sp, #S_OFF 442 add r1, sp, #S_OFF
445 cmp scno, #(__ARM_NR_BASE - __NR_SYSCALL_BASE) 4432: cmp scno, #(__ARM_NR_BASE - __NR_SYSCALL_BASE)
446 eor r0, scno, #__NR_SYSCALL_BASE @ put OS number back 444 eor r0, scno, #__NR_SYSCALL_BASE @ put OS number back
447 bcs arm_syscall 445 bcs arm_syscall
4482: mov why, #0 @ no longer a real syscall 446 mov why, #0 @ no longer a real syscall
449 b sys_ni_syscall @ not private func 447 b sys_ni_syscall @ not private func
450 448
451#if defined(CONFIG_OABI_COMPAT) || !defined(CONFIG_AEABI) 449#if defined(CONFIG_OABI_COMPAT) || !defined(CONFIG_AEABI)
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index de23a9beed13..39f89fbd5111 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -329,10 +329,10 @@
329#ifdef CONFIG_CONTEXT_TRACKING 329#ifdef CONFIG_CONTEXT_TRACKING
330 .if \save 330 .if \save
331 stmdb sp!, {r0-r3, ip, lr} 331 stmdb sp!, {r0-r3, ip, lr}
332 bl user_exit 332 bl context_tracking_user_exit
333 ldmia sp!, {r0-r3, ip, lr} 333 ldmia sp!, {r0-r3, ip, lr}
334 .else 334 .else
335 bl user_exit 335 bl context_tracking_user_exit
336 .endif 336 .endif
337#endif 337#endif
338 .endm 338 .endm
@@ -341,10 +341,10 @@
341#ifdef CONFIG_CONTEXT_TRACKING 341#ifdef CONFIG_CONTEXT_TRACKING
342 .if \save 342 .if \save
343 stmdb sp!, {r0-r3, ip, lr} 343 stmdb sp!, {r0-r3, ip, lr}
344 bl user_enter 344 bl context_tracking_user_enter
345 ldmia sp!, {r0-r3, ip, lr} 345 ldmia sp!, {r0-r3, ip, lr}
346 .else 346 .else
347 bl user_enter 347 bl context_tracking_user_enter
348 .endif 348 .endif
349#endif 349#endif
350 .endm 350 .endm
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 2c7cc1e03473..7801866e626a 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -77,6 +77,7 @@
77 77
78 __HEAD 78 __HEAD
79ENTRY(stext) 79ENTRY(stext)
80 ARM_BE8(setend be ) @ ensure we are in BE8 mode
80 81
81 THUMB( adr r9, BSYM(1f) ) @ Kernel is always entered in ARM. 82 THUMB( adr r9, BSYM(1f) ) @ Kernel is always entered in ARM.
82 THUMB( bx r9 ) @ If this is a Thumb-2 kernel, 83 THUMB( bx r9 ) @ If this is a Thumb-2 kernel,
@@ -352,6 +353,9 @@ ENTRY(secondary_startup)
352 * the processor type - there is no need to check the machine type 353 * the processor type - there is no need to check the machine type
353 * as it has already been validated by the primary processor. 354 * as it has already been validated by the primary processor.
354 */ 355 */
356
357 ARM_BE8(setend be) @ ensure we are in BE8 mode
358
355#ifdef CONFIG_ARM_VIRT_EXT 359#ifdef CONFIG_ARM_VIRT_EXT
356 bl __hyp_stub_install_secondary 360 bl __hyp_stub_install_secondary
357#endif 361#endif
@@ -487,7 +491,26 @@ __fixup_smp:
487 mrc p15, 0, r0, c0, c0, 5 @ read MPIDR 491 mrc p15, 0, r0, c0, c0, 5 @ read MPIDR
488 and r0, r0, #0xc0000000 @ multiprocessing extensions and 492 and r0, r0, #0xc0000000 @ multiprocessing extensions and
489 teq r0, #0x80000000 @ not part of a uniprocessor system? 493 teq r0, #0x80000000 @ not part of a uniprocessor system?
490 moveq pc, lr @ yes, assume SMP 494 bne __fixup_smp_on_up @ no, assume UP
495
496 @ Core indicates it is SMP. Check for Aegis SOC where a single
497 @ Cortex-A9 CPU is present but SMP operations fault.
498 mov r4, #0x41000000
499 orr r4, r4, #0x0000c000
500 orr r4, r4, #0x00000090
501 teq r3, r4 @ Check for ARM Cortex-A9
502 movne pc, lr @ Not ARM Cortex-A9,
503
504 @ If a future SoC *does* use 0x0 as the PERIPH_BASE, then the
505 @ below address check will need to be #ifdef'd or equivalent
506 @ for the Aegis platform.
507 mrc p15, 4, r0, c15, c0 @ get SCU base address
508 teq r0, #0x0 @ '0' on actual UP A9 hardware
509 beq __fixup_smp_on_up @ So its an A9 UP
510 ldr r0, [r0, #4] @ read SCU Config
511 and r0, r0, #0x3 @ number of CPUs
512 teq r0, #0x0 @ is 1?
513 movne pc, lr
491 514
492__fixup_smp_on_up: 515__fixup_smp_on_up:
493 adr r0, 1f 516 adr r0, 1f
@@ -536,6 +559,14 @@ ENTRY(fixup_smp)
536 ldmfd sp!, {r4 - r6, pc} 559 ldmfd sp!, {r4 - r6, pc}
537ENDPROC(fixup_smp) 560ENDPROC(fixup_smp)
538 561
562#ifdef __ARMEB__
563#define LOW_OFFSET 0x4
564#define HIGH_OFFSET 0x0
565#else
566#define LOW_OFFSET 0x0
567#define HIGH_OFFSET 0x4
568#endif
569
539#ifdef CONFIG_ARM_PATCH_PHYS_VIRT 570#ifdef CONFIG_ARM_PATCH_PHYS_VIRT
540 571
541/* __fixup_pv_table - patch the stub instructions with the delta between 572/* __fixup_pv_table - patch the stub instructions with the delta between
@@ -546,17 +577,20 @@ ENDPROC(fixup_smp)
546 __HEAD 577 __HEAD
547__fixup_pv_table: 578__fixup_pv_table:
548 adr r0, 1f 579 adr r0, 1f
549 ldmia r0, {r3-r5, r7} 580 ldmia r0, {r3-r7}
550 sub r3, r0, r3 @ PHYS_OFFSET - PAGE_OFFSET 581 mvn ip, #0
582 subs r3, r0, r3 @ PHYS_OFFSET - PAGE_OFFSET
551 add r4, r4, r3 @ adjust table start address 583 add r4, r4, r3 @ adjust table start address
552 add r5, r5, r3 @ adjust table end address 584 add r5, r5, r3 @ adjust table end address
553 add r7, r7, r3 @ adjust __pv_phys_offset address 585 add r6, r6, r3 @ adjust __pv_phys_offset address
554 str r8, [r7] @ save computed PHYS_OFFSET to __pv_phys_offset 586 add r7, r7, r3 @ adjust __pv_offset address
587 str r8, [r6, #LOW_OFFSET] @ save computed PHYS_OFFSET to __pv_phys_offset
588 strcc ip, [r7, #HIGH_OFFSET] @ save to __pv_offset high bits
555 mov r6, r3, lsr #24 @ constant for add/sub instructions 589 mov r6, r3, lsr #24 @ constant for add/sub instructions
556 teq r3, r6, lsl #24 @ must be 16MiB aligned 590 teq r3, r6, lsl #24 @ must be 16MiB aligned
557THUMB( it ne @ cross section branch ) 591THUMB( it ne @ cross section branch )
558 bne __error 592 bne __error
559 str r6, [r7, #4] @ save to __pv_offset 593 str r3, [r7, #LOW_OFFSET] @ save to __pv_offset low bits
560 b __fixup_a_pv_table 594 b __fixup_a_pv_table
561ENDPROC(__fixup_pv_table) 595ENDPROC(__fixup_pv_table)
562 596
@@ -565,10 +599,19 @@ ENDPROC(__fixup_pv_table)
565 .long __pv_table_begin 599 .long __pv_table_begin
566 .long __pv_table_end 600 .long __pv_table_end
5672: .long __pv_phys_offset 6012: .long __pv_phys_offset
602 .long __pv_offset
568 603
569 .text 604 .text
570__fixup_a_pv_table: 605__fixup_a_pv_table:
606 adr r0, 3f
607 ldr r6, [r0]
608 add r6, r6, r3
609 ldr r0, [r6, #HIGH_OFFSET] @ pv_offset high word
610 ldr r6, [r6, #LOW_OFFSET] @ pv_offset low word
611 mov r6, r6, lsr #24
612 cmn r0, #1
571#ifdef CONFIG_THUMB2_KERNEL 613#ifdef CONFIG_THUMB2_KERNEL
614 moveq r0, #0x200000 @ set bit 21, mov to mvn instruction
572 lsls r6, #24 615 lsls r6, #24
573 beq 2f 616 beq 2f
574 clz r7, r6 617 clz r7, r6
@@ -582,18 +625,42 @@ __fixup_a_pv_table:
582 b 2f 625 b 2f
5831: add r7, r3 6261: add r7, r3
584 ldrh ip, [r7, #2] 627 ldrh ip, [r7, #2]
585 and ip, 0x8f00 628ARM_BE8(rev16 ip, ip)
586 orr ip, r6 @ mask in offset bits 31-24 629 tst ip, #0x4000
630 and ip, #0x8f00
631 orrne ip, r6 @ mask in offset bits 31-24
632 orreq ip, r0 @ mask in offset bits 7-0
633ARM_BE8(rev16 ip, ip)
587 strh ip, [r7, #2] 634 strh ip, [r7, #2]
635 bne 2f
636 ldrh ip, [r7]
637ARM_BE8(rev16 ip, ip)
638 bic ip, #0x20
639 orr ip, ip, r0, lsr #16
640ARM_BE8(rev16 ip, ip)
641 strh ip, [r7]
5882: cmp r4, r5 6422: cmp r4, r5
589 ldrcc r7, [r4], #4 @ use branch for delay slot 643 ldrcc r7, [r4], #4 @ use branch for delay slot
590 bcc 1b 644 bcc 1b
591 bx lr 645 bx lr
592#else 646#else
647 moveq r0, #0x400000 @ set bit 22, mov to mvn instruction
593 b 2f 648 b 2f
5941: ldr ip, [r7, r3] 6491: ldr ip, [r7, r3]
650#ifdef CONFIG_CPU_ENDIAN_BE8
651 @ in BE8, we load data in BE, but instructions still in LE
652 bic ip, ip, #0xff000000
653 tst ip, #0x000f0000 @ check the rotation field
654 orrne ip, ip, r6, lsl #24 @ mask in offset bits 31-24
655 biceq ip, ip, #0x00004000 @ clear bit 22
656 orreq ip, ip, r0, lsl #24 @ mask in offset bits 7-0
657#else
595 bic ip, ip, #0x000000ff 658 bic ip, ip, #0x000000ff
596 orr ip, ip, r6 @ mask in offset bits 31-24 659 tst ip, #0xf00 @ check the rotation field
660 orrne ip, ip, r6 @ mask in offset bits 31-24
661 biceq ip, ip, #0x400000 @ clear bit 22
662 orreq ip, ip, r0 @ mask in offset bits 7-0
663#endif
597 str ip, [r7, r3] 664 str ip, [r7, r3]
5982: cmp r4, r5 6652: cmp r4, r5
599 ldrcc r7, [r4], #4 @ use branch for delay slot 666 ldrcc r7, [r4], #4 @ use branch for delay slot
@@ -602,28 +669,30 @@ __fixup_a_pv_table:
602#endif 669#endif
603ENDPROC(__fixup_a_pv_table) 670ENDPROC(__fixup_a_pv_table)
604 671
672 .align
6733: .long __pv_offset
674
605ENTRY(fixup_pv_table) 675ENTRY(fixup_pv_table)
606 stmfd sp!, {r4 - r7, lr} 676 stmfd sp!, {r4 - r7, lr}
607 ldr r2, 2f @ get address of __pv_phys_offset
608 mov r3, #0 @ no offset 677 mov r3, #0 @ no offset
609 mov r4, r0 @ r0 = table start 678 mov r4, r0 @ r0 = table start
610 add r5, r0, r1 @ r1 = table size 679 add r5, r0, r1 @ r1 = table size
611 ldr r6, [r2, #4] @ get __pv_offset
612 bl __fixup_a_pv_table 680 bl __fixup_a_pv_table
613 ldmfd sp!, {r4 - r7, pc} 681 ldmfd sp!, {r4 - r7, pc}
614ENDPROC(fixup_pv_table) 682ENDPROC(fixup_pv_table)
615 683
616 .align
6172: .long __pv_phys_offset
618
619 .data 684 .data
620 .globl __pv_phys_offset 685 .globl __pv_phys_offset
621 .type __pv_phys_offset, %object 686 .type __pv_phys_offset, %object
622__pv_phys_offset: 687__pv_phys_offset:
623 .long 0 688 .quad 0
624 .size __pv_phys_offset, . - __pv_phys_offset 689 .size __pv_phys_offset, . -__pv_phys_offset
690
691 .globl __pv_offset
692 .type __pv_offset, %object
625__pv_offset: 693__pv_offset:
626 .long 0 694 .quad 0
695 .size __pv_offset, . -__pv_offset
627#endif 696#endif
628 697
629#include "head-common.S" 698#include "head-common.S"
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index 7b95de601357..3d446605cbf8 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -344,13 +344,13 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
344 /* Breakpoint */ 344 /* Breakpoint */
345 ctrl_base = ARM_BASE_BCR; 345 ctrl_base = ARM_BASE_BCR;
346 val_base = ARM_BASE_BVR; 346 val_base = ARM_BASE_BVR;
347 slots = (struct perf_event **)__get_cpu_var(bp_on_reg); 347 slots = this_cpu_ptr(bp_on_reg);
348 max_slots = core_num_brps; 348 max_slots = core_num_brps;
349 } else { 349 } else {
350 /* Watchpoint */ 350 /* Watchpoint */
351 ctrl_base = ARM_BASE_WCR; 351 ctrl_base = ARM_BASE_WCR;
352 val_base = ARM_BASE_WVR; 352 val_base = ARM_BASE_WVR;
353 slots = (struct perf_event **)__get_cpu_var(wp_on_reg); 353 slots = this_cpu_ptr(wp_on_reg);
354 max_slots = core_num_wrps; 354 max_slots = core_num_wrps;
355 } 355 }
356 356
@@ -396,12 +396,12 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp)
396 if (info->ctrl.type == ARM_BREAKPOINT_EXECUTE) { 396 if (info->ctrl.type == ARM_BREAKPOINT_EXECUTE) {
397 /* Breakpoint */ 397 /* Breakpoint */
398 base = ARM_BASE_BCR; 398 base = ARM_BASE_BCR;
399 slots = (struct perf_event **)__get_cpu_var(bp_on_reg); 399 slots = this_cpu_ptr(bp_on_reg);
400 max_slots = core_num_brps; 400 max_slots = core_num_brps;
401 } else { 401 } else {
402 /* Watchpoint */ 402 /* Watchpoint */
403 base = ARM_BASE_WCR; 403 base = ARM_BASE_WCR;
404 slots = (struct perf_event **)__get_cpu_var(wp_on_reg); 404 slots = this_cpu_ptr(wp_on_reg);
405 max_slots = core_num_wrps; 405 max_slots = core_num_wrps;
406 } 406 }
407 407
@@ -697,7 +697,7 @@ static void watchpoint_handler(unsigned long addr, unsigned int fsr,
697 struct arch_hw_breakpoint *info; 697 struct arch_hw_breakpoint *info;
698 struct arch_hw_breakpoint_ctrl ctrl; 698 struct arch_hw_breakpoint_ctrl ctrl;
699 699
700 slots = (struct perf_event **)__get_cpu_var(wp_on_reg); 700 slots = this_cpu_ptr(wp_on_reg);
701 701
702 for (i = 0; i < core_num_wrps; ++i) { 702 for (i = 0; i < core_num_wrps; ++i) {
703 rcu_read_lock(); 703 rcu_read_lock();
@@ -768,7 +768,7 @@ static void watchpoint_single_step_handler(unsigned long pc)
768 struct perf_event *wp, **slots; 768 struct perf_event *wp, **slots;
769 struct arch_hw_breakpoint *info; 769 struct arch_hw_breakpoint *info;
770 770
771 slots = (struct perf_event **)__get_cpu_var(wp_on_reg); 771 slots = this_cpu_ptr(wp_on_reg);
772 772
773 for (i = 0; i < core_num_wrps; ++i) { 773 for (i = 0; i < core_num_wrps; ++i) {
774 rcu_read_lock(); 774 rcu_read_lock();
@@ -802,7 +802,7 @@ static void breakpoint_handler(unsigned long unknown, struct pt_regs *regs)
802 struct arch_hw_breakpoint *info; 802 struct arch_hw_breakpoint *info;
803 struct arch_hw_breakpoint_ctrl ctrl; 803 struct arch_hw_breakpoint_ctrl ctrl;
804 804
805 slots = (struct perf_event **)__get_cpu_var(bp_on_reg); 805 slots = this_cpu_ptr(bp_on_reg);
806 806
807 /* The exception entry code places the amended lr in the PC. */ 807 /* The exception entry code places the amended lr in the PC. */
808 addr = regs->ARM_pc; 808 addr = regs->ARM_pc;
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c
index 170e9f34003f..a7b621ece23d 100644
--- a/arch/arm/kernel/kprobes.c
+++ b/arch/arm/kernel/kprobes.c
@@ -171,13 +171,13 @@ static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
171 171
172static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) 172static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
173{ 173{
174 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; 174 __this_cpu_write(current_kprobe, kcb->prev_kprobe.kp);
175 kcb->kprobe_status = kcb->prev_kprobe.status; 175 kcb->kprobe_status = kcb->prev_kprobe.status;
176} 176}
177 177
178static void __kprobes set_current_kprobe(struct kprobe *p) 178static void __kprobes set_current_kprobe(struct kprobe *p)
179{ 179{
180 __get_cpu_var(current_kprobe) = p; 180 __this_cpu_write(current_kprobe, p);
181} 181}
182 182
183static void __kprobes 183static void __kprobes
@@ -421,10 +421,10 @@ static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
421 continue; 421 continue;
422 422
423 if (ri->rp && ri->rp->handler) { 423 if (ri->rp && ri->rp->handler) {
424 __get_cpu_var(current_kprobe) = &ri->rp->kp; 424 __this_cpu_write(current_kprobe, &ri->rp->kp);
425 get_kprobe_ctlblk()->kprobe_status = KPROBE_HIT_ACTIVE; 425 get_kprobe_ctlblk()->kprobe_status = KPROBE_HIT_ACTIVE;
426 ri->rp->handler(ri, regs); 426 ri->rp->handler(ri, regs);
427 __get_cpu_var(current_kprobe) = NULL; 427 __this_cpu_write(current_kprobe, NULL);
428 } 428 }
429 429
430 orig_ret_address = (unsigned long)ri->ret_addr; 430 orig_ret_address = (unsigned long)ri->ret_addr;
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index 084dc8896986..45e478157278 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -24,6 +24,7 @@
24#include <asm/sections.h> 24#include <asm/sections.h>
25#include <asm/smp_plat.h> 25#include <asm/smp_plat.h>
26#include <asm/unwind.h> 26#include <asm/unwind.h>
27#include <asm/opcodes.h>
27 28
28#ifdef CONFIG_XIP_KERNEL 29#ifdef CONFIG_XIP_KERNEL
29/* 30/*
@@ -40,7 +41,7 @@
40void *module_alloc(unsigned long size) 41void *module_alloc(unsigned long size)
41{ 42{
42 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, 43 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
43 GFP_KERNEL, PAGE_KERNEL_EXEC, -1, 44 GFP_KERNEL, PAGE_KERNEL_EXEC, NUMA_NO_NODE,
44 __builtin_return_address(0)); 45 __builtin_return_address(0));
45} 46}
46#endif 47#endif
@@ -60,6 +61,7 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
60 Elf32_Sym *sym; 61 Elf32_Sym *sym;
61 const char *symname; 62 const char *symname;
62 s32 offset; 63 s32 offset;
64 u32 tmp;
63#ifdef CONFIG_THUMB2_KERNEL 65#ifdef CONFIG_THUMB2_KERNEL
64 u32 upper, lower, sign, j1, j2; 66 u32 upper, lower, sign, j1, j2;
65#endif 67#endif
@@ -95,7 +97,8 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
95 case R_ARM_PC24: 97 case R_ARM_PC24:
96 case R_ARM_CALL: 98 case R_ARM_CALL:
97 case R_ARM_JUMP24: 99 case R_ARM_JUMP24:
98 offset = (*(u32 *)loc & 0x00ffffff) << 2; 100 offset = __mem_to_opcode_arm(*(u32 *)loc);
101 offset = (offset & 0x00ffffff) << 2;
99 if (offset & 0x02000000) 102 if (offset & 0x02000000)
100 offset -= 0x04000000; 103 offset -= 0x04000000;
101 104
@@ -111,9 +114,10 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
111 } 114 }
112 115
113 offset >>= 2; 116 offset >>= 2;
117 offset &= 0x00ffffff;
114 118
115 *(u32 *)loc &= 0xff000000; 119 *(u32 *)loc &= __opcode_to_mem_arm(0xff000000);
116 *(u32 *)loc |= offset & 0x00ffffff; 120 *(u32 *)loc |= __opcode_to_mem_arm(offset);
117 break; 121 break;
118 122
119 case R_ARM_V4BX: 123 case R_ARM_V4BX:
@@ -121,8 +125,8 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
121 * other bits to re-code instruction as 125 * other bits to re-code instruction as
122 * MOV PC,Rm. 126 * MOV PC,Rm.
123 */ 127 */
124 *(u32 *)loc &= 0xf000000f; 128 *(u32 *)loc &= __opcode_to_mem_arm(0xf000000f);
125 *(u32 *)loc |= 0x01a0f000; 129 *(u32 *)loc |= __opcode_to_mem_arm(0x01a0f000);
126 break; 130 break;
127 131
128 case R_ARM_PREL31: 132 case R_ARM_PREL31:
@@ -132,7 +136,7 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
132 136
133 case R_ARM_MOVW_ABS_NC: 137 case R_ARM_MOVW_ABS_NC:
134 case R_ARM_MOVT_ABS: 138 case R_ARM_MOVT_ABS:
135 offset = *(u32 *)loc; 139 offset = tmp = __mem_to_opcode_arm(*(u32 *)loc);
136 offset = ((offset & 0xf0000) >> 4) | (offset & 0xfff); 140 offset = ((offset & 0xf0000) >> 4) | (offset & 0xfff);
137 offset = (offset ^ 0x8000) - 0x8000; 141 offset = (offset ^ 0x8000) - 0x8000;
138 142
@@ -140,16 +144,18 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
140 if (ELF32_R_TYPE(rel->r_info) == R_ARM_MOVT_ABS) 144 if (ELF32_R_TYPE(rel->r_info) == R_ARM_MOVT_ABS)
141 offset >>= 16; 145 offset >>= 16;
142 146
143 *(u32 *)loc &= 0xfff0f000; 147 tmp &= 0xfff0f000;
144 *(u32 *)loc |= ((offset & 0xf000) << 4) | 148 tmp |= ((offset & 0xf000) << 4) |
145 (offset & 0x0fff); 149 (offset & 0x0fff);
150
151 *(u32 *)loc = __opcode_to_mem_arm(tmp);
146 break; 152 break;
147 153
148#ifdef CONFIG_THUMB2_KERNEL 154#ifdef CONFIG_THUMB2_KERNEL
149 case R_ARM_THM_CALL: 155 case R_ARM_THM_CALL:
150 case R_ARM_THM_JUMP24: 156 case R_ARM_THM_JUMP24:
151 upper = *(u16 *)loc; 157 upper = __mem_to_opcode_thumb16(*(u16 *)loc);
152 lower = *(u16 *)(loc + 2); 158 lower = __mem_to_opcode_thumb16(*(u16 *)(loc + 2));
153 159
154 /* 160 /*
155 * 25 bit signed address range (Thumb-2 BL and B.W 161 * 25 bit signed address range (Thumb-2 BL and B.W
@@ -198,17 +204,20 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
198 sign = (offset >> 24) & 1; 204 sign = (offset >> 24) & 1;
199 j1 = sign ^ (~(offset >> 23) & 1); 205 j1 = sign ^ (~(offset >> 23) & 1);
200 j2 = sign ^ (~(offset >> 22) & 1); 206 j2 = sign ^ (~(offset >> 22) & 1);
201 *(u16 *)loc = (u16)((upper & 0xf800) | (sign << 10) | 207 upper = (u16)((upper & 0xf800) | (sign << 10) |
202 ((offset >> 12) & 0x03ff)); 208 ((offset >> 12) & 0x03ff));
203 *(u16 *)(loc + 2) = (u16)((lower & 0xd000) | 209 lower = (u16)((lower & 0xd000) |
204 (j1 << 13) | (j2 << 11) | 210 (j1 << 13) | (j2 << 11) |
205 ((offset >> 1) & 0x07ff)); 211 ((offset >> 1) & 0x07ff));
212
213 *(u16 *)loc = __opcode_to_mem_thumb16(upper);
214 *(u16 *)(loc + 2) = __opcode_to_mem_thumb16(lower);
206 break; 215 break;
207 216
208 case R_ARM_THM_MOVW_ABS_NC: 217 case R_ARM_THM_MOVW_ABS_NC:
209 case R_ARM_THM_MOVT_ABS: 218 case R_ARM_THM_MOVT_ABS:
210 upper = *(u16 *)loc; 219 upper = __mem_to_opcode_thumb16(*(u16 *)loc);
211 lower = *(u16 *)(loc + 2); 220 lower = __mem_to_opcode_thumb16(*(u16 *)(loc + 2));
212 221
213 /* 222 /*
214 * MOVT/MOVW instructions encoding in Thumb-2: 223 * MOVT/MOVW instructions encoding in Thumb-2:
@@ -229,12 +238,14 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
229 if (ELF32_R_TYPE(rel->r_info) == R_ARM_THM_MOVT_ABS) 238 if (ELF32_R_TYPE(rel->r_info) == R_ARM_THM_MOVT_ABS)
230 offset >>= 16; 239 offset >>= 16;
231 240
232 *(u16 *)loc = (u16)((upper & 0xfbf0) | 241 upper = (u16)((upper & 0xfbf0) |
233 ((offset & 0xf000) >> 12) | 242 ((offset & 0xf000) >> 12) |
234 ((offset & 0x0800) >> 1)); 243 ((offset & 0x0800) >> 1));
235 *(u16 *)(loc + 2) = (u16)((lower & 0x8f00) | 244 lower = (u16)((lower & 0x8f00) |
236 ((offset & 0x0700) << 4) | 245 ((offset & 0x0700) << 4) |
237 (offset & 0x00ff)); 246 (offset & 0x00ff));
247 *(u16 *)loc = __opcode_to_mem_thumb16(upper);
248 *(u16 *)(loc + 2) = __opcode_to_mem_thumb16(lower);
238 break; 249 break;
239#endif 250#endif
240 251
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index e186ee1e63f6..bc3f2efa0d86 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -256,12 +256,11 @@ validate_event(struct pmu_hw_events *hw_events,
256 struct perf_event *event) 256 struct perf_event *event)
257{ 257{
258 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); 258 struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
259 struct pmu *leader_pmu = event->group_leader->pmu;
260 259
261 if (is_software_event(event)) 260 if (is_software_event(event))
262 return 1; 261 return 1;
263 262
264 if (event->pmu != leader_pmu || event->state < PERF_EVENT_STATE_OFF) 263 if (event->state < PERF_EVENT_STATE_OFF)
265 return 1; 264 return 1;
266 265
267 if (event->state == PERF_EVENT_STATE_OFF && !event->attr.enable_on_exec) 266 if (event->state == PERF_EVENT_STATE_OFF && !event->attr.enable_on_exec)
diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c
index 8d6147b2001f..d85055cd24ba 100644
--- a/arch/arm/kernel/perf_event_cpu.c
+++ b/arch/arm/kernel/perf_event_cpu.c
@@ -68,7 +68,7 @@ EXPORT_SYMBOL_GPL(perf_num_counters);
68 68
69static struct pmu_hw_events *cpu_pmu_get_cpu_events(void) 69static struct pmu_hw_events *cpu_pmu_get_cpu_events(void)
70{ 70{
71 return &__get_cpu_var(cpu_hw_events); 71 return this_cpu_ptr(&cpu_hw_events);
72} 72}
73 73
74static void cpu_pmu_free_irq(struct arm_pmu *cpu_pmu) 74static void cpu_pmu_free_irq(struct arm_pmu *cpu_pmu)
diff --git a/arch/arm/kernel/perf_regs.c b/arch/arm/kernel/perf_regs.c
new file mode 100644
index 000000000000..6e4379c67cbc
--- /dev/null
+++ b/arch/arm/kernel/perf_regs.c
@@ -0,0 +1,30 @@
1
2#include <linux/errno.h>
3#include <linux/kernel.h>
4#include <linux/perf_event.h>
5#include <linux/bug.h>
6#include <asm/perf_regs.h>
7#include <asm/ptrace.h>
8
9u64 perf_reg_value(struct pt_regs *regs, int idx)
10{
11 if (WARN_ON_ONCE((u32)idx >= PERF_REG_ARM_MAX))
12 return 0;
13
14 return regs->uregs[idx];
15}
16
17#define REG_RESERVED (~((1ULL << PERF_REG_ARM_MAX) - 1))
18
19int perf_reg_validate(u64 mask)
20{
21 if (!mask || mask & REG_RESERVED)
22 return -EINVAL;
23
24 return 0;
25}
26
27u64 perf_reg_abi(struct task_struct *task)
28{
29 return PERF_SAMPLE_REGS_ABI_32;
30}
diff --git a/arch/arm/kernel/psci_smp.c b/arch/arm/kernel/psci_smp.c
index 70ded3fb42d9..570a48cc3d64 100644
--- a/arch/arm/kernel/psci_smp.c
+++ b/arch/arm/kernel/psci_smp.c
@@ -14,7 +14,6 @@
14 */ 14 */
15 15
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/irqchip/arm-gic.h>
18#include <linux/smp.h> 17#include <linux/smp.h>
19#include <linux/of.h> 18#include <linux/of.h>
20 19
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 0e1e2b3afa45..6a1b8a81b1ae 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -73,6 +73,8 @@ __setup("fpe=", fpe_setup);
73#endif 73#endif
74 74
75extern void paging_init(const struct machine_desc *desc); 75extern void paging_init(const struct machine_desc *desc);
76extern void early_paging_init(const struct machine_desc *,
77 struct proc_info_list *);
76extern void sanity_check_meminfo(void); 78extern void sanity_check_meminfo(void);
77extern enum reboot_mode reboot_mode; 79extern enum reboot_mode reboot_mode;
78extern void setup_dma_zone(const struct machine_desc *desc); 80extern void setup_dma_zone(const struct machine_desc *desc);
@@ -599,6 +601,8 @@ static void __init setup_processor(void)
599 elf_hwcap &= ~(HWCAP_THUMB | HWCAP_IDIVT); 601 elf_hwcap &= ~(HWCAP_THUMB | HWCAP_IDIVT);
600#endif 602#endif
601 603
604 erratum_a15_798181_init();
605
602 feat_v6_fixup(); 606 feat_v6_fixup();
603 607
604 cacheid_init(); 608 cacheid_init();
@@ -619,9 +623,10 @@ void __init dump_machine_table(void)
619 /* can't use cpu_relax() here as it may require MMU setup */; 623 /* can't use cpu_relax() here as it may require MMU setup */;
620} 624}
621 625
622int __init arm_add_memory(phys_addr_t start, phys_addr_t size) 626int __init arm_add_memory(u64 start, u64 size)
623{ 627{
624 struct membank *bank = &meminfo.bank[meminfo.nr_banks]; 628 struct membank *bank = &meminfo.bank[meminfo.nr_banks];
629 u64 aligned_start;
625 630
626 if (meminfo.nr_banks >= NR_BANKS) { 631 if (meminfo.nr_banks >= NR_BANKS) {
627 printk(KERN_CRIT "NR_BANKS too low, " 632 printk(KERN_CRIT "NR_BANKS too low, "
@@ -634,10 +639,16 @@ int __init arm_add_memory(phys_addr_t start, phys_addr_t size)
634 * Size is appropriately rounded down, start is rounded up. 639 * Size is appropriately rounded down, start is rounded up.
635 */ 640 */
636 size -= start & ~PAGE_MASK; 641 size -= start & ~PAGE_MASK;
637 bank->start = PAGE_ALIGN(start); 642 aligned_start = PAGE_ALIGN(start);
638 643
639#ifndef CONFIG_ARM_LPAE 644#ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT
640 if (bank->start + size < bank->start) { 645 if (aligned_start > ULONG_MAX) {
646 printk(KERN_CRIT "Ignoring memory at 0x%08llx outside "
647 "32-bit physical address space\n", (long long)start);
648 return -EINVAL;
649 }
650
651 if (aligned_start + size > ULONG_MAX) {
641 printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in " 652 printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in "
642 "32-bit physical address space\n", (long long)start); 653 "32-bit physical address space\n", (long long)start);
643 /* 654 /*
@@ -645,10 +656,11 @@ int __init arm_add_memory(phys_addr_t start, phys_addr_t size)
645 * 32 bits, we use ULONG_MAX as the upper limit rather than 4GB. 656 * 32 bits, we use ULONG_MAX as the upper limit rather than 4GB.
646 * This means we lose a page after masking. 657 * This means we lose a page after masking.
647 */ 658 */
648 size = ULONG_MAX - bank->start; 659 size = ULONG_MAX - aligned_start;
649 } 660 }
650#endif 661#endif
651 662
663 bank->start = aligned_start;
652 bank->size = size & ~(phys_addr_t)(PAGE_SIZE - 1); 664 bank->size = size & ~(phys_addr_t)(PAGE_SIZE - 1);
653 665
654 /* 666 /*
@@ -669,8 +681,8 @@ int __init arm_add_memory(phys_addr_t start, phys_addr_t size)
669static int __init early_mem(char *p) 681static int __init early_mem(char *p)
670{ 682{
671 static int usermem __initdata = 0; 683 static int usermem __initdata = 0;
672 phys_addr_t size; 684 u64 size;
673 phys_addr_t start; 685 u64 start;
674 char *endp; 686 char *endp;
675 687
676 /* 688 /*
@@ -878,6 +890,8 @@ void __init setup_arch(char **cmdline_p)
878 parse_early_param(); 890 parse_early_param();
879 891
880 sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL); 892 sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
893
894 early_paging_init(mdesc, lookup_processor_type(read_cpuid_id()));
881 sanity_check_meminfo(); 895 sanity_check_meminfo();
882 arm_memblock_init(&meminfo, mdesc); 896 arm_memblock_init(&meminfo, mdesc);
883 897
@@ -975,6 +989,7 @@ static const char *hwcap_str[] = {
975 "idivt", 989 "idivt",
976 "vfpd32", 990 "vfpd32",
977 "lpae", 991 "lpae",
992 "evtstrm",
978 NULL 993 NULL
979}; 994};
980 995
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index ab3304225272..04d63880037f 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -21,29 +21,7 @@
21#include <asm/unistd.h> 21#include <asm/unistd.h>
22#include <asm/vfp.h> 22#include <asm/vfp.h>
23 23
24/* 24extern const unsigned long sigreturn_codes[7];
25 * For ARM syscalls, we encode the syscall number into the instruction.
26 */
27#define SWI_SYS_SIGRETURN (0xef000000|(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE))
28#define SWI_SYS_RT_SIGRETURN (0xef000000|(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE))
29
30/*
31 * With EABI, the syscall number has to be loaded into r7.
32 */
33#define MOV_R7_NR_SIGRETURN (0xe3a07000 | (__NR_sigreturn - __NR_SYSCALL_BASE))
34#define MOV_R7_NR_RT_SIGRETURN (0xe3a07000 | (__NR_rt_sigreturn - __NR_SYSCALL_BASE))
35
36/*
37 * For Thumb syscalls, we pass the syscall number via r7. We therefore
38 * need two 16-bit instructions.
39 */
40#define SWI_THUMB_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_sigreturn - __NR_SYSCALL_BASE))
41#define SWI_THUMB_RT_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_rt_sigreturn - __NR_SYSCALL_BASE))
42
43static const unsigned long sigreturn_codes[7] = {
44 MOV_R7_NR_SIGRETURN, SWI_SYS_SIGRETURN, SWI_THUMB_SIGRETURN,
45 MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN,
46};
47 25
48static unsigned long signal_return_offset; 26static unsigned long signal_return_offset;
49 27
@@ -375,12 +353,18 @@ setup_return(struct pt_regs *regs, struct ksignal *ksig,
375 */ 353 */
376 thumb = handler & 1; 354 thumb = handler & 1;
377 355
378 if (thumb) {
379 cpsr |= PSR_T_BIT;
380#if __LINUX_ARM_ARCH__ >= 7 356#if __LINUX_ARM_ARCH__ >= 7
381 /* clear the If-Then Thumb-2 execution state */ 357 /*
382 cpsr &= ~PSR_IT_MASK; 358 * Clear the If-Then Thumb-2 execution state
359 * ARM spec requires this to be all 000s in ARM mode
360 * Snapdragon S4/Krait misbehaves on a Thumb=>ARM
361 * signal transition without this.
362 */
363 cpsr &= ~PSR_IT_MASK;
383#endif 364#endif
365
366 if (thumb) {
367 cpsr |= PSR_T_BIT;
384 } else 368 } else
385 cpsr &= ~PSR_T_BIT; 369 cpsr &= ~PSR_T_BIT;
386 } 370 }
diff --git a/arch/arm/kernel/sigreturn_codes.S b/arch/arm/kernel/sigreturn_codes.S
new file mode 100644
index 000000000000..3c5d0f2170fd
--- /dev/null
+++ b/arch/arm/kernel/sigreturn_codes.S
@@ -0,0 +1,80 @@
1/*
2 * sigreturn_codes.S - code sinpets for sigreturn syscalls
3 *
4 * Created by: Victor Kamensky, 2013-08-13
5 * Copyright: (C) 2013 Linaro Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <asm/unistd.h>
18
19/*
20 * For ARM syscalls, we encode the syscall number into the instruction.
21 * With EABI, the syscall number has to be loaded into r7. As result
22 * ARM syscall sequence snippet will have move and svc in .arm encoding
23 *
24 * For Thumb syscalls, we pass the syscall number via r7. We therefore
25 * need two 16-bit instructions in .thumb encoding
26 *
27 * Please note sigreturn_codes code are not executed in place. Instead
28 * they just copied by kernel into appropriate places. Code inside of
29 * arch/arm/kernel/signal.c is very sensitive to layout of these code
30 * snippets.
31 */
32
33#if __LINUX_ARM_ARCH__ <= 4
34 /*
35 * Note we manually set minimally required arch that supports
36 * required thumb opcodes for early arch versions. It is OK
37 * for this file to be used in combination with other
38 * lower arch variants, since these code snippets are only
39 * used as input data.
40 */
41 .arch armv4t
42#endif
43
44 .section .rodata
45 .global sigreturn_codes
46 .type sigreturn_codes, #object
47
48 .arm
49
50sigreturn_codes:
51
52 /* ARM sigreturn syscall code snippet */
53 mov r7, #(__NR_sigreturn - __NR_SYSCALL_BASE)
54 swi #(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE)
55
56 /* Thumb sigreturn syscall code snippet */
57 .thumb
58 movs r7, #(__NR_sigreturn - __NR_SYSCALL_BASE)
59 swi #0
60
61 /* ARM sigreturn_rt syscall code snippet */
62 .arm
63 mov r7, #(__NR_rt_sigreturn - __NR_SYSCALL_BASE)
64 swi #(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE)
65
66 /* Thumb sigreturn_rt syscall code snippet */
67 .thumb
68 movs r7, #(__NR_rt_sigreturn - __NR_SYSCALL_BASE)
69 swi #0
70
71 /*
72 * Note on addtional space: setup_return in signal.c
73 * algorithm uses two words copy regardless whether
74 * it is thumb case or not, so we need additional
75 * word after real last entry.
76 */
77 .arm
78 .space 4
79
80 .size sigreturn_codes, . - sigreturn_codes
diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S
index db1536b8b30b..b907d9b790ab 100644
--- a/arch/arm/kernel/sleep.S
+++ b/arch/arm/kernel/sleep.S
@@ -55,6 +55,7 @@
55 * specific registers and some other data for resume. 55 * specific registers and some other data for resume.
56 * r0 = suspend function arg0 56 * r0 = suspend function arg0
57 * r1 = suspend function 57 * r1 = suspend function
58 * r2 = MPIDR value the resuming CPU will use
58 */ 59 */
59ENTRY(__cpu_suspend) 60ENTRY(__cpu_suspend)
60 stmfd sp!, {r4 - r11, lr} 61 stmfd sp!, {r4 - r11, lr}
@@ -67,23 +68,18 @@ ENTRY(__cpu_suspend)
67 mov r5, sp @ current virtual SP 68 mov r5, sp @ current virtual SP
68 add r4, r4, #12 @ Space for pgd, virt sp, phys resume fn 69 add r4, r4, #12 @ Space for pgd, virt sp, phys resume fn
69 sub sp, sp, r4 @ allocate CPU state on stack 70 sub sp, sp, r4 @ allocate CPU state on stack
70 stmfd sp!, {r0, r1} @ save suspend func arg and pointer
71 add r0, sp, #8 @ save pointer to save block
72 mov r1, r4 @ size of save block
73 mov r2, r5 @ virtual SP
74 ldr r3, =sleep_save_sp 71 ldr r3, =sleep_save_sp
72 stmfd sp!, {r0, r1} @ save suspend func arg and pointer
75 ldr r3, [r3, #SLEEP_SAVE_SP_VIRT] 73 ldr r3, [r3, #SLEEP_SAVE_SP_VIRT]
76 ALT_SMP(mrc p15, 0, r9, c0, c0, 5) 74 ALT_SMP(ldr r0, =mpidr_hash)
77 ALT_UP_B(1f) 75 ALT_UP_B(1f)
78 ldr r8, =mpidr_hash 76 /* This ldmia relies on the memory layout of the mpidr_hash struct */
79 /* 77 ldmia r0, {r1, r6-r8} @ r1 = mpidr mask (r6,r7,r8) = l[0,1,2] shifts
80 * This ldmia relies on the memory layout of the mpidr_hash 78 compute_mpidr_hash r0, r6, r7, r8, r2, r1
81 * struct mpidr_hash. 79 add r3, r3, r0, lsl #2
82 */ 801: mov r2, r5 @ virtual SP
83 ldmia r8, {r4-r7} @ r4 = mpidr mask (r5,r6,r7) = l[0,1,2] shifts 81 mov r1, r4 @ size of save block
84 compute_mpidr_hash lr, r5, r6, r7, r9, r4 82 add r0, sp, #8 @ pointer to save block
85 add r3, r3, lr, lsl #2
861:
87 bl __cpu_suspend_save 83 bl __cpu_suspend_save
88 adr lr, BSYM(cpu_suspend_abort) 84 adr lr, BSYM(cpu_suspend_abort)
89 ldmfd sp!, {r0, pc} @ call suspend fn 85 ldmfd sp!, {r0, pc} @ call suspend fn
@@ -130,6 +126,7 @@ ENDPROC(cpu_resume_after_mmu)
130 .data 126 .data
131 .align 127 .align
132ENTRY(cpu_resume) 128ENTRY(cpu_resume)
129ARM_BE8(setend be) @ ensure we are in BE mode
133 mov r1, #0 130 mov r1, #0
134 ALT_SMP(mrc p15, 0, r0, c0, c0, 5) 131 ALT_SMP(mrc p15, 0, r0, c0, c0, 5)
135 ALT_UP_B(1f) 132 ALT_UP_B(1f)
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 72024ea8a3a6..dc894ab3622b 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -25,6 +25,7 @@
25#include <linux/clockchips.h> 25#include <linux/clockchips.h>
26#include <linux/completion.h> 26#include <linux/completion.h>
27#include <linux/cpufreq.h> 27#include <linux/cpufreq.h>
28#include <linux/irq_work.h>
28 29
29#include <linux/atomic.h> 30#include <linux/atomic.h>
30#include <asm/smp.h> 31#include <asm/smp.h>
@@ -66,6 +67,8 @@ enum ipi_msg_type {
66 IPI_CALL_FUNC, 67 IPI_CALL_FUNC,
67 IPI_CALL_FUNC_SINGLE, 68 IPI_CALL_FUNC_SINGLE,
68 IPI_CPU_STOP, 69 IPI_CPU_STOP,
70 IPI_IRQ_WORK,
71 IPI_COMPLETION,
69}; 72};
70 73
71static DECLARE_COMPLETION(cpu_running); 74static DECLARE_COMPLETION(cpu_running);
@@ -80,7 +83,7 @@ void __init smp_set_ops(struct smp_operations *ops)
80 83
81static unsigned long get_arch_pgd(pgd_t *pgd) 84static unsigned long get_arch_pgd(pgd_t *pgd)
82{ 85{
83 phys_addr_t pgdir = virt_to_phys(pgd); 86 phys_addr_t pgdir = virt_to_idmap(pgd);
84 BUG_ON(pgdir & ARCH_PGD_MASK); 87 BUG_ON(pgdir & ARCH_PGD_MASK);
85 return pgdir >> ARCH_PGD_SHIFT; 88 return pgdir >> ARCH_PGD_SHIFT;
86} 89}
@@ -448,6 +451,14 @@ void arch_send_call_function_single_ipi(int cpu)
448 smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE); 451 smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
449} 452}
450 453
454#ifdef CONFIG_IRQ_WORK
455void arch_irq_work_raise(void)
456{
457 if (is_smp())
458 smp_cross_call(cpumask_of(smp_processor_id()), IPI_IRQ_WORK);
459}
460#endif
461
451static const char *ipi_types[NR_IPI] = { 462static const char *ipi_types[NR_IPI] = {
452#define S(x,s) [x] = s 463#define S(x,s) [x] = s
453 S(IPI_WAKEUP, "CPU wakeup interrupts"), 464 S(IPI_WAKEUP, "CPU wakeup interrupts"),
@@ -456,6 +467,8 @@ static const char *ipi_types[NR_IPI] = {
456 S(IPI_CALL_FUNC, "Function call interrupts"), 467 S(IPI_CALL_FUNC, "Function call interrupts"),
457 S(IPI_CALL_FUNC_SINGLE, "Single function call interrupts"), 468 S(IPI_CALL_FUNC_SINGLE, "Single function call interrupts"),
458 S(IPI_CPU_STOP, "CPU stop interrupts"), 469 S(IPI_CPU_STOP, "CPU stop interrupts"),
470 S(IPI_IRQ_WORK, "IRQ work interrupts"),
471 S(IPI_COMPLETION, "completion interrupts"),
459}; 472};
460 473
461void show_ipi_list(struct seq_file *p, int prec) 474void show_ipi_list(struct seq_file *p, int prec)
@@ -515,6 +528,19 @@ static void ipi_cpu_stop(unsigned int cpu)
515 cpu_relax(); 528 cpu_relax();
516} 529}
517 530
531static DEFINE_PER_CPU(struct completion *, cpu_completion);
532
533int register_ipi_completion(struct completion *completion, int cpu)
534{
535 per_cpu(cpu_completion, cpu) = completion;
536 return IPI_COMPLETION;
537}
538
539static void ipi_complete(unsigned int cpu)
540{
541 complete(per_cpu(cpu_completion, cpu));
542}
543
518/* 544/*
519 * Main handler for inter-processor interrupts 545 * Main handler for inter-processor interrupts
520 */ 546 */
@@ -565,6 +591,20 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
565 irq_exit(); 591 irq_exit();
566 break; 592 break;
567 593
594#ifdef CONFIG_IRQ_WORK
595 case IPI_IRQ_WORK:
596 irq_enter();
597 irq_work_run();
598 irq_exit();
599 break;
600#endif
601
602 case IPI_COMPLETION:
603 irq_enter();
604 ipi_complete(cpu);
605 irq_exit();
606 break;
607
568 default: 608 default:
569 printk(KERN_CRIT "CPU%u: Unknown IPI message 0x%x\n", 609 printk(KERN_CRIT "CPU%u: Unknown IPI message 0x%x\n",
570 cpu, ipinr); 610 cpu, ipinr);
diff --git a/arch/arm/kernel/smp_scu.c b/arch/arm/kernel/smp_scu.c
index 5bc1a63284e3..1aafa0d785eb 100644
--- a/arch/arm/kernel/smp_scu.c
+++ b/arch/arm/kernel/smp_scu.c
@@ -28,7 +28,7 @@
28 */ 28 */
29unsigned int __init scu_get_core_count(void __iomem *scu_base) 29unsigned int __init scu_get_core_count(void __iomem *scu_base)
30{ 30{
31 unsigned int ncores = __raw_readl(scu_base + SCU_CONFIG); 31 unsigned int ncores = readl_relaxed(scu_base + SCU_CONFIG);
32 return (ncores & 0x03) + 1; 32 return (ncores & 0x03) + 1;
33} 33}
34 34
@@ -42,19 +42,19 @@ void scu_enable(void __iomem *scu_base)
42#ifdef CONFIG_ARM_ERRATA_764369 42#ifdef CONFIG_ARM_ERRATA_764369
43 /* Cortex-A9 only */ 43 /* Cortex-A9 only */
44 if ((read_cpuid_id() & 0xff0ffff0) == 0x410fc090) { 44 if ((read_cpuid_id() & 0xff0ffff0) == 0x410fc090) {
45 scu_ctrl = __raw_readl(scu_base + 0x30); 45 scu_ctrl = readl_relaxed(scu_base + 0x30);
46 if (!(scu_ctrl & 1)) 46 if (!(scu_ctrl & 1))
47 __raw_writel(scu_ctrl | 0x1, scu_base + 0x30); 47 writel_relaxed(scu_ctrl | 0x1, scu_base + 0x30);
48 } 48 }
49#endif 49#endif
50 50
51 scu_ctrl = __raw_readl(scu_base + SCU_CTRL); 51 scu_ctrl = readl_relaxed(scu_base + SCU_CTRL);
52 /* already enabled? */ 52 /* already enabled? */
53 if (scu_ctrl & 1) 53 if (scu_ctrl & 1)
54 return; 54 return;
55 55
56 scu_ctrl |= 1; 56 scu_ctrl |= 1;
57 __raw_writel(scu_ctrl, scu_base + SCU_CTRL); 57 writel_relaxed(scu_ctrl, scu_base + SCU_CTRL);
58 58
59 /* 59 /*
60 * Ensure that the data accessed by CPU0 before the SCU was 60 * Ensure that the data accessed by CPU0 before the SCU was
@@ -80,9 +80,9 @@ int scu_power_mode(void __iomem *scu_base, unsigned int mode)
80 if (mode > 3 || mode == 1 || cpu > 3) 80 if (mode > 3 || mode == 1 || cpu > 3)
81 return -EINVAL; 81 return -EINVAL;
82 82
83 val = __raw_readb(scu_base + SCU_CPU_STATUS + cpu) & ~0x03; 83 val = readb_relaxed(scu_base + SCU_CPU_STATUS + cpu) & ~0x03;
84 val |= mode; 84 val |= mode;
85 __raw_writeb(val, scu_base + SCU_CPU_STATUS + cpu); 85 writeb_relaxed(val, scu_base + SCU_CPU_STATUS + cpu);
86 86
87 return 0; 87 return 0;
88} 88}
diff --git a/arch/arm/kernel/smp_tlb.c b/arch/arm/kernel/smp_tlb.c
index 83ccca303df8..95d063620b76 100644
--- a/arch/arm/kernel/smp_tlb.c
+++ b/arch/arm/kernel/smp_tlb.c
@@ -70,6 +70,40 @@ static inline void ipi_flush_bp_all(void *ignored)
70 local_flush_bp_all(); 70 local_flush_bp_all();
71} 71}
72 72
73#ifdef CONFIG_ARM_ERRATA_798181
74bool (*erratum_a15_798181_handler)(void);
75
76static bool erratum_a15_798181_partial(void)
77{
78 asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (0));
79 dsb(ish);
80 return false;
81}
82
83static bool erratum_a15_798181_broadcast(void)
84{
85 asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (0));
86 dsb(ish);
87 return true;
88}
89
90void erratum_a15_798181_init(void)
91{
92 unsigned int midr = read_cpuid_id();
93 unsigned int revidr = read_cpuid(CPUID_REVIDR);
94
95 /* Cortex-A15 r0p0..r3p2 w/o ECO fix affected */
96 if ((midr & 0xff0ffff0) != 0x410fc0f0 || midr > 0x413fc0f2 ||
97 (revidr & 0x210) == 0x210) {
98 return;
99 }
100 if (revidr & 0x10)
101 erratum_a15_798181_handler = erratum_a15_798181_partial;
102 else
103 erratum_a15_798181_handler = erratum_a15_798181_broadcast;
104}
105#endif
106
73static void ipi_flush_tlb_a15_erratum(void *arg) 107static void ipi_flush_tlb_a15_erratum(void *arg)
74{ 108{
75 dmb(); 109 dmb();
@@ -80,7 +114,6 @@ static void broadcast_tlb_a15_erratum(void)
80 if (!erratum_a15_798181()) 114 if (!erratum_a15_798181())
81 return; 115 return;
82 116
83 dummy_flush_tlb_a15_erratum();
84 smp_call_function(ipi_flush_tlb_a15_erratum, NULL, 1); 117 smp_call_function(ipi_flush_tlb_a15_erratum, NULL, 1);
85} 118}
86 119
@@ -92,7 +125,6 @@ static void broadcast_tlb_mm_a15_erratum(struct mm_struct *mm)
92 if (!erratum_a15_798181()) 125 if (!erratum_a15_798181())
93 return; 126 return;
94 127
95 dummy_flush_tlb_a15_erratum();
96 this_cpu = get_cpu(); 128 this_cpu = get_cpu();
97 a15_erratum_get_cpumask(this_cpu, mm, &mask); 129 a15_erratum_get_cpumask(this_cpu, mm, &mask);
98 smp_call_function_many(&mask, ipi_flush_tlb_a15_erratum, NULL, 1); 130 smp_call_function_many(&mask, ipi_flush_tlb_a15_erratum, NULL, 1);
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 2985c9f0905d..6591e26fc13f 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -45,7 +45,7 @@ static void twd_set_mode(enum clock_event_mode mode,
45 case CLOCK_EVT_MODE_PERIODIC: 45 case CLOCK_EVT_MODE_PERIODIC:
46 ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE 46 ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE
47 | TWD_TIMER_CONTROL_PERIODIC; 47 | TWD_TIMER_CONTROL_PERIODIC;
48 __raw_writel(DIV_ROUND_CLOSEST(twd_timer_rate, HZ), 48 writel_relaxed(DIV_ROUND_CLOSEST(twd_timer_rate, HZ),
49 twd_base + TWD_TIMER_LOAD); 49 twd_base + TWD_TIMER_LOAD);
50 break; 50 break;
51 case CLOCK_EVT_MODE_ONESHOT: 51 case CLOCK_EVT_MODE_ONESHOT:
@@ -58,18 +58,18 @@ static void twd_set_mode(enum clock_event_mode mode,
58 ctrl = 0; 58 ctrl = 0;
59 } 59 }
60 60
61 __raw_writel(ctrl, twd_base + TWD_TIMER_CONTROL); 61 writel_relaxed(ctrl, twd_base + TWD_TIMER_CONTROL);
62} 62}
63 63
64static int twd_set_next_event(unsigned long evt, 64static int twd_set_next_event(unsigned long evt,
65 struct clock_event_device *unused) 65 struct clock_event_device *unused)
66{ 66{
67 unsigned long ctrl = __raw_readl(twd_base + TWD_TIMER_CONTROL); 67 unsigned long ctrl = readl_relaxed(twd_base + TWD_TIMER_CONTROL);
68 68
69 ctrl |= TWD_TIMER_CONTROL_ENABLE; 69 ctrl |= TWD_TIMER_CONTROL_ENABLE;
70 70
71 __raw_writel(evt, twd_base + TWD_TIMER_COUNTER); 71 writel_relaxed(evt, twd_base + TWD_TIMER_COUNTER);
72 __raw_writel(ctrl, twd_base + TWD_TIMER_CONTROL); 72 writel_relaxed(ctrl, twd_base + TWD_TIMER_CONTROL);
73 73
74 return 0; 74 return 0;
75} 75}
@@ -82,8 +82,8 @@ static int twd_set_next_event(unsigned long evt,
82 */ 82 */
83static int twd_timer_ack(void) 83static int twd_timer_ack(void)
84{ 84{
85 if (__raw_readl(twd_base + TWD_TIMER_INTSTAT)) { 85 if (readl_relaxed(twd_base + TWD_TIMER_INTSTAT)) {
86 __raw_writel(1, twd_base + TWD_TIMER_INTSTAT); 86 writel_relaxed(1, twd_base + TWD_TIMER_INTSTAT);
87 return 1; 87 return 1;
88 } 88 }
89 89
@@ -211,15 +211,15 @@ static void twd_calibrate_rate(void)
211 waitjiffies += 5; 211 waitjiffies += 5;
212 212
213 /* enable, no interrupt or reload */ 213 /* enable, no interrupt or reload */
214 __raw_writel(0x1, twd_base + TWD_TIMER_CONTROL); 214 writel_relaxed(0x1, twd_base + TWD_TIMER_CONTROL);
215 215
216 /* maximum value */ 216 /* maximum value */
217 __raw_writel(0xFFFFFFFFU, twd_base + TWD_TIMER_COUNTER); 217 writel_relaxed(0xFFFFFFFFU, twd_base + TWD_TIMER_COUNTER);
218 218
219 while (get_jiffies_64() < waitjiffies) 219 while (get_jiffies_64() < waitjiffies)
220 udelay(10); 220 udelay(10);
221 221
222 count = __raw_readl(twd_base + TWD_TIMER_COUNTER); 222 count = readl_relaxed(twd_base + TWD_TIMER_COUNTER);
223 223
224 twd_timer_rate = (0xFFFFFFFFU - count) * (HZ / 5); 224 twd_timer_rate = (0xFFFFFFFFU - count) * (HZ / 5);
225 225
@@ -277,7 +277,7 @@ static void twd_timer_setup(void)
277 * bother with the below. 277 * bother with the below.
278 */ 278 */
279 if (per_cpu(percpu_setup_called, cpu)) { 279 if (per_cpu(percpu_setup_called, cpu)) {
280 __raw_writel(0, twd_base + TWD_TIMER_CONTROL); 280 writel_relaxed(0, twd_base + TWD_TIMER_CONTROL);
281 clockevents_register_device(clk); 281 clockevents_register_device(clk);
282 enable_percpu_irq(clk->irq, 0); 282 enable_percpu_irq(clk->irq, 0);
283 return; 283 return;
@@ -290,7 +290,7 @@ static void twd_timer_setup(void)
290 * The following is done once per CPU the first time .setup() is 290 * The following is done once per CPU the first time .setup() is
291 * called. 291 * called.
292 */ 292 */
293 __raw_writel(0, twd_base + TWD_TIMER_CONTROL); 293 writel_relaxed(0, twd_base + TWD_TIMER_CONTROL);
294 294
295 clk->name = "local_timer"; 295 clk->name = "local_timer";
296 clk->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT | 296 clk->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT |
diff --git a/arch/arm/kernel/suspend.c b/arch/arm/kernel/suspend.c
index 41cf3cbf756d..2835d35234ca 100644
--- a/arch/arm/kernel/suspend.c
+++ b/arch/arm/kernel/suspend.c
@@ -10,7 +10,7 @@
10#include <asm/suspend.h> 10#include <asm/suspend.h>
11#include <asm/tlbflush.h> 11#include <asm/tlbflush.h>
12 12
13extern int __cpu_suspend(unsigned long, int (*)(unsigned long)); 13extern int __cpu_suspend(unsigned long, int (*)(unsigned long), u32 cpuid);
14extern void cpu_resume_mmu(void); 14extern void cpu_resume_mmu(void);
15 15
16#ifdef CONFIG_MMU 16#ifdef CONFIG_MMU
@@ -21,6 +21,7 @@ extern void cpu_resume_mmu(void);
21int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) 21int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
22{ 22{
23 struct mm_struct *mm = current->active_mm; 23 struct mm_struct *mm = current->active_mm;
24 u32 __mpidr = cpu_logical_map(smp_processor_id());
24 int ret; 25 int ret;
25 26
26 if (!idmap_pgd) 27 if (!idmap_pgd)
@@ -32,7 +33,7 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
32 * resume (indicated by a zero return code), we need to switch 33 * resume (indicated by a zero return code), we need to switch
33 * back to the correct page tables. 34 * back to the correct page tables.
34 */ 35 */
35 ret = __cpu_suspend(arg, fn); 36 ret = __cpu_suspend(arg, fn, __mpidr);
36 if (ret == 0) { 37 if (ret == 0) {
37 cpu_switch_mm(mm->pgd, mm); 38 cpu_switch_mm(mm->pgd, mm);
38 local_flush_bp_all(); 39 local_flush_bp_all();
@@ -44,7 +45,8 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
44#else 45#else
45int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) 46int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
46{ 47{
47 return __cpu_suspend(arg, fn); 48 u32 __mpidr = cpu_logical_map(smp_processor_id());
49 return __cpu_suspend(arg, fn, __mpidr);
48} 50}
49#define idmap_pgd NULL 51#define idmap_pgd NULL
50#endif 52#endif
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 98aee3258398..829a96d4a179 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -11,25 +11,26 @@
11 * This file contains the ARM-specific time handling details: 11 * This file contains the ARM-specific time handling details:
12 * reading the RTC at bootup, etc... 12 * reading the RTC at bootup, etc...
13 */ 13 */
14#include <linux/clk-provider.h>
15#include <linux/clocksource.h>
16#include <linux/errno.h>
14#include <linux/export.h> 17#include <linux/export.h>
15#include <linux/kernel.h>
16#include <linux/interrupt.h>
17#include <linux/time.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/interrupt.h>
20#include <linux/irq.h>
21#include <linux/kernel.h>
22#include <linux/profile.h>
19#include <linux/sched.h> 23#include <linux/sched.h>
24#include <linux/sched_clock.h>
20#include <linux/smp.h> 25#include <linux/smp.h>
26#include <linux/time.h>
21#include <linux/timex.h> 27#include <linux/timex.h>
22#include <linux/errno.h>
23#include <linux/profile.h>
24#include <linux/timer.h> 28#include <linux/timer.h>
25#include <linux/clocksource.h>
26#include <linux/irq.h>
27#include <linux/sched_clock.h>
28 29
29#include <asm/thread_info.h>
30#include <asm/stacktrace.h>
31#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
32#include <asm/mach/time.h> 31#include <asm/mach/time.h>
32#include <asm/stacktrace.h>
33#include <asm/thread_info.h>
33 34
34#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \ 35#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \
35 defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE) 36 defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE)
@@ -116,8 +117,12 @@ int __init register_persistent_clock(clock_access_fn read_boot,
116 117
117void __init time_init(void) 118void __init time_init(void)
118{ 119{
119 if (machine_desc->init_time) 120 if (machine_desc->init_time) {
120 machine_desc->init_time(); 121 machine_desc->init_time();
121 else 122 } else {
123#ifdef CONFIG_COMMON_CLK
124 of_clk_init(NULL);
125#endif
122 clocksource_of_init(); 126 clocksource_of_init();
127 }
123} 128}
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 8fcda140358d..6125f259b7b5 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -34,6 +34,7 @@
34#include <asm/unwind.h> 34#include <asm/unwind.h>
35#include <asm/tls.h> 35#include <asm/tls.h>
36#include <asm/system_misc.h> 36#include <asm/system_misc.h>
37#include <asm/opcodes.h>
37 38
38static const char *handler[]= { "prefetch abort", "data abort", "address exception", "interrupt" }; 39static const char *handler[]= { "prefetch abort", "data abort", "address exception", "interrupt" };
39 40
@@ -341,15 +342,17 @@ void arm_notify_die(const char *str, struct pt_regs *regs,
341int is_valid_bugaddr(unsigned long pc) 342int is_valid_bugaddr(unsigned long pc)
342{ 343{
343#ifdef CONFIG_THUMB2_KERNEL 344#ifdef CONFIG_THUMB2_KERNEL
344 unsigned short bkpt; 345 u16 bkpt;
346 u16 insn = __opcode_to_mem_thumb16(BUG_INSTR_VALUE);
345#else 347#else
346 unsigned long bkpt; 348 u32 bkpt;
349 u32 insn = __opcode_to_mem_arm(BUG_INSTR_VALUE);
347#endif 350#endif
348 351
349 if (probe_kernel_address((unsigned *)pc, bkpt)) 352 if (probe_kernel_address((unsigned *)pc, bkpt))
350 return 0; 353 return 0;
351 354
352 return bkpt == BUG_INSTR_VALUE; 355 return bkpt == insn;
353} 356}
354 357
355#endif 358#endif
@@ -402,25 +405,28 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
402 if (processor_mode(regs) == SVC_MODE) { 405 if (processor_mode(regs) == SVC_MODE) {
403#ifdef CONFIG_THUMB2_KERNEL 406#ifdef CONFIG_THUMB2_KERNEL
404 if (thumb_mode(regs)) { 407 if (thumb_mode(regs)) {
405 instr = ((u16 *)pc)[0]; 408 instr = __mem_to_opcode_thumb16(((u16 *)pc)[0]);
406 if (is_wide_instruction(instr)) { 409 if (is_wide_instruction(instr)) {
407 instr <<= 16; 410 u16 inst2;
408 instr |= ((u16 *)pc)[1]; 411 inst2 = __mem_to_opcode_thumb16(((u16 *)pc)[1]);
412 instr = __opcode_thumb32_compose(instr, inst2);
409 } 413 }
410 } else 414 } else
411#endif 415#endif
412 instr = *(u32 *) pc; 416 instr = __mem_to_opcode_arm(*(u32 *) pc);
413 } else if (thumb_mode(regs)) { 417 } else if (thumb_mode(regs)) {
414 if (get_user(instr, (u16 __user *)pc)) 418 if (get_user(instr, (u16 __user *)pc))
415 goto die_sig; 419 goto die_sig;
420 instr = __mem_to_opcode_thumb16(instr);
416 if (is_wide_instruction(instr)) { 421 if (is_wide_instruction(instr)) {
417 unsigned int instr2; 422 unsigned int instr2;
418 if (get_user(instr2, (u16 __user *)pc+1)) 423 if (get_user(instr2, (u16 __user *)pc+1))
419 goto die_sig; 424 goto die_sig;
420 instr <<= 16; 425 instr2 = __mem_to_opcode_thumb16(instr2);
421 instr |= instr2; 426 instr = __opcode_thumb32_compose(instr, instr2);
422 } 427 }
423 } else if (get_user(instr, (u32 __user *)pc)) { 428 } else if (get_user(instr, (u32 __user *)pc)) {
429 instr = __mem_to_opcode_arm(instr);
424 goto die_sig; 430 goto die_sig;
425 } 431 }
426 432
diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig
index ebf5015508b5..466bd299b1a8 100644
--- a/arch/arm/kvm/Kconfig
+++ b/arch/arm/kvm/Kconfig
@@ -20,6 +20,7 @@ config KVM
20 bool "Kernel-based Virtual Machine (KVM) support" 20 bool "Kernel-based Virtual Machine (KVM) support"
21 select PREEMPT_NOTIFIERS 21 select PREEMPT_NOTIFIERS
22 select ANON_INODES 22 select ANON_INODES
23 select HAVE_KVM_CPU_RELAX_INTERCEPT
23 select KVM_MMIO 24 select KVM_MMIO
24 select KVM_ARM_HOST 25 select KVM_ARM_HOST
25 depends on ARM_VIRT_EXT && ARM_LPAE 26 depends on ARM_VIRT_EXT && ARM_LPAE
diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
index d99bee4950e5..789bca9e64a7 100644
--- a/arch/arm/kvm/Makefile
+++ b/arch/arm/kvm/Makefile
@@ -19,6 +19,6 @@ kvm-arm-y = $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o
19 19
20obj-y += kvm-arm.o init.o interrupts.o 20obj-y += kvm-arm.o init.o interrupts.o
21obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o 21obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o
22obj-y += coproc.o coproc_a15.o mmio.o psci.o perf.o 22obj-y += coproc.o coproc_a15.o coproc_a7.o mmio.o psci.o perf.o
23obj-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic.o 23obj-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic.o
24obj-$(CONFIG_KVM_ARM_TIMER) += $(KVM)/arm/arch_timer.o 24obj-$(CONFIG_KVM_ARM_TIMER) += $(KVM)/arm/arch_timer.o
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 9c697db2787e..2a700e00528d 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -65,7 +65,7 @@ static bool vgic_present;
65static void kvm_arm_set_running_vcpu(struct kvm_vcpu *vcpu) 65static void kvm_arm_set_running_vcpu(struct kvm_vcpu *vcpu)
66{ 66{
67 BUG_ON(preemptible()); 67 BUG_ON(preemptible());
68 __get_cpu_var(kvm_arm_running_vcpu) = vcpu; 68 __this_cpu_write(kvm_arm_running_vcpu, vcpu);
69} 69}
70 70
71/** 71/**
@@ -75,7 +75,7 @@ static void kvm_arm_set_running_vcpu(struct kvm_vcpu *vcpu)
75struct kvm_vcpu *kvm_arm_get_running_vcpu(void) 75struct kvm_vcpu *kvm_arm_get_running_vcpu(void)
76{ 76{
77 BUG_ON(preemptible()); 77 BUG_ON(preemptible());
78 return __get_cpu_var(kvm_arm_running_vcpu); 78 return __this_cpu_read(kvm_arm_running_vcpu);
79} 79}
80 80
81/** 81/**
@@ -152,12 +152,13 @@ int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
152 return VM_FAULT_SIGBUS; 152 return VM_FAULT_SIGBUS;
153} 153}
154 154
155void kvm_arch_free_memslot(struct kvm_memory_slot *free, 155void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
156 struct kvm_memory_slot *dont) 156 struct kvm_memory_slot *dont)
157{ 157{
158} 158}
159 159
160int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) 160int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
161 unsigned long npages)
161{ 162{
162 return 0; 163 return 0;
163} 164}
@@ -797,6 +798,19 @@ long kvm_arch_vm_ioctl(struct file *filp,
797 return -EFAULT; 798 return -EFAULT;
798 return kvm_vm_ioctl_set_device_addr(kvm, &dev_addr); 799 return kvm_vm_ioctl_set_device_addr(kvm, &dev_addr);
799 } 800 }
801 case KVM_ARM_PREFERRED_TARGET: {
802 int err;
803 struct kvm_vcpu_init init;
804
805 err = kvm_vcpu_preferred_target(&init);
806 if (err)
807 return err;
808
809 if (copy_to_user(argp, &init, sizeof(init)))
810 return -EFAULT;
811
812 return 0;
813 }
800 default: 814 default:
801 return -EINVAL; 815 return -EINVAL;
802 } 816 }
@@ -815,7 +829,7 @@ static void cpu_init_hyp_mode(void *dummy)
815 829
816 boot_pgd_ptr = kvm_mmu_get_boot_httbr(); 830 boot_pgd_ptr = kvm_mmu_get_boot_httbr();
817 pgd_ptr = kvm_mmu_get_httbr(); 831 pgd_ptr = kvm_mmu_get_httbr();
818 stack_page = __get_cpu_var(kvm_arm_hyp_stack_page); 832 stack_page = __this_cpu_read(kvm_arm_hyp_stack_page);
819 hyp_stack_ptr = stack_page + PAGE_SIZE; 833 hyp_stack_ptr = stack_page + PAGE_SIZE;
820 vector_ptr = (unsigned long)__kvm_hyp_vector; 834 vector_ptr = (unsigned long)__kvm_hyp_vector;
821 835
diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c
index db9cf692d4dd..78c0885d6501 100644
--- a/arch/arm/kvm/coproc.c
+++ b/arch/arm/kvm/coproc.c
@@ -71,6 +71,98 @@ int kvm_handle_cp14_access(struct kvm_vcpu *vcpu, struct kvm_run *run)
71 return 1; 71 return 1;
72} 72}
73 73
74static void reset_mpidr(struct kvm_vcpu *vcpu, const struct coproc_reg *r)
75{
76 /*
77 * Compute guest MPIDR. We build a virtual cluster out of the
78 * vcpu_id, but we read the 'U' bit from the underlying
79 * hardware directly.
80 */
81 vcpu->arch.cp15[c0_MPIDR] = ((read_cpuid_mpidr() & MPIDR_SMP_BITMASK) |
82 ((vcpu->vcpu_id >> 2) << MPIDR_LEVEL_BITS) |
83 (vcpu->vcpu_id & 3));
84}
85
86/* TRM entries A7:4.3.31 A15:4.3.28 - RO WI */
87static bool access_actlr(struct kvm_vcpu *vcpu,
88 const struct coproc_params *p,
89 const struct coproc_reg *r)
90{
91 if (p->is_write)
92 return ignore_write(vcpu, p);
93
94 *vcpu_reg(vcpu, p->Rt1) = vcpu->arch.cp15[c1_ACTLR];
95 return true;
96}
97
98/* TRM entries A7:4.3.56, A15:4.3.60 - R/O. */
99static bool access_cbar(struct kvm_vcpu *vcpu,
100 const struct coproc_params *p,
101 const struct coproc_reg *r)
102{
103 if (p->is_write)
104 return write_to_read_only(vcpu, p);
105 return read_zero(vcpu, p);
106}
107
108/* TRM entries A7:4.3.49, A15:4.3.48 - R/O WI */
109static bool access_l2ctlr(struct kvm_vcpu *vcpu,
110 const struct coproc_params *p,
111 const struct coproc_reg *r)
112{
113 if (p->is_write)
114 return ignore_write(vcpu, p);
115
116 *vcpu_reg(vcpu, p->Rt1) = vcpu->arch.cp15[c9_L2CTLR];
117 return true;
118}
119
120static void reset_l2ctlr(struct kvm_vcpu *vcpu, const struct coproc_reg *r)
121{
122 u32 l2ctlr, ncores;
123
124 asm volatile("mrc p15, 1, %0, c9, c0, 2\n" : "=r" (l2ctlr));
125 l2ctlr &= ~(3 << 24);
126 ncores = atomic_read(&vcpu->kvm->online_vcpus) - 1;
127 /* How many cores in the current cluster and the next ones */
128 ncores -= (vcpu->vcpu_id & ~3);
129 /* Cap it to the maximum number of cores in a single cluster */
130 ncores = min(ncores, 3U);
131 l2ctlr |= (ncores & 3) << 24;
132
133 vcpu->arch.cp15[c9_L2CTLR] = l2ctlr;
134}
135
136static void reset_actlr(struct kvm_vcpu *vcpu, const struct coproc_reg *r)
137{
138 u32 actlr;
139
140 /* ACTLR contains SMP bit: make sure you create all cpus first! */
141 asm volatile("mrc p15, 0, %0, c1, c0, 1\n" : "=r" (actlr));
142 /* Make the SMP bit consistent with the guest configuration */
143 if (atomic_read(&vcpu->kvm->online_vcpus) > 1)
144 actlr |= 1U << 6;
145 else
146 actlr &= ~(1U << 6);
147
148 vcpu->arch.cp15[c1_ACTLR] = actlr;
149}
150
151/*
152 * TRM entries: A7:4.3.50, A15:4.3.49
153 * R/O WI (even if NSACR.NS_L2ERR, a write of 1 is ignored).
154 */
155static bool access_l2ectlr(struct kvm_vcpu *vcpu,
156 const struct coproc_params *p,
157 const struct coproc_reg *r)
158{
159 if (p->is_write)
160 return ignore_write(vcpu, p);
161
162 *vcpu_reg(vcpu, p->Rt1) = 0;
163 return true;
164}
165
74/* See note at ARM ARM B1.14.4 */ 166/* See note at ARM ARM B1.14.4 */
75static bool access_dcsw(struct kvm_vcpu *vcpu, 167static bool access_dcsw(struct kvm_vcpu *vcpu,
76 const struct coproc_params *p, 168 const struct coproc_params *p,
@@ -153,10 +245,22 @@ static bool pm_fake(struct kvm_vcpu *vcpu,
153 * registers preceding 32-bit ones. 245 * registers preceding 32-bit ones.
154 */ 246 */
155static const struct coproc_reg cp15_regs[] = { 247static const struct coproc_reg cp15_regs[] = {
248 /* MPIDR: we use VMPIDR for guest access. */
249 { CRn( 0), CRm( 0), Op1( 0), Op2( 5), is32,
250 NULL, reset_mpidr, c0_MPIDR },
251
156 /* CSSELR: swapped by interrupt.S. */ 252 /* CSSELR: swapped by interrupt.S. */
157 { CRn( 0), CRm( 0), Op1( 2), Op2( 0), is32, 253 { CRn( 0), CRm( 0), Op1( 2), Op2( 0), is32,
158 NULL, reset_unknown, c0_CSSELR }, 254 NULL, reset_unknown, c0_CSSELR },
159 255
256 /* ACTLR: trapped by HCR.TAC bit. */
257 { CRn( 1), CRm( 0), Op1( 0), Op2( 1), is32,
258 access_actlr, reset_actlr, c1_ACTLR },
259
260 /* CPACR: swapped by interrupt.S. */
261 { CRn( 1), CRm( 0), Op1( 0), Op2( 2), is32,
262 NULL, reset_val, c1_CPACR, 0x00000000 },
263
160 /* TTBR0/TTBR1: swapped by interrupt.S. */ 264 /* TTBR0/TTBR1: swapped by interrupt.S. */
161 { CRm64( 2), Op1( 0), is64, NULL, reset_unknown64, c2_TTBR0 }, 265 { CRm64( 2), Op1( 0), is64, NULL, reset_unknown64, c2_TTBR0 },
162 { CRm64( 2), Op1( 1), is64, NULL, reset_unknown64, c2_TTBR1 }, 266 { CRm64( 2), Op1( 1), is64, NULL, reset_unknown64, c2_TTBR1 },
@@ -195,6 +299,13 @@ static const struct coproc_reg cp15_regs[] = {
195 { CRn( 7), CRm(10), Op1( 0), Op2( 2), is32, access_dcsw}, 299 { CRn( 7), CRm(10), Op1( 0), Op2( 2), is32, access_dcsw},
196 { CRn( 7), CRm(14), Op1( 0), Op2( 2), is32, access_dcsw}, 300 { CRn( 7), CRm(14), Op1( 0), Op2( 2), is32, access_dcsw},
197 /* 301 /*
302 * L2CTLR access (guest wants to know #CPUs).
303 */
304 { CRn( 9), CRm( 0), Op1( 1), Op2( 2), is32,
305 access_l2ctlr, reset_l2ctlr, c9_L2CTLR },
306 { CRn( 9), CRm( 0), Op1( 1), Op2( 3), is32, access_l2ectlr},
307
308 /*
198 * Dummy performance monitor implementation. 309 * Dummy performance monitor implementation.
199 */ 310 */
200 { CRn( 9), CRm(12), Op1( 0), Op2( 0), is32, access_pmcr}, 311 { CRn( 9), CRm(12), Op1( 0), Op2( 0), is32, access_pmcr},
@@ -234,6 +345,9 @@ static const struct coproc_reg cp15_regs[] = {
234 /* CNTKCTL: swapped by interrupt.S. */ 345 /* CNTKCTL: swapped by interrupt.S. */
235 { CRn(14), CRm( 1), Op1( 0), Op2( 0), is32, 346 { CRn(14), CRm( 1), Op1( 0), Op2( 0), is32,
236 NULL, reset_val, c14_CNTKCTL, 0x00000000 }, 347 NULL, reset_val, c14_CNTKCTL, 0x00000000 },
348
349 /* The Configuration Base Address Register. */
350 { CRn(15), CRm( 0), Op1( 4), Op2( 0), is32, access_cbar},
237}; 351};
238 352
239/* Target specific emulation tables */ 353/* Target specific emulation tables */
@@ -241,6 +355,12 @@ static struct kvm_coproc_target_table *target_tables[KVM_ARM_NUM_TARGETS];
241 355
242void kvm_register_target_coproc_table(struct kvm_coproc_target_table *table) 356void kvm_register_target_coproc_table(struct kvm_coproc_target_table *table)
243{ 357{
358 unsigned int i;
359
360 for (i = 1; i < table->num; i++)
361 BUG_ON(cmp_reg(&table->table[i-1],
362 &table->table[i]) >= 0);
363
244 target_tables[table->target] = table; 364 target_tables[table->target] = table;
245} 365}
246 366
diff --git a/arch/arm/kvm/coproc_a15.c b/arch/arm/kvm/coproc_a15.c
index cf93472b9dd6..bb0cac1410cc 100644
--- a/arch/arm/kvm/coproc_a15.c
+++ b/arch/arm/kvm/coproc_a15.c
@@ -17,101 +17,12 @@
17 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */ 18 */
19#include <linux/kvm_host.h> 19#include <linux/kvm_host.h>
20#include <asm/cputype.h>
21#include <asm/kvm_arm.h>
22#include <asm/kvm_host.h>
23#include <asm/kvm_emulate.h>
24#include <asm/kvm_coproc.h> 20#include <asm/kvm_coproc.h>
21#include <asm/kvm_emulate.h>
25#include <linux/init.h> 22#include <linux/init.h>
26 23
27static void reset_mpidr(struct kvm_vcpu *vcpu, const struct coproc_reg *r)
28{
29 /*
30 * Compute guest MPIDR:
31 * (Even if we present only one VCPU to the guest on an SMP
32 * host we don't set the U bit in the MPIDR, or vice versa, as
33 * revealing the underlying hardware properties is likely to
34 * be the best choice).
35 */
36 vcpu->arch.cp15[c0_MPIDR] = (read_cpuid_mpidr() & ~MPIDR_LEVEL_MASK)
37 | (vcpu->vcpu_id & MPIDR_LEVEL_MASK);
38}
39
40#include "coproc.h" 24#include "coproc.h"
41 25
42/* A15 TRM 4.3.28: RO WI */
43static bool access_actlr(struct kvm_vcpu *vcpu,
44 const struct coproc_params *p,
45 const struct coproc_reg *r)
46{
47 if (p->is_write)
48 return ignore_write(vcpu, p);
49
50 *vcpu_reg(vcpu, p->Rt1) = vcpu->arch.cp15[c1_ACTLR];
51 return true;
52}
53
54/* A15 TRM 4.3.60: R/O. */
55static bool access_cbar(struct kvm_vcpu *vcpu,
56 const struct coproc_params *p,
57 const struct coproc_reg *r)
58{
59 if (p->is_write)
60 return write_to_read_only(vcpu, p);
61 return read_zero(vcpu, p);
62}
63
64/* A15 TRM 4.3.48: R/O WI. */
65static bool access_l2ctlr(struct kvm_vcpu *vcpu,
66 const struct coproc_params *p,
67 const struct coproc_reg *r)
68{
69 if (p->is_write)
70 return ignore_write(vcpu, p);
71
72 *vcpu_reg(vcpu, p->Rt1) = vcpu->arch.cp15[c9_L2CTLR];
73 return true;
74}
75
76static void reset_l2ctlr(struct kvm_vcpu *vcpu, const struct coproc_reg *r)
77{
78 u32 l2ctlr, ncores;
79
80 asm volatile("mrc p15, 1, %0, c9, c0, 2\n" : "=r" (l2ctlr));
81 l2ctlr &= ~(3 << 24);
82 ncores = atomic_read(&vcpu->kvm->online_vcpus) - 1;
83 l2ctlr |= (ncores & 3) << 24;
84
85 vcpu->arch.cp15[c9_L2CTLR] = l2ctlr;
86}
87
88static void reset_actlr(struct kvm_vcpu *vcpu, const struct coproc_reg *r)
89{
90 u32 actlr;
91
92 /* ACTLR contains SMP bit: make sure you create all cpus first! */
93 asm volatile("mrc p15, 0, %0, c1, c0, 1\n" : "=r" (actlr));
94 /* Make the SMP bit consistent with the guest configuration */
95 if (atomic_read(&vcpu->kvm->online_vcpus) > 1)
96 actlr |= 1U << 6;
97 else
98 actlr &= ~(1U << 6);
99
100 vcpu->arch.cp15[c1_ACTLR] = actlr;
101}
102
103/* A15 TRM 4.3.49: R/O WI (even if NSACR.NS_L2ERR, a write of 1 is ignored). */
104static bool access_l2ectlr(struct kvm_vcpu *vcpu,
105 const struct coproc_params *p,
106 const struct coproc_reg *r)
107{
108 if (p->is_write)
109 return ignore_write(vcpu, p);
110
111 *vcpu_reg(vcpu, p->Rt1) = 0;
112 return true;
113}
114
115/* 26/*
116 * A15-specific CP15 registers. 27 * A15-specific CP15 registers.
117 * CRn denotes the primary register number, but is copied to the CRm in the 28 * CRn denotes the primary register number, but is copied to the CRm in the
@@ -121,29 +32,9 @@ static bool access_l2ectlr(struct kvm_vcpu *vcpu,
121 * registers preceding 32-bit ones. 32 * registers preceding 32-bit ones.
122 */ 33 */
123static const struct coproc_reg a15_regs[] = { 34static const struct coproc_reg a15_regs[] = {
124 /* MPIDR: we use VMPIDR for guest access. */
125 { CRn( 0), CRm( 0), Op1( 0), Op2( 5), is32,
126 NULL, reset_mpidr, c0_MPIDR },
127
128 /* SCTLR: swapped by interrupt.S. */ 35 /* SCTLR: swapped by interrupt.S. */
129 { CRn( 1), CRm( 0), Op1( 0), Op2( 0), is32, 36 { CRn( 1), CRm( 0), Op1( 0), Op2( 0), is32,
130 NULL, reset_val, c1_SCTLR, 0x00C50078 }, 37 NULL, reset_val, c1_SCTLR, 0x00C50078 },
131 /* ACTLR: trapped by HCR.TAC bit. */
132 { CRn( 1), CRm( 0), Op1( 0), Op2( 1), is32,
133 access_actlr, reset_actlr, c1_ACTLR },
134 /* CPACR: swapped by interrupt.S. */
135 { CRn( 1), CRm( 0), Op1( 0), Op2( 2), is32,
136 NULL, reset_val, c1_CPACR, 0x00000000 },
137
138 /*
139 * L2CTLR access (guest wants to know #CPUs).
140 */
141 { CRn( 9), CRm( 0), Op1( 1), Op2( 2), is32,
142 access_l2ctlr, reset_l2ctlr, c9_L2CTLR },
143 { CRn( 9), CRm( 0), Op1( 1), Op2( 3), is32, access_l2ectlr},
144
145 /* The Configuration Base Address Register. */
146 { CRn(15), CRm( 0), Op1( 4), Op2( 0), is32, access_cbar},
147}; 38};
148 39
149static struct kvm_coproc_target_table a15_target_table = { 40static struct kvm_coproc_target_table a15_target_table = {
@@ -154,12 +45,6 @@ static struct kvm_coproc_target_table a15_target_table = {
154 45
155static int __init coproc_a15_init(void) 46static int __init coproc_a15_init(void)
156{ 47{
157 unsigned int i;
158
159 for (i = 1; i < ARRAY_SIZE(a15_regs); i++)
160 BUG_ON(cmp_reg(&a15_regs[i-1],
161 &a15_regs[i]) >= 0);
162
163 kvm_register_target_coproc_table(&a15_target_table); 48 kvm_register_target_coproc_table(&a15_target_table);
164 return 0; 49 return 0;
165} 50}
diff --git a/arch/arm/kvm/coproc_a7.c b/arch/arm/kvm/coproc_a7.c
new file mode 100644
index 000000000000..1df767331588
--- /dev/null
+++ b/arch/arm/kvm/coproc_a7.c
@@ -0,0 +1,54 @@
1/*
2 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
3 * Copyright (C) 2013 - ARM Ltd
4 *
5 * Authors: Rusty Russell <rusty@rustcorp.au>
6 * Christoffer Dall <c.dall@virtualopensystems.com>
7 * Jonathan Austin <jonathan.austin@arm.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, write to the Free Software
20 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22#include <linux/kvm_host.h>
23#include <asm/kvm_coproc.h>
24#include <asm/kvm_emulate.h>
25#include <linux/init.h>
26
27#include "coproc.h"
28
29/*
30 * Cortex-A7 specific CP15 registers.
31 * CRn denotes the primary register number, but is copied to the CRm in the
32 * user space API for 64-bit register access in line with the terminology used
33 * in the ARM ARM.
34 * Important: Must be sorted ascending by CRn, CRM, Op1, Op2 and with 64-bit
35 * registers preceding 32-bit ones.
36 */
37static const struct coproc_reg a7_regs[] = {
38 /* SCTLR: swapped by interrupt.S. */
39 { CRn( 1), CRm( 0), Op1( 0), Op2( 0), is32,
40 NULL, reset_val, c1_SCTLR, 0x00C50878 },
41};
42
43static struct kvm_coproc_target_table a7_target_table = {
44 .target = KVM_ARM_TARGET_CORTEX_A7,
45 .table = a7_regs,
46 .num = ARRAY_SIZE(a7_regs),
47};
48
49static int __init coproc_a7_init(void)
50{
51 kvm_register_target_coproc_table(&a7_target_table);
52 return 0;
53}
54late_initcall(coproc_a7_init);
diff --git a/arch/arm/kvm/emulate.c b/arch/arm/kvm/emulate.c
index bdede9e7da51..d6c005283678 100644
--- a/arch/arm/kvm/emulate.c
+++ b/arch/arm/kvm/emulate.c
@@ -354,7 +354,7 @@ static void inject_abt(struct kvm_vcpu *vcpu, bool is_pabt, unsigned long addr)
354 *vcpu_pc(vcpu) = exc_vector_base(vcpu) + vect_offset; 354 *vcpu_pc(vcpu) = exc_vector_base(vcpu) + vect_offset;
355 355
356 if (is_pabt) { 356 if (is_pabt) {
357 /* Set DFAR and DFSR */ 357 /* Set IFAR and IFSR */
358 vcpu->arch.cp15[c6_IFAR] = addr; 358 vcpu->arch.cp15[c6_IFAR] = addr;
359 is_lpae = (vcpu->arch.cp15[c2_TTBCR] >> 31); 359 is_lpae = (vcpu->arch.cp15[c2_TTBCR] >> 31);
360 /* Always give debug fault for now - should give guest a clue */ 360 /* Always give debug fault for now - should give guest a clue */
diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c
index 152d03612181..20f8d97904af 100644
--- a/arch/arm/kvm/guest.c
+++ b/arch/arm/kvm/guest.c
@@ -190,6 +190,8 @@ int __attribute_const__ kvm_target_cpu(void)
190 return -EINVAL; 190 return -EINVAL;
191 191
192 switch (part_number) { 192 switch (part_number) {
193 case ARM_CPU_PART_CORTEX_A7:
194 return KVM_ARM_TARGET_CORTEX_A7;
193 case ARM_CPU_PART_CORTEX_A15: 195 case ARM_CPU_PART_CORTEX_A15:
194 return KVM_ARM_TARGET_CORTEX_A15; 196 return KVM_ARM_TARGET_CORTEX_A15;
195 default: 197 default:
@@ -202,7 +204,7 @@ int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
202{ 204{
203 unsigned int i; 205 unsigned int i;
204 206
205 /* We can only do a cortex A15 for now. */ 207 /* We can only cope with guest==host and only on A15/A7 (for now). */
206 if (init->target != kvm_target_cpu()) 208 if (init->target != kvm_target_cpu())
207 return -EINVAL; 209 return -EINVAL;
208 210
@@ -222,6 +224,26 @@ int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
222 return kvm_reset_vcpu(vcpu); 224 return kvm_reset_vcpu(vcpu);
223} 225}
224 226
227int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init)
228{
229 int target = kvm_target_cpu();
230
231 if (target < 0)
232 return -ENODEV;
233
234 memset(init, 0, sizeof(*init));
235
236 /*
237 * For now, we don't return any features.
238 * In future, we might use features to return target
239 * specific features available for the preferred
240 * target type.
241 */
242 init->target = (__u32)target;
243
244 return 0;
245}
246
225int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) 247int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
226{ 248{
227 return -EINVAL; 249 return -EINVAL;
diff --git a/arch/arm/kvm/handle_exit.c b/arch/arm/kvm/handle_exit.c
index df4c82d47ad7..a92079011a83 100644
--- a/arch/arm/kvm/handle_exit.c
+++ b/arch/arm/kvm/handle_exit.c
@@ -73,23 +73,29 @@ static int handle_dabt_hyp(struct kvm_vcpu *vcpu, struct kvm_run *run)
73} 73}
74 74
75/** 75/**
76 * kvm_handle_wfi - handle a wait-for-interrupts instruction executed by a guest 76 * kvm_handle_wfx - handle a WFI or WFE instructions trapped in guests
77 * @vcpu: the vcpu pointer 77 * @vcpu: the vcpu pointer
78 * @run: the kvm_run structure pointer 78 * @run: the kvm_run structure pointer
79 * 79 *
80 * Simply sets the wait_for_interrupts flag on the vcpu structure, which will 80 * WFE: Yield the CPU and come back to this vcpu when the scheduler
81 * halt execution of world-switches and schedule other host processes until 81 * decides to.
82 * there is an incoming IRQ or FIQ to the VM. 82 * WFI: Simply call kvm_vcpu_block(), which will halt execution of
83 * world-switches and schedule other host processes until there is an
84 * incoming IRQ or FIQ to the VM.
83 */ 85 */
84static int kvm_handle_wfi(struct kvm_vcpu *vcpu, struct kvm_run *run) 86static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run)
85{ 87{
86 trace_kvm_wfi(*vcpu_pc(vcpu)); 88 trace_kvm_wfi(*vcpu_pc(vcpu));
87 kvm_vcpu_block(vcpu); 89 if (kvm_vcpu_get_hsr(vcpu) & HSR_WFI_IS_WFE)
90 kvm_vcpu_on_spin(vcpu);
91 else
92 kvm_vcpu_block(vcpu);
93
88 return 1; 94 return 1;
89} 95}
90 96
91static exit_handle_fn arm_exit_handlers[] = { 97static exit_handle_fn arm_exit_handlers[] = {
92 [HSR_EC_WFI] = kvm_handle_wfi, 98 [HSR_EC_WFI] = kvm_handle_wfx,
93 [HSR_EC_CP15_32] = kvm_handle_cp15_32, 99 [HSR_EC_CP15_32] = kvm_handle_cp15_32,
94 [HSR_EC_CP15_64] = kvm_handle_cp15_64, 100 [HSR_EC_CP15_64] = kvm_handle_cp15_64,
95 [HSR_EC_CP14_MR] = kvm_handle_cp14_access, 101 [HSR_EC_CP14_MR] = kvm_handle_cp14_access,
diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
index 0c25d9487d53..4cb5a93182e9 100644
--- a/arch/arm/kvm/mmio.c
+++ b/arch/arm/kvm/mmio.c
@@ -23,6 +23,68 @@
23 23
24#include "trace.h" 24#include "trace.h"
25 25
26static void mmio_write_buf(char *buf, unsigned int len, unsigned long data)
27{
28 void *datap = NULL;
29 union {
30 u8 byte;
31 u16 hword;
32 u32 word;
33 u64 dword;
34 } tmp;
35
36 switch (len) {
37 case 1:
38 tmp.byte = data;
39 datap = &tmp.byte;
40 break;
41 case 2:
42 tmp.hword = data;
43 datap = &tmp.hword;
44 break;
45 case 4:
46 tmp.word = data;
47 datap = &tmp.word;
48 break;
49 case 8:
50 tmp.dword = data;
51 datap = &tmp.dword;
52 break;
53 }
54
55 memcpy(buf, datap, len);
56}
57
58static unsigned long mmio_read_buf(char *buf, unsigned int len)
59{
60 unsigned long data = 0;
61 union {
62 u16 hword;
63 u32 word;
64 u64 dword;
65 } tmp;
66
67 switch (len) {
68 case 1:
69 data = buf[0];
70 break;
71 case 2:
72 memcpy(&tmp.hword, buf, len);
73 data = tmp.hword;
74 break;
75 case 4:
76 memcpy(&tmp.word, buf, len);
77 data = tmp.word;
78 break;
79 case 8:
80 memcpy(&tmp.dword, buf, len);
81 data = tmp.dword;
82 break;
83 }
84
85 return data;
86}
87
26/** 88/**
27 * kvm_handle_mmio_return -- Handle MMIO loads after user space emulation 89 * kvm_handle_mmio_return -- Handle MMIO loads after user space emulation
28 * @vcpu: The VCPU pointer 90 * @vcpu: The VCPU pointer
@@ -33,28 +95,27 @@
33 */ 95 */
34int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run) 96int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run)
35{ 97{
36 unsigned long *dest; 98 unsigned long data;
37 unsigned int len; 99 unsigned int len;
38 int mask; 100 int mask;
39 101
40 if (!run->mmio.is_write) { 102 if (!run->mmio.is_write) {
41 dest = vcpu_reg(vcpu, vcpu->arch.mmio_decode.rt);
42 *dest = 0;
43
44 len = run->mmio.len; 103 len = run->mmio.len;
45 if (len > sizeof(unsigned long)) 104 if (len > sizeof(unsigned long))
46 return -EINVAL; 105 return -EINVAL;
47 106
48 memcpy(dest, run->mmio.data, len); 107 data = mmio_read_buf(run->mmio.data, len);
49
50 trace_kvm_mmio(KVM_TRACE_MMIO_READ, len, run->mmio.phys_addr,
51 *((u64 *)run->mmio.data));
52 108
53 if (vcpu->arch.mmio_decode.sign_extend && 109 if (vcpu->arch.mmio_decode.sign_extend &&
54 len < sizeof(unsigned long)) { 110 len < sizeof(unsigned long)) {
55 mask = 1U << ((len * 8) - 1); 111 mask = 1U << ((len * 8) - 1);
56 *dest = (*dest ^ mask) - mask; 112 data = (data ^ mask) - mask;
57 } 113 }
114
115 trace_kvm_mmio(KVM_TRACE_MMIO_READ, len, run->mmio.phys_addr,
116 data);
117 data = vcpu_data_host_to_guest(vcpu, data, len);
118 *vcpu_reg(vcpu, vcpu->arch.mmio_decode.rt) = data;
58 } 119 }
59 120
60 return 0; 121 return 0;
@@ -105,6 +166,7 @@ int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run,
105 phys_addr_t fault_ipa) 166 phys_addr_t fault_ipa)
106{ 167{
107 struct kvm_exit_mmio mmio; 168 struct kvm_exit_mmio mmio;
169 unsigned long data;
108 unsigned long rt; 170 unsigned long rt;
109 int ret; 171 int ret;
110 172
@@ -125,13 +187,15 @@ int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run,
125 } 187 }
126 188
127 rt = vcpu->arch.mmio_decode.rt; 189 rt = vcpu->arch.mmio_decode.rt;
190 data = vcpu_data_guest_to_host(vcpu, *vcpu_reg(vcpu, rt), mmio.len);
191
128 trace_kvm_mmio((mmio.is_write) ? KVM_TRACE_MMIO_WRITE : 192 trace_kvm_mmio((mmio.is_write) ? KVM_TRACE_MMIO_WRITE :
129 KVM_TRACE_MMIO_READ_UNSATISFIED, 193 KVM_TRACE_MMIO_READ_UNSATISFIED,
130 mmio.len, fault_ipa, 194 mmio.len, fault_ipa,
131 (mmio.is_write) ? *vcpu_reg(vcpu, rt) : 0); 195 (mmio.is_write) ? data : 0);
132 196
133 if (mmio.is_write) 197 if (mmio.is_write)
134 memcpy(mmio.data, vcpu_reg(vcpu, rt), mmio.len); 198 mmio_write_buf(mmio.data, mmio.len, data);
135 199
136 if (vgic_handle_mmio(vcpu, run, &mmio)) 200 if (vgic_handle_mmio(vcpu, run, &mmio))
137 return 1; 201 return 1;
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index b0de86b56c13..371958370de4 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -19,6 +19,7 @@
19#include <linux/mman.h> 19#include <linux/mman.h>
20#include <linux/kvm_host.h> 20#include <linux/kvm_host.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/hugetlb.h>
22#include <trace/events/kvm.h> 23#include <trace/events/kvm.h>
23#include <asm/pgalloc.h> 24#include <asm/pgalloc.h>
24#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
@@ -41,6 +42,8 @@ static unsigned long hyp_idmap_start;
41static unsigned long hyp_idmap_end; 42static unsigned long hyp_idmap_end;
42static phys_addr_t hyp_idmap_vector; 43static phys_addr_t hyp_idmap_vector;
43 44
45#define kvm_pmd_huge(_x) (pmd_huge(_x) || pmd_trans_huge(_x))
46
44static void kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) 47static void kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa)
45{ 48{
46 /* 49 /*
@@ -93,19 +96,29 @@ static bool page_empty(void *ptr)
93 96
94static void clear_pud_entry(struct kvm *kvm, pud_t *pud, phys_addr_t addr) 97static void clear_pud_entry(struct kvm *kvm, pud_t *pud, phys_addr_t addr)
95{ 98{
96 pmd_t *pmd_table = pmd_offset(pud, 0); 99 if (pud_huge(*pud)) {
97 pud_clear(pud); 100 pud_clear(pud);
98 kvm_tlb_flush_vmid_ipa(kvm, addr); 101 kvm_tlb_flush_vmid_ipa(kvm, addr);
99 pmd_free(NULL, pmd_table); 102 } else {
103 pmd_t *pmd_table = pmd_offset(pud, 0);
104 pud_clear(pud);
105 kvm_tlb_flush_vmid_ipa(kvm, addr);
106 pmd_free(NULL, pmd_table);
107 }
100 put_page(virt_to_page(pud)); 108 put_page(virt_to_page(pud));
101} 109}
102 110
103static void clear_pmd_entry(struct kvm *kvm, pmd_t *pmd, phys_addr_t addr) 111static void clear_pmd_entry(struct kvm *kvm, pmd_t *pmd, phys_addr_t addr)
104{ 112{
105 pte_t *pte_table = pte_offset_kernel(pmd, 0); 113 if (kvm_pmd_huge(*pmd)) {
106 pmd_clear(pmd); 114 pmd_clear(pmd);
107 kvm_tlb_flush_vmid_ipa(kvm, addr); 115 kvm_tlb_flush_vmid_ipa(kvm, addr);
108 pte_free_kernel(NULL, pte_table); 116 } else {
117 pte_t *pte_table = pte_offset_kernel(pmd, 0);
118 pmd_clear(pmd);
119 kvm_tlb_flush_vmid_ipa(kvm, addr);
120 pte_free_kernel(NULL, pte_table);
121 }
109 put_page(virt_to_page(pmd)); 122 put_page(virt_to_page(pmd));
110} 123}
111 124
@@ -136,18 +149,32 @@ static void unmap_range(struct kvm *kvm, pgd_t *pgdp,
136 continue; 149 continue;
137 } 150 }
138 151
152 if (pud_huge(*pud)) {
153 /*
154 * If we are dealing with a huge pud, just clear it and
155 * move on.
156 */
157 clear_pud_entry(kvm, pud, addr);
158 addr = pud_addr_end(addr, end);
159 continue;
160 }
161
139 pmd = pmd_offset(pud, addr); 162 pmd = pmd_offset(pud, addr);
140 if (pmd_none(*pmd)) { 163 if (pmd_none(*pmd)) {
141 addr = pmd_addr_end(addr, end); 164 addr = pmd_addr_end(addr, end);
142 continue; 165 continue;
143 } 166 }
144 167
145 pte = pte_offset_kernel(pmd, addr); 168 if (!kvm_pmd_huge(*pmd)) {
146 clear_pte_entry(kvm, pte, addr); 169 pte = pte_offset_kernel(pmd, addr);
147 next = addr + PAGE_SIZE; 170 clear_pte_entry(kvm, pte, addr);
171 next = addr + PAGE_SIZE;
172 }
148 173
149 /* If we emptied the pte, walk back up the ladder */ 174 /*
150 if (page_empty(pte)) { 175 * If the pmd entry is to be cleared, walk back up the ladder
176 */
177 if (kvm_pmd_huge(*pmd) || page_empty(pte)) {
151 clear_pmd_entry(kvm, pmd, addr); 178 clear_pmd_entry(kvm, pmd, addr);
152 next = pmd_addr_end(addr, end); 179 next = pmd_addr_end(addr, end);
153 if (page_empty(pmd) && !page_empty(pud)) { 180 if (page_empty(pmd) && !page_empty(pud)) {
@@ -420,29 +447,71 @@ void kvm_free_stage2_pgd(struct kvm *kvm)
420 kvm->arch.pgd = NULL; 447 kvm->arch.pgd = NULL;
421} 448}
422 449
423 450static pmd_t *stage2_get_pmd(struct kvm *kvm, struct kvm_mmu_memory_cache *cache,
424static int stage2_set_pte(struct kvm *kvm, struct kvm_mmu_memory_cache *cache, 451 phys_addr_t addr)
425 phys_addr_t addr, const pte_t *new_pte, bool iomap)
426{ 452{
427 pgd_t *pgd; 453 pgd_t *pgd;
428 pud_t *pud; 454 pud_t *pud;
429 pmd_t *pmd; 455 pmd_t *pmd;
430 pte_t *pte, old_pte;
431 456
432 /* Create 2nd stage page table mapping - Level 1 */
433 pgd = kvm->arch.pgd + pgd_index(addr); 457 pgd = kvm->arch.pgd + pgd_index(addr);
434 pud = pud_offset(pgd, addr); 458 pud = pud_offset(pgd, addr);
435 if (pud_none(*pud)) { 459 if (pud_none(*pud)) {
436 if (!cache) 460 if (!cache)
437 return 0; /* ignore calls from kvm_set_spte_hva */ 461 return NULL;
438 pmd = mmu_memory_cache_alloc(cache); 462 pmd = mmu_memory_cache_alloc(cache);
439 pud_populate(NULL, pud, pmd); 463 pud_populate(NULL, pud, pmd);
440 get_page(virt_to_page(pud)); 464 get_page(virt_to_page(pud));
441 } 465 }
442 466
443 pmd = pmd_offset(pud, addr); 467 return pmd_offset(pud, addr);
468}
469
470static int stage2_set_pmd_huge(struct kvm *kvm, struct kvm_mmu_memory_cache
471 *cache, phys_addr_t addr, const pmd_t *new_pmd)
472{
473 pmd_t *pmd, old_pmd;
474
475 pmd = stage2_get_pmd(kvm, cache, addr);
476 VM_BUG_ON(!pmd);
477
478 /*
479 * Mapping in huge pages should only happen through a fault. If a
480 * page is merged into a transparent huge page, the individual
481 * subpages of that huge page should be unmapped through MMU
482 * notifiers before we get here.
483 *
484 * Merging of CompoundPages is not supported; they should become
485 * splitting first, unmapped, merged, and mapped back in on-demand.
486 */
487 VM_BUG_ON(pmd_present(*pmd) && pmd_pfn(*pmd) != pmd_pfn(*new_pmd));
488
489 old_pmd = *pmd;
490 kvm_set_pmd(pmd, *new_pmd);
491 if (pmd_present(old_pmd))
492 kvm_tlb_flush_vmid_ipa(kvm, addr);
493 else
494 get_page(virt_to_page(pmd));
495 return 0;
496}
497
498static int stage2_set_pte(struct kvm *kvm, struct kvm_mmu_memory_cache *cache,
499 phys_addr_t addr, const pte_t *new_pte, bool iomap)
500{
501 pmd_t *pmd;
502 pte_t *pte, old_pte;
444 503
445 /* Create 2nd stage page table mapping - Level 2 */ 504 /* Create stage-2 page table mapping - Level 1 */
505 pmd = stage2_get_pmd(kvm, cache, addr);
506 if (!pmd) {
507 /*
508 * Ignore calls from kvm_set_spte_hva for unallocated
509 * address ranges.
510 */
511 return 0;
512 }
513
514 /* Create stage-2 page mappings - Level 2 */
446 if (pmd_none(*pmd)) { 515 if (pmd_none(*pmd)) {
447 if (!cache) 516 if (!cache)
448 return 0; /* ignore calls from kvm_set_spte_hva */ 517 return 0; /* ignore calls from kvm_set_spte_hva */
@@ -507,16 +576,60 @@ out:
507 return ret; 576 return ret;
508} 577}
509 578
579static bool transparent_hugepage_adjust(pfn_t *pfnp, phys_addr_t *ipap)
580{
581 pfn_t pfn = *pfnp;
582 gfn_t gfn = *ipap >> PAGE_SHIFT;
583
584 if (PageTransCompound(pfn_to_page(pfn))) {
585 unsigned long mask;
586 /*
587 * The address we faulted on is backed by a transparent huge
588 * page. However, because we map the compound huge page and
589 * not the individual tail page, we need to transfer the
590 * refcount to the head page. We have to be careful that the
591 * THP doesn't start to split while we are adjusting the
592 * refcounts.
593 *
594 * We are sure this doesn't happen, because mmu_notifier_retry
595 * was successful and we are holding the mmu_lock, so if this
596 * THP is trying to split, it will be blocked in the mmu
597 * notifier before touching any of the pages, specifically
598 * before being able to call __split_huge_page_refcount().
599 *
600 * We can therefore safely transfer the refcount from PG_tail
601 * to PG_head and switch the pfn from a tail page to the head
602 * page accordingly.
603 */
604 mask = PTRS_PER_PMD - 1;
605 VM_BUG_ON((gfn & mask) != (pfn & mask));
606 if (pfn & mask) {
607 *ipap &= PMD_MASK;
608 kvm_release_pfn_clean(pfn);
609 pfn &= ~mask;
610 kvm_get_pfn(pfn);
611 *pfnp = pfn;
612 }
613
614 return true;
615 }
616
617 return false;
618}
619
510static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, 620static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
511 gfn_t gfn, struct kvm_memory_slot *memslot, 621 struct kvm_memory_slot *memslot,
512 unsigned long fault_status) 622 unsigned long fault_status)
513{ 623{
514 pte_t new_pte;
515 pfn_t pfn;
516 int ret; 624 int ret;
517 bool write_fault, writable; 625 bool write_fault, writable, hugetlb = false, force_pte = false;
518 unsigned long mmu_seq; 626 unsigned long mmu_seq;
627 gfn_t gfn = fault_ipa >> PAGE_SHIFT;
628 unsigned long hva = gfn_to_hva(vcpu->kvm, gfn);
629 struct kvm *kvm = vcpu->kvm;
519 struct kvm_mmu_memory_cache *memcache = &vcpu->arch.mmu_page_cache; 630 struct kvm_mmu_memory_cache *memcache = &vcpu->arch.mmu_page_cache;
631 struct vm_area_struct *vma;
632 pfn_t pfn;
520 633
521 write_fault = kvm_is_write_fault(kvm_vcpu_get_hsr(vcpu)); 634 write_fault = kvm_is_write_fault(kvm_vcpu_get_hsr(vcpu));
522 if (fault_status == FSC_PERM && !write_fault) { 635 if (fault_status == FSC_PERM && !write_fault) {
@@ -524,6 +637,26 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
524 return -EFAULT; 637 return -EFAULT;
525 } 638 }
526 639
640 /* Let's check if we will get back a huge page backed by hugetlbfs */
641 down_read(&current->mm->mmap_sem);
642 vma = find_vma_intersection(current->mm, hva, hva + 1);
643 if (is_vm_hugetlb_page(vma)) {
644 hugetlb = true;
645 gfn = (fault_ipa & PMD_MASK) >> PAGE_SHIFT;
646 } else {
647 /*
648 * Pages belonging to VMAs not aligned to the PMD mapping
649 * granularity cannot be mapped using block descriptors even
650 * if the pages belong to a THP for the process, because the
651 * stage-2 block descriptor will cover more than a single THP
652 * and we loose atomicity for unmapping, updates, and splits
653 * of the THP or other pages in the stage-2 block range.
654 */
655 if (vma->vm_start & ~PMD_MASK)
656 force_pte = true;
657 }
658 up_read(&current->mm->mmap_sem);
659
527 /* We need minimum second+third level pages */ 660 /* We need minimum second+third level pages */
528 ret = mmu_topup_memory_cache(memcache, 2, KVM_NR_MEM_OBJS); 661 ret = mmu_topup_memory_cache(memcache, 2, KVM_NR_MEM_OBJS);
529 if (ret) 662 if (ret)
@@ -541,26 +674,40 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
541 */ 674 */
542 smp_rmb(); 675 smp_rmb();
543 676
544 pfn = gfn_to_pfn_prot(vcpu->kvm, gfn, write_fault, &writable); 677 pfn = gfn_to_pfn_prot(kvm, gfn, write_fault, &writable);
545 if (is_error_pfn(pfn)) 678 if (is_error_pfn(pfn))
546 return -EFAULT; 679 return -EFAULT;
547 680
548 new_pte = pfn_pte(pfn, PAGE_S2); 681 spin_lock(&kvm->mmu_lock);
549 coherent_icache_guest_page(vcpu->kvm, gfn); 682 if (mmu_notifier_retry(kvm, mmu_seq))
550
551 spin_lock(&vcpu->kvm->mmu_lock);
552 if (mmu_notifier_retry(vcpu->kvm, mmu_seq))
553 goto out_unlock; 683 goto out_unlock;
554 if (writable) { 684 if (!hugetlb && !force_pte)
555 kvm_set_s2pte_writable(&new_pte); 685 hugetlb = transparent_hugepage_adjust(&pfn, &fault_ipa);
556 kvm_set_pfn_dirty(pfn); 686
687 if (hugetlb) {
688 pmd_t new_pmd = pfn_pmd(pfn, PAGE_S2);
689 new_pmd = pmd_mkhuge(new_pmd);
690 if (writable) {
691 kvm_set_s2pmd_writable(&new_pmd);
692 kvm_set_pfn_dirty(pfn);
693 }
694 coherent_icache_guest_page(kvm, hva & PMD_MASK, PMD_SIZE);
695 ret = stage2_set_pmd_huge(kvm, memcache, fault_ipa, &new_pmd);
696 } else {
697 pte_t new_pte = pfn_pte(pfn, PAGE_S2);
698 if (writable) {
699 kvm_set_s2pte_writable(&new_pte);
700 kvm_set_pfn_dirty(pfn);
701 }
702 coherent_icache_guest_page(kvm, hva, PAGE_SIZE);
703 ret = stage2_set_pte(kvm, memcache, fault_ipa, &new_pte, false);
557 } 704 }
558 stage2_set_pte(vcpu->kvm, memcache, fault_ipa, &new_pte, false); 705
559 706
560out_unlock: 707out_unlock:
561 spin_unlock(&vcpu->kvm->mmu_lock); 708 spin_unlock(&kvm->mmu_lock);
562 kvm_release_pfn_clean(pfn); 709 kvm_release_pfn_clean(pfn);
563 return 0; 710 return ret;
564} 711}
565 712
566/** 713/**
@@ -629,7 +776,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run)
629 776
630 memslot = gfn_to_memslot(vcpu->kvm, gfn); 777 memslot = gfn_to_memslot(vcpu->kvm, gfn);
631 778
632 ret = user_mem_abort(vcpu, fault_ipa, gfn, memslot, fault_status); 779 ret = user_mem_abort(vcpu, fault_ipa, memslot, fault_status);
633 if (ret == 0) 780 if (ret == 0)
634 ret = 1; 781 ret = 1;
635out_unlock: 782out_unlock:
diff --git a/arch/arm/kvm/psci.c b/arch/arm/kvm/psci.c
index 86a693a02ba3..0881bf169fbc 100644
--- a/arch/arm/kvm/psci.c
+++ b/arch/arm/kvm/psci.c
@@ -18,6 +18,7 @@
18#include <linux/kvm_host.h> 18#include <linux/kvm_host.h>
19#include <linux/wait.h> 19#include <linux/wait.h>
20 20
21#include <asm/cputype.h>
21#include <asm/kvm_emulate.h> 22#include <asm/kvm_emulate.h>
22#include <asm/kvm_psci.h> 23#include <asm/kvm_psci.h>
23 24
@@ -34,22 +35,30 @@ static void kvm_psci_vcpu_off(struct kvm_vcpu *vcpu)
34static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu) 35static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu)
35{ 36{
36 struct kvm *kvm = source_vcpu->kvm; 37 struct kvm *kvm = source_vcpu->kvm;
37 struct kvm_vcpu *vcpu; 38 struct kvm_vcpu *vcpu = NULL, *tmp;
38 wait_queue_head_t *wq; 39 wait_queue_head_t *wq;
39 unsigned long cpu_id; 40 unsigned long cpu_id;
41 unsigned long mpidr;
40 phys_addr_t target_pc; 42 phys_addr_t target_pc;
43 int i;
41 44
42 cpu_id = *vcpu_reg(source_vcpu, 1); 45 cpu_id = *vcpu_reg(source_vcpu, 1);
43 if (vcpu_mode_is_32bit(source_vcpu)) 46 if (vcpu_mode_is_32bit(source_vcpu))
44 cpu_id &= ~((u32) 0); 47 cpu_id &= ~((u32) 0);
45 48
46 if (cpu_id >= atomic_read(&kvm->online_vcpus)) 49 kvm_for_each_vcpu(i, tmp, kvm) {
50 mpidr = kvm_vcpu_get_mpidr(tmp);
51 if ((mpidr & MPIDR_HWID_BITMASK) == (cpu_id & MPIDR_HWID_BITMASK)) {
52 vcpu = tmp;
53 break;
54 }
55 }
56
57 if (!vcpu)
47 return KVM_PSCI_RET_INVAL; 58 return KVM_PSCI_RET_INVAL;
48 59
49 target_pc = *vcpu_reg(source_vcpu, 2); 60 target_pc = *vcpu_reg(source_vcpu, 2);
50 61
51 vcpu = kvm_get_vcpu(kvm, cpu_id);
52
53 wq = kvm_arch_vcpu_wq(vcpu); 62 wq = kvm_arch_vcpu_wq(vcpu);
54 if (!waitqueue_active(wq)) 63 if (!waitqueue_active(wq))
55 return KVM_PSCI_RET_INVAL; 64 return KVM_PSCI_RET_INVAL;
@@ -62,6 +71,10 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu)
62 vcpu_set_thumb(vcpu); 71 vcpu_set_thumb(vcpu);
63 } 72 }
64 73
74 /* Propagate caller endianness */
75 if (kvm_vcpu_is_be(source_vcpu))
76 kvm_vcpu_set_be(vcpu);
77
65 *vcpu_pc(vcpu) = target_pc; 78 *vcpu_pc(vcpu) = target_pc;
66 vcpu->arch.pause = false; 79 vcpu->arch.pause = false;
67 smp_mb(); /* Make sure the above is visible */ 80 smp_mb(); /* Make sure the above is visible */
diff --git a/arch/arm/kvm/reset.c b/arch/arm/kvm/reset.c
index 71e08baee209..f558c073c023 100644
--- a/arch/arm/kvm/reset.c
+++ b/arch/arm/kvm/reset.c
@@ -30,16 +30,14 @@
30#include <kvm/arm_arch_timer.h> 30#include <kvm/arm_arch_timer.h>
31 31
32/****************************************************************************** 32/******************************************************************************
33 * Cortex-A15 Reset Values 33 * Cortex-A15 and Cortex-A7 Reset Values
34 */ 34 */
35 35
36static const int a15_max_cpu_idx = 3; 36static struct kvm_regs cortexa_regs_reset = {
37
38static struct kvm_regs a15_regs_reset = {
39 .usr_regs.ARM_cpsr = SVC_MODE | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT, 37 .usr_regs.ARM_cpsr = SVC_MODE | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT,
40}; 38};
41 39
42static const struct kvm_irq_level a15_vtimer_irq = { 40static const struct kvm_irq_level cortexa_vtimer_irq = {
43 { .irq = 27 }, 41 { .irq = 27 },
44 .level = 1, 42 .level = 1,
45}; 43};
@@ -58,23 +56,22 @@ static const struct kvm_irq_level a15_vtimer_irq = {
58 */ 56 */
59int kvm_reset_vcpu(struct kvm_vcpu *vcpu) 57int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
60{ 58{
61 struct kvm_regs *cpu_reset; 59 struct kvm_regs *reset_regs;
62 const struct kvm_irq_level *cpu_vtimer_irq; 60 const struct kvm_irq_level *cpu_vtimer_irq;
63 61
64 switch (vcpu->arch.target) { 62 switch (vcpu->arch.target) {
63 case KVM_ARM_TARGET_CORTEX_A7:
65 case KVM_ARM_TARGET_CORTEX_A15: 64 case KVM_ARM_TARGET_CORTEX_A15:
66 if (vcpu->vcpu_id > a15_max_cpu_idx) 65 reset_regs = &cortexa_regs_reset;
67 return -EINVAL;
68 cpu_reset = &a15_regs_reset;
69 vcpu->arch.midr = read_cpuid_id(); 66 vcpu->arch.midr = read_cpuid_id();
70 cpu_vtimer_irq = &a15_vtimer_irq; 67 cpu_vtimer_irq = &cortexa_vtimer_irq;
71 break; 68 break;
72 default: 69 default:
73 return -ENODEV; 70 return -ENODEV;
74 } 71 }
75 72
76 /* Reset core registers */ 73 /* Reset core registers */
77 memcpy(&vcpu->arch.regs, cpu_reset, sizeof(vcpu->arch.regs)); 74 memcpy(&vcpu->arch.regs, reset_regs, sizeof(vcpu->arch.regs));
78 75
79 /* Reset CP15 registers */ 76 /* Reset CP15 registers */
80 kvm_reset_coprocs(vcpu); 77 kvm_reset_coprocs(vcpu);
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index bd454b09133e..47d7338561de 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -41,7 +41,6 @@ else
41endif 41endif
42 42
43lib-$(CONFIG_ARCH_RPC) += ecard.o io-acorn.o floppydma.o 43lib-$(CONFIG_ARCH_RPC) += ecard.o io-acorn.o floppydma.o
44lib-$(CONFIG_ARCH_SHARK) += io-shark.o
45 44
46$(obj)/csumpartialcopy.o: $(obj)/csumpartialcopygeneric.S 45$(obj)/csumpartialcopy.o: $(obj)/csumpartialcopygeneric.S
47$(obj)/csumpartialcopyuser.o: $(obj)/csumpartialcopygeneric.S 46$(obj)/csumpartialcopyuser.o: $(obj)/csumpartialcopygeneric.S
diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h
index d6408d1ee543..e0c68d5bb7dc 100644
--- a/arch/arm/lib/bitops.h
+++ b/arch/arm/lib/bitops.h
@@ -10,6 +10,11 @@ UNWIND( .fnstart )
10 and r3, r0, #31 @ Get bit offset 10 and r3, r0, #31 @ Get bit offset
11 mov r0, r0, lsr #5 11 mov r0, r0, lsr #5
12 add r1, r1, r0, lsl #2 @ Get word offset 12 add r1, r1, r0, lsl #2 @ Get word offset
13#if __LINUX_ARM_ARCH__ >= 7
14 .arch_extension mp
15 ALT_SMP(W(pldw) [r1])
16 ALT_UP(W(nop))
17#endif
13 mov r3, r2, lsl r3 18 mov r3, r2, lsl r3
141: ldrex r2, [r1] 191: ldrex r2, [r1]
15 \instr r2, r2, r3 20 \instr r2, r2, r3
diff --git a/arch/arm/lib/io-shark.c b/arch/arm/lib/io-shark.c
deleted file mode 100644
index 824253948f51..000000000000
--- a/arch/arm/lib/io-shark.c
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * linux/arch/arm/lib/io-shark.c
3 *
4 * by Alexander Schulz
5 *
6 * derived from:
7 * linux/arch/arm/lib/io-ebsa.S
8 * Copyright (C) 1995, 1996 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 */
diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c
index 025f742dd4df..3e58d710013c 100644
--- a/arch/arm/lib/uaccess_with_memcpy.c
+++ b/arch/arm/lib/uaccess_with_memcpy.c
@@ -18,6 +18,7 @@
18#include <linux/hardirq.h> /* for in_atomic() */ 18#include <linux/hardirq.h> /* for in_atomic() */
19#include <linux/gfp.h> 19#include <linux/gfp.h>
20#include <linux/highmem.h> 20#include <linux/highmem.h>
21#include <linux/hugetlb.h>
21#include <asm/current.h> 22#include <asm/current.h>
22#include <asm/page.h> 23#include <asm/page.h>
23 24
@@ -40,7 +41,35 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp)
40 return 0; 41 return 0;
41 42
42 pmd = pmd_offset(pud, addr); 43 pmd = pmd_offset(pud, addr);
43 if (unlikely(pmd_none(*pmd) || pmd_bad(*pmd))) 44 if (unlikely(pmd_none(*pmd)))
45 return 0;
46
47 /*
48 * A pmd can be bad if it refers to a HugeTLB or THP page.
49 *
50 * Both THP and HugeTLB pages have the same pmd layout
51 * and should not be manipulated by the pte functions.
52 *
53 * Lock the page table for the destination and check
54 * to see that it's still huge and whether or not we will
55 * need to fault on write, or if we have a splitting THP.
56 */
57 if (unlikely(pmd_thp_or_huge(*pmd))) {
58 ptl = &current->mm->page_table_lock;
59 spin_lock(ptl);
60 if (unlikely(!pmd_thp_or_huge(*pmd)
61 || pmd_hugewillfault(*pmd)
62 || pmd_trans_splitting(*pmd))) {
63 spin_unlock(ptl);
64 return 0;
65 }
66
67 *ptep = NULL;
68 *ptlp = ptl;
69 return 1;
70 }
71
72 if (unlikely(pmd_bad(*pmd)))
44 return 0; 73 return 0;
45 74
46 pte = pte_offset_map_lock(current->mm, pmd, addr, &ptl); 75 pte = pte_offset_map_lock(current->mm, pmd, addr, &ptl);
@@ -94,7 +123,10 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n)
94 from += tocopy; 123 from += tocopy;
95 n -= tocopy; 124 n -= tocopy;
96 125
97 pte_unmap_unlock(pte, ptl); 126 if (pte)
127 pte_unmap_unlock(pte, ptl);
128 else
129 spin_unlock(ptl);
98 } 130 }
99 if (!atomic) 131 if (!atomic)
100 up_read(&current->mm->mmap_sem); 132 up_read(&current->mm->mmap_sem);
@@ -147,7 +179,10 @@ __clear_user_memset(void __user *addr, unsigned long n)
147 addr += tocopy; 179 addr += tocopy;
148 n -= tocopy; 180 n -= tocopy;
149 181
150 pte_unmap_unlock(pte, ptl); 182 if (pte)
183 pte_unmap_unlock(pte, ptl);
184 else
185 spin_unlock(ptl);
151 } 186 }
152 up_read(&current->mm->mmap_sem); 187 up_read(&current->mm->mmap_sem);
153 188
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 3b0a9538093c..c1b737097c95 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -98,7 +98,6 @@ obj-y += leds.o
98# Power Management 98# Power Management
99obj-$(CONFIG_PM) += pm.o 99obj-$(CONFIG_PM) += pm.o
100obj-$(CONFIG_AT91_SLOW_CLOCK) += pm_slowclock.o 100obj-$(CONFIG_AT91_SLOW_CLOCK) += pm_slowclock.o
101obj-$(CONFIG_CPU_IDLE) += cpuidle.o
102 101
103ifeq ($(CONFIG_PM_DEBUG),y) 102ifeq ($(CONFIG_PM_DEBUG),y)
104CFLAGS_pm.o += -DDEBUG 103CFLAGS_pm.o += -DDEBUG
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 4aad93d54d6f..25805f2f6010 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -27,6 +27,7 @@
27#include "generic.h" 27#include "generic.h"
28#include "clock.h" 28#include "clock.h"
29#include "sam9_smc.h" 29#include "sam9_smc.h"
30#include "pm.h"
30 31
31/* -------------------------------------------------------------------- 32/* --------------------------------------------------------------------
32 * Clocks 33 * Clocks
@@ -327,6 +328,7 @@ static void __init at91rm9200_ioremap_registers(void)
327{ 328{
328 at91rm9200_ioremap_st(AT91RM9200_BASE_ST); 329 at91rm9200_ioremap_st(AT91RM9200_BASE_ST);
329 at91_ioremap_ramc(0, AT91RM9200_BASE_MC, 256); 330 at91_ioremap_ramc(0, AT91RM9200_BASE_MC, 256);
331 at91_pm_set_standby(at91rm9200_standby);
330} 332}
331 333
332static void __init at91rm9200_initialize(void) 334static void __init at91rm9200_initialize(void)
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index 180b3024bec3..f607deb40f4d 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -93,7 +93,7 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id)
93 93
94static struct irqaction at91rm9200_timer_irq = { 94static struct irqaction at91rm9200_timer_irq = {
95 .name = "at91_tick", 95 .name = "at91_tick",
96 .flags = IRQF_SHARED | IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 96 .flags = IRQF_SHARED | IRQF_TIMER | IRQF_IRQPOLL,
97 .handler = at91rm9200_timer_interrupt, 97 .handler = at91rm9200_timer_interrupt,
98 .irq = NR_IRQS_LEGACY + AT91_ID_SYS, 98 .irq = NR_IRQS_LEGACY + AT91_ID_SYS,
99}; 99};
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 5de6074b4f4f..f8629a3fa245 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -28,6 +28,7 @@
28#include "generic.h" 28#include "generic.h"
29#include "clock.h" 29#include "clock.h"
30#include "sam9_smc.h" 30#include "sam9_smc.h"
31#include "pm.h"
31 32
32/* -------------------------------------------------------------------- 33/* --------------------------------------------------------------------
33 * Clocks 34 * Clocks
@@ -342,6 +343,7 @@ static void __init at91sam9260_ioremap_registers(void)
342 at91sam926x_ioremap_pit(AT91SAM9260_BASE_PIT); 343 at91sam926x_ioremap_pit(AT91SAM9260_BASE_PIT);
343 at91sam9_ioremap_smc(0, AT91SAM9260_BASE_SMC); 344 at91sam9_ioremap_smc(0, AT91SAM9260_BASE_SMC);
344 at91_ioremap_matrix(AT91SAM9260_BASE_MATRIX); 345 at91_ioremap_matrix(AT91SAM9260_BASE_MATRIX);
346 at91_pm_set_standby(at91sam9_sdram_standby);
345} 347}
346 348
347static void __init at91sam9260_initialize(void) 349static void __init at91sam9260_initialize(void)
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 0e0793241ab7..1f3867a17a28 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -27,6 +27,7 @@
27#include "generic.h" 27#include "generic.h"
28#include "clock.h" 28#include "clock.h"
29#include "sam9_smc.h" 29#include "sam9_smc.h"
30#include "pm.h"
30 31
31/* -------------------------------------------------------------------- 32/* --------------------------------------------------------------------
32 * Clocks 33 * Clocks
@@ -284,6 +285,7 @@ static void __init at91sam9261_ioremap_registers(void)
284 at91sam926x_ioremap_pit(AT91SAM9261_BASE_PIT); 285 at91sam926x_ioremap_pit(AT91SAM9261_BASE_PIT);
285 at91sam9_ioremap_smc(0, AT91SAM9261_BASE_SMC); 286 at91sam9_ioremap_smc(0, AT91SAM9261_BASE_SMC);
286 at91_ioremap_matrix(AT91SAM9261_BASE_MATRIX); 287 at91_ioremap_matrix(AT91SAM9261_BASE_MATRIX);
288 at91_pm_set_standby(at91sam9_sdram_standby);
287} 289}
288 290
289static void __init at91sam9261_initialize(void) 291static void __init at91sam9261_initialize(void)
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 629ea5fc95cf..b2a34740146a 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -465,7 +465,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
465 465
466#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) 466#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
467static u64 lcdc_dmamask = DMA_BIT_MASK(32); 467static u64 lcdc_dmamask = DMA_BIT_MASK(32);
468static struct atmel_lcdfb_info lcdc_data; 468static struct atmel_lcdfb_pdata lcdc_data;
469 469
470static struct resource lcdc_resources[] = { 470static struct resource lcdc_resources[] = {
471 [0] = { 471 [0] = {
@@ -498,7 +498,7 @@ static struct platform_device at91_lcdc_device = {
498 .num_resources = ARRAY_SIZE(lcdc_resources), 498 .num_resources = ARRAY_SIZE(lcdc_resources),
499}; 499};
500 500
501void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) 501void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
502{ 502{
503 if (!data) { 503 if (!data) {
504 return; 504 return;
@@ -559,7 +559,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
559 platform_device_register(&at91_lcdc_device); 559 platform_device_register(&at91_lcdc_device);
560} 560}
561#else 561#else
562void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {} 562void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
563#endif 563#endif
564 564
565 565
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 6ce7d1850893..90d455d294a1 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -26,6 +26,7 @@
26#include "generic.h" 26#include "generic.h"
27#include "clock.h" 27#include "clock.h"
28#include "sam9_smc.h" 28#include "sam9_smc.h"
29#include "pm.h"
29 30
30/* -------------------------------------------------------------------- 31/* --------------------------------------------------------------------
31 * Clocks 32 * Clocks
@@ -321,6 +322,7 @@ static void __init at91sam9263_ioremap_registers(void)
321 at91sam9_ioremap_smc(0, AT91SAM9263_BASE_SMC0); 322 at91sam9_ioremap_smc(0, AT91SAM9263_BASE_SMC0);
322 at91sam9_ioremap_smc(1, AT91SAM9263_BASE_SMC1); 323 at91sam9_ioremap_smc(1, AT91SAM9263_BASE_SMC1);
323 at91_ioremap_matrix(AT91SAM9263_BASE_MATRIX); 324 at91_ioremap_matrix(AT91SAM9263_BASE_MATRIX);
325 at91_pm_set_standby(at91sam9_sdram_standby);
324} 326}
325 327
326static void __init at91sam9263_initialize(void) 328static void __init at91sam9263_initialize(void)
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 858c8aac2daf..4aeadddbc181 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -832,7 +832,7 @@ void __init at91_add_device_can(struct at91_can_data *data) {}
832 832
833#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) 833#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
834static u64 lcdc_dmamask = DMA_BIT_MASK(32); 834static u64 lcdc_dmamask = DMA_BIT_MASK(32);
835static struct atmel_lcdfb_info lcdc_data; 835static struct atmel_lcdfb_pdata lcdc_data;
836 836
837static struct resource lcdc_resources[] = { 837static struct resource lcdc_resources[] = {
838 [0] = { 838 [0] = {
@@ -859,7 +859,7 @@ static struct platform_device at91_lcdc_device = {
859 .num_resources = ARRAY_SIZE(lcdc_resources), 859 .num_resources = ARRAY_SIZE(lcdc_resources),
860}; 860};
861 861
862void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) 862void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
863{ 863{
864 if (!data) 864 if (!data)
865 return; 865 return;
@@ -891,7 +891,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
891 platform_device_register(&at91_lcdc_device); 891 platform_device_register(&at91_lcdc_device);
892} 892}
893#else 893#else
894void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {} 894void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
895#endif 895#endif
896 896
897 897
diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
index 3a4bc2e1a65e..bb392320a0dd 100644
--- a/arch/arm/mach-at91/at91sam926x_time.c
+++ b/arch/arm/mach-at91/at91sam926x_time.c
@@ -171,7 +171,7 @@ static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id)
171 171
172static struct irqaction at91sam926x_pit_irq = { 172static struct irqaction at91sam926x_pit_irq = {
173 .name = "at91_tick", 173 .name = "at91_tick",
174 .flags = IRQF_SHARED | IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 174 .flags = IRQF_SHARED | IRQF_TIMER | IRQF_IRQPOLL,
175 .handler = at91sam926x_pit_interrupt, 175 .handler = at91sam926x_pit_interrupt,
176 .irq = NR_IRQS_LEGACY + AT91_ID_SYS, 176 .irq = NR_IRQS_LEGACY + AT91_ID_SYS,
177}; 177};
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 474ee04d24b9..e9bf0b8f40eb 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -26,6 +26,7 @@
26#include "generic.h" 26#include "generic.h"
27#include "clock.h" 27#include "clock.h"
28#include "sam9_smc.h" 28#include "sam9_smc.h"
29#include "pm.h"
29 30
30/* -------------------------------------------------------------------- 31/* --------------------------------------------------------------------
31 * Clocks 32 * Clocks
@@ -370,6 +371,7 @@ static void __init at91sam9g45_ioremap_registers(void)
370 at91sam926x_ioremap_pit(AT91SAM9G45_BASE_PIT); 371 at91sam926x_ioremap_pit(AT91SAM9G45_BASE_PIT);
371 at91sam9_ioremap_smc(0, AT91SAM9G45_BASE_SMC); 372 at91sam9_ioremap_smc(0, AT91SAM9G45_BASE_SMC);
372 at91_ioremap_matrix(AT91SAM9G45_BASE_MATRIX); 373 at91_ioremap_matrix(AT91SAM9G45_BASE_MATRIX);
374 at91_pm_set_standby(at91_ddr_standby);
373} 375}
374 376
375static void __init at91sam9g45_initialize(void) 377static void __init at91sam9g45_initialize(void)
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index acb703e13331..cb36fa872d30 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -965,7 +965,7 @@ void __init at91_add_device_isi(struct isi_platform_data *data,
965 965
966#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) 966#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
967static u64 lcdc_dmamask = DMA_BIT_MASK(32); 967static u64 lcdc_dmamask = DMA_BIT_MASK(32);
968static struct atmel_lcdfb_info lcdc_data; 968static struct atmel_lcdfb_pdata lcdc_data;
969 969
970static struct resource lcdc_resources[] = { 970static struct resource lcdc_resources[] = {
971 [0] = { 971 [0] = {
@@ -991,7 +991,7 @@ static struct platform_device at91_lcdc_device = {
991 .num_resources = ARRAY_SIZE(lcdc_resources), 991 .num_resources = ARRAY_SIZE(lcdc_resources),
992}; 992};
993 993
994void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) 994void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
995{ 995{
996 if (!data) 996 if (!data)
997 return; 997 return;
@@ -1037,7 +1037,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
1037 platform_device_register(&at91_lcdc_device); 1037 platform_device_register(&at91_lcdc_device);
1038} 1038}
1039#else 1039#else
1040void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {} 1040void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
1041#endif 1041#endif
1042 1042
1043 1043
diff --git a/arch/arm/mach-at91/at91sam9g45_reset.S b/arch/arm/mach-at91/at91sam9g45_reset.S
index 721a1a34dd1d..c40c1e2ef80f 100644
--- a/arch/arm/mach-at91/at91sam9g45_reset.S
+++ b/arch/arm/mach-at91/at91sam9g45_reset.S
@@ -16,11 +16,17 @@
16#include "at91_rstc.h" 16#include "at91_rstc.h"
17 .arm 17 .arm
18 18
19/*
20 * at91_ramc_base is an array void*
21 * init at NULL if only one DDR controler is present in or DT
22 */
19 .globl at91sam9g45_restart 23 .globl at91sam9g45_restart
20 24
21at91sam9g45_restart: 25at91sam9g45_restart:
22 ldr r5, =at91_ramc_base @ preload constants 26 ldr r5, =at91_ramc_base @ preload constants
23 ldr r0, [r5] 27 ldr r0, [r5]
28 ldr r5, [r5, #4] @ ddr1
29 cmp r5, #0
24 ldr r4, =at91_rstc_base 30 ldr r4, =at91_rstc_base
25 ldr r1, [r4] 31 ldr r1, [r4]
26 32
@@ -30,6 +36,8 @@ at91sam9g45_restart:
30 36
31 .balign 32 @ align to cache line 37 .balign 32 @ align to cache line
32 38
39 strne r2, [r5, #AT91_DDRSDRC_RTR] @ disable DDR1 access
40 strne r3, [r5, #AT91_DDRSDRC_LPR] @ power down DDR1
33 str r2, [r0, #AT91_DDRSDRC_RTR] @ disable DDR0 access 41 str r2, [r0, #AT91_DDRSDRC_RTR] @ disable DDR0 access
34 str r3, [r0, #AT91_DDRSDRC_LPR] @ power down DDR0 42 str r3, [r0, #AT91_DDRSDRC_LPR] @ power down DDR0
35 str r4, [r1, #AT91_RSTC_CR] @ reset processor 43 str r4, [r1, #AT91_RSTC_CR] @ reset processor
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c
index c7d670d11802..2d895a297739 100644
--- a/arch/arm/mach-at91/at91sam9n12.c
+++ b/arch/arm/mach-at91/at91sam9n12.c
@@ -169,6 +169,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
169 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb_clk), 169 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb_clk),
170 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb_clk), 170 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb_clk),
171 CLKDEV_CON_DEV_ID("mci_clk", "f0008000.mmc", &mmc_clk), 171 CLKDEV_CON_DEV_ID("mci_clk", "f0008000.mmc", &mmc_clk),
172 CLKDEV_CON_DEV_ID(NULL, "f0010000.ssc", &ssc_clk),
172 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma_clk), 173 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma_clk),
173 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk), 174 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
174 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk), 175 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index d4ec0d9a9872..88995af09c04 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -27,6 +27,7 @@
27#include "generic.h" 27#include "generic.h"
28#include "clock.h" 28#include "clock.h"
29#include "sam9_smc.h" 29#include "sam9_smc.h"
30#include "pm.h"
30 31
31/* -------------------------------------------------------------------- 32/* --------------------------------------------------------------------
32 * Clocks 33 * Clocks
@@ -287,6 +288,7 @@ static void __init at91sam9rl_ioremap_registers(void)
287 at91sam926x_ioremap_pit(AT91SAM9RL_BASE_PIT); 288 at91sam926x_ioremap_pit(AT91SAM9RL_BASE_PIT);
288 at91sam9_ioremap_smc(0, AT91SAM9RL_BASE_SMC); 289 at91sam9_ioremap_smc(0, AT91SAM9RL_BASE_SMC);
289 at91_ioremap_matrix(AT91SAM9RL_BASE_MATRIX); 290 at91_ioremap_matrix(AT91SAM9RL_BASE_MATRIX);
291 at91_pm_set_standby(at91sam9_sdram_standby);
290} 292}
291 293
292static void __init at91sam9rl_initialize(void) 294static void __init at91sam9rl_initialize(void)
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 352468f265a9..a698bdab2cce 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -498,7 +498,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) {}
498 498
499#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) 499#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
500static u64 lcdc_dmamask = DMA_BIT_MASK(32); 500static u64 lcdc_dmamask = DMA_BIT_MASK(32);
501static struct atmel_lcdfb_info lcdc_data; 501static struct atmel_lcdfb_pdata lcdc_data;
502 502
503static struct resource lcdc_resources[] = { 503static struct resource lcdc_resources[] = {
504 [0] = { 504 [0] = {
@@ -525,7 +525,7 @@ static struct platform_device at91_lcdc_device = {
525 .num_resources = ARRAY_SIZE(lcdc_resources), 525 .num_resources = ARRAY_SIZE(lcdc_resources),
526}; 526};
527 527
528void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) 528void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
529{ 529{
530 if (!data) { 530 if (!data) {
531 return; 531 return;
@@ -557,7 +557,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
557 platform_device_register(&at91_lcdc_device); 557 platform_device_register(&at91_lcdc_device);
558} 558}
559#else 559#else
560void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {} 560void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
561#endif 561#endif
562 562
563 563
diff --git a/arch/arm/mach-at91/at91x40_time.c b/arch/arm/mach-at91/at91x40_time.c
index 2919eba41ff4..c0e637adf65d 100644
--- a/arch/arm/mach-at91/at91x40_time.c
+++ b/arch/arm/mach-at91/at91x40_time.c
@@ -57,7 +57,7 @@ static irqreturn_t at91x40_timer_interrupt(int irq, void *dev_id)
57 57
58static struct irqaction at91x40_timer_irq = { 58static struct irqaction at91x40_timer_irq = {
59 .name = "at91_tick", 59 .name = "at91_tick",
60 .flags = IRQF_DISABLED | IRQF_TIMER, 60 .flags = IRQF_TIMER,
61 .handler = at91x40_timer_interrupt 61 .handler = at91x40_timer_interrupt
62}; 62};
63 63
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index ade948b82662..112e867c4abe 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -112,7 +112,7 @@ static struct spi_board_info cam60_spi_devices[] __initdata = {
112/* 112/*
113 * MACB Ethernet device 113 * MACB Ethernet device
114 */ 114 */
115static struct __initdata macb_platform_data cam60_macb_data = { 115static struct macb_platform_data cam60_macb_data __initdata = {
116 .phy_irq_pin = AT91_PIN_PB5, 116 .phy_irq_pin = AT91_PIN_PB5,
117 .is_rmii = 0, 117 .is_rmii = 0,
118}; 118};
diff --git a/arch/arm/mach-at91/board-dt-rm9200.c b/arch/arm/mach-at91/board-dt-rm9200.c
index 3fcb6623a33e..3a185faee795 100644
--- a/arch/arm/mach-at91/board-dt-rm9200.c
+++ b/arch/arm/mach-at91/board-dt-rm9200.c
@@ -14,7 +14,6 @@
14#include <linux/gpio.h> 14#include <linux/gpio.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_irq.h> 16#include <linux/of_irq.h>
17#include <linux/of_platform.h>
18 17
19#include <asm/setup.h> 18#include <asm/setup.h>
20#include <asm/irq.h> 19#include <asm/irq.h>
@@ -36,11 +35,6 @@ static void __init at91rm9200_dt_init_irq(void)
36 of_irq_init(irq_of_match); 35 of_irq_init(irq_of_match);
37} 36}
38 37
39static void __init at91rm9200_dt_device_init(void)
40{
41 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
42}
43
44static const char *at91rm9200_dt_board_compat[] __initdata = { 38static const char *at91rm9200_dt_board_compat[] __initdata = {
45 "atmel,at91rm9200", 39 "atmel,at91rm9200",
46 NULL 40 NULL
@@ -52,6 +46,5 @@ DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)")
52 .handle_irq = at91_aic_handle_irq, 46 .handle_irq = at91_aic_handle_irq,
53 .init_early = at91rm9200_dt_initialize, 47 .init_early = at91rm9200_dt_initialize,
54 .init_irq = at91rm9200_dt_init_irq, 48 .init_irq = at91rm9200_dt_init_irq,
55 .init_machine = at91rm9200_dt_device_init,
56 .dt_compat = at91rm9200_dt_board_compat, 49 .dt_compat = at91rm9200_dt_board_compat,
57MACHINE_END 50MACHINE_END
diff --git a/arch/arm/mach-at91/board-dt-sam9.c b/arch/arm/mach-at91/board-dt-sam9.c
index 8db30132abed..3dab868b02fa 100644
--- a/arch/arm/mach-at91/board-dt-sam9.c
+++ b/arch/arm/mach-at91/board-dt-sam9.c
@@ -13,7 +13,6 @@
13#include <linux/gpio.h> 13#include <linux/gpio.h>
14#include <linux/of.h> 14#include <linux/of.h>
15#include <linux/of_irq.h> 15#include <linux/of_irq.h>
16#include <linux/of_platform.h>
17 16
18#include <asm/setup.h> 17#include <asm/setup.h>
19#include <asm/irq.h> 18#include <asm/irq.h>
@@ -37,11 +36,6 @@ static void __init at91_dt_init_irq(void)
37 of_irq_init(irq_of_match); 36 of_irq_init(irq_of_match);
38} 37}
39 38
40static void __init at91_dt_device_init(void)
41{
42 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
43}
44
45static const char *at91_dt_board_compat[] __initdata = { 39static const char *at91_dt_board_compat[] __initdata = {
46 "atmel,at91sam9", 40 "atmel,at91sam9",
47 NULL 41 NULL
@@ -54,6 +48,5 @@ DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)")
54 .handle_irq = at91_aic_handle_irq, 48 .handle_irq = at91_aic_handle_irq,
55 .init_early = at91_dt_initialize, 49 .init_early = at91_dt_initialize,
56 .init_irq = at91_dt_init_irq, 50 .init_irq = at91_dt_init_irq,
57 .init_machine = at91_dt_device_init,
58 .dt_compat = at91_dt_board_compat, 51 .dt_compat = at91_dt_board_compat,
59MACHINE_END 52MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index d3437624ca4e..473546b9408b 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -389,7 +389,7 @@ static struct fb_monspecs at91fb_default_stn_monspecs = {
389 | ATMEL_LCDC_IFWIDTH_4 \ 389 | ATMEL_LCDC_IFWIDTH_4 \
390 | ATMEL_LCDC_SCANMOD_SINGLE) 390 | ATMEL_LCDC_SCANMOD_SINGLE)
391 391
392static void at91_lcdc_stn_power_control(int on) 392static void at91_lcdc_stn_power_control(struct atmel_lcdfb_pdata *pdata, int on)
393{ 393{
394 /* backlight */ 394 /* backlight */
395 if (on) { /* power up */ 395 if (on) { /* power up */
@@ -401,7 +401,7 @@ static void at91_lcdc_stn_power_control(int on)
401 } 401 }
402} 402}
403 403
404static struct atmel_lcdfb_info __initdata ek_lcdc_data = { 404static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
405 .default_bpp = 1, 405 .default_bpp = 1,
406 .default_dmacon = ATMEL_LCDC_DMAEN, 406 .default_dmacon = ATMEL_LCDC_DMAEN,
407 .default_lcdcon2 = AT91SAM9261_DEFAULT_STN_LCDCON2, 407 .default_lcdcon2 = AT91SAM9261_DEFAULT_STN_LCDCON2,
@@ -445,7 +445,7 @@ static struct fb_monspecs at91fb_default_tft_monspecs = {
445 | ATMEL_LCDC_DISTYPE_TFT \ 445 | ATMEL_LCDC_DISTYPE_TFT \
446 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) 446 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
447 447
448static void at91_lcdc_tft_power_control(int on) 448static void at91_lcdc_tft_power_control(struct atmel_lcdfb_pdata *pdata, int on)
449{ 449{
450 if (on) 450 if (on)
451 at91_set_gpio_value(AT91_PIN_PA12, 0); /* power up */ 451 at91_set_gpio_value(AT91_PIN_PA12, 0); /* power up */
@@ -453,7 +453,7 @@ static void at91_lcdc_tft_power_control(int on)
453 at91_set_gpio_value(AT91_PIN_PA12, 1); /* power down */ 453 at91_set_gpio_value(AT91_PIN_PA12, 1); /* power down */
454} 454}
455 455
456static struct atmel_lcdfb_info __initdata ek_lcdc_data = { 456static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
457 .lcdcon_is_backlight = true, 457 .lcdcon_is_backlight = true,
458 .default_bpp = 16, 458 .default_bpp = 16,
459 .default_dmacon = ATMEL_LCDC_DMAEN, 459 .default_dmacon = ATMEL_LCDC_DMAEN,
@@ -465,7 +465,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
465#endif 465#endif
466 466
467#else 467#else
468static struct atmel_lcdfb_info __initdata ek_lcdc_data; 468static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
469#endif 469#endif
470 470
471 471
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 3284df05df14..8b4942cbb6d9 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -275,13 +275,13 @@ static struct fb_monspecs at91fb_default_monspecs = {
275 | ATMEL_LCDC_DISTYPE_TFT \ 275 | ATMEL_LCDC_DISTYPE_TFT \
276 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) 276 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
277 277
278static void at91_lcdc_power_control(int on) 278static void at91_lcdc_power_control(struct atmel_lcdfb_pdata *pdata, int on)
279{ 279{
280 at91_set_gpio_value(AT91_PIN_PA30, on); 280 at91_set_gpio_value(AT91_PIN_PA30, on);
281} 281}
282 282
283/* Driver datas */ 283/* Driver datas */
284static struct atmel_lcdfb_info __initdata ek_lcdc_data = { 284static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
285 .lcdcon_is_backlight = true, 285 .lcdcon_is_backlight = true,
286 .default_bpp = 16, 286 .default_bpp = 16,
287 .default_dmacon = ATMEL_LCDC_DMAEN, 287 .default_dmacon = ATMEL_LCDC_DMAEN,
@@ -292,7 +292,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
292}; 292};
293 293
294#else 294#else
295static struct atmel_lcdfb_info __initdata ek_lcdc_data; 295static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
296#endif 296#endif
297 297
298 298
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 2a94896a1375..ef39078c8ce2 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -284,7 +284,7 @@ static struct fb_monspecs at91fb_default_monspecs = {
284 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) 284 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
285 285
286/* Driver datas */ 286/* Driver datas */
287static struct atmel_lcdfb_info __initdata ek_lcdc_data = { 287static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
288 .lcdcon_is_backlight = true, 288 .lcdcon_is_backlight = true,
289 .default_bpp = 32, 289 .default_bpp = 32,
290 .default_dmacon = ATMEL_LCDC_DMAEN, 290 .default_dmacon = ATMEL_LCDC_DMAEN,
@@ -295,7 +295,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
295}; 295};
296 296
297#else 297#else
298static struct atmel_lcdfb_info __initdata ek_lcdc_data; 298static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
299#endif 299#endif
300 300
301 301
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index aa265dcf2128..604eecf6cd70 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -170,7 +170,7 @@ static struct fb_monspecs at91fb_default_monspecs = {
170 | ATMEL_LCDC_DISTYPE_TFT \ 170 | ATMEL_LCDC_DISTYPE_TFT \
171 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) 171 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
172 172
173static void at91_lcdc_power_control(int on) 173static void at91_lcdc_power_control(struct atmel_lcdfb_pdata *pdata, int on)
174{ 174{
175 if (on) 175 if (on)
176 at91_set_gpio_value(AT91_PIN_PC1, 0); /* power up */ 176 at91_set_gpio_value(AT91_PIN_PC1, 0); /* power up */
@@ -179,7 +179,7 @@ static void at91_lcdc_power_control(int on)
179} 179}
180 180
181/* Driver datas */ 181/* Driver datas */
182static struct atmel_lcdfb_info __initdata ek_lcdc_data = { 182static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
183 .lcdcon_is_backlight = true, 183 .lcdcon_is_backlight = true,
184 .default_bpp = 16, 184 .default_bpp = 16,
185 .default_dmacon = ATMEL_LCDC_DMAEN, 185 .default_dmacon = ATMEL_LCDC_DMAEN,
@@ -191,7 +191,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
191}; 191};
192 192
193#else 193#else
194static struct atmel_lcdfb_info __initdata ek_lcdc_data; 194static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
195#endif 195#endif
196 196
197 197
diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
index 4a234fb2ab3b..6c08b341167d 100644
--- a/arch/arm/mach-at91/board.h
+++ b/arch/arm/mach-at91/board.h
@@ -107,8 +107,8 @@ extern void __init at91_add_device_pwm(u32 mask);
107extern void __init at91_add_device_ssc(unsigned id, unsigned pins); 107extern void __init at91_add_device_ssc(unsigned id, unsigned pins);
108 108
109 /* LCD Controller */ 109 /* LCD Controller */
110struct atmel_lcdfb_info; 110struct atmel_lcdfb_pdata;
111extern void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data); 111extern void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data);
112 112
113 /* AC97 */ 113 /* AC97 */
114extern void __init at91_add_device_ac97(struct ac97c_platform_data *data); 114extern void __init at91_add_device_ac97(struct ac97c_platform_data *data);
diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c
deleted file mode 100644
index 4ec6a6d9b9be..000000000000
--- a/arch/arm/mach-at91/cpuidle.c
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * based on arch/arm/mach-kirkwood/cpuidle.c
3 *
4 * CPU idle support for AT91 SoC
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 * The cpu idle uses wait-for-interrupt and RAM self refresh in order
11 * to implement two idle states -
12 * #1 wait-for-interrupt
13 * #2 wait-for-interrupt and RAM self refresh
14 */
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/cpuidle.h>
20#include <linux/io.h>
21#include <linux/export.h>
22#include <asm/proc-fns.h>
23#include <asm/cpuidle.h>
24#include <mach/cpu.h>
25
26#include "pm.h"
27
28#define AT91_MAX_STATES 2
29
30/* Actual code that puts the SoC in different idle states */
31static int at91_enter_idle(struct cpuidle_device *dev,
32 struct cpuidle_driver *drv,
33 int index)
34{
35 if (cpu_is_at91rm9200())
36 at91rm9200_standby();
37 else if (cpu_is_at91sam9g45())
38 at91sam9g45_standby();
39 else if (cpu_is_at91sam9263())
40 at91sam9263_standby();
41 else
42 at91sam9_standby();
43
44 return index;
45}
46
47static struct cpuidle_driver at91_idle_driver = {
48 .name = "at91_idle",
49 .owner = THIS_MODULE,
50 .states[0] = ARM_CPUIDLE_WFI_STATE,
51 .states[1] = {
52 .enter = at91_enter_idle,
53 .exit_latency = 10,
54 .target_residency = 10000,
55 .flags = CPUIDLE_FLAG_TIME_VALID,
56 .name = "RAM_SR",
57 .desc = "WFI and DDR Self Refresh",
58 },
59 .state_count = AT91_MAX_STATES,
60};
61
62/* Initialize CPU idle by registering the idle states */
63static int __init at91_init_cpuidle(void)
64{
65 return cpuidle_register(&at91_idle_driver, NULL);
66}
67
68device_initcall(at91_init_cpuidle);
diff --git a/arch/arm/mach-at91/include/mach/at91_adc.h b/arch/arm/mach-at91/include/mach/at91_adc.h
index 048a57f76bd3..c287307b9a3b 100644
--- a/arch/arm/mach-at91/include/mach/at91_adc.h
+++ b/arch/arm/mach-at91/include/mach/at91_adc.h
@@ -60,14 +60,48 @@
60#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */ 60#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
61#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */ 61#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
62#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */ 62#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
63#define AT91_ADC_IER_PEN (1 << 29)
64#define AT91_ADC_IER_NOPEN (1 << 30)
65#define AT91_ADC_IER_XRDY (1 << 20)
66#define AT91_ADC_IER_YRDY (1 << 21)
67#define AT91_ADC_IER_PRDY (1 << 22)
68#define AT91_ADC_ISR_PENS (1 << 31)
63 69
64#define AT91_ADC_CHR(n) (0x30 + ((n) * 4)) /* Channel Data Register N */ 70#define AT91_ADC_CHR(n) (0x30 + ((n) * 4)) /* Channel Data Register N */
65#define AT91_ADC_DATA (0x3ff) 71#define AT91_ADC_DATA (0x3ff)
66 72
67#define AT91_ADC_CDR0_9X5 (0x50) /* Channel Data Register 0 for 9X5 */ 73#define AT91_ADC_CDR0_9X5 (0x50) /* Channel Data Register 0 for 9X5 */
68 74
75#define AT91_ADC_ACR 0x94 /* Analog Control Register */
76#define AT91_ADC_ACR_PENDETSENS (0x3 << 0) /* pull-up resistor */
77
78#define AT91_ADC_TSMR 0xB0
79#define AT91_ADC_TSMR_TSMODE (3 << 0) /* Touch Screen Mode */
80#define AT91_ADC_TSMR_TSMODE_NONE (0 << 0)
81#define AT91_ADC_TSMR_TSMODE_4WIRE_NO_PRESS (1 << 0)
82#define AT91_ADC_TSMR_TSMODE_4WIRE_PRESS (2 << 0)
83#define AT91_ADC_TSMR_TSMODE_5WIRE (3 << 0)
84#define AT91_ADC_TSMR_TSAV (3 << 4) /* Averages samples */
85#define AT91_ADC_TSMR_TSAV_(x) ((x) << 4)
86#define AT91_ADC_TSMR_SCTIM (0x0f << 16) /* Switch closure time */
87#define AT91_ADC_TSMR_PENDBC (0x0f << 28) /* Pen Debounce time */
88#define AT91_ADC_TSMR_PENDBC_(x) ((x) << 28)
89#define AT91_ADC_TSMR_NOTSDMA (1 << 22) /* No Touchscreen DMA */
90#define AT91_ADC_TSMR_PENDET_DIS (0 << 24) /* Pen contact detection disable */
91#define AT91_ADC_TSMR_PENDET_ENA (1 << 24) /* Pen contact detection enable */
92
93#define AT91_ADC_TSXPOSR 0xB4
94#define AT91_ADC_TSYPOSR 0xB8
95#define AT91_ADC_TSPRESSR 0xBC
96
69#define AT91_ADC_TRGR_9260 AT91_ADC_MR 97#define AT91_ADC_TRGR_9260 AT91_ADC_MR
70#define AT91_ADC_TRGR_9G45 0x08 98#define AT91_ADC_TRGR_9G45 0x08
71#define AT91_ADC_TRGR_9X5 0xC0 99#define AT91_ADC_TRGR_9X5 0xC0
72 100
101/* Trigger Register bit field */
102#define AT91_ADC_TRGR_TRGPER (0xffff << 16)
103#define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
104#define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
105#define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
106
73#endif 107#endif
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 15afb5d9271f..9986542e8060 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -39,6 +39,8 @@
39#include "at91_rstc.h" 39#include "at91_rstc.h"
40#include "at91_shdwc.h" 40#include "at91_shdwc.h"
41 41
42static void (*at91_pm_standby)(void);
43
42static void __init show_reset_status(void) 44static void __init show_reset_status(void)
43{ 45{
44 static char reset[] __initdata = "reset"; 46 static char reset[] __initdata = "reset";
@@ -266,14 +268,8 @@ static int at91_pm_enter(suspend_state_t state)
266 * For ARM 926 based chips, this requirement is weaker 268 * For ARM 926 based chips, this requirement is weaker
267 * as at91sam9 can access a RAM in self-refresh mode. 269 * as at91sam9 can access a RAM in self-refresh mode.
268 */ 270 */
269 if (cpu_is_at91rm9200()) 271 if (at91_pm_standby)
270 at91rm9200_standby(); 272 at91_pm_standby();
271 else if (cpu_is_at91sam9g45())
272 at91sam9g45_standby();
273 else if (cpu_is_at91sam9263())
274 at91sam9263_standby();
275 else
276 at91sam9_standby();
277 break; 273 break;
278 274
279 case PM_SUSPEND_ON: 275 case PM_SUSPEND_ON:
@@ -314,6 +310,18 @@ static const struct platform_suspend_ops at91_pm_ops = {
314 .end = at91_pm_end, 310 .end = at91_pm_end,
315}; 311};
316 312
313static struct platform_device at91_cpuidle_device = {
314 .name = "cpuidle-at91",
315};
316
317void at91_pm_set_standby(void (*at91_standby)(void))
318{
319 if (at91_standby) {
320 at91_cpuidle_device.dev.platform_data = at91_standby;
321 at91_pm_standby = at91_standby;
322 }
323}
324
317static int __init at91_pm_init(void) 325static int __init at91_pm_init(void)
318{ 326{
319#ifdef CONFIG_AT91_SLOW_CLOCK 327#ifdef CONFIG_AT91_SLOW_CLOCK
@@ -325,6 +333,9 @@ static int __init at91_pm_init(void)
325 /* AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. */ 333 /* AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. */
326 if (cpu_is_at91rm9200()) 334 if (cpu_is_at91rm9200())
327 at91_ramc_write(0, AT91RM9200_SDRAMC_LPR, 0); 335 at91_ramc_write(0, AT91RM9200_SDRAMC_LPR, 0);
336
337 if (at91_cpuidle_device.dev.platform_data)
338 platform_device_register(&at91_cpuidle_device);
328 339
329 suspend_set_ops(&at91_pm_ops); 340 suspend_set_ops(&at91_pm_ops);
330 341
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h
index 2f5908f0b8c5..3ed190ce062b 100644
--- a/arch/arm/mach-at91/pm.h
+++ b/arch/arm/mach-at91/pm.h
@@ -11,9 +11,13 @@
11#ifndef __ARCH_ARM_MACH_AT91_PM 11#ifndef __ARCH_ARM_MACH_AT91_PM
12#define __ARCH_ARM_MACH_AT91_PM 12#define __ARCH_ARM_MACH_AT91_PM
13 13
14#include <asm/proc-fns.h>
15
14#include <mach/at91_ramc.h> 16#include <mach/at91_ramc.h>
15#include <mach/at91rm9200_sdramc.h> 17#include <mach/at91rm9200_sdramc.h>
16 18
19extern void at91_pm_set_standby(void (*at91_standby)(void));
20
17/* 21/*
18 * The AT91RM9200 goes into self-refresh mode with this command, and will 22 * The AT91RM9200 goes into self-refresh mode with this command, and will
19 * terminate self-refresh automatically on the next SDRAM access. 23 * terminate self-refresh automatically on the next SDRAM access.
@@ -45,16 +49,18 @@ static inline void at91rm9200_standby(void)
45/* We manage both DDRAM/SDRAM controllers, we need more than one value to 49/* We manage both DDRAM/SDRAM controllers, we need more than one value to
46 * remember. 50 * remember.
47 */ 51 */
48static inline void at91sam9g45_standby(void) 52static inline void at91_ddr_standby(void)
49{ 53{
50 /* Those two values allow us to delay self-refresh activation 54 /* Those two values allow us to delay self-refresh activation
51 * to the maximum. */ 55 * to the maximum. */
52 u32 lpr0, lpr1; 56 u32 lpr0, lpr1 = 0;
53 u32 saved_lpr0, saved_lpr1; 57 u32 saved_lpr0, saved_lpr1 = 0;
54 58
55 saved_lpr1 = at91_ramc_read(1, AT91_DDRSDRC_LPR); 59 if (at91_ramc_base[1]) {
56 lpr1 = saved_lpr1 & ~AT91_DDRSDRC_LPCB; 60 saved_lpr1 = at91_ramc_read(1, AT91_DDRSDRC_LPR);
57 lpr1 |= AT91_DDRSDRC_LPCB_SELF_REFRESH; 61 lpr1 = saved_lpr1 & ~AT91_DDRSDRC_LPCB;
62 lpr1 |= AT91_DDRSDRC_LPCB_SELF_REFRESH;
63 }
58 64
59 saved_lpr0 = at91_ramc_read(0, AT91_DDRSDRC_LPR); 65 saved_lpr0 = at91_ramc_read(0, AT91_DDRSDRC_LPR);
60 lpr0 = saved_lpr0 & ~AT91_DDRSDRC_LPCB; 66 lpr0 = saved_lpr0 & ~AT91_DDRSDRC_LPCB;
@@ -62,25 +68,29 @@ static inline void at91sam9g45_standby(void)
62 68
63 /* self-refresh mode now */ 69 /* self-refresh mode now */
64 at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0); 70 at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0);
65 at91_ramc_write(1, AT91_DDRSDRC_LPR, lpr1); 71 if (at91_ramc_base[1])
72 at91_ramc_write(1, AT91_DDRSDRC_LPR, lpr1);
66 73
67 cpu_do_idle(); 74 cpu_do_idle();
68 75
69 at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0); 76 at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0);
70 at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1); 77 if (at91_ramc_base[1])
78 at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1);
71} 79}
72 80
73/* We manage both DDRAM/SDRAM controllers, we need more than one value to 81/* We manage both DDRAM/SDRAM controllers, we need more than one value to
74 * remember. 82 * remember.
75 */ 83 */
76static inline void at91sam9263_standby(void) 84static inline void at91sam9_sdram_standby(void)
77{ 85{
78 u32 lpr0, lpr1; 86 u32 lpr0, lpr1 = 0;
79 u32 saved_lpr0, saved_lpr1; 87 u32 saved_lpr0, saved_lpr1 = 0;
80 88
81 saved_lpr1 = at91_ramc_read(1, AT91_SDRAMC_LPR); 89 if (at91_ramc_base[1]) {
82 lpr1 = saved_lpr1 & ~AT91_SDRAMC_LPCB; 90 saved_lpr1 = at91_ramc_read(1, AT91_SDRAMC_LPR);
83 lpr1 |= AT91_SDRAMC_LPCB_SELF_REFRESH; 91 lpr1 = saved_lpr1 & ~AT91_SDRAMC_LPCB;
92 lpr1 |= AT91_SDRAMC_LPCB_SELF_REFRESH;
93 }
84 94
85 saved_lpr0 = at91_ramc_read(0, AT91_SDRAMC_LPR); 95 saved_lpr0 = at91_ramc_read(0, AT91_SDRAMC_LPR);
86 lpr0 = saved_lpr0 & ~AT91_SDRAMC_LPCB; 96 lpr0 = saved_lpr0 & ~AT91_SDRAMC_LPCB;
@@ -88,27 +98,14 @@ static inline void at91sam9263_standby(void)
88 98
89 /* self-refresh mode now */ 99 /* self-refresh mode now */
90 at91_ramc_write(0, AT91_SDRAMC_LPR, lpr0); 100 at91_ramc_write(0, AT91_SDRAMC_LPR, lpr0);
91 at91_ramc_write(1, AT91_SDRAMC_LPR, lpr1); 101 if (at91_ramc_base[1])
102 at91_ramc_write(1, AT91_SDRAMC_LPR, lpr1);
92 103
93 cpu_do_idle(); 104 cpu_do_idle();
94 105
95 at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr0); 106 at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr0);
96 at91_ramc_write(1, AT91_SDRAMC_LPR, saved_lpr1); 107 if (at91_ramc_base[1])
97} 108 at91_ramc_write(1, AT91_SDRAMC_LPR, saved_lpr1);
98
99static inline void at91sam9_standby(void)
100{
101 u32 saved_lpr, lpr;
102
103 saved_lpr = at91_ramc_read(0, AT91_SDRAMC_LPR);
104
105 lpr = saved_lpr & ~AT91_SDRAMC_LPCB;
106 at91_ramc_write(0, AT91_SDRAMC_LPR, lpr |
107 AT91_SDRAMC_LPCB_SELF_REFRESH);
108
109 cpu_do_idle();
110
111 at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr);
112} 109}
113 110
114#endif 111#endif
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index b17fbcf4d9e8..094b3459c288 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -23,6 +23,7 @@
23#include "at91_shdwc.h" 23#include "at91_shdwc.h"
24#include "soc.h" 24#include "soc.h"
25#include "generic.h" 25#include "generic.h"
26#include "pm.h"
26 27
27struct at91_init_soc __initdata at91_boot_soc; 28struct at91_init_soc __initdata at91_boot_soc;
28 29
@@ -376,15 +377,16 @@ static void at91_dt_rstc(void)
376} 377}
377 378
378static struct of_device_id ramc_ids[] = { 379static struct of_device_id ramc_ids[] = {
379 { .compatible = "atmel,at91rm9200-sdramc" }, 380 { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby },
380 { .compatible = "atmel,at91sam9260-sdramc" }, 381 { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby },
381 { .compatible = "atmel,at91sam9g45-ddramc" }, 382 { .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby },
382 { /*sentinel*/ } 383 { /*sentinel*/ }
383}; 384};
384 385
385static void at91_dt_ramc(void) 386static void at91_dt_ramc(void)
386{ 387{
387 struct device_node *np; 388 struct device_node *np;
389 const struct of_device_id *of_id;
388 390
389 np = of_find_matching_node(NULL, ramc_ids); 391 np = of_find_matching_node(NULL, ramc_ids);
390 if (!np) 392 if (!np)
@@ -396,6 +398,12 @@ static void at91_dt_ramc(void)
396 /* the controller may have 2 banks */ 398 /* the controller may have 2 banks */
397 at91_ramc_base[1] = of_iomap(np, 1); 399 at91_ramc_base[1] = of_iomap(np, 1);
398 400
401 of_id = of_match_node(ramc_ids, np);
402 if (!of_id)
403 pr_warn("AT91: ramc no standby function available\n");
404 else
405 at91_pm_set_standby(of_id->data);
406
399 of_node_put(np); 407 of_node_put(np);
400} 408}
401 409
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index 69d67f714a2f..9fe6d88737ed 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -1,5 +1,16 @@
1config ARCH_BCM 1config ARCH_BCM
2 bool "Broadcom SoC" if ARCH_MULTI_V7 2 bool "Broadcom SoC Support"
3 depends on ARCH_MULTIPLATFORM
4 help
5 This enables support for Broadcom ARM based SoC
6 chips
7
8if ARCH_BCM
9
10menu "Broadcom SoC Selection"
11
12config ARCH_BCM_MOBILE
13 bool "Broadcom Mobile SoC" if ARCH_MULTI_V7
3 depends on MMU 14 depends on MMU
4 select ARCH_REQUIRE_GPIOLIB 15 select ARCH_REQUIRE_GPIOLIB
5 select ARM_ERRATA_754322 16 select ARM_ERRATA_754322
@@ -9,12 +20,17 @@ config ARCH_BCM
9 select CLKSRC_OF 20 select CLKSRC_OF
10 select GENERIC_CLOCKEVENTS 21 select GENERIC_CLOCKEVENTS
11 select GENERIC_TIME 22 select GENERIC_TIME
12 select GPIO_BCM 23 select GPIO_BCM_KONA
13 select SPARSE_IRQ 24 select SPARSE_IRQ
14 select TICK_ONESHOT 25 select TICK_ONESHOT
15 select CACHE_L2X0 26 select CACHE_L2X0
27 select HAVE_ARM_ARCH_TIMER
16 help 28 help
17 This enables support for system based on Broadcom SoCs. 29 This enables support for systems based on Broadcom mobile SoCs.
18 It currently supports the 'BCM281XX' family, which includes 30 It currently supports the 'BCM281XX' family, which includes
19 BCM11130, BCM11140, BCM11351, BCM28145 and 31 BCM11130, BCM11140, BCM11351, BCM28145 and
20 BCM28155 variants. 32 BCM28155 variants.
33
34endmenu
35
36endif
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
index e3d03033a7e2..c2ccd5a0f772 100644
--- a/arch/arm/mach-bcm/Makefile
+++ b/arch/arm/mach-bcm/Makefile
@@ -10,6 +10,6 @@
10# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details. 11# GNU General Public License for more details.
12 12
13obj-$(CONFIG_ARCH_BCM) := board_bcm281xx.o bcm_kona_smc.o bcm_kona_smc_asm.o kona.o 13obj-$(CONFIG_ARCH_BCM_MOBILE) := board_bcm281xx.o bcm_kona_smc.o bcm_kona_smc_asm.o kona.o
14plus_sec := $(call as-instr,.arch_extension sec,+sec) 14plus_sec := $(call as-instr,.arch_extension sec,+sec)
15AFLAGS_bcm_kona_smc_asm.o :=-Wa,-march=armv7-a$(plus_sec) 15AFLAGS_bcm_kona_smc_asm.o :=-Wa,-march=armv7-a$(plus_sec)
diff --git a/arch/arm/mach-bcm/board_bcm281xx.c b/arch/arm/mach-bcm/board_bcm281xx.c
index 8d9f931164bb..cb3dc364405c 100644
--- a/arch/arm/mach-bcm/board_bcm281xx.c
+++ b/arch/arm/mach-bcm/board_bcm281xx.c
@@ -67,8 +67,7 @@ static void __init board_init(void)
67 67
68static const char * const bcm11351_dt_compat[] = { "brcm,bcm11351", NULL, }; 68static const char * const bcm11351_dt_compat[] = { "brcm,bcm11351", NULL, };
69 69
70DT_MACHINE_START(BCM11351_DT, "Broadcom Application Processor") 70DT_MACHINE_START(BCM11351_DT, "BCM281xx Broadcom Application Processor")
71 .init_time = clocksource_of_init,
72 .init_machine = board_init, 71 .init_machine = board_init,
73 .restart = bcm_kona_restart, 72 .restart = bcm_kona_restart,
74 .dt_compat = bcm11351_dt_compat, 73 .dt_compat = bcm11351_dt_compat,
diff --git a/arch/arm/mach-bcm2835/bcm2835.c b/arch/arm/mach-bcm2835/bcm2835.c
index 40686d7ef500..70f2f3925f0e 100644
--- a/arch/arm/mach-bcm2835/bcm2835.c
+++ b/arch/arm/mach-bcm2835/bcm2835.c
@@ -14,11 +14,10 @@
14 14
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/irqchip/bcm2835.h> 17#include <linux/irqchip.h>
18#include <linux/of_address.h> 18#include <linux/of_address.h>
19#include <linux/of_platform.h> 19#include <linux/of_platform.h>
20#include <linux/clk/bcm2835.h> 20#include <linux/clk/bcm2835.h>
21#include <linux/clocksource.h>
22 21
23#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
24#include <asm/mach/map.h> 23#include <asm/mach/map.h>
@@ -131,10 +130,8 @@ static const char * const bcm2835_compat[] = {
131 130
132DT_MACHINE_START(BCM2835, "BCM2835") 131DT_MACHINE_START(BCM2835, "BCM2835")
133 .map_io = bcm2835_map_io, 132 .map_io = bcm2835_map_io,
134 .init_irq = bcm2835_init_irq, 133 .init_irq = irqchip_init,
135 .handle_irq = bcm2835_handle_irq,
136 .init_machine = bcm2835_init, 134 .init_machine = bcm2835_init,
137 .init_time = clocksource_of_init,
138 .restart = bcm2835_restart, 135 .restart = bcm2835_restart,
139 .dt_compat = bcm2835_compat 136 .dt_compat = bcm2835_compat
140MACHINE_END 137MACHINE_END
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c
index 4ca2f3ca2de4..134641d688bb 100644
--- a/arch/arm/mach-clps711x/common.c
+++ b/arch/arm/mach-clps711x/common.c
@@ -29,12 +29,12 @@
29#include <linux/clockchips.h> 29#include <linux/clockchips.h>
30#include <linux/clocksource.h> 30#include <linux/clocksource.h>
31#include <linux/clk-provider.h> 31#include <linux/clk-provider.h>
32#include <linux/sched_clock.h>
32 33
33#include <asm/exception.h> 34#include <asm/exception.h>
34#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
35#include <asm/mach/map.h> 36#include <asm/mach/map.h>
36#include <asm/mach/time.h> 37#include <asm/mach/time.h>
37#include <asm/sched_clock.h>
38#include <asm/system_misc.h> 38#include <asm/system_misc.h>
39 39
40#include <mach/hardware.h> 40#include <mach/hardware.h>
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index e026b19b23ea..a075b3e0c5c7 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -40,7 +40,6 @@ 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
44 select CP_INTC 43 select CP_INTC
45 44
46config ARCH_DAVINCI_DA8XX 45config ARCH_DAVINCI_DA8XX
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index c4bdc0a1c36e..40f15f133c55 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -22,17 +22,19 @@
22#include <linux/mtd/partitions.h> 22#include <linux/mtd/partitions.h>
23#include <linux/spi/spi.h> 23#include <linux/spi/spi.h>
24#include <linux/spi/flash.h> 24#include <linux/spi/flash.h>
25#include <linux/platform_data/gpio-davinci.h>
26#include <linux/platform_data/mtd-davinci.h>
27#include <linux/platform_data/mtd-davinci-aemif.h>
28#include <linux/platform_data/spi-davinci.h>
29#include <linux/platform_data/usb-davinci.h>
25 30
26#include <asm/mach-types.h> 31#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
28 33
34#include <mach/common.h>
29#include <mach/cp_intc.h> 35#include <mach/cp_intc.h>
30#include <mach/mux.h> 36#include <mach/mux.h>
31#include <linux/platform_data/mtd-davinci.h>
32#include <mach/da8xx.h> 37#include <mach/da8xx.h>
33#include <linux/platform_data/usb-davinci.h>
34#include <linux/platform_data/mtd-davinci-aemif.h>
35#include <linux/platform_data/spi-davinci.h>
36 38
37#define DA830_EVM_PHY_ID "" 39#define DA830_EVM_PHY_ID ""
38/* 40/*
@@ -74,7 +76,7 @@ static int da830_evm_usb_ocic_notify(da8xx_ocic_handler_t handler)
74 if (handler != NULL) { 76 if (handler != NULL) {
75 da830_evm_usb_ocic_handler = handler; 77 da830_evm_usb_ocic_handler = handler;
76 78
77 error = request_irq(irq, da830_evm_usb_ocic_irq, IRQF_DISABLED | 79 error = request_irq(irq, da830_evm_usb_ocic_irq,
78 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 80 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
79 "OHCI over-current indicator", NULL); 81 "OHCI over-current indicator", NULL);
80 if (error) 82 if (error)
@@ -591,6 +593,10 @@ static __init void da830_evm_init(void)
591 struct davinci_soc_info *soc_info = &davinci_soc_info; 593 struct davinci_soc_info *soc_info = &davinci_soc_info;
592 int ret; 594 int ret;
593 595
596 ret = da830_register_gpio();
597 if (ret)
598 pr_warn("da830_evm_init: GPIO init failed: %d\n", ret);
599
594 ret = da830_register_edma(da830_edma_rsv); 600 ret = da830_register_edma(da830_edma_rsv);
595 if (ret) 601 if (ret)
596 pr_warning("da830_evm_init: edma registration failed: %d\n", 602 pr_warning("da830_evm_init: edma registration failed: %d\n",
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index dd1fb24521aa..df16cb88a26b 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -28,6 +28,7 @@
28#include <linux/mtd/partitions.h> 28#include <linux/mtd/partitions.h>
29#include <linux/mtd/physmap.h> 29#include <linux/mtd/physmap.h>
30#include <linux/platform_device.h> 30#include <linux/platform_device.h>
31#include <linux/platform_data/gpio-davinci.h>
31#include <linux/platform_data/mtd-davinci.h> 32#include <linux/platform_data/mtd-davinci.h>
32#include <linux/platform_data/mtd-davinci-aemif.h> 33#include <linux/platform_data/mtd-davinci-aemif.h>
33#include <linux/platform_data/spi-davinci.h> 34#include <linux/platform_data/spi-davinci.h>
@@ -38,6 +39,7 @@
38#include <linux/spi/flash.h> 39#include <linux/spi/flash.h>
39#include <linux/wl12xx.h> 40#include <linux/wl12xx.h>
40 41
42#include <mach/common.h>
41#include <mach/cp_intc.h> 43#include <mach/cp_intc.h>
42#include <mach/da8xx.h> 44#include <mach/da8xx.h>
43#include <mach/mux.h> 45#include <mach/mux.h>
@@ -1437,6 +1439,10 @@ static __init void da850_evm_init(void)
1437{ 1439{
1438 int ret; 1440 int ret;
1439 1441
1442 ret = da850_register_gpio();
1443 if (ret)
1444 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
1445
1440 ret = pmic_tps65070_init(); 1446 ret = pmic_tps65070_init();
1441 if (ret) 1447 if (ret)
1442 pr_warn("%s: TPS65070 PMIC init failed: %d\n", __func__, ret); 1448 pr_warn("%s: TPS65070 PMIC init failed: %d\n", __func__, ret);
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index 42b23a3194a0..ecdc7d44fa70 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -22,15 +22,17 @@
22#include <media/tvp514x.h> 22#include <media/tvp514x.h>
23#include <linux/spi/spi.h> 23#include <linux/spi/spi.h>
24#include <linux/spi/eeprom.h> 24#include <linux/spi/eeprom.h>
25#include <linux/platform_data/gpio-davinci.h>
26#include <linux/platform_data/i2c-davinci.h>
27#include <linux/platform_data/mtd-davinci.h>
28#include <linux/platform_data/mmc-davinci.h>
29#include <linux/platform_data/usb-davinci.h>
25 30
26#include <asm/mach-types.h> 31#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
28 33
29#include <linux/platform_data/i2c-davinci.h>
30#include <mach/serial.h> 34#include <mach/serial.h>
31#include <linux/platform_data/mtd-davinci.h> 35#include <mach/common.h>
32#include <linux/platform_data/mmc-davinci.h>
33#include <linux/platform_data/usb-davinci.h>
34 36
35#include "davinci.h" 37#include "davinci.h"
36 38
@@ -375,6 +377,11 @@ static struct spi_board_info dm355_evm_spi_info[] __initconst = {
375static __init void dm355_evm_init(void) 377static __init void dm355_evm_init(void)
376{ 378{
377 struct clk *aemif; 379 struct clk *aemif;
380 int ret;
381
382 ret = dm355_gpio_register();
383 if (ret)
384 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
378 385
379 gpio_request(1, "dm9000"); 386 gpio_request(1, "dm9000");
380 gpio_direction_input(1); 387 gpio_direction_input(1);
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
index 65a984c52df6..43bacbf15314 100644
--- a/arch/arm/mach-davinci/board-dm355-leopard.c
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c
@@ -19,15 +19,16 @@
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
21#include <linux/spi/eeprom.h> 21#include <linux/spi/eeprom.h>
22#include <linux/platform_data/i2c-davinci.h>
23#include <linux/platform_data/mmc-davinci.h>
24#include <linux/platform_data/mtd-davinci.h>
25#include <linux/platform_data/usb-davinci.h>
22 26
23#include <asm/mach-types.h> 27#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
25 29
26#include <linux/platform_data/i2c-davinci.h> 30#include <mach/common.h>
27#include <mach/serial.h> 31#include <mach/serial.h>
28#include <linux/platform_data/mtd-davinci.h>
29#include <linux/platform_data/mmc-davinci.h>
30#include <linux/platform_data/usb-davinci.h>
31 32
32#include "davinci.h" 33#include "davinci.h"
33 34
@@ -234,6 +235,11 @@ static struct spi_board_info dm355_leopard_spi_info[] __initconst = {
234static __init void dm355_leopard_init(void) 235static __init void dm355_leopard_init(void)
235{ 236{
236 struct clk *aemif; 237 struct clk *aemif;
238 int ret;
239
240 ret = dm355_gpio_register();
241 if (ret)
242 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
237 243
238 gpio_request(9, "dm9000"); 244 gpio_request(9, "dm9000");
239 gpio_direction_input(9); 245 gpio_direction_input(9);
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index 92b7f770615a..f4a6c18912ea 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -176,7 +176,7 @@ static struct at24_platform_data eeprom_info = {
176 .context = (void *)0x7f00, 176 .context = (void *)0x7f00,
177}; 177};
178 178
179static struct snd_platform_data dm365_evm_snd_data = { 179static struct snd_platform_data dm365_evm_snd_data __maybe_unused = {
180 .asp_chan_q = EVENTQ_3, 180 .asp_chan_q = EVENTQ_3,
181}; 181};
182 182
@@ -743,6 +743,12 @@ static struct spi_board_info dm365_evm_spi_info[] __initconst = {
743 743
744static __init void dm365_evm_init(void) 744static __init void dm365_evm_init(void)
745{ 745{
746 int ret;
747
748 ret = dm365_gpio_register();
749 if (ret)
750 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
751
746 evm_init_i2c(); 752 evm_init_i2c();
747 davinci_serial_init(dm365_serial_device); 753 davinci_serial_init(dm365_serial_device);
748 754
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index 40bb9b5b87e8..9cc32c283b8b 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -754,9 +754,14 @@ static int davinci_phy_fixup(struct phy_device *phydev)
754 754
755static __init void davinci_evm_init(void) 755static __init void davinci_evm_init(void)
756{ 756{
757 int ret;
757 struct clk *aemif_clk; 758 struct clk *aemif_clk;
758 struct davinci_soc_info *soc_info = &davinci_soc_info; 759 struct davinci_soc_info *soc_info = &davinci_soc_info;
759 760
761 ret = dm644x_gpio_register();
762 if (ret)
763 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
764
760 aemif_clk = clk_get(NULL, "aemif"); 765 aemif_clk = clk_get(NULL, "aemif");
761 clk_prepare_enable(aemif_clk); 766 clk_prepare_enable(aemif_clk);
762 767
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index 2bc3651d56cc..44b20191a9fe 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -33,17 +33,19 @@
33#include <linux/mtd/partitions.h> 33#include <linux/mtd/partitions.h>
34#include <linux/clk.h> 34#include <linux/clk.h>
35#include <linux/export.h> 35#include <linux/export.h>
36#include <linux/platform_data/gpio-davinci.h>
37#include <linux/platform_data/i2c-davinci.h>
38#include <linux/platform_data/mtd-davinci.h>
39#include <linux/platform_data/mtd-davinci-aemif.h>
36 40
37#include <asm/mach-types.h> 41#include <asm/mach-types.h>
38#include <asm/mach/arch.h> 42#include <asm/mach/arch.h>
39 43
40#include <mach/common.h> 44#include <mach/common.h>
45#include <mach/irqs.h>
41#include <mach/serial.h> 46#include <mach/serial.h>
42#include <linux/platform_data/i2c-davinci.h>
43#include <linux/platform_data/mtd-davinci.h>
44#include <mach/clock.h> 47#include <mach/clock.h>
45#include <mach/cdce949.h> 48#include <mach/cdce949.h>
46#include <linux/platform_data/mtd-davinci-aemif.h>
47 49
48#include "davinci.h" 50#include "davinci.h"
49#include "clock.h" 51#include "clock.h"
@@ -786,8 +788,13 @@ static struct edma_rsv_info dm646x_edma_rsv[] = {
786 788
787static __init void evm_init(void) 789static __init void evm_init(void)
788{ 790{
791 int ret;
789 struct davinci_soc_info *soc_info = &davinci_soc_info; 792 struct davinci_soc_info *soc_info = &davinci_soc_info;
790 793
794 ret = dm646x_gpio_register();
795 if (ret)
796 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
797
791 evm_init_i2c(); 798 evm_init_i2c();
792 davinci_serial_init(dm646x_serial_device); 799 davinci_serial_init(dm646x_serial_device);
793 dm646x_init_mcasp0(&dm646x_evm_snd_data[0]); 800 dm646x_init_mcasp0(&dm646x_evm_snd_data[0]);
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index 46f336fca803..bb680af98374 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -26,17 +26,18 @@
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/gpio.h> 27#include <linux/gpio.h>
28#include <linux/mtd/partitions.h> 28#include <linux/mtd/partitions.h>
29#include <linux/platform_data/gpio-davinci.h>
30#include <linux/platform_data/i2c-davinci.h>
31#include <linux/platform_data/mmc-davinci.h>
32#include <linux/platform_data/mtd-davinci.h>
33#include <linux/platform_data/usb-davinci.h>
29 34
30#include <asm/mach-types.h> 35#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
32 37
33#include <mach/common.h> 38#include <mach/common.h>
34#include <linux/platform_data/i2c-davinci.h>
35#include <mach/serial.h> 39#include <mach/serial.h>
36#include <mach/mux.h> 40#include <mach/mux.h>
37#include <linux/platform_data/mtd-davinci.h>
38#include <linux/platform_data/mmc-davinci.h>
39#include <linux/platform_data/usb-davinci.h>
40 41
41#include "davinci.h" 42#include "davinci.h"
42 43
@@ -169,9 +170,14 @@ static struct davinci_mmc_config davinci_ntosd2_mmc_config = {
169 170
170static __init void davinci_ntosd2_init(void) 171static __init void davinci_ntosd2_init(void)
171{ 172{
173 int ret;
172 struct clk *aemif_clk; 174 struct clk *aemif_clk;
173 struct davinci_soc_info *soc_info = &davinci_soc_info; 175 struct davinci_soc_info *soc_info = &davinci_soc_info;
174 176
177 ret = dm644x_gpio_register();
178 if (ret)
179 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
180
175 aemif_clk = clk_get(NULL, "aemif"); 181 aemif_clk = clk_get(NULL, "aemif");
176 clk_prepare_enable(aemif_clk); 182 clk_prepare_enable(aemif_clk);
177 183
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
index ab98c75cabb4..2aac51d0e853 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -13,10 +13,12 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/console.h> 14#include <linux/console.h>
15#include <linux/gpio.h> 15#include <linux/gpio.h>
16#include <linux/platform_data/gpio-davinci.h>
16 17
17#include <asm/mach-types.h> 18#include <asm/mach-types.h>
18#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
19 20
21#include <mach/common.h>
20#include <mach/cp_intc.h> 22#include <mach/cp_intc.h>
21#include <mach/da8xx.h> 23#include <mach/da8xx.h>
22#include <mach/mux.h> 24#include <mach/mux.h>
@@ -211,7 +213,7 @@ static int hawk_usb_ocic_notify(da8xx_ocic_handler_t handler)
211 hawk_usb_ocic_handler = handler; 213 hawk_usb_ocic_handler = handler;
212 214
213 error = request_irq(irq, omapl138_hawk_usb_ocic_irq, 215 error = request_irq(irq, omapl138_hawk_usb_ocic_irq,
214 IRQF_DISABLED | IRQF_TRIGGER_RISING | 216 IRQF_TRIGGER_RISING |
215 IRQF_TRIGGER_FALLING, 217 IRQF_TRIGGER_FALLING,
216 "OHCI over-current indicator", NULL); 218 "OHCI over-current indicator", NULL);
217 if (error) 219 if (error)
@@ -290,6 +292,10 @@ static __init void omapl138_hawk_init(void)
290{ 292{
291 int ret; 293 int ret;
292 294
295 ret = da850_register_gpio();
296 if (ret)
297 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
298
293 davinci_serial_init(da8xx_serial_device); 299 davinci_serial_init(da8xx_serial_device);
294 300
295 omapl138_hawk_config_emac(); 301 omapl138_hawk_config_emac();
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index d6c746e35ad9..0813b5167e05 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -11,6 +11,7 @@
11#include <linux/gpio.h> 11#include <linux/gpio.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/clk.h> 13#include <linux/clk.h>
14#include <linux/platform_data/gpio-davinci.h>
14 15
15#include <asm/mach/map.h> 16#include <asm/mach/map.h>
16 17
@@ -20,7 +21,6 @@
20#include <mach/common.h> 21#include <mach/common.h>
21#include <mach/time.h> 22#include <mach/time.h>
22#include <mach/da8xx.h> 23#include <mach/da8xx.h>
23#include <mach/gpio-davinci.h>
24 24
25#include "clock.h" 25#include "clock.h"
26#include "mux.h" 26#include "mux.h"
@@ -1151,6 +1151,16 @@ static struct davinci_id da830_ids[] = {
1151 }, 1151 },
1152}; 1152};
1153 1153
1154static struct davinci_gpio_platform_data da830_gpio_platform_data = {
1155 .ngpio = 128,
1156 .intc_irq_num = DA830_N_CP_INTC_IRQ,
1157};
1158
1159int __init da830_register_gpio(void)
1160{
1161 return da8xx_register_gpio(&da830_gpio_platform_data);
1162}
1163
1154static struct davinci_timer_instance da830_timer_instance[2] = { 1164static struct davinci_timer_instance da830_timer_instance[2] = {
1155 { 1165 {
1156 .base = DA8XX_TIMER64P0_BASE, 1166 .base = DA8XX_TIMER64P0_BASE,
@@ -1196,10 +1206,6 @@ static struct davinci_soc_info davinci_soc_info_da830 = {
1196 .intc_irq_prios = da830_default_priorities, 1206 .intc_irq_prios = da830_default_priorities,
1197 .intc_irq_num = DA830_N_CP_INTC_IRQ, 1207 .intc_irq_num = DA830_N_CP_INTC_IRQ,
1198 .timer_info = &da830_timer_info, 1208 .timer_info = &da830_timer_info,
1199 .gpio_type = GPIO_TYPE_DAVINCI,
1200 .gpio_base = DA8XX_GPIO_BASE,
1201 .gpio_num = 128,
1202 .gpio_irq = IRQ_DA8XX_GPIO0,
1203 .emac_pdata = &da8xx_emac_pdata, 1209 .emac_pdata = &da8xx_emac_pdata,
1204}; 1210};
1205 1211
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index f56e5fbfa2fd..352984e1528a 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -17,6 +17,7 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/cpufreq.h> 18#include <linux/cpufreq.h>
19#include <linux/regulator/consumer.h> 19#include <linux/regulator/consumer.h>
20#include <linux/platform_data/gpio-davinci.h>
20 21
21#include <asm/mach/map.h> 22#include <asm/mach/map.h>
22 23
@@ -28,7 +29,6 @@
28#include <mach/da8xx.h> 29#include <mach/da8xx.h>
29#include <mach/cpufreq.h> 30#include <mach/cpufreq.h>
30#include <mach/pm.h> 31#include <mach/pm.h>
31#include <mach/gpio-davinci.h>
32 32
33#include "clock.h" 33#include "clock.h"
34#include "mux.h" 34#include "mux.h"
@@ -1281,6 +1281,16 @@ int __init da850_register_vpif_capture(struct vpif_capture_config
1281 return platform_device_register(&da850_vpif_capture_dev); 1281 return platform_device_register(&da850_vpif_capture_dev);
1282} 1282}
1283 1283
1284static struct davinci_gpio_platform_data da850_gpio_platform_data = {
1285 .ngpio = 144,
1286 .intc_irq_num = DA850_N_CP_INTC_IRQ,
1287};
1288
1289int __init da850_register_gpio(void)
1290{
1291 return da8xx_register_gpio(&da850_gpio_platform_data);
1292}
1293
1284static struct davinci_soc_info davinci_soc_info_da850 = { 1294static struct davinci_soc_info davinci_soc_info_da850 = {
1285 .io_desc = da850_io_desc, 1295 .io_desc = da850_io_desc,
1286 .io_desc_num = ARRAY_SIZE(da850_io_desc), 1296 .io_desc_num = ARRAY_SIZE(da850_io_desc),
@@ -1298,10 +1308,6 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
1298 .intc_irq_prios = da850_default_priorities, 1308 .intc_irq_prios = da850_default_priorities,
1299 .intc_irq_num = DA850_N_CP_INTC_IRQ, 1309 .intc_irq_num = DA850_N_CP_INTC_IRQ,
1300 .timer_info = &da850_timer_info, 1310 .timer_info = &da850_timer_info,
1301 .gpio_type = GPIO_TYPE_DAVINCI,
1302 .gpio_base = DA8XX_GPIO_BASE,
1303 .gpio_num = 144,
1304 .gpio_irq = IRQ_DA8XX_GPIO0,
1305 .emac_pdata = &da8xx_emac_pdata, 1311 .emac_pdata = &da8xx_emac_pdata,
1306 .sram_dma = DA8XX_SHARED_RAM_BASE, 1312 .sram_dma = DA8XX_SHARED_RAM_BASE,
1307 .sram_len = SZ_128K, 1313 .sram_len = SZ_128K,
diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h
index 2ab5d577186f..2eebc4338802 100644
--- a/arch/arm/mach-davinci/davinci.h
+++ b/arch/arm/mach-davinci/davinci.h
@@ -53,6 +53,9 @@ extern void __iomem *davinci_sysmod_base;
53#define DAVINCI_SYSMOD_VIRT(x) (davinci_sysmod_base + (x)) 53#define DAVINCI_SYSMOD_VIRT(x) (davinci_sysmod_base + (x))
54void davinci_map_sysmod(void); 54void davinci_map_sysmod(void);
55 55
56#define DAVINCI_GPIO_BASE 0x01C67000
57int davinci_gpio_register(struct resource *res, int size, void *pdata);
58
56/* DM355 base addresses */ 59/* DM355 base addresses */
57#define DM355_ASYNC_EMIF_CONTROL_BASE 0x01e10000 60#define DM355_ASYNC_EMIF_CONTROL_BASE 0x01e10000
58#define DM355_ASYNC_EMIF_DATA_CE0_BASE 0x02000000 61#define DM355_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
@@ -82,6 +85,7 @@ void dm355_init_spi0(unsigned chipselect_mask,
82 const struct spi_board_info *info, unsigned len); 85 const struct spi_board_info *info, unsigned len);
83void dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata); 86void dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata);
84int dm355_init_video(struct vpfe_config *, struct vpbe_config *); 87int dm355_init_video(struct vpfe_config *, struct vpbe_config *);
88int dm355_gpio_register(void);
85 89
86/* DM365 function declarations */ 90/* DM365 function declarations */
87void dm365_init(void); 91void dm365_init(void);
@@ -92,11 +96,13 @@ void dm365_init_rtc(void);
92void dm365_init_spi0(unsigned chipselect_mask, 96void dm365_init_spi0(unsigned chipselect_mask,
93 const struct spi_board_info *info, unsigned len); 97 const struct spi_board_info *info, unsigned len);
94int dm365_init_video(struct vpfe_config *, struct vpbe_config *); 98int dm365_init_video(struct vpfe_config *, struct vpbe_config *);
99int dm365_gpio_register(void);
95 100
96/* DM644x function declarations */ 101/* DM644x function declarations */
97void dm644x_init(void); 102void dm644x_init(void);
98void dm644x_init_asp(struct snd_platform_data *pdata); 103void dm644x_init_asp(struct snd_platform_data *pdata);
99int dm644x_init_video(struct vpfe_config *, struct vpbe_config *); 104int dm644x_init_video(struct vpfe_config *, struct vpbe_config *);
105int dm644x_gpio_register(void);
100 106
101/* DM646x function declarations */ 107/* DM646x function declarations */
102void dm646x_init(void); 108void dm646x_init(void);
@@ -106,6 +112,7 @@ int dm646x_init_edma(struct edma_rsv_info *rsv);
106void dm646x_video_init(void); 112void dm646x_video_init(void);
107void dm646x_setup_vpif(struct vpif_display_config *, 113void dm646x_setup_vpif(struct vpif_display_config *,
108 struct vpif_capture_config *); 114 struct vpif_capture_config *);
115int dm646x_gpio_register(void);
109 116
110extern struct platform_device dm365_serial_device[]; 117extern struct platform_device dm365_serial_device[];
111extern struct platform_device dm355_serial_device[]; 118extern struct platform_device dm355_serial_device[];
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 2e473fefd71e..c46eccbbd512 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -665,6 +665,32 @@ int __init da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata)
665 return platform_device_register(&da8xx_lcdc_device); 665 return platform_device_register(&da8xx_lcdc_device);
666} 666}
667 667
668static struct resource da8xx_gpio_resources[] = {
669 { /* registers */
670 .start = DA8XX_GPIO_BASE,
671 .end = DA8XX_GPIO_BASE + SZ_4K - 1,
672 .flags = IORESOURCE_MEM,
673 },
674 { /* interrupt */
675 .start = IRQ_DA8XX_GPIO0,
676 .end = IRQ_DA8XX_GPIO8,
677 .flags = IORESOURCE_IRQ,
678 },
679};
680
681static struct platform_device da8xx_gpio_device = {
682 .name = "davinci_gpio",
683 .id = -1,
684 .num_resources = ARRAY_SIZE(da8xx_gpio_resources),
685 .resource = da8xx_gpio_resources,
686};
687
688int __init da8xx_register_gpio(void *pdata)
689{
690 da8xx_gpio_device.dev.platform_data = pdata;
691 return platform_device_register(&da8xx_gpio_device);
692}
693
668static struct resource da8xx_mmcsd0_resources[] = { 694static struct resource da8xx_mmcsd0_resources[] = {
669 { /* registers */ 695 { /* registers */
670 .start = DA8XX_MMCSD0_BASE, 696 .start = DA8XX_MMCSD0_BASE,
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index 111573c0aad1..3996e98f52fb 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -318,6 +318,19 @@ static void davinci_init_wdt(void)
318 platform_device_register(&davinci_wdt_device); 318 platform_device_register(&davinci_wdt_device);
319} 319}
320 320
321static struct platform_device davinci_gpio_device = {
322 .name = "davinci_gpio",
323 .id = -1,
324};
325
326int davinci_gpio_register(struct resource *res, int size, void *pdata)
327{
328 davinci_gpio_device.resource = res;
329 davinci_gpio_device.num_resources = size;
330 davinci_gpio_device.dev.platform_data = pdata;
331 return platform_device_register(&davinci_gpio_device);
332}
333
321/*-------------------------------------------------------------------------*/ 334/*-------------------------------------------------------------------------*/
322 335
323/*-------------------------------------------------------------------------*/ 336/*-------------------------------------------------------------------------*/
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index 3eaa5f6b2160..ef9ff1fb6f52 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -13,8 +13,10 @@
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/dma-mapping.h> 15#include <linux/dma-mapping.h>
16
17#include <linux/spi/spi.h> 16#include <linux/spi/spi.h>
17#include <linux/platform_data/edma.h>
18#include <linux/platform_data/gpio-davinci.h>
19#include <linux/platform_data/spi-davinci.h>
18 20
19#include <asm/mach/map.h> 21#include <asm/mach/map.h>
20 22
@@ -25,9 +27,6 @@
25#include <mach/time.h> 27#include <mach/time.h>
26#include <mach/serial.h> 28#include <mach/serial.h>
27#include <mach/common.h> 29#include <mach/common.h>
28#include <linux/platform_data/spi-davinci.h>
29#include <mach/gpio-davinci.h>
30#include <linux/platform_data/edma.h>
31 30
32#include "davinci.h" 31#include "davinci.h"
33#include "clock.h" 32#include "clock.h"
@@ -886,6 +885,30 @@ static struct platform_device dm355_vpbe_dev = {
886 }, 885 },
887}; 886};
888 887
888static struct resource dm355_gpio_resources[] = {
889 { /* registers */
890 .start = DAVINCI_GPIO_BASE,
891 .end = DAVINCI_GPIO_BASE + SZ_4K - 1,
892 .flags = IORESOURCE_MEM,
893 },
894 { /* interrupt */
895 .start = IRQ_DM355_GPIOBNK0,
896 .end = IRQ_DM355_GPIOBNK6,
897 .flags = IORESOURCE_IRQ,
898 },
899};
900
901static struct davinci_gpio_platform_data dm355_gpio_platform_data = {
902 .ngpio = 104,
903 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
904};
905
906int __init dm355_gpio_register(void)
907{
908 return davinci_gpio_register(dm355_gpio_resources,
909 sizeof(dm355_gpio_resources),
910 &dm355_gpio_platform_data);
911}
889/*----------------------------------------------------------------------*/ 912/*----------------------------------------------------------------------*/
890 913
891static struct map_desc dm355_io_desc[] = { 914static struct map_desc dm355_io_desc[] = {
@@ -1005,10 +1028,6 @@ static struct davinci_soc_info davinci_soc_info_dm355 = {
1005 .intc_irq_prios = dm355_default_priorities, 1028 .intc_irq_prios = dm355_default_priorities,
1006 .intc_irq_num = DAVINCI_N_AINTC_IRQ, 1029 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
1007 .timer_info = &dm355_timer_info, 1030 .timer_info = &dm355_timer_info,
1008 .gpio_type = GPIO_TYPE_DAVINCI,
1009 .gpio_base = DAVINCI_GPIO_BASE,
1010 .gpio_num = 104,
1011 .gpio_irq = IRQ_DM355_GPIOBNK0,
1012 .sram_dma = 0x00010000, 1031 .sram_dma = 0x00010000,
1013 .sram_len = SZ_32K, 1032 .sram_len = SZ_32K,
1014}; 1033};
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index c29e324eb0bb..1511a0680f9a 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -19,6 +19,9 @@
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#include <linux/platform_data/edma.h>
22#include <linux/platform_data/gpio-davinci.h>
23#include <linux/platform_data/keyscan-davinci.h>
24#include <linux/platform_data/spi-davinci.h>
22 25
23#include <asm/mach/map.h> 26#include <asm/mach/map.h>
24 27
@@ -29,9 +32,6 @@
29#include <mach/time.h> 32#include <mach/time.h>
30#include <mach/serial.h> 33#include <mach/serial.h>
31#include <mach/common.h> 34#include <mach/common.h>
32#include <linux/platform_data/keyscan-davinci.h>
33#include <linux/platform_data/spi-davinci.h>
34#include <mach/gpio-davinci.h>
35 35
36#include "davinci.h" 36#include "davinci.h"
37#include "clock.h" 37#include "clock.h"
@@ -698,6 +698,32 @@ void __init dm365_init_spi0(unsigned chipselect_mask,
698 platform_device_register(&dm365_spi0_device); 698 platform_device_register(&dm365_spi0_device);
699} 699}
700 700
701static struct resource dm365_gpio_resources[] = {
702 { /* registers */
703 .start = DAVINCI_GPIO_BASE,
704 .end = DAVINCI_GPIO_BASE + SZ_4K - 1,
705 .flags = IORESOURCE_MEM,
706 },
707 { /* interrupt */
708 .start = IRQ_DM365_GPIO0,
709 .end = IRQ_DM365_GPIO7,
710 .flags = IORESOURCE_IRQ,
711 },
712};
713
714static struct davinci_gpio_platform_data dm365_gpio_platform_data = {
715 .ngpio = 104,
716 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
717 .gpio_unbanked = 8,
718};
719
720int __init dm365_gpio_register(void)
721{
722 return davinci_gpio_register(dm365_gpio_resources,
723 sizeof(dm365_gpio_resources),
724 &dm365_gpio_platform_data);
725}
726
701static struct emac_platform_data dm365_emac_pdata = { 727static struct emac_platform_data dm365_emac_pdata = {
702 .ctrl_reg_offset = DM365_EMAC_CNTRL_OFFSET, 728 .ctrl_reg_offset = DM365_EMAC_CNTRL_OFFSET,
703 .ctrl_mod_reg_offset = DM365_EMAC_CNTRL_MOD_OFFSET, 729 .ctrl_mod_reg_offset = DM365_EMAC_CNTRL_MOD_OFFSET,
@@ -1105,11 +1131,6 @@ static struct davinci_soc_info davinci_soc_info_dm365 = {
1105 .intc_irq_prios = dm365_default_priorities, 1131 .intc_irq_prios = dm365_default_priorities,
1106 .intc_irq_num = DAVINCI_N_AINTC_IRQ, 1132 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
1107 .timer_info = &dm365_timer_info, 1133 .timer_info = &dm365_timer_info,
1108 .gpio_type = GPIO_TYPE_DAVINCI,
1109 .gpio_base = DAVINCI_GPIO_BASE,
1110 .gpio_num = 104,
1111 .gpio_irq = IRQ_DM365_GPIO0,
1112 .gpio_unbanked = 8, /* really 16 ... skip muxed GPIOs */
1113 .emac_pdata = &dm365_emac_pdata, 1134 .emac_pdata = &dm365_emac_pdata,
1114 .sram_dma = 0x00010000, 1135 .sram_dma = 0x00010000,
1115 .sram_len = SZ_32K, 1136 .sram_len = SZ_32K,
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 4f74682293d6..143a3217e8ef 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -13,6 +13,7 @@
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#include <linux/platform_data/edma.h>
16#include <linux/platform_data/gpio-davinci.h>
16 17
17#include <asm/mach/map.h> 18#include <asm/mach/map.h>
18 19
@@ -23,7 +24,6 @@
23#include <mach/time.h> 24#include <mach/time.h>
24#include <mach/serial.h> 25#include <mach/serial.h>
25#include <mach/common.h> 26#include <mach/common.h>
26#include <mach/gpio-davinci.h>
27 27
28#include "davinci.h" 28#include "davinci.h"
29#include "clock.h" 29#include "clock.h"
@@ -771,6 +771,30 @@ static struct platform_device dm644x_vpbe_dev = {
771 }, 771 },
772}; 772};
773 773
774static struct resource dm644_gpio_resources[] = {
775 { /* registers */
776 .start = DAVINCI_GPIO_BASE,
777 .end = DAVINCI_GPIO_BASE + SZ_4K - 1,
778 .flags = IORESOURCE_MEM,
779 },
780 { /* interrupt */
781 .start = IRQ_GPIOBNK0,
782 .end = IRQ_GPIOBNK4,
783 .flags = IORESOURCE_IRQ,
784 },
785};
786
787static struct davinci_gpio_platform_data dm644_gpio_platform_data = {
788 .ngpio = 71,
789 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
790};
791
792int __init dm644x_gpio_register(void)
793{
794 return davinci_gpio_register(dm644_gpio_resources,
795 sizeof(dm644_gpio_resources),
796 &dm644_gpio_platform_data);
797}
774/*----------------------------------------------------------------------*/ 798/*----------------------------------------------------------------------*/
775 799
776static struct map_desc dm644x_io_desc[] = { 800static struct map_desc dm644x_io_desc[] = {
@@ -897,10 +921,6 @@ static struct davinci_soc_info davinci_soc_info_dm644x = {
897 .intc_irq_prios = dm644x_default_priorities, 921 .intc_irq_prios = dm644x_default_priorities,
898 .intc_irq_num = DAVINCI_N_AINTC_IRQ, 922 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
899 .timer_info = &dm644x_timer_info, 923 .timer_info = &dm644x_timer_info,
900 .gpio_type = GPIO_TYPE_DAVINCI,
901 .gpio_base = DAVINCI_GPIO_BASE,
902 .gpio_num = 71,
903 .gpio_irq = IRQ_GPIOBNK0,
904 .emac_pdata = &dm644x_emac_pdata, 924 .emac_pdata = &dm644x_emac_pdata,
905 .sram_dma = 0x00008000, 925 .sram_dma = 0x00008000,
906 .sram_len = SZ_16K, 926 .sram_len = SZ_16K,
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 68f8d1f1aca1..2a73f299c1d0 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -14,6 +14,7 @@
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#include <linux/platform_data/edma.h>
17#include <linux/platform_data/gpio-davinci.h>
17 18
18#include <asm/mach/map.h> 19#include <asm/mach/map.h>
19 20
@@ -24,7 +25,6 @@
24#include <mach/time.h> 25#include <mach/time.h>
25#include <mach/serial.h> 26#include <mach/serial.h>
26#include <mach/common.h> 27#include <mach/common.h>
27#include <mach/gpio-davinci.h>
28 28
29#include "davinci.h" 29#include "davinci.h"
30#include "clock.h" 30#include "clock.h"
@@ -748,6 +748,30 @@ static struct platform_device vpif_capture_dev = {
748 .num_resources = ARRAY_SIZE(vpif_capture_resource), 748 .num_resources = ARRAY_SIZE(vpif_capture_resource),
749}; 749};
750 750
751static struct resource dm646x_gpio_resources[] = {
752 { /* registers */
753 .start = DAVINCI_GPIO_BASE,
754 .end = DAVINCI_GPIO_BASE + SZ_4K - 1,
755 .flags = IORESOURCE_MEM,
756 },
757 { /* interrupt */
758 .start = IRQ_DM646X_GPIOBNK0,
759 .end = IRQ_DM646X_GPIOBNK2,
760 .flags = IORESOURCE_IRQ,
761 },
762};
763
764static struct davinci_gpio_platform_data dm646x_gpio_platform_data = {
765 .ngpio = 43,
766 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
767};
768
769int __init dm646x_gpio_register(void)
770{
771 return davinci_gpio_register(dm646x_gpio_resources,
772 sizeof(dm646x_gpio_resources),
773 &dm646x_gpio_platform_data);
774}
751/*----------------------------------------------------------------------*/ 775/*----------------------------------------------------------------------*/
752 776
753static struct map_desc dm646x_io_desc[] = { 777static struct map_desc dm646x_io_desc[] = {
@@ -874,10 +898,6 @@ static struct davinci_soc_info davinci_soc_info_dm646x = {
874 .intc_irq_prios = dm646x_default_priorities, 898 .intc_irq_prios = dm646x_default_priorities,
875 .intc_irq_num = DAVINCI_N_AINTC_IRQ, 899 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
876 .timer_info = &dm646x_timer_info, 900 .timer_info = &dm646x_timer_info,
877 .gpio_type = GPIO_TYPE_DAVINCI,
878 .gpio_base = DAVINCI_GPIO_BASE,
879 .gpio_num = 43, /* Only 33 usable */
880 .gpio_irq = IRQ_DM646X_GPIOBNK0,
881 .emac_pdata = &dm646x_emac_pdata, 901 .emac_pdata = &dm646x_emac_pdata,
882 .sram_dma = 0x10010000, 902 .sram_dma = 0x10010000,
883 .sram_len = SZ_32K, 903 .sram_len = SZ_32K,
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index aae53072c0eb..39e58b48e826 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -97,6 +97,7 @@ int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
97int da850_register_mmcsd1(struct davinci_mmc_config *config); 97int da850_register_mmcsd1(struct davinci_mmc_config *config);
98void da8xx_register_mcasp(int id, struct snd_platform_data *pdata); 98void da8xx_register_mcasp(int id, struct snd_platform_data *pdata);
99int da8xx_register_rtc(void); 99int da8xx_register_rtc(void);
100int da8xx_register_gpio(void *pdata);
100int da850_register_cpufreq(char *async_clk); 101int da850_register_cpufreq(char *async_clk);
101int da8xx_register_cpuidle(void); 102int da8xx_register_cpuidle(void);
102void __iomem *da8xx_get_mem_ctlr(void); 103void __iomem *da8xx_get_mem_ctlr(void);
@@ -110,6 +111,8 @@ int da850_register_vpif_capture
110void da8xx_restart(enum reboot_mode mode, const char *cmd); 111void da8xx_restart(enum reboot_mode mode, const char *cmd);
111void da8xx_rproc_reserve_cma(void); 112void da8xx_rproc_reserve_cma(void);
112int da8xx_register_rproc(void); 113int da8xx_register_rproc(void);
114int da850_register_gpio(void);
115int da830_register_gpio(void);
113 116
114extern struct platform_device da8xx_serial_device[]; 117extern struct platform_device da8xx_serial_device[];
115extern struct emac_platform_data da8xx_emac_pdata; 118extern struct emac_platform_data da8xx_emac_pdata;
diff --git a/arch/arm/mach-davinci/include/mach/gpio-davinci.h b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
deleted file mode 100644
index 1fdd1fd35448..000000000000
--- a/arch/arm/mach-davinci/include/mach/gpio-davinci.h
+++ /dev/null
@@ -1,91 +0,0 @@
1/*
2 * TI DaVinci GPIO Support
3 *
4 * Copyright (c) 2006 David Brownell
5 * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef __DAVINCI_DAVINCI_GPIO_H
14#define __DAVINCI_DAVINCI_GPIO_H
15
16#include <linux/io.h>
17#include <linux/spinlock.h>
18
19#include <asm-generic/gpio.h>
20
21#include <mach/irqs.h>
22#include <mach/common.h>
23
24#define DAVINCI_GPIO_BASE 0x01C67000
25
26enum davinci_gpio_type {
27 GPIO_TYPE_DAVINCI = 0,
28 GPIO_TYPE_TNETV107X,
29};
30
31/*
32 * basic gpio routines
33 *
34 * board-specific init should be done by arch/.../.../board-XXX.c (maybe
35 * initializing banks together) rather than boot loaders; kexec() won't
36 * go through boot loaders.
37 *
38 * the gpio clock will be turned on when gpios are used, and you may also
39 * need to pay attention to PINMUX registers to be sure those pins are
40 * used as gpios, not with other peripherals.
41 *
42 * On-chip GPIOs are numbered 0..(DAVINCI_N_GPIO-1). For documentation,
43 * and maybe for later updates, code may write GPIO(N). These may be
44 * all 1.8V signals, all 3.3V ones, or a mix of the two. A given chip
45 * may not support all the GPIOs in that range.
46 *
47 * GPIOs can also be on external chips, numbered after the ones built-in
48 * to the DaVinci chip. For now, they won't be usable as IRQ sources.
49 */
50#define GPIO(X) (X) /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
51
52/* Convert GPIO signal to GPIO pin number */
53#define GPIO_TO_PIN(bank, gpio) (16 * (bank) + (gpio))
54
55struct davinci_gpio_controller {
56 struct gpio_chip chip;
57 int irq_base;
58 spinlock_t lock;
59 void __iomem *regs;
60 void __iomem *set_data;
61 void __iomem *clr_data;
62 void __iomem *in_data;
63};
64
65/* The __gpio_to_controller() and __gpio_mask() functions inline to constants
66 * with constant parameters; or in outlined code they execute at runtime.
67 *
68 * You'd access the controller directly when reading or writing more than
69 * one gpio value at a time, and to support wired logic where the value
70 * being driven by the cpu need not match the value read back.
71 *
72 * These are NOT part of the cross-platform GPIO interface
73 */
74static inline struct davinci_gpio_controller *
75__gpio_to_controller(unsigned gpio)
76{
77 struct davinci_gpio_controller *ctlrs = davinci_soc_info.gpio_ctlrs;
78 int index = gpio / 32;
79
80 if (!ctlrs || index >= davinci_soc_info.gpio_ctlrs_num)
81 return NULL;
82
83 return ctlrs + index;
84}
85
86static inline u32 __gpio_mask(unsigned gpio)
87{
88 return 1 << (gpio % 32);
89}
90
91#endif /* __DAVINCI_DAVINCI_GPIO_H */
diff --git a/arch/arm/mach-davinci/include/mach/gpio.h b/arch/arm/mach-davinci/include/mach/gpio.h
deleted file mode 100644
index 960e9de47e1e..000000000000
--- a/arch/arm/mach-davinci/include/mach/gpio.h
+++ /dev/null
@@ -1,88 +0,0 @@
1/*
2 * TI DaVinci GPIO Support
3 *
4 * Copyright (c) 2006 David Brownell
5 * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef __DAVINCI_GPIO_H
14#define __DAVINCI_GPIO_H
15
16#include <asm-generic/gpio.h>
17
18#define __ARM_GPIOLIB_COMPLEX
19
20/* The inline versions use the static inlines in the driver header */
21#include "gpio-davinci.h"
22
23/*
24 * The get/set/clear functions will inline when called with constant
25 * parameters referencing built-in GPIOs, for low-overhead bitbanging.
26 *
27 * gpio_set_value() will inline only on traditional Davinci style controllers
28 * with distinct set/clear registers.
29 *
30 * Otherwise, calls with variable parameters or referencing external
31 * GPIOs (e.g. on GPIO expander chips) use outlined functions.
32 */
33static inline void gpio_set_value(unsigned gpio, int value)
34{
35 if (__builtin_constant_p(value) && gpio < davinci_soc_info.gpio_num) {
36 struct davinci_gpio_controller *ctlr;
37 u32 mask;
38
39 ctlr = __gpio_to_controller(gpio);
40
41 if (ctlr->set_data != ctlr->clr_data) {
42 mask = __gpio_mask(gpio);
43 if (value)
44 __raw_writel(mask, ctlr->set_data);
45 else
46 __raw_writel(mask, ctlr->clr_data);
47 return;
48 }
49 }
50
51 __gpio_set_value(gpio, value);
52}
53
54/* Returns zero or nonzero; works for gpios configured as inputs OR
55 * as outputs, at least for built-in GPIOs.
56 *
57 * NOTE: for built-in GPIOs, changes in reported values are synchronized
58 * to the GPIO clock. This is easily seen after calling gpio_set_value()
59 * and then immediately gpio_get_value(), where the gpio_get_value() will
60 * return the old value until the GPIO clock ticks and the new value gets
61 * latched.
62 */
63static inline int gpio_get_value(unsigned gpio)
64{
65 struct davinci_gpio_controller *ctlr;
66
67 if (!__builtin_constant_p(gpio) || gpio >= davinci_soc_info.gpio_num)
68 return __gpio_get_value(gpio);
69
70 ctlr = __gpio_to_controller(gpio);
71 return __gpio_mask(gpio) & __raw_readl(ctlr->in_data);
72}
73
74static inline int gpio_cansleep(unsigned gpio)
75{
76 if (__builtin_constant_p(gpio) && gpio < davinci_soc_info.gpio_num)
77 return 0;
78 else
79 return __gpio_cansleep(gpio);
80}
81
82static inline int irq_to_gpio(unsigned irq)
83{
84 /* don't support the reverse mapping */
85 return -ENOSYS;
86}
87
88#endif /* __DAVINCI_GPIO_H */
diff --git a/arch/arm/mach-davinci/include/mach/serial.h b/arch/arm/mach-davinci/include/mach/serial.h
index 52b8571b2e70..ce402cd21fa0 100644
--- a/arch/arm/mach-davinci/include/mach/serial.h
+++ b/arch/arm/mach-davinci/include/mach/serial.h
@@ -15,8 +15,6 @@
15 15
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17 17
18#include <linux/platform_device.h>
19
20#define DAVINCI_UART0_BASE (IO_PHYS + 0x20000) 18#define DAVINCI_UART0_BASE (IO_PHYS + 0x20000)
21#define DAVINCI_UART1_BASE (IO_PHYS + 0x20400) 19#define DAVINCI_UART1_BASE (IO_PHYS + 0x20400)
22#define DAVINCI_UART2_BASE (IO_PHYS + 0x20800) 20#define DAVINCI_UART2_BASE (IO_PHYS + 0x20800)
@@ -39,6 +37,8 @@
39#define UART_DM646X_SCR_TX_WATERMARK 0x08 37#define UART_DM646X_SCR_TX_WATERMARK 0x08
40 38
41#ifndef __ASSEMBLY__ 39#ifndef __ASSEMBLY__
40#include <linux/platform_device.h>
41
42extern int davinci_serial_init(struct platform_device *); 42extern int davinci_serial_init(struct platform_device *);
43#endif 43#endif
44 44
diff --git a/arch/arm/mach-davinci/sram.c b/arch/arm/mach-davinci/sram.c
index f18928b073f5..8540dddf1fbd 100644
--- a/arch/arm/mach-davinci/sram.c
+++ b/arch/arm/mach-davinci/sram.c
@@ -25,7 +25,6 @@ struct gen_pool *sram_get_gen_pool(void)
25 25
26void *sram_alloc(size_t len, dma_addr_t *dma) 26void *sram_alloc(size_t len, dma_addr_t *dma)
27{ 27{
28 unsigned long vaddr;
29 dma_addr_t dma_base = davinci_soc_info.sram_dma; 28 dma_addr_t dma_base = davinci_soc_info.sram_dma;
30 29
31 if (dma) 30 if (dma)
@@ -33,13 +32,7 @@ void *sram_alloc(size_t len, dma_addr_t *dma)
33 if (!sram_pool || (dma && !dma_base)) 32 if (!sram_pool || (dma && !dma_base))
34 return NULL; 33 return NULL;
35 34
36 vaddr = gen_pool_alloc(sram_pool, len); 35 return gen_pool_dma_alloc(sram_pool, len, dma);
37 if (!vaddr)
38 return NULL;
39
40 if (dma)
41 *dma = gen_pool_virt_to_phys(sram_pool, vaddr);
42 return (void *)vaddr;
43 36
44} 37}
45EXPORT_SYMBOL(sram_alloc); 38EXPORT_SYMBOL(sram_alloc);
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index 7a55b5c95971..56c6eb5266ad 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -181,7 +181,7 @@ static struct timer_s timers[] = {
181 .name = "clockevent", 181 .name = "clockevent",
182 .opts = TIMER_OPTS_DISABLED, 182 .opts = TIMER_OPTS_DISABLED,
183 .irqaction = { 183 .irqaction = {
184 .flags = IRQF_DISABLED | IRQF_TIMER, 184 .flags = IRQF_TIMER,
185 .handler = timer_interrupt, 185 .handler = timer_interrupt,
186 } 186 }
187 }, 187 },
@@ -190,7 +190,7 @@ static struct timer_s timers[] = {
190 .period = ~0, 190 .period = ~0,
191 .opts = TIMER_OPTS_PERIODIC, 191 .opts = TIMER_OPTS_PERIODIC,
192 .irqaction = { 192 .irqaction = {
193 .flags = IRQF_DISABLED | IRQF_TIMER, 193 .flags = IRQF_TIMER,
194 .handler = freerun_interrupt, 194 .handler = freerun_interrupt,
195 } 195 }
196 }, 196 },
@@ -331,7 +331,6 @@ static void davinci_set_mode(enum clock_event_mode mode,
331 331
332static struct clock_event_device clockevent_davinci = { 332static struct clock_event_device clockevent_davinci = {
333 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 333 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
334 .shift = 32,
335 .set_next_event = davinci_set_next_event, 334 .set_next_event = davinci_set_next_event,
336 .set_mode = davinci_set_mode, 335 .set_mode = davinci_set_mode,
337}; 336};
@@ -397,14 +396,10 @@ void __init davinci_timer_init(void)
397 396
398 /* setup clockevent */ 397 /* setup clockevent */
399 clockevent_davinci.name = id_to_name[timers[TID_CLOCKEVENT].id]; 398 clockevent_davinci.name = id_to_name[timers[TID_CLOCKEVENT].id];
400 clockevent_davinci.mult = div_sc(davinci_clock_tick_rate, NSEC_PER_SEC,
401 clockevent_davinci.shift);
402 clockevent_davinci.max_delta_ns =
403 clockevent_delta2ns(0xfffffffe, &clockevent_davinci);
404 clockevent_davinci.min_delta_ns = 50000; /* 50 usec */
405 399
406 clockevent_davinci.cpumask = cpumask_of(0); 400 clockevent_davinci.cpumask = cpumask_of(0);
407 clockevents_register_device(&clockevent_davinci); 401 clockevents_config_and_register(&clockevent_davinci,
402 davinci_clock_tick_rate, 1, 0xfffffffe);
408 403
409 for (i=0; i< ARRAY_SIZE(timers); i++) 404 for (i=0; i< ARRAY_SIZE(timers); i++)
410 timer32_config(&timers[i]); 405 timer32_config(&timers[i]);
diff --git a/arch/arm/mach-dove/board-dt.c b/arch/arm/mach-dove/board-dt.c
index 49f72a848423..49fa9abd09da 100644
--- a/arch/arm/mach-dove/board-dt.c
+++ b/arch/arm/mach-dove/board-dt.c
@@ -10,54 +10,15 @@
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/clocksource.h>
14#include <linux/irqchip.h>
15#include <linux/of.h> 13#include <linux/of.h>
16#include <linux/of_platform.h> 14#include <linux/of_platform.h>
17#include <linux/platform_data/usb-ehci-orion.h>
18#include <asm/hardware/cache-tauros2.h> 15#include <asm/hardware/cache-tauros2.h>
19#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
20#include <mach/dove.h> 17#include <mach/dove.h>
21#include <mach/pm.h> 18#include <mach/pm.h>
22#include <plat/common.h> 19#include <plat/common.h>
23#include <plat/irq.h>
24#include "common.h" 20#include "common.h"
25 21
26/*
27 * There are still devices that doesn't even know about DT,
28 * get clock gates here and add a clock lookup.
29 */
30static void __init dove_legacy_clk_init(void)
31{
32 struct device_node *np = of_find_compatible_node(NULL, NULL,
33 "marvell,dove-gating-clock");
34 struct of_phandle_args clkspec;
35
36 clkspec.np = np;
37 clkspec.args_count = 1;
38
39 clkspec.args[0] = CLOCK_GATING_BIT_PCIE0;
40 orion_clkdev_add("0", "pcie",
41 of_clk_get_from_provider(&clkspec));
42
43 clkspec.args[0] = CLOCK_GATING_BIT_PCIE1;
44 orion_clkdev_add("1", "pcie",
45 of_clk_get_from_provider(&clkspec));
46}
47
48static void __init dove_dt_time_init(void)
49{
50 of_clk_init(NULL);
51 clocksource_of_init();
52}
53
54static void __init dove_dt_init_early(void)
55{
56 mvebu_mbus_init("marvell,dove-mbus",
57 BRIDGE_WINS_BASE, BRIDGE_WINS_SZ,
58 DOVE_MC_WINS_BASE, DOVE_MC_WINS_SZ);
59}
60
61static void __init dove_dt_init(void) 22static void __init dove_dt_init(void)
62{ 23{
63 pr_info("Dove 88AP510 SoC\n"); 24 pr_info("Dove 88AP510 SoC\n");
@@ -65,14 +26,7 @@ static void __init dove_dt_init(void)
65#ifdef CONFIG_CACHE_TAUROS2 26#ifdef CONFIG_CACHE_TAUROS2
66 tauros2_init(0); 27 tauros2_init(0);
67#endif 28#endif
68 dove_setup_cpu_wins(); 29 BUG_ON(mvebu_mbus_dt_init());
69
70 /* Setup clocks for legacy devices */
71 dove_legacy_clk_init();
72
73 /* Internal devices not ported to DT yet */
74 dove_pcie_init(1, 1);
75
76 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 30 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
77} 31}
78 32
@@ -83,8 +37,6 @@ static const char * const dove_dt_board_compat[] = {
83 37
84DT_MACHINE_START(DOVE_DT, "Marvell Dove (Flattened Device Tree)") 38DT_MACHINE_START(DOVE_DT, "Marvell Dove (Flattened Device Tree)")
85 .map_io = dove_map_io, 39 .map_io = dove_map_io,
86 .init_early = dove_dt_init_early,
87 .init_time = dove_dt_time_init,
88 .init_machine = dove_dt_init, 40 .init_machine = dove_dt_init,
89 .restart = dove_restart, 41 .restart = dove_restart,
90 .dt_compat = dove_dt_board_compat, 42 .dt_compat = dove_dt_board_compat,
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index c95dbce2468e..39ef3b613912 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -212,7 +212,7 @@ static struct clk_lookup clocks[] = {
212 INIT_CK(NULL, "hclk", &clk_h), 212 INIT_CK(NULL, "hclk", &clk_h),
213 INIT_CK(NULL, "apb_pclk", &clk_p), 213 INIT_CK(NULL, "apb_pclk", &clk_p),
214 INIT_CK(NULL, "pll2", &clk_pll2), 214 INIT_CK(NULL, "pll2", &clk_pll2),
215 INIT_CK("ep93xx-ohci", NULL, &clk_usb_host), 215 INIT_CK("ohci-platform", NULL, &clk_usb_host),
216 INIT_CK("ep93xx-keypad", NULL, &clk_keypad), 216 INIT_CK("ep93xx-keypad", NULL, &clk_keypad),
217 INIT_CK("ep93xx-fb", NULL, &clk_video), 217 INIT_CK("ep93xx-fb", NULL, &clk_video),
218 INIT_CK("ep93xx-spi.0", NULL, &clk_spi), 218 INIT_CK("ep93xx-spi.0", NULL, &clk_spi),
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 3f12b885c083..d95ee28a616a 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -36,6 +36,7 @@
36#include <linux/export.h> 36#include <linux/export.h>
37#include <linux/irqchip/arm-vic.h> 37#include <linux/irqchip/arm-vic.h>
38#include <linux/reboot.h> 38#include <linux/reboot.h>
39#include <linux/usb/ohci_pdriver.h>
39 40
40#include <mach/hardware.h> 41#include <mach/hardware.h>
41#include <linux/platform_data/video-ep93xx.h> 42#include <linux/platform_data/video-ep93xx.h>
@@ -297,25 +298,53 @@ static struct platform_device ep93xx_rtc_device = {
297 .resource = ep93xx_rtc_resource, 298 .resource = ep93xx_rtc_resource,
298}; 299};
299 300
301/*************************************************************************
302 * EP93xx OHCI USB Host
303 *************************************************************************/
304
305static struct clk *ep93xx_ohci_host_clock;
306
307static int ep93xx_ohci_power_on(struct platform_device *pdev)
308{
309 if (!ep93xx_ohci_host_clock) {
310 ep93xx_ohci_host_clock = devm_clk_get(&pdev->dev, NULL);
311 if (IS_ERR(ep93xx_ohci_host_clock))
312 return PTR_ERR(ep93xx_ohci_host_clock);
313 }
314
315 return clk_enable(ep93xx_ohci_host_clock);
316}
317
318static void ep93xx_ohci_power_off(struct platform_device *pdev)
319{
320 clk_disable(ep93xx_ohci_host_clock);
321}
322
323static struct usb_ohci_pdata ep93xx_ohci_pdata = {
324 .power_on = ep93xx_ohci_power_on,
325 .power_off = ep93xx_ohci_power_off,
326 .power_suspend = ep93xx_ohci_power_off,
327};
300 328
301static struct resource ep93xx_ohci_resources[] = { 329static struct resource ep93xx_ohci_resources[] = {
302 DEFINE_RES_MEM(EP93XX_USB_PHYS_BASE, 0x1000), 330 DEFINE_RES_MEM(EP93XX_USB_PHYS_BASE, 0x1000),
303 DEFINE_RES_IRQ(IRQ_EP93XX_USB), 331 DEFINE_RES_IRQ(IRQ_EP93XX_USB),
304}; 332};
305 333
334static u64 ep93xx_ohci_dma_mask = DMA_BIT_MASK(32);
306 335
307static struct platform_device ep93xx_ohci_device = { 336static struct platform_device ep93xx_ohci_device = {
308 .name = "ep93xx-ohci", 337 .name = "ohci-platform",
309 .id = -1, 338 .id = -1,
339 .num_resources = ARRAY_SIZE(ep93xx_ohci_resources),
340 .resource = ep93xx_ohci_resources,
310 .dev = { 341 .dev = {
311 .dma_mask = &ep93xx_ohci_device.dev.coherent_dma_mask, 342 .dma_mask = &ep93xx_ohci_dma_mask,
312 .coherent_dma_mask = DMA_BIT_MASK(32), 343 .coherent_dma_mask = DMA_BIT_MASK(32),
344 .platform_data = &ep93xx_ohci_pdata,
313 }, 345 },
314 .num_resources = ARRAY_SIZE(ep93xx_ohci_resources),
315 .resource = ep93xx_ohci_resources,
316}; 346};
317 347
318
319/************************************************************************* 348/*************************************************************************
320 * EP93xx physmap'ed flash 349 * EP93xx physmap'ed flash
321 *************************************************************************/ 350 *************************************************************************/
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 56fe819ee10b..f9d67a0acb2a 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -14,19 +14,28 @@ 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 ARM_AMBA
18 select CLKSRC_OF
19 select CLKSRC_SAMSUNG_PWM if CPU_EXYNOS4210
20 select CPU_EXYNOS4210
17 select GIC_NON_BANKED 21 select GIC_NON_BANKED
22 select KEYBOARD_SAMSUNG if INPUT_KEYBOARD
18 select HAVE_ARM_SCU if SMP 23 select HAVE_ARM_SCU if SMP
19 select HAVE_SMP 24 select HAVE_SMP
20 select MIGHT_HAVE_CACHE_L2X0 25 select MIGHT_HAVE_CACHE_L2X0
21 select PINCTRL 26 select PINCTRL
27 select S5P_DEV_MFC
22 help 28 help
23 Samsung EXYNOS4 SoCs based systems 29 Samsung EXYNOS4 SoCs based systems
24 30
25config ARCH_EXYNOS5 31config ARCH_EXYNOS5
26 bool "SAMSUNG EXYNOS5" 32 bool "SAMSUNG EXYNOS5"
33 select ARM_AMBA
34 select CLKSRC_OF
27 select HAVE_ARM_SCU if SMP 35 select HAVE_ARM_SCU if SMP
28 select HAVE_SMP 36 select HAVE_SMP
29 select PINCTRL 37 select PINCTRL
38 select USB_ARCH_HAS_XHCI
30 help 39 help
31 Samsung EXYNOS5 (Cortex-A15) SoC based systems 40 Samsung EXYNOS5 (Cortex-A15) SoC based systems
32 41
@@ -110,35 +119,6 @@ config SOC_EXYNOS5440
110 help 119 help
111 Enable EXYNOS5440 SoC support 120 Enable EXYNOS5440 SoC support
112 121
113comment "Flattened Device Tree based board for EXYNOS SoCs"
114
115config MACH_EXYNOS4_DT
116 bool "Samsung Exynos4 Machine using device tree"
117 default y
118 depends on ARCH_EXYNOS4
119 select ARM_AMBA
120 select CLKSRC_OF
121 select CLKSRC_SAMSUNG_PWM if CPU_EXYNOS4210
122 select CPU_EXYNOS4210
123 select KEYBOARD_SAMSUNG if INPUT_KEYBOARD
124 select S5P_DEV_MFC
125 help
126 Machine support for Samsung Exynos4 machine with device tree enabled.
127 Select this if a fdt blob is available for the Exynos4 SoC based board.
128 Note: This is under development and not all peripherals can be supported
129 with this machine file.
130
131config MACH_EXYNOS5_DT
132 bool "SAMSUNG EXYNOS5 Machine using device tree"
133 default y
134 depends on ARCH_EXYNOS5
135 select ARM_AMBA
136 select CLKSRC_OF
137 select USB_ARCH_HAS_XHCI
138 help
139 Machine support for Samsung EXYNOS5 machine with device tree enabled.
140 Select this if a fdt blob is available for the EXYNOS5 SoC based board.
141
142endmenu 122endmenu
143 123
144endif 124endif
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index 53696154aead..8930b66b4abd 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -32,5 +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_EXYNOS4_DT) += mach-exynos4-dt.o 35obj-$(CONFIG_ARCH_EXYNOS4) += mach-exynos4-dt.o
36obj-$(CONFIG_MACH_EXYNOS5_DT) += mach-exynos5-dt.o 36obj-$(CONFIG_ARCH_EXYNOS5) += mach-exynos5-dt.o
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index ba95e5db2501..61d2906ccefb 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -26,10 +26,9 @@
26#include <linux/export.h> 26#include <linux/export.h>
27#include <linux/irqdomain.h> 27#include <linux/irqdomain.h>
28#include <linux/of_address.h> 28#include <linux/of_address.h>
29#include <linux/clocksource.h>
30#include <linux/clk-provider.h>
31#include <linux/irqchip/arm-gic.h> 29#include <linux/irqchip/arm-gic.h>
32#include <linux/irqchip/chained_irq.h> 30#include <linux/irqchip/chained_irq.h>
31#include <linux/platform_device.h>
33 32
34#include <asm/proc-fns.h> 33#include <asm/proc-fns.h>
35#include <asm/exception.h> 34#include <asm/exception.h>
@@ -294,6 +293,16 @@ void exynos5_restart(enum reboot_mode mode, const char *cmd)
294 __raw_writel(val, addr); 293 __raw_writel(val, addr);
295} 294}
296 295
296static struct platform_device exynos_cpuidle = {
297 .name = "exynos_cpuidle",
298 .id = -1,
299};
300
301void __init exynos_cpuidle_init(void)
302{
303 platform_device_register(&exynos_cpuidle);
304}
305
297void __init exynos_init_late(void) 306void __init exynos_init_late(void)
298{ 307{
299 if (of_machine_is_compatible("samsung,exynos5440")) 308 if (of_machine_is_compatible("samsung,exynos5440"))
@@ -367,12 +376,6 @@ static void __init exynos5_map_io(void)
367 iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc)); 376 iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc));
368} 377}
369 378
370void __init exynos_init_time(void)
371{
372 of_clk_init(NULL);
373 clocksource_of_init();
374}
375
376struct bus_type exynos_subsys = { 379struct bus_type exynos_subsys = {
377 .name = "exynos-core", 380 .name = "exynos-core",
378 .dev_name = "exynos-core", 381 .dev_name = "exynos-core",
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 8646a141ae46..ff9b6a9419b0 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -16,12 +16,12 @@
16#include <linux/of.h> 16#include <linux/of.h>
17 17
18void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1); 18void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
19void exynos_init_time(void);
20 19
21struct map_desc; 20struct map_desc;
22void exynos_init_io(void); 21void exynos_init_io(void);
23void exynos4_restart(enum reboot_mode mode, const char *cmd); 22void exynos4_restart(enum reboot_mode mode, const char *cmd);
24void exynos5_restart(enum reboot_mode mode, const char *cmd); 23void exynos5_restart(enum reboot_mode mode, const char *cmd);
24void exynos_cpuidle_init(void);
25void exynos_init_late(void); 25void exynos_init_late(void);
26 26
27void exynos_firmware_init(void); 27void exynos_firmware_init(void);
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index ac139226d63c..ddbfe8709fe7 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -15,6 +15,7 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/export.h> 16#include <linux/export.h>
17#include <linux/time.h> 17#include <linux/time.h>
18#include <linux/platform_device.h>
18 19
19#include <asm/proc-fns.h> 20#include <asm/proc-fns.h>
20#include <asm/smp_scu.h> 21#include <asm/smp_scu.h>
@@ -192,7 +193,7 @@ static void __init exynos5_core_down_clk(void)
192 __raw_writel(tmp, EXYNOS5_PWR_CTRL2); 193 __raw_writel(tmp, EXYNOS5_PWR_CTRL2);
193} 194}
194 195
195static int __init exynos4_init_cpuidle(void) 196static int exynos_cpuidle_probe(struct platform_device *pdev)
196{ 197{
197 int cpu_id, ret; 198 int cpu_id, ret;
198 struct cpuidle_device *device; 199 struct cpuidle_device *device;
@@ -205,7 +206,7 @@ static int __init exynos4_init_cpuidle(void)
205 206
206 ret = cpuidle_register_driver(&exynos4_idle_driver); 207 ret = cpuidle_register_driver(&exynos4_idle_driver);
207 if (ret) { 208 if (ret) {
208 printk(KERN_ERR "CPUidle failed to register driver\n"); 209 dev_err(&pdev->dev, "failed to register cpuidle driver\n");
209 return ret; 210 return ret;
210 } 211 }
211 212
@@ -219,11 +220,20 @@ static int __init exynos4_init_cpuidle(void)
219 220
220 ret = cpuidle_register_device(device); 221 ret = cpuidle_register_device(device);
221 if (ret) { 222 if (ret) {
222 printk(KERN_ERR "CPUidle register device failed\n"); 223 dev_err(&pdev->dev, "failed to register cpuidle device\n");
223 return ret; 224 return ret;
224 } 225 }
225 } 226 }
226 227
227 return 0; 228 return 0;
228} 229}
229device_initcall(exynos4_init_cpuidle); 230
231static struct platform_driver exynos_cpuidle_driver = {
232 .probe = exynos_cpuidle_probe,
233 .driver = {
234 .name = "exynos_cpuidle",
235 .owner = THIS_MODULE,
236 },
237};
238
239module_platform_driver(exynos_cpuidle_driver);
diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h b/arch/arm/mach-exynos/include/mach/regs-pmu.h
index 57344b7e98ce..2cdb63e8ce5c 100644
--- a/arch/arm/mach-exynos/include/mach/regs-pmu.h
+++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h
@@ -44,11 +44,6 @@
44#define S5P_DAC_PHY_CONTROL S5P_PMUREG(0x070C) 44#define S5P_DAC_PHY_CONTROL S5P_PMUREG(0x070C)
45#define S5P_DAC_PHY_ENABLE (1 << 0) 45#define S5P_DAC_PHY_ENABLE (1 << 0)
46 46
47#define S5P_MIPI_DPHY_CONTROL(n) S5P_PMUREG(0x0710 + (n) * 4)
48#define S5P_MIPI_DPHY_ENABLE (1 << 0)
49#define S5P_MIPI_DPHY_SRESETN (1 << 1)
50#define S5P_MIPI_DPHY_MRESETN (1 << 2)
51
52#define S5P_INFORM0 S5P_PMUREG(0x0800) 47#define S5P_INFORM0 S5P_PMUREG(0x0800)
53#define S5P_INFORM1 S5P_PMUREG(0x0804) 48#define S5P_INFORM1 S5P_PMUREG(0x0804)
54#define S5P_INFORM2 S5P_PMUREG(0x0808) 49#define S5P_INFORM2 S5P_PMUREG(0x0808)
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c
index 0099c6c13bba..4603e6bd424b 100644
--- a/arch/arm/mach-exynos/mach-exynos4-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
@@ -11,12 +11,8 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12*/ 12*/
13 13
14#include <linux/kernel.h>
15#include <linux/of_platform.h> 14#include <linux/of_platform.h>
16#include <linux/of_fdt.h> 15#include <linux/of_fdt.h>
17#include <linux/serial_core.h>
18#include <linux/memblock.h>
19#include <linux/clocksource.h>
20 16
21#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
22#include <plat/mfc.h> 18#include <plat/mfc.h>
@@ -25,6 +21,8 @@
25 21
26static void __init exynos4_dt_machine_init(void) 22static void __init exynos4_dt_machine_init(void)
27{ 23{
24 exynos_cpuidle_init();
25
28 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 26 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
29} 27}
30 28
@@ -54,7 +52,6 @@ DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)")
54 .init_early = exynos_firmware_init, 52 .init_early = exynos_firmware_init,
55 .init_machine = exynos4_dt_machine_init, 53 .init_machine = exynos4_dt_machine_init,
56 .init_late = exynos_init_late, 54 .init_late = exynos_init_late,
57 .init_time = exynos_init_time,
58 .dt_compat = exynos4_dt_compat, 55 .dt_compat = exynos4_dt_compat,
59 .restart = exynos4_restart, 56 .restart = exynos4_restart,
60 .reserve = exynos4_reserve, 57 .reserve = exynos4_reserve,
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
index f874b773ca13..1fe075a70c1e 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -11,14 +11,10 @@
11 11
12#include <linux/of_platform.h> 12#include <linux/of_platform.h>
13#include <linux/of_fdt.h> 13#include <linux/of_fdt.h>
14#include <linux/memblock.h>
15#include <linux/io.h> 14#include <linux/io.h>
16#include <linux/clocksource.h>
17 15
18#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
19#include <mach/regs-pmu.h> 17#include <mach/regs-pmu.h>
20
21#include <plat/cpu.h>
22#include <plat/mfc.h> 18#include <plat/mfc.h>
23 19
24#include "common.h" 20#include "common.h"
@@ -47,6 +43,8 @@ static void __init exynos5_dt_machine_init(void)
47 } 43 }
48 } 44 }
49 45
46 exynos_cpuidle_init();
47
50 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 48 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
51} 49}
52 50
@@ -76,7 +74,6 @@ DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
76 .map_io = exynos_init_io, 74 .map_io = exynos_init_io,
77 .init_machine = exynos5_dt_machine_init, 75 .init_machine = exynos5_dt_machine_init,
78 .init_late = exynos_init_late, 76 .init_late = exynos_init_late,
79 .init_time = exynos_init_time,
80 .dt_compat = exynos5_dt_compat, 77 .dt_compat = exynos5_dt_compat,
81 .restart = exynos5_restart, 78 .restart = exynos5_restart,
82 .reserve = exynos5_reserve, 79 .reserve = exynos5_reserve,
diff --git a/arch/arm/mach-footbridge/netwinder-hw.c b/arch/arm/mach-footbridge/netwinder-hw.c
index 1fd2cf097e30..eb1fa5c84723 100644
--- a/arch/arm/mach-footbridge/netwinder-hw.c
+++ b/arch/arm/mach-footbridge/netwinder-hw.c
@@ -692,14 +692,14 @@ static void netwinder_led_set(struct led_classdev *cdev,
692 unsigned long flags; 692 unsigned long flags;
693 u32 reg; 693 u32 reg;
694 694
695 spin_lock_irqsave(&nw_gpio_lock, flags); 695 raw_spin_lock_irqsave(&nw_gpio_lock, flags);
696 reg = nw_gpio_read(); 696 reg = nw_gpio_read();
697 if (b != LED_OFF) 697 if (b != LED_OFF)
698 reg &= ~led->mask; 698 reg &= ~led->mask;
699 else 699 else
700 reg |= led->mask; 700 reg |= led->mask;
701 nw_gpio_modify_op(led->mask, reg); 701 nw_gpio_modify_op(led->mask, reg);
702 spin_unlock_irqrestore(&nw_gpio_lock, flags); 702 raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
703} 703}
704 704
705static enum led_brightness netwinder_led_get(struct led_classdev *cdev) 705static enum led_brightness netwinder_led_get(struct led_classdev *cdev)
@@ -709,9 +709,9 @@ static enum led_brightness netwinder_led_get(struct led_classdev *cdev)
709 unsigned long flags; 709 unsigned long flags;
710 u32 reg; 710 u32 reg;
711 711
712 spin_lock_irqsave(&nw_gpio_lock, flags); 712 raw_spin_lock_irqsave(&nw_gpio_lock, flags);
713 reg = nw_gpio_read(); 713 reg = nw_gpio_read();
714 spin_unlock_irqrestore(&nw_gpio_lock, flags); 714 raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
715 715
716 return (reg & led->mask) ? LED_OFF : LED_FULL; 716 return (reg & led->mask) ? LED_OFF : LED_FULL;
717} 717}
diff --git a/arch/arm/mach-gemini/gpio.c b/arch/arm/mach-gemini/gpio.c
index 70bfa571b24b..f8cb5710d6ee 100644
--- a/arch/arm/mach-gemini/gpio.c
+++ b/arch/arm/mach-gemini/gpio.c
@@ -21,9 +21,9 @@
21 21
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23#include <mach/irqs.h> 23#include <mach/irqs.h>
24#include <mach/gpio.h>
25 24
26#define GPIO_BASE(x) IO_ADDRESS(GEMINI_GPIO_BASE(x)) 25#define GPIO_BASE(x) IO_ADDRESS(GEMINI_GPIO_BASE(x))
26#define irq_to_gpio(x) ((x) - GPIO_IRQ_BASE)
27 27
28/* GPIO registers definition */ 28/* GPIO registers definition */
29#define GPIO_DATA_OUT 0x0 29#define GPIO_DATA_OUT 0x0
diff --git a/arch/arm/mach-gemini/include/mach/gpio.h b/arch/arm/mach-gemini/include/mach/gpio.h
deleted file mode 100644
index 40a0527bada7..000000000000
--- a/arch/arm/mach-gemini/include/mach/gpio.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Gemini gpiolib specific defines
3 *
4 * Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef __MACH_GPIO_H__
13#define __MACH_GPIO_H__
14
15#include <mach/irqs.h>
16
17#define gpio_to_irq(x) ((x) + GPIO_IRQ_BASE)
18#define irq_to_gpio(x) ((x) - GPIO_IRQ_BASE)
19
20#endif /* __MACH_GPIO_H__ */
diff --git a/arch/arm/mach-gemini/time.c b/arch/arm/mach-gemini/time.c
index 21dc5a89d1c4..0a63c4d25b64 100644
--- a/arch/arm/mach-gemini/time.c
+++ b/arch/arm/mach-gemini/time.c
@@ -13,6 +13,8 @@
13#include <mach/hardware.h> 13#include <mach/hardware.h>
14#include <mach/global_reg.h> 14#include <mach/global_reg.h>
15#include <asm/mach/time.h> 15#include <asm/mach/time.h>
16#include <linux/clockchips.h>
17#include <linux/clocksource.h>
16 18
17/* 19/*
18 * Register definitions for the timers 20 * Register definitions for the timers
@@ -33,19 +35,89 @@
33#define TIMER_3_CR_CLOCK (1 << 7) 35#define TIMER_3_CR_CLOCK (1 << 7)
34#define TIMER_3_CR_INT (1 << 8) 36#define TIMER_3_CR_INT (1 << 8)
35 37
38static unsigned int tick_rate;
39
40static int gemini_timer_set_next_event(unsigned long cycles,
41 struct clock_event_device *evt)
42{
43 u32 cr;
44
45 cr = readl(TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE)));
46
47 /* This may be overdoing it, feel free to test without this */
48 cr &= ~TIMER_2_CR_ENABLE;
49 cr &= ~TIMER_2_CR_INT;
50 writel(cr, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE)));
51
52 /* Set next event */
53 writel(cycles, TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER2_BASE)));
54 writel(cycles, TIMER_LOAD(IO_ADDRESS(GEMINI_TIMER2_BASE)));
55 cr |= TIMER_2_CR_ENABLE;
56 cr |= TIMER_2_CR_INT;
57 writel(cr, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE)));
58
59 return 0;
60}
61
62static void gemini_timer_set_mode(enum clock_event_mode mode,
63 struct clock_event_device *evt)
64{
65 u32 period = DIV_ROUND_CLOSEST(tick_rate, HZ);
66 u32 cr;
67
68 switch (mode) {
69 case CLOCK_EVT_MODE_PERIODIC:
70 /* Start the timer */
71 writel(period,
72 TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER2_BASE)));
73 writel(period,
74 TIMER_LOAD(IO_ADDRESS(GEMINI_TIMER2_BASE)));
75 cr = readl(TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE)));
76 cr |= TIMER_2_CR_ENABLE;
77 cr |= TIMER_2_CR_INT;
78 writel(cr, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE)));
79 break;
80 case CLOCK_EVT_MODE_ONESHOT:
81 case CLOCK_EVT_MODE_UNUSED:
82 case CLOCK_EVT_MODE_SHUTDOWN:
83 case CLOCK_EVT_MODE_RESUME:
84 /*
85 * Disable also for oneshot: the set_next() call will
86 * arm the timer instead.
87 */
88 cr = readl(TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE)));
89 cr &= ~TIMER_2_CR_ENABLE;
90 cr &= ~TIMER_2_CR_INT;
91 writel(cr, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE)));
92 break;
93 default:
94 break;
95 }
96}
97
98/* Use TIMER2 as clock event */
99static struct clock_event_device gemini_clockevent = {
100 .name = "TIMER2",
101 .rating = 300, /* Reasonably fast and accurate clock event */
102 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
103 .set_next_event = gemini_timer_set_next_event,
104 .set_mode = gemini_timer_set_mode,
105};
106
36/* 107/*
37 * IRQ handler for the timer 108 * IRQ handler for the timer
38 */ 109 */
39static irqreturn_t gemini_timer_interrupt(int irq, void *dev_id) 110static irqreturn_t gemini_timer_interrupt(int irq, void *dev_id)
40{ 111{
41 timer_tick(); 112 struct clock_event_device *evt = &gemini_clockevent;
42 113
114 evt->event_handler(evt);
43 return IRQ_HANDLED; 115 return IRQ_HANDLED;
44} 116}
45 117
46static struct irqaction gemini_timer_irq = { 118static struct irqaction gemini_timer_irq = {
47 .name = "Gemini Timer Tick", 119 .name = "Gemini Timer Tick",
48 .flags = IRQF_DISABLED | IRQF_TIMER, 120 .flags = IRQF_TIMER,
49 .handler = gemini_timer_interrupt, 121 .handler = gemini_timer_interrupt,
50}; 122};
51 123
@@ -54,9 +126,9 @@ static struct irqaction gemini_timer_irq = {
54 */ 126 */
55void __init gemini_timer_init(void) 127void __init gemini_timer_init(void)
56{ 128{
57 unsigned int tick_rate, reg_v; 129 u32 reg_v;
58 130
59 reg_v = __raw_readl(IO_ADDRESS(GEMINI_GLOBAL_BASE + GLOBAL_STATUS)); 131 reg_v = readl(IO_ADDRESS(GEMINI_GLOBAL_BASE + GLOBAL_STATUS));
60 tick_rate = REG_TO_AHB_SPEED(reg_v) * 1000000; 132 tick_rate = REG_TO_AHB_SPEED(reg_v) * 1000000;
61 133
62 printk(KERN_INFO "Bus: %dMHz", tick_rate / 1000000); 134 printk(KERN_INFO "Bus: %dMHz", tick_rate / 1000000);
@@ -82,8 +154,17 @@ void __init gemini_timer_init(void)
82 * Make irqs happen for the system timer 154 * Make irqs happen for the system timer
83 */ 155 */
84 setup_irq(IRQ_TIMER2, &gemini_timer_irq); 156 setup_irq(IRQ_TIMER2, &gemini_timer_irq);
85 /* Start the timer */ 157
86 __raw_writel(tick_rate / HZ, TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER2_BASE))); 158 /* Enable and use TIMER1 as clock source */
87 __raw_writel(tick_rate / HZ, TIMER_LOAD(IO_ADDRESS(GEMINI_TIMER2_BASE))); 159 writel(0xffffffff, TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER1_BASE)));
88 __raw_writel(TIMER_2_CR_ENABLE | TIMER_2_CR_INT, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE))); 160 writel(0xffffffff, TIMER_LOAD(IO_ADDRESS(GEMINI_TIMER1_BASE)));
161 writel(TIMER_1_CR_ENABLE, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE)));
162 if (clocksource_mmio_init(TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER1_BASE)),
163 "TIMER1", tick_rate, 300, 32,
164 clocksource_mmio_readl_up))
165 pr_err("timer: failed to initialize gemini clock source\n");
166
167 /* Configure and register the clockevent */
168 clockevents_config_and_register(&gemini_clockevent, tick_rate,
169 1, 0xffffffff);
89} 170}
diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig
index 8e8437dea3ce..08332d841440 100644
--- a/arch/arm/mach-highbank/Kconfig
+++ b/arch/arm/mach-highbank/Kconfig
@@ -4,15 +4,16 @@ config ARCH_HIGHBANK
4 select ARCH_HAS_CPUFREQ 4 select ARCH_HAS_CPUFREQ
5 select ARCH_HAS_HOLES_MEMORYMODEL 5 select ARCH_HAS_HOLES_MEMORYMODEL
6 select ARCH_HAS_OPP 6 select ARCH_HAS_OPP
7 select ARCH_SUPPORTS_BIG_ENDIAN
7 select ARCH_WANT_OPTIONAL_GPIOLIB 8 select ARCH_WANT_OPTIONAL_GPIOLIB
8 select ARM_AMBA 9 select ARM_AMBA
9 select ARM_ERRATA_764369 10 select ARM_ERRATA_764369
10 select ARM_ERRATA_775420 11 select ARM_ERRATA_775420
11 select ARM_ERRATA_798181 12 select ARM_ERRATA_798181 if SMP
12 select ARM_GIC 13 select ARM_GIC
14 select ARM_PSCI
13 select ARM_TIMER_SP804 15 select ARM_TIMER_SP804
14 select CACHE_L2X0 16 select CACHE_L2X0
15 select CLKDEV_LOOKUP
16 select COMMON_CLK 17 select COMMON_CLK
17 select CPU_V7 18 select CPU_V7
18 select GENERIC_CLOCKEVENTS 19 select GENERIC_CLOCKEVENTS
diff --git a/arch/arm/mach-highbank/Makefile b/arch/arm/mach-highbank/Makefile
index 8a1ef576d79f..55840f414d3e 100644
--- a/arch/arm/mach-highbank/Makefile
+++ b/arch/arm/mach-highbank/Makefile
@@ -3,6 +3,4 @@ obj-y := highbank.o system.o smc.o
3plus_sec := $(call as-instr,.arch_extension sec,+sec) 3plus_sec := $(call as-instr,.arch_extension sec,+sec)
4AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec) 4AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec)
5 5
6obj-$(CONFIG_SMP) += platsmp.o
7obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
8obj-$(CONFIG_PM_SLEEP) += pm.o 6obj-$(CONFIG_PM_SLEEP) += pm.o
diff --git a/arch/arm/mach-highbank/core.h b/arch/arm/mach-highbank/core.h
index aea1ec5ab6f8..7ec5edcd1336 100644
--- a/arch/arm/mach-highbank/core.h
+++ b/arch/arm/mach-highbank/core.h
@@ -3,7 +3,6 @@
3 3
4#include <linux/reboot.h> 4#include <linux/reboot.h>
5 5
6extern void highbank_set_cpu_jump(int cpu, void *jump_addr);
7extern void highbank_restart(enum reboot_mode, const char *); 6extern void highbank_restart(enum reboot_mode, const char *);
8extern void __iomem *scu_base_addr; 7extern void __iomem *scu_base_addr;
9 8
@@ -14,8 +13,5 @@ static inline void highbank_pm_init(void) {}
14#endif 13#endif
15 14
16extern void highbank_smc1(int fn, int arg); 15extern void highbank_smc1(int fn, int arg);
17extern void highbank_cpu_die(unsigned int cpu);
18
19extern struct smp_operations highbank_smp_ops;
20 16
21#endif 17#endif
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 8e63ccdb0de3..b3d7e5634b83 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -24,11 +24,9 @@
24#include <linux/of_platform.h> 24#include <linux/of_platform.h>
25#include <linux/of_address.h> 25#include <linux/of_address.h>
26#include <linux/amba/bus.h> 26#include <linux/amba/bus.h>
27#include <linux/clk-provider.h> 27#include <linux/platform_device.h>
28 28
29#include <asm/cacheflush.h> 29#include <asm/psci.h>
30#include <asm/cputype.h>
31#include <asm/smp_plat.h>
32#include <asm/hardware/cache-l2x0.h> 30#include <asm/hardware/cache-l2x0.h>
33#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
34#include <asm/mach/map.h> 32#include <asm/mach/map.h>
@@ -49,17 +47,6 @@ static void __init highbank_scu_map_io(void)
49 scu_base_addr = ioremap(base, SZ_4K); 47 scu_base_addr = ioremap(base, SZ_4K);
50} 48}
51 49
52#define HB_JUMP_TABLE_PHYS(cpu) (0x40 + (0x10 * (cpu)))
53#define HB_JUMP_TABLE_VIRT(cpu) phys_to_virt(HB_JUMP_TABLE_PHYS(cpu))
54
55void highbank_set_cpu_jump(int cpu, void *jump_addr)
56{
57 cpu = MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0);
58 writel(virt_to_phys(jump_addr), HB_JUMP_TABLE_VIRT(cpu));
59 __cpuc_flush_dcache_area(HB_JUMP_TABLE_VIRT(cpu), 16);
60 outer_clean_range(HB_JUMP_TABLE_PHYS(cpu),
61 HB_JUMP_TABLE_PHYS(cpu) + 15);
62}
63 50
64static void highbank_l2x0_disable(void) 51static void highbank_l2x0_disable(void)
65{ 52{
@@ -83,20 +70,6 @@ static void __init highbank_init_irq(void)
83 } 70 }
84} 71}
85 72
86static void __init highbank_timer_init(void)
87{
88 struct device_node *np;
89
90 /* Map system registers */
91 np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
92 sregs_base = of_iomap(np, 0);
93 WARN_ON(!sregs_base);
94
95 of_clk_init(NULL);
96
97 clocksource_of_init();
98}
99
100static void highbank_power_off(void) 73static void highbank_power_off(void)
101{ 74{
102 highbank_set_pwr_shutdown(); 75 highbank_set_pwr_shutdown();
@@ -153,8 +126,19 @@ static struct notifier_block highbank_platform_nb = {
153 .notifier_call = highbank_platform_notifier, 126 .notifier_call = highbank_platform_notifier,
154}; 127};
155 128
129static struct platform_device highbank_cpuidle_device = {
130 .name = "cpuidle-calxeda",
131};
132
156static void __init highbank_init(void) 133static void __init highbank_init(void)
157{ 134{
135 struct device_node *np;
136
137 /* Map system registers */
138 np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
139 sregs_base = of_iomap(np, 0);
140 WARN_ON(!sregs_base);
141
158 pm_power_off = highbank_power_off; 142 pm_power_off = highbank_power_off;
159 highbank_pm_init(); 143 highbank_pm_init();
160 144
@@ -162,6 +146,9 @@ static void __init highbank_init(void)
162 bus_register_notifier(&amba_bustype, &highbank_amba_nb); 146 bus_register_notifier(&amba_bustype, &highbank_amba_nb);
163 147
164 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 148 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
149
150 if (psci_ops.cpu_suspend)
151 platform_device_register(&highbank_cpuidle_device);
165} 152}
166 153
167static const char *highbank_match[] __initconst = { 154static const char *highbank_match[] __initconst = {
@@ -174,9 +161,7 @@ DT_MACHINE_START(HIGHBANK, "Highbank")
174#if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE) 161#if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
175 .dma_zone_size = (4ULL * SZ_1G), 162 .dma_zone_size = (4ULL * SZ_1G),
176#endif 163#endif
177 .smp = smp_ops(highbank_smp_ops),
178 .init_irq = highbank_init_irq, 164 .init_irq = highbank_init_irq,
179 .init_time = highbank_timer_init,
180 .init_machine = highbank_init, 165 .init_machine = highbank_init,
181 .dt_compat = highbank_match, 166 .dt_compat = highbank_match,
182 .restart = highbank_restart, 167 .restart = highbank_restart,
diff --git a/arch/arm/mach-highbank/hotplug.c b/arch/arm/mach-highbank/hotplug.c
deleted file mode 100644
index a019e4e86e51..000000000000
--- a/arch/arm/mach-highbank/hotplug.c
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * Copyright 2011 Calxeda, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include <linux/kernel.h>
17#include <asm/cacheflush.h>
18
19#include "core.h"
20#include "sysregs.h"
21
22extern void secondary_startup(void);
23
24/*
25 * platform-specific code to shutdown a CPU
26 *
27 */
28void __ref highbank_cpu_die(unsigned int cpu)
29{
30 highbank_set_cpu_jump(cpu, phys_to_virt(0));
31
32 flush_cache_louis();
33 highbank_set_core_pwr();
34
35 while (1)
36 cpu_do_idle();
37}
diff --git a/arch/arm/mach-highbank/platsmp.c b/arch/arm/mach-highbank/platsmp.c
deleted file mode 100644
index 32d75cf55cbc..000000000000
--- a/arch/arm/mach-highbank/platsmp.c
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * Copyright 2010-2011 Calxeda, Inc.
3 * Based on platsmp.c, Copyright (C) 2002 ARM Ltd.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17#include <linux/init.h>
18#include <linux/smp.h>
19#include <linux/io.h>
20
21#include <asm/smp_scu.h>
22
23#include "core.h"
24
25extern void secondary_startup(void);
26
27static int highbank_boot_secondary(unsigned int cpu, struct task_struct *idle)
28{
29 highbank_set_cpu_jump(cpu, secondary_startup);
30 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
31 return 0;
32}
33
34/*
35 * Initialise the CPU possible map early - this describes the CPUs
36 * which may be present or become present in the system.
37 */
38static void __init highbank_smp_init_cpus(void)
39{
40 unsigned int i, ncores = 4;
41
42 /* sanity check */
43 if (ncores > NR_CPUS) {
44 printk(KERN_WARNING
45 "highbank: no. of cores (%d) greater than configured "
46 "maximum of %d - clipping\n",
47 ncores, NR_CPUS);
48 ncores = NR_CPUS;
49 }
50
51 for (i = 0; i < ncores; i++)
52 set_cpu_possible(i, true);
53}
54
55static void __init highbank_smp_prepare_cpus(unsigned int max_cpus)
56{
57 if (scu_base_addr)
58 scu_enable(scu_base_addr);
59}
60
61struct smp_operations highbank_smp_ops __initdata = {
62 .smp_init_cpus = highbank_smp_init_cpus,
63 .smp_prepare_cpus = highbank_smp_prepare_cpus,
64 .smp_boot_secondary = highbank_boot_secondary,
65#ifdef CONFIG_HOTPLUG_CPU
66 .cpu_die = highbank_cpu_die,
67#endif
68};
diff --git a/arch/arm/mach-highbank/pm.c b/arch/arm/mach-highbank/pm.c
index 04eddb4f4380..7f2bd85eb935 100644
--- a/arch/arm/mach-highbank/pm.c
+++ b/arch/arm/mach-highbank/pm.c
@@ -16,27 +16,19 @@
16 16
17#include <linux/cpu_pm.h> 17#include <linux/cpu_pm.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/io.h>
20#include <linux/suspend.h> 19#include <linux/suspend.h>
21 20
22#include <asm/cacheflush.h>
23#include <asm/proc-fns.h>
24#include <asm/suspend.h> 21#include <asm/suspend.h>
25 22#include <asm/psci.h>
26#include "core.h"
27#include "sysregs.h"
28 23
29static int highbank_suspend_finish(unsigned long val) 24static int highbank_suspend_finish(unsigned long val)
30{ 25{
31 outer_flush_all(); 26 const struct psci_power_state ps = {
32 outer_disable(); 27 .type = PSCI_POWER_STATE_TYPE_POWER_DOWN,
33 28 .affinity_level = 1,
34 highbank_set_pwr_suspend(); 29 };
35
36 cpu_do_idle();
37 30
38 highbank_clear_pwr_request(); 31 return psci_ops.cpu_suspend(ps, __pa(cpu_resume));
39 return 0;
40} 32}
41 33
42static int highbank_pm_enter(suspend_state_t state) 34static int highbank_pm_enter(suspend_state_t state)
@@ -44,15 +36,11 @@ static int highbank_pm_enter(suspend_state_t state)
44 cpu_pm_enter(); 36 cpu_pm_enter();
45 cpu_cluster_pm_enter(); 37 cpu_cluster_pm_enter();
46 38
47 highbank_set_cpu_jump(0, cpu_resume);
48 cpu_suspend(0, highbank_suspend_finish); 39 cpu_suspend(0, highbank_suspend_finish);
49 40
50 cpu_cluster_pm_exit(); 41 cpu_cluster_pm_exit();
51 cpu_pm_exit(); 42 cpu_pm_exit();
52 43
53 highbank_smc1(0x102, 0x1);
54 if (scu_base_addr)
55 scu_enable(scu_base_addr);
56 return 0; 44 return 0;
57} 45}
58 46
@@ -63,5 +51,8 @@ static const struct platform_suspend_ops highbank_pm_ops = {
63 51
64void __init highbank_pm_init(void) 52void __init highbank_pm_init(void)
65{ 53{
54 if (!psci_ops.cpu_suspend)
55 return;
56
66 suspend_set_ops(&highbank_pm_ops); 57 suspend_set_ops(&highbank_pm_ops);
67} 58}
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 29a8af6922a8..7a6e6f710068 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -4,13 +4,14 @@ config ARCH_MXC
4 select ARM_CPU_SUSPEND if PM 4 select ARM_CPU_SUSPEND if PM
5 select ARM_PATCH_PHYS_VIRT 5 select ARM_PATCH_PHYS_VIRT
6 select AUTO_ZRELADDR if !ZBOOT_ROM 6 select AUTO_ZRELADDR if !ZBOOT_ROM
7 select CLKDEV_LOOKUP
8 select CLKSRC_MMIO 7 select CLKSRC_MMIO
8 select COMMON_CLK
9 select GENERIC_ALLOCATOR 9 select GENERIC_ALLOCATOR
10 select GENERIC_CLOCKEVENTS 10 select GENERIC_CLOCKEVENTS
11 select GENERIC_IRQ_CHIP 11 select GENERIC_IRQ_CHIP
12 select MIGHT_HAVE_CACHE_L2X0 if ARCH_MULTI_V6_V7 12 select MIGHT_HAVE_CACHE_L2X0 if ARCH_MULTI_V6_V7
13 select MULTI_IRQ_HANDLER 13 select MULTI_IRQ_HANDLER
14 select SOC_BUS
14 select SPARSE_IRQ 15 select SPARSE_IRQ
15 select USE_OF 16 select USE_OF
16 help 17 help
@@ -24,7 +25,7 @@ config MXC_IRQ_PRIOR
24 help 25 help
25 Select this if you want to use prioritized IRQ handling. 26 Select this if you want to use prioritized IRQ handling.
26 This feature prevents higher priority ISR to be interrupted 27 This feature prevents higher priority ISR to be interrupted
27 by lower priority IRQ even IRQF_DISABLED flag is not set. 28 by lower priority IRQ.
28 This may be useful in embedded applications, where are strong 29 This may be useful in embedded applications, where are strong
29 requirements for timing. 30 requirements for timing.
30 Say N here, unless you have a specialized requirement. 31 Say N here, unless you have a specialized requirement.
@@ -92,14 +93,12 @@ config MACH_MX27
92config SOC_IMX1 93config SOC_IMX1
93 bool 94 bool
94 select ARCH_MX1 95 select ARCH_MX1
95 select COMMON_CLK
96 select CPU_ARM920T 96 select CPU_ARM920T
97 select IMX_HAVE_IOMUX_V1 97 select IMX_HAVE_IOMUX_V1
98 select MXC_AVIC 98 select MXC_AVIC
99 99
100config SOC_IMX21 100config SOC_IMX21
101 bool 101 bool
102 select COMMON_CLK
103 select CPU_ARM926T 102 select CPU_ARM926T
104 select IMX_HAVE_IOMUX_V1 103 select IMX_HAVE_IOMUX_V1
105 select MXC_AVIC 104 select MXC_AVIC
@@ -108,7 +107,6 @@ config SOC_IMX25
108 bool 107 bool
109 select ARCH_MX25 108 select ARCH_MX25
110 select ARCH_MXC_IOMUX_V3 109 select ARCH_MXC_IOMUX_V3
111 select COMMON_CLK
112 select CPU_ARM926T 110 select CPU_ARM926T
113 select MXC_AVIC 111 select MXC_AVIC
114 112
@@ -116,7 +114,6 @@ config SOC_IMX27
116 bool 114 bool
117 select ARCH_HAS_CPUFREQ 115 select ARCH_HAS_CPUFREQ
118 select ARCH_HAS_OPP 116 select ARCH_HAS_OPP
119 select COMMON_CLK
120 select CPU_ARM926T 117 select CPU_ARM926T
121 select IMX_HAVE_IOMUX_V1 118 select IMX_HAVE_IOMUX_V1
122 select MACH_MX27 119 select MACH_MX27
@@ -124,7 +121,6 @@ config SOC_IMX27
124 121
125config SOC_IMX31 122config SOC_IMX31
126 bool 123 bool
127 select COMMON_CLK
128 select CPU_V6 124 select CPU_V6
129 select IMX_HAVE_PLATFORM_MXC_RNGA 125 select IMX_HAVE_PLATFORM_MXC_RNGA
130 select MXC_AVIC 126 select MXC_AVIC
@@ -133,7 +129,6 @@ config SOC_IMX31
133config SOC_IMX35 129config SOC_IMX35
134 bool 130 bool
135 select ARCH_MXC_IOMUX_V3 131 select ARCH_MXC_IOMUX_V3
136 select COMMON_CLK
137 select CPU_V6K 132 select CPU_V6K
138 select HAVE_EPIT 133 select HAVE_EPIT
139 select MXC_AVIC 134 select MXC_AVIC
@@ -144,7 +139,6 @@ config SOC_IMX5
144 select ARCH_HAS_CPUFREQ 139 select ARCH_HAS_CPUFREQ
145 select ARCH_HAS_OPP 140 select ARCH_HAS_OPP
146 select ARCH_MXC_IOMUX_V3 141 select ARCH_MXC_IOMUX_V3
147 select COMMON_CLK
148 select CPU_V7 142 select CPU_V7
149 select MXC_TZIC 143 select MXC_TZIC
150 144
@@ -791,7 +785,6 @@ config SOC_IMX6Q
791 select ARM_ERRATA_764369 if SMP 785 select ARM_ERRATA_764369 if SMP
792 select ARM_ERRATA_775420 786 select ARM_ERRATA_775420
793 select ARM_GIC 787 select ARM_GIC
794 select COMMON_CLK
795 select CPU_V7 788 select CPU_V7
796 select HAVE_ARM_SCU if SMP 789 select HAVE_ARM_SCU if SMP
797 select HAVE_ARM_TWD if SMP 790 select HAVE_ARM_TWD if SMP
@@ -801,6 +794,8 @@ config SOC_IMX6Q
801 select HAVE_IMX_SRC 794 select HAVE_IMX_SRC
802 select HAVE_SMP 795 select HAVE_SMP
803 select MFD_SYSCON 796 select MFD_SYSCON
797 select MIGHT_HAVE_PCI
798 select PCI_DOMAINS if PCI
804 select PINCTRL 799 select PINCTRL
805 select PINCTRL_IMX6Q 800 select PINCTRL_IMX6Q
806 select PL310_ERRATA_588369 if CACHE_PL310 801 select PL310_ERRATA_588369 if CACHE_PL310
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 5383c589ad71..bbe1f5bb799c 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -102,6 +102,8 @@ obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o mach-imx6sl.o
102 102
103ifeq ($(CONFIG_PM),y) 103ifeq ($(CONFIG_PM),y)
104obj-$(CONFIG_SOC_IMX6Q) += pm-imx6q.o headsmp.o 104obj-$(CONFIG_SOC_IMX6Q) += pm-imx6q.o headsmp.o
105# i.MX6SL reuses pm-imx6q.c
106obj-$(CONFIG_SOC_IMX6SL) += pm-imx6q.o
105endif 107endif
106 108
107# i.MX5 based machines 109# i.MX5 based machines
diff --git a/arch/arm/mach-imx/anatop.c b/arch/arm/mach-imx/anatop.c
index ad3b755abb78..4a40bbb46183 100644
--- a/arch/arm/mach-imx/anatop.c
+++ b/arch/arm/mach-imx/anatop.c
@@ -16,6 +16,7 @@
16#include <linux/mfd/syscon.h> 16#include <linux/mfd/syscon.h>
17#include <linux/regmap.h> 17#include <linux/regmap.h>
18#include "common.h" 18#include "common.h"
19#include "hardware.h"
19 20
20#define REG_SET 0x4 21#define REG_SET 0x4
21#define REG_CLR 0x8 22#define REG_CLR 0x8
@@ -26,6 +27,7 @@
26#define ANADIG_USB1_CHRG_DETECT 0x1b0 27#define ANADIG_USB1_CHRG_DETECT 0x1b0
27#define ANADIG_USB2_CHRG_DETECT 0x210 28#define ANADIG_USB2_CHRG_DETECT 0x210
28#define ANADIG_DIGPROG 0x260 29#define ANADIG_DIGPROG 0x260
30#define ANADIG_DIGPROG_IMX6SL 0x280
29 31
30#define BM_ANADIG_REG_2P5_ENABLE_WEAK_LINREG 0x40000 32#define BM_ANADIG_REG_2P5_ENABLE_WEAK_LINREG 0x40000
31#define BM_ANADIG_REG_CORE_FET_ODRIVE 0x20000000 33#define BM_ANADIG_REG_CORE_FET_ODRIVE 0x20000000
@@ -76,21 +78,38 @@ static void imx_anatop_usb_chrg_detect_disable(void)
76 BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B); 78 BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B);
77} 79}
78 80
79u32 imx_anatop_get_digprog(void) 81void __init imx_init_revision_from_anatop(void)
80{ 82{
81 struct device_node *np; 83 struct device_node *np;
82 void __iomem *anatop_base; 84 void __iomem *anatop_base;
83 static u32 digprog; 85 unsigned int revision;
84 86 u32 digprog;
85 if (digprog) 87 u16 offset = ANADIG_DIGPROG;
86 return digprog;
87 88
88 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop"); 89 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop");
89 anatop_base = of_iomap(np, 0); 90 anatop_base = of_iomap(np, 0);
90 WARN_ON(!anatop_base); 91 WARN_ON(!anatop_base);
91 digprog = readl_relaxed(anatop_base + ANADIG_DIGPROG); 92 if (of_device_is_compatible(np, "fsl,imx6sl-anatop"))
93 offset = ANADIG_DIGPROG_IMX6SL;
94 digprog = readl_relaxed(anatop_base + offset);
95 iounmap(anatop_base);
96
97 switch (digprog & 0xff) {
98 case 0:
99 revision = IMX_CHIP_REVISION_1_0;
100 break;
101 case 1:
102 revision = IMX_CHIP_REVISION_1_1;
103 break;
104 case 2:
105 revision = IMX_CHIP_REVISION_1_2;
106 break;
107 default:
108 revision = IMX_CHIP_REVISION_UNKNOWN;
109 }
92 110
93 return digprog; 111 mxc_set_cpu_type(digprog >> 16 & 0xff);
112 imx_set_soc_revision(revision);
94} 113}
95 114
96void __init imx_anatop_init(void) 115void __init imx_anatop_init(void)
diff --git a/arch/arm/mach-imx/clk-fixup-mux.c b/arch/arm/mach-imx/clk-fixup-mux.c
index deb4b8093b30..0d40b35c557c 100644
--- a/arch/arm/mach-imx/clk-fixup-mux.c
+++ b/arch/arm/mach-imx/clk-fixup-mux.c
@@ -90,6 +90,7 @@ struct clk *imx_clk_fixup_mux(const char *name, void __iomem *reg,
90 init.ops = &clk_fixup_mux_ops; 90 init.ops = &clk_fixup_mux_ops;
91 init.parent_names = parents; 91 init.parent_names = parents;
92 init.num_parents = num_parents; 92 init.num_parents = num_parents;
93 init.flags = 0;
93 94
94 fixup_mux->mux.reg = reg; 95 fixup_mux->mux.reg = reg;
95 fixup_mux->mux.shift = shift; 96 fixup_mux->mux.shift = shift;
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index c3cfa4116dc0..c6b40f386786 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -285,7 +285,7 @@ int __init mx27_clocks_init(unsigned long fref)
285 clk_register_clkdev(clk[ata_ahb_gate], "ata", NULL); 285 clk_register_clkdev(clk[ata_ahb_gate], "ata", NULL);
286 clk_register_clkdev(clk[rtc_ipg_gate], NULL, "imx21-rtc"); 286 clk_register_clkdev(clk[rtc_ipg_gate], NULL, "imx21-rtc");
287 clk_register_clkdev(clk[scc_ipg_gate], "scc", NULL); 287 clk_register_clkdev(clk[scc_ipg_gate], "scc", NULL);
288 clk_register_clkdev(clk[cpu_div], NULL, "cpufreq-cpu0.0"); 288 clk_register_clkdev(clk[cpu_div], NULL, "cpu0");
289 clk_register_clkdev(clk[emi_ahb_gate], "emi_ahb" , NULL); 289 clk_register_clkdev(clk[emi_ahb_gate], "emi_ahb" , NULL);
290 290
291 mxc_timer_init(MX27_IO_ADDRESS(MX27_GPT1_BASE_ADDR), MX27_INT_GPT1); 291 mxc_timer_init(MX27_IO_ADDRESS(MX27_GPT1_BASE_ADDR), MX27_INT_GPT1);
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index 1a56a3319997..ce37af26ff8c 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -11,8 +11,12 @@
11#include <linux/clk.h> 11#include <linux/clk.h>
12#include <linux/io.h> 12#include <linux/io.h>
13#include <linux/clkdev.h> 13#include <linux/clkdev.h>
14#include <linux/clk-provider.h>
14#include <linux/of.h> 15#include <linux/of.h>
15#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/of.h>
18#include <linux/of_address.h>
19#include <linux/of_irq.h>
16 20
17#include "crm-regs-imx5.h" 21#include "crm-regs-imx5.h"
18#include "clk.h" 22#include "clk.h"
@@ -131,8 +135,6 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
131{ 135{
132 int i; 136 int i;
133 137
134 of_clk_init(NULL);
135
136 clk[dummy] = imx_clk_fixed("dummy", 0); 138 clk[dummy] = imx_clk_fixed("dummy", 0);
137 clk[ckil] = imx_obtain_fixed_clock("ckil", rate_ckil); 139 clk[ckil] = imx_obtain_fixed_clock("ckil", rate_ckil);
138 clk[osc] = imx_obtain_fixed_clock("osc", rate_osc); 140 clk[osc] = imx_obtain_fixed_clock("osc", rate_osc);
@@ -328,7 +330,7 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
328 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1"); 330 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1");
329 clk_register_clkdev(clk[ssi3_ipg_gate], NULL, "imx-ssi.2"); 331 clk_register_clkdev(clk[ssi3_ipg_gate], NULL, "imx-ssi.2");
330 clk_register_clkdev(clk[sdma_gate], NULL, "imx35-sdma"); 332 clk_register_clkdev(clk[sdma_gate], NULL, "imx35-sdma");
331 clk_register_clkdev(clk[cpu_podf], NULL, "cpufreq-cpu0.0"); 333 clk_register_clkdev(clk[cpu_podf], NULL, "cpu0");
332 clk_register_clkdev(clk[iim_gate], "iim", NULL); 334 clk_register_clkdev(clk[iim_gate], "iim", NULL);
333 clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.0"); 335 clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.0");
334 clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.1"); 336 clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.1");
@@ -397,7 +399,7 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
397 mx51_spdif_xtal_sel, ARRAY_SIZE(mx51_spdif_xtal_sel)); 399 mx51_spdif_xtal_sel, ARRAY_SIZE(mx51_spdif_xtal_sel));
398 clk[spdif1_sel] = imx_clk_mux("spdif1_sel", MXC_CCM_CSCMR2, 2, 2, 400 clk[spdif1_sel] = imx_clk_mux("spdif1_sel", MXC_CCM_CSCMR2, 2, 2,
399 spdif_sel, ARRAY_SIZE(spdif_sel)); 401 spdif_sel, ARRAY_SIZE(spdif_sel));
400 clk[spdif1_pred] = imx_clk_divider("spdif1_podf", "spdif1_sel", MXC_CCM_CDCDR, 16, 3); 402 clk[spdif1_pred] = imx_clk_divider("spdif1_pred", "spdif1_sel", MXC_CCM_CDCDR, 16, 3);
401 clk[spdif1_podf] = imx_clk_divider("spdif1_podf", "spdif1_pred", MXC_CCM_CDCDR, 9, 6); 403 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, 404 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)); 405 mx51_spdif1_com_sel, ARRAY_SIZE(mx51_spdif1_com_sel));
@@ -465,12 +467,17 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
465 return 0; 467 return 0;
466} 468}
467 469
468int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc, 470static void __init mx51_clocks_init_dt(struct device_node *np)
469 unsigned long rate_ckih1, unsigned long rate_ckih2)
470{ 471{
471 int i; 472 mx51_clocks_init(0, 0, 0, 0);
473}
474CLK_OF_DECLARE(imx51_ccm, "fsl,imx51-ccm", mx51_clocks_init_dt);
475
476static void __init mx53_clocks_init(struct device_node *np)
477{
478 int i, irq;
472 unsigned long r; 479 unsigned long r;
473 struct device_node *np; 480 void __iomem *base;
474 481
475 clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE); 482 clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE);
476 clk[pll2_sw] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE); 483 clk[pll2_sw] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE);
@@ -529,12 +536,11 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
529 pr_err("i.MX53 clk %d: register failed with %ld\n", 536 pr_err("i.MX53 clk %d: register failed with %ld\n",
530 i, PTR_ERR(clk[i])); 537 i, PTR_ERR(clk[i]));
531 538
532 np = of_find_compatible_node(NULL, NULL, "fsl,imx53-ccm");
533 clk_data.clks = clk; 539 clk_data.clks = clk;
534 clk_data.clk_num = ARRAY_SIZE(clk); 540 clk_data.clk_num = ARRAY_SIZE(clk);
535 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 541 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
536 542
537 mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2); 543 mx5_clocks_common_init(0, 0, 0, 0);
538 544
539 clk_register_clkdev(clk[vpu_gate], NULL, "imx53-vpu.0"); 545 clk_register_clkdev(clk[vpu_gate], NULL, "imx53-vpu.0");
540 clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2"); 546 clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2");
@@ -557,9 +563,6 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
557 clk_set_rate(clk[esdhc_a_podf], 200000000); 563 clk_set_rate(clk[esdhc_a_podf], 200000000);
558 clk_set_rate(clk[esdhc_b_podf], 200000000); 564 clk_set_rate(clk[esdhc_b_podf], 200000000);
559 565
560 /* System timer */
561 mxc_timer_init(MX53_IO_ADDRESS(MX53_GPT1_BASE_ADDR), MX53_INT_GPT);
562
563 clk_prepare_enable(clk[iim_gate]); 566 clk_prepare_enable(clk[iim_gate]);
564 imx_print_silicon_rev("i.MX53", mx53_revision()); 567 imx_print_silicon_rev("i.MX53", mx53_revision());
565 clk_disable_unprepare(clk[iim_gate]); 568 clk_disable_unprepare(clk[iim_gate]);
@@ -567,15 +570,10 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
567 r = clk_round_rate(clk[usboh3_per_gate], 54000000); 570 r = clk_round_rate(clk[usboh3_per_gate], 54000000);
568 clk_set_rate(clk[usboh3_per_gate], r); 571 clk_set_rate(clk[usboh3_per_gate], r);
569 572
570 return 0; 573 np = of_find_compatible_node(NULL, NULL, "fsl,imx53-gpt");
571} 574 base = of_iomap(np, 0);
572 575 WARN_ON(!base);
573int __init mx51_clocks_init_dt(void) 576 irq = irq_of_parse_and_map(np, 0);
574{ 577 mxc_timer_init(base, irq);
575 return mx51_clocks_init(0, 0, 0, 0);
576}
577
578int __init mx53_clocks_init_dt(void)
579{
580 return mx53_clocks_init(0, 0, 0, 0);
581} 578}
579CLK_OF_DECLARE(imx53_ccm, "fsl,imx53-ccm", mx53_clocks_init);
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 9181a241d3a8..d756d91fd741 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -14,7 +14,6 @@
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/clkdev.h> 16#include <linux/clkdev.h>
17#include <linux/delay.h>
18#include <linux/err.h> 17#include <linux/err.h>
19#include <linux/io.h> 18#include <linux/io.h>
20#include <linux/of.h> 19#include <linux/of.h>
@@ -25,155 +24,6 @@
25#include "common.h" 24#include "common.h"
26#include "hardware.h" 25#include "hardware.h"
27 26
28#define CCR 0x0
29#define BM_CCR_WB_COUNT (0x7 << 16)
30#define BM_CCR_RBC_BYPASS_COUNT (0x3f << 21)
31#define BM_CCR_RBC_EN (0x1 << 27)
32
33#define CCGR0 0x68
34#define CCGR1 0x6c
35#define CCGR2 0x70
36#define CCGR3 0x74
37#define CCGR4 0x78
38#define CCGR5 0x7c
39#define CCGR6 0x80
40#define CCGR7 0x84
41
42#define CLPCR 0x54
43#define BP_CLPCR_LPM 0
44#define BM_CLPCR_LPM (0x3 << 0)
45#define BM_CLPCR_BYPASS_PMIC_READY (0x1 << 2)
46#define BM_CLPCR_ARM_CLK_DIS_ON_LPM (0x1 << 5)
47#define BM_CLPCR_SBYOS (0x1 << 6)
48#define BM_CLPCR_DIS_REF_OSC (0x1 << 7)
49#define BM_CLPCR_VSTBY (0x1 << 8)
50#define BP_CLPCR_STBY_COUNT 9
51#define BM_CLPCR_STBY_COUNT (0x3 << 9)
52#define BM_CLPCR_COSC_PWRDOWN (0x1 << 11)
53#define BM_CLPCR_WB_PER_AT_LPM (0x1 << 16)
54#define BM_CLPCR_WB_CORE_AT_LPM (0x1 << 17)
55#define BM_CLPCR_BYP_MMDC_CH0_LPM_HS (0x1 << 19)
56#define BM_CLPCR_BYP_MMDC_CH1_LPM_HS (0x1 << 21)
57#define BM_CLPCR_MASK_CORE0_WFI (0x1 << 22)
58#define BM_CLPCR_MASK_CORE1_WFI (0x1 << 23)
59#define BM_CLPCR_MASK_CORE2_WFI (0x1 << 24)
60#define BM_CLPCR_MASK_CORE3_WFI (0x1 << 25)
61#define BM_CLPCR_MASK_SCU_IDLE (0x1 << 26)
62#define BM_CLPCR_MASK_L2CC_IDLE (0x1 << 27)
63
64#define CGPR 0x64
65#define BM_CGPR_CHICKEN_BIT (0x1 << 17)
66
67static void __iomem *ccm_base;
68
69void imx6q_set_chicken_bit(void)
70{
71 u32 val = readl_relaxed(ccm_base + CGPR);
72
73 val |= BM_CGPR_CHICKEN_BIT;
74 writel_relaxed(val, ccm_base + CGPR);
75}
76
77static void imx6q_enable_rbc(bool enable)
78{
79 u32 val;
80 static bool last_rbc_mode;
81
82 if (last_rbc_mode == enable)
83 return;
84 /*
85 * need to mask all interrupts in GPC before
86 * operating RBC configurations
87 */
88 imx_gpc_mask_all();
89
90 /* configure RBC enable bit */
91 val = readl_relaxed(ccm_base + CCR);
92 val &= ~BM_CCR_RBC_EN;
93 val |= enable ? BM_CCR_RBC_EN : 0;
94 writel_relaxed(val, ccm_base + CCR);
95
96 /* configure RBC count */
97 val = readl_relaxed(ccm_base + CCR);
98 val &= ~BM_CCR_RBC_BYPASS_COUNT;
99 val |= enable ? BM_CCR_RBC_BYPASS_COUNT : 0;
100 writel(val, ccm_base + CCR);
101
102 /*
103 * need to delay at least 2 cycles of CKIL(32K)
104 * due to hardware design requirement, which is
105 * ~61us, here we use 65us for safe
106 */
107 udelay(65);
108
109 /* restore GPC interrupt mask settings */
110 imx_gpc_restore_all();
111
112 last_rbc_mode = enable;
113}
114
115static void imx6q_enable_wb(bool enable)
116{
117 u32 val;
118 static bool last_wb_mode;
119
120 if (last_wb_mode == enable)
121 return;
122
123 /* configure well bias enable bit */
124 val = readl_relaxed(ccm_base + CLPCR);
125 val &= ~BM_CLPCR_WB_PER_AT_LPM;
126 val |= enable ? BM_CLPCR_WB_PER_AT_LPM : 0;
127 writel_relaxed(val, ccm_base + CLPCR);
128
129 /* configure well bias count */
130 val = readl_relaxed(ccm_base + CCR);
131 val &= ~BM_CCR_WB_COUNT;
132 val |= enable ? BM_CCR_WB_COUNT : 0;
133 writel_relaxed(val, ccm_base + CCR);
134
135 last_wb_mode = enable;
136}
137
138int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
139{
140 u32 val = readl_relaxed(ccm_base + CLPCR);
141
142 val &= ~BM_CLPCR_LPM;
143 switch (mode) {
144 case WAIT_CLOCKED:
145 imx6q_enable_wb(false);
146 imx6q_enable_rbc(false);
147 break;
148 case WAIT_UNCLOCKED:
149 val |= 0x1 << BP_CLPCR_LPM;
150 val |= BM_CLPCR_ARM_CLK_DIS_ON_LPM;
151 break;
152 case STOP_POWER_ON:
153 val |= 0x2 << BP_CLPCR_LPM;
154 break;
155 case WAIT_UNCLOCKED_POWER_OFF:
156 val |= 0x1 << BP_CLPCR_LPM;
157 val &= ~BM_CLPCR_VSTBY;
158 val &= ~BM_CLPCR_SBYOS;
159 break;
160 case STOP_POWER_OFF:
161 val |= 0x2 << BP_CLPCR_LPM;
162 val |= 0x3 << BP_CLPCR_STBY_COUNT;
163 val |= BM_CLPCR_VSTBY;
164 val |= BM_CLPCR_SBYOS;
165 imx6q_enable_wb(true);
166 imx6q_enable_rbc(true);
167 break;
168 default:
169 return -EINVAL;
170 }
171
172 writel_relaxed(val, ccm_base + CLPCR);
173
174 return 0;
175}
176
177static const char *step_sels[] = { "osc", "pll2_pfd2_396m", }; 27static const char *step_sels[] = { "osc", "pll2_pfd2_396m", };
178static const char *pll1_sw_sels[] = { "pll1_sys", "step", }; 28static const char *pll1_sw_sels[] = { "pll1_sys", "step", };
179static const char *periph_pre_sels[] = { "pll2_bus", "pll2_pfd2_396m", "pll2_pfd0_352m", "pll2_198m", }; 29static const char *periph_pre_sels[] = { "pll2_bus", "pll2_pfd2_396m", "pll2_pfd0_352m", "pll2_198m", };
@@ -182,7 +32,7 @@ static const char *periph2_clk2_sels[] = { "pll3_usb_otg", "pll2_bus", };
182static const char *periph_sels[] = { "periph_pre", "periph_clk2", }; 32static const char *periph_sels[] = { "periph_pre", "periph_clk2", };
183static const char *periph2_sels[] = { "periph2_pre", "periph2_clk2", }; 33static const char *periph2_sels[] = { "periph2_pre", "periph2_clk2", };
184static const char *axi_sels[] = { "periph", "pll2_pfd2_396m", "periph", "pll3_pfd1_540m", }; 34static const char *axi_sels[] = { "periph", "pll2_pfd2_396m", "periph", "pll3_pfd1_540m", };
185static const char *audio_sels[] = { "pll4_post_div", "pll3_pfd2_508m", "pll3_pfd3_454m", "pll3_usb_otg", }; 35static const char *audio_sels[] = { "pll4_audio_div", "pll3_pfd2_508m", "pll3_pfd3_454m", "pll3_usb_otg", };
186static const char *gpu_axi_sels[] = { "axi", "ahb", }; 36static const char *gpu_axi_sels[] = { "axi", "ahb", };
187static const char *gpu2d_core_sels[] = { "axi", "pll3_usb_otg", "pll2_pfd0_352m", "pll2_pfd2_396m", }; 37static const char *gpu2d_core_sels[] = { "axi", "pll3_usb_otg", "pll2_pfd0_352m", "pll2_pfd2_396m", };
188static const char *gpu3d_core_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll2_pfd1_594m", "pll2_pfd2_396m", }; 38static const char *gpu3d_core_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll2_pfd1_594m", "pll2_pfd2_396m", };
@@ -196,7 +46,7 @@ static const char *ipu2_di0_sels[] = { "ipu2_di0_pre", "dummy", "dummy", "ldb_di
196static const char *ipu2_di1_sels[] = { "ipu2_di1_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", }; 46static const char *ipu2_di1_sels[] = { "ipu2_di1_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", };
197static const char *hsi_tx_sels[] = { "pll3_120m", "pll2_pfd2_396m", }; 47static const char *hsi_tx_sels[] = { "pll3_120m", "pll2_pfd2_396m", };
198static const char *pcie_axi_sels[] = { "axi", "ahb", }; 48static const char *pcie_axi_sels[] = { "axi", "ahb", };
199static const char *ssi_sels[] = { "pll3_pfd2_508m", "pll3_pfd3_454m", "pll4_post_div", }; 49static const char *ssi_sels[] = { "pll3_pfd2_508m", "pll3_pfd3_454m", "pll4_audio_div", };
200static const char *usdhc_sels[] = { "pll2_pfd2_396m", "pll2_pfd0_352m", }; 50static const char *usdhc_sels[] = { "pll2_pfd2_396m", "pll2_pfd0_352m", };
201static const char *enfc_sels[] = { "pll2_pfd0_352m", "pll2_bus", "pll3_usb_otg", "pll2_pfd2_396m", }; 51static const char *enfc_sels[] = { "pll2_pfd0_352m", "pll2_bus", "pll3_usb_otg", "pll2_pfd2_396m", };
202static const char *emi_sels[] = { "pll2_pfd2_396m", "pll3_usb_otg", "axi", "pll2_pfd0_352m", }; 52static const char *emi_sels[] = { "pll2_pfd2_396m", "pll3_usb_otg", "axi", "pll2_pfd0_352m", };
@@ -205,7 +55,7 @@ static const char *vdo_axi_sels[] = { "axi", "ahb", };
205static const char *vpu_axi_sels[] = { "axi", "pll2_pfd2_396m", "pll2_pfd0_352m", }; 55static const char *vpu_axi_sels[] = { "axi", "pll2_pfd2_396m", "pll2_pfd0_352m", };
206static const char *cko1_sels[] = { "pll3_usb_otg", "pll2_bus", "pll1_sys", "pll5_video_div", 56static const char *cko1_sels[] = { "pll3_usb_otg", "pll2_bus", "pll1_sys", "pll5_video_div",
207 "dummy", "axi", "enfc", "ipu1_di0", "ipu1_di1", "ipu2_di0", 57 "dummy", "axi", "enfc", "ipu1_di0", "ipu1_di1", "ipu2_di0",
208 "ipu2_di1", "ahb", "ipg", "ipg_per", "ckil", "pll4_post_div", }; 58 "ipu2_di1", "ahb", "ipg", "ipg_per", "ckil", "pll4_audio_div", };
209static const char *cko2_sels[] = { 59static const char *cko2_sels[] = {
210 "mmdc_ch0_axi", "mmdc_ch1_axi", "usdhc4", "usdhc1", 60 "mmdc_ch0_axi", "mmdc_ch1_axi", "usdhc4", "usdhc1",
211 "gpu2d_axi", "dummy", "ecspi_root", "gpu3d_axi", 61 "gpu2d_axi", "dummy", "ecspi_root", "gpu3d_axi",
@@ -217,6 +67,11 @@ static const char *cko2_sels[] = {
217 "uart_serial", "spdif", "asrc", "hsi_tx", 67 "uart_serial", "spdif", "asrc", "hsi_tx",
218}; 68};
219static const char *cko_sels[] = { "cko1", "cko2", }; 69static const char *cko_sels[] = { "cko1", "cko2", };
70static const char *lvds_sels[] = {
71 "dummy", "dummy", "dummy", "dummy", "dummy", "dummy",
72 "pll4_audio", "pll5_video", "pll8_mlb", "enet_ref",
73 "pcie_ref", "sata_ref",
74};
220 75
221enum mx6q_clks { 76enum mx6q_clks {
222 dummy, ckil, ckih, osc, pll2_pfd0_352m, pll2_pfd1_594m, pll2_pfd2_396m, 77 dummy, ckil, ckih, osc, pll2_pfd0_352m, pll2_pfd1_594m, pll2_pfd2_396m,
@@ -251,7 +106,8 @@ enum mx6q_clks {
251 ssi2_ipg, ssi3_ipg, rom, usbphy1, usbphy2, ldb_di0_div_3_5, ldb_di1_div_3_5, 106 ssi2_ipg, ssi3_ipg, rom, usbphy1, usbphy2, ldb_di0_div_3_5, ldb_di1_div_3_5,
252 sata_ref, sata_ref_100m, pcie_ref, pcie_ref_125m, enet_ref, usbphy1_gate, 107 sata_ref, sata_ref_100m, pcie_ref, pcie_ref_125m, enet_ref, usbphy1_gate,
253 usbphy2_gate, pll4_post_div, pll5_post_div, pll5_video_div, eim_slow, 108 usbphy2_gate, pll4_post_div, pll5_post_div, pll5_video_div, eim_slow,
254 spdif, cko2_sel, cko2_podf, cko2, cko, vdoa, clk_max 109 spdif, cko2_sel, cko2_podf, cko2, cko, vdoa, pll4_audio_div,
110 lvds1_sel, lvds2_sel, lvds1_gate, lvds2_gate, clk_max
255}; 111};
256 112
257static struct clk *clk[clk_max]; 113static struct clk *clk[clk_max];
@@ -300,7 +156,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
300 WARN_ON(!base); 156 WARN_ON(!base);
301 157
302 /* Audio/video PLL post dividers do not work on i.MX6q revision 1.0 */ 158 /* Audio/video PLL post dividers do not work on i.MX6q revision 1.0 */
303 if (cpu_is_imx6q() && imx6q_revision() == IMX_CHIP_REVISION_1_0) { 159 if (cpu_is_imx6q() && imx_get_soc_revision() == IMX_CHIP_REVISION_1_0) {
304 post_div_table[1].div = 1; 160 post_div_table[1].div = 1;
305 post_div_table[2].div = 1; 161 post_div_table[2].div = 1;
306 video_div_table[1].div = 1; 162 video_div_table[1].div = 1;
@@ -342,6 +198,18 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
342 base + 0xe0, 0, 2, 0, clk_enet_ref_table, 198 base + 0xe0, 0, 2, 0, clk_enet_ref_table,
343 &imx_ccm_lock); 199 &imx_ccm_lock);
344 200
201 clk[lvds1_sel] = imx_clk_mux("lvds1_sel", base + 0x160, 0, 5, lvds_sels, ARRAY_SIZE(lvds_sels));
202 clk[lvds2_sel] = imx_clk_mux("lvds2_sel", base + 0x160, 5, 5, lvds_sels, ARRAY_SIZE(lvds_sels));
203
204 /*
205 * lvds1_gate and lvds2_gate are pseudo-gates. Both can be
206 * independently configured as clock inputs or outputs. We treat
207 * the "output_enable" bit as a gate, even though it's really just
208 * enabling clock output.
209 */
210 clk[lvds1_gate] = imx_clk_gate("lvds1_gate", "dummy", base + 0x160, 10);
211 clk[lvds2_gate] = imx_clk_gate("lvds2_gate", "dummy", base + 0x160, 11);
212
345 /* name parent_name reg idx */ 213 /* name parent_name reg idx */
346 clk[pll2_pfd0_352m] = imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0); 214 clk[pll2_pfd0_352m] = imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0);
347 clk[pll2_pfd1_594m] = imx_clk_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1); 215 clk[pll2_pfd1_594m] = imx_clk_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1);
@@ -359,13 +227,15 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
359 clk[twd] = imx_clk_fixed_factor("twd", "arm", 1, 2); 227 clk[twd] = imx_clk_fixed_factor("twd", "arm", 1, 2);
360 228
361 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); 229 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);
230 clk[pll4_audio_div] = clk_register_divider(NULL, "pll4_audio_div", "pll4_post_div", CLK_SET_RATE_PARENT, base + 0x170, 15, 1, 0, &imx_ccm_lock);
362 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); 231 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);
363 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); 232 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);
364 233
365 np = ccm_node; 234 np = ccm_node;
366 base = of_iomap(np, 0); 235 base = of_iomap(np, 0);
367 WARN_ON(!base); 236 WARN_ON(!base);
368 ccm_base = base; 237
238 imx6q_pm_set_ccm_base(base);
369 239
370 /* name reg shift width parent_names num_parents */ 240 /* name reg shift width parent_names num_parents */
371 clk[step] = imx_clk_mux("step", base + 0xc, 8, 1, step_sels, ARRAY_SIZE(step_sels)); 241 clk[step] = imx_clk_mux("step", base + 0xc, 8, 1, step_sels, ARRAY_SIZE(step_sels));
@@ -573,7 +443,8 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
573 clk_register_clkdev(clk[pll4_post_div], "pll4_post_div", NULL); 443 clk_register_clkdev(clk[pll4_post_div], "pll4_post_div", NULL);
574 clk_register_clkdev(clk[pll4_audio], "pll4_audio", NULL); 444 clk_register_clkdev(clk[pll4_audio], "pll4_audio", NULL);
575 445
576 if ((imx6q_revision() != IMX_CHIP_REVISION_1_0) || cpu_is_imx6dl()) { 446 if ((imx_get_soc_revision() != IMX_CHIP_REVISION_1_0) ||
447 cpu_is_imx6dl()) {
577 clk_set_parent(clk[ldb_di0_sel], clk[pll5_video_div]); 448 clk_set_parent(clk[ldb_di0_sel], clk[pll5_video_div]);
578 clk_set_parent(clk[ldb_di1_sel], clk[pll5_video_div]); 449 clk_set_parent(clk[ldb_di1_sel], clk[pll5_video_div]);
579 } 450 }
@@ -603,8 +474,9 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
603 if (ret) 474 if (ret)
604 pr_warn("failed to set up CLKO: %d\n", ret); 475 pr_warn("failed to set up CLKO: %d\n", ret);
605 476
606 /* Set initial power mode */ 477 /* All existing boards with PCIe use LVDS1 */
607 imx6q_set_lpm(WAIT_CLOCKED); 478 if (IS_ENABLED(CONFIG_PCI_IMX6))
479 clk_set_parent(clk[lvds1_sel], clk[sata_ref]);
608 480
609 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"); 481 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt");
610 base = of_iomap(np, 0); 482 base = of_iomap(np, 0);
diff --git a/arch/arm/mach-imx/clk-imx6sl.c b/arch/arm/mach-imx/clk-imx6sl.c
index a5c3c5d21aee..c0c4ef55e35b 100644
--- a/arch/arm/mach-imx/clk-imx6sl.c
+++ b/arch/arm/mach-imx/clk-imx6sl.c
@@ -127,6 +127,9 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
127 base = of_iomap(np, 0); 127 base = of_iomap(np, 0);
128 WARN_ON(!base); 128 WARN_ON(!base);
129 129
130 /* Reuse imx6q pm code */
131 imx6q_pm_set_ccm_base(base);
132
130 /* name reg shift width parent_names num_parents */ 133 /* 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)); 134 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)); 135 clks[IMX6SL_CLK_PLL1_SW] = imx_clk_mux("pll1_sw", base + 0xc, 2, 1, pll1_sw_sels, ARRAY_SIZE(pll1_sw_sels));
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 4517fd760bfc..7cbe22d0c6e9 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -13,74 +13,73 @@
13 13
14#include <linux/reboot.h> 14#include <linux/reboot.h>
15 15
16struct irq_data;
16struct platform_device; 17struct platform_device;
17struct pt_regs; 18struct pt_regs;
18struct clk; 19struct clk;
19enum mxc_cpu_pwr_mode; 20enum mxc_cpu_pwr_mode;
20 21
21extern void mx1_map_io(void); 22void mx1_map_io(void);
22extern void mx21_map_io(void); 23void mx21_map_io(void);
23extern void mx25_map_io(void); 24void mx25_map_io(void);
24extern void mx27_map_io(void); 25void mx27_map_io(void);
25extern void mx31_map_io(void); 26void mx31_map_io(void);
26extern void mx35_map_io(void); 27void mx35_map_io(void);
27extern void mx51_map_io(void); 28void mx51_map_io(void);
28extern void mx53_map_io(void); 29void mx53_map_io(void);
29extern void imx1_init_early(void); 30void imx1_init_early(void);
30extern void imx21_init_early(void); 31void imx21_init_early(void);
31extern void imx25_init_early(void); 32void imx25_init_early(void);
32extern void imx27_init_early(void); 33void imx27_init_early(void);
33extern void imx31_init_early(void); 34void imx31_init_early(void);
34extern void imx35_init_early(void); 35void imx35_init_early(void);
35extern void imx51_init_early(void); 36void imx51_init_early(void);
36extern void imx53_init_early(void); 37void imx53_init_early(void);
37extern void mxc_init_irq(void __iomem *); 38void mxc_init_irq(void __iomem *);
38extern void tzic_init_irq(void __iomem *); 39void tzic_init_irq(void __iomem *);
39extern void mx1_init_irq(void); 40void mx1_init_irq(void);
40extern void mx21_init_irq(void); 41void mx21_init_irq(void);
41extern void mx25_init_irq(void); 42void mx25_init_irq(void);
42extern void mx27_init_irq(void); 43void mx27_init_irq(void);
43extern void mx31_init_irq(void); 44void mx31_init_irq(void);
44extern void mx35_init_irq(void); 45void mx35_init_irq(void);
45extern void mx51_init_irq(void); 46void mx51_init_irq(void);
46extern void mx53_init_irq(void); 47void mx53_init_irq(void);
47extern void imx1_soc_init(void); 48void imx1_soc_init(void);
48extern void imx21_soc_init(void); 49void imx21_soc_init(void);
49extern void imx25_soc_init(void); 50void imx25_soc_init(void);
50extern void imx27_soc_init(void); 51void imx27_soc_init(void);
51extern void imx31_soc_init(void); 52void imx31_soc_init(void);
52extern void imx35_soc_init(void); 53void imx35_soc_init(void);
53extern void imx51_soc_init(void); 54void imx51_soc_init(void);
54extern void imx51_init_late(void); 55void imx51_init_late(void);
55extern void imx53_init_late(void); 56void imx53_init_late(void);
56extern void epit_timer_init(void __iomem *base, int irq); 57void epit_timer_init(void __iomem *base, int irq);
57extern void mxc_timer_init(void __iomem *, int); 58void mxc_timer_init(void __iomem *, int);
58extern int mx1_clocks_init(unsigned long fref); 59int mx1_clocks_init(unsigned long fref);
59extern int mx21_clocks_init(unsigned long lref, unsigned long fref); 60int mx21_clocks_init(unsigned long lref, unsigned long fref);
60extern int mx25_clocks_init(void); 61int mx25_clocks_init(void);
61extern int mx27_clocks_init(unsigned long fref); 62int mx27_clocks_init(unsigned long fref);
62extern int mx31_clocks_init(unsigned long fref); 63int mx31_clocks_init(unsigned long fref);
63extern int mx35_clocks_init(void); 64int mx35_clocks_init(void);
64extern int mx51_clocks_init(unsigned long ckil, unsigned long osc, 65int mx51_clocks_init(unsigned long ckil, unsigned long osc,
65 unsigned long ckih1, unsigned long ckih2); 66 unsigned long ckih1, unsigned long ckih2);
66extern int mx53_clocks_init(unsigned long ckil, unsigned long osc, 67int mx25_clocks_init_dt(void);
67 unsigned long ckih1, unsigned long ckih2); 68int mx27_clocks_init_dt(void);
68extern int mx25_clocks_init_dt(void); 69int mx31_clocks_init_dt(void);
69extern int mx27_clocks_init_dt(void); 70struct platform_device *mxc_register_gpio(char *name, int id,
70extern int mx31_clocks_init_dt(void);
71extern int mx51_clocks_init_dt(void);
72extern int mx53_clocks_init_dt(void);
73extern struct platform_device *mxc_register_gpio(char *name, int id,
74 resource_size_t iobase, resource_size_t iosize, int irq, int irq_high); 71 resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
75extern void mxc_set_cpu_type(unsigned int type); 72void mxc_set_cpu_type(unsigned int type);
76extern void mxc_restart(enum reboot_mode, const char *); 73void mxc_restart(enum reboot_mode, const char *);
77extern void mxc_arch_reset_init(void __iomem *); 74void mxc_arch_reset_init(void __iomem *);
78extern void mxc_arch_reset_init_dt(void); 75void mxc_arch_reset_init_dt(void);
79extern int mx53_revision(void); 76int mx53_revision(void);
80extern int imx6q_revision(void); 77void imx_set_aips(void __iomem *);
81extern int mx53_display_revision(void); 78int mxc_device_init(void);
82extern void imx_set_aips(void __iomem *); 79void imx_set_soc_revision(unsigned int rev);
83extern int mxc_device_init(void); 80unsigned int imx_get_soc_revision(void);
81void imx_init_revision_from_anatop(void);
82struct device *imx_soc_device_init(void);
84 83
85enum mxc_cpu_pwr_mode { 84enum mxc_cpu_pwr_mode {
86 WAIT_CLOCKED, /* wfi only */ 85 WAIT_CLOCKED, /* wfi only */
@@ -97,8 +96,8 @@ enum mx3_cpu_pwr_mode {
97 MX3_SLEEP, 96 MX3_SLEEP,
98}; 97};
99 98
100extern void mx3_cpu_lp_set(enum mx3_cpu_pwr_mode mode); 99void mx3_cpu_lp_set(enum mx3_cpu_pwr_mode mode);
101extern void imx_print_silicon_rev(const char *cpu, int srev); 100void imx_print_silicon_rev(const char *cpu, int srev);
102 101
103void avic_handle_irq(struct pt_regs *); 102void avic_handle_irq(struct pt_regs *);
104void tzic_handle_irq(struct pt_regs *); 103void tzic_handle_irq(struct pt_regs *);
@@ -112,54 +111,61 @@ void tzic_handle_irq(struct pt_regs *);
112#define imx51_handle_irq tzic_handle_irq 111#define imx51_handle_irq tzic_handle_irq
113#define imx53_handle_irq tzic_handle_irq 112#define imx53_handle_irq tzic_handle_irq
114 113
115extern void imx_enable_cpu(int cpu, bool enable); 114void imx_enable_cpu(int cpu, bool enable);
116extern void imx_set_cpu_jump(int cpu, void *jump_addr); 115void imx_set_cpu_jump(int cpu, void *jump_addr);
117extern u32 imx_get_cpu_arg(int cpu); 116u32 imx_get_cpu_arg(int cpu);
118extern void imx_set_cpu_arg(int cpu, u32 arg); 117void imx_set_cpu_arg(int cpu, u32 arg);
119extern void v7_cpu_resume(void); 118void v7_cpu_resume(void);
120#ifdef CONFIG_SMP 119#ifdef CONFIG_SMP
121extern void v7_secondary_startup(void); 120void v7_secondary_startup(void);
122extern void imx_scu_map_io(void); 121void imx_scu_map_io(void);
123extern void imx_smp_prepare(void); 122void imx_smp_prepare(void);
124extern void imx_scu_standby_enable(void); 123void imx_scu_standby_enable(void);
125#else 124#else
126static inline void imx_scu_map_io(void) {} 125static inline void imx_scu_map_io(void) {}
127static inline void imx_smp_prepare(void) {} 126static inline void imx_smp_prepare(void) {}
128static inline void imx_scu_standby_enable(void) {} 127static inline void imx_scu_standby_enable(void) {}
129#endif 128#endif
130extern void imx_src_init(void); 129void imx_src_init(void);
131extern void imx_src_prepare_restart(void); 130#ifdef CONFIG_HAVE_IMX_SRC
132extern void imx_gpc_init(void); 131void imx_src_prepare_restart(void);
133extern void imx_gpc_pre_suspend(void); 132#else
134extern void imx_gpc_post_resume(void); 133static inline void imx_src_prepare_restart(void) {}
135extern void imx_gpc_mask_all(void); 134#endif
136extern void imx_gpc_restore_all(void); 135void imx_gpc_init(void);
137extern void imx_anatop_init(void); 136void imx_gpc_pre_suspend(void);
138extern void imx_anatop_pre_suspend(void); 137void imx_gpc_post_resume(void);
139extern void imx_anatop_post_resume(void); 138void imx_gpc_mask_all(void);
140extern u32 imx_anatop_get_digprog(void); 139void imx_gpc_restore_all(void);
141extern int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode); 140void imx_gpc_irq_mask(struct irq_data *d);
142extern void imx6q_set_chicken_bit(void); 141void imx_gpc_irq_unmask(struct irq_data *d);
143 142void imx_anatop_init(void);
144extern void imx_cpu_die(unsigned int cpu); 143void imx_anatop_pre_suspend(void);
145extern int imx_cpu_kill(unsigned int cpu); 144void imx_anatop_post_resume(void);
145int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode);
146void imx6q_set_chicken_bit(void);
147
148void imx_cpu_die(unsigned int cpu);
149int imx_cpu_kill(unsigned int cpu);
146 150
147#ifdef CONFIG_PM 151#ifdef CONFIG_PM
148extern void imx6q_pm_init(void); 152void imx6q_pm_init(void);
149extern void imx5_pm_init(void); 153void imx6q_pm_set_ccm_base(void __iomem *base);
154void imx5_pm_init(void);
150#else 155#else
151static inline void imx6q_pm_init(void) {} 156static inline void imx6q_pm_init(void) {}
157static inline void imx6q_pm_set_ccm_base(void __iomem *base) {}
152static inline void imx5_pm_init(void) {} 158static inline void imx5_pm_init(void) {}
153#endif 159#endif
154 160
155#ifdef CONFIG_NEON 161#ifdef CONFIG_NEON
156extern int mx51_neon_fixup(void); 162int mx51_neon_fixup(void);
157#else 163#else
158static inline int mx51_neon_fixup(void) { return 0; } 164static inline int mx51_neon_fixup(void) { return 0; }
159#endif 165#endif
160 166
161#ifdef CONFIG_CACHE_L2X0 167#ifdef CONFIG_CACHE_L2X0
162extern void imx_init_l2cache(void); 168void imx_init_l2cache(void);
163#else 169#else
164static inline void imx_init_l2cache(void) {} 170static inline void imx_init_l2cache(void) {}
165#endif 171#endif
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index e70e3acbf9bd..ba3b498a67ec 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -1,6 +1,9 @@
1 1#include <linux/err.h>
2#include <linux/module.h> 2#include <linux/module.h>
3#include <linux/io.h> 3#include <linux/io.h>
4#include <linux/of.h>
5#include <linux/slab.h>
6#include <linux/sys_soc.h>
4 7
5#include "hardware.h" 8#include "hardware.h"
6#include "common.h" 9#include "common.h"
@@ -8,11 +11,23 @@
8unsigned int __mxc_cpu_type; 11unsigned int __mxc_cpu_type;
9EXPORT_SYMBOL(__mxc_cpu_type); 12EXPORT_SYMBOL(__mxc_cpu_type);
10 13
14static unsigned int imx_soc_revision;
15
11void mxc_set_cpu_type(unsigned int type) 16void mxc_set_cpu_type(unsigned int type)
12{ 17{
13 __mxc_cpu_type = type; 18 __mxc_cpu_type = type;
14} 19}
15 20
21void imx_set_soc_revision(unsigned int rev)
22{
23 imx_soc_revision = rev;
24}
25
26unsigned int imx_get_soc_revision(void)
27{
28 return imx_soc_revision;
29}
30
16void imx_print_silicon_rev(const char *cpu, int srev) 31void imx_print_silicon_rev(const char *cpu, int srev)
17{ 32{
18 if (srev == IMX_CHIP_REVISION_UNKNOWN) 33 if (srev == IMX_CHIP_REVISION_UNKNOWN)
@@ -44,3 +59,81 @@ void __init imx_set_aips(void __iomem *base)
44 reg = __raw_readl(base + 0x50) & 0x00FFFFFF; 59 reg = __raw_readl(base + 0x50) & 0x00FFFFFF;
45 __raw_writel(reg, base + 0x50); 60 __raw_writel(reg, base + 0x50);
46} 61}
62
63struct device * __init imx_soc_device_init(void)
64{
65 struct soc_device_attribute *soc_dev_attr;
66 struct soc_device *soc_dev;
67 struct device_node *root;
68 const char *soc_id;
69 int ret;
70
71 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
72 if (!soc_dev_attr)
73 return NULL;
74
75 soc_dev_attr->family = "Freescale i.MX";
76
77 root = of_find_node_by_path("/");
78 ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
79 of_node_put(root);
80 if (ret)
81 goto free_soc;
82
83 switch (__mxc_cpu_type) {
84 case MXC_CPU_MX1:
85 soc_id = "i.MX1";
86 break;
87 case MXC_CPU_MX21:
88 soc_id = "i.MX21";
89 break;
90 case MXC_CPU_MX25:
91 soc_id = "i.MX25";
92 break;
93 case MXC_CPU_MX27:
94 soc_id = "i.MX27";
95 break;
96 case MXC_CPU_MX31:
97 soc_id = "i.MX31";
98 break;
99 case MXC_CPU_MX35:
100 soc_id = "i.MX35";
101 break;
102 case MXC_CPU_MX51:
103 soc_id = "i.MX51";
104 break;
105 case MXC_CPU_MX53:
106 soc_id = "i.MX53";
107 break;
108 case MXC_CPU_IMX6SL:
109 soc_id = "i.MX6SL";
110 break;
111 case MXC_CPU_IMX6DL:
112 soc_id = "i.MX6DL";
113 break;
114 case MXC_CPU_IMX6Q:
115 soc_id = "i.MX6Q";
116 break;
117 default:
118 soc_id = "Unknown";
119 }
120 soc_dev_attr->soc_id = soc_id;
121
122 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d.%d",
123 (imx_soc_revision >> 4) & 0xf,
124 imx_soc_revision & 0xf);
125 if (!soc_dev_attr->revision)
126 goto free_soc;
127
128 soc_dev = soc_device_register(soc_dev_attr);
129 if (IS_ERR(soc_dev))
130 goto free_rev;
131
132 return soc_device_to_device(soc_dev);
133
134free_rev:
135 kfree(soc_dev_attr->revision);
136free_soc:
137 kfree(soc_dev_attr);
138 return NULL;
139}
diff --git a/arch/arm/mach-imx/epit.c b/arch/arm/mach-imx/epit.c
index e02de188ae83..074b1a81ba76 100644
--- a/arch/arm/mach-imx/epit.c
+++ b/arch/arm/mach-imx/epit.c
@@ -171,7 +171,7 @@ static irqreturn_t epit_timer_interrupt(int irq, void *dev_id)
171 171
172static struct irqaction epit_timer_irq = { 172static struct irqaction epit_timer_irq = {
173 .name = "i.MX EPIT Timer Tick", 173 .name = "i.MX EPIT Timer Tick",
174 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 174 .flags = IRQF_TIMER | IRQF_IRQPOLL,
175 .handler = epit_timer_interrupt, 175 .handler = epit_timer_interrupt,
176}; 176};
177 177
diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c
index 44a65e9ff1fc..586e0171a652 100644
--- a/arch/arm/mach-imx/gpc.c
+++ b/arch/arm/mach-imx/gpc.c
@@ -90,7 +90,7 @@ void imx_gpc_restore_all(void)
90 writel_relaxed(gpc_saved_imrs[i], reg_imr1 + i * 4); 90 writel_relaxed(gpc_saved_imrs[i], reg_imr1 + i * 4);
91} 91}
92 92
93static void imx_gpc_irq_unmask(struct irq_data *d) 93void imx_gpc_irq_unmask(struct irq_data *d)
94{ 94{
95 void __iomem *reg; 95 void __iomem *reg;
96 u32 val; 96 u32 val;
@@ -105,7 +105,7 @@ static void imx_gpc_irq_unmask(struct irq_data *d)
105 writel_relaxed(val, reg); 105 writel_relaxed(val, reg);
106} 106}
107 107
108static void imx_gpc_irq_mask(struct irq_data *d) 108void imx_gpc_irq_mask(struct irq_data *d)
109{ 109{
110 void __iomem *reg; 110 void __iomem *reg;
111 u32 val; 111 u32 val;
diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c
index 3daf1ed90579..b35e99cc5e5b 100644
--- a/arch/arm/mach-imx/hotplug.c
+++ b/arch/arm/mach-imx/hotplug.c
@@ -52,7 +52,9 @@ void imx_cpu_die(unsigned int cpu)
52 * the register being cleared to kill the cpu. 52 * the register being cleared to kill the cpu.
53 */ 53 */
54 imx_set_cpu_arg(cpu, ~0); 54 imx_set_cpu_arg(cpu, ~0);
55 cpu_do_idle(); 55
56 while (1)
57 cpu_do_idle();
56} 58}
57 59
58int imx_cpu_kill(unsigned int cpu) 60int imx_cpu_kill(unsigned int cpu)
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
index 53e43e579dd7..bece8a65e6f0 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/imx51-dt.c
@@ -34,17 +34,11 @@ static const char *imx51_dt_board_compat[] __initdata = {
34 NULL 34 NULL
35}; 35};
36 36
37static void __init imx51_timer_init(void)
38{
39 mx51_clocks_init_dt();
40}
41
42DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)") 37DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)")
43 .map_io = mx51_map_io, 38 .map_io = mx51_map_io,
44 .init_early = imx51_init_early, 39 .init_early = imx51_init_early,
45 .init_irq = mx51_init_irq, 40 .init_irq = mx51_init_irq,
46 .handle_irq = imx51_handle_irq, 41 .handle_irq = imx51_handle_irq,
47 .init_time = imx51_timer_init,
48 .init_machine = imx51_dt_init, 42 .init_machine = imx51_dt_init,
49 .init_late = imx51_init_late, 43 .init_late = imx51_init_late,
50 .dt_compat = imx51_dt_board_compat, 44 .dt_compat = imx51_dt_board_compat,
diff --git a/arch/arm/mach-imx/mach-armadillo5x0.c b/arch/arm/mach-imx/mach-armadillo5x0.c
index 368a6e3f5926..58b864a3fc20 100644
--- a/arch/arm/mach-imx/mach-armadillo5x0.c
+++ b/arch/arm/mach-imx/mach-armadillo5x0.c
@@ -404,8 +404,7 @@ static int armadillo5x0_sdhc1_init(struct device *dev,
404 404
405 /* When supported the trigger type have to be BOTH */ 405 /* When supported the trigger type have to be BOTH */
406 ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_ATA_DMACK)), 406 ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_ATA_DMACK)),
407 detect_irq, 407 detect_irq, IRQF_TRIGGER_FALLING,
408 IRQF_DISABLED | IRQF_TRIGGER_FALLING,
409 "sdhc-detect", data); 408 "sdhc-detect", data);
410 409
411 if (ret) 410 if (ret)
diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c
index 98c58944015a..c9c4d8d96931 100644
--- a/arch/arm/mach-imx/mach-imx53.c
+++ b/arch/arm/mach-imx/mach-imx53.c
@@ -36,17 +36,11 @@ static const char *imx53_dt_board_compat[] __initdata = {
36 NULL 36 NULL
37}; 37};
38 38
39static void __init imx53_timer_init(void)
40{
41 mx53_clocks_init_dt();
42}
43
44DT_MACHINE_START(IMX53_DT, "Freescale i.MX53 (Device Tree Support)") 39DT_MACHINE_START(IMX53_DT, "Freescale i.MX53 (Device Tree Support)")
45 .map_io = mx53_map_io, 40 .map_io = mx53_map_io,
46 .init_early = imx53_init_early, 41 .init_early = imx53_init_early,
47 .init_irq = mx53_init_irq, 42 .init_irq = mx53_init_irq,
48 .handle_irq = imx53_handle_irq, 43 .handle_irq = imx53_handle_irq,
49 .init_time = imx53_timer_init,
50 .init_machine = imx53_dt_init, 44 .init_machine = imx53_dt_init,
51 .init_late = imx53_init_late, 45 .init_late = imx53_init_late,
52 .dt_compat = imx53_dt_board_compat, 46 .dt_compat = imx53_dt_board_compat,
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 85a1b51346c8..d0cfb225ec9a 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -11,11 +11,8 @@
11 */ 11 */
12 12
13#include <linux/clk.h> 13#include <linux/clk.h>
14#include <linux/clk-provider.h>
15#include <linux/clkdev.h> 14#include <linux/clkdev.h>
16#include <linux/clocksource.h>
17#include <linux/cpu.h> 15#include <linux/cpu.h>
18#include <linux/delay.h>
19#include <linux/export.h> 16#include <linux/export.h>
20#include <linux/init.h> 17#include <linux/init.h>
21#include <linux/io.h> 18#include <linux/io.h>
@@ -25,7 +22,7 @@
25#include <linux/of_address.h> 22#include <linux/of_address.h>
26#include <linux/of_irq.h> 23#include <linux/of_irq.h>
27#include <linux/of_platform.h> 24#include <linux/of_platform.h>
28#include <linux/opp.h> 25#include <linux/pm_opp.h>
29#include <linux/phy.h> 26#include <linux/phy.h>
30#include <linux/reboot.h> 27#include <linux/reboot.h>
31#include <linux/regmap.h> 28#include <linux/regmap.h>
@@ -40,64 +37,6 @@
40#include "cpuidle.h" 37#include "cpuidle.h"
41#include "hardware.h" 38#include "hardware.h"
42 39
43static u32 chip_revision;
44
45int imx6q_revision(void)
46{
47 return chip_revision;
48}
49
50static void __init imx6q_init_revision(void)
51{
52 u32 rev = imx_anatop_get_digprog();
53
54 switch (rev & 0xff) {
55 case 0:
56 chip_revision = IMX_CHIP_REVISION_1_0;
57 break;
58 case 1:
59 chip_revision = IMX_CHIP_REVISION_1_1;
60 break;
61 case 2:
62 chip_revision = IMX_CHIP_REVISION_1_2;
63 break;
64 default:
65 chip_revision = IMX_CHIP_REVISION_UNKNOWN;
66 }
67
68 mxc_set_cpu_type(rev >> 16 & 0xff);
69}
70
71static void imx6q_restart(enum reboot_mode mode, const char *cmd)
72{
73 struct device_node *np;
74 void __iomem *wdog_base;
75
76 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-wdt");
77 wdog_base = of_iomap(np, 0);
78 if (!wdog_base)
79 goto soft;
80
81 imx_src_prepare_restart();
82
83 /* enable wdog */
84 writew_relaxed(1 << 2, wdog_base);
85 /* write twice to ensure the request will not get ignored */
86 writew_relaxed(1 << 2, wdog_base);
87
88 /* wait for reset to assert ... */
89 mdelay(500);
90
91 pr_err("Watchdog reset failed to assert reset\n");
92
93 /* delay to allow the serial port to show the message */
94 mdelay(50);
95
96soft:
97 /* we'll take a jump through zero as a poor second */
98 soft_restart(0);
99}
100
101/* For imx6q sabrelite board: set KSZ9021RN RGMII pad skew */ 40/* For imx6q sabrelite board: set KSZ9021RN RGMII pad skew */
102static int ksz9021rn_phy_fixup(struct phy_device *phydev) 41static int ksz9021rn_phy_fixup(struct phy_device *phydev)
103{ 42{
@@ -192,9 +131,20 @@ static void __init imx6q_1588_init(void)
192 131
193static void __init imx6q_init_machine(void) 132static void __init imx6q_init_machine(void)
194{ 133{
134 struct device *parent;
135
136 imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q",
137 imx_get_soc_revision());
138
139 mxc_arch_reset_init_dt();
140
141 parent = imx_soc_device_init();
142 if (parent == NULL)
143 pr_warn("failed to initialize soc device\n");
144
195 imx6q_enet_phy_init(); 145 imx6q_enet_phy_init();
196 146
197 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 147 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
198 148
199 imx_anatop_init(); 149 imx_anatop_init();
200 imx6q_pm_init(); 150 imx6q_pm_init();
@@ -226,17 +176,22 @@ static void __init imx6q_opp_check_1p2ghz(struct device *cpu_dev)
226 val = readl_relaxed(base + OCOTP_CFG3); 176 val = readl_relaxed(base + OCOTP_CFG3);
227 val >>= OCOTP_CFG3_SPEED_SHIFT; 177 val >>= OCOTP_CFG3_SPEED_SHIFT;
228 if ((val & 0x3) != OCOTP_CFG3_SPEED_1P2GHZ) 178 if ((val & 0x3) != OCOTP_CFG3_SPEED_1P2GHZ)
229 if (opp_disable(cpu_dev, 1200000000)) 179 if (dev_pm_opp_disable(cpu_dev, 1200000000))
230 pr_warn("failed to disable 1.2 GHz OPP\n"); 180 pr_warn("failed to disable 1.2 GHz OPP\n");
231 181
232put_node: 182put_node:
233 of_node_put(np); 183 of_node_put(np);
234} 184}
235 185
236static void __init imx6q_opp_init(struct device *cpu_dev) 186static void __init imx6q_opp_init(void)
237{ 187{
238 struct device_node *np; 188 struct device_node *np;
189 struct device *cpu_dev = get_cpu_device(0);
239 190
191 if (!cpu_dev) {
192 pr_warn("failed to get cpu0 device\n");
193 return;
194 }
240 np = of_node_get(cpu_dev->of_node); 195 np = of_node_get(cpu_dev->of_node);
241 if (!np) { 196 if (!np) {
242 pr_warn("failed to find cpu0 node\n"); 197 pr_warn("failed to find cpu0 node\n");
@@ -264,11 +219,11 @@ static void __init imx6q_init_late(void)
264 * WAIT mode is broken on TO 1.0 and 1.1, so there is no point 219 * WAIT mode is broken on TO 1.0 and 1.1, so there is no point
265 * to run cpuidle on them. 220 * to run cpuidle on them.
266 */ 221 */
267 if (imx6q_revision() > IMX_CHIP_REVISION_1_1) 222 if (imx_get_soc_revision() > IMX_CHIP_REVISION_1_1)
268 imx6q_cpuidle_init(); 223 imx6q_cpuidle_init();
269 224
270 if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ)) { 225 if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ)) {
271 imx6q_opp_init(&imx6q_cpufreq_pdev.dev); 226 imx6q_opp_init();
272 platform_device_register(&imx6q_cpufreq_pdev); 227 platform_device_register(&imx6q_cpufreq_pdev);
273 } 228 }
274} 229}
@@ -281,21 +236,13 @@ static void __init imx6q_map_io(void)
281 236
282static void __init imx6q_init_irq(void) 237static void __init imx6q_init_irq(void)
283{ 238{
284 imx6q_init_revision(); 239 imx_init_revision_from_anatop();
285 imx_init_l2cache(); 240 imx_init_l2cache();
286 imx_src_init(); 241 imx_src_init();
287 imx_gpc_init(); 242 imx_gpc_init();
288 irqchip_init(); 243 irqchip_init();
289} 244}
290 245
291static void __init imx6q_timer_init(void)
292{
293 of_clk_init(NULL);
294 clocksource_of_init();
295 imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q",
296 imx6q_revision());
297}
298
299static const char *imx6q_dt_compat[] __initdata = { 246static const char *imx6q_dt_compat[] __initdata = {
300 "fsl,imx6dl", 247 "fsl,imx6dl",
301 "fsl,imx6q", 248 "fsl,imx6q",
@@ -306,9 +253,8 @@ DT_MACHINE_START(IMX6Q, "Freescale i.MX6 Quad/DualLite (Device Tree)")
306 .smp = smp_ops(imx_smp_ops), 253 .smp = smp_ops(imx_smp_ops),
307 .map_io = imx6q_map_io, 254 .map_io = imx6q_map_io,
308 .init_irq = imx6q_init_irq, 255 .init_irq = imx6q_init_irq,
309 .init_time = imx6q_timer_init,
310 .init_machine = imx6q_init_machine, 256 .init_machine = imx6q_init_machine,
311 .init_late = imx6q_init_late, 257 .init_late = imx6q_init_late,
312 .dt_compat = imx6q_dt_compat, 258 .dt_compat = imx6q_dt_compat,
313 .restart = imx6q_restart, 259 .restart = mxc_restart,
314MACHINE_END 260MACHINE_END
diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
index 0d75dc54f715..2f952e3fcf89 100644
--- a/arch/arm/mach-imx/mach-imx6sl.c
+++ b/arch/arm/mach-imx/mach-imx6sl.c
@@ -7,35 +7,60 @@
7 * 7 *
8 */ 8 */
9 9
10#include <linux/clk-provider.h>
11#include <linux/irqchip.h> 10#include <linux/irqchip.h>
12#include <linux/of.h> 11#include <linux/of.h>
13#include <linux/of_platform.h> 12#include <linux/of_platform.h>
13#include <linux/mfd/syscon.h>
14#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
15#include <linux/regmap.h>
14#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
15#include <asm/mach/map.h> 17#include <asm/mach/map.h>
16 18
17#include "common.h" 19#include "common.h"
18 20
21static void __init imx6sl_fec_init(void)
22{
23 struct regmap *gpr;
24
25 /* set FEC clock from internal PLL clock source */
26 gpr = syscon_regmap_lookup_by_compatible("fsl,imx6sl-iomuxc-gpr");
27 if (!IS_ERR(gpr)) {
28 regmap_update_bits(gpr, IOMUXC_GPR1,
29 IMX6SL_GPR1_FEC_CLOCK_MUX2_SEL_MASK, 0);
30 regmap_update_bits(gpr, IOMUXC_GPR1,
31 IMX6SL_GPR1_FEC_CLOCK_MUX1_SEL_MASK, 0);
32 } else {
33 pr_err("failed to find fsl,imx6sl-iomux-gpr regmap\n");
34 }
35}
36
19static void __init imx6sl_init_machine(void) 37static void __init imx6sl_init_machine(void)
20{ 38{
39 struct device *parent;
40
21 mxc_arch_reset_init_dt(); 41 mxc_arch_reset_init_dt();
22 42
23 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 43 parent = imx_soc_device_init();
44 if (parent == NULL)
45 pr_warn("failed to initialize soc device\n");
46
47 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
48
49 imx6sl_fec_init();
50 imx_anatop_init();
51 /* Reuse imx6q pm code */
52 imx6q_pm_init();
24} 53}
25 54
26static void __init imx6sl_init_irq(void) 55static void __init imx6sl_init_irq(void)
27{ 56{
57 imx_init_revision_from_anatop();
28 imx_init_l2cache(); 58 imx_init_l2cache();
29 imx_src_init(); 59 imx_src_init();
30 imx_gpc_init(); 60 imx_gpc_init();
31 irqchip_init(); 61 irqchip_init();
32} 62}
33 63
34static void __init imx6sl_timer_init(void)
35{
36 of_clk_init(NULL);
37}
38
39static const char *imx6sl_dt_compat[] __initdata = { 64static const char *imx6sl_dt_compat[] __initdata = {
40 "fsl,imx6sl", 65 "fsl,imx6sl",
41 NULL, 66 NULL,
@@ -44,7 +69,6 @@ static const char *imx6sl_dt_compat[] __initdata = {
44DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)") 69DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)")
45 .map_io = debug_ll_io_init, 70 .map_io = debug_ll_io_init,
46 .init_irq = imx6sl_init_irq, 71 .init_irq = imx6sl_init_irq,
47 .init_time = imx6sl_timer_init,
48 .init_machine = imx6sl_init_machine, 72 .init_machine = imx6sl_init_machine,
49 .dt_compat = imx6sl_dt_compat, 73 .dt_compat = imx6sl_dt_compat,
50 .restart = mxc_restart, 74 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-mx31_3ds.c b/arch/arm/mach-imx/mach-mx31_3ds.c
index 1ed916175d41..50044a21b388 100644
--- a/arch/arm/mach-imx/mach-mx31_3ds.c
+++ b/arch/arm/mach-imx/mach-mx31_3ds.c
@@ -311,7 +311,7 @@ static int mx31_3ds_sdhc1_init(struct device *dev,
311 } 311 }
312 312
313 ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)), 313 ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)),
314 detect_irq, IRQF_DISABLED | 314 detect_irq,
315 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, 315 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
316 "sdhc1-detect", data); 316 "sdhc1-detect", data);
317 if (ret) { 317 if (ret) {
diff --git a/arch/arm/mach-imx/mach-pcm037.c b/arch/arm/mach-imx/mach-pcm037.c
index bc0261e99d39..45303bd62902 100644
--- a/arch/arm/mach-imx/mach-pcm037.c
+++ b/arch/arm/mach-imx/mach-pcm037.c
@@ -371,8 +371,7 @@ static int pcm970_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
371#endif 371#endif
372 372
373 ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_SCK6)), detect_irq, 373 ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_SCK6)), detect_irq,
374 IRQF_DISABLED | IRQF_TRIGGER_FALLING, 374 IRQF_TRIGGER_FALLING, "sdhc-detect", data);
375 "sdhc-detect", data);
376 if (ret) 375 if (ret)
377 goto err_gpio_free_2; 376 goto err_gpio_free_2;
378 377
diff --git a/arch/arm/mach-imx/mach-vf610.c b/arch/arm/mach-imx/mach-vf610.c
index 816991deb9b8..af0cb8a9dc48 100644
--- a/arch/arm/mach-imx/mach-vf610.c
+++ b/arch/arm/mach-imx/mach-vf610.c
@@ -8,9 +8,7 @@
8 */ 8 */
9 9
10#include <linux/of_platform.h> 10#include <linux/of_platform.h>
11#include <linux/clocksource.h>
12#include <linux/irqchip.h> 11#include <linux/irqchip.h>
13#include <linux/clk-provider.h>
14#include <asm/mach/arch.h> 12#include <asm/mach/arch.h>
15#include <asm/hardware/cache-l2x0.h> 13#include <asm/hardware/cache-l2x0.h>
16 14
@@ -28,12 +26,6 @@ static void __init vf610_init_irq(void)
28 irqchip_init(); 26 irqchip_init();
29} 27}
30 28
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 = { 29static const char *vf610_dt_compat[] __initdata = {
38 "fsl,vf610", 30 "fsl,vf610",
39 NULL, 31 NULL,
@@ -41,7 +33,6 @@ static const char *vf610_dt_compat[] __initdata = {
41 33
42DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF610 (Device Tree)") 34DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF610 (Device Tree)")
43 .init_irq = vf610_init_irq, 35 .init_irq = vf610_init_irq,
44 .init_time = vf610_init_time,
45 .init_machine = vf610_init_machine, 36 .init_machine = vf610_init_machine,
46 .dt_compat = vf610_dt_compat, 37 .dt_compat = vf610_dt_compat,
47 .restart = mxc_restart, 38 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c
index eb3cce38c70d..d1d52600f458 100644
--- a/arch/arm/mach-imx/mm-imx5.c
+++ b/arch/arm/mach-imx/mm-imx5.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/pinctrl/machine.h> 17#include <linux/pinctrl/machine.h>
18#include <linux/of_address.h>
18 19
19#include <asm/mach/map.h> 20#include <asm/mach/map.h>
20 21
@@ -88,8 +89,15 @@ void __init imx51_init_early(void)
88 89
89void __init imx53_init_early(void) 90void __init imx53_init_early(void)
90{ 91{
92 struct device_node *np;
93 void __iomem *base;
94
91 mxc_set_cpu_type(MXC_CPU_MX53); 95 mxc_set_cpu_type(MXC_CPU_MX53);
92 mxc_iomux_v3_init(MX53_IO_ADDRESS(MX53_IOMUXC_BASE_ADDR)); 96
97 np = of_find_compatible_node(NULL, NULL, "fsl,imx53-iomuxc");
98 base = of_iomap(np, 0);
99 WARN_ON(!base);
100 mxc_iomux_v3_init(base);
93 imx_src_init(); 101 imx_src_init();
94} 102}
95 103
@@ -100,7 +108,14 @@ void __init mx51_init_irq(void)
100 108
101void __init mx53_init_irq(void) 109void __init mx53_init_irq(void)
102{ 110{
103 tzic_init_irq(MX53_IO_ADDRESS(MX53_TZIC_BASE_ADDR)); 111 struct device_node *np;
112 void __iomem *base;
113
114 np = of_find_compatible_node(NULL, NULL, "fsl,imx53-tzic");
115 base = of_iomap(np, 0);
116 WARN_ON(!base);
117
118 tzic_init_irq(base);
104} 119}
105 120
106static struct sdma_platform_data imx51_sdma_pdata __initdata = { 121static struct sdma_platform_data imx51_sdma_pdata __initdata = {
diff --git a/arch/arm/mach-imx/mx31lilly-db.c b/arch/arm/mach-imx/mx31lilly-db.c
index d4361b80c5fb..649fe49ce85e 100644
--- a/arch/arm/mach-imx/mx31lilly-db.c
+++ b/arch/arm/mach-imx/mx31lilly-db.c
@@ -130,8 +130,7 @@ static int mxc_mmc1_init(struct device *dev,
130 gpio_direction_input(gpio_wp); 130 gpio_direction_input(gpio_wp);
131 131
132 ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1)), 132 ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1)),
133 detect_irq, 133 detect_irq, IRQF_TRIGGER_FALLING,
134 IRQF_DISABLED | IRQF_TRIGGER_FALLING,
135 "MMC detect", data); 134 "MMC detect", data);
136 if (ret) 135 if (ret)
137 goto exit_free_wp; 136 goto exit_free_wp;
diff --git a/arch/arm/mach-imx/mxc.h b/arch/arm/mach-imx/mxc.h
index 8629e5be7ecd..b08ab3ad4a6d 100644
--- a/arch/arm/mach-imx/mxc.h
+++ b/arch/arm/mach-imx/mxc.h
@@ -34,6 +34,7 @@
34#define MXC_CPU_MX35 35 34#define MXC_CPU_MX35 35
35#define MXC_CPU_MX51 51 35#define MXC_CPU_MX51 51
36#define MXC_CPU_MX53 53 36#define MXC_CPU_MX53 53
37#define MXC_CPU_IMX6SL 0x60
37#define MXC_CPU_IMX6DL 0x61 38#define MXC_CPU_IMX6DL 0x61
38#define MXC_CPU_IMX6Q 0x63 39#define MXC_CPU_IMX6Q 0x63
39 40
@@ -152,6 +153,11 @@ extern unsigned int __mxc_cpu_type;
152#endif 153#endif
153 154
154#ifndef __ASSEMBLY__ 155#ifndef __ASSEMBLY__
156static inline bool cpu_is_imx6sl(void)
157{
158 return __mxc_cpu_type == MXC_CPU_IMX6SL;
159}
160
155static inline bool cpu_is_imx6dl(void) 161static inline bool cpu_is_imx6dl(void)
156{ 162{
157 return __mxc_cpu_type == MXC_CPU_IMX6DL; 163 return __mxc_cpu_type == MXC_CPU_IMX6DL;
diff --git a/arch/arm/mach-imx/pm-imx6q.c b/arch/arm/mach-imx/pm-imx6q.c
index 204942749e21..aecd9f8037e0 100644
--- a/arch/arm/mach-imx/pm-imx6q.c
+++ b/arch/arm/mach-imx/pm-imx6q.c
@@ -10,9 +10,15 @@
10 * http://www.gnu.org/copyleft/gpl.html 10 * http://www.gnu.org/copyleft/gpl.html
11 */ 11 */
12 12
13#include <linux/delay.h>
13#include <linux/init.h> 14#include <linux/init.h>
14#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/irq.h>
17#include <linux/mfd/syscon.h>
18#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
15#include <linux/of.h> 19#include <linux/of.h>
20#include <linux/of_address.h>
21#include <linux/regmap.h>
16#include <linux/suspend.h> 22#include <linux/suspend.h>
17#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
18#include <asm/proc-fns.h> 24#include <asm/proc-fns.h>
@@ -22,6 +28,147 @@
22#include "common.h" 28#include "common.h"
23#include "hardware.h" 29#include "hardware.h"
24 30
31#define CCR 0x0
32#define BM_CCR_WB_COUNT (0x7 << 16)
33#define BM_CCR_RBC_BYPASS_COUNT (0x3f << 21)
34#define BM_CCR_RBC_EN (0x1 << 27)
35
36#define CLPCR 0x54
37#define BP_CLPCR_LPM 0
38#define BM_CLPCR_LPM (0x3 << 0)
39#define BM_CLPCR_BYPASS_PMIC_READY (0x1 << 2)
40#define BM_CLPCR_ARM_CLK_DIS_ON_LPM (0x1 << 5)
41#define BM_CLPCR_SBYOS (0x1 << 6)
42#define BM_CLPCR_DIS_REF_OSC (0x1 << 7)
43#define BM_CLPCR_VSTBY (0x1 << 8)
44#define BP_CLPCR_STBY_COUNT 9
45#define BM_CLPCR_STBY_COUNT (0x3 << 9)
46#define BM_CLPCR_COSC_PWRDOWN (0x1 << 11)
47#define BM_CLPCR_WB_PER_AT_LPM (0x1 << 16)
48#define BM_CLPCR_WB_CORE_AT_LPM (0x1 << 17)
49#define BM_CLPCR_BYP_MMDC_CH0_LPM_HS (0x1 << 19)
50#define BM_CLPCR_BYP_MMDC_CH1_LPM_HS (0x1 << 21)
51#define BM_CLPCR_MASK_CORE0_WFI (0x1 << 22)
52#define BM_CLPCR_MASK_CORE1_WFI (0x1 << 23)
53#define BM_CLPCR_MASK_CORE2_WFI (0x1 << 24)
54#define BM_CLPCR_MASK_CORE3_WFI (0x1 << 25)
55#define BM_CLPCR_MASK_SCU_IDLE (0x1 << 26)
56#define BM_CLPCR_MASK_L2CC_IDLE (0x1 << 27)
57
58#define CGPR 0x64
59#define BM_CGPR_CHICKEN_BIT (0x1 << 17)
60
61static void __iomem *ccm_base;
62
63void imx6q_set_chicken_bit(void)
64{
65 u32 val = readl_relaxed(ccm_base + CGPR);
66
67 val |= BM_CGPR_CHICKEN_BIT;
68 writel_relaxed(val, ccm_base + CGPR);
69}
70
71static void imx6q_enable_rbc(bool enable)
72{
73 u32 val;
74
75 /*
76 * need to mask all interrupts in GPC before
77 * operating RBC configurations
78 */
79 imx_gpc_mask_all();
80
81 /* configure RBC enable bit */
82 val = readl_relaxed(ccm_base + CCR);
83 val &= ~BM_CCR_RBC_EN;
84 val |= enable ? BM_CCR_RBC_EN : 0;
85 writel_relaxed(val, ccm_base + CCR);
86
87 /* configure RBC count */
88 val = readl_relaxed(ccm_base + CCR);
89 val &= ~BM_CCR_RBC_BYPASS_COUNT;
90 val |= enable ? BM_CCR_RBC_BYPASS_COUNT : 0;
91 writel(val, ccm_base + CCR);
92
93 /*
94 * need to delay at least 2 cycles of CKIL(32K)
95 * due to hardware design requirement, which is
96 * ~61us, here we use 65us for safe
97 */
98 udelay(65);
99
100 /* restore GPC interrupt mask settings */
101 imx_gpc_restore_all();
102}
103
104static void imx6q_enable_wb(bool enable)
105{
106 u32 val;
107
108 /* configure well bias enable bit */
109 val = readl_relaxed(ccm_base + CLPCR);
110 val &= ~BM_CLPCR_WB_PER_AT_LPM;
111 val |= enable ? BM_CLPCR_WB_PER_AT_LPM : 0;
112 writel_relaxed(val, ccm_base + CLPCR);
113
114 /* configure well bias count */
115 val = readl_relaxed(ccm_base + CCR);
116 val &= ~BM_CCR_WB_COUNT;
117 val |= enable ? BM_CCR_WB_COUNT : 0;
118 writel_relaxed(val, ccm_base + CCR);
119}
120
121int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
122{
123 struct irq_desc *iomuxc_irq_desc;
124 u32 val = readl_relaxed(ccm_base + CLPCR);
125
126 val &= ~BM_CLPCR_LPM;
127 switch (mode) {
128 case WAIT_CLOCKED:
129 break;
130 case WAIT_UNCLOCKED:
131 val |= 0x1 << BP_CLPCR_LPM;
132 val |= BM_CLPCR_ARM_CLK_DIS_ON_LPM;
133 break;
134 case STOP_POWER_ON:
135 val |= 0x2 << BP_CLPCR_LPM;
136 break;
137 case WAIT_UNCLOCKED_POWER_OFF:
138 val |= 0x1 << BP_CLPCR_LPM;
139 val &= ~BM_CLPCR_VSTBY;
140 val &= ~BM_CLPCR_SBYOS;
141 break;
142 case STOP_POWER_OFF:
143 val |= 0x2 << BP_CLPCR_LPM;
144 val |= 0x3 << BP_CLPCR_STBY_COUNT;
145 val |= BM_CLPCR_VSTBY;
146 val |= BM_CLPCR_SBYOS;
147 if (cpu_is_imx6sl()) {
148 val |= BM_CLPCR_BYPASS_PMIC_READY;
149 val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS;
150 } else {
151 val |= BM_CLPCR_BYP_MMDC_CH1_LPM_HS;
152 }
153 break;
154 default:
155 return -EINVAL;
156 }
157
158 /*
159 * Unmask the always pending IOMUXC interrupt #32 as wakeup source to
160 * deassert dsm_request signal, so that we can ensure dsm_request
161 * is not asserted when we're going to write CLPCR register to set LPM.
162 * After setting up LPM bits, we need to mask this wakeup source.
163 */
164 iomuxc_irq_desc = irq_to_desc(32);
165 imx_gpc_irq_unmask(&iomuxc_irq_desc->irq_data);
166 writel_relaxed(val, ccm_base + CLPCR);
167 imx_gpc_irq_mask(&iomuxc_irq_desc->irq_data);
168
169 return 0;
170}
171
25static int imx6q_suspend_finish(unsigned long val) 172static int imx6q_suspend_finish(unsigned long val)
26{ 173{
27 cpu_do_idle(); 174 cpu_do_idle();
@@ -33,14 +180,19 @@ static int imx6q_pm_enter(suspend_state_t state)
33 switch (state) { 180 switch (state) {
34 case PM_SUSPEND_MEM: 181 case PM_SUSPEND_MEM:
35 imx6q_set_lpm(STOP_POWER_OFF); 182 imx6q_set_lpm(STOP_POWER_OFF);
183 imx6q_enable_wb(true);
184 imx6q_enable_rbc(true);
36 imx_gpc_pre_suspend(); 185 imx_gpc_pre_suspend();
37 imx_anatop_pre_suspend(); 186 imx_anatop_pre_suspend();
38 imx_set_cpu_jump(0, v7_cpu_resume); 187 imx_set_cpu_jump(0, v7_cpu_resume);
39 /* Zzz ... */ 188 /* Zzz ... */
40 cpu_suspend(0, imx6q_suspend_finish); 189 cpu_suspend(0, imx6q_suspend_finish);
41 imx_smp_prepare(); 190 if (cpu_is_imx6q() || cpu_is_imx6dl())
191 imx_smp_prepare();
42 imx_anatop_post_resume(); 192 imx_anatop_post_resume();
43 imx_gpc_post_resume(); 193 imx_gpc_post_resume();
194 imx6q_enable_rbc(false);
195 imx6q_enable_wb(false);
44 imx6q_set_lpm(WAIT_CLOCKED); 196 imx6q_set_lpm(WAIT_CLOCKED);
45 break; 197 break;
46 default: 198 default:
@@ -55,7 +207,29 @@ static const struct platform_suspend_ops imx6q_pm_ops = {
55 .valid = suspend_valid_only_mem, 207 .valid = suspend_valid_only_mem,
56}; 208};
57 209
210void __init imx6q_pm_set_ccm_base(void __iomem *base)
211{
212 ccm_base = base;
213}
214
58void __init imx6q_pm_init(void) 215void __init imx6q_pm_init(void)
59{ 216{
217 struct regmap *gpr;
218
219 WARN_ON(!ccm_base);
220
221 /*
222 * Force IOMUXC irq pending, so that the interrupt to GPC can be
223 * used to deassert dsm_request signal when the signal gets
224 * asserted unexpectedly.
225 */
226 gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr");
227 if (!IS_ERR(gpr))
228 regmap_update_bits(gpr, IOMUXC_GPR1, IMX6Q_GPR1_GINT,
229 IMX6Q_GPR1_GINT);
230
231 /* Set initial power mode */
232 imx6q_set_lpm(WAIT_CLOCKED);
233
60 suspend_set_ops(&imx6q_pm_ops); 234 suspend_set_ops(&imx6q_pm_ops);
61} 235}
diff --git a/arch/arm/mach-imx/src.c b/arch/arm/mach-imx/src.c
index 10a6b1a8c5ac..4754373e7e7d 100644
--- a/arch/arm/mach-imx/src.c
+++ b/arch/arm/mach-imx/src.c
@@ -91,6 +91,7 @@ void imx_enable_cpu(int cpu, bool enable)
91 spin_lock(&scr_lock); 91 spin_lock(&scr_lock);
92 val = readl_relaxed(src_base + SRC_SCR); 92 val = readl_relaxed(src_base + SRC_SCR);
93 val = enable ? val | mask : val & ~mask; 93 val = enable ? val | mask : val & ~mask;
94 val |= 1 << (BP_SRC_SCR_CORE1_RST + cpu - 1);
94 writel_relaxed(val, src_base + SRC_SCR); 95 writel_relaxed(val, src_base + SRC_SCR);
95 spin_unlock(&scr_lock); 96 spin_unlock(&scr_lock);
96} 97}
diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
index 64ff37ea72b1..e6edcd38b282 100644
--- a/arch/arm/mach-imx/system.c
+++ b/arch/arm/mach-imx/system.c
@@ -42,6 +42,9 @@ void mxc_restart(enum reboot_mode mode, const char *cmd)
42{ 42{
43 unsigned int wcr_enable; 43 unsigned int wcr_enable;
44 44
45 if (cpu_is_imx6q() || cpu_is_imx6dl())
46 imx_src_prepare_restart();
47
45 if (wdog_clk) 48 if (wdog_clk)
46 clk_enable(wdog_clk); 49 clk_enable(wdog_clk);
47 50
@@ -52,6 +55,8 @@ void mxc_restart(enum reboot_mode mode, const char *cmd)
52 55
53 /* Assert SRS signal */ 56 /* Assert SRS signal */
54 __raw_writew(wcr_enable, wdog_base); 57 __raw_writew(wcr_enable, wdog_base);
58 /* write twice to ensure the request will not get ignored */
59 __raw_writew(wcr_enable, wdog_base);
55 60
56 /* wait for reset to assert... */ 61 /* wait for reset to assert... */
57 mdelay(500); 62 mdelay(500);
@@ -117,6 +122,17 @@ void __init imx_init_l2cache(void)
117 /* Configure the L2 PREFETCH and POWER registers */ 122 /* Configure the L2 PREFETCH and POWER registers */
118 val = readl_relaxed(l2x0_base + L2X0_PREFETCH_CTRL); 123 val = readl_relaxed(l2x0_base + L2X0_PREFETCH_CTRL);
119 val |= 0x70800000; 124 val |= 0x70800000;
125 /*
126 * The L2 cache controller(PL310) version on the i.MX6D/Q is r3p1-50rel0
127 * The L2 cache controller(PL310) version on the i.MX6DL/SOLO/SL is r3p2
128 * But according to ARM PL310 errata: 752271
129 * ID: 752271: Double linefill feature can cause data corruption
130 * Fault Status: Present in: r3p0, r3p1, r3p1-50rel0. Fixed in r3p2
131 * Workaround: The only workaround to this erratum is to disable the
132 * double linefill feature. This is the default behavior.
133 */
134 if (cpu_is_imx6q())
135 val &= ~(1 << 30 | 1 << 23);
120 writel_relaxed(val, l2x0_base + L2X0_PREFETCH_CTRL); 136 writel_relaxed(val, l2x0_base + L2X0_PREFETCH_CTRL);
121 val = L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN; 137 val = L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN;
122 writel_relaxed(val, l2x0_base + L2X0_POWER_CTRL); 138 writel_relaxed(val, l2x0_base + L2X0_POWER_CTRL);
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index cd46529e9eaa..9b6638aadeaa 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -250,7 +250,7 @@ static irqreturn_t mxc_timer_interrupt(int irq, void *dev_id)
250 250
251static struct irqaction mxc_timer_irq = { 251static struct irqaction mxc_timer_irq = {
252 .name = "i.MX Timer Tick", 252 .name = "i.MX Timer Tick",
253 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 253 .flags = IRQF_TIMER | IRQF_IRQPOLL,
254 .handler = mxc_timer_interrupt, 254 .handler = mxc_timer_interrupt,
255}; 255};
256 256
diff --git a/arch/arm/mach-integrator/include/mach/cm.h b/arch/arm/mach-integrator/cm.h
index 202e6a57f100..4ecff7bff482 100644
--- a/arch/arm/mach-integrator/include/mach/cm.h
+++ b/arch/arm/mach-integrator/cm.h
@@ -1,9 +1,12 @@
1/* 1/*
2 * update the core module control register. 2 * access the core module control register.
3 */ 3 */
4u32 cm_get(void);
4void cm_control(u32, u32); 5void cm_control(u32, u32);
5 6
6#define CM_CTRL __io_address(INTEGRATOR_HDR_CTRL) 7struct device_node;
8void cm_init(void);
9void cm_clear_irqs(void);
7 10
8#define CM_CTRL_LED (1 << 0) 11#define CM_CTRL_LED (1 << 0)
9#define CM_CTRL_nMBDET (1 << 1) 12#define CM_CTRL_nMBDET (1 << 1)
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 4cdfd7365925..00ddf20ed91b 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -22,77 +22,30 @@
22#include <linux/amba/serial.h> 22#include <linux/amba/serial.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/stat.h> 24#include <linux/stat.h>
25#include <linux/of.h>
26#include <linux/of_address.h>
25 27
26#include <mach/hardware.h> 28#include <mach/hardware.h>
27#include <mach/platform.h> 29#include <mach/platform.h>
28#include <mach/cm.h>
29#include <mach/irqs.h>
30 30
31#include <asm/mach-types.h> 31#include <asm/mach-types.h>
32#include <asm/mach/time.h> 32#include <asm/mach/time.h>
33#include <asm/pgtable.h> 33#include <asm/pgtable.h>
34 34
35#include "cm.h"
35#include "common.h" 36#include "common.h"
36 37
37#ifdef CONFIG_ATAGS 38static DEFINE_RAW_SPINLOCK(cm_lock);
38 39static void __iomem *cm_base;
39#define INTEGRATOR_RTC_IRQ { IRQ_RTCINT }
40#define INTEGRATOR_UART0_IRQ { IRQ_UARTINT0 }
41#define INTEGRATOR_UART1_IRQ { IRQ_UARTINT1 }
42#define KMI0_IRQ { IRQ_KMIINT0 }
43#define KMI1_IRQ { IRQ_KMIINT1 }
44
45static AMBA_APB_DEVICE(rtc, "rtc", 0,
46 INTEGRATOR_RTC_BASE, INTEGRATOR_RTC_IRQ, NULL);
47
48static AMBA_APB_DEVICE(uart0, "uart0", 0,
49 INTEGRATOR_UART0_BASE, INTEGRATOR_UART0_IRQ, NULL);
50
51static AMBA_APB_DEVICE(uart1, "uart1", 0,
52 INTEGRATOR_UART1_BASE, INTEGRATOR_UART1_IRQ, NULL);
53
54static AMBA_APB_DEVICE(kmi0, "kmi0", 0, KMI0_BASE, KMI0_IRQ, NULL);
55static AMBA_APB_DEVICE(kmi1, "kmi1", 0, KMI1_BASE, KMI1_IRQ, NULL);
56
57static struct amba_device *amba_devs[] __initdata = {
58 &rtc_device,
59 &uart0_device,
60 &uart1_device,
61 &kmi0_device,
62 &kmi1_device,
63};
64 40
65int __init integrator_init(bool is_cp) 41/**
42 * cm_get - get the value from the CM_CTRL register
43 */
44u32 cm_get(void)
66{ 45{
67 int i; 46 return readl(cm_base + INTEGRATOR_HDR_CTRL_OFFSET);
68
69 /*
70 * The Integrator/AP lacks necessary AMBA PrimeCell IDs, so we need to
71 * hard-code them. The Integator/CP and forward have proper cell IDs.
72 * Else we leave them undefined to the bus driver can autoprobe them.
73 */
74 if (!is_cp && IS_ENABLED(CONFIG_ARCH_INTEGRATOR_AP)) {
75 rtc_device.periphid = 0x00041030;
76 uart0_device.periphid = 0x00041010;
77 uart1_device.periphid = 0x00041010;
78 kmi0_device.periphid = 0x00041050;
79 kmi1_device.periphid = 0x00041050;
80 uart0_device.dev.platform_data = &ap_uart_data;
81 uart1_device.dev.platform_data = &ap_uart_data;
82 }
83
84 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
85 struct amba_device *d = amba_devs[i];
86 amba_device_register(d, &iomem_resource);
87 }
88
89 return 0;
90} 47}
91 48
92#endif
93
94static DEFINE_RAW_SPINLOCK(cm_lock);
95
96/** 49/**
97 * cm_control - update the CM_CTRL register. 50 * cm_control - update the CM_CTRL register.
98 * @mask: bits to change 51 * @mask: bits to change
@@ -104,12 +57,80 @@ void cm_control(u32 mask, u32 set)
104 u32 val; 57 u32 val;
105 58
106 raw_spin_lock_irqsave(&cm_lock, flags); 59 raw_spin_lock_irqsave(&cm_lock, flags);
107 val = readl(CM_CTRL) & ~mask; 60 val = readl(cm_base + INTEGRATOR_HDR_CTRL_OFFSET) & ~mask;
108 writel(val | set, CM_CTRL); 61 writel(val | set, cm_base + INTEGRATOR_HDR_CTRL_OFFSET);
109 raw_spin_unlock_irqrestore(&cm_lock, flags); 62 raw_spin_unlock_irqrestore(&cm_lock, flags);
110} 63}
111 64
112EXPORT_SYMBOL(cm_control); 65static const char *integrator_arch_str(u32 id)
66{
67 switch ((id >> 16) & 0xff) {
68 case 0x00:
69 return "ASB little-endian";
70 case 0x01:
71 return "AHB little-endian";
72 case 0x03:
73 return "AHB-Lite system bus, bi-endian";
74 case 0x04:
75 return "AHB";
76 case 0x08:
77 return "AHB system bus, ASB processor bus";
78 default:
79 return "Unknown";
80 }
81}
82
83static const char *integrator_fpga_str(u32 id)
84{
85 switch ((id >> 12) & 0xf) {
86 case 0x01:
87 return "XC4062";
88 case 0x02:
89 return "XC4085";
90 case 0x03:
91 return "XVC600";
92 case 0x04:
93 return "EPM7256AE (Altera PLD)";
94 default:
95 return "Unknown";
96 }
97}
98
99void cm_clear_irqs(void)
100{
101 /* disable core module IRQs */
102 writel(0xffffffffU, cm_base + INTEGRATOR_HDR_IC_OFFSET +
103 IRQ_ENABLE_CLEAR);
104}
105
106static const struct of_device_id cm_match[] = {
107 { .compatible = "arm,core-module-integrator"},
108 { },
109};
110
111void cm_init(void)
112{
113 struct device_node *cm = of_find_matching_node(NULL, cm_match);
114 u32 val;
115
116 if (!cm) {
117 pr_crit("no core module node found in device tree\n");
118 return;
119 }
120 cm_base = of_iomap(cm, 0);
121 if (!cm_base) {
122 pr_crit("could not remap core module\n");
123 return;
124 }
125 cm_clear_irqs();
126 val = readl(cm_base + INTEGRATOR_HDR_ID_OFFSET);
127 pr_info("Detected ARM core module:\n");
128 pr_info(" Manufacturer: %02x\n", (val >> 24));
129 pr_info(" Architecture: %s\n", integrator_arch_str(val));
130 pr_info(" FPGA: %s\n", integrator_fpga_str(val));
131 pr_info(" Build: %02x\n", (val >> 4) & 0xFF);
132 pr_info(" Rev: %c\n", ('A' + (val & 0x03)));
133}
113 134
114/* 135/*
115 * We need to stop things allocating the low memory; ideally we need a 136 * We need to stop things allocating the low memory; ideally we need a
@@ -145,27 +166,7 @@ static ssize_t intcp_get_arch(struct device *dev,
145 struct device_attribute *attr, 166 struct device_attribute *attr,
146 char *buf) 167 char *buf)
147{ 168{
148 const char *arch; 169 return sprintf(buf, "%s\n", integrator_arch_str(integrator_id));
149
150 switch ((integrator_id >> 16) & 0xff) {
151 case 0x00:
152 arch = "ASB little-endian";
153 break;
154 case 0x01:
155 arch = "AHB little-endian";
156 break;
157 case 0x03:
158 arch = "AHB-Lite system bus, bi-endian";
159 break;
160 case 0x04:
161 arch = "AHB";
162 break;
163 default:
164 arch = "Unknown";
165 break;
166 }
167
168 return sprintf(buf, "%s\n", arch);
169} 170}
170 171
171static struct device_attribute intcp_arch_attr = 172static struct device_attribute intcp_arch_attr =
@@ -175,24 +176,7 @@ static ssize_t intcp_get_fpga(struct device *dev,
175 struct device_attribute *attr, 176 struct device_attribute *attr,
176 char *buf) 177 char *buf)
177{ 178{
178 const char *fpga; 179 return sprintf(buf, "%s\n", integrator_fpga_str(integrator_id));
179
180 switch ((integrator_id >> 12) & 0xf) {
181 case 0x01:
182 fpga = "XC4062";
183 break;
184 case 0x02:
185 fpga = "XC4085";
186 break;
187 case 0x04:
188 fpga = "EPM7256AE (Altera PLD)";
189 break;
190 default:
191 fpga = "Unknown";
192 break;
193 }
194
195 return sprintf(buf, "%s\n", fpga);
196} 180}
197 181
198static struct device_attribute intcp_fpga_attr = 182static struct device_attribute intcp_fpga_attr =
diff --git a/arch/arm/mach-integrator/include/mach/irqs.h b/arch/arm/mach-integrator/include/mach/irqs.h
deleted file mode 100644
index eff0adad9ae3..000000000000
--- a/arch/arm/mach-integrator/include/mach/irqs.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * arch/arm/mach-integrator/include/mach/irqs.h
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/*
23 * Interrupt numbers, all of the above are just static reservations
24 * used so they can be encoded into device resources. They will finally
25 * be done away with when switching to device tree.
26 */
27#define IRQ_PIC_START 64
28#define IRQ_SOFTINT (IRQ_PIC_START+0)
29#define IRQ_UARTINT0 (IRQ_PIC_START+1)
30#define IRQ_UARTINT1 (IRQ_PIC_START+2)
31#define IRQ_KMIINT0 (IRQ_PIC_START+3)
32#define IRQ_KMIINT1 (IRQ_PIC_START+4)
33#define IRQ_TIMERINT0 (IRQ_PIC_START+5)
34#define IRQ_TIMERINT1 (IRQ_PIC_START+6)
35#define IRQ_TIMERINT2 (IRQ_PIC_START+7)
36#define IRQ_RTCINT (IRQ_PIC_START+8)
37#define IRQ_AP_EXPINT0 (IRQ_PIC_START+9)
38#define IRQ_AP_EXPINT1 (IRQ_PIC_START+10)
39#define IRQ_AP_EXPINT2 (IRQ_PIC_START+11)
40#define IRQ_AP_EXPINT3 (IRQ_PIC_START+12)
41#define IRQ_AP_PCIINT0 (IRQ_PIC_START+13)
42#define IRQ_AP_PCIINT1 (IRQ_PIC_START+14)
43#define IRQ_AP_PCIINT2 (IRQ_PIC_START+15)
44#define IRQ_AP_PCIINT3 (IRQ_PIC_START+16)
45#define IRQ_AP_V3INT (IRQ_PIC_START+17)
46#define IRQ_AP_CPINT0 (IRQ_PIC_START+18)
47#define IRQ_AP_CPINT1 (IRQ_PIC_START+19)
48#define IRQ_AP_LBUSTIMEOUT (IRQ_PIC_START+20)
49#define IRQ_AP_APCINT (IRQ_PIC_START+21)
50#define IRQ_CP_CLCDCINT (IRQ_PIC_START+22)
51#define IRQ_CP_MMCIINT0 (IRQ_PIC_START+23)
52#define IRQ_CP_MMCIINT1 (IRQ_PIC_START+24)
53#define IRQ_CP_AACIINT (IRQ_PIC_START+25)
54#define IRQ_CP_CPPLDINT (IRQ_PIC_START+26)
55#define IRQ_CP_ETHINT (IRQ_PIC_START+27)
56#define IRQ_CP_TSPENINT (IRQ_PIC_START+28)
57#define IRQ_PIC_END (IRQ_PIC_START+28)
58
59#define IRQ_CIC_START (IRQ_PIC_END+1)
60#define IRQ_CM_SOFTINT (IRQ_CIC_START+0)
61#define IRQ_CM_COMMRX (IRQ_CIC_START+1)
62#define IRQ_CM_COMMTX (IRQ_CIC_START+2)
63#define IRQ_CIC_END (IRQ_CIC_START+2)
64
65/*
66 * IntegratorCP only
67 */
68#define IRQ_SIC_START (IRQ_CIC_END+1)
69#define IRQ_SIC_CP_SOFTINT (IRQ_SIC_START+0)
70#define IRQ_SIC_CP_RI0 (IRQ_SIC_START+1)
71#define IRQ_SIC_CP_RI1 (IRQ_SIC_START+2)
72#define IRQ_SIC_CP_CARDIN (IRQ_SIC_START+3)
73#define IRQ_SIC_CP_LMINT0 (IRQ_SIC_START+4)
74#define IRQ_SIC_CP_LMINT1 (IRQ_SIC_START+5)
75#define IRQ_SIC_CP_LMINT2 (IRQ_SIC_START+6)
76#define IRQ_SIC_CP_LMINT3 (IRQ_SIC_START+7)
77#define IRQ_SIC_CP_LMINT4 (IRQ_SIC_START+8)
78#define IRQ_SIC_CP_LMINT5 (IRQ_SIC_START+9)
79#define IRQ_SIC_CP_LMINT6 (IRQ_SIC_START+10)
80#define IRQ_SIC_CP_LMINT7 (IRQ_SIC_START+11)
81#define IRQ_SIC_END (IRQ_SIC_START+11)
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index d9e95e612fcb..d50dc2dbfd89 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -51,13 +51,13 @@
51#include <asm/mach-types.h> 51#include <asm/mach-types.h>
52 52
53#include <mach/lm.h> 53#include <mach/lm.h>
54#include <mach/irqs.h>
55 54
56#include <asm/mach/arch.h> 55#include <asm/mach/arch.h>
57#include <asm/mach/irq.h> 56#include <asm/mach/irq.h>
58#include <asm/mach/map.h> 57#include <asm/mach/map.h>
59#include <asm/mach/time.h> 58#include <asm/mach/time.h>
60 59
60#include "cm.h"
61#include "common.h" 61#include "common.h"
62#include "pci_v3.h" 62#include "pci_v3.h"
63 63
@@ -146,7 +146,7 @@ static int irq_suspend(void)
146static void irq_resume(void) 146static void irq_resume(void)
147{ 147{
148 /* disable all irq sources */ 148 /* disable all irq sources */
149 writel(-1, VA_CMIC_BASE + IRQ_ENABLE_CLEAR); 149 cm_clear_irqs();
150 writel(-1, VA_IC_BASE + IRQ_ENABLE_CLEAR); 150 writel(-1, VA_IC_BASE + IRQ_ENABLE_CLEAR);
151 writel(-1, VA_IC_BASE + FIQ_ENABLE_CLEAR); 151 writel(-1, VA_IC_BASE + FIQ_ENABLE_CLEAR);
152 152
@@ -402,8 +402,6 @@ void __init ap_init_early(void)
402{ 402{
403} 403}
404 404
405#ifdef CONFIG_OF
406
407static void __init ap_of_timer_init(void) 405static void __init ap_of_timer_init(void)
408{ 406{
409 struct device_node *node; 407 struct device_node *node;
@@ -450,8 +448,7 @@ static const struct of_device_id fpga_irq_of_match[] __initconst = {
450 448
451static void __init ap_init_irq_of(void) 449static void __init ap_init_irq_of(void)
452{ 450{
453 /* disable core module IRQs */ 451 cm_init();
454 writel(0xffffffffU, VA_CMIC_BASE + IRQ_ENABLE_CLEAR);
455 of_irq_init(fpga_irq_of_match); 452 of_irq_init(fpga_irq_of_match);
456 integrator_clk_init(false); 453 integrator_clk_init(false);
457} 454}
@@ -473,6 +470,11 @@ static struct of_dev_auxdata ap_auxdata_lookup[] __initdata = {
473 { /* sentinel */ }, 470 { /* sentinel */ },
474}; 471};
475 472
473static const struct of_device_id ap_syscon_match[] = {
474 { .compatible = "arm,integrator-ap-syscon"},
475 { },
476};
477
476static void __init ap_init_of(void) 478static void __init ap_init_of(void)
477{ 479{
478 unsigned long sc_dec; 480 unsigned long sc_dec;
@@ -489,7 +491,8 @@ static void __init ap_init_of(void)
489 root = of_find_node_by_path("/"); 491 root = of_find_node_by_path("/");
490 if (!root) 492 if (!root)
491 return; 493 return;
492 syscon = of_find_node_by_path("/syscon"); 494
495 syscon = of_find_matching_node(root, ap_syscon_match);
493 if (!syscon) 496 if (!syscon)
494 return; 497 return;
495 498
@@ -541,7 +544,7 @@ static void __init ap_init_of(void)
541 lmdev->resource.start = 0xc0000000 + 0x10000000 * i; 544 lmdev->resource.start = 0xc0000000 + 0x10000000 * i;
542 lmdev->resource.end = lmdev->resource.start + 0x0fffffff; 545 lmdev->resource.end = lmdev->resource.start + 0x0fffffff;
543 lmdev->resource.flags = IORESOURCE_MEM; 546 lmdev->resource.flags = IORESOURCE_MEM;
544 lmdev->irq = IRQ_AP_EXPINT0 + i; 547 lmdev->irq = irq_of_parse_and_map(syscon, i);
545 lmdev->id = i; 548 lmdev->id = i;
546 549
547 lm_device_register(lmdev); 550 lm_device_register(lmdev);
@@ -564,136 +567,3 @@ DT_MACHINE_START(INTEGRATOR_AP_DT, "ARM Integrator/AP (Device Tree)")
564 .restart = integrator_restart, 567 .restart = integrator_restart,
565 .dt_compat = ap_dt_board_compat, 568 .dt_compat = ap_dt_board_compat,
566MACHINE_END 569MACHINE_END
567
568#endif
569
570#ifdef CONFIG_ATAGS
571
572/*
573 * For the ATAG boot some static mappings are needed. This will
574 * go away with the ATAG support down the road.
575 */
576
577static struct map_desc ap_io_desc_atag[] __initdata = {
578 {
579 .virtual = IO_ADDRESS(INTEGRATOR_SC_BASE),
580 .pfn = __phys_to_pfn(INTEGRATOR_SC_BASE),
581 .length = SZ_4K,
582 .type = MT_DEVICE
583 },
584};
585
586static void __init ap_map_io_atag(void)
587{
588 iotable_init(ap_io_desc_atag, ARRAY_SIZE(ap_io_desc_atag));
589 ap_map_io();
590}
591
592/*
593 * This is where non-devicetree initialization code is collected and stashed
594 * for eventual deletion.
595 */
596
597static struct platform_device pci_v3_device = {
598 .name = "pci-v3",
599 .id = 0,
600};
601
602static struct resource cfi_flash_resource = {
603 .start = INTEGRATOR_FLASH_BASE,
604 .end = INTEGRATOR_FLASH_BASE + INTEGRATOR_FLASH_SIZE - 1,
605 .flags = IORESOURCE_MEM,
606};
607
608static struct platform_device cfi_flash_device = {
609 .name = "physmap-flash",
610 .id = 0,
611 .dev = {
612 .platform_data = &ap_flash_data,
613 },
614 .num_resources = 1,
615 .resource = &cfi_flash_resource,
616};
617
618static void __init ap_timer_init(void)
619{
620 struct clk *clk;
621 unsigned long rate;
622
623 clk = clk_get_sys("ap_timer", NULL);
624 BUG_ON(IS_ERR(clk));
625 clk_prepare_enable(clk);
626 rate = clk_get_rate(clk);
627
628 writel(0, TIMER0_VA_BASE + TIMER_CTRL);
629 writel(0, TIMER1_VA_BASE + TIMER_CTRL);
630 writel(0, TIMER2_VA_BASE + TIMER_CTRL);
631
632 integrator_clocksource_init(rate, (void __iomem *)TIMER2_VA_BASE);
633 integrator_clockevent_init(rate, (void __iomem *)TIMER1_VA_BASE,
634 IRQ_TIMERINT1);
635}
636
637#define INTEGRATOR_SC_VALID_INT 0x003fffff
638
639static void __init ap_init_irq(void)
640{
641 /* Disable all interrupts initially. */
642 /* Do the core module ones */
643 writel(-1, VA_CMIC_BASE + IRQ_ENABLE_CLEAR);
644
645 /* do the header card stuff next */
646 writel(-1, VA_IC_BASE + IRQ_ENABLE_CLEAR);
647 writel(-1, VA_IC_BASE + FIQ_ENABLE_CLEAR);
648
649 fpga_irq_init(VA_IC_BASE, "SC", IRQ_PIC_START,
650 -1, INTEGRATOR_SC_VALID_INT, NULL);
651 integrator_clk_init(false);
652}
653
654static void __init ap_init(void)
655{
656 unsigned long sc_dec;
657 int i;
658
659 platform_device_register(&pci_v3_device);
660 platform_device_register(&cfi_flash_device);
661
662 ap_syscon_base = __io_address(INTEGRATOR_SC_BASE);
663 sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET);
664 for (i = 0; i < 4; i++) {
665 struct lm_device *lmdev;
666
667 if ((sc_dec & (16 << i)) == 0)
668 continue;
669
670 lmdev = kzalloc(sizeof(struct lm_device), GFP_KERNEL);
671 if (!lmdev)
672 continue;
673
674 lmdev->resource.start = 0xc0000000 + 0x10000000 * i;
675 lmdev->resource.end = lmdev->resource.start + 0x0fffffff;
676 lmdev->resource.flags = IORESOURCE_MEM;
677 lmdev->irq = IRQ_AP_EXPINT0 + i;
678 lmdev->id = i;
679
680 lm_device_register(lmdev);
681 }
682
683 integrator_init(false);
684}
685
686MACHINE_START(INTEGRATOR, "ARM-Integrator")
687 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
688 .atag_offset = 0x100,
689 .reserve = integrator_reserve,
690 .map_io = ap_map_io_atag,
691 .init_early = ap_init_early,
692 .init_irq = ap_init_irq,
693 .handle_irq = fpga_handle_irq,
694 .init_time = ap_timer_init,
695 .init_machine = ap_init,
696 .restart = integrator_restart,
697MACHINE_END
698
699#endif
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 8c60fcb08a98..1df6e7602cad 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -36,9 +36,7 @@
36#include <asm/hardware/arm_timer.h> 36#include <asm/hardware/arm_timer.h>
37#include <asm/hardware/icst.h> 37#include <asm/hardware/icst.h>
38 38
39#include <mach/cm.h>
40#include <mach/lm.h> 39#include <mach/lm.h>
41#include <mach/irqs.h>
42 40
43#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
44#include <asm/mach/irq.h> 42#include <asm/mach/irq.h>
@@ -50,6 +48,7 @@
50#include <plat/clcd.h> 48#include <plat/clcd.h>
51#include <plat/sched_clock.h> 49#include <plat/sched_clock.h>
52 50
51#include "cm.h"
53#include "common.h" 52#include "common.h"
54 53
55/* Base address to the CP controller */ 54/* Base address to the CP controller */
@@ -249,7 +248,6 @@ static void __init intcp_init_early(void)
249#endif 248#endif
250} 249}
251 250
252#ifdef CONFIG_OF
253static const struct of_device_id fpga_irq_of_match[] __initconst = { 251static const struct of_device_id fpga_irq_of_match[] __initconst = {
254 { .compatible = "arm,versatile-fpga-irq", .data = fpga_irq_of_init, }, 252 { .compatible = "arm,versatile-fpga-irq", .data = fpga_irq_of_init, },
255 { /* Sentinel */ } 253 { /* Sentinel */ }
@@ -257,6 +255,7 @@ static const struct of_device_id fpga_irq_of_match[] __initconst = {
257 255
258static void __init intcp_init_irq_of(void) 256static void __init intcp_init_irq_of(void)
259{ 257{
258 cm_init();
260 of_irq_init(fpga_irq_of_match); 259 of_irq_init(fpga_irq_of_match);
261 integrator_clk_init(true); 260 integrator_clk_init(true);
262} 261}
@@ -287,6 +286,11 @@ static struct of_dev_auxdata intcp_auxdata_lookup[] __initdata = {
287 { /* sentinel */ }, 286 { /* sentinel */ },
288}; 287};
289 288
289static const struct of_device_id intcp_syscon_match[] = {
290 { .compatible = "arm,integrator-cp-syscon"},
291 { },
292};
293
290static void __init intcp_init_of(void) 294static void __init intcp_init_of(void)
291{ 295{
292 struct device_node *root; 296 struct device_node *root;
@@ -301,7 +305,8 @@ static void __init intcp_init_of(void)
301 root = of_find_node_by_path("/"); 305 root = of_find_node_by_path("/");
302 if (!root) 306 if (!root)
303 return; 307 return;
304 cpcon = of_find_node_by_path("/cpcon"); 308
309 cpcon = of_find_matching_node(root, intcp_syscon_match);
305 if (!cpcon) 310 if (!cpcon)
306 return; 311 return;
307 312
@@ -354,175 +359,3 @@ DT_MACHINE_START(INTEGRATOR_CP_DT, "ARM Integrator/CP (Device Tree)")
354 .restart = integrator_restart, 359 .restart = integrator_restart,
355 .dt_compat = intcp_dt_board_compat, 360 .dt_compat = intcp_dt_board_compat,
356MACHINE_END 361MACHINE_END
357
358#endif
359
360#ifdef CONFIG_ATAGS
361
362/*
363 * For the ATAG boot some static mappings are needed. This will
364 * go away with the ATAG support down the road.
365 */
366
367static struct map_desc intcp_io_desc_atag[] __initdata = {
368 {
369 .virtual = IO_ADDRESS(INTEGRATOR_CP_CTL_BASE),
370 .pfn = __phys_to_pfn(INTEGRATOR_CP_CTL_BASE),
371 .length = SZ_4K,
372 .type = MT_DEVICE
373 },
374};
375
376static void __init intcp_map_io_atag(void)
377{
378 iotable_init(intcp_io_desc_atag, ARRAY_SIZE(intcp_io_desc_atag));
379 intcp_con_base = __io_address(INTEGRATOR_CP_CTL_BASE);
380 intcp_map_io();
381}
382
383
384/*
385 * This is where non-devicetree initialization code is collected and stashed
386 * for eventual deletion.
387 */
388
389#define INTCP_FLASH_SIZE SZ_32M
390
391static struct resource intcp_flash_resource = {
392 .start = INTCP_PA_FLASH_BASE,
393 .end = INTCP_PA_FLASH_BASE + INTCP_FLASH_SIZE - 1,
394 .flags = IORESOURCE_MEM,
395};
396
397static struct platform_device intcp_flash_device = {
398 .name = "physmap-flash",
399 .id = 0,
400 .dev = {
401 .platform_data = &intcp_flash_data,
402 },
403 .num_resources = 1,
404 .resource = &intcp_flash_resource,
405};
406
407#define INTCP_ETH_SIZE 0x10
408
409static struct resource smc91x_resources[] = {
410 [0] = {
411 .start = INTEGRATOR_CP_ETH_BASE,
412 .end = INTEGRATOR_CP_ETH_BASE + INTCP_ETH_SIZE - 1,
413 .flags = IORESOURCE_MEM,
414 },
415 [1] = {
416 .start = IRQ_CP_ETHINT,
417 .end = IRQ_CP_ETHINT,
418 .flags = IORESOURCE_IRQ,
419 },
420};
421
422static struct platform_device smc91x_device = {
423 .name = "smc91x",
424 .id = 0,
425 .num_resources = ARRAY_SIZE(smc91x_resources),
426 .resource = smc91x_resources,
427};
428
429static struct platform_device *intcp_devs[] __initdata = {
430 &intcp_flash_device,
431 &smc91x_device,
432};
433
434#define INTCP_VA_CIC_BASE __io_address(INTEGRATOR_HDR_BASE + 0x40)
435#define INTCP_VA_PIC_BASE __io_address(INTEGRATOR_IC_BASE)
436#define INTCP_VA_SIC_BASE __io_address(INTEGRATOR_CP_SIC_BASE)
437
438static void __init intcp_init_irq(void)
439{
440 u32 pic_mask, cic_mask, sic_mask;
441
442 /* These masks are for the HW IRQ registers */
443 pic_mask = ~((~0u) << (11 - 0));
444 pic_mask |= (~((~0u) << (29 - 22))) << 22;
445 cic_mask = ~((~0u) << (1 + IRQ_CIC_END - IRQ_CIC_START));
446 sic_mask = ~((~0u) << (1 + IRQ_SIC_END - IRQ_SIC_START));
447
448 /*
449 * Disable all interrupt sources
450 */
451 writel(0xffffffff, INTCP_VA_PIC_BASE + IRQ_ENABLE_CLEAR);
452 writel(0xffffffff, INTCP_VA_PIC_BASE + FIQ_ENABLE_CLEAR);
453 writel(0xffffffff, INTCP_VA_CIC_BASE + IRQ_ENABLE_CLEAR);
454 writel(0xffffffff, INTCP_VA_CIC_BASE + FIQ_ENABLE_CLEAR);
455 writel(sic_mask, INTCP_VA_SIC_BASE + IRQ_ENABLE_CLEAR);
456 writel(sic_mask, INTCP_VA_SIC_BASE + FIQ_ENABLE_CLEAR);
457
458 fpga_irq_init(INTCP_VA_PIC_BASE, "PIC", IRQ_PIC_START,
459 -1, pic_mask, NULL);
460
461 fpga_irq_init(INTCP_VA_CIC_BASE, "CIC", IRQ_CIC_START,
462 -1, cic_mask, NULL);
463
464 fpga_irq_init(INTCP_VA_SIC_BASE, "SIC", IRQ_SIC_START,
465 IRQ_CP_CPPLDINT, sic_mask, NULL);
466
467 integrator_clk_init(true);
468}
469
470#define TIMER0_VA_BASE __io_address(INTEGRATOR_TIMER0_BASE)
471#define TIMER1_VA_BASE __io_address(INTEGRATOR_TIMER1_BASE)
472#define TIMER2_VA_BASE __io_address(INTEGRATOR_TIMER2_BASE)
473
474static void __init cp_timer_init(void)
475{
476 writel(0, TIMER0_VA_BASE + TIMER_CTRL);
477 writel(0, TIMER1_VA_BASE + TIMER_CTRL);
478 writel(0, TIMER2_VA_BASE + TIMER_CTRL);
479
480 sp804_clocksource_init(TIMER2_VA_BASE, "timer2");
481 sp804_clockevents_init(TIMER1_VA_BASE, IRQ_TIMERINT1, "timer1");
482}
483
484#define INTEGRATOR_CP_MMC_IRQS { IRQ_CP_MMCIINT0, IRQ_CP_MMCIINT1 }
485#define INTEGRATOR_CP_AACI_IRQS { IRQ_CP_AACIINT }
486
487static AMBA_APB_DEVICE(mmc, "mmci", 0, INTEGRATOR_CP_MMC_BASE,
488 INTEGRATOR_CP_MMC_IRQS, &mmc_data);
489
490static AMBA_APB_DEVICE(aaci, "aaci", 0, INTEGRATOR_CP_AACI_BASE,
491 INTEGRATOR_CP_AACI_IRQS, NULL);
492
493static AMBA_AHB_DEVICE(clcd, "clcd", 0, INTCP_PA_CLCD_BASE,
494 { IRQ_CP_CLCDCINT }, &clcd_data);
495
496static struct amba_device *amba_devs[] __initdata = {
497 &mmc_device,
498 &aaci_device,
499 &clcd_device,
500};
501
502static void __init intcp_init(void)
503{
504 int i;
505
506 platform_add_devices(intcp_devs, ARRAY_SIZE(intcp_devs));
507
508 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
509 struct amba_device *d = amba_devs[i];
510 amba_device_register(d, &iomem_resource);
511 }
512 integrator_init(true);
513}
514
515MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
516 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
517 .atag_offset = 0x100,
518 .reserve = integrator_reserve,
519 .map_io = intcp_map_io_atag,
520 .init_early = intcp_init_early,
521 .init_irq = intcp_init_irq,
522 .handle_irq = fpga_handle_irq,
523 .init_time = cp_timer_init,
524 .init_machine = intcp_init,
525 .restart = integrator_restart,
526MACHINE_END
527
528#endif
diff --git a/arch/arm/mach-integrator/leds.c b/arch/arm/mach-integrator/leds.c
index 7a7f6d3273bf..cb6ac58f5e07 100644
--- a/arch/arm/mach-integrator/leds.c
+++ b/arch/arm/mach-integrator/leds.c
@@ -11,10 +11,11 @@
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/leds.h> 12#include <linux/leds.h>
13 13
14#include <mach/cm.h>
15#include <mach/hardware.h> 14#include <mach/hardware.h>
16#include <mach/platform.h> 15#include <mach/platform.h>
17 16
17#include "cm.h"
18
18#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) 19#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
19 20
20#define ALPHA_REG __io_address(INTEGRATOR_DBG_BASE) 21#define ALPHA_REG __io_address(INTEGRATOR_DBG_BASE)
@@ -78,7 +79,7 @@ static void cm_led_set(struct led_classdev *cdev,
78 79
79static enum led_brightness cm_led_get(struct led_classdev *cdev) 80static enum led_brightness cm_led_get(struct led_classdev *cdev)
80{ 81{
81 u32 reg = readl(CM_CTRL); 82 u32 reg = cm_get();
82 83
83 return (reg & CM_CTRL_LED) ? LED_FULL : LED_OFF; 84 return (reg & CM_CTRL_LED) ? LED_FULL : LED_OFF;
84} 85}
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index bef100527c42..c5e01b24d9fb 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -36,7 +36,6 @@
36 36
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <mach/platform.h> 38#include <mach/platform.h>
39#include <mach/irqs.h>
40 39
41#include <asm/mach/map.h> 40#include <asm/mach/map.h>
42#include <asm/signal.h> 41#include <asm/signal.h>
@@ -605,7 +604,7 @@ v3_pci_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
605 return 1; 604 return 1;
606} 605}
607 606
608static irqreturn_t v3_irq(int dummy, void *devid) 607static irqreturn_t v3_irq(int irq, void *devid)
609{ 608{
610#ifdef CONFIG_DEBUG_LL 609#ifdef CONFIG_DEBUG_LL
611 struct pt_regs *regs = get_irq_regs(); 610 struct pt_regs *regs = get_irq_regs();
@@ -615,7 +614,7 @@ static irqreturn_t v3_irq(int dummy, void *devid)
615 extern void printascii(const char *); 614 extern void printascii(const char *);
616 615
617 sprintf(buf, "V3 int %d: pc=0x%08lx [%08lx] LBFADDR=%08x LBFCODE=%02x " 616 sprintf(buf, "V3 int %d: pc=0x%08lx [%08lx] LBFADDR=%08x LBFCODE=%02x "
618 "ISTAT=%02x\n", IRQ_AP_V3INT, pc, instr, 617 "ISTAT=%02x\n", irq, pc, instr,
619 __raw_readl(ap_syscon_base + INTEGRATOR_SC_LBFADDR_OFFSET), 618 __raw_readl(ap_syscon_base + INTEGRATOR_SC_LBFADDR_OFFSET),
620 __raw_readl(ap_syscon_base + INTEGRATOR_SC_LBFCODE_OFFSET) & 255, 619 __raw_readl(ap_syscon_base + INTEGRATOR_SC_LBFCODE_OFFSET) & 255,
621 v3_readb(V3_LB_ISTAT)); 620 v3_readb(V3_LB_ISTAT));
@@ -809,21 +808,6 @@ static u8 __init pci_v3_swizzle(struct pci_dev *dev, u8 *pinp)
809 return pci_common_swizzle(dev, pinp); 808 return pci_common_swizzle(dev, pinp);
810} 809}
811 810
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 = { 811static struct hw_pci pci_v3 __initdata = {
828 .swizzle = pci_v3_swizzle, 812 .swizzle = pci_v3_swizzle,
829 .setup = pci_v3_setup, 813 .setup = pci_v3_setup,
@@ -833,32 +817,27 @@ static struct hw_pci pci_v3 __initdata = {
833 .postinit = pci_v3_postinit, 817 .postinit = pci_v3_postinit,
834}; 818};
835 819
836#ifdef CONFIG_OF 820static int __init pci_v3_probe(struct platform_device *pdev)
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{ 821{
822 struct device_node *np = pdev->dev.of_node;
857 struct of_pci_range_parser parser; 823 struct of_pci_range_parser parser;
858 struct of_pci_range range; 824 struct of_pci_range range;
859 struct resource *res; 825 struct resource *res;
860 int irq, ret; 826 int irq, ret;
861 827
828 /* Remap the Integrator system controller */
829 ap_syscon_base = devm_ioremap(&pdev->dev, INTEGRATOR_SC_BASE, 0x100);
830 if (!ap_syscon_base) {
831 dev_err(&pdev->dev, "unable to remap the AP syscon for PCIv3\n");
832 return -ENODEV;
833 }
834
835 /* Device tree probe path */
836 if (!np) {
837 dev_err(&pdev->dev, "no device tree node for PCIv3\n");
838 return -ENODEV;
839 }
840
862 if (of_pci_range_parser_init(&parser, np)) 841 if (of_pci_range_parser_init(&parser, np))
863 return -EINVAL; 842 return -EINVAL;
864 843
@@ -919,77 +898,7 @@ static int __init pci_v3_dtprobe(struct platform_device *pdev,
919 return -EINVAL; 898 return -EINVAL;
920 } 899 }
921 900
922 pci_v3.map_irq = pci_v3_map_irq_dt; 901 pci_v3.map_irq = of_irq_parse_and_map_pci;
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); 902 pci_common_init_dev(&pdev->dev, &pci_v3);
994 903
995 return 0; 904 return 0;
diff --git a/arch/arm/mach-integrator/pci_v3.h b/arch/arm/mach-integrator/pci_v3.h
index 755fd29fed4a..06a9e2e7d007 100644
--- a/arch/arm/mach-integrator/pci_v3.h
+++ b/arch/arm/mach-integrator/pci_v3.h
@@ -1,2 +1,9 @@
1/* Simple oneliner include to the PCIv3 early init */ 1/* Simple oneliner include to the PCIv3 early init */
2#ifdef CONFIG_PCI
2extern int pci_v3_early_init(void); 3extern int pci_v3_early_init(void);
4#else
5static inline int pci_v3_early_init(void)
6{
7 return 0;
8}
9#endif
diff --git a/arch/arm/mach-iop32x/em7210.c b/arch/arm/mach-iop32x/em7210.c
index 31fbb6c61b25..177cd073a83b 100644
--- a/arch/arm/mach-iop32x/em7210.c
+++ b/arch/arm/mach-iop32x/em7210.c
@@ -32,6 +32,7 @@
32#include <asm/mach/time.h> 32#include <asm/mach/time.h>
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <mach/time.h> 34#include <mach/time.h>
35#include "gpio-iop32x.h"
35 36
36static void __init em7210_timer_init(void) 37static void __init em7210_timer_init(void)
37{ 38{
@@ -183,6 +184,7 @@ void em7210_power_off(void)
183 184
184static void __init em7210_init_machine(void) 185static void __init em7210_init_machine(void)
185{ 186{
187 register_iop32x_gpio();
186 platform_device_register(&em7210_serial_device); 188 platform_device_register(&em7210_serial_device);
187 platform_device_register(&iop3xx_i2c0_device); 189 platform_device_register(&iop3xx_i2c0_device);
188 platform_device_register(&iop3xx_i2c1_device); 190 platform_device_register(&iop3xx_i2c1_device);
diff --git a/arch/arm/mach-iop32x/glantank.c b/arch/arm/mach-iop32x/glantank.c
index ac304705fe68..547b2342d61a 100644
--- a/arch/arm/mach-iop32x/glantank.c
+++ b/arch/arm/mach-iop32x/glantank.c
@@ -34,6 +34,7 @@
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35#include <asm/page.h> 35#include <asm/page.h>
36#include <mach/time.h> 36#include <mach/time.h>
37#include "gpio-iop32x.h"
37 38
38/* 39/*
39 * GLAN Tank timer tick configuration. 40 * GLAN Tank timer tick configuration.
@@ -187,6 +188,7 @@ static void glantank_power_off(void)
187 188
188static void __init glantank_init_machine(void) 189static void __init glantank_init_machine(void)
189{ 190{
191 register_iop32x_gpio();
190 platform_device_register(&iop3xx_i2c0_device); 192 platform_device_register(&iop3xx_i2c0_device);
191 platform_device_register(&iop3xx_i2c1_device); 193 platform_device_register(&iop3xx_i2c1_device);
192 platform_device_register(&glantank_flash_device); 194 platform_device_register(&glantank_flash_device);
diff --git a/arch/arm/mach-iop32x/gpio-iop32x.h b/arch/arm/mach-iop32x/gpio-iop32x.h
new file mode 100644
index 000000000000..3c7309c02029
--- /dev/null
+++ b/arch/arm/mach-iop32x/gpio-iop32x.h
@@ -0,0 +1,10 @@
1static struct resource iop32x_gpio_res[] = {
2 DEFINE_RES_MEM((IOP3XX_PERIPHERAL_PHYS_BASE + 0x07c4), 0x10),
3};
4
5static inline void register_iop32x_gpio(void)
6{
7 platform_device_register_simple("gpio-iop", 0,
8 iop32x_gpio_res,
9 ARRAY_SIZE(iop32x_gpio_res));
10}
diff --git a/arch/arm/mach-iop32x/include/mach/gpio.h b/arch/arm/mach-iop32x/include/mach/gpio.h
deleted file mode 100644
index 708f4ec9db1d..000000000000
--- a/arch/arm/mach-iop32x/include/mach/gpio.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_ARCH_IOP32X_GPIO_H
2#define __ASM_ARCH_IOP32X_GPIO_H
3
4#include <asm/hardware/iop3xx-gpio.h>
5
6#endif
diff --git a/arch/arm/mach-iop32x/include/mach/iop32x.h b/arch/arm/mach-iop32x/include/mach/iop32x.h
index 941f363aca56..56ec864ec313 100644
--- a/arch/arm/mach-iop32x/include/mach/iop32x.h
+++ b/arch/arm/mach-iop32x/include/mach/iop32x.h
@@ -19,7 +19,6 @@
19 * Peripherals that are shared between the iop32x and iop33x but 19 * Peripherals that are shared between the iop32x and iop33x but
20 * located at different addresses. 20 * located at different addresses.
21 */ 21 */
22#define IOP3XX_GPIO_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07c4 + (reg))
23#define IOP3XX_TIMER_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07e0 + (reg)) 22#define IOP3XX_TIMER_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07e0 + (reg))
24 23
25#include <asm/hardware/iop3xx.h> 24#include <asm/hardware/iop3xx.h>
diff --git a/arch/arm/mach-iop32x/iq31244.c b/arch/arm/mach-iop32x/iq31244.c
index f2cd2966212d..0e1392b20d18 100644
--- a/arch/arm/mach-iop32x/iq31244.c
+++ b/arch/arm/mach-iop32x/iq31244.c
@@ -37,6 +37,7 @@
37#include <asm/page.h> 37#include <asm/page.h>
38#include <asm/pgtable.h> 38#include <asm/pgtable.h>
39#include <mach/time.h> 39#include <mach/time.h>
40#include "gpio-iop32x.h"
40 41
41/* 42/*
42 * Until March of 2007 iq31244 platforms and ep80219 platforms shared the 43 * Until March of 2007 iq31244 platforms and ep80219 platforms shared the
@@ -283,6 +284,7 @@ void ep80219_power_off(void)
283 284
284static void __init iq31244_init_machine(void) 285static void __init iq31244_init_machine(void)
285{ 286{
287 register_iop32x_gpio();
286 platform_device_register(&iop3xx_i2c0_device); 288 platform_device_register(&iop3xx_i2c0_device);
287 platform_device_register(&iop3xx_i2c1_device); 289 platform_device_register(&iop3xx_i2c1_device);
288 platform_device_register(&iq31244_flash_device); 290 platform_device_register(&iq31244_flash_device);
diff --git a/arch/arm/mach-iop32x/iq80321.c b/arch/arm/mach-iop32x/iq80321.c
index 015435de90dd..66782ff1f46a 100644
--- a/arch/arm/mach-iop32x/iq80321.c
+++ b/arch/arm/mach-iop32x/iq80321.c
@@ -33,6 +33,7 @@
33#include <asm/page.h> 33#include <asm/page.h>
34#include <asm/pgtable.h> 34#include <asm/pgtable.h>
35#include <mach/time.h> 35#include <mach/time.h>
36#include "gpio-iop32x.h"
36 37
37/* 38/*
38 * IQ80321 timer tick configuration. 39 * IQ80321 timer tick configuration.
@@ -170,6 +171,7 @@ static struct platform_device iq80321_serial_device = {
170 171
171static void __init iq80321_init_machine(void) 172static void __init iq80321_init_machine(void)
172{ 173{
174 register_iop32x_gpio();
173 platform_device_register(&iop3xx_i2c0_device); 175 platform_device_register(&iop3xx_i2c0_device);
174 platform_device_register(&iop3xx_i2c1_device); 176 platform_device_register(&iop3xx_i2c1_device);
175 platform_device_register(&iq80321_flash_device); 177 platform_device_register(&iq80321_flash_device);
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c
index 069144300b77..c1cd80ecc219 100644
--- a/arch/arm/mach-iop32x/n2100.c
+++ b/arch/arm/mach-iop32x/n2100.c
@@ -30,6 +30,7 @@
30#include <linux/platform_device.h> 30#include <linux/platform_device.h>
31#include <linux/reboot.h> 31#include <linux/reboot.h>
32#include <linux/io.h> 32#include <linux/io.h>
33#include <linux/gpio.h>
33#include <mach/hardware.h> 34#include <mach/hardware.h>
34#include <asm/irq.h> 35#include <asm/irq.h>
35#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
@@ -40,6 +41,7 @@
40#include <asm/page.h> 41#include <asm/page.h>
41#include <asm/pgtable.h> 42#include <asm/pgtable.h>
42#include <mach/time.h> 43#include <mach/time.h>
44#include "gpio-iop32x.h"
43 45
44/* 46/*
45 * N2100 timer tick configuration. 47 * N2100 timer tick configuration.
@@ -288,8 +290,14 @@ static void n2100_power_off(void)
288 290
289static void n2100_restart(enum reboot_mode mode, const char *cmd) 291static void n2100_restart(enum reboot_mode mode, const char *cmd)
290{ 292{
291 gpio_line_set(N2100_HARDWARE_RESET, GPIO_LOW); 293 int ret;
292 gpio_line_config(N2100_HARDWARE_RESET, GPIO_OUT); 294
295 ret = gpio_direction_output(N2100_HARDWARE_RESET, 0);
296 if (ret) {
297 pr_crit("could not drive reset GPIO low\n");
298 return;
299 }
300 /* Wait for reset to happen */
293 while (1) 301 while (1)
294 ; 302 ;
295} 303}
@@ -299,7 +307,7 @@ static struct timer_list power_button_poll_timer;
299 307
300static void power_button_poll(unsigned long dummy) 308static void power_button_poll(unsigned long dummy)
301{ 309{
302 if (gpio_line_get(N2100_POWER_BUTTON) == 0) { 310 if (gpio_get_value(N2100_POWER_BUTTON) == 0) {
303 ctrl_alt_del(); 311 ctrl_alt_del();
304 return; 312 return;
305 } 313 }
@@ -308,9 +316,37 @@ static void power_button_poll(unsigned long dummy)
308 add_timer(&power_button_poll_timer); 316 add_timer(&power_button_poll_timer);
309} 317}
310 318
319static int __init n2100_request_gpios(void)
320{
321 int ret;
322
323 if (!machine_is_n2100())
324 return 0;
325
326 ret = gpio_request(N2100_HARDWARE_RESET, "reset");
327 if (ret)
328 pr_err("could not request reset GPIO\n");
329
330 ret = gpio_request(N2100_POWER_BUTTON, "power");
331 if (ret)
332 pr_err("could not request power GPIO\n");
333 else {
334 ret = gpio_direction_input(N2100_POWER_BUTTON);
335 if (ret)
336 pr_err("could not set power GPIO as input\n");
337 }
338 /* Set up power button poll timer */
339 init_timer(&power_button_poll_timer);
340 power_button_poll_timer.function = power_button_poll;
341 power_button_poll_timer.expires = jiffies + (HZ / 10);
342 add_timer(&power_button_poll_timer);
343 return 0;
344}
345device_initcall(n2100_request_gpios);
311 346
312static void __init n2100_init_machine(void) 347static void __init n2100_init_machine(void)
313{ 348{
349 register_iop32x_gpio();
314 platform_device_register(&iop3xx_i2c0_device); 350 platform_device_register(&iop3xx_i2c0_device);
315 platform_device_register(&n2100_flash_device); 351 platform_device_register(&n2100_flash_device);
316 platform_device_register(&n2100_serial_device); 352 platform_device_register(&n2100_serial_device);
@@ -321,11 +357,6 @@ static void __init n2100_init_machine(void)
321 ARRAY_SIZE(n2100_i2c_devices)); 357 ARRAY_SIZE(n2100_i2c_devices));
322 358
323 pm_power_off = n2100_power_off; 359 pm_power_off = n2100_power_off;
324
325 init_timer(&power_button_poll_timer);
326 power_button_poll_timer.function = power_button_poll;
327 power_button_poll_timer.expires = jiffies + (HZ / 10);
328 add_timer(&power_button_poll_timer);
329} 360}
330 361
331MACHINE_START(N2100, "Thecus N2100") 362MACHINE_START(N2100, "Thecus N2100")
diff --git a/arch/arm/mach-iop33x/include/mach/gpio.h b/arch/arm/mach-iop33x/include/mach/gpio.h
deleted file mode 100644
index ddd55bba9bb9..000000000000
--- a/arch/arm/mach-iop33x/include/mach/gpio.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_ARCH_IOP33X_GPIO_H
2#define __ASM_ARCH_IOP33X_GPIO_H
3
4#include <asm/hardware/iop3xx-gpio.h>
5
6#endif
diff --git a/arch/arm/mach-iop33x/include/mach/iop33x.h b/arch/arm/mach-iop33x/include/mach/iop33x.h
index a89c0a234bff..c95122653094 100644
--- a/arch/arm/mach-iop33x/include/mach/iop33x.h
+++ b/arch/arm/mach-iop33x/include/mach/iop33x.h
@@ -18,7 +18,6 @@
18 * Peripherals that are shared between the iop32x and iop33x but 18 * Peripherals that are shared between the iop32x and iop33x but
19 * located at different addresses. 19 * located at different addresses.
20 */ 20 */
21#define IOP3XX_GPIO_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x1780 + (reg))
22#define IOP3XX_TIMER_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07d0 + (reg)) 21#define IOP3XX_TIMER_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07d0 + (reg))
23 22
24#include <asm/hardware/iop3xx.h> 23#include <asm/hardware/iop3xx.h>
diff --git a/arch/arm/mach-iop33x/iq80331.c b/arch/arm/mach-iop33x/iq80331.c
index c43304a10fa7..e2cb65cfbe23 100644
--- a/arch/arm/mach-iop33x/iq80331.c
+++ b/arch/arm/mach-iop33x/iq80331.c
@@ -122,8 +122,15 @@ static struct platform_device iq80331_flash_device = {
122 .resource = &iq80331_flash_resource, 122 .resource = &iq80331_flash_resource,
123}; 123};
124 124
125static struct resource iq80331_gpio_res[] = {
126 DEFINE_RES_MEM((IOP3XX_PERIPHERAL_PHYS_BASE + 0x1780), 0x10),
127};
128
125static void __init iq80331_init_machine(void) 129static void __init iq80331_init_machine(void)
126{ 130{
131 platform_device_register_simple("gpio-iop", 0,
132 iq80331_gpio_res,
133 ARRAY_SIZE(iq80331_gpio_res));
127 platform_device_register(&iop3xx_i2c0_device); 134 platform_device_register(&iop3xx_i2c0_device);
128 platform_device_register(&iop3xx_i2c1_device); 135 platform_device_register(&iop3xx_i2c1_device);
129 platform_device_register(&iop33x_uart0_device); 136 platform_device_register(&iop33x_uart0_device);
diff --git a/arch/arm/mach-iop33x/iq80332.c b/arch/arm/mach-iop33x/iq80332.c
index 8192987e78e5..0b6269d94f89 100644
--- a/arch/arm/mach-iop33x/iq80332.c
+++ b/arch/arm/mach-iop33x/iq80332.c
@@ -122,8 +122,15 @@ static struct platform_device iq80332_flash_device = {
122 .resource = &iq80332_flash_resource, 122 .resource = &iq80332_flash_resource,
123}; 123};
124 124
125static struct resource iq80332_gpio_res[] = {
126 DEFINE_RES_MEM((IOP3XX_PERIPHERAL_PHYS_BASE + 0x1780), 0x10),
127};
128
125static void __init iq80332_init_machine(void) 129static void __init iq80332_init_machine(void)
126{ 130{
131 platform_device_register_simple("gpio-iop", 0,
132 iq80332_gpio_res,
133 ARRAY_SIZE(iq80332_gpio_res));
127 platform_device_register(&iop3xx_i2c0_device); 134 platform_device_register(&iop3xx_i2c0_device);
128 platform_device_register(&iop3xx_i2c1_device); 135 platform_device_register(&iop3xx_i2c1_device);
129 platform_device_register(&iop33x_uart0_device); 136 platform_device_register(&iop33x_uart0_device);
diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig
index 30e1ebe3a891..c342dc4e8a45 100644
--- a/arch/arm/mach-ixp4xx/Kconfig
+++ b/arch/arm/mach-ixp4xx/Kconfig
@@ -1,9 +1,5 @@
1if ARCH_IXP4XX 1if ARCH_IXP4XX
2 2
3config ARCH_SUPPORTS_BIG_ENDIAN
4 bool
5 default y
6
7menu "Intel IXP4xx Implementation Options" 3menu "Intel IXP4xx Implementation Options"
8 4
9comment "IXP4xx Platforms" 5comment "IXP4xx Platforms"
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 5327decde5a0..9edaf4734fa8 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -81,6 +81,44 @@ void __init ixp4xx_map_io(void)
81 iotable_init(ixp4xx_io_desc, ARRAY_SIZE(ixp4xx_io_desc)); 81 iotable_init(ixp4xx_io_desc, ARRAY_SIZE(ixp4xx_io_desc));
82} 82}
83 83
84/*
85 * GPIO-functions
86 */
87/*
88 * The following converted to the real HW bits the gpio_line_config
89 */
90/* GPIO pin types */
91#define IXP4XX_GPIO_OUT 0x1
92#define IXP4XX_GPIO_IN 0x2
93
94/* GPIO signal types */
95#define IXP4XX_GPIO_LOW 0
96#define IXP4XX_GPIO_HIGH 1
97
98/* GPIO Clocks */
99#define IXP4XX_GPIO_CLK_0 14
100#define IXP4XX_GPIO_CLK_1 15
101
102static void gpio_line_config(u8 line, u32 direction)
103{
104 if (direction == IXP4XX_GPIO_IN)
105 *IXP4XX_GPIO_GPOER |= (1 << line);
106 else
107 *IXP4XX_GPIO_GPOER &= ~(1 << line);
108}
109
110static void gpio_line_get(u8 line, int *value)
111{
112 *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;
113}
114
115static void gpio_line_set(u8 line, int value)
116{
117 if (value == IXP4XX_GPIO_HIGH)
118 *IXP4XX_GPIO_GPOUTR |= (1 << line);
119 else if (value == IXP4XX_GPIO_LOW)
120 *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
121}
84 122
85/************************************************************************* 123/*************************************************************************
86 * IXP4xx chipset IRQ handling 124 * IXP4xx chipset IRQ handling
@@ -117,17 +155,6 @@ static int ixp4xx_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
117 return -EINVAL; 155 return -EINVAL;
118} 156}
119 157
120int irq_to_gpio(unsigned int irq)
121{
122 int gpio = (irq < 32) ? irq2gpio[irq] : -EINVAL;
123
124 if (gpio == -1)
125 return -EINVAL;
126
127 return gpio;
128}
129EXPORT_SYMBOL(irq_to_gpio);
130
131static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type) 158static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type)
132{ 159{
133 int line = irq2gpio[d->irq]; 160 int line = irq2gpio[d->irq];
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index 63de1b3fd06b..736dc692d540 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -26,6 +26,7 @@
26#include <linux/reboot.h> 26#include <linux/reboot.h>
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/i2c-gpio.h> 28#include <linux/i2c-gpio.h>
29#include <linux/gpio.h>
29 30
30#include <mach/hardware.h> 31#include <mach/hardware.h>
31 32
@@ -161,11 +162,8 @@ static struct platform_device *dsmg600_devices[] __initdata = {
161 162
162static void dsmg600_power_off(void) 163static void dsmg600_power_off(void)
163{ 164{
164 /* enable the pwr cntl gpio */ 165 /* enable the pwr cntl and drive it high */
165 gpio_line_config(DSMG600_PO_GPIO, IXP4XX_GPIO_OUT); 166 gpio_direction_output(DSMG600_PO_GPIO, 1);
166
167 /* poweroff */
168 gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH);
169} 167}
170 168
171/* This is used to make sure the power-button pusher is serious. The button 169/* This is used to make sure the power-button pusher is serious. The button
@@ -202,7 +200,7 @@ static void dsmg600_power_handler(unsigned long data)
202 ctrl_alt_del(); 200 ctrl_alt_del();
203 201
204 /* Change the state of the power LED to "blink" */ 202 /* Change the state of the power LED to "blink" */
205 gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW); 203 gpio_set_value(DSMG600_LED_PWR_GPIO, 0);
206 } else { 204 } else {
207 power_button_countdown = PBUTTON_HOLDDOWN_COUNT; 205 power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
208 } 206 }
@@ -228,6 +226,40 @@ static void __init dsmg600_timer_init(void)
228 ixp4xx_timer_init(); 226 ixp4xx_timer_init();
229} 227}
230 228
229static int __init dsmg600_gpio_init(void)
230{
231 if (!machine_is_dsmg600())
232 return 0;
233
234 gpio_request(DSMG600_RB_GPIO, "reset button");
235 if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler,
236 IRQF_DISABLED | IRQF_TRIGGER_LOW,
237 "DSM-G600 reset button", NULL) < 0) {
238
239 printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
240 gpio_to_irq(DSMG600_RB_GPIO));
241 }
242
243 /*
244 * The power button on the D-Link DSM-G600 is on GPIO 15, but
245 * it cannot handle interrupts on that GPIO line. So we'll
246 * have to poll it with a kernel timer.
247 */
248
249 /* Make sure that the power button GPIO is set up as an input */
250 gpio_request(DSMG600_PB_GPIO, "power button");
251 gpio_direction_input(DSMG600_PB_GPIO);
252 /* Request poweroff GPIO line */
253 gpio_request(DSMG600_PO_GPIO, "power off button");
254
255 /* Set the initial value for the power button IRQ handler */
256 power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
257
258 mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500));
259 return 0;
260}
261device_initcall(dsmg600_gpio_init);
262
231static void __init dsmg600_init(void) 263static void __init dsmg600_init(void)
232{ 264{
233 ixp4xx_sys_init(); 265 ixp4xx_sys_init();
@@ -251,27 +283,6 @@ static void __init dsmg600_init(void)
251 platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices)); 283 platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
252 284
253 pm_power_off = dsmg600_power_off; 285 pm_power_off = dsmg600_power_off;
254
255 if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler,
256 IRQF_DISABLED | IRQF_TRIGGER_LOW,
257 "DSM-G600 reset button", NULL) < 0) {
258
259 printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
260 gpio_to_irq(DSMG600_RB_GPIO));
261 }
262
263 /* The power button on the D-Link DSM-G600 is on GPIO 15, but
264 * it cannot handle interrupts on that GPIO line. So we'll
265 * have to poll it with a kernel timer.
266 */
267
268 /* Make sure that the power button GPIO is set up as an input */
269 gpio_line_config(DSMG600_PB_GPIO, IXP4XX_GPIO_IN);
270
271 /* Set the initial value for the power button IRQ handler */
272 power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
273
274 mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500));
275} 286}
276 287
277MACHINE_START(DSMG600, "D-Link DSM-G600 RevA") 288MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
diff --git a/arch/arm/mach-ixp4xx/include/mach/platform.h b/arch/arm/mach-ixp4xx/include/mach/platform.h
index 4c4c6a6f4526..75c4c6572ad0 100644
--- a/arch/arm/mach-ixp4xx/include/mach/platform.h
+++ b/arch/arm/mach-ixp4xx/include/mach/platform.h
@@ -131,44 +131,5 @@ struct pci_sys_data;
131extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); 131extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
132extern struct pci_ops ixp4xx_ops; 132extern struct pci_ops ixp4xx_ops;
133 133
134/*
135 * GPIO-functions
136 */
137/*
138 * The following converted to the real HW bits the gpio_line_config
139 */
140/* GPIO pin types */
141#define IXP4XX_GPIO_OUT 0x1
142#define IXP4XX_GPIO_IN 0x2
143
144/* GPIO signal types */
145#define IXP4XX_GPIO_LOW 0
146#define IXP4XX_GPIO_HIGH 1
147
148/* GPIO Clocks */
149#define IXP4XX_GPIO_CLK_0 14
150#define IXP4XX_GPIO_CLK_1 15
151
152static inline void gpio_line_config(u8 line, u32 direction)
153{
154 if (direction == IXP4XX_GPIO_IN)
155 *IXP4XX_GPIO_GPOER |= (1 << line);
156 else
157 *IXP4XX_GPIO_GPOER &= ~(1 << line);
158}
159
160static inline void gpio_line_get(u8 line, int *value)
161{
162 *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;
163}
164
165static inline void gpio_line_set(u8 line, int value)
166{
167 if (value == IXP4XX_GPIO_HIGH)
168 *IXP4XX_GPIO_GPOUTR |= (1 << line);
169 else if (value == IXP4XX_GPIO_LOW)
170 *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
171}
172
173#endif // __ASSEMBLY__ 134#endif // __ASSEMBLY__
174 135
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index 22d688b7d513..e7b8befa8729 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -20,6 +20,7 @@
20#include <linux/mtd/nand.h> 20#include <linux/mtd/nand.h>
21#include <linux/mtd/partitions.h> 21#include <linux/mtd/partitions.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/gpio.h>
23#include <asm/types.h> 24#include <asm/types.h>
24#include <asm/setup.h> 25#include <asm/setup.h>
25#include <asm/memory.h> 26#include <asm/memory.h>
@@ -80,10 +81,10 @@ ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
80 81
81 if (ctrl & NAND_CTRL_CHANGE) { 82 if (ctrl & NAND_CTRL_CHANGE) {
82 if (ctrl & NAND_NCE) { 83 if (ctrl & NAND_NCE) {
83 gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_LOW); 84 gpio_set_value(IXDP425_NAND_NCE_PIN, 0);
84 udelay(5); 85 udelay(5);
85 } else 86 } else
86 gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_HIGH); 87 gpio_set_value(IXDP425_NAND_NCE_PIN, 1);
87 88
88 offset = (ctrl & NAND_CLE) ? IXDP425_NAND_CMD_BYTE : 0; 89 offset = (ctrl & NAND_CLE) ? IXDP425_NAND_CMD_BYTE : 0;
89 offset |= (ctrl & NAND_ALE) ? IXDP425_NAND_ADDR_BYTE : 0; 90 offset |= (ctrl & NAND_ALE) ? IXDP425_NAND_ADDR_BYTE : 0;
@@ -227,7 +228,8 @@ static void __init ixdp425_init(void)
227 ixdp425_flash_nand_resource.start = IXP4XX_EXP_BUS_BASE(3), 228 ixdp425_flash_nand_resource.start = IXP4XX_EXP_BUS_BASE(3),
228 ixdp425_flash_nand_resource.end = IXP4XX_EXP_BUS_BASE(3) + 0x10 - 1; 229 ixdp425_flash_nand_resource.end = IXP4XX_EXP_BUS_BASE(3) + 0x10 - 1;
229 230
230 gpio_line_config(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_OUT); 231 gpio_request(IXDP425_NAND_NCE_PIN, "NAND NCE pin");
232 gpio_direction_output(IXDP425_NAND_NCE_PIN, 0);
231 233
232 /* Configure expansion bus for NAND Flash */ 234 /* Configure expansion bus for NAND Flash */
233 *IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN | 235 *IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN |
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index ed667ce9f576..507cb5233537 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -184,11 +184,8 @@ static void nas100d_power_off(void)
184{ 184{
185 /* This causes the box to drop the power and go dead. */ 185 /* This causes the box to drop the power and go dead. */
186 186
187 /* enable the pwr cntl gpio */ 187 /* enable the pwr cntl gpio and assert power off */
188 gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT); 188 gpio_direction_output(NAS100D_PO_GPIO, 1);
189
190 /* do the deed */
191 gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
192} 189}
193 190
194/* This is used to make sure the power-button pusher is serious. The button 191/* This is used to make sure the power-button pusher is serious. The button
@@ -225,7 +222,7 @@ static void nas100d_power_handler(unsigned long data)
225 ctrl_alt_del(); 222 ctrl_alt_del();
226 223
227 /* Change the state of the power LED to "blink" */ 224 /* Change the state of the power LED to "blink" */
228 gpio_line_set(NAS100D_LED_PWR_GPIO, IXP4XX_GPIO_LOW); 225 gpio_set_value(NAS100D_LED_PWR_GPIO, 0);
229 } else { 226 } else {
230 power_button_countdown = PBUTTON_HOLDDOWN_COUNT; 227 power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
231 } 228 }
@@ -242,6 +239,33 @@ static irqreturn_t nas100d_reset_handler(int irq, void *dev_id)
242 return IRQ_HANDLED; 239 return IRQ_HANDLED;
243} 240}
244 241
242static int __init nas100d_gpio_init(void)
243{
244 if (!machine_is_nas100d())
245 return 0;
246
247 /*
248 * The power button on the Iomega NAS100d is on GPIO 14, but
249 * it cannot handle interrupts on that GPIO line. So we'll
250 * have to poll it with a kernel timer.
251 */
252
253 /* Request the power off GPIO */
254 gpio_request(NAS100D_PO_GPIO, "power off");
255
256 /* Make sure that the power button GPIO is set up as an input */
257 gpio_request(NAS100D_PB_GPIO, "power button");
258 gpio_direction_input(NAS100D_PB_GPIO);
259
260 /* Set the initial value for the power button IRQ handler */
261 power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
262
263 mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500));
264
265 return 0;
266}
267device_initcall(nas100d_gpio_init);
268
245static void __init nas100d_init(void) 269static void __init nas100d_init(void)
246{ 270{
247 uint8_t __iomem *f; 271 uint8_t __iomem *f;
@@ -278,19 +302,6 @@ static void __init nas100d_init(void)
278 gpio_to_irq(NAS100D_RB_GPIO)); 302 gpio_to_irq(NAS100D_RB_GPIO));
279 } 303 }
280 304
281 /* The power button on the Iomega NAS100d is on GPIO 14, but
282 * it cannot handle interrupts on that GPIO line. So we'll
283 * have to poll it with a kernel timer.
284 */
285
286 /* Make sure that the power button GPIO is set up as an input */
287 gpio_line_config(NAS100D_PB_GPIO, IXP4XX_GPIO_IN);
288
289 /* Set the initial value for the power button IRQ handler */
290 power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
291
292 mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500));
293
294 /* 305 /*
295 * Map in a portion of the flash and read the MAC address. 306 * Map in a portion of the flash and read the MAC address.
296 * Since it is stored in BE in the flash itself, we need to 307 * Since it is stored in BE in the flash itself, we need to
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index 7e55236c26ea..ba5f1cda2a9d 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -197,11 +197,8 @@ static void nslu2_power_off(void)
197{ 197{
198 /* This causes the box to drop the power and go dead. */ 198 /* This causes the box to drop the power and go dead. */
199 199
200 /* enable the pwr cntl gpio */ 200 /* enable the pwr cntl gpio and assert power off */
201 gpio_line_config(NSLU2_PO_GPIO, IXP4XX_GPIO_OUT); 201 gpio_direction_output(NSLU2_PO_GPIO, 1);
202
203 /* do the deed */
204 gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH);
205} 202}
206 203
207static irqreturn_t nslu2_power_handler(int irq, void *dev_id) 204static irqreturn_t nslu2_power_handler(int irq, void *dev_id)
@@ -223,6 +220,16 @@ static irqreturn_t nslu2_reset_handler(int irq, void *dev_id)
223 return IRQ_HANDLED; 220 return IRQ_HANDLED;
224} 221}
225 222
223static int __init nslu2_gpio_init(void)
224{
225 if (!machine_is_nslu2())
226 return 0;
227
228 /* Request the power off GPIO */
229 return gpio_request(NSLU2_PO_GPIO, "power off");
230}
231device_initcall(nslu2_gpio_init);
232
226static void __init nslu2_timer_init(void) 233static void __init nslu2_timer_init(void)
227{ 234{
228 /* The xtal on this machine is non-standard. */ 235 /* The xtal on this machine is non-standard. */
diff --git a/arch/arm/mach-keystone/Kconfig b/arch/arm/mach-keystone/Kconfig
index 366d1a3b418d..f20c53e75ed9 100644
--- a/arch/arm/mach-keystone/Kconfig
+++ b/arch/arm/mach-keystone/Kconfig
@@ -9,6 +9,8 @@ config ARCH_KEYSTONE
9 select GENERIC_CLOCKEVENTS 9 select GENERIC_CLOCKEVENTS
10 select ARCH_WANT_OPTIONAL_GPIOLIB 10 select ARCH_WANT_OPTIONAL_GPIOLIB
11 select ARM_ERRATA_798181 if SMP 11 select ARM_ERRATA_798181 if SMP
12 select COMMON_CLK_KEYSTONE
13 select TI_EDMA
12 help 14 help
13 Support for boards based on the Texas Instruments Keystone family of 15 Support for boards based on the Texas Instruments Keystone family of
14 SoCs. 16 SoCs.
diff --git a/arch/arm/mach-keystone/Makefile b/arch/arm/mach-keystone/Makefile
index ddc52b05dc84..25d92396fbfa 100644
--- a/arch/arm/mach-keystone/Makefile
+++ b/arch/arm/mach-keystone/Makefile
@@ -4,3 +4,6 @@ plus_sec := $(call as-instr,.arch_extension sec,+sec)
4AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec) 4AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec)
5 5
6obj-$(CONFIG_SMP) += platsmp.o 6obj-$(CONFIG_SMP) += platsmp.o
7
8# PM domain driver for Keystone SOCs
9obj-$(CONFIG_ARCH_KEYSTONE) += pm_domain.o
diff --git a/arch/arm/mach-keystone/platsmp.c b/arch/arm/mach-keystone/platsmp.c
index c12296157d4a..5cf0683577ea 100644
--- a/arch/arm/mach-keystone/platsmp.c
+++ b/arch/arm/mach-keystone/platsmp.c
@@ -17,7 +17,6 @@
17#include <linux/io.h> 17#include <linux/io.h>
18 18
19#include <asm/smp_plat.h> 19#include <asm/smp_plat.h>
20#include <asm/prom.h>
21 20
22#include "keystone.h" 21#include "keystone.h"
23 22
diff --git a/arch/arm/mach-keystone/pm_domain.c b/arch/arm/mach-keystone/pm_domain.c
new file mode 100644
index 000000000000..29625232e954
--- /dev/null
+++ b/arch/arm/mach-keystone/pm_domain.c
@@ -0,0 +1,82 @@
1/*
2 * PM domain driver for Keystone2 devices
3 *
4 * Copyright 2013 Texas Instruments, Inc.
5 * Santosh Shilimkar <santosh.shillimkar@ti.com>
6 *
7 * Based on Kevins work on DAVINCI SOCs
8 * Kevin Hilman <khilman@linaro.org>
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/pm_runtime.h>
17#include <linux/pm_clock.h>
18#include <linux/platform_device.h>
19#include <linux/clk-provider.h>
20#include <linux/of.h>
21
22#ifdef CONFIG_PM_RUNTIME
23static int keystone_pm_runtime_suspend(struct device *dev)
24{
25 int ret;
26
27 dev_dbg(dev, "%s\n", __func__);
28
29 ret = pm_generic_runtime_suspend(dev);
30 if (ret)
31 return ret;
32
33 ret = pm_clk_suspend(dev);
34 if (ret) {
35 pm_generic_runtime_resume(dev);
36 return ret;
37 }
38
39 return 0;
40}
41
42static int keystone_pm_runtime_resume(struct device *dev)
43{
44 dev_dbg(dev, "%s\n", __func__);
45
46 pm_clk_resume(dev);
47
48 return pm_generic_runtime_resume(dev);
49}
50#endif
51
52static struct dev_pm_domain keystone_pm_domain = {
53 .ops = {
54 SET_RUNTIME_PM_OPS(keystone_pm_runtime_suspend,
55 keystone_pm_runtime_resume, NULL)
56 USE_PLATFORM_PM_SLEEP_OPS
57 },
58};
59
60static struct pm_clk_notifier_block platform_domain_notifier = {
61 .pm_domain = &keystone_pm_domain,
62};
63
64static struct of_device_id of_keystone_table[] = {
65 {.compatible = "ti,keystone"},
66 { /* end of list */ },
67};
68
69int __init keystone_pm_runtime_init(void)
70{
71 struct device_node *np;
72
73 np = of_find_matching_node(NULL, of_keystone_table);
74 if (!np)
75 return 0;
76
77 of_clk_init(NULL);
78 pm_clk_add_notifier(&platform_bus_type, &platform_domain_notifier);
79
80 return 0;
81}
82subsys_initcall(keystone_pm_runtime_init);
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index d1f8e3d0793b..144b51102939 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -1,5 +1,7 @@
1obj-y += common.o pcie.o 1obj-y += common.o pcie.o
2obj-$(CONFIG_KIRKWOOD_LEGACY) += irq.o mpp.o 2obj-$(CONFIG_KIRKWOOD_LEGACY) += irq.o mpp.o
3obj-$(CONFIG_PM) += pm.o
4
3obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o 5obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o
4obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o 6obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
5obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o 7obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 82d3ad8e87cf..9caa4fe95913 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -13,9 +13,10 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_address.h>
17#include <linux/of_net.h>
16#include <linux/of_platform.h> 18#include <linux/of_platform.h>
17#include <linux/clk-provider.h> 19#include <linux/clk-provider.h>
18#include <linux/clocksource.h>
19#include <linux/dma-mapping.h> 20#include <linux/dma-mapping.h>
20#include <linux/irqchip.h> 21#include <linux/irqchip.h>
21#include <linux/kexec.h> 22#include <linux/kexec.h>
@@ -44,14 +45,6 @@ static void __init kirkwood_legacy_clk_init(void)
44 clkspec.np = np; 45 clkspec.np = np;
45 clkspec.args_count = 1; 46 clkspec.args_count = 1;
46 47
47 clkspec.args[0] = CGC_BIT_PEX0;
48 orion_clkdev_add("0", "pcie",
49 of_clk_get_from_provider(&clkspec));
50
51 clkspec.args[0] = CGC_BIT_PEX1;
52 orion_clkdev_add("1", "pcie",
53 of_clk_get_from_provider(&clkspec));
54
55 /* 48 /*
56 * The ethernet interfaces forget the MAC address assigned by 49 * The ethernet interfaces forget the MAC address assigned by
57 * u-boot if the clocks are turned off. Until proper DT support 50 * u-boot if the clocks are turned off. Until proper DT support
@@ -66,17 +59,83 @@ static void __init kirkwood_legacy_clk_init(void)
66 clk_prepare_enable(clk); 59 clk_prepare_enable(clk);
67} 60}
68 61
69static void __init kirkwood_dt_time_init(void) 62#define MV643XX_ETH_MAC_ADDR_LOW 0x0414
70{ 63#define MV643XX_ETH_MAC_ADDR_HIGH 0x0418
71 of_clk_init(NULL);
72 clocksource_of_init();
73}
74 64
75static void __init kirkwood_dt_init_early(void) 65static void __init kirkwood_dt_eth_fixup(void)
76{ 66{
77 mvebu_mbus_init("marvell,kirkwood-mbus", 67 struct device_node *np;
78 BRIDGE_WINS_BASE, BRIDGE_WINS_SZ, 68
79 DDR_WINDOW_CPU_BASE, DDR_WINDOW_CPU_SZ); 69 /*
70 * The ethernet interfaces forget the MAC address assigned by u-boot
71 * if the clocks are turned off. Usually, u-boot on kirkwood boards
72 * has no DT support to properly set local-mac-address property.
73 * As a workaround, we get the MAC address from mv643xx_eth registers
74 * and update the port device node if no valid MAC address is set.
75 */
76 for_each_compatible_node(np, NULL, "marvell,kirkwood-eth-port") {
77 struct device_node *pnp = of_get_parent(np);
78 struct clk *clk;
79 struct property *pmac;
80 void __iomem *io;
81 u8 *macaddr;
82 u32 reg;
83
84 if (!pnp)
85 continue;
86
87 /* skip disabled nodes or nodes with valid MAC address*/
88 if (!of_device_is_available(pnp) || of_get_mac_address(np))
89 goto eth_fixup_skip;
90
91 clk = of_clk_get(pnp, 0);
92 if (IS_ERR(clk))
93 goto eth_fixup_skip;
94
95 io = of_iomap(pnp, 0);
96 if (!io)
97 goto eth_fixup_no_map;
98
99 /* ensure port clock is not gated to not hang CPU */
100 clk_prepare_enable(clk);
101
102 /* store MAC address register contents in local-mac-address */
103 pr_err(FW_INFO "%s: local-mac-address is not set\n",
104 np->full_name);
105
106 pmac = kzalloc(sizeof(*pmac) + 6, GFP_KERNEL);
107 if (!pmac)
108 goto eth_fixup_no_mem;
109
110 pmac->value = pmac + 1;
111 pmac->length = 6;
112 pmac->name = kstrdup("local-mac-address", GFP_KERNEL);
113 if (!pmac->name) {
114 kfree(pmac);
115 goto eth_fixup_no_mem;
116 }
117
118 macaddr = pmac->value;
119 reg = readl(io + MV643XX_ETH_MAC_ADDR_HIGH);
120 macaddr[0] = (reg >> 24) & 0xff;
121 macaddr[1] = (reg >> 16) & 0xff;
122 macaddr[2] = (reg >> 8) & 0xff;
123 macaddr[3] = reg & 0xff;
124
125 reg = readl(io + MV643XX_ETH_MAC_ADDR_LOW);
126 macaddr[4] = (reg >> 8) & 0xff;
127 macaddr[5] = reg & 0xff;
128
129 of_update_property(np, pmac);
130
131eth_fixup_no_mem:
132 iounmap(io);
133 clk_disable_unprepare(clk);
134eth_fixup_no_map:
135 clk_put(clk);
136eth_fixup_skip:
137 of_node_put(pnp);
138 }
80} 139}
81 140
82static void __init kirkwood_dt_init(void) 141static void __init kirkwood_dt_init(void)
@@ -92,16 +151,16 @@ static void __init kirkwood_dt_init(void)
92 writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG); 151 writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
93 152
94 BUG_ON(mvebu_mbus_dt_init()); 153 BUG_ON(mvebu_mbus_dt_init());
95 kirkwood_setup_wins();
96 154
97 kirkwood_l2_init(); 155 kirkwood_l2_init();
98 156
99 kirkwood_cpufreq_init(); 157 kirkwood_cpufreq_init();
100 158 kirkwood_cpuidle_init();
101 /* Setup clocks for legacy devices */ 159 /* Setup clocks for legacy devices */
102 kirkwood_legacy_clk_init(); 160 kirkwood_legacy_clk_init();
103 161
104 kirkwood_cpuidle_init(); 162 kirkwood_pm_init();
163 kirkwood_dt_eth_fixup();
105 164
106#ifdef CONFIG_KEXEC 165#ifdef CONFIG_KEXEC
107 kexec_reinit = kirkwood_enable_pcie; 166 kexec_reinit = kirkwood_enable_pcie;
@@ -121,8 +180,6 @@ static const char * const kirkwood_dt_board_compat[] = {
121DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)") 180DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
122 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */ 181 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
123 .map_io = kirkwood_map_io, 182 .map_io = kirkwood_map_io,
124 .init_early = kirkwood_dt_init_early,
125 .init_time = kirkwood_dt_time_init,
126 .init_machine = kirkwood_dt_init, 183 .init_machine = kirkwood_dt_init,
127 .restart = kirkwood_restart, 184 .restart = kirkwood_restart,
128 .dt_compat = kirkwood_dt_board_compat, 185 .dt_compat = kirkwood_dt_board_compat,
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 176761134a66..f3407a5db216 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -721,6 +721,7 @@ void __init kirkwood_init(void)
721 kirkwood_xor1_init(); 721 kirkwood_xor1_init();
722 kirkwood_crypto_init(); 722 kirkwood_crypto_init();
723 723
724 kirkwood_pm_init();
724 kirkwood_cpuidle_init(); 725 kirkwood_cpuidle_init();
725#ifdef CONFIG_KEXEC 726#ifdef CONFIG_KEXEC
726 kexec_reinit = kirkwood_enable_pcie; 727 kexec_reinit = kirkwood_enable_pcie;
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 1296de94febf..05fd648df543 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -58,6 +58,12 @@ void kirkwood_cpufreq_init(void);
58void kirkwood_restart(enum reboot_mode, const char *); 58void kirkwood_restart(enum reboot_mode, const char *);
59void kirkwood_clk_init(void); 59void kirkwood_clk_init(void);
60 60
61#ifdef CONFIG_PM
62void kirkwood_pm_init(void);
63#else
64static inline void kirkwood_pm_init(void) {};
65#endif
66
61/* board init functions for boards not fully converted to fdt */ 67/* board init functions for boards not fully converted to fdt */
62#ifdef CONFIG_MACH_MV88F6281GTW_GE_DT 68#ifdef CONFIG_MACH_MV88F6281GTW_GE_DT
63void mv88f6281gtw_ge_init(void); 69void mv88f6281gtw_ge_init(void);
diff --git a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
index 91242c944d7a..8b9d1c9ff199 100644
--- a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
+++ b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
@@ -78,4 +78,6 @@
78#define CGC_TDM (1 << 20) 78#define CGC_TDM (1 << 20)
79#define CGC_RESERVED (0x6 << 21) 79#define CGC_RESERVED (0x6 << 21)
80 80
81#define MEMORY_PM_CTRL (BRIDGE_VIRT_BASE + 0x118)
82
81#endif 83#endif
diff --git a/arch/arm/mach-kirkwood/pm.c b/arch/arm/mach-kirkwood/pm.c
new file mode 100644
index 000000000000..8783a7184e73
--- /dev/null
+++ b/arch/arm/mach-kirkwood/pm.c
@@ -0,0 +1,73 @@
1/*
2 * Power Management driver for Marvell Kirkwood SoCs
3 *
4 * Copyright (C) 2013 Ezequiel Garcia <ezequiel@free-electrons.com>
5 * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License,
9 * version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/kernel.h>
18#include <linux/suspend.h>
19#include <linux/io.h>
20#include <mach/bridge-regs.h>
21
22static void __iomem *ddr_operation_base;
23
24static void kirkwood_low_power(void)
25{
26 u32 mem_pm_ctrl;
27
28 mem_pm_ctrl = readl(MEMORY_PM_CTRL);
29
30 /* Set peripherals to low-power mode */
31 writel_relaxed(~0, MEMORY_PM_CTRL);
32
33 /* Set DDR in self-refresh */
34 writel_relaxed(0x7, ddr_operation_base);
35
36 /*
37 * Set CPU in wait-for-interrupt state.
38 * This disables the CPU core clocks,
39 * the array clocks, and also the L2 controller.
40 */
41 cpu_do_idle();
42
43 writel_relaxed(mem_pm_ctrl, MEMORY_PM_CTRL);
44}
45
46static int kirkwood_suspend_enter(suspend_state_t state)
47{
48 switch (state) {
49 case PM_SUSPEND_STANDBY:
50 kirkwood_low_power();
51 break;
52 default:
53 return -EINVAL;
54 }
55 return 0;
56}
57
58static int kirkwood_pm_valid_standby(suspend_state_t state)
59{
60 return state == PM_SUSPEND_STANDBY;
61}
62
63static const struct platform_suspend_ops kirkwood_suspend_ops = {
64 .enter = kirkwood_suspend_enter,
65 .valid = kirkwood_pm_valid_standby,
66};
67
68int __init kirkwood_pm_init(void)
69{
70 ddr_operation_base = ioremap(DDR_OPERATION_BASE, 4);
71 suspend_set_ops(&kirkwood_suspend_ops);
72 return 0;
73}
diff --git a/arch/arm/mach-mmp/include/mach/gpio.h b/arch/arm/mach-mmp/include/mach/gpio.h
deleted file mode 100644
index 13219ebf5128..000000000000
--- a/arch/arm/mach-mmp/include/mach/gpio.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __ASM_MACH_GPIO_H
2#define __ASM_MACH_GPIO_H
3
4#include <asm-generic/gpio.h>
5
6#include <mach/cputype.h>
7
8#endif /* __ASM_MACH_GPIO_H */
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index 702232996c8c..cfadd974f5ce 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -191,7 +191,6 @@ static struct pxa3xx_nand_platform_data dkb_nand_info = {
191#define SCLK_SOURCE_SELECT(x) (x << 30) /* 0x0 ~ 0x3 */ 191#define SCLK_SOURCE_SELECT(x) (x << 30) /* 0x0 ~ 0x3 */
192/* link config */ 192/* link config */
193#define CFG_DUMBMODE(mode) (mode << 28) /* 0x0 ~ 0x6*/ 193#define CFG_DUMBMODE(mode) (mode << 28) /* 0x0 ~ 0x6*/
194#define CFG_GRA_SWAPRB(x) (x << 0) /* 1: rbswap enabled */
195static struct mmp_mach_path_config dkb_disp_config[] = { 194static struct mmp_mach_path_config dkb_disp_config[] = {
196 [0] = { 195 [0] = {
197 .name = "mmp-parallel", 196 .name = "mmp-parallel",
@@ -199,8 +198,7 @@ static struct mmp_mach_path_config dkb_disp_config[] = {
199 .output_type = PATH_OUT_PARALLEL, 198 .output_type = PATH_OUT_PARALLEL,
200 .path_config = CFG_IOPADMODE(0x1) 199 .path_config = CFG_IOPADMODE(0x1)
201 | SCLK_SOURCE_SELECT(0x1), 200 | SCLK_SOURCE_SELECT(0x1),
202 .link_config = CFG_DUMBMODE(0x2) 201 .link_config = CFG_DUMBMODE(0x2),
203 | CFG_GRA_SWAPRB(0x1),
204 }, 202 },
205}; 203};
206 204
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index 905efc8cac79..2586c2865874 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -1,12 +1,12 @@
1if ARCH_MSM 1if ARCH_MSM
2 2
3comment "Qualcomm MSM SoC Type" 3comment "Qualcomm MSM SoC Type"
4 depends on (ARCH_MSM8X60 || ARCH_MSM8960) 4 depends on ARCH_MSM_DT
5 5
6choice 6choice
7 prompt "Qualcomm MSM SoC Type" 7 prompt "Qualcomm MSM SoC Type"
8 default ARCH_MSM7X00A 8 default ARCH_MSM7X00A
9 depends on !(ARCH_MSM8X60 || ARCH_MSM8960) 9 depends on !ARCH_MSM_DT
10 10
11config ARCH_MSM7X00A 11config ARCH_MSM7X00A
12 bool "MSM7x00A / MSM7x01A" 12 bool "MSM7x00A / MSM7x01A"
@@ -49,7 +49,6 @@ config ARCH_MSM8X60
49 select GPIO_MSM_V2 49 select GPIO_MSM_V2
50 select HAVE_SMP 50 select HAVE_SMP
51 select MSM_SCM if SMP 51 select MSM_SCM if SMP
52 select USE_OF
53 52
54config ARCH_MSM8960 53config ARCH_MSM8960
55 bool "MSM8960" 54 bool "MSM8960"
@@ -58,6 +57,11 @@ config ARCH_MSM8960
58 select HAVE_SMP 57 select HAVE_SMP
59 select GPIO_MSM_V2 58 select GPIO_MSM_V2
60 select MSM_SCM if SMP 59 select MSM_SCM if SMP
60
61config ARCH_MSM_DT
62 def_bool y
63 depends on (ARCH_MSM8X60 || ARCH_MSM8960)
64 select SPARSE_IRQ
61 select USE_OF 65 select USE_OF
62 66
63config MSM_HAS_DEBUG_UART_HS 67config MSM_HAS_DEBUG_UART_HS
@@ -68,6 +72,7 @@ config MSM_SOC_REV_A
68 72
69config ARCH_MSM_ARM11 73config ARCH_MSM_ARM11
70 bool 74 bool
75
71config ARCH_MSM_SCORPION 76config ARCH_MSM_SCORPION
72 bool 77 bool
73 78
@@ -75,6 +80,7 @@ config MSM_VIC
75 bool 80 bool
76 81
77menu "Qualcomm MSM Board Type" 82menu "Qualcomm MSM Board Type"
83 depends on !ARCH_MSM_DT
78 84
79config MACH_HALIBUT 85config MACH_HALIBUT
80 depends on ARCH_MSM 86 depends on ARCH_MSM
@@ -122,6 +128,7 @@ config MSM_SMD
122 128
123config MSM_GPIOMUX 129config MSM_GPIOMUX
124 bool 130 bool
131 depends on !ARCH_MSM_DT
125 help 132 help
126 Support for MSM V1 TLMM GPIOMUX architecture. 133 Support for MSM V1 TLMM GPIOMUX architecture.
127 134
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index d872634c2f85..7ed4c1b2bdd2 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -26,7 +26,6 @@ obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o b
26obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o 26obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o
27obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o 27obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o
28obj-$(CONFIG_ARCH_QSD8X50) += board-qsd8x50.o devices-qsd8x50.o 28obj-$(CONFIG_ARCH_QSD8X50) += board-qsd8x50.o devices-qsd8x50.o
29obj-$(CONFIG_ARCH_MSM8X60) += board-dt-8660.o 29obj-$(CONFIG_ARCH_MSM_DT) += board-dt.o
30obj-$(CONFIG_ARCH_MSM8960) += board-dt-8960.o
31obj-$(CONFIG_MSM_GPIOMUX) += gpiomux.o 30obj-$(CONFIG_MSM_GPIOMUX) += gpiomux.o
32obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o 31obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o
diff --git a/arch/arm/mach-msm/board-dt-8660.c b/arch/arm/mach-msm/board-dt-8660.c
deleted file mode 100644
index c2946892f5e3..000000000000
--- a/arch/arm/mach-msm/board-dt-8660.c
+++ /dev/null
@@ -1,48 +0,0 @@
1/* Copyright (c) 2010-2012, The Linux Foundation. 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#include <linux/init.h>
14#include <linux/of.h>
15#include <linux/of_platform.h>
16
17#include <asm/mach/arch.h>
18#include <asm/mach/map.h>
19
20#include "common.h"
21
22static void __init msm8x60_init_late(void)
23{
24 smd_debugfs_init();
25}
26
27static struct of_dev_auxdata msm_auxdata_lookup[] __initdata = {
28 {}
29};
30
31static void __init msm8x60_dt_init(void)
32{
33 of_platform_populate(NULL, of_default_bus_match_table,
34 msm_auxdata_lookup, NULL);
35}
36
37static const char *msm8x60_fluid_match[] __initdata = {
38 "qcom,msm8660-fluid",
39 "qcom,msm8660-surf",
40 NULL
41};
42
43DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
44 .smp = smp_ops(msm_smp_ops),
45 .init_machine = msm8x60_dt_init,
46 .init_late = msm8x60_init_late,
47 .dt_compat = msm8x60_fluid_match,
48MACHINE_END
diff --git a/arch/arm/mach-msm/board-dt-8960.c b/arch/arm/mach-msm/board-dt.c
index d4ca52c45111..16e6183ac9f1 100644
--- a/arch/arm/mach-msm/board-dt-8960.c
+++ b/arch/arm/mach-msm/board-dt.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2012, The Linux Foundation. All rights reserved. 1/* Copyright (c) 2010-2012,2013 The Linux Foundation. All rights reserved.
2 * 2 *
3 * This program is free software; you can redistribute it and/or modify 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 4 * it under the terms of the GNU General Public License version 2 and
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/of.h>
14#include <linux/of_platform.h> 15#include <linux/of_platform.h>
15 16
16#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
@@ -18,18 +19,14 @@
18 19
19#include "common.h" 20#include "common.h"
20 21
21static void __init msm_dt_init(void) 22static const char * const msm_dt_match[] __initconst = {
22{ 23 "qcom,msm8660-fluid",
23 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 24 "qcom,msm8660-surf",
24}
25
26static const char * const msm8960_dt_match[] __initconst = {
27 "qcom,msm8960-cdp", 25 "qcom,msm8960-cdp",
28 NULL 26 NULL
29}; 27};
30 28
31DT_MACHINE_START(MSM8960_DT, "Qualcomm MSM (Flattened Device Tree)") 29DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
32 .smp = smp_ops(msm_smp_ops), 30 .smp = smp_ops(msm_smp_ops),
33 .init_machine = msm_dt_init, 31 .dt_compat = msm_dt_match,
34 .dt_compat = msm8960_dt_match,
35MACHINE_END 32MACHINE_END
diff --git a/arch/arm/mach-msm/include/mach/irqs-8960.h b/arch/arm/mach-msm/include/mach/irqs-8960.h
deleted file mode 100644
index 81ab2a6792bd..000000000000
--- a/arch/arm/mach-msm/include/mach/irqs-8960.h
+++ /dev/null
@@ -1,277 +0,0 @@
1/* Copyright (c) 2011 Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __ASM_ARCH_MSM_IRQS_8960_H
14#define __ASM_ARCH_MSM_IRQS_8960_H
15
16/* MSM ACPU Interrupt Numbers */
17
18/* 0-15: STI/SGI (software triggered/generated interrupts)
19 16-31: PPI (private peripheral interrupts)
20 32+: SPI (shared peripheral interrupts) */
21
22#define GIC_PPI_START 16
23#define GIC_SPI_START 32
24
25#define INT_VGIC (GIC_PPI_START + 0)
26#define INT_DEBUG_TIMER_EXP (GIC_PPI_START + 1)
27#define INT_GP_TIMER_EXP (GIC_PPI_START + 2)
28#define INT_GP_TIMER2_EXP (GIC_PPI_START + 3)
29#define WDT0_ACCSCSSNBARK_INT (GIC_PPI_START + 4)
30#define WDT1_ACCSCSSNBARK_INT (GIC_PPI_START + 5)
31#define AVS_SVICINT (GIC_PPI_START + 6)
32#define AVS_SVICINTSWDONE (GIC_PPI_START + 7)
33#define CPU_DBGCPUXCOMMRXFULL (GIC_PPI_START + 8)
34#define CPU_DBGCPUXCOMMTXEMPTY (GIC_PPI_START + 9)
35#define CPU_SICCPUXPERFMONIRPTREQ (GIC_PPI_START + 10)
36#define SC_AVSCPUXDOWN (GIC_PPI_START + 11)
37#define SC_AVSCPUXUP (GIC_PPI_START + 12)
38#define SC_SICCPUXACGIRPTREQ (GIC_PPI_START + 13)
39#define SC_SICCPUXEXTFAULTIRPTREQ (GIC_PPI_START + 14)
40/* PPI 15 is unused */
41
42#define SC_SICMPUIRPTREQ (GIC_SPI_START + 0)
43#define SC_SICL2IRPTREQ (GIC_SPI_START + 1)
44#define SC_SICL2PERFMONIRPTREQ (GIC_SPI_START + 2)
45#define SC_SICAGCIRPTREQ (GIC_SPI_START + 3)
46#define TLMM_APCC_DIR_CONN_IRQ_0 (GIC_SPI_START + 4)
47#define TLMM_APCC_DIR_CONN_IRQ_1 (GIC_SPI_START + 5)
48#define TLMM_APCC_DIR_CONN_IRQ_2 (GIC_SPI_START + 6)
49#define TLMM_APCC_DIR_CONN_IRQ_3 (GIC_SPI_START + 7)
50#define TLMM_APCC_DIR_CONN_IRQ_4 (GIC_SPI_START + 8)
51#define TLMM_APCC_DIR_CONN_IRQ_5 (GIC_SPI_START + 9)
52#define TLMM_APCC_DIR_CONN_IRQ_6 (GIC_SPI_START + 10)
53#define TLMM_APCC_DIR_CONN_IRQ_7 (GIC_SPI_START + 11)
54#define TLMM_APCC_DIR_CONN_IRQ_8 (GIC_SPI_START + 12)
55#define TLMM_APCC_DIR_CONN_IRQ_9 (GIC_SPI_START + 13)
56#define PM8921_SEC_IRQ_103 (GIC_SPI_START + 14)
57#define PM8018_SEC_IRQ_106 (GIC_SPI_START + 15)
58#define TLMM_APCC_SUMMARY_IRQ (GIC_SPI_START + 16)
59#define SPDM_RT_1_IRQ (GIC_SPI_START + 17)
60#define SPDM_DIAG_IRQ (GIC_SPI_START + 18)
61#define RPM_APCC_CPU0_GP_HIGH_IRQ (GIC_SPI_START + 19)
62#define RPM_APCC_CPU0_GP_MEDIUM_IRQ (GIC_SPI_START + 20)
63#define RPM_APCC_CPU0_GP_LOW_IRQ (GIC_SPI_START + 21)
64#define RPM_APCC_CPU0_WAKE_UP_IRQ (GIC_SPI_START + 22)
65#define RPM_APCC_CPU1_GP_HIGH_IRQ (GIC_SPI_START + 23)
66#define RPM_APCC_CPU1_GP_MEDIUM_IRQ (GIC_SPI_START + 24)
67#define RPM_APCC_CPU1_GP_LOW_IRQ (GIC_SPI_START + 25)
68#define RPM_APCC_CPU1_WAKE_UP_IRQ (GIC_SPI_START + 26)
69#define SSBI2_2_SC_CPU0_SECURE_IRQ (GIC_SPI_START + 27)
70#define SSBI2_2_SC_CPU0_NON_SECURE_IRQ (GIC_SPI_START + 28)
71#define SSBI2_1_SC_CPU0_SECURE_IRQ (GIC_SPI_START + 29)
72#define SSBI2_1_SC_CPU0_NON_SECURE_IRQ (GIC_SPI_START + 30)
73#define MSMC_SC_SEC_CE_IRQ (GIC_SPI_START + 31)
74#define MSMC_SC_PRI_CE_IRQ (GIC_SPI_START + 32)
75#define SLIMBUS0_CORE_EE1_IRQ (GIC_SPI_START + 33)
76#define SLIMBUS0_BAM_EE1_IRQ (GIC_SPI_START + 34)
77#define Q6FW_WDOG_EXPIRED_IRQ (GIC_SPI_START + 35)
78#define Q6SW_WDOG_EXPIRED_IRQ (GIC_SPI_START + 36)
79#define MSS_TO_APPS_IRQ_0 (GIC_SPI_START + 37)
80#define MSS_TO_APPS_IRQ_1 (GIC_SPI_START + 38)
81#define MSS_TO_APPS_IRQ_2 (GIC_SPI_START + 39)
82#define MSS_TO_APPS_IRQ_3 (GIC_SPI_START + 40)
83#define MSS_TO_APPS_IRQ_4 (GIC_SPI_START + 41)
84#define MSS_TO_APPS_IRQ_5 (GIC_SPI_START + 42)
85#define MSS_TO_APPS_IRQ_6 (GIC_SPI_START + 43)
86#define MSS_TO_APPS_IRQ_7 (GIC_SPI_START + 44)
87#define MSS_TO_APPS_IRQ_8 (GIC_SPI_START + 45)
88#define MSS_TO_APPS_IRQ_9 (GIC_SPI_START + 46)
89#define VPE_IRQ (GIC_SPI_START + 47)
90#define VFE_IRQ (GIC_SPI_START + 48)
91#define VCODEC_IRQ (GIC_SPI_START + 49)
92#define TV_ENC_IRQ (GIC_SPI_START + 50)
93#define SMMU_VPE_CB_SC_SECURE_IRQ (GIC_SPI_START + 51)
94#define SMMU_VPE_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 52)
95#define SMMU_VFE_CB_SC_SECURE_IRQ (GIC_SPI_START + 53)
96#define SMMU_VFE_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 54)
97#define SMMU_VCODEC_B_CB_SC_SECURE_IRQ (GIC_SPI_START + 55)
98#define SMMU_VCODEC_B_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 56)
99#define SMMU_VCODEC_A_CB_SC_SECURE_IRQ (GIC_SPI_START + 57)
100#define SMMU_VCODEC_A_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 58)
101#define SMMU_ROT_CB_SC_SECURE_IRQ (GIC_SPI_START + 59)
102#define SMMU_ROT_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 60)
103#define SMMU_MDP1_CB_SC_SECURE_IRQ (GIC_SPI_START + 61)
104#define SMMU_MDP1_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 62)
105#define SMMU_MDP0_CB_SC_SECURE_IRQ (GIC_SPI_START + 63)
106#define SMMU_MDP0_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 64)
107#define SMMU_JPEGD_CB_SC_SECURE_IRQ (GIC_SPI_START + 65)
108#define SMMU_JPEGD_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 66)
109#define SMMU_IJPEG_CB_SC_SECURE_IRQ (GIC_SPI_START + 67)
110#define SMMU_IJPEG_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 68)
111#define SMMU_GFX3D_CB_SC_SECURE_IRQ (GIC_SPI_START + 69)
112#define SMMU_GFX3D_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 70)
113#define SMMU_GFX2D0_CB_SC_SECURE_IRQ (GIC_SPI_START + 71)
114#define SMMU_GFX2D0_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 72)
115#define ROT_IRQ (GIC_SPI_START + 73)
116#define MMSS_FABRIC_IRQ (GIC_SPI_START + 74)
117#define MDP_IRQ (GIC_SPI_START + 75)
118#define JPEGD_IRQ (GIC_SPI_START + 76)
119#define JPEG_IRQ (GIC_SPI_START + 77)
120#define MMSS_IMEM_IRQ (GIC_SPI_START + 78)
121#define HDMI_IRQ (GIC_SPI_START + 79)
122#define GFX3D_IRQ (GIC_SPI_START + 80)
123#define GFX2D0_IRQ (GIC_SPI_START + 81)
124#define DSI1_IRQ (GIC_SPI_START + 82)
125#define CSI_1_IRQ (GIC_SPI_START + 83)
126#define CSI_0_IRQ (GIC_SPI_START + 84)
127#define LPASS_SCSS_AUDIO_IF_OUT0_IRQ (GIC_SPI_START + 85)
128#define LPASS_SCSS_MIDI_IRQ (GIC_SPI_START + 86)
129#define LPASS_Q6SS_WDOG_EXPIRED (GIC_SPI_START + 87)
130#define LPASS_SCSS_GP_LOW_IRQ (GIC_SPI_START + 88)
131#define LPASS_SCSS_GP_MEDIUM_IRQ (GIC_SPI_START + 89)
132#define LPASS_SCSS_GP_HIGH_IRQ (GIC_SPI_START + 90)
133#define TOP_IMEM_IRQ (GIC_SPI_START + 91)
134#define FABRIC_SYS_IRQ (GIC_SPI_START + 92)
135#define FABRIC_APPS_IRQ (GIC_SPI_START + 93)
136#define USB1_HS_BAM_IRQ (GIC_SPI_START + 94)
137#define SDC4_BAM_IRQ (GIC_SPI_START + 95)
138#define SDC3_BAM_IRQ (GIC_SPI_START + 96)
139#define SDC2_BAM_IRQ (GIC_SPI_START + 97)
140#define SDC1_BAM_IRQ (GIC_SPI_START + 98)
141#define FABRIC_SPS_IRQ (GIC_SPI_START + 99)
142#define USB1_HS_IRQ (GIC_SPI_START + 100)
143#define SDC4_IRQ_0 (GIC_SPI_START + 101)
144#define SDC3_IRQ_0 (GIC_SPI_START + 102)
145#define SDC2_IRQ_0 (GIC_SPI_START + 103)
146#define SDC1_IRQ_0 (GIC_SPI_START + 104)
147#define SPS_BAM_DMA_IRQ (GIC_SPI_START + 105)
148#define SPS_SEC_VIOL_IRQ (GIC_SPI_START + 106)
149#define SPS_MTI_0 (GIC_SPI_START + 107)
150#define SPS_MTI_1 (GIC_SPI_START + 108)
151#define SPS_MTI_2 (GIC_SPI_START + 109)
152#define SPS_MTI_3 (GIC_SPI_START + 110)
153#define SPS_MTI_4 (GIC_SPI_START + 111)
154#define SPS_MTI_5 (GIC_SPI_START + 112)
155#define SPS_MTI_6 (GIC_SPI_START + 113)
156#define SPS_MTI_7 (GIC_SPI_START + 114)
157#define SPS_MTI_8 (GIC_SPI_START + 115)
158#define SPS_MTI_9 (GIC_SPI_START + 116)
159#define SPS_MTI_10 (GIC_SPI_START + 117)
160#define SPS_MTI_11 (GIC_SPI_START + 118)
161#define SPS_MTI_12 (GIC_SPI_START + 119)
162#define SPS_MTI_13 (GIC_SPI_START + 120)
163#define SPS_MTI_14 (GIC_SPI_START + 121)
164#define SPS_MTI_15 (GIC_SPI_START + 122)
165#define SPS_MTI_16 (GIC_SPI_START + 123)
166#define SPS_MTI_17 (GIC_SPI_START + 124)
167#define SPS_MTI_18 (GIC_SPI_START + 125)
168#define SPS_MTI_19 (GIC_SPI_START + 126)
169#define SPS_MTI_20 (GIC_SPI_START + 127)
170#define SPS_MTI_21 (GIC_SPI_START + 128)
171#define SPS_MTI_22 (GIC_SPI_START + 129)
172#define SPS_MTI_23 (GIC_SPI_START + 130)
173#define SPS_MTI_24 (GIC_SPI_START + 131)
174#define SPS_MTI_25 (GIC_SPI_START + 132)
175#define SPS_MTI_26 (GIC_SPI_START + 133)
176#define SPS_MTI_27 (GIC_SPI_START + 134)
177#define SPS_MTI_28 (GIC_SPI_START + 135)
178#define SPS_MTI_29 (GIC_SPI_START + 136)
179#define SPS_MTI_30 (GIC_SPI_START + 137)
180#define SPS_MTI_31 (GIC_SPI_START + 138)
181#define CSIPHY_4LN_IRQ (GIC_SPI_START + 139)
182#define CSIPHY_2LN_IRQ (GIC_SPI_START + 140)
183#define USB2_IRQ (GIC_SPI_START + 141)
184#define USB1_IRQ (GIC_SPI_START + 142)
185#define TSSC_SSBI_IRQ (GIC_SPI_START + 143)
186#define TSSC_SAMPLE_IRQ (GIC_SPI_START + 144)
187#define TSSC_PENUP_IRQ (GIC_SPI_START + 145)
188#define GSBI1_UARTDM_IRQ (GIC_SPI_START + 146)
189#define GSBI1_QUP_IRQ (GIC_SPI_START + 147)
190#define GSBI2_UARTDM_IRQ (GIC_SPI_START + 148)
191#define GSBI2_QUP_IRQ (GIC_SPI_START + 149)
192#define GSBI3_UARTDM_IRQ (GIC_SPI_START + 150)
193#define GSBI3_QUP_IRQ (GIC_SPI_START + 151)
194#define GSBI4_UARTDM_IRQ (GIC_SPI_START + 152)
195#define GSBI4_QUP_IRQ (GIC_SPI_START + 153)
196#define GSBI5_UARTDM_IRQ (GIC_SPI_START + 154)
197#define GSBI5_QUP_IRQ (GIC_SPI_START + 155)
198#define GSBI6_UARTDM_IRQ (GIC_SPI_START + 156)
199#define GSBI6_QUP_IRQ (GIC_SPI_START + 157)
200#define GSBI7_UARTDM_IRQ (GIC_SPI_START + 158)
201#define GSBI7_QUP_IRQ (GIC_SPI_START + 159)
202#define GSBI8_UARTDM_IRQ (GIC_SPI_START + 160)
203#define GSBI8_QUP_IRQ (GIC_SPI_START + 161)
204#define TSIF_TSPP_IRQ (GIC_SPI_START + 162)
205#define TSIF_BAM_IRQ (GIC_SPI_START + 163)
206#define TSIF2_IRQ (GIC_SPI_START + 164)
207#define TSIF1_IRQ (GIC_SPI_START + 165)
208#define DSI2_IRQ (GIC_SPI_START + 166)
209#define ISPIF_IRQ (GIC_SPI_START + 167)
210#define MSMC_SC_SEC_TMR_IRQ (GIC_SPI_START + 168)
211#define MSMC_SC_SEC_WDOG_BARK_IRQ (GIC_SPI_START + 169)
212#define INT_ADM0_SCSS_0_IRQ (GIC_SPI_START + 170)
213#define INT_ADM0_SCSS_1_IRQ (GIC_SPI_START + 171)
214#define INT_ADM0_SCSS_2_IRQ (GIC_SPI_START + 172)
215#define INT_ADM0_SCSS_3_IRQ (GIC_SPI_START + 173)
216#define CC_SCSS_WDT1CPU1BITEEXPIRED (GIC_SPI_START + 174)
217#define CC_SCSS_WDT1CPU0BITEEXPIRED (GIC_SPI_START + 175)
218#define CC_SCSS_WDT0CPU1BITEEXPIRED (GIC_SPI_START + 176)
219#define CC_SCSS_WDT0CPU0BITEEXPIRED (GIC_SPI_START + 177)
220#define TSENS_UPPER_LOWER_INT (GIC_SPI_START + 178)
221#define SSBI2_2_SC_CPU1_SECURE_INT (GIC_SPI_START + 179)
222#define SSBI2_2_SC_CPU1_NON_SECURE_INT (GIC_SPI_START + 180)
223#define SSBI2_1_SC_CPU1_SECURE_INT (GIC_SPI_START + 181)
224#define SSBI2_1_SC_CPU1_NON_SECURE_INT (GIC_SPI_START + 182)
225#define XPU_SUMMARY_IRQ (GIC_SPI_START + 183)
226#define BUS_EXCEPTION_SUMMARY_IRQ (GIC_SPI_START + 184)
227#define HSDDRX_EBI1CH0_IRQ (GIC_SPI_START + 185)
228#define HSDDRX_EBI1CH1_IRQ (GIC_SPI_START + 186)
229#define SDC5_BAM_IRQ (GIC_SPI_START + 187)
230#define SDC5_IRQ_0 (GIC_SPI_START + 188)
231#define GSBI9_UARTDM_IRQ (GIC_SPI_START + 189)
232#define GSBI9_QUP_IRQ (GIC_SPI_START + 190)
233#define GSBI10_UARTDM_IRQ (GIC_SPI_START + 191)
234#define GSBI10_QUP_IRQ (GIC_SPI_START + 192)
235#define GSBI11_UARTDM_IRQ (GIC_SPI_START + 193)
236#define GSBI11_QUP_IRQ (GIC_SPI_START + 194)
237#define GSBI12_UARTDM_IRQ (GIC_SPI_START + 195)
238#define GSBI12_QUP_IRQ (GIC_SPI_START + 196)
239#define RIVA_APSS_LTECOEX_IRQ (GIC_SPI_START + 197)
240#define RIVA_APSS_SPARE_IRQ (GIC_SPI_START + 198)
241#define RIVA_APSS_WDOG_BITE_RESET_RDY_IRQ (GIC_SPI_START + 199)
242#define RIVA_ASS_RESET_DONE_IRQ (GIC_SPI_START + 200)
243#define RIVA_APSS_ASIC_IRQ (GIC_SPI_START + 201)
244#define RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ (GIC_SPI_START + 202)
245#define RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ (GIC_SPI_START + 203)
246#define RIVA_APPS_WLAM_SMSM_IRQ (GIC_SPI_START + 204)
247#define RIVA_APPS_LOG_CTRL_IRQ (GIC_SPI_START + 205)
248#define RIVA_APPS_FM_CTRL_IRQ (GIC_SPI_START + 206)
249#define RIVA_APPS_HCI_IRQ (GIC_SPI_START + 207)
250#define RIVA_APPS_WLAN_CTRL_IRQ (GIC_SPI_START + 208)
251#define A2_BAM_IRQ (GIC_SPI_START + 209)
252#define SMMU_GFX2D1_CB_SC_SECURE_IRQ (GIC_SPI_START + 210)
253#define SMMU_GFX2D1_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 211)
254#define GFX2D1_IRQ (GIC_SPI_START + 212)
255#define PPSS_WDOG_TIMER_IRQ (GIC_SPI_START + 213)
256#define SPS_SLIMBUS_CORE_EE0_IRQ (GIC_SPI_START + 214)
257#define SPS_SLIMBUS_BAM_EE0_IRQ (GIC_SPI_START + 215)
258#define QDSS_ETB_IRQ (GIC_SPI_START + 216)
259#define QDSS_CTI2KPSS_CPU1_IRQ (GIC_SPI_START + 217)
260#define QDSS_CTI2KPSS_CPU0_IRQ (GIC_SPI_START + 218)
261#define TLMM_APCC_DIR_CONN_IRQ_16 (GIC_SPI_START + 219)
262#define TLMM_APCC_DIR_CONN_IRQ_17 (GIC_SPI_START + 220)
263#define TLMM_APCC_DIR_CONN_IRQ_18 (GIC_SPI_START + 221)
264#define TLMM_APCC_DIR_CONN_IRQ_19 (GIC_SPI_START + 222)
265#define TLMM_APCC_DIR_CONN_IRQ_20 (GIC_SPI_START + 223)
266#define TLMM_APCC_DIR_CONN_IRQ_21 (GIC_SPI_START + 224)
267#define PM8921_SEC_IRQ_104 (GIC_SPI_START + 225)
268#define PM8018_SEC_IRQ_107 (GIC_SPI_START + 226)
269
270/* For now, use the maximum number of interrupts until a pending GIC issue
271 * is sorted out */
272#define NR_MSM_IRQS 1020
273#define NR_BOARD_IRQS 0
274#define NR_GPIO_IRQS 0
275
276#endif
277
diff --git a/arch/arm/mach-msm/include/mach/irqs-8x60.h b/arch/arm/mach-msm/include/mach/irqs-8x60.h
deleted file mode 100644
index f65841c74c0b..000000000000
--- a/arch/arm/mach-msm/include/mach/irqs-8x60.h
+++ /dev/null
@@ -1,258 +0,0 @@
1/* Copyright (c) 2010 Code Aurora Forum. All rights reserved.
2 *
3 * This software is licensed under the terms of the GNU General Public
4 * License version 2, as published by the Free Software Foundation, and
5 * may be copied, distributed, and modified under those terms.
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
14#ifndef __ASM_ARCH_MSM_IRQS_8X60_H
15#define __ASM_ARCH_MSM_IRQS_8X60_H
16
17/* MSM ACPU Interrupt Numbers */
18
19/* 0-15: STI/SGI (software triggered/generated interrupts)
20 * 16-31: PPI (private peripheral interrupts)
21 * 32+: SPI (shared peripheral interrupts)
22 */
23
24#define GIC_PPI_START 16
25#define GIC_SPI_START 32
26
27#define INT_DEBUG_TIMER_EXP (GIC_PPI_START + 0)
28#define INT_GP_TIMER_EXP (GIC_PPI_START + 1)
29#define INT_GP_TIMER2_EXP (GIC_PPI_START + 2)
30#define WDT0_ACCSCSSNBARK_INT (GIC_PPI_START + 3)
31#define WDT1_ACCSCSSNBARK_INT (GIC_PPI_START + 4)
32#define AVS_SVICINT (GIC_PPI_START + 5)
33#define AVS_SVICINTSWDONE (GIC_PPI_START + 6)
34#define CPU_DBGCPUXCOMMRXFULL (GIC_PPI_START + 7)
35#define CPU_DBGCPUXCOMMTXEMPTY (GIC_PPI_START + 8)
36#define CPU_SICCPUXPERFMONIRPTREQ (GIC_PPI_START + 9)
37#define SC_AVSCPUXDOWN (GIC_PPI_START + 10)
38#define SC_AVSCPUXUP (GIC_PPI_START + 11)
39#define SC_SICCPUXACGIRPTREQ (GIC_PPI_START + 12)
40/* PPI 13 to 15 are unused */
41
42
43#define SC_SICMPUIRPTREQ (GIC_SPI_START + 0)
44#define SC_SICL2IRPTREQ (GIC_SPI_START + 1)
45#define SC_SICL2ACGIRPTREQ (GIC_SPI_START + 2)
46#define NC (GIC_SPI_START + 3)
47#define TLMM_SCSS_DIR_CONN_IRQ_0 (GIC_SPI_START + 4)
48#define TLMM_SCSS_DIR_CONN_IRQ_1 (GIC_SPI_START + 5)
49#define TLMM_SCSS_DIR_CONN_IRQ_2 (GIC_SPI_START + 6)
50#define TLMM_SCSS_DIR_CONN_IRQ_3 (GIC_SPI_START + 7)
51#define TLMM_SCSS_DIR_CONN_IRQ_4 (GIC_SPI_START + 8)
52#define TLMM_SCSS_DIR_CONN_IRQ_5 (GIC_SPI_START + 9)
53#define TLMM_SCSS_DIR_CONN_IRQ_6 (GIC_SPI_START + 10)
54#define TLMM_SCSS_DIR_CONN_IRQ_7 (GIC_SPI_START + 11)
55#define TLMM_SCSS_DIR_CONN_IRQ_8 (GIC_SPI_START + 12)
56#define TLMM_SCSS_DIR_CONN_IRQ_9 (GIC_SPI_START + 13)
57#define PM8058_SEC_IRQ_N (GIC_SPI_START + 14)
58#define PM8901_SEC_IRQ_N (GIC_SPI_START + 15)
59#define TLMM_SCSS_SUMMARY_IRQ (GIC_SPI_START + 16)
60#define SPDM_RT_1_IRQ (GIC_SPI_START + 17)
61#define SPDM_DIAG_IRQ (GIC_SPI_START + 18)
62#define RPM_SCSS_CPU0_GP_HIGH_IRQ (GIC_SPI_START + 19)
63#define RPM_SCSS_CPU0_GP_MEDIUM_IRQ (GIC_SPI_START + 20)
64#define RPM_SCSS_CPU0_GP_LOW_IRQ (GIC_SPI_START + 21)
65#define RPM_SCSS_CPU0_WAKE_UP_IRQ (GIC_SPI_START + 22)
66#define RPM_SCSS_CPU1_GP_HIGH_IRQ (GIC_SPI_START + 23)
67#define RPM_SCSS_CPU1_GP_MEDIUM_IRQ (GIC_SPI_START + 24)
68#define RPM_SCSS_CPU1_GP_LOW_IRQ (GIC_SPI_START + 25)
69#define RPM_SCSS_CPU1_WAKE_UP_IRQ (GIC_SPI_START + 26)
70#define SSBI2_2_SC_CPU0_SECURE_INT (GIC_SPI_START + 27)
71#define SSBI2_2_SC_CPU0_NON_SECURE_INT (GIC_SPI_START + 28)
72#define SSBI2_1_SC_CPU0_SECURE_INT (GIC_SPI_START + 29)
73#define SSBI2_1_SC_CPU0_NON_SECURE_INT (GIC_SPI_START + 30)
74#define MSMC_SC_SEC_CE_IRQ (GIC_SPI_START + 31)
75#define MSMC_SC_PRI_CE_IRQ (GIC_SPI_START + 32)
76#define MARM_FIQ (GIC_SPI_START + 33)
77#define MARM_IRQ (GIC_SPI_START + 34)
78#define MARM_L2CC_IRQ (GIC_SPI_START + 35)
79#define MARM_WDOG_EXPIRED (GIC_SPI_START + 36)
80#define MARM_SCSS_GP_IRQ_0 (GIC_SPI_START + 37)
81#define MARM_SCSS_GP_IRQ_1 (GIC_SPI_START + 38)
82#define MARM_SCSS_GP_IRQ_2 (GIC_SPI_START + 39)
83#define MARM_SCSS_GP_IRQ_3 (GIC_SPI_START + 40)
84#define MARM_SCSS_GP_IRQ_4 (GIC_SPI_START + 41)
85#define MARM_SCSS_GP_IRQ_5 (GIC_SPI_START + 42)
86#define MARM_SCSS_GP_IRQ_6 (GIC_SPI_START + 43)
87#define MARM_SCSS_GP_IRQ_7 (GIC_SPI_START + 44)
88#define MARM_SCSS_GP_IRQ_8 (GIC_SPI_START + 45)
89#define MARM_SCSS_GP_IRQ_9 (GIC_SPI_START + 46)
90#define VPE_IRQ (GIC_SPI_START + 47)
91#define VFE_IRQ (GIC_SPI_START + 48)
92#define VCODEC_IRQ (GIC_SPI_START + 49)
93#define TV_ENC_IRQ (GIC_SPI_START + 50)
94#define SMMU_VPE_CB_SC_SECURE_IRQ (GIC_SPI_START + 51)
95#define SMMU_VPE_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 52)
96#define SMMU_VFE_CB_SC_SECURE_IRQ (GIC_SPI_START + 53)
97#define SMMU_VFE_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 54)
98#define SMMU_VCODEC_B_CB_SC_SECURE_IRQ (GIC_SPI_START + 55)
99#define SMMU_VCODEC_B_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 56)
100#define SMMU_VCODEC_A_CB_SC_SECURE_IRQ (GIC_SPI_START + 57)
101#define SMMU_VCODEC_A_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 58)
102#define SMMU_ROT_CB_SC_SECURE_IRQ (GIC_SPI_START + 59)
103#define SMMU_ROT_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 60)
104#define SMMU_MDP1_CB_SC_SECURE_IRQ (GIC_SPI_START + 61)
105#define SMMU_MDP1_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 62)
106#define SMMU_MDP0_CB_SC_SECURE_IRQ (GIC_SPI_START + 63)
107#define SMMU_MDP0_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 64)
108#define SMMU_JPEGD_CB_SC_SECURE_IRQ (GIC_SPI_START + 65)
109#define SMMU_JPEGD_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 66)
110#define SMMU_IJPEG_CB_SC_SECURE_IRQ (GIC_SPI_START + 67)
111#define SMMU_IJPEG_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 68)
112#define SMMU_GFX3D_CB_SC_SECURE_IRQ (GIC_SPI_START + 69)
113#define SMMU_GFX3D_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 70)
114#define SMMU_GFX2D0_CB_SC_SECURE_IRQ (GIC_SPI_START + 71)
115#define SMMU_GFX2D0_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 72)
116#define ROT_IRQ (GIC_SPI_START + 73)
117#define MMSS_FABRIC_IRQ (GIC_SPI_START + 74)
118#define MDP_IRQ (GIC_SPI_START + 75)
119#define JPEGD_IRQ (GIC_SPI_START + 76)
120#define JPEG_IRQ (GIC_SPI_START + 77)
121#define MMSS_IMEM_IRQ (GIC_SPI_START + 78)
122#define HDMI_IRQ (GIC_SPI_START + 79)
123#define GFX3D_IRQ (GIC_SPI_START + 80)
124#define GFX2D0_IRQ (GIC_SPI_START + 81)
125#define DSI_IRQ (GIC_SPI_START + 82)
126#define CSI_1_IRQ (GIC_SPI_START + 83)
127#define CSI_0_IRQ (GIC_SPI_START + 84)
128#define LPASS_SCSS_AUDIO_IF_OUT0_IRQ (GIC_SPI_START + 85)
129#define LPASS_SCSS_MIDI_IRQ (GIC_SPI_START + 86)
130#define LPASS_Q6SS_WDOG_EXPIRED (GIC_SPI_START + 87)
131#define LPASS_SCSS_GP_LOW_IRQ (GIC_SPI_START + 88)
132#define LPASS_SCSS_GP_MEDIUM_IRQ (GIC_SPI_START + 89)
133#define LPASS_SCSS_GP_HIGH_IRQ (GIC_SPI_START + 90)
134#define TOP_IMEM_IRQ (GIC_SPI_START + 91)
135#define FABRIC_SYS_IRQ (GIC_SPI_START + 92)
136#define FABRIC_APPS_IRQ (GIC_SPI_START + 93)
137#define USB1_HS_BAM_IRQ (GIC_SPI_START + 94)
138#define SDC4_BAM_IRQ (GIC_SPI_START + 95)
139#define SDC3_BAM_IRQ (GIC_SPI_START + 96)
140#define SDC2_BAM_IRQ (GIC_SPI_START + 97)
141#define SDC1_BAM_IRQ (GIC_SPI_START + 98)
142#define FABRIC_SPS_IRQ (GIC_SPI_START + 99)
143#define USB1_HS_IRQ (GIC_SPI_START + 100)
144#define SDC4_IRQ_0 (GIC_SPI_START + 101)
145#define SDC3_IRQ_0 (GIC_SPI_START + 102)
146#define SDC2_IRQ_0 (GIC_SPI_START + 103)
147#define SDC1_IRQ_0 (GIC_SPI_START + 104)
148#define SPS_BAM_DMA_IRQ (GIC_SPI_START + 105)
149#define SPS_SEC_VIOL_IRQ (GIC_SPI_START + 106)
150#define SPS_MTI_0 (GIC_SPI_START + 107)
151#define SPS_MTI_1 (GIC_SPI_START + 108)
152#define SPS_MTI_2 (GIC_SPI_START + 109)
153#define SPS_MTI_3 (GIC_SPI_START + 110)
154#define SPS_MTI_4 (GIC_SPI_START + 111)
155#define SPS_MTI_5 (GIC_SPI_START + 112)
156#define SPS_MTI_6 (GIC_SPI_START + 113)
157#define SPS_MTI_7 (GIC_SPI_START + 114)
158#define SPS_MTI_8 (GIC_SPI_START + 115)
159#define SPS_MTI_9 (GIC_SPI_START + 116)
160#define SPS_MTI_10 (GIC_SPI_START + 117)
161#define SPS_MTI_11 (GIC_SPI_START + 118)
162#define SPS_MTI_12 (GIC_SPI_START + 119)
163#define SPS_MTI_13 (GIC_SPI_START + 120)
164#define SPS_MTI_14 (GIC_SPI_START + 121)
165#define SPS_MTI_15 (GIC_SPI_START + 122)
166#define SPS_MTI_16 (GIC_SPI_START + 123)
167#define SPS_MTI_17 (GIC_SPI_START + 124)
168#define SPS_MTI_18 (GIC_SPI_START + 125)
169#define SPS_MTI_19 (GIC_SPI_START + 126)
170#define SPS_MTI_20 (GIC_SPI_START + 127)
171#define SPS_MTI_21 (GIC_SPI_START + 128)
172#define SPS_MTI_22 (GIC_SPI_START + 129)
173#define SPS_MTI_23 (GIC_SPI_START + 130)
174#define SPS_MTI_24 (GIC_SPI_START + 131)
175#define SPS_MTI_25 (GIC_SPI_START + 132)
176#define SPS_MTI_26 (GIC_SPI_START + 133)
177#define SPS_MTI_27 (GIC_SPI_START + 134)
178#define SPS_MTI_28 (GIC_SPI_START + 135)
179#define SPS_MTI_29 (GIC_SPI_START + 136)
180#define SPS_MTI_30 (GIC_SPI_START + 137)
181#define SPS_MTI_31 (GIC_SPI_START + 138)
182#define UXMC_EBI2_WR_ER_DONE_IRQ (GIC_SPI_START + 139)
183#define UXMC_EBI2_OP_DONE_IRQ (GIC_SPI_START + 140)
184#define USB2_IRQ (GIC_SPI_START + 141)
185#define USB1_IRQ (GIC_SPI_START + 142)
186#define TSSC_SSBI_IRQ (GIC_SPI_START + 143)
187#define TSSC_SAMPLE_IRQ (GIC_SPI_START + 144)
188#define TSSC_PENUP_IRQ (GIC_SPI_START + 145)
189#define INT_UART1DM_IRQ (GIC_SPI_START + 146)
190#define GSBI1_QUP_IRQ (GIC_SPI_START + 147)
191#define INT_UART2DM_IRQ (GIC_SPI_START + 148)
192#define GSBI2_QUP_IRQ (GIC_SPI_START + 149)
193#define INT_UART3DM_IRQ (GIC_SPI_START + 150)
194#define GSBI3_QUP_IRQ (GIC_SPI_START + 151)
195#define INT_UART4DM_IRQ (GIC_SPI_START + 152)
196#define GSBI4_QUP_IRQ (GIC_SPI_START + 153)
197#define INT_UART5DM_IRQ (GIC_SPI_START + 154)
198#define GSBI5_QUP_IRQ (GIC_SPI_START + 155)
199#define INT_UART6DM_IRQ (GIC_SPI_START + 156)
200#define GSBI6_QUP_IRQ (GIC_SPI_START + 157)
201#define INT_UART7DM_IRQ (GIC_SPI_START + 158)
202#define GSBI7_QUP_IRQ (GIC_SPI_START + 159)
203#define INT_UART8DM_IRQ (GIC_SPI_START + 160)
204#define GSBI8_QUP_IRQ (GIC_SPI_START + 161)
205#define TSIF_TSPP_IRQ (GIC_SPI_START + 162)
206#define TSIF_BAM_IRQ (GIC_SPI_START + 163)
207#define TSIF2_IRQ (GIC_SPI_START + 164)
208#define TSIF1_IRQ (GIC_SPI_START + 165)
209#define INT_ADM1_MASTER (GIC_SPI_START + 166)
210#define INT_ADM1_AARM (GIC_SPI_START + 167)
211#define INT_ADM1_SD2 (GIC_SPI_START + 168)
212#define INT_ADM1_SD3 (GIC_SPI_START + 169)
213#define INT_ADM0_MASTER (GIC_SPI_START + 170)
214#define INT_ADM0_AARM (GIC_SPI_START + 171)
215#define INT_ADM0_SD2 (GIC_SPI_START + 172)
216#define INT_ADM0_SD3 (GIC_SPI_START + 173)
217#define CC_SCSS_WDT1CPU1BITEEXPIRED (GIC_SPI_START + 174)
218#define CC_SCSS_WDT1CPU0BITEEXPIRED (GIC_SPI_START + 175)
219#define CC_SCSS_WDT0CPU1BITEEXPIRED (GIC_SPI_START + 176)
220#define CC_SCSS_WDT0CPU0BITEEXPIRED (GIC_SPI_START + 177)
221#define TSENS_UPPER_LOWER_INT (GIC_SPI_START + 178)
222#define SSBI2_2_SC_CPU1_SECURE_INT (GIC_SPI_START + 179)
223#define SSBI2_2_SC_CPU1_NON_SECURE_INT (GIC_SPI_START + 180)
224#define SSBI2_1_SC_CPU1_SECURE_INT (GIC_SPI_START + 181)
225#define SSBI2_1_SC_CPU1_NON_SECURE_INT (GIC_SPI_START + 182)
226#define XPU_SUMMARY_IRQ (GIC_SPI_START + 183)
227#define BUS_EXCEPTION_SUMMARY_IRQ (GIC_SPI_START + 184)
228#define HSDDRX_SMICH0_IRQ (GIC_SPI_START + 185)
229#define HSDDRX_EBI1_IRQ (GIC_SPI_START + 186)
230#define SDC5_BAM_IRQ (GIC_SPI_START + 187)
231#define SDC5_IRQ_0 (GIC_SPI_START + 188)
232#define INT_UART9DM_IRQ (GIC_SPI_START + 189)
233#define GSBI9_QUP_IRQ (GIC_SPI_START + 190)
234#define INT_UART10DM_IRQ (GIC_SPI_START + 191)
235#define GSBI10_QUP_IRQ (GIC_SPI_START + 192)
236#define INT_UART11DM_IRQ (GIC_SPI_START + 193)
237#define GSBI11_QUP_IRQ (GIC_SPI_START + 194)
238#define INT_UART12DM_IRQ (GIC_SPI_START + 195)
239#define GSBI12_QUP_IRQ (GIC_SPI_START + 196)
240
241/*SPI 197 to 209 arent used in 8x60*/
242#define SMMU_GFX2D1_CB_SC_SECURE_IRQ (GIC_SPI_START + 210)
243#define SMMU_GFX2D1_CB_SC_NON_SECURE_IRQ (GIC_SPI_START + 211)
244
245/*SPI 212 to 216 arent used in 8x60*/
246#define SMPSS_SPARE_1 (GIC_SPI_START + 217)
247#define SMPSS_SPARE_2 (GIC_SPI_START + 218)
248#define SMPSS_SPARE_3 (GIC_SPI_START + 219)
249#define SMPSS_SPARE_4 (GIC_SPI_START + 220)
250#define SMPSS_SPARE_5 (GIC_SPI_START + 221)
251#define SMPSS_SPARE_6 (GIC_SPI_START + 222)
252#define SMPSS_SPARE_7 (GIC_SPI_START + 223)
253
254#define NR_GPIO_IRQS 173
255#define NR_MSM_IRQS 256
256#define NR_BOARD_IRQS 0
257
258#endif
diff --git a/arch/arm/mach-msm/include/mach/irqs.h b/arch/arm/mach-msm/include/mach/irqs.h
index 3cd78b165abb..164d355c96ea 100644
--- a/arch/arm/mach-msm/include/mach/irqs.h
+++ b/arch/arm/mach-msm/include/mach/irqs.h
@@ -24,11 +24,6 @@
24#elif defined(CONFIG_ARCH_QSD8X50) 24#elif defined(CONFIG_ARCH_QSD8X50)
25#include "irqs-8x50.h" 25#include "irqs-8x50.h"
26#include "sirc.h" 26#include "sirc.h"
27#elif defined(CONFIG_ARCH_MSM8X60)
28#include "irqs-8x60.h"
29#elif defined(CONFIG_ARCH_MSM8960)
30/* TODO: Make these not generic. */
31#include "irqs-8960.h"
32#elif defined(CONFIG_ARCH_MSM_ARM11) 27#elif defined(CONFIG_ARCH_MSM_ARM11)
33#include "irqs-7x00.h" 28#include "irqs-7x00.h"
34#else 29#else
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 696fb73296d0..1e9c3383daba 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -274,7 +274,6 @@ static void __init msm_dt_timer_init(struct device_node *np)
274 pr_err("Unknown frequency\n"); 274 pr_err("Unknown frequency\n");
275 return; 275 return;
276 } 276 }
277 of_node_put(np);
278 277
279 event_base = base + 0x4; 278 event_base = base + 0x4;
280 sts_base = base + 0x88; 279 sts_base = base + 0x88;
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 9eb63d724602..5e269d7263ce 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -1,5 +1,6 @@
1config ARCH_MVEBU 1config ARCH_MVEBU
2 bool "Marvell SOCs with Device Tree support" if ARCH_MULTI_V7 2 bool "Marvell SOCs with Device Tree support" if ARCH_MULTI_V7
3 select ARCH_SUPPORTS_BIG_ENDIAN
3 select CLKSRC_MMIO 4 select CLKSRC_MMIO
4 select COMMON_CLK 5 select COMMON_CLK
5 select GENERIC_CLOCKEVENTS 6 select GENERIC_CLOCKEVENTS
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index 4c24303ec481..58adf2fd9cfc 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -140,6 +140,7 @@ int __init coherency_init(void)
140 coherency_base = of_iomap(np, 0); 140 coherency_base = of_iomap(np, 0);
141 coherency_cpu_base = of_iomap(np, 1); 141 coherency_cpu_base = of_iomap(np, 1);
142 set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0); 142 set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0);
143 of_node_put(np);
143 } 144 }
144 145
145 return 0; 146 return 0;
@@ -147,9 +148,14 @@ int __init coherency_init(void)
147 148
148static int __init coherency_late_init(void) 149static int __init coherency_late_init(void)
149{ 150{
150 if (of_find_matching_node(NULL, of_coherency_table)) 151 struct device_node *np;
152
153 np = of_find_matching_node(NULL, of_coherency_table);
154 if (np) {
151 bus_register_notifier(&platform_bus_type, 155 bus_register_notifier(&platform_bus_type,
152 &mvebu_hwcc_platform_nb); 156 &mvebu_hwcc_platform_nb);
157 of_node_put(np);
158 }
153 return 0; 159 return 0;
154} 160}
155 161
diff --git a/arch/arm/mach-mvebu/coherency_ll.S b/arch/arm/mach-mvebu/coherency_ll.S
index 5476669ba905..ee7598fe75db 100644
--- a/arch/arm/mach-mvebu/coherency_ll.S
+++ b/arch/arm/mach-mvebu/coherency_ll.S
@@ -20,6 +20,8 @@
20#define ARMADA_XP_CFB_CTL_REG_OFFSET 0x0 20#define ARMADA_XP_CFB_CTL_REG_OFFSET 0x0
21#define ARMADA_XP_CFB_CFG_REG_OFFSET 0x4 21#define ARMADA_XP_CFB_CFG_REG_OFFSET 0x4
22 22
23#include <asm/assembler.h>
24
23 .text 25 .text
24/* 26/*
25 * r0: Coherency fabric base register address 27 * r0: Coherency fabric base register address
@@ -29,6 +31,7 @@ ENTRY(ll_set_cpu_coherent)
29 /* Create bit by cpu index */ 31 /* Create bit by cpu index */
30 mov r3, #(1 << 24) 32 mov r3, #(1 << 24)
31 lsl r1, r3, r1 33 lsl r1, r3, r1
34ARM_BE8(rev r1, r1)
32 35
33 /* Add CPU to SMP group - Atomic */ 36 /* Add CPU to SMP group - Atomic */
34 add r3, r0, #ARMADA_XP_CFB_CTL_REG_OFFSET 37 add r3, r0, #ARMADA_XP_CFB_CTL_REG_OFFSET
diff --git a/arch/arm/mach-mvebu/headsmp.S b/arch/arm/mach-mvebu/headsmp.S
index 8a1b0c96e9ec..3dd80df428f7 100644
--- a/arch/arm/mach-mvebu/headsmp.S
+++ b/arch/arm/mach-mvebu/headsmp.S
@@ -21,12 +21,16 @@
21#include <linux/linkage.h> 21#include <linux/linkage.h>
22#include <linux/init.h> 22#include <linux/init.h>
23 23
24#include <asm/assembler.h>
25
24/* 26/*
25 * Armada XP specific entry point for secondary CPUs. 27 * Armada XP specific entry point for secondary CPUs.
26 * We add the CPU to the coherency fabric and then jump to secondary 28 * We add the CPU to the coherency fabric and then jump to secondary
27 * startup 29 * startup
28 */ 30 */
29ENTRY(armada_xp_secondary_startup) 31ENTRY(armada_xp_secondary_startup)
32 ARM_BE8(setend be ) @ go BE8 if entered LE
33
30 /* Get coherency fabric base physical address */ 34 /* Get coherency fabric base physical address */
31 adr r0, 1f 35 adr r0, 1f
32 ldr r1, [r0] 36 ldr r1, [r0]
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index 3cc4bef6401c..27fc4f049474 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -67,6 +67,7 @@ int __init armada_370_xp_pmsu_init(void)
67 pr_info("Initializing Power Management Service Unit\n"); 67 pr_info("Initializing Power Management Service Unit\n");
68 pmsu_mp_base = of_iomap(np, 0); 68 pmsu_mp_base = of_iomap(np, 0);
69 pmsu_reset_base = of_iomap(np, 1); 69 pmsu_reset_base = of_iomap(np, 1);
70 of_node_put(np);
70 } 71 }
71 72
72 return 0; 73 return 0;
diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c
index f875124ff4f9..5175083cdb34 100644
--- a/arch/arm/mach-mvebu/system-controller.c
+++ b/arch/arm/mach-mvebu/system-controller.c
@@ -98,6 +98,7 @@ static int __init mvebu_system_controller_init(void)
98 BUG_ON(!match); 98 BUG_ON(!match);
99 system_controller_base = of_iomap(np, 0); 99 system_controller_base = of_iomap(np, 0);
100 mvebu_sc = (struct mvebu_system_controller *)match->data; 100 mvebu_sc = (struct mvebu_system_controller *)match->data;
101 of_node_put(np);
101 } 102 }
102 103
103 return 0; 104 return 0;
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 98f6e2adb53e..1dc5acd4fc99 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -13,8 +13,6 @@
13#include <linux/clk.h> 13#include <linux/clk.h>
14#include <linux/clk/mxs.h> 14#include <linux/clk/mxs.h>
15#include <linux/clkdev.h> 15#include <linux/clkdev.h>
16#include <linux/clocksource.h>
17#include <linux/clk-provider.h>
18#include <linux/delay.h> 16#include <linux/delay.h>
19#include <linux/err.h> 17#include <linux/err.h>
20#include <linux/gpio.h> 18#include <linux/gpio.h>
@@ -332,6 +330,11 @@ static void __init crystalfontz_init(void)
332 update_fec_mac_prop(OUI_CRYSTALFONTZ); 330 update_fec_mac_prop(OUI_CRYSTALFONTZ);
333} 331}
334 332
333static void __init m28cu3_init(void)
334{
335 update_fec_mac_prop(OUI_DENX);
336}
337
335static const char __init *mxs_get_soc_id(void) 338static const char __init *mxs_get_soc_id(void)
336{ 339{
337 struct device_node *np; 340 struct device_node *np;
@@ -459,6 +462,8 @@ static void __init mxs_machine_init(void)
459 apx4devkit_init(); 462 apx4devkit_init();
460 else if (of_machine_is_compatible("crystalfontz,cfa10036")) 463 else if (of_machine_is_compatible("crystalfontz,cfa10036"))
461 crystalfontz_init(); 464 crystalfontz_init();
465 else if (of_machine_is_compatible("msr,m28cu3"))
466 m28cu3_init();
462 467
463 of_platform_populate(NULL, of_default_bus_match_table, 468 of_platform_populate(NULL, of_default_bus_match_table,
464 NULL, parent); 469 NULL, parent);
@@ -490,16 +495,6 @@ static void mxs_restart(enum reboot_mode mode, const char *cmd)
490 soft_restart(0); 495 soft_restart(0);
491} 496}
492 497
493static void __init mxs_timer_init(void)
494{
495 if (of_machine_is_compatible("fsl,imx23"))
496 mx23_clocks_init();
497 else
498 mx28_clocks_init();
499 of_clk_init(NULL);
500 clocksource_of_init();
501}
502
503static const char *mxs_dt_compat[] __initdata = { 498static const char *mxs_dt_compat[] __initdata = {
504 "fsl,imx28", 499 "fsl,imx28",
505 "fsl,imx23", 500 "fsl,imx23",
@@ -508,7 +503,6 @@ static const char *mxs_dt_compat[] __initdata = {
508 503
509DT_MACHINE_START(MXS, "Freescale MXS (Device Tree)") 504DT_MACHINE_START(MXS, "Freescale MXS (Device Tree)")
510 .handle_irq = icoll_handle_irq, 505 .handle_irq = icoll_handle_irq,
511 .init_time = mxs_timer_init,
512 .init_machine = mxs_machine_init, 506 .init_machine = mxs_machine_init,
513 .init_late = mxs_pm_init, 507 .init_late = mxs_pm_init,
514 .dt_compat = mxs_dt_compat, 508 .dt_compat = mxs_dt_compat,
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 13e0df9c11ce..cce2c9dfb5d1 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -25,15 +25,11 @@
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/platform_data/clk-nomadik.h>
29#include <linux/clocksource.h>
30#include <linux/of_irq.h> 28#include <linux/of_irq.h>
31#include <linux/of_gpio.h> 29#include <linux/of_gpio.h>
32#include <linux/of_address.h> 30#include <linux/of_address.h>
33#include <linux/of_platform.h> 31#include <linux/of_platform.h>
34#include <linux/mtd/fsmc.h>
35#include <linux/gpio.h> 32#include <linux/gpio.h>
36#include <linux/amba/mmci.h>
37 33
38#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
39#include <asm/mach/map.h> 35#include <asm/mach/map.h>
@@ -113,50 +109,6 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd)
113 writel(1, srcbase + 0x18); 109 writel(1, srcbase + 0x18);
114} 110}
115 111
116/* Initial value for SRC control register: all timers use MXTAL/8 source */
117#define SRC_CR_INIT_MASK 0x00007fff
118#define SRC_CR_INIT_VAL 0x2aaa8000
119
120static void __init cpu8815_timer_init_of(void)
121{
122 struct device_node *mtu;
123 void __iomem *base;
124 int irq;
125 u32 src_cr;
126
127 /* We need this to be up now */
128 nomadik_clk_init();
129
130 mtu = of_find_node_by_path("/mtu@101e2000");
131 if (!mtu)
132 return;
133 base = of_iomap(mtu, 0);
134 if (WARN_ON(!base))
135 return;
136 irq = irq_of_parse_and_map(mtu, 0);
137
138 pr_info("Remapped MTU @ %p, irq: %d\n", base, irq);
139
140 /* Configure timer sources in "system reset controller" ctrl reg */
141 src_cr = readl(base);
142 src_cr &= SRC_CR_INIT_MASK;
143 src_cr |= SRC_CR_INIT_VAL;
144 writel(src_cr, base);
145
146 clocksource_of_init();
147}
148
149static struct fsmc_nand_timings cpu8815_nand_timings = {
150 .thiz = 0,
151 .thold = 0x10,
152 .twait = 0x0A,
153 .tset = 0,
154};
155
156static struct fsmc_nand_platform_data cpu8815_nand_data = {
157 .nand_timings = &cpu8815_nand_timings,
158};
159
160/* 112/*
161 * The SMSC911x IRQ is connected to a GPIO pin, but the driver expects 113 * The SMSC911x IRQ is connected to a GPIO pin, but the driver expects
162 * to simply request an IRQ passed as a resource. So the GPIO pin needs 114 * to simply request an IRQ passed as a resource. So the GPIO pin needs
@@ -190,15 +142,6 @@ static int __init cpu8815_eth_init(void)
190device_initcall(cpu8815_eth_init); 142device_initcall(cpu8815_eth_init);
191 143
192/* 144/*
193 * TODO:
194 * cannot be set from device tree, convert to a proper DT
195 * binding.
196 */
197static struct mmci_platform_data mmcsd_plat_data = {
198 .ocr_mask = MMC_VDD_29_30,
199};
200
201/*
202 * This GPIO pin turns on a line that is used to detect card insertion 145 * This GPIO pin turns on a line that is used to detect card insertion
203 * on this board. 146 * on this board.
204 */ 147 */
@@ -232,24 +175,13 @@ static int __init cpu8815_mmcsd_init(void)
232} 175}
233device_initcall(cpu8815_mmcsd_init); 176device_initcall(cpu8815_mmcsd_init);
234 177
235
236/* These are mostly to get the right device names for the clock lookups */
237static struct of_dev_auxdata cpu8815_auxdata_lookup[] __initdata = {
238 OF_DEV_AUXDATA("stericsson,fsmc-nand", NOMADIK_FSMC_BASE,
239 NULL, &cpu8815_nand_data),
240 OF_DEV_AUXDATA("arm,primecell", NOMADIK_SDI_BASE,
241 NULL, &mmcsd_plat_data),
242 { /* sentinel */ },
243};
244
245static void __init cpu8815_init_of(void) 178static void __init cpu8815_init_of(void)
246{ 179{
247#ifdef CONFIG_CACHE_L2X0 180#ifdef CONFIG_CACHE_L2X0
248 /* At full speed latency must be >=2, so 0x249 in low bits */ 181 /* At full speed latency must be >=2, so 0x249 in low bits */
249 l2x0_of_init(0x00730249, 0xfe000fff); 182 l2x0_of_init(0x00730249, 0xfe000fff);
250#endif 183#endif
251 of_platform_populate(NULL, of_default_bus_match_table, 184 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
252 cpu8815_auxdata_lookup, NULL);
253} 185}
254 186
255static const char * cpu8815_board_compat[] = { 187static const char * cpu8815_board_compat[] = {
@@ -259,7 +191,6 @@ static const char * cpu8815_board_compat[] = {
259 191
260DT_MACHINE_START(NOMADIK_DT, "Nomadik STn8815") 192DT_MACHINE_START(NOMADIK_DT, "Nomadik STn8815")
261 .map_io = cpu8815_map_io, 193 .map_io = cpu8815_map_io,
262 .init_time = cpu8815_timer_init_of,
263 .init_machine = cpu8815_init_of, 194 .init_machine = cpu8815_init_of,
264 .restart = cpu8815_restart, 195 .restart = cpu8815_restart,
265 .dt_compat = cpu8815_board_compat, 196 .dt_compat = cpu8815_board_compat,
diff --git a/arch/arm/mach-nspire/nspire.c b/arch/arm/mach-nspire/nspire.c
index 99e26092a9f7..4b2ed2e8352f 100644
--- a/arch/arm/mach-nspire/nspire.c
+++ b/arch/arm/mach-nspire/nspire.c
@@ -14,11 +14,9 @@
14#include <linux/of_platform.h> 14#include <linux/of_platform.h>
15#include <linux/irqchip.h> 15#include <linux/irqchip.h>
16#include <linux/irqchip/arm-vic.h> 16#include <linux/irqchip/arm-vic.h>
17#include <linux/clk-provider.h>
18#include <linux/clkdev.h> 17#include <linux/clkdev.h>
19#include <linux/amba/bus.h> 18#include <linux/amba/bus.h>
20#include <linux/amba/clcd.h> 19#include <linux/amba/clcd.h>
21#include <linux/clocksource.h>
22 20
23#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
24#include <asm/mach-types.h> 22#include <asm/mach-types.h>
@@ -65,12 +63,6 @@ static void __init nspire_init(void)
65 nspire_auxdata, NULL); 63 nspire_auxdata, NULL);
66} 64}
67 65
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) 66static void nspire_restart(char mode, const char *cmd)
75{ 67{
76 void __iomem *base = ioremap(NSPIRE_MISC_PHYS_BASE, SZ_4K); 68 void __iomem *base = ioremap(NSPIRE_MISC_PHYS_BASE, SZ_4K);
@@ -83,7 +75,6 @@ static void nspire_restart(char mode, const char *cmd)
83DT_MACHINE_START(NSPIRE, "TI-NSPIRE") 75DT_MACHINE_START(NSPIRE, "TI-NSPIRE")
84 .dt_compat = nspire_dt_match, 76 .dt_compat = nspire_dt_match,
85 .map_io = nspire_map_io, 77 .map_io = nspire_map_io,
86 .init_time = nspire_init_time,
87 .init_machine = nspire_init, 78 .init_machine = nspire_init,
88 .restart = nspire_restart, 79 .restart = nspire_restart,
89MACHINE_END 80MACHINE_END
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h
index abec019a5281..732f8ee2fcd2 100644
--- a/arch/arm/mach-omap1/common.h
+++ b/arch/arm/mach-omap1/common.h
@@ -46,6 +46,9 @@ static inline void omap7xx_map_io(void)
46void omap1510_fpga_init_irq(void); 46void omap1510_fpga_init_irq(void);
47void omap15xx_map_io(void); 47void omap15xx_map_io(void);
48#else 48#else
49static inline void omap1510_fpga_init_irq(void)
50{
51}
49static inline void omap15xx_map_io(void) 52static inline void omap15xx_map_io(void)
50{ 53{
51} 54}
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index 8bd71b2d0967..3c0e42219200 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -135,8 +135,7 @@ static struct irq_chip omap_fpga_irq = {
135 * mask_ack routine for all of the FPGA interrupts has been changed from 135 * mask_ack routine for all of the FPGA interrupts has been changed from
136 * fpga_mask_ack_irq() to fpga_ack_irq() so that the specific FPGA interrupt 136 * fpga_mask_ack_irq() to fpga_ack_irq() so that the specific FPGA interrupt
137 * being serviced is left unmasked. We can do this because the FPGA cascade 137 * being serviced is left unmasked. We can do this because the FPGA cascade
138 * interrupt is installed with the IRQF_DISABLED flag, which leaves all 138 * interrupt is run with all interrupts masked.
139 * interrupts masked at the CPU while an FPGA interrupt handler executes.
140 * 139 *
141 * Limited testing indicates that this workaround appears to be effective 140 * Limited testing indicates that this workaround appears to be effective
142 * for the smc9194 Ethernet driver used on the Innovator. It should work 141 * for the smc9194 Ethernet driver used on the Innovator. It should work
diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c
index 02b3eb2e201c..312a0924d786 100644
--- a/arch/arm/mach-omap1/gpio15xx.c
+++ b/arch/arm/mach-omap1/gpio15xx.c
@@ -25,7 +25,7 @@
25#define OMAP1510_GPIO_BASE 0xFFFCE000 25#define OMAP1510_GPIO_BASE 0xFFFCE000
26 26
27/* gpio1 */ 27/* gpio1 */
28static struct __initdata resource omap15xx_mpu_gpio_resources[] = { 28static struct resource omap15xx_mpu_gpio_resources[] = {
29 { 29 {
30 .start = OMAP1_MPUIO_VBASE, 30 .start = OMAP1_MPUIO_VBASE,
31 .end = OMAP1_MPUIO_VBASE + SZ_2K - 1, 31 .end = OMAP1_MPUIO_VBASE + SZ_2K - 1,
@@ -48,7 +48,7 @@ static struct omap_gpio_reg_offs omap15xx_mpuio_regs = {
48 .irqctrl = OMAP_MPUIO_GPIO_INT_EDGE, 48 .irqctrl = OMAP_MPUIO_GPIO_INT_EDGE,
49}; 49};
50 50
51static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = { 51static struct omap_gpio_platform_data omap15xx_mpu_gpio_config = {
52 .is_mpuio = true, 52 .is_mpuio = true,
53 .bank_width = 16, 53 .bank_width = 16,
54 .bank_stride = 1, 54 .bank_stride = 1,
@@ -66,7 +66,7 @@ static struct platform_device omap15xx_mpu_gpio = {
66}; 66};
67 67
68/* gpio2 */ 68/* gpio2 */
69static struct __initdata resource omap15xx_gpio_resources[] = { 69static struct resource omap15xx_gpio_resources[] = {
70 { 70 {
71 .start = OMAP1510_GPIO_BASE, 71 .start = OMAP1510_GPIO_BASE,
72 .end = OMAP1510_GPIO_BASE + SZ_2K - 1, 72 .end = OMAP1510_GPIO_BASE + SZ_2K - 1,
@@ -90,7 +90,7 @@ static struct omap_gpio_reg_offs omap15xx_gpio_regs = {
90 .pinctrl = OMAP1510_GPIO_PIN_CONTROL, 90 .pinctrl = OMAP1510_GPIO_PIN_CONTROL,
91}; 91};
92 92
93static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = { 93static struct omap_gpio_platform_data omap15xx_gpio_config = {
94 .bank_width = 16, 94 .bank_width = 16,
95 .regs = &omap15xx_gpio_regs, 95 .regs = &omap15xx_gpio_regs,
96}; 96};
diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
index b9952a258d82..6e6ec93dcbb3 100644
--- a/arch/arm/mach-omap1/gpio16xx.c
+++ b/arch/arm/mach-omap1/gpio16xx.c
@@ -31,7 +31,7 @@
31#define SYSCONFIG_WORD 0x14 31#define SYSCONFIG_WORD 0x14
32 32
33/* mpu gpio */ 33/* mpu gpio */
34static struct __initdata resource omap16xx_mpu_gpio_resources[] = { 34static struct resource omap16xx_mpu_gpio_resources[] = {
35 { 35 {
36 .start = OMAP1_MPUIO_VBASE, 36 .start = OMAP1_MPUIO_VBASE,
37 .end = OMAP1_MPUIO_VBASE + SZ_2K - 1, 37 .end = OMAP1_MPUIO_VBASE + SZ_2K - 1,
@@ -54,7 +54,7 @@ static struct omap_gpio_reg_offs omap16xx_mpuio_regs = {
54 .irqctrl = OMAP_MPUIO_GPIO_INT_EDGE, 54 .irqctrl = OMAP_MPUIO_GPIO_INT_EDGE,
55}; 55};
56 56
57static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = { 57static struct omap_gpio_platform_data omap16xx_mpu_gpio_config = {
58 .is_mpuio = true, 58 .is_mpuio = true,
59 .bank_width = 16, 59 .bank_width = 16,
60 .bank_stride = 1, 60 .bank_stride = 1,
@@ -72,7 +72,7 @@ static struct platform_device omap16xx_mpu_gpio = {
72}; 72};
73 73
74/* gpio1 */ 74/* gpio1 */
75static struct __initdata resource omap16xx_gpio1_resources[] = { 75static struct resource omap16xx_gpio1_resources[] = {
76 { 76 {
77 .start = OMAP1610_GPIO1_BASE, 77 .start = OMAP1610_GPIO1_BASE,
78 .end = OMAP1610_GPIO1_BASE + SZ_2K - 1, 78 .end = OMAP1610_GPIO1_BASE + SZ_2K - 1,
@@ -100,7 +100,7 @@ static struct omap_gpio_reg_offs omap16xx_gpio_regs = {
100 .edgectrl2 = OMAP1610_GPIO_EDGE_CTRL2, 100 .edgectrl2 = OMAP1610_GPIO_EDGE_CTRL2,
101}; 101};
102 102
103static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = { 103static struct omap_gpio_platform_data omap16xx_gpio1_config = {
104 .bank_width = 16, 104 .bank_width = 16,
105 .regs = &omap16xx_gpio_regs, 105 .regs = &omap16xx_gpio_regs,
106}; 106};
@@ -116,7 +116,7 @@ static struct platform_device omap16xx_gpio1 = {
116}; 116};
117 117
118/* gpio2 */ 118/* gpio2 */
119static struct __initdata resource omap16xx_gpio2_resources[] = { 119static struct resource omap16xx_gpio2_resources[] = {
120 { 120 {
121 .start = OMAP1610_GPIO2_BASE, 121 .start = OMAP1610_GPIO2_BASE,
122 .end = OMAP1610_GPIO2_BASE + SZ_2K - 1, 122 .end = OMAP1610_GPIO2_BASE + SZ_2K - 1,
@@ -128,7 +128,7 @@ static struct __initdata resource omap16xx_gpio2_resources[] = {
128 }, 128 },
129}; 129};
130 130
131static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = { 131static struct omap_gpio_platform_data omap16xx_gpio2_config = {
132 .bank_width = 16, 132 .bank_width = 16,
133 .regs = &omap16xx_gpio_regs, 133 .regs = &omap16xx_gpio_regs,
134}; 134};
@@ -144,7 +144,7 @@ static struct platform_device omap16xx_gpio2 = {
144}; 144};
145 145
146/* gpio3 */ 146/* gpio3 */
147static struct __initdata resource omap16xx_gpio3_resources[] = { 147static struct resource omap16xx_gpio3_resources[] = {
148 { 148 {
149 .start = OMAP1610_GPIO3_BASE, 149 .start = OMAP1610_GPIO3_BASE,
150 .end = OMAP1610_GPIO3_BASE + SZ_2K - 1, 150 .end = OMAP1610_GPIO3_BASE + SZ_2K - 1,
@@ -156,7 +156,7 @@ static struct __initdata resource omap16xx_gpio3_resources[] = {
156 }, 156 },
157}; 157};
158 158
159static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = { 159static struct omap_gpio_platform_data omap16xx_gpio3_config = {
160 .bank_width = 16, 160 .bank_width = 16,
161 .regs = &omap16xx_gpio_regs, 161 .regs = &omap16xx_gpio_regs,
162}; 162};
@@ -172,7 +172,7 @@ static struct platform_device omap16xx_gpio3 = {
172}; 172};
173 173
174/* gpio4 */ 174/* gpio4 */
175static struct __initdata resource omap16xx_gpio4_resources[] = { 175static struct resource omap16xx_gpio4_resources[] = {
176 { 176 {
177 .start = OMAP1610_GPIO4_BASE, 177 .start = OMAP1610_GPIO4_BASE,
178 .end = OMAP1610_GPIO4_BASE + SZ_2K - 1, 178 .end = OMAP1610_GPIO4_BASE + SZ_2K - 1,
@@ -184,7 +184,7 @@ static struct __initdata resource omap16xx_gpio4_resources[] = {
184 }, 184 },
185}; 185};
186 186
187static struct __initdata omap_gpio_platform_data omap16xx_gpio4_config = { 187static struct omap_gpio_platform_data omap16xx_gpio4_config = {
188 .bank_width = 16, 188 .bank_width = 16,
189 .regs = &omap16xx_gpio_regs, 189 .regs = &omap16xx_gpio_regs,
190}; 190};
@@ -199,7 +199,7 @@ static struct platform_device omap16xx_gpio4 = {
199 .resource = omap16xx_gpio4_resources, 199 .resource = omap16xx_gpio4_resources,
200}; 200};
201 201
202static struct __initdata platform_device * omap16xx_gpio_dev[] = { 202static struct platform_device *omap16xx_gpio_dev[] __initdata = {
203 &omap16xx_mpu_gpio, 203 &omap16xx_mpu_gpio,
204 &omap16xx_gpio1, 204 &omap16xx_gpio1,
205 &omap16xx_gpio2, 205 &omap16xx_gpio2,
diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c
index f5819b2b7cbe..4612d2506a2d 100644
--- a/arch/arm/mach-omap1/gpio7xx.c
+++ b/arch/arm/mach-omap1/gpio7xx.c
@@ -30,7 +30,7 @@
30#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE 30#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE
31 31
32/* mpu gpio */ 32/* mpu gpio */
33static struct __initdata resource omap7xx_mpu_gpio_resources[] = { 33static struct resource omap7xx_mpu_gpio_resources[] = {
34 { 34 {
35 .start = OMAP1_MPUIO_VBASE, 35 .start = OMAP1_MPUIO_VBASE,
36 .end = OMAP1_MPUIO_VBASE + SZ_2K - 1, 36 .end = OMAP1_MPUIO_VBASE + SZ_2K - 1,
@@ -53,7 +53,7 @@ static struct omap_gpio_reg_offs omap7xx_mpuio_regs = {
53 .irqctrl = OMAP_MPUIO_GPIO_INT_EDGE >> 1, 53 .irqctrl = OMAP_MPUIO_GPIO_INT_EDGE >> 1,
54}; 54};
55 55
56static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = { 56static struct omap_gpio_platform_data omap7xx_mpu_gpio_config = {
57 .is_mpuio = true, 57 .is_mpuio = true,
58 .bank_width = 16, 58 .bank_width = 16,
59 .bank_stride = 2, 59 .bank_stride = 2,
@@ -71,7 +71,7 @@ static struct platform_device omap7xx_mpu_gpio = {
71}; 71};
72 72
73/* gpio1 */ 73/* gpio1 */
74static struct __initdata resource omap7xx_gpio1_resources[] = { 74static struct resource omap7xx_gpio1_resources[] = {
75 { 75 {
76 .start = OMAP7XX_GPIO1_BASE, 76 .start = OMAP7XX_GPIO1_BASE,
77 .end = OMAP7XX_GPIO1_BASE + SZ_2K - 1, 77 .end = OMAP7XX_GPIO1_BASE + SZ_2K - 1,
@@ -94,7 +94,7 @@ static struct omap_gpio_reg_offs omap7xx_gpio_regs = {
94 .irqctrl = OMAP7XX_GPIO_INT_CONTROL, 94 .irqctrl = OMAP7XX_GPIO_INT_CONTROL,
95}; 95};
96 96
97static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = { 97static struct omap_gpio_platform_data omap7xx_gpio1_config = {
98 .bank_width = 32, 98 .bank_width = 32,
99 .regs = &omap7xx_gpio_regs, 99 .regs = &omap7xx_gpio_regs,
100}; 100};
@@ -110,7 +110,7 @@ static struct platform_device omap7xx_gpio1 = {
110}; 110};
111 111
112/* gpio2 */ 112/* gpio2 */
113static struct __initdata resource omap7xx_gpio2_resources[] = { 113static struct resource omap7xx_gpio2_resources[] = {
114 { 114 {
115 .start = OMAP7XX_GPIO2_BASE, 115 .start = OMAP7XX_GPIO2_BASE,
116 .end = OMAP7XX_GPIO2_BASE + SZ_2K - 1, 116 .end = OMAP7XX_GPIO2_BASE + SZ_2K - 1,
@@ -122,7 +122,7 @@ static struct __initdata resource omap7xx_gpio2_resources[] = {
122 }, 122 },
123}; 123};
124 124
125static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = { 125static struct omap_gpio_platform_data omap7xx_gpio2_config = {
126 .bank_width = 32, 126 .bank_width = 32,
127 .regs = &omap7xx_gpio_regs, 127 .regs = &omap7xx_gpio_regs,
128}; 128};
@@ -138,7 +138,7 @@ static struct platform_device omap7xx_gpio2 = {
138}; 138};
139 139
140/* gpio3 */ 140/* gpio3 */
141static struct __initdata resource omap7xx_gpio3_resources[] = { 141static struct resource omap7xx_gpio3_resources[] = {
142 { 142 {
143 .start = OMAP7XX_GPIO3_BASE, 143 .start = OMAP7XX_GPIO3_BASE,
144 .end = OMAP7XX_GPIO3_BASE + SZ_2K - 1, 144 .end = OMAP7XX_GPIO3_BASE + SZ_2K - 1,
@@ -150,7 +150,7 @@ static struct __initdata resource omap7xx_gpio3_resources[] = {
150 }, 150 },
151}; 151};
152 152
153static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = { 153static struct omap_gpio_platform_data omap7xx_gpio3_config = {
154 .bank_width = 32, 154 .bank_width = 32,
155 .regs = &omap7xx_gpio_regs, 155 .regs = &omap7xx_gpio_regs,
156}; 156};
@@ -166,7 +166,7 @@ static struct platform_device omap7xx_gpio3 = {
166}; 166};
167 167
168/* gpio4 */ 168/* gpio4 */
169static struct __initdata resource omap7xx_gpio4_resources[] = { 169static struct resource omap7xx_gpio4_resources[] = {
170 { 170 {
171 .start = OMAP7XX_GPIO4_BASE, 171 .start = OMAP7XX_GPIO4_BASE,
172 .end = OMAP7XX_GPIO4_BASE + SZ_2K - 1, 172 .end = OMAP7XX_GPIO4_BASE + SZ_2K - 1,
@@ -178,7 +178,7 @@ static struct __initdata resource omap7xx_gpio4_resources[] = {
178 }, 178 },
179}; 179};
180 180
181static struct __initdata omap_gpio_platform_data omap7xx_gpio4_config = { 181static struct omap_gpio_platform_data omap7xx_gpio4_config = {
182 .bank_width = 32, 182 .bank_width = 32,
183 .regs = &omap7xx_gpio_regs, 183 .regs = &omap7xx_gpio_regs,
184}; 184};
@@ -194,7 +194,7 @@ static struct platform_device omap7xx_gpio4 = {
194}; 194};
195 195
196/* gpio5 */ 196/* gpio5 */
197static struct __initdata resource omap7xx_gpio5_resources[] = { 197static struct resource omap7xx_gpio5_resources[] = {
198 { 198 {
199 .start = OMAP7XX_GPIO5_BASE, 199 .start = OMAP7XX_GPIO5_BASE,
200 .end = OMAP7XX_GPIO5_BASE + SZ_2K - 1, 200 .end = OMAP7XX_GPIO5_BASE + SZ_2K - 1,
@@ -206,7 +206,7 @@ static struct __initdata resource omap7xx_gpio5_resources[] = {
206 }, 206 },
207}; 207};
208 208
209static struct __initdata omap_gpio_platform_data omap7xx_gpio5_config = { 209static struct omap_gpio_platform_data omap7xx_gpio5_config = {
210 .bank_width = 32, 210 .bank_width = 32,
211 .regs = &omap7xx_gpio_regs, 211 .regs = &omap7xx_gpio_regs,
212}; 212};
@@ -222,7 +222,7 @@ static struct platform_device omap7xx_gpio5 = {
222}; 222};
223 223
224/* gpio6 */ 224/* gpio6 */
225static struct __initdata resource omap7xx_gpio6_resources[] = { 225static struct resource omap7xx_gpio6_resources[] = {
226 { 226 {
227 .start = OMAP7XX_GPIO6_BASE, 227 .start = OMAP7XX_GPIO6_BASE,
228 .end = OMAP7XX_GPIO6_BASE + SZ_2K - 1, 228 .end = OMAP7XX_GPIO6_BASE + SZ_2K - 1,
@@ -234,7 +234,7 @@ static struct __initdata resource omap7xx_gpio6_resources[] = {
234 }, 234 },
235}; 235};
236 236
237static struct __initdata omap_gpio_platform_data omap7xx_gpio6_config = { 237static struct omap_gpio_platform_data omap7xx_gpio6_config = {
238 .bank_width = 32, 238 .bank_width = 32,
239 .regs = &omap7xx_gpio_regs, 239 .regs = &omap7xx_gpio_regs,
240}; 240};
@@ -249,7 +249,7 @@ static struct platform_device omap7xx_gpio6 = {
249 .resource = omap7xx_gpio6_resources, 249 .resource = omap7xx_gpio6_resources,
250}; 250};
251 251
252static struct __initdata platform_device * omap7xx_gpio_dev[] = { 252static struct platform_device *omap7xx_gpio_dev[] __initdata = {
253 &omap7xx_mpu_gpio, 253 &omap7xx_mpu_gpio,
254 &omap7xx_gpio1, 254 &omap7xx_gpio1,
255 &omap7xx_gpio2, 255 &omap7xx_gpio2,
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 358b82cb9f78..40a1ae319610 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -628,7 +628,6 @@ static irqreturn_t omap_wakeup_interrupt(int irq, void *dev)
628 628
629static struct irqaction omap_wakeup_irq = { 629static struct irqaction omap_wakeup_irq = {
630 .name = "peripheral wakeup", 630 .name = "peripheral wakeup",
631 .flags = IRQF_DISABLED,
632 .handler = omap_wakeup_interrupt 631 .handler = omap_wakeup_interrupt
633}; 632};
634 633
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index 80603d2fef77..6b5f298d6638 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -160,7 +160,7 @@ static irqreturn_t omap_mpu_timer1_interrupt(int irq, void *dev_id)
160 160
161static struct irqaction omap_mpu_timer1_irq = { 161static struct irqaction omap_mpu_timer1_irq = {
162 .name = "mpu_timer1", 162 .name = "mpu_timer1",
163 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 163 .flags = IRQF_TIMER | IRQF_IRQPOLL,
164 .handler = omap_mpu_timer1_interrupt, 164 .handler = omap_mpu_timer1_interrupt,
165}; 165};
166 166
diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c
index 0b74246ba62c..107e7ab3edba 100644
--- a/arch/arm/mach-omap1/timer32k.c
+++ b/arch/arm/mach-omap1/timer32k.c
@@ -156,7 +156,7 @@ static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id)
156 156
157static struct irqaction omap_32k_timer_irq = { 157static struct irqaction omap_32k_timer_irq = {
158 .name = "32KHz timer", 158 .name = "32KHz timer",
159 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 159 .flags = IRQF_TIMER | IRQF_IRQPOLL,
160 .handler = omap_32k_timer_interrupt, 160 .handler = omap_32k_timer_interrupt,
161}; 161};
162 162
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index b5fb5f7992df..dc21df166161 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -8,7 +8,6 @@ config ARCH_OMAP2
8 select CPU_V6 8 select CPU_V6
9 select MULTI_IRQ_HANDLER 9 select MULTI_IRQ_HANDLER
10 select SOC_HAS_OMAP2_SDRC 10 select SOC_HAS_OMAP2_SDRC
11 select COMMON_CLK
12 11
13config ARCH_OMAP3 12config ARCH_OMAP3
14 bool "TI OMAP3" 13 bool "TI OMAP3"
@@ -22,7 +21,6 @@ config ARCH_OMAP3
22 select PM_OPP if PM 21 select PM_OPP if PM
23 select PM_RUNTIME if CPU_IDLE 22 select PM_RUNTIME if CPU_IDLE
24 select SOC_HAS_OMAP2_SDRC 23 select SOC_HAS_OMAP2_SDRC
25 select COMMON_CLK
26 select USB_ARCH_HAS_EHCI if USB_SUPPORT 24 select USB_ARCH_HAS_EHCI if USB_SUPPORT
27 25
28config ARCH_OMAP4 26config ARCH_OMAP4
@@ -45,7 +43,6 @@ config ARCH_OMAP4
45 select PM_OPP if PM 43 select PM_OPP if PM
46 select PM_RUNTIME if CPU_IDLE 44 select PM_RUNTIME if CPU_IDLE
47 select USB_ARCH_HAS_EHCI if USB_SUPPORT 45 select USB_ARCH_HAS_EHCI if USB_SUPPORT
48 select COMMON_CLK
49 select ARM_ERRATA_754322 46 select ARM_ERRATA_754322
50 select ARM_ERRATA_775420 47 select ARM_ERRATA_775420
51 48
@@ -59,7 +56,6 @@ config SOC_OMAP5
59 select HAVE_ARM_SCU if SMP 56 select HAVE_ARM_SCU if SMP
60 select HAVE_ARM_TWD if LOCAL_TIMERS 57 select HAVE_ARM_TWD if LOCAL_TIMERS
61 select HAVE_SMP 58 select HAVE_SMP
62 select COMMON_CLK
63 select HAVE_ARM_ARCH_TIMER 59 select HAVE_ARM_ARCH_TIMER
64 select ARM_ERRATA_798181 if SMP 60 select ARM_ERRATA_798181 if SMP
65 61
@@ -70,7 +66,6 @@ config SOC_AM33XX
70 select ARM_CPU_SUSPEND if PM 66 select ARM_CPU_SUSPEND if PM
71 select CPU_V7 67 select CPU_V7
72 select MULTI_IRQ_HANDLER 68 select MULTI_IRQ_HANDLER
73 select COMMON_CLK
74 69
75config SOC_AM43XX 70config SOC_AM43XX
76 bool "TI AM43x" 71 bool "TI AM43x"
@@ -79,7 +74,6 @@ config SOC_AM43XX
79 select ARCH_OMAP2PLUS 74 select ARCH_OMAP2PLUS
80 select MULTI_IRQ_HANDLER 75 select MULTI_IRQ_HANDLER
81 select ARM_GIC 76 select ARM_GIC
82 select COMMON_CLK
83 select MACH_OMAP_GENERIC 77 select MACH_OMAP_GENERIC
84 78
85config ARCH_OMAP2PLUS 79config ARCH_OMAP2PLUS
@@ -89,11 +83,11 @@ config ARCH_OMAP2PLUS
89 select ARCH_HAS_HOLES_MEMORYMODEL 83 select ARCH_HAS_HOLES_MEMORYMODEL
90 select ARCH_OMAP 84 select ARCH_OMAP
91 select ARCH_REQUIRE_GPIOLIB 85 select ARCH_REQUIRE_GPIOLIB
92 select CLKDEV_LOOKUP
93 select CLKSRC_MMIO 86 select CLKSRC_MMIO
87 select COMMON_CLK
94 select GENERIC_CLOCKEVENTS 88 select GENERIC_CLOCKEVENTS
95 select GENERIC_IRQ_CHIP 89 select GENERIC_IRQ_CHIP
96 select HAVE_CLK 90 select MACH_OMAP_GENERIC
97 select OMAP_DM_TIMER 91 select OMAP_DM_TIMER
98 select PINCTRL 92 select PINCTRL
99 select PROC_DEVICETREE if PROC_FS 93 select PROC_DEVICETREE if PROC_FS
@@ -187,16 +181,11 @@ config OMAP_PACKAGE_CUS
187config OMAP_PACKAGE_CBP 181config OMAP_PACKAGE_CBP
188 bool 182 bool
189 183
190comment "OMAP Board Type" 184comment "OMAP Legacy Platform Data Board Type"
191 depends on ARCH_OMAP2PLUS 185 depends on ARCH_OMAP2PLUS
192 186
193config MACH_OMAP_GENERIC 187config MACH_OMAP_GENERIC
194 bool "Generic OMAP2+ board" 188 bool
195 depends on ARCH_OMAP2PLUS
196 default y
197 help
198 Support for generic TI OMAP2+ boards using Flattened Device Tree.
199 More information at Documentation/devicetree
200 189
201config MACH_OMAP2_TUSB6010 190config MACH_OMAP2_TUSB6010
202 bool 191 bool
@@ -260,12 +249,6 @@ config MACH_OVERO
260 default y 249 default y
261 select OMAP_PACKAGE_CBB 250 select OMAP_PACKAGE_CBB
262 251
263config MACH_OMAP3EVM
264 bool "OMAP 3530 EVM board"
265 depends on ARCH_OMAP3
266 default y
267 select OMAP_PACKAGE_CBB
268
269config MACH_OMAP3517EVM 252config MACH_OMAP3517EVM
270 bool "OMAP3517/ AM3517 EVM board" 253 bool "OMAP3517/ AM3517 EVM board"
271 depends on ARCH_OMAP3 254 depends on ARCH_OMAP3
@@ -314,33 +297,12 @@ config MACH_NOKIA_N8X0
314 select MACH_NOKIA_N810_WIMAX 297 select MACH_NOKIA_N810_WIMAX
315 select OMAP_PACKAGE_ZAC 298 select OMAP_PACKAGE_ZAC
316 299
317config MACH_NOKIA_RM680
318 bool "Nokia N950 (RM-680) / N9 (RM-696) phones"
319 depends on ARCH_OMAP3
320 default y
321 select MACH_NOKIA_RM696
322 select OMAP_PACKAGE_CBB
323
324config MACH_NOKIA_RX51 300config MACH_NOKIA_RX51
325 bool "Nokia N900 (RX-51) phone" 301 bool "Nokia N900 (RX-51) phone"
326 depends on ARCH_OMAP3 302 depends on ARCH_OMAP3
327 default y 303 default y
328 select OMAP_PACKAGE_CBB 304 select OMAP_PACKAGE_CBB
329 305
330config MACH_OMAP_ZOOM2
331 bool "OMAP3 Zoom2 board"
332 depends on ARCH_OMAP3
333 default y
334 select OMAP_PACKAGE_CBB
335 select REGULATOR_FIXED_VOLTAGE if REGULATOR
336
337config MACH_OMAP_ZOOM3
338 bool "OMAP3630 Zoom3 board"
339 depends on ARCH_OMAP3
340 default y
341 select OMAP_PACKAGE_CBP
342 select REGULATOR_FIXED_VOLTAGE if REGULATOR
343
344config MACH_CM_T35 306config MACH_CM_T35
345 bool "CompuLab CM-T35/CM-T3730 modules" 307 bool "CompuLab CM-T35/CM-T3730 modules"
346 depends on ARCH_OMAP3 308 depends on ARCH_OMAP3
@@ -357,31 +319,12 @@ config MACH_CM_T3517
357config MACH_CM_T3730 319config MACH_CM_T3730
358 bool 320 bool
359 321
360config MACH_IGEP0020
361 bool "IGEP v2 board"
362 depends on ARCH_OMAP3
363 default y
364 select OMAP_PACKAGE_CBB
365
366config MACH_IGEP0030
367 bool "IGEP OMAP3 module"
368 depends on ARCH_OMAP3
369 default y
370 select MACH_IGEP0020
371 select OMAP_PACKAGE_CBB
372
373config MACH_SBC3530 322config MACH_SBC3530
374 bool "OMAP3 SBC STALKER board" 323 bool "OMAP3 SBC STALKER board"
375 depends on ARCH_OMAP3 324 depends on ARCH_OMAP3
376 default y 325 default y
377 select OMAP_PACKAGE_CUS 326 select OMAP_PACKAGE_CUS
378 327
379config MACH_OMAP_3630SDP
380 bool "OMAP3630 SDP board"
381 depends on ARCH_OMAP3
382 default y
383 select OMAP_PACKAGE_CBP
384
385config MACH_TI8168EVM 328config MACH_TI8168EVM
386 bool "TI8168 Evaluation Module" 329 bool "TI8168 Evaluation Module"
387 depends on SOC_TI81XX 330 depends on SOC_TI81XX
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index afb457c3135b..e15ac005ef17 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -8,7 +8,7 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
8# Common support 8# Common support
9obj-y := id.o io.o control.o mux.o devices.o fb.o serial.o gpmc.o timer.o pm.o \ 9obj-y := id.o io.o control.o mux.o devices.o fb.o serial.o gpmc.o timer.o pm.o \
10 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \ 10 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
11 omap_device.o sram.o 11 omap_device.o sram.o drm.o
12 12
13omap-2-3-common = irq.o 13omap-2-3-common = irq.o
14hwmod-common = omap_hwmod.o omap_hwmod_reset.o \ 14hwmod-common = omap_hwmod.o omap_hwmod_reset.o \
@@ -112,13 +112,13 @@ obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o
112obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o 112obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o
113obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o 113obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o
114obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o 114obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o
115obj-$(CONFIG_SOC_AM43XX) += prm33xx.o cm33xx.o
116omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \ 115omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \
117 prcm_mpu44xx.o prminst44xx.o \ 116 prcm_mpu44xx.o prminst44xx.o \
118 vc44xx_data.o vp44xx_data.o 117 vc44xx_data.o vp44xx_data.o
119obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common) 118obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common)
120obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common) 119obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common)
121obj-$(CONFIG_SOC_DRA7XX) += $(omap-prcm-4-5-common) 120obj-$(CONFIG_SOC_DRA7XX) += $(omap-prcm-4-5-common)
121obj-$(CONFIG_SOC_AM43XX) += $(omap-prcm-4-5-common)
122 122
123# OMAP voltage domains 123# OMAP voltage domains
124voltagedomain-common := voltage.o vc.o vp.o 124voltagedomain-common := voltage.o vc.o vp.o
@@ -146,6 +146,7 @@ obj-$(CONFIG_ARCH_OMAP4) += powerdomains44xx_data.o
146obj-$(CONFIG_SOC_AM33XX) += $(powerdomain-common) 146obj-$(CONFIG_SOC_AM33XX) += $(powerdomain-common)
147obj-$(CONFIG_SOC_AM33XX) += powerdomains33xx_data.o 147obj-$(CONFIG_SOC_AM33XX) += powerdomains33xx_data.o
148obj-$(CONFIG_SOC_AM43XX) += $(powerdomain-common) 148obj-$(CONFIG_SOC_AM43XX) += $(powerdomain-common)
149obj-$(CONFIG_SOC_AM43XX) += powerdomains43xx_data.o
149obj-$(CONFIG_SOC_OMAP5) += $(powerdomain-common) 150obj-$(CONFIG_SOC_OMAP5) += $(powerdomain-common)
150obj-$(CONFIG_SOC_OMAP5) += powerdomains54xx_data.o 151obj-$(CONFIG_SOC_OMAP5) += powerdomains54xx_data.o
151obj-$(CONFIG_SOC_DRA7XX) += $(powerdomain-common) 152obj-$(CONFIG_SOC_DRA7XX) += $(powerdomain-common)
@@ -165,6 +166,7 @@ obj-$(CONFIG_ARCH_OMAP4) += clockdomains44xx_data.o
165obj-$(CONFIG_SOC_AM33XX) += $(clockdomain-common) 166obj-$(CONFIG_SOC_AM33XX) += $(clockdomain-common)
166obj-$(CONFIG_SOC_AM33XX) += clockdomains33xx_data.o 167obj-$(CONFIG_SOC_AM33XX) += clockdomains33xx_data.o
167obj-$(CONFIG_SOC_AM43XX) += $(clockdomain-common) 168obj-$(CONFIG_SOC_AM43XX) += $(clockdomain-common)
169obj-$(CONFIG_SOC_AM43XX) += clockdomains43xx_data.o
168obj-$(CONFIG_SOC_OMAP5) += $(clockdomain-common) 170obj-$(CONFIG_SOC_OMAP5) += $(clockdomain-common)
169obj-$(CONFIG_SOC_OMAP5) += clockdomains54xx_data.o 171obj-$(CONFIG_SOC_OMAP5) += clockdomains54xx_data.o
170obj-$(CONFIG_SOC_DRA7XX) += $(clockdomain-common) 172obj-$(CONFIG_SOC_DRA7XX) += $(clockdomain-common)
@@ -210,6 +212,11 @@ obj-$(CONFIG_ARCH_OMAP3) += omap_hwmod_2xxx_3xxx_ipblock_data.o
210obj-$(CONFIG_ARCH_OMAP3) += omap_hwmod_2xxx_3xxx_interconnect_data.o 212obj-$(CONFIG_ARCH_OMAP3) += omap_hwmod_2xxx_3xxx_interconnect_data.o
211obj-$(CONFIG_ARCH_OMAP3) += omap_hwmod_3xxx_data.o 213obj-$(CONFIG_ARCH_OMAP3) += omap_hwmod_3xxx_data.o
212obj-$(CONFIG_SOC_AM33XX) += omap_hwmod_33xx_data.o 214obj-$(CONFIG_SOC_AM33XX) += omap_hwmod_33xx_data.o
215obj-$(CONFIG_SOC_AM33XX) += omap_hwmod_33xx_43xx_interconnect_data.o
216obj-$(CONFIG_SOC_AM33XX) += omap_hwmod_33xx_43xx_ipblock_data.o
217obj-$(CONFIG_SOC_AM43XX) += omap_hwmod_43xx_data.o
218obj-$(CONFIG_SOC_AM43XX) += omap_hwmod_33xx_43xx_interconnect_data.o
219obj-$(CONFIG_SOC_AM43XX) += omap_hwmod_33xx_43xx_ipblock_data.o
213obj-$(CONFIG_ARCH_OMAP4) += omap_hwmod_44xx_data.o 220obj-$(CONFIG_ARCH_OMAP4) += omap_hwmod_44xx_data.o
214obj-$(CONFIG_SOC_OMAP5) += omap_hwmod_54xx_data.o 221obj-$(CONFIG_SOC_OMAP5) += omap_hwmod_54xx_data.o
215obj-$(CONFIG_SOC_DRA7XX) += omap_hwmod_7xx_data.o 222obj-$(CONFIG_SOC_DRA7XX) += omap_hwmod_7xx_data.o
@@ -228,12 +235,8 @@ endif
228# OMAP2420 MSDI controller integration support ("MMC") 235# OMAP2420 MSDI controller integration support ("MMC")
229obj-$(CONFIG_SOC_OMAP2420) += msdi.o 236obj-$(CONFIG_SOC_OMAP2420) += msdi.o
230 237
231ifneq ($(CONFIG_DRM_OMAP),)
232obj-y += drm.o
233endif
234
235# Specific board support 238# Specific board support
236obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o 239obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o pdata-quirks.o
237obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o 240obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
238obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o 241obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o
239obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o 242obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o
@@ -242,26 +245,14 @@ obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o
242obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o 245obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o
243obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o 246obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o
244obj-$(CONFIG_MACH_OVERO) += board-overo.o 247obj-$(CONFIG_MACH_OVERO) += board-overo.o
245obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o
246obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o 248obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o
247obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o 249obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o
248obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o 250obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o
249obj-$(CONFIG_MACH_NOKIA_RM680) += board-rm680.o sdram-nokia.o
250obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o sdram-nokia.o 251obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o sdram-nokia.o
251obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51-peripherals.o 252obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51-peripherals.o
252obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51-video.o 253obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51-video.o
253obj-$(CONFIG_MACH_OMAP_ZOOM2) += board-zoom.o board-zoom-peripherals.o
254obj-$(CONFIG_MACH_OMAP_ZOOM2) += board-zoom-display.o
255obj-$(CONFIG_MACH_OMAP_ZOOM2) += board-zoom-debugboard.o
256obj-$(CONFIG_MACH_OMAP_ZOOM3) += board-zoom.o board-zoom-peripherals.o
257obj-$(CONFIG_MACH_OMAP_ZOOM3) += board-zoom-display.o
258obj-$(CONFIG_MACH_OMAP_ZOOM3) += board-zoom-debugboard.o
259obj-$(CONFIG_MACH_OMAP_3630SDP) += board-3630sdp.o
260obj-$(CONFIG_MACH_OMAP_3630SDP) += board-zoom-peripherals.o
261obj-$(CONFIG_MACH_OMAP_3630SDP) += board-zoom-display.o
262obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o 254obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o
263obj-$(CONFIG_MACH_CM_T3517) += board-cm-t3517.o 255obj-$(CONFIG_MACH_CM_T3517) += board-cm-t3517.o
264obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o
265obj-$(CONFIG_MACH_TOUCHBOOK) += board-omap3touchbook.o 256obj-$(CONFIG_MACH_TOUCHBOOK) += board-omap3touchbook.o
266 257
267obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o 258obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c
deleted file mode 100644
index 20d6d8189240..000000000000
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ /dev/null
@@ -1,225 +0,0 @@
1/*
2 * Copyright (C) 2009 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#include <linux/kernel.h>
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/input.h>
13#include <linux/gpio.h>
14#include <linux/mtd/nand.h>
15
16#include <asm/mach-types.h>
17#include <asm/mach/arch.h>
18
19#include "common.h"
20#include "gpmc-smc91x.h"
21
22#include "board-zoom.h"
23
24#include "board-flash.h"
25#include "mux.h"
26#include "sdram-hynix-h8mbx00u0mer-0em.h"
27
28#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
29
30static struct omap_smc91x_platform_data board_smc91x_data = {
31 .cs = 3,
32 .flags = GPMC_MUX_ADD_DATA | IORESOURCE_IRQ_LOWLEVEL,
33};
34
35static void __init board_smc91x_init(void)
36{
37 board_smc91x_data.gpio_irq = 158;
38 gpmc_smc91x_init(&board_smc91x_data);
39}
40
41#else
42
43static inline void board_smc91x_init(void)
44{
45}
46
47#endif /* defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) */
48
49static void enable_board_wakeup_source(void)
50{
51 /* T2 interrupt line (keypad) */
52 omap_mux_init_signal("sys_nirq",
53 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
54}
55
56static struct usbhs_phy_data phy_data[] __initdata = {
57 {
58 .port = 1,
59 .reset_gpio = 126,
60 .vcc_gpio = -EINVAL,
61 },
62 {
63 .port = 2,
64 .reset_gpio = 61,
65 .vcc_gpio = -EINVAL,
66 },
67};
68
69static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
70
71 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
72 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
73};
74
75#ifdef CONFIG_OMAP_MUX
76static struct omap_board_mux board_mux[] __initdata = {
77 { .reg_offset = OMAP_MUX_TERMINATOR },
78};
79#endif
80
81/*
82 * SDP3630 CS organization
83 * See also the Switch S8 settings in the comments.
84 */
85static char chip_sel_sdp[][GPMC_CS_NUM] = {
86 {PDC_NOR, PDC_NAND, PDC_ONENAND, DBG_MPDB, 0, 0, 0, 0}, /* S8:1111 */
87 {PDC_ONENAND, PDC_NAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1110 */
88 {PDC_NAND, PDC_ONENAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1101 */
89};
90
91static struct mtd_partition sdp_nor_partitions[] = {
92 /* bootloader (U-Boot, etc) in first sector */
93 {
94 .name = "Bootloader-NOR",
95 .offset = 0,
96 .size = SZ_256K,
97 .mask_flags = MTD_WRITEABLE, /* force read-only */
98 },
99 /* bootloader params in the next sector */
100 {
101 .name = "Params-NOR",
102 .offset = MTDPART_OFS_APPEND,
103 .size = SZ_256K,
104 .mask_flags = 0,
105 },
106 /* kernel */
107 {
108 .name = "Kernel-NOR",
109 .offset = MTDPART_OFS_APPEND,
110 .size = SZ_2M,
111 .mask_flags = 0
112 },
113 /* file system */
114 {
115 .name = "Filesystem-NOR",
116 .offset = MTDPART_OFS_APPEND,
117 .size = MTDPART_SIZ_FULL,
118 .mask_flags = 0
119 }
120};
121
122static struct mtd_partition sdp_onenand_partitions[] = {
123 {
124 .name = "X-Loader-OneNAND",
125 .offset = 0,
126 .size = 4 * (64 * 2048),
127 .mask_flags = MTD_WRITEABLE /* force read-only */
128 },
129 {
130 .name = "U-Boot-OneNAND",
131 .offset = MTDPART_OFS_APPEND,
132 .size = 2 * (64 * 2048),
133 .mask_flags = MTD_WRITEABLE /* force read-only */
134 },
135 {
136 .name = "U-Boot Environment-OneNAND",
137 .offset = MTDPART_OFS_APPEND,
138 .size = 1 * (64 * 2048),
139 },
140 {
141 .name = "Kernel-OneNAND",
142 .offset = MTDPART_OFS_APPEND,
143 .size = 16 * (64 * 2048),
144 },
145 {
146 .name = "File System-OneNAND",
147 .offset = MTDPART_OFS_APPEND,
148 .size = MTDPART_SIZ_FULL,
149 },
150};
151
152static struct mtd_partition sdp_nand_partitions[] = {
153 /* All the partition sizes are listed in terms of NAND block size */
154 {
155 .name = "X-Loader-NAND",
156 .offset = 0,
157 .size = 4 * (64 * 2048),
158 .mask_flags = MTD_WRITEABLE, /* force read-only */
159 },
160 {
161 .name = "U-Boot-NAND",
162 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
163 .size = 10 * (64 * 2048),
164 .mask_flags = MTD_WRITEABLE, /* force read-only */
165 },
166 {
167 .name = "Boot Env-NAND",
168
169 .offset = MTDPART_OFS_APPEND, /* Offset = 0x1c0000 */
170 .size = 6 * (64 * 2048),
171 },
172 {
173 .name = "Kernel-NAND",
174 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
175 .size = 40 * (64 * 2048),
176 },
177 {
178 .name = "File System - NAND",
179 .size = MTDPART_SIZ_FULL,
180 .offset = MTDPART_OFS_APPEND, /* Offset = 0x780000 */
181 },
182};
183
184static struct flash_partitions sdp_flash_partitions[] = {
185 {
186 .parts = sdp_nor_partitions,
187 .nr_parts = ARRAY_SIZE(sdp_nor_partitions),
188 },
189 {
190 .parts = sdp_onenand_partitions,
191 .nr_parts = ARRAY_SIZE(sdp_onenand_partitions),
192 },
193 {
194 .parts = sdp_nand_partitions,
195 .nr_parts = ARRAY_SIZE(sdp_nand_partitions),
196 },
197};
198
199static void __init omap_sdp_init(void)
200{
201 omap3_mux_init(board_mux, OMAP_PACKAGE_CBP);
202 zoom_peripherals_init();
203 omap_sdrc_init(h8mbx00u0mer0em_sdrc_params,
204 h8mbx00u0mer0em_sdrc_params);
205 zoom_display_init();
206 board_smc91x_init();
207 board_flash_init(sdp_flash_partitions, chip_sel_sdp, NAND_BUSWIDTH_16);
208 enable_board_wakeup_source();
209
210 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
211 usbhs_init(&usbhs_bdata);
212}
213
214MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
215 .atag_offset = 0x100,
216 .reserve = omap_reserve,
217 .map_io = omap3_map_io,
218 .init_early = omap3630_init_early,
219 .init_irq = omap3_init_irq,
220 .handle_irq = omap3_intc_handle_irq,
221 .init_machine = omap_sdp_init,
222 .init_late = omap3630_init_late,
223 .init_time = omap3_sync32k_timer_init,
224 .restart = omap3xxx_restart,
225MACHINE_END
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index fc20a61f6b2a..ac82512b9c8c 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -142,7 +142,7 @@ __init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs,
142 board_nand_data.nr_parts = nr_parts; 142 board_nand_data.nr_parts = nr_parts;
143 board_nand_data.devsize = nand_type; 143 board_nand_data.devsize = nand_type;
144 144
145 board_nand_data.ecc_opt = OMAP_ECC_HAMMING_CODE_DEFAULT; 145 board_nand_data.ecc_opt = OMAP_ECC_BCH8_CODE_HW;
146 gpmc_nand_init(&board_nand_data, gpmc_t); 146 gpmc_nand_init(&board_nand_data, gpmc_t);
147} 147}
148#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ 148#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 39c78387ddec..19f1652e94cf 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -15,13 +15,10 @@
15#include <linux/of_irq.h> 15#include <linux/of_irq.h>
16#include <linux/of_platform.h> 16#include <linux/of_platform.h>
17#include <linux/irqdomain.h> 17#include <linux/irqdomain.h>
18#include <linux/clk.h>
19 18
20#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
21 20
22#include "common.h" 21#include "common.h"
23#include "common-board-devices.h"
24#include "dss-common.h"
25 22
26#if !(defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)) 23#if !(defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3))
27#define intc_of_init NULL 24#define intc_of_init NULL
@@ -36,40 +33,9 @@ static struct of_device_id omap_dt_match_table[] __initdata = {
36 { } 33 { }
37}; 34};
38 35
39/*
40 * Create alias for USB host PHY clock.
41 * Remove this when clock phandle can be provided via DT
42 */
43static void __init legacy_init_ehci_clk(char *clkname)
44{
45 int ret;
46
47 ret = clk_add_alias("main_clk", NULL, clkname, NULL);
48 if (ret) {
49 pr_err("%s:Failed to add main_clk alias to %s :%d\n",
50 __func__, clkname, ret);
51 }
52}
53
54static void __init omap_generic_init(void) 36static void __init omap_generic_init(void)
55{ 37{
56 omap_sdrc_init(NULL, NULL); 38 pdata_quirks_init(omap_dt_match_table);
57
58 of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
59
60 /*
61 * HACK: call display setup code for selected boards to enable omapdss.
62 * This will be removed when omapdss supports DT.
63 */
64 if (of_machine_is_compatible("ti,omap4-panda")) {
65 omap4_panda_display_init_of();
66 legacy_init_ehci_clk("auxclk3_ck");
67
68 }
69 else if (of_machine_is_compatible("ti,omap4-sdp"))
70 omap_4430sdp_display_init_of();
71 else if (of_machine_is_compatible("ti,omap5-uevm"))
72 legacy_init_ehci_clk("auxclk1_ck");
73} 39}
74 40
75#ifdef CONFIG_SOC_OMAP2420 41#ifdef CONFIG_SOC_OMAP2420
@@ -129,6 +95,24 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
129 .restart = omap3xxx_restart, 95 .restart = omap3xxx_restart,
130MACHINE_END 96MACHINE_END
131 97
98static const char *omap36xx_boards_compat[] __initdata = {
99 "ti,omap36xx",
100 NULL,
101};
102
103DT_MACHINE_START(OMAP36XX_DT, "Generic OMAP36xx (Flattened Device Tree)")
104 .reserve = omap_reserve,
105 .map_io = omap3_map_io,
106 .init_early = omap3630_init_early,
107 .init_irq = omap_intc_of_init,
108 .handle_irq = omap3_intc_handle_irq,
109 .init_machine = omap_generic_init,
110 .init_late = omap3_init_late,
111 .init_time = omap3_sync32k_timer_init,
112 .dt_compat = omap36xx_boards_compat,
113 .restart = omap3xxx_restart,
114MACHINE_END
115
132static const char *omap3_gp_boards_compat[] __initdata = { 116static const char *omap3_gp_boards_compat[] __initdata = {
133 "ti,omap3-beagle", 117 "ti,omap3-beagle",
134 "timll,omap3-devkit8000", 118 "timll,omap3-devkit8000",
@@ -162,6 +146,7 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
162 .init_irq = omap_intc_of_init, 146 .init_irq = omap_intc_of_init,
163 .handle_irq = omap3_intc_handle_irq, 147 .handle_irq = omap3_intc_handle_irq,
164 .init_machine = omap_generic_init, 148 .init_machine = omap_generic_init,
149 .init_late = am33xx_init_late,
165 .init_time = omap3_gptimer_timer_init, 150 .init_time = omap3_gptimer_timer_init,
166 .dt_compat = am33xx_boards_compat, 151 .dt_compat = am33xx_boards_compat,
167 .restart = am33xx_restart, 152 .restart = am33xx_restart,
@@ -201,6 +186,7 @@ DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
201 .init_early = omap5_init_early, 186 .init_early = omap5_init_early,
202 .init_irq = omap_gic_of_init, 187 .init_irq = omap_gic_of_init,
203 .init_machine = omap_generic_init, 188 .init_machine = omap_generic_init,
189 .init_late = omap5_init_late,
204 .init_time = omap5_realtime_timer_init, 190 .init_time = omap5_realtime_timer_init,
205 .dt_compat = omap5_boards_compat, 191 .dt_compat = omap5_boards_compat,
206 .restart = omap44xx_restart, 192 .restart = omap44xx_restart,
@@ -216,6 +202,7 @@ static const char *am43_boards_compat[] __initdata = {
216DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)") 202DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
217 .map_io = am33xx_map_io, 203 .map_io = am33xx_map_io,
218 .init_early = am43xx_init_early, 204 .init_early = am43xx_init_early,
205 .init_late = am43xx_init_late,
219 .init_irq = omap_gic_of_init, 206 .init_irq = omap_gic_of_init,
220 .init_machine = omap_generic_init, 207 .init_machine = omap_generic_init,
221 .init_time = omap3_sync32k_timer_init, 208 .init_time = omap3_sync32k_timer_init,
@@ -234,6 +221,7 @@ DT_MACHINE_START(DRA7XX_DT, "Generic DRA7XX (Flattened Device Tree)")
234 .smp = smp_ops(omap4_smp_ops), 221 .smp = smp_ops(omap4_smp_ops),
235 .map_io = omap5_map_io, 222 .map_io = omap5_map_io,
236 .init_early = dra7xx_init_early, 223 .init_early = dra7xx_init_early,
224 .init_late = dra7xx_init_late,
237 .init_irq = omap_gic_of_init, 225 .init_irq = omap_gic_of_init,
238 .init_machine = omap_generic_init, 226 .init_machine = omap_generic_init,
239 .init_time = omap5_realtime_timer_init, 227 .init_time = omap5_realtime_timer_init,
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
deleted file mode 100644
index 06dbb2d3d38b..000000000000
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ /dev/null
@@ -1,718 +0,0 @@
1/*
2 * Copyright (C) 2009 Integration Software and Electronic Engineering.
3 *
4 * Modified from mach-omap2/board-generic.c
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/delay.h>
15#include <linux/err.h>
16#include <linux/clk.h>
17#include <linux/io.h>
18#include <linux/gpio.h>
19#include <linux/interrupt.h>
20#include <linux/input.h>
21#include <linux/usb/phy.h>
22
23#include <linux/regulator/machine.h>
24#include <linux/regulator/fixed.h>
25#include <linux/i2c/twl.h>
26#include <linux/mmc/host.h>
27
28#include <linux/mtd/nand.h>
29
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32
33#include <video/omapdss.h>
34#include <video/omap-panel-data.h>
35#include <linux/platform_data/mtd-onenand-omap2.h>
36
37#include "common.h"
38#include "gpmc.h"
39#include "mux.h"
40#include "hsmmc.h"
41#include "sdram-numonyx-m65kxxxxam.h"
42#include "common-board-devices.h"
43#include "board-flash.h"
44#include "control.h"
45#include "gpmc-onenand.h"
46
47#define IGEP2_SMSC911X_CS 5
48#define IGEP2_SMSC911X_GPIO 176
49#define IGEP2_GPIO_USBH_NRESET 24
50#define IGEP2_GPIO_LED0_GREEN 26
51#define IGEP2_GPIO_LED0_RED 27
52#define IGEP2_GPIO_LED1_RED 28
53#define IGEP2_GPIO_DVI_PUP 170
54
55#define IGEP2_RB_GPIO_WIFI_NPD 94
56#define IGEP2_RB_GPIO_WIFI_NRESET 95
57#define IGEP2_RB_GPIO_BT_NRESET 137
58#define IGEP2_RC_GPIO_WIFI_NPD 138
59#define IGEP2_RC_GPIO_WIFI_NRESET 139
60#define IGEP2_RC_GPIO_BT_NRESET 137
61
62#define IGEP3_GPIO_LED0_GREEN 54
63#define IGEP3_GPIO_LED0_RED 53
64#define IGEP3_GPIO_LED1_RED 16
65#define IGEP3_GPIO_USBH_NRESET 183
66
67#define IGEP_SYSBOOT_MASK 0x1f
68#define IGEP_SYSBOOT_NAND 0x0f
69#define IGEP_SYSBOOT_ONENAND 0x10
70
71/*
72 * IGEP2 Hardware Revision Table
73 *
74 * --------------------------------------------------------------------------
75 * | Id. | Hw Rev. | HW0 (28) | WIFI_NPD | WIFI_NRESET | BT_NRESET |
76 * --------------------------------------------------------------------------
77 * | 0 | B | high | gpio94 | gpio95 | - |
78 * | 0 | B/C (B-compatible) | high | gpio94 | gpio95 | gpio137 |
79 * | 1 | C | low | gpio138 | gpio139 | gpio137 |
80 * --------------------------------------------------------------------------
81 */
82
83#define IGEP2_BOARD_HWREV_B 0
84#define IGEP2_BOARD_HWREV_C 1
85#define IGEP3_BOARD_HWREV 2
86
87static u8 hwrev;
88
89static void __init igep2_get_revision(void)
90{
91 u8 ret;
92
93 if (machine_is_igep0030()) {
94 hwrev = IGEP3_BOARD_HWREV;
95 return;
96 }
97
98 omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT);
99
100 if (gpio_request_one(IGEP2_GPIO_LED1_RED, GPIOF_IN, "GPIO_HW0_REV")) {
101 pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n");
102 pr_err("IGEP2: Unknown Hardware Revision\n");
103 return;
104 }
105
106 ret = gpio_get_value(IGEP2_GPIO_LED1_RED);
107 if (ret == 0) {
108 pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n");
109 hwrev = IGEP2_BOARD_HWREV_C;
110 } else if (ret == 1) {
111 pr_info("IGEP2: Hardware Revision B/C (B compatible)\n");
112 hwrev = IGEP2_BOARD_HWREV_B;
113 } else {
114 pr_err("IGEP2: Unknown Hardware Revision\n");
115 hwrev = -1;
116 }
117
118 gpio_free(IGEP2_GPIO_LED1_RED);
119}
120
121#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
122 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) || \
123 defined(CONFIG_MTD_NAND_OMAP2) || \
124 defined(CONFIG_MTD_NAND_OMAP2_MODULE)
125
126#define ONENAND_MAP 0x20000000
127
128/* NAND04GR4E1A ( x2 Flash built-in COMBO POP MEMORY )
129 * Since the device is equipped with two DataRAMs, and two-plane NAND
130 * Flash memory array, these two component enables simultaneous program
131 * of 4KiB. Plane1 has only even blocks such as block0, block2, block4
132 * while Plane2 has only odd blocks such as block1, block3, block5.
133 * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048)
134 */
135
136static struct mtd_partition igep_flash_partitions[] = {
137 {
138 .name = "X-Loader",
139 .offset = 0,
140 .size = 2 * (64*(2*2048))
141 },
142 {
143 .name = "U-Boot",
144 .offset = MTDPART_OFS_APPEND,
145 .size = 6 * (64*(2*2048)),
146 },
147 {
148 .name = "Environment",
149 .offset = MTDPART_OFS_APPEND,
150 .size = 2 * (64*(2*2048)),
151 },
152 {
153 .name = "Kernel",
154 .offset = MTDPART_OFS_APPEND,
155 .size = 12 * (64*(2*2048)),
156 },
157 {
158 .name = "File System",
159 .offset = MTDPART_OFS_APPEND,
160 .size = MTDPART_SIZ_FULL,
161 },
162};
163
164static inline u32 igep_get_sysboot_value(void)
165{
166 return omap_ctrl_readl(OMAP343X_CONTROL_STATUS) & IGEP_SYSBOOT_MASK;
167}
168
169static void __init igep_flash_init(void)
170{
171 u32 mux;
172 mux = igep_get_sysboot_value();
173
174 if (mux == IGEP_SYSBOOT_NAND) {
175 pr_info("IGEP: initializing NAND memory device\n");
176 board_nand_init(igep_flash_partitions,
177 ARRAY_SIZE(igep_flash_partitions),
178 0, NAND_BUSWIDTH_16, nand_default_timings);
179 } else if (mux == IGEP_SYSBOOT_ONENAND) {
180 pr_info("IGEP: initializing OneNAND memory device\n");
181 board_onenand_init(igep_flash_partitions,
182 ARRAY_SIZE(igep_flash_partitions), 0);
183 } else {
184 pr_err("IGEP: Flash: unsupported sysboot sequence found\n");
185 }
186}
187
188#else
189static void __init igep_flash_init(void) {}
190#endif
191
192#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
193
194#include <linux/smsc911x.h>
195#include "gpmc-smsc911x.h"
196
197static struct omap_smsc911x_platform_data smsc911x_cfg = {
198 .cs = IGEP2_SMSC911X_CS,
199 .gpio_irq = IGEP2_SMSC911X_GPIO,
200 .gpio_reset = -EINVAL,
201 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
202};
203
204static inline void __init igep2_init_smsc911x(void)
205{
206 gpmc_smsc911x_init(&smsc911x_cfg);
207}
208
209#else
210static inline void __init igep2_init_smsc911x(void) { }
211#endif
212
213static struct regulator_consumer_supply igep_vmmc1_supply[] = {
214 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
215};
216
217/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
218static struct regulator_init_data igep_vmmc1 = {
219 .constraints = {
220 .min_uV = 1850000,
221 .max_uV = 3150000,
222 .valid_modes_mask = REGULATOR_MODE_NORMAL
223 | REGULATOR_MODE_STANDBY,
224 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
225 | REGULATOR_CHANGE_MODE
226 | REGULATOR_CHANGE_STATUS,
227 },
228 .num_consumer_supplies = ARRAY_SIZE(igep_vmmc1_supply),
229 .consumer_supplies = igep_vmmc1_supply,
230};
231
232static struct regulator_consumer_supply igep_vio_supply[] = {
233 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1"),
234};
235
236static struct regulator_init_data igep_vio = {
237 .constraints = {
238 .min_uV = 1800000,
239 .max_uV = 1800000,
240 .apply_uV = 1,
241 .valid_modes_mask = REGULATOR_MODE_NORMAL
242 | REGULATOR_MODE_STANDBY,
243 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
244 | REGULATOR_CHANGE_MODE
245 | REGULATOR_CHANGE_STATUS,
246 },
247 .num_consumer_supplies = ARRAY_SIZE(igep_vio_supply),
248 .consumer_supplies = igep_vio_supply,
249};
250
251static struct regulator_consumer_supply igep_vmmc2_supply[] = {
252 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
253};
254
255static struct regulator_init_data igep_vmmc2 = {
256 .constraints = {
257 .valid_modes_mask = REGULATOR_MODE_NORMAL,
258 .always_on = 1,
259 },
260 .num_consumer_supplies = ARRAY_SIZE(igep_vmmc2_supply),
261 .consumer_supplies = igep_vmmc2_supply,
262};
263
264static struct fixed_voltage_config igep_vwlan = {
265 .supply_name = "vwlan",
266 .microvolts = 3300000,
267 .gpio = -EINVAL,
268 .enabled_at_boot = 1,
269 .init_data = &igep_vmmc2,
270};
271
272static struct platform_device igep_vwlan_device = {
273 .name = "reg-fixed-voltage",
274 .id = 0,
275 .dev = {
276 .platform_data = &igep_vwlan,
277 },
278};
279
280static struct omap2_hsmmc_info mmc[] = {
281 {
282 .mmc = 1,
283 .caps = MMC_CAP_4_BIT_DATA,
284 .gpio_cd = -EINVAL,
285 .gpio_wp = -EINVAL,
286 .deferred = true,
287 },
288#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
289 {
290 .mmc = 2,
291 .caps = MMC_CAP_4_BIT_DATA,
292 .gpio_cd = -EINVAL,
293 .gpio_wp = -EINVAL,
294 },
295#endif
296 {} /* Terminator */
297};
298
299#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
300#include <linux/leds.h>
301
302static struct gpio_led igep_gpio_leds[] = {
303 [0] = {
304 .name = "omap3:red:user0",
305 .default_state = 0,
306 },
307 [1] = {
308 .name = "omap3:green:boot",
309 .default_state = 1,
310 },
311 [2] = {
312 .name = "omap3:red:user1",
313 .default_state = 0,
314 },
315 [3] = {
316 .name = "omap3:green:user1",
317 .default_state = 0,
318 .gpio = -EINVAL, /* gets replaced */
319 .active_low = 1,
320 },
321};
322
323static struct gpio_led_platform_data igep_led_pdata = {
324 .leds = igep_gpio_leds,
325 .num_leds = ARRAY_SIZE(igep_gpio_leds),
326};
327
328static struct platform_device igep_led_device = {
329 .name = "leds-gpio",
330 .id = -1,
331 .dev = {
332 .platform_data = &igep_led_pdata,
333 },
334};
335
336static void __init igep_leds_init(void)
337{
338 if (machine_is_igep0020()) {
339 igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED;
340 igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN;
341 igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED;
342 } else {
343 igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED;
344 igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN;
345 igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED;
346 }
347
348 platform_device_register(&igep_led_device);
349}
350
351#else
352static struct gpio igep_gpio_leds[] __initdata = {
353 { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:red:d0" },
354 { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:green:d0" },
355 { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:red:d1" },
356};
357
358static inline void igep_leds_init(void)
359{
360 int i;
361
362 if (machine_is_igep0020()) {
363 igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED;
364 igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN;
365 igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED;
366 } else {
367 igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED;
368 igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN;
369 igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED;
370 }
371
372 if (gpio_request_array(igep_gpio_leds, ARRAY_SIZE(igep_gpio_leds))) {
373 pr_warning("IGEP v2: Could not obtain leds gpios\n");
374 return;
375 }
376
377 for (i = 0; i < ARRAY_SIZE(igep_gpio_leds); i++)
378 gpio_export(igep_gpio_leds[i].gpio, 0);
379}
380#endif
381
382static struct gpio igep2_twl_gpios[] = {
383 { -EINVAL, GPIOF_IN, "GPIO_EHCI_NOC" },
384 { -EINVAL, GPIOF_OUT_INIT_LOW, "GPIO_USBH_CPEN" },
385};
386
387static int igep_twl_gpio_setup(struct device *dev,
388 unsigned gpio, unsigned ngpio)
389{
390 int ret;
391
392 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
393 mmc[0].gpio_cd = gpio + 0;
394 omap_hsmmc_late_init(mmc);
395
396 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
397#if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
398 ret = gpio_request_one(gpio + TWL4030_GPIO_MAX + 1, GPIOF_OUT_INIT_HIGH,
399 "gpio-led:green:d1");
400 if (ret == 0)
401 gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
402 else
403 pr_warning("IGEP: Could not obtain gpio GPIO_LED1_GREEN\n");
404#else
405 igep_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1;
406#endif
407
408 if (machine_is_igep0030())
409 return 0;
410
411 /*
412 * REVISIT: need ehci-omap hooks for external VBUS
413 * power switch and overcurrent detect
414 */
415 igep2_twl_gpios[0].gpio = gpio + 1;
416
417 /* TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN (out, active low) */
418 igep2_twl_gpios[1].gpio = gpio + TWL4030_GPIO_MAX;
419
420 ret = gpio_request_array(igep2_twl_gpios, ARRAY_SIZE(igep2_twl_gpios));
421 if (ret < 0)
422 pr_err("IGEP2: Could not obtain gpio for USBH_CPEN");
423
424 return 0;
425};
426
427static struct twl4030_gpio_platform_data igep_twl4030_gpio_pdata = {
428 .use_leds = true,
429 .setup = igep_twl_gpio_setup,
430};
431
432static struct connector_dvi_platform_data omap3stalker_dvi_connector_pdata = {
433 .name = "dvi",
434 .source = "tfp410.0",
435 .i2c_bus_num = 3,
436};
437
438static struct platform_device omap3stalker_dvi_connector_device = {
439 .name = "connector-dvi",
440 .id = 0,
441 .dev.platform_data = &omap3stalker_dvi_connector_pdata,
442};
443
444static struct encoder_tfp410_platform_data omap3stalker_tfp410_pdata = {
445 .name = "tfp410.0",
446 .source = "dpi.0",
447 .data_lines = 24,
448 .power_down_gpio = IGEP2_GPIO_DVI_PUP,
449};
450
451static struct platform_device omap3stalker_tfp410_device = {
452 .name = "tfp410",
453 .id = 0,
454 .dev.platform_data = &omap3stalker_tfp410_pdata,
455};
456
457static struct omap_dss_board_info igep2_dss_data = {
458 .default_display_name = "dvi",
459};
460
461static struct platform_device *igep_devices[] __initdata = {
462 &igep_vwlan_device,
463 &omap3stalker_tfp410_device,
464 &omap3stalker_dvi_connector_device,
465};
466
467static int igep2_keymap[] = {
468 KEY(0, 0, KEY_LEFT),
469 KEY(0, 1, KEY_RIGHT),
470 KEY(0, 2, KEY_A),
471 KEY(0, 3, KEY_B),
472 KEY(1, 0, KEY_DOWN),
473 KEY(1, 1, KEY_UP),
474 KEY(1, 2, KEY_E),
475 KEY(1, 3, KEY_F),
476 KEY(2, 0, KEY_ENTER),
477 KEY(2, 1, KEY_I),
478 KEY(2, 2, KEY_J),
479 KEY(2, 3, KEY_K),
480 KEY(3, 0, KEY_M),
481 KEY(3, 1, KEY_N),
482 KEY(3, 2, KEY_O),
483 KEY(3, 3, KEY_P)
484};
485
486static struct matrix_keymap_data igep2_keymap_data = {
487 .keymap = igep2_keymap,
488 .keymap_size = ARRAY_SIZE(igep2_keymap),
489};
490
491static struct twl4030_keypad_data igep2_keypad_pdata = {
492 .keymap_data = &igep2_keymap_data,
493 .rows = 4,
494 .cols = 4,
495 .rep = 1,
496};
497
498static struct twl4030_platform_data igep_twldata = {
499 /* platform_data for children goes here */
500 .gpio = &igep_twl4030_gpio_pdata,
501 .vmmc1 = &igep_vmmc1,
502 .vio = &igep_vio,
503};
504
505static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = {
506 {
507 I2C_BOARD_INFO("eeprom", 0x50),
508 },
509};
510
511static void __init igep_i2c_init(void)
512{
513 int ret;
514
515 omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_USB,
516 TWL_COMMON_REGULATOR_VPLL2);
517 igep_twldata.vpll2->constraints.apply_uV = true;
518 igep_twldata.vpll2->constraints.name = "VDVI";
519
520 if (machine_is_igep0020()) {
521 /*
522 * Bus 3 is attached to the DVI port where devices like the
523 * pico DLP projector don't work reliably with 400kHz
524 */
525 ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo,
526 ARRAY_SIZE(igep2_i2c3_boardinfo));
527 if (ret)
528 pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret);
529
530 igep_twldata.keypad = &igep2_keypad_pdata;
531 /* Get common pmic data */
532 omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_AUDIO, 0);
533 }
534
535 omap3_pmic_init("twl4030", &igep_twldata);
536}
537
538static struct usbhs_phy_data igep2_phy_data[] __initdata = {
539 {
540 .port = 1,
541 .reset_gpio = IGEP2_GPIO_USBH_NRESET,
542 .vcc_gpio = -EINVAL,
543 },
544};
545
546static struct usbhs_phy_data igep3_phy_data[] __initdata = {
547 {
548 .port = 2,
549 .reset_gpio = IGEP3_GPIO_USBH_NRESET,
550 .vcc_gpio = -EINVAL,
551 },
552};
553
554static struct usbhs_omap_platform_data igep2_usbhs_bdata __initdata = {
555 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
556};
557
558static struct usbhs_omap_platform_data igep3_usbhs_bdata __initdata = {
559 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
560};
561
562#ifdef CONFIG_OMAP_MUX
563static struct omap_board_mux board_mux[] __initdata = {
564 /* Display Sub System */
565 OMAP3_MUX(DSS_PCLK, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
566 OMAP3_MUX(DSS_HSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
567 OMAP3_MUX(DSS_VSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
568 OMAP3_MUX(DSS_ACBIAS, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
569 OMAP3_MUX(DSS_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
570 OMAP3_MUX(DSS_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
571 OMAP3_MUX(DSS_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
572 OMAP3_MUX(DSS_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
573 OMAP3_MUX(DSS_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
574 OMAP3_MUX(DSS_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
575 OMAP3_MUX(DSS_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
576 OMAP3_MUX(DSS_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
577 OMAP3_MUX(DSS_DATA8, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
578 OMAP3_MUX(DSS_DATA9, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
579 OMAP3_MUX(DSS_DATA10, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
580 OMAP3_MUX(DSS_DATA11, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
581 OMAP3_MUX(DSS_DATA12, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
582 OMAP3_MUX(DSS_DATA13, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
583 OMAP3_MUX(DSS_DATA14, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
584 OMAP3_MUX(DSS_DATA15, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
585 OMAP3_MUX(DSS_DATA16, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
586 OMAP3_MUX(DSS_DATA17, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
587 OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
588 OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
589 OMAP3_MUX(DSS_DATA20, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
590 OMAP3_MUX(DSS_DATA21, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
591 OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
592 OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
593 /* TFP410 PanelBus DVI Transmitte (GPIO_170) */
594 OMAP3_MUX(HDQ_SIO, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
595 /* SMSC9221 LAN Controller ETH IRQ (GPIO_176) */
596 OMAP3_MUX(MCSPI1_CS2, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
597 { .reg_offset = OMAP_MUX_TERMINATOR },
598};
599#endif
600
601#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
602static struct gpio igep_wlan_bt_gpios[] __initdata = {
603 { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NPD" },
604 { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NRESET" },
605 { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_BT_NRESET" },
606};
607
608static void __init igep_wlan_bt_init(void)
609{
610 int err;
611
612 /* GPIO's for WLAN-BT combo depends on hardware revision */
613 if (hwrev == IGEP2_BOARD_HWREV_B) {
614 igep_wlan_bt_gpios[0].gpio = IGEP2_RB_GPIO_WIFI_NPD;
615 igep_wlan_bt_gpios[1].gpio = IGEP2_RB_GPIO_WIFI_NRESET;
616 igep_wlan_bt_gpios[2].gpio = IGEP2_RB_GPIO_BT_NRESET;
617 } else if (hwrev == IGEP2_BOARD_HWREV_C || machine_is_igep0030()) {
618 igep_wlan_bt_gpios[0].gpio = IGEP2_RC_GPIO_WIFI_NPD;
619 igep_wlan_bt_gpios[1].gpio = IGEP2_RC_GPIO_WIFI_NRESET;
620 igep_wlan_bt_gpios[2].gpio = IGEP2_RC_GPIO_BT_NRESET;
621 } else
622 return;
623
624 /* Make sure that the GPIO pins are muxed correctly */
625 omap_mux_init_gpio(igep_wlan_bt_gpios[0].gpio, OMAP_PIN_OUTPUT);
626 omap_mux_init_gpio(igep_wlan_bt_gpios[1].gpio, OMAP_PIN_OUTPUT);
627 omap_mux_init_gpio(igep_wlan_bt_gpios[2].gpio, OMAP_PIN_OUTPUT);
628
629 err = gpio_request_array(igep_wlan_bt_gpios,
630 ARRAY_SIZE(igep_wlan_bt_gpios));
631 if (err) {
632 pr_warning("IGEP2: Could not obtain WIFI/BT gpios\n");
633 return;
634 }
635
636 gpio_export(igep_wlan_bt_gpios[0].gpio, 0);
637 gpio_export(igep_wlan_bt_gpios[1].gpio, 0);
638 gpio_export(igep_wlan_bt_gpios[2].gpio, 0);
639
640 gpio_set_value(igep_wlan_bt_gpios[1].gpio, 0);
641 udelay(10);
642 gpio_set_value(igep_wlan_bt_gpios[1].gpio, 1);
643
644}
645#else
646static inline void __init igep_wlan_bt_init(void) { }
647#endif
648
649static struct regulator_consumer_supply dummy_supplies[] = {
650 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
651 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
652};
653
654static void __init igep_init(void)
655{
656 regulator_register_fixed(1, dummy_supplies, ARRAY_SIZE(dummy_supplies));
657 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
658
659 /* Get IGEP2 hardware revision */
660 igep2_get_revision();
661
662 omap_hsmmc_init(mmc);
663
664 /* Register I2C busses and drivers */
665 igep_i2c_init();
666 platform_add_devices(igep_devices, ARRAY_SIZE(igep_devices));
667 omap_serial_init();
668 omap_sdrc_init(m65kxxxxam_sdrc_params,
669 m65kxxxxam_sdrc_params);
670 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
671 usb_musb_init(NULL);
672
673 igep_flash_init();
674 igep_leds_init();
675 omap_twl4030_audio_init("igep2", NULL);
676
677 /*
678 * WLAN-BT combo module from MuRata which has a Marvell WLAN
679 * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
680 */
681 igep_wlan_bt_init();
682
683 if (machine_is_igep0020()) {
684 omap_display_init(&igep2_dss_data);
685 igep2_init_smsc911x();
686 usbhs_init_phys(igep2_phy_data, ARRAY_SIZE(igep2_phy_data));
687 usbhs_init(&igep2_usbhs_bdata);
688 } else {
689 usbhs_init_phys(igep3_phy_data, ARRAY_SIZE(igep3_phy_data));
690 usbhs_init(&igep3_usbhs_bdata);
691 }
692}
693
694MACHINE_START(IGEP0020, "IGEP v2 board")
695 .atag_offset = 0x100,
696 .reserve = omap_reserve,
697 .map_io = omap3_map_io,
698 .init_early = omap35xx_init_early,
699 .init_irq = omap3_init_irq,
700 .handle_irq = omap3_intc_handle_irq,
701 .init_machine = igep_init,
702 .init_late = omap35xx_init_late,
703 .init_time = omap3_sync32k_timer_init,
704 .restart = omap3xxx_restart,
705MACHINE_END
706
707MACHINE_START(IGEP0030, "IGEP OMAP3 module")
708 .atag_offset = 0x100,
709 .reserve = omap_reserve,
710 .map_io = omap3_map_io,
711 .init_early = omap35xx_init_early,
712 .init_irq = omap3_init_irq,
713 .handle_irq = omap3_intc_handle_irq,
714 .init_machine = igep_init,
715 .init_late = omap35xx_init_late,
716 .init_time = omap3_sync32k_timer_init,
717 .restart = omap3xxx_restart,
718MACHINE_END
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index dd8da2c5399f..4ec8d82b0492 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -36,7 +36,6 @@
36#include <asm/mach/map.h> 36#include <asm/mach/map.h>
37 37
38#include "common.h" 38#include "common.h"
39#include "board-zoom.h"
40#include "gpmc.h" 39#include "gpmc.h"
41#include "gpmc-smsc911x.h" 40#include "gpmc-smsc911x.h"
42 41
@@ -406,7 +405,7 @@ static void __init omap_ldp_init(void)
406 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 405 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
407 usb_musb_init(NULL); 406 usb_musb_init(NULL);
408 board_nand_init(ldp_nand_partitions, ARRAY_SIZE(ldp_nand_partitions), 407 board_nand_init(ldp_nand_partitions, ARRAY_SIZE(ldp_nand_partitions),
409 ZOOM_NAND_CS, 0, nand_default_timings); 408 0, 0, nand_default_timings);
410 409
411 omap_hsmmc_init(mmc); 410 omap_hsmmc_init(mmc);
412 ldp_display_init(); 411 ldp_display_init();
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index f26918467efc..a516c1bda141 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -25,7 +25,7 @@
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/input.h> 26#include <linux/input.h>
27#include <linux/gpio_keys.h> 27#include <linux/gpio_keys.h>
28#include <linux/opp.h> 28#include <linux/pm_opp.h>
29#include <linux/cpu.h> 29#include <linux/cpu.h>
30 30
31#include <linux/mtd/mtd.h> 31#include <linux/mtd/mtd.h>
@@ -289,18 +289,12 @@ static struct regulator_consumer_supply beagle_vsim_supply[] = {
289 289
290static struct gpio_led gpio_leds[]; 290static struct gpio_led gpio_leds[];
291 291
292/* PHY's VCC regulator might be added later, so flag that we need it */
293static struct usb_phy_gen_xceiv_platform_data hsusb2_phy_data = {
294 .needs_vcc = true,
295};
296
297static struct usbhs_phy_data phy_data[] = { 292static struct usbhs_phy_data phy_data[] = {
298 { 293 {
299 .port = 2, 294 .port = 2,
300 .reset_gpio = 147, 295 .reset_gpio = 147,
301 .vcc_gpio = -1, /* updated in beagle_twl_gpio_setup */ 296 .vcc_gpio = -1, /* updated in beagle_twl_gpio_setup */
302 .vcc_polarity = 1, /* updated in beagle_twl_gpio_setup */ 297 .vcc_polarity = 1, /* updated in beagle_twl_gpio_setup */
303 .platform_data = &hsusb2_phy_data,
304 }, 298 },
305}; 299};
306 300
@@ -522,11 +516,11 @@ static int __init beagle_opp_init(void)
522 return -ENODEV; 516 return -ENODEV;
523 } 517 }
524 /* Enable MPU 1GHz and lower opps */ 518 /* Enable MPU 1GHz and lower opps */
525 r = opp_enable(mpu_dev, 800000000); 519 r = dev_pm_opp_enable(mpu_dev, 800000000);
526 /* TODO: MPU 1GHz needs SR and ABB */ 520 /* TODO: MPU 1GHz needs SR and ABB */
527 521
528 /* Enable IVA 800MHz and lower opps */ 522 /* Enable IVA 800MHz and lower opps */
529 r |= opp_enable(iva_dev, 660000000); 523 r |= dev_pm_opp_enable(iva_dev, 660000000);
530 /* TODO: DSP 800MHz needs SR and ABB */ 524 /* TODO: DSP 800MHz needs SR and ABB */
531 if (r) { 525 if (r) {
532 pr_err("%s: failed to enable higher opp %d\n", 526 pr_err("%s: failed to enable higher opp %d\n",
@@ -535,8 +529,8 @@ static int __init beagle_opp_init(void)
535 * Cleanup - disable the higher freqs - we dont care 529 * Cleanup - disable the higher freqs - we dont care
536 * about the results 530 * about the results
537 */ 531 */
538 opp_disable(mpu_dev, 800000000); 532 dev_pm_opp_disable(mpu_dev, 800000000);
539 opp_disable(iva_dev, 660000000); 533 dev_pm_opp_disable(iva_dev, 660000000);
540 } 534 }
541 } 535 }
542 return 0; 536 return 0;
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
deleted file mode 100644
index 18143873346c..000000000000
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ /dev/null
@@ -1,756 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap2/board-omap3evm.c
3 *
4 * Copyright (C) 2008 Texas Instruments
5 *
6 * Modified from mach-omap2/board-3430sdp.c
7 *
8 * Initial code: Syed Mohammed Khasim
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/delay.h>
19#include <linux/err.h>
20#include <linux/clk.h>
21#include <linux/gpio.h>
22#include <linux/input.h>
23#include <linux/input/matrix_keypad.h>
24#include <linux/leds.h>
25#include <linux/interrupt.h>
26
27#include <linux/mtd/mtd.h>
28#include <linux/mtd/partitions.h>
29#include <linux/mtd/nand.h>
30
31#include <linux/spi/spi.h>
32#include <linux/spi/ads7846.h>
33#include <linux/i2c/twl.h>
34#include <linux/usb/otg.h>
35#include <linux/usb/musb.h>
36#include <linux/usb/usb_phy_gen_xceiv.h>
37#include <linux/smsc911x.h>
38
39#include <linux/wl12xx.h>
40#include <linux/regulator/fixed.h>
41#include <linux/regulator/machine.h>
42#include <linux/mmc/host.h>
43#include <linux/export.h>
44#include <linux/usb/phy.h>
45
46#include <asm/mach-types.h>
47#include <asm/mach/arch.h>
48#include <asm/mach/map.h>
49
50#include <linux/platform_data/mtd-nand-omap2.h>
51#include "common.h"
52#include <linux/platform_data/spi-omap2-mcspi.h>
53#include <video/omapdss.h>
54#include <video/omap-panel-data.h>
55
56#include "soc.h"
57#include "mux.h"
58#include "sdram-micron-mt46h32m32lf-6.h"
59#include "hsmmc.h"
60#include "common-board-devices.h"
61#include "board-flash.h"
62
63#define NAND_CS 0
64
65#define OMAP3_EVM_TS_GPIO 175
66#define OMAP3_EVM_EHCI_VBUS 22
67#define OMAP3_EVM_EHCI_SELECT 61
68
69#define OMAP3EVM_ETHR_START 0x2c000000
70#define OMAP3EVM_ETHR_SIZE 1024
71#define OMAP3EVM_ETHR_ID_REV 0x50
72#define OMAP3EVM_ETHR_GPIO_IRQ 176
73#define OMAP3EVM_SMSC911X_CS 5
74/*
75 * Eth Reset signal
76 * 64 = Generation 1 (<=RevD)
77 * 7 = Generation 2 (>=RevE)
78 */
79#define OMAP3EVM_GEN1_ETHR_GPIO_RST 64
80#define OMAP3EVM_GEN2_ETHR_GPIO_RST 7
81
82/*
83 * OMAP35x EVM revision
84 * Run time detection of EVM revision is done by reading Ethernet
85 * PHY ID -
86 * GEN_1 = 0x01150000
87 * GEN_2 = 0x92200000
88 */
89enum {
90 OMAP3EVM_BOARD_GEN_1 = 0, /* EVM Rev between A - D */
91 OMAP3EVM_BOARD_GEN_2, /* EVM Rev >= Rev E */
92};
93
94static u8 omap3_evm_version;
95
96static u8 get_omap3_evm_rev(void)
97{
98 return omap3_evm_version;
99}
100
101static void __init omap3_evm_get_revision(void)
102{
103 void __iomem *ioaddr;
104 unsigned int smsc_id;
105
106 /* Ethernet PHY ID is stored at ID_REV register */
107 ioaddr = ioremap_nocache(OMAP3EVM_ETHR_START, SZ_1K);
108 if (!ioaddr)
109 return;
110 smsc_id = readl(ioaddr + OMAP3EVM_ETHR_ID_REV) & 0xFFFF0000;
111 iounmap(ioaddr);
112
113 switch (smsc_id) {
114 /*SMSC9115 chipset*/
115 case 0x01150000:
116 omap3_evm_version = OMAP3EVM_BOARD_GEN_1;
117 break;
118 /*SMSC 9220 chipset*/
119 case 0x92200000:
120 default:
121 omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
122 }
123}
124
125#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
126#include "gpmc-smsc911x.h"
127
128static struct omap_smsc911x_platform_data smsc911x_cfg = {
129 .cs = OMAP3EVM_SMSC911X_CS,
130 .gpio_irq = OMAP3EVM_ETHR_GPIO_IRQ,
131 .gpio_reset = -EINVAL,
132 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
133};
134
135static inline void __init omap3evm_init_smsc911x(void)
136{
137 /* Configure ethernet controller reset gpio */
138 if (cpu_is_omap3430()) {
139 if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1)
140 smsc911x_cfg.gpio_reset = OMAP3EVM_GEN1_ETHR_GPIO_RST;
141 else
142 smsc911x_cfg.gpio_reset = OMAP3EVM_GEN2_ETHR_GPIO_RST;
143 }
144
145 gpmc_smsc911x_init(&smsc911x_cfg);
146}
147
148#else
149static inline void __init omap3evm_init_smsc911x(void) { return; }
150#endif
151
152/*
153 * OMAP3EVM LCD Panel control signals
154 */
155#define OMAP3EVM_LCD_PANEL_LR 2
156#define OMAP3EVM_LCD_PANEL_UD 3
157#define OMAP3EVM_LCD_PANEL_INI 152
158#define OMAP3EVM_LCD_PANEL_QVGA 154
159#define OMAP3EVM_LCD_PANEL_RESB 155
160
161#define OMAP3EVM_LCD_PANEL_ENVDD 153
162#define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210
163
164/*
165 * OMAP3EVM DVI control signals
166 */
167#define OMAP3EVM_DVI_PANEL_EN_GPIO 199
168
169#ifdef CONFIG_BROKEN
170static void __init omap3_evm_display_init(void)
171{
172 int r;
173
174 r = gpio_request_one(OMAP3EVM_LCD_PANEL_ENVDD, GPIOF_OUT_INIT_LOW,
175 "lcd_panel_envdd");
176 if (r)
177 pr_err("failed to get lcd_panel_envdd GPIO\n");
178
179 r = gpio_request_one(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO,
180 GPIOF_OUT_INIT_LOW, "lcd_panel_bklight");
181 if (r)
182 pr_err("failed to get lcd_panel_bklight GPIO\n");
183
184 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
185 gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0);
186 else
187 gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
188}
189#endif
190
191static struct panel_sharp_ls037v7dw01_platform_data omap3_evm_lcd_pdata = {
192 .name = "lcd",
193 .source = "dpi.0",
194
195 .data_lines = 18,
196
197 .resb_gpio = OMAP3EVM_LCD_PANEL_RESB,
198 .ini_gpio = OMAP3EVM_LCD_PANEL_INI,
199 .mo_gpio = OMAP3EVM_LCD_PANEL_QVGA,
200 .lr_gpio = OMAP3EVM_LCD_PANEL_LR,
201 .ud_gpio = OMAP3EVM_LCD_PANEL_UD,
202};
203
204static struct platform_device omap3_evm_lcd_device = {
205 .name = "panel-sharp-ls037v7dw01",
206 .id = 0,
207 .dev.platform_data = &omap3_evm_lcd_pdata,
208};
209
210static struct connector_dvi_platform_data omap3_evm_dvi_connector_pdata = {
211 .name = "dvi",
212 .source = "tfp410.0",
213 .i2c_bus_num = -1,
214};
215
216static struct platform_device omap3_evm_dvi_connector_device = {
217 .name = "connector-dvi",
218 .id = 0,
219 .dev.platform_data = &omap3_evm_dvi_connector_pdata,
220};
221
222static struct encoder_tfp410_platform_data omap3_evm_tfp410_pdata = {
223 .name = "tfp410.0",
224 .source = "dpi.0",
225 .data_lines = 24,
226 .power_down_gpio = OMAP3EVM_DVI_PANEL_EN_GPIO,
227};
228
229static struct platform_device omap3_evm_tfp410_device = {
230 .name = "tfp410",
231 .id = 0,
232 .dev.platform_data = &omap3_evm_tfp410_pdata,
233};
234
235static struct connector_atv_platform_data omap3_evm_tv_pdata = {
236 .name = "tv",
237 .source = "venc.0",
238 .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO,
239 .invert_polarity = false,
240};
241
242static struct platform_device omap3_evm_tv_connector_device = {
243 .name = "connector-analog-tv",
244 .id = 0,
245 .dev.platform_data = &omap3_evm_tv_pdata,
246};
247
248static struct omap_dss_board_info omap3_evm_dss_data = {
249 .default_display_name = "lcd",
250};
251
252static struct regulator_consumer_supply omap3evm_vmmc1_supply[] = {
253 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
254};
255
256static struct regulator_consumer_supply omap3evm_vsim_supply[] = {
257 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"),
258};
259
260/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
261static struct regulator_init_data omap3evm_vmmc1 = {
262 .constraints = {
263 .min_uV = 1850000,
264 .max_uV = 3150000,
265 .valid_modes_mask = REGULATOR_MODE_NORMAL
266 | REGULATOR_MODE_STANDBY,
267 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
268 | REGULATOR_CHANGE_MODE
269 | REGULATOR_CHANGE_STATUS,
270 },
271 .num_consumer_supplies = ARRAY_SIZE(omap3evm_vmmc1_supply),
272 .consumer_supplies = omap3evm_vmmc1_supply,
273};
274
275/* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
276static struct regulator_init_data omap3evm_vsim = {
277 .constraints = {
278 .min_uV = 1800000,
279 .max_uV = 3000000,
280 .valid_modes_mask = REGULATOR_MODE_NORMAL
281 | REGULATOR_MODE_STANDBY,
282 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
283 | REGULATOR_CHANGE_MODE
284 | REGULATOR_CHANGE_STATUS,
285 },
286 .num_consumer_supplies = ARRAY_SIZE(omap3evm_vsim_supply),
287 .consumer_supplies = omap3evm_vsim_supply,
288};
289
290static struct omap2_hsmmc_info mmc[] = {
291 {
292 .mmc = 1,
293 .caps = MMC_CAP_4_BIT_DATA,
294 .gpio_cd = -EINVAL,
295 .gpio_wp = 63,
296 .deferred = true,
297 },
298#ifdef CONFIG_WILINK_PLATFORM_DATA
299 {
300 .name = "wl1271",
301 .mmc = 2,
302 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
303 .gpio_wp = -EINVAL,
304 .gpio_cd = -EINVAL,
305 .nonremovable = true,
306 },
307#endif
308 {} /* Terminator */
309};
310
311static struct gpio_led gpio_leds[] = {
312 {
313 .name = "omap3evm::ledb",
314 /* normally not visible (board underside) */
315 .default_trigger = "default-on",
316 .gpio = -EINVAL, /* gets replaced */
317 .active_low = true,
318 },
319};
320
321static struct gpio_led_platform_data gpio_led_info = {
322 .leds = gpio_leds,
323 .num_leds = ARRAY_SIZE(gpio_leds),
324};
325
326static struct platform_device leds_gpio = {
327 .name = "leds-gpio",
328 .id = -1,
329 .dev = {
330 .platform_data = &gpio_led_info,
331 },
332};
333
334
335static int omap3evm_twl_gpio_setup(struct device *dev,
336 unsigned gpio, unsigned ngpio)
337{
338 int r, lcd_bl_en;
339
340 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
341 mmc[0].gpio_cd = gpio + 0;
342 omap_hsmmc_late_init(mmc);
343
344 /*
345 * Most GPIOs are for USB OTG. Some are mostly sent to
346 * the P2 connector; notably LEDA for the LCD backlight.
347 */
348
349 /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */
350 lcd_bl_en = get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2 ?
351 GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
352 r = gpio_request_one(gpio + TWL4030_GPIO_MAX, lcd_bl_en, "EN_LCD_BKL");
353 if (r)
354 printk(KERN_ERR "failed to get/set lcd_bkl gpio\n");
355
356 /* gpio + 7 == DVI Enable */
357 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI");
358
359 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
360 gpio_leds[0].gpio = gpio + TWL4030_GPIO_MAX + 1;
361
362 platform_device_register(&leds_gpio);
363
364 /* Enable VBUS switch by setting TWL4030.GPIO2DIR as output
365 * for starting USB tranceiver
366 */
367#ifdef CONFIG_TWL4030_CORE
368 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
369 u8 val;
370
371 twl_i2c_read_u8(TWL4030_MODULE_GPIO, &val, REG_GPIODATADIR1);
372 val |= 0x04; /* TWL4030.GPIO2DIR BIT at GPIODATADIR1(0x9B) */
373 twl_i2c_write_u8(TWL4030_MODULE_GPIO, val, REG_GPIODATADIR1);
374 }
375#endif
376
377 return 0;
378}
379
380static struct twl4030_gpio_platform_data omap3evm_gpio_data = {
381 .use_leds = true,
382 .setup = omap3evm_twl_gpio_setup,
383};
384
385static uint32_t board_keymap[] = {
386 KEY(0, 0, KEY_LEFT),
387 KEY(0, 1, KEY_DOWN),
388 KEY(0, 2, KEY_ENTER),
389 KEY(0, 3, KEY_M),
390
391 KEY(1, 0, KEY_RIGHT),
392 KEY(1, 1, KEY_UP),
393 KEY(1, 2, KEY_I),
394 KEY(1, 3, KEY_N),
395
396 KEY(2, 0, KEY_A),
397 KEY(2, 1, KEY_E),
398 KEY(2, 2, KEY_J),
399 KEY(2, 3, KEY_O),
400
401 KEY(3, 0, KEY_B),
402 KEY(3, 1, KEY_F),
403 KEY(3, 2, KEY_K),
404 KEY(3, 3, KEY_P)
405};
406
407static struct matrix_keymap_data board_map_data = {
408 .keymap = board_keymap,
409 .keymap_size = ARRAY_SIZE(board_keymap),
410};
411
412static struct twl4030_keypad_data omap3evm_kp_data = {
413 .keymap_data = &board_map_data,
414 .rows = 4,
415 .cols = 4,
416 .rep = 1,
417};
418
419/* ads7846 on SPI */
420static struct regulator_consumer_supply omap3evm_vio_supply[] = {
421 REGULATOR_SUPPLY("vcc", "spi1.0"),
422};
423
424/* VIO for ads7846 */
425static struct regulator_init_data omap3evm_vio = {
426 .constraints = {
427 .min_uV = 1800000,
428 .max_uV = 1800000,
429 .apply_uV = true,
430 .valid_modes_mask = REGULATOR_MODE_NORMAL
431 | REGULATOR_MODE_STANDBY,
432 .valid_ops_mask = REGULATOR_CHANGE_MODE
433 | REGULATOR_CHANGE_STATUS,
434 },
435 .num_consumer_supplies = ARRAY_SIZE(omap3evm_vio_supply),
436 .consumer_supplies = omap3evm_vio_supply,
437};
438
439#ifdef CONFIG_WILINK_PLATFORM_DATA
440
441#define OMAP3EVM_WLAN_PMENA_GPIO (150)
442#define OMAP3EVM_WLAN_IRQ_GPIO (149)
443
444static struct regulator_consumer_supply omap3evm_vmmc2_supply[] = {
445 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
446};
447
448/* VMMC2 for driving the WL12xx module */
449static struct regulator_init_data omap3evm_vmmc2 = {
450 .constraints = {
451 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
452 },
453 .num_consumer_supplies = ARRAY_SIZE(omap3evm_vmmc2_supply),
454 .consumer_supplies = omap3evm_vmmc2_supply,
455};
456
457static struct fixed_voltage_config omap3evm_vwlan = {
458 .supply_name = "vwl1271",
459 .microvolts = 1800000, /* 1.80V */
460 .gpio = OMAP3EVM_WLAN_PMENA_GPIO,
461 .startup_delay = 70000, /* 70ms */
462 .enable_high = 1,
463 .enabled_at_boot = 0,
464 .init_data = &omap3evm_vmmc2,
465};
466
467static struct platform_device omap3evm_wlan_regulator = {
468 .name = "reg-fixed-voltage",
469 .id = 1,
470 .dev = {
471 .platform_data = &omap3evm_vwlan,
472 },
473};
474
475struct wl12xx_platform_data omap3evm_wlan_data __initdata = {
476 .board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
477};
478#endif
479
480/* VAUX2 for USB */
481static struct regulator_consumer_supply omap3evm_vaux2_supplies[] = {
482 REGULATOR_SUPPLY("VDD_CSIPHY1", "omap3isp"), /* OMAP ISP */
483 REGULATOR_SUPPLY("VDD_CSIPHY2", "omap3isp"), /* OMAP ISP */
484 REGULATOR_SUPPLY("vcc", "usb_phy_gen_xceiv.2"), /* hsusb port 2 */
485 REGULATOR_SUPPLY("vaux2", NULL),
486};
487
488static struct regulator_init_data omap3evm_vaux2 = {
489 .constraints = {
490 .min_uV = 2800000,
491 .max_uV = 2800000,
492 .apply_uV = true,
493 .valid_modes_mask = REGULATOR_MODE_NORMAL
494 | REGULATOR_MODE_STANDBY,
495 .valid_ops_mask = REGULATOR_CHANGE_MODE
496 | REGULATOR_CHANGE_STATUS,
497 },
498 .num_consumer_supplies = ARRAY_SIZE(omap3evm_vaux2_supplies),
499 .consumer_supplies = omap3evm_vaux2_supplies,
500};
501
502static struct twl4030_platform_data omap3evm_twldata = {
503 /* platform_data for children goes here */
504 .keypad = &omap3evm_kp_data,
505 .gpio = &omap3evm_gpio_data,
506 .vio = &omap3evm_vio,
507 .vmmc1 = &omap3evm_vmmc1,
508 .vsim = &omap3evm_vsim,
509};
510
511static int __init omap3_evm_i2c_init(void)
512{
513 omap3_pmic_get_config(&omap3evm_twldata,
514 TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_MADC |
515 TWL_COMMON_PDATA_AUDIO,
516 TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
517
518 omap3evm_twldata.vdac->constraints.apply_uV = true;
519 omap3evm_twldata.vpll2->constraints.apply_uV = true;
520
521 omap3_pmic_init("twl4030", &omap3evm_twldata);
522 omap_register_i2c_bus(2, 400, NULL, 0);
523 omap_register_i2c_bus(3, 400, NULL, 0);
524 return 0;
525}
526
527static struct usbhs_phy_data phy_data[] __initdata = {
528 {
529 .port = 2,
530 .reset_gpio = -1, /* set at runtime */
531 .vcc_gpio = -EINVAL,
532 },
533};
534
535static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
536 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
537};
538
539#ifdef CONFIG_OMAP_MUX
540static struct omap_board_mux omap35x_board_mux[] __initdata = {
541 OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
542 OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
543 OMAP_PIN_OFF_WAKEUPENABLE),
544 OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
545 OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
546 OMAP_PIN_OFF_WAKEUPENABLE),
547 OMAP3_MUX(SYS_BOOT5, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
548 OMAP_PIN_OFF_NONE),
549 OMAP3_MUX(GPMC_WAIT2, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
550 OMAP_PIN_OFF_NONE),
551#ifdef CONFIG_WILINK_PLATFORM_DATA
552 /* WLAN IRQ - GPIO 149 */
553 OMAP3_MUX(UART1_RTS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
554
555 /* WLAN POWER ENABLE - GPIO 150 */
556 OMAP3_MUX(UART1_CTS, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
557
558 /* MMC2 SDIO pin muxes for WL12xx */
559 OMAP3_MUX(SDMMC2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
560 OMAP3_MUX(SDMMC2_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
561 OMAP3_MUX(SDMMC2_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
562 OMAP3_MUX(SDMMC2_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
563 OMAP3_MUX(SDMMC2_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
564 OMAP3_MUX(SDMMC2_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
565#endif
566 { .reg_offset = OMAP_MUX_TERMINATOR },
567};
568
569static struct omap_board_mux omap36x_board_mux[] __initdata = {
570 OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
571 OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
572 OMAP_PIN_OFF_WAKEUPENABLE),
573 OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
574 OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
575 OMAP_PIN_OFF_WAKEUPENABLE),
576 /* AM/DM37x EVM: DSS data bus muxed with sys_boot */
577 OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
578 OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
579 OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
580 OMAP3_MUX(DSS_DATA21, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
581 OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
582 OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
583 OMAP3_MUX(SYS_BOOT0, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
584 OMAP3_MUX(SYS_BOOT1, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
585 OMAP3_MUX(SYS_BOOT3, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
586 OMAP3_MUX(SYS_BOOT4, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
587 OMAP3_MUX(SYS_BOOT5, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
588 OMAP3_MUX(SYS_BOOT6, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
589#ifdef CONFIG_WILINK_PLATFORM_DATA
590 /* WLAN IRQ - GPIO 149 */
591 OMAP3_MUX(UART1_RTS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
592
593 /* WLAN POWER ENABLE - GPIO 150 */
594 OMAP3_MUX(UART1_CTS, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
595
596 /* MMC2 SDIO pin muxes for WL12xx */
597 OMAP3_MUX(SDMMC2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
598 OMAP3_MUX(SDMMC2_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
599 OMAP3_MUX(SDMMC2_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
600 OMAP3_MUX(SDMMC2_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
601 OMAP3_MUX(SDMMC2_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
602 OMAP3_MUX(SDMMC2_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
603#endif
604
605 { .reg_offset = OMAP_MUX_TERMINATOR },
606};
607#else
608#define omap35x_board_mux NULL
609#define omap36x_board_mux NULL
610#endif
611
612static struct omap_musb_board_data musb_board_data = {
613 .interface_type = MUSB_INTERFACE_ULPI,
614 .mode = MUSB_OTG,
615 .power = 100,
616};
617
618static struct gpio omap3_evm_ehci_gpios[] __initdata = {
619 { OMAP3_EVM_EHCI_VBUS, GPIOF_OUT_INIT_HIGH, "enable EHCI VBUS" },
620 { OMAP3_EVM_EHCI_SELECT, GPIOF_OUT_INIT_LOW, "select EHCI port" },
621};
622
623static void __init omap3_evm_wl12xx_init(void)
624{
625#ifdef CONFIG_WILINK_PLATFORM_DATA
626 int ret;
627
628 /* WL12xx WLAN Init */
629 omap3evm_wlan_data.irq = gpio_to_irq(OMAP3EVM_WLAN_IRQ_GPIO);
630 ret = wl12xx_set_platform_data(&omap3evm_wlan_data);
631 if (ret)
632 pr_err("error setting wl12xx data: %d\n", ret);
633 ret = platform_device_register(&omap3evm_wlan_regulator);
634 if (ret)
635 pr_err("error registering wl12xx device: %d\n", ret);
636#endif
637}
638
639static struct regulator_consumer_supply dummy_supplies[] = {
640 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
641 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
642};
643
644static struct mtd_partition omap3evm_nand_partitions[] = {
645 /* All the partition sizes are listed in terms of NAND block size */
646 {
647 .name = "X-Loader",
648 .offset = 0,
649 .size = 4*(SZ_128K),
650 .mask_flags = MTD_WRITEABLE
651 },
652 {
653 .name = "U-Boot",
654 .offset = MTDPART_OFS_APPEND,
655 .size = 14*(SZ_128K),
656 .mask_flags = MTD_WRITEABLE
657 },
658 {
659 .name = "U-Boot Env",
660 .offset = MTDPART_OFS_APPEND,
661 .size = 2*(SZ_128K)
662 },
663 {
664 .name = "Kernel",
665 .offset = MTDPART_OFS_APPEND,
666 .size = 40*(SZ_128K)
667 },
668 {
669 .name = "File system",
670 .size = MTDPART_SIZ_FULL,
671 .offset = MTDPART_OFS_APPEND,
672 },
673};
674
675static void __init omap3_evm_init(void)
676{
677 struct omap_board_mux *obm;
678
679 omap3_evm_get_revision();
680 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
681
682 obm = (cpu_is_omap3630()) ? omap36x_board_mux : omap35x_board_mux;
683 omap3_mux_init(obm, OMAP_PACKAGE_CBB);
684
685 omap_mux_init_gpio(63, OMAP_PIN_INPUT);
686 omap_hsmmc_init(mmc);
687
688 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
689 omap3evm_twldata.vaux2 = &omap3evm_vaux2;
690
691 omap3_evm_i2c_init();
692
693 omap_display_init(&omap3_evm_dss_data);
694 platform_device_register(&omap3_evm_lcd_device);
695 platform_device_register(&omap3_evm_tfp410_device);
696 platform_device_register(&omap3_evm_dvi_connector_device);
697 platform_device_register(&omap3_evm_tv_connector_device);
698
699 omap_serial_init();
700 omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL);
701
702 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
703 usb_nop_xceiv_register();
704
705 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
706 /* enable EHCI VBUS using GPIO22 */
707 omap_mux_init_gpio(OMAP3_EVM_EHCI_VBUS, OMAP_PIN_INPUT_PULLUP);
708 /* Select EHCI port on main board */
709 omap_mux_init_gpio(OMAP3_EVM_EHCI_SELECT,
710 OMAP_PIN_INPUT_PULLUP);
711 gpio_request_array(omap3_evm_ehci_gpios,
712 ARRAY_SIZE(omap3_evm_ehci_gpios));
713
714 /* setup EHCI phy reset config */
715 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
716 phy_data[0].reset_gpio = 21;
717
718 /* EVM REV >= E can supply 500mA with EXTVBUS programming */
719 musb_board_data.power = 500;
720 musb_board_data.extvbus = 1;
721 } else {
722 /* setup EHCI phy reset on MDC */
723 omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
724 phy_data[0].reset_gpio = 135;
725 }
726 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
727 usb_musb_init(&musb_board_data);
728
729 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
730 usbhs_init(&usbhs_bdata);
731 board_nand_init(omap3evm_nand_partitions,
732 ARRAY_SIZE(omap3evm_nand_partitions), NAND_CS,
733 NAND_BUSWIDTH_16, NULL);
734
735 omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
736 omap3evm_init_smsc911x();
737#ifdef CONFIG_BROKEN
738 omap3_evm_display_init();
739#endif
740 omap3_evm_wl12xx_init();
741 omap_twl4030_audio_init("omap3evm", NULL);
742}
743
744MACHINE_START(OMAP3EVM, "OMAP3 EVM")
745 /* Maintainer: Syed Mohammed Khasim - Texas Instruments */
746 .atag_offset = 0x100,
747 .reserve = omap_reserve,
748 .map_io = omap3_map_io,
749 .init_early = omap35xx_init_early,
750 .init_irq = omap3_init_irq,
751 .handle_irq = omap3_intc_handle_irq,
752 .init_machine = omap3_evm_init,
753 .init_late = omap35xx_init_late,
754 .init_time = omap3_sync32k_timer_init,
755 .restart = omap3xxx_restart,
756MACHINE_END
diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c
deleted file mode 100644
index 345e8c4b8731..000000000000
--- a/arch/arm/mach-omap2/board-rm680.c
+++ /dev/null
@@ -1,167 +0,0 @@
1/*
2 * Board support file for Nokia N950 (RM-680) / N9 (RM-696).
3 *
4 * Copyright (C) 2010 Nokia
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/io.h>
12#include <linux/i2c.h>
13#include <linux/gpio.h>
14#include <linux/init.h>
15#include <linux/i2c/twl.h>
16#include <linux/platform_device.h>
17#include <linux/regulator/fixed.h>
18#include <linux/regulator/machine.h>
19#include <linux/regulator/consumer.h>
20#include <linux/platform_data/mtd-onenand-omap2.h>
21#include <linux/usb/phy.h>
22
23#include <asm/mach/arch.h>
24#include <asm/mach-types.h>
25
26#include "common.h"
27#include "mux.h"
28#include "gpmc.h"
29#include "mmc.h"
30#include "hsmmc.h"
31#include "sdram-nokia.h"
32#include "common-board-devices.h"
33#include "gpmc-onenand.h"
34
35static struct regulator_consumer_supply rm680_vemmc_consumers[] = {
36 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
37};
38
39/* Fixed regulator for internal eMMC */
40static struct regulator_init_data rm680_vemmc = {
41 .constraints = {
42 .name = "rm680_vemmc",
43 .valid_modes_mask = REGULATOR_MODE_NORMAL
44 | REGULATOR_MODE_STANDBY,
45 .valid_ops_mask = REGULATOR_CHANGE_STATUS
46 | REGULATOR_CHANGE_MODE,
47 },
48 .num_consumer_supplies = ARRAY_SIZE(rm680_vemmc_consumers),
49 .consumer_supplies = rm680_vemmc_consumers,
50};
51
52static struct fixed_voltage_config rm680_vemmc_config = {
53 .supply_name = "VEMMC",
54 .microvolts = 2900000,
55 .gpio = 157,
56 .startup_delay = 150,
57 .enable_high = 1,
58 .init_data = &rm680_vemmc,
59};
60
61static struct platform_device rm680_vemmc_device = {
62 .name = "reg-fixed-voltage",
63 .dev = {
64 .platform_data = &rm680_vemmc_config,
65 },
66};
67
68static struct platform_device *rm680_peripherals_devices[] __initdata = {
69 &rm680_vemmc_device,
70};
71
72/* TWL */
73static struct twl4030_gpio_platform_data rm680_gpio_data = {
74 .pullups = BIT(0),
75 .pulldowns = BIT(1) | BIT(2) | BIT(8) | BIT(15),
76};
77
78static struct twl4030_platform_data rm680_twl_data = {
79 .gpio = &rm680_gpio_data,
80 /* add rest of the children here */
81};
82
83static void __init rm680_i2c_init(void)
84{
85 omap3_pmic_get_config(&rm680_twl_data, TWL_COMMON_PDATA_USB, 0);
86 omap_pmic_init(1, 2900, "twl5031", 7 + OMAP_INTC_START, &rm680_twl_data);
87 omap_register_i2c_bus(2, 400, NULL, 0);
88 omap_register_i2c_bus(3, 400, NULL, 0);
89}
90
91#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
92 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
93static struct omap_onenand_platform_data board_onenand_data[] = {
94 {
95 .gpio_irq = 65,
96 .flags = ONENAND_SYNC_READWRITE,
97 }
98};
99#endif
100
101/* eMMC */
102static struct omap2_hsmmc_info mmc[] __initdata = {
103 {
104 .name = "internal",
105 .mmc = 2,
106 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED,
107 .gpio_cd = -EINVAL,
108 .gpio_wp = -EINVAL,
109 },
110 { /* Terminator */ }
111};
112
113static void __init rm680_peripherals_init(void)
114{
115 platform_add_devices(rm680_peripherals_devices,
116 ARRAY_SIZE(rm680_peripherals_devices));
117 rm680_i2c_init();
118 gpmc_onenand_init(board_onenand_data);
119 omap_hsmmc_init(mmc);
120}
121
122#ifdef CONFIG_OMAP_MUX
123static struct omap_board_mux board_mux[] __initdata = {
124 { .reg_offset = OMAP_MUX_TERMINATOR },
125};
126#endif
127
128static void __init rm680_init(void)
129{
130 struct omap_sdrc_params *sdrc_params;
131
132 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
133 omap_serial_init();
134
135 sdrc_params = nokia_get_sdram_timings();
136 omap_sdrc_init(sdrc_params, sdrc_params);
137
138 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
139 usb_musb_init(NULL);
140 rm680_peripherals_init();
141}
142
143MACHINE_START(NOKIA_RM680, "Nokia RM-680 board")
144 .atag_offset = 0x100,
145 .reserve = omap_reserve,
146 .map_io = omap3_map_io,
147 .init_early = omap3630_init_early,
148 .init_irq = omap3_init_irq,
149 .handle_irq = omap3_intc_handle_irq,
150 .init_machine = rm680_init,
151 .init_late = omap3630_init_late,
152 .init_time = omap3_sync32k_timer_init,
153 .restart = omap3xxx_restart,
154MACHINE_END
155
156MACHINE_START(NOKIA_RM696, "Nokia RM-696 board")
157 .atag_offset = 0x100,
158 .reserve = omap_reserve,
159 .map_io = omap3_map_io,
160 .init_early = omap3630_init_early,
161 .init_irq = omap3_init_irq,
162 .handle_irq = omap3_intc_handle_irq,
163 .init_machine = rm680_init,
164 .init_late = omap3630_init_late,
165 .init_time = omap3_sync32k_timer_init,
166 .restart = omap3xxx_restart,
167MACHINE_END
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index c3270c0f1fce..f093af17f5e6 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -57,6 +57,8 @@
57#include "common-board-devices.h" 57#include "common-board-devices.h"
58#include "gpmc.h" 58#include "gpmc.h"
59#include "gpmc-onenand.h" 59#include "gpmc-onenand.h"
60#include "soc.h"
61#include "omap-secure.h"
60 62
61#define SYSTEM_REV_B_USES_VAUX3 0x1699 63#define SYSTEM_REV_B_USES_VAUX3 0x1699
62#define SYSTEM_REV_S_USES_VAUX3 0x8 64#define SYSTEM_REV_S_USES_VAUX3 0x8
@@ -167,64 +169,55 @@ static struct lp55xx_led_config rx51_lp5523_led_config[] = {
167 .name = "lp5523:kb1", 169 .name = "lp5523:kb1",
168 .chan_nr = 0, 170 .chan_nr = 0,
169 .led_current = 50, 171 .led_current = 50,
172 .max_current = 100,
170 }, { 173 }, {
171 .name = "lp5523:kb2", 174 .name = "lp5523:kb2",
172 .chan_nr = 1, 175 .chan_nr = 1,
173 .led_current = 50, 176 .led_current = 50,
177 .max_current = 100,
174 }, { 178 }, {
175 .name = "lp5523:kb3", 179 .name = "lp5523:kb3",
176 .chan_nr = 2, 180 .chan_nr = 2,
177 .led_current = 50, 181 .led_current = 50,
182 .max_current = 100,
178 }, { 183 }, {
179 .name = "lp5523:kb4", 184 .name = "lp5523:kb4",
180 .chan_nr = 3, 185 .chan_nr = 3,
181 .led_current = 50, 186 .led_current = 50,
187 .max_current = 100,
182 }, { 188 }, {
183 .name = "lp5523:b", 189 .name = "lp5523:b",
184 .chan_nr = 4, 190 .chan_nr = 4,
185 .led_current = 50, 191 .led_current = 50,
192 .max_current = 100,
186 }, { 193 }, {
187 .name = "lp5523:g", 194 .name = "lp5523:g",
188 .chan_nr = 5, 195 .chan_nr = 5,
189 .led_current = 50, 196 .led_current = 50,
197 .max_current = 100,
190 }, { 198 }, {
191 .name = "lp5523:r", 199 .name = "lp5523:r",
192 .chan_nr = 6, 200 .chan_nr = 6,
193 .led_current = 50, 201 .led_current = 50,
202 .max_current = 100,
194 }, { 203 }, {
195 .name = "lp5523:kb5", 204 .name = "lp5523:kb5",
196 .chan_nr = 7, 205 .chan_nr = 7,
197 .led_current = 50, 206 .led_current = 50,
207 .max_current = 100,
198 }, { 208 }, {
199 .name = "lp5523:kb6", 209 .name = "lp5523:kb6",
200 .chan_nr = 8, 210 .chan_nr = 8,
201 .led_current = 50, 211 .led_current = 50,
212 .max_current = 100,
202 } 213 }
203}; 214};
204 215
205static int rx51_lp5523_setup(void)
206{
207 return gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
208 "lp5523_enable");
209}
210
211static void rx51_lp5523_release(void)
212{
213 gpio_free(RX51_LP5523_CHIP_EN_GPIO);
214}
215
216static void rx51_lp5523_enable(bool state)
217{
218 gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, !!state);
219}
220
221static struct lp55xx_platform_data rx51_lp5523_platform_data = { 216static struct lp55xx_platform_data rx51_lp5523_platform_data = {
222 .led_config = rx51_lp5523_led_config, 217 .led_config = rx51_lp5523_led_config,
223 .num_channels = ARRAY_SIZE(rx51_lp5523_led_config), 218 .num_channels = ARRAY_SIZE(rx51_lp5523_led_config),
224 .clock_mode = LP55XX_CLOCK_AUTO, 219 .clock_mode = LP55XX_CLOCK_AUTO,
225 .setup_resources = rx51_lp5523_setup, 220 .enable_gpio = RX51_LP5523_CHIP_EN_GPIO,
226 .release_resources = rx51_lp5523_release,
227 .enable = rx51_lp5523_enable,
228}; 221};
229#endif 222#endif
230 223
@@ -1289,6 +1282,22 @@ static void __init rx51_init_twl4030_hwmon(void)
1289 platform_device_register(&madc_hwmon); 1282 platform_device_register(&madc_hwmon);
1290} 1283}
1291 1284
1285static struct platform_device omap3_rom_rng_device = {
1286 .name = "omap3-rom-rng",
1287 .id = -1,
1288 .dev = {
1289 .platform_data = rx51_secure_rng_call,
1290 },
1291};
1292
1293static void __init rx51_init_omap3_rom_rng(void)
1294{
1295 if (omap_type() == OMAP2_DEVICE_TYPE_SEC) {
1296 pr_info("RX-51: Registring OMAP3 HWRNG device\n");
1297 platform_device_register(&omap3_rom_rng_device);
1298 }
1299}
1300
1292void __init rx51_peripherals_init(void) 1301void __init rx51_peripherals_init(void)
1293{ 1302{
1294 rx51_i2c_init(); 1303 rx51_i2c_init();
@@ -1309,5 +1318,6 @@ void __init rx51_peripherals_init(void)
1309 1318
1310 rx51_charger_init(); 1319 rx51_charger_init();
1311 rx51_init_twl4030_hwmon(); 1320 rx51_init_twl4030_hwmon();
1321 rx51_init_omap3_rom_rng();
1312} 1322}
1313 1323
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index 7735105561d8..db168c9627a1 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -2,6 +2,8 @@
2 * Board support file for Nokia N900 (aka RX-51). 2 * Board support file for Nokia N900 (aka RX-51).
3 * 3 *
4 * Copyright (C) 2007, 2008 Nokia 4 * Copyright (C) 2007, 2008 Nokia
5 * Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg>
6 * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com>
5 * 7 *
6 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -31,7 +33,9 @@
31#include "mux.h" 33#include "mux.h"
32#include "gpmc.h" 34#include "gpmc.h"
33#include "pm.h" 35#include "pm.h"
36#include "soc.h"
34#include "sdram-nokia.h" 37#include "sdram-nokia.h"
38#include "omap-secure.h"
35 39
36#define RX51_GPIO_SLEEP_IND 162 40#define RX51_GPIO_SLEEP_IND 162
37 41
@@ -103,6 +107,14 @@ static void __init rx51_init(void)
103 usb_musb_init(&musb_board_data); 107 usb_musb_init(&musb_board_data);
104 rx51_peripherals_init(); 108 rx51_peripherals_init();
105 109
110 if (omap_type() == OMAP2_DEVICE_TYPE_SEC) {
111#ifdef CONFIG_ARM_ERRATA_430973
112 pr_info("RX-51: Enabling ARM errata 430973 workaround\n");
113 /* set IBE to 1 */
114 rx51_secure_update_aux_cr(BIT(6), 0);
115#endif
116 }
117
106 /* Ensure SDRC pins are mux'd for self-refresh */ 118 /* Ensure SDRC pins are mux'd for self-refresh */
107 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 119 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
108 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); 120 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c
deleted file mode 100644
index 42e5f231a799..000000000000
--- a/arch/arm/mach-omap2/board-zoom-debugboard.c
+++ /dev/null
@@ -1,139 +0,0 @@
1/*
2 * Copyright (C) 2009 Texas Instruments Inc.
3 * Mikkel Christensen <mlc@ti.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/kernel.h>
11#include <linux/init.h>
12#include <linux/gpio.h>
13#include <linux/serial_8250.h>
14#include <linux/smsc911x.h>
15#include <linux/interrupt.h>
16
17#include <linux/regulator/fixed.h>
18#include <linux/regulator/machine.h>
19
20#include "gpmc.h"
21#include "gpmc-smsc911x.h"
22
23#include "board-zoom.h"
24
25#include "soc.h"
26#include "common.h"
27
28#define ZOOM_SMSC911X_CS 7
29#define ZOOM_SMSC911X_GPIO 158
30#define ZOOM_QUADUART_CS 3
31#define ZOOM_QUADUART_GPIO 102
32#define ZOOM_QUADUART_RST_GPIO 152
33#define QUART_CLK 1843200
34#define DEBUG_BASE 0x08000000
35#define ZOOM_ETHR_START DEBUG_BASE
36
37static struct omap_smsc911x_platform_data zoom_smsc911x_cfg = {
38 .cs = ZOOM_SMSC911X_CS,
39 .gpio_irq = ZOOM_SMSC911X_GPIO,
40 .gpio_reset = -EINVAL,
41 .flags = SMSC911X_USE_32BIT,
42};
43
44static inline void __init zoom_init_smsc911x(void)
45{
46 gpmc_smsc911x_init(&zoom_smsc911x_cfg);
47}
48
49static struct plat_serial8250_port serial_platform_data[] = {
50 {
51 .mapbase = ZOOM_UART_BASE,
52 .flags = UPF_BOOT_AUTOCONF|UPF_IOREMAP|UPF_SHARE_IRQ,
53 .irqflags = IRQF_SHARED | IRQF_TRIGGER_RISING,
54 .iotype = UPIO_MEM,
55 .regshift = 1,
56 .uartclk = QUART_CLK,
57 }, {
58 .flags = 0
59 }
60};
61
62static struct platform_device zoom_debugboard_serial_device = {
63 .name = "serial8250",
64 .id = PLAT8250_DEV_PLATFORM,
65 .dev = {
66 .platform_data = serial_platform_data,
67 },
68};
69
70static inline void __init zoom_init_quaduart(void)
71{
72 int quart_cs;
73 unsigned long cs_mem_base;
74 int quart_gpio = 0;
75
76 if (gpio_request_one(ZOOM_QUADUART_RST_GPIO,
77 GPIOF_OUT_INIT_LOW,
78 "TL16CP754C GPIO") < 0) {
79 pr_err("Failed to request GPIO%d for TL16CP754C\n",
80 ZOOM_QUADUART_RST_GPIO);
81 return;
82 }
83
84 quart_cs = ZOOM_QUADUART_CS;
85
86 if (gpmc_cs_request(quart_cs, SZ_1M, &cs_mem_base) < 0) {
87 pr_err("Failed to request GPMC mem for Quad UART(TL16CP754C)\n");
88 return;
89 }
90
91 quart_gpio = ZOOM_QUADUART_GPIO;
92
93 if (gpio_request_one(quart_gpio, GPIOF_IN, "TL16CP754C GPIO") < 0)
94 printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n",
95 quart_gpio);
96
97 serial_platform_data[0].irq = gpio_to_irq(102);
98}
99
100static inline int omap_zoom_debugboard_detect(void)
101{
102 int debug_board_detect = 0;
103 int ret = 1;
104
105 debug_board_detect = ZOOM_SMSC911X_GPIO;
106
107 if (gpio_request_one(debug_board_detect, GPIOF_IN,
108 "Zoom debug board detect") < 0) {
109 pr_err("Failed to request GPIO%d for Zoom debug board detect\n",
110 debug_board_detect);
111 return 0;
112 }
113
114 if (!gpio_get_value(debug_board_detect)) {
115 ret = 0;
116 }
117 gpio_free(debug_board_detect);
118 return ret;
119}
120
121static struct platform_device *zoom_devices[] __initdata = {
122 &zoom_debugboard_serial_device,
123};
124
125static struct regulator_consumer_supply dummy_supplies[] = {
126 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
127 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
128};
129
130int __init zoom_debugboard_init(void)
131{
132 if (!omap_zoom_debugboard_detect())
133 return 0;
134
135 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
136 zoom_init_smsc911x();
137 zoom_init_quaduart();
138 return platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices));
139}
diff --git a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c
deleted file mode 100644
index 3d8ecc1e05bd..000000000000
--- a/arch/arm/mach-omap2/board-zoom-display.c
+++ /dev/null
@@ -1,71 +0,0 @@
1/*
2 * Copyright (C) 2010 Texas Instruments Inc.
3 *
4 * Modified from mach-omap2/board-zoom-peripherals.c
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/gpio.h>
15#include <linux/spi/spi.h>
16#include <linux/platform_data/spi-omap2-mcspi.h>
17#include <video/omapdss.h>
18#include <video/omap-panel-data.h>
19
20#include "board-zoom.h"
21#include "soc.h"
22#include "common.h"
23
24#define LCD_PANEL_RESET_GPIO_PROD 96
25#define LCD_PANEL_RESET_GPIO_PILOT 55
26#define LCD_PANEL_QVGA_GPIO 56
27
28static struct panel_nec_nl8048hl11_platform_data zoom_lcd_pdata = {
29 .name = "lcd",
30 .source = "dpi.0",
31
32 .data_lines = 24,
33
34 .res_gpio = -1, /* filled in code */
35 .qvga_gpio = LCD_PANEL_QVGA_GPIO,
36};
37
38static struct omap_dss_board_info zoom_dss_data = {
39 .default_display_name = "lcd",
40};
41
42static void __init zoom_lcd_panel_init(void)
43{
44 zoom_lcd_pdata.res_gpio = (omap_rev() > OMAP3430_REV_ES3_0) ?
45 LCD_PANEL_RESET_GPIO_PROD :
46 LCD_PANEL_RESET_GPIO_PILOT;
47}
48
49static struct omap2_mcspi_device_config dss_lcd_mcspi_config = {
50 .turbo_mode = 1,
51};
52
53static struct spi_board_info nec_8048_spi_board_info[] __initdata = {
54 [0] = {
55 .modalias = "panel-nec-nl8048hl11",
56 .bus_num = 1,
57 .chip_select = 2,
58 .max_speed_hz = 375000,
59 .controller_data = &dss_lcd_mcspi_config,
60 .platform_data = &zoom_lcd_pdata,
61 },
62};
63
64void __init zoom_display_init(void)
65{
66 omap_display_init(&zoom_dss_data);
67 zoom_lcd_panel_init();
68 spi_register_board_info(nec_8048_spi_board_info,
69 ARRAY_SIZE(nec_8048_spi_board_info));
70}
71
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
deleted file mode 100644
index a90375d5b2b6..000000000000
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ /dev/null
@@ -1,360 +0,0 @@
1/*
2 * Copyright (C) 2009 Texas Instruments Inc.
3 *
4 * Modified from mach-omap2/board-zoom2.c
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/input.h>
15#include <linux/input/matrix_keypad.h>
16#include <linux/gpio.h>
17#include <linux/i2c/twl.h>
18#include <linux/regulator/machine.h>
19#include <linux/regulator/fixed.h>
20#include <linux/wl12xx.h>
21#include <linux/mmc/host.h>
22#include <linux/platform_data/gpio-omap.h>
23#include <linux/platform_data/omap-twl4030.h>
24#include <linux/usb/phy.h>
25#include <linux/pwm.h>
26#include <linux/leds_pwm.h>
27#include <linux/pwm_backlight.h>
28
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31#include <asm/mach/map.h>
32
33#include "common.h"
34
35#include "board-zoom.h"
36
37#include "mux.h"
38#include "hsmmc.h"
39#include "common-board-devices.h"
40
41#define OMAP_ZOOM_WLAN_PMENA_GPIO (101)
42#define OMAP_ZOOM_TSC2004_IRQ_GPIO (153)
43#define OMAP_ZOOM_WLAN_IRQ_GPIO (162)
44
45/* Zoom2 has Qwerty keyboard*/
46static uint32_t board_keymap[] = {
47 KEY(0, 0, KEY_E),
48 KEY(0, 1, KEY_R),
49 KEY(0, 2, KEY_T),
50 KEY(0, 3, KEY_HOME),
51 KEY(0, 6, KEY_I),
52 KEY(0, 7, KEY_LEFTSHIFT),
53 KEY(1, 0, KEY_D),
54 KEY(1, 1, KEY_F),
55 KEY(1, 2, KEY_G),
56 KEY(1, 3, KEY_SEND),
57 KEY(1, 6, KEY_K),
58 KEY(1, 7, KEY_ENTER),
59 KEY(2, 0, KEY_X),
60 KEY(2, 1, KEY_C),
61 KEY(2, 2, KEY_V),
62 KEY(2, 3, KEY_END),
63 KEY(2, 6, KEY_DOT),
64 KEY(2, 7, KEY_CAPSLOCK),
65 KEY(3, 0, KEY_Z),
66 KEY(3, 1, KEY_KPPLUS),
67 KEY(3, 2, KEY_B),
68 KEY(3, 3, KEY_F1),
69 KEY(3, 6, KEY_O),
70 KEY(3, 7, KEY_SPACE),
71 KEY(4, 0, KEY_W),
72 KEY(4, 1, KEY_Y),
73 KEY(4, 2, KEY_U),
74 KEY(4, 3, KEY_F2),
75 KEY(4, 4, KEY_VOLUMEUP),
76 KEY(4, 6, KEY_L),
77 KEY(4, 7, KEY_LEFT),
78 KEY(5, 0, KEY_S),
79 KEY(5, 1, KEY_H),
80 KEY(5, 2, KEY_J),
81 KEY(5, 3, KEY_F3),
82 KEY(5, 4, KEY_UNKNOWN),
83 KEY(5, 5, KEY_VOLUMEDOWN),
84 KEY(5, 6, KEY_M),
85 KEY(5, 7, KEY_RIGHT),
86 KEY(6, 0, KEY_Q),
87 KEY(6, 1, KEY_A),
88 KEY(6, 2, KEY_N),
89 KEY(6, 3, KEY_BACKSPACE),
90 KEY(6, 6, KEY_P),
91 KEY(6, 7, KEY_UP),
92 KEY(7, 0, KEY_PROG1), /*MACRO 1 <User defined> */
93 KEY(7, 1, KEY_PROG2), /*MACRO 2 <User defined> */
94 KEY(7, 2, KEY_PROG3), /*MACRO 3 <User defined> */
95 KEY(7, 3, KEY_PROG4), /*MACRO 4 <User defined> */
96 KEY(7, 6, KEY_SELECT),
97 KEY(7, 7, KEY_DOWN)
98};
99
100static struct matrix_keymap_data board_map_data = {
101 .keymap = board_keymap,
102 .keymap_size = ARRAY_SIZE(board_keymap),
103};
104
105static struct twl4030_keypad_data zoom_kp_twl4030_data = {
106 .keymap_data = &board_map_data,
107 .rows = 8,
108 .cols = 8,
109 .rep = 1,
110};
111
112static struct regulator_consumer_supply zoom_vmmc1_supply[] = {
113 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
114};
115
116static struct regulator_consumer_supply zoom_vsim_supply[] = {
117 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"),
118};
119
120static struct regulator_consumer_supply zoom_vmmc2_supply[] = {
121 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
122};
123
124static struct regulator_consumer_supply zoom_vmmc3_supply[] = {
125 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.2"),
126};
127
128/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
129static struct regulator_init_data zoom_vmmc1 = {
130 .constraints = {
131 .min_uV = 1850000,
132 .max_uV = 3150000,
133 .valid_modes_mask = REGULATOR_MODE_NORMAL
134 | REGULATOR_MODE_STANDBY,
135 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
136 | REGULATOR_CHANGE_MODE
137 | REGULATOR_CHANGE_STATUS,
138 },
139 .num_consumer_supplies = ARRAY_SIZE(zoom_vmmc1_supply),
140 .consumer_supplies = zoom_vmmc1_supply,
141};
142
143/* VMMC2 for MMC2 card */
144static struct regulator_init_data zoom_vmmc2 = {
145 .constraints = {
146 .min_uV = 1850000,
147 .max_uV = 1850000,
148 .apply_uV = true,
149 .valid_modes_mask = REGULATOR_MODE_NORMAL
150 | REGULATOR_MODE_STANDBY,
151 .valid_ops_mask = REGULATOR_CHANGE_MODE
152 | REGULATOR_CHANGE_STATUS,
153 },
154 .num_consumer_supplies = ARRAY_SIZE(zoom_vmmc2_supply),
155 .consumer_supplies = zoom_vmmc2_supply,
156};
157
158/* VSIM for OMAP VDD_MMC1A (i/o for DAT4..DAT7) */
159static struct regulator_init_data zoom_vsim = {
160 .constraints = {
161 .min_uV = 1800000,
162 .max_uV = 3000000,
163 .valid_modes_mask = REGULATOR_MODE_NORMAL
164 | REGULATOR_MODE_STANDBY,
165 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
166 | REGULATOR_CHANGE_MODE
167 | REGULATOR_CHANGE_STATUS,
168 },
169 .num_consumer_supplies = ARRAY_SIZE(zoom_vsim_supply),
170 .consumer_supplies = zoom_vsim_supply,
171};
172
173static struct regulator_init_data zoom_vmmc3 = {
174 .constraints = {
175 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
176 },
177 .num_consumer_supplies = ARRAY_SIZE(zoom_vmmc3_supply),
178 .consumer_supplies = zoom_vmmc3_supply,
179};
180
181static struct fixed_voltage_config zoom_vwlan = {
182 .supply_name = "vwl1271",
183 .microvolts = 1800000, /* 1.8V */
184 .gpio = OMAP_ZOOM_WLAN_PMENA_GPIO,
185 .startup_delay = 70000, /* 70msec */
186 .enable_high = 1,
187 .enabled_at_boot = 0,
188 .init_data = &zoom_vmmc3,
189};
190
191static struct platform_device omap_vwlan_device = {
192 .name = "reg-fixed-voltage",
193 .id = 1,
194 .dev = {
195 .platform_data = &zoom_vwlan,
196 },
197};
198
199static struct pwm_lookup zoom_pwm_lookup[] = {
200 PWM_LOOKUP("twl-pwm", 0, "leds_pwm", "zoom::keypad"),
201 PWM_LOOKUP("twl-pwm", 1, "pwm-backlight", "backlight"),
202};
203
204static struct led_pwm zoom_pwm_leds[] = {
205 {
206 .name = "zoom::keypad",
207 .max_brightness = 127,
208 .pwm_period_ns = 7812500,
209 },
210};
211
212static struct led_pwm_platform_data zoom_pwm_data = {
213 .num_leds = ARRAY_SIZE(zoom_pwm_leds),
214 .leds = zoom_pwm_leds,
215};
216
217static struct platform_device zoom_leds_pwm = {
218 .name = "leds_pwm",
219 .id = -1,
220 .dev = {
221 .platform_data = &zoom_pwm_data,
222 },
223};
224
225static struct platform_pwm_backlight_data zoom_backlight_data = {
226 .pwm_id = 1,
227 .max_brightness = 127,
228 .dft_brightness = 127,
229 .pwm_period_ns = 7812500,
230};
231
232static struct platform_device zoom_backlight_pwm = {
233 .name = "pwm-backlight",
234 .id = -1,
235 .dev = {
236 .platform_data = &zoom_backlight_data,
237 },
238};
239
240static struct platform_device *zoom_devices[] __initdata = {
241 &omap_vwlan_device,
242 &zoom_leds_pwm,
243 &zoom_backlight_pwm,
244};
245
246static struct wl12xx_platform_data omap_zoom_wlan_data __initdata = {
247 .board_ref_clock = WL12XX_REFCLOCK_26, /* 26 MHz */
248};
249
250static struct omap2_hsmmc_info mmc[] = {
251 {
252 .name = "external",
253 .mmc = 1,
254 .caps = MMC_CAP_4_BIT_DATA,
255 .gpio_wp = -EINVAL,
256 .power_saving = true,
257 .deferred = true,
258 },
259 {
260 .name = "internal",
261 .mmc = 2,
262 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
263 .gpio_cd = -EINVAL,
264 .gpio_wp = -EINVAL,
265 .nonremovable = true,
266 .power_saving = true,
267 },
268 {
269 .name = "wl1271",
270 .mmc = 3,
271 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
272 .gpio_wp = -EINVAL,
273 .gpio_cd = -EINVAL,
274 .nonremovable = true,
275 },
276 {} /* Terminator */
277};
278
279static struct omap_tw4030_pdata omap_twl4030_audio_data = {
280 .voice_connected = true,
281 .custom_routing = true,
282
283 .has_hs = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT,
284 .has_hf = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT,
285
286 .has_mainmic = true,
287 .has_submic = true,
288 .has_hsmic = true,
289 .has_linein = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT,
290};
291
292static int zoom_twl_gpio_setup(struct device *dev,
293 unsigned gpio, unsigned ngpio)
294{
295 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
296 mmc[0].gpio_cd = gpio + 0;
297 omap_hsmmc_late_init(mmc);
298
299 /* Audio setup */
300 omap_twl4030_audio_data.jack_detect = gpio + 2;
301 omap_twl4030_audio_init("Zoom2", &omap_twl4030_audio_data);
302
303 return 0;
304}
305
306static struct twl4030_gpio_platform_data zoom_gpio_data = {
307 .setup = zoom_twl_gpio_setup,
308};
309
310static struct twl4030_platform_data zoom_twldata = {
311 /* platform_data for children goes here */
312 .gpio = &zoom_gpio_data,
313 .keypad = &zoom_kp_twl4030_data,
314 .vmmc1 = &zoom_vmmc1,
315 .vmmc2 = &zoom_vmmc2,
316 .vsim = &zoom_vsim,
317};
318
319static int __init omap_i2c_init(void)
320{
321 omap3_pmic_get_config(&zoom_twldata,
322 TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_BCI |
323 TWL_COMMON_PDATA_MADC | TWL_COMMON_PDATA_AUDIO,
324 TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
325
326 if (machine_is_omap_zoom2())
327 zoom_twldata.audio->codec->ramp_delay_value = 3; /* 161 ms */
328
329 omap_pmic_init(1, 2400, "twl5030", 7 + OMAP_INTC_START, &zoom_twldata);
330 omap_register_i2c_bus(2, 400, NULL, 0);
331 omap_register_i2c_bus(3, 400, NULL, 0);
332 return 0;
333}
334
335static void enable_board_wakeup_source(void)
336{
337 /* T2 interrupt line (keypad) */
338 omap_mux_init_signal("sys_nirq",
339 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
340}
341
342void __init zoom_peripherals_init(void)
343{
344 int ret;
345
346 omap_zoom_wlan_data.irq = gpio_to_irq(OMAP_ZOOM_WLAN_IRQ_GPIO);
347 ret = wl12xx_set_platform_data(&omap_zoom_wlan_data);
348
349 if (ret)
350 pr_err("error setting wl12xx data: %d\n", ret);
351
352 omap_hsmmc_init(mmc);
353 omap_i2c_init();
354 pwm_add_table(zoom_pwm_lookup, ARRAY_SIZE(zoom_pwm_lookup));
355 platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices));
356 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
357 usb_musb_init(NULL);
358 enable_board_wakeup_source();
359 omap_serial_init();
360}
diff --git a/arch/arm/mach-omap2/board-zoom.c b/arch/arm/mach-omap2/board-zoom.c
deleted file mode 100644
index 1a3dd865d8eb..000000000000
--- a/arch/arm/mach-omap2/board-zoom.c
+++ /dev/null
@@ -1,159 +0,0 @@
1/*
2 * Copyright (C) 2009-2010 Texas Instruments Inc.
3 * Mikkel Christensen <mlc@ti.com>
4 * Felipe Balbi <balbi@ti.com>
5 *
6 * Modified from mach-omap2/board-ldp.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
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/input.h>
17#include <linux/gpio.h>
18#include <linux/i2c/twl.h>
19#include <linux/mtd/nand.h>
20
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23
24#include "common.h"
25
26#include "board-zoom.h"
27
28#include "board-flash.h"
29#include "mux.h"
30#include "sdram-micron-mt46h32m32lf-6.h"
31#include "sdram-hynix-h8mbx00u0mer-0em.h"
32
33#define ZOOM3_EHCI_RESET_GPIO 64
34
35#ifdef CONFIG_OMAP_MUX
36static struct omap_board_mux board_mux[] __initdata = {
37 /* WLAN IRQ - GPIO 162 */
38 OMAP3_MUX(MCBSP1_CLKX, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
39 /* WLAN POWER ENABLE - GPIO 101 */
40 OMAP3_MUX(CAM_D2, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
41 /* WLAN SDIO: MMC3 CMD */
42 OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE3 | OMAP_PIN_INPUT_PULLUP),
43 /* WLAN SDIO: MMC3 CLK */
44 OMAP3_MUX(ETK_CLK, OMAP_MUX_MODE2 | OMAP_PIN_INPUT_PULLUP),
45 /* WLAN SDIO: MMC3 DAT[0-3] */
46 OMAP3_MUX(ETK_D3, OMAP_MUX_MODE2 | OMAP_PIN_INPUT_PULLUP),
47 OMAP3_MUX(ETK_D4, OMAP_MUX_MODE2 | OMAP_PIN_INPUT_PULLUP),
48 OMAP3_MUX(ETK_D5, OMAP_MUX_MODE2 | OMAP_PIN_INPUT_PULLUP),
49 OMAP3_MUX(ETK_D6, OMAP_MUX_MODE2 | OMAP_PIN_INPUT_PULLUP),
50 { .reg_offset = OMAP_MUX_TERMINATOR },
51};
52#endif
53
54static struct mtd_partition zoom_nand_partitions[] = {
55 /* All the partition sizes are listed in terms of NAND block size */
56 {
57 .name = "X-Loader-NAND",
58 .offset = 0,
59 .size = 4 * (64 * 2048), /* 512KB, 0x80000 */
60 .mask_flags = MTD_WRITEABLE, /* force read-only */
61 },
62 {
63 .name = "U-Boot-NAND",
64 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
65 .size = 10 * (64 * 2048), /* 1.25MB, 0x140000 */
66 .mask_flags = MTD_WRITEABLE, /* force read-only */
67 },
68 {
69 .name = "Boot Env-NAND",
70 .offset = MTDPART_OFS_APPEND, /* Offset = 0x1c0000 */
71 .size = 2 * (64 * 2048), /* 256KB, 0x40000 */
72 },
73 {
74 .name = "Kernel-NAND",
75 .offset = MTDPART_OFS_APPEND, /* Offset = 0x0200000*/
76 .size = 240 * (64 * 2048), /* 30M, 0x1E00000 */
77 },
78 {
79 .name = "system",
80 .offset = MTDPART_OFS_APPEND, /* Offset = 0x2000000 */
81 .size = 3328 * (64 * 2048), /* 416M, 0x1A000000 */
82 },
83 {
84 .name = "userdata",
85 .offset = MTDPART_OFS_APPEND, /* Offset = 0x1C000000*/
86 .size = 256 * (64 * 2048), /* 32M, 0x2000000 */
87 },
88 {
89 .name = "cache",
90 .offset = MTDPART_OFS_APPEND, /* Offset = 0x1E000000*/
91 .size = 256 * (64 * 2048), /* 32M, 0x2000000 */
92 },
93};
94
95static struct usbhs_phy_data phy_data[] __initdata = {
96 {
97 .port = 2,
98 .reset_gpio = ZOOM3_EHCI_RESET_GPIO,
99 .vcc_gpio = -EINVAL,
100 },
101};
102
103static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
104 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
105};
106
107static void __init omap_zoom_init(void)
108{
109 if (machine_is_omap_zoom2()) {
110 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
111 } else if (machine_is_omap_zoom3()) {
112 omap3_mux_init(board_mux, OMAP_PACKAGE_CBP);
113 omap_mux_init_gpio(ZOOM3_EHCI_RESET_GPIO, OMAP_PIN_OUTPUT);
114
115 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
116 usbhs_init(&usbhs_bdata);
117 }
118
119 board_nand_init(zoom_nand_partitions,
120 ARRAY_SIZE(zoom_nand_partitions), ZOOM_NAND_CS,
121 NAND_BUSWIDTH_16, nand_default_timings);
122 zoom_debugboard_init();
123 zoom_peripherals_init();
124
125 if (machine_is_omap_zoom2())
126 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
127 mt46h32m32lf6_sdrc_params);
128 else if (machine_is_omap_zoom3())
129 omap_sdrc_init(h8mbx00u0mer0em_sdrc_params,
130 h8mbx00u0mer0em_sdrc_params);
131
132 zoom_display_init();
133}
134
135MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
136 .atag_offset = 0x100,
137 .reserve = omap_reserve,
138 .map_io = omap3_map_io,
139 .init_early = omap3430_init_early,
140 .init_irq = omap3_init_irq,
141 .handle_irq = omap3_intc_handle_irq,
142 .init_machine = omap_zoom_init,
143 .init_late = omap3430_init_late,
144 .init_time = omap3_sync32k_timer_init,
145 .restart = omap3xxx_restart,
146MACHINE_END
147
148MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
149 .atag_offset = 0x100,
150 .reserve = omap_reserve,
151 .map_io = omap3_map_io,
152 .init_early = omap3630_init_early,
153 .init_irq = omap3_init_irq,
154 .handle_irq = omap3_intc_handle_irq,
155 .init_machine = omap_zoom_init,
156 .init_late = omap3630_init_late,
157 .init_time = omap3_sync32k_timer_init,
158 .restart = omap3xxx_restart,
159MACHINE_END
diff --git a/arch/arm/mach-omap2/board-zoom.h b/arch/arm/mach-omap2/board-zoom.h
deleted file mode 100644
index 2e9486940ead..000000000000
--- a/arch/arm/mach-omap2/board-zoom.h
+++ /dev/null
@@ -1,10 +0,0 @@
1/*
2 * Defines for zoom boards
3 */
4#include <video/omapdss.h>
5
6#define ZOOM_NAND_CS 0
7
8extern int __init zoom_debugboard_init(void);
9extern void __init zoom_peripherals_init(void);
10extern void __init zoom_display_init(void);
diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c
index 334b76745900..03a2829beb8e 100644
--- a/arch/arm/mach-omap2/cclock3xxx_data.c
+++ b/arch/arm/mach-omap2/cclock3xxx_data.c
@@ -3275,6 +3275,7 @@ static struct omap_clk omap36xx_clks[] = {
3275static struct omap_clk omap34xx_omap36xx_clks[] = { 3275static struct omap_clk omap34xx_omap36xx_clks[] = {
3276 CLK(NULL, "aes1_ick", &aes1_ick), 3276 CLK(NULL, "aes1_ick", &aes1_ick),
3277 CLK("omap_rng", "ick", &rng_ick), 3277 CLK("omap_rng", "ick", &rng_ick),
3278 CLK("omap3-rom-rng", "ick", &rng_ick),
3278 CLK(NULL, "sha11_ick", &sha11_ick), 3279 CLK(NULL, "sha11_ick", &sha11_ick),
3279 CLK(NULL, "des1_ick", &des1_ick), 3280 CLK(NULL, "des1_ick", &des1_ick),
3280 CLK(NULL, "cam_mclk", &cam_mclk), 3281 CLK(NULL, "cam_mclk", &cam_mclk),
diff --git a/arch/arm/mach-omap2/cclock44xx_data.c b/arch/arm/mach-omap2/cclock44xx_data.c
index 1d5b5290d2af..b237950eb8a3 100644
--- a/arch/arm/mach-omap2/cclock44xx_data.c
+++ b/arch/arm/mach-omap2/cclock44xx_data.c
@@ -1632,7 +1632,7 @@ static struct omap_clk omap44xx_clks[] = {
1632 CLK(NULL, "auxclk5_src_ck", &auxclk5_src_ck), 1632 CLK(NULL, "auxclk5_src_ck", &auxclk5_src_ck),
1633 CLK(NULL, "auxclk5_ck", &auxclk5_ck), 1633 CLK(NULL, "auxclk5_ck", &auxclk5_ck),
1634 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck), 1634 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck),
1635 CLK("omap-gpmc", "fck", &dummy_ck), 1635 CLK("50000000.gpmc", "fck", &dummy_ck),
1636 CLK("omap_i2c.1", "ick", &dummy_ck), 1636 CLK("omap_i2c.1", "ick", &dummy_ck),
1637 CLK("omap_i2c.2", "ick", &dummy_ck), 1637 CLK("omap_i2c.2", "ick", &dummy_ck),
1638 CLK("omap_i2c.3", "ick", &dummy_ck), 1638 CLK("omap_i2c.3", "ick", &dummy_ck),
diff --git a/arch/arm/mach-omap2/clkt2xxx_apll.c b/arch/arm/mach-omap2/clkt2xxx_apll.c
index 25b1feed480d..c78e893eba7d 100644
--- a/arch/arm/mach-omap2/clkt2xxx_apll.c
+++ b/arch/arm/mach-omap2/clkt2xxx_apll.c
@@ -52,7 +52,7 @@ static bool omap2xxx_clk_apll_locked(struct clk_hw *hw)
52 52
53 apll_mask = EN_APLL_LOCKED << clk->enable_bit; 53 apll_mask = EN_APLL_LOCKED << clk->enable_bit;
54 54
55 r = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN); 55 r = omap2xxx_cm_get_pll_status();
56 56
57 return ((r & apll_mask) == apll_mask) ? true : false; 57 return ((r & apll_mask) == apll_mask) ? true : false;
58} 58}
@@ -126,7 +126,7 @@ u32 omap2xxx_get_apll_clkin(void)
126{ 126{
127 u32 aplls, srate = 0; 127 u32 aplls, srate = 0;
128 128
129 aplls = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL1); 129 aplls = omap2xxx_cm_get_pll_config();
130 aplls &= OMAP24XX_APLLS_CLKIN_MASK; 130 aplls &= OMAP24XX_APLLS_CLKIN_MASK;
131 aplls >>= OMAP24XX_APLLS_CLKIN_SHIFT; 131 aplls >>= OMAP24XX_APLLS_CLKIN_SHIFT;
132 132
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
index d8620105c42a..3ff32543493c 100644
--- a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
+++ b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
@@ -60,8 +60,7 @@ unsigned long omap2xxx_clk_get_core_rate(void)
60 60
61 core_clk = omap2_get_dpll_rate(dpll_core_ck); 61 core_clk = omap2_get_dpll_rate(dpll_core_ck);
62 62
63 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); 63 v = omap2xxx_cm_get_core_clk_src();
64 v &= OMAP24XX_CORE_CLK_SRC_MASK;
65 64
66 if (v == CORE_CLK_SRC_32K) 65 if (v == CORE_CLK_SRC_32K)
67 core_clk = 32768; 66 core_clk = 32768;
@@ -79,8 +78,7 @@ static long omap2_dpllcore_round_rate(unsigned long target_rate)
79{ 78{
80 u32 high, low, core_clk_src; 79 u32 high, low, core_clk_src;
81 80
82 core_clk_src = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); 81 core_clk_src = omap2xxx_cm_get_core_clk_src();
83 core_clk_src &= OMAP24XX_CORE_CLK_SRC_MASK;
84 82
85 if (core_clk_src == CORE_CLK_SRC_DPLL) { /* DPLL clockout */ 83 if (core_clk_src == CORE_CLK_SRC_DPLL) { /* DPLL clockout */
86 high = curr_prcm_set->dpll_speed * 2; 84 high = curr_prcm_set->dpll_speed * 2;
@@ -120,8 +118,7 @@ int omap2_reprogram_dpllcore(struct clk_hw *hw, unsigned long rate,
120 const struct dpll_data *dd; 118 const struct dpll_data *dd;
121 119
122 cur_rate = omap2xxx_clk_get_core_rate(); 120 cur_rate = omap2xxx_clk_get_core_rate();
123 mult = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); 121 mult = omap2xxx_cm_get_core_clk_src();
124 mult &= OMAP24XX_CORE_CLK_SRC_MASK;
125 122
126 if ((rate == (cur_rate / 2)) && (mult == 2)) { 123 if ((rate == (cur_rate / 2)) && (mult == 2)) {
127 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1); 124 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1);
@@ -145,7 +142,7 @@ int omap2_reprogram_dpllcore(struct clk_hw *hw, unsigned long rate,
145 tmpset.cm_clksel1_pll &= ~(dd->mult_mask | 142 tmpset.cm_clksel1_pll &= ~(dd->mult_mask |
146 dd->div1_mask); 143 dd->div1_mask);
147 div = ((curr_prcm_set->xtal_speed / 1000000) - 1); 144 div = ((curr_prcm_set->xtal_speed / 1000000) - 1);
148 tmpset.cm_clksel2_pll = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); 145 tmpset.cm_clksel2_pll = omap2xxx_cm_get_core_pll_config();
149 tmpset.cm_clksel2_pll &= ~OMAP24XX_CORE_CLK_SRC_MASK; 146 tmpset.cm_clksel2_pll &= ~OMAP24XX_CORE_CLK_SRC_MASK;
150 if (rate > low) { 147 if (rate > low) {
151 tmpset.cm_clksel2_pll |= CORE_CLK_SRC_DPLL_X2; 148 tmpset.cm_clksel2_pll |= CORE_CLK_SRC_DPLL_X2;
diff --git a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
index ae2b35e76dc8..b935ed2922d8 100644
--- a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
+++ b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
@@ -98,7 +98,7 @@ long omap2_round_to_table_rate(struct clk_hw *hw, unsigned long rate,
98int omap2_select_table_rate(struct clk_hw *hw, unsigned long rate, 98int omap2_select_table_rate(struct clk_hw *hw, unsigned long rate,
99 unsigned long parent_rate) 99 unsigned long parent_rate)
100{ 100{
101 u32 cur_rate, done_rate, bypass = 0, tmp; 101 u32 cur_rate, done_rate, bypass = 0;
102 const struct prcm_config *prcm; 102 const struct prcm_config *prcm;
103 unsigned long found_speed = 0; 103 unsigned long found_speed = 0;
104 unsigned long flags; 104 unsigned long flags;
@@ -141,23 +141,11 @@ int omap2_select_table_rate(struct clk_hw *hw, unsigned long rate,
141 else 141 else
142 done_rate = CORE_CLK_SRC_DPLL; 142 done_rate = CORE_CLK_SRC_DPLL;
143 143
144 /* MPU divider */ 144 omap2xxx_cm_set_mod_dividers(prcm->cm_clksel_mpu,
145 omap2_cm_write_mod_reg(prcm->cm_clksel_mpu, MPU_MOD, CM_CLKSEL); 145 prcm->cm_clksel_dsp,
146 146 prcm->cm_clksel_gfx,
147 /* dsp + iva1 div(2420), iva2.1(2430) */ 147 prcm->cm_clksel1_core,
148 omap2_cm_write_mod_reg(prcm->cm_clksel_dsp, 148 prcm->cm_clksel_mdm);
149 OMAP24XX_DSP_MOD, CM_CLKSEL);
150
151 omap2_cm_write_mod_reg(prcm->cm_clksel_gfx, GFX_MOD, CM_CLKSEL);
152
153 /* Major subsystem dividers */
154 tmp = omap2_cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) & OMAP24XX_CLKSEL_DSS2_MASK;
155 omap2_cm_write_mod_reg(prcm->cm_clksel1_core | tmp, CORE_MOD,
156 CM_CLKSEL1);
157
158 if (cpu_is_omap2430())
159 omap2_cm_write_mod_reg(prcm->cm_clksel_mdm,
160 OMAP2430_MDM_MOD, CM_CLKSEL);
161 149
162 /* x2 to enter omap2xxx_sdrc_init_params() */ 150 /* x2 to enter omap2xxx_sdrc_init_params() */
163 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL_X2, 1); 151 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL_X2, 1);
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 0c38ca96c840..c7c5d31e9082 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -543,6 +543,44 @@ int omap2_clk_disable_autoidle_all(void)
543} 543}
544 544
545/** 545/**
546 * omap2_clk_deny_idle - disable autoidle on an OMAP clock
547 * @clk: struct clk * to disable autoidle for
548 *
549 * Disable autoidle on an OMAP clock.
550 */
551int omap2_clk_deny_idle(struct clk *clk)
552{
553 struct clk_hw_omap *c;
554
555 if (__clk_get_flags(clk) & CLK_IS_BASIC)
556 return -EINVAL;
557
558 c = to_clk_hw_omap(__clk_get_hw(clk));
559 if (c->ops && c->ops->deny_idle)
560 c->ops->deny_idle(c);
561 return 0;
562}
563
564/**
565 * omap2_clk_allow_idle - enable autoidle on an OMAP clock
566 * @clk: struct clk * to enable autoidle for
567 *
568 * Enable autoidle on an OMAP clock.
569 */
570int omap2_clk_allow_idle(struct clk *clk)
571{
572 struct clk_hw_omap *c;
573
574 if (__clk_get_flags(clk) & CLK_IS_BASIC)
575 return -EINVAL;
576
577 c = to_clk_hw_omap(__clk_get_hw(clk));
578 if (c->ops && c->ops->allow_idle)
579 c->ops->allow_idle(c);
580 return 0;
581}
582
583/**
546 * omap2_clk_enable_init_clocks - prepare & enable a list of clocks 584 * omap2_clk_enable_init_clocks - prepare & enable a list of clocks
547 * @clk_names: ptr to an array of strings of clock names to enable 585 * @clk_names: ptr to an array of strings of clock names to enable
548 * @num_clocks: number of clock names in @clk_names 586 * @num_clocks: number of clock names in @clk_names
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 7aa32cd292f9..82916cc82c92 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -411,6 +411,8 @@ void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk,
411void omap2_init_clk_hw_omap_clocks(struct clk *clk); 411void omap2_init_clk_hw_omap_clocks(struct clk *clk);
412int omap2_clk_enable_autoidle_all(void); 412int omap2_clk_enable_autoidle_all(void);
413int omap2_clk_disable_autoidle_all(void); 413int omap2_clk_disable_autoidle_all(void);
414int omap2_clk_allow_idle(struct clk *clk);
415int omap2_clk_deny_idle(struct clk *clk);
414void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks); 416void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks);
415int omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name); 417int omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name);
416void omap2_clk_print_new_rates(const char *hfclkin_ck_name, 418void omap2_clk_print_new_rates(const char *hfclkin_ck_name,
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index 4b03394fa0c5..f17f00697cc0 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -132,7 +132,7 @@ struct clockdomain {
132 u8 _flags; 132 u8 _flags;
133 const u8 dep_bit; 133 const u8 dep_bit;
134 const u8 prcm_partition; 134 const u8 prcm_partition;
135 const s16 cm_inst; 135 const u16 cm_inst;
136 const u16 clkdm_offs; 136 const u16 clkdm_offs;
137 struct clkdm_dep *wkdep_srcs; 137 struct clkdm_dep *wkdep_srcs;
138 struct clkdm_dep *sleepdep_srcs; 138 struct clkdm_dep *sleepdep_srcs;
@@ -218,6 +218,7 @@ extern 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); 219extern void __init omap54xx_clockdomains_init(void);
220extern void __init dra7xx_clockdomains_init(void); 220extern void __init dra7xx_clockdomains_init(void);
221void am43xx_clockdomains_init(void);
221 222
222extern void clkdm_add_autodeps(struct clockdomain *clkdm); 223extern void clkdm_add_autodeps(struct clockdomain *clkdm);
223extern void clkdm_del_autodeps(struct clockdomain *clkdm); 224extern void clkdm_del_autodeps(struct clockdomain *clkdm);
@@ -226,6 +227,7 @@ extern struct clkdm_ops omap2_clkdm_operations;
226extern struct clkdm_ops omap3_clkdm_operations; 227extern struct clkdm_ops omap3_clkdm_operations;
227extern struct clkdm_ops omap4_clkdm_operations; 228extern struct clkdm_ops omap4_clkdm_operations;
228extern struct clkdm_ops am33xx_clkdm_operations; 229extern struct clkdm_ops am33xx_clkdm_operations;
230extern struct clkdm_ops am43xx_clkdm_operations;
229 231
230extern struct clkdm_dep gfx_24xx_wkdeps[]; 232extern struct clkdm_dep gfx_24xx_wkdeps[];
231extern struct clkdm_dep dsp_24xx_wkdeps[]; 233extern struct clkdm_dep dsp_24xx_wkdeps[];
diff --git a/arch/arm/mach-omap2/clockdomains43xx_data.c b/arch/arm/mach-omap2/clockdomains43xx_data.c
new file mode 100644
index 000000000000..6d71c6082a24
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomains43xx_data.c
@@ -0,0 +1,196 @@
1/*
2 * AM43xx Clock domains framework
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/io.h>
13
14#include "clockdomain.h"
15#include "prcm44xx.h"
16#include "prcm43xx.h"
17
18static struct clockdomain l4_cefuse_43xx_clkdm = {
19 .name = "l4_cefuse_clkdm",
20 .pwrdm = { .name = "cefuse_pwrdm" },
21 .prcm_partition = AM43XX_CM_PARTITION,
22 .cm_inst = AM43XX_CM_CEFUSE_INST,
23 .clkdm_offs = AM43XX_CM_CEFUSE_CEFUSE_CDOFFS,
24 .flags = CLKDM_CAN_SWSUP,
25};
26
27static struct clockdomain mpu_43xx_clkdm = {
28 .name = "mpu_clkdm",
29 .pwrdm = { .name = "mpu_pwrdm" },
30 .prcm_partition = AM43XX_CM_PARTITION,
31 .cm_inst = AM43XX_CM_MPU_INST,
32 .clkdm_offs = AM43XX_CM_MPU_MPU_CDOFFS,
33 .flags = CLKDM_CAN_HWSUP_SWSUP,
34};
35
36static struct clockdomain l4ls_43xx_clkdm = {
37 .name = "l4ls_clkdm",
38 .pwrdm = { .name = "per_pwrdm" },
39 .prcm_partition = AM43XX_CM_PARTITION,
40 .cm_inst = AM43XX_CM_PER_INST,
41 .clkdm_offs = AM43XX_CM_PER_L4LS_CDOFFS,
42 .flags = CLKDM_CAN_SWSUP,
43};
44
45static struct clockdomain tamper_43xx_clkdm = {
46 .name = "tamper_clkdm",
47 .pwrdm = { .name = "tamper_pwrdm" },
48 .prcm_partition = AM43XX_CM_PARTITION,
49 .cm_inst = AM43XX_CM_TAMPER_INST,
50 .clkdm_offs = AM43XX_CM_TAMPER_TAMPER_CDOFFS,
51 .flags = CLKDM_CAN_SWSUP,
52};
53
54static struct clockdomain l4_rtc_43xx_clkdm = {
55 .name = "l4_rtc_clkdm",
56 .pwrdm = { .name = "rtc_pwrdm" },
57 .prcm_partition = AM43XX_CM_PARTITION,
58 .cm_inst = AM43XX_CM_RTC_INST,
59 .clkdm_offs = AM43XX_CM_RTC_RTC_CDOFFS,
60 .flags = CLKDM_CAN_SWSUP,
61};
62
63static struct clockdomain pruss_ocp_43xx_clkdm = {
64 .name = "pruss_ocp_clkdm",
65 .pwrdm = { .name = "per_pwrdm" },
66 .prcm_partition = AM43XX_CM_PARTITION,
67 .cm_inst = AM43XX_CM_PER_INST,
68 .clkdm_offs = AM43XX_CM_PER_ICSS_CDOFFS,
69 .flags = CLKDM_CAN_SWSUP,
70};
71
72static struct clockdomain ocpwp_l3_43xx_clkdm = {
73 .name = "ocpwp_l3_clkdm",
74 .pwrdm = { .name = "per_pwrdm" },
75 .prcm_partition = AM43XX_CM_PARTITION,
76 .cm_inst = AM43XX_CM_PER_INST,
77 .clkdm_offs = AM43XX_CM_PER_OCPWP_L3_CDOFFS,
78 .flags = CLKDM_CAN_SWSUP,
79};
80
81static struct clockdomain l3s_tsc_43xx_clkdm = {
82 .name = "l3s_tsc_clkdm",
83 .pwrdm = { .name = "wkup_pwrdm" },
84 .prcm_partition = AM43XX_CM_PARTITION,
85 .cm_inst = AM43XX_CM_WKUP_INST,
86 .clkdm_offs = AM43XX_CM_WKUP_L3S_TSC_CDOFFS,
87 .flags = CLKDM_CAN_SWSUP,
88};
89
90static struct clockdomain dss_43xx_clkdm = {
91 .name = "dss_clkdm",
92 .pwrdm = { .name = "per_pwrdm" },
93 .prcm_partition = AM43XX_CM_PARTITION,
94 .cm_inst = AM43XX_CM_PER_INST,
95 .clkdm_offs = AM43XX_CM_PER_DSS_CDOFFS,
96 .flags = CLKDM_CAN_SWSUP,
97};
98
99static struct clockdomain l3_aon_43xx_clkdm = {
100 .name = "l3_aon_clkdm",
101 .pwrdm = { .name = "wkup_pwrdm" },
102 .prcm_partition = AM43XX_CM_PARTITION,
103 .cm_inst = AM43XX_CM_WKUP_INST,
104 .clkdm_offs = AM43XX_CM_WKUP_L3_AON_CDOFFS,
105 .flags = CLKDM_CAN_SWSUP,
106};
107
108static struct clockdomain emif_43xx_clkdm = {
109 .name = "emif_clkdm",
110 .pwrdm = { .name = "per_pwrdm" },
111 .prcm_partition = AM43XX_CM_PARTITION,
112 .cm_inst = AM43XX_CM_PER_INST,
113 .clkdm_offs = AM43XX_CM_PER_EMIF_CDOFFS,
114 .flags = CLKDM_CAN_SWSUP,
115};
116
117static struct clockdomain l4_wkup_aon_43xx_clkdm = {
118 .name = "l4_wkup_aon_clkdm",
119 .pwrdm = { .name = "wkup_pwrdm" },
120 .prcm_partition = AM43XX_CM_PARTITION,
121 .cm_inst = AM43XX_CM_WKUP_INST,
122 .clkdm_offs = AM43XX_CM_WKUP_L4_WKUP_AON_CDOFFS,
123};
124
125static struct clockdomain l3_43xx_clkdm = {
126 .name = "l3_clkdm",
127 .pwrdm = { .name = "per_pwrdm" },
128 .prcm_partition = AM43XX_CM_PARTITION,
129 .cm_inst = AM43XX_CM_PER_INST,
130 .clkdm_offs = AM43XX_CM_PER_L3_CDOFFS,
131 .flags = CLKDM_CAN_SWSUP,
132};
133
134static struct clockdomain l4_wkup_43xx_clkdm = {
135 .name = "l4_wkup_clkdm",
136 .pwrdm = { .name = "wkup_pwrdm" },
137 .prcm_partition = AM43XX_CM_PARTITION,
138 .cm_inst = AM43XX_CM_WKUP_INST,
139 .clkdm_offs = AM43XX_CM_WKUP_WKUP_CDOFFS,
140 .flags = CLKDM_CAN_SWSUP,
141};
142
143static struct clockdomain cpsw_125mhz_43xx_clkdm = {
144 .name = "cpsw_125mhz_clkdm",
145 .pwrdm = { .name = "per_pwrdm" },
146 .prcm_partition = AM43XX_CM_PARTITION,
147 .cm_inst = AM43XX_CM_PER_INST,
148 .clkdm_offs = AM43XX_CM_PER_CPSW_CDOFFS,
149 .flags = CLKDM_CAN_SWSUP,
150};
151
152static struct clockdomain gfx_l3_43xx_clkdm = {
153 .name = "gfx_l3_clkdm",
154 .pwrdm = { .name = "gfx_pwrdm" },
155 .prcm_partition = AM43XX_CM_PARTITION,
156 .cm_inst = AM43XX_CM_GFX_INST,
157 .clkdm_offs = AM43XX_CM_GFX_GFX_L3_CDOFFS,
158 .flags = CLKDM_CAN_SWSUP,
159};
160
161static struct clockdomain l3s_43xx_clkdm = {
162 .name = "l3s_clkdm",
163 .pwrdm = { .name = "per_pwrdm" },
164 .prcm_partition = AM43XX_CM_PARTITION,
165 .cm_inst = AM43XX_CM_PER_INST,
166 .clkdm_offs = AM43XX_CM_PER_L3S_CDOFFS,
167 .flags = CLKDM_CAN_SWSUP,
168};
169
170static struct clockdomain *clockdomains_am43xx[] __initdata = {
171 &l4_cefuse_43xx_clkdm,
172 &mpu_43xx_clkdm,
173 &l4ls_43xx_clkdm,
174 &tamper_43xx_clkdm,
175 &l4_rtc_43xx_clkdm,
176 &pruss_ocp_43xx_clkdm,
177 &ocpwp_l3_43xx_clkdm,
178 &l3s_tsc_43xx_clkdm,
179 &dss_43xx_clkdm,
180 &l3_aon_43xx_clkdm,
181 &emif_43xx_clkdm,
182 &l4_wkup_aon_43xx_clkdm,
183 &l3_43xx_clkdm,
184 &l4_wkup_43xx_clkdm,
185 &cpsw_125mhz_43xx_clkdm,
186 &gfx_l3_43xx_clkdm,
187 &l3s_43xx_clkdm,
188 NULL
189};
190
191void __init am43xx_clockdomains_init(void)
192{
193 clkdm_register_platform_funcs(&am43xx_clkdm_operations);
194 clkdm_register_clkdms(clockdomains_am43xx);
195 clkdm_complete_init();
196}
diff --git a/arch/arm/mach-omap2/cm2xxx.c b/arch/arm/mach-omap2/cm2xxx.c
index 6774a53a3874..ce25abbcffae 100644
--- a/arch/arm/mach-omap2/cm2xxx.c
+++ b/arch/arm/mach-omap2/cm2xxx.c
@@ -327,6 +327,73 @@ struct clkdm_ops omap2_clkdm_operations = {
327 .clkdm_clk_disable = omap2xxx_clkdm_clk_disable, 327 .clkdm_clk_disable = omap2xxx_clkdm_clk_disable,
328}; 328};
329 329
330int omap2xxx_cm_fclks_active(void)
331{
332 u32 f1, f2;
333
334 f1 = omap2_cm_read_mod_reg(CORE_MOD, CM_FCLKEN1);
335 f2 = omap2_cm_read_mod_reg(CORE_MOD, OMAP24XX_CM_FCLKEN2);
336
337 return (f1 | f2) ? 1 : 0;
338}
339
340int omap2xxx_cm_mpu_retention_allowed(void)
341{
342 u32 l;
343
344 /* Check for MMC, UART2, UART1, McSPI2, McSPI1 and DSS1. */
345 l = omap2_cm_read_mod_reg(CORE_MOD, CM_FCLKEN1);
346 if (l & (OMAP2420_EN_MMC_MASK | OMAP24XX_EN_UART2_MASK |
347 OMAP24XX_EN_UART1_MASK | OMAP24XX_EN_MCSPI2_MASK |
348 OMAP24XX_EN_MCSPI1_MASK | OMAP24XX_EN_DSS1_MASK))
349 return 0;
350 /* Check for UART3. */
351 l = omap2_cm_read_mod_reg(CORE_MOD, OMAP24XX_CM_FCLKEN2);
352 if (l & OMAP24XX_EN_UART3_MASK)
353 return 0;
354
355 return 1;
356}
357
358u32 omap2xxx_cm_get_core_clk_src(void)
359{
360 u32 v;
361
362 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
363 v &= OMAP24XX_CORE_CLK_SRC_MASK;
364
365 return v;
366}
367
368u32 omap2xxx_cm_get_core_pll_config(void)
369{
370 return omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
371}
372
373u32 omap2xxx_cm_get_pll_config(void)
374{
375 return omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL1);
376}
377
378u32 omap2xxx_cm_get_pll_status(void)
379{
380 return omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
381}
382
383void omap2xxx_cm_set_mod_dividers(u32 mpu, u32 dsp, u32 gfx, u32 core, u32 mdm)
384{
385 u32 tmp;
386
387 omap2_cm_write_mod_reg(mpu, MPU_MOD, CM_CLKSEL);
388 omap2_cm_write_mod_reg(dsp, OMAP24XX_DSP_MOD, CM_CLKSEL);
389 omap2_cm_write_mod_reg(gfx, GFX_MOD, CM_CLKSEL);
390 tmp = omap2_cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) &
391 OMAP24XX_CLKSEL_DSS2_MASK;
392 omap2_cm_write_mod_reg(core | tmp, CORE_MOD, CM_CLKSEL1);
393 if (cpu_is_omap2430())
394 omap2_cm_write_mod_reg(mdm, OMAP2430_MDM_MOD, CM_CLKSEL);
395}
396
330/* 397/*
331 * 398 *
332 */ 399 */
diff --git a/arch/arm/mach-omap2/cm2xxx.h b/arch/arm/mach-omap2/cm2xxx.h
index 4cbb39b051d2..891d81c3c8f4 100644
--- a/arch/arm/mach-omap2/cm2xxx.h
+++ b/arch/arm/mach-omap2/cm2xxx.h
@@ -62,6 +62,14 @@ extern int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
62 u8 idlest_shift); 62 u8 idlest_shift);
63extern int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg, 63extern int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
64 s16 *prcm_inst, u8 *idlest_reg_id); 64 s16 *prcm_inst, u8 *idlest_reg_id);
65extern int omap2xxx_cm_fclks_active(void);
66extern int omap2xxx_cm_mpu_retention_allowed(void);
67extern u32 omap2xxx_cm_get_core_clk_src(void);
68extern u32 omap2xxx_cm_get_core_pll_config(void);
69extern u32 omap2xxx_cm_get_pll_config(void);
70extern u32 omap2xxx_cm_get_pll_status(void);
71extern void omap2xxx_cm_set_mod_dividers(u32 mpu, u32 dsp, u32 gfx, u32 core,
72 u32 mdm);
65 73
66extern int __init omap2xxx_cm_init(void); 74extern int __init omap2xxx_cm_init(void);
67 75
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index 325a51576576..40a22e5649ae 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -48,13 +48,13 @@
48/* Private functions */ 48/* Private functions */
49 49
50/* Read a register in a CM instance */ 50/* Read a register in a CM instance */
51static inline u32 am33xx_cm_read_reg(s16 inst, u16 idx) 51static inline u32 am33xx_cm_read_reg(u16 inst, u16 idx)
52{ 52{
53 return __raw_readl(cm_base + inst + idx); 53 return __raw_readl(cm_base + inst + idx);
54} 54}
55 55
56/* Write into a register in a CM */ 56/* Write into a register in a CM */
57static inline void am33xx_cm_write_reg(u32 val, s16 inst, u16 idx) 57static inline void am33xx_cm_write_reg(u32 val, u16 inst, u16 idx)
58{ 58{
59 __raw_writel(val, cm_base + inst + idx); 59 __raw_writel(val, cm_base + inst + idx);
60} 60}
@@ -138,7 +138,7 @@ static bool _is_module_ready(u16 inst, s16 cdoffs, u16 clkctrl_offs)
138 * @c must be the unshifted value for CLKTRCTRL - i.e., this function 138 * @c must be the unshifted value for CLKTRCTRL - i.e., this function
139 * will handle the shift itself. 139 * will handle the shift itself.
140 */ 140 */
141static void _clktrctrl_write(u8 c, s16 inst, u16 cdoffs) 141static void _clktrctrl_write(u8 c, u16 inst, u16 cdoffs)
142{ 142{
143 u32 v; 143 u32 v;
144 144
@@ -158,7 +158,7 @@ static void _clktrctrl_write(u8 c, s16 inst, u16 cdoffs)
158 * Returns true if the clockdomain referred to by (@inst, @cdoffs) 158 * Returns true if the clockdomain referred to by (@inst, @cdoffs)
159 * is in hardware-supervised idle mode, or 0 otherwise. 159 * is in hardware-supervised idle mode, or 0 otherwise.
160 */ 160 */
161bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs) 161bool am33xx_cm_is_clkdm_in_hwsup(u16 inst, u16 cdoffs)
162{ 162{
163 u32 v; 163 u32 v;
164 164
@@ -177,7 +177,7 @@ bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs)
177 * Put a clockdomain referred to by (@inst, @cdoffs) into 177 * Put a clockdomain referred to by (@inst, @cdoffs) into
178 * hardware-supervised idle mode. No return value. 178 * hardware-supervised idle mode. No return value.
179 */ 179 */
180void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs) 180void am33xx_cm_clkdm_enable_hwsup(u16 inst, u16 cdoffs)
181{ 181{
182 _clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, inst, cdoffs); 182 _clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, inst, cdoffs);
183} 183}
@@ -191,7 +191,7 @@ void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs)
191 * software-supervised idle mode, i.e., controlled manually by the 191 * software-supervised idle mode, i.e., controlled manually by the
192 * Linux OMAP clockdomain code. No return value. 192 * Linux OMAP clockdomain code. No return value.
193 */ 193 */
194void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs) 194void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs)
195{ 195{
196 _clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, inst, cdoffs); 196 _clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, inst, cdoffs);
197} 197}
@@ -204,7 +204,7 @@ void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs)
204 * Put a clockdomain referred to by (@inst, @cdoffs) into idle 204 * Put a clockdomain referred to by (@inst, @cdoffs) into idle
205 * No return value. 205 * No return value.
206 */ 206 */
207void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs) 207void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs)
208{ 208{
209 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, inst, cdoffs); 209 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, inst, cdoffs);
210} 210}
@@ -217,7 +217,7 @@ void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs)
217 * Take a clockdomain referred to by (@inst, @cdoffs) out of idle, 217 * Take a clockdomain referred to by (@inst, @cdoffs) out of idle,
218 * waking it up. No return value. 218 * waking it up. No return value.
219 */ 219 */
220void am33xx_cm_clkdm_force_wakeup(s16 inst, u16 cdoffs) 220void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs)
221{ 221{
222 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, inst, cdoffs); 222 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, inst, cdoffs);
223} 223}
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index 9d1f4fcdebbb..cfb8891b0c0e 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -377,13 +377,13 @@
377 377
378 378
379#ifndef __ASSEMBLER__ 379#ifndef __ASSEMBLER__
380extern bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs); 380bool am33xx_cm_is_clkdm_in_hwsup(u16 inst, u16 cdoffs);
381extern void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs); 381void am33xx_cm_clkdm_enable_hwsup(u16 inst, u16 cdoffs);
382extern void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs); 382void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs);
383extern void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs); 383void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs);
384extern void am33xx_cm_clkdm_force_wakeup(s16 inst, u16 cdoffs); 384void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs);
385 385
386#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX) 386#ifdef CONFIG_SOC_AM33XX
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/cm3xxx.c b/arch/arm/mach-omap2/cm3xxx.c
index 9061c307d915..f6f028867bfe 100644
--- a/arch/arm/mach-omap2/cm3xxx.c
+++ b/arch/arm/mach-omap2/cm3xxx.c
@@ -636,6 +636,28 @@ void omap3_cm_restore_context(void)
636 OMAP3_CM_CLKOUT_CTRL_OFFSET); 636 OMAP3_CM_CLKOUT_CTRL_OFFSET);
637} 637}
638 638
639void omap3_cm_save_scratchpad_contents(u32 *ptr)
640{
641 *ptr++ = omap2_cm_read_mod_reg(CORE_MOD, CM_CLKSEL);
642 *ptr++ = omap2_cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
643 *ptr++ = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
644
645 /*
646 * As per erratum i671, ROM code does not respect the PER DPLL
647 * programming scheme if CM_AUTOIDLE_PLL..AUTO_PERIPH_DPLL == 1.
648 * Then, in anycase, clear these bits to avoid extra latencies.
649 */
650 *ptr++ = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE) &
651 ~OMAP3430_AUTO_PERIPH_DPLL_MASK;
652 *ptr++ = omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL1_PLL);
653 *ptr++ = omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL2_PLL);
654 *ptr++ = omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL3);
655 *ptr++ = omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKEN_PLL);
656 *ptr++ = omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL);
657 *ptr++ = omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL);
658 *ptr++ = omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL);
659}
660
639/* 661/*
640 * 662 *
641 */ 663 */
diff --git a/arch/arm/mach-omap2/cm3xxx.h b/arch/arm/mach-omap2/cm3xxx.h
index e8e146f4a43f..8224c91b4d7a 100644
--- a/arch/arm/mach-omap2/cm3xxx.h
+++ b/arch/arm/mach-omap2/cm3xxx.h
@@ -83,6 +83,7 @@ extern int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
83 83
84extern void omap3_cm_save_context(void); 84extern void omap3_cm_save_context(void);
85extern void omap3_cm_restore_context(void); 85extern void omap3_cm_restore_context(void);
86extern void omap3_cm_save_scratchpad_contents(u32 *ptr);
86 87
87extern int __init omap3xxx_cm_init(void); 88extern int __init omap3xxx_cm_init(void);
88 89
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index f0290f5566fe..731ca134348c 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -111,7 +111,7 @@ static bool _is_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs)
111/* Public functions */ 111/* Public functions */
112 112
113/* Read a register in a CM instance */ 113/* Read a register in a CM instance */
114u32 omap4_cminst_read_inst_reg(u8 part, s16 inst, u16 idx) 114u32 omap4_cminst_read_inst_reg(u8 part, u16 inst, u16 idx)
115{ 115{
116 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 116 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
117 part == OMAP4430_INVALID_PRCM_PARTITION || 117 part == OMAP4430_INVALID_PRCM_PARTITION ||
@@ -120,7 +120,7 @@ u32 omap4_cminst_read_inst_reg(u8 part, s16 inst, u16 idx)
120} 120}
121 121
122/* Write into a register in a CM instance */ 122/* Write into a register in a CM instance */
123void omap4_cminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx) 123void omap4_cminst_write_inst_reg(u32 val, u8 part, u16 inst, u16 idx)
124{ 124{
125 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 125 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
126 part == OMAP4430_INVALID_PRCM_PARTITION || 126 part == OMAP4430_INVALID_PRCM_PARTITION ||
@@ -129,7 +129,7 @@ void omap4_cminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx)
129} 129}
130 130
131/* Read-modify-write a register in CM1. Caller must lock */ 131/* Read-modify-write a register in CM1. Caller must lock */
132u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16 inst, 132u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, u16 inst,
133 s16 idx) 133 s16 idx)
134{ 134{
135 u32 v; 135 u32 v;
@@ -142,12 +142,12 @@ u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16 inst,
142 return v; 142 return v;
143} 143}
144 144
145u32 omap4_cminst_set_inst_reg_bits(u32 bits, u8 part, s16 inst, s16 idx) 145u32 omap4_cminst_set_inst_reg_bits(u32 bits, u8 part, u16 inst, s16 idx)
146{ 146{
147 return omap4_cminst_rmw_inst_reg_bits(bits, bits, part, inst, idx); 147 return omap4_cminst_rmw_inst_reg_bits(bits, bits, part, inst, idx);
148} 148}
149 149
150u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, s16 inst, s16 idx) 150u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, u16 inst, s16 idx)
151{ 151{
152 return omap4_cminst_rmw_inst_reg_bits(bits, 0x0, part, inst, idx); 152 return omap4_cminst_rmw_inst_reg_bits(bits, 0x0, part, inst, idx);
153} 153}
@@ -177,7 +177,7 @@ u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx, u32 mask)
177 * @c must be the unshifted value for CLKTRCTRL - i.e., this function 177 * @c must be the unshifted value for CLKTRCTRL - i.e., this function
178 * will handle the shift itself. 178 * will handle the shift itself.
179 */ 179 */
180static void _clktrctrl_write(u8 c, u8 part, s16 inst, u16 cdoffs) 180static void _clktrctrl_write(u8 c, u8 part, u16 inst, u16 cdoffs)
181{ 181{
182 u32 v; 182 u32 v;
183 183
@@ -196,7 +196,7 @@ static void _clktrctrl_write(u8 c, u8 part, s16 inst, u16 cdoffs)
196 * Returns true if the clockdomain referred to by (@part, @inst, @cdoffs) 196 * Returns true if the clockdomain referred to by (@part, @inst, @cdoffs)
197 * is in hardware-supervised idle mode, or 0 otherwise. 197 * is in hardware-supervised idle mode, or 0 otherwise.
198 */ 198 */
199bool omap4_cminst_is_clkdm_in_hwsup(u8 part, s16 inst, u16 cdoffs) 199bool omap4_cminst_is_clkdm_in_hwsup(u8 part, u16 inst, u16 cdoffs)
200{ 200{
201 u32 v; 201 u32 v;
202 202
@@ -216,7 +216,7 @@ bool omap4_cminst_is_clkdm_in_hwsup(u8 part, s16 inst, u16 cdoffs)
216 * Put a clockdomain referred to by (@part, @inst, @cdoffs) into 216 * Put a clockdomain referred to by (@part, @inst, @cdoffs) into
217 * hardware-supervised idle mode. No return value. 217 * hardware-supervised idle mode. No return value.
218 */ 218 */
219void omap4_cminst_clkdm_enable_hwsup(u8 part, s16 inst, u16 cdoffs) 219void omap4_cminst_clkdm_enable_hwsup(u8 part, u16 inst, u16 cdoffs)
220{ 220{
221 _clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, part, inst, cdoffs); 221 _clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, part, inst, cdoffs);
222} 222}
@@ -231,7 +231,7 @@ void omap4_cminst_clkdm_enable_hwsup(u8 part, s16 inst, u16 cdoffs)
231 * software-supervised idle mode, i.e., controlled manually by the 231 * software-supervised idle mode, i.e., controlled manually by the
232 * Linux OMAP clockdomain code. No return value. 232 * Linux OMAP clockdomain code. No return value.
233 */ 233 */
234void omap4_cminst_clkdm_disable_hwsup(u8 part, s16 inst, u16 cdoffs) 234void omap4_cminst_clkdm_disable_hwsup(u8 part, u16 inst, u16 cdoffs)
235{ 235{
236 _clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, part, inst, cdoffs); 236 _clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, part, inst, cdoffs);
237} 237}
@@ -245,7 +245,7 @@ void omap4_cminst_clkdm_disable_hwsup(u8 part, s16 inst, u16 cdoffs)
245 * Take a clockdomain referred to by (@part, @inst, @cdoffs) out of idle, 245 * Take a clockdomain referred to by (@part, @inst, @cdoffs) out of idle,
246 * waking it up. No return value. 246 * waking it up. No return value.
247 */ 247 */
248void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, u16 cdoffs) 248void omap4_cminst_clkdm_force_wakeup(u8 part, u16 inst, u16 cdoffs)
249{ 249{
250 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, part, inst, cdoffs); 250 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, part, inst, cdoffs);
251} 251}
@@ -483,3 +483,12 @@ struct clkdm_ops omap4_clkdm_operations = {
483 .clkdm_clk_enable = omap4_clkdm_clk_enable, 483 .clkdm_clk_enable = omap4_clkdm_clk_enable,
484 .clkdm_clk_disable = omap4_clkdm_clk_disable, 484 .clkdm_clk_disable = omap4_clkdm_clk_disable,
485}; 485};
486
487struct clkdm_ops am43xx_clkdm_operations = {
488 .clkdm_sleep = omap4_clkdm_sleep,
489 .clkdm_wakeup = omap4_clkdm_wakeup,
490 .clkdm_allow_idle = omap4_clkdm_allow_idle,
491 .clkdm_deny_idle = omap4_clkdm_deny_idle,
492 .clkdm_clk_enable = omap4_clkdm_clk_enable,
493 .clkdm_clk_disable = omap4_clkdm_clk_disable,
494};
diff --git a/arch/arm/mach-omap2/cminst44xx.h b/arch/arm/mach-omap2/cminst44xx.h
index bd7bab889745..7f56ea444bc4 100644
--- a/arch/arm/mach-omap2/cminst44xx.h
+++ b/arch/arm/mach-omap2/cminst44xx.h
@@ -11,11 +11,11 @@
11#ifndef __ARCH_ASM_MACH_OMAP2_CMINST44XX_H 11#ifndef __ARCH_ASM_MACH_OMAP2_CMINST44XX_H
12#define __ARCH_ASM_MACH_OMAP2_CMINST44XX_H 12#define __ARCH_ASM_MACH_OMAP2_CMINST44XX_H
13 13
14extern bool omap4_cminst_is_clkdm_in_hwsup(u8 part, s16 inst, u16 cdoffs); 14bool omap4_cminst_is_clkdm_in_hwsup(u8 part, u16 inst, u16 cdoffs);
15extern void omap4_cminst_clkdm_enable_hwsup(u8 part, s16 inst, u16 cdoffs); 15void omap4_cminst_clkdm_enable_hwsup(u8 part, u16 inst, u16 cdoffs);
16extern void omap4_cminst_clkdm_disable_hwsup(u8 part, s16 inst, u16 cdoffs); 16void omap4_cminst_clkdm_disable_hwsup(u8 part, u16 inst, u16 cdoffs);
17extern void omap4_cminst_clkdm_force_sleep(u8 part, s16 inst, u16 cdoffs); 17void omap4_cminst_clkdm_force_sleep(u8 part, u16 inst, u16 cdoffs);
18extern void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, u16 cdoffs); 18void omap4_cminst_clkdm_force_wakeup(u8 part, u16 inst, u16 cdoffs);
19extern int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs); 19extern int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs);
20extern int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs, 20extern int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
21 u16 clkctrl_offs); 21 u16 clkctrl_offs);
@@ -27,14 +27,14 @@ extern void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
27 * In an ideal world, we would not export these low-level functions, 27 * In an ideal world, we would not export these low-level functions,
28 * but this will probably take some time to fix properly 28 * but this will probably take some time to fix properly
29 */ 29 */
30extern u32 omap4_cminst_read_inst_reg(u8 part, s16 inst, u16 idx); 30u32 omap4_cminst_read_inst_reg(u8 part, u16 inst, u16 idx);
31extern void omap4_cminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx); 31void omap4_cminst_write_inst_reg(u32 val, u8 part, u16 inst, u16 idx);
32extern u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, 32u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,
33 s16 inst, s16 idx); 33 u16 inst, s16 idx);
34extern u32 omap4_cminst_set_inst_reg_bits(u32 bits, u8 part, s16 inst, 34u32 omap4_cminst_set_inst_reg_bits(u32 bits, u8 part, u16 inst,
35 s16 idx); 35 s16 idx);
36extern u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, s16 inst, 36u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, u16 inst,
37 s16 idx); 37 s16 idx);
38extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx, 38extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx,
39 u32 mask); 39 u32 mask);
40 40
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 4a5684b96492..f7644febee81 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -98,6 +98,7 @@ void am35xx_init_early(void);
98void ti81xx_init_early(void); 98void ti81xx_init_early(void);
99void am33xx_init_early(void); 99void am33xx_init_early(void);
100void am43xx_init_early(void); 100void am43xx_init_early(void);
101void am43xx_init_late(void);
101void omap4430_init_early(void); 102void omap4430_init_early(void);
102void omap5_init_early(void); 103void omap5_init_early(void);
103void omap3_init_late(void); /* Do not use this one */ 104void omap3_init_late(void); /* Do not use this one */
@@ -109,8 +110,11 @@ void omap35xx_init_late(void);
109void omap3630_init_late(void); 110void omap3630_init_late(void);
110void am35xx_init_late(void); 111void am35xx_init_late(void);
111void ti81xx_init_late(void); 112void ti81xx_init_late(void);
113void am33xx_init_late(void);
114void omap5_init_late(void);
112int omap2_common_pm_late_init(void); 115int omap2_common_pm_late_init(void);
113void dra7xx_init_early(void); 116void dra7xx_init_early(void);
117void dra7xx_init_late(void);
114 118
115#ifdef CONFIG_SOC_BUS 119#ifdef CONFIG_SOC_BUS
116void omap_soc_device_init(void); 120void omap_soc_device_init(void);
@@ -288,6 +292,9 @@ static inline void omap4_cpu_resume(void)
288 292
289#endif 293#endif
290 294
295void pdata_quirks_init(struct of_device_id *);
296void omap_pcs_legacy_init(int irq, void (*rearm)(void));
297
291struct omap_sdrc_params; 298struct omap_sdrc_params;
292extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0, 299extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
293 struct omap_sdrc_params *sdrc_cs1); 300 struct omap_sdrc_params *sdrc_cs1);
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 31e0dfe4a4ea..44bb4d544dcf 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -46,17 +46,7 @@ struct omap3_scratchpad {
46struct omap3_scratchpad_prcm_block { 46struct omap3_scratchpad_prcm_block {
47 u32 prm_clksrc_ctrl; 47 u32 prm_clksrc_ctrl;
48 u32 prm_clksel; 48 u32 prm_clksel;
49 u32 cm_clksel_core; 49 u32 cm_contents[11];
50 u32 cm_clksel_wkup;
51 u32 cm_clken_pll;
52 u32 cm_autoidle_pll;
53 u32 cm_clksel1_pll;
54 u32 cm_clksel2_pll;
55 u32 cm_clksel3_pll;
56 u32 cm_clken_pll_mpu;
57 u32 cm_autoidle_pll_mpu;
58 u32 cm_clksel1_pll_mpu;
59 u32 cm_clksel2_pll_mpu;
60 u32 prcm_block_size; 50 u32 prcm_block_size;
61}; 51};
62 52
@@ -347,34 +337,9 @@ void omap3_save_scratchpad_contents(void)
347 prcm_block_contents.prm_clksel = 337 prcm_block_contents.prm_clksel =
348 omap2_prm_read_mod_reg(OMAP3430_CCR_MOD, 338 omap2_prm_read_mod_reg(OMAP3430_CCR_MOD,
349 OMAP3_PRM_CLKSEL_OFFSET); 339 OMAP3_PRM_CLKSEL_OFFSET);
350 prcm_block_contents.cm_clksel_core = 340
351 omap2_cm_read_mod_reg(CORE_MOD, CM_CLKSEL); 341 omap3_cm_save_scratchpad_contents(prcm_block_contents.cm_contents);
352 prcm_block_contents.cm_clksel_wkup = 342
353 omap2_cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
354 prcm_block_contents.cm_clken_pll =
355 omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
356 /*
357 * As per erratum i671, ROM code does not respect the PER DPLL
358 * programming scheme if CM_AUTOIDLE_PLL..AUTO_PERIPH_DPLL == 1.
359 * Then, in anycase, clear these bits to avoid extra latencies.
360 */
361 prcm_block_contents.cm_autoidle_pll =
362 omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE) &
363 ~OMAP3430_AUTO_PERIPH_DPLL_MASK;
364 prcm_block_contents.cm_clksel1_pll =
365 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL1_PLL);
366 prcm_block_contents.cm_clksel2_pll =
367 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL2_PLL);
368 prcm_block_contents.cm_clksel3_pll =
369 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL3);
370 prcm_block_contents.cm_clken_pll_mpu =
371 omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKEN_PLL);
372 prcm_block_contents.cm_autoidle_pll_mpu =
373 omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL);
374 prcm_block_contents.cm_clksel1_pll_mpu =
375 omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL);
376 prcm_block_contents.cm_clksel2_pll_mpu =
377 omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL);
378 prcm_block_contents.prcm_block_size = 0x0; 343 prcm_block_contents.prcm_block_size = 0x0;
379 344
380 /* Populate the SDRC block contents */ 345 /* Populate the SDRC block contents */
@@ -604,4 +569,15 @@ int omap3_ctrl_save_padconf(void)
604 return 0; 569 return 0;
605} 570}
606 571
572/**
573 * omap3_ctrl_set_iva_bootmode_idle - sets the IVA2 bootmode to idle
574 *
575 * Sets the bootmode for IVA2 to idle. This is needed by the PM code to
576 * force disable IVA2 so that it does not prevent any low-power states.
577 */
578void omap3_ctrl_set_iva_bootmode_idle(void)
579{
580 omap_ctrl_writel(OMAP3_IVA2_BOOTMOD_IDLE,
581 OMAP343X_CONTROL_IVA2_BOOTMOD);
582}
607#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */ 583#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index f7d7c2ef1b40..da054801b114 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -427,6 +427,7 @@ extern void omap_ctrl_write_dsp_boot_addr(u32 bootaddr);
427extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode); 427extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode);
428extern void omap3630_ctrl_disable_rta(void); 428extern void omap3630_ctrl_disable_rta(void);
429extern int omap3_ctrl_save_padconf(void); 429extern int omap3_ctrl_save_padconf(void);
430extern void omap3_ctrl_set_iva_bootmode_idle(void);
430extern void omap2_set_globals_control(void __iomem *ctrl, 431extern void omap2_set_globals_control(void __iomem *ctrl,
431 void __iomem *ctrl_pad); 432 void __iomem *ctrl_pad);
432#else 433#else
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c
index c443f2e97e10..4c8982ae9529 100644
--- a/arch/arm/mach-omap2/cpuidle44xx.c
+++ b/arch/arm/mach-omap2/cpuidle44xx.c
@@ -143,7 +143,7 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
143 * Call idle CPU cluster PM exit notifier chain 143 * Call idle CPU cluster PM exit notifier chain
144 * to restore GIC and wakeupgen context. 144 * to restore GIC and wakeupgen context.
145 */ 145 */
146 if ((cx->mpu_state == PWRDM_POWER_RET) && 146 if (dev->cpu == 0 && (cx->mpu_state == PWRDM_POWER_RET) &&
147 (cx->mpu_logic_state == PWRDM_POWER_OFF)) 147 (cx->mpu_logic_state == PWRDM_POWER_OFF))
148 cpu_cluster_pm_exit(); 148 cpu_cluster_pm_exit();
149 149
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 5c5315ba129b..0dd6398bade4 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -19,7 +19,6 @@
19#include <linux/of.h> 19#include <linux/of.h>
20#include <linux/pinctrl/machine.h> 20#include <linux/pinctrl/machine.h>
21#include <linux/platform_data/omap4-keypad.h> 21#include <linux/platform_data/omap4-keypad.h>
22#include <linux/wl12xx.h>
23#include <linux/platform_data/mailbox-omap.h> 22#include <linux/platform_data/mailbox-omap.h>
24 23
25#include <asm/mach-types.h> 24#include <asm/mach-types.h>
@@ -37,6 +36,7 @@
37#include "mux.h" 36#include "mux.h"
38#include "control.h" 37#include "control.h"
39#include "devices.h" 38#include "devices.h"
39#include "display.h"
40 40
41#define L3_MODULES_MAX_LEN 12 41#define L3_MODULES_MAX_LEN 12
42#define L3_MODULES 3 42#define L3_MODULES 3
@@ -466,47 +466,13 @@ static struct platform_device omap_vout_device = {
466 .resource = &omap_vout_resource[0], 466 .resource = &omap_vout_resource[0],
467 .id = -1, 467 .id = -1,
468}; 468};
469static void omap_init_vout(void)
470{
471 if (platform_device_register(&omap_vout_device) < 0)
472 printk(KERN_ERR "Unable to register OMAP-VOUT device\n");
473}
474#else
475static inline void omap_init_vout(void) {}
476#endif
477
478#if IS_ENABLED(CONFIG_WL12XX)
479 469
480static struct wl12xx_platform_data wl12xx __initdata; 470int __init omap_init_vout(void)
481
482void __init omap_init_wl12xx_of(void)
483{ 471{
484 int ret; 472 return platform_device_register(&omap_vout_device);
485
486 if (!of_have_populated_dt())
487 return;
488
489 if (of_machine_is_compatible("ti,omap4-sdp")) {
490 wl12xx.board_ref_clock = WL12XX_REFCLOCK_26;
491 wl12xx.board_tcxo_clock = WL12XX_TCXOCLOCK_26;
492 wl12xx.irq = gpio_to_irq(53);
493 } else if (of_machine_is_compatible("ti,omap4-panda")) {
494 wl12xx.board_ref_clock = WL12XX_REFCLOCK_38;
495 wl12xx.irq = gpio_to_irq(53);
496 } else {
497 return;
498 }
499
500 ret = wl12xx_set_platform_data(&wl12xx);
501 if (ret) {
502 pr_err("error setting wl12xx data: %d\n", ret);
503 return;
504 }
505} 473}
506#else 474#else
507static inline void omap_init_wl12xx_of(void) 475int __init omap_init_vout(void) { return 0; }
508{
509}
510#endif 476#endif
511 477
512/*-------------------------------------------------------------------------*/ 478/*-------------------------------------------------------------------------*/
@@ -531,12 +497,8 @@ static int __init omap2_init_devices(void)
531 omap_init_sham(); 497 omap_init_sham();
532 omap_init_aes(); 498 omap_init_aes();
533 omap_init_rng(); 499 omap_init_rng();
534 } else {
535 /* These can be removed when bindings are done */
536 omap_init_wl12xx_of();
537 } 500 }
538 omap_init_sti(); 501 omap_init_sti();
539 omap_init_vout();
540 502
541 return 0; 503 return 0;
542} 504}
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 03a0516c7f67..a4e536b11ec9 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -416,6 +416,34 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
416 } 416 }
417 } 417 }
418 418
419 /* create DRM device */
420 r = omap_init_drm();
421 if (r < 0) {
422 pr_err("Unable to register omapdrm device\n");
423 return r;
424 }
425
426 /* create vrfb device */
427 r = omap_init_vrfb();
428 if (r < 0) {
429 pr_err("Unable to register omapvrfb device\n");
430 return r;
431 }
432
433 /* create FB device */
434 r = omap_init_fb();
435 if (r < 0) {
436 pr_err("Unable to register omapfb device\n");
437 return r;
438 }
439
440 /* create V4L2 display device */
441 r = omap_init_vout();
442 if (r < 0) {
443 pr_err("Unable to register omap_vout device\n");
444 return r;
445 }
446
419 return 0; 447 return 0;
420} 448}
421 449
diff --git a/arch/arm/mach-omap2/display.h b/arch/arm/mach-omap2/display.h
index b871b017b352..f3d2ce4bc262 100644
--- a/arch/arm/mach-omap2/display.h
+++ b/arch/arm/mach-omap2/display.h
@@ -26,4 +26,8 @@ struct omap_dss_dispc_dev_attr {
26 bool has_framedonetv_irq; 26 bool has_framedonetv_irq;
27}; 27};
28 28
29int omap_init_drm(void);
30int omap_init_vrfb(void);
31int omap_init_fb(void);
32int omap_init_vout(void);
29#endif 33#endif
diff --git a/arch/arm/mach-omap2/drm.c b/arch/arm/mach-omap2/drm.c
index 59a4af779f42..facd7406a03d 100644
--- a/arch/arm/mach-omap2/drm.c
+++ b/arch/arm/mach-omap2/drm.c
@@ -26,10 +26,9 @@
26#include <linux/platform_data/omap_drm.h> 26#include <linux/platform_data/omap_drm.h>
27 27
28#include "soc.h" 28#include "soc.h"
29#include "omap_device.h" 29#include "display.h"
30#include "omap_hwmod.h"
31 30
32#if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE) 31#if defined(CONFIG_DRM_OMAP) || defined(CONFIG_DRM_OMAP_MODULE)
33 32
34static struct omap_drm_platform_data platform_data; 33static struct omap_drm_platform_data platform_data;
35 34
@@ -42,26 +41,13 @@ static struct platform_device omap_drm_device = {
42 .id = 0, 41 .id = 0,
43}; 42};
44 43
45static int __init omap_init_drm(void) 44int __init omap_init_drm(void)
46{ 45{
47 struct omap_hwmod *oh = NULL;
48 struct platform_device *pdev;
49
50 /* lookup and populate the DMM information, if present - OMAP4+ */
51 oh = omap_hwmod_lookup("dmm");
52
53 if (oh) {
54 pdev = omap_device_build(oh->name, -1, oh, NULL, 0);
55 WARN(IS_ERR(pdev), "Could not build omap_device for %s\n",
56 oh->name);
57 }
58
59 platform_data.omaprev = GET_OMAP_TYPE; 46 platform_data.omaprev = GET_OMAP_TYPE;
60 47
61 return platform_device_register(&omap_drm_device); 48 return platform_device_register(&omap_drm_device);
62 49
63} 50}
64 51#else
65omap_arch_initcall(omap_init_drm); 52int __init omap_init_drm(void) { return 0; }
66
67#endif 53#endif
diff --git a/arch/arm/mach-omap2/dss-common.c b/arch/arm/mach-omap2/dss-common.c
index bf89effa4c99..365bfd3d9c68 100644
--- a/arch/arm/mach-omap2/dss-common.c
+++ b/arch/arm/mach-omap2/dss-common.c
@@ -213,3 +213,47 @@ void __init omap_4430sdp_display_init_of(void)
213 platform_device_register(&sdp4430_tpd_device); 213 platform_device_register(&sdp4430_tpd_device);
214 platform_device_register(&sdp4430_hdmi_connector_device); 214 platform_device_register(&sdp4430_hdmi_connector_device);
215} 215}
216
217
218/* OMAP3 IGEPv2 data */
219
220#define IGEP2_DVI_TFP410_POWER_DOWN_GPIO 170
221
222/* DVI Connector */
223static struct connector_dvi_platform_data omap3_igep2_dvi_connector_pdata = {
224 .name = "dvi",
225 .source = "tfp410.0",
226 .i2c_bus_num = 3,
227};
228
229static struct platform_device omap3_igep2_dvi_connector_device = {
230 .name = "connector-dvi",
231 .id = 0,
232 .dev.platform_data = &omap3_igep2_dvi_connector_pdata,
233};
234
235/* TFP410 DPI-to-DVI chip */
236static struct encoder_tfp410_platform_data omap3_igep2_tfp410_pdata = {
237 .name = "tfp410.0",
238 .source = "dpi.0",
239 .data_lines = 24,
240 .power_down_gpio = IGEP2_DVI_TFP410_POWER_DOWN_GPIO,
241};
242
243static struct platform_device omap3_igep2_tfp410_device = {
244 .name = "tfp410",
245 .id = 0,
246 .dev.platform_data = &omap3_igep2_tfp410_pdata,
247};
248
249static struct omap_dss_board_info igep2_dss_data = {
250 .default_display_name = "dvi",
251};
252
253void __init omap3_igep2_display_init_of(void)
254{
255 omap_display_init(&igep2_dss_data);
256
257 platform_device_register(&omap3_igep2_tfp410_device);
258 platform_device_register(&omap3_igep2_dvi_connector_device);
259}
diff --git a/arch/arm/mach-omap2/dss-common.h b/arch/arm/mach-omap2/dss-common.h
index c28fe3c03588..a9becf0d5be8 100644
--- a/arch/arm/mach-omap2/dss-common.h
+++ b/arch/arm/mach-omap2/dss-common.h
@@ -8,5 +8,6 @@
8 8
9void __init omap4_panda_display_init_of(void); 9void __init omap4_panda_display_init_of(void);
10void __init omap_4430sdp_display_init_of(void); 10void __init omap_4430sdp_display_init_of(void);
11void __init omap3_igep2_display_init_of(void);
11 12
12#endif 13#endif
diff --git a/arch/arm/mach-omap2/fb.c b/arch/arm/mach-omap2/fb.c
index 2ca33cc0c484..26e28e94f625 100644
--- a/arch/arm/mach-omap2/fb.c
+++ b/arch/arm/mach-omap2/fb.c
@@ -32,6 +32,7 @@
32#include <asm/mach/map.h> 32#include <asm/mach/map.h>
33 33
34#include "soc.h" 34#include "soc.h"
35#include "display.h"
35 36
36#ifdef CONFIG_OMAP2_VRFB 37#ifdef CONFIG_OMAP2_VRFB
37 38
@@ -64,7 +65,7 @@ static const struct resource omap3_vrfb_resources[] = {
64 DEFINE_RES_MEM_NAMED(0xfc000000u, 0x4000000, "vrfb-area-11"), 65 DEFINE_RES_MEM_NAMED(0xfc000000u, 0x4000000, "vrfb-area-11"),
65}; 66};
66 67
67static int __init omap_init_vrfb(void) 68int __init omap_init_vrfb(void)
68{ 69{
69 struct platform_device *pdev; 70 struct platform_device *pdev;
70 const struct resource *res; 71 const struct resource *res;
@@ -85,8 +86,8 @@ static int __init omap_init_vrfb(void)
85 86
86 return PTR_RET(pdev); 87 return PTR_RET(pdev);
87} 88}
88 89#else
89omap_arch_initcall(omap_init_vrfb); 90int __init omap_init_vrfb(void) { return 0; }
90#endif 91#endif
91 92
92#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) 93#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
@@ -105,11 +106,10 @@ static struct platform_device omap_fb_device = {
105 .num_resources = 0, 106 .num_resources = 0,
106}; 107};
107 108
108static int __init omap_init_fb(void) 109int __init omap_init_fb(void)
109{ 110{
110 return platform_device_register(&omap_fb_device); 111 return platform_device_register(&omap_fb_device);
111} 112}
112 113#else
113omap_arch_initcall(omap_init_fb); 114int __init omap_init_fb(void) { return 0; }
114
115#endif 115#endif
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c
index 64b5a8346982..8b6876c98ce1 100644
--- a/arch/arm/mach-omap2/gpmc-onenand.c
+++ b/arch/arm/mach-omap2/gpmc-onenand.c
@@ -272,9 +272,19 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base)
272 struct gpmc_timings t; 272 struct gpmc_timings t;
273 int ret; 273 int ret;
274 274
275 if (gpmc_onenand_data->of_node) 275 if (gpmc_onenand_data->of_node) {
276 gpmc_read_settings_dt(gpmc_onenand_data->of_node, 276 gpmc_read_settings_dt(gpmc_onenand_data->of_node,
277 &onenand_async); 277 &onenand_async);
278 if (onenand_async.sync_read || onenand_async.sync_write) {
279 if (onenand_async.sync_write)
280 gpmc_onenand_data->flags |=
281 ONENAND_SYNC_READWRITE;
282 else
283 gpmc_onenand_data->flags |= ONENAND_SYNC_READ;
284 onenand_async.sync_read = false;
285 onenand_async.sync_write = false;
286 }
287 }
278 288
279 omap2_onenand_set_async_mode(onenand_base); 289 omap2_onenand_set_async_mode(onenand_base);
280 290
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 9f4795aff48a..81de56251955 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -1341,14 +1341,6 @@ static void __maybe_unused gpmc_read_timings_dt(struct device_node *np,
1341 1341
1342#ifdef CONFIG_MTD_NAND 1342#ifdef CONFIG_MTD_NAND
1343 1343
1344static const char * const nand_ecc_opts[] = {
1345 [OMAP_ECC_HAMMING_CODE_DEFAULT] = "sw",
1346 [OMAP_ECC_HAMMING_CODE_HW] = "hw",
1347 [OMAP_ECC_HAMMING_CODE_HW_ROMCODE] = "hw-romcode",
1348 [OMAP_ECC_BCH4_CODE_HW] = "bch4",
1349 [OMAP_ECC_BCH8_CODE_HW] = "bch8",
1350};
1351
1352static const char * const nand_xfer_types[] = { 1344static const char * const nand_xfer_types[] = {
1353 [NAND_OMAP_PREFETCH_POLLED] = "prefetch-polled", 1345 [NAND_OMAP_PREFETCH_POLLED] = "prefetch-polled",
1354 [NAND_OMAP_POLLED] = "polled", 1346 [NAND_OMAP_POLLED] = "polled",
@@ -1378,13 +1370,41 @@ static int gpmc_probe_nand_child(struct platform_device *pdev,
1378 gpmc_nand_data->cs = val; 1370 gpmc_nand_data->cs = val;
1379 gpmc_nand_data->of_node = child; 1371 gpmc_nand_data->of_node = child;
1380 1372
1381 if (!of_property_read_string(child, "ti,nand-ecc-opt", &s)) 1373 /* Detect availability of ELM module */
1382 for (val = 0; val < ARRAY_SIZE(nand_ecc_opts); val++) 1374 gpmc_nand_data->elm_of_node = of_parse_phandle(child, "ti,elm-id", 0);
1383 if (!strcasecmp(s, nand_ecc_opts[val])) { 1375 if (gpmc_nand_data->elm_of_node == NULL)
1384 gpmc_nand_data->ecc_opt = val; 1376 gpmc_nand_data->elm_of_node =
1385 break; 1377 of_parse_phandle(child, "elm_id", 0);
1386 } 1378 if (gpmc_nand_data->elm_of_node == NULL)
1379 pr_warn("%s: ti,elm-id property not found\n", __func__);
1380
1381 /* select ecc-scheme for NAND */
1382 if (of_property_read_string(child, "ti,nand-ecc-opt", &s)) {
1383 pr_err("%s: ti,nand-ecc-opt not found\n", __func__);
1384 return -ENODEV;
1385 }
1386 if (!strcmp(s, "ham1") || !strcmp(s, "sw") ||
1387 !strcmp(s, "hw") || !strcmp(s, "hw-romcode"))
1388 gpmc_nand_data->ecc_opt =
1389 OMAP_ECC_HAM1_CODE_HW;
1390 else if (!strcmp(s, "bch4"))
1391 if (gpmc_nand_data->elm_of_node)
1392 gpmc_nand_data->ecc_opt =
1393 OMAP_ECC_BCH4_CODE_HW;
1394 else
1395 gpmc_nand_data->ecc_opt =
1396 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW;
1397 else if (!strcmp(s, "bch8"))
1398 if (gpmc_nand_data->elm_of_node)
1399 gpmc_nand_data->ecc_opt =
1400 OMAP_ECC_BCH8_CODE_HW;
1401 else
1402 gpmc_nand_data->ecc_opt =
1403 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW;
1404 else
1405 pr_err("%s: ti,nand-ecc-opt invalid value\n", __func__);
1387 1406
1407 /* select data transfer mode for NAND controller */
1388 if (!of_property_read_string(child, "ti,nand-xfer-type", &s)) 1408 if (!of_property_read_string(child, "ti,nand-xfer-type", &s))
1389 for (val = 0; val < ARRAY_SIZE(nand_xfer_types); val++) 1409 for (val = 0; val < ARRAY_SIZE(nand_xfer_types); val++)
1390 if (!strcasecmp(s, nand_xfer_types[val])) { 1410 if (!strcasecmp(s, nand_xfer_types[val])) {
@@ -1491,8 +1511,8 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
1491 */ 1511 */
1492 ret = gpmc_cs_remap(cs, res.start); 1512 ret = gpmc_cs_remap(cs, res.start);
1493 if (ret < 0) { 1513 if (ret < 0) {
1494 dev_err(&pdev->dev, "cannot remap GPMC CS %d to 0x%x\n", 1514 dev_err(&pdev->dev, "cannot remap GPMC CS %d to %pa\n",
1495 cs, res.start); 1515 cs, &res.start);
1496 goto err; 1516 goto err;
1497 } 1517 }
1498 1518
@@ -1521,6 +1541,42 @@ err:
1521 return ret; 1541 return ret;
1522} 1542}
1523 1543
1544/*
1545 * REVISIT: Add timing support from slls644g.pdf
1546 */
1547static int gpmc_probe_8250(struct platform_device *pdev,
1548 struct device_node *child)
1549{
1550 struct resource res;
1551 unsigned long base;
1552 int ret, cs;
1553
1554 if (of_property_read_u32(child, "reg", &cs) < 0) {
1555 dev_err(&pdev->dev, "%s has no 'reg' property\n",
1556 child->full_name);
1557 return -ENODEV;
1558 }
1559
1560 if (of_address_to_resource(child, 0, &res) < 0) {
1561 dev_err(&pdev->dev, "%s has malformed 'reg' property\n",
1562 child->full_name);
1563 return -ENODEV;
1564 }
1565
1566 ret = gpmc_cs_request(cs, resource_size(&res), &base);
1567 if (ret < 0) {
1568 dev_err(&pdev->dev, "cannot request GPMC CS %d\n", cs);
1569 return ret;
1570 }
1571
1572 if (of_platform_device_create(child, NULL, &pdev->dev))
1573 return 0;
1574
1575 dev_err(&pdev->dev, "failed to create gpmc child %s\n", child->name);
1576
1577 return -ENODEV;
1578}
1579
1524static int gpmc_probe_dt(struct platform_device *pdev) 1580static int gpmc_probe_dt(struct platform_device *pdev)
1525{ 1581{
1526 int ret; 1582 int ret;
@@ -1564,6 +1620,8 @@ static int gpmc_probe_dt(struct platform_device *pdev)
1564 else if (of_node_cmp(child->name, "ethernet") == 0 || 1620 else if (of_node_cmp(child->name, "ethernet") == 0 ||
1565 of_node_cmp(child->name, "nor") == 0) 1621 of_node_cmp(child->name, "nor") == 0)
1566 ret = gpmc_probe_generic_child(pdev, child); 1622 ret = gpmc_probe_generic_child(pdev, child);
1623 else if (of_node_cmp(child->name, "8250") == 0)
1624 ret = gpmc_probe_8250(pdev, child);
1567 1625
1568 if (WARN(ret < 0, "%s: probing gpmc child %s failed\n", 1626 if (WARN(ret < 0, "%s: probing gpmc child %s failed\n",
1569 __func__, child->full_name)) 1627 __func__, child->full_name))
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 0289adcb6efb..9428c5f9d4f2 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -18,6 +18,7 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/random.h>
21#include <linux/slab.h> 22#include <linux/slab.h>
22 23
23#ifdef CONFIG_SOC_BUS 24#ifdef CONFIG_SOC_BUS
@@ -130,6 +131,17 @@ void omap_get_die_id(struct omap_die_id *odi)
130 odi->id_3 = read_tap_reg(OMAP_TAP_DIE_ID_3); 131 odi->id_3 = read_tap_reg(OMAP_TAP_DIE_ID_3);
131} 132}
132 133
134static int __init omap_feed_randpool(void)
135{
136 struct omap_die_id odi;
137
138 /* Throw the die ID into the entropy pool at boot */
139 omap_get_die_id(&odi);
140 add_device_randomness(&odi, sizeof(odi));
141 return 0;
142}
143omap_device_initcall(omap_feed_randpool);
144
133void __init omap2xxx_check_revision(void) 145void __init omap2xxx_check_revision(void)
134{ 146{
135 int i, j; 147 int i, j;
@@ -576,8 +588,8 @@ void __init omap5xxx_check_revision(void)
576 case 0xb942: 588 case 0xb942:
577 switch (rev) { 589 switch (rev) {
578 case 0: 590 case 0:
579 omap_revision = OMAP5430_REV_ES1_0; 591 /* No support for ES1.0 Test chip */
580 break; 592 BUG();
581 case 1: 593 case 1:
582 default: 594 default:
583 omap_revision = OMAP5430_REV_ES2_0; 595 omap_revision = OMAP5430_REV_ES2_0;
@@ -587,8 +599,8 @@ void __init omap5xxx_check_revision(void)
587 case 0xb998: 599 case 0xb998:
588 switch (rev) { 600 switch (rev) {
589 case 0: 601 case 0:
590 omap_revision = OMAP5432_REV_ES1_0; 602 /* No support for ES1.0 Test chip */
591 break; 603 BUG();
592 case 1: 604 case 1:
593 default: 605 default:
594 omap_revision = OMAP5432_REV_ES2_0; 606 omap_revision = OMAP5432_REV_ES2_0;
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index ff2113ce4014..cd22262a2cc0 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -583,6 +583,11 @@ void __init am33xx_init_early(void)
583 omap_hwmod_init_postsetup(); 583 omap_hwmod_init_postsetup();
584 omap_clk_init = am33xx_clk_init; 584 omap_clk_init = am33xx_clk_init;
585} 585}
586
587void __init am33xx_init_late(void)
588{
589 omap_common_late_init();
590}
586#endif 591#endif
587 592
588#ifdef CONFIG_SOC_AM43XX 593#ifdef CONFIG_SOC_AM43XX
@@ -594,7 +599,18 @@ void __init am43xx_init_early(void)
594 NULL); 599 NULL);
595 omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE)); 600 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); 601 omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE), NULL);
602 omap_prm_base_init();
603 omap_cm_base_init();
597 omap3xxx_check_revision(); 604 omap3xxx_check_revision();
605 am43xx_powerdomains_init();
606 am43xx_clockdomains_init();
607 am43xx_hwmod_init();
608 omap_hwmod_init_postsetup();
609}
610
611void __init am43xx_init_late(void)
612{
613 omap_common_late_init();
598} 614}
599#endif 615#endif
600 616
@@ -651,6 +667,11 @@ void __init omap5_init_early(void)
651 omap54xx_hwmod_init(); 667 omap54xx_hwmod_init();
652 omap_hwmod_init_postsetup(); 668 omap_hwmod_init_postsetup();
653} 669}
670
671void __init omap5_init_late(void)
672{
673 omap_common_late_init();
674}
654#endif 675#endif
655 676
656#ifdef CONFIG_SOC_DRA7XX 677#ifdef CONFIG_SOC_DRA7XX
@@ -671,6 +692,11 @@ void __init dra7xx_init_early(void)
671 dra7xx_hwmod_init(); 692 dra7xx_hwmod_init();
672 omap_hwmod_init_postsetup(); 693 omap_hwmod_init_postsetup();
673} 694}
695
696void __init dra7xx_init_late(void)
697{
698 omap_common_late_init();
699}
674#endif 700#endif
675 701
676 702
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 3926f370448f..e022a869bff2 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -233,7 +233,7 @@ static inline void omap_intc_handle_irq(void __iomem *base_addr, struct pt_regs
233 goto out; 233 goto out;
234 234
235 irqnr = readl_relaxed(base_addr + 0xd8); 235 irqnr = readl_relaxed(base_addr + 0xd8);
236#ifdef CONFIG_SOC_TI81XX 236#if IS_ENABLED(CONFIG_SOC_TI81XX) || IS_ENABLED(CONFIG_SOC_AM33XX)
237 if (irqnr) 237 if (irqnr)
238 goto out; 238 goto out;
239 irqnr = readl_relaxed(base_addr + 0xf8); 239 irqnr = readl_relaxed(base_addr + 0xf8);
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 5d8768075dd9..b4ac3af1160c 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -25,6 +25,7 @@
25 25
26#include "soc.h" 26#include "soc.h"
27#include "omap_device.h" 27#include "omap_device.h"
28#include "clock.h"
28 29
29/* 30/*
30 * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle. 31 * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle.
@@ -33,22 +34,18 @@
33#include "cm3xxx.h" 34#include "cm3xxx.h"
34#include "cm-regbits-34xx.h" 35#include "cm-regbits-34xx.h"
35 36
37static struct clk *mcbsp_iclks[5];
38
36static int omap3_enable_st_clock(unsigned int id, bool enable) 39static int omap3_enable_st_clock(unsigned int id, bool enable)
37{ 40{
38 unsigned int w;
39
40 /* 41 /*
41 * Sidetone uses McBSP ICLK - which must not idle when sidetones 42 * Sidetone uses McBSP ICLK - which must not idle when sidetones
42 * are enabled or sidetones start sounding ugly. 43 * are enabled or sidetones start sounding ugly.
43 */ 44 */
44 w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
45 if (enable) 45 if (enable)
46 w &= ~(1 << (id - 2)); 46 return omap2_clk_deny_idle(mcbsp_iclks[id]);
47 else 47 else
48 w |= 1 << (id - 2); 48 return omap2_clk_allow_idle(mcbsp_iclks[id]);
49 omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
50
51 return 0;
52} 49}
53 50
54static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused) 51static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
@@ -58,6 +55,7 @@ static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
58 struct omap_hwmod *oh_device[2]; 55 struct omap_hwmod *oh_device[2];
59 struct omap_mcbsp_platform_data *pdata = NULL; 56 struct omap_mcbsp_platform_data *pdata = NULL;
60 struct platform_device *pdev; 57 struct platform_device *pdev;
58 char clk_name[11];
61 59
62 sscanf(oh->name, "mcbsp%d", &id); 60 sscanf(oh->name, "mcbsp%d", &id);
63 61
@@ -99,6 +97,8 @@ static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
99 oh_device[1] = omap_hwmod_lookup(( 97 oh_device[1] = omap_hwmod_lookup((
100 (struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone); 98 (struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone);
101 pdata->enable_st_clock = omap3_enable_st_clock; 99 pdata->enable_st_clock = omap3_enable_st_clock;
100 sprintf(clk_name, "mcbsp%d_ick", id);
101 mcbsp_iclks[id] = clk_get(NULL, clk_name);
102 count++; 102 count++;
103 } 103 }
104 pdev = omap_device_build_ss(name, id, oh_device, count, pdata, 104 pdev = omap_device_build_ss(name, id, oh_device, count, pdata,
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index f82cf878d6af..48094b58c88f 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -811,6 +811,12 @@ int __init omap_mux_late_init(void)
811 } 811 }
812 } 812 }
813 813
814 omap_mux_dbg_init();
815
816 /* see pinctrl-single-omap for the wake-up interrupt handling */
817 if (of_have_populated_dt())
818 return 0;
819
814 ret = request_irq(omap_prcm_event_to_irq("io"), 820 ret = request_irq(omap_prcm_event_to_irq("io"),
815 omap_hwmod_mux_handle_irq, IRQF_SHARED | IRQF_NO_SUSPEND, 821 omap_hwmod_mux_handle_irq, IRQF_SHARED | IRQF_NO_SUSPEND,
816 "hwmod_io", omap_mux_late_init); 822 "hwmod_io", omap_mux_late_init);
@@ -818,8 +824,6 @@ int __init omap_mux_late_init(void)
818 if (ret) 824 if (ret)
819 pr_warning("mux: Failed to setup hwmod io irq %d\n", ret); 825 pr_warning("mux: Failed to setup hwmod io irq %d\n", ret);
820 826
821 omap_mux_dbg_init();
822
823 return 0; 827 return 0;
824} 828}
825 829
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
index 5d2080ef7923..16f78a990d04 100644
--- a/arch/arm/mach-omap2/mux.h
+++ b/arch/arm/mach-omap2/mux.h
@@ -28,7 +28,7 @@
28#define OMAP_PULL_UP (1 << 4) 28#define OMAP_PULL_UP (1 << 4)
29#define OMAP_ALTELECTRICALSEL (1 << 5) 29#define OMAP_ALTELECTRICALSEL (1 << 5)
30 30
31/* 34xx specific mux bit defines */ 31/* omap3/4/5 specific mux bit defines */
32#define OMAP_INPUT_EN (1 << 8) 32#define OMAP_INPUT_EN (1 << 8)
33#define OMAP_OFF_EN (1 << 9) 33#define OMAP_OFF_EN (1 << 9)
34#define OMAP_OFFOUT_EN (1 << 10) 34#define OMAP_OFFOUT_EN (1 << 10)
@@ -36,8 +36,6 @@
36#define OMAP_OFF_PULL_EN (1 << 12) 36#define OMAP_OFF_PULL_EN (1 << 12)
37#define OMAP_OFF_PULL_UP (1 << 13) 37#define OMAP_OFF_PULL_UP (1 << 13)
38#define OMAP_WAKEUP_EN (1 << 14) 38#define OMAP_WAKEUP_EN (1 << 14)
39
40/* 44xx specific mux bit defines */
41#define OMAP_WAKEUP_EVENT (1 << 15) 39#define OMAP_WAKEUP_EVENT (1 << 15)
42 40
43/* Active pin states */ 41/* Active pin states */
diff --git a/arch/arm/mach-omap2/mux34xx.c b/arch/arm/mach-omap2/mux34xx.c
index c53609f46294..be271f1d585b 100644
--- a/arch/arm/mach-omap2/mux34xx.c
+++ b/arch/arm/mach-omap2/mux34xx.c
@@ -620,7 +620,7 @@ static struct omap_mux __initdata omap3_muxmodes[] = {
620 "uart1_rts", "ssi1_flag_tx", NULL, NULL, 620 "uart1_rts", "ssi1_flag_tx", NULL, NULL,
621 "gpio_149", NULL, NULL, "safe_mode"), 621 "gpio_149", NULL, NULL, "safe_mode"),
622 _OMAP3_MUXENTRY(UART1_RX, 151, 622 _OMAP3_MUXENTRY(UART1_RX, 151,
623 "uart1_rx", "ss1_wake_tx", "mcbsp1_clkr", "mcspi4_clk", 623 "uart1_rx", "ssi1_wake_tx", "mcbsp1_clkr", "mcspi4_clk",
624 "gpio_151", NULL, NULL, "safe_mode"), 624 "gpio_151", NULL, NULL, "safe_mode"),
625 _OMAP3_MUXENTRY(UART1_TX, 148, 625 _OMAP3_MUXENTRY(UART1_TX, 148,
626 "uart1_tx", "ssi1_dat_tx", NULL, NULL, 626 "uart1_tx", "ssi1_dat_tx", NULL, NULL,
diff --git a/arch/arm/mach-omap2/omap-pm.h b/arch/arm/mach-omap2/omap-pm.h
index 67faa7b8fe92..1d777e63e05c 100644
--- a/arch/arm/mach-omap2/omap-pm.h
+++ b/arch/arm/mach-omap2/omap-pm.h
@@ -17,7 +17,7 @@
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/cpufreq.h> 18#include <linux/cpufreq.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/opp.h> 20#include <linux/pm_opp.h>
21 21
22/* 22/*
23 * agent_id values for use with omap_pm_set_min_bus_tput(): 23 * agent_id values for use with omap_pm_set_min_bus_tput():
diff --git a/arch/arm/mach-omap2/omap-secure.c b/arch/arm/mach-omap2/omap-secure.c
index b970440cffca..5ac122e88f67 100644
--- a/arch/arm/mach-omap2/omap-secure.c
+++ b/arch/arm/mach-omap2/omap-secure.c
@@ -3,6 +3,8 @@
3 * 3 *
4 * Copyright (C) 2011 Texas Instruments, Inc. 4 * Copyright (C) 2011 Texas Instruments, Inc.
5 * Santosh Shilimkar <santosh.shilimkar@ti.com> 5 * Santosh Shilimkar <santosh.shilimkar@ti.com>
6 * Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg>
7 * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com>
6 * 8 *
7 * 9 *
8 * This program is free software,you can redistribute it and/or modify 10 * This program is free software,you can redistribute it and/or modify
@@ -70,3 +72,77 @@ phys_addr_t omap_secure_ram_mempool_base(void)
70{ 72{
71 return omap_secure_memblock_base; 73 return omap_secure_memblock_base;
72} 74}
75
76/**
77 * rx51_secure_dispatcher: Routine to dispatch secure PPA API calls
78 * @idx: The PPA API index
79 * @process: Process ID
80 * @flag: The flag indicating criticality of operation
81 * @nargs: Number of valid arguments out of four.
82 * @arg1, arg2, arg3 args4: Parameters passed to secure API
83 *
84 * Return the non-zero error value on failure.
85 *
86 * NOTE: rx51_secure_dispatcher differs from omap_secure_dispatcher because
87 * it calling omap_smc3() instead omap_smc2() and param[0] is nargs+1
88 */
89u32 rx51_secure_dispatcher(u32 idx, u32 process, u32 flag, u32 nargs,
90 u32 arg1, u32 arg2, u32 arg3, u32 arg4)
91{
92 u32 ret;
93 u32 param[5];
94
95 param[0] = nargs+1; /* RX-51 needs number of arguments + 1 */
96 param[1] = arg1;
97 param[2] = arg2;
98 param[3] = arg3;
99 param[4] = arg4;
100
101 /*
102 * Secure API needs physical address
103 * pointer for the parameters
104 */
105 local_irq_disable();
106 local_fiq_disable();
107 flush_cache_all();
108 outer_clean_range(__pa(param), __pa(param + 5));
109 ret = omap_smc3(idx, process, flag, __pa(param));
110 flush_cache_all();
111 local_fiq_enable();
112 local_irq_enable();
113
114 return ret;
115}
116
117/**
118 * rx51_secure_update_aux_cr: Routine to modify the contents of Auxiliary Control Register
119 * @set_bits: bits to set in ACR
120 * @clr_bits: bits to clear in ACR
121 *
122 * Return the non-zero error value on failure.
123*/
124u32 rx51_secure_update_aux_cr(u32 set_bits, u32 clear_bits)
125{
126 u32 acr;
127
128 /* Read ACR */
129 asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));
130 acr &= ~clear_bits;
131 acr |= set_bits;
132
133 return rx51_secure_dispatcher(RX51_PPA_WRITE_ACR,
134 0,
135 FLAG_START_CRITICAL,
136 1, acr, 0, 0, 0);
137}
138
139/**
140 * rx51_secure_rng_call: Routine for HW random generator
141 */
142u32 rx51_secure_rng_call(u32 ptr, u32 count, u32 flag)
143{
144 return rx51_secure_dispatcher(RX51_PPA_HWRNG,
145 0,
146 NO_FLAG,
147 3, ptr, count, flag, 0);
148}
diff --git a/arch/arm/mach-omap2/omap-secure.h b/arch/arm/mach-omap2/omap-secure.h
index 0e729170c46b..8cc7d331437d 100644
--- a/arch/arm/mach-omap2/omap-secure.h
+++ b/arch/arm/mach-omap2/omap-secure.h
@@ -3,6 +3,8 @@
3 * 3 *
4 * Copyright (C) 2011 Texas Instruments, Inc. 4 * Copyright (C) 2011 Texas Instruments, Inc.
5 * Santosh Shilimkar <santosh.shilimkar@ti.com> 5 * Santosh Shilimkar <santosh.shilimkar@ti.com>
6 * Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg>
7 * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com>
6 * 8 *
7 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -42,23 +44,38 @@
42#define OMAP4_MON_L2X0_AUXCTRL_INDEX 0x109 44#define OMAP4_MON_L2X0_AUXCTRL_INDEX 0x109
43#define OMAP4_MON_L2X0_PREFETCH_INDEX 0x113 45#define OMAP4_MON_L2X0_PREFETCH_INDEX 0x113
44 46
47#define OMAP5_DRA7_MON_SET_CNTFRQ_INDEX 0x109
48
45/* Secure PPA(Primary Protected Application) APIs */ 49/* Secure PPA(Primary Protected Application) APIs */
46#define OMAP4_PPA_L2_POR_INDEX 0x23 50#define OMAP4_PPA_L2_POR_INDEX 0x23
47#define OMAP4_PPA_CPU_ACTRL_SMP_INDEX 0x25 51#define OMAP4_PPA_CPU_ACTRL_SMP_INDEX 0x25
48 52
53/* Secure RX-51 PPA (Primary Protected Application) APIs */
54#define RX51_PPA_HWRNG 29
55#define RX51_PPA_L2_INVAL 40
56#define RX51_PPA_WRITE_ACR 42
57
49#ifndef __ASSEMBLER__ 58#ifndef __ASSEMBLER__
50 59
51extern u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs, 60extern u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs,
52 u32 arg1, u32 arg2, u32 arg3, u32 arg4); 61 u32 arg1, u32 arg2, u32 arg3, u32 arg4);
53extern u32 omap_smc2(u32 id, u32 falg, u32 pargs); 62extern u32 omap_smc2(u32 id, u32 falg, u32 pargs);
63extern u32 omap_smc3(u32 id, u32 process, u32 flag, u32 pargs);
54extern phys_addr_t omap_secure_ram_mempool_base(void); 64extern phys_addr_t omap_secure_ram_mempool_base(void);
55extern int omap_secure_ram_reserve_memblock(void); 65extern int omap_secure_ram_reserve_memblock(void);
56 66
67extern u32 rx51_secure_dispatcher(u32 idx, u32 process, u32 flag, u32 nargs,
68 u32 arg1, u32 arg2, u32 arg3, u32 arg4);
69extern u32 rx51_secure_update_aux_cr(u32 set_bits, u32 clear_bits);
70extern u32 rx51_secure_rng_call(u32 ptr, u32 count, u32 flag);
71
57#ifdef CONFIG_OMAP4_ERRATA_I688 72#ifdef CONFIG_OMAP4_ERRATA_I688
58extern int omap_barrier_reserve_memblock(void); 73extern int omap_barrier_reserve_memblock(void);
59#else 74#else
60static inline void omap_barrier_reserve_memblock(void) 75static inline void omap_barrier_reserve_memblock(void)
61{ } 76{ }
62#endif 77#endif
78
79void set_cntfreq(void);
63#endif /* __ASSEMBLER__ */ 80#endif /* __ASSEMBLER__ */
64#endif /* OMAP_ARCH_OMAP_SECURE_H */ 81#endif /* OMAP_ARCH_OMAP_SECURE_H */
diff --git a/arch/arm/mach-omap2/omap-smc.S b/arch/arm/mach-omap2/omap-smc.S
index f6441c13cd8c..fd90125bffc7 100644
--- a/arch/arm/mach-omap2/omap-smc.S
+++ b/arch/arm/mach-omap2/omap-smc.S
@@ -1,9 +1,11 @@
1/* 1/*
2 * OMAP44xx secure APIs file. 2 * OMAP34xx and OMAP44xx secure APIs file.
3 * 3 *
4 * Copyright (C) 2010 Texas Instruments, Inc. 4 * Copyright (C) 2010 Texas Instruments, Inc.
5 * Written by Santosh Shilimkar <santosh.shilimkar@ti.com> 5 * Written by Santosh Shilimkar <santosh.shilimkar@ti.com>
6 * 6 *
7 * Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg>
8 * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com>
7 * 9 *
8 * This program is free software,you can redistribute it and/or modify 10 * This program is free software,you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
@@ -54,6 +56,23 @@ ENTRY(omap_smc2)
54 ldmfd sp!, {r4-r12, pc} 56 ldmfd sp!, {r4-r12, pc}
55ENDPROC(omap_smc2) 57ENDPROC(omap_smc2)
56 58
59/**
60 * u32 omap_smc3(u32 service_id, u32 process_id, u32 flag, u32 pargs)
61 * Low level common routine for secure HAL and PPA APIs via smc #1
62 * r0 - @service_id: Secure Service ID
63 * r1 - @process_id: Process ID
64 * r2 - @flag: Flag to indicate the criticality of operation
65 * r3 - @pargs: Physical address of parameter list
66 */
67ENTRY(omap_smc3)
68 stmfd sp!, {r4-r11, lr}
69 mov r12, r0 @ Copy the secure service ID
70 mov r6, #0xff @ Indicate new Task call
71 dsb @ Memory Barrier (not sure if needed, copied from omap_smc2)
72 smc #1 @ Call PPA service
73 ldmfd sp!, {r4-r11, pc}
74ENDPROC(omap_smc3)
75
57ENTRY(omap_modify_auxcoreboot0) 76ENTRY(omap_modify_auxcoreboot0)
58 stmfd sp!, {r1-r12, lr} 77 stmfd sp!, {r1-r12, lr}
59 ldr r12, =0x104 78 ldr r12, =0x104
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 8708b2a9da45..75e95d4fb448 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * OMAP4 SMP source file. It contains platform specific fucntions 2 * OMAP4 SMP source file. It contains platform specific functions
3 * needed for the linux smp kernel. 3 * needed for the linux smp kernel.
4 * 4 *
5 * Copyright (C) 2009 Texas Instruments, Inc. 5 * Copyright (C) 2009 Texas Instruments, Inc.
@@ -66,6 +66,13 @@ static void omap4_secondary_init(unsigned int cpu)
66 4, 0, 0, 0, 0, 0); 66 4, 0, 0, 0, 0, 0);
67 67
68 /* 68 /*
69 * Configure the CNTFRQ register for the secondary cpu's which
70 * indicates the frequency of the cpu local timers.
71 */
72 if (soc_is_omap54xx() || soc_is_dra7xx())
73 set_cntfreq();
74
75 /*
69 * Synchronise with the boot thread. 76 * Synchronise with the boot thread.
70 */ 77 */
71 spin_lock(&boot_lock); 78 spin_lock(&boot_lock);
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c
index 813c61558a5f..3664562f9148 100644
--- a/arch/arm/mach-omap2/omap-wakeupgen.c
+++ b/arch/arm/mach-omap2/omap-wakeupgen.c
@@ -33,8 +33,12 @@
33#include "omap4-sar-layout.h" 33#include "omap4-sar-layout.h"
34#include "common.h" 34#include "common.h"
35 35
36#define MAX_NR_REG_BANKS 5 36#define AM43XX_NR_REG_BANKS 7
37#define MAX_IRQS 160 37#define AM43XX_IRQS 224
38#define MAX_NR_REG_BANKS AM43XX_NR_REG_BANKS
39#define MAX_IRQS AM43XX_IRQS
40#define DEFAULT_NR_REG_BANKS 5
41#define DEFAULT_IRQS 160
38#define WKG_MASK_ALL 0x00000000 42#define WKG_MASK_ALL 0x00000000
39#define WKG_UNMASK_ALL 0xffffffff 43#define WKG_UNMASK_ALL 0xffffffff
40#define CPU_ENA_OFFSET 0x400 44#define CPU_ENA_OFFSET 0x400
@@ -47,8 +51,8 @@ static void __iomem *wakeupgen_base;
47static void __iomem *sar_base; 51static void __iomem *sar_base;
48static DEFINE_RAW_SPINLOCK(wakeupgen_lock); 52static DEFINE_RAW_SPINLOCK(wakeupgen_lock);
49static unsigned int irq_target_cpu[MAX_IRQS]; 53static unsigned int irq_target_cpu[MAX_IRQS];
50static unsigned int irq_banks = MAX_NR_REG_BANKS; 54static unsigned int irq_banks = DEFAULT_NR_REG_BANKS;
51static unsigned int max_irqs = MAX_IRQS; 55static unsigned int max_irqs = DEFAULT_IRQS;
52static unsigned int omap_secure_apis; 56static unsigned int omap_secure_apis;
53 57
54/* 58/*
@@ -418,12 +422,16 @@ int __init omap_wakeupgen_init(void)
418 irq_banks = OMAP4_NR_BANKS; 422 irq_banks = OMAP4_NR_BANKS;
419 max_irqs = OMAP4_NR_IRQS; 423 max_irqs = OMAP4_NR_IRQS;
420 omap_secure_apis = 1; 424 omap_secure_apis = 1;
425 } else if (soc_is_am43xx()) {
426 irq_banks = AM43XX_NR_REG_BANKS;
427 max_irqs = AM43XX_IRQS;
421 } 428 }
422 429
423 /* Clear all IRQ bitmasks at wakeupGen level */ 430 /* Clear all IRQ bitmasks at wakeupGen level */
424 for (i = 0; i < irq_banks; i++) { 431 for (i = 0; i < irq_banks; i++) {
425 wakeupgen_writel(0, i, CPU0_ID); 432 wakeupgen_writel(0, i, CPU0_ID);
426 wakeupgen_writel(0, i, CPU1_ID); 433 if (!soc_is_am43xx())
434 wakeupgen_writel(0, i, CPU1_ID);
427 } 435 }
428 436
429 /* 437 /*
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index f99f68e1e85b..b69dd9abb50a 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -158,7 +158,7 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
158 } 158 }
159 159
160 od = omap_device_alloc(pdev, hwmods, oh_cnt); 160 od = omap_device_alloc(pdev, hwmods, oh_cnt);
161 if (!od) { 161 if (IS_ERR(od)) {
162 dev_err(&pdev->dev, "Cannot allocate omap_device for :%s\n", 162 dev_err(&pdev->dev, "Cannot allocate omap_device for :%s\n",
163 oh_name); 163 oh_name);
164 ret = PTR_ERR(od); 164 ret = PTR_ERR(od);
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index d9ee0ff094d4..e3f0ecaf87dd 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2357,25 +2357,29 @@ static struct device_node *of_dev_hwmod_lookup(struct device_node *np,
2357/** 2357/**
2358 * _init_mpu_rt_base - populate the virtual address for a hwmod 2358 * _init_mpu_rt_base - populate the virtual address for a hwmod
2359 * @oh: struct omap_hwmod * to locate the virtual address 2359 * @oh: struct omap_hwmod * to locate the virtual address
2360 * @data: (unused, caller should pass NULL)
2361 * @np: struct device_node * of the IP block's device node in the DT data
2360 * 2362 *
2361 * Cache the virtual address used by the MPU to access this IP block's 2363 * Cache the virtual address used by the MPU to access this IP block's
2362 * registers. This address is needed early so the OCP registers that 2364 * registers. This address is needed early so the OCP registers that
2363 * are part of the device's address space can be ioremapped properly. 2365 * are part of the device's address space can be ioremapped properly.
2364 * No return value. 2366 *
2367 * Returns 0 on success, -EINVAL if an invalid hwmod is passed, and
2368 * -ENXIO on absent or invalid register target address space.
2365 */ 2369 */
2366static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) 2370static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data,
2371 struct device_node *np)
2367{ 2372{
2368 struct omap_hwmod_addr_space *mem; 2373 struct omap_hwmod_addr_space *mem;
2369 void __iomem *va_start = NULL; 2374 void __iomem *va_start = NULL;
2370 struct device_node *np;
2371 2375
2372 if (!oh) 2376 if (!oh)
2373 return; 2377 return -EINVAL;
2374 2378
2375 _save_mpu_port_index(oh); 2379 _save_mpu_port_index(oh);
2376 2380
2377 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) 2381 if (oh->_int_flags & _HWMOD_NO_MPU_PORT)
2378 return; 2382 return -ENXIO;
2379 2383
2380 mem = _find_mpu_rt_addr_space(oh); 2384 mem = _find_mpu_rt_addr_space(oh);
2381 if (!mem) { 2385 if (!mem) {
@@ -2383,25 +2387,24 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
2383 oh->name); 2387 oh->name);
2384 2388
2385 /* Extract the IO space from device tree blob */ 2389 /* Extract the IO space from device tree blob */
2386 if (!of_have_populated_dt()) 2390 if (!np)
2387 return; 2391 return -ENXIO;
2388 2392
2389 np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh); 2393 va_start = of_iomap(np, oh->mpu_rt_idx);
2390 if (np)
2391 va_start = of_iomap(np, oh->mpu_rt_idx);
2392 } else { 2394 } else {
2393 va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); 2395 va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
2394 } 2396 }
2395 2397
2396 if (!va_start) { 2398 if (!va_start) {
2397 pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name); 2399 pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name);
2398 return; 2400 return -ENXIO;
2399 } 2401 }
2400 2402
2401 pr_debug("omap_hwmod: %s: MPU register target at va %p\n", 2403 pr_debug("omap_hwmod: %s: MPU register target at va %p\n",
2402 oh->name, va_start); 2404 oh->name, va_start);
2403 2405
2404 oh->_mpu_rt_va = va_start; 2406 oh->_mpu_rt_va = va_start;
2407 return 0;
2405} 2408}
2406 2409
2407/** 2410/**
@@ -2414,18 +2417,28 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
2414 * registered at this point. This is the first of two phases for 2417 * registered at this point. This is the first of two phases for
2415 * hwmod initialization. Code called here does not touch any hardware 2418 * hwmod initialization. Code called here does not touch any hardware
2416 * registers, it simply prepares internal data structures. Returns 0 2419 * registers, it simply prepares internal data structures. Returns 0
2417 * upon success or if the hwmod isn't registered, or -EINVAL upon 2420 * upon success or if the hwmod isn't registered or if the hwmod's
2418 * failure. 2421 * address space is not defined, or -EINVAL upon failure.
2419 */ 2422 */
2420static int __init _init(struct omap_hwmod *oh, void *data) 2423static int __init _init(struct omap_hwmod *oh, void *data)
2421{ 2424{
2422 int r; 2425 int r;
2426 struct device_node *np = NULL;
2423 2427
2424 if (oh->_state != _HWMOD_STATE_REGISTERED) 2428 if (oh->_state != _HWMOD_STATE_REGISTERED)
2425 return 0; 2429 return 0;
2426 2430
2427 if (oh->class->sysc) 2431 if (of_have_populated_dt())
2428 _init_mpu_rt_base(oh, NULL); 2432 np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh);
2433
2434 if (oh->class->sysc) {
2435 r = _init_mpu_rt_base(oh, NULL, np);
2436 if (r < 0) {
2437 WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n",
2438 oh->name);
2439 return 0;
2440 }
2441 }
2429 2442
2430 r = _init_clocks(oh, NULL); 2443 r = _init_clocks(oh, NULL);
2431 if (r < 0) { 2444 if (r < 0) {
@@ -2433,6 +2446,12 @@ static int __init _init(struct omap_hwmod *oh, void *data)
2433 return -EINVAL; 2446 return -EINVAL;
2434 } 2447 }
2435 2448
2449 if (np)
2450 if (of_find_property(np, "ti,no-reset-on-init", NULL))
2451 oh->flags |= HWMOD_INIT_NO_RESET;
2452 if (of_find_property(np, "ti,no-idle-on-init", NULL))
2453 oh->flags |= HWMOD_INIT_NO_IDLE;
2454
2436 oh->_state = _HWMOD_STATE_INITIALIZED; 2455 oh->_state = _HWMOD_STATE_INITIALIZED;
2437 2456
2438 return 0; 2457 return 0;
@@ -4125,6 +4144,14 @@ void __init omap_hwmod_init(void)
4125 soc_ops.init_clkdm = _init_clkdm; 4144 soc_ops.init_clkdm = _init_clkdm;
4126 soc_ops.update_context_lost = _omap4_update_context_lost; 4145 soc_ops.update_context_lost = _omap4_update_context_lost;
4127 soc_ops.get_context_lost = _omap4_get_context_lost; 4146 soc_ops.get_context_lost = _omap4_get_context_lost;
4147 } else if (soc_is_am43xx()) {
4148 soc_ops.enable_module = _omap4_enable_module;
4149 soc_ops.disable_module = _omap4_disable_module;
4150 soc_ops.wait_target_ready = _omap4_wait_target_ready;
4151 soc_ops.assert_hardreset = _omap4_assert_hardreset;
4152 soc_ops.deassert_hardreset = _omap4_deassert_hardreset;
4153 soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted;
4154 soc_ops.init_clkdm = _init_clkdm;
4128 } else if (soc_is_am33xx()) { 4155 } else if (soc_is_am33xx()) {
4129 soc_ops.enable_module = _am33xx_enable_module; 4156 soc_ops.enable_module = _am33xx_enable_module;
4130 soc_ops.disable_module = _am33xx_disable_module; 4157 soc_ops.disable_module = _am33xx_disable_module;
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index d02acf9308d3..0f97d635ff90 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -752,6 +752,7 @@ extern int omap44xx_hwmod_init(void);
752extern int omap54xx_hwmod_init(void); 752extern int omap54xx_hwmod_init(void);
753extern int am33xx_hwmod_init(void); 753extern int am33xx_hwmod_init(void);
754extern int dra7xx_hwmod_init(void); 754extern int dra7xx_hwmod_init(void);
755int am43xx_hwmod_init(void);
755 756
756extern int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois); 757extern int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois);
757 758
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
new file mode 100644
index 000000000000..130332c0534d
--- /dev/null
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
@@ -0,0 +1,163 @@
1/*
2 *
3 * Copyright (C) 2013 Texas Instruments Incorporated
4 *
5 * Data common for AM335x and AM43x
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __ARCH_ARM_MACH_OMAP2_OMAP_HWMOD_33XX_43XX_COMMON_DATA_H
18#define __ARCH_ARM_MACH_OMAP2_OMAP_HWMOD_33XX_43XX_COMMON_DATA_H
19
20extern struct omap_hwmod_ocp_if am33xx_mpu__l3_main;
21extern struct omap_hwmod_ocp_if am33xx_l3_main__l3_s;
22extern struct omap_hwmod_ocp_if am33xx_l3_s__l4_ls;
23extern struct omap_hwmod_ocp_if am33xx_l3_s__l4_wkup;
24extern struct omap_hwmod_ocp_if am33xx_l3_main__l3_instr;
25extern struct omap_hwmod_ocp_if am33xx_mpu__prcm;
26extern struct omap_hwmod_ocp_if am33xx_l3_s__l3_main;
27extern struct omap_hwmod_ocp_if am33xx_pruss__l3_main;
28extern struct omap_hwmod_ocp_if am33xx_gfx__l3_main;
29extern struct omap_hwmod_ocp_if am33xx_l3_main__gfx;
30extern struct omap_hwmod_ocp_if am33xx_l4_wkup__rtc;
31extern struct omap_hwmod_ocp_if am33xx_l4_per__dcan0;
32extern struct omap_hwmod_ocp_if am33xx_l4_per__dcan1;
33extern struct omap_hwmod_ocp_if am33xx_l4_per__gpio1;
34extern struct omap_hwmod_ocp_if am33xx_l4_per__gpio2;
35extern struct omap_hwmod_ocp_if am33xx_l4_per__gpio3;
36extern struct omap_hwmod_ocp_if am33xx_cpgmac0__mdio;
37extern struct omap_hwmod_ocp_if am33xx_l4_ls__elm;
38extern struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss0;
39extern struct omap_hwmod_ocp_if am33xx_epwmss0__ecap0;
40extern struct omap_hwmod_ocp_if am33xx_epwmss0__eqep0;
41extern struct omap_hwmod_ocp_if am33xx_epwmss0__ehrpwm0;
42extern struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss1;
43extern struct omap_hwmod_ocp_if am33xx_epwmss1__ecap1;
44extern struct omap_hwmod_ocp_if am33xx_epwmss1__eqep1;
45extern struct omap_hwmod_ocp_if am33xx_epwmss1__ehrpwm1;
46extern struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss2;
47extern struct omap_hwmod_ocp_if am33xx_epwmss2__ecap2;
48extern struct omap_hwmod_ocp_if am33xx_epwmss2__eqep2;
49extern struct omap_hwmod_ocp_if am33xx_epwmss2__ehrpwm2;
50extern struct omap_hwmod_ocp_if am33xx_l3_s__gpmc;
51extern struct omap_hwmod_ocp_if am33xx_l4_per__i2c2;
52extern struct omap_hwmod_ocp_if am33xx_l4_per__i2c3;
53extern struct omap_hwmod_ocp_if am33xx_l4_per__mailbox;
54extern struct omap_hwmod_ocp_if am33xx_l4_ls__spinlock;
55extern struct omap_hwmod_ocp_if am33xx_l4_ls__mcasp0;
56extern struct omap_hwmod_ocp_if am33xx_l4_ls__mcasp1;
57extern struct omap_hwmod_ocp_if am33xx_l4_ls__mmc0;
58extern struct omap_hwmod_ocp_if am33xx_l4_ls__mmc1;
59extern struct omap_hwmod_ocp_if am33xx_l3_s__mmc2;
60extern struct omap_hwmod_ocp_if am33xx_l4_ls__mcspi0;
61extern struct omap_hwmod_ocp_if am33xx_l4_ls__mcspi1;
62extern struct omap_hwmod_ocp_if am33xx_l4_ls__timer2;
63extern struct omap_hwmod_ocp_if am33xx_l4_ls__timer3;
64extern struct omap_hwmod_ocp_if am33xx_l4_ls__timer4;
65extern struct omap_hwmod_ocp_if am33xx_l4_ls__timer5;
66extern struct omap_hwmod_ocp_if am33xx_l4_ls__timer6;
67extern struct omap_hwmod_ocp_if am33xx_l4_ls__timer7;
68extern struct omap_hwmod_ocp_if am33xx_l3_main__tpcc;
69extern struct omap_hwmod_ocp_if am33xx_l3_main__tptc0;
70extern struct omap_hwmod_ocp_if am33xx_l3_main__tptc1;
71extern struct omap_hwmod_ocp_if am33xx_l3_main__tptc2;
72extern struct omap_hwmod_ocp_if am33xx_l4_ls__uart2;
73extern struct omap_hwmod_ocp_if am33xx_l4_ls__uart3;
74extern struct omap_hwmod_ocp_if am33xx_l4_ls__uart4;
75extern struct omap_hwmod_ocp_if am33xx_l4_ls__uart5;
76extern struct omap_hwmod_ocp_if am33xx_l4_ls__uart6;
77extern struct omap_hwmod_ocp_if am33xx_l3_main__ocmc;
78extern struct omap_hwmod_ocp_if am33xx_l3_main__sha0;
79extern struct omap_hwmod_ocp_if am33xx_l3_main__aes0;
80
81extern struct omap_hwmod am33xx_l3_main_hwmod;
82extern struct omap_hwmod am33xx_l3_s_hwmod;
83extern struct omap_hwmod am33xx_l3_instr_hwmod;
84extern struct omap_hwmod am33xx_l4_ls_hwmod;
85extern struct omap_hwmod am33xx_l4_wkup_hwmod;
86extern struct omap_hwmod am33xx_mpu_hwmod;
87extern struct omap_hwmod am33xx_pruss_hwmod;
88extern struct omap_hwmod am33xx_gfx_hwmod;
89extern struct omap_hwmod am33xx_prcm_hwmod;
90extern struct omap_hwmod am33xx_aes0_hwmod;
91extern struct omap_hwmod am33xx_sha0_hwmod;
92extern struct omap_hwmod am33xx_ocmcram_hwmod;
93extern struct omap_hwmod am33xx_smartreflex0_hwmod;
94extern struct omap_hwmod am33xx_smartreflex1_hwmod;
95extern struct omap_hwmod am33xx_cpgmac0_hwmod;
96extern struct omap_hwmod am33xx_mdio_hwmod;
97extern struct omap_hwmod am33xx_dcan0_hwmod;
98extern struct omap_hwmod am33xx_dcan1_hwmod;
99extern struct omap_hwmod am33xx_elm_hwmod;
100extern struct omap_hwmod am33xx_epwmss0_hwmod;
101extern struct omap_hwmod am33xx_ecap0_hwmod;
102extern struct omap_hwmod am33xx_eqep0_hwmod;
103extern struct omap_hwmod am33xx_ehrpwm0_hwmod;
104extern struct omap_hwmod am33xx_epwmss1_hwmod;
105extern struct omap_hwmod am33xx_ecap1_hwmod;
106extern struct omap_hwmod am33xx_eqep1_hwmod;
107extern struct omap_hwmod am33xx_ehrpwm1_hwmod;
108extern struct omap_hwmod am33xx_epwmss2_hwmod;
109extern struct omap_hwmod am33xx_ecap2_hwmod;
110extern struct omap_hwmod am33xx_eqep2_hwmod;
111extern struct omap_hwmod am33xx_ehrpwm2_hwmod;
112extern struct omap_hwmod am33xx_gpio1_hwmod;
113extern struct omap_hwmod am33xx_gpio2_hwmod;
114extern struct omap_hwmod am33xx_gpio3_hwmod;
115extern struct omap_hwmod am33xx_gpmc_hwmod;
116extern struct omap_hwmod am33xx_i2c1_hwmod;
117extern struct omap_hwmod am33xx_i2c2_hwmod;
118extern struct omap_hwmod am33xx_i2c3_hwmod;
119extern struct omap_hwmod am33xx_mailbox_hwmod;
120extern struct omap_hwmod am33xx_mcasp0_hwmod;
121extern struct omap_hwmod am33xx_mcasp1_hwmod;
122extern struct omap_hwmod am33xx_mmc0_hwmod;
123extern struct omap_hwmod am33xx_mmc1_hwmod;
124extern struct omap_hwmod am33xx_mmc2_hwmod;
125extern struct omap_hwmod am33xx_rtc_hwmod;
126extern struct omap_hwmod am33xx_spi0_hwmod;
127extern struct omap_hwmod am33xx_spi1_hwmod;
128extern struct omap_hwmod am33xx_spinlock_hwmod;
129extern struct omap_hwmod am33xx_timer1_hwmod;
130extern struct omap_hwmod am33xx_timer2_hwmod;
131extern struct omap_hwmod am33xx_timer3_hwmod;
132extern struct omap_hwmod am33xx_timer4_hwmod;
133extern struct omap_hwmod am33xx_timer5_hwmod;
134extern struct omap_hwmod am33xx_timer6_hwmod;
135extern struct omap_hwmod am33xx_timer7_hwmod;
136extern struct omap_hwmod am33xx_tpcc_hwmod;
137extern struct omap_hwmod am33xx_tptc0_hwmod;
138extern struct omap_hwmod am33xx_tptc1_hwmod;
139extern struct omap_hwmod am33xx_tptc2_hwmod;
140extern struct omap_hwmod am33xx_uart1_hwmod;
141extern struct omap_hwmod am33xx_uart2_hwmod;
142extern struct omap_hwmod am33xx_uart3_hwmod;
143extern struct omap_hwmod am33xx_uart4_hwmod;
144extern struct omap_hwmod am33xx_uart5_hwmod;
145extern struct omap_hwmod am33xx_uart6_hwmod;
146extern struct omap_hwmod am33xx_wd_timer1_hwmod;
147
148extern struct omap_hwmod_class am33xx_l4_hwmod_class;
149extern struct omap_hwmod_class am33xx_wkup_m3_hwmod_class;
150extern struct omap_hwmod_class am33xx_control_hwmod_class;
151extern struct omap_hwmod_class am33xx_gpio_hwmod_class;
152extern struct omap_hwmod_class am33xx_timer_hwmod_class;
153extern struct omap_hwmod_class am33xx_epwmss_hwmod_class;
154extern struct omap_hwmod_class am33xx_ehrpwm_hwmod_class;
155extern struct omap_hwmod_class am33xx_spi_hwmod_class;
156
157extern struct omap_gpio_dev_attr gpio_dev_attr;
158extern struct omap2_mcspi_dev_attr mcspi_attrib;
159
160void omap_hwmod_am33xx_reg(void);
161void omap_hwmod_am43xx_reg(void);
162
163#endif
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c
new file mode 100644
index 000000000000..e2db378b849e
--- /dev/null
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c
@@ -0,0 +1,643 @@
1/*
2 *
3 * Copyright (C) 2013 Texas Instruments Incorporated
4 *
5 * Interconnects common for AM335x and AM43x
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/sizes.h>
18#include "omap_hwmod.h"
19#include "omap_hwmod_33xx_43xx_common_data.h"
20
21/* mpu -> l3 main */
22struct omap_hwmod_ocp_if am33xx_mpu__l3_main = {
23 .master = &am33xx_mpu_hwmod,
24 .slave = &am33xx_l3_main_hwmod,
25 .clk = "dpll_mpu_m2_ck",
26 .user = OCP_USER_MPU,
27};
28
29/* l3 main -> l3 s */
30struct omap_hwmod_ocp_if am33xx_l3_main__l3_s = {
31 .master = &am33xx_l3_main_hwmod,
32 .slave = &am33xx_l3_s_hwmod,
33 .clk = "l3s_gclk",
34 .user = OCP_USER_MPU | OCP_USER_SDMA,
35};
36
37/* l3 s -> l4 per/ls */
38struct omap_hwmod_ocp_if am33xx_l3_s__l4_ls = {
39 .master = &am33xx_l3_s_hwmod,
40 .slave = &am33xx_l4_ls_hwmod,
41 .clk = "l3s_gclk",
42 .user = OCP_USER_MPU | OCP_USER_SDMA,
43};
44
45/* l3 s -> l4 wkup */
46struct omap_hwmod_ocp_if am33xx_l3_s__l4_wkup = {
47 .master = &am33xx_l3_s_hwmod,
48 .slave = &am33xx_l4_wkup_hwmod,
49 .clk = "l3s_gclk",
50 .user = OCP_USER_MPU | OCP_USER_SDMA,
51};
52
53/* l3 main -> l3 instr */
54struct omap_hwmod_ocp_if am33xx_l3_main__l3_instr = {
55 .master = &am33xx_l3_main_hwmod,
56 .slave = &am33xx_l3_instr_hwmod,
57 .clk = "l3s_gclk",
58 .user = OCP_USER_MPU | OCP_USER_SDMA,
59};
60
61/* mpu -> prcm */
62struct omap_hwmod_ocp_if am33xx_mpu__prcm = {
63 .master = &am33xx_mpu_hwmod,
64 .slave = &am33xx_prcm_hwmod,
65 .clk = "dpll_mpu_m2_ck",
66 .user = OCP_USER_MPU | OCP_USER_SDMA,
67};
68
69/* l3 s -> l3 main*/
70struct omap_hwmod_ocp_if am33xx_l3_s__l3_main = {
71 .master = &am33xx_l3_s_hwmod,
72 .slave = &am33xx_l3_main_hwmod,
73 .clk = "l3s_gclk",
74 .user = OCP_USER_MPU | OCP_USER_SDMA,
75};
76
77/* pru-icss -> l3 main */
78struct omap_hwmod_ocp_if am33xx_pruss__l3_main = {
79 .master = &am33xx_pruss_hwmod,
80 .slave = &am33xx_l3_main_hwmod,
81 .clk = "l3_gclk",
82 .user = OCP_USER_MPU | OCP_USER_SDMA,
83};
84
85/* gfx -> l3 main */
86struct omap_hwmod_ocp_if am33xx_gfx__l3_main = {
87 .master = &am33xx_gfx_hwmod,
88 .slave = &am33xx_l3_main_hwmod,
89 .clk = "dpll_core_m4_ck",
90 .user = OCP_USER_MPU | OCP_USER_SDMA,
91};
92
93/* l3 main -> gfx */
94struct omap_hwmod_ocp_if am33xx_l3_main__gfx = {
95 .master = &am33xx_l3_main_hwmod,
96 .slave = &am33xx_gfx_hwmod,
97 .clk = "dpll_core_m4_ck",
98 .user = OCP_USER_MPU | OCP_USER_SDMA,
99};
100
101/* l4 wkup -> rtc */
102struct omap_hwmod_ocp_if am33xx_l4_wkup__rtc = {
103 .master = &am33xx_l4_wkup_hwmod,
104 .slave = &am33xx_rtc_hwmod,
105 .clk = "clkdiv32k_ick",
106 .user = OCP_USER_MPU,
107};
108
109/* l4 per/ls -> DCAN0 */
110struct omap_hwmod_ocp_if am33xx_l4_per__dcan0 = {
111 .master = &am33xx_l4_ls_hwmod,
112 .slave = &am33xx_dcan0_hwmod,
113 .clk = "l4ls_gclk",
114 .user = OCP_USER_MPU | OCP_USER_SDMA,
115};
116
117/* l4 per/ls -> DCAN1 */
118struct omap_hwmod_ocp_if am33xx_l4_per__dcan1 = {
119 .master = &am33xx_l4_ls_hwmod,
120 .slave = &am33xx_dcan1_hwmod,
121 .clk = "l4ls_gclk",
122 .user = OCP_USER_MPU | OCP_USER_SDMA,
123};
124
125/* l4 per/ls -> GPIO2 */
126struct omap_hwmod_ocp_if am33xx_l4_per__gpio1 = {
127 .master = &am33xx_l4_ls_hwmod,
128 .slave = &am33xx_gpio1_hwmod,
129 .clk = "l4ls_gclk",
130 .user = OCP_USER_MPU | OCP_USER_SDMA,
131};
132
133/* l4 per/ls -> gpio3 */
134struct omap_hwmod_ocp_if am33xx_l4_per__gpio2 = {
135 .master = &am33xx_l4_ls_hwmod,
136 .slave = &am33xx_gpio2_hwmod,
137 .clk = "l4ls_gclk",
138 .user = OCP_USER_MPU | OCP_USER_SDMA,
139};
140
141/* l4 per/ls -> gpio4 */
142struct omap_hwmod_ocp_if am33xx_l4_per__gpio3 = {
143 .master = &am33xx_l4_ls_hwmod,
144 .slave = &am33xx_gpio3_hwmod,
145 .clk = "l4ls_gclk",
146 .user = OCP_USER_MPU | OCP_USER_SDMA,
147};
148
149struct omap_hwmod_ocp_if am33xx_cpgmac0__mdio = {
150 .master = &am33xx_cpgmac0_hwmod,
151 .slave = &am33xx_mdio_hwmod,
152 .user = OCP_USER_MPU,
153};
154
155static struct omap_hwmod_addr_space am33xx_elm_addr_space[] = {
156 {
157 .pa_start = 0x48080000,
158 .pa_end = 0x48080000 + SZ_8K - 1,
159 .flags = ADDR_TYPE_RT
160 },
161 { }
162};
163
164struct omap_hwmod_ocp_if am33xx_l4_ls__elm = {
165 .master = &am33xx_l4_ls_hwmod,
166 .slave = &am33xx_elm_hwmod,
167 .clk = "l4ls_gclk",
168 .addr = am33xx_elm_addr_space,
169 .user = OCP_USER_MPU,
170};
171
172static struct omap_hwmod_addr_space am33xx_epwmss0_addr_space[] = {
173 {
174 .pa_start = 0x48300000,
175 .pa_end = 0x48300000 + SZ_16 - 1,
176 .flags = ADDR_TYPE_RT
177 },
178 { }
179};
180
181struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss0 = {
182 .master = &am33xx_l4_ls_hwmod,
183 .slave = &am33xx_epwmss0_hwmod,
184 .clk = "l4ls_gclk",
185 .addr = am33xx_epwmss0_addr_space,
186 .user = OCP_USER_MPU,
187};
188
189struct omap_hwmod_ocp_if am33xx_epwmss0__ecap0 = {
190 .master = &am33xx_epwmss0_hwmod,
191 .slave = &am33xx_ecap0_hwmod,
192 .clk = "l4ls_gclk",
193 .user = OCP_USER_MPU,
194};
195
196struct omap_hwmod_ocp_if am33xx_epwmss0__eqep0 = {
197 .master = &am33xx_epwmss0_hwmod,
198 .slave = &am33xx_eqep0_hwmod,
199 .clk = "l4ls_gclk",
200 .user = OCP_USER_MPU,
201};
202
203struct omap_hwmod_ocp_if am33xx_epwmss0__ehrpwm0 = {
204 .master = &am33xx_epwmss0_hwmod,
205 .slave = &am33xx_ehrpwm0_hwmod,
206 .clk = "l4ls_gclk",
207 .user = OCP_USER_MPU,
208};
209
210
211static struct omap_hwmod_addr_space am33xx_epwmss1_addr_space[] = {
212 {
213 .pa_start = 0x48302000,
214 .pa_end = 0x48302000 + SZ_16 - 1,
215 .flags = ADDR_TYPE_RT
216 },
217 { }
218};
219
220struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss1 = {
221 .master = &am33xx_l4_ls_hwmod,
222 .slave = &am33xx_epwmss1_hwmod,
223 .clk = "l4ls_gclk",
224 .addr = am33xx_epwmss1_addr_space,
225 .user = OCP_USER_MPU,
226};
227
228struct omap_hwmod_ocp_if am33xx_epwmss1__ecap1 = {
229 .master = &am33xx_epwmss1_hwmod,
230 .slave = &am33xx_ecap1_hwmod,
231 .clk = "l4ls_gclk",
232 .user = OCP_USER_MPU,
233};
234
235struct omap_hwmod_ocp_if am33xx_epwmss1__eqep1 = {
236 .master = &am33xx_epwmss1_hwmod,
237 .slave = &am33xx_eqep1_hwmod,
238 .clk = "l4ls_gclk",
239 .user = OCP_USER_MPU,
240};
241
242struct omap_hwmod_ocp_if am33xx_epwmss1__ehrpwm1 = {
243 .master = &am33xx_epwmss1_hwmod,
244 .slave = &am33xx_ehrpwm1_hwmod,
245 .clk = "l4ls_gclk",
246 .user = OCP_USER_MPU,
247};
248
249static struct omap_hwmod_addr_space am33xx_epwmss2_addr_space[] = {
250 {
251 .pa_start = 0x48304000,
252 .pa_end = 0x48304000 + SZ_16 - 1,
253 .flags = ADDR_TYPE_RT
254 },
255 { }
256};
257
258struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss2 = {
259 .master = &am33xx_l4_ls_hwmod,
260 .slave = &am33xx_epwmss2_hwmod,
261 .clk = "l4ls_gclk",
262 .addr = am33xx_epwmss2_addr_space,
263 .user = OCP_USER_MPU,
264};
265
266struct omap_hwmod_ocp_if am33xx_epwmss2__ecap2 = {
267 .master = &am33xx_epwmss2_hwmod,
268 .slave = &am33xx_ecap2_hwmod,
269 .clk = "l4ls_gclk",
270 .user = OCP_USER_MPU,
271};
272
273struct omap_hwmod_ocp_if am33xx_epwmss2__eqep2 = {
274 .master = &am33xx_epwmss2_hwmod,
275 .slave = &am33xx_eqep2_hwmod,
276 .clk = "l4ls_gclk",
277 .user = OCP_USER_MPU,
278};
279
280struct omap_hwmod_ocp_if am33xx_epwmss2__ehrpwm2 = {
281 .master = &am33xx_epwmss2_hwmod,
282 .slave = &am33xx_ehrpwm2_hwmod,
283 .clk = "l4ls_gclk",
284 .user = OCP_USER_MPU,
285};
286
287/* l3s cfg -> gpmc */
288static struct omap_hwmod_addr_space am33xx_gpmc_addr_space[] = {
289 {
290 .pa_start = 0x50000000,
291 .pa_end = 0x50000000 + SZ_8K - 1,
292 .flags = ADDR_TYPE_RT,
293 },
294 { }
295};
296
297struct omap_hwmod_ocp_if am33xx_l3_s__gpmc = {
298 .master = &am33xx_l3_s_hwmod,
299 .slave = &am33xx_gpmc_hwmod,
300 .clk = "l3s_gclk",
301 .addr = am33xx_gpmc_addr_space,
302 .user = OCP_USER_MPU,
303};
304
305/* i2c2 */
306struct omap_hwmod_ocp_if am33xx_l4_per__i2c2 = {
307 .master = &am33xx_l4_ls_hwmod,
308 .slave = &am33xx_i2c2_hwmod,
309 .clk = "l4ls_gclk",
310 .user = OCP_USER_MPU,
311};
312
313struct omap_hwmod_ocp_if am33xx_l4_per__i2c3 = {
314 .master = &am33xx_l4_ls_hwmod,
315 .slave = &am33xx_i2c3_hwmod,
316 .clk = "l4ls_gclk",
317 .user = OCP_USER_MPU,
318};
319
320static struct omap_hwmod_addr_space am33xx_mailbox_addrs[] = {
321 {
322 .pa_start = 0x480C8000,
323 .pa_end = 0x480C8000 + (SZ_4K - 1),
324 .flags = ADDR_TYPE_RT
325 },
326 { }
327};
328
329/* l4 ls -> mailbox */
330struct omap_hwmod_ocp_if am33xx_l4_per__mailbox = {
331 .master = &am33xx_l4_ls_hwmod,
332 .slave = &am33xx_mailbox_hwmod,
333 .clk = "l4ls_gclk",
334 .addr = am33xx_mailbox_addrs,
335 .user = OCP_USER_MPU,
336};
337
338/* l4 ls -> spinlock */
339struct omap_hwmod_ocp_if am33xx_l4_ls__spinlock = {
340 .master = &am33xx_l4_ls_hwmod,
341 .slave = &am33xx_spinlock_hwmod,
342 .clk = "l4ls_gclk",
343 .user = OCP_USER_MPU,
344};
345
346/* l4 ls -> mcasp0 */
347static struct omap_hwmod_addr_space am33xx_mcasp0_addr_space[] = {
348 {
349 .pa_start = 0x48038000,
350 .pa_end = 0x48038000 + SZ_8K - 1,
351 .flags = ADDR_TYPE_RT
352 },
353 { }
354};
355
356struct omap_hwmod_ocp_if am33xx_l4_ls__mcasp0 = {
357 .master = &am33xx_l4_ls_hwmod,
358 .slave = &am33xx_mcasp0_hwmod,
359 .clk = "l4ls_gclk",
360 .addr = am33xx_mcasp0_addr_space,
361 .user = OCP_USER_MPU,
362};
363
364/* l4 ls -> mcasp1 */
365static struct omap_hwmod_addr_space am33xx_mcasp1_addr_space[] = {
366 {
367 .pa_start = 0x4803C000,
368 .pa_end = 0x4803C000 + SZ_8K - 1,
369 .flags = ADDR_TYPE_RT
370 },
371 { }
372};
373
374struct omap_hwmod_ocp_if am33xx_l4_ls__mcasp1 = {
375 .master = &am33xx_l4_ls_hwmod,
376 .slave = &am33xx_mcasp1_hwmod,
377 .clk = "l4ls_gclk",
378 .addr = am33xx_mcasp1_addr_space,
379 .user = OCP_USER_MPU,
380};
381
382/* l4 ls -> mmc0 */
383static struct omap_hwmod_addr_space am33xx_mmc0_addr_space[] = {
384 {
385 .pa_start = 0x48060100,
386 .pa_end = 0x48060100 + SZ_4K - 1,
387 .flags = ADDR_TYPE_RT,
388 },
389 { }
390};
391
392struct omap_hwmod_ocp_if am33xx_l4_ls__mmc0 = {
393 .master = &am33xx_l4_ls_hwmod,
394 .slave = &am33xx_mmc0_hwmod,
395 .clk = "l4ls_gclk",
396 .addr = am33xx_mmc0_addr_space,
397 .user = OCP_USER_MPU,
398};
399
400/* l4 ls -> mmc1 */
401static struct omap_hwmod_addr_space am33xx_mmc1_addr_space[] = {
402 {
403 .pa_start = 0x481d8100,
404 .pa_end = 0x481d8100 + SZ_4K - 1,
405 .flags = ADDR_TYPE_RT,
406 },
407 { }
408};
409
410struct omap_hwmod_ocp_if am33xx_l4_ls__mmc1 = {
411 .master = &am33xx_l4_ls_hwmod,
412 .slave = &am33xx_mmc1_hwmod,
413 .clk = "l4ls_gclk",
414 .addr = am33xx_mmc1_addr_space,
415 .user = OCP_USER_MPU,
416};
417
418/* l3 s -> mmc2 */
419static struct omap_hwmod_addr_space am33xx_mmc2_addr_space[] = {
420 {
421 .pa_start = 0x47810100,
422 .pa_end = 0x47810100 + SZ_64K - 1,
423 .flags = ADDR_TYPE_RT,
424 },
425 { }
426};
427
428struct omap_hwmod_ocp_if am33xx_l3_s__mmc2 = {
429 .master = &am33xx_l3_s_hwmod,
430 .slave = &am33xx_mmc2_hwmod,
431 .clk = "l3s_gclk",
432 .addr = am33xx_mmc2_addr_space,
433 .user = OCP_USER_MPU,
434};
435
436/* l4 ls -> mcspi0 */
437struct omap_hwmod_ocp_if am33xx_l4_ls__mcspi0 = {
438 .master = &am33xx_l4_ls_hwmod,
439 .slave = &am33xx_spi0_hwmod,
440 .clk = "l4ls_gclk",
441 .user = OCP_USER_MPU,
442};
443
444/* l4 ls -> mcspi1 */
445struct omap_hwmod_ocp_if am33xx_l4_ls__mcspi1 = {
446 .master = &am33xx_l4_ls_hwmod,
447 .slave = &am33xx_spi1_hwmod,
448 .clk = "l4ls_gclk",
449 .user = OCP_USER_MPU,
450};
451
452/* l4 per -> timer2 */
453struct omap_hwmod_ocp_if am33xx_l4_ls__timer2 = {
454 .master = &am33xx_l4_ls_hwmod,
455 .slave = &am33xx_timer2_hwmod,
456 .clk = "l4ls_gclk",
457 .user = OCP_USER_MPU,
458};
459
460/* l4 per -> timer3 */
461struct omap_hwmod_ocp_if am33xx_l4_ls__timer3 = {
462 .master = &am33xx_l4_ls_hwmod,
463 .slave = &am33xx_timer3_hwmod,
464 .clk = "l4ls_gclk",
465 .user = OCP_USER_MPU,
466};
467
468/* l4 per -> timer4 */
469struct omap_hwmod_ocp_if am33xx_l4_ls__timer4 = {
470 .master = &am33xx_l4_ls_hwmod,
471 .slave = &am33xx_timer4_hwmod,
472 .clk = "l4ls_gclk",
473 .user = OCP_USER_MPU,
474};
475
476/* l4 per -> timer5 */
477struct omap_hwmod_ocp_if am33xx_l4_ls__timer5 = {
478 .master = &am33xx_l4_ls_hwmod,
479 .slave = &am33xx_timer5_hwmod,
480 .clk = "l4ls_gclk",
481 .user = OCP_USER_MPU,
482};
483
484/* l4 per -> timer6 */
485struct omap_hwmod_ocp_if am33xx_l4_ls__timer6 = {
486 .master = &am33xx_l4_ls_hwmod,
487 .slave = &am33xx_timer6_hwmod,
488 .clk = "l4ls_gclk",
489 .user = OCP_USER_MPU,
490};
491
492/* l4 per -> timer7 */
493struct omap_hwmod_ocp_if am33xx_l4_ls__timer7 = {
494 .master = &am33xx_l4_ls_hwmod,
495 .slave = &am33xx_timer7_hwmod,
496 .clk = "l4ls_gclk",
497 .user = OCP_USER_MPU,
498};
499
500/* l3 main -> tpcc */
501struct omap_hwmod_ocp_if am33xx_l3_main__tpcc = {
502 .master = &am33xx_l3_main_hwmod,
503 .slave = &am33xx_tpcc_hwmod,
504 .clk = "l3_gclk",
505 .user = OCP_USER_MPU,
506};
507
508/* l3 main -> tpcc0 */
509static struct omap_hwmod_addr_space am33xx_tptc0_addr_space[] = {
510 {
511 .pa_start = 0x49800000,
512 .pa_end = 0x49800000 + SZ_8K - 1,
513 .flags = ADDR_TYPE_RT,
514 },
515 { }
516};
517
518struct omap_hwmod_ocp_if am33xx_l3_main__tptc0 = {
519 .master = &am33xx_l3_main_hwmod,
520 .slave = &am33xx_tptc0_hwmod,
521 .clk = "l3_gclk",
522 .addr = am33xx_tptc0_addr_space,
523 .user = OCP_USER_MPU,
524};
525
526/* l3 main -> tpcc1 */
527static struct omap_hwmod_addr_space am33xx_tptc1_addr_space[] = {
528 {
529 .pa_start = 0x49900000,
530 .pa_end = 0x49900000 + SZ_8K - 1,
531 .flags = ADDR_TYPE_RT,
532 },
533 { }
534};
535
536struct omap_hwmod_ocp_if am33xx_l3_main__tptc1 = {
537 .master = &am33xx_l3_main_hwmod,
538 .slave = &am33xx_tptc1_hwmod,
539 .clk = "l3_gclk",
540 .addr = am33xx_tptc1_addr_space,
541 .user = OCP_USER_MPU,
542};
543
544/* l3 main -> tpcc2 */
545static struct omap_hwmod_addr_space am33xx_tptc2_addr_space[] = {
546 {
547 .pa_start = 0x49a00000,
548 .pa_end = 0x49a00000 + SZ_8K - 1,
549 .flags = ADDR_TYPE_RT,
550 },
551 { }
552};
553
554struct omap_hwmod_ocp_if am33xx_l3_main__tptc2 = {
555 .master = &am33xx_l3_main_hwmod,
556 .slave = &am33xx_tptc2_hwmod,
557 .clk = "l3_gclk",
558 .addr = am33xx_tptc2_addr_space,
559 .user = OCP_USER_MPU,
560};
561
562/* l4 ls -> uart2 */
563struct omap_hwmod_ocp_if am33xx_l4_ls__uart2 = {
564 .master = &am33xx_l4_ls_hwmod,
565 .slave = &am33xx_uart2_hwmod,
566 .clk = "l4ls_gclk",
567 .user = OCP_USER_MPU,
568};
569
570/* l4 ls -> uart3 */
571struct omap_hwmod_ocp_if am33xx_l4_ls__uart3 = {
572 .master = &am33xx_l4_ls_hwmod,
573 .slave = &am33xx_uart3_hwmod,
574 .clk = "l4ls_gclk",
575 .user = OCP_USER_MPU,
576};
577
578/* l4 ls -> uart4 */
579struct omap_hwmod_ocp_if am33xx_l4_ls__uart4 = {
580 .master = &am33xx_l4_ls_hwmod,
581 .slave = &am33xx_uart4_hwmod,
582 .clk = "l4ls_gclk",
583 .user = OCP_USER_MPU,
584};
585
586/* l4 ls -> uart5 */
587struct omap_hwmod_ocp_if am33xx_l4_ls__uart5 = {
588 .master = &am33xx_l4_ls_hwmod,
589 .slave = &am33xx_uart5_hwmod,
590 .clk = "l4ls_gclk",
591 .user = OCP_USER_MPU,
592};
593
594/* l4 ls -> uart6 */
595struct omap_hwmod_ocp_if am33xx_l4_ls__uart6 = {
596 .master = &am33xx_l4_ls_hwmod,
597 .slave = &am33xx_uart6_hwmod,
598 .clk = "l4ls_gclk",
599 .user = OCP_USER_MPU,
600};
601
602/* l3 main -> ocmc */
603struct omap_hwmod_ocp_if am33xx_l3_main__ocmc = {
604 .master = &am33xx_l3_main_hwmod,
605 .slave = &am33xx_ocmcram_hwmod,
606 .user = OCP_USER_MPU | OCP_USER_SDMA,
607};
608
609/* l3 main -> sha0 HIB2 */
610static struct omap_hwmod_addr_space am33xx_sha0_addrs[] = {
611 {
612 .pa_start = 0x53100000,
613 .pa_end = 0x53100000 + SZ_512 - 1,
614 .flags = ADDR_TYPE_RT
615 },
616 { }
617};
618
619struct omap_hwmod_ocp_if am33xx_l3_main__sha0 = {
620 .master = &am33xx_l3_main_hwmod,
621 .slave = &am33xx_sha0_hwmod,
622 .clk = "sha0_fck",
623 .addr = am33xx_sha0_addrs,
624 .user = OCP_USER_MPU | OCP_USER_SDMA,
625};
626
627/* l3 main -> AES0 HIB2 */
628static struct omap_hwmod_addr_space am33xx_aes0_addrs[] = {
629 {
630 .pa_start = 0x53500000,
631 .pa_end = 0x53500000 + SZ_1M - 1,
632 .flags = ADDR_TYPE_RT
633 },
634 { }
635};
636
637struct omap_hwmod_ocp_if am33xx_l3_main__aes0 = {
638 .master = &am33xx_l3_main_hwmod,
639 .slave = &am33xx_aes0_hwmod,
640 .clk = "aes0_fck",
641 .addr = am33xx_aes0_addrs,
642 .user = OCP_USER_MPU | OCP_USER_SDMA,
643};
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
new file mode 100644
index 000000000000..0f178623e7da
--- /dev/null
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -0,0 +1,1469 @@
1/*
2 *
3 * Copyright (C) 2013 Texas Instruments Incorporated
4 *
5 * Hwmod common for AM335x and AM43x
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/platform_data/gpio-omap.h>
18#include <linux/platform_data/spi-omap2-mcspi.h>
19#include "omap_hwmod.h"
20#include "i2c.h"
21#include "mmc.h"
22#include "wd_timer.h"
23#include "cm33xx.h"
24#include "prm33xx.h"
25#include "omap_hwmod_33xx_43xx_common_data.h"
26#include "prcm43xx.h"
27
28#define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
29#define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl))
30#define RSTST(oh, rstst) ((oh).prcm.omap4.rstst_offs = (rstst))
31
32/*
33 * 'l3' class
34 * instance(s): l3_main, l3_s, l3_instr
35 */
36static struct omap_hwmod_class am33xx_l3_hwmod_class = {
37 .name = "l3",
38};
39
40struct omap_hwmod am33xx_l3_main_hwmod = {
41 .name = "l3_main",
42 .class = &am33xx_l3_hwmod_class,
43 .clkdm_name = "l3_clkdm",
44 .flags = HWMOD_INIT_NO_IDLE,
45 .main_clk = "l3_gclk",
46 .prcm = {
47 .omap4 = {
48 .modulemode = MODULEMODE_SWCTRL,
49 },
50 },
51};
52
53/* l3_s */
54struct omap_hwmod am33xx_l3_s_hwmod = {
55 .name = "l3_s",
56 .class = &am33xx_l3_hwmod_class,
57 .clkdm_name = "l3s_clkdm",
58};
59
60/* l3_instr */
61struct omap_hwmod am33xx_l3_instr_hwmod = {
62 .name = "l3_instr",
63 .class = &am33xx_l3_hwmod_class,
64 .clkdm_name = "l3_clkdm",
65 .flags = HWMOD_INIT_NO_IDLE,
66 .main_clk = "l3_gclk",
67 .prcm = {
68 .omap4 = {
69 .modulemode = MODULEMODE_SWCTRL,
70 },
71 },
72};
73
74/*
75 * 'l4' class
76 * instance(s): l4_ls, l4_hs, l4_wkup, l4_fw
77 */
78struct omap_hwmod_class am33xx_l4_hwmod_class = {
79 .name = "l4",
80};
81
82/* l4_ls */
83struct omap_hwmod am33xx_l4_ls_hwmod = {
84 .name = "l4_ls",
85 .class = &am33xx_l4_hwmod_class,
86 .clkdm_name = "l4ls_clkdm",
87 .flags = HWMOD_INIT_NO_IDLE,
88 .main_clk = "l4ls_gclk",
89 .prcm = {
90 .omap4 = {
91 .modulemode = MODULEMODE_SWCTRL,
92 },
93 },
94};
95
96/* l4_wkup */
97struct omap_hwmod am33xx_l4_wkup_hwmod = {
98 .name = "l4_wkup",
99 .class = &am33xx_l4_hwmod_class,
100 .clkdm_name = "l4_wkup_clkdm",
101 .flags = HWMOD_INIT_NO_IDLE,
102 .prcm = {
103 .omap4 = {
104 .modulemode = MODULEMODE_SWCTRL,
105 },
106 },
107};
108
109/*
110 * 'mpu' class
111 */
112static struct omap_hwmod_class am33xx_mpu_hwmod_class = {
113 .name = "mpu",
114};
115
116struct omap_hwmod am33xx_mpu_hwmod = {
117 .name = "mpu",
118 .class = &am33xx_mpu_hwmod_class,
119 .clkdm_name = "mpu_clkdm",
120 .flags = HWMOD_INIT_NO_IDLE,
121 .main_clk = "dpll_mpu_m2_ck",
122 .prcm = {
123 .omap4 = {
124 .modulemode = MODULEMODE_SWCTRL,
125 },
126 },
127};
128
129/*
130 * 'wakeup m3' class
131 * Wakeup controller sub-system under wakeup domain
132 */
133struct omap_hwmod_class am33xx_wkup_m3_hwmod_class = {
134 .name = "wkup_m3",
135};
136
137/*
138 * 'pru-icss' class
139 * Programmable Real-Time Unit and Industrial Communication Subsystem
140 */
141static struct omap_hwmod_class am33xx_pruss_hwmod_class = {
142 .name = "pruss",
143};
144
145static struct omap_hwmod_rst_info am33xx_pruss_resets[] = {
146 { .name = "pruss", .rst_shift = 1 },
147};
148
149/* pru-icss */
150/* Pseudo hwmod for reset control purpose only */
151struct omap_hwmod am33xx_pruss_hwmod = {
152 .name = "pruss",
153 .class = &am33xx_pruss_hwmod_class,
154 .clkdm_name = "pruss_ocp_clkdm",
155 .main_clk = "pruss_ocp_gclk",
156 .prcm = {
157 .omap4 = {
158 .modulemode = MODULEMODE_SWCTRL,
159 },
160 },
161 .rst_lines = am33xx_pruss_resets,
162 .rst_lines_cnt = ARRAY_SIZE(am33xx_pruss_resets),
163};
164
165/* gfx */
166/* Pseudo hwmod for reset control purpose only */
167static struct omap_hwmod_class am33xx_gfx_hwmod_class = {
168 .name = "gfx",
169};
170
171static struct omap_hwmod_rst_info am33xx_gfx_resets[] = {
172 { .name = "gfx", .rst_shift = 0, .st_shift = 0},
173};
174
175struct omap_hwmod am33xx_gfx_hwmod = {
176 .name = "gfx",
177 .class = &am33xx_gfx_hwmod_class,
178 .clkdm_name = "gfx_l3_clkdm",
179 .main_clk = "gfx_fck_div_ck",
180 .prcm = {
181 .omap4 = {
182 .modulemode = MODULEMODE_SWCTRL,
183 },
184 },
185 .rst_lines = am33xx_gfx_resets,
186 .rst_lines_cnt = ARRAY_SIZE(am33xx_gfx_resets),
187};
188
189/*
190 * 'prcm' class
191 * power and reset manager (whole prcm infrastructure)
192 */
193static struct omap_hwmod_class am33xx_prcm_hwmod_class = {
194 .name = "prcm",
195};
196
197/* prcm */
198struct omap_hwmod am33xx_prcm_hwmod = {
199 .name = "prcm",
200 .class = &am33xx_prcm_hwmod_class,
201 .clkdm_name = "l4_wkup_clkdm",
202};
203
204/*
205 * 'aes0' class
206 */
207static struct omap_hwmod_class_sysconfig am33xx_aes0_sysc = {
208 .rev_offs = 0x80,
209 .sysc_offs = 0x84,
210 .syss_offs = 0x88,
211 .sysc_flags = SYSS_HAS_RESET_STATUS,
212};
213
214static struct omap_hwmod_class am33xx_aes0_hwmod_class = {
215 .name = "aes0",
216 .sysc = &am33xx_aes0_sysc,
217};
218
219struct omap_hwmod am33xx_aes0_hwmod = {
220 .name = "aes",
221 .class = &am33xx_aes0_hwmod_class,
222 .clkdm_name = "l3_clkdm",
223 .main_clk = "aes0_fck",
224 .prcm = {
225 .omap4 = {
226 .modulemode = MODULEMODE_SWCTRL,
227 },
228 },
229};
230
231/* sha0 HIB2 (the 'P' (public) device) */
232static struct omap_hwmod_class_sysconfig am33xx_sha0_sysc = {
233 .rev_offs = 0x100,
234 .sysc_offs = 0x110,
235 .syss_offs = 0x114,
236 .sysc_flags = SYSS_HAS_RESET_STATUS,
237};
238
239static struct omap_hwmod_class am33xx_sha0_hwmod_class = {
240 .name = "sha0",
241 .sysc = &am33xx_sha0_sysc,
242};
243
244struct omap_hwmod am33xx_sha0_hwmod = {
245 .name = "sham",
246 .class = &am33xx_sha0_hwmod_class,
247 .clkdm_name = "l3_clkdm",
248 .main_clk = "l3_gclk",
249 .prcm = {
250 .omap4 = {
251 .modulemode = MODULEMODE_SWCTRL,
252 },
253 },
254};
255
256/* ocmcram */
257static struct omap_hwmod_class am33xx_ocmcram_hwmod_class = {
258 .name = "ocmcram",
259};
260
261struct omap_hwmod am33xx_ocmcram_hwmod = {
262 .name = "ocmcram",
263 .class = &am33xx_ocmcram_hwmod_class,
264 .clkdm_name = "l3_clkdm",
265 .flags = HWMOD_INIT_NO_IDLE,
266 .main_clk = "l3_gclk",
267 .prcm = {
268 .omap4 = {
269 .modulemode = MODULEMODE_SWCTRL,
270 },
271 },
272};
273
274/* 'smartreflex' class */
275static struct omap_hwmod_class am33xx_smartreflex_hwmod_class = {
276 .name = "smartreflex",
277};
278
279/* smartreflex0 */
280struct omap_hwmod am33xx_smartreflex0_hwmod = {
281 .name = "smartreflex0",
282 .class = &am33xx_smartreflex_hwmod_class,
283 .clkdm_name = "l4_wkup_clkdm",
284 .main_clk = "smartreflex0_fck",
285 .prcm = {
286 .omap4 = {
287 .modulemode = MODULEMODE_SWCTRL,
288 },
289 },
290};
291
292/* smartreflex1 */
293struct omap_hwmod am33xx_smartreflex1_hwmod = {
294 .name = "smartreflex1",
295 .class = &am33xx_smartreflex_hwmod_class,
296 .clkdm_name = "l4_wkup_clkdm",
297 .main_clk = "smartreflex1_fck",
298 .prcm = {
299 .omap4 = {
300 .modulemode = MODULEMODE_SWCTRL,
301 },
302 },
303};
304
305/*
306 * 'control' module class
307 */
308struct omap_hwmod_class am33xx_control_hwmod_class = {
309 .name = "control",
310};
311
312/*
313 * 'cpgmac' class
314 * cpsw/cpgmac sub system
315 */
316static struct omap_hwmod_class_sysconfig am33xx_cpgmac_sysc = {
317 .rev_offs = 0x0,
318 .sysc_offs = 0x8,
319 .syss_offs = 0x4,
320 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE |
321 SYSS_HAS_RESET_STATUS),
322 .idlemodes = (SIDLE_FORCE | SIDLE_NO | MSTANDBY_FORCE |
323 MSTANDBY_NO),
324 .sysc_fields = &omap_hwmod_sysc_type3,
325};
326
327static struct omap_hwmod_class am33xx_cpgmac0_hwmod_class = {
328 .name = "cpgmac0",
329 .sysc = &am33xx_cpgmac_sysc,
330};
331
332struct omap_hwmod am33xx_cpgmac0_hwmod = {
333 .name = "cpgmac0",
334 .class = &am33xx_cpgmac0_hwmod_class,
335 .clkdm_name = "cpsw_125mhz_clkdm",
336 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY),
337 .main_clk = "cpsw_125mhz_gclk",
338 .mpu_rt_idx = 1,
339 .prcm = {
340 .omap4 = {
341 .modulemode = MODULEMODE_SWCTRL,
342 },
343 },
344};
345
346/*
347 * mdio class
348 */
349static struct omap_hwmod_class am33xx_mdio_hwmod_class = {
350 .name = "davinci_mdio",
351};
352
353struct omap_hwmod am33xx_mdio_hwmod = {
354 .name = "davinci_mdio",
355 .class = &am33xx_mdio_hwmod_class,
356 .clkdm_name = "cpsw_125mhz_clkdm",
357 .main_clk = "cpsw_125mhz_gclk",
358};
359
360/*
361 * dcan class
362 */
363static struct omap_hwmod_class am33xx_dcan_hwmod_class = {
364 .name = "d_can",
365};
366
367/* dcan0 */
368struct omap_hwmod am33xx_dcan0_hwmod = {
369 .name = "d_can0",
370 .class = &am33xx_dcan_hwmod_class,
371 .clkdm_name = "l4ls_clkdm",
372 .main_clk = "dcan0_fck",
373 .prcm = {
374 .omap4 = {
375 .modulemode = MODULEMODE_SWCTRL,
376 },
377 },
378};
379
380/* dcan1 */
381struct omap_hwmod am33xx_dcan1_hwmod = {
382 .name = "d_can1",
383 .class = &am33xx_dcan_hwmod_class,
384 .clkdm_name = "l4ls_clkdm",
385 .main_clk = "dcan1_fck",
386 .prcm = {
387 .omap4 = {
388 .modulemode = MODULEMODE_SWCTRL,
389 },
390 },
391};
392
393/* elm */
394static struct omap_hwmod_class_sysconfig am33xx_elm_sysc = {
395 .rev_offs = 0x0000,
396 .sysc_offs = 0x0010,
397 .syss_offs = 0x0014,
398 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
399 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
400 SYSS_HAS_RESET_STATUS),
401 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
402 .sysc_fields = &omap_hwmod_sysc_type1,
403};
404
405static struct omap_hwmod_class am33xx_elm_hwmod_class = {
406 .name = "elm",
407 .sysc = &am33xx_elm_sysc,
408};
409
410struct omap_hwmod am33xx_elm_hwmod = {
411 .name = "elm",
412 .class = &am33xx_elm_hwmod_class,
413 .clkdm_name = "l4ls_clkdm",
414 .main_clk = "l4ls_gclk",
415 .prcm = {
416 .omap4 = {
417 .modulemode = MODULEMODE_SWCTRL,
418 },
419 },
420};
421
422/* pwmss */
423static struct omap_hwmod_class_sysconfig am33xx_epwmss_sysc = {
424 .rev_offs = 0x0,
425 .sysc_offs = 0x4,
426 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE),
427 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
428 SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
429 MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
430 .sysc_fields = &omap_hwmod_sysc_type2,
431};
432
433struct omap_hwmod_class am33xx_epwmss_hwmod_class = {
434 .name = "epwmss",
435 .sysc = &am33xx_epwmss_sysc,
436};
437
438static struct omap_hwmod_class am33xx_ecap_hwmod_class = {
439 .name = "ecap",
440};
441
442static struct omap_hwmod_class am33xx_eqep_hwmod_class = {
443 .name = "eqep",
444};
445
446struct omap_hwmod_class am33xx_ehrpwm_hwmod_class = {
447 .name = "ehrpwm",
448};
449
450/* epwmss0 */
451struct omap_hwmod am33xx_epwmss0_hwmod = {
452 .name = "epwmss0",
453 .class = &am33xx_epwmss_hwmod_class,
454 .clkdm_name = "l4ls_clkdm",
455 .main_clk = "l4ls_gclk",
456 .prcm = {
457 .omap4 = {
458 .modulemode = MODULEMODE_SWCTRL,
459 },
460 },
461};
462
463/* ecap0 */
464struct omap_hwmod am33xx_ecap0_hwmod = {
465 .name = "ecap0",
466 .class = &am33xx_ecap_hwmod_class,
467 .clkdm_name = "l4ls_clkdm",
468 .main_clk = "l4ls_gclk",
469};
470
471/* eqep0 */
472struct omap_hwmod am33xx_eqep0_hwmod = {
473 .name = "eqep0",
474 .class = &am33xx_eqep_hwmod_class,
475 .clkdm_name = "l4ls_clkdm",
476 .main_clk = "l4ls_gclk",
477};
478
479/* ehrpwm0 */
480struct omap_hwmod am33xx_ehrpwm0_hwmod = {
481 .name = "ehrpwm0",
482 .class = &am33xx_ehrpwm_hwmod_class,
483 .clkdm_name = "l4ls_clkdm",
484 .main_clk = "l4ls_gclk",
485};
486
487/* epwmss1 */
488struct omap_hwmod am33xx_epwmss1_hwmod = {
489 .name = "epwmss1",
490 .class = &am33xx_epwmss_hwmod_class,
491 .clkdm_name = "l4ls_clkdm",
492 .main_clk = "l4ls_gclk",
493 .prcm = {
494 .omap4 = {
495 .modulemode = MODULEMODE_SWCTRL,
496 },
497 },
498};
499
500/* ecap1 */
501struct omap_hwmod am33xx_ecap1_hwmod = {
502 .name = "ecap1",
503 .class = &am33xx_ecap_hwmod_class,
504 .clkdm_name = "l4ls_clkdm",
505 .main_clk = "l4ls_gclk",
506};
507
508/* eqep1 */
509struct omap_hwmod am33xx_eqep1_hwmod = {
510 .name = "eqep1",
511 .class = &am33xx_eqep_hwmod_class,
512 .clkdm_name = "l4ls_clkdm",
513 .main_clk = "l4ls_gclk",
514};
515
516/* ehrpwm1 */
517struct omap_hwmod am33xx_ehrpwm1_hwmod = {
518 .name = "ehrpwm1",
519 .class = &am33xx_ehrpwm_hwmod_class,
520 .clkdm_name = "l4ls_clkdm",
521 .main_clk = "l4ls_gclk",
522};
523
524/* epwmss2 */
525struct omap_hwmod am33xx_epwmss2_hwmod = {
526 .name = "epwmss2",
527 .class = &am33xx_epwmss_hwmod_class,
528 .clkdm_name = "l4ls_clkdm",
529 .main_clk = "l4ls_gclk",
530 .prcm = {
531 .omap4 = {
532 .modulemode = MODULEMODE_SWCTRL,
533 },
534 },
535};
536
537/* ecap2 */
538struct omap_hwmod am33xx_ecap2_hwmod = {
539 .name = "ecap2",
540 .class = &am33xx_ecap_hwmod_class,
541 .clkdm_name = "l4ls_clkdm",
542 .main_clk = "l4ls_gclk",
543};
544
545/* eqep2 */
546struct omap_hwmod am33xx_eqep2_hwmod = {
547 .name = "eqep2",
548 .class = &am33xx_eqep_hwmod_class,
549 .clkdm_name = "l4ls_clkdm",
550 .main_clk = "l4ls_gclk",
551};
552
553/* ehrpwm2 */
554struct omap_hwmod am33xx_ehrpwm2_hwmod = {
555 .name = "ehrpwm2",
556 .class = &am33xx_ehrpwm_hwmod_class,
557 .clkdm_name = "l4ls_clkdm",
558 .main_clk = "l4ls_gclk",
559};
560
561/*
562 * 'gpio' class: for gpio 0,1,2,3
563 */
564static struct omap_hwmod_class_sysconfig am33xx_gpio_sysc = {
565 .rev_offs = 0x0000,
566 .sysc_offs = 0x0010,
567 .syss_offs = 0x0114,
568 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_ENAWAKEUP |
569 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
570 SYSS_HAS_RESET_STATUS),
571 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
572 SIDLE_SMART_WKUP),
573 .sysc_fields = &omap_hwmod_sysc_type1,
574};
575
576struct omap_hwmod_class am33xx_gpio_hwmod_class = {
577 .name = "gpio",
578 .sysc = &am33xx_gpio_sysc,
579 .rev = 2,
580};
581
582struct omap_gpio_dev_attr gpio_dev_attr = {
583 .bank_width = 32,
584 .dbck_flag = true,
585};
586
587/* gpio1 */
588static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
589 { .role = "dbclk", .clk = "gpio1_dbclk" },
590};
591
592struct omap_hwmod am33xx_gpio1_hwmod = {
593 .name = "gpio2",
594 .class = &am33xx_gpio_hwmod_class,
595 .clkdm_name = "l4ls_clkdm",
596 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
597 .main_clk = "l4ls_gclk",
598 .prcm = {
599 .omap4 = {
600 .modulemode = MODULEMODE_SWCTRL,
601 },
602 },
603 .opt_clks = gpio1_opt_clks,
604 .opt_clks_cnt = ARRAY_SIZE(gpio1_opt_clks),
605 .dev_attr = &gpio_dev_attr,
606};
607
608/* gpio2 */
609static struct omap_hwmod_opt_clk gpio2_opt_clks[] = {
610 { .role = "dbclk", .clk = "gpio2_dbclk" },
611};
612
613struct omap_hwmod am33xx_gpio2_hwmod = {
614 .name = "gpio3",
615 .class = &am33xx_gpio_hwmod_class,
616 .clkdm_name = "l4ls_clkdm",
617 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
618 .main_clk = "l4ls_gclk",
619 .prcm = {
620 .omap4 = {
621 .modulemode = MODULEMODE_SWCTRL,
622 },
623 },
624 .opt_clks = gpio2_opt_clks,
625 .opt_clks_cnt = ARRAY_SIZE(gpio2_opt_clks),
626 .dev_attr = &gpio_dev_attr,
627};
628
629/* gpio3 */
630static struct omap_hwmod_opt_clk gpio3_opt_clks[] = {
631 { .role = "dbclk", .clk = "gpio3_dbclk" },
632};
633
634struct omap_hwmod am33xx_gpio3_hwmod = {
635 .name = "gpio4",
636 .class = &am33xx_gpio_hwmod_class,
637 .clkdm_name = "l4ls_clkdm",
638 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
639 .main_clk = "l4ls_gclk",
640 .prcm = {
641 .omap4 = {
642 .modulemode = MODULEMODE_SWCTRL,
643 },
644 },
645 .opt_clks = gpio3_opt_clks,
646 .opt_clks_cnt = ARRAY_SIZE(gpio3_opt_clks),
647 .dev_attr = &gpio_dev_attr,
648};
649
650/* gpmc */
651static struct omap_hwmod_class_sysconfig gpmc_sysc = {
652 .rev_offs = 0x0,
653 .sysc_offs = 0x10,
654 .syss_offs = 0x14,
655 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE |
656 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
657 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
658 .sysc_fields = &omap_hwmod_sysc_type1,
659};
660
661static struct omap_hwmod_class am33xx_gpmc_hwmod_class = {
662 .name = "gpmc",
663 .sysc = &gpmc_sysc,
664};
665
666struct omap_hwmod am33xx_gpmc_hwmod = {
667 .name = "gpmc",
668 .class = &am33xx_gpmc_hwmod_class,
669 .clkdm_name = "l3s_clkdm",
670 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
671 .main_clk = "l3s_gclk",
672 .prcm = {
673 .omap4 = {
674 .modulemode = MODULEMODE_SWCTRL,
675 },
676 },
677};
678
679/* 'i2c' class */
680static struct omap_hwmod_class_sysconfig am33xx_i2c_sysc = {
681 .sysc_offs = 0x0010,
682 .syss_offs = 0x0090,
683 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
684 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
685 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
686 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
687 SIDLE_SMART_WKUP),
688 .sysc_fields = &omap_hwmod_sysc_type1,
689};
690
691static struct omap_hwmod_class i2c_class = {
692 .name = "i2c",
693 .sysc = &am33xx_i2c_sysc,
694 .rev = OMAP_I2C_IP_VERSION_2,
695 .reset = &omap_i2c_reset,
696};
697
698static struct omap_i2c_dev_attr i2c_dev_attr = {
699 .flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE,
700};
701
702/* i2c1 */
703struct omap_hwmod am33xx_i2c1_hwmod = {
704 .name = "i2c1",
705 .class = &i2c_class,
706 .clkdm_name = "l4_wkup_clkdm",
707 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
708 .main_clk = "dpll_per_m2_div4_wkupdm_ck",
709 .prcm = {
710 .omap4 = {
711 .modulemode = MODULEMODE_SWCTRL,
712 },
713 },
714 .dev_attr = &i2c_dev_attr,
715};
716
717/* i2c1 */
718struct omap_hwmod am33xx_i2c2_hwmod = {
719 .name = "i2c2",
720 .class = &i2c_class,
721 .clkdm_name = "l4ls_clkdm",
722 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
723 .main_clk = "dpll_per_m2_div4_ck",
724 .prcm = {
725 .omap4 = {
726 .modulemode = MODULEMODE_SWCTRL,
727 },
728 },
729 .dev_attr = &i2c_dev_attr,
730};
731
732/* i2c3 */
733struct omap_hwmod am33xx_i2c3_hwmod = {
734 .name = "i2c3",
735 .class = &i2c_class,
736 .clkdm_name = "l4ls_clkdm",
737 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
738 .main_clk = "dpll_per_m2_div4_ck",
739 .prcm = {
740 .omap4 = {
741 .modulemode = MODULEMODE_SWCTRL,
742 },
743 },
744 .dev_attr = &i2c_dev_attr,
745};
746
747/*
748 * 'mailbox' class
749 * mailbox module allowing communication between the on-chip processors using a
750 * queued mailbox-interrupt mechanism.
751 */
752static struct omap_hwmod_class_sysconfig am33xx_mailbox_sysc = {
753 .rev_offs = 0x0000,
754 .sysc_offs = 0x0010,
755 .sysc_flags = (SYSC_HAS_RESET_STATUS | SYSC_HAS_SIDLEMODE |
756 SYSC_HAS_SOFTRESET),
757 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
758 .sysc_fields = &omap_hwmod_sysc_type2,
759};
760
761static struct omap_hwmod_class am33xx_mailbox_hwmod_class = {
762 .name = "mailbox",
763 .sysc = &am33xx_mailbox_sysc,
764};
765
766struct omap_hwmod am33xx_mailbox_hwmod = {
767 .name = "mailbox",
768 .class = &am33xx_mailbox_hwmod_class,
769 .clkdm_name = "l4ls_clkdm",
770 .main_clk = "l4ls_gclk",
771 .prcm = {
772 .omap4 = {
773 .modulemode = MODULEMODE_SWCTRL,
774 },
775 },
776};
777
778/*
779 * 'mcasp' class
780 */
781static struct omap_hwmod_class_sysconfig am33xx_mcasp_sysc = {
782 .rev_offs = 0x0,
783 .sysc_offs = 0x4,
784 .sysc_flags = SYSC_HAS_SIDLEMODE,
785 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
786 .sysc_fields = &omap_hwmod_sysc_type3,
787};
788
789static struct omap_hwmod_class am33xx_mcasp_hwmod_class = {
790 .name = "mcasp",
791 .sysc = &am33xx_mcasp_sysc,
792};
793
794/* mcasp0 */
795struct omap_hwmod am33xx_mcasp0_hwmod = {
796 .name = "mcasp0",
797 .class = &am33xx_mcasp_hwmod_class,
798 .clkdm_name = "l3s_clkdm",
799 .main_clk = "mcasp0_fck",
800 .prcm = {
801 .omap4 = {
802 .modulemode = MODULEMODE_SWCTRL,
803 },
804 },
805};
806
807/* mcasp1 */
808struct omap_hwmod am33xx_mcasp1_hwmod = {
809 .name = "mcasp1",
810 .class = &am33xx_mcasp_hwmod_class,
811 .clkdm_name = "l3s_clkdm",
812 .main_clk = "mcasp1_fck",
813 .prcm = {
814 .omap4 = {
815 .modulemode = MODULEMODE_SWCTRL,
816 },
817 },
818};
819
820/* 'mmc' class */
821static struct omap_hwmod_class_sysconfig am33xx_mmc_sysc = {
822 .rev_offs = 0x1fc,
823 .sysc_offs = 0x10,
824 .syss_offs = 0x14,
825 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
826 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
827 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
828 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
829 .sysc_fields = &omap_hwmod_sysc_type1,
830};
831
832static struct omap_hwmod_class am33xx_mmc_hwmod_class = {
833 .name = "mmc",
834 .sysc = &am33xx_mmc_sysc,
835};
836
837/* mmc0 */
838static struct omap_mmc_dev_attr am33xx_mmc0_dev_attr = {
839 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
840};
841
842struct omap_hwmod am33xx_mmc0_hwmod = {
843 .name = "mmc1",
844 .class = &am33xx_mmc_hwmod_class,
845 .clkdm_name = "l4ls_clkdm",
846 .main_clk = "mmc_clk",
847 .prcm = {
848 .omap4 = {
849 .modulemode = MODULEMODE_SWCTRL,
850 },
851 },
852 .dev_attr = &am33xx_mmc0_dev_attr,
853};
854
855/* mmc1 */
856static struct omap_mmc_dev_attr am33xx_mmc1_dev_attr = {
857 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
858};
859
860struct omap_hwmod am33xx_mmc1_hwmod = {
861 .name = "mmc2",
862 .class = &am33xx_mmc_hwmod_class,
863 .clkdm_name = "l4ls_clkdm",
864 .main_clk = "mmc_clk",
865 .prcm = {
866 .omap4 = {
867 .modulemode = MODULEMODE_SWCTRL,
868 },
869 },
870 .dev_attr = &am33xx_mmc1_dev_attr,
871};
872
873/* mmc2 */
874static struct omap_mmc_dev_attr am33xx_mmc2_dev_attr = {
875 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
876};
877struct omap_hwmod am33xx_mmc2_hwmod = {
878 .name = "mmc3",
879 .class = &am33xx_mmc_hwmod_class,
880 .clkdm_name = "l3s_clkdm",
881 .main_clk = "mmc_clk",
882 .prcm = {
883 .omap4 = {
884 .modulemode = MODULEMODE_SWCTRL,
885 },
886 },
887 .dev_attr = &am33xx_mmc2_dev_attr,
888};
889
890/*
891 * 'rtc' class
892 * rtc subsystem
893 */
894static struct omap_hwmod_class_sysconfig am33xx_rtc_sysc = {
895 .rev_offs = 0x0074,
896 .sysc_offs = 0x0078,
897 .sysc_flags = SYSC_HAS_SIDLEMODE,
898 .idlemodes = (SIDLE_FORCE | SIDLE_NO |
899 SIDLE_SMART | SIDLE_SMART_WKUP),
900 .sysc_fields = &omap_hwmod_sysc_type3,
901};
902
903static struct omap_hwmod_class am33xx_rtc_hwmod_class = {
904 .name = "rtc",
905 .sysc = &am33xx_rtc_sysc,
906};
907
908struct omap_hwmod am33xx_rtc_hwmod = {
909 .name = "rtc",
910 .class = &am33xx_rtc_hwmod_class,
911 .clkdm_name = "l4_rtc_clkdm",
912 .main_clk = "clk_32768_ck",
913 .prcm = {
914 .omap4 = {
915 .modulemode = MODULEMODE_SWCTRL,
916 },
917 },
918};
919
920/* 'spi' class */
921static struct omap_hwmod_class_sysconfig am33xx_mcspi_sysc = {
922 .rev_offs = 0x0000,
923 .sysc_offs = 0x0110,
924 .syss_offs = 0x0114,
925 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
926 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
927 SYSS_HAS_RESET_STATUS),
928 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
929 .sysc_fields = &omap_hwmod_sysc_type1,
930};
931
932struct omap_hwmod_class am33xx_spi_hwmod_class = {
933 .name = "mcspi",
934 .sysc = &am33xx_mcspi_sysc,
935 .rev = OMAP4_MCSPI_REV,
936};
937
938/* spi0 */
939struct omap2_mcspi_dev_attr mcspi_attrib = {
940 .num_chipselect = 2,
941};
942struct omap_hwmod am33xx_spi0_hwmod = {
943 .name = "spi0",
944 .class = &am33xx_spi_hwmod_class,
945 .clkdm_name = "l4ls_clkdm",
946 .main_clk = "dpll_per_m2_div4_ck",
947 .prcm = {
948 .omap4 = {
949 .modulemode = MODULEMODE_SWCTRL,
950 },
951 },
952 .dev_attr = &mcspi_attrib,
953};
954
955/* spi1 */
956struct omap_hwmod am33xx_spi1_hwmod = {
957 .name = "spi1",
958 .class = &am33xx_spi_hwmod_class,
959 .clkdm_name = "l4ls_clkdm",
960 .main_clk = "dpll_per_m2_div4_ck",
961 .prcm = {
962 .omap4 = {
963 .modulemode = MODULEMODE_SWCTRL,
964 },
965 },
966 .dev_attr = &mcspi_attrib,
967};
968
969/*
970 * 'spinlock' class
971 * spinlock provides hardware assistance for synchronizing the
972 * processes running on multiple processors
973 */
974
975static struct omap_hwmod_class_sysconfig am33xx_spinlock_sysc = {
976 .rev_offs = 0x0000,
977 .sysc_offs = 0x0010,
978 .syss_offs = 0x0014,
979 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
980 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
981 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
982 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
983 .sysc_fields = &omap_hwmod_sysc_type1,
984};
985
986static struct omap_hwmod_class am33xx_spinlock_hwmod_class = {
987 .name = "spinlock",
988 .sysc = &am33xx_spinlock_sysc,
989};
990
991struct omap_hwmod am33xx_spinlock_hwmod = {
992 .name = "spinlock",
993 .class = &am33xx_spinlock_hwmod_class,
994 .clkdm_name = "l4ls_clkdm",
995 .main_clk = "l4ls_gclk",
996 .prcm = {
997 .omap4 = {
998 .modulemode = MODULEMODE_SWCTRL,
999 },
1000 },
1001};
1002
1003/* 'timer 2-7' class */
1004static struct omap_hwmod_class_sysconfig am33xx_timer_sysc = {
1005 .rev_offs = 0x0000,
1006 .sysc_offs = 0x0010,
1007 .syss_offs = 0x0014,
1008 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
1009 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1010 SIDLE_SMART_WKUP),
1011 .sysc_fields = &omap_hwmod_sysc_type2,
1012};
1013
1014struct omap_hwmod_class am33xx_timer_hwmod_class = {
1015 .name = "timer",
1016 .sysc = &am33xx_timer_sysc,
1017};
1018
1019/* timer1 1ms */
1020static struct omap_hwmod_class_sysconfig am33xx_timer1ms_sysc = {
1021 .rev_offs = 0x0000,
1022 .sysc_offs = 0x0010,
1023 .syss_offs = 0x0014,
1024 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
1025 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
1026 SYSS_HAS_RESET_STATUS),
1027 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1028 .sysc_fields = &omap_hwmod_sysc_type1,
1029};
1030
1031static struct omap_hwmod_class am33xx_timer1ms_hwmod_class = {
1032 .name = "timer",
1033 .sysc = &am33xx_timer1ms_sysc,
1034};
1035
1036struct omap_hwmod am33xx_timer1_hwmod = {
1037 .name = "timer1",
1038 .class = &am33xx_timer1ms_hwmod_class,
1039 .clkdm_name = "l4_wkup_clkdm",
1040 .main_clk = "timer1_fck",
1041 .prcm = {
1042 .omap4 = {
1043 .modulemode = MODULEMODE_SWCTRL,
1044 },
1045 },
1046};
1047
1048struct omap_hwmod am33xx_timer2_hwmod = {
1049 .name = "timer2",
1050 .class = &am33xx_timer_hwmod_class,
1051 .clkdm_name = "l4ls_clkdm",
1052 .main_clk = "timer2_fck",
1053 .prcm = {
1054 .omap4 = {
1055 .modulemode = MODULEMODE_SWCTRL,
1056 },
1057 },
1058};
1059
1060struct omap_hwmod am33xx_timer3_hwmod = {
1061 .name = "timer3",
1062 .class = &am33xx_timer_hwmod_class,
1063 .clkdm_name = "l4ls_clkdm",
1064 .main_clk = "timer3_fck",
1065 .prcm = {
1066 .omap4 = {
1067 .modulemode = MODULEMODE_SWCTRL,
1068 },
1069 },
1070};
1071
1072struct omap_hwmod am33xx_timer4_hwmod = {
1073 .name = "timer4",
1074 .class = &am33xx_timer_hwmod_class,
1075 .clkdm_name = "l4ls_clkdm",
1076 .main_clk = "timer4_fck",
1077 .prcm = {
1078 .omap4 = {
1079 .modulemode = MODULEMODE_SWCTRL,
1080 },
1081 },
1082};
1083
1084struct omap_hwmod am33xx_timer5_hwmod = {
1085 .name = "timer5",
1086 .class = &am33xx_timer_hwmod_class,
1087 .clkdm_name = "l4ls_clkdm",
1088 .main_clk = "timer5_fck",
1089 .prcm = {
1090 .omap4 = {
1091 .modulemode = MODULEMODE_SWCTRL,
1092 },
1093 },
1094};
1095
1096struct omap_hwmod am33xx_timer6_hwmod = {
1097 .name = "timer6",
1098 .class = &am33xx_timer_hwmod_class,
1099 .clkdm_name = "l4ls_clkdm",
1100 .main_clk = "timer6_fck",
1101 .prcm = {
1102 .omap4 = {
1103 .modulemode = MODULEMODE_SWCTRL,
1104 },
1105 },
1106};
1107
1108struct omap_hwmod am33xx_timer7_hwmod = {
1109 .name = "timer7",
1110 .class = &am33xx_timer_hwmod_class,
1111 .clkdm_name = "l4ls_clkdm",
1112 .main_clk = "timer7_fck",
1113 .prcm = {
1114 .omap4 = {
1115 .modulemode = MODULEMODE_SWCTRL,
1116 },
1117 },
1118};
1119
1120/* tpcc */
1121static struct omap_hwmod_class am33xx_tpcc_hwmod_class = {
1122 .name = "tpcc",
1123};
1124
1125struct omap_hwmod am33xx_tpcc_hwmod = {
1126 .name = "tpcc",
1127 .class = &am33xx_tpcc_hwmod_class,
1128 .clkdm_name = "l3_clkdm",
1129 .main_clk = "l3_gclk",
1130 .prcm = {
1131 .omap4 = {
1132 .modulemode = MODULEMODE_SWCTRL,
1133 },
1134 },
1135};
1136
1137static struct omap_hwmod_class_sysconfig am33xx_tptc_sysc = {
1138 .rev_offs = 0x0,
1139 .sysc_offs = 0x10,
1140 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
1141 SYSC_HAS_MIDLEMODE),
1142 .idlemodes = (SIDLE_FORCE | SIDLE_SMART | MSTANDBY_FORCE),
1143 .sysc_fields = &omap_hwmod_sysc_type2,
1144};
1145
1146/* 'tptc' class */
1147static struct omap_hwmod_class am33xx_tptc_hwmod_class = {
1148 .name = "tptc",
1149 .sysc = &am33xx_tptc_sysc,
1150};
1151
1152/* tptc0 */
1153struct omap_hwmod am33xx_tptc0_hwmod = {
1154 .name = "tptc0",
1155 .class = &am33xx_tptc_hwmod_class,
1156 .clkdm_name = "l3_clkdm",
1157 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
1158 .main_clk = "l3_gclk",
1159 .prcm = {
1160 .omap4 = {
1161 .modulemode = MODULEMODE_SWCTRL,
1162 },
1163 },
1164};
1165
1166/* tptc1 */
1167struct omap_hwmod am33xx_tptc1_hwmod = {
1168 .name = "tptc1",
1169 .class = &am33xx_tptc_hwmod_class,
1170 .clkdm_name = "l3_clkdm",
1171 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY),
1172 .main_clk = "l3_gclk",
1173 .prcm = {
1174 .omap4 = {
1175 .modulemode = MODULEMODE_SWCTRL,
1176 },
1177 },
1178};
1179
1180/* tptc2 */
1181struct omap_hwmod am33xx_tptc2_hwmod = {
1182 .name = "tptc2",
1183 .class = &am33xx_tptc_hwmod_class,
1184 .clkdm_name = "l3_clkdm",
1185 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY),
1186 .main_clk = "l3_gclk",
1187 .prcm = {
1188 .omap4 = {
1189 .modulemode = MODULEMODE_SWCTRL,
1190 },
1191 },
1192};
1193
1194/* 'uart' class */
1195static struct omap_hwmod_class_sysconfig uart_sysc = {
1196 .rev_offs = 0x50,
1197 .sysc_offs = 0x54,
1198 .syss_offs = 0x58,
1199 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_ENAWAKEUP |
1200 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
1201 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1202 SIDLE_SMART_WKUP),
1203 .sysc_fields = &omap_hwmod_sysc_type1,
1204};
1205
1206static struct omap_hwmod_class uart_class = {
1207 .name = "uart",
1208 .sysc = &uart_sysc,
1209};
1210
1211struct omap_hwmod am33xx_uart1_hwmod = {
1212 .name = "uart1",
1213 .class = &uart_class,
1214 .clkdm_name = "l4_wkup_clkdm",
1215 .flags = DEBUG_AM33XXUART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
1216 .main_clk = "dpll_per_m2_div4_wkupdm_ck",
1217 .prcm = {
1218 .omap4 = {
1219 .modulemode = MODULEMODE_SWCTRL,
1220 },
1221 },
1222};
1223
1224struct omap_hwmod am33xx_uart2_hwmod = {
1225 .name = "uart2",
1226 .class = &uart_class,
1227 .clkdm_name = "l4ls_clkdm",
1228 .flags = HWMOD_SWSUP_SIDLE_ACT,
1229 .main_clk = "dpll_per_m2_div4_ck",
1230 .prcm = {
1231 .omap4 = {
1232 .modulemode = MODULEMODE_SWCTRL,
1233 },
1234 },
1235};
1236
1237/* uart3 */
1238struct omap_hwmod am33xx_uart3_hwmod = {
1239 .name = "uart3",
1240 .class = &uart_class,
1241 .clkdm_name = "l4ls_clkdm",
1242 .flags = HWMOD_SWSUP_SIDLE_ACT,
1243 .main_clk = "dpll_per_m2_div4_ck",
1244 .prcm = {
1245 .omap4 = {
1246 .modulemode = MODULEMODE_SWCTRL,
1247 },
1248 },
1249};
1250
1251struct omap_hwmod am33xx_uart4_hwmod = {
1252 .name = "uart4",
1253 .class = &uart_class,
1254 .clkdm_name = "l4ls_clkdm",
1255 .flags = HWMOD_SWSUP_SIDLE_ACT,
1256 .main_clk = "dpll_per_m2_div4_ck",
1257 .prcm = {
1258 .omap4 = {
1259 .modulemode = MODULEMODE_SWCTRL,
1260 },
1261 },
1262};
1263
1264struct omap_hwmod am33xx_uart5_hwmod = {
1265 .name = "uart5",
1266 .class = &uart_class,
1267 .clkdm_name = "l4ls_clkdm",
1268 .flags = HWMOD_SWSUP_SIDLE_ACT,
1269 .main_clk = "dpll_per_m2_div4_ck",
1270 .prcm = {
1271 .omap4 = {
1272 .modulemode = MODULEMODE_SWCTRL,
1273 },
1274 },
1275};
1276
1277struct omap_hwmod am33xx_uart6_hwmod = {
1278 .name = "uart6",
1279 .class = &uart_class,
1280 .clkdm_name = "l4ls_clkdm",
1281 .flags = HWMOD_SWSUP_SIDLE_ACT,
1282 .main_clk = "dpll_per_m2_div4_ck",
1283 .prcm = {
1284 .omap4 = {
1285 .modulemode = MODULEMODE_SWCTRL,
1286 },
1287 },
1288};
1289
1290/* 'wd_timer' class */
1291static struct omap_hwmod_class_sysconfig wdt_sysc = {
1292 .rev_offs = 0x0,
1293 .sysc_offs = 0x10,
1294 .syss_offs = 0x14,
1295 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SIDLEMODE |
1296 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
1297 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1298 SIDLE_SMART_WKUP),
1299 .sysc_fields = &omap_hwmod_sysc_type1,
1300};
1301
1302static struct omap_hwmod_class am33xx_wd_timer_hwmod_class = {
1303 .name = "wd_timer",
1304 .sysc = &wdt_sysc,
1305 .pre_shutdown = &omap2_wd_timer_disable,
1306};
1307
1308/*
1309 * XXX: device.c file uses hardcoded name for watchdog timer
1310 * driver "wd_timer2, so we are also using same name as of now...
1311 */
1312struct omap_hwmod am33xx_wd_timer1_hwmod = {
1313 .name = "wd_timer2",
1314 .class = &am33xx_wd_timer_hwmod_class,
1315 .clkdm_name = "l4_wkup_clkdm",
1316 .flags = HWMOD_SWSUP_SIDLE,
1317 .main_clk = "wdt1_fck",
1318 .prcm = {
1319 .omap4 = {
1320 .modulemode = MODULEMODE_SWCTRL,
1321 },
1322 },
1323};
1324
1325static void omap_hwmod_am33xx_clkctrl(void)
1326{
1327 CLKCTRL(am33xx_uart2_hwmod, AM33XX_CM_PER_UART1_CLKCTRL_OFFSET);
1328 CLKCTRL(am33xx_uart3_hwmod, AM33XX_CM_PER_UART2_CLKCTRL_OFFSET);
1329 CLKCTRL(am33xx_uart4_hwmod, AM33XX_CM_PER_UART3_CLKCTRL_OFFSET);
1330 CLKCTRL(am33xx_uart5_hwmod, AM33XX_CM_PER_UART4_CLKCTRL_OFFSET);
1331 CLKCTRL(am33xx_uart6_hwmod, AM33XX_CM_PER_UART5_CLKCTRL_OFFSET);
1332 CLKCTRL(am33xx_dcan0_hwmod, AM33XX_CM_PER_DCAN0_CLKCTRL_OFFSET);
1333 CLKCTRL(am33xx_dcan1_hwmod, AM33XX_CM_PER_DCAN1_CLKCTRL_OFFSET);
1334 CLKCTRL(am33xx_elm_hwmod, AM33XX_CM_PER_ELM_CLKCTRL_OFFSET);
1335 CLKCTRL(am33xx_epwmss0_hwmod, AM33XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET);
1336 CLKCTRL(am33xx_epwmss1_hwmod, AM33XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET);
1337 CLKCTRL(am33xx_epwmss2_hwmod, AM33XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET);
1338 CLKCTRL(am33xx_gpio1_hwmod, AM33XX_CM_PER_GPIO1_CLKCTRL_OFFSET);
1339 CLKCTRL(am33xx_gpio2_hwmod, AM33XX_CM_PER_GPIO2_CLKCTRL_OFFSET);
1340 CLKCTRL(am33xx_gpio3_hwmod, AM33XX_CM_PER_GPIO3_CLKCTRL_OFFSET);
1341 CLKCTRL(am33xx_i2c2_hwmod, AM33XX_CM_PER_I2C1_CLKCTRL_OFFSET);
1342 CLKCTRL(am33xx_i2c3_hwmod, AM33XX_CM_PER_I2C2_CLKCTRL_OFFSET);
1343 CLKCTRL(am33xx_mailbox_hwmod, AM33XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET);
1344 CLKCTRL(am33xx_mcasp0_hwmod, AM33XX_CM_PER_MCASP0_CLKCTRL_OFFSET);
1345 CLKCTRL(am33xx_mcasp1_hwmod, AM33XX_CM_PER_MCASP1_CLKCTRL_OFFSET);
1346 CLKCTRL(am33xx_mmc0_hwmod, AM33XX_CM_PER_MMC0_CLKCTRL_OFFSET);
1347 CLKCTRL(am33xx_mmc1_hwmod, AM33XX_CM_PER_MMC1_CLKCTRL_OFFSET);
1348 CLKCTRL(am33xx_spi0_hwmod, AM33XX_CM_PER_SPI0_CLKCTRL_OFFSET);
1349 CLKCTRL(am33xx_spi1_hwmod, AM33XX_CM_PER_SPI1_CLKCTRL_OFFSET);
1350 CLKCTRL(am33xx_spinlock_hwmod, AM33XX_CM_PER_SPINLOCK_CLKCTRL_OFFSET);
1351 CLKCTRL(am33xx_timer2_hwmod, AM33XX_CM_PER_TIMER2_CLKCTRL_OFFSET);
1352 CLKCTRL(am33xx_timer3_hwmod, AM33XX_CM_PER_TIMER3_CLKCTRL_OFFSET);
1353 CLKCTRL(am33xx_timer4_hwmod, AM33XX_CM_PER_TIMER4_CLKCTRL_OFFSET);
1354 CLKCTRL(am33xx_timer5_hwmod, AM33XX_CM_PER_TIMER5_CLKCTRL_OFFSET);
1355 CLKCTRL(am33xx_timer6_hwmod, AM33XX_CM_PER_TIMER6_CLKCTRL_OFFSET);
1356 CLKCTRL(am33xx_timer7_hwmod, AM33XX_CM_PER_TIMER7_CLKCTRL_OFFSET);
1357 CLKCTRL(am33xx_smartreflex0_hwmod,
1358 AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
1359 CLKCTRL(am33xx_smartreflex1_hwmod,
1360 AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
1361 CLKCTRL(am33xx_uart1_hwmod, AM33XX_CM_WKUP_UART0_CLKCTRL_OFFSET);
1362 CLKCTRL(am33xx_timer1_hwmod, AM33XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET);
1363 CLKCTRL(am33xx_i2c1_hwmod, AM33XX_CM_WKUP_I2C0_CLKCTRL_OFFSET);
1364 CLKCTRL(am33xx_wd_timer1_hwmod, AM33XX_CM_WKUP_WDT1_CLKCTRL_OFFSET);
1365 CLKCTRL(am33xx_rtc_hwmod, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET);
1366 CLKCTRL(am33xx_mmc2_hwmod, AM33XX_CM_PER_MMC2_CLKCTRL_OFFSET);
1367 CLKCTRL(am33xx_gpmc_hwmod, AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET);
1368 CLKCTRL(am33xx_l4_ls_hwmod, AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET);
1369 CLKCTRL(am33xx_l4_wkup_hwmod, AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET);
1370 CLKCTRL(am33xx_l3_main_hwmod, AM33XX_CM_PER_L3_CLKCTRL_OFFSET);
1371 CLKCTRL(am33xx_tpcc_hwmod, AM33XX_CM_PER_TPCC_CLKCTRL_OFFSET);
1372 CLKCTRL(am33xx_tptc0_hwmod, AM33XX_CM_PER_TPTC0_CLKCTRL_OFFSET);
1373 CLKCTRL(am33xx_tptc1_hwmod, AM33XX_CM_PER_TPTC1_CLKCTRL_OFFSET);
1374 CLKCTRL(am33xx_tptc2_hwmod, AM33XX_CM_PER_TPTC2_CLKCTRL_OFFSET);
1375 CLKCTRL(am33xx_gfx_hwmod, AM33XX_CM_GFX_GFX_CLKCTRL_OFFSET);
1376 CLKCTRL(am33xx_cpgmac0_hwmod, AM33XX_CM_PER_CPGMAC0_CLKCTRL_OFFSET);
1377 CLKCTRL(am33xx_pruss_hwmod, AM33XX_CM_PER_PRUSS_CLKCTRL_OFFSET);
1378 CLKCTRL(am33xx_mpu_hwmod , AM33XX_CM_MPU_MPU_CLKCTRL_OFFSET);
1379 CLKCTRL(am33xx_l3_instr_hwmod , AM33XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET);
1380 CLKCTRL(am33xx_ocmcram_hwmod , AM33XX_CM_PER_OCMCRAM_CLKCTRL_OFFSET);
1381 CLKCTRL(am33xx_sha0_hwmod , AM33XX_CM_PER_SHA0_CLKCTRL_OFFSET);
1382 CLKCTRL(am33xx_aes0_hwmod , AM33XX_CM_PER_AES0_CLKCTRL_OFFSET);
1383}
1384
1385static void omap_hwmod_am33xx_rst(void)
1386{
1387 RSTCTRL(am33xx_pruss_hwmod, AM33XX_RM_PER_RSTCTRL_OFFSET);
1388 RSTCTRL(am33xx_gfx_hwmod, AM33XX_RM_GFX_RSTCTRL_OFFSET);
1389 RSTST(am33xx_gfx_hwmod, AM33XX_RM_GFX_RSTST_OFFSET);
1390}
1391
1392void omap_hwmod_am33xx_reg(void)
1393{
1394 omap_hwmod_am33xx_clkctrl();
1395 omap_hwmod_am33xx_rst();
1396}
1397
1398static void omap_hwmod_am43xx_clkctrl(void)
1399{
1400 CLKCTRL(am33xx_uart2_hwmod, AM43XX_CM_PER_UART1_CLKCTRL_OFFSET);
1401 CLKCTRL(am33xx_uart3_hwmod, AM43XX_CM_PER_UART2_CLKCTRL_OFFSET);
1402 CLKCTRL(am33xx_uart4_hwmod, AM43XX_CM_PER_UART3_CLKCTRL_OFFSET);
1403 CLKCTRL(am33xx_uart5_hwmod, AM43XX_CM_PER_UART4_CLKCTRL_OFFSET);
1404 CLKCTRL(am33xx_uart6_hwmod, AM43XX_CM_PER_UART5_CLKCTRL_OFFSET);
1405 CLKCTRL(am33xx_dcan0_hwmod, AM43XX_CM_PER_DCAN0_CLKCTRL_OFFSET);
1406 CLKCTRL(am33xx_dcan1_hwmod, AM43XX_CM_PER_DCAN1_CLKCTRL_OFFSET);
1407 CLKCTRL(am33xx_elm_hwmod, AM43XX_CM_PER_ELM_CLKCTRL_OFFSET);
1408 CLKCTRL(am33xx_epwmss0_hwmod, AM43XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET);
1409 CLKCTRL(am33xx_epwmss1_hwmod, AM43XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET);
1410 CLKCTRL(am33xx_epwmss2_hwmod, AM43XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET);
1411 CLKCTRL(am33xx_gpio1_hwmod, AM43XX_CM_PER_GPIO1_CLKCTRL_OFFSET);
1412 CLKCTRL(am33xx_gpio2_hwmod, AM43XX_CM_PER_GPIO2_CLKCTRL_OFFSET);
1413 CLKCTRL(am33xx_gpio3_hwmod, AM43XX_CM_PER_GPIO3_CLKCTRL_OFFSET);
1414 CLKCTRL(am33xx_i2c2_hwmod, AM43XX_CM_PER_I2C1_CLKCTRL_OFFSET);
1415 CLKCTRL(am33xx_i2c3_hwmod, AM43XX_CM_PER_I2C2_CLKCTRL_OFFSET);
1416 CLKCTRL(am33xx_mailbox_hwmod, AM43XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET);
1417 CLKCTRL(am33xx_mcasp0_hwmod, AM43XX_CM_PER_MCASP0_CLKCTRL_OFFSET);
1418 CLKCTRL(am33xx_mcasp1_hwmod, AM43XX_CM_PER_MCASP1_CLKCTRL_OFFSET);
1419 CLKCTRL(am33xx_mmc0_hwmod, AM43XX_CM_PER_MMC0_CLKCTRL_OFFSET);
1420 CLKCTRL(am33xx_mmc1_hwmod, AM43XX_CM_PER_MMC1_CLKCTRL_OFFSET);
1421 CLKCTRL(am33xx_spi0_hwmod, AM43XX_CM_PER_SPI0_CLKCTRL_OFFSET);
1422 CLKCTRL(am33xx_spi1_hwmod, AM43XX_CM_PER_SPI1_CLKCTRL_OFFSET);
1423 CLKCTRL(am33xx_spinlock_hwmod, AM43XX_CM_PER_SPINLOCK_CLKCTRL_OFFSET);
1424 CLKCTRL(am33xx_timer2_hwmod, AM43XX_CM_PER_TIMER2_CLKCTRL_OFFSET);
1425 CLKCTRL(am33xx_timer3_hwmod, AM43XX_CM_PER_TIMER3_CLKCTRL_OFFSET);
1426 CLKCTRL(am33xx_timer4_hwmod, AM43XX_CM_PER_TIMER4_CLKCTRL_OFFSET);
1427 CLKCTRL(am33xx_timer5_hwmod, AM43XX_CM_PER_TIMER5_CLKCTRL_OFFSET);
1428 CLKCTRL(am33xx_timer6_hwmod, AM43XX_CM_PER_TIMER6_CLKCTRL_OFFSET);
1429 CLKCTRL(am33xx_timer7_hwmod, AM43XX_CM_PER_TIMER7_CLKCTRL_OFFSET);
1430 CLKCTRL(am33xx_smartreflex0_hwmod,
1431 AM43XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
1432 CLKCTRL(am33xx_smartreflex1_hwmod,
1433 AM43XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
1434 CLKCTRL(am33xx_uart1_hwmod, AM43XX_CM_WKUP_UART0_CLKCTRL_OFFSET);
1435 CLKCTRL(am33xx_timer1_hwmod, AM43XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET);
1436 CLKCTRL(am33xx_i2c1_hwmod, AM43XX_CM_WKUP_I2C0_CLKCTRL_OFFSET);
1437 CLKCTRL(am33xx_wd_timer1_hwmod, AM43XX_CM_WKUP_WDT1_CLKCTRL_OFFSET);
1438 CLKCTRL(am33xx_rtc_hwmod, AM43XX_CM_RTC_RTC_CLKCTRL_OFFSET);
1439 CLKCTRL(am33xx_mmc2_hwmod, AM43XX_CM_PER_MMC2_CLKCTRL_OFFSET);
1440 CLKCTRL(am33xx_gpmc_hwmod, AM43XX_CM_PER_GPMC_CLKCTRL_OFFSET);
1441 CLKCTRL(am33xx_l4_ls_hwmod, AM43XX_CM_PER_L4LS_CLKCTRL_OFFSET);
1442 CLKCTRL(am33xx_l4_wkup_hwmod, AM43XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET);
1443 CLKCTRL(am33xx_l3_main_hwmod, AM43XX_CM_PER_L3_CLKCTRL_OFFSET);
1444 CLKCTRL(am33xx_tpcc_hwmod, AM43XX_CM_PER_TPCC_CLKCTRL_OFFSET);
1445 CLKCTRL(am33xx_tptc0_hwmod, AM43XX_CM_PER_TPTC0_CLKCTRL_OFFSET);
1446 CLKCTRL(am33xx_tptc1_hwmod, AM43XX_CM_PER_TPTC1_CLKCTRL_OFFSET);
1447 CLKCTRL(am33xx_tptc2_hwmod, AM43XX_CM_PER_TPTC2_CLKCTRL_OFFSET);
1448 CLKCTRL(am33xx_gfx_hwmod, AM43XX_CM_GFX_GFX_CLKCTRL_OFFSET);
1449 CLKCTRL(am33xx_cpgmac0_hwmod, AM43XX_CM_PER_CPGMAC0_CLKCTRL_OFFSET);
1450 CLKCTRL(am33xx_pruss_hwmod, AM43XX_CM_PER_PRUSS_CLKCTRL_OFFSET);
1451 CLKCTRL(am33xx_mpu_hwmod , AM43XX_CM_MPU_MPU_CLKCTRL_OFFSET);
1452 CLKCTRL(am33xx_l3_instr_hwmod , AM43XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET);
1453 CLKCTRL(am33xx_ocmcram_hwmod , AM43XX_CM_PER_OCMCRAM_CLKCTRL_OFFSET);
1454 CLKCTRL(am33xx_sha0_hwmod , AM43XX_CM_PER_SHA0_CLKCTRL_OFFSET);
1455 CLKCTRL(am33xx_aes0_hwmod , AM43XX_CM_PER_AES0_CLKCTRL_OFFSET);
1456}
1457
1458static void omap_hwmod_am43xx_rst(void)
1459{
1460 RSTCTRL(am33xx_pruss_hwmod, AM43XX_RM_PER_RSTCTRL_OFFSET);
1461 RSTCTRL(am33xx_gfx_hwmod, AM43XX_RM_GFX_RSTCTRL_OFFSET);
1462 RSTST(am33xx_gfx_hwmod, AM43XX_RM_GFX_RSTST_OFFSET);
1463}
1464
1465void omap_hwmod_am43xx_reg(void)
1466{
1467 omap_hwmod_am43xx_clkctrl();
1468 omap_hwmod_am43xx_rst();
1469}
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index 215894f8910d..6b406ca4bd3b 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -29,6 +29,7 @@
29#include "i2c.h" 29#include "i2c.h"
30#include "mmc.h" 30#include "mmc.h"
31#include "wd_timer.h" 31#include "wd_timer.h"
32#include "omap_hwmod_33xx_43xx_common_data.h"
32 33
33/* 34/*
34 * IP blocks 35 * IP blocks
@@ -52,7 +53,7 @@ static struct omap_hwmod am33xx_emif_hwmod = {
52 .name = "emif", 53 .name = "emif",
53 .class = &am33xx_emif_hwmod_class, 54 .class = &am33xx_emif_hwmod_class,
54 .clkdm_name = "l3_clkdm", 55 .clkdm_name = "l3_clkdm",
55 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET), 56 .flags = HWMOD_INIT_NO_IDLE,
56 .main_clk = "dpll_ddr_m2_div2_ck", 57 .main_clk = "dpll_ddr_m2_div2_ck",
57 .prcm = { 58 .prcm = {
58 .omap4 = { 59 .omap4 = {
@@ -62,79 +63,12 @@ static struct omap_hwmod am33xx_emif_hwmod = {
62 }, 63 },
63}; 64};
64 65
65/*
66 * 'l3' class
67 * instance(s): l3_main, l3_s, l3_instr
68 */
69static struct omap_hwmod_class am33xx_l3_hwmod_class = {
70 .name = "l3",
71};
72
73static struct omap_hwmod am33xx_l3_main_hwmod = {
74 .name = "l3_main",
75 .class = &am33xx_l3_hwmod_class,
76 .clkdm_name = "l3_clkdm",
77 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
78 .main_clk = "l3_gclk",
79 .prcm = {
80 .omap4 = {
81 .clkctrl_offs = AM33XX_CM_PER_L3_CLKCTRL_OFFSET,
82 .modulemode = MODULEMODE_SWCTRL,
83 },
84 },
85};
86
87/* l3_s */
88static struct omap_hwmod am33xx_l3_s_hwmod = {
89 .name = "l3_s",
90 .class = &am33xx_l3_hwmod_class,
91 .clkdm_name = "l3s_clkdm",
92};
93
94/* l3_instr */
95static struct omap_hwmod am33xx_l3_instr_hwmod = {
96 .name = "l3_instr",
97 .class = &am33xx_l3_hwmod_class,
98 .clkdm_name = "l3_clkdm",
99 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
100 .main_clk = "l3_gclk",
101 .prcm = {
102 .omap4 = {
103 .clkctrl_offs = AM33XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET,
104 .modulemode = MODULEMODE_SWCTRL,
105 },
106 },
107};
108
109/*
110 * 'l4' class
111 * instance(s): l4_ls, l4_hs, l4_wkup, l4_fw
112 */
113static struct omap_hwmod_class am33xx_l4_hwmod_class = {
114 .name = "l4",
115};
116
117/* l4_ls */
118static struct omap_hwmod am33xx_l4_ls_hwmod = {
119 .name = "l4_ls",
120 .class = &am33xx_l4_hwmod_class,
121 .clkdm_name = "l4ls_clkdm",
122 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
123 .main_clk = "l4ls_gclk",
124 .prcm = {
125 .omap4 = {
126 .clkctrl_offs = AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET,
127 .modulemode = MODULEMODE_SWCTRL,
128 },
129 },
130};
131
132/* l4_hs */ 66/* l4_hs */
133static struct omap_hwmod am33xx_l4_hs_hwmod = { 67static struct omap_hwmod am33xx_l4_hs_hwmod = {
134 .name = "l4_hs", 68 .name = "l4_hs",
135 .class = &am33xx_l4_hwmod_class, 69 .class = &am33xx_l4_hwmod_class,
136 .clkdm_name = "l4hs_clkdm", 70 .clkdm_name = "l4hs_clkdm",
137 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET), 71 .flags = HWMOD_INIT_NO_IDLE,
138 .main_clk = "l4hs_gclk", 72 .main_clk = "l4hs_gclk",
139 .prcm = { 73 .prcm = {
140 .omap4 = { 74 .omap4 = {
@@ -144,50 +78,6 @@ static struct omap_hwmod am33xx_l4_hs_hwmod = {
144 }, 78 },
145}; 79};
146 80
147
148/* l4_wkup */
149static struct omap_hwmod am33xx_l4_wkup_hwmod = {
150 .name = "l4_wkup",
151 .class = &am33xx_l4_hwmod_class,
152 .clkdm_name = "l4_wkup_clkdm",
153 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
154 .prcm = {
155 .omap4 = {
156 .clkctrl_offs = AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET,
157 .modulemode = MODULEMODE_SWCTRL,
158 },
159 },
160};
161
162/*
163 * 'mpu' class
164 */
165static struct omap_hwmod_class am33xx_mpu_hwmod_class = {
166 .name = "mpu",
167};
168
169static struct omap_hwmod am33xx_mpu_hwmod = {
170 .name = "mpu",
171 .class = &am33xx_mpu_hwmod_class,
172 .clkdm_name = "mpu_clkdm",
173 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
174 .main_clk = "dpll_mpu_m2_ck",
175 .prcm = {
176 .omap4 = {
177 .clkctrl_offs = AM33XX_CM_MPU_MPU_CLKCTRL_OFFSET,
178 .modulemode = MODULEMODE_SWCTRL,
179 },
180 },
181};
182
183/*
184 * 'wakeup m3' class
185 * Wakeup controller sub-system under wakeup domain
186 */
187static struct omap_hwmod_class am33xx_wkup_m3_hwmod_class = {
188 .name = "wkup_m3",
189};
190
191static struct omap_hwmod_rst_info am33xx_wkup_m3_resets[] = { 81static struct omap_hwmod_rst_info am33xx_wkup_m3_resets[] = {
192 { .name = "wkup_m3", .rst_shift = 3, .st_shift = 5 }, 82 { .name = "wkup_m3", .rst_shift = 3, .st_shift = 5 },
193}; 83};
@@ -213,78 +103,6 @@ static struct omap_hwmod am33xx_wkup_m3_hwmod = {
213}; 103};
214 104
215/* 105/*
216 * 'pru-icss' class
217 * Programmable Real-Time Unit and Industrial Communication Subsystem
218 */
219static struct omap_hwmod_class am33xx_pruss_hwmod_class = {
220 .name = "pruss",
221};
222
223static struct omap_hwmod_rst_info am33xx_pruss_resets[] = {
224 { .name = "pruss", .rst_shift = 1 },
225};
226
227/* pru-icss */
228/* Pseudo hwmod for reset control purpose only */
229static struct omap_hwmod am33xx_pruss_hwmod = {
230 .name = "pruss",
231 .class = &am33xx_pruss_hwmod_class,
232 .clkdm_name = "pruss_ocp_clkdm",
233 .main_clk = "pruss_ocp_gclk",
234 .prcm = {
235 .omap4 = {
236 .clkctrl_offs = AM33XX_CM_PER_PRUSS_CLKCTRL_OFFSET,
237 .rstctrl_offs = AM33XX_RM_PER_RSTCTRL_OFFSET,
238 .modulemode = MODULEMODE_SWCTRL,
239 },
240 },
241 .rst_lines = am33xx_pruss_resets,
242 .rst_lines_cnt = ARRAY_SIZE(am33xx_pruss_resets),
243};
244
245/* gfx */
246/* Pseudo hwmod for reset control purpose only */
247static struct omap_hwmod_class am33xx_gfx_hwmod_class = {
248 .name = "gfx",
249};
250
251static struct omap_hwmod_rst_info am33xx_gfx_resets[] = {
252 { .name = "gfx", .rst_shift = 0, .st_shift = 0},
253};
254
255static struct omap_hwmod am33xx_gfx_hwmod = {
256 .name = "gfx",
257 .class = &am33xx_gfx_hwmod_class,
258 .clkdm_name = "gfx_l3_clkdm",
259 .main_clk = "gfx_fck_div_ck",
260 .prcm = {
261 .omap4 = {
262 .clkctrl_offs = AM33XX_CM_GFX_GFX_CLKCTRL_OFFSET,
263 .rstctrl_offs = AM33XX_RM_GFX_RSTCTRL_OFFSET,
264 .rstst_offs = AM33XX_RM_GFX_RSTST_OFFSET,
265 .modulemode = MODULEMODE_SWCTRL,
266 },
267 },
268 .rst_lines = am33xx_gfx_resets,
269 .rst_lines_cnt = ARRAY_SIZE(am33xx_gfx_resets),
270};
271
272/*
273 * 'prcm' class
274 * power and reset manager (whole prcm infrastructure)
275 */
276static struct omap_hwmod_class am33xx_prcm_hwmod_class = {
277 .name = "prcm",
278};
279
280/* prcm */
281static struct omap_hwmod am33xx_prcm_hwmod = {
282 .name = "prcm",
283 .class = &am33xx_prcm_hwmod_class,
284 .clkdm_name = "l4_wkup_clkdm",
285};
286
287/*
288 * 'adc/tsc' class 106 * 'adc/tsc' class
289 * TouchScreen Controller (Anolog-To-Digital Converter) 107 * TouchScreen Controller (Anolog-To-Digital Converter)
290 */ 108 */
@@ -388,79 +206,6 @@ static struct omap_hwmod am33xx_ocpwp_hwmod = {
388#endif 206#endif
389 207
390/* 208/*
391 * 'aes0' class
392 */
393static struct omap_hwmod_class_sysconfig am33xx_aes0_sysc = {
394 .rev_offs = 0x80,
395 .sysc_offs = 0x84,
396 .syss_offs = 0x88,
397 .sysc_flags = SYSS_HAS_RESET_STATUS,
398};
399
400static struct omap_hwmod_class am33xx_aes0_hwmod_class = {
401 .name = "aes0",
402 .sysc = &am33xx_aes0_sysc,
403};
404
405static struct omap_hwmod am33xx_aes0_hwmod = {
406 .name = "aes",
407 .class = &am33xx_aes0_hwmod_class,
408 .clkdm_name = "l3_clkdm",
409 .main_clk = "aes0_fck",
410 .prcm = {
411 .omap4 = {
412 .clkctrl_offs = AM33XX_CM_PER_AES0_CLKCTRL_OFFSET,
413 .modulemode = MODULEMODE_SWCTRL,
414 },
415 },
416};
417
418/* sha0 HIB2 (the 'P' (public) device) */
419static struct omap_hwmod_class_sysconfig am33xx_sha0_sysc = {
420 .rev_offs = 0x100,
421 .sysc_offs = 0x110,
422 .syss_offs = 0x114,
423 .sysc_flags = SYSS_HAS_RESET_STATUS,
424};
425
426static struct omap_hwmod_class am33xx_sha0_hwmod_class = {
427 .name = "sha0",
428 .sysc = &am33xx_sha0_sysc,
429};
430
431static struct omap_hwmod am33xx_sha0_hwmod = {
432 .name = "sham",
433 .class = &am33xx_sha0_hwmod_class,
434 .clkdm_name = "l3_clkdm",
435 .main_clk = "l3_gclk",
436 .prcm = {
437 .omap4 = {
438 .clkctrl_offs = AM33XX_CM_PER_SHA0_CLKCTRL_OFFSET,
439 .modulemode = MODULEMODE_SWCTRL,
440 },
441 },
442};
443
444/* ocmcram */
445static struct omap_hwmod_class am33xx_ocmcram_hwmod_class = {
446 .name = "ocmcram",
447};
448
449static struct omap_hwmod am33xx_ocmcram_hwmod = {
450 .name = "ocmcram",
451 .class = &am33xx_ocmcram_hwmod_class,
452 .clkdm_name = "l3_clkdm",
453 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
454 .main_clk = "l3_gclk",
455 .prcm = {
456 .omap4 = {
457 .clkctrl_offs = AM33XX_CM_PER_OCMCRAM_CLKCTRL_OFFSET,
458 .modulemode = MODULEMODE_SWCTRL,
459 },
460 },
461};
462
463/*
464 * 'debugss' class 209 * 'debugss' class
465 * debug sub system 210 * debug sub system
466 */ 211 */
@@ -488,51 +233,11 @@ static struct omap_hwmod am33xx_debugss_hwmod = {
488 .opt_clks_cnt = ARRAY_SIZE(debugss_opt_clks), 233 .opt_clks_cnt = ARRAY_SIZE(debugss_opt_clks),
489}; 234};
490 235
491/* 'smartreflex' class */
492static struct omap_hwmod_class am33xx_smartreflex_hwmod_class = {
493 .name = "smartreflex",
494};
495
496/* smartreflex0 */
497static struct omap_hwmod am33xx_smartreflex0_hwmod = {
498 .name = "smartreflex0",
499 .class = &am33xx_smartreflex_hwmod_class,
500 .clkdm_name = "l4_wkup_clkdm",
501 .main_clk = "smartreflex0_fck",
502 .prcm = {
503 .omap4 = {
504 .clkctrl_offs = AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET,
505 .modulemode = MODULEMODE_SWCTRL,
506 },
507 },
508};
509
510/* smartreflex1 */
511static struct omap_hwmod am33xx_smartreflex1_hwmod = {
512 .name = "smartreflex1",
513 .class = &am33xx_smartreflex_hwmod_class,
514 .clkdm_name = "l4_wkup_clkdm",
515 .main_clk = "smartreflex1_fck",
516 .prcm = {
517 .omap4 = {
518 .clkctrl_offs = AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET,
519 .modulemode = MODULEMODE_SWCTRL,
520 },
521 },
522};
523
524/*
525 * 'control' module class
526 */
527static struct omap_hwmod_class am33xx_control_hwmod_class = {
528 .name = "control",
529};
530
531static struct omap_hwmod am33xx_control_hwmod = { 236static struct omap_hwmod am33xx_control_hwmod = {
532 .name = "control", 237 .name = "control",
533 .class = &am33xx_control_hwmod_class, 238 .class = &am33xx_control_hwmod_class,
534 .clkdm_name = "l4_wkup_clkdm", 239 .clkdm_name = "l4_wkup_clkdm",
535 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET), 240 .flags = HWMOD_INIT_NO_IDLE,
536 .main_clk = "dpll_core_m4_div2_ck", 241 .main_clk = "dpll_core_m4_div2_ck",
537 .prcm = { 242 .prcm = {
538 .omap4 = { 243 .omap4 = {
@@ -542,288 +247,6 @@ static struct omap_hwmod am33xx_control_hwmod = {
542 }, 247 },
543}; 248};
544 249
545/*
546 * 'cpgmac' class
547 * cpsw/cpgmac sub system
548 */
549static struct omap_hwmod_class_sysconfig am33xx_cpgmac_sysc = {
550 .rev_offs = 0x0,
551 .sysc_offs = 0x8,
552 .syss_offs = 0x4,
553 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE |
554 SYSS_HAS_RESET_STATUS),
555 .idlemodes = (SIDLE_FORCE | SIDLE_NO | MSTANDBY_FORCE |
556 MSTANDBY_NO),
557 .sysc_fields = &omap_hwmod_sysc_type3,
558};
559
560static struct omap_hwmod_class am33xx_cpgmac0_hwmod_class = {
561 .name = "cpgmac0",
562 .sysc = &am33xx_cpgmac_sysc,
563};
564
565static struct omap_hwmod am33xx_cpgmac0_hwmod = {
566 .name = "cpgmac0",
567 .class = &am33xx_cpgmac0_hwmod_class,
568 .clkdm_name = "cpsw_125mhz_clkdm",
569 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY),
570 .main_clk = "cpsw_125mhz_gclk",
571 .mpu_rt_idx = 1,
572 .prcm = {
573 .omap4 = {
574 .clkctrl_offs = AM33XX_CM_PER_CPGMAC0_CLKCTRL_OFFSET,
575 .modulemode = MODULEMODE_SWCTRL,
576 },
577 },
578};
579
580/*
581 * mdio class
582 */
583static struct omap_hwmod_class am33xx_mdio_hwmod_class = {
584 .name = "davinci_mdio",
585};
586
587static struct omap_hwmod am33xx_mdio_hwmod = {
588 .name = "davinci_mdio",
589 .class = &am33xx_mdio_hwmod_class,
590 .clkdm_name = "cpsw_125mhz_clkdm",
591 .main_clk = "cpsw_125mhz_gclk",
592};
593
594/*
595 * dcan class
596 */
597static struct omap_hwmod_class am33xx_dcan_hwmod_class = {
598 .name = "d_can",
599};
600
601/* dcan0 */
602static struct omap_hwmod am33xx_dcan0_hwmod = {
603 .name = "d_can0",
604 .class = &am33xx_dcan_hwmod_class,
605 .clkdm_name = "l4ls_clkdm",
606 .main_clk = "dcan0_fck",
607 .prcm = {
608 .omap4 = {
609 .clkctrl_offs = AM33XX_CM_PER_DCAN0_CLKCTRL_OFFSET,
610 .modulemode = MODULEMODE_SWCTRL,
611 },
612 },
613};
614
615/* dcan1 */
616static struct omap_hwmod am33xx_dcan1_hwmod = {
617 .name = "d_can1",
618 .class = &am33xx_dcan_hwmod_class,
619 .clkdm_name = "l4ls_clkdm",
620 .main_clk = "dcan1_fck",
621 .prcm = {
622 .omap4 = {
623 .clkctrl_offs = AM33XX_CM_PER_DCAN1_CLKCTRL_OFFSET,
624 .modulemode = MODULEMODE_SWCTRL,
625 },
626 },
627};
628
629/* elm */
630static struct omap_hwmod_class_sysconfig am33xx_elm_sysc = {
631 .rev_offs = 0x0000,
632 .sysc_offs = 0x0010,
633 .syss_offs = 0x0014,
634 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
635 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
636 SYSS_HAS_RESET_STATUS),
637 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
638 .sysc_fields = &omap_hwmod_sysc_type1,
639};
640
641static struct omap_hwmod_class am33xx_elm_hwmod_class = {
642 .name = "elm",
643 .sysc = &am33xx_elm_sysc,
644};
645
646static struct omap_hwmod am33xx_elm_hwmod = {
647 .name = "elm",
648 .class = &am33xx_elm_hwmod_class,
649 .clkdm_name = "l4ls_clkdm",
650 .main_clk = "l4ls_gclk",
651 .prcm = {
652 .omap4 = {
653 .clkctrl_offs = AM33XX_CM_PER_ELM_CLKCTRL_OFFSET,
654 .modulemode = MODULEMODE_SWCTRL,
655 },
656 },
657};
658
659/* pwmss */
660static struct omap_hwmod_class_sysconfig am33xx_epwmss_sysc = {
661 .rev_offs = 0x0,
662 .sysc_offs = 0x4,
663 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE),
664 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
665 SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
666 MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
667 .sysc_fields = &omap_hwmod_sysc_type2,
668};
669
670static struct omap_hwmod_class am33xx_epwmss_hwmod_class = {
671 .name = "epwmss",
672 .sysc = &am33xx_epwmss_sysc,
673};
674
675static struct omap_hwmod_class am33xx_ecap_hwmod_class = {
676 .name = "ecap",
677};
678
679static struct omap_hwmod_class am33xx_eqep_hwmod_class = {
680 .name = "eqep",
681};
682
683static struct omap_hwmod_class am33xx_ehrpwm_hwmod_class = {
684 .name = "ehrpwm",
685};
686
687/* epwmss0 */
688static struct omap_hwmod am33xx_epwmss0_hwmod = {
689 .name = "epwmss0",
690 .class = &am33xx_epwmss_hwmod_class,
691 .clkdm_name = "l4ls_clkdm",
692 .main_clk = "l4ls_gclk",
693 .prcm = {
694 .omap4 = {
695 .clkctrl_offs = AM33XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET,
696 .modulemode = MODULEMODE_SWCTRL,
697 },
698 },
699};
700
701/* ecap0 */
702static struct omap_hwmod am33xx_ecap0_hwmod = {
703 .name = "ecap0",
704 .class = &am33xx_ecap_hwmod_class,
705 .clkdm_name = "l4ls_clkdm",
706 .main_clk = "l4ls_gclk",
707};
708
709/* eqep0 */
710static struct omap_hwmod am33xx_eqep0_hwmod = {
711 .name = "eqep0",
712 .class = &am33xx_eqep_hwmod_class,
713 .clkdm_name = "l4ls_clkdm",
714 .main_clk = "l4ls_gclk",
715};
716
717/* ehrpwm0 */
718static struct omap_hwmod am33xx_ehrpwm0_hwmod = {
719 .name = "ehrpwm0",
720 .class = &am33xx_ehrpwm_hwmod_class,
721 .clkdm_name = "l4ls_clkdm",
722 .main_clk = "l4ls_gclk",
723};
724
725/* epwmss1 */
726static struct omap_hwmod am33xx_epwmss1_hwmod = {
727 .name = "epwmss1",
728 .class = &am33xx_epwmss_hwmod_class,
729 .clkdm_name = "l4ls_clkdm",
730 .main_clk = "l4ls_gclk",
731 .prcm = {
732 .omap4 = {
733 .clkctrl_offs = AM33XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET,
734 .modulemode = MODULEMODE_SWCTRL,
735 },
736 },
737};
738
739/* ecap1 */
740static struct omap_hwmod am33xx_ecap1_hwmod = {
741 .name = "ecap1",
742 .class = &am33xx_ecap_hwmod_class,
743 .clkdm_name = "l4ls_clkdm",
744 .main_clk = "l4ls_gclk",
745};
746
747/* eqep1 */
748static struct omap_hwmod am33xx_eqep1_hwmod = {
749 .name = "eqep1",
750 .class = &am33xx_eqep_hwmod_class,
751 .clkdm_name = "l4ls_clkdm",
752 .main_clk = "l4ls_gclk",
753};
754
755/* ehrpwm1 */
756static struct omap_hwmod am33xx_ehrpwm1_hwmod = {
757 .name = "ehrpwm1",
758 .class = &am33xx_ehrpwm_hwmod_class,
759 .clkdm_name = "l4ls_clkdm",
760 .main_clk = "l4ls_gclk",
761};
762
763/* epwmss2 */
764static struct omap_hwmod am33xx_epwmss2_hwmod = {
765 .name = "epwmss2",
766 .class = &am33xx_epwmss_hwmod_class,
767 .clkdm_name = "l4ls_clkdm",
768 .main_clk = "l4ls_gclk",
769 .prcm = {
770 .omap4 = {
771 .clkctrl_offs = AM33XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET,
772 .modulemode = MODULEMODE_SWCTRL,
773 },
774 },
775};
776
777/* ecap2 */
778static struct omap_hwmod am33xx_ecap2_hwmod = {
779 .name = "ecap2",
780 .class = &am33xx_ecap_hwmod_class,
781 .clkdm_name = "l4ls_clkdm",
782 .main_clk = "l4ls_gclk",
783};
784
785/* eqep2 */
786static struct omap_hwmod am33xx_eqep2_hwmod = {
787 .name = "eqep2",
788 .class = &am33xx_eqep_hwmod_class,
789 .clkdm_name = "l4ls_clkdm",
790 .main_clk = "l4ls_gclk",
791};
792
793/* ehrpwm2 */
794static struct omap_hwmod am33xx_ehrpwm2_hwmod = {
795 .name = "ehrpwm2",
796 .class = &am33xx_ehrpwm_hwmod_class,
797 .clkdm_name = "l4ls_clkdm",
798 .main_clk = "l4ls_gclk",
799};
800
801/*
802 * 'gpio' class: for gpio 0,1,2,3
803 */
804static struct omap_hwmod_class_sysconfig am33xx_gpio_sysc = {
805 .rev_offs = 0x0000,
806 .sysc_offs = 0x0010,
807 .syss_offs = 0x0114,
808 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_ENAWAKEUP |
809 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
810 SYSS_HAS_RESET_STATUS),
811 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
812 SIDLE_SMART_WKUP),
813 .sysc_fields = &omap_hwmod_sysc_type1,
814};
815
816static struct omap_hwmod_class am33xx_gpio_hwmod_class = {
817 .name = "gpio",
818 .sysc = &am33xx_gpio_sysc,
819 .rev = 2,
820};
821
822static struct omap_gpio_dev_attr gpio_dev_attr = {
823 .bank_width = 32,
824 .dbck_flag = true,
825};
826
827/* gpio0 */ 250/* gpio0 */
828static struct omap_hwmod_opt_clk gpio0_opt_clks[] = { 251static struct omap_hwmod_opt_clk gpio0_opt_clks[] = {
829 { .role = "dbclk", .clk = "gpio0_dbclk" }, 252 { .role = "dbclk", .clk = "gpio0_dbclk" },
@@ -846,174 +269,6 @@ static struct omap_hwmod am33xx_gpio0_hwmod = {
846 .dev_attr = &gpio_dev_attr, 269 .dev_attr = &gpio_dev_attr,
847}; 270};
848 271
849/* gpio1 */
850static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
851 { .role = "dbclk", .clk = "gpio1_dbclk" },
852};
853
854static struct omap_hwmod am33xx_gpio1_hwmod = {
855 .name = "gpio2",
856 .class = &am33xx_gpio_hwmod_class,
857 .clkdm_name = "l4ls_clkdm",
858 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
859 .main_clk = "l4ls_gclk",
860 .prcm = {
861 .omap4 = {
862 .clkctrl_offs = AM33XX_CM_PER_GPIO1_CLKCTRL_OFFSET,
863 .modulemode = MODULEMODE_SWCTRL,
864 },
865 },
866 .opt_clks = gpio1_opt_clks,
867 .opt_clks_cnt = ARRAY_SIZE(gpio1_opt_clks),
868 .dev_attr = &gpio_dev_attr,
869};
870
871/* gpio2 */
872static struct omap_hwmod_opt_clk gpio2_opt_clks[] = {
873 { .role = "dbclk", .clk = "gpio2_dbclk" },
874};
875
876static struct omap_hwmod am33xx_gpio2_hwmod = {
877 .name = "gpio3",
878 .class = &am33xx_gpio_hwmod_class,
879 .clkdm_name = "l4ls_clkdm",
880 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
881 .main_clk = "l4ls_gclk",
882 .prcm = {
883 .omap4 = {
884 .clkctrl_offs = AM33XX_CM_PER_GPIO2_CLKCTRL_OFFSET,
885 .modulemode = MODULEMODE_SWCTRL,
886 },
887 },
888 .opt_clks = gpio2_opt_clks,
889 .opt_clks_cnt = ARRAY_SIZE(gpio2_opt_clks),
890 .dev_attr = &gpio_dev_attr,
891};
892
893/* gpio3 */
894static struct omap_hwmod_opt_clk gpio3_opt_clks[] = {
895 { .role = "dbclk", .clk = "gpio3_dbclk" },
896};
897
898static struct omap_hwmod am33xx_gpio3_hwmod = {
899 .name = "gpio4",
900 .class = &am33xx_gpio_hwmod_class,
901 .clkdm_name = "l4ls_clkdm",
902 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
903 .main_clk = "l4ls_gclk",
904 .prcm = {
905 .omap4 = {
906 .clkctrl_offs = AM33XX_CM_PER_GPIO3_CLKCTRL_OFFSET,
907 .modulemode = MODULEMODE_SWCTRL,
908 },
909 },
910 .opt_clks = gpio3_opt_clks,
911 .opt_clks_cnt = ARRAY_SIZE(gpio3_opt_clks),
912 .dev_attr = &gpio_dev_attr,
913};
914
915/* gpmc */
916static struct omap_hwmod_class_sysconfig gpmc_sysc = {
917 .rev_offs = 0x0,
918 .sysc_offs = 0x10,
919 .syss_offs = 0x14,
920 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE |
921 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
922 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
923 .sysc_fields = &omap_hwmod_sysc_type1,
924};
925
926static struct omap_hwmod_class am33xx_gpmc_hwmod_class = {
927 .name = "gpmc",
928 .sysc = &gpmc_sysc,
929};
930
931static struct omap_hwmod am33xx_gpmc_hwmod = {
932 .name = "gpmc",
933 .class = &am33xx_gpmc_hwmod_class,
934 .clkdm_name = "l3s_clkdm",
935 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
936 .main_clk = "l3s_gclk",
937 .prcm = {
938 .omap4 = {
939 .clkctrl_offs = AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET,
940 .modulemode = MODULEMODE_SWCTRL,
941 },
942 },
943};
944
945/* 'i2c' class */
946static struct omap_hwmod_class_sysconfig am33xx_i2c_sysc = {
947 .sysc_offs = 0x0010,
948 .syss_offs = 0x0090,
949 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
950 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
951 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
952 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
953 SIDLE_SMART_WKUP),
954 .sysc_fields = &omap_hwmod_sysc_type1,
955};
956
957static struct omap_hwmod_class i2c_class = {
958 .name = "i2c",
959 .sysc = &am33xx_i2c_sysc,
960 .rev = OMAP_I2C_IP_VERSION_2,
961 .reset = &omap_i2c_reset,
962};
963
964static struct omap_i2c_dev_attr i2c_dev_attr = {
965 .flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE,
966};
967
968/* i2c1 */
969static struct omap_hwmod am33xx_i2c1_hwmod = {
970 .name = "i2c1",
971 .class = &i2c_class,
972 .clkdm_name = "l4_wkup_clkdm",
973 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
974 .main_clk = "dpll_per_m2_div4_wkupdm_ck",
975 .prcm = {
976 .omap4 = {
977 .clkctrl_offs = AM33XX_CM_WKUP_I2C0_CLKCTRL_OFFSET,
978 .modulemode = MODULEMODE_SWCTRL,
979 },
980 },
981 .dev_attr = &i2c_dev_attr,
982};
983
984/* i2c1 */
985static struct omap_hwmod am33xx_i2c2_hwmod = {
986 .name = "i2c2",
987 .class = &i2c_class,
988 .clkdm_name = "l4ls_clkdm",
989 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
990 .main_clk = "dpll_per_m2_div4_ck",
991 .prcm = {
992 .omap4 = {
993 .clkctrl_offs = AM33XX_CM_PER_I2C1_CLKCTRL_OFFSET,
994 .modulemode = MODULEMODE_SWCTRL,
995 },
996 },
997 .dev_attr = &i2c_dev_attr,
998};
999
1000/* i2c3 */
1001static struct omap_hwmod am33xx_i2c3_hwmod = {
1002 .name = "i2c3",
1003 .class = &i2c_class,
1004 .clkdm_name = "l4ls_clkdm",
1005 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
1006 .main_clk = "dpll_per_m2_div4_ck",
1007 .prcm = {
1008 .omap4 = {
1009 .clkctrl_offs = AM33XX_CM_PER_I2C2_CLKCTRL_OFFSET,
1010 .modulemode = MODULEMODE_SWCTRL,
1011 },
1012 },
1013 .dev_attr = &i2c_dev_attr,
1014};
1015
1016
1017/* lcdc */ 272/* lcdc */
1018static struct omap_hwmod_class_sysconfig lcdc_sysc = { 273static struct omap_hwmod_class_sysconfig lcdc_sysc = {
1019 .rev_offs = 0x0, 274 .rev_offs = 0x0,
@@ -1043,600 +298,6 @@ static struct omap_hwmod am33xx_lcdc_hwmod = {
1043}; 298};
1044 299
1045/* 300/*
1046 * 'mailbox' class
1047 * mailbox module allowing communication between the on-chip processors using a
1048 * queued mailbox-interrupt mechanism.
1049 */
1050static struct omap_hwmod_class_sysconfig am33xx_mailbox_sysc = {
1051 .rev_offs = 0x0000,
1052 .sysc_offs = 0x0010,
1053 .sysc_flags = (SYSC_HAS_RESET_STATUS | SYSC_HAS_SIDLEMODE |
1054 SYSC_HAS_SOFTRESET),
1055 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1056 .sysc_fields = &omap_hwmod_sysc_type2,
1057};
1058
1059static struct omap_hwmod_class am33xx_mailbox_hwmod_class = {
1060 .name = "mailbox",
1061 .sysc = &am33xx_mailbox_sysc,
1062};
1063
1064static struct omap_hwmod am33xx_mailbox_hwmod = {
1065 .name = "mailbox",
1066 .class = &am33xx_mailbox_hwmod_class,
1067 .clkdm_name = "l4ls_clkdm",
1068 .main_clk = "l4ls_gclk",
1069 .prcm = {
1070 .omap4 = {
1071 .clkctrl_offs = AM33XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET,
1072 .modulemode = MODULEMODE_SWCTRL,
1073 },
1074 },
1075};
1076
1077/*
1078 * 'mcasp' class
1079 */
1080static struct omap_hwmod_class_sysconfig am33xx_mcasp_sysc = {
1081 .rev_offs = 0x0,
1082 .sysc_offs = 0x4,
1083 .sysc_flags = SYSC_HAS_SIDLEMODE,
1084 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1085 .sysc_fields = &omap_hwmod_sysc_type3,
1086};
1087
1088static struct omap_hwmod_class am33xx_mcasp_hwmod_class = {
1089 .name = "mcasp",
1090 .sysc = &am33xx_mcasp_sysc,
1091};
1092
1093/* mcasp0 */
1094static struct omap_hwmod am33xx_mcasp0_hwmod = {
1095 .name = "mcasp0",
1096 .class = &am33xx_mcasp_hwmod_class,
1097 .clkdm_name = "l3s_clkdm",
1098 .main_clk = "mcasp0_fck",
1099 .prcm = {
1100 .omap4 = {
1101 .clkctrl_offs = AM33XX_CM_PER_MCASP0_CLKCTRL_OFFSET,
1102 .modulemode = MODULEMODE_SWCTRL,
1103 },
1104 },
1105};
1106
1107/* mcasp1 */
1108static struct omap_hwmod am33xx_mcasp1_hwmod = {
1109 .name = "mcasp1",
1110 .class = &am33xx_mcasp_hwmod_class,
1111 .clkdm_name = "l3s_clkdm",
1112 .main_clk = "mcasp1_fck",
1113 .prcm = {
1114 .omap4 = {
1115 .clkctrl_offs = AM33XX_CM_PER_MCASP1_CLKCTRL_OFFSET,
1116 .modulemode = MODULEMODE_SWCTRL,
1117 },
1118 },
1119};
1120
1121/* 'mmc' class */
1122static struct omap_hwmod_class_sysconfig am33xx_mmc_sysc = {
1123 .rev_offs = 0x1fc,
1124 .sysc_offs = 0x10,
1125 .syss_offs = 0x14,
1126 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
1127 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
1128 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
1129 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1130 .sysc_fields = &omap_hwmod_sysc_type1,
1131};
1132
1133static struct omap_hwmod_class am33xx_mmc_hwmod_class = {
1134 .name = "mmc",
1135 .sysc = &am33xx_mmc_sysc,
1136};
1137
1138/* mmc0 */
1139static struct omap_mmc_dev_attr am33xx_mmc0_dev_attr = {
1140 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
1141};
1142
1143static struct omap_hwmod am33xx_mmc0_hwmod = {
1144 .name = "mmc1",
1145 .class = &am33xx_mmc_hwmod_class,
1146 .clkdm_name = "l4ls_clkdm",
1147 .main_clk = "mmc_clk",
1148 .prcm = {
1149 .omap4 = {
1150 .clkctrl_offs = AM33XX_CM_PER_MMC0_CLKCTRL_OFFSET,
1151 .modulemode = MODULEMODE_SWCTRL,
1152 },
1153 },
1154 .dev_attr = &am33xx_mmc0_dev_attr,
1155};
1156
1157/* mmc1 */
1158static struct omap_mmc_dev_attr am33xx_mmc1_dev_attr = {
1159 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
1160};
1161
1162static struct omap_hwmod am33xx_mmc1_hwmod = {
1163 .name = "mmc2",
1164 .class = &am33xx_mmc_hwmod_class,
1165 .clkdm_name = "l4ls_clkdm",
1166 .main_clk = "mmc_clk",
1167 .prcm = {
1168 .omap4 = {
1169 .clkctrl_offs = AM33XX_CM_PER_MMC1_CLKCTRL_OFFSET,
1170 .modulemode = MODULEMODE_SWCTRL,
1171 },
1172 },
1173 .dev_attr = &am33xx_mmc1_dev_attr,
1174};
1175
1176/* mmc2 */
1177static struct omap_mmc_dev_attr am33xx_mmc2_dev_attr = {
1178 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
1179};
1180static struct omap_hwmod am33xx_mmc2_hwmod = {
1181 .name = "mmc3",
1182 .class = &am33xx_mmc_hwmod_class,
1183 .clkdm_name = "l3s_clkdm",
1184 .main_clk = "mmc_clk",
1185 .prcm = {
1186 .omap4 = {
1187 .clkctrl_offs = AM33XX_CM_PER_MMC2_CLKCTRL_OFFSET,
1188 .modulemode = MODULEMODE_SWCTRL,
1189 },
1190 },
1191 .dev_attr = &am33xx_mmc2_dev_attr,
1192};
1193
1194/*
1195 * 'rtc' class
1196 * rtc subsystem
1197 */
1198static struct omap_hwmod_class_sysconfig am33xx_rtc_sysc = {
1199 .rev_offs = 0x0074,
1200 .sysc_offs = 0x0078,
1201 .sysc_flags = SYSC_HAS_SIDLEMODE,
1202 .idlemodes = (SIDLE_FORCE | SIDLE_NO |
1203 SIDLE_SMART | SIDLE_SMART_WKUP),
1204 .sysc_fields = &omap_hwmod_sysc_type3,
1205};
1206
1207static struct omap_hwmod_class am33xx_rtc_hwmod_class = {
1208 .name = "rtc",
1209 .sysc = &am33xx_rtc_sysc,
1210};
1211
1212static struct omap_hwmod am33xx_rtc_hwmod = {
1213 .name = "rtc",
1214 .class = &am33xx_rtc_hwmod_class,
1215 .clkdm_name = "l4_rtc_clkdm",
1216 .main_clk = "clk_32768_ck",
1217 .prcm = {
1218 .omap4 = {
1219 .clkctrl_offs = AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET,
1220 .modulemode = MODULEMODE_SWCTRL,
1221 },
1222 },
1223};
1224
1225/* 'spi' class */
1226static struct omap_hwmod_class_sysconfig am33xx_mcspi_sysc = {
1227 .rev_offs = 0x0000,
1228 .sysc_offs = 0x0110,
1229 .syss_offs = 0x0114,
1230 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
1231 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
1232 SYSS_HAS_RESET_STATUS),
1233 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1234 .sysc_fields = &omap_hwmod_sysc_type1,
1235};
1236
1237static struct omap_hwmod_class am33xx_spi_hwmod_class = {
1238 .name = "mcspi",
1239 .sysc = &am33xx_mcspi_sysc,
1240 .rev = OMAP4_MCSPI_REV,
1241};
1242
1243/* spi0 */
1244static struct omap2_mcspi_dev_attr mcspi_attrib = {
1245 .num_chipselect = 2,
1246};
1247static struct omap_hwmod am33xx_spi0_hwmod = {
1248 .name = "spi0",
1249 .class = &am33xx_spi_hwmod_class,
1250 .clkdm_name = "l4ls_clkdm",
1251 .main_clk = "dpll_per_m2_div4_ck",
1252 .prcm = {
1253 .omap4 = {
1254 .clkctrl_offs = AM33XX_CM_PER_SPI0_CLKCTRL_OFFSET,
1255 .modulemode = MODULEMODE_SWCTRL,
1256 },
1257 },
1258 .dev_attr = &mcspi_attrib,
1259};
1260
1261/* spi1 */
1262static struct omap_hwmod am33xx_spi1_hwmod = {
1263 .name = "spi1",
1264 .class = &am33xx_spi_hwmod_class,
1265 .clkdm_name = "l4ls_clkdm",
1266 .main_clk = "dpll_per_m2_div4_ck",
1267 .prcm = {
1268 .omap4 = {
1269 .clkctrl_offs = AM33XX_CM_PER_SPI1_CLKCTRL_OFFSET,
1270 .modulemode = MODULEMODE_SWCTRL,
1271 },
1272 },
1273 .dev_attr = &mcspi_attrib,
1274};
1275
1276/*
1277 * 'spinlock' class
1278 * spinlock provides hardware assistance for synchronizing the
1279 * processes running on multiple processors
1280 */
1281static struct omap_hwmod_class am33xx_spinlock_hwmod_class = {
1282 .name = "spinlock",
1283};
1284
1285static struct omap_hwmod am33xx_spinlock_hwmod = {
1286 .name = "spinlock",
1287 .class = &am33xx_spinlock_hwmod_class,
1288 .clkdm_name = "l4ls_clkdm",
1289 .main_clk = "l4ls_gclk",
1290 .prcm = {
1291 .omap4 = {
1292 .clkctrl_offs = AM33XX_CM_PER_SPINLOCK_CLKCTRL_OFFSET,
1293 .modulemode = MODULEMODE_SWCTRL,
1294 },
1295 },
1296};
1297
1298/* 'timer 2-7' class */
1299static struct omap_hwmod_class_sysconfig am33xx_timer_sysc = {
1300 .rev_offs = 0x0000,
1301 .sysc_offs = 0x0010,
1302 .syss_offs = 0x0014,
1303 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
1304 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1305 SIDLE_SMART_WKUP),
1306 .sysc_fields = &omap_hwmod_sysc_type2,
1307};
1308
1309static struct omap_hwmod_class am33xx_timer_hwmod_class = {
1310 .name = "timer",
1311 .sysc = &am33xx_timer_sysc,
1312};
1313
1314/* timer1 1ms */
1315static struct omap_hwmod_class_sysconfig am33xx_timer1ms_sysc = {
1316 .rev_offs = 0x0000,
1317 .sysc_offs = 0x0010,
1318 .syss_offs = 0x0014,
1319 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
1320 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
1321 SYSS_HAS_RESET_STATUS),
1322 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1323 .sysc_fields = &omap_hwmod_sysc_type1,
1324};
1325
1326static struct omap_hwmod_class am33xx_timer1ms_hwmod_class = {
1327 .name = "timer",
1328 .sysc = &am33xx_timer1ms_sysc,
1329};
1330
1331static struct omap_hwmod am33xx_timer1_hwmod = {
1332 .name = "timer1",
1333 .class = &am33xx_timer1ms_hwmod_class,
1334 .clkdm_name = "l4_wkup_clkdm",
1335 .main_clk = "timer1_fck",
1336 .prcm = {
1337 .omap4 = {
1338 .clkctrl_offs = AM33XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET,
1339 .modulemode = MODULEMODE_SWCTRL,
1340 },
1341 },
1342};
1343
1344static struct omap_hwmod am33xx_timer2_hwmod = {
1345 .name = "timer2",
1346 .class = &am33xx_timer_hwmod_class,
1347 .clkdm_name = "l4ls_clkdm",
1348 .main_clk = "timer2_fck",
1349 .prcm = {
1350 .omap4 = {
1351 .clkctrl_offs = AM33XX_CM_PER_TIMER2_CLKCTRL_OFFSET,
1352 .modulemode = MODULEMODE_SWCTRL,
1353 },
1354 },
1355};
1356
1357static struct omap_hwmod am33xx_timer3_hwmod = {
1358 .name = "timer3",
1359 .class = &am33xx_timer_hwmod_class,
1360 .clkdm_name = "l4ls_clkdm",
1361 .main_clk = "timer3_fck",
1362 .prcm = {
1363 .omap4 = {
1364 .clkctrl_offs = AM33XX_CM_PER_TIMER3_CLKCTRL_OFFSET,
1365 .modulemode = MODULEMODE_SWCTRL,
1366 },
1367 },
1368};
1369
1370static struct omap_hwmod am33xx_timer4_hwmod = {
1371 .name = "timer4",
1372 .class = &am33xx_timer_hwmod_class,
1373 .clkdm_name = "l4ls_clkdm",
1374 .main_clk = "timer4_fck",
1375 .prcm = {
1376 .omap4 = {
1377 .clkctrl_offs = AM33XX_CM_PER_TIMER4_CLKCTRL_OFFSET,
1378 .modulemode = MODULEMODE_SWCTRL,
1379 },
1380 },
1381};
1382
1383static struct omap_hwmod am33xx_timer5_hwmod = {
1384 .name = "timer5",
1385 .class = &am33xx_timer_hwmod_class,
1386 .clkdm_name = "l4ls_clkdm",
1387 .main_clk = "timer5_fck",
1388 .prcm = {
1389 .omap4 = {
1390 .clkctrl_offs = AM33XX_CM_PER_TIMER5_CLKCTRL_OFFSET,
1391 .modulemode = MODULEMODE_SWCTRL,
1392 },
1393 },
1394};
1395
1396static struct omap_hwmod am33xx_timer6_hwmod = {
1397 .name = "timer6",
1398 .class = &am33xx_timer_hwmod_class,
1399 .clkdm_name = "l4ls_clkdm",
1400 .main_clk = "timer6_fck",
1401 .prcm = {
1402 .omap4 = {
1403 .clkctrl_offs = AM33XX_CM_PER_TIMER6_CLKCTRL_OFFSET,
1404 .modulemode = MODULEMODE_SWCTRL,
1405 },
1406 },
1407};
1408
1409static struct omap_hwmod am33xx_timer7_hwmod = {
1410 .name = "timer7",
1411 .class = &am33xx_timer_hwmod_class,
1412 .clkdm_name = "l4ls_clkdm",
1413 .main_clk = "timer7_fck",
1414 .prcm = {
1415 .omap4 = {
1416 .clkctrl_offs = AM33XX_CM_PER_TIMER7_CLKCTRL_OFFSET,
1417 .modulemode = MODULEMODE_SWCTRL,
1418 },
1419 },
1420};
1421
1422/* tpcc */
1423static struct omap_hwmod_class am33xx_tpcc_hwmod_class = {
1424 .name = "tpcc",
1425};
1426
1427static struct omap_hwmod am33xx_tpcc_hwmod = {
1428 .name = "tpcc",
1429 .class = &am33xx_tpcc_hwmod_class,
1430 .clkdm_name = "l3_clkdm",
1431 .main_clk = "l3_gclk",
1432 .prcm = {
1433 .omap4 = {
1434 .clkctrl_offs = AM33XX_CM_PER_TPCC_CLKCTRL_OFFSET,
1435 .modulemode = MODULEMODE_SWCTRL,
1436 },
1437 },
1438};
1439
1440static struct omap_hwmod_class_sysconfig am33xx_tptc_sysc = {
1441 .rev_offs = 0x0,
1442 .sysc_offs = 0x10,
1443 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
1444 SYSC_HAS_MIDLEMODE),
1445 .idlemodes = (SIDLE_FORCE | SIDLE_SMART | MSTANDBY_FORCE),
1446 .sysc_fields = &omap_hwmod_sysc_type2,
1447};
1448
1449/* 'tptc' class */
1450static struct omap_hwmod_class am33xx_tptc_hwmod_class = {
1451 .name = "tptc",
1452 .sysc = &am33xx_tptc_sysc,
1453};
1454
1455/* tptc0 */
1456static struct omap_hwmod am33xx_tptc0_hwmod = {
1457 .name = "tptc0",
1458 .class = &am33xx_tptc_hwmod_class,
1459 .clkdm_name = "l3_clkdm",
1460 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
1461 .main_clk = "l3_gclk",
1462 .prcm = {
1463 .omap4 = {
1464 .clkctrl_offs = AM33XX_CM_PER_TPTC0_CLKCTRL_OFFSET,
1465 .modulemode = MODULEMODE_SWCTRL,
1466 },
1467 },
1468};
1469
1470/* tptc1 */
1471static struct omap_hwmod am33xx_tptc1_hwmod = {
1472 .name = "tptc1",
1473 .class = &am33xx_tptc_hwmod_class,
1474 .clkdm_name = "l3_clkdm",
1475 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY),
1476 .main_clk = "l3_gclk",
1477 .prcm = {
1478 .omap4 = {
1479 .clkctrl_offs = AM33XX_CM_PER_TPTC1_CLKCTRL_OFFSET,
1480 .modulemode = MODULEMODE_SWCTRL,
1481 },
1482 },
1483};
1484
1485/* tptc2 */
1486static struct omap_hwmod am33xx_tptc2_hwmod = {
1487 .name = "tptc2",
1488 .class = &am33xx_tptc_hwmod_class,
1489 .clkdm_name = "l3_clkdm",
1490 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY),
1491 .main_clk = "l3_gclk",
1492 .prcm = {
1493 .omap4 = {
1494 .clkctrl_offs = AM33XX_CM_PER_TPTC2_CLKCTRL_OFFSET,
1495 .modulemode = MODULEMODE_SWCTRL,
1496 },
1497 },
1498};
1499
1500/* 'uart' class */
1501static struct omap_hwmod_class_sysconfig uart_sysc = {
1502 .rev_offs = 0x50,
1503 .sysc_offs = 0x54,
1504 .syss_offs = 0x58,
1505 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_ENAWAKEUP |
1506 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
1507 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1508 SIDLE_SMART_WKUP),
1509 .sysc_fields = &omap_hwmod_sysc_type1,
1510};
1511
1512static struct omap_hwmod_class uart_class = {
1513 .name = "uart",
1514 .sysc = &uart_sysc,
1515};
1516
1517/* uart1 */
1518static struct omap_hwmod am33xx_uart1_hwmod = {
1519 .name = "uart1",
1520 .class = &uart_class,
1521 .clkdm_name = "l4_wkup_clkdm",
1522 .flags = DEBUG_AM33XXUART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
1523 .main_clk = "dpll_per_m2_div4_wkupdm_ck",
1524 .prcm = {
1525 .omap4 = {
1526 .clkctrl_offs = AM33XX_CM_WKUP_UART0_CLKCTRL_OFFSET,
1527 .modulemode = MODULEMODE_SWCTRL,
1528 },
1529 },
1530};
1531
1532static struct omap_hwmod am33xx_uart2_hwmod = {
1533 .name = "uart2",
1534 .class = &uart_class,
1535 .clkdm_name = "l4ls_clkdm",
1536 .flags = HWMOD_SWSUP_SIDLE_ACT,
1537 .main_clk = "dpll_per_m2_div4_ck",
1538 .prcm = {
1539 .omap4 = {
1540 .clkctrl_offs = AM33XX_CM_PER_UART1_CLKCTRL_OFFSET,
1541 .modulemode = MODULEMODE_SWCTRL,
1542 },
1543 },
1544};
1545
1546/* uart3 */
1547static struct omap_hwmod am33xx_uart3_hwmod = {
1548 .name = "uart3",
1549 .class = &uart_class,
1550 .clkdm_name = "l4ls_clkdm",
1551 .flags = HWMOD_SWSUP_SIDLE_ACT,
1552 .main_clk = "dpll_per_m2_div4_ck",
1553 .prcm = {
1554 .omap4 = {
1555 .clkctrl_offs = AM33XX_CM_PER_UART2_CLKCTRL_OFFSET,
1556 .modulemode = MODULEMODE_SWCTRL,
1557 },
1558 },
1559};
1560
1561static struct omap_hwmod am33xx_uart4_hwmod = {
1562 .name = "uart4",
1563 .class = &uart_class,
1564 .clkdm_name = "l4ls_clkdm",
1565 .flags = HWMOD_SWSUP_SIDLE_ACT,
1566 .main_clk = "dpll_per_m2_div4_ck",
1567 .prcm = {
1568 .omap4 = {
1569 .clkctrl_offs = AM33XX_CM_PER_UART3_CLKCTRL_OFFSET,
1570 .modulemode = MODULEMODE_SWCTRL,
1571 },
1572 },
1573};
1574
1575static struct omap_hwmod am33xx_uart5_hwmod = {
1576 .name = "uart5",
1577 .class = &uart_class,
1578 .clkdm_name = "l4ls_clkdm",
1579 .flags = HWMOD_SWSUP_SIDLE_ACT,
1580 .main_clk = "dpll_per_m2_div4_ck",
1581 .prcm = {
1582 .omap4 = {
1583 .clkctrl_offs = AM33XX_CM_PER_UART4_CLKCTRL_OFFSET,
1584 .modulemode = MODULEMODE_SWCTRL,
1585 },
1586 },
1587};
1588
1589static struct omap_hwmod am33xx_uart6_hwmod = {
1590 .name = "uart6",
1591 .class = &uart_class,
1592 .clkdm_name = "l4ls_clkdm",
1593 .flags = HWMOD_SWSUP_SIDLE_ACT,
1594 .main_clk = "dpll_per_m2_div4_ck",
1595 .prcm = {
1596 .omap4 = {
1597 .clkctrl_offs = AM33XX_CM_PER_UART5_CLKCTRL_OFFSET,
1598 .modulemode = MODULEMODE_SWCTRL,
1599 },
1600 },
1601};
1602
1603/* 'wd_timer' class */
1604static struct omap_hwmod_class_sysconfig wdt_sysc = {
1605 .rev_offs = 0x0,
1606 .sysc_offs = 0x10,
1607 .syss_offs = 0x14,
1608 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SIDLEMODE |
1609 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
1610 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1611 SIDLE_SMART_WKUP),
1612 .sysc_fields = &omap_hwmod_sysc_type1,
1613};
1614
1615static struct omap_hwmod_class am33xx_wd_timer_hwmod_class = {
1616 .name = "wd_timer",
1617 .sysc = &wdt_sysc,
1618 .pre_shutdown = &omap2_wd_timer_disable,
1619};
1620
1621/*
1622 * XXX: device.c file uses hardcoded name for watchdog timer
1623 * driver "wd_timer2, so we are also using same name as of now...
1624 */
1625static struct omap_hwmod am33xx_wd_timer1_hwmod = {
1626 .name = "wd_timer2",
1627 .class = &am33xx_wd_timer_hwmod_class,
1628 .clkdm_name = "l4_wkup_clkdm",
1629 .flags = HWMOD_SWSUP_SIDLE,
1630 .main_clk = "wdt1_fck",
1631 .prcm = {
1632 .omap4 = {
1633 .clkctrl_offs = AM33XX_CM_WKUP_WDT1_CLKCTRL_OFFSET,
1634 .modulemode = MODULEMODE_SWCTRL,
1635 },
1636 },
1637};
1638
1639/*
1640 * 'usb_otg' class 301 * 'usb_otg' class
1641 * high-speed on-the-go universal serial bus (usb_otg) controller 302 * high-speed on-the-go universal serial bus (usb_otg) controller
1642 */ 303 */
@@ -1690,14 +351,6 @@ static struct omap_hwmod_ocp_if am33xx_l3_main__emif = {
1690 .user = OCP_USER_MPU | OCP_USER_SDMA, 351 .user = OCP_USER_MPU | OCP_USER_SDMA,
1691}; 352};
1692 353
1693/* mpu -> l3 main */
1694static struct omap_hwmod_ocp_if am33xx_mpu__l3_main = {
1695 .master = &am33xx_mpu_hwmod,
1696 .slave = &am33xx_l3_main_hwmod,
1697 .clk = "dpll_mpu_m2_ck",
1698 .user = OCP_USER_MPU,
1699};
1700
1701/* l3 main -> l4 hs */ 354/* l3 main -> l4 hs */
1702static struct omap_hwmod_ocp_if am33xx_l3_main__l4_hs = { 355static struct omap_hwmod_ocp_if am33xx_l3_main__l4_hs = {
1703 .master = &am33xx_l3_main_hwmod, 356 .master = &am33xx_l3_main_hwmod,
@@ -1706,62 +359,6 @@ static struct omap_hwmod_ocp_if am33xx_l3_main__l4_hs = {
1706 .user = OCP_USER_MPU | OCP_USER_SDMA, 359 .user = OCP_USER_MPU | OCP_USER_SDMA,
1707}; 360};
1708 361
1709/* l3 main -> l3 s */
1710static struct omap_hwmod_ocp_if am33xx_l3_main__l3_s = {
1711 .master = &am33xx_l3_main_hwmod,
1712 .slave = &am33xx_l3_s_hwmod,
1713 .clk = "l3s_gclk",
1714 .user = OCP_USER_MPU | OCP_USER_SDMA,
1715};
1716
1717/* l3 s -> l4 per/ls */
1718static struct omap_hwmod_ocp_if am33xx_l3_s__l4_ls = {
1719 .master = &am33xx_l3_s_hwmod,
1720 .slave = &am33xx_l4_ls_hwmod,
1721 .clk = "l3s_gclk",
1722 .user = OCP_USER_MPU | OCP_USER_SDMA,
1723};
1724
1725/* l3 s -> l4 wkup */
1726static struct omap_hwmod_ocp_if am33xx_l3_s__l4_wkup = {
1727 .master = &am33xx_l3_s_hwmod,
1728 .slave = &am33xx_l4_wkup_hwmod,
1729 .clk = "l3s_gclk",
1730 .user = OCP_USER_MPU | OCP_USER_SDMA,
1731};
1732
1733/* l3 main -> l3 instr */
1734static struct omap_hwmod_ocp_if am33xx_l3_main__l3_instr = {
1735 .master = &am33xx_l3_main_hwmod,
1736 .slave = &am33xx_l3_instr_hwmod,
1737 .clk = "l3s_gclk",
1738 .user = OCP_USER_MPU | OCP_USER_SDMA,
1739};
1740
1741/* mpu -> prcm */
1742static struct omap_hwmod_ocp_if am33xx_mpu__prcm = {
1743 .master = &am33xx_mpu_hwmod,
1744 .slave = &am33xx_prcm_hwmod,
1745 .clk = "dpll_mpu_m2_ck",
1746 .user = OCP_USER_MPU | OCP_USER_SDMA,
1747};
1748
1749/* l3 s -> l3 main*/
1750static struct omap_hwmod_ocp_if am33xx_l3_s__l3_main = {
1751 .master = &am33xx_l3_s_hwmod,
1752 .slave = &am33xx_l3_main_hwmod,
1753 .clk = "l3s_gclk",
1754 .user = OCP_USER_MPU | OCP_USER_SDMA,
1755};
1756
1757/* pru-icss -> l3 main */
1758static struct omap_hwmod_ocp_if am33xx_pruss__l3_main = {
1759 .master = &am33xx_pruss_hwmod,
1760 .slave = &am33xx_l3_main_hwmod,
1761 .clk = "l3_gclk",
1762 .user = OCP_USER_MPU | OCP_USER_SDMA,
1763};
1764
1765/* wkup m3 -> l4 wkup */ 362/* wkup m3 -> l4 wkup */
1766static struct omap_hwmod_ocp_if am33xx_wkup_m3__l4_wkup = { 363static struct omap_hwmod_ocp_if am33xx_wkup_m3__l4_wkup = {
1767 .master = &am33xx_wkup_m3_hwmod, 364 .master = &am33xx_wkup_m3_hwmod,
@@ -1770,14 +367,6 @@ static struct omap_hwmod_ocp_if am33xx_wkup_m3__l4_wkup = {
1770 .user = OCP_USER_MPU | OCP_USER_SDMA, 367 .user = OCP_USER_MPU | OCP_USER_SDMA,
1771}; 368};
1772 369
1773/* gfx -> l3 main */
1774static struct omap_hwmod_ocp_if am33xx_gfx__l3_main = {
1775 .master = &am33xx_gfx_hwmod,
1776 .slave = &am33xx_l3_main_hwmod,
1777 .clk = "dpll_core_m4_ck",
1778 .user = OCP_USER_MPU | OCP_USER_SDMA,
1779};
1780
1781/* l4 wkup -> wkup m3 */ 370/* l4 wkup -> wkup m3 */
1782static struct omap_hwmod_ocp_if am33xx_l4_wkup__wkup_m3 = { 371static struct omap_hwmod_ocp_if am33xx_l4_wkup__wkup_m3 = {
1783 .master = &am33xx_l4_wkup_hwmod, 372 .master = &am33xx_l4_wkup_hwmod,
@@ -1794,14 +383,6 @@ static struct omap_hwmod_ocp_if am33xx_l4_hs__pruss = {
1794 .user = OCP_USER_MPU | OCP_USER_SDMA, 383 .user = OCP_USER_MPU | OCP_USER_SDMA,
1795}; 384};
1796 385
1797/* l3 main -> gfx */
1798static struct omap_hwmod_ocp_if am33xx_l3_main__gfx = {
1799 .master = &am33xx_l3_main_hwmod,
1800 .slave = &am33xx_gfx_hwmod,
1801 .clk = "dpll_core_m4_ck",
1802 .user = OCP_USER_MPU | OCP_USER_SDMA,
1803};
1804
1805/* l3_main -> debugss */ 386/* l3_main -> debugss */
1806static struct omap_hwmod_addr_space am33xx_debugss_addrs[] = { 387static struct omap_hwmod_addr_space am33xx_debugss_addrs[] = {
1807 { 388 {
@@ -1844,54 +425,6 @@ static struct omap_hwmod_ocp_if am33xx_l4_wkup__control = {
1844 .user = OCP_USER_MPU, 425 .user = OCP_USER_MPU,
1845}; 426};
1846 427
1847/* l4 wkup -> rtc */
1848static struct omap_hwmod_ocp_if am33xx_l4_wkup__rtc = {
1849 .master = &am33xx_l4_wkup_hwmod,
1850 .slave = &am33xx_rtc_hwmod,
1851 .clk = "clkdiv32k_ick",
1852 .user = OCP_USER_MPU,
1853};
1854
1855/* l4 per/ls -> DCAN0 */
1856static struct omap_hwmod_ocp_if am33xx_l4_per__dcan0 = {
1857 .master = &am33xx_l4_ls_hwmod,
1858 .slave = &am33xx_dcan0_hwmod,
1859 .clk = "l4ls_gclk",
1860 .user = OCP_USER_MPU | OCP_USER_SDMA,
1861};
1862
1863/* l4 per/ls -> DCAN1 */
1864static struct omap_hwmod_ocp_if am33xx_l4_per__dcan1 = {
1865 .master = &am33xx_l4_ls_hwmod,
1866 .slave = &am33xx_dcan1_hwmod,
1867 .clk = "l4ls_gclk",
1868 .user = OCP_USER_MPU | OCP_USER_SDMA,
1869};
1870
1871/* l4 per/ls -> GPIO2 */
1872static struct omap_hwmod_ocp_if am33xx_l4_per__gpio1 = {
1873 .master = &am33xx_l4_ls_hwmod,
1874 .slave = &am33xx_gpio1_hwmod,
1875 .clk = "l4ls_gclk",
1876 .user = OCP_USER_MPU | OCP_USER_SDMA,
1877};
1878
1879/* l4 per/ls -> gpio3 */
1880static struct omap_hwmod_ocp_if am33xx_l4_per__gpio2 = {
1881 .master = &am33xx_l4_ls_hwmod,
1882 .slave = &am33xx_gpio2_hwmod,
1883 .clk = "l4ls_gclk",
1884 .user = OCP_USER_MPU | OCP_USER_SDMA,
1885};
1886
1887/* l4 per/ls -> gpio4 */
1888static struct omap_hwmod_ocp_if am33xx_l4_per__gpio3 = {
1889 .master = &am33xx_l4_ls_hwmod,
1890 .slave = &am33xx_gpio3_hwmod,
1891 .clk = "l4ls_gclk",
1892 .user = OCP_USER_MPU | OCP_USER_SDMA,
1893};
1894
1895/* L4 WKUP -> I2C1 */ 428/* L4 WKUP -> I2C1 */
1896static struct omap_hwmod_ocp_if am33xx_l4_wkup__i2c1 = { 429static struct omap_hwmod_ocp_if am33xx_l4_wkup__i2c1 = {
1897 .master = &am33xx_l4_wkup_hwmod, 430 .master = &am33xx_l4_wkup_hwmod,
@@ -1933,177 +466,6 @@ static struct omap_hwmod_ocp_if am33xx_l4_hs__cpgmac0 = {
1933 .user = OCP_USER_MPU, 466 .user = OCP_USER_MPU,
1934}; 467};
1935 468
1936static struct omap_hwmod_ocp_if am33xx_cpgmac0__mdio = {
1937 .master = &am33xx_cpgmac0_hwmod,
1938 .slave = &am33xx_mdio_hwmod,
1939 .user = OCP_USER_MPU,
1940};
1941
1942static struct omap_hwmod_addr_space am33xx_elm_addr_space[] = {
1943 {
1944 .pa_start = 0x48080000,
1945 .pa_end = 0x48080000 + SZ_8K - 1,
1946 .flags = ADDR_TYPE_RT
1947 },
1948 { }
1949};
1950
1951static struct omap_hwmod_ocp_if am33xx_l4_ls__elm = {
1952 .master = &am33xx_l4_ls_hwmod,
1953 .slave = &am33xx_elm_hwmod,
1954 .clk = "l4ls_gclk",
1955 .addr = am33xx_elm_addr_space,
1956 .user = OCP_USER_MPU,
1957};
1958
1959static struct omap_hwmod_addr_space am33xx_epwmss0_addr_space[] = {
1960 {
1961 .pa_start = 0x48300000,
1962 .pa_end = 0x48300000 + SZ_16 - 1,
1963 .flags = ADDR_TYPE_RT
1964 },
1965 { }
1966};
1967
1968static struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss0 = {
1969 .master = &am33xx_l4_ls_hwmod,
1970 .slave = &am33xx_epwmss0_hwmod,
1971 .clk = "l4ls_gclk",
1972 .addr = am33xx_epwmss0_addr_space,
1973 .user = OCP_USER_MPU,
1974};
1975
1976static struct omap_hwmod_ocp_if am33xx_epwmss0__ecap0 = {
1977 .master = &am33xx_epwmss0_hwmod,
1978 .slave = &am33xx_ecap0_hwmod,
1979 .clk = "l4ls_gclk",
1980 .user = OCP_USER_MPU,
1981};
1982
1983static struct omap_hwmod_ocp_if am33xx_epwmss0__eqep0 = {
1984 .master = &am33xx_epwmss0_hwmod,
1985 .slave = &am33xx_eqep0_hwmod,
1986 .clk = "l4ls_gclk",
1987 .user = OCP_USER_MPU,
1988};
1989
1990static struct omap_hwmod_ocp_if am33xx_epwmss0__ehrpwm0 = {
1991 .master = &am33xx_epwmss0_hwmod,
1992 .slave = &am33xx_ehrpwm0_hwmod,
1993 .clk = "l4ls_gclk",
1994 .user = OCP_USER_MPU,
1995};
1996
1997
1998static struct omap_hwmod_addr_space am33xx_epwmss1_addr_space[] = {
1999 {
2000 .pa_start = 0x48302000,
2001 .pa_end = 0x48302000 + SZ_16 - 1,
2002 .flags = ADDR_TYPE_RT
2003 },
2004 { }
2005};
2006
2007static struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss1 = {
2008 .master = &am33xx_l4_ls_hwmod,
2009 .slave = &am33xx_epwmss1_hwmod,
2010 .clk = "l4ls_gclk",
2011 .addr = am33xx_epwmss1_addr_space,
2012 .user = OCP_USER_MPU,
2013};
2014
2015static struct omap_hwmod_ocp_if am33xx_epwmss1__ecap1 = {
2016 .master = &am33xx_epwmss1_hwmod,
2017 .slave = &am33xx_ecap1_hwmod,
2018 .clk = "l4ls_gclk",
2019 .user = OCP_USER_MPU,
2020};
2021
2022static struct omap_hwmod_ocp_if am33xx_epwmss1__eqep1 = {
2023 .master = &am33xx_epwmss1_hwmod,
2024 .slave = &am33xx_eqep1_hwmod,
2025 .clk = "l4ls_gclk",
2026 .user = OCP_USER_MPU,
2027};
2028
2029static struct omap_hwmod_ocp_if am33xx_epwmss1__ehrpwm1 = {
2030 .master = &am33xx_epwmss1_hwmod,
2031 .slave = &am33xx_ehrpwm1_hwmod,
2032 .clk = "l4ls_gclk",
2033 .user = OCP_USER_MPU,
2034};
2035
2036static struct omap_hwmod_addr_space am33xx_epwmss2_addr_space[] = {
2037 {
2038 .pa_start = 0x48304000,
2039 .pa_end = 0x48304000 + SZ_16 - 1,
2040 .flags = ADDR_TYPE_RT
2041 },
2042 { }
2043};
2044
2045static struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss2 = {
2046 .master = &am33xx_l4_ls_hwmod,
2047 .slave = &am33xx_epwmss2_hwmod,
2048 .clk = "l4ls_gclk",
2049 .addr = am33xx_epwmss2_addr_space,
2050 .user = OCP_USER_MPU,
2051};
2052
2053static struct omap_hwmod_ocp_if am33xx_epwmss2__ecap2 = {
2054 .master = &am33xx_epwmss2_hwmod,
2055 .slave = &am33xx_ecap2_hwmod,
2056 .clk = "l4ls_gclk",
2057 .user = OCP_USER_MPU,
2058};
2059
2060static struct omap_hwmod_ocp_if am33xx_epwmss2__eqep2 = {
2061 .master = &am33xx_epwmss2_hwmod,
2062 .slave = &am33xx_eqep2_hwmod,
2063 .clk = "l4ls_gclk",
2064 .user = OCP_USER_MPU,
2065};
2066
2067static struct omap_hwmod_ocp_if am33xx_epwmss2__ehrpwm2 = {
2068 .master = &am33xx_epwmss2_hwmod,
2069 .slave = &am33xx_ehrpwm2_hwmod,
2070 .clk = "l4ls_gclk",
2071 .user = OCP_USER_MPU,
2072};
2073
2074/* l3s cfg -> gpmc */
2075static struct omap_hwmod_addr_space am33xx_gpmc_addr_space[] = {
2076 {
2077 .pa_start = 0x50000000,
2078 .pa_end = 0x50000000 + SZ_8K - 1,
2079 .flags = ADDR_TYPE_RT,
2080 },
2081 { }
2082};
2083
2084static struct omap_hwmod_ocp_if am33xx_l3_s__gpmc = {
2085 .master = &am33xx_l3_s_hwmod,
2086 .slave = &am33xx_gpmc_hwmod,
2087 .clk = "l3s_gclk",
2088 .addr = am33xx_gpmc_addr_space,
2089 .user = OCP_USER_MPU,
2090};
2091
2092/* i2c2 */
2093static struct omap_hwmod_ocp_if am33xx_l4_per__i2c2 = {
2094 .master = &am33xx_l4_ls_hwmod,
2095 .slave = &am33xx_i2c2_hwmod,
2096 .clk = "l4ls_gclk",
2097 .user = OCP_USER_MPU,
2098};
2099
2100static struct omap_hwmod_ocp_if am33xx_l4_per__i2c3 = {
2101 .master = &am33xx_l4_ls_hwmod,
2102 .slave = &am33xx_i2c3_hwmod,
2103 .clk = "l4ls_gclk",
2104 .user = OCP_USER_MPU,
2105};
2106
2107static struct omap_hwmod_addr_space am33xx_lcdc_addr_space[] = { 469static struct omap_hwmod_addr_space am33xx_lcdc_addr_space[] = {
2108 { 470 {
2109 .pa_start = 0x4830E000, 471 .pa_start = 0x4830E000,
@@ -2121,138 +483,6 @@ static struct omap_hwmod_ocp_if am33xx_l3_main__lcdc = {
2121 .user = OCP_USER_MPU, 483 .user = OCP_USER_MPU,
2122}; 484};
2123 485
2124static struct omap_hwmod_addr_space am33xx_mailbox_addrs[] = {
2125 {
2126 .pa_start = 0x480C8000,
2127 .pa_end = 0x480C8000 + (SZ_4K - 1),
2128 .flags = ADDR_TYPE_RT
2129 },
2130 { }
2131};
2132
2133/* l4 ls -> mailbox */
2134static struct omap_hwmod_ocp_if am33xx_l4_per__mailbox = {
2135 .master = &am33xx_l4_ls_hwmod,
2136 .slave = &am33xx_mailbox_hwmod,
2137 .clk = "l4ls_gclk",
2138 .addr = am33xx_mailbox_addrs,
2139 .user = OCP_USER_MPU,
2140};
2141
2142/* l4 ls -> spinlock */
2143static struct omap_hwmod_ocp_if am33xx_l4_ls__spinlock = {
2144 .master = &am33xx_l4_ls_hwmod,
2145 .slave = &am33xx_spinlock_hwmod,
2146 .clk = "l4ls_gclk",
2147 .user = OCP_USER_MPU,
2148};
2149
2150/* l4 ls -> mcasp0 */
2151static struct omap_hwmod_addr_space am33xx_mcasp0_addr_space[] = {
2152 {
2153 .pa_start = 0x48038000,
2154 .pa_end = 0x48038000 + SZ_8K - 1,
2155 .flags = ADDR_TYPE_RT
2156 },
2157 { }
2158};
2159
2160static struct omap_hwmod_ocp_if am33xx_l4_ls__mcasp0 = {
2161 .master = &am33xx_l4_ls_hwmod,
2162 .slave = &am33xx_mcasp0_hwmod,
2163 .clk = "l4ls_gclk",
2164 .addr = am33xx_mcasp0_addr_space,
2165 .user = OCP_USER_MPU,
2166};
2167
2168/* l4 ls -> mcasp1 */
2169static struct omap_hwmod_addr_space am33xx_mcasp1_addr_space[] = {
2170 {
2171 .pa_start = 0x4803C000,
2172 .pa_end = 0x4803C000 + SZ_8K - 1,
2173 .flags = ADDR_TYPE_RT
2174 },
2175 { }
2176};
2177
2178static struct omap_hwmod_ocp_if am33xx_l4_ls__mcasp1 = {
2179 .master = &am33xx_l4_ls_hwmod,
2180 .slave = &am33xx_mcasp1_hwmod,
2181 .clk = "l4ls_gclk",
2182 .addr = am33xx_mcasp1_addr_space,
2183 .user = OCP_USER_MPU,
2184};
2185
2186/* l4 ls -> mmc0 */
2187static struct omap_hwmod_addr_space am33xx_mmc0_addr_space[] = {
2188 {
2189 .pa_start = 0x48060100,
2190 .pa_end = 0x48060100 + SZ_4K - 1,
2191 .flags = ADDR_TYPE_RT,
2192 },
2193 { }
2194};
2195
2196static struct omap_hwmod_ocp_if am33xx_l4_ls__mmc0 = {
2197 .master = &am33xx_l4_ls_hwmod,
2198 .slave = &am33xx_mmc0_hwmod,
2199 .clk = "l4ls_gclk",
2200 .addr = am33xx_mmc0_addr_space,
2201 .user = OCP_USER_MPU,
2202};
2203
2204/* l4 ls -> mmc1 */
2205static struct omap_hwmod_addr_space am33xx_mmc1_addr_space[] = {
2206 {
2207 .pa_start = 0x481d8100,
2208 .pa_end = 0x481d8100 + SZ_4K - 1,
2209 .flags = ADDR_TYPE_RT,
2210 },
2211 { }
2212};
2213
2214static struct omap_hwmod_ocp_if am33xx_l4_ls__mmc1 = {
2215 .master = &am33xx_l4_ls_hwmod,
2216 .slave = &am33xx_mmc1_hwmod,
2217 .clk = "l4ls_gclk",
2218 .addr = am33xx_mmc1_addr_space,
2219 .user = OCP_USER_MPU,
2220};
2221
2222/* l3 s -> mmc2 */
2223static struct omap_hwmod_addr_space am33xx_mmc2_addr_space[] = {
2224 {
2225 .pa_start = 0x47810100,
2226 .pa_end = 0x47810100 + SZ_64K - 1,
2227 .flags = ADDR_TYPE_RT,
2228 },
2229 { }
2230};
2231
2232static struct omap_hwmod_ocp_if am33xx_l3_s__mmc2 = {
2233 .master = &am33xx_l3_s_hwmod,
2234 .slave = &am33xx_mmc2_hwmod,
2235 .clk = "l3s_gclk",
2236 .addr = am33xx_mmc2_addr_space,
2237 .user = OCP_USER_MPU,
2238};
2239
2240/* l4 ls -> mcspi0 */
2241static struct omap_hwmod_ocp_if am33xx_l4_ls__mcspi0 = {
2242 .master = &am33xx_l4_ls_hwmod,
2243 .slave = &am33xx_spi0_hwmod,
2244 .clk = "l4ls_gclk",
2245 .user = OCP_USER_MPU,
2246};
2247
2248/* l4 ls -> mcspi1 */
2249static struct omap_hwmod_ocp_if am33xx_l4_ls__mcspi1 = {
2250 .master = &am33xx_l4_ls_hwmod,
2251 .slave = &am33xx_spi1_hwmod,
2252 .clk = "l4ls_gclk",
2253 .user = OCP_USER_MPU,
2254};
2255
2256/* l4 wkup -> timer1 */ 486/* l4 wkup -> timer1 */
2257static struct omap_hwmod_ocp_if am33xx_l4_wkup__timer1 = { 487static struct omap_hwmod_ocp_if am33xx_l4_wkup__timer1 = {
2258 .master = &am33xx_l4_wkup_hwmod, 488 .master = &am33xx_l4_wkup_hwmod,
@@ -2261,116 +491,6 @@ static struct omap_hwmod_ocp_if am33xx_l4_wkup__timer1 = {
2261 .user = OCP_USER_MPU, 491 .user = OCP_USER_MPU,
2262}; 492};
2263 493
2264/* l4 per -> timer2 */
2265static struct omap_hwmod_ocp_if am33xx_l4_ls__timer2 = {
2266 .master = &am33xx_l4_ls_hwmod,
2267 .slave = &am33xx_timer2_hwmod,
2268 .clk = "l4ls_gclk",
2269 .user = OCP_USER_MPU,
2270};
2271
2272/* l4 per -> timer3 */
2273static struct omap_hwmod_ocp_if am33xx_l4_ls__timer3 = {
2274 .master = &am33xx_l4_ls_hwmod,
2275 .slave = &am33xx_timer3_hwmod,
2276 .clk = "l4ls_gclk",
2277 .user = OCP_USER_MPU,
2278};
2279
2280/* l4 per -> timer4 */
2281static struct omap_hwmod_ocp_if am33xx_l4_ls__timer4 = {
2282 .master = &am33xx_l4_ls_hwmod,
2283 .slave = &am33xx_timer4_hwmod,
2284 .clk = "l4ls_gclk",
2285 .user = OCP_USER_MPU,
2286};
2287
2288/* l4 per -> timer5 */
2289static struct omap_hwmod_ocp_if am33xx_l4_ls__timer5 = {
2290 .master = &am33xx_l4_ls_hwmod,
2291 .slave = &am33xx_timer5_hwmod,
2292 .clk = "l4ls_gclk",
2293 .user = OCP_USER_MPU,
2294};
2295
2296/* l4 per -> timer6 */
2297static struct omap_hwmod_ocp_if am33xx_l4_ls__timer6 = {
2298 .master = &am33xx_l4_ls_hwmod,
2299 .slave = &am33xx_timer6_hwmod,
2300 .clk = "l4ls_gclk",
2301 .user = OCP_USER_MPU,
2302};
2303
2304/* l4 per -> timer7 */
2305static struct omap_hwmod_ocp_if am33xx_l4_ls__timer7 = {
2306 .master = &am33xx_l4_ls_hwmod,
2307 .slave = &am33xx_timer7_hwmod,
2308 .clk = "l4ls_gclk",
2309 .user = OCP_USER_MPU,
2310};
2311
2312/* l3 main -> tpcc */
2313static struct omap_hwmod_ocp_if am33xx_l3_main__tpcc = {
2314 .master = &am33xx_l3_main_hwmod,
2315 .slave = &am33xx_tpcc_hwmod,
2316 .clk = "l3_gclk",
2317 .user = OCP_USER_MPU,
2318};
2319
2320/* l3 main -> tpcc0 */
2321static struct omap_hwmod_addr_space am33xx_tptc0_addr_space[] = {
2322 {
2323 .pa_start = 0x49800000,
2324 .pa_end = 0x49800000 + SZ_8K - 1,
2325 .flags = ADDR_TYPE_RT,
2326 },
2327 { }
2328};
2329
2330static struct omap_hwmod_ocp_if am33xx_l3_main__tptc0 = {
2331 .master = &am33xx_l3_main_hwmod,
2332 .slave = &am33xx_tptc0_hwmod,
2333 .clk = "l3_gclk",
2334 .addr = am33xx_tptc0_addr_space,
2335 .user = OCP_USER_MPU,
2336};
2337
2338/* l3 main -> tpcc1 */
2339static struct omap_hwmod_addr_space am33xx_tptc1_addr_space[] = {
2340 {
2341 .pa_start = 0x49900000,
2342 .pa_end = 0x49900000 + SZ_8K - 1,
2343 .flags = ADDR_TYPE_RT,
2344 },
2345 { }
2346};
2347
2348static struct omap_hwmod_ocp_if am33xx_l3_main__tptc1 = {
2349 .master = &am33xx_l3_main_hwmod,
2350 .slave = &am33xx_tptc1_hwmod,
2351 .clk = "l3_gclk",
2352 .addr = am33xx_tptc1_addr_space,
2353 .user = OCP_USER_MPU,
2354};
2355
2356/* l3 main -> tpcc2 */
2357static struct omap_hwmod_addr_space am33xx_tptc2_addr_space[] = {
2358 {
2359 .pa_start = 0x49a00000,
2360 .pa_end = 0x49a00000 + SZ_8K - 1,
2361 .flags = ADDR_TYPE_RT,
2362 },
2363 { }
2364};
2365
2366static struct omap_hwmod_ocp_if am33xx_l3_main__tptc2 = {
2367 .master = &am33xx_l3_main_hwmod,
2368 .slave = &am33xx_tptc2_hwmod,
2369 .clk = "l3_gclk",
2370 .addr = am33xx_tptc2_addr_space,
2371 .user = OCP_USER_MPU,
2372};
2373
2374/* l4 wkup -> uart1 */ 494/* l4 wkup -> uart1 */
2375static struct omap_hwmod_ocp_if am33xx_l4_wkup__uart1 = { 495static struct omap_hwmod_ocp_if am33xx_l4_wkup__uart1 = {
2376 .master = &am33xx_l4_wkup_hwmod, 496 .master = &am33xx_l4_wkup_hwmod,
@@ -2379,46 +499,6 @@ static struct omap_hwmod_ocp_if am33xx_l4_wkup__uart1 = {
2379 .user = OCP_USER_MPU, 499 .user = OCP_USER_MPU,
2380}; 500};
2381 501
2382/* l4 ls -> uart2 */
2383static struct omap_hwmod_ocp_if am33xx_l4_ls__uart2 = {
2384 .master = &am33xx_l4_ls_hwmod,
2385 .slave = &am33xx_uart2_hwmod,
2386 .clk = "l4ls_gclk",
2387 .user = OCP_USER_MPU,
2388};
2389
2390/* l4 ls -> uart3 */
2391static struct omap_hwmod_ocp_if am33xx_l4_ls__uart3 = {
2392 .master = &am33xx_l4_ls_hwmod,
2393 .slave = &am33xx_uart3_hwmod,
2394 .clk = "l4ls_gclk",
2395 .user = OCP_USER_MPU,
2396};
2397
2398/* l4 ls -> uart4 */
2399static struct omap_hwmod_ocp_if am33xx_l4_ls__uart4 = {
2400 .master = &am33xx_l4_ls_hwmod,
2401 .slave = &am33xx_uart4_hwmod,
2402 .clk = "l4ls_gclk",
2403 .user = OCP_USER_MPU,
2404};
2405
2406/* l4 ls -> uart5 */
2407static struct omap_hwmod_ocp_if am33xx_l4_ls__uart5 = {
2408 .master = &am33xx_l4_ls_hwmod,
2409 .slave = &am33xx_uart5_hwmod,
2410 .clk = "l4ls_gclk",
2411 .user = OCP_USER_MPU,
2412};
2413
2414/* l4 ls -> uart6 */
2415static struct omap_hwmod_ocp_if am33xx_l4_ls__uart6 = {
2416 .master = &am33xx_l4_ls_hwmod,
2417 .slave = &am33xx_uart6_hwmod,
2418 .clk = "l4ls_gclk",
2419 .user = OCP_USER_MPU,
2420};
2421
2422/* l4 wkup -> wd_timer1 */ 502/* l4 wkup -> wd_timer1 */
2423static struct omap_hwmod_ocp_if am33xx_l4_wkup__wd_timer1 = { 503static struct omap_hwmod_ocp_if am33xx_l4_wkup__wd_timer1 = {
2424 .master = &am33xx_l4_wkup_hwmod, 504 .master = &am33xx_l4_wkup_hwmod,
@@ -2437,47 +517,39 @@ static struct omap_hwmod_ocp_if am33xx_l3_s__usbss = {
2437 .flags = OCPIF_SWSUP_IDLE, 517 .flags = OCPIF_SWSUP_IDLE,
2438}; 518};
2439 519
2440/* l3 main -> ocmc */ 520/* rng */
2441static struct omap_hwmod_ocp_if am33xx_l3_main__ocmc = { 521static struct omap_hwmod_class_sysconfig am33xx_rng_sysc = {
2442 .master = &am33xx_l3_main_hwmod, 522 .rev_offs = 0x1fe0,
2443 .slave = &am33xx_ocmcram_hwmod, 523 .sysc_offs = 0x1fe4,
2444 .user = OCP_USER_MPU | OCP_USER_SDMA, 524 .sysc_flags = SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE,
2445}; 525 .idlemodes = SIDLE_FORCE | SIDLE_NO,
2446 526 .sysc_fields = &omap_hwmod_sysc_type1,
2447/* l3 main -> sha0 HIB2 */
2448static struct omap_hwmod_addr_space am33xx_sha0_addrs[] = {
2449 {
2450 .pa_start = 0x53100000,
2451 .pa_end = 0x53100000 + SZ_512 - 1,
2452 .flags = ADDR_TYPE_RT
2453 },
2454 { }
2455}; 527};
2456 528
2457static struct omap_hwmod_ocp_if am33xx_l3_main__sha0 = { 529static struct omap_hwmod_class am33xx_rng_hwmod_class = {
2458 .master = &am33xx_l3_main_hwmod, 530 .name = "rng",
2459 .slave = &am33xx_sha0_hwmod, 531 .sysc = &am33xx_rng_sysc,
2460 .clk = "sha0_fck",
2461 .addr = am33xx_sha0_addrs,
2462 .user = OCP_USER_MPU | OCP_USER_SDMA,
2463}; 532};
2464 533
2465/* l3 main -> AES0 HIB2 */ 534static struct omap_hwmod am33xx_rng_hwmod = {
2466static struct omap_hwmod_addr_space am33xx_aes0_addrs[] = { 535 .name = "rng",
2467 { 536 .class = &am33xx_rng_hwmod_class,
2468 .pa_start = 0x53500000, 537 .clkdm_name = "l4ls_clkdm",
2469 .pa_end = 0x53500000 + SZ_1M - 1, 538 .flags = HWMOD_SWSUP_SIDLE,
2470 .flags = ADDR_TYPE_RT 539 .main_clk = "rng_fck",
540 .prcm = {
541 .omap4 = {
542 .clkctrl_offs = AM33XX_CM_PER_RNG_CLKCTRL_OFFSET,
543 .modulemode = MODULEMODE_SWCTRL,
544 },
2471 }, 545 },
2472 { }
2473}; 546};
2474 547
2475static struct omap_hwmod_ocp_if am33xx_l3_main__aes0 = { 548static struct omap_hwmod_ocp_if am33xx_l4_per__rng = {
2476 .master = &am33xx_l3_main_hwmod, 549 .master = &am33xx_l4_ls_hwmod,
2477 .slave = &am33xx_aes0_hwmod, 550 .slave = &am33xx_rng_hwmod,
2478 .clk = "aes0_fck", 551 .clk = "rng_fck",
2479 .addr = am33xx_aes0_addrs, 552 .user = OCP_USER_MPU,
2480 .user = OCP_USER_MPU | OCP_USER_SDMA,
2481}; 553};
2482 554
2483static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = { 555static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
@@ -2559,11 +631,13 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
2559 &am33xx_cpgmac0__mdio, 631 &am33xx_cpgmac0__mdio,
2560 &am33xx_l3_main__sha0, 632 &am33xx_l3_main__sha0,
2561 &am33xx_l3_main__aes0, 633 &am33xx_l3_main__aes0,
634 &am33xx_l4_per__rng,
2562 NULL, 635 NULL,
2563}; 636};
2564 637
2565int __init am33xx_hwmod_init(void) 638int __init am33xx_hwmod_init(void)
2566{ 639{
640 omap_hwmod_am33xx_reg();
2567 omap_hwmod_init(); 641 omap_hwmod_init();
2568 return omap_hwmod_register_links(am33xx_hwmod_ocp_ifs); 642 return omap_hwmod_register_links(am33xx_hwmod_ocp_ifs);
2569} 643}
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 0c3a427da544..9e56fabd7fa3 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -3693,6 +3693,53 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__aes = {
3693 .user = OCP_USER_MPU | OCP_USER_SDMA, 3693 .user = OCP_USER_MPU | OCP_USER_SDMA,
3694}; 3694};
3695 3695
3696/*
3697 * 'ssi' class
3698 * synchronous serial interface (multichannel and full-duplex serial if)
3699 */
3700
3701static struct omap_hwmod_class_sysconfig omap34xx_ssi_sysc = {
3702 .rev_offs = 0x0000,
3703 .sysc_offs = 0x0010,
3704 .syss_offs = 0x0014,
3705 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_EMUFREE |
3706 SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE |
3707 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
3708 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
3709 SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
3710 MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
3711 .sysc_fields = &omap_hwmod_sysc_type1,
3712};
3713
3714static struct omap_hwmod_class omap34xx_ssi_hwmod_class = {
3715 .name = "ssi",
3716 .sysc = &omap34xx_ssi_sysc,
3717};
3718
3719static struct omap_hwmod omap34xx_ssi_hwmod = {
3720 .name = "ssi",
3721 .class = &omap34xx_ssi_hwmod_class,
3722 .clkdm_name = "core_l4_clkdm",
3723 .main_clk = "ssi_ssr_fck",
3724 .prcm = {
3725 .omap2 = {
3726 .prcm_reg_id = 1,
3727 .module_bit = OMAP3430_EN_SSI_SHIFT,
3728 .module_offs = CORE_MOD,
3729 .idlest_reg_id = 1,
3730 .idlest_idle_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT,
3731 },
3732 },
3733};
3734
3735/* L4 CORE -> SSI */
3736static struct omap_hwmod_ocp_if omap34xx_l4_core__ssi = {
3737 .master = &omap3xxx_l4_core_hwmod,
3738 .slave = &omap34xx_ssi_hwmod,
3739 .clk = "ssi_ick",
3740 .user = OCP_USER_MPU | OCP_USER_SDMA,
3741};
3742
3696static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = { 3743static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = {
3697 &omap3xxx_l3_main__l4_core, 3744 &omap3xxx_l3_main__l4_core,
3698 &omap3xxx_l3_main__l4_per, 3745 &omap3xxx_l3_main__l4_per,
@@ -3818,6 +3865,7 @@ static struct omap_hwmod_ocp_if *omap34xx_hwmod_ocp_ifs[] __initdata = {
3818#ifdef CONFIG_OMAP_IOMMU_IVA2 3865#ifdef CONFIG_OMAP_IOMMU_IVA2
3819 &omap3xxx_l3_main__mmu_iva, 3866 &omap3xxx_l3_main__mmu_iva,
3820#endif 3867#endif
3868 &omap34xx_l4_core__ssi,
3821 NULL 3869 NULL
3822}; 3870};
3823 3871
diff --git a/arch/arm/mach-omap2/omap_hwmod_43xx_data.c b/arch/arm/mach-omap2/omap_hwmod_43xx_data.c
new file mode 100644
index 000000000000..9002fca76699
--- /dev/null
+++ b/arch/arm/mach-omap2/omap_hwmod_43xx_data.c
@@ -0,0 +1,758 @@
1/*
2 * Copyright (C) 2013 Texas Instruments Incorporated
3 *
4 * Hwmod present only in AM43x and those that differ other than register
5 * offsets as compared to AM335x.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/platform_data/gpio-omap.h>
18#include <linux/platform_data/spi-omap2-mcspi.h>
19#include "omap_hwmod.h"
20#include "omap_hwmod_33xx_43xx_common_data.h"
21#include "prcm43xx.h"
22
23/* IP blocks */
24static struct omap_hwmod am43xx_l4_hs_hwmod = {
25 .name = "l4_hs",
26 .class = &am33xx_l4_hwmod_class,
27 .clkdm_name = "l3_clkdm",
28 .flags = HWMOD_INIT_NO_IDLE,
29 .main_clk = "l4hs_gclk",
30 .prcm = {
31 .omap4 = {
32 .clkctrl_offs = AM43XX_CM_PER_L4HS_CLKCTRL_OFFSET,
33 .modulemode = MODULEMODE_SWCTRL,
34 },
35 },
36};
37
38static struct omap_hwmod_rst_info am33xx_wkup_m3_resets[] = {
39 { .name = "wkup_m3", .rst_shift = 3, .st_shift = 5 },
40};
41
42static struct omap_hwmod am43xx_wkup_m3_hwmod = {
43 .name = "wkup_m3",
44 .class = &am33xx_wkup_m3_hwmod_class,
45 .clkdm_name = "l4_wkup_aon_clkdm",
46 /* Keep hardreset asserted */
47 .flags = HWMOD_INIT_NO_RESET | HWMOD_NO_IDLEST,
48 .main_clk = "sys_clkin_ck",
49 .prcm = {
50 .omap4 = {
51 .clkctrl_offs = AM43XX_CM_WKUP_WKUP_M3_CLKCTRL_OFFSET,
52 .rstctrl_offs = AM43XX_RM_WKUP_RSTCTRL_OFFSET,
53 .rstst_offs = AM43XX_RM_WKUP_RSTST_OFFSET,
54 .modulemode = MODULEMODE_SWCTRL,
55 },
56 },
57 .rst_lines = am33xx_wkup_m3_resets,
58 .rst_lines_cnt = ARRAY_SIZE(am33xx_wkup_m3_resets),
59};
60
61static struct omap_hwmod am43xx_control_hwmod = {
62 .name = "control",
63 .class = &am33xx_control_hwmod_class,
64 .clkdm_name = "l4_wkup_clkdm",
65 .flags = HWMOD_INIT_NO_IDLE,
66 .main_clk = "sys_clkin_ck",
67 .prcm = {
68 .omap4 = {
69 .clkctrl_offs = AM43XX_CM_WKUP_CONTROL_CLKCTRL_OFFSET,
70 .modulemode = MODULEMODE_SWCTRL,
71 },
72 },
73};
74
75static struct omap_hwmod_opt_clk gpio0_opt_clks[] = {
76 { .role = "dbclk", .clk = "gpio0_dbclk" },
77};
78
79static struct omap_hwmod am43xx_gpio0_hwmod = {
80 .name = "gpio1",
81 .class = &am33xx_gpio_hwmod_class,
82 .clkdm_name = "l4_wkup_clkdm",
83 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
84 .main_clk = "sys_clkin_ck",
85 .prcm = {
86 .omap4 = {
87 .clkctrl_offs = AM43XX_CM_WKUP_GPIO0_CLKCTRL_OFFSET,
88 .modulemode = MODULEMODE_SWCTRL,
89 },
90 },
91 .opt_clks = gpio0_opt_clks,
92 .opt_clks_cnt = ARRAY_SIZE(gpio0_opt_clks),
93 .dev_attr = &gpio_dev_attr,
94};
95
96static struct omap_hwmod_class_sysconfig am43xx_synctimer_sysc = {
97 .rev_offs = 0x0,
98 .sysc_offs = 0x4,
99 .sysc_flags = SYSC_HAS_SIDLEMODE,
100 .idlemodes = (SIDLE_FORCE | SIDLE_NO),
101 .sysc_fields = &omap_hwmod_sysc_type1,
102};
103
104static struct omap_hwmod_class am43xx_synctimer_hwmod_class = {
105 .name = "synctimer",
106 .sysc = &am43xx_synctimer_sysc,
107};
108
109static struct omap_hwmod am43xx_synctimer_hwmod = {
110 .name = "counter_32k",
111 .class = &am43xx_synctimer_hwmod_class,
112 .clkdm_name = "l4_wkup_aon_clkdm",
113 .flags = HWMOD_SWSUP_SIDLE,
114 .main_clk = "synctimer_32kclk",
115 .prcm = {
116 .omap4 = {
117 .clkctrl_offs = AM43XX_CM_WKUP_SYNCTIMER_CLKCTRL_OFFSET,
118 .modulemode = MODULEMODE_SWCTRL,
119 },
120 },
121};
122
123static struct omap_hwmod am43xx_timer8_hwmod = {
124 .name = "timer8",
125 .class = &am33xx_timer_hwmod_class,
126 .clkdm_name = "l4ls_clkdm",
127 .main_clk = "timer8_fck",
128 .prcm = {
129 .omap4 = {
130 .clkctrl_offs = AM43XX_CM_PER_TIMER8_CLKCTRL_OFFSET,
131 .modulemode = MODULEMODE_SWCTRL,
132 },
133 },
134};
135
136static struct omap_hwmod am43xx_timer9_hwmod = {
137 .name = "timer9",
138 .class = &am33xx_timer_hwmod_class,
139 .clkdm_name = "l4ls_clkdm",
140 .main_clk = "timer9_fck",
141 .prcm = {
142 .omap4 = {
143 .clkctrl_offs = AM43XX_CM_PER_TIMER9_CLKCTRL_OFFSET,
144 .modulemode = MODULEMODE_SWCTRL,
145 },
146 },
147};
148
149static struct omap_hwmod am43xx_timer10_hwmod = {
150 .name = "timer10",
151 .class = &am33xx_timer_hwmod_class,
152 .clkdm_name = "l4ls_clkdm",
153 .main_clk = "timer10_fck",
154 .prcm = {
155 .omap4 = {
156 .clkctrl_offs = AM43XX_CM_PER_TIMER10_CLKCTRL_OFFSET,
157 .modulemode = MODULEMODE_SWCTRL,
158 },
159 },
160};
161
162static struct omap_hwmod am43xx_timer11_hwmod = {
163 .name = "timer11",
164 .class = &am33xx_timer_hwmod_class,
165 .clkdm_name = "l4ls_clkdm",
166 .main_clk = "timer11_fck",
167 .prcm = {
168 .omap4 = {
169 .clkctrl_offs = AM43XX_CM_PER_TIMER11_CLKCTRL_OFFSET,
170 .modulemode = MODULEMODE_SWCTRL,
171 },
172 },
173};
174
175static struct omap_hwmod am43xx_epwmss3_hwmod = {
176 .name = "epwmss3",
177 .class = &am33xx_epwmss_hwmod_class,
178 .clkdm_name = "l4ls_clkdm",
179 .main_clk = "l4ls_gclk",
180 .prcm = {
181 .omap4 = {
182 .clkctrl_offs = AM43XX_CM_PER_EPWMSS3_CLKCTRL_OFFSET,
183 .modulemode = MODULEMODE_SWCTRL,
184 },
185 },
186};
187
188static struct omap_hwmod am43xx_ehrpwm3_hwmod = {
189 .name = "ehrpwm3",
190 .class = &am33xx_ehrpwm_hwmod_class,
191 .clkdm_name = "l4ls_clkdm",
192 .main_clk = "l4ls_gclk",
193};
194
195static struct omap_hwmod am43xx_epwmss4_hwmod = {
196 .name = "epwmss4",
197 .class = &am33xx_epwmss_hwmod_class,
198 .clkdm_name = "l4ls_clkdm",
199 .main_clk = "l4ls_gclk",
200 .prcm = {
201 .omap4 = {
202 .clkctrl_offs = AM43XX_CM_PER_EPWMSS4_CLKCTRL_OFFSET,
203 .modulemode = MODULEMODE_SWCTRL,
204 },
205 },
206};
207
208static struct omap_hwmod am43xx_ehrpwm4_hwmod = {
209 .name = "ehrpwm4",
210 .class = &am33xx_ehrpwm_hwmod_class,
211 .clkdm_name = "l4ls_clkdm",
212 .main_clk = "l4ls_gclk",
213};
214
215static struct omap_hwmod am43xx_epwmss5_hwmod = {
216 .name = "epwmss5",
217 .class = &am33xx_epwmss_hwmod_class,
218 .clkdm_name = "l4ls_clkdm",
219 .main_clk = "l4ls_gclk",
220 .prcm = {
221 .omap4 = {
222 .clkctrl_offs = AM43XX_CM_PER_EPWMSS5_CLKCTRL_OFFSET,
223 .modulemode = MODULEMODE_SWCTRL,
224 },
225 },
226};
227
228static struct omap_hwmod am43xx_ehrpwm5_hwmod = {
229 .name = "ehrpwm5",
230 .class = &am33xx_ehrpwm_hwmod_class,
231 .clkdm_name = "l4ls_clkdm",
232 .main_clk = "l4ls_gclk",
233};
234
235static struct omap_hwmod am43xx_spi2_hwmod = {
236 .name = "spi2",
237 .class = &am33xx_spi_hwmod_class,
238 .clkdm_name = "l4ls_clkdm",
239 .main_clk = "dpll_per_m2_div4_ck",
240 .prcm = {
241 .omap4 = {
242 .clkctrl_offs = AM43XX_CM_PER_SPI2_CLKCTRL_OFFSET,
243 .modulemode = MODULEMODE_SWCTRL,
244 },
245 },
246 .dev_attr = &mcspi_attrib,
247};
248
249static struct omap_hwmod am43xx_spi3_hwmod = {
250 .name = "spi3",
251 .class = &am33xx_spi_hwmod_class,
252 .clkdm_name = "l4ls_clkdm",
253 .main_clk = "dpll_per_m2_div4_ck",
254 .prcm = {
255 .omap4 = {
256 .clkctrl_offs = AM43XX_CM_PER_SPI3_CLKCTRL_OFFSET,
257 .modulemode = MODULEMODE_SWCTRL,
258 },
259 },
260 .dev_attr = &mcspi_attrib,
261};
262
263static struct omap_hwmod am43xx_spi4_hwmod = {
264 .name = "spi4",
265 .class = &am33xx_spi_hwmod_class,
266 .clkdm_name = "l4ls_clkdm",
267 .main_clk = "dpll_per_m2_div4_ck",
268 .prcm = {
269 .omap4 = {
270 .clkctrl_offs = AM43XX_CM_PER_SPI4_CLKCTRL_OFFSET,
271 .modulemode = MODULEMODE_SWCTRL,
272 },
273 },
274 .dev_attr = &mcspi_attrib,
275};
276
277static struct omap_hwmod_opt_clk gpio4_opt_clks[] = {
278 { .role = "dbclk", .clk = "gpio4_dbclk" },
279};
280
281static struct omap_hwmod am43xx_gpio4_hwmod = {
282 .name = "gpio5",
283 .class = &am33xx_gpio_hwmod_class,
284 .clkdm_name = "l4ls_clkdm",
285 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
286 .main_clk = "l4ls_gclk",
287 .prcm = {
288 .omap4 = {
289 .clkctrl_offs = AM43XX_CM_PER_GPIO4_CLKCTRL_OFFSET,
290 .modulemode = MODULEMODE_SWCTRL,
291 },
292 },
293 .opt_clks = gpio4_opt_clks,
294 .opt_clks_cnt = ARRAY_SIZE(gpio4_opt_clks),
295 .dev_attr = &gpio_dev_attr,
296};
297
298static struct omap_hwmod_opt_clk gpio5_opt_clks[] = {
299 { .role = "dbclk", .clk = "gpio5_dbclk" },
300};
301
302static struct omap_hwmod am43xx_gpio5_hwmod = {
303 .name = "gpio6",
304 .class = &am33xx_gpio_hwmod_class,
305 .clkdm_name = "l4ls_clkdm",
306 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
307 .main_clk = "l4ls_gclk",
308 .prcm = {
309 .omap4 = {
310 .clkctrl_offs = AM43XX_CM_PER_GPIO5_CLKCTRL_OFFSET,
311 .modulemode = MODULEMODE_SWCTRL,
312 },
313 },
314 .opt_clks = gpio5_opt_clks,
315 .opt_clks_cnt = ARRAY_SIZE(gpio5_opt_clks),
316 .dev_attr = &gpio_dev_attr,
317};
318
319static struct omap_hwmod_class am43xx_ocp2scp_hwmod_class = {
320 .name = "ocp2scp",
321};
322
323static struct omap_hwmod am43xx_ocp2scp0_hwmod = {
324 .name = "ocp2scp0",
325 .class = &am43xx_ocp2scp_hwmod_class,
326 .clkdm_name = "l4ls_clkdm",
327 .main_clk = "l4ls_gclk",
328 .prcm = {
329 .omap4 = {
330 .clkctrl_offs = AM43XX_CM_PER_USBPHYOCP2SCP0_CLKCTRL_OFFSET,
331 .modulemode = MODULEMODE_SWCTRL,
332 },
333 },
334};
335
336static struct omap_hwmod am43xx_ocp2scp1_hwmod = {
337 .name = "ocp2scp1",
338 .class = &am43xx_ocp2scp_hwmod_class,
339 .clkdm_name = "l4ls_clkdm",
340 .main_clk = "l4ls_gclk",
341 .prcm = {
342 .omap4 = {
343 .clkctrl_offs = AM43XX_CM_PER_USBPHYOCP2SCP1_CLKCTRL_OFFSET,
344 .modulemode = MODULEMODE_SWCTRL,
345 },
346 },
347};
348
349static struct omap_hwmod_class_sysconfig am43xx_usb_otg_ss_sysc = {
350 .rev_offs = 0x0000,
351 .sysc_offs = 0x0010,
352 .sysc_flags = (SYSC_HAS_DMADISABLE | SYSC_HAS_MIDLEMODE |
353 SYSC_HAS_SIDLEMODE),
354 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
355 SIDLE_SMART_WKUP | MSTANDBY_FORCE |
356 MSTANDBY_NO | MSTANDBY_SMART |
357 MSTANDBY_SMART_WKUP),
358 .sysc_fields = &omap_hwmod_sysc_type2,
359};
360
361static struct omap_hwmod_class am43xx_usb_otg_ss_hwmod_class = {
362 .name = "usb_otg_ss",
363 .sysc = &am43xx_usb_otg_ss_sysc,
364};
365
366static struct omap_hwmod am43xx_usb_otg_ss0_hwmod = {
367 .name = "usb_otg_ss0",
368 .class = &am43xx_usb_otg_ss_hwmod_class,
369 .clkdm_name = "l3s_clkdm",
370 .main_clk = "l3s_gclk",
371 .prcm = {
372 .omap4 = {
373 .clkctrl_offs = AM43XX_CM_PER_USB_OTG_SS0_CLKCTRL_OFFSET,
374 .modulemode = MODULEMODE_SWCTRL,
375 },
376 },
377};
378
379static struct omap_hwmod am43xx_usb_otg_ss1_hwmod = {
380 .name = "usb_otg_ss1",
381 .class = &am43xx_usb_otg_ss_hwmod_class,
382 .clkdm_name = "l3s_clkdm",
383 .main_clk = "l3s_gclk",
384 .prcm = {
385 .omap4 = {
386 .clkctrl_offs = AM43XX_CM_PER_USB_OTG_SS1_CLKCTRL_OFFSET,
387 .modulemode = MODULEMODE_SWCTRL,
388 },
389 },
390};
391
392static struct omap_hwmod_class_sysconfig am43xx_qspi_sysc = {
393 .sysc_offs = 0x0010,
394 .sysc_flags = SYSC_HAS_SIDLEMODE,
395 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
396 SIDLE_SMART_WKUP),
397 .sysc_fields = &omap_hwmod_sysc_type2,
398};
399
400static struct omap_hwmod_class am43xx_qspi_hwmod_class = {
401 .name = "qspi",
402 .sysc = &am43xx_qspi_sysc,
403};
404
405static struct omap_hwmod am43xx_qspi_hwmod = {
406 .name = "qspi",
407 .class = &am43xx_qspi_hwmod_class,
408 .clkdm_name = "l3s_clkdm",
409 .main_clk = "l3s_gclk",
410 .prcm = {
411 .omap4 = {
412 .clkctrl_offs = AM43XX_CM_PER_QSPI_CLKCTRL_OFFSET,
413 .modulemode = MODULEMODE_SWCTRL,
414 },
415 },
416};
417
418/* Interfaces */
419static struct omap_hwmod_ocp_if am43xx_l3_main__l4_hs = {
420 .master = &am33xx_l3_main_hwmod,
421 .slave = &am43xx_l4_hs_hwmod,
422 .clk = "l3s_gclk",
423 .user = OCP_USER_MPU | OCP_USER_SDMA,
424};
425
426static struct omap_hwmod_ocp_if am43xx_wkup_m3__l4_wkup = {
427 .master = &am43xx_wkup_m3_hwmod,
428 .slave = &am33xx_l4_wkup_hwmod,
429 .clk = "sys_clkin_ck",
430 .user = OCP_USER_MPU | OCP_USER_SDMA,
431};
432
433static struct omap_hwmod_ocp_if am43xx_l4_wkup__wkup_m3 = {
434 .master = &am33xx_l4_wkup_hwmod,
435 .slave = &am43xx_wkup_m3_hwmod,
436 .clk = "sys_clkin_ck",
437 .user = OCP_USER_MPU | OCP_USER_SDMA,
438};
439
440static struct omap_hwmod_ocp_if am43xx_l3_main__pruss = {
441 .master = &am33xx_l3_main_hwmod,
442 .slave = &am33xx_pruss_hwmod,
443 .clk = "dpll_core_m4_ck",
444 .user = OCP_USER_MPU,
445};
446
447static struct omap_hwmod_ocp_if am43xx_l4_wkup__smartreflex0 = {
448 .master = &am33xx_l4_wkup_hwmod,
449 .slave = &am33xx_smartreflex0_hwmod,
450 .clk = "sys_clkin_ck",
451 .user = OCP_USER_MPU,
452};
453
454static struct omap_hwmod_ocp_if am43xx_l4_wkup__smartreflex1 = {
455 .master = &am33xx_l4_wkup_hwmod,
456 .slave = &am33xx_smartreflex1_hwmod,
457 .clk = "sys_clkin_ck",
458 .user = OCP_USER_MPU,
459};
460
461static struct omap_hwmod_ocp_if am43xx_l4_wkup__control = {
462 .master = &am33xx_l4_wkup_hwmod,
463 .slave = &am43xx_control_hwmod,
464 .clk = "sys_clkin_ck",
465 .user = OCP_USER_MPU,
466};
467
468static struct omap_hwmod_ocp_if am43xx_l4_wkup__i2c1 = {
469 .master = &am33xx_l4_wkup_hwmod,
470 .slave = &am33xx_i2c1_hwmod,
471 .clk = "sys_clkin_ck",
472 .user = OCP_USER_MPU,
473};
474
475static struct omap_hwmod_ocp_if am43xx_l4_wkup__gpio0 = {
476 .master = &am33xx_l4_wkup_hwmod,
477 .slave = &am43xx_gpio0_hwmod,
478 .clk = "sys_clkin_ck",
479 .user = OCP_USER_MPU | OCP_USER_SDMA,
480};
481
482static struct omap_hwmod_ocp_if am43xx_l4_hs__cpgmac0 = {
483 .master = &am43xx_l4_hs_hwmod,
484 .slave = &am33xx_cpgmac0_hwmod,
485 .clk = "cpsw_125mhz_gclk",
486 .user = OCP_USER_MPU,
487};
488
489static struct omap_hwmod_ocp_if am43xx_l4_wkup__timer1 = {
490 .master = &am33xx_l4_wkup_hwmod,
491 .slave = &am33xx_timer1_hwmod,
492 .clk = "sys_clkin_ck",
493 .user = OCP_USER_MPU,
494};
495
496static struct omap_hwmod_ocp_if am43xx_l4_wkup__uart1 = {
497 .master = &am33xx_l4_wkup_hwmod,
498 .slave = &am33xx_uart1_hwmod,
499 .clk = "sys_clkin_ck",
500 .user = OCP_USER_MPU,
501};
502
503static struct omap_hwmod_ocp_if am43xx_l4_wkup__wd_timer1 = {
504 .master = &am33xx_l4_wkup_hwmod,
505 .slave = &am33xx_wd_timer1_hwmod,
506 .clk = "sys_clkin_ck",
507 .user = OCP_USER_MPU,
508};
509
510static struct omap_hwmod_ocp_if am33xx_l4_wkup__synctimer = {
511 .master = &am33xx_l4_wkup_hwmod,
512 .slave = &am43xx_synctimer_hwmod,
513 .clk = "sys_clkin_ck",
514 .user = OCP_USER_MPU,
515};
516
517static struct omap_hwmod_ocp_if am43xx_l4_ls__timer8 = {
518 .master = &am33xx_l4_ls_hwmod,
519 .slave = &am43xx_timer8_hwmod,
520 .clk = "l4ls_gclk",
521 .user = OCP_USER_MPU,
522};
523
524static struct omap_hwmod_ocp_if am43xx_l4_ls__timer9 = {
525 .master = &am33xx_l4_ls_hwmod,
526 .slave = &am43xx_timer9_hwmod,
527 .clk = "l4ls_gclk",
528 .user = OCP_USER_MPU,
529};
530
531static struct omap_hwmod_ocp_if am43xx_l4_ls__timer10 = {
532 .master = &am33xx_l4_ls_hwmod,
533 .slave = &am43xx_timer10_hwmod,
534 .clk = "l4ls_gclk",
535 .user = OCP_USER_MPU,
536};
537
538static struct omap_hwmod_ocp_if am43xx_l4_ls__timer11 = {
539 .master = &am33xx_l4_ls_hwmod,
540 .slave = &am43xx_timer11_hwmod,
541 .clk = "l4ls_gclk",
542 .user = OCP_USER_MPU,
543};
544
545static struct omap_hwmod_ocp_if am43xx_l4_ls__epwmss3 = {
546 .master = &am33xx_l4_ls_hwmod,
547 .slave = &am43xx_epwmss3_hwmod,
548 .clk = "l4ls_gclk",
549 .user = OCP_USER_MPU,
550};
551
552static struct omap_hwmod_ocp_if am43xx_epwmss3__ehrpwm3 = {
553 .master = &am43xx_epwmss3_hwmod,
554 .slave = &am43xx_ehrpwm3_hwmod,
555 .clk = "l4ls_gclk",
556 .user = OCP_USER_MPU,
557};
558
559static struct omap_hwmod_ocp_if am43xx_l4_ls__epwmss4 = {
560 .master = &am33xx_l4_ls_hwmod,
561 .slave = &am43xx_epwmss4_hwmod,
562 .clk = "l4ls_gclk",
563 .user = OCP_USER_MPU,
564};
565
566static struct omap_hwmod_ocp_if am43xx_epwmss4__ehrpwm4 = {
567 .master = &am43xx_epwmss4_hwmod,
568 .slave = &am43xx_ehrpwm4_hwmod,
569 .clk = "l4ls_gclk",
570 .user = OCP_USER_MPU,
571};
572
573static struct omap_hwmod_ocp_if am43xx_l4_ls__epwmss5 = {
574 .master = &am33xx_l4_ls_hwmod,
575 .slave = &am43xx_epwmss5_hwmod,
576 .clk = "l4ls_gclk",
577 .user = OCP_USER_MPU,
578};
579
580static struct omap_hwmod_ocp_if am43xx_epwmss5__ehrpwm5 = {
581 .master = &am43xx_epwmss5_hwmod,
582 .slave = &am43xx_ehrpwm5_hwmod,
583 .clk = "l4ls_gclk",
584 .user = OCP_USER_MPU,
585};
586
587static struct omap_hwmod_ocp_if am43xx_l4_ls__mcspi2 = {
588 .master = &am33xx_l4_ls_hwmod,
589 .slave = &am43xx_spi2_hwmod,
590 .clk = "l4ls_gclk",
591 .user = OCP_USER_MPU,
592};
593
594static struct omap_hwmod_ocp_if am43xx_l4_ls__mcspi3 = {
595 .master = &am33xx_l4_ls_hwmod,
596 .slave = &am43xx_spi3_hwmod,
597 .clk = "l4ls_gclk",
598 .user = OCP_USER_MPU,
599};
600
601static struct omap_hwmod_ocp_if am43xx_l4_ls__mcspi4 = {
602 .master = &am33xx_l4_ls_hwmod,
603 .slave = &am43xx_spi4_hwmod,
604 .clk = "l4ls_gclk",
605 .user = OCP_USER_MPU,
606};
607
608static struct omap_hwmod_ocp_if am43xx_l4_ls__gpio4 = {
609 .master = &am33xx_l4_ls_hwmod,
610 .slave = &am43xx_gpio4_hwmod,
611 .clk = "l4ls_gclk",
612 .user = OCP_USER_MPU | OCP_USER_SDMA,
613};
614
615static struct omap_hwmod_ocp_if am43xx_l4_ls__gpio5 = {
616 .master = &am33xx_l4_ls_hwmod,
617 .slave = &am43xx_gpio5_hwmod,
618 .clk = "l4ls_gclk",
619 .user = OCP_USER_MPU | OCP_USER_SDMA,
620};
621
622static struct omap_hwmod_ocp_if am43xx_l4_ls__ocp2scp0 = {
623 .master = &am33xx_l4_ls_hwmod,
624 .slave = &am43xx_ocp2scp0_hwmod,
625 .clk = "l4ls_gclk",
626 .user = OCP_USER_MPU,
627};
628
629static struct omap_hwmod_ocp_if am43xx_l4_ls__ocp2scp1 = {
630 .master = &am33xx_l4_ls_hwmod,
631 .slave = &am43xx_ocp2scp1_hwmod,
632 .clk = "l4ls_gclk",
633 .user = OCP_USER_MPU,
634};
635
636static struct omap_hwmod_ocp_if am43xx_l3_s__usbotgss0 = {
637 .master = &am33xx_l3_s_hwmod,
638 .slave = &am43xx_usb_otg_ss0_hwmod,
639 .clk = "l3s_gclk",
640 .user = OCP_USER_MPU | OCP_USER_SDMA,
641};
642
643static struct omap_hwmod_ocp_if am43xx_l3_s__usbotgss1 = {
644 .master = &am33xx_l3_s_hwmod,
645 .slave = &am43xx_usb_otg_ss1_hwmod,
646 .clk = "l3s_gclk",
647 .user = OCP_USER_MPU | OCP_USER_SDMA,
648};
649
650static struct omap_hwmod_ocp_if am43xx_l3_s__qspi = {
651 .master = &am33xx_l3_s_hwmod,
652 .slave = &am43xx_qspi_hwmod,
653 .clk = "l3s_gclk",
654 .user = OCP_USER_MPU | OCP_USER_SDMA,
655};
656
657static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
658 &am33xx_l4_wkup__synctimer,
659 &am43xx_l4_ls__timer8,
660 &am43xx_l4_ls__timer9,
661 &am43xx_l4_ls__timer10,
662 &am43xx_l4_ls__timer11,
663 &am43xx_l4_ls__epwmss3,
664 &am43xx_epwmss3__ehrpwm3,
665 &am43xx_l4_ls__epwmss4,
666 &am43xx_epwmss4__ehrpwm4,
667 &am43xx_l4_ls__epwmss5,
668 &am43xx_epwmss5__ehrpwm5,
669 &am43xx_l4_ls__mcspi2,
670 &am43xx_l4_ls__mcspi3,
671 &am43xx_l4_ls__mcspi4,
672 &am43xx_l4_ls__gpio4,
673 &am43xx_l4_ls__gpio5,
674 &am43xx_l3_main__pruss,
675 &am33xx_mpu__l3_main,
676 &am33xx_mpu__prcm,
677 &am33xx_l3_s__l4_ls,
678 &am33xx_l3_s__l4_wkup,
679 &am43xx_l3_main__l4_hs,
680 &am33xx_l3_main__l3_s,
681 &am33xx_l3_main__l3_instr,
682 &am33xx_l3_main__gfx,
683 &am33xx_l3_s__l3_main,
684 &am33xx_pruss__l3_main,
685 &am43xx_wkup_m3__l4_wkup,
686 &am33xx_gfx__l3_main,
687 &am43xx_l4_wkup__wkup_m3,
688 &am43xx_l4_wkup__control,
689 &am43xx_l4_wkup__smartreflex0,
690 &am43xx_l4_wkup__smartreflex1,
691 &am43xx_l4_wkup__uart1,
692 &am43xx_l4_wkup__timer1,
693 &am43xx_l4_wkup__i2c1,
694 &am43xx_l4_wkup__gpio0,
695 &am43xx_l4_wkup__wd_timer1,
696 &am43xx_l3_s__qspi,
697 &am33xx_l4_per__dcan0,
698 &am33xx_l4_per__dcan1,
699 &am33xx_l4_per__gpio1,
700 &am33xx_l4_per__gpio2,
701 &am33xx_l4_per__gpio3,
702 &am33xx_l4_per__i2c2,
703 &am33xx_l4_per__i2c3,
704 &am33xx_l4_per__mailbox,
705 &am33xx_l4_ls__mcasp0,
706 &am33xx_l4_ls__mcasp1,
707 &am33xx_l4_ls__mmc0,
708 &am33xx_l4_ls__mmc1,
709 &am33xx_l3_s__mmc2,
710 &am33xx_l4_ls__timer2,
711 &am33xx_l4_ls__timer3,
712 &am33xx_l4_ls__timer4,
713 &am33xx_l4_ls__timer5,
714 &am33xx_l4_ls__timer6,
715 &am33xx_l4_ls__timer7,
716 &am33xx_l3_main__tpcc,
717 &am33xx_l4_ls__uart2,
718 &am33xx_l4_ls__uart3,
719 &am33xx_l4_ls__uart4,
720 &am33xx_l4_ls__uart5,
721 &am33xx_l4_ls__uart6,
722 &am33xx_l4_ls__elm,
723 &am33xx_l4_ls__epwmss0,
724 &am33xx_epwmss0__ecap0,
725 &am33xx_epwmss0__eqep0,
726 &am33xx_epwmss0__ehrpwm0,
727 &am33xx_l4_ls__epwmss1,
728 &am33xx_epwmss1__ecap1,
729 &am33xx_epwmss1__eqep1,
730 &am33xx_epwmss1__ehrpwm1,
731 &am33xx_l4_ls__epwmss2,
732 &am33xx_epwmss2__ecap2,
733 &am33xx_epwmss2__eqep2,
734 &am33xx_epwmss2__ehrpwm2,
735 &am33xx_l3_s__gpmc,
736 &am33xx_l4_ls__mcspi0,
737 &am33xx_l4_ls__mcspi1,
738 &am33xx_l3_main__tptc0,
739 &am33xx_l3_main__tptc1,
740 &am33xx_l3_main__tptc2,
741 &am33xx_l3_main__ocmc,
742 &am43xx_l4_hs__cpgmac0,
743 &am33xx_cpgmac0__mdio,
744 &am33xx_l3_main__sha0,
745 &am33xx_l3_main__aes0,
746 &am43xx_l4_ls__ocp2scp0,
747 &am43xx_l4_ls__ocp2scp1,
748 &am43xx_l3_s__usbotgss0,
749 &am43xx_l3_s__usbotgss1,
750 NULL,
751};
752
753int __init am43xx_hwmod_init(void)
754{
755 omap_hwmod_am43xx_reg();
756 omap_hwmod_init();
757 return omap_hwmod_register_links(am43xx_hwmod_ocp_ifs);
758}
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 9c3b504477d7..1e5b12cb8246 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -914,7 +914,7 @@ static struct omap_hwmod omap44xx_emif1_hwmod = {
914 .name = "emif1", 914 .name = "emif1",
915 .class = &omap44xx_emif_hwmod_class, 915 .class = &omap44xx_emif_hwmod_class,
916 .clkdm_name = "l3_emif_clkdm", 916 .clkdm_name = "l3_emif_clkdm",
917 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, 917 .flags = HWMOD_INIT_NO_IDLE,
918 .main_clk = "ddrphy_ck", 918 .main_clk = "ddrphy_ck",
919 .prcm = { 919 .prcm = {
920 .omap4 = { 920 .omap4 = {
@@ -930,7 +930,7 @@ static struct omap_hwmod omap44xx_emif2_hwmod = {
930 .name = "emif2", 930 .name = "emif2",
931 .class = &omap44xx_emif_hwmod_class, 931 .class = &omap44xx_emif_hwmod_class,
932 .clkdm_name = "l3_emif_clkdm", 932 .clkdm_name = "l3_emif_clkdm",
933 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, 933 .flags = HWMOD_INIT_NO_IDLE,
934 .main_clk = "ddrphy_ck", 934 .main_clk = "ddrphy_ck",
935 .prcm = { 935 .prcm = {
936 .omap4 = { 936 .omap4 = {
@@ -2193,7 +2193,7 @@ static struct omap_hwmod omap44xx_mpu_hwmod = {
2193 .name = "mpu", 2193 .name = "mpu",
2194 .class = &omap44xx_mpu_hwmod_class, 2194 .class = &omap44xx_mpu_hwmod_class,
2195 .clkdm_name = "mpuss_clkdm", 2195 .clkdm_name = "mpuss_clkdm",
2196 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, 2196 .flags = HWMOD_INIT_NO_IDLE,
2197 .main_clk = "dpll_mpu_m2_ck", 2197 .main_clk = "dpll_mpu_m2_ck",
2198 .prcm = { 2198 .prcm = {
2199 .omap4 = { 2199 .omap4 = {
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
index cde415570e04..9e08d6994a0b 100644
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -352,7 +352,7 @@ static struct omap_hwmod omap54xx_emif1_hwmod = {
352 .name = "emif1", 352 .name = "emif1",
353 .class = &omap54xx_emif_hwmod_class, 353 .class = &omap54xx_emif_hwmod_class,
354 .clkdm_name = "emif_clkdm", 354 .clkdm_name = "emif_clkdm",
355 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, 355 .flags = HWMOD_INIT_NO_IDLE,
356 .main_clk = "dpll_core_h11x2_ck", 356 .main_clk = "dpll_core_h11x2_ck",
357 .prcm = { 357 .prcm = {
358 .omap4 = { 358 .omap4 = {
@@ -368,7 +368,7 @@ static struct omap_hwmod omap54xx_emif2_hwmod = {
368 .name = "emif2", 368 .name = "emif2",
369 .class = &omap54xx_emif_hwmod_class, 369 .class = &omap54xx_emif_hwmod_class,
370 .clkdm_name = "emif_clkdm", 370 .clkdm_name = "emif_clkdm",
371 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, 371 .flags = HWMOD_INIT_NO_IDLE,
372 .main_clk = "dpll_core_h11x2_ck", 372 .main_clk = "dpll_core_h11x2_ck",
373 .prcm = { 373 .prcm = {
374 .omap4 = { 374 .omap4 = {
@@ -1135,7 +1135,7 @@ static struct omap_hwmod omap54xx_mpu_hwmod = {
1135 .name = "mpu", 1135 .name = "mpu",
1136 .class = &omap54xx_mpu_hwmod_class, 1136 .class = &omap54xx_mpu_hwmod_class,
1137 .clkdm_name = "mpu_clkdm", 1137 .clkdm_name = "mpu_clkdm",
1138 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, 1138 .flags = HWMOD_INIT_NO_IDLE,
1139 .main_clk = "dpll_mpu_m2_ck", 1139 .main_clk = "dpll_mpu_m2_ck",
1140 .prcm = { 1140 .prcm = {
1141 .omap4 = { 1141 .omap4 = {
@@ -1146,6 +1146,77 @@ static struct omap_hwmod omap54xx_mpu_hwmod = {
1146}; 1146};
1147 1147
1148/* 1148/*
1149 * 'spinlock' class
1150 * spinlock provides hardware assistance for synchronizing the processes
1151 * running on multiple processors
1152 */
1153
1154static struct omap_hwmod_class_sysconfig omap54xx_spinlock_sysc = {
1155 .rev_offs = 0x0000,
1156 .sysc_offs = 0x0010,
1157 .syss_offs = 0x0014,
1158 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
1159 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
1160 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
1161 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1162 .sysc_fields = &omap_hwmod_sysc_type1,
1163};
1164
1165static struct omap_hwmod_class omap54xx_spinlock_hwmod_class = {
1166 .name = "spinlock",
1167 .sysc = &omap54xx_spinlock_sysc,
1168};
1169
1170/* spinlock */
1171static struct omap_hwmod omap54xx_spinlock_hwmod = {
1172 .name = "spinlock",
1173 .class = &omap54xx_spinlock_hwmod_class,
1174 .clkdm_name = "l4cfg_clkdm",
1175 .prcm = {
1176 .omap4 = {
1177 .clkctrl_offs = OMAP54XX_CM_L4CFG_SPINLOCK_CLKCTRL_OFFSET,
1178 .context_offs = OMAP54XX_RM_L4CFG_SPINLOCK_CONTEXT_OFFSET,
1179 },
1180 },
1181};
1182
1183/*
1184 * 'ocp2scp' class
1185 * bridge to transform ocp interface protocol to scp (serial control port)
1186 * protocol
1187 */
1188
1189static struct omap_hwmod_class_sysconfig omap54xx_ocp2scp_sysc = {
1190 .rev_offs = 0x0000,
1191 .sysc_offs = 0x0010,
1192 .syss_offs = 0x0014,
1193 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE |
1194 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
1195 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1196 .sysc_fields = &omap_hwmod_sysc_type1,
1197};
1198
1199static struct omap_hwmod_class omap54xx_ocp2scp_hwmod_class = {
1200 .name = "ocp2scp",
1201 .sysc = &omap54xx_ocp2scp_sysc,
1202};
1203
1204/* ocp2scp1 */
1205static struct omap_hwmod omap54xx_ocp2scp1_hwmod = {
1206 .name = "ocp2scp1",
1207 .class = &omap54xx_ocp2scp_hwmod_class,
1208 .clkdm_name = "l3init_clkdm",
1209 .main_clk = "l4_root_clk_div",
1210 .prcm = {
1211 .omap4 = {
1212 .clkctrl_offs = OMAP54XX_CM_L3INIT_OCP2SCP1_CLKCTRL_OFFSET,
1213 .context_offs = OMAP54XX_RM_L3INIT_OCP2SCP1_CONTEXT_OFFSET,
1214 .modulemode = MODULEMODE_HWCTRL,
1215 },
1216 },
1217};
1218
1219/*
1149 * 'timer' class 1220 * 'timer' class
1150 * general purpose timer module with accurate 1ms tick 1221 * general purpose timer module with accurate 1ms tick
1151 * This class contains several variants: ['timer_1ms', 'timer'] 1222 * This class contains several variants: ['timer_1ms', 'timer']
@@ -1465,6 +1536,123 @@ static struct omap_hwmod omap54xx_uart6_hwmod = {
1465}; 1536};
1466 1537
1467/* 1538/*
1539 * 'usb_host_hs' class
1540 * high-speed multi-port usb host controller
1541 */
1542
1543static struct omap_hwmod_class_sysconfig omap54xx_usb_host_hs_sysc = {
1544 .rev_offs = 0x0000,
1545 .sysc_offs = 0x0010,
1546 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS |
1547 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
1548 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1549 SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
1550 MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
1551 .sysc_fields = &omap_hwmod_sysc_type2,
1552};
1553
1554static struct omap_hwmod_class omap54xx_usb_host_hs_hwmod_class = {
1555 .name = "usb_host_hs",
1556 .sysc = &omap54xx_usb_host_hs_sysc,
1557};
1558
1559static struct omap_hwmod omap54xx_usb_host_hs_hwmod = {
1560 .name = "usb_host_hs",
1561 .class = &omap54xx_usb_host_hs_hwmod_class,
1562 .clkdm_name = "l3init_clkdm",
1563 /*
1564 * Errata: USBHOST Configured In Smart-Idle Can Lead To a Deadlock
1565 * id: i660
1566 *
1567 * Description:
1568 * In the following configuration :
1569 * - USBHOST module is set to smart-idle mode
1570 * - PRCM asserts idle_req to the USBHOST module ( This typically
1571 * happens when the system is going to a low power mode : all ports
1572 * have been suspended, the master part of the USBHOST module has
1573 * entered the standby state, and SW has cut the functional clocks)
1574 * - an USBHOST interrupt occurs before the module is able to answer
1575 * idle_ack, typically a remote wakeup IRQ.
1576 * Then the USB HOST module will enter a deadlock situation where it
1577 * is no more accessible nor functional.
1578 *
1579 * Workaround:
1580 * Don't use smart idle; use only force idle, hence HWMOD_SWSUP_SIDLE
1581 */
1582
1583 /*
1584 * Errata: USB host EHCI may stall when entering smart-standby mode
1585 * Id: i571
1586 *
1587 * Description:
1588 * When the USBHOST module is set to smart-standby mode, and when it is
1589 * ready to enter the standby state (i.e. all ports are suspended and
1590 * all attached devices are in suspend mode), then it can wrongly assert
1591 * the Mstandby signal too early while there are still some residual OCP
1592 * transactions ongoing. If this condition occurs, the internal state
1593 * machine may go to an undefined state and the USB link may be stuck
1594 * upon the next resume.
1595 *
1596 * Workaround:
1597 * Don't use smart standby; use only force standby,
1598 * hence HWMOD_SWSUP_MSTANDBY
1599 */
1600
1601 /*
1602 * During system boot; If the hwmod framework resets the module
1603 * the module will have smart idle settings; which can lead to deadlock
1604 * (above Errata Id:i660); so, dont reset the module during boot;
1605 * Use HWMOD_INIT_NO_RESET.
1606 */
1607
1608 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
1609 HWMOD_INIT_NO_RESET,
1610 .main_clk = "l3init_60m_fclk",
1611 .prcm = {
1612 .omap4 = {
1613 .clkctrl_offs = OMAP54XX_CM_L3INIT_USB_HOST_HS_CLKCTRL_OFFSET,
1614 .context_offs = OMAP54XX_RM_L3INIT_USB_HOST_HS_CONTEXT_OFFSET,
1615 .modulemode = MODULEMODE_SWCTRL,
1616 },
1617 },
1618};
1619
1620/*
1621 * 'usb_tll_hs' class
1622 * usb_tll_hs module is the adapter on the usb_host_hs ports
1623 */
1624
1625static struct omap_hwmod_class_sysconfig omap54xx_usb_tll_hs_sysc = {
1626 .rev_offs = 0x0000,
1627 .sysc_offs = 0x0010,
1628 .syss_offs = 0x0014,
1629 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
1630 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
1631 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
1632 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1633 .sysc_fields = &omap_hwmod_sysc_type1,
1634};
1635
1636static struct omap_hwmod_class omap54xx_usb_tll_hs_hwmod_class = {
1637 .name = "usb_tll_hs",
1638 .sysc = &omap54xx_usb_tll_hs_sysc,
1639};
1640
1641static struct omap_hwmod omap54xx_usb_tll_hs_hwmod = {
1642 .name = "usb_tll_hs",
1643 .class = &omap54xx_usb_tll_hs_hwmod_class,
1644 .clkdm_name = "l3init_clkdm",
1645 .main_clk = "l4_root_clk_div",
1646 .prcm = {
1647 .omap4 = {
1648 .clkctrl_offs = OMAP54XX_CM_L3INIT_USB_TLL_HS_CLKCTRL_OFFSET,
1649 .context_offs = OMAP54XX_RM_L3INIT_USB_TLL_HS_CONTEXT_OFFSET,
1650 .modulemode = MODULEMODE_HWCTRL,
1651 },
1652 },
1653};
1654
1655/*
1468 * 'usb_otg_ss' class 1656 * 'usb_otg_ss' class
1469 * 2.0 super speed (usb_otg_ss) controller 1657 * 2.0 super speed (usb_otg_ss) controller
1470 */ 1658 */
@@ -1960,6 +2148,22 @@ static struct omap_hwmod_ocp_if omap54xx_l4_cfg__mpu = {
1960 .user = OCP_USER_MPU | OCP_USER_SDMA, 2148 .user = OCP_USER_MPU | OCP_USER_SDMA,
1961}; 2149};
1962 2150
2151/* l4_cfg -> spinlock */
2152static struct omap_hwmod_ocp_if omap54xx_l4_cfg__spinlock = {
2153 .master = &omap54xx_l4_cfg_hwmod,
2154 .slave = &omap54xx_spinlock_hwmod,
2155 .clk = "l4_root_clk_div",
2156 .user = OCP_USER_MPU | OCP_USER_SDMA,
2157};
2158
2159/* l4_cfg -> ocp2scp1 */
2160static struct omap_hwmod_ocp_if omap54xx_l4_cfg__ocp2scp1 = {
2161 .master = &omap54xx_l4_cfg_hwmod,
2162 .slave = &omap54xx_ocp2scp1_hwmod,
2163 .clk = "l4_root_clk_div",
2164 .user = OCP_USER_MPU | OCP_USER_SDMA,
2165};
2166
1963/* l4_wkup -> timer1 */ 2167/* l4_wkup -> timer1 */
1964static struct omap_hwmod_ocp_if omap54xx_l4_wkup__timer1 = { 2168static struct omap_hwmod_ocp_if omap54xx_l4_wkup__timer1 = {
1965 .master = &omap54xx_l4_wkup_hwmod, 2169 .master = &omap54xx_l4_wkup_hwmod,
@@ -2096,6 +2300,22 @@ static struct omap_hwmod_ocp_if omap54xx_l4_per__uart6 = {
2096 .user = OCP_USER_MPU | OCP_USER_SDMA, 2300 .user = OCP_USER_MPU | OCP_USER_SDMA,
2097}; 2301};
2098 2302
2303/* l4_cfg -> usb_host_hs */
2304static struct omap_hwmod_ocp_if omap54xx_l4_cfg__usb_host_hs = {
2305 .master = &omap54xx_l4_cfg_hwmod,
2306 .slave = &omap54xx_usb_host_hs_hwmod,
2307 .clk = "l3_iclk_div",
2308 .user = OCP_USER_MPU | OCP_USER_SDMA,
2309};
2310
2311/* l4_cfg -> usb_tll_hs */
2312static struct omap_hwmod_ocp_if omap54xx_l4_cfg__usb_tll_hs = {
2313 .master = &omap54xx_l4_cfg_hwmod,
2314 .slave = &omap54xx_usb_tll_hs_hwmod,
2315 .clk = "l4_root_clk_div",
2316 .user = OCP_USER_MPU | OCP_USER_SDMA,
2317};
2318
2099/* l4_cfg -> usb_otg_ss */ 2319/* l4_cfg -> usb_otg_ss */
2100static struct omap_hwmod_ocp_if omap54xx_l4_cfg__usb_otg_ss = { 2320static struct omap_hwmod_ocp_if omap54xx_l4_cfg__usb_otg_ss = {
2101 .master = &omap54xx_l4_cfg_hwmod, 2321 .master = &omap54xx_l4_cfg_hwmod,
@@ -2163,6 +2383,8 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
2163 &omap54xx_l4_per__mmc4, 2383 &omap54xx_l4_per__mmc4,
2164 &omap54xx_l4_per__mmc5, 2384 &omap54xx_l4_per__mmc5,
2165 &omap54xx_l4_cfg__mpu, 2385 &omap54xx_l4_cfg__mpu,
2386 &omap54xx_l4_cfg__spinlock,
2387 &omap54xx_l4_cfg__ocp2scp1,
2166 &omap54xx_l4_wkup__timer1, 2388 &omap54xx_l4_wkup__timer1,
2167 &omap54xx_l4_per__timer2, 2389 &omap54xx_l4_per__timer2,
2168 &omap54xx_l4_per__timer3, 2390 &omap54xx_l4_per__timer3,
@@ -2180,6 +2402,8 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
2180 &omap54xx_l4_per__uart4, 2402 &omap54xx_l4_per__uart4,
2181 &omap54xx_l4_per__uart5, 2403 &omap54xx_l4_per__uart5,
2182 &omap54xx_l4_per__uart6, 2404 &omap54xx_l4_per__uart6,
2405 &omap54xx_l4_cfg__usb_host_hs,
2406 &omap54xx_l4_cfg__usb_tll_hs,
2183 &omap54xx_l4_cfg__usb_otg_ss, 2407 &omap54xx_l4_cfg__usb_otg_ss,
2184 &omap54xx_l4_wkup__wd_timer2, 2408 &omap54xx_l4_wkup__wd_timer2,
2185 NULL, 2409 NULL,
diff --git a/arch/arm/mach-omap2/opp.c b/arch/arm/mach-omap2/opp.c
index bd41d59a7cab..a358a07e18f2 100644
--- a/arch/arm/mach-omap2/opp.c
+++ b/arch/arm/mach-omap2/opp.c
@@ -17,7 +17,8 @@
17 * GNU General Public License for more details. 17 * GNU General Public License for more details.
18 */ 18 */
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/opp.h> 20#include <linux/of.h>
21#include <linux/pm_opp.h>
21#include <linux/cpu.h> 22#include <linux/cpu.h>
22 23
23#include "omap_device.h" 24#include "omap_device.h"
@@ -40,6 +41,9 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def,
40{ 41{
41 int i, r; 42 int i, r;
42 43
44 if (of_have_populated_dt())
45 return -EINVAL;
46
43 if (!opp_def || !opp_def_size) { 47 if (!opp_def || !opp_def_size) {
44 pr_err("%s: invalid params!\n", __func__); 48 pr_err("%s: invalid params!\n", __func__);
45 return -EINVAL; 49 return -EINVAL;
@@ -81,14 +85,14 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def,
81 dev = &oh->od->pdev->dev; 85 dev = &oh->od->pdev->dev;
82 } 86 }
83 87
84 r = opp_add(dev, opp_def->freq, opp_def->u_volt); 88 r = dev_pm_opp_add(dev, opp_def->freq, opp_def->u_volt);
85 if (r) { 89 if (r) {
86 dev_err(dev, "%s: add OPP %ld failed for %s [%d] result=%d\n", 90 dev_err(dev, "%s: add OPP %ld failed for %s [%d] result=%d\n",
87 __func__, opp_def->freq, 91 __func__, opp_def->freq,
88 opp_def->hwmod_name, i, r); 92 opp_def->hwmod_name, i, r);
89 } else { 93 } else {
90 if (!opp_def->default_available) 94 if (!opp_def->default_available)
91 r = opp_disable(dev, opp_def->freq); 95 r = dev_pm_opp_disable(dev, opp_def->freq);
92 if (r) 96 if (r)
93 dev_err(dev, "%s: disable %ld failed for %s [%d] result=%d\n", 97 dev_err(dev, "%s: disable %ld failed for %s [%d] result=%d\n",
94 __func__, opp_def->freq, 98 __func__, opp_def->freq,
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
new file mode 100644
index 000000000000..10c71450cf63
--- /dev/null
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -0,0 +1,174 @@
1/*
2 * Legacy platform_data quirks
3 *
4 * Copyright (C) 2013 Texas Instruments
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#include <linux/clk.h>
11#include <linux/gpio.h>
12#include <linux/init.h>
13#include <linux/kernel.h>
14#include <linux/of_platform.h>
15#include <linux/wl12xx.h>
16
17#include <linux/platform_data/pinctrl-single.h>
18
19#include "common.h"
20#include "common-board-devices.h"
21#include "dss-common.h"
22#include "control.h"
23
24struct pdata_init {
25 const char *compatible;
26 void (*fn)(void);
27};
28
29/*
30 * Create alias for USB host PHY clock.
31 * Remove this when clock phandle can be provided via DT
32 */
33static void __init __used legacy_init_ehci_clk(char *clkname)
34{
35 int ret;
36
37 ret = clk_add_alias("main_clk", NULL, clkname, NULL);
38 if (ret)
39 pr_err("%s:Failed to add main_clk alias to %s :%d\n",
40 __func__, clkname, ret);
41}
42
43#if IS_ENABLED(CONFIG_WL12XX)
44
45static struct wl12xx_platform_data wl12xx __initdata;
46
47static void __init __used legacy_init_wl12xx(unsigned ref_clock,
48 unsigned tcxo_clock,
49 int gpio)
50{
51 int res;
52
53 wl12xx.board_ref_clock = ref_clock;
54 wl12xx.board_tcxo_clock = tcxo_clock;
55 wl12xx.irq = gpio_to_irq(gpio);
56
57 res = wl12xx_set_platform_data(&wl12xx);
58 if (res) {
59 pr_err("error setting wl12xx data: %d\n", res);
60 return;
61 }
62}
63#else
64static inline void legacy_init_wl12xx(unsigned ref_clock,
65 unsigned tcxo_clock,
66 int gpio)
67{
68}
69#endif
70
71#ifdef CONFIG_ARCH_OMAP3
72static void __init hsmmc2_internal_input_clk(void)
73{
74 u32 reg;
75
76 reg = omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1);
77 reg |= OMAP2_MMCSDIO2ADPCLKISEL;
78 omap_ctrl_writel(reg, OMAP343X_CONTROL_DEVCONF1);
79}
80
81static void __init omap3_igep0020_legacy_init(void)
82{
83 omap3_igep2_display_init_of();
84}
85
86static void __init omap3_evm_legacy_init(void)
87{
88 legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 149);
89}
90
91static void __init omap3_zoom_legacy_init(void)
92{
93 legacy_init_wl12xx(WL12XX_REFCLOCK_26, 0, 162);
94}
95#endif /* CONFIG_ARCH_OMAP3 */
96
97#ifdef CONFIG_ARCH_OMAP4
98static void __init omap4_sdp_legacy_init(void)
99{
100 omap_4430sdp_display_init_of();
101 legacy_init_wl12xx(WL12XX_REFCLOCK_26,
102 WL12XX_TCXOCLOCK_26, 53);
103}
104
105static void __init omap4_panda_legacy_init(void)
106{
107 omap4_panda_display_init_of();
108 legacy_init_ehci_clk("auxclk3_ck");
109 legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 53);
110}
111#endif
112
113#ifdef CONFIG_SOC_OMAP5
114static void __init omap5_uevm_legacy_init(void)
115{
116 legacy_init_ehci_clk("auxclk1_ck");
117}
118#endif
119
120static struct pcs_pdata pcs_pdata;
121
122void omap_pcs_legacy_init(int irq, void (*rearm)(void))
123{
124 pcs_pdata.irq = irq;
125 pcs_pdata.rearm = rearm;
126}
127
128struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
129#ifdef CONFIG_ARCH_OMAP3
130 OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata),
131 OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002a00, "48002a00.pinmux", &pcs_pdata),
132#endif
133#ifdef CONFIG_ARCH_OMAP4
134 OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a100040, "4a100040.pinmux", &pcs_pdata),
135 OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a31e040, "4a31e040.pinmux", &pcs_pdata),
136#endif
137 { /* sentinel */ },
138};
139
140static struct pdata_init pdata_quirks[] __initdata = {
141#ifdef CONFIG_ARCH_OMAP3
142 { "nokia,omap3-n9", hsmmc2_internal_input_clk, },
143 { "nokia,omap3-n950", hsmmc2_internal_input_clk, },
144 { "isee,omap3-igep0020", omap3_igep0020_legacy_init, },
145 { "ti,omap3-evm-37xx", omap3_evm_legacy_init, },
146 { "ti,omap3-zoom3", omap3_zoom_legacy_init, },
147#endif
148#ifdef CONFIG_ARCH_OMAP4
149 { "ti,omap4-sdp", omap4_sdp_legacy_init, },
150 { "ti,omap4-panda", omap4_panda_legacy_init, },
151#endif
152#ifdef CONFIG_SOC_OMAP5
153 { "ti,omap5-uevm", omap5_uevm_legacy_init, },
154#endif
155 { /* sentinel */ },
156};
157
158void __init pdata_quirks_init(struct of_device_id *omap_dt_match_table)
159{
160 struct pdata_init *quirks = pdata_quirks;
161
162 omap_sdrc_init(NULL, NULL);
163 of_platform_populate(NULL, omap_dt_match_table,
164 omap_auxdata_lookup, NULL);
165
166 while (quirks->compatible) {
167 if (of_machine_is_compatible(quirks->compatible)) {
168 if (quirks->fn)
169 quirks->fn();
170 break;
171 }
172 quirks++;
173 }
174}
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index e742118fcfd2..e1b41416fbf1 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -13,7 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/opp.h> 16#include <linux/pm_opp.h>
17#include <linux/export.h> 17#include <linux/export.h>
18#include <linux/suspend.h> 18#include <linux/suspend.h>
19#include <linux/cpu.h> 19#include <linux/cpu.h>
@@ -131,7 +131,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
131{ 131{
132 struct voltagedomain *voltdm; 132 struct voltagedomain *voltdm;
133 struct clk *clk; 133 struct clk *clk;
134 struct opp *opp; 134 struct dev_pm_opp *opp;
135 unsigned long freq, bootup_volt; 135 unsigned long freq, bootup_volt;
136 struct device *dev; 136 struct device *dev;
137 137
@@ -172,7 +172,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
172 clk_put(clk); 172 clk_put(clk);
173 173
174 rcu_read_lock(); 174 rcu_read_lock();
175 opp = opp_find_freq_ceil(dev, &freq); 175 opp = dev_pm_opp_find_freq_ceil(dev, &freq);
176 if (IS_ERR(opp)) { 176 if (IS_ERR(opp)) {
177 rcu_read_unlock(); 177 rcu_read_unlock();
178 pr_err("%s: unable to find boot up OPP for vdd_%s\n", 178 pr_err("%s: unable to find boot up OPP for vdd_%s\n",
@@ -180,7 +180,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
180 goto exit; 180 goto exit;
181 } 181 }
182 182
183 bootup_volt = opp_get_voltage(opp); 183 bootup_volt = dev_pm_opp_get_voltage(opp);
184 rcu_read_unlock(); 184 rcu_read_unlock();
185 if (!bootup_volt) { 185 if (!bootup_volt) {
186 pr_err("%s: unable to find voltage corresponding to the bootup OPP for vdd_%s\n", 186 pr_err("%s: unable to find voltage corresponding to the bootup OPP for vdd_%s\n",
@@ -266,7 +266,12 @@ static void __init omap4_init_voltages(void)
266 266
267static inline void omap_init_cpufreq(void) 267static inline void omap_init_cpufreq(void)
268{ 268{
269 struct platform_device_info devinfo = { .name = "omap-cpufreq", }; 269 struct platform_device_info devinfo = { };
270
271 if (!of_have_populated_dt())
272 devinfo.name = "omap-cpufreq";
273 else
274 devinfo.name = "cpufreq-cpu0";
270 platform_device_register_full(&devinfo); 275 platform_device_register_full(&devinfo);
271} 276}
272 277
@@ -300,10 +305,11 @@ int __init omap2_common_pm_late_init(void)
300 /* Smartreflex device init */ 305 /* Smartreflex device init */
301 omap_devinit_smartreflex(); 306 omap_devinit_smartreflex();
302 307
303 /* cpufreq dummy device instantiation */
304 omap_init_cpufreq();
305 } 308 }
306 309
310 /* cpufreq dummy device instantiation */
311 omap_init_cpufreq();
312
307#ifdef CONFIG_SUSPEND 313#ifdef CONFIG_SUSPEND
308 suspend_set_ops(&omap_pm_ops); 314 suspend_set_ops(&omap_pm_ops);
309#endif 315#endif
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index ce956b0a7ba4..8c0759496c8d 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -62,16 +62,6 @@ static struct clockdomain *dsp_clkdm, *mpu_clkdm, *wkup_clkdm, *gfx_clkdm;
62 62
63static struct clk *osc_ck, *emul_ck; 63static struct clk *osc_ck, *emul_ck;
64 64
65static int omap2_fclks_active(void)
66{
67 u32 f1, f2;
68
69 f1 = omap2_cm_read_mod_reg(CORE_MOD, CM_FCLKEN1);
70 f2 = omap2_cm_read_mod_reg(CORE_MOD, OMAP24XX_CM_FCLKEN2);
71
72 return (f1 | f2) ? 1 : 0;
73}
74
75static int omap2_enter_full_retention(void) 65static int omap2_enter_full_retention(void)
76{ 66{
77 u32 l; 67 u32 l;
@@ -142,17 +132,7 @@ static int sti_console_enabled;
142 132
143static int omap2_allow_mpu_retention(void) 133static int omap2_allow_mpu_retention(void)
144{ 134{
145 u32 l; 135 if (!omap2xxx_cm_mpu_retention_allowed())
146
147 /* Check for MMC, UART2, UART1, McSPI2, McSPI1 and DSS1. */
148 l = omap2_cm_read_mod_reg(CORE_MOD, CM_FCLKEN1);
149 if (l & (OMAP2420_EN_MMC_MASK | OMAP24XX_EN_UART2_MASK |
150 OMAP24XX_EN_UART1_MASK | OMAP24XX_EN_MCSPI2_MASK |
151 OMAP24XX_EN_MCSPI1_MASK | OMAP24XX_EN_DSS1_MASK))
152 return 0;
153 /* Check for UART3. */
154 l = omap2_cm_read_mod_reg(CORE_MOD, OMAP24XX_CM_FCLKEN2);
155 if (l & OMAP24XX_EN_UART3_MASK)
156 return 0; 136 return 0;
157 if (sti_console_enabled) 137 if (sti_console_enabled)
158 return 0; 138 return 0;
@@ -188,7 +168,7 @@ static void omap2_enter_mpu_retention(void)
188 168
189static int omap2_can_sleep(void) 169static int omap2_can_sleep(void)
190{ 170{
191 if (omap2_fclks_active()) 171 if (omap2xxx_cm_fclks_active())
192 return 0; 172 return 0;
193 if (__clk_is_enabled(osc_ck)) 173 if (__clk_is_enabled(osc_ck))
194 return 0; 174 return 0;
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 5a2d8034c8de..93b80e5da8d4 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -430,8 +430,7 @@ static void __init omap3_iva_idle(void)
430 OMAP3430_IVA2_MOD, CM_FCLKEN); 430 OMAP3430_IVA2_MOD, CM_FCLKEN);
431 431
432 /* Set IVA2 boot mode to 'idle' */ 432 /* Set IVA2 boot mode to 'idle' */
433 omap_ctrl_writel(OMAP3_IVA2_BOOTMOD_IDLE, 433 omap3_ctrl_set_iva_bootmode_idle();
434 OMAP343X_CONTROL_IVA2_BOOTMOD);
435 434
436 /* Un-reset IVA2 */ 435 /* Un-reset IVA2 */
437 omap2_prm_write_mod_reg(0, OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL); 436 omap2_prm_write_mod_reg(0, OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL);
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index baf3d8bf6bea..da5a59ae77b6 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -257,6 +257,7 @@ extern void am33xx_powerdomains_init(void);
257extern void omap44xx_powerdomains_init(void); 257extern void omap44xx_powerdomains_init(void);
258extern void omap54xx_powerdomains_init(void); 258extern void omap54xx_powerdomains_init(void);
259extern void dra7xx_powerdomains_init(void); 259extern void dra7xx_powerdomains_init(void);
260void am43xx_powerdomains_init(void);
260 261
261extern struct pwrdm_ops omap2_pwrdm_operations; 262extern struct pwrdm_ops omap2_pwrdm_operations;
262extern struct pwrdm_ops omap3_pwrdm_operations; 263extern struct pwrdm_ops omap3_pwrdm_operations;
diff --git a/arch/arm/mach-omap2/powerdomains43xx_data.c b/arch/arm/mach-omap2/powerdomains43xx_data.c
new file mode 100644
index 000000000000..95fee54c38ab
--- /dev/null
+++ b/arch/arm/mach-omap2/powerdomains43xx_data.c
@@ -0,0 +1,136 @@
1/*
2 * AM43xx Power domains framework
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13
14#include "powerdomain.h"
15
16#include "prcm-common.h"
17#include "prcm44xx.h"
18#include "prcm43xx.h"
19
20static struct powerdomain gfx_43xx_pwrdm = {
21 .name = "gfx_pwrdm",
22 .voltdm = { .name = "core" },
23 .prcm_offs = AM43XX_PRM_GFX_INST,
24 .prcm_partition = AM43XX_PRM_PARTITION,
25 .pwrsts = PWRSTS_OFF_ON,
26 .banks = 1,
27 .pwrsts_mem_on = {
28 [0] = PWRSTS_ON, /* gfx_mem */
29 },
30 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
31};
32
33static struct powerdomain mpu_43xx_pwrdm = {
34 .name = "mpu_pwrdm",
35 .voltdm = { .name = "mpu" },
36 .prcm_offs = AM43XX_PRM_MPU_INST,
37 .prcm_partition = AM43XX_PRM_PARTITION,
38 .pwrsts = PWRSTS_OFF_RET_ON,
39 .pwrsts_logic_ret = PWRSTS_OFF_RET,
40 .banks = 3,
41 .pwrsts_mem_ret = {
42 [0] = PWRSTS_OFF_RET, /* mpu_l1 */
43 [1] = PWRSTS_OFF_RET, /* mpu_l2 */
44 [2] = PWRSTS_OFF_RET, /* mpu_ram */
45 },
46 .pwrsts_mem_on = {
47 [0] = PWRSTS_ON, /* mpu_l1 */
48 [1] = PWRSTS_ON, /* mpu_l2 */
49 [2] = PWRSTS_ON, /* mpu_ram */
50 },
51 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
52};
53
54static struct powerdomain rtc_43xx_pwrdm = {
55 .name = "rtc_pwrdm",
56 .voltdm = { .name = "rtc" },
57 .prcm_offs = AM43XX_PRM_RTC_INST,
58 .prcm_partition = AM43XX_PRM_PARTITION,
59 .pwrsts = PWRSTS_ON,
60};
61
62static struct powerdomain wkup_43xx_pwrdm = {
63 .name = "wkup_pwrdm",
64 .voltdm = { .name = "core" },
65 .prcm_offs = AM43XX_PRM_WKUP_INST,
66 .prcm_partition = AM43XX_PRM_PARTITION,
67 .pwrsts = PWRSTS_ON,
68 .banks = 1,
69 .pwrsts_mem_on = {
70 [0] = PWRSTS_ON, /* debugss_mem */
71 },
72};
73
74static struct powerdomain tamper_43xx_pwrdm = {
75 .name = "tamper_pwrdm",
76 .voltdm = { .name = "tamper" },
77 .prcm_offs = AM43XX_PRM_TAMPER_INST,
78 .prcm_partition = AM43XX_PRM_PARTITION,
79 .pwrsts = PWRSTS_ON,
80};
81
82static struct powerdomain cefuse_43xx_pwrdm = {
83 .name = "cefuse_pwrdm",
84 .voltdm = { .name = "core" },
85 .prcm_offs = AM43XX_PRM_CEFUSE_INST,
86 .prcm_partition = AM43XX_PRM_PARTITION,
87 .pwrsts = PWRSTS_OFF_ON,
88 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
89};
90
91static struct powerdomain per_43xx_pwrdm = {
92 .name = "per_pwrdm",
93 .voltdm = { .name = "core" },
94 .prcm_offs = AM43XX_PRM_PER_INST,
95 .prcm_partition = AM43XX_PRM_PARTITION,
96 .pwrsts = PWRSTS_OFF_RET_ON,
97 .pwrsts_logic_ret = PWRSTS_OFF_RET,
98 .banks = 4,
99 .pwrsts_mem_ret = {
100 [0] = PWRSTS_OFF_RET, /* icss_mem */
101 [1] = PWRSTS_OFF_RET, /* per_mem */
102 [2] = PWRSTS_OFF_RET, /* ram1_mem */
103 [3] = PWRSTS_OFF_RET, /* ram2_mem */
104 },
105 .pwrsts_mem_on = {
106 [0] = PWRSTS_ON, /* icss_mem */
107 [1] = PWRSTS_ON, /* per_mem */
108 [2] = PWRSTS_ON, /* ram1_mem */
109 [3] = PWRSTS_ON, /* ram2_mem */
110 },
111 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
112};
113
114static struct powerdomain *powerdomains_am43xx[] __initdata = {
115 &gfx_43xx_pwrdm,
116 &mpu_43xx_pwrdm,
117 &rtc_43xx_pwrdm,
118 &wkup_43xx_pwrdm,
119 &tamper_43xx_pwrdm,
120 &cefuse_43xx_pwrdm,
121 &per_43xx_pwrdm,
122 NULL
123};
124
125static int am43xx_check_vcvp(void)
126{
127 return 0;
128}
129
130void __init am43xx_powerdomains_init(void)
131{
132 omap4_pwrdm_operations.pwrdm_has_voltdm = am43xx_check_vcvp;
133 pwrdm_register_platform_funcs(&omap4_pwrdm_operations);
134 pwrdm_register_pwrdms(powerdomains_am43xx);
135 pwrdm_complete_init();
136}
diff --git a/arch/arm/mach-omap2/prcm43xx.h b/arch/arm/mach-omap2/prcm43xx.h
new file mode 100644
index 000000000000..7785be984edd
--- /dev/null
+++ b/arch/arm/mach-omap2/prcm43xx.h
@@ -0,0 +1,146 @@
1/*
2 * AM43x PRCM defines
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#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_43XX_H
12#define __ARCH_ARM_MACH_OMAP2_PRCM_43XX_H
13
14#define AM43XX_PRM_PARTITION 1
15#define AM43XX_CM_PARTITION 1
16
17/* PRM instances */
18#define AM43XX_PRM_OCP_SOCKET_INST 0x0000
19#define AM43XX_PRM_MPU_INST 0x0300
20#define AM43XX_PRM_GFX_INST 0x0400
21#define AM43XX_PRM_RTC_INST 0x0500
22#define AM43XX_PRM_TAMPER_INST 0x0600
23#define AM43XX_PRM_CEFUSE_INST 0x0700
24#define AM43XX_PRM_PER_INST 0x0800
25#define AM43XX_PRM_WKUP_INST 0x2000
26#define AM43XX_PRM_DEVICE_INST 0x4000
27
28/* RM RSTCTRL offsets */
29#define AM43XX_RM_PER_RSTCTRL_OFFSET 0x0010
30#define AM43XX_RM_GFX_RSTCTRL_OFFSET 0x0010
31#define AM43XX_RM_WKUP_RSTCTRL_OFFSET 0x0010
32
33/* RM RSTST offsets */
34#define AM43XX_RM_GFX_RSTST_OFFSET 0x0014
35#define AM43XX_RM_WKUP_RSTST_OFFSET 0x0014
36
37/* CM instances */
38#define AM43XX_CM_WKUP_INST 0x2800
39#define AM43XX_CM_DEVICE_INST 0x4100
40#define AM43XX_CM_DPLL_INST 0x4200
41#define AM43XX_CM_MPU_INST 0x8300
42#define AM43XX_CM_GFX_INST 0x8400
43#define AM43XX_CM_RTC_INST 0x8500
44#define AM43XX_CM_TAMPER_INST 0x8600
45#define AM43XX_CM_CEFUSE_INST 0x8700
46#define AM43XX_CM_PER_INST 0x8800
47
48/* CD offsets */
49#define AM43XX_CM_WKUP_L3_AON_CDOFFS 0x0000
50#define AM43XX_CM_WKUP_L3S_TSC_CDOFFS 0x0100
51#define AM43XX_CM_WKUP_L4_WKUP_AON_CDOFFS 0x0200
52#define AM43XX_CM_WKUP_WKUP_CDOFFS 0x0300
53#define AM43XX_CM_MPU_MPU_CDOFFS 0x0000
54#define AM43XX_CM_GFX_GFX_L3_CDOFFS 0x0000
55#define AM43XX_CM_RTC_RTC_CDOFFS 0x0000
56#define AM43XX_CM_TAMPER_TAMPER_CDOFFS 0x0000
57#define AM43XX_CM_CEFUSE_CEFUSE_CDOFFS 0x0000
58#define AM43XX_CM_PER_L3_CDOFFS 0x0000
59#define AM43XX_CM_PER_L3S_CDOFFS 0x0200
60#define AM43XX_CM_PER_ICSS_CDOFFS 0x0300
61#define AM43XX_CM_PER_L4LS_CDOFFS 0x0400
62#define AM43XX_CM_PER_EMIF_CDOFFS 0x0700
63#define AM43XX_CM_PER_DSS_CDOFFS 0x0a00
64#define AM43XX_CM_PER_CPSW_CDOFFS 0x0b00
65#define AM43XX_CM_PER_OCPWP_L3_CDOFFS 0x0c00
66
67/* CLK CTRL offsets */
68#define AM43XX_CM_PER_UART1_CLKCTRL_OFFSET 0x0580
69#define AM43XX_CM_PER_UART2_CLKCTRL_OFFSET 0x0588
70#define AM43XX_CM_PER_UART3_CLKCTRL_OFFSET 0x0590
71#define AM43XX_CM_PER_UART4_CLKCTRL_OFFSET 0x0598
72#define AM43XX_CM_PER_UART5_CLKCTRL_OFFSET 0x05a0
73#define AM43XX_CM_PER_DCAN0_CLKCTRL_OFFSET 0x0428
74#define AM43XX_CM_PER_DCAN1_CLKCTRL_OFFSET 0x0430
75#define AM43XX_CM_PER_ELM_CLKCTRL_OFFSET 0x0468
76#define AM43XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET 0x0438
77#define AM43XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET 0x0440
78#define AM43XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET 0x0448
79#define AM43XX_CM_PER_GPIO1_CLKCTRL_OFFSET 0x0478
80#define AM43XX_CM_PER_GPIO2_CLKCTRL_OFFSET 0x0480
81#define AM43XX_CM_PER_GPIO3_CLKCTRL_OFFSET 0x0488
82#define AM43XX_CM_PER_I2C1_CLKCTRL_OFFSET 0x04a8
83#define AM43XX_CM_PER_I2C2_CLKCTRL_OFFSET 0x04b0
84#define AM43XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET 0x04b8
85#define AM43XX_CM_PER_MMC0_CLKCTRL_OFFSET 0x04c0
86#define AM43XX_CM_PER_MMC1_CLKCTRL_OFFSET 0x04c8
87#define AM43XX_CM_PER_SPI0_CLKCTRL_OFFSET 0x0500
88#define AM43XX_CM_PER_SPI1_CLKCTRL_OFFSET 0x0508
89#define AM43XX_CM_PER_SPINLOCK_CLKCTRL_OFFSET 0x0528
90#define AM43XX_CM_PER_TIMER2_CLKCTRL_OFFSET 0x0530
91#define AM43XX_CM_PER_TIMER3_CLKCTRL_OFFSET 0x0538
92#define AM43XX_CM_PER_TIMER4_CLKCTRL_OFFSET 0x0540
93#define AM43XX_CM_PER_TIMER5_CLKCTRL_OFFSET 0x0548
94#define AM43XX_CM_PER_TIMER6_CLKCTRL_OFFSET 0x0550
95#define AM43XX_CM_PER_TIMER7_CLKCTRL_OFFSET 0x0558
96#define AM43XX_CM_WKUP_WKUP_M3_CLKCTRL_OFFSET 0x0228
97#define AM43XX_CM_WKUP_CONTROL_CLKCTRL_OFFSET 0x0360
98#define AM43XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET 0x0350
99#define AM43XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET 0x0358
100#define AM43XX_CM_WKUP_UART0_CLKCTRL_OFFSET 0x0348
101#define AM43XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET 0x0328
102#define AM43XX_CM_WKUP_I2C0_CLKCTRL_OFFSET 0x0340
103#define AM43XX_CM_WKUP_GPIO0_CLKCTRL_OFFSET 0x0368
104#define AM43XX_CM_WKUP_ADC_TSC_CLKCTRL_OFFSET 0x0120
105#define AM43XX_CM_WKUP_WDT1_CLKCTRL_OFFSET 0x0338
106#define AM43XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET 0x0220
107#define AM43XX_CM_RTC_RTC_CLKCTRL_OFFSET 0x0020
108#define AM43XX_CM_PER_MMC2_CLKCTRL_OFFSET 0x0248
109#define AM43XX_CM_PER_QSPI_CLKCTRL_OFFSET 0x0258
110#define AM43XX_CM_PER_GPMC_CLKCTRL_OFFSET 0x0220
111#define AM43XX_CM_PER_MCASP0_CLKCTRL_OFFSET 0x0238
112#define AM43XX_CM_PER_MCASP1_CLKCTRL_OFFSET 0x0240
113#define AM43XX_CM_PER_L4LS_CLKCTRL_OFFSET 0x0420
114#define AM43XX_CM_PER_L3_CLKCTRL_OFFSET 0x0020
115#define AM43XX_CM_PER_TPCC_CLKCTRL_OFFSET 0x0078
116#define AM43XX_CM_PER_TPTC0_CLKCTRL_OFFSET 0x0080
117#define AM43XX_CM_PER_TPTC1_CLKCTRL_OFFSET 0x0088
118#define AM43XX_CM_PER_TPTC2_CLKCTRL_OFFSET 0x0090
119#define AM43XX_CM_PER_CPGMAC0_CLKCTRL_OFFSET 0x0b20
120#define AM43XX_CM_PER_PRUSS_CLKCTRL_OFFSET 0x0320
121#define AM43XX_CM_GFX_GFX_CLKCTRL_OFFSET 0x0020
122#define AM43XX_CM_PER_L4HS_CLKCTRL_OFFSET 0x00a0
123#define AM43XX_CM_MPU_MPU_CLKCTRL_OFFSET 0x0020
124#define AM43XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET 0x0040
125#define AM43XX_CM_PER_OCMCRAM_CLKCTRL_OFFSET 0x0050
126#define AM43XX_CM_PER_SHA0_CLKCTRL_OFFSET 0x0058
127#define AM43XX_CM_PER_AES0_CLKCTRL_OFFSET 0x0028
128#define AM43XX_CM_PER_TIMER8_CLKCTRL_OFFSET 0x0560
129#define AM43XX_CM_PER_TIMER9_CLKCTRL_OFFSET 0x0568
130#define AM43XX_CM_PER_TIMER10_CLKCTRL_OFFSET 0x0570
131#define AM43XX_CM_PER_TIMER11_CLKCTRL_OFFSET 0x0578
132#define AM43XX_CM_WKUP_SYNCTIMER_CLKCTRL_OFFSET 0x0230
133#define AM43XX_CM_PER_EPWMSS3_CLKCTRL_OFFSET 0x0450
134#define AM43XX_CM_PER_EPWMSS4_CLKCTRL_OFFSET 0x0458
135#define AM43XX_CM_PER_EPWMSS5_CLKCTRL_OFFSET 0x0460
136#define AM43XX_CM_PER_SPI2_CLKCTRL_OFFSET 0x0510
137#define AM43XX_CM_PER_SPI3_CLKCTRL_OFFSET 0x0518
138#define AM43XX_CM_PER_SPI4_CLKCTRL_OFFSET 0x0520
139#define AM43XX_CM_PER_GPIO4_CLKCTRL_OFFSET 0x0490
140#define AM43XX_CM_PER_GPIO5_CLKCTRL_OFFSET 0x0498
141#define AM43XX_CM_PER_USB_OTG_SS0_CLKCTRL_OFFSET 0x0260
142#define AM43XX_CM_PER_USBPHYOCP2SCP0_CLKCTRL_OFFSET 0x05B8
143#define AM43XX_CM_PER_USB_OTG_SS1_CLKCTRL_OFFSET 0x0268
144#define AM43XX_CM_PER_USBPHYOCP2SCP1_CLKCTRL_OFFSET 0x05C0
145
146#endif
diff --git a/arch/arm/mach-omap2/prm3xxx.h b/arch/arm/mach-omap2/prm3xxx.h
index 277f71794e61..f8eb83323b1a 100644
--- a/arch/arm/mach-omap2/prm3xxx.h
+++ b/arch/arm/mach-omap2/prm3xxx.h
@@ -144,7 +144,13 @@ extern u32 omap3_prm_vcvp_read(u8 offset);
144extern void omap3_prm_vcvp_write(u32 val, u8 offset); 144extern void omap3_prm_vcvp_write(u32 val, u8 offset);
145extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset); 145extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
146 146
147extern void omap3xxx_prm_reconfigure_io_chain(void); 147#ifdef CONFIG_ARCH_OMAP3
148void omap3xxx_prm_reconfigure_io_chain(void);
149#else
150static inline void omap3xxx_prm_reconfigure_io_chain(void)
151{
152}
153#endif
148 154
149/* PRM interrupt-related functions */ 155/* PRM interrupt-related functions */
150extern void omap3xxx_prm_read_pending_irqs(unsigned long *events); 156extern void omap3xxx_prm_read_pending_irqs(unsigned long *events);
diff --git a/arch/arm/mach-omap2/prm44xx_54xx.h b/arch/arm/mach-omap2/prm44xx_54xx.h
index 7cd22abb8f15..a085d9cc1f5d 100644
--- a/arch/arm/mach-omap2/prm44xx_54xx.h
+++ b/arch/arm/mach-omap2/prm44xx_54xx.h
@@ -42,7 +42,13 @@ extern u32 omap4_prm_vcvp_read(u8 offset);
42extern void omap4_prm_vcvp_write(u32 val, u8 offset); 42extern void omap4_prm_vcvp_write(u32 val, u8 offset);
43extern u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset); 43extern u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
44 44
45extern void omap44xx_prm_reconfigure_io_chain(void); 45#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
46void omap44xx_prm_reconfigure_io_chain(void);
47#else
48static inline void omap44xx_prm_reconfigure_io_chain(void)
49{
50}
51#endif
46 52
47/* PRM interrupt-related functions */ 53/* PRM interrupt-related functions */
48extern void omap44xx_prm_read_pending_irqs(unsigned long *events); 54extern void omap44xx_prm_read_pending_irqs(unsigned long *events);
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 228b850e632f..a2e1174ad1b6 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -24,6 +24,7 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26 26
27#include "soc.h"
27#include "prm2xxx_3xxx.h" 28#include "prm2xxx_3xxx.h"
28#include "prm2xxx.h" 29#include "prm2xxx.h"
29#include "prm3xxx.h" 30#include "prm3xxx.h"
@@ -322,6 +323,16 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
322 prcm_irq_chips[i] = gc; 323 prcm_irq_chips[i] = gc;
323 } 324 }
324 325
326 if (of_have_populated_dt()) {
327 int irq = omap_prcm_event_to_irq("io");
328 if (cpu_is_omap34xx())
329 omap_pcs_legacy_init(irq,
330 omap3xxx_prm_reconfigure_io_chain);
331 else
332 omap_pcs_legacy_init(irq,
333 omap44xx_prm_reconfigure_io_chain);
334 }
335
325 return 0; 336 return 0;
326 337
327err: 338err:
diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h
index 4588df1447ed..076bd90a6ce0 100644
--- a/arch/arm/mach-omap2/soc.h
+++ b/arch/arm/mach-omap2/soc.h
@@ -455,9 +455,7 @@ IS_OMAP_TYPE(3430, 0x3430)
455#define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8)) 455#define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8))
456 456
457#define OMAP54XX_CLASS 0x54000054 457#define OMAP54XX_CLASS 0x54000054
458#define OMAP5430_REV_ES1_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x10 << 8))
459#define OMAP5430_REV_ES2_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x20 << 8)) 458#define OMAP5430_REV_ES2_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x20 << 8))
460#define OMAP5432_REV_ES1_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x10 << 8))
461#define OMAP5432_REV_ES2_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x20 << 8)) 459#define OMAP5432_REV_ES2_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x20 << 8))
462 460
463void omap2xxx_check_revision(void); 461void omap2xxx_check_revision(void);
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index fa74a0625da1..3ca81e0ada5e 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -55,6 +55,7 @@
55#include "soc.h" 55#include "soc.h"
56#include "common.h" 56#include "common.h"
57#include "powerdomain.h" 57#include "powerdomain.h"
58#include "omap-secure.h"
58 59
59#define REALTIME_COUNTER_BASE 0x48243200 60#define REALTIME_COUNTER_BASE 0x48243200
60#define INCREMENTER_NUMERATOR_OFFSET 0x10 61#define INCREMENTER_NUMERATOR_OFFSET 0x10
@@ -66,6 +67,15 @@
66static struct omap_dm_timer clkev; 67static struct omap_dm_timer clkev;
67static struct clock_event_device clockevent_gpt; 68static struct clock_event_device clockevent_gpt;
68 69
70#ifdef CONFIG_SOC_HAS_REALTIME_COUNTER
71static unsigned long arch_timer_freq;
72
73void set_cntfreq(void)
74{
75 omap_smc1(OMAP5_DRA7_MON_SET_CNTFRQ_INDEX, arch_timer_freq);
76}
77#endif
78
69static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id) 79static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id)
70{ 80{
71 struct clock_event_device *evt = &clockevent_gpt; 81 struct clock_event_device *evt = &clockevent_gpt;
@@ -78,7 +88,7 @@ static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id)
78 88
79static struct irqaction omap2_gp_timer_irq = { 89static struct irqaction omap2_gp_timer_irq = {
80 .name = "gp_timer", 90 .name = "gp_timer",
81 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 91 .flags = IRQF_TIMER | IRQF_IRQPOLL,
82 .handler = omap2_gp_timer_interrupt, 92 .handler = omap2_gp_timer_interrupt,
83}; 93};
84 94
@@ -515,6 +525,10 @@ static void __init realtime_counter_init(void)
515 num = 8; 525 num = 8;
516 den = 25; 526 den = 25;
517 break; 527 break;
528 case 20000000:
529 num = 192;
530 den = 625;
531 break;
518 case 2600000: 532 case 2600000:
519 num = 384; 533 num = 384;
520 den = 1625; 534 den = 1625;
@@ -542,6 +556,9 @@ static void __init realtime_counter_init(void)
542 reg |= den; 556 reg |= den;
543 __raw_writel(reg, base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET); 557 __raw_writel(reg, base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET);
544 558
559 arch_timer_freq = (rate / den) * num;
560 set_cntfreq();
561
545 iounmap(base); 562 iounmap(base);
546} 563}
547#else 564#else
@@ -628,7 +645,7 @@ void __init omap4_local_timer_init(void)
628#endif /* CONFIG_HAVE_ARM_TWD */ 645#endif /* CONFIG_HAVE_ARM_TWD */
629#endif /* CONFIG_ARCH_OMAP4 */ 646#endif /* CONFIG_ARCH_OMAP4 */
630 647
631#ifdef CONFIG_SOC_OMAP5 648#if defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX)
632void __init omap5_realtime_timer_init(void) 649void __init omap5_realtime_timer_init(void)
633{ 650{
634 omap4_sync32k_timer_init(); 651 omap4_sync32k_timer_init();
@@ -636,7 +653,7 @@ void __init omap5_realtime_timer_init(void)
636 653
637 clocksource_of_init(); 654 clocksource_of_init();
638} 655}
639#endif /* CONFIG_SOC_OMAP5 */ 656#endif /* CONFIG_SOC_OMAP5 || CONFIG_SOC_DRA7XX */
640 657
641/** 658/**
642 * omap_timer_init - build and register timer device with an 659 * omap_timer_init - build and register timer device with an
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index c05898fbd634..b0d54dae1bcb 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -24,6 +24,7 @@
24#include <linux/i2c/twl.h> 24#include <linux/i2c/twl.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/string.h> 26#include <linux/string.h>
27#include <linux/phy/phy.h>
27#include <linux/regulator/machine.h> 28#include <linux/regulator/machine.h>
28#include <linux/regulator/fixed.h> 29#include <linux/regulator/fixed.h>
29 30
@@ -90,8 +91,18 @@ void __init omap_pmic_late_init(void)
90} 91}
91 92
92#if defined(CONFIG_ARCH_OMAP3) 93#if defined(CONFIG_ARCH_OMAP3)
94struct phy_consumer consumers[] = {
95 PHY_CONSUMER("musb-hdrc.0", "usb"),
96};
97
98struct phy_init_data init_data = {
99 .consumers = consumers,
100 .num_consumers = ARRAY_SIZE(consumers),
101};
102
93static struct twl4030_usb_data omap3_usb_pdata = { 103static struct twl4030_usb_data omap3_usb_pdata = {
94 .usb_mode = T2_USB_MODE_ULPI, 104 .usb_mode = T2_USB_MODE_ULPI,
105 .init_data = &init_data,
95}; 106};
96 107
97static int omap3_batt_table[] = { 108static int omap3_batt_table[] = {
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index e83a6a4b184a..10855eb4ccc1 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -435,6 +435,7 @@ int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys)
435 struct platform_device *pdev; 435 struct platform_device *pdev;
436 char *phy_id; 436 char *phy_id;
437 struct platform_device_info pdevinfo; 437 struct platform_device_info pdevinfo;
438 struct usb_phy_gen_xceiv_platform_data nop_pdata;
438 439
439 for (i = 0; i < num_phys; i++) { 440 for (i = 0; i < num_phys; i++) {
440 441
@@ -455,11 +456,18 @@ int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys)
455 return -ENOMEM; 456 return -ENOMEM;
456 } 457 }
457 458
459 /* set platform data */
460 memset(&nop_pdata, 0, sizeof(nop_pdata));
461 if (gpio_is_valid(phy->vcc_gpio))
462 nop_pdata.needs_vcc = true;
463 nop_pdata.gpio_reset = phy->reset_gpio;
464 nop_pdata.type = USB_PHY_TYPE_USB2;
465
458 /* create a NOP PHY device */ 466 /* create a NOP PHY device */
459 memset(&pdevinfo, 0, sizeof(pdevinfo)); 467 memset(&pdevinfo, 0, sizeof(pdevinfo));
460 pdevinfo.name = nop_name; 468 pdevinfo.name = nop_name;
461 pdevinfo.id = phy->port; 469 pdevinfo.id = phy->port;
462 pdevinfo.data = phy->platform_data; 470 pdevinfo.data = &nop_pdata;
463 pdevinfo.size_data = 471 pdevinfo.size_data =
464 sizeof(struct usb_phy_gen_xceiv_platform_data); 472 sizeof(struct usb_phy_gen_xceiv_platform_data);
465 scnprintf(phy_id, MAX_STR, "usb_phy_gen_xceiv.%d", 473 scnprintf(phy_id, MAX_STR, "usb_phy_gen_xceiv.%d",
@@ -474,14 +482,6 @@ int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys)
474 482
475 usb_bind_phy("ehci-omap.0", phy->port - 1, phy_id); 483 usb_bind_phy("ehci-omap.0", phy->port - 1, phy_id);
476 484
477 /* Do we need RESET regulator ? */
478 if (gpio_is_valid(phy->reset_gpio)) {
479 scnprintf(rail_name, MAX_STR,
480 "hsusb%d_reset", phy->port);
481 usbhs_add_regulator(rail_name, phy_id, "reset",
482 phy->reset_gpio, 1);
483 }
484
485 /* Do we need VCC regulator ? */ 485 /* Do we need VCC regulator ? */
486 if (gpio_is_valid(phy->vcc_gpio)) { 486 if (gpio_is_valid(phy->vcc_gpio)) {
487 scnprintf(rail_name, MAX_STR, "hsusb%d_vcc", phy->port); 487 scnprintf(rail_name, MAX_STR, "hsusb%d_vcc", phy->port);
diff --git a/arch/arm/mach-omap2/usb.h b/arch/arm/mach-omap2/usb.h
index e7261ebcf7b0..4ba2ae759895 100644
--- a/arch/arm/mach-omap2/usb.h
+++ b/arch/arm/mach-omap2/usb.h
@@ -58,7 +58,6 @@ struct usbhs_phy_data {
58 int reset_gpio; 58 int reset_gpio;
59 int vcc_gpio; 59 int vcc_gpio;
60 bool vcc_polarity; /* 1 active high, 0 active low */ 60 bool vcc_polarity; /* 1 active high, 0 active low */
61 void *platform_data;
62}; 61};
63 62
64extern void usb_musb_init(struct omap_musb_board_data *board_data); 63extern void usb_musb_init(struct omap_musb_board_data *board_data);
diff --git a/arch/arm/mach-prima2/common.c b/arch/arm/mach-prima2/common.c
index e110b6d4ae8c..d49aff74de98 100644
--- a/arch/arm/mach-prima2/common.c
+++ b/arch/arm/mach-prima2/common.c
@@ -6,7 +6,6 @@
6 * Licensed under GPLv2 or later. 6 * Licensed under GPLv2 or later.
7 */ 7 */
8 8
9#include <linux/clocksource.h>
10#include <linux/init.h> 9#include <linux/init.h>
11#include <linux/kernel.h> 10#include <linux/kernel.h>
12#include <asm/sizes.h> 11#include <asm/sizes.h>
@@ -21,13 +20,6 @@ void __init sirfsoc_init_late(void)
21 sirfsoc_pm_init(); 20 sirfsoc_pm_init();
22} 21}
23 22
24static __init void sirfsoc_init_time(void)
25{
26 /* initialize clocking early, we want to set the OS timer */
27 sirfsoc_of_clk_init();
28 clocksource_of_init();
29}
30
31static __init void sirfsoc_map_io(void) 23static __init void sirfsoc_map_io(void)
32{ 24{
33 sirfsoc_map_lluart(); 25 sirfsoc_map_lluart();
@@ -43,7 +35,6 @@ static const char *atlas6_dt_match[] __initdata = {
43DT_MACHINE_START(ATLAS6_DT, "Generic ATLAS6 (Flattened Device Tree)") 35DT_MACHINE_START(ATLAS6_DT, "Generic ATLAS6 (Flattened Device Tree)")
44 /* Maintainer: Barry Song <baohua.song@csr.com> */ 36 /* Maintainer: Barry Song <baohua.song@csr.com> */
45 .map_io = sirfsoc_map_io, 37 .map_io = sirfsoc_map_io,
46 .init_time = sirfsoc_init_time,
47 .init_late = sirfsoc_init_late, 38 .init_late = sirfsoc_init_late,
48 .dt_compat = atlas6_dt_match, 39 .dt_compat = atlas6_dt_match,
49 .restart = sirfsoc_restart, 40 .restart = sirfsoc_restart,
@@ -59,7 +50,6 @@ static const char *prima2_dt_match[] __initdata = {
59DT_MACHINE_START(PRIMA2_DT, "Generic PRIMA2 (Flattened Device Tree)") 50DT_MACHINE_START(PRIMA2_DT, "Generic PRIMA2 (Flattened Device Tree)")
60 /* Maintainer: Barry Song <baohua.song@csr.com> */ 51 /* Maintainer: Barry Song <baohua.song@csr.com> */
61 .map_io = sirfsoc_map_io, 52 .map_io = sirfsoc_map_io,
62 .init_time = sirfsoc_init_time,
63 .dma_zone_size = SZ_256M, 53 .dma_zone_size = SZ_256M,
64 .init_late = sirfsoc_init_late, 54 .init_late = sirfsoc_init_late,
65 .dt_compat = prima2_dt_match, 55 .dt_compat = prima2_dt_match,
@@ -77,7 +67,6 @@ DT_MACHINE_START(MARCO_DT, "Generic MARCO (Flattened Device Tree)")
77 /* Maintainer: Barry Song <baohua.song@csr.com> */ 67 /* Maintainer: Barry Song <baohua.song@csr.com> */
78 .smp = smp_ops(sirfsoc_smp_ops), 68 .smp = smp_ops(sirfsoc_smp_ops),
79 .map_io = sirfsoc_map_io, 69 .map_io = sirfsoc_map_io,
80 .init_time = sirfsoc_init_time,
81 .init_late = sirfsoc_init_late, 70 .init_late = sirfsoc_init_late,
82 .dt_compat = marco_dt_match, 71 .dt_compat = marco_dt_match,
83 .restart = sirfsoc_restart, 72 .restart = sirfsoc_restart,
diff --git a/arch/arm/mach-prima2/common.h b/arch/arm/mach-prima2/common.h
index a6304858474a..4b768060a858 100644
--- a/arch/arm/mach-prima2/common.h
+++ b/arch/arm/mach-prima2/common.h
@@ -23,7 +23,6 @@ extern void sirfsoc_secondary_startup(void);
23extern void sirfsoc_cpu_die(unsigned int cpu); 23extern void sirfsoc_cpu_die(unsigned int cpu);
24 24
25extern void __init sirfsoc_of_irq_init(void); 25extern void __init sirfsoc_of_irq_init(void);
26extern void __init sirfsoc_of_clk_init(void);
27extern void sirfsoc_restart(enum reboot_mode, const char *); 26extern void sirfsoc_restart(enum reboot_mode, const char *);
28extern asmlinkage void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs); 27extern asmlinkage void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs);
29 28
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index a8427115ee07..96100dbf5a2e 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -615,14 +615,12 @@ 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
619 help 618 help
620 Select code specific to PXA21x/25x/26x variants 619 Select code specific to PXA21x/25x/26x variants
621 620
622config PXA27x 621config PXA27x
623 bool 622 bool
624 select CPU_XSCALE 623 select CPU_XSCALE
625 select CPU_FREQ_TABLE if CPU_FREQ
626 help 624 help
627 Select code specific to PXA27x variants 625 Select code specific to PXA27x variants
628 626
@@ -635,7 +633,6 @@ config CPU_PXA26x
635config PXA3xx 633config PXA3xx
636 bool 634 bool
637 select CPU_XSC3 635 select CPU_XSC3
638 select CPU_FREQ_TABLE if CPU_FREQ
639 help 636 help
640 Select code specific to PXA3xx variants 637 Select code specific to PXA3xx variants
641 638
diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
deleted file mode 100644
index 0248e433bc98..000000000000
--- a/arch/arm/mach-pxa/include/mach/gpio.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * arch/arm/mach-pxa/include/mach/gpio.h
3 *
4 * PXA GPIO wrappers for arch-neutral GPIO calls
5 *
6 * Written by Philipp Zabel <philipp.zabel@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#ifndef __ASM_ARCH_PXA_GPIO_H
25#define __ASM_ARCH_PXA_GPIO_H
26
27#include <asm-generic/gpio.h>
28
29#include <mach/irqs.h>
30#include <mach/hardware.h>
31
32#endif
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 25ee12b21f01..cf073dea5784 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -5,12 +5,13 @@ config ARCH_ROCKCHIP
5 select ARCH_REQUIRE_GPIOLIB 5 select ARCH_REQUIRE_GPIOLIB
6 select ARM_GIC 6 select ARM_GIC
7 select CACHE_L2X0 7 select CACHE_L2X0
8 select HAVE_ARM_TWD if LOCAL_TIMERS 8 select HAVE_ARM_TWD if SMP
9 select HAVE_SMP 9 select HAVE_SMP
10 select LOCAL_TIMERS if SMP
11 select COMMON_CLK 10 select COMMON_CLK
12 select GENERIC_CLOCKEVENTS 11 select GENERIC_CLOCKEVENTS
13 select DW_APB_TIMER_OF 12 select DW_APB_TIMER_OF
13 select ARM_GLOBAL_TIMER
14 select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
14 help 15 help
15 Support for Rockchip's Cortex-A9 Single-to-Quad-Core-SoCs 16 Support for Rockchip's Cortex-A9 Single-to-Quad-Core-SoCs
16 containing the RK2928, RK30xx and RK31xx series. 17 containing the RK2928, RK30xx and RK31xx series.
diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index 724d2d81f976..82c0b0709712 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -19,18 +19,10 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/of_platform.h> 20#include <linux/of_platform.h>
21#include <linux/irqchip.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> 22#include <asm/mach/arch.h>
25#include <asm/mach/map.h> 23#include <asm/mach/map.h>
26#include <asm/hardware/cache-l2x0.h> 24#include <asm/hardware/cache-l2x0.h>
27 25
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) 26static void __init rockchip_dt_init(void)
35{ 27{
36 l2x0_of_init(0, ~0UL); 28 l2x0_of_init(0, ~0UL);
@@ -47,6 +39,5 @@ static const char * const rockchip_board_dt_compat[] = {
47 39
48DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)") 40DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)")
49 .init_machine = rockchip_dt_init, 41 .init_machine = rockchip_dt_init,
50 .init_time = rockchip_timer_init,
51 .dt_compat = rockchip_board_dt_compat, 42 .dt_compat = rockchip_board_dt_compat,
52MACHINE_END 43MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index dba2173e70f3..8f1d327e0cd1 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -28,6 +28,7 @@ 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_DMA if S3C24XX_DMA
31 select ARM_S3C2410_CPUFREQ if ARM_S3C24XX_CPUFREQ 32 select ARM_S3C2410_CPUFREQ if ARM_S3C24XX_CPUFREQ
32 select S3C2410_PM if PM 33 select S3C2410_PM if PM
33 select SAMSUNG_WDT_RESET 34 select SAMSUNG_WDT_RESET
@@ -70,6 +71,7 @@ config CPU_S3C2442
70 select CPU_ARM920T 71 select CPU_ARM920T
71 select CPU_LLSERIAL_S3C2440 72 select CPU_LLSERIAL_S3C2440
72 select S3C2410_CLOCK 73 select S3C2410_CLOCK
74 select S3C2410_DMA if S3C24XX_DMA
73 select S3C2410_PM if PM 75 select S3C2410_PM if PM
74 help 76 help
75 Support for S3C2442 Samsung Mobile CPU based systems. 77 Support for S3C2442 Samsung Mobile CPU based systems.
@@ -148,7 +150,6 @@ config S3C2410_DMA_DEBUG
148config S3C2410_DMA 150config S3C2410_DMA
149 bool 151 bool
150 depends on S3C24XX_DMA && (CPU_S3C2410 || CPU_S3C2442) 152 depends on S3C24XX_DMA && (CPU_S3C2410 || CPU_S3C2442)
151 default y if CPU_S3C2410 || CPU_S3C2442
152 help 153 help
153 DMA device selection for S3C2410 and compatible CPUs 154 DMA device selection for S3C2410 and compatible CPUs
154 155
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2412.c b/arch/arm/mach-s3c24xx/clock-s3c2412.c
index d8f253f2b486..11b3b28457bb 100644
--- a/arch/arm/mach-s3c24xx/clock-s3c2412.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2412.c
@@ -484,22 +484,22 @@ static struct clk init_clocks_disable[] = {
484 484
485static struct clk init_clocks[] = { 485static struct clk init_clocks[] = {
486 { 486 {
487 .name = "dma", 487 .name = "dma.0",
488 .parent = &clk_h, 488 .parent = &clk_h,
489 .enable = s3c2412_clkcon_enable, 489 .enable = s3c2412_clkcon_enable,
490 .ctrlbit = S3C2412_CLKCON_DMA0, 490 .ctrlbit = S3C2412_CLKCON_DMA0,
491 }, { 491 }, {
492 .name = "dma", 492 .name = "dma.1",
493 .parent = &clk_h, 493 .parent = &clk_h,
494 .enable = s3c2412_clkcon_enable, 494 .enable = s3c2412_clkcon_enable,
495 .ctrlbit = S3C2412_CLKCON_DMA1, 495 .ctrlbit = S3C2412_CLKCON_DMA1,
496 }, { 496 }, {
497 .name = "dma", 497 .name = "dma.2",
498 .parent = &clk_h, 498 .parent = &clk_h,
499 .enable = s3c2412_clkcon_enable, 499 .enable = s3c2412_clkcon_enable,
500 .ctrlbit = S3C2412_CLKCON_DMA2, 500 .ctrlbit = S3C2412_CLKCON_DMA2,
501 }, { 501 }, {
502 .name = "dma", 502 .name = "dma.3",
503 .parent = &clk_h, 503 .parent = &clk_h,
504 .enable = s3c2412_clkcon_enable, 504 .enable = s3c2412_clkcon_enable,
505 .ctrlbit = S3C2412_CLKCON_DMA3, 505 .ctrlbit = S3C2412_CLKCON_DMA3,
diff --git a/arch/arm/mach-s3c24xx/common-s3c2443.c b/arch/arm/mach-s3c24xx/common-s3c2443.c
index f6b9f2ef01bd..65d3eef73090 100644
--- a/arch/arm/mach-s3c24xx/common-s3c2443.c
+++ b/arch/arm/mach-s3c24xx/common-s3c2443.c
@@ -438,32 +438,32 @@ static struct clk init_clocks_off[] = {
438 438
439static struct clk init_clocks[] = { 439static struct clk init_clocks[] = {
440 { 440 {
441 .name = "dma", 441 .name = "dma.0",
442 .parent = &clk_h, 442 .parent = &clk_h,
443 .enable = s3c2443_clkcon_enable_h, 443 .enable = s3c2443_clkcon_enable_h,
444 .ctrlbit = S3C2443_HCLKCON_DMA0, 444 .ctrlbit = S3C2443_HCLKCON_DMA0,
445 }, { 445 }, {
446 .name = "dma", 446 .name = "dma.1",
447 .parent = &clk_h, 447 .parent = &clk_h,
448 .enable = s3c2443_clkcon_enable_h, 448 .enable = s3c2443_clkcon_enable_h,
449 .ctrlbit = S3C2443_HCLKCON_DMA1, 449 .ctrlbit = S3C2443_HCLKCON_DMA1,
450 }, { 450 }, {
451 .name = "dma", 451 .name = "dma.2",
452 .parent = &clk_h, 452 .parent = &clk_h,
453 .enable = s3c2443_clkcon_enable_h, 453 .enable = s3c2443_clkcon_enable_h,
454 .ctrlbit = S3C2443_HCLKCON_DMA2, 454 .ctrlbit = S3C2443_HCLKCON_DMA2,
455 }, { 455 }, {
456 .name = "dma", 456 .name = "dma.3",
457 .parent = &clk_h, 457 .parent = &clk_h,
458 .enable = s3c2443_clkcon_enable_h, 458 .enable = s3c2443_clkcon_enable_h,
459 .ctrlbit = S3C2443_HCLKCON_DMA3, 459 .ctrlbit = S3C2443_HCLKCON_DMA3,
460 }, { 460 }, {
461 .name = "dma", 461 .name = "dma.4",
462 .parent = &clk_h, 462 .parent = &clk_h,
463 .enable = s3c2443_clkcon_enable_h, 463 .enable = s3c2443_clkcon_enable_h,
464 .ctrlbit = S3C2443_HCLKCON_DMA4, 464 .ctrlbit = S3C2443_HCLKCON_DMA4,
465 }, { 465 }, {
466 .name = "dma", 466 .name = "dma.5",
467 .parent = &clk_h, 467 .parent = &clk_h,
468 .enable = s3c2443_clkcon_enable_h, 468 .enable = s3c2443_clkcon_enable_h,
469 .ctrlbit = S3C2443_HCLKCON_DMA5, 469 .ctrlbit = S3C2443_HCLKCON_DMA5,
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index 457261c98433..4adaa4b43ffe 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -31,6 +31,7 @@
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/io.h> 33#include <linux/io.h>
34#include <linux/platform_data/dma-s3c24xx.h>
34 35
35#include <mach/hardware.h> 36#include <mach/hardware.h>
36#include <mach/regs-clock.h> 37#include <mach/regs-clock.h>
@@ -44,6 +45,7 @@
44 45
45#include <mach/regs-gpio.h> 46#include <mach/regs-gpio.h>
46#include <plat/regs-serial.h> 47#include <plat/regs-serial.h>
48#include <mach/dma.h>
47 49
48#include <plat/cpu.h> 50#include <plat/cpu.h>
49#include <plat/devs.h> 51#include <plat/devs.h>
@@ -329,3 +331,207 @@ void __init_or_cpufreq s3c24xx_setup_clocks(unsigned long fclk,
329 clk_p.rate = pclk; 331 clk_p.rate = pclk;
330 clk_f.rate = fclk; 332 clk_f.rate = fclk;
331} 333}
334
335#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
336 defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
337static struct resource s3c2410_dma_resource[] = {
338 [0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
339 [1] = DEFINE_RES_IRQ(IRQ_DMA0),
340 [2] = DEFINE_RES_IRQ(IRQ_DMA1),
341 [3] = DEFINE_RES_IRQ(IRQ_DMA2),
342 [4] = DEFINE_RES_IRQ(IRQ_DMA3),
343};
344#endif
345
346#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2442)
347static struct s3c24xx_dma_channel s3c2410_dma_channels[DMACH_MAX] = {
348 [DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
349 [DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
350 [DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
351 S3C24XX_DMA_CHANREQ(2, 2) |
352 S3C24XX_DMA_CHANREQ(1, 3),
353 },
354 [DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
355 [DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
356 [DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
357 [DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
358 [DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
359 [DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
360 S3C24XX_DMA_CHANREQ(3, 2) |
361 S3C24XX_DMA_CHANREQ(3, 3),
362 },
363 [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
364 S3C24XX_DMA_CHANREQ(1, 2),
365 },
366 [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 2), },
367 [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
368 [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
369 [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
370 [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
371};
372
373static struct s3c24xx_dma_platdata s3c2410_dma_platdata = {
374 .num_phy_channels = 4,
375 .channels = s3c2410_dma_channels,
376 .num_channels = DMACH_MAX,
377};
378
379struct platform_device s3c2410_device_dma = {
380 .name = "s3c2410-dma",
381 .id = 0,
382 .num_resources = ARRAY_SIZE(s3c2410_dma_resource),
383 .resource = s3c2410_dma_resource,
384 .dev = {
385 .platform_data = &s3c2410_dma_platdata,
386 },
387};
388#endif
389
390#ifdef CONFIG_CPU_S3C2412
391static struct s3c24xx_dma_channel s3c2412_dma_channels[DMACH_MAX] = {
392 [DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
393 [DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
394 [DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
395 [DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
396 [DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
397 [DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
398 [DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
399 [DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
400 [DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
401 [DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
402 [DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
403 [DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
404 [DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
405 [DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
406 [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
407 [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
408 [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, 13 },
409 [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, 14 },
410 [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, 15 },
411 [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, 16 },
412};
413
414static struct s3c24xx_dma_platdata s3c2412_dma_platdata = {
415 .num_phy_channels = 4,
416 .channels = s3c2412_dma_channels,
417 .num_channels = DMACH_MAX,
418};
419
420struct platform_device s3c2412_device_dma = {
421 .name = "s3c2412-dma",
422 .id = 0,
423 .num_resources = ARRAY_SIZE(s3c2410_dma_resource),
424 .resource = s3c2410_dma_resource,
425 .dev = {
426 .platform_data = &s3c2412_dma_platdata,
427 },
428};
429#endif
430
431#if defined(CONFIG_CPU_S3C2440)
432static struct s3c24xx_dma_channel s3c2440_dma_channels[DMACH_MAX] = {
433 [DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
434 [DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
435 [DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
436 S3C24XX_DMA_CHANREQ(6, 1) |
437 S3C24XX_DMA_CHANREQ(2, 2) |
438 S3C24XX_DMA_CHANREQ(1, 3),
439 },
440 [DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
441 [DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
442 [DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
443 [DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
444 [DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
445 [DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
446 S3C24XX_DMA_CHANREQ(3, 2) |
447 S3C24XX_DMA_CHANREQ(3, 3),
448 },
449 [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
450 S3C24XX_DMA_CHANREQ(1, 2),
451 },
452 [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 0) |
453 S3C24XX_DMA_CHANREQ(0, 2),
454 },
455 [DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 0) |
456 S3C24XX_DMA_CHANREQ(5, 2),
457 },
458 [DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 1) |
459 S3C24XX_DMA_CHANREQ(6, 3),
460 },
461 [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 2) |
462 S3C24XX_DMA_CHANREQ(5, 3),
463 },
464 [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
465 [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
466 [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
467 [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
468};
469
470static struct s3c24xx_dma_platdata s3c2440_dma_platdata = {
471 .num_phy_channels = 4,
472 .channels = s3c2440_dma_channels,
473 .num_channels = DMACH_MAX,
474};
475
476struct platform_device s3c2440_device_dma = {
477 .name = "s3c2410-dma",
478 .id = 0,
479 .num_resources = ARRAY_SIZE(s3c2410_dma_resource),
480 .resource = s3c2410_dma_resource,
481 .dev = {
482 .platform_data = &s3c2440_dma_platdata,
483 },
484};
485#endif
486
487#if defined(CONFIG_CPUS_3C2443) || defined(CONFIG_CPU_S3C2416)
488static struct resource s3c2443_dma_resource[] = {
489 [0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
490 [1] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA0),
491 [2] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA1),
492 [3] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA2),
493 [4] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA3),
494 [5] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA4),
495 [6] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA5),
496};
497
498static struct s3c24xx_dma_channel s3c2443_dma_channels[DMACH_MAX] = {
499 [DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
500 [DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
501 [DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
502 [DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
503 [DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
504 [DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
505 [DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
506 [DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
507 [DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
508 [DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
509 [DMACH_UART3] = { S3C24XX_DMA_APB, true, 25 },
510 [DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
511 [DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
512 [DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
513 [DMACH_UART3_SRC2] = { S3C24XX_DMA_APB, true, 26 },
514 [DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
515 [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
516 [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
517 [DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, 28 },
518 [DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, 27 },
519 [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, 29 },
520};
521
522static struct s3c24xx_dma_platdata s3c2443_dma_platdata = {
523 .num_phy_channels = 6,
524 .channels = s3c2443_dma_channels,
525 .num_channels = DMACH_MAX,
526};
527
528struct platform_device s3c2443_device_dma = {
529 .name = "s3c2443-dma",
530 .id = 0,
531 .num_resources = ARRAY_SIZE(s3c2443_dma_resource),
532 .resource = s3c2443_dma_resource,
533 .dev = {
534 .platform_data = &s3c2443_dma_platdata,
535 },
536};
537#endif
diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h
index 84b280654f4c..e46c10417216 100644
--- a/arch/arm/mach-s3c24xx/common.h
+++ b/arch/arm/mach-s3c24xx/common.h
@@ -109,4 +109,9 @@ extern void s3c2443_init_irq(void);
109 109
110extern struct syscore_ops s3c24xx_irq_syscore_ops; 110extern struct syscore_ops s3c24xx_irq_syscore_ops;
111 111
112extern struct platform_device s3c2410_device_dma;
113extern struct platform_device s3c2412_device_dma;
114extern struct platform_device s3c2440_device_dma;
115extern struct platform_device s3c2443_device_dma;
116
112#endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */ 117#endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index a45fcd8ccf79..43c23e220f5b 100644
--- a/arch/arm/mach-s3c24xx/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
@@ -466,6 +466,7 @@ static struct platform_device *jive_devices[] __initdata = {
466 &jive_device_wm8750, 466 &jive_device_wm8750,
467 &s3c_device_nand, 467 &s3c_device_nand,
468 &s3c_device_usbgadget, 468 &s3c_device_usbgadget,
469 &s3c2412_device_dma,
469}; 470};
470 471
471static struct s3c2410_udc_mach_info jive_udc_cfg __initdata = { 472static struct s3c2410_udc_mach_info jive_udc_cfg __initdata = {
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c
index 8146e920f10d..c9d31ef28dd1 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
@@ -89,6 +89,7 @@ static struct platform_device *smdk2413_devices[] __initdata = {
89 &s3c_device_i2c0, 89 &s3c_device_i2c0,
90 &s3c_device_iis, 90 &s3c_device_iis,
91 &s3c_device_usbgadget, 91 &s3c_device_usbgadget,
92 &s3c2412_device_dma,
92}; 93};
93 94
94static void __init smdk2413_fixup(struct tag *tags, char **cmdline, 95static void __init smdk2413_fixup(struct tag *tags, char **cmdline,
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c
index cb46847c66b4..f88e672ad1e4 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
@@ -215,6 +215,7 @@ static struct platform_device *smdk2416_devices[] __initdata = {
215 &s3c_device_hsmmc0, 215 &s3c_device_hsmmc0,
216 &s3c_device_hsmmc1, 216 &s3c_device_hsmmc1,
217 &s3c_device_usb_hsudc, 217 &s3c_device_usb_hsudc,
218 &s3c2443_device_dma,
218}; 219};
219 220
220static void __init smdk2416_map_io(void) 221static void __init smdk2416_map_io(void)
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c
index 9435c3bef18a..d9933fcc6cc8 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2443.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
@@ -115,6 +115,7 @@ static struct platform_device *smdk2443_devices[] __initdata = {
115#ifdef CONFIG_SND_SOC_SMDK2443_WM9710 115#ifdef CONFIG_SND_SOC_SMDK2443_WM9710
116 &s3c_device_ac97, 116 &s3c_device_ac97,
117#endif 117#endif
118 &s3c2443_device_dma,
118}; 119};
119 120
120static void __init smdk2443_map_io(void) 121static void __init smdk2443_map_io(void)
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c
index b66588428ec9..f7ec9c550787 100644
--- a/arch/arm/mach-s3c24xx/mach-vstms.c
+++ b/arch/arm/mach-s3c24xx/mach-vstms.c
@@ -126,6 +126,7 @@ static struct platform_device *vstms_devices[] __initdata = {
126 &s3c_device_iis, 126 &s3c_device_iis,
127 &s3c_device_rtc, 127 &s3c_device_rtc,
128 &s3c_device_nand, 128 &s3c_device_nand,
129 &s3c2412_device_dma,
129}; 130};
130 131
131static void __init vstms_fixup(struct tag *tags, char **cmdline, 132static void __init vstms_fixup(struct tag *tags, char **cmdline,
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 041da5172423..2cb8dc55b50e 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -3,16 +3,7 @@
3# 3#
4# Licensed under GPLv2 4# Licensed under GPLv2
5 5
6# temporary until we can eliminate all drivers using it. 6if ARCH_S3C64XX
7config PLAT_S3C64XX
8 bool
9 depends on ARCH_S3C64XX
10 default y
11 select PM_GENERIC_DOMAINS
12 select SAMSUNG_WAKEMASK
13 help
14 Base platform code for any Samsung S3C64XX device
15
16 7
17# Configuration options for the S3C6410 CPU 8# Configuration options for the S3C6410 CPU
18 9
@@ -306,3 +297,21 @@ config MACH_WLF_CRAGG_6410
306 select SAMSUNG_GPIO_EXTRA128 297 select SAMSUNG_GPIO_EXTRA128
307 help 298 help
308 Machine support for the Wolfson Cragganmore S3C6410 variant. 299 Machine support for the Wolfson Cragganmore S3C6410 variant.
300
301config MACH_S3C64XX_DT
302 bool "Samsung S3C6400/S3C6410 machine using Device Tree"
303 select CLKSRC_OF
304 select CPU_S3C6400
305 select CPU_S3C6410
306 select PINCTRL
307 select PINCTRL_S3C64XX
308 select USE_OF
309 help
310 Machine support for Samsung S3C6400/S3C6410 machines with Device Tree
311 enabled.
312 Select this if a fdt blob is available for your S3C64XX SoC based
313 board.
314 Note: This is under development and not all peripherals can be
315 supported with this machine file.
316
317endif
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index 31d0c9101272..6faedcffce04 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -12,7 +12,7 @@ obj- :=
12 12
13# Core 13# Core
14 14
15obj-y += common.o clock.o 15obj-y += common.o
16 16
17# Core support 17# Core support
18 18
@@ -57,3 +57,4 @@ obj-$(CONFIG_MACH_SMARTQ7) += mach-smartq7.o
57obj-$(CONFIG_MACH_SMDK6400) += mach-smdk6400.o 57obj-$(CONFIG_MACH_SMDK6400) += mach-smdk6400.o
58obj-$(CONFIG_MACH_SMDK6410) += mach-smdk6410.o 58obj-$(CONFIG_MACH_SMDK6410) += mach-smdk6410.o
59obj-$(CONFIG_MACH_WLF_CRAGG_6410) += mach-crag6410.o mach-crag6410-module.o 59obj-$(CONFIG_MACH_WLF_CRAGG_6410) += mach-crag6410.o mach-crag6410-module.o
60obj-$(CONFIG_MACH_S3C64XX_DT) += mach-s3c64xx-dt.o
diff --git a/arch/arm/mach-s3c64xx/clock.c b/arch/arm/mach-s3c64xx/clock.c
deleted file mode 100644
index c1bcc4a6d3a8..000000000000
--- a/arch/arm/mach-s3c64xx/clock.c
+++ /dev/null
@@ -1,1007 +0,0 @@
1/* linux/arch/arm/plat-s3c64xx/clock.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX Base clock support
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/interrupt.h>
18#include <linux/ioport.h>
19#include <linux/clk.h>
20#include <linux/err.h>
21#include <linux/io.h>
22
23#include <mach/hardware.h>
24#include <mach/map.h>
25
26#include <mach/regs-clock.h>
27
28#include <plat/cpu.h>
29#include <plat/devs.h>
30#include <plat/cpu-freq.h>
31#include <plat/clock.h>
32#include <plat/clock-clksrc.h>
33#include <plat/pll.h>
34
35#include "regs-sys.h"
36
37/* fin_apll, fin_mpll and fin_epll are all the same clock, which we call
38 * ext_xtal_mux for want of an actual name from the manual.
39*/
40
41static struct clk clk_ext_xtal_mux = {
42 .name = "ext_xtal",
43};
44
45#define clk_fin_apll clk_ext_xtal_mux
46#define clk_fin_mpll clk_ext_xtal_mux
47#define clk_fin_epll clk_ext_xtal_mux
48
49#define clk_fout_mpll clk_mpll
50#define clk_fout_epll clk_epll
51
52struct clk clk_h2 = {
53 .name = "hclk2",
54 .rate = 0,
55};
56
57struct clk clk_27m = {
58 .name = "clk_27m",
59 .rate = 27000000,
60};
61
62static int clk_48m_ctrl(struct clk *clk, int enable)
63{
64 unsigned long flags;
65 u32 val;
66
67 /* can't rely on clock lock, this register has other usages */
68 local_irq_save(flags);
69
70 val = __raw_readl(S3C64XX_OTHERS);
71 if (enable)
72 val |= S3C64XX_OTHERS_USBMASK;
73 else
74 val &= ~S3C64XX_OTHERS_USBMASK;
75
76 __raw_writel(val, S3C64XX_OTHERS);
77 local_irq_restore(flags);
78
79 return 0;
80}
81
82struct clk clk_48m = {
83 .name = "clk_48m",
84 .rate = 48000000,
85 .enable = clk_48m_ctrl,
86};
87
88struct clk clk_xusbxti = {
89 .name = "xusbxti",
90 .rate = 48000000,
91};
92
93static int inline s3c64xx_gate(void __iomem *reg,
94 struct clk *clk,
95 int enable)
96{
97 unsigned int ctrlbit = clk->ctrlbit;
98 u32 con;
99
100 con = __raw_readl(reg);
101
102 if (enable)
103 con |= ctrlbit;
104 else
105 con &= ~ctrlbit;
106
107 __raw_writel(con, reg);
108 return 0;
109}
110
111static int s3c64xx_pclk_ctrl(struct clk *clk, int enable)
112{
113 return s3c64xx_gate(S3C_PCLK_GATE, clk, enable);
114}
115
116static int s3c64xx_hclk_ctrl(struct clk *clk, int enable)
117{
118 return s3c64xx_gate(S3C_HCLK_GATE, clk, enable);
119}
120
121int s3c64xx_sclk_ctrl(struct clk *clk, int enable)
122{
123 return s3c64xx_gate(S3C_SCLK_GATE, clk, enable);
124}
125
126static struct clk init_clocks_off[] = {
127 {
128 .name = "nand",
129 .parent = &clk_h,
130 }, {
131 .name = "rtc",
132 .parent = &clk_p,
133 .enable = s3c64xx_pclk_ctrl,
134 .ctrlbit = S3C_CLKCON_PCLK_RTC,
135 }, {
136 .name = "adc",
137 .parent = &clk_p,
138 .enable = s3c64xx_pclk_ctrl,
139 .ctrlbit = S3C_CLKCON_PCLK_TSADC,
140 }, {
141 .name = "i2c",
142 .devname = "s3c2440-i2c.0",
143 .parent = &clk_p,
144 .enable = s3c64xx_pclk_ctrl,
145 .ctrlbit = S3C_CLKCON_PCLK_IIC,
146 }, {
147 .name = "i2c",
148 .devname = "s3c2440-i2c.1",
149 .parent = &clk_p,
150 .enable = s3c64xx_pclk_ctrl,
151 .ctrlbit = S3C6410_CLKCON_PCLK_I2C1,
152 }, {
153 .name = "keypad",
154 .parent = &clk_p,
155 .enable = s3c64xx_pclk_ctrl,
156 .ctrlbit = S3C_CLKCON_PCLK_KEYPAD,
157 }, {
158 .name = "spi",
159 .devname = "s3c6410-spi.0",
160 .parent = &clk_p,
161 .enable = s3c64xx_pclk_ctrl,
162 .ctrlbit = S3C_CLKCON_PCLK_SPI0,
163 }, {
164 .name = "spi",
165 .devname = "s3c6410-spi.1",
166 .parent = &clk_p,
167 .enable = s3c64xx_pclk_ctrl,
168 .ctrlbit = S3C_CLKCON_PCLK_SPI1,
169 }, {
170 .name = "48m",
171 .devname = "s3c-sdhci.0",
172 .parent = &clk_48m,
173 .enable = s3c64xx_sclk_ctrl,
174 .ctrlbit = S3C_CLKCON_SCLK_MMC0_48,
175 }, {
176 .name = "48m",
177 .devname = "s3c-sdhci.1",
178 .parent = &clk_48m,
179 .enable = s3c64xx_sclk_ctrl,
180 .ctrlbit = S3C_CLKCON_SCLK_MMC1_48,
181 }, {
182 .name = "48m",
183 .devname = "s3c-sdhci.2",
184 .parent = &clk_48m,
185 .enable = s3c64xx_sclk_ctrl,
186 .ctrlbit = S3C_CLKCON_SCLK_MMC2_48,
187 }, {
188 .name = "ac97",
189 .parent = &clk_p,
190 .ctrlbit = S3C_CLKCON_PCLK_AC97,
191 }, {
192 .name = "cfcon",
193 .parent = &clk_h,
194 .enable = s3c64xx_hclk_ctrl,
195 .ctrlbit = S3C_CLKCON_HCLK_IHOST,
196 }, {
197 .name = "dma0",
198 .parent = &clk_h,
199 .enable = s3c64xx_hclk_ctrl,
200 .ctrlbit = S3C_CLKCON_HCLK_DMA0,
201 }, {
202 .name = "dma1",
203 .parent = &clk_h,
204 .enable = s3c64xx_hclk_ctrl,
205 .ctrlbit = S3C_CLKCON_HCLK_DMA1,
206 }, {
207 .name = "3dse",
208 .parent = &clk_h,
209 .enable = s3c64xx_hclk_ctrl,
210 .ctrlbit = S3C_CLKCON_HCLK_3DSE,
211 }, {
212 .name = "hclk_secur",
213 .parent = &clk_h,
214 .enable = s3c64xx_hclk_ctrl,
215 .ctrlbit = S3C_CLKCON_HCLK_SECUR,
216 }, {
217 .name = "sdma1",
218 .parent = &clk_h,
219 .enable = s3c64xx_hclk_ctrl,
220 .ctrlbit = S3C_CLKCON_HCLK_SDMA1,
221 }, {
222 .name = "sdma0",
223 .parent = &clk_h,
224 .enable = s3c64xx_hclk_ctrl,
225 .ctrlbit = S3C_CLKCON_HCLK_SDMA0,
226 }, {
227 .name = "hclk_jpeg",
228 .parent = &clk_h,
229 .enable = s3c64xx_hclk_ctrl,
230 .ctrlbit = S3C_CLKCON_HCLK_JPEG,
231 }, {
232 .name = "camif",
233 .parent = &clk_h,
234 .enable = s3c64xx_hclk_ctrl,
235 .ctrlbit = S3C_CLKCON_HCLK_CAMIF,
236 }, {
237 .name = "hclk_scaler",
238 .parent = &clk_h,
239 .enable = s3c64xx_hclk_ctrl,
240 .ctrlbit = S3C_CLKCON_HCLK_SCALER,
241 }, {
242 .name = "2d",
243 .parent = &clk_h,
244 .enable = s3c64xx_hclk_ctrl,
245 .ctrlbit = S3C_CLKCON_HCLK_2D,
246 }, {
247 .name = "tv",
248 .parent = &clk_h,
249 .enable = s3c64xx_hclk_ctrl,
250 .ctrlbit = S3C_CLKCON_HCLK_TV,
251 }, {
252 .name = "post0",
253 .parent = &clk_h,
254 .enable = s3c64xx_hclk_ctrl,
255 .ctrlbit = S3C_CLKCON_HCLK_POST0,
256 }, {
257 .name = "rot",
258 .parent = &clk_h,
259 .enable = s3c64xx_hclk_ctrl,
260 .ctrlbit = S3C_CLKCON_HCLK_ROT,
261 }, {
262 .name = "hclk_mfc",
263 .parent = &clk_h,
264 .enable = s3c64xx_hclk_ctrl,
265 .ctrlbit = S3C_CLKCON_HCLK_MFC,
266 }, {
267 .name = "pclk_mfc",
268 .parent = &clk_p,
269 .enable = s3c64xx_pclk_ctrl,
270 .ctrlbit = S3C_CLKCON_PCLK_MFC,
271 }, {
272 .name = "dac27",
273 .enable = s3c64xx_sclk_ctrl,
274 .ctrlbit = S3C_CLKCON_SCLK_DAC27,
275 }, {
276 .name = "tv27",
277 .enable = s3c64xx_sclk_ctrl,
278 .ctrlbit = S3C_CLKCON_SCLK_TV27,
279 }, {
280 .name = "scaler27",
281 .enable = s3c64xx_sclk_ctrl,
282 .ctrlbit = S3C_CLKCON_SCLK_SCALER27,
283 }, {
284 .name = "sclk_scaler",
285 .enable = s3c64xx_sclk_ctrl,
286 .ctrlbit = S3C_CLKCON_SCLK_SCALER,
287 }, {
288 .name = "post0_27",
289 .enable = s3c64xx_sclk_ctrl,
290 .ctrlbit = S3C_CLKCON_SCLK_POST0_27,
291 }, {
292 .name = "secur",
293 .enable = s3c64xx_sclk_ctrl,
294 .ctrlbit = S3C_CLKCON_SCLK_SECUR,
295 }, {
296 .name = "sclk_mfc",
297 .enable = s3c64xx_sclk_ctrl,
298 .ctrlbit = S3C_CLKCON_SCLK_MFC,
299 }, {
300 .name = "sclk_jpeg",
301 .enable = s3c64xx_sclk_ctrl,
302 .ctrlbit = S3C_CLKCON_SCLK_JPEG,
303 },
304};
305
306static struct clk clk_48m_spi0 = {
307 .name = "spi_48m",
308 .devname = "s3c6410-spi.0",
309 .parent = &clk_48m,
310 .enable = s3c64xx_sclk_ctrl,
311 .ctrlbit = S3C_CLKCON_SCLK_SPI0_48,
312};
313
314static struct clk clk_48m_spi1 = {
315 .name = "spi_48m",
316 .devname = "s3c6410-spi.1",
317 .parent = &clk_48m,
318 .enable = s3c64xx_sclk_ctrl,
319 .ctrlbit = S3C_CLKCON_SCLK_SPI1_48,
320};
321
322static struct clk clk_i2s0 = {
323 .name = "iis",
324 .devname = "samsung-i2s.0",
325 .parent = &clk_p,
326 .enable = s3c64xx_pclk_ctrl,
327 .ctrlbit = S3C_CLKCON_PCLK_IIS0,
328};
329
330static struct clk clk_i2s1 = {
331 .name = "iis",
332 .devname = "samsung-i2s.1",
333 .parent = &clk_p,
334 .enable = s3c64xx_pclk_ctrl,
335 .ctrlbit = S3C_CLKCON_PCLK_IIS1,
336};
337
338#ifdef CONFIG_CPU_S3C6410
339static struct clk clk_i2s2 = {
340 .name = "iis",
341 .devname = "samsung-i2s.2",
342 .parent = &clk_p,
343 .enable = s3c64xx_pclk_ctrl,
344 .ctrlbit = S3C6410_CLKCON_PCLK_IIS2,
345};
346#endif
347
348static struct clk init_clocks[] = {
349 {
350 .name = "lcd",
351 .parent = &clk_h,
352 .enable = s3c64xx_hclk_ctrl,
353 .ctrlbit = S3C_CLKCON_HCLK_LCD,
354 }, {
355 .name = "gpio",
356 .parent = &clk_p,
357 .enable = s3c64xx_pclk_ctrl,
358 .ctrlbit = S3C_CLKCON_PCLK_GPIO,
359 }, {
360 .name = "usb-host",
361 .parent = &clk_h,
362 .enable = s3c64xx_hclk_ctrl,
363 .ctrlbit = S3C_CLKCON_HCLK_UHOST,
364 }, {
365 .name = "otg",
366 .parent = &clk_h,
367 .enable = s3c64xx_hclk_ctrl,
368 .ctrlbit = S3C_CLKCON_HCLK_USB,
369 }, {
370 .name = "timers",
371 .parent = &clk_p,
372 .enable = s3c64xx_pclk_ctrl,
373 .ctrlbit = S3C_CLKCON_PCLK_PWM,
374 }, {
375 .name = "uart",
376 .devname = "s3c6400-uart.0",
377 .parent = &clk_p,
378 .enable = s3c64xx_pclk_ctrl,
379 .ctrlbit = S3C_CLKCON_PCLK_UART0,
380 }, {
381 .name = "uart",
382 .devname = "s3c6400-uart.1",
383 .parent = &clk_p,
384 .enable = s3c64xx_pclk_ctrl,
385 .ctrlbit = S3C_CLKCON_PCLK_UART1,
386 }, {
387 .name = "uart",
388 .devname = "s3c6400-uart.2",
389 .parent = &clk_p,
390 .enable = s3c64xx_pclk_ctrl,
391 .ctrlbit = S3C_CLKCON_PCLK_UART2,
392 }, {
393 .name = "uart",
394 .devname = "s3c6400-uart.3",
395 .parent = &clk_p,
396 .enable = s3c64xx_pclk_ctrl,
397 .ctrlbit = S3C_CLKCON_PCLK_UART3,
398 }, {
399 .name = "watchdog",
400 .parent = &clk_p,
401 .ctrlbit = S3C_CLKCON_PCLK_WDT,
402 },
403};
404
405static struct clk clk_hsmmc0 = {
406 .name = "hsmmc",
407 .devname = "s3c-sdhci.0",
408 .parent = &clk_h,
409 .enable = s3c64xx_hclk_ctrl,
410 .ctrlbit = S3C_CLKCON_HCLK_HSMMC0,
411};
412
413static struct clk clk_hsmmc1 = {
414 .name = "hsmmc",
415 .devname = "s3c-sdhci.1",
416 .parent = &clk_h,
417 .enable = s3c64xx_hclk_ctrl,
418 .ctrlbit = S3C_CLKCON_HCLK_HSMMC1,
419};
420
421static struct clk clk_hsmmc2 = {
422 .name = "hsmmc",
423 .devname = "s3c-sdhci.2",
424 .parent = &clk_h,
425 .enable = s3c64xx_hclk_ctrl,
426 .ctrlbit = S3C_CLKCON_HCLK_HSMMC2,
427};
428
429static struct clk clk_fout_apll = {
430 .name = "fout_apll",
431};
432
433static struct clk *clk_src_apll_list[] = {
434 [0] = &clk_fin_apll,
435 [1] = &clk_fout_apll,
436};
437
438static struct clksrc_sources clk_src_apll = {
439 .sources = clk_src_apll_list,
440 .nr_sources = ARRAY_SIZE(clk_src_apll_list),
441};
442
443static struct clksrc_clk clk_mout_apll = {
444 .clk = {
445 .name = "mout_apll",
446 },
447 .reg_src = { .reg = S3C_CLK_SRC, .shift = 0, .size = 1 },
448 .sources = &clk_src_apll,
449};
450
451static struct clk *clk_src_epll_list[] = {
452 [0] = &clk_fin_epll,
453 [1] = &clk_fout_epll,
454};
455
456static struct clksrc_sources clk_src_epll = {
457 .sources = clk_src_epll_list,
458 .nr_sources = ARRAY_SIZE(clk_src_epll_list),
459};
460
461static struct clksrc_clk clk_mout_epll = {
462 .clk = {
463 .name = "mout_epll",
464 },
465 .reg_src = { .reg = S3C_CLK_SRC, .shift = 2, .size = 1 },
466 .sources = &clk_src_epll,
467};
468
469static struct clk *clk_src_mpll_list[] = {
470 [0] = &clk_fin_mpll,
471 [1] = &clk_fout_mpll,
472};
473
474static struct clksrc_sources clk_src_mpll = {
475 .sources = clk_src_mpll_list,
476 .nr_sources = ARRAY_SIZE(clk_src_mpll_list),
477};
478
479static struct clksrc_clk clk_mout_mpll = {
480 .clk = {
481 .name = "mout_mpll",
482 },
483 .reg_src = { .reg = S3C_CLK_SRC, .shift = 1, .size = 1 },
484 .sources = &clk_src_mpll,
485};
486
487static unsigned int armclk_mask;
488
489static unsigned long s3c64xx_clk_arm_get_rate(struct clk *clk)
490{
491 unsigned long rate = clk_get_rate(clk->parent);
492 u32 clkdiv;
493
494 /* divisor mask starts at bit0, so no need to shift */
495 clkdiv = __raw_readl(S3C_CLK_DIV0) & armclk_mask;
496
497 return rate / (clkdiv + 1);
498}
499
500static unsigned long s3c64xx_clk_arm_round_rate(struct clk *clk,
501 unsigned long rate)
502{
503 unsigned long parent = clk_get_rate(clk->parent);
504 u32 div;
505
506 if (parent < rate)
507 return parent;
508
509 div = (parent / rate) - 1;
510 if (div > armclk_mask)
511 div = armclk_mask;
512
513 return parent / (div + 1);
514}
515
516static int s3c64xx_clk_arm_set_rate(struct clk *clk, unsigned long rate)
517{
518 unsigned long parent = clk_get_rate(clk->parent);
519 u32 div;
520 u32 val;
521
522 if (rate < parent / (armclk_mask + 1))
523 return -EINVAL;
524
525 rate = clk_round_rate(clk, rate);
526 div = clk_get_rate(clk->parent) / rate;
527
528 val = __raw_readl(S3C_CLK_DIV0);
529 val &= ~armclk_mask;
530 val |= (div - 1);
531 __raw_writel(val, S3C_CLK_DIV0);
532
533 return 0;
534
535}
536
537static struct clk clk_arm = {
538 .name = "armclk",
539 .parent = &clk_mout_apll.clk,
540 .ops = &(struct clk_ops) {
541 .get_rate = s3c64xx_clk_arm_get_rate,
542 .set_rate = s3c64xx_clk_arm_set_rate,
543 .round_rate = s3c64xx_clk_arm_round_rate,
544 },
545};
546
547static unsigned long s3c64xx_clk_doutmpll_get_rate(struct clk *clk)
548{
549 unsigned long rate = clk_get_rate(clk->parent);
550
551 printk(KERN_DEBUG "%s: parent is %ld\n", __func__, rate);
552
553 if (__raw_readl(S3C_CLK_DIV0) & S3C6400_CLKDIV0_MPLL_MASK)
554 rate /= 2;
555
556 return rate;
557}
558
559static struct clk_ops clk_dout_ops = {
560 .get_rate = s3c64xx_clk_doutmpll_get_rate,
561};
562
563static struct clk clk_dout_mpll = {
564 .name = "dout_mpll",
565 .parent = &clk_mout_mpll.clk,
566 .ops = &clk_dout_ops,
567};
568
569static struct clk *clkset_spi_mmc_list[] = {
570 &clk_mout_epll.clk,
571 &clk_dout_mpll,
572 &clk_fin_epll,
573 &clk_27m,
574};
575
576static struct clksrc_sources clkset_spi_mmc = {
577 .sources = clkset_spi_mmc_list,
578 .nr_sources = ARRAY_SIZE(clkset_spi_mmc_list),
579};
580
581static struct clk *clkset_irda_list[] = {
582 &clk_mout_epll.clk,
583 &clk_dout_mpll,
584 NULL,
585 &clk_27m,
586};
587
588static struct clksrc_sources clkset_irda = {
589 .sources = clkset_irda_list,
590 .nr_sources = ARRAY_SIZE(clkset_irda_list),
591};
592
593static struct clk *clkset_uart_list[] = {
594 &clk_mout_epll.clk,
595 &clk_dout_mpll,
596 NULL,
597 NULL
598};
599
600static struct clksrc_sources clkset_uart = {
601 .sources = clkset_uart_list,
602 .nr_sources = ARRAY_SIZE(clkset_uart_list),
603};
604
605static struct clk *clkset_uhost_list[] = {
606 &clk_48m,
607 &clk_mout_epll.clk,
608 &clk_dout_mpll,
609 &clk_fin_epll,
610};
611
612static struct clksrc_sources clkset_uhost = {
613 .sources = clkset_uhost_list,
614 .nr_sources = ARRAY_SIZE(clkset_uhost_list),
615};
616
617/* The peripheral clocks are all controlled via clocksource followed
618 * by an optional divider and gate stage. We currently roll this into
619 * one clock which hides the intermediate clock from the mux.
620 *
621 * Note, the JPEG clock can only be an even divider...
622 *
623 * The scaler and LCD clocks depend on the S3C64XX version, and also
624 * have a common parent divisor so are not included here.
625 */
626
627/* clocks that feed other parts of the clock source tree */
628
629static struct clk clk_iis_cd0 = {
630 .name = "iis_cdclk0",
631};
632
633static struct clk clk_iis_cd1 = {
634 .name = "iis_cdclk1",
635};
636
637static struct clk clk_iisv4_cd = {
638 .name = "iis_cdclk_v4",
639};
640
641static struct clk clk_pcm_cd = {
642 .name = "pcm_cdclk",
643};
644
645static struct clk *clkset_audio0_list[] = {
646 [0] = &clk_mout_epll.clk,
647 [1] = &clk_dout_mpll,
648 [2] = &clk_fin_epll,
649 [3] = &clk_iis_cd0,
650 [4] = &clk_pcm_cd,
651};
652
653static struct clksrc_sources clkset_audio0 = {
654 .sources = clkset_audio0_list,
655 .nr_sources = ARRAY_SIZE(clkset_audio0_list),
656};
657
658static struct clk *clkset_audio1_list[] = {
659 [0] = &clk_mout_epll.clk,
660 [1] = &clk_dout_mpll,
661 [2] = &clk_fin_epll,
662 [3] = &clk_iis_cd1,
663 [4] = &clk_pcm_cd,
664};
665
666static struct clksrc_sources clkset_audio1 = {
667 .sources = clkset_audio1_list,
668 .nr_sources = ARRAY_SIZE(clkset_audio1_list),
669};
670
671#ifdef CONFIG_CPU_S3C6410
672static struct clk *clkset_audio2_list[] = {
673 [0] = &clk_mout_epll.clk,
674 [1] = &clk_dout_mpll,
675 [2] = &clk_fin_epll,
676 [3] = &clk_iisv4_cd,
677 [4] = &clk_pcm_cd,
678};
679
680static struct clksrc_sources clkset_audio2 = {
681 .sources = clkset_audio2_list,
682 .nr_sources = ARRAY_SIZE(clkset_audio2_list),
683};
684#endif
685
686static struct clksrc_clk clksrcs[] = {
687 {
688 .clk = {
689 .name = "usb-bus-host",
690 .ctrlbit = S3C_CLKCON_SCLK_UHOST,
691 .enable = s3c64xx_sclk_ctrl,
692 },
693 .reg_src = { .reg = S3C_CLK_SRC, .shift = 5, .size = 2 },
694 .reg_div = { .reg = S3C_CLK_DIV1, .shift = 20, .size = 4 },
695 .sources = &clkset_uhost,
696 }, {
697 .clk = {
698 .name = "irda-bus",
699 .ctrlbit = S3C_CLKCON_SCLK_IRDA,
700 .enable = s3c64xx_sclk_ctrl,
701 },
702 .reg_src = { .reg = S3C_CLK_SRC, .shift = 24, .size = 2 },
703 .reg_div = { .reg = S3C_CLK_DIV2, .shift = 20, .size = 4 },
704 .sources = &clkset_irda,
705 }, {
706 .clk = {
707 .name = "camera",
708 .ctrlbit = S3C_CLKCON_SCLK_CAM,
709 .enable = s3c64xx_sclk_ctrl,
710 .parent = &clk_h2,
711 },
712 .reg_div = { .reg = S3C_CLK_DIV0, .shift = 20, .size = 4 },
713 },
714};
715
716/* Where does UCLK0 come from? */
717static struct clksrc_clk clk_sclk_uclk = {
718 .clk = {
719 .name = "uclk1",
720 .ctrlbit = S3C_CLKCON_SCLK_UART,
721 .enable = s3c64xx_sclk_ctrl,
722 },
723 .reg_src = { .reg = S3C_CLK_SRC, .shift = 13, .size = 1 },
724 .reg_div = { .reg = S3C_CLK_DIV2, .shift = 16, .size = 4 },
725 .sources = &clkset_uart,
726};
727
728static struct clksrc_clk clk_sclk_mmc0 = {
729 .clk = {
730 .name = "mmc_bus",
731 .devname = "s3c-sdhci.0",
732 .ctrlbit = S3C_CLKCON_SCLK_MMC0,
733 .enable = s3c64xx_sclk_ctrl,
734 },
735 .reg_src = { .reg = S3C_CLK_SRC, .shift = 18, .size = 2 },
736 .reg_div = { .reg = S3C_CLK_DIV1, .shift = 0, .size = 4 },
737 .sources = &clkset_spi_mmc,
738};
739
740static struct clksrc_clk clk_sclk_mmc1 = {
741 .clk = {
742 .name = "mmc_bus",
743 .devname = "s3c-sdhci.1",
744 .ctrlbit = S3C_CLKCON_SCLK_MMC1,
745 .enable = s3c64xx_sclk_ctrl,
746 },
747 .reg_src = { .reg = S3C_CLK_SRC, .shift = 20, .size = 2 },
748 .reg_div = { .reg = S3C_CLK_DIV1, .shift = 4, .size = 4 },
749 .sources = &clkset_spi_mmc,
750};
751
752static struct clksrc_clk clk_sclk_mmc2 = {
753 .clk = {
754 .name = "mmc_bus",
755 .devname = "s3c-sdhci.2",
756 .ctrlbit = S3C_CLKCON_SCLK_MMC2,
757 .enable = s3c64xx_sclk_ctrl,
758 },
759 .reg_src = { .reg = S3C_CLK_SRC, .shift = 22, .size = 2 },
760 .reg_div = { .reg = S3C_CLK_DIV1, .shift = 8, .size = 4 },
761 .sources = &clkset_spi_mmc,
762};
763
764static struct clksrc_clk clk_sclk_spi0 = {
765 .clk = {
766 .name = "spi-bus",
767 .devname = "s3c6410-spi.0",
768 .ctrlbit = S3C_CLKCON_SCLK_SPI0,
769 .enable = s3c64xx_sclk_ctrl,
770 },
771 .reg_src = { .reg = S3C_CLK_SRC, .shift = 14, .size = 2 },
772 .reg_div = { .reg = S3C_CLK_DIV2, .shift = 0, .size = 4 },
773 .sources = &clkset_spi_mmc,
774};
775
776static struct clksrc_clk clk_sclk_spi1 = {
777 .clk = {
778 .name = "spi-bus",
779 .devname = "s3c6410-spi.1",
780 .ctrlbit = S3C_CLKCON_SCLK_SPI1,
781 .enable = s3c64xx_sclk_ctrl,
782 },
783 .reg_src = { .reg = S3C_CLK_SRC, .shift = 16, .size = 2 },
784 .reg_div = { .reg = S3C_CLK_DIV2, .shift = 4, .size = 4 },
785 .sources = &clkset_spi_mmc,
786};
787
788static struct clksrc_clk clk_audio_bus0 = {
789 .clk = {
790 .name = "audio-bus",
791 .devname = "samsung-i2s.0",
792 .ctrlbit = S3C_CLKCON_SCLK_AUDIO0,
793 .enable = s3c64xx_sclk_ctrl,
794 },
795 .reg_src = { .reg = S3C_CLK_SRC, .shift = 7, .size = 3 },
796 .reg_div = { .reg = S3C_CLK_DIV2, .shift = 8, .size = 4 },
797 .sources = &clkset_audio0,
798};
799
800static struct clksrc_clk clk_audio_bus1 = {
801 .clk = {
802 .name = "audio-bus",
803 .devname = "samsung-i2s.1",
804 .ctrlbit = S3C_CLKCON_SCLK_AUDIO1,
805 .enable = s3c64xx_sclk_ctrl,
806 },
807 .reg_src = { .reg = S3C_CLK_SRC, .shift = 10, .size = 3 },
808 .reg_div = { .reg = S3C_CLK_DIV2, .shift = 12, .size = 4 },
809 .sources = &clkset_audio1,
810};
811
812#ifdef CONFIG_CPU_S3C6410
813static struct clksrc_clk clk_audio_bus2 = {
814 .clk = {
815 .name = "audio-bus",
816 .devname = "samsung-i2s.2",
817 .ctrlbit = S3C6410_CLKCON_SCLK_AUDIO2,
818 .enable = s3c64xx_sclk_ctrl,
819 },
820 .reg_src = { .reg = S3C6410_CLK_SRC2, .shift = 0, .size = 3 },
821 .reg_div = { .reg = S3C_CLK_DIV2, .shift = 24, .size = 4 },
822 .sources = &clkset_audio2,
823};
824#endif
825/* Clock initialisation code */
826
827static struct clksrc_clk *init_parents[] = {
828 &clk_mout_apll,
829 &clk_mout_epll,
830 &clk_mout_mpll,
831};
832
833static struct clksrc_clk *clksrc_cdev[] = {
834 &clk_sclk_uclk,
835 &clk_sclk_mmc0,
836 &clk_sclk_mmc1,
837 &clk_sclk_mmc2,
838 &clk_sclk_spi0,
839 &clk_sclk_spi1,
840 &clk_audio_bus0,
841 &clk_audio_bus1,
842};
843
844static struct clk *clk_cdev[] = {
845 &clk_hsmmc0,
846 &clk_hsmmc1,
847 &clk_hsmmc2,
848 &clk_48m_spi0,
849 &clk_48m_spi1,
850 &clk_i2s0,
851 &clk_i2s1,
852};
853
854static struct clk_lookup s3c64xx_clk_lookup[] = {
855 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
856 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk),
857 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.0", &clk_hsmmc0),
858 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.0", &clk_hsmmc1),
859 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.0", &clk_hsmmc2),
860 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
861 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
862 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
863 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
864 CLKDEV_INIT("s3c6410-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
865 CLKDEV_INIT("s3c6410-spi.0", "spi_busclk2", &clk_48m_spi0),
866 CLKDEV_INIT("s3c6410-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
867 CLKDEV_INIT("s3c6410-spi.1", "spi_busclk2", &clk_48m_spi1),
868 CLKDEV_INIT("samsung-i2s.0", "i2s_opclk0", &clk_i2s0),
869 CLKDEV_INIT("samsung-i2s.0", "i2s_opclk1", &clk_audio_bus0.clk),
870 CLKDEV_INIT("samsung-i2s.1", "i2s_opclk0", &clk_i2s1),
871 CLKDEV_INIT("samsung-i2s.1", "i2s_opclk1", &clk_audio_bus1.clk),
872#ifdef CONFIG_CPU_S3C6410
873 CLKDEV_INIT("samsung-i2s.2", "i2s_opclk0", &clk_i2s2),
874 CLKDEV_INIT("samsung-i2s.2", "i2s_opclk1", &clk_audio_bus2.clk),
875#endif
876};
877
878#define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1)
879
880void __init_or_cpufreq s3c64xx_setup_clocks(void)
881{
882 struct clk *xtal_clk;
883 unsigned long xtal;
884 unsigned long fclk;
885 unsigned long hclk;
886 unsigned long hclk2;
887 unsigned long pclk;
888 unsigned long epll;
889 unsigned long apll;
890 unsigned long mpll;
891 unsigned int ptr;
892 u32 clkdiv0;
893
894 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
895
896 clkdiv0 = __raw_readl(S3C_CLK_DIV0);
897 printk(KERN_DEBUG "%s: clkdiv0 = %08x\n", __func__, clkdiv0);
898
899 xtal_clk = clk_get(NULL, "xtal");
900 BUG_ON(IS_ERR(xtal_clk));
901
902 xtal = clk_get_rate(xtal_clk);
903 clk_put(xtal_clk);
904
905 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
906
907 /* For now assume the mux always selects the crystal */
908 clk_ext_xtal_mux.parent = xtal_clk;
909
910 epll = s3c_get_pll6553x(xtal, __raw_readl(S3C_EPLL_CON0),
911 __raw_readl(S3C_EPLL_CON1));
912 mpll = s3c6400_get_pll(xtal, __raw_readl(S3C_MPLL_CON));
913 apll = s3c6400_get_pll(xtal, __raw_readl(S3C_APLL_CON));
914
915 fclk = mpll;
916
917 printk(KERN_INFO "S3C64XX: PLL settings, A=%ld, M=%ld, E=%ld\n",
918 apll, mpll, epll);
919
920 if(__raw_readl(S3C64XX_OTHERS) & S3C64XX_OTHERS_SYNCMUXSEL)
921 /* Synchronous mode */
922 hclk2 = apll / GET_DIV(clkdiv0, S3C6400_CLKDIV0_HCLK2);
923 else
924 /* Asynchronous mode */
925 hclk2 = mpll / GET_DIV(clkdiv0, S3C6400_CLKDIV0_HCLK2);
926
927 hclk = hclk2 / GET_DIV(clkdiv0, S3C6400_CLKDIV0_HCLK);
928 pclk = hclk2 / GET_DIV(clkdiv0, S3C6400_CLKDIV0_PCLK);
929
930 printk(KERN_INFO "S3C64XX: HCLK2=%ld, HCLK=%ld, PCLK=%ld\n",
931 hclk2, hclk, pclk);
932
933 clk_fout_mpll.rate = mpll;
934 clk_fout_epll.rate = epll;
935 clk_fout_apll.rate = apll;
936
937 clk_h2.rate = hclk2;
938 clk_h.rate = hclk;
939 clk_p.rate = pclk;
940 clk_f.rate = fclk;
941
942 for (ptr = 0; ptr < ARRAY_SIZE(init_parents); ptr++)
943 s3c_set_clksrc(init_parents[ptr], true);
944
945 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
946 s3c_set_clksrc(&clksrcs[ptr], true);
947}
948
949static struct clk *clks1[] __initdata = {
950 &clk_ext_xtal_mux,
951 &clk_iis_cd0,
952 &clk_iis_cd1,
953 &clk_iisv4_cd,
954 &clk_pcm_cd,
955 &clk_mout_epll.clk,
956 &clk_mout_mpll.clk,
957 &clk_dout_mpll,
958 &clk_arm,
959};
960
961static struct clk *clks[] __initdata = {
962 &clk_ext,
963 &clk_epll,
964 &clk_27m,
965 &clk_48m,
966 &clk_h2,
967 &clk_xusbxti,
968};
969
970/**
971 * s3c64xx_register_clocks - register clocks for s3c6400 and s3c6410
972 * @xtal: The rate for the clock crystal feeding the PLLs.
973 * @armclk_divlimit: Divisor mask for ARMCLK.
974 *
975 * Register the clocks for the S3C6400 and S3C6410 SoC range, such
976 * as ARMCLK as well as the necessary parent clocks.
977 *
978 * This call does not setup the clocks, which is left to the
979 * s3c64xx_setup_clocks() call which may be needed by the cpufreq
980 * or resume code to re-set the clocks if the bootloader has changed
981 * them.
982 */
983void __init s3c64xx_register_clocks(unsigned long xtal,
984 unsigned armclk_divlimit)
985{
986 unsigned int cnt;
987
988 armclk_mask = armclk_divlimit;
989
990 s3c24xx_register_baseclocks(xtal);
991 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
992
993 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
994
995 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
996 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
997
998 s3c24xx_register_clocks(clk_cdev, ARRAY_SIZE(clk_cdev));
999 for (cnt = 0; cnt < ARRAY_SIZE(clk_cdev); cnt++)
1000 s3c_disable_clocks(clk_cdev[cnt], 1);
1001
1002 s3c24xx_register_clocks(clks1, ARRAY_SIZE(clks1));
1003 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
1004 for (cnt = 0; cnt < ARRAY_SIZE(clksrc_cdev); cnt++)
1005 s3c_register_clksrc(clksrc_cdev[cnt], 1);
1006 clkdev_add_table(s3c64xx_clk_lookup, ARRAY_SIZE(s3c64xx_clk_lookup));
1007}
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 73d79cf5e141..7a3ce4c39e5f 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -14,9 +14,14 @@
14 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
15 */ 15 */
16 16
17/*
18 * NOTE: Code in this file is not used when booting with Device Tree support.
19 */
20
17#include <linux/kernel.h> 21#include <linux/kernel.h>
18#include <linux/init.h> 22#include <linux/init.h>
19#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/clk-provider.h>
20#include <linux/interrupt.h> 25#include <linux/interrupt.h>
21#include <linux/ioport.h> 26#include <linux/ioport.h>
22#include <linux/serial_core.h> 27#include <linux/serial_core.h>
@@ -38,7 +43,6 @@
38#include <mach/regs-gpio.h> 43#include <mach/regs-gpio.h>
39 44
40#include <plat/cpu.h> 45#include <plat/cpu.h>
41#include <plat/clock.h>
42#include <plat/devs.h> 46#include <plat/devs.h>
43#include <plat/pm.h> 47#include <plat/pm.h>
44#include <plat/gpio-cfg.h> 48#include <plat/gpio-cfg.h>
@@ -50,6 +54,19 @@
50 54
51#include "common.h" 55#include "common.h"
52 56
57/* External clock frequency */
58static unsigned long xtal_f = 12000000, xusbxti_f = 48000000;
59
60void __init s3c64xx_set_xtal_freq(unsigned long freq)
61{
62 xtal_f = freq;
63}
64
65void __init s3c64xx_set_xusbxti_freq(unsigned long freq)
66{
67 xusbxti_f = freq;
68}
69
53/* uart registration process */ 70/* uart registration process */
54 71
55static void __init s3c64xx_init_uarts(struct s3c2410_uartcfg *cfg, int no) 72static void __init s3c64xx_init_uarts(struct s3c2410_uartcfg *cfg, int no)
@@ -67,7 +84,6 @@ static struct cpu_table cpu_ids[] __initdata = {
67 .idcode = S3C6400_CPU_ID, 84 .idcode = S3C6400_CPU_ID,
68 .idmask = S3C64XX_CPU_MASK, 85 .idmask = S3C64XX_CPU_MASK,
69 .map_io = s3c6400_map_io, 86 .map_io = s3c6400_map_io,
70 .init_clocks = s3c6400_init_clocks,
71 .init_uarts = s3c64xx_init_uarts, 87 .init_uarts = s3c64xx_init_uarts,
72 .init = s3c6400_init, 88 .init = s3c6400_init,
73 .name = name_s3c6400, 89 .name = name_s3c6400,
@@ -75,7 +91,6 @@ static struct cpu_table cpu_ids[] __initdata = {
75 .idcode = S3C6410_CPU_ID, 91 .idcode = S3C6410_CPU_ID,
76 .idmask = S3C64XX_CPU_MASK, 92 .idmask = S3C64XX_CPU_MASK,
77 .map_io = s3c6410_map_io, 93 .map_io = s3c6410_map_io,
78 .init_clocks = s3c6410_init_clocks,
79 .init_uarts = s3c64xx_init_uarts, 94 .init_uarts = s3c64xx_init_uarts,
80 .init = s3c6410_init, 95 .init = s3c6410_init,
81 .name = name_s3c6410, 96 .name = name_s3c6410,
@@ -192,6 +207,10 @@ void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
192 207
193static __init int s3c64xx_dev_init(void) 208static __init int s3c64xx_dev_init(void)
194{ 209{
210 /* Not applicable when using DT. */
211 if (of_have_populated_dt())
212 return 0;
213
195 subsys_system_register(&s3c64xx_subsys, NULL); 214 subsys_system_register(&s3c64xx_subsys, NULL);
196 return device_register(&s3c64xx_dev); 215 return device_register(&s3c64xx_dev);
197} 216}
@@ -213,8 +232,10 @@ void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
213{ 232{
214 /* 233 /*
215 * FIXME: there is no better place to put this at the moment 234 * FIXME: there is no better place to put this at the moment
216 * (samsung_wdt_reset_init needs clocks) 235 * (s3c64xx_clk_init needs ioremap and must happen before init_time
236 * samsung_wdt_reset_init needs clocks)
217 */ 237 */
238 s3c64xx_clk_init(NULL, xtal_f, xusbxti_f, soc_is_s3c6400(), S3C_VA_SYS);
218 samsung_wdt_reset_init(S3C_VA_WATCHDOG); 239 samsung_wdt_reset_init(S3C_VA_WATCHDOG);
219 240
220 printk(KERN_DEBUG "%s: initialising interrupts\n", __func__); 241 printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);
@@ -391,6 +412,10 @@ static int __init s3c64xx_init_irq_eint(void)
391{ 412{
392 int irq; 413 int irq;
393 414
415 /* On DT-enabled systems EINTs are handled by pinctrl-s3c64xx driver. */
416 if (of_have_populated_dt())
417 return -ENODEV;
418
394 for (irq = IRQ_EINT(0); irq <= IRQ_EINT(27); irq++) { 419 for (irq = IRQ_EINT(0); irq <= IRQ_EINT(27); irq++) {
395 irq_set_chip_and_handler(irq, &s3c_irq_eint, handle_level_irq); 420 irq_set_chip_and_handler(irq, &s3c_irq_eint, handle_level_irq);
396 irq_set_chip_data(irq, (void *)eint_irq_to_bit(irq)); 421 irq_set_chip_data(irq, (void *)eint_irq_to_bit(irq));
diff --git a/arch/arm/mach-s3c64xx/common.h b/arch/arm/mach-s3c64xx/common.h
index e8f990b37665..bd3bd562011e 100644
--- a/arch/arm/mach-s3c64xx/common.h
+++ b/arch/arm/mach-s3c64xx/common.h
@@ -22,21 +22,21 @@
22void s3c64xx_init_irq(u32 vic0, u32 vic1); 22void s3c64xx_init_irq(u32 vic0, u32 vic1);
23void s3c64xx_init_io(struct map_desc *mach_desc, int size); 23void s3c64xx_init_io(struct map_desc *mach_desc, int size);
24 24
25void s3c64xx_register_clocks(unsigned long xtal, unsigned armclk_limit);
26void s3c64xx_setup_clocks(void);
27
28void s3c64xx_restart(enum reboot_mode mode, const char *cmd); 25void s3c64xx_restart(enum reboot_mode mode, const char *cmd);
29void s3c64xx_init_late(void); 26void s3c64xx_init_late(void);
30 27
28void s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
29 unsigned long xusbxti_f, bool is_s3c6400, void __iomem *reg_base);
30void s3c64xx_set_xtal_freq(unsigned long freq);
31void s3c64xx_set_xusbxti_freq(unsigned long freq);
32
31#ifdef CONFIG_CPU_S3C6400 33#ifdef CONFIG_CPU_S3C6400
32 34
33extern int s3c6400_init(void); 35extern int s3c6400_init(void);
34extern void s3c6400_init_irq(void); 36extern void s3c6400_init_irq(void);
35extern void s3c6400_map_io(void); 37extern void s3c6400_map_io(void);
36extern void s3c6400_init_clocks(int xtal);
37 38
38#else 39#else
39#define s3c6400_init_clocks NULL
40#define s3c6400_map_io NULL 40#define s3c6400_map_io NULL
41#define s3c6400_init NULL 41#define s3c6400_init NULL
42#endif 42#endif
@@ -46,10 +46,8 @@ extern void s3c6400_init_clocks(int xtal);
46extern int s3c6410_init(void); 46extern int s3c6410_init(void);
47extern void s3c6410_init_irq(void); 47extern void s3c6410_init_irq(void);
48extern void s3c6410_map_io(void); 48extern void s3c6410_map_io(void);
49extern void s3c6410_init_clocks(int xtal);
50 49
51#else 50#else
52#define s3c6410_init_clocks NULL
53#define s3c6410_map_io NULL 51#define s3c6410_map_io NULL
54#define s3c6410_init NULL 52#define s3c6410_init NULL
55#endif 53#endif
diff --git a/arch/arm/mach-s3c64xx/dma.c b/arch/arm/mach-s3c64xx/dma.c
index 759846c28d12..7e22c2113816 100644
--- a/arch/arm/mach-s3c64xx/dma.c
+++ b/arch/arm/mach-s3c64xx/dma.c
@@ -12,6 +12,10 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13*/ 13*/
14 14
15/*
16 * NOTE: Code in this file is not used when booting with Device Tree support.
17 */
18
15#include <linux/kernel.h> 19#include <linux/kernel.h>
16#include <linux/module.h> 20#include <linux/module.h>
17#include <linux/interrupt.h> 21#include <linux/interrupt.h>
@@ -24,6 +28,7 @@
24#include <linux/err.h> 28#include <linux/err.h>
25#include <linux/io.h> 29#include <linux/io.h>
26#include <linux/amba/pl080.h> 30#include <linux/amba/pl080.h>
31#include <linux/of.h>
27 32
28#include <mach/dma.h> 33#include <mach/dma.h>
29#include <mach/map.h> 34#include <mach/map.h>
@@ -677,7 +682,7 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
677 goto err_map; 682 goto err_map;
678 } 683 }
679 684
680 clk_enable(dmac->clk); 685 clk_prepare_enable(dmac->clk);
681 686
682 dmac->regs = regs; 687 dmac->regs = regs;
683 dmac->chanbase = chbase; 688 dmac->chanbase = chbase;
@@ -711,7 +716,7 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
711 return 0; 716 return 0;
712 717
713err_clk: 718err_clk:
714 clk_disable(dmac->clk); 719 clk_disable_unprepare(dmac->clk);
715 clk_put(dmac->clk); 720 clk_put(dmac->clk);
716err_map: 721err_map:
717 iounmap(regs); 722 iounmap(regs);
@@ -726,6 +731,10 @@ static int __init s3c64xx_dma_init(void)
726{ 731{
727 int ret; 732 int ret;
728 733
734 /* This driver is not supported when booting with device tree. */
735 if (of_have_populated_dt())
736 return -ENODEV;
737
729 printk(KERN_INFO "%s: Registering DMA channels\n", __func__); 738 printk(KERN_INFO "%s: Registering DMA channels\n", __func__);
730 739
731 dma_pool = dma_pool_create("DMA-LLI", NULL, sizeof(struct pl080s_lli), 16, 0); 740 dma_pool = dma_pool_create("DMA-LLI", NULL, sizeof(struct pl080s_lli), 16, 0);
diff --git a/arch/arm/mach-s3c64xx/include/mach/regs-clock.h b/arch/arm/mach-s3c64xx/include/mach/regs-clock.h
index 05332b998ec0..4f44aac77092 100644
--- a/arch/arm/mach-s3c64xx/include/mach/regs-clock.h
+++ b/arch/arm/mach-s3c64xx/include/mach/regs-clock.h
@@ -15,145 +15,21 @@
15#ifndef __PLAT_REGS_CLOCK_H 15#ifndef __PLAT_REGS_CLOCK_H
16#define __PLAT_REGS_CLOCK_H __FILE__ 16#define __PLAT_REGS_CLOCK_H __FILE__
17 17
18/*
19 * FIXME: Remove remaining definitions
20 */
21
18#define S3C_CLKREG(x) (S3C_VA_SYS + (x)) 22#define S3C_CLKREG(x) (S3C_VA_SYS + (x))
19 23
20#define S3C_APLL_LOCK S3C_CLKREG(0x00)
21#define S3C_MPLL_LOCK S3C_CLKREG(0x04)
22#define S3C_EPLL_LOCK S3C_CLKREG(0x08)
23#define S3C_APLL_CON S3C_CLKREG(0x0C)
24#define S3C_MPLL_CON S3C_CLKREG(0x10)
25#define S3C_EPLL_CON0 S3C_CLKREG(0x14)
26#define S3C_EPLL_CON1 S3C_CLKREG(0x18)
27#define S3C_CLK_SRC S3C_CLKREG(0x1C)
28#define S3C_CLK_DIV0 S3C_CLKREG(0x20)
29#define S3C_CLK_DIV1 S3C_CLKREG(0x24)
30#define S3C_CLK_DIV2 S3C_CLKREG(0x28)
31#define S3C_CLK_OUT S3C_CLKREG(0x2C)
32#define S3C_HCLK_GATE S3C_CLKREG(0x30)
33#define S3C_PCLK_GATE S3C_CLKREG(0x34) 24#define S3C_PCLK_GATE S3C_CLKREG(0x34)
34#define S3C_SCLK_GATE S3C_CLKREG(0x38)
35#define S3C_MEM0_GATE S3C_CLKREG(0x3C)
36#define S3C6410_CLK_SRC2 S3C_CLKREG(0x10C) 25#define S3C6410_CLK_SRC2 S3C_CLKREG(0x10C)
37#define S3C_MEM_SYS_CFG S3C_CLKREG(0x120) 26#define S3C_MEM_SYS_CFG S3C_CLKREG(0x120)
38 27
39/* CLKDIV0 */
40#define S3C6400_CLKDIV0_PCLK_MASK (0xf << 12)
41#define S3C6400_CLKDIV0_PCLK_SHIFT (12)
42#define S3C6400_CLKDIV0_HCLK2_MASK (0x7 << 9)
43#define S3C6400_CLKDIV0_HCLK2_SHIFT (9)
44#define S3C6400_CLKDIV0_HCLK_MASK (0x1 << 8)
45#define S3C6400_CLKDIV0_HCLK_SHIFT (8)
46#define S3C6400_CLKDIV0_MPLL_MASK (0x1 << 4)
47#define S3C6400_CLKDIV0_MPLL_SHIFT (4)
48
49#define S3C6400_CLKDIV0_ARM_MASK (0x7 << 0)
50#define S3C6410_CLKDIV0_ARM_MASK (0xf << 0)
51#define S3C6400_CLKDIV0_ARM_SHIFT (0)
52
53/* HCLK GATE Registers */
54#define S3C_CLKCON_HCLK_3DSE (1<<31)
55#define S3C_CLKCON_HCLK_UHOST (1<<29)
56#define S3C_CLKCON_HCLK_SECUR (1<<28)
57#define S3C_CLKCON_HCLK_SDMA1 (1<<27)
58#define S3C_CLKCON_HCLK_SDMA0 (1<<26)
59#define S3C_CLKCON_HCLK_IROM (1<<25)
60#define S3C_CLKCON_HCLK_DDR1 (1<<24)
61#define S3C_CLKCON_HCLK_DDR0 (1<<23)
62#define S3C_CLKCON_HCLK_MEM1 (1<<22)
63#define S3C_CLKCON_HCLK_MEM0 (1<<21)
64#define S3C_CLKCON_HCLK_USB (1<<20)
65#define S3C_CLKCON_HCLK_HSMMC2 (1<<19)
66#define S3C_CLKCON_HCLK_HSMMC1 (1<<18)
67#define S3C_CLKCON_HCLK_HSMMC0 (1<<17)
68#define S3C_CLKCON_HCLK_MDP (1<<16)
69#define S3C_CLKCON_HCLK_DHOST (1<<15)
70#define S3C_CLKCON_HCLK_IHOST (1<<14)
71#define S3C_CLKCON_HCLK_DMA1 (1<<13)
72#define S3C_CLKCON_HCLK_DMA0 (1<<12)
73#define S3C_CLKCON_HCLK_JPEG (1<<11)
74#define S3C_CLKCON_HCLK_CAMIF (1<<10)
75#define S3C_CLKCON_HCLK_SCALER (1<<9)
76#define S3C_CLKCON_HCLK_2D (1<<8)
77#define S3C_CLKCON_HCLK_TV (1<<7)
78#define S3C_CLKCON_HCLK_POST0 (1<<5)
79#define S3C_CLKCON_HCLK_ROT (1<<4)
80#define S3C_CLKCON_HCLK_LCD (1<<3)
81#define S3C_CLKCON_HCLK_TZIC (1<<2)
82#define S3C_CLKCON_HCLK_INTC (1<<1)
83#define S3C_CLKCON_HCLK_MFC (1<<0)
84
85/* PCLK GATE Registers */ 28/* PCLK GATE Registers */
86#define S3C6410_CLKCON_PCLK_I2C1 (1<<27)
87#define S3C6410_CLKCON_PCLK_IIS2 (1<<26)
88#define S3C_CLKCON_PCLK_SKEY (1<<24)
89#define S3C_CLKCON_PCLK_CHIPID (1<<23)
90#define S3C_CLKCON_PCLK_SPI1 (1<<22)
91#define S3C_CLKCON_PCLK_SPI0 (1<<21)
92#define S3C_CLKCON_PCLK_HSIRX (1<<20)
93#define S3C_CLKCON_PCLK_HSITX (1<<19)
94#define S3C_CLKCON_PCLK_GPIO (1<<18)
95#define S3C_CLKCON_PCLK_IIC (1<<17)
96#define S3C_CLKCON_PCLK_IIS1 (1<<16)
97#define S3C_CLKCON_PCLK_IIS0 (1<<15)
98#define S3C_CLKCON_PCLK_AC97 (1<<14)
99#define S3C_CLKCON_PCLK_TZPC (1<<13)
100#define S3C_CLKCON_PCLK_TSADC (1<<12)
101#define S3C_CLKCON_PCLK_KEYPAD (1<<11)
102#define S3C_CLKCON_PCLK_IRDA (1<<10)
103#define S3C_CLKCON_PCLK_PCM1 (1<<9)
104#define S3C_CLKCON_PCLK_PCM0 (1<<8)
105#define S3C_CLKCON_PCLK_PWM (1<<7)
106#define S3C_CLKCON_PCLK_RTC (1<<6)
107#define S3C_CLKCON_PCLK_WDT (1<<5)
108#define S3C_CLKCON_PCLK_UART3 (1<<4) 29#define S3C_CLKCON_PCLK_UART3 (1<<4)
109#define S3C_CLKCON_PCLK_UART2 (1<<3) 30#define S3C_CLKCON_PCLK_UART2 (1<<3)
110#define S3C_CLKCON_PCLK_UART1 (1<<2) 31#define S3C_CLKCON_PCLK_UART1 (1<<2)
111#define S3C_CLKCON_PCLK_UART0 (1<<1) 32#define S3C_CLKCON_PCLK_UART0 (1<<1)
112#define S3C_CLKCON_PCLK_MFC (1<<0)
113
114/* SCLK GATE Registers */
115#define S3C_CLKCON_SCLK_UHOST (1<<30)
116#define S3C_CLKCON_SCLK_MMC2_48 (1<<29)
117#define S3C_CLKCON_SCLK_MMC1_48 (1<<28)
118#define S3C_CLKCON_SCLK_MMC0_48 (1<<27)
119#define S3C_CLKCON_SCLK_MMC2 (1<<26)
120#define S3C_CLKCON_SCLK_MMC1 (1<<25)
121#define S3C_CLKCON_SCLK_MMC0 (1<<24)
122#define S3C_CLKCON_SCLK_SPI1_48 (1<<23)
123#define S3C_CLKCON_SCLK_SPI0_48 (1<<22)
124#define S3C_CLKCON_SCLK_SPI1 (1<<21)
125#define S3C_CLKCON_SCLK_SPI0 (1<<20)
126#define S3C_CLKCON_SCLK_DAC27 (1<<19)
127#define S3C_CLKCON_SCLK_TV27 (1<<18)
128#define S3C_CLKCON_SCLK_SCALER27 (1<<17)
129#define S3C_CLKCON_SCLK_SCALER (1<<16)
130#define S3C_CLKCON_SCLK_LCD27 (1<<15)
131#define S3C_CLKCON_SCLK_LCD (1<<14)
132#define S3C6400_CLKCON_SCLK_POST1_27 (1<<13)
133#define S3C6410_CLKCON_FIMC (1<<13)
134#define S3C_CLKCON_SCLK_POST0_27 (1<<12)
135#define S3C6400_CLKCON_SCLK_POST1 (1<<11)
136#define S3C6410_CLKCON_SCLK_AUDIO2 (1<<11)
137#define S3C_CLKCON_SCLK_POST0 (1<<10)
138#define S3C_CLKCON_SCLK_AUDIO1 (1<<9)
139#define S3C_CLKCON_SCLK_AUDIO0 (1<<8)
140#define S3C_CLKCON_SCLK_SECUR (1<<7)
141#define S3C_CLKCON_SCLK_IRDA (1<<6)
142#define S3C_CLKCON_SCLK_UART (1<<5)
143#define S3C_CLKCON_SCLK_ONENAND (1<<4)
144#define S3C_CLKCON_SCLK_MFC (1<<3)
145#define S3C_CLKCON_SCLK_CAM (1<<2)
146#define S3C_CLKCON_SCLK_JPEG (1<<1)
147
148/* CLKSRC */
149
150#define S3C6400_CLKSRC_APLL_MOUT (1 << 0)
151#define S3C6400_CLKSRC_MPLL_MOUT (1 << 1)
152#define S3C6400_CLKSRC_EPLL_MOUT (1 << 2)
153#define S3C6400_CLKSRC_APLL_MOUT_SHIFT (0)
154#define S3C6400_CLKSRC_MPLL_MOUT_SHIFT (1)
155#define S3C6400_CLKSRC_EPLL_MOUT_SHIFT (2)
156#define S3C6400_CLKSRC_MFC (1 << 4)
157 33
158/* MEM_SYS_CFG */ 34/* MEM_SYS_CFG */
159#define MEM_SYS_CFG_INDEP_CF 0x4000 35#define MEM_SYS_CFG_INDEP_CF 0x4000
diff --git a/arch/arm/mach-s3c64xx/irq-pm.c b/arch/arm/mach-s3c64xx/irq-pm.c
index c3da1b68d03e..1649c0d1c1b8 100644
--- a/arch/arm/mach-s3c64xx/irq-pm.c
+++ b/arch/arm/mach-s3c64xx/irq-pm.c
@@ -12,12 +12,17 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15/*
16 * NOTE: Code in this file is not used when booting with Device Tree support.
17 */
18
15#include <linux/kernel.h> 19#include <linux/kernel.h>
16#include <linux/syscore_ops.h> 20#include <linux/syscore_ops.h>
17#include <linux/interrupt.h> 21#include <linux/interrupt.h>
18#include <linux/serial_core.h> 22#include <linux/serial_core.h>
19#include <linux/irq.h> 23#include <linux/irq.h>
20#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/of.h>
21 26
22#include <mach/map.h> 27#include <mach/map.h>
23 28
@@ -101,6 +106,10 @@ static struct syscore_ops s3c64xx_irq_syscore_ops = {
101 106
102static __init int s3c64xx_syscore_init(void) 107static __init int s3c64xx_syscore_init(void)
103{ 108{
109 /* Appropriate drivers (pinctrl, uart) handle this when using DT. */
110 if (of_have_populated_dt())
111 return 0;
112
104 register_syscore_ops(&s3c64xx_irq_syscore_ops); 113 register_syscore_ops(&s3c64xx_irq_syscore_ops);
105 114
106 return 0; 115 return 0;
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
index 35e3f54574ef..d266dd5f7060 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -207,7 +207,7 @@ static struct platform_device *anw6410_devices[] __initdata = {
207static void __init anw6410_map_io(void) 207static void __init anw6410_map_io(void)
208{ 208{
209 s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc)); 209 s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc));
210 s3c24xx_init_clocks(12000000); 210 s3c64xx_set_xtal_freq(12000000);
211 s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs)); 211 s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs));
212 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 212 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
213 213
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index eb8e5a1aca42..aca7d16e195d 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -310,10 +310,6 @@ static struct regulator_consumer_supply wallvdd_consumers[] = {
310 310
311 REGULATOR_SUPPLY("SPKVDDL", "spi0.1"), 311 REGULATOR_SUPPLY("SPKVDDL", "spi0.1"),
312 REGULATOR_SUPPLY("SPKVDDR", "spi0.1"), 312 REGULATOR_SUPPLY("SPKVDDR", "spi0.1"),
313 REGULATOR_SUPPLY("SPKVDDL", "wm5102-codec"),
314 REGULATOR_SUPPLY("SPKVDDR", "wm5102-codec"),
315 REGULATOR_SUPPLY("SPKVDDL", "wm5110-codec"),
316 REGULATOR_SUPPLY("SPKVDDR", "wm5110-codec"),
317 313
318 REGULATOR_SUPPLY("DC1VDD", "0-0034"), 314 REGULATOR_SUPPLY("DC1VDD", "0-0034"),
319 REGULATOR_SUPPLY("DC2VDD", "0-0034"), 315 REGULATOR_SUPPLY("DC2VDD", "0-0034"),
@@ -653,14 +649,6 @@ static struct regulator_consumer_supply pvdd_1v8_consumers[] = {
653 REGULATOR_SUPPLY("DBVDD3", "spi0.1"), 649 REGULATOR_SUPPLY("DBVDD3", "spi0.1"),
654 REGULATOR_SUPPLY("LDOVDD", "spi0.1"), 650 REGULATOR_SUPPLY("LDOVDD", "spi0.1"),
655 REGULATOR_SUPPLY("CPVDD", "spi0.1"), 651 REGULATOR_SUPPLY("CPVDD", "spi0.1"),
656
657 REGULATOR_SUPPLY("DBVDD2", "wm5102-codec"),
658 REGULATOR_SUPPLY("DBVDD3", "wm5102-codec"),
659 REGULATOR_SUPPLY("CPVDD", "wm5102-codec"),
660
661 REGULATOR_SUPPLY("DBVDD2", "wm5110-codec"),
662 REGULATOR_SUPPLY("DBVDD3", "wm5110-codec"),
663 REGULATOR_SUPPLY("CPVDD", "wm5110-codec"),
664}; 652};
665 653
666static struct regulator_init_data pvdd_1v8 = { 654static struct regulator_init_data pvdd_1v8 = {
@@ -743,7 +731,7 @@ static struct s3c2410_platform_i2c i2c1_pdata = {
743static void __init crag6410_map_io(void) 731static void __init crag6410_map_io(void)
744{ 732{
745 s3c64xx_init_io(NULL, 0); 733 s3c64xx_init_io(NULL, 0);
746 s3c24xx_init_clocks(12000000); 734 s3c64xx_set_xtal_freq(12000000);
747 s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs)); 735 s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs));
748 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 736 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
749 737
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index f39569e0f2e6..e8064044ef79 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -247,7 +247,7 @@ static struct platform_device *hmt_devices[] __initdata = {
247static void __init hmt_map_io(void) 247static void __init hmt_map_io(void)
248{ 248{
249 s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc)); 249 s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc));
250 s3c24xx_init_clocks(12000000); 250 s3c64xx_set_xtal_freq(12000000);
251 s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs)); 251 s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs));
252 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 252 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
253} 253}
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index fc043e3ecdf8..58d46a3d7b78 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -231,7 +231,7 @@ static void __init mini6410_map_io(void)
231 u32 tmp; 231 u32 tmp;
232 232
233 s3c64xx_init_io(NULL, 0); 233 s3c64xx_init_io(NULL, 0);
234 s3c24xx_init_clocks(12000000); 234 s3c64xx_set_xtal_freq(12000000);
235 s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs)); 235 s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs));
236 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 236 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
237 237
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c
index 7e2c3908f1f8..2067b0bf55b4 100644
--- a/arch/arm/mach-s3c64xx/mach-ncp.c
+++ b/arch/arm/mach-s3c64xx/mach-ncp.c
@@ -86,7 +86,7 @@ static struct map_desc ncp_iodesc[] __initdata = {};
86static void __init ncp_map_io(void) 86static void __init ncp_map_io(void)
87{ 87{
88 s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc)); 88 s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc));
89 s3c24xx_init_clocks(12000000); 89 s3c64xx_set_xtal_freq(12000000);
90 s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs)); 90 s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs));
91 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 91 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
92} 92}
diff --git a/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c b/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c
new file mode 100644
index 000000000000..7eb9a10fc1af
--- /dev/null
+++ b/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c
@@ -0,0 +1,85 @@
1/*
2 * Samsung's S3C64XX flattened device tree enabled machine
3 *
4 * Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/clk-provider.h>
12#include <linux/irqchip.h>
13#include <linux/of_platform.h>
14
15#include <asm/mach/arch.h>
16#include <asm/mach/map.h>
17#include <asm/system_misc.h>
18
19#include <plat/cpu.h>
20#include <plat/watchdog-reset.h>
21
22#include <mach/map.h>
23
24#include "common.h"
25
26/*
27 * IO mapping for shared system controller IP.
28 *
29 * FIXME: Make remaining drivers use dynamic mapping.
30 */
31static struct map_desc s3c64xx_dt_iodesc[] __initdata = {
32 {
33 .virtual = (unsigned long)S3C_VA_SYS,
34 .pfn = __phys_to_pfn(S3C64XX_PA_SYSCON),
35 .length = SZ_4K,
36 .type = MT_DEVICE,
37 },
38};
39
40static void __init s3c64xx_dt_map_io(void)
41{
42 debug_ll_io_init();
43 iotable_init(s3c64xx_dt_iodesc, ARRAY_SIZE(s3c64xx_dt_iodesc));
44
45 s3c64xx_init_cpu();
46
47 if (!soc_is_s3c64xx())
48 panic("SoC is not S3C64xx!");
49}
50
51static void __init s3c64xx_dt_init_irq(void)
52{
53 of_clk_init(NULL);
54 samsung_wdt_reset_of_init();
55 irqchip_init();
56};
57
58static void __init s3c64xx_dt_init_machine(void)
59{
60 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
61}
62
63static void s3c64xx_dt_restart(enum reboot_mode mode, const char *cmd)
64{
65 if (mode != REBOOT_SOFT)
66 samsung_wdt_reset();
67
68 /* if all else fails, or mode was for soft, jump to 0 */
69 soft_restart(0);
70}
71
72static char const *s3c64xx_dt_compat[] __initdata = {
73 "samsung,s3c6400",
74 "samsung,s3c6410",
75 NULL
76};
77
78DT_MACHINE_START(S3C6400_DT, "Samsung S3C64xx (Flattened Device Tree)")
79 /* Maintainer: Tomasz Figa <tomasz.figa@gmail.com> */
80 .dt_compat = s3c64xx_dt_compat,
81 .map_io = s3c64xx_dt_map_io,
82 .init_irq = s3c64xx_dt_init_irq,
83 .init_machine = s3c64xx_dt_init_machine,
84 .restart = s3c64xx_dt_restart,
85MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index 86d980b448fd..0f47237be3b2 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -337,13 +337,6 @@ err:
337 return ret; 337 return ret;
338} 338}
339 339
340static int __init smartq_usb_otg_init(void)
341{
342 clk_xusbxti.rate = 12000000;
343
344 return 0;
345}
346
347static int __init smartq_wifi_init(void) 340static int __init smartq_wifi_init(void)
348{ 341{
349 int ret; 342 int ret;
@@ -377,7 +370,8 @@ static struct map_desc smartq_iodesc[] __initdata = {};
377void __init smartq_map_io(void) 370void __init smartq_map_io(void)
378{ 371{
379 s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc)); 372 s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc));
380 s3c24xx_init_clocks(12000000); 373 s3c64xx_set_xtal_freq(12000000);
374 s3c64xx_set_xusbxti_freq(12000000);
381 s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs)); 375 s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs));
382 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 376 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
383 377
@@ -399,7 +393,6 @@ void __init smartq_machine_init(void)
399 WARN_ON(smartq_lcd_setup_gpio()); 393 WARN_ON(smartq_lcd_setup_gpio());
400 WARN_ON(smartq_power_off_init()); 394 WARN_ON(smartq_power_off_init());
401 WARN_ON(smartq_usb_host_init()); 395 WARN_ON(smartq_usb_host_init());
402 WARN_ON(smartq_usb_otg_init());
403 WARN_ON(smartq_wifi_init()); 396 WARN_ON(smartq_wifi_init());
404 397
405 platform_add_devices(smartq_devices, ARRAY_SIZE(smartq_devices)); 398 platform_add_devices(smartq_devices, ARRAY_SIZE(smartq_devices));
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-s3c64xx/mach-smdk6400.c
index d70c0843aea2..27381cfcabbe 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6400.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c
@@ -65,7 +65,7 @@ static struct map_desc smdk6400_iodesc[] = {};
65static void __init smdk6400_map_io(void) 65static void __init smdk6400_map_io(void)
66{ 66{
67 s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc)); 67 s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc));
68 s3c24xx_init_clocks(12000000); 68 s3c64xx_set_xtal_freq(12000000);
69 s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs)); 69 s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs));
70 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 70 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
71} 71}
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index d90b450c5645..2a7b32ca5c96 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -634,7 +634,7 @@ static void __init smdk6410_map_io(void)
634 u32 tmp; 634 u32 tmp;
635 635
636 s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc)); 636 s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
637 s3c24xx_init_clocks(12000000); 637 s3c64xx_set_xtal_freq(12000000);
638 s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs)); 638 s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
639 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 639 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
640 640
diff --git a/arch/arm/mach-s3c64xx/pm.c b/arch/arm/mach-s3c64xx/pm.c
index 6a1f91fea678..8cdb824a3b43 100644
--- a/arch/arm/mach-s3c64xx/pm.c
+++ b/arch/arm/mach-s3c64xx/pm.c
@@ -194,29 +194,8 @@ void s3c_pm_debug_smdkled(u32 set, u32 clear)
194#endif 194#endif
195 195
196static struct sleep_save core_save[] = { 196static struct sleep_save core_save[] = {
197 SAVE_ITEM(S3C_APLL_LOCK),
198 SAVE_ITEM(S3C_MPLL_LOCK),
199 SAVE_ITEM(S3C_EPLL_LOCK),
200 SAVE_ITEM(S3C_CLK_SRC),
201 SAVE_ITEM(S3C_CLK_DIV0),
202 SAVE_ITEM(S3C_CLK_DIV1),
203 SAVE_ITEM(S3C_CLK_DIV2),
204 SAVE_ITEM(S3C_CLK_OUT),
205 SAVE_ITEM(S3C_HCLK_GATE),
206 SAVE_ITEM(S3C_PCLK_GATE),
207 SAVE_ITEM(S3C_SCLK_GATE),
208 SAVE_ITEM(S3C_MEM0_GATE),
209
210 SAVE_ITEM(S3C_EPLL_CON1),
211 SAVE_ITEM(S3C_EPLL_CON0),
212
213 SAVE_ITEM(S3C64XX_MEM0DRVCON), 197 SAVE_ITEM(S3C64XX_MEM0DRVCON),
214 SAVE_ITEM(S3C64XX_MEM1DRVCON), 198 SAVE_ITEM(S3C64XX_MEM1DRVCON),
215
216#ifndef CONFIG_CPU_FREQ
217 SAVE_ITEM(S3C_APLL_CON),
218 SAVE_ITEM(S3C_MPLL_CON),
219#endif
220}; 199};
221 200
222static struct sleep_save misc_save[] = { 201static struct sleep_save misc_save[] = {
diff --git a/arch/arm/mach-s3c64xx/s3c6400.c b/arch/arm/mach-s3c64xx/s3c6400.c
index 4869714c6f1b..3db0c98222f7 100644
--- a/arch/arm/mach-s3c64xx/s3c6400.c
+++ b/arch/arm/mach-s3c64xx/s3c6400.c
@@ -9,6 +9,10 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10*/ 10*/
11 11
12/*
13 * NOTE: Code in this file is not used when booting with Device Tree support.
14 */
15
12#include <linux/kernel.h> 16#include <linux/kernel.h>
13#include <linux/types.h> 17#include <linux/types.h>
14#include <linux/interrupt.h> 18#include <linux/interrupt.h>
@@ -20,6 +24,7 @@
20#include <linux/device.h> 24#include <linux/device.h>
21#include <linux/serial_core.h> 25#include <linux/serial_core.h>
22#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/of.h>
23 28
24#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
25#include <asm/mach/map.h> 30#include <asm/mach/map.h>
@@ -58,12 +63,6 @@ void __init s3c6400_map_io(void)
58 s3c64xx_onenand1_setname("s3c6400-onenand"); 63 s3c64xx_onenand1_setname("s3c6400-onenand");
59} 64}
60 65
61void __init s3c6400_init_clocks(int xtal)
62{
63 s3c64xx_register_clocks(xtal, S3C6400_CLKDIV0_ARM_MASK);
64 s3c64xx_setup_clocks();
65}
66
67void __init s3c6400_init_irq(void) 66void __init s3c6400_init_irq(void)
68{ 67{
69 /* VIC0 does not have IRQS 5..7, 68 /* VIC0 does not have IRQS 5..7,
@@ -82,6 +81,10 @@ static struct device s3c6400_dev = {
82 81
83static int __init s3c6400_core_init(void) 82static int __init s3c6400_core_init(void)
84{ 83{
84 /* Not applicable when using DT. */
85 if (of_have_populated_dt())
86 return 0;
87
85 return subsys_system_register(&s3c6400_subsys, NULL); 88 return subsys_system_register(&s3c6400_subsys, NULL);
86} 89}
87 90
diff --git a/arch/arm/mach-s3c64xx/s3c6410.c b/arch/arm/mach-s3c64xx/s3c6410.c
index 31c29fdf1800..72b2278953a8 100644
--- a/arch/arm/mach-s3c64xx/s3c6410.c
+++ b/arch/arm/mach-s3c64xx/s3c6410.c
@@ -10,6 +10,10 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11*/ 11*/
12 12
13/*
14 * NOTE: Code in this file is not used when booting with Device Tree support.
15 */
16
13#include <linux/kernel.h> 17#include <linux/kernel.h>
14#include <linux/types.h> 18#include <linux/types.h>
15#include <linux/interrupt.h> 19#include <linux/interrupt.h>
@@ -21,6 +25,7 @@
21#include <linux/device.h> 25#include <linux/device.h>
22#include <linux/serial_core.h> 26#include <linux/serial_core.h>
23#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/of.h>
24 29
25#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 31#include <asm/mach/map.h>
@@ -62,13 +67,6 @@ void __init s3c6410_map_io(void)
62 s3c_cfcon_setname("s3c64xx-pata"); 67 s3c_cfcon_setname("s3c64xx-pata");
63} 68}
64 69
65void __init s3c6410_init_clocks(int xtal)
66{
67 printk(KERN_DEBUG "%s: initialising clocks\n", __func__);
68 s3c64xx_register_clocks(xtal, S3C6410_CLKDIV0_ARM_MASK);
69 s3c64xx_setup_clocks();
70}
71
72void __init s3c6410_init_irq(void) 70void __init s3c6410_init_irq(void)
73{ 71{
74 /* VIC0 is missing IRQ7, VIC1 is fully populated. */ 72 /* VIC0 is missing IRQ7, VIC1 is fully populated. */
@@ -86,6 +84,10 @@ static struct device s3c6410_dev = {
86 84
87static int __init s3c6410_core_init(void) 85static int __init s3c6410_core_init(void)
88{ 86{
87 /* Not applicable when using DT. */
88 if (of_have_populated_dt())
89 return 0;
90
89 return subsys_system_register(&s3c6410_subsys, NULL); 91 return subsys_system_register(&s3c6410_subsys, NULL);
90} 92}
91 93
diff --git a/arch/arm/mach-s5pv210/include/mach/regs-clock.h b/arch/arm/mach-s5pv210/include/mach/regs-clock.h
index 032de66fb8be..e345584d4c34 100644
--- a/arch/arm/mach-s5pv210/include/mach/regs-clock.h
+++ b/arch/arm/mach-s5pv210/include/mach/regs-clock.h
@@ -147,10 +147,6 @@
147#define S5P_HDMI_PHY_CONTROL S5P_CLKREG(0xE804) 147#define S5P_HDMI_PHY_CONTROL S5P_CLKREG(0xE804)
148#define S5P_USB_PHY_CONTROL S5P_CLKREG(0xE80C) 148#define S5P_USB_PHY_CONTROL S5P_CLKREG(0xE80C)
149#define S5P_DAC_PHY_CONTROL S5P_CLKREG(0xE810) 149#define S5P_DAC_PHY_CONTROL S5P_CLKREG(0xE810)
150#define S5P_MIPI_DPHY_CONTROL(x) S5P_CLKREG(0xE814)
151#define S5P_MIPI_DPHY_ENABLE (1 << 0)
152#define S5P_MIPI_DPHY_SRESETN (1 << 1)
153#define S5P_MIPI_DPHY_MRESETN (1 << 2)
154 150
155#define S5P_INFORM0 S5P_CLKREG(0xF000) 151#define S5P_INFORM0 S5P_CLKREG(0xF000)
156#define S5P_INFORM1 S5P_CLKREG(0xF004) 152#define S5P_INFORM1 S5P_CLKREG(0xF004)
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index e838ba27e443..c9808c684152 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -512,6 +512,9 @@ static void __init assabet_map_io(void)
512 * Its called GPCLKR0 in my SA1110 manual. 512 * Its called GPCLKR0 in my SA1110 manual.
513 */ 513 */
514 Ser1SDCR0 |= SDCR0_SUS; 514 Ser1SDCR0 |= SDCR0_SUS;
515 MSC1 = (MSC1 & ~0xffff) |
516 MSC_NonBrst | MSC_32BitStMem |
517 MSC_RdAcc(2) | MSC_WrAcc(2) | MSC_Rec(0);
515 518
516 if (!machine_has_neponset()) 519 if (!machine_has_neponset())
517 sa1100_register_uart_fns(&assabet_port_fns); 520 sa1100_register_uart_fns(&assabet_port_fns);
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index 612a45689770..7fb96ebdc0fb 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -289,7 +289,7 @@ static void collie_flash_exit(void)
289} 289}
290 290
291static struct flash_platform_data collie_flash_data = { 291static struct flash_platform_data collie_flash_data = {
292 .map_name = "cfi_probe", 292 .map_name = "jedec_probe",
293 .init = collie_flash_init, 293 .init = collie_flash_init,
294 .set_vpp = collie_set_vpp, 294 .set_vpp = collie_set_vpp,
295 .exit = collie_flash_exit, 295 .exit = collie_flash_exit,
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index f25b6119e028..d4ea142c4edd 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -42,74 +42,31 @@ EXPORT_SYMBOL(reset_status);
42/* 42/*
43 * This table is setup for a 3.6864MHz Crystal. 43 * This table is setup for a 3.6864MHz Crystal.
44 */ 44 */
45static const unsigned short cclk_frequency_100khz[NR_FREQS] = { 45struct cpufreq_frequency_table sa11x0_freq_table[NR_FREQS+1] = {
46 590, /* 59.0 MHz */ 46 { .frequency = 59000, /* 59.0 MHz */},
47 737, /* 73.7 MHz */ 47 { .frequency = 73700, /* 73.7 MHz */},
48 885, /* 88.5 MHz */ 48 { .frequency = 88500, /* 88.5 MHz */},
49 1032, /* 103.2 MHz */ 49 { .frequency = 103200, /* 103.2 MHz */},
50 1180, /* 118.0 MHz */ 50 { .frequency = 118000, /* 118.0 MHz */},
51 1327, /* 132.7 MHz */ 51 { .frequency = 132700, /* 132.7 MHz */},
52 1475, /* 147.5 MHz */ 52 { .frequency = 147500, /* 147.5 MHz */},
53 1622, /* 162.2 MHz */ 53 { .frequency = 162200, /* 162.2 MHz */},
54 1769, /* 176.9 MHz */ 54 { .frequency = 176900, /* 176.9 MHz */},
55 1917, /* 191.7 MHz */ 55 { .frequency = 191700, /* 191.7 MHz */},
56 2064, /* 206.4 MHz */ 56 { .frequency = 206400, /* 206.4 MHz */},
57 2212, /* 221.2 MHz */ 57 { .frequency = 221200, /* 221.2 MHz */},
58 2359, /* 235.9 MHz */ 58 { .frequency = 235900, /* 235.9 MHz */},
59 2507, /* 250.7 MHz */ 59 { .frequency = 250700, /* 250.7 MHz */},
60 2654, /* 265.4 MHz */ 60 { .frequency = 265400, /* 265.4 MHz */},
61 2802 /* 280.2 MHz */ 61 { .frequency = 280200, /* 280.2 MHz */},
62 { .frequency = CPUFREQ_TABLE_END, },
62}; 63};
63 64
64/* rounds up(!) */
65unsigned int sa11x0_freq_to_ppcr(unsigned int khz)
66{
67 int i;
68
69 khz /= 100;
70
71 for (i = 0; i < NR_FREQS; i++)
72 if (cclk_frequency_100khz[i] >= khz)
73 break;
74
75 return i;
76}
77
78unsigned int sa11x0_ppcr_to_freq(unsigned int idx)
79{
80 unsigned int freq = 0;
81 if (idx < NR_FREQS)
82 freq = cclk_frequency_100khz[idx] * 100;
83 return freq;
84}
85
86
87/* make sure that only the "userspace" governor is run -- anything else wouldn't make sense on
88 * this platform, anyway.
89 */
90int sa11x0_verify_speed(struct cpufreq_policy *policy)
91{
92 unsigned int tmp;
93 if (policy->cpu)
94 return -EINVAL;
95
96 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);
97
98 /* make sure that at least one frequency is within the policy */
99 tmp = cclk_frequency_100khz[sa11x0_freq_to_ppcr(policy->min)] * 100;
100 if (tmp > policy->max)
101 policy->max = tmp;
102
103 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);
104
105 return 0;
106}
107
108unsigned int sa11x0_getspeed(unsigned int cpu) 65unsigned int sa11x0_getspeed(unsigned int cpu)
109{ 66{
110 if (cpu) 67 if (cpu)
111 return 0; 68 return 0;
112 return cclk_frequency_100khz[PPCR & 0xf] * 100; 69 return sa11x0_freq_table[PPCR & 0xf].frequency;
113} 70}
114 71
115/* 72/*
diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h
index 9a33695c9492..0d92e119b36b 100644
--- a/arch/arm/mach-sa1100/generic.h
+++ b/arch/arm/mach-sa1100/generic.h
@@ -3,6 +3,7 @@
3 * 3 *
4 * Author: Nicolas Pitre 4 * Author: Nicolas Pitre
5 */ 5 */
6#include <linux/cpufreq.h>
6#include <linux/reboot.h> 7#include <linux/reboot.h>
7 8
8extern void sa1100_timer_init(void); 9extern void sa1100_timer_init(void);
@@ -19,12 +20,8 @@ extern void sa11x0_init_late(void);
19extern void sa1110_mb_enable(void); 20extern void sa1110_mb_enable(void);
20extern void sa1110_mb_disable(void); 21extern void sa1110_mb_disable(void);
21 22
22struct cpufreq_policy; 23extern struct cpufreq_frequency_table sa11x0_freq_table[];
23
24extern unsigned int sa11x0_freq_to_ppcr(unsigned int khz);
25extern int sa11x0_verify_speed(struct cpufreq_policy *policy);
26extern unsigned int sa11x0_getspeed(unsigned int cpu); 24extern unsigned int sa11x0_getspeed(unsigned int cpu);
27extern unsigned int sa11x0_ppcr_to_freq(unsigned int idx);
28 25
29struct flash_platform_data; 26struct flash_platform_data;
30struct resource; 27struct resource;
diff --git a/arch/arm/mach-sa1100/include/mach/gpio.h b/arch/arm/mach-sa1100/include/mach/gpio.h
deleted file mode 100644
index 6a9eecf3137e..000000000000
--- a/arch/arm/mach-sa1100/include/mach/gpio.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/gpio.h
3 *
4 * SA1100 GPIO wrappers for arch-neutral GPIO calls
5 *
6 * Written by Philipp Zabel <philipp.zabel@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#ifndef __ASM_ARCH_SA1100_GPIO_H
25#define __ASM_ARCH_SA1100_GPIO_H
26
27#include <linux/io.h>
28#include <mach/hardware.h>
29#include <asm/irq.h>
30#include <asm-generic/gpio.h>
31
32#define __ARM_GPIOLIB_COMPLEX
33
34static inline int gpio_get_value(unsigned gpio)
35{
36 if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
37 return GPLR & GPIO_GPIO(gpio);
38 else
39 return __gpio_get_value(gpio);
40}
41
42static inline void gpio_set_value(unsigned gpio, int value)
43{
44 if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
45 if (value)
46 GPSR = GPIO_GPIO(gpio);
47 else
48 GPCR = GPIO_GPIO(gpio);
49 else
50 __gpio_set_value(gpio, value);
51}
52
53#define gpio_cansleep __gpio_cansleep
54
55#endif
diff --git a/arch/arm/mach-sa1100/include/mach/h3xxx.h b/arch/arm/mach-sa1100/include/mach/h3xxx.h
index 7d9df16f04a2..c810620db53d 100644
--- a/arch/arm/mach-sa1100/include/mach/h3xxx.h
+++ b/arch/arm/mach-sa1100/include/mach/h3xxx.h
@@ -13,6 +13,8 @@
13#ifndef _INCLUDE_H3XXX_H_ 13#ifndef _INCLUDE_H3XXX_H_
14#define _INCLUDE_H3XXX_H_ 14#define _INCLUDE_H3XXX_H_
15 15
16#include "hardware.h" /* Gives GPIO_MAX */
17
16/* Physical memory regions corresponding to chip selects */ 18/* Physical memory regions corresponding to chip selects */
17#define H3600_EGPIO_PHYS (SA1100_CS5_PHYS + 0x01000000) 19#define H3600_EGPIO_PHYS (SA1100_CS5_PHYS + 0x01000000)
18#define H3600_BANK_2_PHYS SA1100_CS2_PHYS 20#define H3600_BANK_2_PHYS SA1100_CS2_PHYS
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c
index bcbc94540e45..41e476e571d7 100644
--- a/arch/arm/mach-sa1100/simpad.c
+++ b/arch/arm/mach-sa1100/simpad.c
@@ -19,6 +19,7 @@
19 19
20#include <mach/hardware.h> 20#include <mach/hardware.h>
21#include <asm/setup.h> 21#include <asm/setup.h>
22#include <asm/irq.h>
22 23
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-shark/Makefile b/arch/arm/mach-shark/Makefile
deleted file mode 100644
index 29657183c452..000000000000
--- a/arch/arm/mach-shark/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Object file lists.
6
7obj-y := core.o dma.o irq.o pci.o leds.o
8obj-m :=
9obj-n :=
10obj- :=
diff --git a/arch/arm/mach-shark/Makefile.boot b/arch/arm/mach-shark/Makefile.boot
deleted file mode 100644
index e40e24e4ca34..000000000000
--- a/arch/arm/mach-shark/Makefile.boot
+++ /dev/null
@@ -1,2 +0,0 @@
1 zreladdr-y += 0x08008000
2
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c
deleted file mode 100644
index 1d32c5e8eab6..000000000000
--- a/arch/arm/mach-shark/core.c
+++ /dev/null
@@ -1,146 +0,0 @@
1/*
2 * linux/arch/arm/mach-shark/arch.c
3 *
4 * Architecture specific stuff.
5 */
6#include <linux/kernel.h>
7#include <linux/init.h>
8#include <linux/interrupt.h>
9#include <linux/irq.h>
10#include <linux/sched.h>
11#include <linux/serial_8250.h>
12#include <linux/io.h>
13#include <linux/cpu.h>
14#include <linux/reboot.h>
15
16#include <asm/setup.h>
17#include <asm/mach-types.h>
18#include <asm/param.h>
19#include <asm/system_misc.h>
20
21#include <asm/mach/map.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/time.h>
24
25#define ROMCARD_SIZE 0x08000000
26#define ROMCARD_START 0x10000000
27
28static void shark_restart(enum reboot_mode mode, const char *cmd)
29{
30 short temp;
31 /* Reset the Machine via pc[3] of the sequoia chipset */
32 outw(0x09,0x24);
33 temp=inw(0x26);
34 temp = temp | (1<<3) | (1<<10);
35 outw(0x09,0x24);
36 outw(temp,0x26);
37}
38
39static struct plat_serial8250_port serial_platform_data[] = {
40 {
41 .iobase = 0x3f8,
42 .irq = 4,
43 .uartclk = 1843200,
44 .regshift = 0,
45 .iotype = UPIO_PORT,
46 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
47 },
48 {
49 .iobase = 0x2f8,
50 .irq = 3,
51 .uartclk = 1843200,
52 .regshift = 0,
53 .iotype = UPIO_PORT,
54 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
55 },
56 { },
57};
58
59static struct platform_device serial_device = {
60 .name = "serial8250",
61 .id = PLAT8250_DEV_PLATFORM,
62 .dev = {
63 .platform_data = serial_platform_data,
64 },
65};
66
67static struct resource rtc_resources[] = {
68 [0] = {
69 .start = 0x70,
70 .end = 0x73,
71 .flags = IORESOURCE_IO,
72 },
73 [1] = {
74 .start = IRQ_ISA_RTC_ALARM,
75 .end = IRQ_ISA_RTC_ALARM,
76 .flags = IORESOURCE_IRQ,
77 }
78};
79
80static struct platform_device rtc_device = {
81 .name = "rtc_cmos",
82 .id = -1,
83 .resource = rtc_resources,
84 .num_resources = ARRAY_SIZE(rtc_resources),
85};
86
87static int __init shark_init(void)
88{
89 int ret;
90
91 if (machine_is_shark())
92 {
93 ret = platform_device_register(&rtc_device);
94 if (ret) printk(KERN_ERR "Unable to register RTC device: %d\n", ret);
95 ret = platform_device_register(&serial_device);
96 if (ret) printk(KERN_ERR "Unable to register Serial device: %d\n", ret);
97 }
98 return 0;
99}
100
101arch_initcall(shark_init);
102
103extern void shark_init_irq(void);
104
105#define IRQ_TIMER 0
106#define HZ_TIME ((1193180 + HZ/2) / HZ)
107
108static irqreturn_t
109shark_timer_interrupt(int irq, void *dev_id)
110{
111 timer_tick();
112 return IRQ_HANDLED;
113}
114
115static struct irqaction shark_timer_irq = {
116 .name = "Shark Timer Tick",
117 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
118 .handler = shark_timer_interrupt,
119};
120
121/*
122 * Set up timer interrupt, and return the current time in seconds.
123 */
124static void __init shark_timer_init(void)
125{
126 outb(0x34, 0x43); /* binary, mode 0, LSB/MSB, Ch 0 */
127 outb(HZ_TIME & 0xff, 0x40); /* LSB of count */
128 outb(HZ_TIME >> 8, 0x40);
129
130 setup_irq(IRQ_TIMER, &shark_timer_irq);
131}
132
133static void shark_init_early(void)
134{
135 cpu_idle_poll_ctrl(true);
136}
137
138MACHINE_START(SHARK, "Shark")
139 /* Maintainer: Alexander Schulz */
140 .atag_offset = 0x3000,
141 .init_early = shark_init_early,
142 .init_irq = shark_init_irq,
143 .init_time = shark_timer_init,
144 .dma_zone_size = SZ_4M,
145 .restart = shark_restart,
146MACHINE_END
diff --git a/arch/arm/mach-shark/dma.c b/arch/arm/mach-shark/dma.c
deleted file mode 100644
index 10b5b8b3272a..000000000000
--- a/arch/arm/mach-shark/dma.c
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * linux/arch/arm/mach-shark/dma.c
3 *
4 * by Alexander Schulz
5 *
6 * derived from:
7 * arch/arm/kernel/dma-ebsa285.c
8 * Copyright (C) 1998 Phil Blundell
9 */
10
11#include <linux/init.h>
12
13#include <asm/dma.h>
14#include <asm/mach/dma.h>
15
16static int __init shark_dma_init(void)
17{
18#ifdef CONFIG_ISA_DMA
19 isa_init_dma();
20#endif
21 return 0;
22}
23core_initcall(shark_dma_init);
diff --git a/arch/arm/mach-shark/include/mach/debug-macro.S b/arch/arm/mach-shark/include/mach/debug-macro.S
deleted file mode 100644
index d129119a3f69..000000000000
--- a/arch/arm/mach-shark/include/mach/debug-macro.S
+++ /dev/null
@@ -1,34 +0,0 @@
1/* arch/arm/mach-shark/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14 .macro addruart, rp, rv, tmp
15 mov \rp, #0x3f8
16 orr \rv, \rp, #0xfe000000
17 orr \rv, \rv, #0x00e00000
18 orr \rp, \rp, #0x40000000
19 .endm
20
21 .macro senduart,rd,rx
22 strb \rd, [\rx]
23 .endm
24
25 .macro waituart,rd,rx
26 .endm
27
28 .macro busyuart,rd,rx
29 mov \rd, #0
301001: add \rd, \rd, #1
31 teq \rd, #0x10000
32 bne 1001b
33 .endm
34
diff --git a/arch/arm/mach-shark/include/mach/entry-macro.S b/arch/arm/mach-shark/include/mach/entry-macro.S
deleted file mode 100644
index c9e49f049532..000000000000
--- a/arch/arm/mach-shark/include/mach/entry-macro.S
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * arch/arm/mach-shark/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Shark platform
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 .macro get_irqnr_preamble, base, tmp
11 mov \base, #0xfe000000
12 orr \base, \base, #0x00e00000
13 .endm
14
15 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
16
17 mov \irqstat, #0x0C
18 strb \irqstat, [\base, #0x20] @outb(0x0C, 0x20) /* Poll command */
19 ldrb \irqnr, [\base, #0x20] @irq = inb(0x20) & 7
20 and \irqstat, \irqnr, #0x80
21 teq \irqstat, #0
22 beq 43f
23 and \irqnr, \irqnr, #7
24 teq \irqnr, #2
25 bne 44f
2643: mov \irqstat, #0x0C
27 strb \irqstat, [\base, #0xa0] @outb(0x0C, 0xA0) /* Poll command */
28 ldrb \irqnr, [\base, #0xa0] @irq = (inb(0xA0) & 7) + 8
29 and \irqstat, \irqnr, #0x80
30 teq \irqstat, #0
31 beq 44f
32 and \irqnr, \irqnr, #7
33 add \irqnr, \irqnr, #8
3444: teq \irqstat, #0
35 .endm
36
diff --git a/arch/arm/mach-shark/include/mach/framebuffer.h b/arch/arm/mach-shark/include/mach/framebuffer.h
deleted file mode 100644
index 84a5bf6e5ba3..000000000000
--- a/arch/arm/mach-shark/include/mach/framebuffer.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * arch/arm/mach-shark/include/mach/framebuffer.h
3 *
4 * by Alexander Schulz
5 *
6 */
7
8#ifndef __ASM_ARCH_FRAMEBUFFER_H
9#define __ASM_ARCH_FRAMEBUFFER_H
10
11/* defines for the Framebuffer */
12#define FB_START 0x06000000
13#define FB_SIZE 0x01000000
14
15#endif
16
diff --git a/arch/arm/mach-shark/include/mach/hardware.h b/arch/arm/mach-shark/include/mach/hardware.h
deleted file mode 100644
index 663f952a8ab3..000000000000
--- a/arch/arm/mach-shark/include/mach/hardware.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * arch/arm/mach-shark/include/mach/hardware.h
3 *
4 * by Alexander Schulz
5 *
6 * derived from:
7 * arch/arm/mach-ebsa110/include/mach/hardware.h
8 * Copyright (C) 1996-1999 Russell King.
9 */
10#ifndef __ASM_ARCH_HARDWARE_H
11#define __ASM_ARCH_HARDWARE_H
12
13#define UNCACHEABLE_ADDR 0xdf010000
14
15#endif
16
diff --git a/arch/arm/mach-shark/include/mach/irqs.h b/arch/arm/mach-shark/include/mach/irqs.h
deleted file mode 100644
index c8e8a4e1f61a..000000000000
--- a/arch/arm/mach-shark/include/mach/irqs.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * arch/arm/mach-shark/include/mach/irqs.h
3 *
4 * by Alexander Schulz
5 */
6
7#define NR_IRQS 16
8
9#define IRQ_ISA_KEYBOARD 1
10#define IRQ_ISA_RTC_ALARM 8
11#define I8042_KBD_IRQ 1
12#define I8042_AUX_IRQ 12
13#define IRQ_HARDDISK 14
diff --git a/arch/arm/mach-shark/include/mach/isa-dma.h b/arch/arm/mach-shark/include/mach/isa-dma.h
deleted file mode 100644
index 96c43b8f8dda..000000000000
--- a/arch/arm/mach-shark/include/mach/isa-dma.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * arch/arm/mach-shark/include/mach/isa-dma.h
3 *
4 * by Alexander Schulz
5 */
6#ifndef __ASM_ARCH_DMA_H
7#define __ASM_ARCH_DMA_H
8
9#define MAX_DMA_CHANNELS 8
10#define DMA_ISA_CASCADE 4
11
12#endif /* _ASM_ARCH_DMA_H */
13
diff --git a/arch/arm/mach-shark/include/mach/memory.h b/arch/arm/mach-shark/include/mach/memory.h
deleted file mode 100644
index 1cf8d6962617..000000000000
--- a/arch/arm/mach-shark/include/mach/memory.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * arch/arm/mach-shark/include/mach/memory.h
3 *
4 * by Alexander Schulz
5 *
6 * derived from:
7 * arch/arm/mach-ebsa110/include/mach/memory.h
8 * Copyright (c) 1996-1999 Russell King.
9 */
10#ifndef __ASM_ARCH_MEMORY_H
11#define __ASM_ARCH_MEMORY_H
12
13#include <asm/sizes.h>
14
15/*
16 * Physical DRAM offset.
17 */
18#define PLAT_PHYS_OFFSET UL(0x08000000)
19
20/*
21 * Cache flushing area
22 */
23#define FLUSH_BASE_PHYS 0x80000000
24#define FLUSH_BASE 0xdf000000
25
26#endif
diff --git a/arch/arm/mach-shark/include/mach/timex.h b/arch/arm/mach-shark/include/mach/timex.h
deleted file mode 100644
index bb6eeaebed86..000000000000
--- a/arch/arm/mach-shark/include/mach/timex.h
+++ /dev/null
@@ -1,7 +0,0 @@
1/*
2 * arch/arm/mach-shark/include/mach/timex.h
3 *
4 * by Alexander Schulz
5 */
6
7#define CLOCK_TICK_RATE 1193180
diff --git a/arch/arm/mach-shark/include/mach/uncompress.h b/arch/arm/mach-shark/include/mach/uncompress.h
deleted file mode 100644
index a168435aecc9..000000000000
--- a/arch/arm/mach-shark/include/mach/uncompress.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * arch/arm/mach-shark/include/mach/uncompress.h
3 * by Alexander Schulz
4 *
5 * derived from:
6 * arch/arm/mach-footbridge/include/mach/uncompress.h
7 * Copyright (C) 1996,1997,1998 Russell King
8 */
9
10#define SERIAL_BASE ((volatile unsigned char *)0x400003f8)
11
12static inline void putc(int c)
13{
14 volatile int t;
15
16 SERIAL_BASE[0] = c;
17 t=0x10000;
18 while (t--);
19}
20
21static inline void flush(void)
22{
23}
24
25#ifdef DEBUG
26static void putn(unsigned long z)
27{
28 int i;
29 char x;
30
31 putc('0');
32 putc('x');
33 for (i=0;i<8;i++) {
34 x='0'+((z>>((7-i)*4))&0xf);
35 if (x>'9') x=x-'0'+'A'-10;
36 putc(x);
37 }
38}
39
40static void putr()
41{
42 putc('\n');
43 putc('\r');
44}
45#endif
46
47/*
48 * nothing to do
49 */
50#define arch_decomp_setup()
diff --git a/arch/arm/mach-shark/irq.c b/arch/arm/mach-shark/irq.c
deleted file mode 100644
index 5dce13e429f3..000000000000
--- a/arch/arm/mach-shark/irq.c
+++ /dev/null
@@ -1,108 +0,0 @@
1/*
2 * linux/arch/arm/mach-shark/irq.c
3 *
4 * by Alexander Schulz
5 *
6 * derived from linux/arch/ppc/kernel/i8259.c and:
7 * arch/arm/mach-ebsa110/include/mach/irq.h
8 * Copyright (C) 1996-1998 Russell King
9 */
10
11#include <linux/init.h>
12#include <linux/fs.h>
13#include <linux/interrupt.h>
14#include <linux/io.h>
15
16#include <asm/irq.h>
17#include <asm/mach/irq.h>
18
19/*
20 * 8259A PIC functions to handle ISA devices:
21 */
22
23/*
24 * This contains the irq mask for both 8259A irq controllers,
25 * Let through the cascade-interrupt no. 2 (ff-(1<<2)==fb)
26 */
27static unsigned char cached_irq_mask[2] = { 0xfb, 0xff };
28
29/*
30 * These have to be protected by the irq controller spinlock
31 * before being called.
32 */
33static void shark_disable_8259A_irq(struct irq_data *d)
34{
35 unsigned int mask;
36 if (d->irq<8) {
37 mask = 1 << d->irq;
38 cached_irq_mask[0] |= mask;
39 outb(cached_irq_mask[1],0xA1);
40 } else {
41 mask = 1 << (d->irq-8);
42 cached_irq_mask[1] |= mask;
43 outb(cached_irq_mask[0],0x21);
44 }
45}
46
47static void shark_enable_8259A_irq(struct irq_data *d)
48{
49 unsigned int mask;
50 if (d->irq<8) {
51 mask = ~(1 << d->irq);
52 cached_irq_mask[0] &= mask;
53 outb(cached_irq_mask[0],0x21);
54 } else {
55 mask = ~(1 << (d->irq-8));
56 cached_irq_mask[1] &= mask;
57 outb(cached_irq_mask[1],0xA1);
58 }
59}
60
61static void shark_ack_8259A_irq(struct irq_data *d){}
62
63static irqreturn_t bogus_int(int irq, void *dev_id)
64{
65 printk("Got interrupt %i!\n",irq);
66 return IRQ_NONE;
67}
68
69static struct irqaction cascade;
70
71static struct irq_chip fb_chip = {
72 .name = "XT-PIC",
73 .irq_ack = shark_ack_8259A_irq,
74 .irq_mask = shark_disable_8259A_irq,
75 .irq_unmask = shark_enable_8259A_irq,
76};
77
78void __init shark_init_irq(void)
79{
80 int irq;
81
82 for (irq = 0; irq < NR_IRQS; irq++) {
83 irq_set_chip_and_handler(irq, &fb_chip, handle_edge_irq);
84 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
85 }
86
87 /* init master interrupt controller */
88 outb(0x11, 0x20); /* Start init sequence, edge triggered (level: 0x19)*/
89 outb(0x00, 0x21); /* Vector base */
90 outb(0x04, 0x21); /* Cascade (slave) on IRQ2 */
91 outb(0x03, 0x21); /* Select 8086 mode , auto eoi*/
92 outb(0x0A, 0x20);
93 /* init slave interrupt controller */
94 outb(0x11, 0xA0); /* Start init sequence, edge triggered */
95 outb(0x08, 0xA1); /* Vector base */
96 outb(0x02, 0xA1); /* Cascade (slave) on IRQ2 */
97 outb(0x03, 0xA1); /* Select 8086 mode, auto eoi */
98 outb(0x0A, 0xA0);
99 outb(cached_irq_mask[1],0xA1);
100 outb(cached_irq_mask[0],0x21);
101 //request_region(0x20,0x2,"pic1");
102 //request_region(0xA0,0x2,"pic2");
103
104 cascade.handler = bogus_int;
105 cascade.name = "cascade";
106 setup_irq(2,&cascade);
107}
108
diff --git a/arch/arm/mach-shark/leds.c b/arch/arm/mach-shark/leds.c
deleted file mode 100644
index 081c778a10ac..000000000000
--- a/arch/arm/mach-shark/leds.c
+++ /dev/null
@@ -1,117 +0,0 @@
1/*
2 * DIGITAL Shark LED control routines.
3 *
4 * Driver for the 3 user LEDs found on the Shark
5 * Based on Versatile and RealView machine LED code
6 *
7 * License terms: GNU General Public License (GPL) version 2
8 * Author: Bryan Wu <bryan.wu@canonical.com>
9 */
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/io.h>
13#include <linux/ioport.h>
14#include <linux/slab.h>
15#include <linux/leds.h>
16
17#include <asm/mach-types.h>
18
19#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
20struct shark_led {
21 struct led_classdev cdev;
22 u8 mask;
23};
24
25/*
26 * The triggers lines up below will only be used if the
27 * LED triggers are compiled in.
28 */
29static const struct {
30 const char *name;
31 const char *trigger;
32} shark_leds[] = {
33 { "shark:amber0", "default-on", }, /* Bit 5 */
34 { "shark:green", "heartbeat", }, /* Bit 6 */
35 { "shark:amber1", "cpu0" }, /* Bit 7 */
36};
37
38static u16 led_reg_read(void)
39{
40 outw(0x09, 0x24);
41 return inw(0x26);
42}
43
44static void led_reg_write(u16 value)
45{
46 outw(0x09, 0x24);
47 outw(value, 0x26);
48}
49
50static void shark_led_set(struct led_classdev *cdev,
51 enum led_brightness b)
52{
53 struct shark_led *led = container_of(cdev,
54 struct shark_led, cdev);
55 u16 reg = led_reg_read();
56
57 if (b != LED_OFF)
58 reg |= led->mask;
59 else
60 reg &= ~led->mask;
61
62 led_reg_write(reg);
63}
64
65static enum led_brightness shark_led_get(struct led_classdev *cdev)
66{
67 struct shark_led *led = container_of(cdev,
68 struct shark_led, cdev);
69 u16 reg = led_reg_read();
70
71 return (reg & led->mask) ? LED_FULL : LED_OFF;
72}
73
74static int __init shark_leds_init(void)
75{
76 int i;
77 u16 reg;
78
79 if (!machine_is_shark())
80 return -ENODEV;
81
82 for (i = 0; i < ARRAY_SIZE(shark_leds); i++) {
83 struct shark_led *led;
84
85 led = kzalloc(sizeof(*led), GFP_KERNEL);
86 if (!led)
87 break;
88
89 led->cdev.name = shark_leds[i].name;
90 led->cdev.brightness_set = shark_led_set;
91 led->cdev.brightness_get = shark_led_get;
92 led->cdev.default_trigger = shark_leds[i].trigger;
93
94 /* Count in 5 bits offset */
95 led->mask = BIT(i + 5);
96
97 if (led_classdev_register(NULL, &led->cdev) < 0) {
98 kfree(led);
99 break;
100 }
101 }
102
103 /* Make LEDs independent of power-state */
104 request_region(0x24, 4, "led_reg");
105 reg = led_reg_read();
106 reg |= 1 << 10;
107 led_reg_write(reg);
108
109 return 0;
110}
111
112/*
113 * Since we may have triggers on any subsystem, defer registration
114 * until after subsystem_init.
115 */
116fs_initcall(shark_leds_init);
117#endif
diff --git a/arch/arm/mach-shark/pci.c b/arch/arm/mach-shark/pci.c
deleted file mode 100644
index 6d91a914c1dd..000000000000
--- a/arch/arm/mach-shark/pci.c
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * linux/arch/arm/mach-shark/pci.c
3 *
4 * PCI bios-type initialisation for PCI machines
5 *
6 * Bits taken from various places.
7 */
8#include <linux/kernel.h>
9#include <linux/pci.h>
10#include <linux/init.h>
11#include <linux/io.h>
12#include <video/vga.h>
13
14#include <asm/irq.h>
15#include <asm/mach/pci.h>
16#include <asm/mach-types.h>
17
18#define IO_START 0x40000000
19
20static int __init shark_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
21{
22 if (dev->bus->number == 0)
23 if (dev->devfn == 0)
24 return 255;
25 else
26 return 11;
27 else
28 return 255;
29}
30
31extern void __init via82c505_preinit(void);
32
33static struct hw_pci shark_pci __initdata = {
34 .setup = via82c505_setup,
35 .map_irq = shark_map_irq,
36 .nr_controllers = 1,
37 .ops = &via82c505_ops,
38 .preinit = via82c505_preinit,
39};
40
41static int __init shark_pci_init(void)
42{
43 if (!machine_is_shark())
44 return -ENODEV;
45
46 pcibios_min_io = 0x6000;
47 pcibios_min_mem = 0x50000000;
48 vga_base = 0xe8000000;
49
50 pci_ioremap_io(0, IO_START);
51
52 pci_common_init(&shark_pci);
53
54 return 0;
55}
56
57subsys_initcall(shark_pci_init);
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 1f94c310c477..a4a4b75109b2 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -22,16 +22,10 @@ config ARCH_EMEV2
22 22
23comment "SH-Mobile Board Type" 23comment "SH-Mobile Board Type"
24 24
25config MACH_KZM9D_REFERENCE 25config MACH_KZM9D
26 bool "KZM9D board - Reference Device Tree Implementation" 26 bool "KZM9D board"
27 depends on ARCH_EMEV2 27 depends on ARCH_EMEV2
28 select REGULATOR_FIXED_VOLTAGE if REGULATOR 28 select REGULATOR_FIXED_VOLTAGE if REGULATOR
29 ---help---
30 Use reference implementation of KZM9D board support
31 which makes a greater use of device tree at the expense
32 of not supporting a number of devices.
33
34 This is intended to aid developers
35 29
36comment "SH-Mobile System Configuration" 30comment "SH-Mobile System Configuration"
37endif 31endif
@@ -101,12 +95,24 @@ config ARCH_R8A7790
101 select SH_CLK_CPG 95 select SH_CLK_CPG
102 select RENESAS_IRQC 96 select RENESAS_IRQC
103 97
98config ARCH_R8A7791
99 bool "R-Car M2 (R8A77910)"
100 select ARM_GIC
101 select CPU_V7
102 select SH_CLK_CPG
103
104config ARCH_EMEV2 104config ARCH_EMEV2
105 bool "Emma Mobile EV2" 105 bool "Emma Mobile EV2"
106 select ARCH_WANT_OPTIONAL_GPIOLIB 106 select ARCH_WANT_OPTIONAL_GPIOLIB
107 select ARM_GIC 107 select ARM_GIC
108 select CPU_V7 108 select CPU_V7
109 109
110config ARCH_R7S72100
111 bool "RZ/A1H (R7S72100)"
112 select ARM_GIC
113 select CPU_V7
114 select SH_CLK_CPG
115
110comment "SH-Mobile Board Type" 116comment "SH-Mobile Board Type"
111 117
112config MACH_APE6EVM 118config MACH_APE6EVM
@@ -162,6 +168,8 @@ config MACH_BOCKW
162 select RENESAS_INTC_IRQPIN 168 select RENESAS_INTC_IRQPIN
163 select REGULATOR_FIXED_VOLTAGE if REGULATOR 169 select REGULATOR_FIXED_VOLTAGE if REGULATOR
164 select USE_OF 170 select USE_OF
171 select SND_SOC_AK4554 if SND_SIMPLE_CARD
172 select SND_SOC_AK4642 if SND_SIMPLE_CARD
165 173
166config MACH_BOCKW_REFERENCE 174config MACH_BOCKW_REFERENCE
167 bool "BOCK-W - Reference Device Tree Implementation" 175 bool "BOCK-W - Reference Device Tree Implementation"
@@ -177,6 +185,11 @@ config MACH_BOCKW_REFERENCE
177 185
178 This is intended to aid developers 186 This is intended to aid developers
179 187
188config MACH_GENMAI
189 bool "Genmai board"
190 depends on ARCH_R7S72100
191 select USE_OF
192
180config MACH_MARZEN 193config MACH_MARZEN
181 bool "MARZEN board" 194 bool "MARZEN board"
182 depends on ARCH_R8A7779 195 depends on ARCH_R8A7779
@@ -213,23 +226,16 @@ config MACH_LAGER_REFERENCE
213 226
214 This is intended to aid developers 227 This is intended to aid developers
215 228
216config MACH_KZM9D 229config MACH_KOELSCH
217 bool "KZM9D board" 230 bool "Koelsch board"
218 depends on ARCH_EMEV2 231 depends on ARCH_R8A7791
219 select REGULATOR_FIXED_VOLTAGE if REGULATOR
220 select USE_OF 232 select USE_OF
221 233
222config MACH_KZM9D_REFERENCE 234config MACH_KZM9D
223 bool "KZM9D board - Reference Device Tree Implementation" 235 bool "KZM9D board"
224 depends on ARCH_EMEV2 236 depends on ARCH_EMEV2
225 select REGULATOR_FIXED_VOLTAGE if REGULATOR 237 select REGULATOR_FIXED_VOLTAGE if REGULATOR
226 select USE_OF 238 select USE_OF
227 ---help---
228 Use reference implementation of KZM9D board support
229 which makes a greater use of device tree at the expense
230 of not supporting a number of devices.
231
232 This is intended to aid developers
233 239
234config MACH_KZM9G 240config MACH_KZM9G
235 bool "KZM-A9-GT board" 241 bool "KZM-A9-GT board"
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 2705bfa8c113..51db2bcafabf 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -15,7 +15,10 @@ obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o
15obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o 15obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o
16obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o 16obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o
17obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o 17obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o
18obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o setup-rcar-gen2.o
19obj-$(CONFIG_ARCH_R8A7791) += setup-r8a7791.o setup-rcar-gen2.o
18obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o 20obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o
21obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o
19 22
20# Clock objects 23# Clock objects
21ifndef CONFIG_COMMON_CLK 24ifndef CONFIG_COMMON_CLK
@@ -27,13 +30,17 @@ obj-$(CONFIG_ARCH_R8A7740) += clock-r8a7740.o
27obj-$(CONFIG_ARCH_R8A7778) += clock-r8a7778.o 30obj-$(CONFIG_ARCH_R8A7778) += clock-r8a7778.o
28obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o 31obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o
29obj-$(CONFIG_ARCH_R8A7790) += clock-r8a7790.o 32obj-$(CONFIG_ARCH_R8A7790) += clock-r8a7790.o
33obj-$(CONFIG_ARCH_R8A7791) += clock-r8a7791.o
30obj-$(CONFIG_ARCH_EMEV2) += clock-emev2.o 34obj-$(CONFIG_ARCH_EMEV2) += clock-emev2.o
35obj-$(CONFIG_ARCH_R7S72100) += clock-r7s72100.o
31endif 36endif
32 37
33# SMP objects 38# SMP objects
34smp-y := platsmp.o headsmp.o 39smp-y := platsmp.o headsmp.o
35smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o platsmp-scu.o 40smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o platsmp-scu.o
36smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o platsmp-scu.o 41smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o platsmp-scu.o
42smp-$(CONFIG_ARCH_R8A7790) += smp-r8a7790.o platsmp-apmu.o
43smp-$(CONFIG_ARCH_R8A7791) += smp-r8a7791.o platsmp-apmu.o
37smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o platsmp-scu.o 44smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o platsmp-scu.o
38 45
39# IRQ objects 46# IRQ objects
@@ -48,21 +55,26 @@ obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o pm-rmobile.o
48obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o 55obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o
49 56
50# Board objects 57# Board objects
58ifdef CONFIG_ARCH_SHMOBILE_MULTI
59obj-$(CONFIG_MACH_KZM9D) += board-kzm9d-reference.o
60else
51obj-$(CONFIG_MACH_APE6EVM) += board-ape6evm.o 61obj-$(CONFIG_MACH_APE6EVM) += board-ape6evm.o
52obj-$(CONFIG_MACH_APE6EVM_REFERENCE) += board-ape6evm-reference.o 62obj-$(CONFIG_MACH_APE6EVM_REFERENCE) += board-ape6evm-reference.o
53obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o 63obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o
54obj-$(CONFIG_MACH_BOCKW) += board-bockw.o 64obj-$(CONFIG_MACH_BOCKW) += board-bockw.o
55obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o 65obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o
66obj-$(CONFIG_MACH_GENMAI) += board-genmai.o
56obj-$(CONFIG_MACH_MARZEN) += board-marzen.o 67obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
57obj-$(CONFIG_MACH_MARZEN_REFERENCE) += board-marzen-reference.o 68obj-$(CONFIG_MACH_MARZEN_REFERENCE) += board-marzen-reference.o
58obj-$(CONFIG_MACH_LAGER) += board-lager.o 69obj-$(CONFIG_MACH_LAGER) += board-lager.o
59obj-$(CONFIG_MACH_LAGER_REFERENCE) += board-lager-reference.o 70obj-$(CONFIG_MACH_LAGER_REFERENCE) += board-lager-reference.o
60obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o 71obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
61obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += board-armadillo800eva-reference.o 72obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += board-armadillo800eva-reference.o
73obj-$(CONFIG_MACH_KOELSCH) += board-koelsch.o
62obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o 74obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o
63obj-$(CONFIG_MACH_KZM9D_REFERENCE) += board-kzm9d-reference.o
64obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o 75obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o
65obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o 76obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o
77endif
66 78
67# Framework support 79# Framework support
68obj-$(CONFIG_SMP) += $(smp-y) 80obj-$(CONFIG_SMP) += $(smp-y)
diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
index 6a504fe7d86c..391d72a5536c 100644
--- a/arch/arm/mach-shmobile/Makefile.boot
+++ b/arch/arm/mach-shmobile/Makefile.boot
@@ -6,8 +6,9 @@ loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000
6loadaddr-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += 0x40008000 6loadaddr-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += 0x40008000
7loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000 7loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
8loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000 8loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000
9loadaddr-$(CONFIG_MACH_GENMAI) += 0x8008000
10loadaddr-$(CONFIG_MACH_KOELSCH) += 0x40008000
9loadaddr-$(CONFIG_MACH_KZM9D) += 0x40008000 11loadaddr-$(CONFIG_MACH_KZM9D) += 0x40008000
10loadaddr-$(CONFIG_MACH_KZM9D_REFERENCE) += 0x40008000
11loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000 12loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000
12loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000 13loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
13loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000 14loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000
diff --git a/arch/arm/mach-shmobile/board-ape6evm-reference.c b/arch/arm/mach-shmobile/board-ape6evm-reference.c
index a23fa714f7ac..3276afcf3cc9 100644
--- a/arch/arm/mach-shmobile/board-ape6evm-reference.c
+++ b/arch/arm/mach-shmobile/board-ape6evm-reference.c
@@ -57,7 +57,7 @@ static const char *ape6evm_boards_compat_dt[] __initdata = {
57}; 57};
58 58
59DT_MACHINE_START(APE6EVM_DT, "ape6evm") 59DT_MACHINE_START(APE6EVM_DT, "ape6evm")
60 .init_early = r8a73a4_init_delay, 60 .init_early = r8a73a4_init_early,
61 .init_machine = ape6evm_add_standard_devices, 61 .init_machine = ape6evm_add_standard_devices,
62 .dt_compat = ape6evm_boards_compat_dt, 62 .dt_compat = ape6evm_boards_compat_dt,
63MACHINE_END 63MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c
index 24b87eea9da3..0fa068e30a30 100644
--- a/arch/arm/mach-shmobile/board-ape6evm.c
+++ b/arch/arm/mach-shmobile/board-ape6evm.c
@@ -86,7 +86,7 @@ static struct gpio_keys_button gpio_buttons[] = {
86 GPIO_KEY(KEY_VOLUMEDOWN, 329, "S21"), 86 GPIO_KEY(KEY_VOLUMEDOWN, 329, "S21"),
87}; 87};
88 88
89static struct __initdata gpio_keys_platform_data ape6evm_keys_pdata = { 89static struct gpio_keys_platform_data ape6evm_keys_pdata __initdata = {
90 .buttons = gpio_buttons, 90 .buttons = gpio_buttons,
91 .nbuttons = ARRAY_SIZE(gpio_buttons), 91 .nbuttons = ARRAY_SIZE(gpio_buttons),
92}; 92};
@@ -113,22 +113,58 @@ static const struct smsc911x_platform_config lan9220_data __initconst = {
113}; 113};
114 114
115/* 115/*
116 * On APE6EVM power is supplied to MMCIF by a tps80032 regulator. For now we 116 * MMC0 power supplies:
117 * model a VDD supply to MMCIF, using a fixed 3.3V regulator. Also use the 117 * Both Vcc and VccQ to eMMC on APE6EVM are supplied by a tps80032 voltage
118 * static power supply for SDHI0 and SDHI1, whereas SDHI0's VccQ is also 118 * regulator. Until support for it is added to this file we simulate the
119 * supplied by the same tps80032 regulator and thus can also be adjusted 119 * Vcc supply by a fixed always-on regulator
120 * dynamically.
121 */ 120 */
122static struct regulator_consumer_supply fixed3v3_power_consumers[] = 121static struct regulator_consumer_supply vcc_mmc0_consumers[] =
123{ 122{
124 REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"), 123 REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
124};
125
126/*
127 * SDHI0 power supplies:
128 * Vcc to SDHI0 on APE6EVM is supplied by a GPIO-switchable regulator. VccQ is
129 * provided by the same tps80032 regulator as both MMC0 voltages - see comment
130 * above
131 */
132static struct regulator_consumer_supply vcc_sdhi0_consumers[] =
133{
125 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), 134 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
135};
136
137static struct regulator_init_data vcc_sdhi0_init_data = {
138 .constraints = {
139 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
140 },
141 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi0_consumers),
142 .consumer_supplies = vcc_sdhi0_consumers,
143};
144
145static const struct fixed_voltage_config vcc_sdhi0_info __initconst = {
146 .supply_name = "SDHI0 Vcc",
147 .microvolts = 3300000,
148 .gpio = 76,
149 .enable_high = 1,
150 .init_data = &vcc_sdhi0_init_data,
151};
152
153/*
154 * SDHI1 power supplies:
155 * Vcc and VccQ to SDHI1 on APE6EVM are both fixed at 3.3V
156 */
157static struct regulator_consumer_supply vcc_sdhi1_consumers[] =
158{
126 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"), 159 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
127}; 160};
128 161
129/* MMCIF */ 162/* MMCIF */
130static const struct sh_mmcif_plat_data mmcif0_pdata __initconst = { 163static const struct sh_mmcif_plat_data mmcif0_pdata __initconst = {
131 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, 164 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
165 .slave_id_tx = SHDMA_SLAVE_MMCIF0_TX,
166 .slave_id_rx = SHDMA_SLAVE_MMCIF0_RX,
167 .ccs_unsupported = true,
132}; 168};
133 169
134static const struct resource mmcif0_resources[] __initconst = { 170static const struct resource mmcif0_resources[] __initconst = {
@@ -215,14 +251,19 @@ static void __init ape6evm_add_standard_devices(void)
215 platform_device_register_resndata(&platform_bus, "smsc911x", -1, 251 platform_device_register_resndata(&platform_bus, "smsc911x", -1,
216 lan9220_res, ARRAY_SIZE(lan9220_res), 252 lan9220_res, ARRAY_SIZE(lan9220_res),
217 &lan9220_data, sizeof(lan9220_data)); 253 &lan9220_data, sizeof(lan9220_data));
218 regulator_register_always_on(1, "fixed-3.3V", fixed3v3_power_consumers, 254
219 ARRAY_SIZE(fixed3v3_power_consumers), 3300000); 255 regulator_register_always_on(1, "MMC0 Vcc", vcc_mmc0_consumers,
256 ARRAY_SIZE(vcc_mmc0_consumers), 2800000);
220 platform_device_register_resndata(&platform_bus, "sh_mmcif", 0, 257 platform_device_register_resndata(&platform_bus, "sh_mmcif", 0,
221 mmcif0_resources, ARRAY_SIZE(mmcif0_resources), 258 mmcif0_resources, ARRAY_SIZE(mmcif0_resources),
222 &mmcif0_pdata, sizeof(mmcif0_pdata)); 259 &mmcif0_pdata, sizeof(mmcif0_pdata));
260 platform_device_register_data(&platform_bus, "reg-fixed-voltage", 2,
261 &vcc_sdhi0_info, sizeof(vcc_sdhi0_info));
223 platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0, 262 platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0,
224 sdhi0_resources, ARRAY_SIZE(sdhi0_resources), 263 sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
225 &sdhi0_pdata, sizeof(sdhi0_pdata)); 264 &sdhi0_pdata, sizeof(sdhi0_pdata));
265 regulator_register_always_on(3, "SDHI1 Vcc", vcc_sdhi1_consumers,
266 ARRAY_SIZE(vcc_sdhi1_consumers), 3300000);
226 platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 1, 267 platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 1,
227 sdhi1_resources, ARRAY_SIZE(sdhi1_resources), 268 sdhi1_resources, ARRAY_SIZE(sdhi1_resources),
228 &sdhi1_pdata, sizeof(sdhi1_pdata)); 269 &sdhi1_pdata, sizeof(sdhi1_pdata));
@@ -240,7 +281,7 @@ static const char *ape6evm_boards_compat_dt[] __initdata = {
240}; 281};
241 282
242DT_MACHINE_START(APE6EVM_DT, "ape6evm") 283DT_MACHINE_START(APE6EVM_DT, "ape6evm")
243 .init_early = r8a73a4_init_delay, 284 .init_early = r8a73a4_init_early,
244 .init_machine = ape6evm_add_standard_devices, 285 .init_machine = ape6evm_add_standard_devices,
245 .dt_compat = ape6evm_boards_compat_dt, 286 .dt_compat = ape6evm_boards_compat_dt,
246MACHINE_END 287MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 5bd1479d3deb..8bc8e4c58847 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -823,6 +823,7 @@ static struct sh_mmcif_plat_data sh_mmcif_plat = {
823 .caps = MMC_CAP_4_BIT_DATA | 823 .caps = MMC_CAP_4_BIT_DATA |
824 MMC_CAP_8_BIT_DATA | 824 MMC_CAP_8_BIT_DATA |
825 MMC_CAP_NONREMOVABLE, 825 MMC_CAP_NONREMOVABLE,
826 .ccs_unsupported = true,
826 .slave_id_tx = SHDMA_SLAVE_MMCIF_TX, 827 .slave_id_tx = SHDMA_SLAVE_MMCIF_TX,
827 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, 828 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
828}; 829};
@@ -1108,9 +1109,9 @@ static const struct pinctrl_map eva_pinctrl_map[] = {
1108 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.1", "pfc-r8a7740", 1109 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.1", "pfc-r8a7740",
1109 "fsib_mclk_in", "fsib"), 1110 "fsib_mclk_in", "fsib"),
1110 /* GETHER */ 1111 /* GETHER */
1111 PIN_MAP_MUX_GROUP_DEFAULT("sh-eth", "pfc-r8a7740", 1112 PIN_MAP_MUX_GROUP_DEFAULT("r8a7740-gether", "pfc-r8a7740",
1112 "gether_mii", "gether"), 1113 "gether_mii", "gether"),
1113 PIN_MAP_MUX_GROUP_DEFAULT("sh-eth", "pfc-r8a7740", 1114 PIN_MAP_MUX_GROUP_DEFAULT("r8a7740-gether", "pfc-r8a7740",
1114 "gether_int", "gether"), 1115 "gether_int", "gether"),
1115 /* HDMI */ 1116 /* HDMI */
1116 PIN_MAP_MUX_GROUP_DEFAULT("sh-mobile-hdmi", "pfc-r8a7740", 1117 PIN_MAP_MUX_GROUP_DEFAULT("sh-mobile-hdmi", "pfc-r8a7740",
diff --git a/arch/arm/mach-shmobile/board-bockw-reference.c b/arch/arm/mach-shmobile/board-bockw-reference.c
index 1a7c893e1a52..ae88fdad4b3a 100644
--- a/arch/arm/mach-shmobile/board-bockw-reference.c
+++ b/arch/arm/mach-shmobile/board-bockw-reference.c
@@ -36,15 +36,35 @@ static const struct pinctrl_map bockw_pinctrl_map[] = {
36 "scif0_ctrl", "scif0"), 36 "scif0_ctrl", "scif0"),
37}; 37};
38 38
39#define FPGA 0x18200000
40#define IRQ0MR 0x30
41#define COMCTLR 0x101c
39static void __init bockw_init(void) 42static void __init bockw_init(void)
40{ 43{
44 static void __iomem *fpga;
45
41 r8a7778_clock_init(); 46 r8a7778_clock_init();
47 r8a7778_init_irq_extpin_dt(1);
42 48
43 pinctrl_register_mappings(bockw_pinctrl_map, 49 pinctrl_register_mappings(bockw_pinctrl_map,
44 ARRAY_SIZE(bockw_pinctrl_map)); 50 ARRAY_SIZE(bockw_pinctrl_map));
45 r8a7778_pinmux_init(); 51 r8a7778_pinmux_init();
46 r8a7778_add_dt_devices(); 52 r8a7778_add_dt_devices();
47 53
54 fpga = ioremap_nocache(FPGA, SZ_1M);
55 if (fpga) {
56 /*
57 * CAUTION
58 *
59 * IRQ0/1 is cascaded interrupt from FPGA.
60 * it should be cared in the future
61 * Now, it is assuming IRQ0 was used only from SMSC.
62 */
63 u16 val = ioread16(fpga + IRQ0MR);
64 val &= ~(1 << 4); /* enable SMSC911x */
65 iowrite16(val, fpga + IRQ0MR);
66 }
67
48 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 68 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
49} 69}
50 70
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index 6b9faf3908f7..38611526fe9a 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -32,11 +32,19 @@
32#include <linux/smsc911x.h> 32#include <linux/smsc911x.h>
33#include <linux/spi/spi.h> 33#include <linux/spi/spi.h>
34#include <linux/spi/flash.h> 34#include <linux/spi/flash.h>
35#include <linux/usb/renesas_usbhs.h>
35#include <media/soc_camera.h> 36#include <media/soc_camera.h>
36#include <mach/common.h> 37#include <mach/common.h>
37#include <mach/irqs.h> 38#include <mach/irqs.h>
38#include <mach/r8a7778.h> 39#include <mach/r8a7778.h>
39#include <asm/mach/arch.h> 40#include <asm/mach/arch.h>
41#include <sound/rcar_snd.h>
42#include <sound/simple_card.h>
43
44#define FPGA 0x18200000
45#define IRQ0MR 0x30
46#define COMCTLR 0x101c
47static void __iomem *fpga;
40 48
41/* 49/*
42 * CN9(Upper side) SCIF/RCAN selection 50 * CN9(Upper side) SCIF/RCAN selection
@@ -63,6 +71,45 @@
63 * SW19 (MMC) 1 pin 71 * SW19 (MMC) 1 pin
64 */ 72 */
65 73
74/*
75 * SSI settings
76 *
77 * SW45: 1-4 side (SSI5 out, ROUT/LOUT CN19 Mid)
78 * SW46: 1101 (SSI6 Recorde)
79 * SW47: 1110 (SSI5 Playback)
80 * SW48: 11 (Recorde power)
81 * SW49: 1 (SSI slave mode)
82 * SW50: 1111 (SSI7, SSI8)
83 * SW51: 1111 (SSI3, SSI4)
84 * SW54: 1pin (ak4554 FPGA control)
85 * SW55: 1 (CLKB is 24.5760MHz)
86 * SW60: 1pin (ak4554 FPGA control)
87 * SW61: 3pin (use X11 clock)
88 * SW78: 3-6 (ak4642 connects I2C0)
89 *
90 * You can use sound as
91 *
92 * hw0: CN19: SSI56-AK4643
93 * hw1: CN21: SSI3-AK4554(playback)
94 * hw2: CN21: SSI4-AK4554(capture)
95 * hw3: CN20: SSI7-AK4554(playback)
96 * hw4: CN20: SSI8-AK4554(capture)
97 *
98 * this command is required when playback on hw0.
99 *
100 * # amixer set "LINEOUT Mixer DACL" on
101 */
102
103/*
104 * USB
105 *
106 * USB1 (CN29) can be Host/Function
107 *
108 * Host Func
109 * SW98 1 2
110 * SW99 1 3
111 */
112
66/* Dummy supplies, where voltage doesn't matter */ 113/* Dummy supplies, where voltage doesn't matter */
67static struct regulator_consumer_supply dummy_supplies[] = { 114static struct regulator_consumer_supply dummy_supplies[] = {
68 REGULATOR_SUPPLY("vddvario", "smsc911x"), 115 REGULATOR_SUPPLY("vddvario", "smsc911x"),
@@ -81,16 +128,76 @@ static struct resource smsc911x_resources[] __initdata = {
81 DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */ 128 DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
82}; 129};
83 130
131#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
132/*
133 * When USB1 is Func
134 */
135static int usbhsf_get_id(struct platform_device *pdev)
136{
137 return USBHS_GADGET;
138}
139
140#define SUSPMODE 0x102
141static int usbhsf_power_ctrl(struct platform_device *pdev,
142 void __iomem *base, int enable)
143{
144 enable = !!enable;
145
146 r8a7778_usb_phy_power(enable);
147
148 iowrite16(enable << 14, base + SUSPMODE);
149
150 return 0;
151}
152
153static struct resource usbhsf_resources[] __initdata = {
154 DEFINE_RES_MEM(0xffe60000, 0x110),
155 DEFINE_RES_IRQ(gic_iid(0x4f)),
156};
157
158static struct renesas_usbhs_platform_info usbhs_info __initdata = {
159 .platform_callback = {
160 .get_id = usbhsf_get_id,
161 .power_ctrl = usbhsf_power_ctrl,
162 },
163 .driver_param = {
164 .buswait_bwait = 4,
165 },
166};
167
168#define USB_PHY_SETTING {.port1_func = 1, .ovc_pin[1].active_high = 1,}
169#define USB1_DEVICE "renesas_usbhs"
170#define ADD_USB_FUNC_DEVICE_IF_POSSIBLE() \
171 platform_device_register_resndata( \
172 &platform_bus, "renesas_usbhs", -1, \
173 usbhsf_resources, \
174 ARRAY_SIZE(usbhsf_resources), \
175 &usbhs_info, sizeof(struct renesas_usbhs_platform_info))
176
177#else
178/*
179 * When USB1 is Host
180 */
181#define USB_PHY_SETTING { }
182#define USB1_DEVICE "ehci-platform"
183#define ADD_USB_FUNC_DEVICE_IF_POSSIBLE()
184
185#endif
186
84/* USB */ 187/* USB */
85static struct resource usb_phy_resources[] __initdata = { 188static struct resource usb_phy_resources[] __initdata = {
86 DEFINE_RES_MEM(0xffe70800, 0x100), 189 DEFINE_RES_MEM(0xffe70800, 0x100),
87 DEFINE_RES_MEM(0xffe76000, 0x100), 190 DEFINE_RES_MEM(0xffe76000, 0x100),
88}; 191};
89 192
90static struct rcar_phy_platform_data usb_phy_platform_data __initdata; 193static struct rcar_phy_platform_data usb_phy_platform_data __initdata =
194 USB_PHY_SETTING;
195
91 196
92/* SDHI */ 197/* SDHI */
93static struct sh_mobile_sdhi_info sdhi0_info __initdata = { 198static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
199 .dma_slave_tx = HPBDMA_SLAVE_SDHI0_TX,
200 .dma_slave_rx = HPBDMA_SLAVE_SDHI0_RX,
94 .tmio_caps = MMC_CAP_SD_HIGHSPEED, 201 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
95 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, 202 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
96 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, 203 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
@@ -101,6 +208,12 @@ static struct resource sdhi0_resources[] __initdata = {
101 DEFINE_RES_IRQ(gic_iid(0x77)), 208 DEFINE_RES_IRQ(gic_iid(0x77)),
102}; 209};
103 210
211/* Ether */
212static struct resource ether_resources[] __initdata = {
213 DEFINE_RES_MEM(0xfde00000, 0x400),
214 DEFINE_RES_IRQ(gic_iid(0x89)),
215};
216
104static struct sh_eth_plat_data ether_platform_data __initdata = { 217static struct sh_eth_plat_data ether_platform_data __initdata = {
105 .phy = 0x01, 218 .phy = 0x01,
106 .edmac_endian = EDMAC_LITTLE_ENDIAN, 219 .edmac_endian = EDMAC_LITTLE_ENDIAN,
@@ -118,7 +231,9 @@ static struct sh_eth_plat_data ether_platform_data __initdata = {
118static struct i2c_board_info i2c0_devices[] = { 231static struct i2c_board_info i2c0_devices[] = {
119 { 232 {
120 I2C_BOARD_INFO("rx8581", 0x51), 233 I2C_BOARD_INFO("rx8581", 0x51),
121 }, 234 }, {
235 I2C_BOARD_INFO("ak4643", 0x12),
236 }
122}; 237};
123 238
124/* HSPI*/ 239/* HSPI*/
@@ -162,10 +277,6 @@ static struct sh_mmcif_plat_data sh_mmcif_plat __initdata = {
162 MMC_CAP_NEEDS_POLL, 277 MMC_CAP_NEEDS_POLL,
163}; 278};
164 279
165static struct rcar_vin_platform_data vin_platform_data __initdata = {
166 .flags = RCAR_VIN_BT656,
167};
168
169/* In the default configuration both decoders reside on I2C bus 0 */ 280/* In the default configuration both decoders reside on I2C bus 0 */
170#define BOCKW_CAMERA(idx) \ 281#define BOCKW_CAMERA(idx) \
171static struct i2c_board_info camera##idx##_info = { \ 282static struct i2c_board_info camera##idx##_info = { \
@@ -181,7 +292,237 @@ static struct soc_camera_link iclink##idx##_ml86v7667 __initdata = { \
181BOCKW_CAMERA(0); 292BOCKW_CAMERA(0);
182BOCKW_CAMERA(1); 293BOCKW_CAMERA(1);
183 294
295/* VIN */
296static struct rcar_vin_platform_data vin_platform_data __initdata = {
297 .flags = RCAR_VIN_BT656,
298};
299
300#define R8A7778_VIN(idx) \
301static struct resource vin##idx##_resources[] __initdata = { \
302 DEFINE_RES_MEM(0xffc50000 + 0x1000 * (idx), 0x1000), \
303 DEFINE_RES_IRQ(gic_iid(0x5a)), \
304}; \
305 \
306static struct platform_device_info vin##idx##_info __initdata = { \
307 .parent = &platform_bus, \
308 .name = "r8a7778-vin", \
309 .id = idx, \
310 .res = vin##idx##_resources, \
311 .num_res = ARRAY_SIZE(vin##idx##_resources), \
312 .dma_mask = DMA_BIT_MASK(32), \
313 .data = &vin_platform_data, \
314 .size_data = sizeof(vin_platform_data), \
315}
316R8A7778_VIN(0);
317R8A7778_VIN(1);
318
319/* Sound */
320static struct resource rsnd_resources[] __initdata = {
321 [RSND_GEN1_SRU] = DEFINE_RES_MEM(0xffd90000, 0x1000),
322 [RSND_GEN1_SSI] = DEFINE_RES_MEM(0xffd91000, 0x1240),
323 [RSND_GEN1_ADG] = DEFINE_RES_MEM(0xfffe0000, 0x24),
324};
325
326static struct rsnd_ssi_platform_info rsnd_ssi[] = {
327 RSND_SSI_UNUSED, /* SSI 0 */
328 RSND_SSI_UNUSED, /* SSI 1 */
329 RSND_SSI_UNUSED, /* SSI 2 */
330 RSND_SSI_SET(1, 0, gic_iid(0x85), RSND_SSI_PLAY),
331 RSND_SSI_SET(2, 0, gic_iid(0x85), RSND_SSI_CLK_PIN_SHARE | RSND_SSI_CLK_FROM_ADG),
332 RSND_SSI_SET(0, 0, gic_iid(0x86), RSND_SSI_PLAY),
333 RSND_SSI_SET(0, 0, gic_iid(0x86), 0),
334 RSND_SSI_SET(3, 0, gic_iid(0x86), RSND_SSI_PLAY),
335 RSND_SSI_SET(4, 0, gic_iid(0x86), RSND_SSI_CLK_PIN_SHARE | RSND_SSI_CLK_FROM_ADG),
336};
337
338static struct rsnd_scu_platform_info rsnd_scu[9] = {
339 /* no member at this point */
340};
341
342enum {
343 AK4554_34 = 0,
344 AK4643_56,
345 AK4554_78,
346 SOUND_MAX,
347};
348
349static int rsnd_codec_power(int id, int enable)
350{
351 static int sound_user[SOUND_MAX] = {0, 0, 0};
352 int *usr = NULL;
353 u32 bit;
354
355 switch (id) {
356 case 3:
357 case 4:
358 usr = sound_user + AK4554_34;
359 bit = (1 << 10);
360 break;
361 case 5:
362 case 6:
363 usr = sound_user + AK4643_56;
364 bit = (1 << 6);
365 break;
366 case 7:
367 case 8:
368 usr = sound_user + AK4554_78;
369 bit = (1 << 7);
370 break;
371 }
372
373 if (!usr)
374 return -EIO;
375
376 if (enable) {
377 if (*usr == 0) {
378 u32 val = ioread16(fpga + COMCTLR);
379 val &= ~bit;
380 iowrite16(val, fpga + COMCTLR);
381 }
382
383 (*usr)++;
384 } else {
385 if (*usr == 0)
386 return 0;
387
388 (*usr)--;
389
390 if (*usr == 0) {
391 u32 val = ioread16(fpga + COMCTLR);
392 val |= bit;
393 iowrite16(val, fpga + COMCTLR);
394 }
395 }
396
397 return 0;
398}
399
400static int rsnd_start(int id)
401{
402 return rsnd_codec_power(id, 1);
403}
404
405static int rsnd_stop(int id)
406{
407 return rsnd_codec_power(id, 0);
408}
409
410static struct rcar_snd_info rsnd_info = {
411 .flags = RSND_GEN1,
412 .ssi_info = rsnd_ssi,
413 .ssi_info_nr = ARRAY_SIZE(rsnd_ssi),
414 .scu_info = rsnd_scu,
415 .scu_info_nr = ARRAY_SIZE(rsnd_scu),
416 .start = rsnd_start,
417 .stop = rsnd_stop,
418};
419
420static struct asoc_simple_card_info rsnd_card_info[] = {
421 /* SSI5, SSI6 */
422 {
423 .name = "AK4643",
424 .card = "SSI56-AK4643",
425 .codec = "ak4642-codec.0-0012",
426 .platform = "rcar_sound",
427 .daifmt = SND_SOC_DAIFMT_LEFT_J,
428 .cpu_dai = {
429 .name = "rsnd-dai.0",
430 .fmt = SND_SOC_DAIFMT_CBS_CFS,
431 },
432 .codec_dai = {
433 .name = "ak4642-hifi",
434 .fmt = SND_SOC_DAIFMT_CBM_CFM,
435 .sysclk = 11289600,
436 },
437 },
438 /* SSI3 */
439 {
440 .name = "AK4554",
441 .card = "SSI3-AK4554(playback)",
442 .codec = "ak4554-adc-dac.0",
443 .platform = "rcar_sound",
444 .cpu_dai = {
445 .name = "rsnd-dai.1",
446 .fmt = SND_SOC_DAIFMT_CBM_CFM |
447 SND_SOC_DAIFMT_RIGHT_J,
448 },
449 .codec_dai = {
450 .name = "ak4554-hifi",
451 },
452 },
453 /* SSI4 */
454 {
455 .name = "AK4554",
456 .card = "SSI4-AK4554(capture)",
457 .codec = "ak4554-adc-dac.0",
458 .platform = "rcar_sound",
459 .cpu_dai = {
460 .name = "rsnd-dai.2",
461 .fmt = SND_SOC_DAIFMT_CBM_CFM |
462 SND_SOC_DAIFMT_LEFT_J,
463 },
464 .codec_dai = {
465 .name = "ak4554-hifi",
466 },
467 },
468 /* SSI7 */
469 {
470 .name = "AK4554",
471 .card = "SSI7-AK4554(playback)",
472 .codec = "ak4554-adc-dac.1",
473 .platform = "rcar_sound",
474 .cpu_dai = {
475 .name = "rsnd-dai.3",
476 .fmt = SND_SOC_DAIFMT_CBM_CFM |
477 SND_SOC_DAIFMT_RIGHT_J,
478 },
479 .codec_dai = {
480 .name = "ak4554-hifi",
481 },
482 },
483 /* SSI8 */
484 {
485 .name = "AK4554",
486 .card = "SSI8-AK4554(capture)",
487 .codec = "ak4554-adc-dac.1",
488 .platform = "rcar_sound",
489 .cpu_dai = {
490 .name = "rsnd-dai.4",
491 .fmt = SND_SOC_DAIFMT_CBM_CFM |
492 SND_SOC_DAIFMT_LEFT_J,
493 },
494 .codec_dai = {
495 .name = "ak4554-hifi",
496 },
497 }
498};
499
184static const struct pinctrl_map bockw_pinctrl_map[] = { 500static const struct pinctrl_map bockw_pinctrl_map[] = {
501 /* AUDIO */
502 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778",
503 "audio_clk_a", "audio_clk"),
504 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778",
505 "audio_clk_b", "audio_clk"),
506 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778",
507 "ssi34_ctrl", "ssi"),
508 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778",
509 "ssi3_data", "ssi"),
510 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778",
511 "ssi4_data", "ssi"),
512 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778",
513 "ssi5_ctrl", "ssi"),
514 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778",
515 "ssi5_data", "ssi"),
516 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778",
517 "ssi6_ctrl", "ssi"),
518 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778",
519 "ssi6_data", "ssi"),
520 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778",
521 "ssi78_ctrl", "ssi"),
522 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778",
523 "ssi7_data", "ssi"),
524 PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7778",
525 "ssi8_data", "ssi"),
185 /* Ether */ 526 /* Ether */
186 PIN_MAP_MUX_GROUP_DEFAULT("r8a777x-ether", "pfc-r8a7778", 527 PIN_MAP_MUX_GROUP_DEFAULT("r8a777x-ether", "pfc-r8a7778",
187 "ether_rmii", "ether"), 528 "ether_rmii", "ether"),
@@ -201,7 +542,7 @@ static const struct pinctrl_map bockw_pinctrl_map[] = {
201 /* USB */ 542 /* USB */
202 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778", 543 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778",
203 "usb0", "usb0"), 544 "usb0", "usb0"),
204 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778", 545 PIN_MAP_MUX_GROUP_DEFAULT(USB1_DEVICE, "pfc-r8a7778",
205 "usb1", "usb1"), 546 "usb1", "usb1"),
206 /* SDHI0 */ 547 /* SDHI0 */
207 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", 548 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778",
@@ -224,22 +565,28 @@ static const struct pinctrl_map bockw_pinctrl_map[] = {
224 "vin1_data8", "vin1"), 565 "vin1_data8", "vin1"),
225}; 566};
226 567
227#define FPGA 0x18200000
228#define IRQ0MR 0x30
229#define PFC 0xfffc0000 568#define PFC 0xfffc0000
230#define PUPR4 0x110 569#define PUPR4 0x110
231static void __init bockw_init(void) 570static void __init bockw_init(void)
232{ 571{
233 void __iomem *base; 572 void __iomem *base;
573 struct clk *clk;
574 int i;
234 575
235 r8a7778_clock_init(); 576 r8a7778_clock_init();
236 r8a7778_init_irq_extpin(1); 577 r8a7778_init_irq_extpin(1);
237 r8a7778_add_standard_devices(); 578 r8a7778_add_standard_devices();
238 r8a7778_add_ether_device(&ether_platform_data); 579
239 r8a7778_add_vin_device(0, &vin_platform_data); 580 platform_device_register_resndata(&platform_bus, "r8a777x-ether", -1,
581 ether_resources,
582 ARRAY_SIZE(ether_resources),
583 &ether_platform_data,
584 sizeof(ether_platform_data));
585
586 platform_device_register_full(&vin0_info);
240 /* VIN1 has a pin conflict with Ether */ 587 /* VIN1 has a pin conflict with Ether */
241 if (!IS_ENABLED(CONFIG_SH_ETH)) 588 if (!IS_ENABLED(CONFIG_SH_ETH))
242 r8a7778_add_vin_device(1, &vin_platform_data); 589 platform_device_register_full(&vin1_info);
243 platform_device_register_data(&platform_bus, "soc-camera-pdrv", 0, 590 platform_device_register_data(&platform_bus, "soc-camera-pdrv", 0,
244 &iclink0_ml86v7667, 591 &iclink0_ml86v7667,
245 sizeof(iclink0_ml86v7667)); 592 sizeof(iclink0_ml86v7667));
@@ -269,8 +616,8 @@ static void __init bockw_init(void)
269 616
270 617
271 /* for SMSC */ 618 /* for SMSC */
272 base = ioremap_nocache(FPGA, SZ_1M); 619 fpga = ioremap_nocache(FPGA, SZ_1M);
273 if (base) { 620 if (fpga) {
274 /* 621 /*
275 * CAUTION 622 * CAUTION
276 * 623 *
@@ -278,10 +625,9 @@ static void __init bockw_init(void)
278 * it should be cared in the future 625 * it should be cared in the future
279 * Now, it is assuming IRQ0 was used only from SMSC. 626 * Now, it is assuming IRQ0 was used only from SMSC.
280 */ 627 */
281 u16 val = ioread16(base + IRQ0MR); 628 u16 val = ioread16(fpga + IRQ0MR);
282 val &= ~(1 << 4); /* enable SMSC911x */ 629 val &= ~(1 << 4); /* enable SMSC911x */
283 iowrite16(val, base + IRQ0MR); 630 iowrite16(val, fpga + IRQ0MR);
284 iounmap(base);
285 631
286 regulator_register_fixed(0, dummy_supplies, 632 regulator_register_fixed(0, dummy_supplies,
287 ARRAY_SIZE(dummy_supplies)); 633 ARRAY_SIZE(dummy_supplies));
@@ -308,6 +654,42 @@ static void __init bockw_init(void)
308 sdhi0_resources, ARRAY_SIZE(sdhi0_resources), 654 sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
309 &sdhi0_info, sizeof(struct sh_mobile_sdhi_info)); 655 &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
310 } 656 }
657
658 /* for Audio */
659 clk = clk_get(NULL, "audio_clk_b");
660 clk_set_rate(clk, 24576000);
661 clk_put(clk);
662 rsnd_codec_power(5, 1); /* enable ak4642 */
663
664 platform_device_register_simple(
665 "ak4554-adc-dac", 0, NULL, 0);
666
667 platform_device_register_simple(
668 "ak4554-adc-dac", 1, NULL, 0);
669
670 platform_device_register_resndata(
671 &platform_bus, "rcar_sound", -1,
672 rsnd_resources, ARRAY_SIZE(rsnd_resources),
673 &rsnd_info, sizeof(rsnd_info));
674
675 for (i = 0; i < ARRAY_SIZE(rsnd_card_info); i++) {
676 struct platform_device_info cardinfo = {
677 .parent = &platform_bus,
678 .name = "asoc-simple-card",
679 .id = i,
680 .data = &rsnd_card_info[i],
681 .size_data = sizeof(struct asoc_simple_card_info),
682 .dma_mask = ~0,
683 };
684
685 platform_device_register_full(&cardinfo);
686 }
687}
688
689static void __init bockw_init_late(void)
690{
691 r8a7778_init_late();
692 ADD_USB_FUNC_DEVICE_IF_POSSIBLE();
311} 693}
312 694
313static const char *bockw_boards_compat_dt[] __initdata = { 695static const char *bockw_boards_compat_dt[] __initdata = {
@@ -320,5 +702,5 @@ DT_MACHINE_START(BOCKW_DT, "bockw")
320 .init_irq = r8a7778_init_irq_dt, 702 .init_irq = r8a7778_init_irq_dt,
321 .init_machine = bockw_init, 703 .init_machine = bockw_init,
322 .dt_compat = bockw_boards_compat_dt, 704 .dt_compat = bockw_boards_compat_dt,
323 .init_late = r8a7778_init_late, 705 .init_late = bockw_init_late,
324MACHINE_END 706MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-genmai.c b/arch/arm/mach-shmobile/board-genmai.c
new file mode 100644
index 000000000000..3e92e3c62d4c
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-genmai.c
@@ -0,0 +1,43 @@
1/*
2 * Genmai board support
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Magnus Damm
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <linux/kernel.h>
22#include <linux/platform_device.h>
23#include <mach/common.h>
24#include <mach/r7s72100.h>
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27
28static void __init genmai_add_standard_devices(void)
29{
30 r7s72100_clock_init();
31 r7s72100_add_dt_devices();
32}
33
34static const char * const genmai_boards_compat_dt[] __initconst = {
35 "renesas,genmai",
36 NULL,
37};
38
39DT_MACHINE_START(GENMAI_DT, "genmai")
40 .init_early = r7s72100_init_early,
41 .init_machine = genmai_add_standard_devices,
42 .dt_compat = genmai_boards_compat_dt,
43MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
new file mode 100644
index 000000000000..ace1711a6cd8
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-koelsch.c
@@ -0,0 +1,47 @@
1/*
2 * Koelsch board support
3 *
4 * Copyright (C) 2013 Renesas Electronics Corporation
5 * Copyright (C) 2013 Renesas Solutions Corp.
6 * Copyright (C) 2013 Magnus Damm
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include <linux/kernel.h>
23#include <linux/platform_device.h>
24#include <mach/common.h>
25#include <mach/r8a7791.h>
26#include <mach/rcar-gen2.h>
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29
30static void __init koelsch_add_standard_devices(void)
31{
32 r8a7791_clock_init();
33 r8a7791_add_standard_devices();
34}
35
36static const char * const koelsch_boards_compat_dt[] __initconst = {
37 "renesas,koelsch",
38 NULL,
39};
40
41DT_MACHINE_START(KOELSCH_DT, "koelsch")
42 .smp = smp_ops(r8a7791_smp_ops),
43 .init_early = r8a7791_init_early,
44 .init_machine = koelsch_add_standard_devices,
45 .init_time = rcar_gen2_timer_init,
46 .dt_compat = koelsch_boards_compat_dt,
47MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9d-reference.c b/arch/arm/mach-shmobile/board-kzm9d-reference.c
index 8f8bb2fab076..054d8d5c8fc1 100644
--- a/arch/arm/mach-shmobile/board-kzm9d-reference.c
+++ b/arch/arm/mach-shmobile/board-kzm9d-reference.c
@@ -33,6 +33,7 @@ static void __init kzm9d_add_standard_devices(void)
33} 33}
34 34
35static const char *kzm9d_boards_compat_dt[] __initdata = { 35static const char *kzm9d_boards_compat_dt[] __initdata = {
36 "renesas,kzm9d",
36 "renesas,kzm9d-reference", 37 "renesas,kzm9d-reference",
37 NULL, 38 NULL,
38}; 39};
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index f1994968d303..fe689b7fdc9e 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -366,6 +366,7 @@ static struct resource sh_mmcif_resources[] = {
366static struct sh_mmcif_plat_data sh_mmcif_platdata = { 366static struct sh_mmcif_plat_data sh_mmcif_platdata = {
367 .ocr = MMC_VDD_165_195, 367 .ocr = MMC_VDD_165_195,
368 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, 368 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
369 .ccs_unsupported = true,
369 .slave_id_tx = SHDMA_SLAVE_MMCIF_TX, 370 .slave_id_tx = SHDMA_SLAVE_MMCIF_TX,
370 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, 371 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
371}; 372};
diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
index 9c316a1b2e32..1a1a4a888632 100644
--- a/arch/arm/mach-shmobile/board-lager-reference.c
+++ b/arch/arm/mach-shmobile/board-lager-reference.c
@@ -38,8 +38,9 @@ static const char *lager_boards_compat_dt[] __initdata = {
38}; 38};
39 39
40DT_MACHINE_START(LAGER_DT, "lager") 40DT_MACHINE_START(LAGER_DT, "lager")
41 .init_early = r8a7790_init_delay, 41 .smp = smp_ops(r8a7790_smp_ops),
42 .init_early = r8a7790_init_early,
43 .init_time = rcar_gen2_timer_init,
42 .init_machine = lager_add_standard_devices, 44 .init_machine = lager_add_standard_devices,
43 .init_time = r8a7790_timer_init,
44 .dt_compat = lager_boards_compat_dt, 45 .dt_compat = lager_boards_compat_dt,
45MACHINE_END 46MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index ffb6f0ac7606..a8d3ce646fb9 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -28,7 +28,9 @@
28#include <linux/mmc/sh_mmcif.h> 28#include <linux/mmc/sh_mmcif.h>
29#include <linux/pinctrl/machine.h> 29#include <linux/pinctrl/machine.h>
30#include <linux/platform_data/gpio-rcar.h> 30#include <linux/platform_data/gpio-rcar.h>
31#include <linux/platform_data/rcar-du.h>
31#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/phy.h>
32#include <linux/regulator/fixed.h> 34#include <linux/regulator/fixed.h>
33#include <linux/regulator/machine.h> 35#include <linux/regulator/machine.h>
34#include <linux/sh_eth.h> 36#include <linux/sh_eth.h>
@@ -38,6 +40,62 @@
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 42
43/* DU */
44static struct rcar_du_encoder_data lager_du_encoders[] = {
45 {
46 .type = RCAR_DU_ENCODER_VGA,
47 .output = RCAR_DU_OUTPUT_DPAD0,
48 }, {
49 .type = RCAR_DU_ENCODER_NONE,
50 .output = RCAR_DU_OUTPUT_LVDS1,
51 .connector.lvds.panel = {
52 .width_mm = 210,
53 .height_mm = 158,
54 .mode = {
55 .clock = 65000,
56 .hdisplay = 1024,
57 .hsync_start = 1048,
58 .hsync_end = 1184,
59 .htotal = 1344,
60 .vdisplay = 768,
61 .vsync_start = 771,
62 .vsync_end = 777,
63 .vtotal = 806,
64 .flags = 0,
65 },
66 },
67 },
68};
69
70static const struct rcar_du_platform_data lager_du_pdata __initconst = {
71 .encoders = lager_du_encoders,
72 .num_encoders = ARRAY_SIZE(lager_du_encoders),
73};
74
75static const struct resource du_resources[] __initconst = {
76 DEFINE_RES_MEM(0xfeb00000, 0x70000),
77 DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
78 DEFINE_RES_MEM_NAMED(0xfeb94000, 0x1c, "lvds.1"),
79 DEFINE_RES_IRQ(gic_spi(256)),
80 DEFINE_RES_IRQ(gic_spi(268)),
81 DEFINE_RES_IRQ(gic_spi(269)),
82};
83
84static void __init lager_add_du_device(void)
85{
86 struct platform_device_info info = {
87 .name = "rcar-du-r8a7790",
88 .id = -1,
89 .res = du_resources,
90 .num_res = ARRAY_SIZE(du_resources),
91 .data = &lager_du_pdata,
92 .size_data = sizeof(lager_du_pdata),
93 .dma_mask = DMA_BIT_MASK(32),
94 };
95
96 platform_device_register_full(&info);
97}
98
41/* LEDS */ 99/* LEDS */
42static struct gpio_led lager_leds[] = { 100static struct gpio_led lager_leds[] = {
43 { 101 {
@@ -55,7 +113,7 @@ static struct gpio_led lager_leds[] = {
55 }, 113 },
56}; 114};
57 115
58static __initdata struct gpio_led_platform_data lager_leds_pdata = { 116static const struct gpio_led_platform_data lager_leds_pdata __initconst = {
59 .leds = lager_leds, 117 .leds = lager_leds,
60 .num_leds = ARRAY_SIZE(lager_leds), 118 .num_leds = ARRAY_SIZE(lager_leds),
61}; 119};
@@ -71,7 +129,7 @@ static struct gpio_keys_button gpio_buttons[] = {
71 GPIO_KEY(KEY_1, RCAR_GP_PIN(1, 14), "SW2-pin1"), 129 GPIO_KEY(KEY_1, RCAR_GP_PIN(1, 14), "SW2-pin1"),
72}; 130};
73 131
74static __initdata struct gpio_keys_platform_data lager_keys_pdata = { 132static const struct gpio_keys_platform_data lager_keys_pdata __initconst = {
75 .buttons = gpio_buttons, 133 .buttons = gpio_buttons,
76 .nbuttons = ARRAY_SIZE(gpio_buttons), 134 .nbuttons = ARRAY_SIZE(gpio_buttons),
77}; 135};
@@ -83,29 +141,38 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[] =
83}; 141};
84 142
85/* MMCIF */ 143/* MMCIF */
86static struct sh_mmcif_plat_data mmcif1_pdata __initdata = { 144static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = {
87 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, 145 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
146 .clk_ctrl2_present = true,
147 .ccs_unsupported = true,
88}; 148};
89 149
90static struct resource mmcif1_resources[] __initdata = { 150static const struct resource mmcif1_resources[] __initconst = {
91 DEFINE_RES_MEM_NAMED(0xee220000, 0x80, "MMCIF1"), 151 DEFINE_RES_MEM_NAMED(0xee220000, 0x80, "MMCIF1"),
92 DEFINE_RES_IRQ(gic_spi(170)), 152 DEFINE_RES_IRQ(gic_spi(170)),
93}; 153};
94 154
95/* Ether */ 155/* Ether */
96static struct sh_eth_plat_data ether_pdata __initdata = { 156static const struct sh_eth_plat_data ether_pdata __initconst = {
97 .phy = 0x1, 157 .phy = 0x1,
98 .edmac_endian = EDMAC_LITTLE_ENDIAN, 158 .edmac_endian = EDMAC_LITTLE_ENDIAN,
99 .phy_interface = PHY_INTERFACE_MODE_RMII, 159 .phy_interface = PHY_INTERFACE_MODE_RMII,
100 .ether_link_active_low = 1, 160 .ether_link_active_low = 1,
101}; 161};
102 162
103static struct resource ether_resources[] __initdata = { 163static const struct resource ether_resources[] __initconst = {
104 DEFINE_RES_MEM(0xee700000, 0x400), 164 DEFINE_RES_MEM(0xee700000, 0x400),
105 DEFINE_RES_IRQ(gic_spi(162)), 165 DEFINE_RES_IRQ(gic_spi(162)),
106}; 166};
107 167
108static const struct pinctrl_map lager_pinctrl_map[] = { 168static const struct pinctrl_map lager_pinctrl_map[] = {
169 /* DU (CN10: ARGB0, CN13: LVDS) */
170 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
171 "du_rgb666", "du"),
172 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
173 "du_sync_1", "du"),
174 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
175 "du_clk_out_0", "du"),
109 /* SCIF0 (CN19: DEBUG SERIAL0) */ 176 /* SCIF0 (CN19: DEBUG SERIAL0) */
110 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790", 177 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790",
111 "scif0_data", "scif0"), 178 "scif0_data", "scif0"),
@@ -153,16 +220,43 @@ static void __init lager_add_standard_devices(void)
153 ether_resources, 220 ether_resources,
154 ARRAY_SIZE(ether_resources), 221 ARRAY_SIZE(ether_resources),
155 &ether_pdata, sizeof(ether_pdata)); 222 &ether_pdata, sizeof(ether_pdata));
223
224 lager_add_du_device();
225}
226
227/*
228 * Ether LEDs on the Lager board are named LINK and ACTIVE which corresponds
229 * to non-default 01 setting of the Micrel KSZ8041 PHY control register 1 bits
230 * 14-15. We have to set them back to 01 from the default 00 value each time
231 * the PHY is reset. It's also important because the PHY's LED0 signal is
232 * connected to SoC's ETH_LINK signal and in the PHY's default mode it will
233 * bounce on and off after each packet, which we apparently want to avoid.
234 */
235static int lager_ksz8041_fixup(struct phy_device *phydev)
236{
237 u16 phyctrl1 = phy_read(phydev, 0x1e);
238
239 phyctrl1 &= ~0xc000;
240 phyctrl1 |= 0x4000;
241 return phy_write(phydev, 0x1e, phyctrl1);
242}
243
244static void __init lager_init(void)
245{
246 lager_add_standard_devices();
247
248 phy_register_fixup_for_id("r8a7790-ether-ff:01", lager_ksz8041_fixup);
156} 249}
157 250
158static const char *lager_boards_compat_dt[] __initdata = { 251static const char * const lager_boards_compat_dt[] __initconst = {
159 "renesas,lager", 252 "renesas,lager",
160 NULL, 253 NULL,
161}; 254};
162 255
163DT_MACHINE_START(LAGER_DT, "lager") 256DT_MACHINE_START(LAGER_DT, "lager")
164 .init_early = r8a7790_init_delay, 257 .smp = smp_ops(r8a7790_smp_ops),
165 .init_time = r8a7790_timer_init, 258 .init_early = r8a7790_init_early,
166 .init_machine = lager_add_standard_devices, 259 .init_time = rcar_gen2_timer_init,
260 .init_machine = lager_init,
167 .dt_compat = lager_boards_compat_dt, 261 .dt_compat = lager_boards_compat_dt,
168MACHINE_END 262MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
index 3f4250a2d4eb..2773936bf7dc 100644
--- a/arch/arm/mach-shmobile/board-marzen-reference.c
+++ b/arch/arm/mach-shmobile/board-marzen-reference.c
@@ -28,6 +28,7 @@
28static void __init marzen_init(void) 28static void __init marzen_init(void)
29{ 29{
30 r8a7779_add_standard_devices_dt(); 30 r8a7779_add_standard_devices_dt();
31 r8a7779_init_irq_extpin_dt(1); /* IRQ1 as individual interrupt */
31} 32}
32 33
33static const char *marzen_boards_compat_dt[] __initdata = { 34static const char *marzen_boards_compat_dt[] __initdata = {
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index 3f5044fda4e3..da1352f5f71b 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -30,6 +30,7 @@
30#include <linux/dma-mapping.h> 30#include <linux/dma-mapping.h>
31#include <linux/pinctrl/machine.h> 31#include <linux/pinctrl/machine.h>
32#include <linux/platform_data/gpio-rcar.h> 32#include <linux/platform_data/gpio-rcar.h>
33#include <linux/platform_data/rcar-du.h>
33#include <linux/platform_data/usb-rcar-phy.h> 34#include <linux/platform_data/usb-rcar-phy.h>
34#include <linux/regulator/fixed.h> 35#include <linux/regulator/fixed.h>
35#include <linux/regulator/machine.h> 36#include <linux/regulator/machine.h>
@@ -124,6 +125,8 @@ static struct resource sdhi0_resources[] = {
124}; 125};
125 126
126static struct sh_mobile_sdhi_info sdhi0_platform_data = { 127static struct sh_mobile_sdhi_info sdhi0_platform_data = {
128 .dma_slave_tx = HPBDMA_SLAVE_SDHI0_TX,
129 .dma_slave_rx = HPBDMA_SLAVE_SDHI0_RX,
127 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT, 130 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT,
128 .tmio_caps = MMC_CAP_SD_HIGHSPEED, 131 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
129}; 132};
@@ -169,6 +172,63 @@ static struct platform_device hspi_device = {
169 .num_resources = ARRAY_SIZE(hspi_resources), 172 .num_resources = ARRAY_SIZE(hspi_resources),
170}; 173};
171 174
175/*
176 * DU
177 *
178 * The panel only specifies the [hv]display and [hv]total values. The position
179 * and width of the sync pulses don't matter, they're copied from VESA timings.
180 */
181static struct rcar_du_encoder_data du_encoders[] = {
182 {
183 .type = RCAR_DU_ENCODER_VGA,
184 .output = RCAR_DU_OUTPUT_DPAD0,
185 }, {
186 .type = RCAR_DU_ENCODER_LVDS,
187 .output = RCAR_DU_OUTPUT_DPAD1,
188 .connector.lvds.panel = {
189 .width_mm = 210,
190 .height_mm = 158,
191 .mode = {
192 .clock = 65000,
193 .hdisplay = 1024,
194 .hsync_start = 1048,
195 .hsync_end = 1184,
196 .htotal = 1344,
197 .vdisplay = 768,
198 .vsync_start = 771,
199 .vsync_end = 777,
200 .vtotal = 806,
201 .flags = 0,
202 },
203 },
204 },
205};
206
207static const struct rcar_du_platform_data du_pdata __initconst = {
208 .encoders = du_encoders,
209 .num_encoders = ARRAY_SIZE(du_encoders),
210};
211
212static const struct resource du_resources[] __initconst = {
213 DEFINE_RES_MEM(0xfff80000, 0x40000),
214 DEFINE_RES_IRQ(gic_iid(0x3f)),
215};
216
217static void __init marzen_add_du_device(void)
218{
219 struct platform_device_info info = {
220 .name = "rcar-du-r8a7779",
221 .id = -1,
222 .res = du_resources,
223 .num_res = ARRAY_SIZE(du_resources),
224 .data = &du_pdata,
225 .size_data = sizeof(du_pdata),
226 .dma_mask = DMA_BIT_MASK(32),
227 };
228
229 platform_device_register_full(&info);
230}
231
172/* LEDS */ 232/* LEDS */
173static struct gpio_led marzen_leds[] = { 233static struct gpio_led marzen_leds[] = {
174 { 234 {
@@ -237,6 +297,19 @@ static struct platform_device *marzen_devices[] __initdata = {
237}; 297};
238 298
239static const struct pinctrl_map marzen_pinctrl_map[] = { 299static const struct pinctrl_map marzen_pinctrl_map[] = {
300 /* DU (CN10: ARGB0, CN13: LVDS) */
301 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
302 "du0_rgb888", "du0"),
303 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
304 "du0_sync_1", "du0"),
305 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
306 "du0_clk_out_0", "du0"),
307 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
308 "du1_rgb666", "du1"),
309 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
310 "du1_sync_1", "du1"),
311 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
312 "du1_clk_out", "du1"),
240 /* HSPI0 */ 313 /* HSPI0 */
241 PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779", 314 PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779",
242 "hspi0", "hspi0"), 315 "hspi0", "hspi0"),
@@ -297,6 +370,7 @@ static void __init marzen_init(void)
297 r8a7779_add_vin_device(1, &vin_platform_data); 370 r8a7779_add_vin_device(1, &vin_platform_data);
298 r8a7779_add_vin_device(3, &vin_platform_data); 371 r8a7779_add_vin_device(3, &vin_platform_data);
299 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); 372 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
373 marzen_add_du_device();
300} 374}
301 375
302static const char *marzen_boards_compat_dt[] __initdata = { 376static const char *marzen_boards_compat_dt[] __initdata = {
diff --git a/arch/arm/mach-shmobile/clock-r7s72100.c b/arch/arm/mach-shmobile/clock-r7s72100.c
new file mode 100644
index 000000000000..4aba20ca127e
--- /dev/null
+++ b/arch/arm/mach-shmobile/clock-r7s72100.c
@@ -0,0 +1,202 @@
1/*
2 * r7a72100 clock framework support
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2012 Phil Edworthy
6 * Copyright (C) 2011 Magnus Damm
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/io.h>
20#include <linux/sh_clk.h>
21#include <linux/clkdev.h>
22#include <mach/common.h>
23#include <mach/r7s72100.h>
24
25/* registers */
26#define FRQCR 0xfcfe0010
27#define FRQCR2 0xfcfe0014
28#define STBCR3 0xfcfe0420
29#define STBCR4 0xfcfe0424
30
31#define PLL_RATE 30
32
33static struct clk_mapping cpg_mapping = {
34 .phys = 0xfcfe0000,
35 .len = 0x1000,
36};
37
38/* Fixed 32 KHz root clock for RTC */
39static struct clk r_clk = {
40 .rate = 32768,
41};
42
43/*
44 * Default rate for the root input clock, reset this with clk_set_rate()
45 * from the platform code.
46 */
47static struct clk extal_clk = {
48 .rate = 13330000,
49 .mapping = &cpg_mapping,
50};
51
52static unsigned long pll_recalc(struct clk *clk)
53{
54 return clk->parent->rate * PLL_RATE;
55}
56
57static struct sh_clk_ops pll_clk_ops = {
58 .recalc = pll_recalc,
59};
60
61static struct clk pll_clk = {
62 .ops = &pll_clk_ops,
63 .parent = &extal_clk,
64 .flags = CLK_ENABLE_ON_INIT,
65};
66
67static unsigned long bus_recalc(struct clk *clk)
68{
69 return clk->parent->rate * 2 / 3;
70}
71
72static struct sh_clk_ops bus_clk_ops = {
73 .recalc = bus_recalc,
74};
75
76static struct clk bus_clk = {
77 .ops = &bus_clk_ops,
78 .parent = &pll_clk,
79 .flags = CLK_ENABLE_ON_INIT,
80};
81
82static unsigned long peripheral0_recalc(struct clk *clk)
83{
84 return clk->parent->rate / 12;
85}
86
87static struct sh_clk_ops peripheral0_clk_ops = {
88 .recalc = peripheral0_recalc,
89};
90
91static struct clk peripheral0_clk = {
92 .ops = &peripheral0_clk_ops,
93 .parent = &pll_clk,
94 .flags = CLK_ENABLE_ON_INIT,
95};
96
97static unsigned long peripheral1_recalc(struct clk *clk)
98{
99 return clk->parent->rate / 6;
100}
101
102static struct sh_clk_ops peripheral1_clk_ops = {
103 .recalc = peripheral1_recalc,
104};
105
106static struct clk peripheral1_clk = {
107 .ops = &peripheral1_clk_ops,
108 .parent = &pll_clk,
109 .flags = CLK_ENABLE_ON_INIT,
110};
111
112struct clk *main_clks[] = {
113 &r_clk,
114 &extal_clk,
115 &pll_clk,
116 &bus_clk,
117 &peripheral0_clk,
118 &peripheral1_clk,
119};
120
121static int div2[] = { 1, 3, 0, 3 }; /* 1, 2/3, reserve, 1/3 */
122static int multipliers[] = { 1, 2, 1, 1 };
123
124static struct clk_div_mult_table div4_div_mult_table = {
125 .divisors = div2,
126 .nr_divisors = ARRAY_SIZE(div2),
127 .multipliers = multipliers,
128 .nr_multipliers = ARRAY_SIZE(multipliers),
129};
130
131static struct clk_div4_table div4_table = {
132 .div_mult_table = &div4_div_mult_table,
133};
134
135enum { DIV4_I,
136 DIV4_NR };
137
138#define DIV4(_reg, _bit, _mask, _flags) \
139 SH_CLK_DIV4(&pll_clk, _reg, _bit, _mask, _flags)
140
141/* The mask field specifies the div2 entries that are valid */
142struct clk div4_clks[DIV4_NR] = {
143 [DIV4_I] = DIV4(FRQCR, 8, 0xB, CLK_ENABLE_REG_16BIT
144 | CLK_ENABLE_ON_INIT),
145};
146
147enum { MSTP47, MSTP46, MSTP45, MSTP44, MSTP43, MSTP42, MSTP41, MSTP40,
148 MSTP33, MSTP_NR };
149
150static struct clk mstp_clks[MSTP_NR] = {
151 [MSTP47] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 7, 0), /* SCIF0 */
152 [MSTP46] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 6, 0), /* SCIF1 */
153 [MSTP45] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 5, 0), /* SCIF2 */
154 [MSTP44] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 4, 0), /* SCIF3 */
155 [MSTP43] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 3, 0), /* SCIF4 */
156 [MSTP42] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 2, 0), /* SCIF5 */
157 [MSTP41] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 1, 0), /* SCIF6 */
158 [MSTP40] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 0, 0), /* SCIF7 */
159 [MSTP33] = SH_CLK_MSTP8(&peripheral0_clk, STBCR3, 3, 0), /* MTU2 */
160};
161
162static struct clk_lookup lookups[] = {
163 /* main clocks */
164 CLKDEV_CON_ID("rclk", &r_clk),
165 CLKDEV_CON_ID("extal", &extal_clk),
166 CLKDEV_CON_ID("pll_clk", &pll_clk),
167 CLKDEV_CON_ID("peripheral_clk", &peripheral1_clk),
168
169 /* DIV4 clocks */
170 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]),
171
172 /* MSTP clocks */
173 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP47]),
174 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP46]),
175 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP45]),
176 CLKDEV_ICK_ID("sci_fck", "sh-sci.3", &mstp_clks[MSTP44]),
177 CLKDEV_ICK_ID("sci_fck", "sh-sci.4", &mstp_clks[MSTP43]),
178 CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP42]),
179 CLKDEV_ICK_ID("sci_fck", "sh-sci.6", &mstp_clks[MSTP41]),
180 CLKDEV_ICK_ID("sci_fck", "sh-sci.7", &mstp_clks[MSTP40]),
181};
182
183void __init r7s72100_clock_init(void)
184{
185 int k, ret = 0;
186
187 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
188 ret = clk_register(main_clks[k]);
189
190 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
191
192 if (!ret)
193 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
194
195 if (!ret)
196 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
197
198 if (!ret)
199 shmobile_clk_init();
200 else
201 panic("failed to setup rza1 clocks\n");
202}
diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c
index 8ea5ef6c79cc..571409b611d3 100644
--- a/arch/arm/mach-shmobile/clock-r8a73a4.c
+++ b/arch/arm/mach-shmobile/clock-r8a73a4.c
@@ -504,7 +504,7 @@ static struct clk div6_clks[DIV6_NR] = {
504 504
505/* MSTP */ 505/* MSTP */
506enum { 506enum {
507 MSTP217, MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, 507 MSTP218, MSTP217, MSTP216, MSTP207, MSTP206, MSTP204, MSTP203,
508 MSTP329, MSTP323, MSTP318, MSTP317, MSTP316, 508 MSTP329, MSTP323, MSTP318, MSTP317, MSTP316,
509 MSTP315, MSTP314, MSTP313, MSTP312, MSTP305, MSTP300, 509 MSTP315, MSTP314, MSTP313, MSTP312, MSTP305, MSTP300,
510 MSTP411, MSTP410, MSTP409, 510 MSTP411, MSTP410, MSTP409,
@@ -519,6 +519,7 @@ static struct clk mstp_clks[MSTP_NR] = {
519 [MSTP207] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 7, 0), /* SCIFB1 */ 519 [MSTP207] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 7, 0), /* SCIFB1 */
520 [MSTP216] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 16, 0), /* SCIFB2 */ 520 [MSTP216] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 16, 0), /* SCIFB2 */
521 [MSTP217] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 17, 0), /* SCIFB3 */ 521 [MSTP217] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 17, 0), /* SCIFB3 */
522 [MSTP218] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC */
522 [MSTP300] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 0, 0), /* IIC2 */ 523 [MSTP300] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 0, 0), /* IIC2 */
523 [MSTP305] = SH_CLK_MSTP32(&div6_clks[DIV6_MMC1],SMSTPCR3, 5, 0), /* MMCIF1 */ 524 [MSTP305] = SH_CLK_MSTP32(&div6_clks[DIV6_MMC1],SMSTPCR3, 5, 0), /* MMCIF1 */
524 [MSTP312] = SH_CLK_MSTP32(&div6_clks[DIV6_SDHI2],SMSTPCR3, 12, 0), /* SDHI2 */ 525 [MSTP312] = SH_CLK_MSTP32(&div6_clks[DIV6_SDHI2],SMSTPCR3, 12, 0), /* SDHI2 */
@@ -555,7 +556,7 @@ static struct clk_lookup lookups[] = {
555 CLKDEV_CON_ID("pll2h", &pll2h_clk), 556 CLKDEV_CON_ID("pll2h", &pll2h_clk),
556 557
557 /* CPU clock */ 558 /* CPU clock */
558 CLKDEV_DEV_ID("cpufreq-cpu0", &z_clk), 559 CLKDEV_DEV_ID("cpu0", &z_clk),
559 560
560 /* DIV6 */ 561 /* DIV6 */
561 CLKDEV_CON_ID("zb", &div6_clks[DIV6_ZB]), 562 CLKDEV_CON_ID("zb", &div6_clks[DIV6_ZB]),
@@ -578,6 +579,8 @@ static struct clk_lookup lookups[] = {
578 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]), 579 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]),
579 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]), 580 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]),
580 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP217]), 581 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP217]),
582 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]),
583 CLKDEV_DEV_ID("e6700020.dma-controller", &mstp_clks[MSTP218]),
581 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), 584 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
582 CLKDEV_DEV_ID("e6520000.i2c", &mstp_clks[MSTP300]), 585 CLKDEV_DEV_ID("e6520000.i2c", &mstp_clks[MSTP300]),
583 CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]), 586 CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]),
diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c
index c4bf2d8fb111..fb6af83858e3 100644
--- a/arch/arm/mach-shmobile/clock-r8a7778.c
+++ b/arch/arm/mach-shmobile/clock-r8a7778.c
@@ -69,6 +69,15 @@ static struct clk extal_clk = {
69 .mapping = &cpg_mapping, 69 .mapping = &cpg_mapping,
70}; 70};
71 71
72static struct clk audio_clk_a = {
73};
74
75static struct clk audio_clk_b = {
76};
77
78static struct clk audio_clk_c = {
79};
80
72/* 81/*
73 * clock ratio of these clock will be updated 82 * clock ratio of these clock will be updated
74 * on r8a7778_clock_init() 83 * on r8a7778_clock_init()
@@ -100,18 +109,23 @@ static struct clk *main_clks[] = {
100 &p_clk, 109 &p_clk,
101 &g_clk, 110 &g_clk,
102 &z_clk, 111 &z_clk,
112 &audio_clk_a,
113 &audio_clk_b,
114 &audio_clk_c,
103}; 115};
104 116
105enum { 117enum {
106 MSTP331, 118 MSTP331,
107 MSTP323, MSTP322, MSTP321, 119 MSTP323, MSTP322, MSTP321,
120 MSTP311, MSTP310,
121 MSTP309, MSTP308, MSTP307,
108 MSTP114, 122 MSTP114,
109 MSTP110, MSTP109, 123 MSTP110, MSTP109,
110 MSTP100, 124 MSTP100,
111 MSTP030, 125 MSTP030,
112 MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, 126 MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021,
113 MSTP016, MSTP015, 127 MSTP016, MSTP015, MSTP012, MSTP011, MSTP010,
114 MSTP007, 128 MSTP009, MSTP008, MSTP007,
115 MSTP_NR }; 129 MSTP_NR };
116 130
117static struct clk mstp_clks[MSTP_NR] = { 131static struct clk mstp_clks[MSTP_NR] = {
@@ -119,6 +133,11 @@ static struct clk mstp_clks[MSTP_NR] = {
119 [MSTP323] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 23, 0), /* SDHI0 */ 133 [MSTP323] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 23, 0), /* SDHI0 */
120 [MSTP322] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 22, 0), /* SDHI1 */ 134 [MSTP322] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 22, 0), /* SDHI1 */
121 [MSTP321] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 21, 0), /* SDHI2 */ 135 [MSTP321] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 21, 0), /* SDHI2 */
136 [MSTP311] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 11, 0), /* SSI4 */
137 [MSTP310] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 10, 0), /* SSI5 */
138 [MSTP309] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 9, 0), /* SSI6 */
139 [MSTP308] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 8, 0), /* SSI7 */
140 [MSTP307] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 7, 0), /* SSI8 */
122 [MSTP114] = SH_CLK_MSTP32(&p_clk, MSTPCR1, 14, 0), /* Ether */ 141 [MSTP114] = SH_CLK_MSTP32(&p_clk, MSTPCR1, 14, 0), /* Ether */
123 [MSTP110] = SH_CLK_MSTP32(&s_clk, MSTPCR1, 10, 0), /* VIN0 */ 142 [MSTP110] = SH_CLK_MSTP32(&s_clk, MSTPCR1, 10, 0), /* VIN0 */
124 [MSTP109] = SH_CLK_MSTP32(&s_clk, MSTPCR1, 9, 0), /* VIN1 */ 143 [MSTP109] = SH_CLK_MSTP32(&s_clk, MSTPCR1, 9, 0), /* VIN1 */
@@ -135,11 +154,20 @@ static struct clk mstp_clks[MSTP_NR] = {
135 [MSTP021] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 21, 0), /* SCIF5 */ 154 [MSTP021] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 21, 0), /* SCIF5 */
136 [MSTP016] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 16, 0), /* TMU0 */ 155 [MSTP016] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 16, 0), /* TMU0 */
137 [MSTP015] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 15, 0), /* TMU1 */ 156 [MSTP015] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 15, 0), /* TMU1 */
157 [MSTP012] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 12, 0), /* SSI0 */
158 [MSTP011] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 11, 0), /* SSI1 */
159 [MSTP010] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 10, 0), /* SSI2 */
160 [MSTP009] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 9, 0), /* SSI3 */
161 [MSTP008] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 8, 0), /* SRU */
138 [MSTP007] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 7, 0), /* HSPI */ 162 [MSTP007] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 7, 0), /* HSPI */
139}; 163};
140 164
141static struct clk_lookup lookups[] = { 165static struct clk_lookup lookups[] = {
142 /* main */ 166 /* main */
167 CLKDEV_CON_ID("audio_clk_a", &audio_clk_a),
168 CLKDEV_CON_ID("audio_clk_b", &audio_clk_b),
169 CLKDEV_CON_ID("audio_clk_c", &audio_clk_c),
170 CLKDEV_CON_ID("audio_clk_internal", &s1_clk),
143 CLKDEV_CON_ID("shyway_clk", &s_clk), 171 CLKDEV_CON_ID("shyway_clk", &s_clk),
144 CLKDEV_CON_ID("peripheral_clk", &p_clk), 172 CLKDEV_CON_ID("peripheral_clk", &p_clk),
145 173
@@ -153,6 +181,7 @@ static struct clk_lookup lookups[] = {
153 CLKDEV_DEV_ID("r8a7778-vin.1", &mstp_clks[MSTP109]), /* VIN1 */ 181 CLKDEV_DEV_ID("r8a7778-vin.1", &mstp_clks[MSTP109]), /* VIN1 */
154 CLKDEV_DEV_ID("ehci-platform", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */ 182 CLKDEV_DEV_ID("ehci-platform", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
155 CLKDEV_DEV_ID("ohci-platform", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */ 183 CLKDEV_DEV_ID("ohci-platform", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */
184 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP100]), /* USB FUNC */
156 CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */ 185 CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */
157 CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */ 186 CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */
158 CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */ 187 CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */
@@ -168,6 +197,17 @@ static struct clk_lookup lookups[] = {
168 CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */ 197 CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */
169 CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */ 198 CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */
170 CLKDEV_DEV_ID("sh-hspi.2", &mstp_clks[MSTP007]), /* HSPI2 */ 199 CLKDEV_DEV_ID("sh-hspi.2", &mstp_clks[MSTP007]), /* HSPI2 */
200 CLKDEV_DEV_ID("rcar_sound", &mstp_clks[MSTP008]), /* SRU */
201
202 CLKDEV_ICK_ID("ssi.0", "rcar_sound", &mstp_clks[MSTP012]),
203 CLKDEV_ICK_ID("ssi.1", "rcar_sound", &mstp_clks[MSTP011]),
204 CLKDEV_ICK_ID("ssi.2", "rcar_sound", &mstp_clks[MSTP010]),
205 CLKDEV_ICK_ID("ssi.3", "rcar_sound", &mstp_clks[MSTP009]),
206 CLKDEV_ICK_ID("ssi.4", "rcar_sound", &mstp_clks[MSTP311]),
207 CLKDEV_ICK_ID("ssi.5", "rcar_sound", &mstp_clks[MSTP310]),
208 CLKDEV_ICK_ID("ssi.6", "rcar_sound", &mstp_clks[MSTP309]),
209 CLKDEV_ICK_ID("ssi.7", "rcar_sound", &mstp_clks[MSTP308]),
210 CLKDEV_ICK_ID("ssi.8", "rcar_sound", &mstp_clks[MSTP307]),
171}; 211};
172 212
173void __init r8a7778_clock_init(void) 213void __init r8a7778_clock_init(void)
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index bd6ad922eb7e..1f7080fab0a5 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -200,7 +200,7 @@ static struct clk_lookup lookups[] = {
200 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */ 200 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
201 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */ 201 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
202 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP320]), /* SDHI3 */ 202 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP320]), /* SDHI3 */
203 CLKDEV_DEV_ID("rcar-du.0", &mstp_clks[MSTP103]), /* DU */ 203 CLKDEV_DEV_ID("rcar-du-r8a7779", &mstp_clks[MSTP103]), /* DU */
204}; 204};
205 205
206void __init r8a7779_clock_init(void) 206void __init r8a7779_clock_init(void)
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
index fc36d3db0b4d..a64f965c7da1 100644
--- a/arch/arm/mach-shmobile/clock-r8a7790.c
+++ b/arch/arm/mach-shmobile/clock-r8a7790.c
@@ -52,6 +52,7 @@
52#define SMSTPCR5 0xe6150144 52#define SMSTPCR5 0xe6150144
53#define SMSTPCR7 0xe615014c 53#define SMSTPCR7 0xe615014c
54#define SMSTPCR8 0xe6150990 54#define SMSTPCR8 0xe6150990
55#define SMSTPCR9 0xe6150994
55 56
56#define SDCKCR 0xE6150074 57#define SDCKCR 0xE6150074
57#define SD2CKCR 0xE6150078 58#define SD2CKCR 0xE6150078
@@ -181,8 +182,9 @@ static struct clk div6_clks[DIV6_NR] = {
181 182
182/* MSTP */ 183/* MSTP */
183enum { 184enum {
185 MSTP931, MSTP930, MSTP929, MSTP928,
184 MSTP813, 186 MSTP813,
185 MSTP721, MSTP720, 187 MSTP726, MSTP725, MSTP724, MSTP723, MSTP722, MSTP721, MSTP720,
186 MSTP717, MSTP716, 188 MSTP717, MSTP716,
187 MSTP522, 189 MSTP522,
188 MSTP315, MSTP314, MSTP313, MSTP312, MSTP311, MSTP305, MSTP304, 190 MSTP315, MSTP314, MSTP313, MSTP312, MSTP311, MSTP305, MSTP304,
@@ -192,7 +194,16 @@ enum {
192}; 194};
193 195
194static struct clk mstp_clks[MSTP_NR] = { 196static struct clk mstp_clks[MSTP_NR] = {
197 [MSTP931] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 31, 0), /* I2C0 */
198 [MSTP930] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 30, 0), /* I2C1 */
199 [MSTP929] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 29, 0), /* I2C2 */
200 [MSTP928] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 28, 0), /* I2C3 */
195 [MSTP813] = SH_CLK_MSTP32(&p_clk, SMSTPCR8, 13, 0), /* Ether */ 201 [MSTP813] = SH_CLK_MSTP32(&p_clk, SMSTPCR8, 13, 0), /* Ether */
202 [MSTP726] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 26, 0), /* LVDS0 */
203 [MSTP725] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 25, 0), /* LVDS1 */
204 [MSTP724] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 24, 0), /* DU0 */
205 [MSTP723] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 23, 0), /* DU1 */
206 [MSTP722] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 22, 0), /* DU2 */
196 [MSTP721] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 21, 0), /* SCIF0 */ 207 [MSTP721] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 21, 0), /* SCIF0 */
197 [MSTP720] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 20, 0), /* SCIF1 */ 208 [MSTP720] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 20, 0), /* SCIF1 */
198 [MSTP717] = SH_CLK_MSTP32(&zs_clk, SMSTPCR7, 17, 0), /* HSCIF0 */ 209 [MSTP717] = SH_CLK_MSTP32(&zs_clk, SMSTPCR7, 17, 0), /* HSCIF0 */
@@ -251,6 +262,11 @@ static struct clk_lookup lookups[] = {
251 CLKDEV_CON_ID("ssprs", &div6_clks[DIV6_SSPRS]), 262 CLKDEV_CON_ID("ssprs", &div6_clks[DIV6_SSPRS]),
252 263
253 /* MSTP */ 264 /* MSTP */
265 CLKDEV_ICK_ID("lvds.0", "rcar-du-r8a7790", &mstp_clks[MSTP726]),
266 CLKDEV_ICK_ID("lvds.1", "rcar-du-r8a7790", &mstp_clks[MSTP725]),
267 CLKDEV_ICK_ID("du.0", "rcar-du-r8a7790", &mstp_clks[MSTP724]),
268 CLKDEV_ICK_ID("du.1", "rcar-du-r8a7790", &mstp_clks[MSTP723]),
269 CLKDEV_ICK_ID("du.2", "rcar-du-r8a7790", &mstp_clks[MSTP722]),
254 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), 270 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]),
255 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), 271 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
256 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]), 272 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]),
@@ -261,6 +277,10 @@ static struct clk_lookup lookups[] = {
261 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP720]), 277 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP720]),
262 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP717]), 278 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP717]),
263 CLKDEV_DEV_ID("sh-sci.9", &mstp_clks[MSTP716]), 279 CLKDEV_DEV_ID("sh-sci.9", &mstp_clks[MSTP716]),
280 CLKDEV_DEV_ID("e6508000.i2c", &mstp_clks[MSTP931]),
281 CLKDEV_DEV_ID("e6518000.i2c", &mstp_clks[MSTP930]),
282 CLKDEV_DEV_ID("e6530000.i2c", &mstp_clks[MSTP929]),
283 CLKDEV_DEV_ID("e6540000.i2c", &mstp_clks[MSTP928]),
264 CLKDEV_DEV_ID("r8a7790-ether", &mstp_clks[MSTP813]), 284 CLKDEV_DEV_ID("r8a7790-ether", &mstp_clks[MSTP813]),
265 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), 285 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
266 CLKDEV_DEV_ID("ee200000.mmcif", &mstp_clks[MSTP315]), 286 CLKDEV_DEV_ID("ee200000.mmcif", &mstp_clks[MSTP315]),
@@ -290,7 +310,7 @@ static struct clk_lookup lookups[] = {
290 310
291void __init r8a7790_clock_init(void) 311void __init r8a7790_clock_init(void)
292{ 312{
293 u32 mode = r8a7790_read_mode_pins(); 313 u32 mode = rcar_gen2_read_mode_pins();
294 int k, ret = 0; 314 int k, ret = 0;
295 315
296 switch (mode & (MD(14) | MD(13))) { 316 switch (mode & (MD(14) | MD(13))) {
diff --git a/arch/arm/mach-shmobile/clock-r8a7791.c b/arch/arm/mach-shmobile/clock-r8a7791.c
new file mode 100644
index 000000000000..c9a26f16ce5b
--- /dev/null
+++ b/arch/arm/mach-shmobile/clock-r8a7791.c
@@ -0,0 +1,237 @@
1/*
2 * r8a7791 clock framework support
3 *
4 * Copyright (C) 2013 Renesas Electronics Corporation
5 * Copyright (C) 2013 Renesas Solutions Corp.
6 * Copyright (C) 2013 Magnus Damm
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21#include <linux/init.h>
22#include <linux/io.h>
23#include <linux/kernel.h>
24#include <linux/sh_clk.h>
25#include <linux/clkdev.h>
26#include <mach/clock.h>
27#include <mach/common.h>
28
29/*
30 * MD EXTAL PLL0 PLL1 PLL3
31 * 14 13 19 (MHz) *1 *1
32 *---------------------------------------------------
33 * 0 0 0 15 x 1 x172/2 x208/2 x106
34 * 0 0 1 15 x 1 x172/2 x208/2 x88
35 * 0 1 0 20 x 1 x130/2 x156/2 x80
36 * 0 1 1 20 x 1 x130/2 x156/2 x66
37 * 1 0 0 26 / 2 x200/2 x240/2 x122
38 * 1 0 1 26 / 2 x200/2 x240/2 x102
39 * 1 1 0 30 / 2 x172/2 x208/2 x106
40 * 1 1 1 30 / 2 x172/2 x208/2 x88
41 *
42 * *1 : Table 7.6 indicates VCO ouput (PLLx = VCO/2)
43 * see "p1 / 2" on R8A7791_CLOCK_ROOT() below
44 */
45
46#define MD(nr) (1 << nr)
47
48#define CPG_BASE 0xe6150000
49#define CPG_LEN 0x1000
50
51#define SMSTPCR0 0xE6150130
52#define SMSTPCR1 0xE6150134
53#define SMSTPCR2 0xe6150138
54#define SMSTPCR3 0xE615013C
55#define SMSTPCR5 0xE6150144
56#define SMSTPCR7 0xe615014c
57#define SMSTPCR8 0xE6150990
58#define SMSTPCR9 0xE6150994
59#define SMSTPCR10 0xE6150998
60#define SMSTPCR11 0xE615099C
61
62#define MODEMR 0xE6160060
63#define SDCKCR 0xE6150074
64#define SD2CKCR 0xE6150078
65#define SD3CKCR 0xE615007C
66#define MMC0CKCR 0xE6150240
67#define MMC1CKCR 0xE6150244
68#define SSPCKCR 0xE6150248
69#define SSPRSCKCR 0xE615024C
70
71static struct clk_mapping cpg_mapping = {
72 .phys = CPG_BASE,
73 .len = CPG_LEN,
74};
75
76static struct clk extal_clk = {
77 /* .rate will be updated on r8a7791_clock_init() */
78 .mapping = &cpg_mapping,
79};
80
81static struct sh_clk_ops followparent_clk_ops = {
82 .recalc = followparent_recalc,
83};
84
85static struct clk main_clk = {
86 /* .parent will be set r8a73a4_clock_init */
87 .ops = &followparent_clk_ops,
88};
89
90/*
91 * clock ratio of these clock will be updated
92 * on r8a7791_clock_init()
93 */
94SH_FIXED_RATIO_CLK_SET(pll1_clk, main_clk, 1, 1);
95SH_FIXED_RATIO_CLK_SET(pll3_clk, main_clk, 1, 1);
96
97/* fixed ratio clock */
98SH_FIXED_RATIO_CLK_SET(extal_div2_clk, extal_clk, 1, 2);
99SH_FIXED_RATIO_CLK_SET(cp_clk, extal_clk, 1, 2);
100
101SH_FIXED_RATIO_CLK_SET(pll1_div2_clk, pll1_clk, 1, 2);
102SH_FIXED_RATIO_CLK_SET(hp_clk, pll1_clk, 1, 12);
103SH_FIXED_RATIO_CLK_SET(p_clk, pll1_clk, 1, 24);
104SH_FIXED_RATIO_CLK_SET(rclk_clk, pll1_clk, 1, (48 * 1024));
105SH_FIXED_RATIO_CLK_SET(mp_clk, pll1_div2_clk, 1, 15);
106
107static struct clk *main_clks[] = {
108 &extal_clk,
109 &extal_div2_clk,
110 &main_clk,
111 &pll1_clk,
112 &pll1_div2_clk,
113 &pll3_clk,
114 &hp_clk,
115 &p_clk,
116 &rclk_clk,
117 &mp_clk,
118 &cp_clk,
119};
120
121/* MSTP */
122enum {
123 MSTP721, MSTP720,
124 MSTP719, MSTP718, MSTP715, MSTP714,
125 MSTP216, MSTP207, MSTP206,
126 MSTP204, MSTP203, MSTP202, MSTP1105, MSTP1106, MSTP1107,
127 MSTP124,
128 MSTP_NR
129};
130
131static struct clk mstp_clks[MSTP_NR] = {
132 [MSTP721] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 21, 0), /* SCIF0 */
133 [MSTP720] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 20, 0), /* SCIF1 */
134 [MSTP719] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 19, 0), /* SCIF2 */
135 [MSTP718] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 18, 0), /* SCIF3 */
136 [MSTP715] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 15, 0), /* SCIF4 */
137 [MSTP714] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 14, 0), /* SCIF5 */
138 [MSTP216] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 16, 0), /* SCIFB2 */
139 [MSTP207] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 7, 0), /* SCIFB1 */
140 [MSTP206] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 6, 0), /* SCIFB0 */
141 [MSTP204] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 4, 0), /* SCIFA0 */
142 [MSTP203] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 3, 0), /* SCIFA1 */
143 [MSTP202] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 2, 0), /* SCIFA2 */
144 [MSTP1105] = SH_CLK_MSTP32(&mp_clk, SMSTPCR11, 5, 0), /* SCIFA3 */
145 [MSTP1106] = SH_CLK_MSTP32(&mp_clk, SMSTPCR11, 6, 0), /* SCIFA4 */
146 [MSTP1107] = SH_CLK_MSTP32(&mp_clk, SMSTPCR11, 7, 0), /* SCIFA5 */
147 [MSTP124] = SH_CLK_MSTP32(&rclk_clk, SMSTPCR1, 24, 0), /* CMT0 */
148};
149
150static struct clk_lookup lookups[] = {
151
152 /* main clocks */
153 CLKDEV_CON_ID("extal", &extal_clk),
154 CLKDEV_CON_ID("extal_div2", &extal_div2_clk),
155 CLKDEV_CON_ID("main", &main_clk),
156 CLKDEV_CON_ID("pll1", &pll1_clk),
157 CLKDEV_CON_ID("pll1_div2", &pll1_div2_clk),
158 CLKDEV_CON_ID("pll3", &pll3_clk),
159 CLKDEV_CON_ID("hp", &hp_clk),
160 CLKDEV_CON_ID("p", &p_clk),
161 CLKDEV_CON_ID("rclk", &rclk_clk),
162 CLKDEV_CON_ID("mp", &mp_clk),
163 CLKDEV_CON_ID("cp", &cp_clk),
164 CLKDEV_CON_ID("peripheral_clk", &hp_clk),
165
166 /* MSTP */
167 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */
168 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */
169 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]), /* SCIFB0 */
170 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]), /* SCIFB1 */
171 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]), /* SCIFB2 */
172 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP202]), /* SCIFA2 */
173 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP721]), /* SCIF0 */
174 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP720]), /* SCIF1 */
175 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP719]), /* SCIF2 */
176 CLKDEV_DEV_ID("sh-sci.9", &mstp_clks[MSTP718]), /* SCIF3 */
177 CLKDEV_DEV_ID("sh-sci.10", &mstp_clks[MSTP715]), /* SCIF4 */
178 CLKDEV_DEV_ID("sh-sci.11", &mstp_clks[MSTP714]), /* SCIF5 */
179 CLKDEV_DEV_ID("sh-sci.12", &mstp_clks[MSTP1105]), /* SCIFA3 */
180 CLKDEV_DEV_ID("sh-sci.13", &mstp_clks[MSTP1106]), /* SCIFA4 */
181 CLKDEV_DEV_ID("sh-sci.14", &mstp_clks[MSTP1107]), /* SCIFA5 */
182 CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]),
183};
184
185#define R8A7791_CLOCK_ROOT(e, m, p0, p1, p30, p31) \
186 extal_clk.rate = e * 1000 * 1000; \
187 main_clk.parent = m; \
188 SH_CLK_SET_RATIO(&pll1_clk_ratio, p1 / 2, 1); \
189 if (mode & MD(19)) \
190 SH_CLK_SET_RATIO(&pll3_clk_ratio, p31, 1); \
191 else \
192 SH_CLK_SET_RATIO(&pll3_clk_ratio, p30, 1)
193
194
195void __init r8a7791_clock_init(void)
196{
197 void __iomem *modemr = ioremap_nocache(MODEMR, PAGE_SIZE);
198 u32 mode;
199 int k, ret = 0;
200
201 BUG_ON(!modemr);
202 mode = ioread32(modemr);
203 iounmap(modemr);
204
205 switch (mode & (MD(14) | MD(13))) {
206 case 0:
207 R8A7791_CLOCK_ROOT(15, &extal_clk, 172, 208, 106, 88);
208 break;
209 case MD(13):
210 R8A7791_CLOCK_ROOT(20, &extal_clk, 130, 156, 80, 66);
211 break;
212 case MD(14):
213 R8A7791_CLOCK_ROOT(26, &extal_div2_clk, 200, 240, 122, 102);
214 break;
215 case MD(13) | MD(14):
216 R8A7791_CLOCK_ROOT(30, &extal_div2_clk, 172, 208, 106, 88);
217 break;
218 }
219
220 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
221 ret = clk_register(main_clks[k]);
222
223 if (!ret)
224 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
225
226 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
227
228 if (!ret)
229 shmobile_clk_init();
230 else
231 goto epanic;
232
233 return;
234
235epanic:
236 panic("failed to setup r8a7791 clocks\n");
237}
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index 1942eaef5181..c92c023f0d27 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -616,7 +616,7 @@ static struct clk_lookup lookups[] = {
616 CLKDEV_DEV_ID("smp_twd", &twd_clk), /* smp_twd */ 616 CLKDEV_DEV_ID("smp_twd", &twd_clk), /* smp_twd */
617 617
618 /* DIV4 clocks */ 618 /* DIV4 clocks */
619 CLKDEV_DEV_ID("cpufreq-cpu0", &div4_clks[DIV4_Z]), 619 CLKDEV_DEV_ID("cpu0", &div4_clks[DIV4_Z]),
620 620
621 /* DIV6 clocks */ 621 /* DIV6 clocks */
622 CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]), 622 CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]),
diff --git a/arch/arm/mach-shmobile/headsmp.S b/arch/arm/mach-shmobile/headsmp.S
index f93751caf5cb..e5be5c88644b 100644
--- a/arch/arm/mach-shmobile/headsmp.S
+++ b/arch/arm/mach-shmobile/headsmp.S
@@ -40,6 +40,9 @@ shmobile_boot_fn:
40 .globl shmobile_boot_arg 40 .globl shmobile_boot_arg
41shmobile_boot_arg: 41shmobile_boot_arg:
422: .space 4 422: .space 4
43 .globl shmobile_boot_size
44shmobile_boot_size:
45 .long . - shmobile_boot_vector
43 46
44/* 47/*
45 * Per-CPU SMP boot function/argument selection code based on MPIDR 48 * Per-CPU SMP boot function/argument selection code based on MPIDR
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 7b938681e756..e31980590eb4 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -9,16 +9,23 @@ extern void shmobile_setup_console(void);
9extern void shmobile_boot_vector(void); 9extern void shmobile_boot_vector(void);
10extern unsigned long shmobile_boot_fn; 10extern unsigned long shmobile_boot_fn;
11extern unsigned long shmobile_boot_arg; 11extern unsigned long shmobile_boot_arg;
12extern unsigned long shmobile_boot_size;
12extern void shmobile_smp_boot(void); 13extern void shmobile_smp_boot(void);
13extern void shmobile_smp_sleep(void); 14extern void shmobile_smp_sleep(void);
14extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn, 15extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn,
15 unsigned long arg); 16 unsigned long arg);
17extern int shmobile_smp_cpu_disable(unsigned int cpu);
18extern void shmobile_invalidate_start(void);
16extern void shmobile_boot_scu(void); 19extern void shmobile_boot_scu(void);
17extern void shmobile_smp_scu_prepare_cpus(unsigned int max_cpus); 20extern void shmobile_smp_scu_prepare_cpus(unsigned int max_cpus);
18extern int shmobile_smp_scu_boot_secondary(unsigned int cpu,
19 struct task_struct *idle);
20extern void shmobile_smp_scu_cpu_die(unsigned int cpu); 21extern void shmobile_smp_scu_cpu_die(unsigned int cpu);
21extern int shmobile_smp_scu_cpu_kill(unsigned int cpu); 22extern int shmobile_smp_scu_cpu_kill(unsigned int cpu);
23extern void shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus);
24extern int shmobile_smp_apmu_boot_secondary(unsigned int cpu,
25 struct task_struct *idle);
26extern void shmobile_smp_apmu_cpu_die(unsigned int cpu);
27extern int shmobile_smp_apmu_cpu_kill(unsigned int cpu);
28extern void shmobile_invalidate_start(void);
22struct clk; 29struct clk;
23extern int shmobile_clk_init(void); 30extern int shmobile_clk_init(void);
24extern void shmobile_handle_irq_intc(struct pt_regs *); 31extern void shmobile_handle_irq_intc(struct pt_regs *);
@@ -39,7 +46,6 @@ static inline int shmobile_cpuidle_init(void) { return 0; }
39#endif 46#endif
40 47
41extern void __iomem *shmobile_scu_base; 48extern void __iomem *shmobile_scu_base;
42extern void shmobile_smp_init_cpus(unsigned int ncores);
43 49
44static inline void __init shmobile_init_late(void) 50static inline void __init shmobile_init_late(void)
45{ 51{
diff --git a/arch/arm/mach-shmobile/include/mach/r7s72100.h b/arch/arm/mach-shmobile/include/mach/r7s72100.h
new file mode 100644
index 000000000000..5f34b20ecd4a
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/r7s72100.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_R7S72100_H__
2#define __ASM_R7S72100_H__
3
4void r7s72100_add_dt_devices(void);
5void r7s72100_clock_init(void);
6void r7s72100_init_early(void);
7
8#endif /* __ASM_R7S72100_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a73a4.h b/arch/arm/mach-shmobile/include/mach/r8a73a4.h
index f3a9b702da56..ce8bdd1d8a8a 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a73a4.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a73a4.h
@@ -1,10 +1,19 @@
1#ifndef __ASM_R8A73A4_H__ 1#ifndef __ASM_R8A73A4_H__
2#define __ASM_R8A73A4_H__ 2#define __ASM_R8A73A4_H__
3 3
4/* DMA slave IDs */
5enum {
6 SHDMA_SLAVE_INVALID,
7 SHDMA_SLAVE_MMCIF0_TX,
8 SHDMA_SLAVE_MMCIF0_RX,
9 SHDMA_SLAVE_MMCIF1_TX,
10 SHDMA_SLAVE_MMCIF1_RX,
11};
12
4void r8a73a4_add_standard_devices(void); 13void r8a73a4_add_standard_devices(void);
5void r8a73a4_add_dt_devices(void); 14void r8a73a4_add_dt_devices(void);
6void r8a73a4_clock_init(void); 15void r8a73a4_clock_init(void);
7void r8a73a4_pinmux_init(void); 16void r8a73a4_pinmux_init(void);
8void r8a73a4_init_delay(void); 17void r8a73a4_init_early(void);
9 18
10#endif /* __ASM_R8A73A4_H__ */ 19#endif /* __ASM_R8A73A4_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7778.h b/arch/arm/mach-shmobile/include/mach/r8a7778.h
index adfcf51b163d..441886c9714b 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7778.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7778.h
@@ -1,6 +1,7 @@
1/* 1/*
2 * Copyright (C) 2013 Renesas Solutions Corp. 2 * Copyright (C) 2013 Renesas Solutions Corp.
3 * Copyright (C) 2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 3 * Copyright (C) 2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
4 * Copyright (C) 2013 Cogent Embedded, Inc.
4 * 5 *
5 * 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
6 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -21,11 +22,15 @@
21#include <linux/sh_eth.h> 22#include <linux/sh_eth.h>
22#include <linux/platform_data/camera-rcar.h> 23#include <linux/platform_data/camera-rcar.h>
23 24
25/* HPB-DMA slave IDs */
26enum {
27 HPBDMA_SLAVE_DUMMY,
28 HPBDMA_SLAVE_SDHI0_TX,
29 HPBDMA_SLAVE_SDHI0_RX,
30};
31
24extern void r8a7778_add_standard_devices(void); 32extern void r8a7778_add_standard_devices(void);
25extern void r8a7778_add_standard_devices_dt(void); 33extern void r8a7778_add_standard_devices_dt(void);
26extern void r8a7778_add_ether_device(struct sh_eth_plat_data *pdata);
27extern void r8a7778_add_vin_device(int id,
28 struct rcar_vin_platform_data *pdata);
29extern void r8a7778_add_dt_devices(void); 34extern void r8a7778_add_dt_devices(void);
30 35
31extern void r8a7778_init_late(void); 36extern void r8a7778_init_late(void);
@@ -33,6 +38,9 @@ extern void r8a7778_init_delay(void);
33extern void r8a7778_init_irq_dt(void); 38extern void r8a7778_init_irq_dt(void);
34extern void r8a7778_clock_init(void); 39extern void r8a7778_clock_init(void);
35extern void r8a7778_init_irq_extpin(int irlm); 40extern void r8a7778_init_irq_extpin(int irlm);
41extern void r8a7778_init_irq_extpin_dt(int irlm);
36extern void r8a7778_pinmux_init(void); 42extern void r8a7778_pinmux_init(void);
37 43
44extern int r8a7778_usb_phy_power(bool enable);
45
38#endif /* __ASM_R8A7778_H__ */ 46#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 11c740047e14..17af34ed89c8 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h
@@ -6,6 +6,13 @@
6#include <linux/sh_eth.h> 6#include <linux/sh_eth.h>
7#include <linux/platform_data/camera-rcar.h> 7#include <linux/platform_data/camera-rcar.h>
8 8
9/* HPB-DMA slave IDs */
10enum {
11 HPBDMA_SLAVE_DUMMY,
12 HPBDMA_SLAVE_SDHI0_TX,
13 HPBDMA_SLAVE_SDHI0_RX,
14};
15
9struct platform_device; 16struct platform_device;
10 17
11struct r8a7779_pm_ch { 18struct r8a7779_pm_ch {
@@ -26,6 +33,7 @@ static inline struct r8a7779_pm_ch *to_r8a7779_ch(struct generic_pm_domain *d)
26 33
27extern void r8a7779_init_delay(void); 34extern void r8a7779_init_delay(void);
28extern void r8a7779_init_irq_extpin(int irlm); 35extern void r8a7779_init_irq_extpin(int irlm);
36extern void r8a7779_init_irq_extpin_dt(int irlm);
29extern void r8a7779_init_irq_dt(void); 37extern void r8a7779_init_irq_dt(void);
30extern void r8a7779_map_io(void); 38extern void r8a7779_map_io(void);
31extern void r8a7779_earlytimer_init(void); 39extern void r8a7779_earlytimer_init(void);
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7790.h b/arch/arm/mach-shmobile/include/mach/r8a7790.h
index 788d55952091..5fbfa28b40b6 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7790.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7790.h
@@ -1,14 +1,13 @@
1#ifndef __ASM_R8A7790_H__ 1#ifndef __ASM_R8A7790_H__
2#define __ASM_R8A7790_H__ 2#define __ASM_R8A7790_H__
3 3
4#include <mach/rcar-gen2.h>
5
4void r8a7790_add_standard_devices(void); 6void r8a7790_add_standard_devices(void);
5void r8a7790_add_dt_devices(void); 7void r8a7790_add_dt_devices(void);
6void r8a7790_clock_init(void); 8void r8a7790_clock_init(void);
7void r8a7790_pinmux_init(void); 9void r8a7790_pinmux_init(void);
8void r8a7790_init_delay(void); 10void r8a7790_init_early(void);
9void r8a7790_timer_init(void); 11extern struct smp_operations r8a7790_smp_ops;
10
11#define MD(nr) BIT(nr)
12u32 r8a7790_read_mode_pins(void);
13 12
14#endif /* __ASM_R8A7790_H__ */ 13#endif /* __ASM_R8A7790_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7791.h b/arch/arm/mach-shmobile/include/mach/r8a7791.h
new file mode 100644
index 000000000000..051ead3c286e
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/r8a7791.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_R8A7791_H__
2#define __ASM_R8A7791_H__
3
4void r8a7791_add_standard_devices(void);
5void r8a7791_add_dt_devices(void);
6void r8a7791_clock_init(void);
7void r8a7791_init_early(void);
8extern struct smp_operations r8a7791_smp_ops;
9
10#endif /* __ASM_R8A7791_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/rcar-gen2.h b/arch/arm/mach-shmobile/include/mach/rcar-gen2.h
new file mode 100644
index 000000000000..43f606eb2d82
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/rcar-gen2.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_RCAR_GEN2_H__
2#define __ASM_RCAR_GEN2_H__
3
4void rcar_gen2_timer_init(void);
5#define MD(nr) BIT(nr)
6u32 rcar_gen2_read_mode_pins(void);
7
8#endif /* __ASM_RCAR_GEN2_H__ */
diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
new file mode 100644
index 000000000000..1da5a72d9642
--- /dev/null
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -0,0 +1,195 @@
1/*
2 * SMP support for SoCs with APMU
3 *
4 * Copyright (C) 2013 Magnus Damm
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#include <linux/delay.h>
11#include <linux/init.h>
12#include <linux/io.h>
13#include <linux/ioport.h>
14#include <linux/of_address.h>
15#include <linux/smp.h>
16#include <asm/cacheflush.h>
17#include <asm/cp15.h>
18#include <asm/smp_plat.h>
19#include <mach/common.h>
20
21static struct {
22 void __iomem *iomem;
23 int bit;
24} apmu_cpus[CONFIG_NR_CPUS];
25
26#define WUPCR_OFFS 0x10
27#define PSTR_OFFS 0x40
28#define CPUNCR_OFFS(n) (0x100 + (0x10 * (n)))
29
30static int apmu_power_on(void __iomem *p, int bit)
31{
32 /* request power on */
33 writel_relaxed(BIT(bit), p + WUPCR_OFFS);
34
35 /* wait for APMU to finish */
36 while (readl_relaxed(p + WUPCR_OFFS) != 0)
37 ;
38
39 return 0;
40}
41
42static int apmu_power_off(void __iomem *p, int bit)
43{
44 /* request Core Standby for next WFI */
45 writel_relaxed(3, p + CPUNCR_OFFS(bit));
46 return 0;
47}
48
49static int apmu_power_off_poll(void __iomem *p, int bit)
50{
51 int k;
52
53 for (k = 0; k < 1000; k++) {
54 if (((readl_relaxed(p + PSTR_OFFS) >> (bit * 4)) & 0x03) == 3)
55 return 1;
56
57 mdelay(1);
58 }
59
60 return 0;
61}
62
63static int apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
64{
65 void __iomem *p = apmu_cpus[cpu].iomem;
66
67 return p ? fn(p, apmu_cpus[cpu].bit) : -EINVAL;
68}
69
70static void apmu_init_cpu(struct resource *res, int cpu, int bit)
71{
72 if (apmu_cpus[cpu].iomem)
73 return;
74
75 apmu_cpus[cpu].iomem = ioremap_nocache(res->start, resource_size(res));
76 apmu_cpus[cpu].bit = bit;
77
78 pr_debug("apmu ioremap %d %d 0x%08x 0x%08x\n", cpu, bit,
79 res->start, resource_size(res));
80}
81
82static struct {
83 struct resource iomem;
84 int cpus[4];
85} apmu_config[] = {
86 {
87 .iomem = DEFINE_RES_MEM(0xe6152000, 0x88),
88 .cpus = { 0, 1, 2, 3 },
89 },
90 {
91 .iomem = DEFINE_RES_MEM(0xe6151000, 0x88),
92 .cpus = { 0x100, 0x101, 0x102, 0x103 },
93 }
94};
95
96static void apmu_parse_cfg(void (*fn)(struct resource *res, int cpu, int bit))
97{
98 u32 id;
99 int k;
100 int bit, index;
101 bool is_allowed;
102
103 for (k = 0; k < ARRAY_SIZE(apmu_config); k++) {
104 /* only enable the cluster that includes the boot CPU */
105 is_allowed = false;
106 for (bit = 0; bit < ARRAY_SIZE(apmu_config[k].cpus); bit++) {
107 id = apmu_config[k].cpus[bit];
108 if (id >= 0) {
109 if (id == cpu_logical_map(0))
110 is_allowed = true;
111 }
112 }
113 if (!is_allowed)
114 continue;
115
116 for (bit = 0; bit < ARRAY_SIZE(apmu_config[k].cpus); bit++) {
117 id = apmu_config[k].cpus[bit];
118 if (id >= 0) {
119 index = get_logical_index(id);
120 if (index >= 0)
121 fn(&apmu_config[k].iomem, index, bit);
122 }
123 }
124 }
125}
126
127void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus)
128{
129 /* install boot code shared by all CPUs */
130 shmobile_boot_fn = virt_to_phys(shmobile_smp_boot);
131 shmobile_boot_arg = MPIDR_HWID_BITMASK;
132
133 /* perform per-cpu setup */
134 apmu_parse_cfg(apmu_init_cpu);
135}
136
137int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
138{
139 /* For this particular CPU register boot vector */
140 shmobile_smp_hook(cpu, virt_to_phys(shmobile_invalidate_start), 0);
141
142 return apmu_wrap(cpu, apmu_power_on);
143}
144
145#ifdef CONFIG_HOTPLUG_CPU
146/* nicked from arch/arm/mach-exynos/hotplug.c */
147static inline void cpu_enter_lowpower_a15(void)
148{
149 unsigned int v;
150
151 asm volatile(
152 " mrc p15, 0, %0, c1, c0, 0\n"
153 " bic %0, %0, %1\n"
154 " mcr p15, 0, %0, c1, c0, 0\n"
155 : "=&r" (v)
156 : "Ir" (CR_C)
157 : "cc");
158
159 flush_cache_louis();
160
161 asm volatile(
162 /*
163 * Turn off coherency
164 */
165 " mrc p15, 0, %0, c1, c0, 1\n"
166 " bic %0, %0, %1\n"
167 " mcr p15, 0, %0, c1, c0, 1\n"
168 : "=&r" (v)
169 : "Ir" (0x40)
170 : "cc");
171
172 isb();
173 dsb();
174}
175
176void shmobile_smp_apmu_cpu_die(unsigned int cpu)
177{
178 /* For this particular CPU deregister boot vector */
179 shmobile_smp_hook(cpu, 0, 0);
180
181 /* Select next sleep mode using the APMU */
182 apmu_wrap(cpu, apmu_power_off);
183
184 /* Do ARM specific CPU shutdown */
185 cpu_enter_lowpower_a15();
186
187 /* jump to shared mach-shmobile sleep / reset code */
188 shmobile_smp_sleep();
189}
190
191int shmobile_smp_apmu_cpu_kill(unsigned int cpu)
192{
193 return apmu_wrap(cpu, apmu_power_off_poll);
194}
195#endif
diff --git a/arch/arm/mach-shmobile/platsmp-scu.c b/arch/arm/mach-shmobile/platsmp-scu.c
index c96f50160be6..673ad6e80869 100644
--- a/arch/arm/mach-shmobile/platsmp-scu.c
+++ b/arch/arm/mach-shmobile/platsmp-scu.c
@@ -7,6 +7,7 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#include <linux/cpu.h>
10#include <linux/delay.h> 11#include <linux/delay.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/io.h> 13#include <linux/io.h>
@@ -16,6 +17,26 @@
16#include <asm/smp_scu.h> 17#include <asm/smp_scu.h>
17#include <mach/common.h> 18#include <mach/common.h>
18 19
20static int shmobile_smp_scu_notifier_call(struct notifier_block *nfb,
21 unsigned long action, void *hcpu)
22{
23 unsigned int cpu = (long)hcpu;
24
25 switch (action) {
26 case CPU_UP_PREPARE:
27 /* For this particular CPU register SCU SMP boot vector */
28 shmobile_smp_hook(cpu, virt_to_phys(shmobile_boot_scu),
29 (unsigned long)shmobile_scu_base);
30 break;
31 };
32
33 return NOTIFY_OK;
34}
35
36static struct notifier_block shmobile_smp_scu_notifier = {
37 .notifier_call = shmobile_smp_scu_notifier_call,
38};
39
19void __init shmobile_smp_scu_prepare_cpus(unsigned int max_cpus) 40void __init shmobile_smp_scu_prepare_cpus(unsigned int max_cpus)
20{ 41{
21 /* install boot code shared by all CPUs */ 42 /* install boot code shared by all CPUs */
@@ -25,14 +46,9 @@ void __init shmobile_smp_scu_prepare_cpus(unsigned int max_cpus)
25 /* enable SCU and cache coherency on booting CPU */ 46 /* enable SCU and cache coherency on booting CPU */
26 scu_enable(shmobile_scu_base); 47 scu_enable(shmobile_scu_base);
27 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL); 48 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
28}
29 49
30int shmobile_smp_scu_boot_secondary(unsigned int cpu, struct task_struct *idle) 50 /* Use CPU notifier for reset vector control */
31{ 51 register_cpu_notifier(&shmobile_smp_scu_notifier);
32 /* For this particular CPU register SCU boot vector */
33 shmobile_smp_hook(cpu, virt_to_phys(shmobile_boot_scu),
34 (unsigned long)shmobile_scu_base);
35 return 0;
36} 52}
37 53
38#ifdef CONFIG_HOTPLUG_CPU 54#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
index d4ae616bcedb..9ebc246b8d7d 100644
--- a/arch/arm/mach-shmobile/platsmp.c
+++ b/arch/arm/mach-shmobile/platsmp.c
@@ -11,25 +11,10 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/smp.h>
15#include <asm/cacheflush.h> 14#include <asm/cacheflush.h>
16#include <asm/smp_plat.h> 15#include <asm/smp_plat.h>
17#include <mach/common.h> 16#include <mach/common.h>
18 17
19void __init shmobile_smp_init_cpus(unsigned int ncores)
20{
21 unsigned int i;
22
23 if (ncores > nr_cpu_ids) {
24 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
25 ncores, nr_cpu_ids);
26 ncores = nr_cpu_ids;
27 }
28
29 for (i = 0; i < ncores; i++)
30 set_cpu_possible(i, true);
31}
32
33extern unsigned long shmobile_smp_fn[]; 18extern unsigned long shmobile_smp_fn[];
34extern unsigned long shmobile_smp_arg[]; 19extern unsigned long shmobile_smp_arg[];
35extern unsigned long shmobile_smp_mpidr[]; 20extern unsigned long shmobile_smp_mpidr[];
@@ -44,3 +29,10 @@ void shmobile_smp_hook(unsigned int cpu, unsigned long fn, unsigned long arg)
44 shmobile_smp_arg[cpu] = arg; 29 shmobile_smp_arg[cpu] = arg;
45 flush_cache_all(); 30 flush_cache_all();
46} 31}
32
33#ifdef CONFIG_HOTPLUG_CPU
34int shmobile_smp_cpu_disable(unsigned int cpu)
35{
36 return 0; /* Hotplug of any CPU is supported */
37}
38#endif
diff --git a/arch/arm/mach-shmobile/setup-r7s72100.c b/arch/arm/mach-shmobile/setup-r7s72100.c
new file mode 100644
index 000000000000..d4eb509a1c87
--- /dev/null
+++ b/arch/arm/mach-shmobile/setup-r7s72100.c
@@ -0,0 +1,88 @@
1/*
2 * r7s72100 processor support
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Magnus Damm
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <linux/irq.h>
22#include <linux/kernel.h>
23#include <linux/of_platform.h>
24#include <linux/serial_sci.h>
25#include <mach/common.h>
26#include <mach/irqs.h>
27#include <mach/r7s72100.h>
28#include <asm/mach/arch.h>
29
30#define SCIF_DATA(index, baseaddr, irq) \
31[index] = { \
32 .type = PORT_SCIF, \
33 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, \
34 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
35 .scbrr_algo_id = SCBRR_ALGO_2, \
36 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | \
37 SCSCR_REIE, \
38 .mapbase = baseaddr, \
39 .irqs = { irq + 1, irq + 2, irq + 3, irq }, \
40}
41
42enum { SCIF0, SCIF1, SCIF2, SCIF3, SCIF4, SCIF5, SCIF6, SCIF7 };
43
44static const struct plat_sci_port scif[] __initconst = {
45 SCIF_DATA(SCIF0, 0xe8007000, gic_iid(221)), /* SCIF0 */
46 SCIF_DATA(SCIF1, 0xe8007800, gic_iid(225)), /* SCIF1 */
47 SCIF_DATA(SCIF2, 0xe8008000, gic_iid(229)), /* SCIF2 */
48 SCIF_DATA(SCIF3, 0xe8008800, gic_iid(233)), /* SCIF3 */
49 SCIF_DATA(SCIF4, 0xe8009000, gic_iid(237)), /* SCIF4 */
50 SCIF_DATA(SCIF5, 0xe8009800, gic_iid(241)), /* SCIF5 */
51 SCIF_DATA(SCIF6, 0xe800a000, gic_iid(245)), /* SCIF6 */
52 SCIF_DATA(SCIF7, 0xe800a800, gic_iid(249)), /* SCIF7 */
53};
54
55static inline void r7s72100_register_scif(int idx)
56{
57 platform_device_register_data(&platform_bus, "sh-sci", idx, &scif[idx],
58 sizeof(struct plat_sci_port));
59}
60
61void __init r7s72100_add_dt_devices(void)
62{
63 r7s72100_register_scif(SCIF0);
64 r7s72100_register_scif(SCIF1);
65 r7s72100_register_scif(SCIF2);
66 r7s72100_register_scif(SCIF3);
67 r7s72100_register_scif(SCIF4);
68 r7s72100_register_scif(SCIF5);
69 r7s72100_register_scif(SCIF6);
70 r7s72100_register_scif(SCIF7);
71}
72
73void __init r7s72100_init_early(void)
74{
75 shmobile_setup_delay(400, 1, 3); /* Cortex-A9 @ 400MHz */
76}
77
78#ifdef CONFIG_USE_OF
79static const char *r7s72100_boards_compat_dt[] __initdata = {
80 "renesas,r7s72100",
81 NULL,
82};
83
84DT_MACHINE_START(R7S72100_DT, "Generic R7S72100 (Flattened Device Tree)")
85 .init_early = r7s72100_init_early,
86 .dt_compat = r7s72100_boards_compat_dt,
87MACHINE_END
88#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
index 89491700afb7..b0f2749071be 100644
--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
+++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
@@ -22,8 +22,10 @@
22#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <linux/platform_data/irq-renesas-irqc.h> 23#include <linux/platform_data/irq-renesas-irqc.h>
24#include <linux/serial_sci.h> 24#include <linux/serial_sci.h>
25#include <linux/sh_dma.h>
25#include <linux/sh_timer.h> 26#include <linux/sh_timer.h>
26#include <mach/common.h> 27#include <mach/common.h>
28#include <mach/dma-register.h>
27#include <mach/irqs.h> 29#include <mach/irqs.h>
28#include <mach/r8a73a4.h> 30#include <mach/r8a73a4.h>
29#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
@@ -199,15 +201,104 @@ void __init r8a73a4_add_dt_devices(void)
199 r8a7790_register_cmt(10); 201 r8a7790_register_cmt(10);
200} 202}
201 203
204/* DMA */
205static const struct sh_dmae_slave_config dma_slaves[] = {
206 {
207 .slave_id = SHDMA_SLAVE_MMCIF0_TX,
208 .addr = 0xee200034,
209 .chcr = CHCR_TX(XMIT_SZ_32BIT),
210 .mid_rid = 0xd1,
211 }, {
212 .slave_id = SHDMA_SLAVE_MMCIF0_RX,
213 .addr = 0xee200034,
214 .chcr = CHCR_RX(XMIT_SZ_32BIT),
215 .mid_rid = 0xd2,
216 }, {
217 .slave_id = SHDMA_SLAVE_MMCIF1_TX,
218 .addr = 0xee220034,
219 .chcr = CHCR_TX(XMIT_SZ_32BIT),
220 .mid_rid = 0xe1,
221 }, {
222 .slave_id = SHDMA_SLAVE_MMCIF1_RX,
223 .addr = 0xee220034,
224 .chcr = CHCR_RX(XMIT_SZ_32BIT),
225 .mid_rid = 0xe2,
226 },
227};
228
229#define DMAE_CHANNEL(a, b) \
230 { \
231 .offset = (a) - 0x20, \
232 .dmars = (a) - 0x20 + 0x40, \
233 .chclr_bit = (b), \
234 .chclr_offset = 0x80 - 0x20, \
235 }
236
237static const struct sh_dmae_channel dma_channels[] = {
238 DMAE_CHANNEL(0x8000, 0),
239 DMAE_CHANNEL(0x8080, 1),
240 DMAE_CHANNEL(0x8100, 2),
241 DMAE_CHANNEL(0x8180, 3),
242 DMAE_CHANNEL(0x8200, 4),
243 DMAE_CHANNEL(0x8280, 5),
244 DMAE_CHANNEL(0x8300, 6),
245 DMAE_CHANNEL(0x8380, 7),
246 DMAE_CHANNEL(0x8400, 8),
247 DMAE_CHANNEL(0x8480, 9),
248 DMAE_CHANNEL(0x8500, 10),
249 DMAE_CHANNEL(0x8580, 11),
250 DMAE_CHANNEL(0x8600, 12),
251 DMAE_CHANNEL(0x8680, 13),
252 DMAE_CHANNEL(0x8700, 14),
253 DMAE_CHANNEL(0x8780, 15),
254 DMAE_CHANNEL(0x8800, 16),
255 DMAE_CHANNEL(0x8880, 17),
256 DMAE_CHANNEL(0x8900, 18),
257 DMAE_CHANNEL(0x8980, 19),
258};
259
260static const struct sh_dmae_pdata dma_pdata = {
261 .slave = dma_slaves,
262 .slave_num = ARRAY_SIZE(dma_slaves),
263 .channel = dma_channels,
264 .channel_num = ARRAY_SIZE(dma_channels),
265 .ts_low_shift = TS_LOW_SHIFT,
266 .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
267 .ts_high_shift = TS_HI_SHIFT,
268 .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
269 .ts_shift = dma_ts_shift,
270 .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
271 .dmaor_init = DMAOR_DME,
272 .chclr_present = 1,
273 .chclr_bitwise = 1,
274};
275
276static struct resource dma_resources[] = {
277 DEFINE_RES_MEM(0xe6700020, 0x89e0),
278 DEFINE_RES_IRQ_NAMED(gic_spi(220), "error_irq"),
279 {
280 /* IRQ for channels 0-19 */
281 .start = gic_spi(200),
282 .end = gic_spi(219),
283 .flags = IORESOURCE_IRQ,
284 },
285};
286
287#define r8a73a4_register_dmac() \
288 platform_device_register_resndata(&platform_bus, "sh-dma-engine", 0, \
289 dma_resources, ARRAY_SIZE(dma_resources), \
290 &dma_pdata, sizeof(dma_pdata))
291
202void __init r8a73a4_add_standard_devices(void) 292void __init r8a73a4_add_standard_devices(void)
203{ 293{
204 r8a73a4_add_dt_devices(); 294 r8a73a4_add_dt_devices();
205 r8a73a4_register_irqc(0); 295 r8a73a4_register_irqc(0);
206 r8a73a4_register_irqc(1); 296 r8a73a4_register_irqc(1);
207 r8a73a4_register_thermal(); 297 r8a73a4_register_thermal();
298 r8a73a4_register_dmac();
208} 299}
209 300
210void __init r8a73a4_init_delay(void) 301void __init r8a73a4_init_early(void)
211{ 302{
212#ifndef CONFIG_ARM_ARCH_TIMER 303#ifndef CONFIG_ARM_ARCH_TIMER
213 shmobile_setup_delay(1500, 2, 4); /* Cortex-A15 @ 1500MHz */ 304 shmobile_setup_delay(1500, 2, 4); /* Cortex-A15 @ 1500MHz */
@@ -222,7 +313,7 @@ static const char *r8a73a4_boards_compat_dt[] __initdata = {
222}; 313};
223 314
224DT_MACHINE_START(R8A73A4_DT, "Generic R8A73A4 (Flattened Device Tree)") 315DT_MACHINE_START(R8A73A4_DT, "Generic R8A73A4 (Flattened Device Tree)")
225 .init_early = r8a73a4_init_delay, 316 .init_early = r8a73a4_init_early,
226 .dt_compat = r8a73a4_boards_compat_dt, 317 .dt_compat = r8a73a4_boards_compat_dt,
227MACHINE_END 318MACHINE_END
228#endif /* CONFIG_USE_OF */ 319#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
index 6a2657ebd197..03fcc5974ef9 100644
--- a/arch/arm/mach-shmobile/setup-r8a7778.c
+++ b/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -24,6 +24,7 @@
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/dma-rcar-hpbdma.h>
27#include <linux/platform_data/gpio-rcar.h> 28#include <linux/platform_data/gpio-rcar.h>
28#include <linux/platform_data/irq-renesas-intc-irqpin.h> 29#include <linux/platform_data/irq-renesas-intc-irqpin.h>
29#include <linux/platform_device.h> 30#include <linux/platform_device.h>
@@ -95,29 +96,46 @@ static struct sh_timer_config sh_tmu1_platform_data __initdata = {
95 &sh_tmu##idx##_platform_data, \ 96 &sh_tmu##idx##_platform_data, \
96 sizeof(sh_tmu##idx##_platform_data)) 97 sizeof(sh_tmu##idx##_platform_data))
97 98
98/* USB */ 99int r8a7778_usb_phy_power(bool enable)
99static struct usb_phy *phy; 100{
101 static struct usb_phy *phy = NULL;
102 int ret = 0;
100 103
104 if (!phy)
105 phy = usb_get_phy(USB_PHY_TYPE_USB2);
106
107 if (IS_ERR(phy)) {
108 pr_err("kernel doesn't have usb phy driver\n");
109 return PTR_ERR(phy);
110 }
111
112 if (enable)
113 ret = usb_phy_init(phy);
114 else
115 usb_phy_shutdown(phy);
116
117 return ret;
118}
119
120/* USB */
101static int usb_power_on(struct platform_device *pdev) 121static int usb_power_on(struct platform_device *pdev)
102{ 122{
103 if (IS_ERR(phy)) 123 int ret = r8a7778_usb_phy_power(true);
104 return PTR_ERR(phy); 124
125 if (ret)
126 return ret;
105 127
106 pm_runtime_enable(&pdev->dev); 128 pm_runtime_enable(&pdev->dev);
107 pm_runtime_get_sync(&pdev->dev); 129 pm_runtime_get_sync(&pdev->dev);
108 130
109 usb_phy_init(phy);
110
111 return 0; 131 return 0;
112} 132}
113 133
114static void usb_power_off(struct platform_device *pdev) 134static void usb_power_off(struct platform_device *pdev)
115{ 135{
116 if (IS_ERR(phy)) 136 if (r8a7778_usb_phy_power(false))
117 return; 137 return;
118 138
119 usb_phy_shutdown(phy);
120
121 pm_runtime_put_sync(&pdev->dev); 139 pm_runtime_put_sync(&pdev->dev);
122 pm_runtime_disable(&pdev->dev); 140 pm_runtime_disable(&pdev->dev);
123} 141}
@@ -174,20 +192,6 @@ static struct platform_device_info hci##_info __initdata = { \
174USB_PLATFORM_INFO(ehci); 192USB_PLATFORM_INFO(ehci);
175USB_PLATFORM_INFO(ohci); 193USB_PLATFORM_INFO(ohci);
176 194
177/* Ether */
178static struct resource ether_resources[] __initdata = {
179 DEFINE_RES_MEM(0xfde00000, 0x400),
180 DEFINE_RES_IRQ(gic_iid(0x89)),
181};
182
183void __init r8a7778_add_ether_device(struct sh_eth_plat_data *pdata)
184{
185 platform_device_register_resndata(&platform_bus, "r8a777x-ether", -1,
186 ether_resources,
187 ARRAY_SIZE(ether_resources),
188 pdata, sizeof(*pdata));
189}
190
191/* PFC/GPIO */ 195/* PFC/GPIO */
192static struct resource pfc_resources[] __initdata = { 196static struct resource pfc_resources[] __initdata = {
193 DEFINE_RES_MEM(0xfffc0000, 0x118), 197 DEFINE_RES_MEM(0xfffc0000, 0x118),
@@ -272,7 +276,7 @@ static struct resource hspi_resources[] __initdata = {
272 DEFINE_RES_IRQ(gic_iid(0x75)), 276 DEFINE_RES_IRQ(gic_iid(0x75)),
273}; 277};
274 278
275void __init r8a7778_register_hspi(int id) 279static void __init r8a7778_register_hspi(int id)
276{ 280{
277 BUG_ON(id < 0 || id > 2); 281 BUG_ON(id < 0 || id > 2);
278 282
@@ -281,40 +285,6 @@ void __init r8a7778_register_hspi(int id)
281 hspi_resources + (2 * id), 2); 285 hspi_resources + (2 * id), 2);
282} 286}
283 287
284/* VIN */
285#define R8A7778_VIN(idx) \
286static struct resource vin##idx##_resources[] __initdata = { \
287 DEFINE_RES_MEM(0xffc50000 + 0x1000 * (idx), 0x1000), \
288 DEFINE_RES_IRQ(gic_iid(0x5a)), \
289}; \
290 \
291static struct platform_device_info vin##idx##_info __initdata = { \
292 .parent = &platform_bus, \
293 .name = "r8a7778-vin", \
294 .id = idx, \
295 .res = vin##idx##_resources, \
296 .num_res = ARRAY_SIZE(vin##idx##_resources), \
297 .dma_mask = DMA_BIT_MASK(32), \
298}
299
300R8A7778_VIN(0);
301R8A7778_VIN(1);
302
303static struct platform_device_info *vin_info_table[] __initdata = {
304 &vin0_info,
305 &vin1_info,
306};
307
308void __init r8a7778_add_vin_device(int id, struct rcar_vin_platform_data *pdata)
309{
310 BUG_ON(id < 0 || id > 1);
311
312 vin_info_table[id]->data = pdata;
313 vin_info_table[id]->size_data = sizeof(*pdata);
314
315 platform_device_register_full(vin_info_table[id]);
316}
317
318void __init r8a7778_add_dt_devices(void) 288void __init r8a7778_add_dt_devices(void)
319{ 289{
320 int i; 290 int i;
@@ -339,6 +309,88 @@ void __init r8a7778_add_dt_devices(void)
339 r8a7778_register_tmu(1); 309 r8a7778_register_tmu(1);
340} 310}
341 311
312/* HPB-DMA */
313
314/* Asynchronous mode register (ASYNCMDR) bits */
315#define HPB_DMAE_ASYNCMDR_ASMD22_MASK BIT(2) /* SDHI0 */
316#define HPB_DMAE_ASYNCMDR_ASMD22_SINGLE BIT(2) /* SDHI0 */
317#define HPB_DMAE_ASYNCMDR_ASMD22_MULTI 0 /* SDHI0 */
318#define HPB_DMAE_ASYNCMDR_ASMD21_MASK BIT(1) /* SDHI0 */
319#define HPB_DMAE_ASYNCMDR_ASMD21_SINGLE BIT(1) /* SDHI0 */
320#define HPB_DMAE_ASYNCMDR_ASMD21_MULTI 0 /* SDHI0 */
321
322static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = {
323 {
324 .id = HPBDMA_SLAVE_SDHI0_TX,
325 .addr = 0xffe4c000 + 0x30,
326 .dcr = HPB_DMAE_DCR_SPDS_16BIT |
327 HPB_DMAE_DCR_DMDL |
328 HPB_DMAE_DCR_DPDS_16BIT,
329 .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 |
330 HPB_DMAE_ASYNCRSTR_ASRST22 |
331 HPB_DMAE_ASYNCRSTR_ASRST23,
332 .mdr = HPB_DMAE_ASYNCMDR_ASMD21_MULTI,
333 .mdm = HPB_DMAE_ASYNCMDR_ASMD21_MASK,
334 .port = 0x0D0C,
335 .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
336 .dma_ch = 21,
337 }, {
338 .id = HPBDMA_SLAVE_SDHI0_RX,
339 .addr = 0xffe4c000 + 0x30,
340 .dcr = HPB_DMAE_DCR_SMDL |
341 HPB_DMAE_DCR_SPDS_16BIT |
342 HPB_DMAE_DCR_DPDS_16BIT,
343 .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 |
344 HPB_DMAE_ASYNCRSTR_ASRST22 |
345 HPB_DMAE_ASYNCRSTR_ASRST23,
346 .mdr = HPB_DMAE_ASYNCMDR_ASMD22_MULTI,
347 .mdm = HPB_DMAE_ASYNCMDR_ASMD22_MASK,
348 .port = 0x0D0C,
349 .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
350 .dma_ch = 22,
351 },
352};
353
354static const struct hpb_dmae_channel hpb_dmae_channels[] = {
355 HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_TX), /* ch. 21 */
356 HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_RX), /* ch. 22 */
357};
358
359static struct hpb_dmae_pdata dma_platform_data __initdata = {
360 .slaves = hpb_dmae_slaves,
361 .num_slaves = ARRAY_SIZE(hpb_dmae_slaves),
362 .channels = hpb_dmae_channels,
363 .num_channels = ARRAY_SIZE(hpb_dmae_channels),
364 .ts_shift = {
365 [XMIT_SZ_8BIT] = 0,
366 [XMIT_SZ_16BIT] = 1,
367 [XMIT_SZ_32BIT] = 2,
368 },
369 .num_hw_channels = 39,
370};
371
372static struct resource hpb_dmae_resources[] __initdata = {
373 /* Channel registers */
374 DEFINE_RES_MEM(0xffc08000, 0x1000),
375 /* Common registers */
376 DEFINE_RES_MEM(0xffc09000, 0x170),
377 /* Asynchronous reset registers */
378 DEFINE_RES_MEM(0xffc00300, 4),
379 /* Asynchronous mode registers */
380 DEFINE_RES_MEM(0xffc00400, 4),
381 /* IRQ for DMA channels */
382 DEFINE_RES_NAMED(gic_iid(0x7b), 5, NULL, IORESOURCE_IRQ),
383};
384
385static void __init r8a7778_register_hpb_dmae(void)
386{
387 platform_device_register_resndata(&platform_bus, "hpb-dma-engine", -1,
388 hpb_dmae_resources,
389 ARRAY_SIZE(hpb_dmae_resources),
390 &dma_platform_data,
391 sizeof(dma_platform_data));
392}
393
342void __init r8a7778_add_standard_devices(void) 394void __init r8a7778_add_standard_devices(void)
343{ 395{
344 r8a7778_add_dt_devices(); 396 r8a7778_add_dt_devices();
@@ -349,12 +401,12 @@ void __init r8a7778_add_standard_devices(void)
349 r8a7778_register_hspi(0); 401 r8a7778_register_hspi(0);
350 r8a7778_register_hspi(1); 402 r8a7778_register_hspi(1);
351 r8a7778_register_hspi(2); 403 r8a7778_register_hspi(2);
404
405 r8a7778_register_hpb_dmae();
352} 406}
353 407
354void __init r8a7778_init_late(void) 408void __init r8a7778_init_late(void)
355{ 409{
356 phy = usb_get_phy(USB_PHY_TYPE_USB2);
357
358 platform_device_register_full(&ehci_info); 410 platform_device_register_full(&ehci_info);
359 platform_device_register_full(&ohci_info); 411 platform_device_register_full(&ohci_info);
360} 412}
@@ -376,7 +428,7 @@ static struct resource irqpin_resources[] __initdata = {
376 DEFINE_RES_IRQ(gic_iid(0x3e)), /* IRQ3 */ 428 DEFINE_RES_IRQ(gic_iid(0x3e)), /* IRQ3 */
377}; 429};
378 430
379void __init r8a7778_init_irq_extpin(int irlm) 431void __init r8a7778_init_irq_extpin_dt(int irlm)
380{ 432{
381 void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE); 433 void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE);
382 unsigned long tmp; 434 unsigned long tmp;
@@ -394,7 +446,11 @@ void __init r8a7778_init_irq_extpin(int irlm)
394 tmp |= (1 << 21); /* LVLMODE = 1 */ 446 tmp |= (1 << 21); /* LVLMODE = 1 */
395 iowrite32(tmp, icr0); 447 iowrite32(tmp, icr0);
396 iounmap(icr0); 448 iounmap(icr0);
449}
397 450
451void __init r8a7778_init_irq_extpin(int irlm)
452{
453 r8a7778_init_irq_extpin_dt(irlm);
398 if (irlm) 454 if (irlm)
399 platform_device_register_resndata( 455 platform_device_register_resndata(
400 &platform_bus, "renesas_intc_irqpin", -1, 456 &platform_bus, "renesas_intc_irqpin", -1,
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index ecd0148ee1e1..13049e9d691c 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -25,6 +25,7 @@
25#include <linux/irqchip.h> 25#include <linux/irqchip.h>
26#include <linux/irqchip/arm-gic.h> 26#include <linux/irqchip/arm-gic.h>
27#include <linux/of_platform.h> 27#include <linux/of_platform.h>
28#include <linux/platform_data/dma-rcar-hpbdma.h>
28#include <linux/platform_data/gpio-rcar.h> 29#include <linux/platform_data/gpio-rcar.h>
29#include <linux/platform_data/irq-renesas-intc-irqpin.h> 30#include <linux/platform_data/irq-renesas-intc-irqpin.h>
30#include <linux/platform_device.h> 31#include <linux/platform_device.h>
@@ -97,7 +98,7 @@ static struct resource irqpin0_resources[] __initdata = {
97 DEFINE_RES_IRQ(gic_spi(30)), /* IRQ3 */ 98 DEFINE_RES_IRQ(gic_spi(30)), /* IRQ3 */
98}; 99};
99 100
100void __init r8a7779_init_irq_extpin(int irlm) 101void __init r8a7779_init_irq_extpin_dt(int irlm)
101{ 102{
102 void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE); 103 void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE);
103 u32 tmp; 104 u32 tmp;
@@ -115,7 +116,11 @@ void __init r8a7779_init_irq_extpin(int irlm)
115 tmp |= (1 << 21); /* LVLMODE = 1 */ 116 tmp |= (1 << 21); /* LVLMODE = 1 */
116 iowrite32(tmp, icr0); 117 iowrite32(tmp, icr0);
117 iounmap(icr0); 118 iounmap(icr0);
119}
118 120
121void __init r8a7779_init_irq_extpin(int irlm)
122{
123 r8a7779_init_irq_extpin_dt(irlm);
119 if (irlm) 124 if (irlm)
120 platform_device_register_resndata( 125 platform_device_register_resndata(
121 &platform_bus, "renesas_intc_irqpin", -1, 126 &platform_bus, "renesas_intc_irqpin", -1,
@@ -632,6 +637,158 @@ static struct platform_device_info *vin_info_table[] __initdata = {
632 &vin3_info, 637 &vin3_info,
633}; 638};
634 639
640/* HPB-DMA */
641
642/* Asynchronous mode register bits */
643#define HPB_DMAE_ASYNCMDR_ASMD43_MASK BIT(23) /* MMC1 */
644#define HPB_DMAE_ASYNCMDR_ASMD43_SINGLE BIT(23) /* MMC1 */
645#define HPB_DMAE_ASYNCMDR_ASMD43_MULTI 0 /* MMC1 */
646#define HPB_DMAE_ASYNCMDR_ASBTMD43_MASK BIT(22) /* MMC1 */
647#define HPB_DMAE_ASYNCMDR_ASBTMD43_BURST BIT(22) /* MMC1 */
648#define HPB_DMAE_ASYNCMDR_ASBTMD43_NBURST 0 /* MMC1 */
649#define HPB_DMAE_ASYNCMDR_ASMD24_MASK BIT(21) /* MMC0 */
650#define HPB_DMAE_ASYNCMDR_ASMD24_SINGLE BIT(21) /* MMC0 */
651#define HPB_DMAE_ASYNCMDR_ASMD24_MULTI 0 /* MMC0 */
652#define HPB_DMAE_ASYNCMDR_ASBTMD24_MASK BIT(20) /* MMC0 */
653#define HPB_DMAE_ASYNCMDR_ASBTMD24_BURST BIT(20) /* MMC0 */
654#define HPB_DMAE_ASYNCMDR_ASBTMD24_NBURST 0 /* MMC0 */
655#define HPB_DMAE_ASYNCMDR_ASMD41_MASK BIT(19) /* SDHI3 */
656#define HPB_DMAE_ASYNCMDR_ASMD41_SINGLE BIT(19) /* SDHI3 */
657#define HPB_DMAE_ASYNCMDR_ASMD41_MULTI 0 /* SDHI3 */
658#define HPB_DMAE_ASYNCMDR_ASBTMD41_MASK BIT(18) /* SDHI3 */
659#define HPB_DMAE_ASYNCMDR_ASBTMD41_BURST BIT(18) /* SDHI3 */
660#define HPB_DMAE_ASYNCMDR_ASBTMD41_NBURST 0 /* SDHI3 */
661#define HPB_DMAE_ASYNCMDR_ASMD40_MASK BIT(17) /* SDHI3 */
662#define HPB_DMAE_ASYNCMDR_ASMD40_SINGLE BIT(17) /* SDHI3 */
663#define HPB_DMAE_ASYNCMDR_ASMD40_MULTI 0 /* SDHI3 */
664#define HPB_DMAE_ASYNCMDR_ASBTMD40_MASK BIT(16) /* SDHI3 */
665#define HPB_DMAE_ASYNCMDR_ASBTMD40_BURST BIT(16) /* SDHI3 */
666#define HPB_DMAE_ASYNCMDR_ASBTMD40_NBURST 0 /* SDHI3 */
667#define HPB_DMAE_ASYNCMDR_ASMD39_MASK BIT(15) /* SDHI3 */
668#define HPB_DMAE_ASYNCMDR_ASMD39_SINGLE BIT(15) /* SDHI3 */
669#define HPB_DMAE_ASYNCMDR_ASMD39_MULTI 0 /* SDHI3 */
670#define HPB_DMAE_ASYNCMDR_ASBTMD39_MASK BIT(14) /* SDHI3 */
671#define HPB_DMAE_ASYNCMDR_ASBTMD39_BURST BIT(14) /* SDHI3 */
672#define HPB_DMAE_ASYNCMDR_ASBTMD39_NBURST 0 /* SDHI3 */
673#define HPB_DMAE_ASYNCMDR_ASMD27_MASK BIT(13) /* SDHI2 */
674#define HPB_DMAE_ASYNCMDR_ASMD27_SINGLE BIT(13) /* SDHI2 */
675#define HPB_DMAE_ASYNCMDR_ASMD27_MULTI 0 /* SDHI2 */
676#define HPB_DMAE_ASYNCMDR_ASBTMD27_MASK BIT(12) /* SDHI2 */
677#define HPB_DMAE_ASYNCMDR_ASBTMD27_BURST BIT(12) /* SDHI2 */
678#define HPB_DMAE_ASYNCMDR_ASBTMD27_NBURST 0 /* SDHI2 */
679#define HPB_DMAE_ASYNCMDR_ASMD26_MASK BIT(11) /* SDHI2 */
680#define HPB_DMAE_ASYNCMDR_ASMD26_SINGLE BIT(11) /* SDHI2 */
681#define HPB_DMAE_ASYNCMDR_ASMD26_MULTI 0 /* SDHI2 */
682#define HPB_DMAE_ASYNCMDR_ASBTMD26_MASK BIT(10) /* SDHI2 */
683#define HPB_DMAE_ASYNCMDR_ASBTMD26_BURST BIT(10) /* SDHI2 */
684#define HPB_DMAE_ASYNCMDR_ASBTMD26_NBURST 0 /* SDHI2 */
685#define HPB_DMAE_ASYNCMDR_ASMD25_MASK BIT(9) /* SDHI2 */
686#define HPB_DMAE_ASYNCMDR_ASMD25_SINGLE BIT(9) /* SDHI2 */
687#define HPB_DMAE_ASYNCMDR_ASMD25_MULTI 0 /* SDHI2 */
688#define HPB_DMAE_ASYNCMDR_ASBTMD25_MASK BIT(8) /* SDHI2 */
689#define HPB_DMAE_ASYNCMDR_ASBTMD25_BURST BIT(8) /* SDHI2 */
690#define HPB_DMAE_ASYNCMDR_ASBTMD25_NBURST 0 /* SDHI2 */
691#define HPB_DMAE_ASYNCMDR_ASMD23_MASK BIT(7) /* SDHI0 */
692#define HPB_DMAE_ASYNCMDR_ASMD23_SINGLE BIT(7) /* SDHI0 */
693#define HPB_DMAE_ASYNCMDR_ASMD23_MULTI 0 /* SDHI0 */
694#define HPB_DMAE_ASYNCMDR_ASBTMD23_MASK BIT(6) /* SDHI0 */
695#define HPB_DMAE_ASYNCMDR_ASBTMD23_BURST BIT(6) /* SDHI0 */
696#define HPB_DMAE_ASYNCMDR_ASBTMD23_NBURST 0 /* SDHI0 */
697#define HPB_DMAE_ASYNCMDR_ASMD22_MASK BIT(5) /* SDHI0 */
698#define HPB_DMAE_ASYNCMDR_ASMD22_SINGLE BIT(5) /* SDHI0 */
699#define HPB_DMAE_ASYNCMDR_ASMD22_MULTI 0 /* SDHI0 */
700#define HPB_DMAE_ASYNCMDR_ASBTMD22_MASK BIT(4) /* SDHI0 */
701#define HPB_DMAE_ASYNCMDR_ASBTMD22_BURST BIT(4) /* SDHI0 */
702#define HPB_DMAE_ASYNCMDR_ASBTMD22_NBURST 0 /* SDHI0 */
703#define HPB_DMAE_ASYNCMDR_ASMD21_MASK BIT(3) /* SDHI0 */
704#define HPB_DMAE_ASYNCMDR_ASMD21_SINGLE BIT(3) /* SDHI0 */
705#define HPB_DMAE_ASYNCMDR_ASMD21_MULTI 0 /* SDHI0 */
706#define HPB_DMAE_ASYNCMDR_ASBTMD21_MASK BIT(2) /* SDHI0 */
707#define HPB_DMAE_ASYNCMDR_ASBTMD21_BURST BIT(2) /* SDHI0 */
708#define HPB_DMAE_ASYNCMDR_ASBTMD21_NBURST 0 /* SDHI0 */
709#define HPB_DMAE_ASYNCMDR_ASMD20_MASK BIT(1) /* SDHI1 */
710#define HPB_DMAE_ASYNCMDR_ASMD20_SINGLE BIT(1) /* SDHI1 */
711#define HPB_DMAE_ASYNCMDR_ASMD20_MULTI 0 /* SDHI1 */
712#define HPB_DMAE_ASYNCMDR_ASBTMD20_MASK BIT(0) /* SDHI1 */
713#define HPB_DMAE_ASYNCMDR_ASBTMD20_BURST BIT(0) /* SDHI1 */
714#define HPB_DMAE_ASYNCMDR_ASBTMD20_NBURST 0 /* SDHI1 */
715
716static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = {
717 {
718 .id = HPBDMA_SLAVE_SDHI0_TX,
719 .addr = 0xffe4c000 + 0x30,
720 .dcr = HPB_DMAE_DCR_SPDS_16BIT |
721 HPB_DMAE_DCR_DMDL |
722 HPB_DMAE_DCR_DPDS_16BIT,
723 .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 |
724 HPB_DMAE_ASYNCRSTR_ASRST22 |
725 HPB_DMAE_ASYNCRSTR_ASRST23,
726 .mdr = HPB_DMAE_ASYNCMDR_ASMD21_SINGLE |
727 HPB_DMAE_ASYNCMDR_ASBTMD21_NBURST,
728 .mdm = HPB_DMAE_ASYNCMDR_ASMD21_MASK |
729 HPB_DMAE_ASYNCMDR_ASBTMD21_MASK,
730 .port = 0x0D0C,
731 .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
732 .dma_ch = 21,
733 }, {
734 .id = HPBDMA_SLAVE_SDHI0_RX,
735 .addr = 0xffe4c000 + 0x30,
736 .dcr = HPB_DMAE_DCR_SMDL |
737 HPB_DMAE_DCR_SPDS_16BIT |
738 HPB_DMAE_DCR_DPDS_16BIT,
739 .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 |
740 HPB_DMAE_ASYNCRSTR_ASRST22 |
741 HPB_DMAE_ASYNCRSTR_ASRST23,
742 .mdr = HPB_DMAE_ASYNCMDR_ASMD22_SINGLE |
743 HPB_DMAE_ASYNCMDR_ASBTMD22_NBURST,
744 .mdm = HPB_DMAE_ASYNCMDR_ASMD22_MASK |
745 HPB_DMAE_ASYNCMDR_ASBTMD22_MASK,
746 .port = 0x0D0C,
747 .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
748 .dma_ch = 22,
749 },
750};
751
752static const struct hpb_dmae_channel hpb_dmae_channels[] = {
753 HPB_DMAE_CHANNEL(0x93, HPBDMA_SLAVE_SDHI0_TX), /* ch. 21 */
754 HPB_DMAE_CHANNEL(0x93, HPBDMA_SLAVE_SDHI0_RX), /* ch. 22 */
755};
756
757static struct hpb_dmae_pdata dma_platform_data __initdata = {
758 .slaves = hpb_dmae_slaves,
759 .num_slaves = ARRAY_SIZE(hpb_dmae_slaves),
760 .channels = hpb_dmae_channels,
761 .num_channels = ARRAY_SIZE(hpb_dmae_channels),
762 .ts_shift = {
763 [XMIT_SZ_8BIT] = 0,
764 [XMIT_SZ_16BIT] = 1,
765 [XMIT_SZ_32BIT] = 2,
766 },
767 .num_hw_channels = 44,
768};
769
770static struct resource hpb_dmae_resources[] __initdata = {
771 /* Channel registers */
772 DEFINE_RES_MEM(0xffc08000, 0x1000),
773 /* Common registers */
774 DEFINE_RES_MEM(0xffc09000, 0x170),
775 /* Asynchronous reset registers */
776 DEFINE_RES_MEM(0xffc00300, 4),
777 /* Asynchronous mode registers */
778 DEFINE_RES_MEM(0xffc00400, 4),
779 /* IRQ for DMA channels */
780 DEFINE_RES_NAMED(gic_iid(0x8e), 12, NULL, IORESOURCE_IRQ),
781};
782
783static void __init r8a7779_register_hpb_dmae(void)
784{
785 platform_device_register_resndata(&platform_bus, "hpb-dma-engine", -1,
786 hpb_dmae_resources,
787 ARRAY_SIZE(hpb_dmae_resources),
788 &dma_platform_data,
789 sizeof(dma_platform_data));
790}
791
635static struct platform_device *r8a7779_devices_dt[] __initdata = { 792static struct platform_device *r8a7779_devices_dt[] __initdata = {
636 &scif0_device, 793 &scif0_device,
637 &scif1_device, 794 &scif1_device,
@@ -665,6 +822,7 @@ void __init r8a7779_add_standard_devices(void)
665 ARRAY_SIZE(r8a7779_devices_dt)); 822 ARRAY_SIZE(r8a7779_devices_dt));
666 platform_add_devices(r8a7779_standard_devices, 823 platform_add_devices(r8a7779_standard_devices,
667 ARRAY_SIZE(r8a7779_standard_devices)); 824 ARRAY_SIZE(r8a7779_standard_devices));
825 r8a7779_register_hpb_dmae();
668} 826}
669 827
670void __init r8a7779_add_ether_device(struct sh_eth_plat_data *pdata) 828void __init r8a7779_add_ether_device(struct sh_eth_plat_data *pdata)
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index d0f5c9f9349a..c47bcebbcb00 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -18,7 +18,6 @@
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/clocksource.h>
22#include <linux/irq.h> 21#include <linux/irq.h>
23#include <linux/kernel.h> 22#include <linux/kernel.h>
24#include <linux/of_platform.h> 23#include <linux/of_platform.h>
@@ -31,17 +30,18 @@
31#include <mach/r8a7790.h> 30#include <mach/r8a7790.h>
32#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
33 32
34static struct resource pfc_resources[] __initdata = { 33static const struct resource pfc_resources[] __initconst = {
35 DEFINE_RES_MEM(0xe6060000, 0x250), 34 DEFINE_RES_MEM(0xe6060000, 0x250),
36}; 35};
37 36
38#define R8A7790_GPIO(idx) \ 37#define R8A7790_GPIO(idx) \
39static struct resource r8a7790_gpio##idx##_resources[] __initdata = { \ 38static const struct resource r8a7790_gpio##idx##_resources[] __initconst = { \
40 DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50), \ 39 DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50), \
41 DEFINE_RES_IRQ(gic_spi(4 + (idx))), \ 40 DEFINE_RES_IRQ(gic_spi(4 + (idx))), \
42}; \ 41}; \
43 \ 42 \
44static struct gpio_rcar_config r8a7790_gpio##idx##_platform_data __initdata = { \ 43static const struct gpio_rcar_config \
44r8a7790_gpio##idx##_platform_data __initconst = { \
45 .gpio_base = 32 * (idx), \ 45 .gpio_base = 32 * (idx), \
46 .irq_base = 0, \ 46 .irq_base = 0, \
47 .number_of_pins = 32, \ 47 .number_of_pins = 32, \
@@ -112,7 +112,7 @@ void __init r8a7790_pinmux_init(void)
112enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFA2, SCIF0, SCIF1, 112enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFA2, SCIF0, SCIF1,
113 HSCIF0, HSCIF1 }; 113 HSCIF0, HSCIF1 };
114 114
115static struct plat_sci_port scif[] __initdata = { 115static const struct plat_sci_port scif[] __initconst = {
116 SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */ 116 SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */
117 SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */ 117 SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */
118 SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */ 118 SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */
@@ -131,11 +131,11 @@ static inline void r8a7790_register_scif(int idx)
131 sizeof(struct plat_sci_port)); 131 sizeof(struct plat_sci_port));
132} 132}
133 133
134static struct renesas_irqc_config irqc0_data __initdata = { 134static const struct renesas_irqc_config irqc0_data __initconst = {
135 .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */ 135 .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */
136}; 136};
137 137
138static struct resource irqc0_resources[] __initdata = { 138static const struct resource irqc0_resources[] __initconst = {
139 DEFINE_RES_MEM(0xe61c0000, 0x200), /* IRQC Event Detector Block_0 */ 139 DEFINE_RES_MEM(0xe61c0000, 0x200), /* IRQC Event Detector Block_0 */
140 DEFINE_RES_IRQ(gic_spi(0)), /* IRQ0 */ 140 DEFINE_RES_IRQ(gic_spi(0)), /* IRQ0 */
141 DEFINE_RES_IRQ(gic_spi(1)), /* IRQ1 */ 141 DEFINE_RES_IRQ(gic_spi(1)), /* IRQ1 */
@@ -150,7 +150,7 @@ static struct resource irqc0_resources[] __initdata = {
150 &irqc##idx##_data, \ 150 &irqc##idx##_data, \
151 sizeof(struct renesas_irqc_config)) 151 sizeof(struct renesas_irqc_config))
152 152
153static struct resource thermal_resources[] __initdata = { 153static const struct resource thermal_resources[] __initconst = {
154 DEFINE_RES_MEM(0xe61f0000, 0x14), 154 DEFINE_RES_MEM(0xe61f0000, 0x14),
155 DEFINE_RES_MEM(0xe61f0100, 0x38), 155 DEFINE_RES_MEM(0xe61f0100, 0x38),
156 DEFINE_RES_IRQ(gic_spi(69)), 156 DEFINE_RES_IRQ(gic_spi(69)),
@@ -161,13 +161,13 @@ static struct resource thermal_resources[] __initdata = {
161 thermal_resources, \ 161 thermal_resources, \
162 ARRAY_SIZE(thermal_resources)) 162 ARRAY_SIZE(thermal_resources))
163 163
164static struct sh_timer_config cmt00_platform_data __initdata = { 164static const struct sh_timer_config cmt00_platform_data __initconst = {
165 .name = "CMT00", 165 .name = "CMT00",
166 .timer_bit = 0, 166 .timer_bit = 0,
167 .clockevent_rating = 80, 167 .clockevent_rating = 80,
168}; 168};
169 169
170static struct resource cmt00_resources[] __initdata = { 170static const struct resource cmt00_resources[] __initconst = {
171 DEFINE_RES_MEM(0xffca0510, 0x0c), 171 DEFINE_RES_MEM(0xffca0510, 0x0c),
172 DEFINE_RES_MEM(0xffca0500, 0x04), 172 DEFINE_RES_MEM(0xffca0500, 0x04),
173 DEFINE_RES_IRQ(gic_spi(142)), /* CMT0_0 */ 173 DEFINE_RES_IRQ(gic_spi(142)), /* CMT0_0 */
@@ -202,72 +202,7 @@ void __init r8a7790_add_standard_devices(void)
202 r8a7790_register_thermal(); 202 r8a7790_register_thermal();
203} 203}
204 204
205#define MODEMR 0xe6160060 205void __init r8a7790_init_early(void)
206
207u32 __init r8a7790_read_mode_pins(void)
208{
209 void __iomem *modemr = ioremap_nocache(MODEMR, 4);
210 u32 mode;
211
212 BUG_ON(!modemr);
213 mode = ioread32(modemr);
214 iounmap(modemr);
215
216 return mode;
217}
218
219#define CNTCR 0
220#define CNTFID0 0x20
221
222void __init r8a7790_timer_init(void)
223{
224#ifdef CONFIG_ARM_ARCH_TIMER
225 u32 mode = r8a7790_read_mode_pins();
226 void __iomem *base;
227 int extal_mhz = 0;
228 u32 freq;
229
230 /* At Linux boot time the r8a7790 arch timer comes up
231 * with the counter disabled. Moreover, it may also report
232 * a potentially incorrect fixed 13 MHz frequency. To be
233 * correct these registers need to be updated to use the
234 * frequency EXTAL / 2 which can be determined by the MD pins.
235 */
236
237 switch (mode & (MD(14) | MD(13))) {
238 case 0:
239 extal_mhz = 15;
240 break;
241 case MD(13):
242 extal_mhz = 20;
243 break;
244 case MD(14):
245 extal_mhz = 26;
246 break;
247 case MD(13) | MD(14):
248 extal_mhz = 30;
249 break;
250 }
251
252 /* The arch timer frequency equals EXTAL / 2 */
253 freq = extal_mhz * (1000000 / 2);
254
255 /* Remap "armgcnt address map" space */
256 base = ioremap(0xe6080000, PAGE_SIZE);
257
258 /* Update registers with correct frequency */
259 iowrite32(freq, base + CNTFID0);
260 asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
261
262 /* make sure arch timer is started by setting bit 0 of CNTCR */
263 iowrite32(1, base + CNTCR);
264 iounmap(base);
265#endif /* CONFIG_ARM_ARCH_TIMER */
266
267 clocksource_of_init();
268}
269
270void __init r8a7790_init_delay(void)
271{ 206{
272#ifndef CONFIG_ARM_ARCH_TIMER 207#ifndef CONFIG_ARM_ARCH_TIMER
273 shmobile_setup_delay(1300, 2, 4); /* Cortex-A15 @ 1300MHz */ 208 shmobile_setup_delay(1300, 2, 4); /* Cortex-A15 @ 1300MHz */
@@ -276,14 +211,15 @@ void __init r8a7790_init_delay(void)
276 211
277#ifdef CONFIG_USE_OF 212#ifdef CONFIG_USE_OF
278 213
279static const char *r8a7790_boards_compat_dt[] __initdata = { 214static const char * const r8a7790_boards_compat_dt[] __initconst = {
280 "renesas,r8a7790", 215 "renesas,r8a7790",
281 NULL, 216 NULL,
282}; 217};
283 218
284DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)") 219DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)")
285 .init_early = r8a7790_init_delay, 220 .smp = smp_ops(r8a7790_smp_ops),
286 .init_time = r8a7790_timer_init, 221 .init_early = r8a7790_init_early,
222 .init_time = rcar_gen2_timer_init,
287 .dt_compat = r8a7790_boards_compat_dt, 223 .dt_compat = r8a7790_boards_compat_dt,
288MACHINE_END 224MACHINE_END
289#endif /* CONFIG_USE_OF */ 225#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
new file mode 100644
index 000000000000..d9393d61ee27
--- /dev/null
+++ b/arch/arm/mach-shmobile/setup-r8a7791.c
@@ -0,0 +1,184 @@
1/*
2 * r8a7791 processor support
3 *
4 * Copyright (C) 2013 Renesas Electronics Corporation
5 * Copyright (C) 2013 Renesas Solutions Corp.
6 * Copyright (C) 2013 Magnus Damm
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include <linux/irq.h>
23#include <linux/kernel.h>
24#include <linux/of_platform.h>
25#include <linux/platform_data/irq-renesas-irqc.h>
26#include <linux/serial_sci.h>
27#include <linux/sh_timer.h>
28#include <mach/common.h>
29#include <mach/irqs.h>
30#include <mach/r8a7791.h>
31#include <mach/rcar-gen2.h>
32#include <asm/mach/arch.h>
33
34#define SCIF_COMMON(scif_type, baseaddr, irq) \
35 .type = scif_type, \
36 .mapbase = baseaddr, \
37 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
38 .irqs = SCIx_IRQ_MUXED(irq)
39
40#define SCIFA_DATA(index, baseaddr, irq) \
41[index] = { \
42 SCIF_COMMON(PORT_SCIFA, baseaddr, irq), \
43 .scbrr_algo_id = SCBRR_ALGO_4, \
44 .scscr = SCSCR_RE | SCSCR_TE, \
45}
46
47#define SCIFB_DATA(index, baseaddr, irq) \
48[index] = { \
49 SCIF_COMMON(PORT_SCIFB, baseaddr, irq), \
50 .scbrr_algo_id = SCBRR_ALGO_4, \
51 .scscr = SCSCR_RE | SCSCR_TE, \
52}
53
54#define SCIF_DATA(index, baseaddr, irq) \
55[index] = { \
56 SCIF_COMMON(PORT_SCIF, baseaddr, irq), \
57 .scbrr_algo_id = SCBRR_ALGO_2, \
58 .scscr = SCSCR_RE | SCSCR_TE, \
59}
60
61#define HSCIF_DATA(index, baseaddr, irq) \
62[index] = { \
63 SCIF_COMMON(PORT_HSCIF, baseaddr, irq), \
64 .scbrr_algo_id = SCBRR_ALGO_6, \
65 .scscr = SCSCR_RE | SCSCR_TE, \
66}
67
68enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFA2, SCIF0, SCIF1,
69 SCIF2, SCIF3, SCIF4, SCIF5, SCIFA3, SCIFA4, SCIFA5 };
70
71static const struct plat_sci_port scif[] __initconst = {
72 SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */
73 SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */
74 SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */
75 SCIFB_DATA(SCIFB1, 0xe6c30000, gic_spi(149)), /* SCIFB1 */
76 SCIFB_DATA(SCIFB2, 0xe6ce0000, gic_spi(150)), /* SCIFB2 */
77 SCIFA_DATA(SCIFA2, 0xe6c60000, gic_spi(151)), /* SCIFA2 */
78 SCIF_DATA(SCIF0, 0xe6e60000, gic_spi(152)), /* SCIF0 */
79 SCIF_DATA(SCIF1, 0xe6e68000, gic_spi(153)), /* SCIF1 */
80 SCIF_DATA(SCIF2, 0xe6e58000, gic_spi(22)), /* SCIF2 */
81 SCIF_DATA(SCIF3, 0xe6ea8000, gic_spi(23)), /* SCIF3 */
82 SCIF_DATA(SCIF4, 0xe6ee0000, gic_spi(24)), /* SCIF4 */
83 SCIF_DATA(SCIF5, 0xe6ee8000, gic_spi(25)), /* SCIF5 */
84 SCIFA_DATA(SCIFA3, 0xe6c70000, gic_spi(29)), /* SCIFA3 */
85 SCIFA_DATA(SCIFA4, 0xe6c78000, gic_spi(30)), /* SCIFA4 */
86 SCIFA_DATA(SCIFA5, 0xe6c80000, gic_spi(31)), /* SCIFA5 */
87};
88
89static inline void r8a7791_register_scif(int idx)
90{
91 platform_device_register_data(&platform_bus, "sh-sci", idx, &scif[idx],
92 sizeof(struct plat_sci_port));
93}
94
95static const struct sh_timer_config cmt00_platform_data __initconst = {
96 .name = "CMT00",
97 .timer_bit = 0,
98 .clockevent_rating = 80,
99};
100
101static const struct resource cmt00_resources[] __initconst = {
102 DEFINE_RES_MEM(0xffca0510, 0x0c),
103 DEFINE_RES_MEM(0xffca0500, 0x04),
104 DEFINE_RES_IRQ(gic_spi(142)), /* CMT0_0 */
105};
106
107#define r8a7791_register_cmt(idx) \
108 platform_device_register_resndata(&platform_bus, "sh_cmt", \
109 idx, cmt##idx##_resources, \
110 ARRAY_SIZE(cmt##idx##_resources), \
111 &cmt##idx##_platform_data, \
112 sizeof(struct sh_timer_config))
113
114static struct renesas_irqc_config irqc0_data = {
115 .irq_base = irq_pin(0), /* IRQ0 -> IRQ9 */
116};
117
118static struct resource irqc0_resources[] = {
119 DEFINE_RES_MEM(0xe61c0000, 0x200), /* IRQC Event Detector Block_0 */
120 DEFINE_RES_IRQ(gic_spi(0)), /* IRQ0 */
121 DEFINE_RES_IRQ(gic_spi(1)), /* IRQ1 */
122 DEFINE_RES_IRQ(gic_spi(2)), /* IRQ2 */
123 DEFINE_RES_IRQ(gic_spi(3)), /* IRQ3 */
124 DEFINE_RES_IRQ(gic_spi(12)), /* IRQ4 */
125 DEFINE_RES_IRQ(gic_spi(13)), /* IRQ5 */
126 DEFINE_RES_IRQ(gic_spi(14)), /* IRQ6 */
127 DEFINE_RES_IRQ(gic_spi(15)), /* IRQ7 */
128 DEFINE_RES_IRQ(gic_spi(16)), /* IRQ8 */
129 DEFINE_RES_IRQ(gic_spi(17)), /* IRQ9 */
130};
131
132#define r8a7791_register_irqc(idx) \
133 platform_device_register_resndata(&platform_bus, "renesas_irqc", \
134 idx, irqc##idx##_resources, \
135 ARRAY_SIZE(irqc##idx##_resources), \
136 &irqc##idx##_data, \
137 sizeof(struct renesas_irqc_config))
138
139void __init r8a7791_add_dt_devices(void)
140{
141 r8a7791_register_scif(SCIFA0);
142 r8a7791_register_scif(SCIFA1);
143 r8a7791_register_scif(SCIFB0);
144 r8a7791_register_scif(SCIFB1);
145 r8a7791_register_scif(SCIFB2);
146 r8a7791_register_scif(SCIFA2);
147 r8a7791_register_scif(SCIF0);
148 r8a7791_register_scif(SCIF1);
149 r8a7791_register_scif(SCIF2);
150 r8a7791_register_scif(SCIF3);
151 r8a7791_register_scif(SCIF4);
152 r8a7791_register_scif(SCIF5);
153 r8a7791_register_scif(SCIFA3);
154 r8a7791_register_scif(SCIFA4);
155 r8a7791_register_scif(SCIFA5);
156 r8a7791_register_cmt(00);
157}
158
159void __init r8a7791_add_standard_devices(void)
160{
161 r8a7791_add_dt_devices();
162 r8a7791_register_irqc(0);
163}
164
165void __init r8a7791_init_early(void)
166{
167#ifndef CONFIG_ARM_ARCH_TIMER
168 shmobile_setup_delay(1300, 2, 4); /* Cortex-A15 @ 1300MHz */
169#endif
170}
171
172#ifdef CONFIG_USE_OF
173static const char *r8a7791_boards_compat_dt[] __initdata = {
174 "renesas,r8a7791",
175 NULL,
176};
177
178DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)")
179 .smp = smp_ops(r8a7791_smp_ops),
180 .init_early = r8a7791_init_early,
181 .init_time = rcar_gen2_timer_init,
182 .dt_compat = r8a7791_boards_compat_dt,
183MACHINE_END
184#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
new file mode 100644
index 000000000000..5734c24bf6c7
--- /dev/null
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -0,0 +1,91 @@
1/*
2 * R-Car Generation 2 support
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Magnus Damm
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <linux/clocksource.h>
22#include <linux/io.h>
23#include <linux/kernel.h>
24#include <mach/common.h>
25#include <mach/rcar-gen2.h>
26#include <asm/mach/arch.h>
27
28#define MODEMR 0xe6160060
29
30u32 __init rcar_gen2_read_mode_pins(void)
31{
32 void __iomem *modemr = ioremap_nocache(MODEMR, 4);
33 u32 mode;
34
35 BUG_ON(!modemr);
36 mode = ioread32(modemr);
37 iounmap(modemr);
38
39 return mode;
40}
41
42#define CNTCR 0
43#define CNTFID0 0x20
44
45void __init rcar_gen2_timer_init(void)
46{
47#ifdef CONFIG_ARM_ARCH_TIMER
48 u32 mode = rcar_gen2_read_mode_pins();
49 void __iomem *base;
50 int extal_mhz = 0;
51 u32 freq;
52
53 /* At Linux boot time the r8a7790 arch timer comes up
54 * with the counter disabled. Moreover, it may also report
55 * a potentially incorrect fixed 13 MHz frequency. To be
56 * correct these registers need to be updated to use the
57 * frequency EXTAL / 2 which can be determined by the MD pins.
58 */
59
60 switch (mode & (MD(14) | MD(13))) {
61 case 0:
62 extal_mhz = 15;
63 break;
64 case MD(13):
65 extal_mhz = 20;
66 break;
67 case MD(14):
68 extal_mhz = 26;
69 break;
70 case MD(13) | MD(14):
71 extal_mhz = 30;
72 break;
73 }
74
75 /* The arch timer frequency equals EXTAL / 2 */
76 freq = extal_mhz * (1000000 / 2);
77
78 /* Remap "armgcnt address map" space */
79 base = ioremap(0xe6080000, PAGE_SIZE);
80
81 /* Update registers with correct frequency */
82 iowrite32(freq, base + CNTFID0);
83 asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
84
85 /* make sure arch timer is started by setting bit 0 of CNTCR */
86 iowrite32(1, base + CNTCR);
87 iounmap(base);
88#endif /* CONFIG_ARM_ARCH_TIMER */
89
90 clocksource_of_init();
91}
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index 522de5ebb55f..f2ca92308f75 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -34,12 +34,6 @@
34 34
35static int emev2_boot_secondary(unsigned int cpu, struct task_struct *idle) 35static int emev2_boot_secondary(unsigned int cpu, struct task_struct *idle)
36{ 36{
37 int ret;
38
39 ret = shmobile_smp_scu_boot_secondary(cpu, idle);
40 if (ret)
41 return ret;
42
43 arch_send_wakeup_ipi_mask(cpumask_of(cpu_logical_map(cpu))); 37 arch_send_wakeup_ipi_mask(cpumask_of(cpu_logical_map(cpu)));
44 return 0; 38 return 0;
45} 39}
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index 0f05e9fb722f..627c1f0d9478 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -87,10 +87,6 @@ static int r8a7779_boot_secondary(unsigned int cpu, struct task_struct *idle)
87 unsigned int lcpu = cpu_logical_map(cpu); 87 unsigned int lcpu = cpu_logical_map(cpu);
88 int ret; 88 int ret;
89 89
90 ret = shmobile_smp_scu_boot_secondary(cpu, idle);
91 if (ret)
92 return ret;
93
94 if (lcpu < ARRAY_SIZE(r8a7779_ch_cpu)) 90 if (lcpu < ARRAY_SIZE(r8a7779_ch_cpu))
95 ch = r8a7779_ch_cpu[lcpu]; 91 ch = r8a7779_ch_cpu[lcpu];
96 92
diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c b/arch/arm/mach-shmobile/smp-r8a7790.c
new file mode 100644
index 000000000000..015e2753de1f
--- /dev/null
+++ b/arch/arm/mach-shmobile/smp-r8a7790.c
@@ -0,0 +1,67 @@
1/*
2 * SMP support for r8a7790
3 *
4 * Copyright (C) 2012-2013 Renesas Solutions Corp.
5 * Copyright (C) 2012 Takashi Yoshii <takashi.yoshii.ze@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#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/smp.h>
19#include <linux/io.h>
20#include <asm/smp_plat.h>
21#include <mach/common.h>
22
23#define RST 0xe6160000
24#define CA15BAR 0x0020
25#define CA7BAR 0x0030
26#define CA15RESCNT 0x0040
27#define CA7RESCNT 0x0044
28#define MERAM 0xe8080000
29
30static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus)
31{
32 void __iomem *p;
33 u32 bar;
34
35 /* let APMU code install data related to shmobile_boot_vector */
36 shmobile_smp_apmu_prepare_cpus(max_cpus);
37
38 /* MERAM for jump stub, because BAR requires 256KB aligned address */
39 p = ioremap_nocache(MERAM, shmobile_boot_size);
40 memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
41 iounmap(p);
42
43 /* setup reset vectors */
44 p = ioremap_nocache(RST, 0x63);
45 bar = (MERAM >> 8) & 0xfffffc00;
46 writel_relaxed(bar, p + CA15BAR);
47 writel_relaxed(bar, p + CA7BAR);
48 writel_relaxed(bar | 0x10, p + CA15BAR);
49 writel_relaxed(bar | 0x10, p + CA7BAR);
50
51 /* enable clocks to all CPUs */
52 writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
53 p + CA15RESCNT);
54 writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | 0x5a5a0000,
55 p + CA7RESCNT);
56 iounmap(p);
57}
58
59struct smp_operations r8a7790_smp_ops __initdata = {
60 .smp_prepare_cpus = r8a7790_smp_prepare_cpus,
61 .smp_boot_secondary = shmobile_smp_apmu_boot_secondary,
62#ifdef CONFIG_HOTPLUG_CPU
63 .cpu_disable = shmobile_smp_cpu_disable,
64 .cpu_die = shmobile_smp_apmu_cpu_die,
65 .cpu_kill = shmobile_smp_apmu_cpu_kill,
66#endif
67};
diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c
new file mode 100644
index 000000000000..2df5bd190fe4
--- /dev/null
+++ b/arch/arm/mach-shmobile/smp-r8a7791.c
@@ -0,0 +1,62 @@
1/*
2 * SMP support for r8a7791
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Magnus Damm
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/smp.h>
19#include <linux/io.h>
20#include <asm/smp_plat.h>
21#include <mach/common.h>
22#include <mach/r8a7791.h>
23
24#define RST 0xe6160000
25#define CA15BAR 0x0020
26#define CA15RESCNT 0x0040
27#define RAM 0xe6300000
28
29static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus)
30{
31 void __iomem *p;
32 u32 bar;
33
34 /* let APMU code install data related to shmobile_boot_vector */
35 shmobile_smp_apmu_prepare_cpus(max_cpus);
36
37 /* RAM for jump stub, because BAR requires 256KB aligned address */
38 p = ioremap_nocache(RAM, shmobile_boot_size);
39 memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
40 iounmap(p);
41
42 /* setup reset vectors */
43 p = ioremap_nocache(RST, 0x63);
44 bar = (RAM >> 8) & 0xfffffc00;
45 writel_relaxed(bar, p + CA15BAR);
46 writel_relaxed(bar | 0x10, p + CA15BAR);
47
48 /* enable clocks to all CPUs */
49 writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
50 p + CA15RESCNT);
51 iounmap(p);
52}
53
54struct smp_operations r8a7791_smp_ops __initdata = {
55 .smp_prepare_cpus = r8a7791_smp_prepare_cpus,
56 .smp_boot_secondary = shmobile_smp_apmu_boot_secondary,
57#ifdef CONFIG_HOTPLUG_CPU
58 .cpu_disable = shmobile_smp_cpu_disable,
59 .cpu_die = shmobile_smp_apmu_cpu_die,
60 .cpu_kill = shmobile_smp_apmu_cpu_kill,
61#endif
62};
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index 0baa24443793..13ba36a6831f 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -46,11 +46,6 @@ void __init sh73a0_register_twd(void)
46static int sh73a0_boot_secondary(unsigned int cpu, struct task_struct *idle) 46static int sh73a0_boot_secondary(unsigned int cpu, struct task_struct *idle)
47{ 47{
48 unsigned int lcpu = cpu_logical_map(cpu); 48 unsigned int lcpu = cpu_logical_map(cpu);
49 int ret;
50
51 ret = shmobile_smp_scu_boot_secondary(cpu, idle);
52 if (ret)
53 return ret;
54 49
55 if (((__raw_readl(PSTR) >> (4 * lcpu)) & 3) == 3) 50 if (((__raw_readl(PSTR) >> (4 * lcpu)) & 3) == 3)
56 __raw_writel(1 << lcpu, WUPCR); /* wake up */ 51 __raw_writel(1 << lcpu, WUPCR); /* wake up */
@@ -71,18 +66,11 @@ static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus)
71 shmobile_smp_scu_prepare_cpus(max_cpus); 66 shmobile_smp_scu_prepare_cpus(max_cpus);
72} 67}
73 68
74#ifdef CONFIG_HOTPLUG_CPU
75static int sh73a0_cpu_disable(unsigned int cpu)
76{
77 return 0; /* CPU0 and CPU1 supported */
78}
79#endif /* CONFIG_HOTPLUG_CPU */
80
81struct smp_operations sh73a0_smp_ops __initdata = { 69struct smp_operations sh73a0_smp_ops __initdata = {
82 .smp_prepare_cpus = sh73a0_smp_prepare_cpus, 70 .smp_prepare_cpus = sh73a0_smp_prepare_cpus,
83 .smp_boot_secondary = sh73a0_boot_secondary, 71 .smp_boot_secondary = sh73a0_boot_secondary,
84#ifdef CONFIG_HOTPLUG_CPU 72#ifdef CONFIG_HOTPLUG_CPU
85 .cpu_disable = sh73a0_cpu_disable, 73 .cpu_disable = shmobile_smp_cpu_disable,
86 .cpu_die = shmobile_smp_scu_cpu_die, 74 .cpu_die = shmobile_smp_scu_cpu_die,
87 .cpu_kill = shmobile_smp_scu_cpu_kill, 75 .cpu_kill = shmobile_smp_scu_cpu_kill,
88#endif 76#endif
diff --git a/arch/arm/mach-socfpga/Kconfig b/arch/arm/mach-socfpga/Kconfig
index dd86db467521..037100a1563a 100644
--- a/arch/arm/mach-socfpga/Kconfig
+++ b/arch/arm/mach-socfpga/Kconfig
@@ -4,7 +4,6 @@ config ARCH_SOCFPGA
4 select ARM_AMBA 4 select ARM_AMBA
5 select ARM_GIC 5 select ARM_GIC
6 select CACHE_L2X0 6 select CACHE_L2X0
7 select CLKDEV_LOOKUP
8 select COMMON_CLK 7 select COMMON_CLK
9 select CPU_V7 8 select CPU_V7
10 select DW_APB_TIMER_OF 9 select DW_APB_TIMER_OF
diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index bfce9641e32f..dd0d49cdbe09 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/clk-provider.h>
18#include <linux/irqchip.h> 17#include <linux/irqchip.h>
19#include <linux/of_address.h> 18#include <linux/of_address.h>
20#include <linux/of_irq.h> 19#include <linux/of_irq.h>
@@ -107,7 +106,6 @@ static void __init socfpga_cyclone5_init(void)
107{ 106{
108 l2x0_of_init(0, ~0UL); 107 l2x0_of_init(0, ~0UL);
109 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 108 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
110 of_clk_init(NULL);
111 socfpga_init_clocks(); 109 socfpga_init_clocks();
112} 110}
113 111
diff --git a/arch/arm/mach-spear/Kconfig b/arch/arm/mach-spear/Kconfig
index df0d59afeb40..ac1710e64d9a 100644
--- a/arch/arm/mach-spear/Kconfig
+++ b/arch/arm/mach-spear/Kconfig
@@ -7,11 +7,9 @@ menuconfig PLAT_SPEAR
7 default PLAT_SPEAR_SINGLE 7 default PLAT_SPEAR_SINGLE
8 select ARCH_REQUIRE_GPIOLIB 8 select ARCH_REQUIRE_GPIOLIB
9 select ARM_AMBA 9 select ARM_AMBA
10 select CLKDEV_LOOKUP
11 select CLKSRC_MMIO 10 select CLKSRC_MMIO
12 select COMMON_CLK 11 select COMMON_CLK
13 select GENERIC_CLOCKEVENTS 12 select GENERIC_CLOCKEVENTS
14 select HAVE_CLK
15 13
16if PLAT_SPEAR 14if PLAT_SPEAR
17 15
diff --git a/arch/arm/mach-sti/board-dt.c b/arch/arm/mach-sti/board-dt.c
index 8fe6f0c46480..1217fb598cfd 100644
--- a/arch/arm/mach-sti/board-dt.c
+++ b/arch/arm/mach-sti/board-dt.c
@@ -7,9 +7,8 @@
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 */ 8 */
9 9
10#include <linux/clk-provider.h>
11#include <linux/clocksource.h>
12#include <linux/irq.h> 10#include <linux/irq.h>
11#include <linux/of_platform.h>
13#include <asm/hardware/cache-l2x0.h> 12#include <asm/hardware/cache-l2x0.h>
14#include <asm/mach/arch.h> 13#include <asm/mach/arch.h>
15 14
@@ -28,11 +27,10 @@ void __init stih41x_l2x0_init(void)
28 l2x0_of_init(aux_ctrl, L2X0_AUX_CTRL_MASK); 27 l2x0_of_init(aux_ctrl, L2X0_AUX_CTRL_MASK);
29} 28}
30 29
31static void __init stih41x_timer_init(void) 30static void __init stih41x_machine_init(void)
32{ 31{
33 of_clk_init(NULL);
34 clocksource_of_init();
35 stih41x_l2x0_init(); 32 stih41x_l2x0_init();
33 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
36} 34}
37 35
38static const char *stih41x_dt_match[] __initdata = { 36static const char *stih41x_dt_match[] __initdata = {
@@ -42,7 +40,7 @@ static const char *stih41x_dt_match[] __initdata = {
42}; 40};
43 41
44DT_MACHINE_START(STM, "STiH415/416 SoC with Flattened Device Tree") 42DT_MACHINE_START(STM, "STiH415/416 SoC with Flattened Device Tree")
45 .init_time = stih41x_timer_init, 43 .init_machine = stih41x_machine_init,
46 .smp = smp_ops(sti_smp_ops), 44 .smp = smp_ops(sti_smp_ops),
47 .dt_compat = stih41x_dt_match, 45 .dt_compat = stih41x_dt_match,
48MACHINE_END 46MACHINE_END
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 3ab2f65f8a50..c9e72c89066a 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -1,14 +1,14 @@
1config ARCH_SUNXI 1config ARCH_SUNXI
2 bool "Allwinner A1X SOCs" if ARCH_MULTI_V7 2 bool "Allwinner A1X SOCs" if ARCH_MULTI_V7
3 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
4 select ARM_GIC
4 select CLKSRC_MMIO 5 select CLKSRC_MMIO
5 select CLKSRC_OF 6 select CLKSRC_OF
6 select COMMON_CLK 7 select COMMON_CLK
7 select GENERIC_CLOCKEVENTS 8 select GENERIC_CLOCKEVENTS
8 select GENERIC_IRQ_CHIP 9 select GENERIC_IRQ_CHIP
10 select HAVE_SMP
9 select PINCTRL 11 select PINCTRL
12 select PINCTRL_SUNXI
10 select SPARSE_IRQ 13 select SPARSE_IRQ
11 select SUN4I_TIMER 14 select SUN4I_TIMER
12 select PINCTRL_SUNXI
13 select ARM_GIC
14 select HAVE_SMP
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index e79fb3469341..61d3a387f01c 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -10,7 +10,6 @@
10 * warranty of any kind, whether express or implied. 10 * warranty of any kind, whether express or implied.
11 */ 11 */
12 12
13#include <linux/clocksource.h>
14#include <linux/delay.h> 13#include <linux/delay.h>
15#include <linux/kernel.h> 14#include <linux/kernel.h>
16#include <linux/init.h> 15#include <linux/init.h>
@@ -20,8 +19,6 @@
20#include <linux/io.h> 19#include <linux/io.h>
21#include <linux/reboot.h> 20#include <linux/reboot.h>
22 21
23#include <linux/clk/sunxi.h>
24
25#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 23#include <asm/mach/map.h>
27#include <asm/system_misc.h> 24#include <asm/system_misc.h>
@@ -93,14 +90,13 @@ static void sun6i_restart(enum reboot_mode mode, const char *cmd)
93} 90}
94 91
95static struct of_device_id sunxi_restart_ids[] = { 92static struct of_device_id sunxi_restart_ids[] = {
96 { .compatible = "allwinner,sun4i-wdt", .data = sun4i_restart }, 93 { .compatible = "allwinner,sun4i-wdt" },
97 { .compatible = "allwinner,sun6i-wdt", .data = sun6i_restart }, 94 { .compatible = "allwinner,sun6i-wdt" },
98 { /*sentinel*/ } 95 { /*sentinel*/ }
99}; 96};
100 97
101static void sunxi_setup_restart(void) 98static void sunxi_setup_restart(void)
102{ 99{
103 const struct of_device_id *of_id;
104 struct device_node *np; 100 struct device_node *np;
105 101
106 np = of_find_matching_node(NULL, sunxi_restart_ids); 102 np = of_find_matching_node(NULL, sunxi_restart_ids);
@@ -109,17 +105,6 @@ static void sunxi_setup_restart(void)
109 105
110 wdt_base = of_iomap(np, 0); 106 wdt_base = of_iomap(np, 0);
111 WARN(!wdt_base, "failed to map watchdog base address"); 107 WARN(!wdt_base, "failed to map watchdog base address");
112
113 of_id = of_match_node(sunxi_restart_ids, np);
114 WARN(!of_id, "restart function not available");
115
116 arm_pm_restart = of_id->data;
117}
118
119static void __init sunxi_timer_init(void)
120{
121 sunxi_init_clocks();
122 clocksource_of_init();
123} 108}
124 109
125static void __init sunxi_dt_init(void) 110static void __init sunxi_dt_init(void)
@@ -133,13 +118,33 @@ static const char * const sunxi_board_dt_compat[] = {
133 "allwinner,sun4i-a10", 118 "allwinner,sun4i-a10",
134 "allwinner,sun5i-a10s", 119 "allwinner,sun5i-a10s",
135 "allwinner,sun5i-a13", 120 "allwinner,sun5i-a13",
136 "allwinner,sun6i-a31",
137 "allwinner,sun7i-a20",
138 NULL, 121 NULL,
139}; 122};
140 123
141DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)") 124DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
142 .init_machine = sunxi_dt_init, 125 .init_machine = sunxi_dt_init,
143 .init_time = sunxi_timer_init,
144 .dt_compat = sunxi_board_dt_compat, 126 .dt_compat = sunxi_board_dt_compat,
127 .restart = sun4i_restart,
128MACHINE_END
129
130static const char * const sun6i_board_dt_compat[] = {
131 "allwinner,sun6i-a31",
132 NULL,
133};
134
135DT_MACHINE_START(SUN6I_DT, "Allwinner sun6i (A31) Family")
136 .init_machine = sunxi_dt_init,
137 .dt_compat = sun6i_board_dt_compat,
138 .restart = sun6i_restart,
139MACHINE_END
140
141static const char * const sun7i_board_dt_compat[] = {
142 "allwinner,sun7i-a20",
143 NULL,
144};
145
146DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family")
147 .init_machine = sunxi_dt_init,
148 .dt_compat = sun7i_board_dt_compat,
149 .restart = sun4i_restart,
145MACHINE_END 150MACHINE_END
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 67a76f2dfb9f..09e740f58b27 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -3,7 +3,6 @@ config ARCH_TEGRA
3 select ARCH_HAS_CPUFREQ 3 select ARCH_HAS_CPUFREQ
4 select ARCH_REQUIRE_GPIOLIB 4 select ARCH_REQUIRE_GPIOLIB
5 select ARM_GIC 5 select ARM_GIC
6 select CLKDEV_LOOKUP
7 select CLKSRC_MMIO 6 select CLKSRC_MMIO
8 select CLKSRC_OF 7 select CLKSRC_OF
9 select COMMON_CLK 8 select COMMON_CLK
@@ -11,7 +10,6 @@ config ARCH_TEGRA
11 select GENERIC_CLOCKEVENTS 10 select GENERIC_CLOCKEVENTS
12 select HAVE_ARM_SCU if SMP 11 select HAVE_ARM_SCU if SMP
13 select HAVE_ARM_TWD if SMP 12 select HAVE_ARM_TWD if SMP
14 select HAVE_CLK
15 select HAVE_SMP 13 select HAVE_SMP
16 select MIGHT_HAVE_CACHE_L2X0 14 select MIGHT_HAVE_CACHE_L2X0
17 select MIGHT_HAVE_PCI 15 select MIGHT_HAVE_PCI
@@ -53,14 +51,22 @@ config ARCH_TEGRA_3x_SOC
53 51
54config ARCH_TEGRA_114_SOC 52config ARCH_TEGRA_114_SOC
55 bool "Enable support for Tegra114 family" 53 bool "Enable support for Tegra114 family"
56 select HAVE_ARM_ARCH_TIMER 54 select ARM_ERRATA_798181 if SMP
57 select ARM_ERRATA_798181
58 select ARM_L1_CACHE_SHIFT_6 55 select ARM_L1_CACHE_SHIFT_6
56 select HAVE_ARM_ARCH_TIMER
59 select PINCTRL_TEGRA114 57 select PINCTRL_TEGRA114
60 help 58 help
61 Support for NVIDIA Tegra T114 processor family, based on the 59 Support for NVIDIA Tegra T114 processor family, based on the
62 ARM CortexA15MP CPU 60 ARM CortexA15MP CPU
63 61
62config ARCH_TEGRA_124_SOC
63 bool "Enable support for Tegra124 family"
64 select ARM_L1_CACHE_SHIFT_6
65 select HAVE_ARM_ARCH_TIMER
66 help
67 Support for NVIDIA Tegra T124 processor family, based on the
68 ARM CortexA15MP CPU
69
64config TEGRA_AHB 70config TEGRA_AHB
65 bool "Enable AHB driver for NVIDIA Tegra SoCs" 71 bool "Enable AHB driver for NVIDIA Tegra SoCs"
66 default y 72 default y
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index e7e5f45c6558..019bb1758662 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -1,6 +1,5 @@
1asflags-y += -march=armv7-a 1asflags-y += -march=armv7-a
2 2
3obj-y += common.o
4obj-y += io.o 3obj-y += io.o
5obj-y += irq.o 4obj-y += irq.o
6obj-y += fuse.o 5obj-y += fuse.o
@@ -36,5 +35,10 @@ obj-$(CONFIG_ARCH_TEGRA_114_SOC) += pm-tegra30.o
36ifeq ($(CONFIG_CPU_IDLE),y) 35ifeq ($(CONFIG_CPU_IDLE),y)
37obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o 36obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o
38endif 37endif
38obj-$(CONFIG_ARCH_TEGRA_124_SOC) += sleep-tegra30.o
39obj-$(CONFIG_ARCH_TEGRA_124_SOC) += pm-tegra30.o
40ifeq ($(CONFIG_CPU_IDLE),y)
41obj-$(CONFIG_ARCH_TEGRA_124_SOC) += cpuidle-tegra114.o
42endif
39 43
40obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-paz00.o 44obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-paz00.o
diff --git a/arch/arm/mach-tegra/apbio.c b/arch/arm/mach-tegra/apbio.c
index d7aa52ea6cfc..bc471973cf04 100644
--- a/arch/arm/mach-tegra/apbio.c
+++ b/arch/arm/mach-tegra/apbio.c
@@ -114,7 +114,7 @@ static int do_dma_transfer(unsigned long apb_add,
114 dma_desc->callback = apb_dma_complete; 114 dma_desc->callback = apb_dma_complete;
115 dma_desc->callback_param = NULL; 115 dma_desc->callback_param = NULL;
116 116
117 INIT_COMPLETION(tegra_apb_wait); 117 reinit_completion(&tegra_apb_wait);
118 118
119 dmaengine_submit(dma_desc); 119 dmaengine_submit(dma_desc);
120 dma_async_issue_pending(tegra_apb_dma_chan); 120 dma_async_issue_pending(tegra_apb_dma_chan);
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 740e16f64728..06f024070dab 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -20,12 +20,11 @@
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/rfkill-gpio.h> 21#include <linux/rfkill-gpio.h>
22#include "board.h" 22#include "board.h"
23#include "board-paz00.h"
24 23
25static struct rfkill_gpio_platform_data wifi_rfkill_platform_data = { 24static struct rfkill_gpio_platform_data wifi_rfkill_platform_data = {
26 .name = "wifi_rfkill", 25 .name = "wifi_rfkill",
27 .reset_gpio = TEGRA_WIFI_RST, 26 .reset_gpio = 25, /* PD1 */
28 .shutdown_gpio = TEGRA_WIFI_PWRN, 27 .shutdown_gpio = 85, /* PK5 */
29 .type = RFKILL_TYPE_WLAN, 28 .type = RFKILL_TYPE_WLAN,
30}; 29};
31 30
diff --git a/arch/arm/mach-tegra/board-paz00.h b/arch/arm/mach-tegra/board-paz00.h
deleted file mode 100644
index 25c08ecef52f..000000000000
--- a/arch/arm/mach-tegra/board-paz00.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * arch/arm/mach-tegra/board-paz00.h
3 *
4 * Copyright (C) 2010 Marc Dietrich <marvin24@gmx.de>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef _MACH_TEGRA_BOARD_PAZ00_H
18#define _MACH_TEGRA_BOARD_PAZ00_H
19
20#include "gpio-names.h"
21
22#define TEGRA_WIFI_PWRN TEGRA_GPIO_PK5
23#define TEGRA_WIFI_RST TEGRA_GPIO_PD1
24
25#endif
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h
index db6810dc0b3d..bcf5dbf69d58 100644
--- a/arch/arm/mach-tegra/board.h
+++ b/arch/arm/mach-tegra/board.h
@@ -25,20 +25,8 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/reboot.h> 26#include <linux/reboot.h>
27 27
28void tegra_assert_system_reset(enum reboot_mode mode, const char *cmd);
29
30void __init tegra_init_early(void);
31void __init tegra_map_common_io(void); 28void __init tegra_map_common_io(void);
32void __init tegra_init_irq(void); 29void __init tegra_init_irq(void);
33void __init tegra_dt_init_irq(void);
34
35void tegra_init_late(void);
36
37#ifdef CONFIG_DEBUG_FS
38int tegra_clk_debugfs_init(void);
39#else
40static inline int tegra_clk_debugfs_init(void) { return 0; }
41#endif
42 30
43int __init tegra_powergate_init(void); 31int __init tegra_powergate_init(void);
44#if defined(CONFIG_ARCH_TEGRA_2x_SOC) && defined(CONFIG_DEBUG_FS) 32#if defined(CONFIG_ARCH_TEGRA_2x_SOC) && defined(CONFIG_DEBUG_FS)
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
deleted file mode 100644
index 94a119a35af8..000000000000
--- a/arch/arm/mach-tegra/common.c
+++ /dev/null
@@ -1,115 +0,0 @@
1/*
2 * arch/arm/mach-tegra/common.c
3 *
4 * Copyright (c) 2013 NVIDIA Corporation. All rights reserved.
5 * Copyright (C) 2010 Google, Inc.
6 *
7 * Author:
8 * Colin Cross <ccross@android.com>
9 *
10 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 */
20
21#include <linux/init.h>
22#include <linux/io.h>
23#include <linux/clk.h>
24#include <linux/delay.h>
25#include <linux/reboot.h>
26#include <linux/irqchip.h>
27#include <linux/clk-provider.h>
28
29#include <asm/hardware/cache-l2x0.h>
30
31#include "board.h"
32#include "common.h"
33#include "cpuidle.h"
34#include "fuse.h"
35#include "iomap.h"
36#include "irq.h"
37#include "pmc.h"
38#include "apbio.h"
39#include "sleep.h"
40#include "pm.h"
41#include "reset.h"
42
43/*
44 * Storage for debug-macro.S's state.
45 *
46 * This must be in .data not .bss so that it gets initialized each time the
47 * kernel is loaded. The data is declared here rather than debug-macro.S so
48 * that multiple inclusions of debug-macro.S point at the same data.
49 */
50u32 tegra_uart_config[4] = {
51 /* Debug UART initialization required */
52 1,
53 /* Debug UART physical address */
54 0,
55 /* Debug UART virtual address */
56 0,
57 /* Scratch space for debug macro */
58 0,
59};
60
61#ifdef CONFIG_OF
62void __init tegra_dt_init_irq(void)
63{
64 of_clk_init(NULL);
65 tegra_pmc_init();
66 tegra_init_irq();
67 irqchip_init();
68 tegra_legacy_irq_syscore_init();
69}
70#endif
71
72void tegra_assert_system_reset(enum reboot_mode mode, const char *cmd)
73{
74 void __iomem *reset = IO_ADDRESS(TEGRA_PMC_BASE + 0);
75 u32 reg;
76
77 reg = readl_relaxed(reset);
78 reg |= 0x10;
79 writel_relaxed(reg, reset);
80}
81
82static void __init tegra_init_cache(void)
83{
84#ifdef CONFIG_CACHE_L2X0
85 int ret;
86 void __iomem *p = IO_ADDRESS(TEGRA_ARM_PERIF_BASE) + 0x3000;
87 u32 aux_ctrl, cache_type;
88
89 cache_type = readl(p + L2X0_CACHE_TYPE);
90 aux_ctrl = (cache_type & 0x700) << (17-8);
91 aux_ctrl |= 0x7C400001;
92
93 ret = l2x0_of_init(aux_ctrl, 0x8200c3fe);
94 if (!ret)
95 l2x0_saved_regs_addr = virt_to_phys(&l2x0_saved_regs);
96#endif
97
98}
99
100void __init tegra_init_early(void)
101{
102 tegra_cpu_reset_handler_init();
103 tegra_apb_io_init();
104 tegra_init_fuse();
105 tegra_init_cache();
106 tegra_powergate_init();
107 tegra_hotplug_init();
108}
109
110void __init tegra_init_late(void)
111{
112 tegra_init_suspend();
113 tegra_cpuidle_init();
114 tegra_powergate_debugfs_init();
115}
diff --git a/arch/arm/mach-tegra/cpuidle.c b/arch/arm/mach-tegra/cpuidle.c
index 0961dfcf83a4..7bc5d8d667fe 100644
--- a/arch/arm/mach-tegra/cpuidle.c
+++ b/arch/arm/mach-tegra/cpuidle.c
@@ -39,7 +39,9 @@ void __init tegra_cpuidle_init(void)
39 tegra30_cpuidle_init(); 39 tegra30_cpuidle_init();
40 break; 40 break;
41 case TEGRA114: 41 case TEGRA114:
42 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC)) 42 case TEGRA124:
43 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) ||
44 IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC))
43 tegra114_cpuidle_init(); 45 tegra114_cpuidle_init();
44 break; 46 break;
45 } 47 }
diff --git a/arch/arm/mach-tegra/flowctrl.c b/arch/arm/mach-tegra/flowctrl.c
index 5348543382bf..ce8ab8abf061 100644
--- a/arch/arm/mach-tegra/flowctrl.c
+++ b/arch/arm/mach-tegra/flowctrl.c
@@ -87,6 +87,7 @@ void flowctrl_cpu_suspend_enter(unsigned int cpuid)
87 break; 87 break;
88 case TEGRA30: 88 case TEGRA30:
89 case TEGRA114: 89 case TEGRA114:
90 case TEGRA124:
90 /* clear wfe bitmap */ 91 /* clear wfe bitmap */
91 reg &= ~TEGRA30_FLOW_CTRL_CSR_WFE_BITMAP; 92 reg &= ~TEGRA30_FLOW_CTRL_CSR_WFE_BITMAP;
92 /* clear wfi bitmap */ 93 /* clear wfi bitmap */
@@ -125,6 +126,7 @@ void flowctrl_cpu_suspend_exit(unsigned int cpuid)
125 break; 126 break;
126 case TEGRA30: 127 case TEGRA30:
127 case TEGRA114: 128 case TEGRA114:
129 case TEGRA124:
128 /* clear wfe bitmap */ 130 /* clear wfe bitmap */
129 reg &= ~TEGRA30_FLOW_CTRL_CSR_WFE_BITMAP; 131 reg &= ~TEGRA30_FLOW_CTRL_CSR_WFE_BITMAP;
130 /* clear wfi bitmap */ 132 /* clear wfi bitmap */
diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
index e035cd284a6e..d4639c506622 100644
--- a/arch/arm/mach-tegra/fuse.c
+++ b/arch/arm/mach-tegra/fuse.c
@@ -21,14 +21,26 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/export.h> 23#include <linux/export.h>
24#include <linux/random.h>
24#include <linux/tegra-soc.h> 25#include <linux/tegra-soc.h>
25 26
26#include "fuse.h" 27#include "fuse.h"
27#include "iomap.h" 28#include "iomap.h"
28#include "apbio.h" 29#include "apbio.h"
29 30
31/* Tegra20 only */
30#define FUSE_UID_LOW 0x108 32#define FUSE_UID_LOW 0x108
31#define FUSE_UID_HIGH 0x10c 33#define FUSE_UID_HIGH 0x10c
34
35/* Tegra30 and later */
36#define FUSE_VENDOR_CODE 0x200
37#define FUSE_FAB_CODE 0x204
38#define FUSE_LOT_CODE_0 0x208
39#define FUSE_LOT_CODE_1 0x20c
40#define FUSE_WAFER_ID 0x210
41#define FUSE_X_COORDINATE 0x214
42#define FUSE_Y_COORDINATE 0x218
43
32#define FUSE_SKU_INFO 0x110 44#define FUSE_SKU_INFO 0x110
33 45
34#define TEGRA20_FUSE_SPARE_BIT 0x200 46#define TEGRA20_FUSE_SPARE_BIT 0x200
@@ -112,21 +124,51 @@ u32 tegra_read_chipid(void)
112 return readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804); 124 return readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804);
113} 125}
114 126
115void tegra_init_fuse(void) 127static void __init tegra20_fuse_init_randomness(void)
128{
129 u32 randomness[2];
130
131 randomness[0] = tegra_fuse_readl(FUSE_UID_LOW);
132 randomness[1] = tegra_fuse_readl(FUSE_UID_HIGH);
133
134 add_device_randomness(randomness, sizeof(randomness));
135}
136
137/* Applies to Tegra30 or later */
138static void __init tegra30_fuse_init_randomness(void)
139{
140 u32 randomness[7];
141
142 randomness[0] = tegra_fuse_readl(FUSE_VENDOR_CODE);
143 randomness[1] = tegra_fuse_readl(FUSE_FAB_CODE);
144 randomness[2] = tegra_fuse_readl(FUSE_LOT_CODE_0);
145 randomness[3] = tegra_fuse_readl(FUSE_LOT_CODE_1);
146 randomness[4] = tegra_fuse_readl(FUSE_WAFER_ID);
147 randomness[5] = tegra_fuse_readl(FUSE_X_COORDINATE);
148 randomness[6] = tegra_fuse_readl(FUSE_Y_COORDINATE);
149
150 add_device_randomness(randomness, sizeof(randomness));
151}
152
153void __init tegra_init_fuse(void)
116{ 154{
117 u32 id; 155 u32 id;
156 u32 randomness[5];
118 157
119 u32 reg = readl(IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x48)); 158 u32 reg = readl(IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x48));
120 reg |= 1 << 28; 159 reg |= 1 << 28;
121 writel(reg, IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x48)); 160 writel(reg, IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x48));
122 161
123 reg = tegra_fuse_readl(FUSE_SKU_INFO); 162 reg = tegra_fuse_readl(FUSE_SKU_INFO);
163 randomness[0] = reg;
124 tegra_sku_id = reg & 0xFF; 164 tegra_sku_id = reg & 0xFF;
125 165
126 reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT); 166 reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT);
167 randomness[1] = reg;
127 tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT; 168 tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT;
128 169
129 id = tegra_read_chipid(); 170 id = tegra_read_chipid();
171 randomness[2] = id;
130 tegra_chip_id = (id >> 8) & 0xff; 172 tegra_chip_id = (id >> 8) & 0xff;
131 173
132 switch (tegra_chip_id) { 174 switch (tegra_chip_id) {
@@ -149,6 +191,18 @@ void tegra_init_fuse(void)
149 191
150 tegra_revision = tegra_get_revision(id); 192 tegra_revision = tegra_get_revision(id);
151 tegra_init_speedo_data(); 193 tegra_init_speedo_data();
194 randomness[3] = (tegra_cpu_process_id << 16) | tegra_core_process_id;
195 randomness[4] = (tegra_cpu_speedo_id << 16) | tegra_soc_speedo_id;
196
197 add_device_randomness(randomness, sizeof(randomness));
198 switch (tegra_chip_id) {
199 case TEGRA20:
200 tegra20_fuse_init_randomness();
201 case TEGRA30:
202 case TEGRA114:
203 default:
204 tegra30_fuse_init_randomness();
205 }
152 206
153 pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n", 207 pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n",
154 tegra_revision_name[tegra_revision], 208 tegra_revision_name[tegra_revision],
diff --git a/arch/arm/mach-tegra/fuse.h b/arch/arm/mach-tegra/fuse.h
index def79683bef6..c01d04785d67 100644
--- a/arch/arm/mach-tegra/fuse.h
+++ b/arch/arm/mach-tegra/fuse.h
@@ -29,6 +29,7 @@
29#define TEGRA20 0x20 29#define TEGRA20 0x20
30#define TEGRA30 0x30 30#define TEGRA30 0x30
31#define TEGRA114 0x35 31#define TEGRA114 0x35
32#define TEGRA124 0x40
32 33
33#ifndef __ASSEMBLY__ 34#ifndef __ASSEMBLY__
34enum tegra_revision { 35enum tegra_revision {
diff --git a/arch/arm/mach-tegra/gpio-names.h b/arch/arm/mach-tegra/gpio-names.h
deleted file mode 100644
index f28220a641b2..000000000000
--- a/arch/arm/mach-tegra/gpio-names.h
+++ /dev/null
@@ -1,247 +0,0 @@
1/*
2 * arch/arm/mach-tegra/include/mach/gpio-names.h
3 *
4 * Copyright (c) 2010 Google, Inc
5 *
6 * Author:
7 * Erik Gilling <konkers@google.com>
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#ifndef __MACH_TEGRA_GPIO_NAMES_H
20#define __MACH_TEGRA_GPIO_NAMES_H
21
22#define TEGRA_GPIO_PA0 0
23#define TEGRA_GPIO_PA1 1
24#define TEGRA_GPIO_PA2 2
25#define TEGRA_GPIO_PA3 3
26#define TEGRA_GPIO_PA4 4
27#define TEGRA_GPIO_PA5 5
28#define TEGRA_GPIO_PA6 6
29#define TEGRA_GPIO_PA7 7
30#define TEGRA_GPIO_PB0 8
31#define TEGRA_GPIO_PB1 9
32#define TEGRA_GPIO_PB2 10
33#define TEGRA_GPIO_PB3 11
34#define TEGRA_GPIO_PB4 12
35#define TEGRA_GPIO_PB5 13
36#define TEGRA_GPIO_PB6 14
37#define TEGRA_GPIO_PB7 15
38#define TEGRA_GPIO_PC0 16
39#define TEGRA_GPIO_PC1 17
40#define TEGRA_GPIO_PC2 18
41#define TEGRA_GPIO_PC3 19
42#define TEGRA_GPIO_PC4 20
43#define TEGRA_GPIO_PC5 21
44#define TEGRA_GPIO_PC6 22
45#define TEGRA_GPIO_PC7 23
46#define TEGRA_GPIO_PD0 24
47#define TEGRA_GPIO_PD1 25
48#define TEGRA_GPIO_PD2 26
49#define TEGRA_GPIO_PD3 27
50#define TEGRA_GPIO_PD4 28
51#define TEGRA_GPIO_PD5 29
52#define TEGRA_GPIO_PD6 30
53#define TEGRA_GPIO_PD7 31
54#define TEGRA_GPIO_PE0 32
55#define TEGRA_GPIO_PE1 33
56#define TEGRA_GPIO_PE2 34
57#define TEGRA_GPIO_PE3 35
58#define TEGRA_GPIO_PE4 36
59#define TEGRA_GPIO_PE5 37
60#define TEGRA_GPIO_PE6 38
61#define TEGRA_GPIO_PE7 39
62#define TEGRA_GPIO_PF0 40
63#define TEGRA_GPIO_PF1 41
64#define TEGRA_GPIO_PF2 42
65#define TEGRA_GPIO_PF3 43
66#define TEGRA_GPIO_PF4 44
67#define TEGRA_GPIO_PF5 45
68#define TEGRA_GPIO_PF6 46
69#define TEGRA_GPIO_PF7 47
70#define TEGRA_GPIO_PG0 48
71#define TEGRA_GPIO_PG1 49
72#define TEGRA_GPIO_PG2 50
73#define TEGRA_GPIO_PG3 51
74#define TEGRA_GPIO_PG4 52
75#define TEGRA_GPIO_PG5 53
76#define TEGRA_GPIO_PG6 54
77#define TEGRA_GPIO_PG7 55
78#define TEGRA_GPIO_PH0 56
79#define TEGRA_GPIO_PH1 57
80#define TEGRA_GPIO_PH2 58
81#define TEGRA_GPIO_PH3 59
82#define TEGRA_GPIO_PH4 60
83#define TEGRA_GPIO_PH5 61
84#define TEGRA_GPIO_PH6 62
85#define TEGRA_GPIO_PH7 63
86#define TEGRA_GPIO_PI0 64
87#define TEGRA_GPIO_PI1 65
88#define TEGRA_GPIO_PI2 66
89#define TEGRA_GPIO_PI3 67
90#define TEGRA_GPIO_PI4 68
91#define TEGRA_GPIO_PI5 69
92#define TEGRA_GPIO_PI6 70
93#define TEGRA_GPIO_PI7 71
94#define TEGRA_GPIO_PJ0 72
95#define TEGRA_GPIO_PJ1 73
96#define TEGRA_GPIO_PJ2 74
97#define TEGRA_GPIO_PJ3 75
98#define TEGRA_GPIO_PJ4 76
99#define TEGRA_GPIO_PJ5 77
100#define TEGRA_GPIO_PJ6 78
101#define TEGRA_GPIO_PJ7 79
102#define TEGRA_GPIO_PK0 80
103#define TEGRA_GPIO_PK1 81
104#define TEGRA_GPIO_PK2 82
105#define TEGRA_GPIO_PK3 83
106#define TEGRA_GPIO_PK4 84
107#define TEGRA_GPIO_PK5 85
108#define TEGRA_GPIO_PK6 86
109#define TEGRA_GPIO_PK7 87
110#define TEGRA_GPIO_PL0 88
111#define TEGRA_GPIO_PL1 89
112#define TEGRA_GPIO_PL2 90
113#define TEGRA_GPIO_PL3 91
114#define TEGRA_GPIO_PL4 92
115#define TEGRA_GPIO_PL5 93
116#define TEGRA_GPIO_PL6 94
117#define TEGRA_GPIO_PL7 95
118#define TEGRA_GPIO_PM0 96
119#define TEGRA_GPIO_PM1 97
120#define TEGRA_GPIO_PM2 98
121#define TEGRA_GPIO_PM3 99
122#define TEGRA_GPIO_PM4 100
123#define TEGRA_GPIO_PM5 101
124#define TEGRA_GPIO_PM6 102
125#define TEGRA_GPIO_PM7 103
126#define TEGRA_GPIO_PN0 104
127#define TEGRA_GPIO_PN1 105
128#define TEGRA_GPIO_PN2 106
129#define TEGRA_GPIO_PN3 107
130#define TEGRA_GPIO_PN4 108
131#define TEGRA_GPIO_PN5 109
132#define TEGRA_GPIO_PN6 110
133#define TEGRA_GPIO_PN7 111
134#define TEGRA_GPIO_PO0 112
135#define TEGRA_GPIO_PO1 113
136#define TEGRA_GPIO_PO2 114
137#define TEGRA_GPIO_PO3 115
138#define TEGRA_GPIO_PO4 116
139#define TEGRA_GPIO_PO5 117
140#define TEGRA_GPIO_PO6 118
141#define TEGRA_GPIO_PO7 119
142#define TEGRA_GPIO_PP0 120
143#define TEGRA_GPIO_PP1 121
144#define TEGRA_GPIO_PP2 122
145#define TEGRA_GPIO_PP3 123
146#define TEGRA_GPIO_PP4 124
147#define TEGRA_GPIO_PP5 125
148#define TEGRA_GPIO_PP6 126
149#define TEGRA_GPIO_PP7 127
150#define TEGRA_GPIO_PQ0 128
151#define TEGRA_GPIO_PQ1 129
152#define TEGRA_GPIO_PQ2 130
153#define TEGRA_GPIO_PQ3 131
154#define TEGRA_GPIO_PQ4 132
155#define TEGRA_GPIO_PQ5 133
156#define TEGRA_GPIO_PQ6 134
157#define TEGRA_GPIO_PQ7 135
158#define TEGRA_GPIO_PR0 136
159#define TEGRA_GPIO_PR1 137
160#define TEGRA_GPIO_PR2 138
161#define TEGRA_GPIO_PR3 139
162#define TEGRA_GPIO_PR4 140
163#define TEGRA_GPIO_PR5 141
164#define TEGRA_GPIO_PR6 142
165#define TEGRA_GPIO_PR7 143
166#define TEGRA_GPIO_PS0 144
167#define TEGRA_GPIO_PS1 145
168#define TEGRA_GPIO_PS2 146
169#define TEGRA_GPIO_PS3 147
170#define TEGRA_GPIO_PS4 148
171#define TEGRA_GPIO_PS5 149
172#define TEGRA_GPIO_PS6 150
173#define TEGRA_GPIO_PS7 151
174#define TEGRA_GPIO_PT0 152
175#define TEGRA_GPIO_PT1 153
176#define TEGRA_GPIO_PT2 154
177#define TEGRA_GPIO_PT3 155
178#define TEGRA_GPIO_PT4 156
179#define TEGRA_GPIO_PT5 157
180#define TEGRA_GPIO_PT6 158
181#define TEGRA_GPIO_PT7 159
182#define TEGRA_GPIO_PU0 160
183#define TEGRA_GPIO_PU1 161
184#define TEGRA_GPIO_PU2 162
185#define TEGRA_GPIO_PU3 163
186#define TEGRA_GPIO_PU4 164
187#define TEGRA_GPIO_PU5 165
188#define TEGRA_GPIO_PU6 166
189#define TEGRA_GPIO_PU7 167
190#define TEGRA_GPIO_PV0 168
191#define TEGRA_GPIO_PV1 169
192#define TEGRA_GPIO_PV2 170
193#define TEGRA_GPIO_PV3 171
194#define TEGRA_GPIO_PV4 172
195#define TEGRA_GPIO_PV5 173
196#define TEGRA_GPIO_PV6 174
197#define TEGRA_GPIO_PV7 175
198#define TEGRA_GPIO_PW0 176
199#define TEGRA_GPIO_PW1 177
200#define TEGRA_GPIO_PW2 178
201#define TEGRA_GPIO_PW3 179
202#define TEGRA_GPIO_PW4 180
203#define TEGRA_GPIO_PW5 181
204#define TEGRA_GPIO_PW6 182
205#define TEGRA_GPIO_PW7 183
206#define TEGRA_GPIO_PX0 184
207#define TEGRA_GPIO_PX1 185
208#define TEGRA_GPIO_PX2 186
209#define TEGRA_GPIO_PX3 187
210#define TEGRA_GPIO_PX4 188
211#define TEGRA_GPIO_PX5 189
212#define TEGRA_GPIO_PX6 190
213#define TEGRA_GPIO_PX7 191
214#define TEGRA_GPIO_PY0 192
215#define TEGRA_GPIO_PY1 193
216#define TEGRA_GPIO_PY2 194
217#define TEGRA_GPIO_PY3 195
218#define TEGRA_GPIO_PY4 196
219#define TEGRA_GPIO_PY5 197
220#define TEGRA_GPIO_PY6 198
221#define TEGRA_GPIO_PY7 199
222#define TEGRA_GPIO_PZ0 200
223#define TEGRA_GPIO_PZ1 201
224#define TEGRA_GPIO_PZ2 202
225#define TEGRA_GPIO_PZ3 203
226#define TEGRA_GPIO_PZ4 204
227#define TEGRA_GPIO_PZ5 205
228#define TEGRA_GPIO_PZ6 206
229#define TEGRA_GPIO_PZ7 207
230#define TEGRA_GPIO_PAA0 208
231#define TEGRA_GPIO_PAA1 209
232#define TEGRA_GPIO_PAA2 210
233#define TEGRA_GPIO_PAA3 211
234#define TEGRA_GPIO_PAA4 212
235#define TEGRA_GPIO_PAA5 213
236#define TEGRA_GPIO_PAA6 214
237#define TEGRA_GPIO_PAA7 215
238#define TEGRA_GPIO_PBB0 216
239#define TEGRA_GPIO_PBB1 217
240#define TEGRA_GPIO_PBB2 218
241#define TEGRA_GPIO_PBB3 219
242#define TEGRA_GPIO_PBB4 220
243#define TEGRA_GPIO_PBB5 221
244#define TEGRA_GPIO_PBB6 222
245#define TEGRA_GPIO_PBB7 223
246
247#endif
diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c
index 04de2e860923..ff26af26bd0c 100644
--- a/arch/arm/mach-tegra/hotplug.c
+++ b/arch/arm/mach-tegra/hotplug.c
@@ -57,4 +57,6 @@ void __init tegra_hotplug_init(void)
57 tegra_hotplug_shutdown = tegra30_hotplug_shutdown; 57 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
58 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_chip_id == TEGRA114) 58 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_chip_id == TEGRA114)
59 tegra_hotplug_shutdown = tegra30_hotplug_shutdown; 59 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
60 if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_chip_id == TEGRA124)
61 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
60} 62}
diff --git a/arch/arm/mach-tegra/iomap.h b/arch/arm/mach-tegra/iomap.h
index 3f5fa0749bde..26b1c2ad0ceb 100644
--- a/arch/arm/mach-tegra/iomap.h
+++ b/arch/arm/mach-tegra/iomap.h
@@ -24,44 +24,12 @@
24#define TEGRA_IRAM_BASE 0x40000000 24#define TEGRA_IRAM_BASE 0x40000000
25#define TEGRA_IRAM_SIZE SZ_256K 25#define TEGRA_IRAM_SIZE SZ_256K
26 26
27#define TEGRA_IRAM_CODE_AREA (TEGRA_IRAM_BASE + SZ_4K)
28
29#define TEGRA_HOST1X_BASE 0x50000000
30#define TEGRA_HOST1X_SIZE 0x24000
31
32#define TEGRA_ARM_PERIF_BASE 0x50040000 27#define TEGRA_ARM_PERIF_BASE 0x50040000
33#define TEGRA_ARM_PERIF_SIZE SZ_8K 28#define TEGRA_ARM_PERIF_SIZE SZ_8K
34 29
35#define TEGRA_ARM_PL310_BASE 0x50043000
36#define TEGRA_ARM_PL310_SIZE SZ_4K
37
38#define TEGRA_ARM_INT_DIST_BASE 0x50041000 30#define TEGRA_ARM_INT_DIST_BASE 0x50041000
39#define TEGRA_ARM_INT_DIST_SIZE SZ_4K 31#define TEGRA_ARM_INT_DIST_SIZE SZ_4K
40 32
41#define TEGRA_MPE_BASE 0x54040000
42#define TEGRA_MPE_SIZE SZ_256K
43
44#define TEGRA_VI_BASE 0x54080000
45#define TEGRA_VI_SIZE SZ_256K
46
47#define TEGRA_ISP_BASE 0x54100000
48#define TEGRA_ISP_SIZE SZ_256K
49
50#define TEGRA_DISPLAY_BASE 0x54200000
51#define TEGRA_DISPLAY_SIZE SZ_256K
52
53#define TEGRA_DISPLAY2_BASE 0x54240000
54#define TEGRA_DISPLAY2_SIZE SZ_256K
55
56#define TEGRA_HDMI_BASE 0x54280000
57#define TEGRA_HDMI_SIZE SZ_256K
58
59#define TEGRA_GART_BASE 0x58000000
60#define TEGRA_GART_SIZE SZ_32M
61
62#define TEGRA_RES_SEMA_BASE 0x60001000
63#define TEGRA_RES_SEMA_SIZE SZ_4K
64
65#define TEGRA_PRIMARY_ICTLR_BASE 0x60004000 33#define TEGRA_PRIMARY_ICTLR_BASE 0x60004000
66#define TEGRA_PRIMARY_ICTLR_SIZE SZ_64 34#define TEGRA_PRIMARY_ICTLR_SIZE SZ_64
67 35
@@ -98,51 +66,15 @@
98#define TEGRA_FLOW_CTRL_BASE 0x60007000 66#define TEGRA_FLOW_CTRL_BASE 0x60007000
99#define TEGRA_FLOW_CTRL_SIZE 20 67#define TEGRA_FLOW_CTRL_SIZE 20
100 68
101#define TEGRA_AHB_DMA_BASE 0x60008000
102#define TEGRA_AHB_DMA_SIZE SZ_4K
103
104#define TEGRA_AHB_DMA_CH0_BASE 0x60009000
105#define TEGRA_AHB_DMA_CH0_SIZE 32
106
107#define TEGRA_APB_DMA_BASE 0x6000A000
108#define TEGRA_APB_DMA_SIZE SZ_4K
109
110#define TEGRA_APB_DMA_CH0_BASE 0x6000B000
111#define TEGRA_APB_DMA_CH0_SIZE 32
112
113#define TEGRA_AHB_GIZMO_BASE 0x6000C004
114#define TEGRA_AHB_GIZMO_SIZE 0x10C
115
116#define TEGRA_SB_BASE 0x6000C200 69#define TEGRA_SB_BASE 0x6000C200
117#define TEGRA_SB_SIZE 256 70#define TEGRA_SB_SIZE 256
118 71
119#define TEGRA_STATMON_BASE 0x6000C400
120#define TEGRA_STATMON_SIZE SZ_1K
121
122#define TEGRA_GPIO_BASE 0x6000D000
123#define TEGRA_GPIO_SIZE SZ_4K
124
125#define TEGRA_EXCEPTION_VECTORS_BASE 0x6000F000 72#define TEGRA_EXCEPTION_VECTORS_BASE 0x6000F000
126#define TEGRA_EXCEPTION_VECTORS_SIZE SZ_4K 73#define TEGRA_EXCEPTION_VECTORS_SIZE SZ_4K
127 74
128#define TEGRA_APB_MISC_BASE 0x70000000 75#define TEGRA_APB_MISC_BASE 0x70000000
129#define TEGRA_APB_MISC_SIZE SZ_4K 76#define TEGRA_APB_MISC_SIZE SZ_4K
130 77
131#define TEGRA_APB_MISC_DAS_BASE 0x70000c00
132#define TEGRA_APB_MISC_DAS_SIZE SZ_128
133
134#define TEGRA_AC97_BASE 0x70002000
135#define TEGRA_AC97_SIZE SZ_512
136
137#define TEGRA_SPDIF_BASE 0x70002400
138#define TEGRA_SPDIF_SIZE SZ_512
139
140#define TEGRA_I2S1_BASE 0x70002800
141#define TEGRA_I2S1_SIZE SZ_256
142
143#define TEGRA_I2S2_BASE 0x70002A00
144#define TEGRA_I2S2_SIZE SZ_256
145
146#define TEGRA_UARTA_BASE 0x70006000 78#define TEGRA_UARTA_BASE 0x70006000
147#define TEGRA_UARTA_SIZE SZ_64 79#define TEGRA_UARTA_SIZE SZ_64
148 80
@@ -158,108 +90,27 @@
158#define TEGRA_UARTE_BASE 0x70006400 90#define TEGRA_UARTE_BASE 0x70006400
159#define TEGRA_UARTE_SIZE SZ_256 91#define TEGRA_UARTE_SIZE SZ_256
160 92
161#define TEGRA_NAND_BASE 0x70008000
162#define TEGRA_NAND_SIZE SZ_256
163
164#define TEGRA_HSMMC_BASE 0x70008500
165#define TEGRA_HSMMC_SIZE SZ_256
166
167#define TEGRA_SNOR_BASE 0x70009000
168#define TEGRA_SNOR_SIZE SZ_4K
169
170#define TEGRA_PWFM_BASE 0x7000A000
171#define TEGRA_PWFM_SIZE SZ_256
172
173#define TEGRA_PWFM0_BASE 0x7000A000
174#define TEGRA_PWFM0_SIZE 4
175
176#define TEGRA_PWFM1_BASE 0x7000A010
177#define TEGRA_PWFM1_SIZE 4
178
179#define TEGRA_PWFM2_BASE 0x7000A020
180#define TEGRA_PWFM2_SIZE 4
181
182#define TEGRA_PWFM3_BASE 0x7000A030
183#define TEGRA_PWFM3_SIZE 4
184
185#define TEGRA_MIPI_BASE 0x7000B000
186#define TEGRA_MIPI_SIZE SZ_256
187
188#define TEGRA_I2C_BASE 0x7000C000
189#define TEGRA_I2C_SIZE SZ_256
190
191#define TEGRA_TWC_BASE 0x7000C100
192#define TEGRA_TWC_SIZE SZ_256
193
194#define TEGRA_SPI_BASE 0x7000C380
195#define TEGRA_SPI_SIZE 48
196
197#define TEGRA_I2C2_BASE 0x7000C400
198#define TEGRA_I2C2_SIZE SZ_256
199
200#define TEGRA_I2C3_BASE 0x7000C500
201#define TEGRA_I2C3_SIZE SZ_256
202
203#define TEGRA_OWR_BASE 0x7000C600
204#define TEGRA_OWR_SIZE 80
205
206#define TEGRA_DVC_BASE 0x7000D000
207#define TEGRA_DVC_SIZE SZ_512
208
209#define TEGRA_SPI1_BASE 0x7000D400
210#define TEGRA_SPI1_SIZE SZ_512
211
212#define TEGRA_SPI2_BASE 0x7000D600
213#define TEGRA_SPI2_SIZE SZ_512
214
215#define TEGRA_SPI3_BASE 0x7000D800
216#define TEGRA_SPI3_SIZE SZ_512
217
218#define TEGRA_SPI4_BASE 0x7000DA00
219#define TEGRA_SPI4_SIZE SZ_512
220
221#define TEGRA_RTC_BASE 0x7000E000
222#define TEGRA_RTC_SIZE SZ_256
223
224#define TEGRA_KBC_BASE 0x7000E200
225#define TEGRA_KBC_SIZE SZ_256
226
227#define TEGRA_PMC_BASE 0x7000E400 93#define TEGRA_PMC_BASE 0x7000E400
228#define TEGRA_PMC_SIZE SZ_256 94#define TEGRA_PMC_SIZE SZ_256
229 95
230#define TEGRA_MC_BASE 0x7000F000
231#define TEGRA_MC_SIZE SZ_1K
232
233#define TEGRA_EMC_BASE 0x7000F400 96#define TEGRA_EMC_BASE 0x7000F400
234#define TEGRA_EMC_SIZE SZ_1K 97#define TEGRA_EMC_SIZE SZ_1K
235 98
236#define TEGRA_FUSE_BASE 0x7000F800 99#define TEGRA_FUSE_BASE 0x7000F800
237#define TEGRA_FUSE_SIZE SZ_1K 100#define TEGRA_FUSE_SIZE SZ_1K
238 101
239#define TEGRA_KFUSE_BASE 0x7000FC00
240#define TEGRA_KFUSE_SIZE SZ_1K
241
242#define TEGRA_EMC0_BASE 0x7001A000 102#define TEGRA_EMC0_BASE 0x7001A000
243#define TEGRA_EMC0_SIZE SZ_2K 103#define TEGRA_EMC0_SIZE SZ_2K
244 104
245#define TEGRA_EMC1_BASE 0x7001A800 105#define TEGRA_EMC1_BASE 0x7001A800
246#define TEGRA_EMC1_SIZE SZ_2K 106#define TEGRA_EMC1_SIZE SZ_2K
247 107
108#define TEGRA124_EMC_BASE 0x7001B000
109#define TEGRA124_EMC_SIZE SZ_2K
110
248#define TEGRA_CSITE_BASE 0x70040000 111#define TEGRA_CSITE_BASE 0x70040000
249#define TEGRA_CSITE_SIZE SZ_256K 112#define TEGRA_CSITE_SIZE SZ_256K
250 113
251#define TEGRA_SDMMC1_BASE 0xC8000000
252#define TEGRA_SDMMC1_SIZE SZ_512
253
254#define TEGRA_SDMMC2_BASE 0xC8000200
255#define TEGRA_SDMMC2_SIZE SZ_512
256
257#define TEGRA_SDMMC3_BASE 0xC8000400
258#define TEGRA_SDMMC3_SIZE SZ_512
259
260#define TEGRA_SDMMC4_BASE 0xC8000600
261#define TEGRA_SDMMC4_SIZE SZ_512
262
263/* On TEGRA, many peripherals are very closely packed in 114/* On TEGRA, many peripherals are very closely packed in
264 * two 256MB io windows (that actually only use about 64KB 115 * two 256MB io windows (that actually only use about 64KB
265 * at the start of each). 116 * at the start of each).
diff --git a/arch/arm/mach-tegra/irammap.h b/arch/arm/mach-tegra/irammap.h
index 501952a84344..e32e1742c9a1 100644
--- a/arch/arm/mach-tegra/irammap.h
+++ b/arch/arm/mach-tegra/irammap.h
@@ -23,4 +23,10 @@
23#define TEGRA_IRAM_RESET_HANDLER_OFFSET 0 23#define TEGRA_IRAM_RESET_HANDLER_OFFSET 0
24#define TEGRA_IRAM_RESET_HANDLER_SIZE SZ_1K 24#define TEGRA_IRAM_RESET_HANDLER_SIZE SZ_1K
25 25
26/*
27 * This area is used for LPx resume vector, only while LPx power state is
28 * active. At other times, the AVP may use this area for arbitrary purposes
29 */
30#define TEGRA_IRAM_LPx_RESUME_AREA (TEGRA_IRAM_BASE + SZ_4K)
31
26#endif 32#endif
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 2d0203627fbb..eb72ae709124 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -176,6 +176,8 @@ static int tegra_boot_secondary(unsigned int cpu,
176 return tegra30_boot_secondary(cpu, idle); 176 return tegra30_boot_secondary(cpu, idle);
177 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_chip_id == TEGRA114) 177 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_chip_id == TEGRA114)
178 return tegra114_boot_secondary(cpu, idle); 178 return tegra114_boot_secondary(cpu, idle);
179 if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_chip_id == TEGRA124)
180 return tegra114_boot_secondary(cpu, idle);
179 181
180 return -EINVAL; 182 return -EINVAL;
181} 183}
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
index ed294a04e1d3..4ae0286b468d 100644
--- a/arch/arm/mach-tegra/pm.c
+++ b/arch/arm/mach-tegra/pm.c
@@ -59,8 +59,10 @@ static void tegra_tear_down_cpu_init(void)
59 break; 59 break;
60 case TEGRA30: 60 case TEGRA30:
61 case TEGRA114: 61 case TEGRA114:
62 case TEGRA124:
62 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || 63 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) ||
63 IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC)) 64 IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) ||
65 IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC))
64 tegra_tear_down_cpu = tegra30_tear_down_cpu; 66 tegra_tear_down_cpu = tegra30_tear_down_cpu;
65 break; 67 break;
66 } 68 }
@@ -216,8 +218,10 @@ static bool tegra_lp1_iram_hook(void)
216 break; 218 break;
217 case TEGRA30: 219 case TEGRA30:
218 case TEGRA114: 220 case TEGRA114:
221 case TEGRA124:
219 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || 222 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) ||
220 IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC)) 223 IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) ||
224 IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC))
221 tegra30_lp1_iram_hook(); 225 tegra30_lp1_iram_hook();
222 break; 226 break;
223 default: 227 default:
@@ -244,8 +248,10 @@ static bool tegra_sleep_core_init(void)
244 break; 248 break;
245 case TEGRA30: 249 case TEGRA30:
246 case TEGRA114: 250 case TEGRA114:
251 case TEGRA124:
247 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || 252 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) ||
248 IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC)) 253 IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) ||
254 IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC))
249 tegra30_sleep_core_init(); 255 tegra30_sleep_core_init();
250 break; 256 break;
251 default: 257 default:
@@ -263,10 +269,10 @@ static void tegra_suspend_enter_lp1(void)
263 tegra_pmc_suspend(); 269 tegra_pmc_suspend();
264 270
265 /* copy the reset vector & SDRAM shutdown code into IRAM */ 271 /* copy the reset vector & SDRAM shutdown code into IRAM */
266 memcpy(iram_save_addr, IO_ADDRESS(TEGRA_IRAM_CODE_AREA), 272 memcpy(iram_save_addr, IO_ADDRESS(TEGRA_IRAM_LPx_RESUME_AREA),
267 iram_save_size);
268 memcpy(IO_ADDRESS(TEGRA_IRAM_CODE_AREA), tegra_lp1_iram.start_addr,
269 iram_save_size); 273 iram_save_size);
274 memcpy(IO_ADDRESS(TEGRA_IRAM_LPx_RESUME_AREA),
275 tegra_lp1_iram.start_addr, iram_save_size);
270 276
271 *((u32 *)tegra_cpu_lp1_mask) = 1; 277 *((u32 *)tegra_cpu_lp1_mask) = 1;
272} 278}
@@ -276,7 +282,7 @@ static void tegra_suspend_exit_lp1(void)
276 tegra_pmc_resume(); 282 tegra_pmc_resume();
277 283
278 /* restore IRAM */ 284 /* restore IRAM */
279 memcpy(IO_ADDRESS(TEGRA_IRAM_CODE_AREA), iram_save_addr, 285 memcpy(IO_ADDRESS(TEGRA_IRAM_LPx_RESUME_AREA), iram_save_addr,
280 iram_save_size); 286 iram_save_size);
281 287
282 *(u32 *)tegra_cpu_lp1_mask = 0; 288 *(u32 *)tegra_cpu_lp1_mask = 0;
diff --git a/arch/arm/mach-tegra/pm.h b/arch/arm/mach-tegra/pm.h
index fe204e5256e7..6e92a7c2ecbd 100644
--- a/arch/arm/mach-tegra/pm.h
+++ b/arch/arm/mach-tegra/pm.h
@@ -37,9 +37,6 @@ void tegra30_sleep_core_init(void);
37 37
38extern unsigned long l2x0_saved_regs_addr; 38extern unsigned long l2x0_saved_regs_addr;
39 39
40void save_cpu_arch_register(void);
41void restore_cpu_arch_register(void);
42
43void tegra_clear_cpu_in_lp2(void); 40void tegra_clear_cpu_in_lp2(void);
44bool tegra_set_cpu_in_lp2(void); 41bool tegra_set_cpu_in_lp2(void);
45 42
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c
index 8acb881f7cfe..fb7920201ab4 100644
--- a/arch/arm/mach-tegra/pmc.c
+++ b/arch/arm/mach-tegra/pmc.c
@@ -20,6 +20,7 @@
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/of_address.h> 22#include <linux/of_address.h>
23#include <linux/tegra-powergate.h>
23 24
24#include "flowctrl.h" 25#include "flowctrl.h"
25#include "fuse.h" 26#include "fuse.h"
@@ -43,12 +44,6 @@
43#define PMC_CPUPWRGOOD_TIMER 0xc8 44#define PMC_CPUPWRGOOD_TIMER 0xc8
44#define PMC_CPUPWROFF_TIMER 0xcc 45#define PMC_CPUPWROFF_TIMER 0xcc
45 46
46#define TEGRA_POWERGATE_PCIE 3
47#define TEGRA_POWERGATE_VDEC 4
48#define TEGRA_POWERGATE_CPU1 9
49#define TEGRA_POWERGATE_CPU2 10
50#define TEGRA_POWERGATE_CPU3 11
51
52static u8 tegra_cpu_domains[] = { 47static u8 tegra_cpu_domains[] = {
53 0xFF, /* not available for CPU0 */ 48 0xFF, /* not available for CPU0 */
54 TEGRA_POWERGATE_CPU1, 49 TEGRA_POWERGATE_CPU1,
@@ -166,6 +161,15 @@ int tegra_pmc_cpu_remove_clamping(int cpuid)
166 return tegra_pmc_powergate_remove_clamping(id); 161 return tegra_pmc_powergate_remove_clamping(id);
167} 162}
168 163
164void tegra_pmc_restart(enum reboot_mode mode, const char *cmd)
165{
166 u32 val;
167
168 val = tegra_pmc_readl(0);
169 val |= 0x10;
170 tegra_pmc_writel(val, 0);
171}
172
169#ifdef CONFIG_PM_SLEEP 173#ifdef CONFIG_PM_SLEEP
170static void set_power_timers(u32 us_on, u32 us_off, unsigned long rate) 174static void set_power_timers(u32 us_on, u32 us_off, unsigned long rate)
171{ 175{
@@ -279,19 +283,17 @@ void tegra_pmc_suspend_init(void)
279#endif 283#endif
280 284
281static const struct of_device_id matches[] __initconst = { 285static const struct of_device_id matches[] __initconst = {
286 { .compatible = "nvidia,tegra124-pmc" },
282 { .compatible = "nvidia,tegra114-pmc" }, 287 { .compatible = "nvidia,tegra114-pmc" },
283 { .compatible = "nvidia,tegra30-pmc" }, 288 { .compatible = "nvidia,tegra30-pmc" },
284 { .compatible = "nvidia,tegra20-pmc" }, 289 { .compatible = "nvidia,tegra20-pmc" },
285 { } 290 { }
286}; 291};
287 292
288static void __init tegra_pmc_parse_dt(void) 293void __init tegra_pmc_init_irq(void)
289{ 294{
290 struct device_node *np; 295 struct device_node *np;
291 u32 prop; 296 u32 val;
292 enum tegra_suspend_mode suspend_mode;
293 u32 core_good_time[2] = {0, 0};
294 u32 lp0_vec[2] = {0, 0};
295 297
296 np = of_find_matching_node(NULL, matches); 298 np = of_find_matching_node(NULL, matches);
297 BUG_ON(!np); 299 BUG_ON(!np);
@@ -300,6 +302,26 @@ static void __init tegra_pmc_parse_dt(void)
300 302
301 tegra_pmc_invert_interrupt = of_property_read_bool(np, 303 tegra_pmc_invert_interrupt = of_property_read_bool(np,
302 "nvidia,invert-interrupt"); 304 "nvidia,invert-interrupt");
305
306 val = tegra_pmc_readl(PMC_CTRL);
307 if (tegra_pmc_invert_interrupt)
308 val |= PMC_CTRL_INTR_LOW;
309 else
310 val &= ~PMC_CTRL_INTR_LOW;
311 tegra_pmc_writel(val, PMC_CTRL);
312}
313
314void __init tegra_pmc_init(void)
315{
316 struct device_node *np;
317 u32 prop;
318 enum tegra_suspend_mode suspend_mode;
319 u32 core_good_time[2] = {0, 0};
320 u32 lp0_vec[2] = {0, 0};
321
322 np = of_find_matching_node(NULL, matches);
323 BUG_ON(!np);
324
303 tegra_pclk = of_clk_get_by_name(np, "pclk"); 325 tegra_pclk = of_clk_get_by_name(np, "pclk");
304 WARN_ON(IS_ERR(tegra_pclk)); 326 WARN_ON(IS_ERR(tegra_pclk));
305 327
@@ -365,17 +387,3 @@ static void __init tegra_pmc_parse_dt(void)
365 387
366 pmc_pm_data.suspend_mode = suspend_mode; 388 pmc_pm_data.suspend_mode = suspend_mode;
367} 389}
368
369void __init tegra_pmc_init(void)
370{
371 u32 val;
372
373 tegra_pmc_parse_dt();
374
375 val = tegra_pmc_readl(PMC_CTRL);
376 if (tegra_pmc_invert_interrupt)
377 val |= PMC_CTRL_INTR_LOW;
378 else
379 val &= ~PMC_CTRL_INTR_LOW;
380 tegra_pmc_writel(val, PMC_CTRL);
381}
diff --git a/arch/arm/mach-tegra/pmc.h b/arch/arm/mach-tegra/pmc.h
index 549f8c7b762c..59e19c344298 100644
--- a/arch/arm/mach-tegra/pmc.h
+++ b/arch/arm/mach-tegra/pmc.h
@@ -18,6 +18,8 @@
18#ifndef __MACH_TEGRA_PMC_H 18#ifndef __MACH_TEGRA_PMC_H
19#define __MACH_TEGRA_PMC_H 19#define __MACH_TEGRA_PMC_H
20 20
21#include <linux/reboot.h>
22
21enum tegra_suspend_mode { 23enum tegra_suspend_mode {
22 TEGRA_SUSPEND_NONE = 0, 24 TEGRA_SUSPEND_NONE = 0,
23 TEGRA_SUSPEND_LP2, /* CPU voltage off */ 25 TEGRA_SUSPEND_LP2, /* CPU voltage off */
@@ -39,6 +41,9 @@ bool tegra_pmc_cpu_is_powered(int cpuid);
39int tegra_pmc_cpu_power_on(int cpuid); 41int tegra_pmc_cpu_power_on(int cpuid);
40int tegra_pmc_cpu_remove_clamping(int cpuid); 42int tegra_pmc_cpu_remove_clamping(int cpuid);
41 43
44void tegra_pmc_restart(enum reboot_mode mode, const char *cmd);
45
46void tegra_pmc_init_irq(void);
42void tegra_pmc_init(void); 47void tegra_pmc_init(void);
43 48
44#endif 49#endif
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c
index f076f0f80fcd..85d28e756bb7 100644
--- a/arch/arm/mach-tegra/powergate.c
+++ b/arch/arm/mach-tegra/powergate.c
@@ -42,8 +42,16 @@
42 42
43static int tegra_num_powerdomains; 43static int tegra_num_powerdomains;
44static int tegra_num_cpu_domains; 44static int tegra_num_cpu_domains;
45static u8 *tegra_cpu_domains; 45static const u8 *tegra_cpu_domains;
46static u8 tegra30_cpu_domains[] = { 46
47static const u8 tegra30_cpu_domains[] = {
48 TEGRA_POWERGATE_CPU,
49 TEGRA_POWERGATE_CPU1,
50 TEGRA_POWERGATE_CPU2,
51 TEGRA_POWERGATE_CPU3,
52};
53
54static const u8 tegra114_cpu_domains[] = {
47 TEGRA_POWERGATE_CPU0, 55 TEGRA_POWERGATE_CPU0,
48 TEGRA_POWERGATE_CPU1, 56 TEGRA_POWERGATE_CPU1,
49 TEGRA_POWERGATE_CPU2, 57 TEGRA_POWERGATE_CPU2,
@@ -189,6 +197,11 @@ int __init tegra_powergate_init(void)
189 tegra_num_cpu_domains = 4; 197 tegra_num_cpu_domains = 4;
190 tegra_cpu_domains = tegra30_cpu_domains; 198 tegra_cpu_domains = tegra30_cpu_domains;
191 break; 199 break;
200 case TEGRA114:
201 tegra_num_powerdomains = 23;
202 tegra_num_cpu_domains = 4;
203 tegra_cpu_domains = tegra114_cpu_domains;
204 break;
192 default: 205 default:
193 /* Unknown Tegra variant. Disable powergating */ 206 /* Unknown Tegra variant. Disable powergating */
194 tegra_num_powerdomains = 0; 207 tegra_num_powerdomains = 0;
@@ -229,6 +242,27 @@ static const char * const powergate_name_t30[] = {
229 [TEGRA_POWERGATE_3D1] = "3d1", 242 [TEGRA_POWERGATE_3D1] = "3d1",
230}; 243};
231 244
245static const char * const powergate_name_t114[] = {
246 [TEGRA_POWERGATE_CPU] = "cpu0",
247 [TEGRA_POWERGATE_3D] = "3d",
248 [TEGRA_POWERGATE_VENC] = "venc",
249 [TEGRA_POWERGATE_VDEC] = "vdec",
250 [TEGRA_POWERGATE_MPE] = "mpe",
251 [TEGRA_POWERGATE_HEG] = "heg",
252 [TEGRA_POWERGATE_CPU1] = "cpu1",
253 [TEGRA_POWERGATE_CPU2] = "cpu2",
254 [TEGRA_POWERGATE_CPU3] = "cpu3",
255 [TEGRA_POWERGATE_CELP] = "celp",
256 [TEGRA_POWERGATE_CPU0] = "cpu0",
257 [TEGRA_POWERGATE_C0NC] = "c0nc",
258 [TEGRA_POWERGATE_C1NC] = "c1nc",
259 [TEGRA_POWERGATE_DIS] = "dis",
260 [TEGRA_POWERGATE_DISB] = "disb",
261 [TEGRA_POWERGATE_XUSBA] = "xusba",
262 [TEGRA_POWERGATE_XUSBB] = "xusbb",
263 [TEGRA_POWERGATE_XUSBC] = "xusbc",
264};
265
232static int powergate_show(struct seq_file *s, void *data) 266static int powergate_show(struct seq_file *s, void *data)
233{ 267{
234 int i; 268 int i;
@@ -236,9 +270,14 @@ static int powergate_show(struct seq_file *s, void *data)
236 seq_printf(s, " powergate powered\n"); 270 seq_printf(s, " powergate powered\n");
237 seq_printf(s, "------------------\n"); 271 seq_printf(s, "------------------\n");
238 272
239 for (i = 0; i < tegra_num_powerdomains; i++) 273 for (i = 0; i < tegra_num_powerdomains; i++) {
274 if (!powergate_name[i])
275 continue;
276
240 seq_printf(s, " %9s %7s\n", powergate_name[i], 277 seq_printf(s, " %9s %7s\n", powergate_name[i],
241 tegra_powergate_is_powered(i) ? "yes" : "no"); 278 tegra_powergate_is_powered(i) ? "yes" : "no");
279 }
280
242 return 0; 281 return 0;
243} 282}
244 283
@@ -265,6 +304,9 @@ int __init tegra_powergate_debugfs_init(void)
265 case TEGRA30: 304 case TEGRA30:
266 powergate_name = powergate_name_t30; 305 powergate_name = powergate_name_t30;
267 break; 306 break;
307 case TEGRA114:
308 powergate_name = powergate_name_t114;
309 break;
268 } 310 }
269 311
270 if (powergate_name) { 312 if (powergate_name) {
diff --git a/arch/arm/mach-tegra/reset-handler.S b/arch/arm/mach-tegra/reset-handler.S
index f527b2c2dea7..8c1ba4fea384 100644
--- a/arch/arm/mach-tegra/reset-handler.S
+++ b/arch/arm/mach-tegra/reset-handler.S
@@ -45,17 +45,11 @@
45ENTRY(tegra_resume) 45ENTRY(tegra_resume)
46 check_cpu_part_num 0xc09, r8, r9 46 check_cpu_part_num 0xc09, r8, r9
47 bleq v7_invalidate_l1 47 bleq v7_invalidate_l1
48 blne tegra_init_l2_for_a15
49 48
50 cpu_id r0 49 cpu_id r0
51 tegra_get_soc_id TEGRA_APB_MISC_BASE, r6
52 cmp r6, #TEGRA114
53 beq no_cpu0_chk
54
55 cmp r0, #0 @ CPU0? 50 cmp r0, #0 @ CPU0?
56 THUMB( it ne ) 51 THUMB( it ne )
57 bne cpu_resume @ no 52 bne cpu_resume @ no
58no_cpu0_chk:
59 53
60 /* Are we on Tegra20? */ 54 /* Are we on Tegra20? */
61 cmp r6, #TEGRA20 55 cmp r6, #TEGRA20
@@ -75,7 +69,7 @@ no_cpu0_chk:
75 69
76 mov32 r9, 0xc09 70 mov32 r9, 0xc09
77 cmp r8, r9 71 cmp r8, r9
78 bne not_ca9 72 bne end_ca9_scu_l2_resume
79#ifdef CONFIG_HAVE_ARM_SCU 73#ifdef CONFIG_HAVE_ARM_SCU
80 /* enable SCU */ 74 /* enable SCU */
81 mov32 r0, TEGRA_ARM_PERIF_BASE 75 mov32 r0, TEGRA_ARM_PERIF_BASE
@@ -86,7 +80,10 @@ no_cpu0_chk:
86 80
87 /* L2 cache resume & re-enable */ 81 /* L2 cache resume & re-enable */
88 l2_cache_resume r0, r1, r2, l2x0_saved_regs_addr 82 l2_cache_resume r0, r1, r2, l2x0_saved_regs_addr
89not_ca9: 83end_ca9_scu_l2_resume:
84 mov32 r9, 0xc0f
85 cmp r8, r9
86 bleq tegra_init_l2_for_a15
90 87
91 b cpu_resume 88 b cpu_resume
92ENDPROC(tegra_resume) 89ENDPROC(tegra_resume)
diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c
index fd0bbf8a6c94..568f5bbf979d 100644
--- a/arch/arm/mach-tegra/reset.c
+++ b/arch/arm/mach-tegra/reset.c
@@ -82,7 +82,7 @@ void __init tegra_cpu_reset_handler_init(void)
82 82
83#ifdef CONFIG_PM_SLEEP 83#ifdef CONFIG_PM_SLEEP
84 __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_LP1] = 84 __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_LP1] =
85 TEGRA_IRAM_CODE_AREA; 85 TEGRA_IRAM_LPx_RESUME_AREA;
86 __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_LP2] = 86 __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_LP2] =
87 virt_to_phys((void *)tegra_resume); 87 virt_to_phys((void *)tegra_resume);
88#endif 88#endif
diff --git a/arch/arm/mach-tegra/sleep-tegra20.S b/arch/arm/mach-tegra/sleep-tegra20.S
index 5c3bd11c9838..aaaf3abd2688 100644
--- a/arch/arm/mach-tegra/sleep-tegra20.S
+++ b/arch/arm/mach-tegra/sleep-tegra20.S
@@ -25,6 +25,7 @@
25#include <asm/cp15.h> 25#include <asm/cp15.h>
26#include <asm/cache.h> 26#include <asm/cache.h>
27 27
28#include "irammap.h"
28#include "sleep.h" 29#include "sleep.h"
29#include "flowctrl.h" 30#include "flowctrl.h"
30 31
@@ -235,7 +236,7 @@ ENTRY(tegra20_sleep_core_finish)
235 mov32 r0, tegra20_tear_down_core 236 mov32 r0, tegra20_tear_down_core
236 mov32 r1, tegra20_iram_start 237 mov32 r1, tegra20_iram_start
237 sub r0, r0, r1 238 sub r0, r0, r1
238 mov32 r1, TEGRA_IRAM_CODE_AREA 239 mov32 r1, TEGRA_IRAM_LPx_RESUME_AREA
239 add r0, r0, r1 240 add r0, r0, r1
240 241
241 mov pc, r3 242 mov pc, r3
@@ -328,7 +329,7 @@ tegra20_iram_start:
328 * The physical address of tegra_resume expected to be stored in 329 * The physical address of tegra_resume expected to be stored in
329 * PMC_SCRATCH41. 330 * PMC_SCRATCH41.
330 * 331 *
331 * NOTE: THIS *MUST* BE RELOCATED TO TEGRA_IRAM_CODE_AREA. 332 * NOTE: THIS *MUST* BE RELOCATED TO TEGRA_IRAM_LPx_RESUME_AREA.
332 */ 333 */
333ENTRY(tegra20_lp1_reset) 334ENTRY(tegra20_lp1_reset)
334 /* 335 /*
diff --git a/arch/arm/mach-tegra/sleep-tegra30.S b/arch/arm/mach-tegra/sleep-tegra30.S
index 63fa91b5fafb..b16d4a57fa59 100644
--- a/arch/arm/mach-tegra/sleep-tegra30.S
+++ b/arch/arm/mach-tegra/sleep-tegra30.S
@@ -20,6 +20,7 @@
20#include <asm/asm-offsets.h> 20#include <asm/asm-offsets.h>
21#include <asm/cache.h> 21#include <asm/cache.h>
22 22
23#include "irammap.h"
23#include "fuse.h" 24#include "fuse.h"
24#include "sleep.h" 25#include "sleep.h"
25#include "flowctrl.h" 26#include "flowctrl.h"
@@ -262,7 +263,7 @@ ENTRY(tegra30_sleep_core_finish)
262 mov32 r0, tegra30_tear_down_core 263 mov32 r0, tegra30_tear_down_core
263 mov32 r1, tegra30_iram_start 264 mov32 r1, tegra30_iram_start
264 sub r0, r0, r1 265 sub r0, r0, r1
265 mov32 r1, TEGRA_IRAM_CODE_AREA 266 mov32 r1, TEGRA_IRAM_LPx_RESUME_AREA
266 add r0, r0, r1 267 add r0, r0, r1
267 268
268 mov pc, r3 269 mov pc, r3
@@ -314,7 +315,7 @@ tegra30_iram_start:
314 * The physical address of tegra_resume expected to be stored in 315 * The physical address of tegra_resume expected to be stored in
315 * PMC_SCRATCH41. 316 * PMC_SCRATCH41.
316 * 317 *
317 * NOTE: THIS *MUST* BE RELOCATED TO TEGRA_IRAM_CODE_AREA. 318 * NOTE: THIS *MUST* BE RELOCATED TO TEGRA_IRAM_LPx_RESUME_AREA.
318 */ 319 */
319ENTRY(tegra30_lp1_reset) 320ENTRY(tegra30_lp1_reset)
320 /* 321 /*
@@ -382,7 +383,7 @@ _pll_m_c_x_done:
382 add r1, r1, #LOCK_DELAY 383 add r1, r1, #LOCK_DELAY
383 wait_until r1, r7, r3 384 wait_until r1, r7, r3
384 385
385 adr r5, tegra30_sdram_pad_save 386 adr r5, tegra_sdram_pad_save
386 387
387 ldr r4, [r5, #0x18] @ restore CLK_SOURCE_MSELECT 388 ldr r4, [r5, #0x18] @ restore CLK_SOURCE_MSELECT
388 str r4, [r0, #CLK_RESET_CLK_SOURCE_MSELECT] 389 str r4, [r0, #CLK_RESET_CLK_SOURCE_MSELECT]
@@ -407,8 +408,12 @@ _pll_m_c_x_done:
407 cmp r10, #TEGRA30 408 cmp r10, #TEGRA30
408 movweq r0, #:lower16:TEGRA_EMC_BASE @ r0 reserved for emc base 409 movweq r0, #:lower16:TEGRA_EMC_BASE @ r0 reserved for emc base
409 movteq r0, #:upper16:TEGRA_EMC_BASE 410 movteq r0, #:upper16:TEGRA_EMC_BASE
410 movwne r0, #:lower16:TEGRA_EMC0_BASE 411 cmp r10, #TEGRA114
411 movtne r0, #:upper16:TEGRA_EMC0_BASE 412 movweq r0, #:lower16:TEGRA_EMC0_BASE
413 movteq r0, #:upper16:TEGRA_EMC0_BASE
414 cmp r10, #TEGRA124
415 movweq r0, #:lower16:TEGRA124_EMC_BASE
416 movteq r0, #:upper16:TEGRA124_EMC_BASE
412 417
413exit_self_refresh: 418exit_self_refresh:
414 ldr r1, [r5, #0xC] @ restore EMC_XM2VTTGENPADCTRL 419 ldr r1, [r5, #0xC] @ restore EMC_XM2VTTGENPADCTRL
@@ -537,6 +542,7 @@ tegra30_sdram_pad_address:
537 .word TEGRA_PMC_BASE + PMC_IO_DPD_STATUS @0x14 542 .word TEGRA_PMC_BASE + PMC_IO_DPD_STATUS @0x14
538 .word TEGRA_CLK_RESET_BASE + CLK_RESET_CLK_SOURCE_MSELECT @0x18 543 .word TEGRA_CLK_RESET_BASE + CLK_RESET_CLK_SOURCE_MSELECT @0x18
539 .word TEGRA_CLK_RESET_BASE + CLK_RESET_SCLK_BURST @0x1c 544 .word TEGRA_CLK_RESET_BASE + CLK_RESET_SCLK_BURST @0x1c
545tegra30_sdram_pad_address_end:
540 546
541tegra114_sdram_pad_address: 547tegra114_sdram_pad_address:
542 .word TEGRA_EMC0_BASE + EMC_CFG @0x0 548 .word TEGRA_EMC0_BASE + EMC_CFG @0x0
@@ -552,16 +558,28 @@ tegra114_sdram_pad_address:
552 .word TEGRA_EMC1_BASE + EMC_AUTO_CAL_INTERVAL @0x28 558 .word TEGRA_EMC1_BASE + EMC_AUTO_CAL_INTERVAL @0x28
553 .word TEGRA_EMC1_BASE + EMC_XM2VTTGENPADCTRL @0x2c 559 .word TEGRA_EMC1_BASE + EMC_XM2VTTGENPADCTRL @0x2c
554 .word TEGRA_EMC1_BASE + EMC_XM2VTTGENPADCTRL2 @0x30 560 .word TEGRA_EMC1_BASE + EMC_XM2VTTGENPADCTRL2 @0x30
561tegra114_sdram_pad_adress_end:
562
563tegra124_sdram_pad_address:
564 .word TEGRA124_EMC_BASE + EMC_CFG @0x0
565 .word TEGRA124_EMC_BASE + EMC_ZCAL_INTERVAL @0x4
566 .word TEGRA124_EMC_BASE + EMC_AUTO_CAL_INTERVAL @0x8
567 .word TEGRA124_EMC_BASE + EMC_XM2VTTGENPADCTRL @0xc
568 .word TEGRA124_EMC_BASE + EMC_XM2VTTGENPADCTRL2 @0x10
569 .word TEGRA_PMC_BASE + PMC_IO_DPD_STATUS @0x14
570 .word TEGRA_CLK_RESET_BASE + CLK_RESET_CLK_SOURCE_MSELECT @0x18
571 .word TEGRA_CLK_RESET_BASE + CLK_RESET_SCLK_BURST @0x1c
572tegra124_sdram_pad_address_end:
555 573
556tegra30_sdram_pad_size: 574tegra30_sdram_pad_size:
557 .word tegra114_sdram_pad_address - tegra30_sdram_pad_address 575 .word tegra30_sdram_pad_address_end - tegra30_sdram_pad_address
558 576
559tegra114_sdram_pad_size: 577tegra114_sdram_pad_size:
560 .word tegra30_sdram_pad_size - tegra114_sdram_pad_address 578 .word tegra114_sdram_pad_adress_end - tegra114_sdram_pad_address
561 579
562 .type tegra30_sdram_pad_save, %object 580 .type tegra_sdram_pad_save, %object
563tegra30_sdram_pad_save: 581tegra_sdram_pad_save:
564 .rept (tegra30_sdram_pad_size - tegra114_sdram_pad_address) / 4 582 .rept (tegra114_sdram_pad_adress_end - tegra114_sdram_pad_address) / 4
565 .long 0 583 .long 0
566 .endr 584 .endr
567 585
@@ -692,13 +710,18 @@ halted:
692 */ 710 */
693tegra30_sdram_self_refresh: 711tegra30_sdram_self_refresh:
694 712
695 adr r8, tegra30_sdram_pad_save 713 adr r8, tegra_sdram_pad_save
696 tegra_get_soc_id TEGRA_APB_MISC_BASE, r10 714 tegra_get_soc_id TEGRA_APB_MISC_BASE, r10
697 cmp r10, #TEGRA30 715 cmp r10, #TEGRA30
698 adreq r2, tegra30_sdram_pad_address 716 adreq r2, tegra30_sdram_pad_address
699 ldreq r3, tegra30_sdram_pad_size 717 ldreq r3, tegra30_sdram_pad_size
700 adrne r2, tegra114_sdram_pad_address 718 cmp r10, #TEGRA114
701 ldrne r3, tegra114_sdram_pad_size 719 adreq r2, tegra114_sdram_pad_address
720 ldreq r3, tegra114_sdram_pad_size
721 cmp r10, #TEGRA124
722 adreq r2, tegra124_sdram_pad_address
723 ldreq r3, tegra30_sdram_pad_size
724
702 mov r9, #0 725 mov r9, #0
703 726
704padsave: 727padsave:
@@ -716,7 +739,10 @@ padsave_done:
716 739
717 cmp r10, #TEGRA30 740 cmp r10, #TEGRA30
718 ldreq r0, =TEGRA_EMC_BASE @ r0 reserved for emc base addr 741 ldreq r0, =TEGRA_EMC_BASE @ r0 reserved for emc base addr
719 ldrne r0, =TEGRA_EMC0_BASE 742 cmp r10, #TEGRA114
743 ldreq r0, =TEGRA_EMC0_BASE
744 cmp r10, #TEGRA124
745 ldreq r0, =TEGRA124_EMC_BASE
720 746
721enter_self_refresh: 747enter_self_refresh:
722 cmp r10, #TEGRA30 748 cmp r10, #TEGRA30
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 5b8605547a09..ce553d557c31 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -16,7 +16,6 @@
16 * 16 *
17 */ 17 */
18 18
19#include <linux/clocksource.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
21#include <linux/init.h> 20#include <linux/init.h>
22#include <linux/platform_device.h> 21#include <linux/platform_device.h>
@@ -34,16 +33,78 @@
34#include <linux/sys_soc.h> 33#include <linux/sys_soc.h>
35#include <linux/usb/tegra_usb_phy.h> 34#include <linux/usb/tegra_usb_phy.h>
36#include <linux/clk/tegra.h> 35#include <linux/clk/tegra.h>
36#include <linux/irqchip.h>
37 37
38#include <asm/hardware/cache-l2x0.h>
38#include <asm/mach-types.h> 39#include <asm/mach-types.h>
39#include <asm/mach/arch.h> 40#include <asm/mach/arch.h>
40#include <asm/mach/time.h> 41#include <asm/mach/time.h>
41#include <asm/setup.h> 42#include <asm/setup.h>
42 43
44#include "apbio.h"
43#include "board.h" 45#include "board.h"
44#include "common.h" 46#include "common.h"
47#include "cpuidle.h"
45#include "fuse.h" 48#include "fuse.h"
46#include "iomap.h" 49#include "iomap.h"
50#include "irq.h"
51#include "pmc.h"
52#include "pm.h"
53#include "reset.h"
54#include "sleep.h"
55
56/*
57 * Storage for debug-macro.S's state.
58 *
59 * This must be in .data not .bss so that it gets initialized each time the
60 * kernel is loaded. The data is declared here rather than debug-macro.S so
61 * that multiple inclusions of debug-macro.S point at the same data.
62 */
63u32 tegra_uart_config[4] = {
64 /* Debug UART initialization required */
65 1,
66 /* Debug UART physical address */
67 0,
68 /* Debug UART virtual address */
69 0,
70 /* Scratch space for debug macro */
71 0,
72};
73
74static void __init tegra_init_cache(void)
75{
76#ifdef CONFIG_CACHE_L2X0
77 int ret;
78 void __iomem *p = IO_ADDRESS(TEGRA_ARM_PERIF_BASE) + 0x3000;
79 u32 aux_ctrl, cache_type;
80
81 cache_type = readl(p + L2X0_CACHE_TYPE);
82 aux_ctrl = (cache_type & 0x700) << (17-8);
83 aux_ctrl |= 0x7C400001;
84
85 ret = l2x0_of_init(aux_ctrl, 0x8200c3fe);
86 if (!ret)
87 l2x0_saved_regs_addr = virt_to_phys(&l2x0_saved_regs);
88#endif
89}
90
91static void __init tegra_init_early(void)
92{
93 tegra_cpu_reset_handler_init();
94 tegra_apb_io_init();
95 tegra_init_fuse();
96 tegra_init_cache();
97 tegra_powergate_init();
98 tegra_hotplug_init();
99}
100
101static void __init tegra_dt_init_irq(void)
102{
103 tegra_pmc_init_irq();
104 tegra_init_irq();
105 irqchip_init();
106 tegra_legacy_irq_syscore_init();
107}
47 108
48static void __init tegra_dt_init(void) 109static void __init tegra_dt_init(void)
49{ 110{
@@ -51,6 +112,8 @@ static void __init tegra_dt_init(void)
51 struct soc_device *soc_dev; 112 struct soc_device *soc_dev;
52 struct device *parent = NULL; 113 struct device *parent = NULL;
53 114
115 tegra_pmc_init();
116
54 tegra_clocks_apply_init_table(); 117 tegra_clocks_apply_init_table();
55 118
56 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 119 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
@@ -97,7 +160,9 @@ static void __init tegra_dt_init_late(void)
97{ 160{
98 int i; 161 int i;
99 162
100 tegra_init_late(); 163 tegra_init_suspend();
164 tegra_cpuidle_init();
165 tegra_powergate_debugfs_init();
101 166
102 for (i = 0; i < ARRAY_SIZE(board_init_funcs); i++) { 167 for (i = 0; i < ARRAY_SIZE(board_init_funcs); i++) {
103 if (of_machine_is_compatible(board_init_funcs[i].machine)) { 168 if (of_machine_is_compatible(board_init_funcs[i].machine)) {
@@ -108,6 +173,7 @@ static void __init tegra_dt_init_late(void)
108} 173}
109 174
110static const char * const tegra_dt_board_compat[] = { 175static const char * const tegra_dt_board_compat[] = {
176 "nvidia,tegra124",
111 "nvidia,tegra114", 177 "nvidia,tegra114",
112 "nvidia,tegra30", 178 "nvidia,tegra30",
113 "nvidia,tegra20", 179 "nvidia,tegra20",
@@ -119,9 +185,8 @@ DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)")
119 .smp = smp_ops(tegra_smp_ops), 185 .smp = smp_ops(tegra_smp_ops),
120 .init_early = tegra_init_early, 186 .init_early = tegra_init_early,
121 .init_irq = tegra_dt_init_irq, 187 .init_irq = tegra_dt_init_irq,
122 .init_time = clocksource_of_init,
123 .init_machine = tegra_dt_init, 188 .init_machine = tegra_dt_init,
124 .init_late = tegra_dt_init_late, 189 .init_late = tegra_dt_init_late,
125 .restart = tegra_assert_system_reset, 190 .restart = tegra_pmc_restart,
126 .dt_compat = tegra_dt_board_compat, 191 .dt_compat = tegra_dt_board_compat,
127MACHINE_END 192MACHINE_END
diff --git a/arch/arm/mach-u300/Kconfig b/arch/arm/mach-u300/Kconfig
index a85adcd00882..8e23071bd1b3 100644
--- a/arch/arm/mach-u300/Kconfig
+++ b/arch/arm/mach-u300/Kconfig
@@ -1,7 +1,3 @@
1menu "ST-Ericsson AB U300/U335 Platform"
2
3comment "ST-Ericsson Mobile Platform Products"
4
5config ARCH_U300 1config ARCH_U300
6 bool "ST-Ericsson U300 Series" if ARCH_MULTI_V5 2 bool "ST-Ericsson U300 Series" if ARCH_MULTI_V5
7 depends on MMU 3 depends on MMU
@@ -9,7 +5,6 @@ config ARCH_U300
9 select ARM_AMBA 5 select ARM_AMBA
10 select ARM_PATCH_PHYS_VIRT 6 select ARM_PATCH_PHYS_VIRT
11 select ARM_VIC 7 select ARM_VIC
12 select CLKDEV_LOOKUP
13 select CLKSRC_MMIO 8 select CLKSRC_MMIO
14 select CLKSRC_OF 9 select CLKSRC_OF
15 select COMMON_CLK 10 select COMMON_CLK
@@ -25,7 +20,9 @@ config ARCH_U300
25 help 20 help
26 Support for ST-Ericsson U300 series mobile platforms. 21 Support for ST-Ericsson U300 series mobile platforms.
27 22
28comment "ST-Ericsson U300/U335 Feature Selections" 23if ARCH_U300
24
25menu "ST-Ericsson AB U300/U335 Platform"
29 26
30config MACH_U300 27config MACH_U300
31 depends on ARCH_U300 28 depends on ARCH_U300
@@ -53,3 +50,5 @@ config MACH_U300_SPIDUMMY
53 SPI framework and ARM PL022 support. 50 SPI framework and ARM PL022 support.
54 51
55endmenu 52endmenu
53
54endif
diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
index b5db207dfd1e..9a5f9fb352ce 100644
--- a/arch/arm/mach-u300/timer.c
+++ b/arch/arm/mach-u300/timer.c
@@ -358,8 +358,7 @@ static struct delay_timer u300_delay_timer;
358 */ 358 */
359static void __init u300_timer_init_of(struct device_node *np) 359static void __init u300_timer_init_of(struct device_node *np)
360{ 360{
361 struct resource irq_res; 361 unsigned int irq;
362 int irq;
363 struct clk *clk; 362 struct clk *clk;
364 unsigned long rate; 363 unsigned long rate;
365 364
@@ -368,11 +367,11 @@ static void __init u300_timer_init_of(struct device_node *np)
368 panic("could not ioremap system timer\n"); 367 panic("could not ioremap system timer\n");
369 368
370 /* Get the IRQ for the GP1 timer */ 369 /* Get the IRQ for the GP1 timer */
371 irq = of_irq_to_resource(np, 2, &irq_res); 370 irq = irq_of_parse_and_map(np, 2);
372 if (irq <= 0) 371 if (!irq)
373 panic("no IRQ for system timer\n"); 372 panic("no IRQ for system timer\n");
374 373
375 pr_info("U300 GP1 timer @ base: %p, IRQ: %d\n", u300_timer_base, irq); 374 pr_info("U300 GP1 timer @ base: %p, IRQ: %u\n", u300_timer_base, irq);
376 375
377 /* Clock the interrupt controller */ 376 /* Clock the interrupt controller */
378 clk = of_clk_get(np, 0); 377 clk = of_clk_get(np, 0);
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 99a28d628297..0034d2cd6973 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -1,40 +1,34 @@
1config ARCH_U8500 1config ARCH_U8500
2 bool "ST-Ericsson U8500 Series" if ARCH_MULTI_V7 2 bool "ST-Ericsson U8500 Series" if ARCH_MULTI_V7
3 depends on MMU 3 depends on MMU
4 select AB8500_CORE
5 select ABX500_CORE
4 select ARCH_HAS_CPUFREQ 6 select ARCH_HAS_CPUFREQ
5 select ARCH_REQUIRE_GPIOLIB 7 select ARCH_REQUIRE_GPIOLIB
6 select ARM_AMBA 8 select ARM_AMBA
7 select CLKDEV_LOOKUP 9 select ARM_ERRATA_754322
10 select ARM_ERRATA_764369 if SMP
11 select ARM_GIC
12 select CACHE_L2X0
13 select CLKSRC_NOMADIK_MTU
14 select COMMON_CLK
8 select CPU_V7 15 select CPU_V7
9 select GENERIC_CLOCKEVENTS 16 select GENERIC_CLOCKEVENTS
10 select HAVE_ARM_SCU if SMP 17 select HAVE_ARM_SCU if SMP
11 select HAVE_ARM_TWD if SMP 18 select HAVE_ARM_TWD if SMP
12 select HAVE_SMP 19 select HAVE_SMP
13 select MIGHT_HAVE_CACHE_L2X0 20 select MIGHT_HAVE_CACHE_L2X0
21 select PINCTRL
22 select PINCTRL_ABX500
23 select PINCTRL_NOMADIK
24 select PL310_ERRATA_753970 if CACHE_PL310
14 help 25 help
15 Support for ST-Ericsson's Ux500 architecture 26 Support for ST-Ericsson's Ux500 architecture
16 27
17if ARCH_U8500 28if ARCH_U8500
18 29
19config UX500_SOC_COMMON
20 bool
21 default y
22 select ABX500_CORE
23 select AB8500_CORE
24 select ARM_ERRATA_754322
25 select ARM_ERRATA_764369 if SMP
26 select ARM_GIC
27 select CACHE_L2X0
28 select CLKSRC_NOMADIK_MTU
29 select COMMON_CLK
30 select PINCTRL
31 select PINCTRL_NOMADIK
32 select PINCTRL_ABX500
33 select PL310_ERRATA_753970 if CACHE_PL310
34
35config UX500_SOC_DB8500 30config UX500_SOC_DB8500
36 bool 31 bool
37 select CPU_FREQ_TABLE if CPU_FREQ
38 select MFD_DB8500_PRCMU 32 select MFD_DB8500_PRCMU
39 select PINCTRL_DB8500 33 select PINCTRL_DB8500
40 select PINCTRL_DB8540 34 select PINCTRL_DB8540
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index fe1f3e26b88b..616b96e86ad4 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -2,14 +2,11 @@
2# Makefile for the linux kernel, U8500 machine. 2# Makefile for the linux kernel, U8500 machine.
3# 3#
4 4
5obj-y := cpu.o devices.o devices-common.o \ 5obj-y := cpu.o devices.o id.o timer.o pm.o
6 id.o usb.o timer.o pm.o
7obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o 6obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
8obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o 7obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o
9obj-$(CONFIG_MACH_MOP500) += board-mop500.o board-mop500-sdi.o \ 8obj-$(CONFIG_MACH_MOP500) += board-mop500.o board-mop500-sdi.o \
10 board-mop500-regulators.o \ 9 board-mop500-regulators.o \
11 board-mop500-uib.o board-mop500-stuib.o \
12 board-mop500-u8500uib.o \
13 board-mop500-pins.o \ 10 board-mop500-pins.o \
14 board-mop500-audio.o 11 board-mop500-audio.o
15obj-$(CONFIG_SMP) += platsmp.o headsmp.o 12obj-$(CONFIG_SMP) += platsmp.o headsmp.o
diff --git a/arch/arm/mach-ux500/board-mop500-audio.c b/arch/arm/mach-ux500/board-mop500-audio.c
index ec0807247e60..154e15f59702 100644
--- a/arch/arm/mach-ux500/board-mop500-audio.c
+++ b/arch/arm/mach-ux500/board-mop500-audio.c
@@ -68,40 +68,6 @@ static struct stedma40_chan_cfg msp2_dma_tx = {
68 .phy_channel = 1, 68 .phy_channel = 1,
69}; 69};
70 70
71static struct platform_device *db8500_add_msp_i2s(struct device *parent,
72 int id,
73 resource_size_t base, int irq,
74 struct msp_i2s_platform_data *pdata)
75{
76 struct platform_device *pdev;
77 struct resource res[] = {
78 DEFINE_RES_MEM(base, SZ_4K),
79 DEFINE_RES_IRQ(irq),
80 };
81
82 pr_info("Register platform-device 'ux500-msp-i2s', id %d, irq %d\n",
83 id, irq);
84 pdev = platform_device_register_resndata(parent, "ux500-msp-i2s", id,
85 res, ARRAY_SIZE(res),
86 pdata, sizeof(*pdata));
87 if (!pdev) {
88 pr_err("Failed to register platform-device 'ux500-msp-i2s.%d'!\n",
89 id);
90 return NULL;
91 }
92
93 return pdev;
94}
95
96/* Platform device for ASoC MOP500 machine */
97static struct platform_device snd_soc_mop500 = {
98 .name = "snd-soc-mop500",
99 .id = 0,
100 .dev = {
101 .platform_data = NULL,
102 },
103};
104
105struct msp_i2s_platform_data msp2_platform_data = { 71struct msp_i2s_platform_data msp2_platform_data = {
106 .id = MSP_I2S_2, 72 .id = MSP_I2S_2,
107 .msp_i2s_dma_rx = &msp2_dma_rx, 73 .msp_i2s_dma_rx = &msp2_dma_rx,
@@ -113,19 +79,3 @@ struct msp_i2s_platform_data msp3_platform_data = {
113 .msp_i2s_dma_rx = &msp1_dma_rx, 79 .msp_i2s_dma_rx = &msp1_dma_rx,
114 .msp_i2s_dma_tx = NULL, 80 .msp_i2s_dma_tx = NULL,
115}; 81};
116
117void mop500_audio_init(struct device *parent)
118{
119 pr_info("%s: Register platform-device 'snd-soc-mop500'.\n", __func__);
120 platform_device_register(&snd_soc_mop500);
121
122 pr_info("Initialize MSP I2S-devices.\n");
123 db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0,
124 &msp0_platform_data);
125 db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1,
126 &msp1_platform_data);
127 db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2,
128 &msp2_platform_data);
129 db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1,
130 &msp3_platform_data);
131}
diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c
index b3e61a38e5c8..26600a1c5319 100644
--- a/arch/arm/mach-ux500/board-mop500-sdi.c
+++ b/arch/arm/mach-ux500/board-mop500-sdi.c
@@ -65,18 +65,6 @@ struct mmci_platform_data mop500_sdi0_data = {
65#endif 65#endif
66}; 66};
67 67
68static void sdi0_configure(struct device *parent)
69{
70 /* Add the device, force v2 to subrevision 1 */
71 db8500_add_sdi0(parent, &mop500_sdi0_data, U8500_SDI_V2_PERIPHID);
72}
73
74void mop500_sdi_tc35892_init(struct device *parent)
75{
76 mop500_sdi0_data.gpio_cd = GPIO_SDMMC_CD;
77 sdi0_configure(parent);
78}
79
80/* 68/*
81 * SDI1 (SDIO WLAN) 69 * SDI1 (SDIO WLAN)
82 */ 70 */
@@ -178,42 +166,3 @@ struct mmci_platform_data mop500_sdi4_data = {
178 .dma_tx_param = &mop500_sdi4_dma_cfg_tx, 166 .dma_tx_param = &mop500_sdi4_dma_cfg_tx,
179#endif 167#endif
180}; 168};
181
182void __init mop500_sdi_init(struct device *parent)
183{
184 /* PoP:ed eMMC */
185 db8500_add_sdi2(parent, &mop500_sdi2_data, U8500_SDI_V2_PERIPHID);
186 /* On-board eMMC */
187 db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
188
189 /*
190 * On boards with the TC35892 GPIO expander, sdi0 will finally
191 * be added when the TC35892 initializes and calls
192 * mop500_sdi_tc35892_init() above.
193 */
194}
195
196void __init snowball_sdi_init(struct device *parent)
197{
198 /* On Snowball MMC_CAP_SD_HIGHSPEED isn't supported (Hardware issue?) */
199 mop500_sdi0_data.capabilities &= ~MMC_CAP_SD_HIGHSPEED;
200 /* On-board eMMC */
201 db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
202 /* External Micro SD slot */
203 mop500_sdi0_data.gpio_cd = SNOWBALL_SDMMC_CD_GPIO;
204 mop500_sdi0_data.cd_invert = true;
205 sdi0_configure(parent);
206}
207
208void __init hrefv60_sdi_init(struct device *parent)
209{
210 /* PoP:ed eMMC */
211 db8500_add_sdi2(parent, &mop500_sdi2_data, U8500_SDI_V2_PERIPHID);
212 /* On-board eMMC */
213 db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
214 /* External Micro SD slot */
215 mop500_sdi0_data.gpio_cd = HREFV60_SDMMC_CD_GPIO;
216 sdi0_configure(parent);
217 /* WLAN SDIO channel */
218 db8500_add_sdi1(parent, &mop500_sdi1_data, U8500_SDI_V2_PERIPHID);
219}
diff --git a/arch/arm/mach-ux500/board-mop500-stuib.c b/arch/arm/mach-ux500/board-mop500-stuib.c
deleted file mode 100644
index 7e1f294f0434..000000000000
--- a/arch/arm/mach-ux500/board-mop500-stuib.c
+++ /dev/null
@@ -1,120 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License terms: GNU General Public License (GPL), version 2
5 */
6
7#include <linux/kernel.h>
8#include <linux/init.h>
9#include <linux/mfd/stmpe.h>
10#include <linux/input/bu21013.h>
11#include <linux/gpio.h>
12#include <linux/interrupt.h>
13#include <linux/i2c.h>
14#include <linux/input/matrix_keypad.h>
15#include <asm/mach-types.h>
16
17#include "board-mop500.h"
18
19/* STMPE/SKE keypad use this key layout */
20static const unsigned int mop500_keymap[] = {
21 KEY(2, 5, KEY_END),
22 KEY(4, 1, KEY_POWER),
23 KEY(3, 5, KEY_VOLUMEDOWN),
24 KEY(1, 3, KEY_3),
25 KEY(5, 2, KEY_RIGHT),
26 KEY(5, 0, KEY_9),
27
28 KEY(0, 5, KEY_MENU),
29 KEY(7, 6, KEY_ENTER),
30 KEY(4, 5, KEY_0),
31 KEY(6, 7, KEY_2),
32 KEY(3, 4, KEY_UP),
33 KEY(3, 3, KEY_DOWN),
34
35 KEY(6, 4, KEY_SEND),
36 KEY(6, 2, KEY_BACK),
37 KEY(4, 2, KEY_VOLUMEUP),
38 KEY(5, 5, KEY_1),
39 KEY(4, 3, KEY_LEFT),
40 KEY(3, 2, KEY_7),
41};
42
43static const struct matrix_keymap_data mop500_keymap_data = {
44 .keymap = mop500_keymap,
45 .keymap_size = ARRAY_SIZE(mop500_keymap),
46};
47/*
48 * STMPE1601
49 */
50static struct stmpe_keypad_platform_data stmpe1601_keypad_data = {
51 .debounce_ms = 64,
52 .scan_count = 8,
53 .no_autorepeat = true,
54 .keymap_data = &mop500_keymap_data,
55};
56
57static struct stmpe_platform_data stmpe1601_data = {
58 .id = 1,
59 .blocks = STMPE_BLOCK_KEYPAD,
60 .irq_trigger = IRQF_TRIGGER_FALLING,
61 .irq_base = MOP500_STMPE1601_IRQ(0),
62 .keypad = &stmpe1601_keypad_data,
63 .autosleep = true,
64 .autosleep_timeout = 1024,
65};
66
67static struct i2c_board_info __initdata mop500_i2c0_devices_stuib[] = {
68 {
69 I2C_BOARD_INFO("stmpe1601", 0x40),
70 .irq = NOMADIK_GPIO_TO_IRQ(218),
71 .platform_data = &stmpe1601_data,
72 .flags = I2C_CLIENT_WAKE,
73 },
74};
75
76/*
77 * BU21013 ROHM touchscreen interface on the STUIBs
78 */
79
80#define TOUCH_GPIO_PIN 84
81
82#define TOUCH_XMAX 384
83#define TOUCH_YMAX 704
84
85#define PRCMU_CLOCK_OCR 0x1CC
86#define TSC_EXT_CLOCK_9_6MHZ 0x840000
87
88static struct bu21013_platform_device tsc_plat_device = {
89 .touch_pin = TOUCH_GPIO_PIN,
90 .touch_x_max = TOUCH_XMAX,
91 .touch_y_max = TOUCH_YMAX,
92 .ext_clk = false,
93 .x_flip = false,
94 .y_flip = true,
95};
96
97static struct i2c_board_info __initdata u8500_i2c3_devices_stuib[] = {
98 {
99 I2C_BOARD_INFO("bu21013_tp", 0x5C),
100 .platform_data = &tsc_plat_device,
101 },
102 {
103 I2C_BOARD_INFO("bu21013_tp", 0x5D),
104 .platform_data = &tsc_plat_device,
105 },
106};
107
108void __init mop500_stuib_init(void)
109{
110 if (machine_is_hrefv60())
111 tsc_plat_device.cs_pin = HREFV60_TOUCH_RST_GPIO;
112 else
113 tsc_plat_device.cs_pin = GPIO_BU21013_CS;
114
115 mop500_uib_i2c_add(0, mop500_i2c0_devices_stuib,
116 ARRAY_SIZE(mop500_i2c0_devices_stuib));
117
118 mop500_uib_i2c_add(3, u8500_i2c3_devices_stuib,
119 ARRAY_SIZE(u8500_i2c3_devices_stuib));
120}
diff --git a/arch/arm/mach-ux500/board-mop500-u8500uib.c b/arch/arm/mach-ux500/board-mop500-u8500uib.c
deleted file mode 100644
index d397c19570af..000000000000
--- a/arch/arm/mach-ux500/board-mop500-u8500uib.c
+++ /dev/null
@@ -1,92 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Board data for the U8500 UIB, also known as the New UIB
5 * License terms: GNU General Public License (GPL), version 2
6 */
7#include <linux/gpio.h>
8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <linux/i2c.h>
11#include <linux/interrupt.h>
12#include <linux/mfd/tc3589x.h>
13#include <linux/input/matrix_keypad.h>
14
15#include "irqs.h"
16
17#include "board-mop500.h"
18
19static struct i2c_board_info __initdata mop500_i2c3_devices_u8500[] = {
20 {
21 I2C_BOARD_INFO("synaptics_rmi4_i2c", 0x4B),
22 .irq = NOMADIK_GPIO_TO_IRQ(84),
23 },
24};
25
26/*
27 * TC35893
28 */
29static const unsigned int u8500_keymap[] = {
30 KEY(3, 1, KEY_END),
31 KEY(4, 1, KEY_POWER),
32 KEY(6, 4, KEY_VOLUMEDOWN),
33 KEY(4, 2, KEY_EMAIL),
34 KEY(3, 3, KEY_RIGHT),
35 KEY(2, 5, KEY_BACKSPACE),
36
37 KEY(6, 7, KEY_MENU),
38 KEY(5, 0, KEY_ENTER),
39 KEY(4, 3, KEY_0),
40 KEY(3, 4, KEY_DOT),
41 KEY(5, 2, KEY_UP),
42 KEY(3, 5, KEY_DOWN),
43
44 KEY(4, 5, KEY_SEND),
45 KEY(0, 5, KEY_BACK),
46 KEY(6, 2, KEY_VOLUMEUP),
47 KEY(1, 3, KEY_SPACE),
48 KEY(7, 6, KEY_LEFT),
49 KEY(5, 5, KEY_SEARCH),
50};
51
52static struct matrix_keymap_data u8500_keymap_data = {
53 .keymap = u8500_keymap,
54 .keymap_size = ARRAY_SIZE(u8500_keymap),
55};
56
57static struct tc3589x_keypad_platform_data tc35893_data = {
58 .krow = TC_KPD_ROWS,
59 .kcol = TC_KPD_COLUMNS,
60 .debounce_period = TC_KPD_DEBOUNCE_PERIOD,
61 .settle_time = TC_KPD_SETTLE_TIME,
62 .irqtype = IRQF_TRIGGER_FALLING,
63 .enable_wakeup = true,
64 .keymap_data = &u8500_keymap_data,
65 .no_autorepeat = true,
66};
67
68static struct tc3589x_platform_data tc3589x_keypad_data = {
69 .block = TC3589x_BLOCK_KEYPAD,
70 .keypad = &tc35893_data,
71 .irq_base = MOP500_EGPIO_IRQ_BASE,
72};
73
74static struct i2c_board_info __initdata mop500_i2c0_devices_u8500[] = {
75 {
76 I2C_BOARD_INFO("tc3589x", 0x44),
77 .platform_data = &tc3589x_keypad_data,
78 .irq = NOMADIK_GPIO_TO_IRQ(218),
79 .flags = I2C_CLIENT_WAKE,
80 },
81};
82
83
84void __init mop500_u8500uib_init(void)
85{
86 mop500_uib_i2c_add(3, mop500_i2c3_devices_u8500,
87 ARRAY_SIZE(mop500_i2c3_devices_u8500));
88
89 mop500_uib_i2c_add(0, mop500_i2c0_devices_u8500,
90 ARRAY_SIZE(mop500_i2c0_devices_u8500));
91
92}
diff --git a/arch/arm/mach-ux500/board-mop500-uib.c b/arch/arm/mach-ux500/board-mop500-uib.c
deleted file mode 100644
index bdaa422da028..000000000000
--- a/arch/arm/mach-ux500/board-mop500-uib.c
+++ /dev/null
@@ -1,133 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL), version 2
6 */
7
8#define pr_fmt(fmt) "mop500-uib: " fmt
9
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/i2c.h>
13
14#include "board-mop500.h"
15#include "id.h"
16
17enum mop500_uib {
18 STUIB,
19 U8500UIB,
20};
21
22struct uib {
23 const char *name;
24 const char *option;
25 void (*init)(void);
26};
27
28static struct uib __initdata mop500_uibs[] = {
29 [STUIB] = {
30 .name = "ST-UIB",
31 .option = "stuib",
32 .init = mop500_stuib_init,
33 },
34 [U8500UIB] = {
35 .name = "U8500-UIB",
36 .option = "u8500uib",
37 .init = mop500_u8500uib_init,
38 },
39};
40
41static struct uib *mop500_uib;
42
43static int __init mop500_uib_setup(char *str)
44{
45 int i;
46
47 for (i = 0; i < ARRAY_SIZE(mop500_uibs); i++) {
48 struct uib *uib = &mop500_uibs[i];
49
50 if (!strcmp(str, uib->option)) {
51 mop500_uib = uib;
52 break;
53 }
54 }
55
56 if (i == ARRAY_SIZE(mop500_uibs))
57 pr_err("invalid uib= option (%s)\n", str);
58
59 return 1;
60}
61__setup("uib=", mop500_uib_setup);
62
63/*
64 * The UIBs are detected after the I2C host controllers are registered, so
65 * i2c_register_board_info() can't be used.
66 */
67void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info,
68 unsigned n)
69{
70 struct i2c_adapter *adap;
71 struct i2c_client *client;
72 int i;
73
74 adap = i2c_get_adapter(busnum);
75 if (!adap) {
76 pr_err("failed to get adapter i2c%d\n", busnum);
77 return;
78 }
79
80 for (i = 0; i < n; i++) {
81 client = i2c_new_device(adap, &info[i]);
82 if (!client)
83 pr_err("failed to register %s to i2c%d\n",
84 info[i].type, busnum);
85 }
86
87 i2c_put_adapter(adap);
88}
89
90static void __init __mop500_uib_init(struct uib *uib, const char *why)
91{
92 pr_info("%s (%s)\n", uib->name, why);
93 uib->init();
94}
95
96/*
97 * Detect the UIB attached based on the presence or absence of i2c devices.
98 */
99int __init mop500_uib_init(void)
100{
101 struct uib *uib = mop500_uib;
102 struct i2c_adapter *i2c0;
103 int ret;
104
105 if (!cpu_is_u8500_family())
106 return -ENODEV;
107
108 if (uib) {
109 __mop500_uib_init(uib, "from uib= boot argument");
110 return 0;
111 }
112
113 i2c0 = i2c_get_adapter(0);
114 if (!i2c0) {
115 __mop500_uib_init(&mop500_uibs[STUIB],
116 "fallback, could not get i2c0");
117 return -ENODEV;
118 }
119
120 /* U8500-UIB has the TC35893 at 0x44 on I2C0, the ST-UIB doesn't. */
121 ret = i2c_smbus_xfer(i2c0, 0x44, 0, I2C_SMBUS_WRITE, 0,
122 I2C_SMBUS_QUICK, NULL);
123 i2c_put_adapter(i2c0);
124
125 if (ret == 0)
126 uib = &mop500_uibs[U8500UIB];
127 else
128 uib = &mop500_uibs[STUIB];
129
130 __mop500_uib_init(uib, "detected");
131
132 return 0;
133}
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index ad0806eff762..514d40b625a4 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -14,27 +14,16 @@
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/i2c.h>
18#include <linux/platform_data/i2c-nomadik.h>
19#include <linux/platform_data/db8500_thermal.h> 17#include <linux/platform_data/db8500_thermal.h>
20#include <linux/gpio.h>
21#include <linux/amba/bus.h> 18#include <linux/amba/bus.h>
22#include <linux/amba/pl022.h> 19#include <linux/amba/pl022.h>
23#include <linux/amba/serial.h>
24#include <linux/spi/spi.h>
25#include <linux/mfd/abx500/ab8500.h> 20#include <linux/mfd/abx500/ab8500.h>
26#include <linux/regulator/ab8500.h> 21#include <linux/regulator/ab8500.h>
27#include <linux/regulator/fixed.h> 22#include <linux/regulator/fixed.h>
28#include <linux/regulator/driver.h> 23#include <linux/regulator/driver.h>
29#include <linux/regulator/gpio-regulator.h>
30#include <linux/mfd/tc3589x.h>
31#include <linux/mfd/tps6105x.h> 24#include <linux/mfd/tps6105x.h>
32#include <linux/mfd/abx500/ab8500-gpio.h>
33#include <linux/mfd/abx500/ab8500-codec.h>
34#include <linux/platform_data/leds-lp55xx.h> 25#include <linux/platform_data/leds-lp55xx.h>
35#include <linux/input.h> 26#include <linux/input.h>
36#include <linux/smsc911x.h>
37#include <linux/gpio_keys.h>
38#include <linux/delay.h> 27#include <linux/delay.h>
39#include <linux/leds.h> 28#include <linux/leds.h>
40#include <linux/pinctrl/consumer.h> 29#include <linux/pinctrl/consumer.h>
@@ -46,7 +35,6 @@
46#include "setup.h" 35#include "setup.h"
47#include "devices.h" 36#include "devices.h"
48#include "irqs.h" 37#include "irqs.h"
49#include <linux/platform_data/crypto-ux500.h>
50 38
51#include "ste-dma40-db8500.h" 39#include "ste-dma40-db8500.h"
52#include "db8500-regs.h" 40#include "db8500-regs.h"
@@ -54,401 +42,9 @@
54#include "board-mop500.h" 42#include "board-mop500.h"
55#include "board-mop500-regulators.h" 43#include "board-mop500-regulators.h"
56 44
57static struct gpio_led snowball_led_array[] = {
58 {
59 .name = "user_led",
60 .default_trigger = "heartbeat",
61 .gpio = 142,
62 },
63};
64
65static struct gpio_led_platform_data snowball_led_data = {
66 .leds = snowball_led_array,
67 .num_leds = ARRAY_SIZE(snowball_led_array),
68};
69
70static struct platform_device snowball_led_dev = {
71 .name = "leds-gpio",
72 .dev = {
73 .platform_data = &snowball_led_data,
74 },
75};
76
77static struct fixed_voltage_config snowball_gpio_en_3v3_data = {
78 .supply_name = "EN-3V3",
79 .gpio = SNOWBALL_EN_3V3_ETH_GPIO,
80 .microvolts = 3300000,
81 .enable_high = 1,
82 .init_data = &gpio_en_3v3_regulator,
83 .startup_delay = 5000, /* 1200us */
84};
85
86static struct platform_device snowball_gpio_en_3v3_regulator_dev = {
87 .name = "reg-fixed-voltage",
88 .id = 1,
89 .dev = {
90 .platform_data = &snowball_gpio_en_3v3_data,
91 },
92};
93
94/* Dynamically populated. */
95static struct gpio sdi0_reg_gpios[] = {
96 { 0, GPIOF_OUT_INIT_LOW, "mmci_vsel" },
97};
98
99static struct gpio_regulator_state sdi0_reg_states[] = {
100 { .value = 2900000, .gpios = (0 << 0) },
101 { .value = 1800000, .gpios = (1 << 0) },
102};
103
104static struct gpio_regulator_config sdi0_reg_info = {
105 .supply_name = "ext-mmc-level-shifter",
106 .gpios = sdi0_reg_gpios,
107 .nr_gpios = ARRAY_SIZE(sdi0_reg_gpios),
108 .states = sdi0_reg_states,
109 .nr_states = ARRAY_SIZE(sdi0_reg_states),
110 .type = REGULATOR_VOLTAGE,
111 .enable_high = 1,
112 .enabled_at_boot = 0,
113 .init_data = &sdi0_reg_init_data,
114 .startup_delay = 100,
115};
116
117static struct platform_device sdi0_regulator = {
118 .name = "gpio-regulator",
119 .id = -1,
120 .dev = {
121 .platform_data = &sdi0_reg_info,
122 },
123};
124
125static struct abx500_gpio_platform_data ab8500_gpio_pdata = {
126 .gpio_base = MOP500_AB8500_PIN_GPIO(1),
127};
128
129/* ab8500-codec */
130static struct ab8500_codec_platform_data ab8500_codec_pdata = {
131 .amics = {
132 .mic1_type = AMIC_TYPE_DIFFERENTIAL,
133 .mic2_type = AMIC_TYPE_DIFFERENTIAL,
134 .mic1a_micbias = AMIC_MICBIAS_VAMIC1,
135 .mic1b_micbias = AMIC_MICBIAS_VAMIC1,
136 .mic2_micbias = AMIC_MICBIAS_VAMIC2
137 },
138 .ear_cmv = EAR_CMV_0_95V
139};
140
141static struct gpio_keys_button snowball_key_array[] = {
142 {
143 .gpio = 32,
144 .type = EV_KEY,
145 .code = KEY_1,
146 .desc = "userpb",
147 .active_low = 1,
148 .debounce_interval = 50,
149 .wakeup = 1,
150 },
151 {
152 .gpio = 151,
153 .type = EV_KEY,
154 .code = KEY_2,
155 .desc = "extkb1",
156 .active_low = 1,
157 .debounce_interval = 50,
158 .wakeup = 1,
159 },
160 {
161 .gpio = 152,
162 .type = EV_KEY,
163 .code = KEY_3,
164 .desc = "extkb2",
165 .active_low = 1,
166 .debounce_interval = 50,
167 .wakeup = 1,
168 },
169 {
170 .gpio = 161,
171 .type = EV_KEY,
172 .code = KEY_4,
173 .desc = "extkb3",
174 .active_low = 1,
175 .debounce_interval = 50,
176 .wakeup = 1,
177 },
178 {
179 .gpio = 162,
180 .type = EV_KEY,
181 .code = KEY_5,
182 .desc = "extkb4",
183 .active_low = 1,
184 .debounce_interval = 50,
185 .wakeup = 1,
186 },
187};
188
189static struct gpio_keys_platform_data snowball_key_data = {
190 .buttons = snowball_key_array,
191 .nbuttons = ARRAY_SIZE(snowball_key_array),
192};
193
194static struct platform_device snowball_key_dev = {
195 .name = "gpio-keys",
196 .id = -1,
197 .dev = {
198 .platform_data = &snowball_key_data,
199 }
200};
201
202static struct smsc911x_platform_config snowball_sbnet_cfg = {
203 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
204 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
205 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
206 .shift = 1,
207};
208
209static struct resource sbnet_res[] = {
210 {
211 .name = "smsc911x-memory",
212 .start = (0x5000 << 16),
213 .end = (0x5000 << 16) + 0xffff,
214 .flags = IORESOURCE_MEM,
215 },
216 {
217 .start = NOMADIK_GPIO_TO_IRQ(140),
218 .end = NOMADIK_GPIO_TO_IRQ(140),
219 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
220 },
221};
222
223static struct platform_device snowball_sbnet_dev = {
224 .name = "smsc911x",
225 .num_resources = ARRAY_SIZE(sbnet_res),
226 .resource = sbnet_res,
227 .dev = {
228 .platform_data = &snowball_sbnet_cfg,
229 },
230};
231
232struct ab8500_platform_data ab8500_platdata = { 45struct ab8500_platform_data ab8500_platdata = {
233 .irq_base = MOP500_AB8500_IRQ_BASE, 46 .irq_base = MOP500_AB8500_IRQ_BASE,
234 .regulator = &ab8500_regulator_plat_data, 47 .regulator = &ab8500_regulator_plat_data,
235 .gpio = &ab8500_gpio_pdata,
236 .codec = &ab8500_codec_pdata,
237};
238
239static struct platform_device u8500_cpufreq_cooling_device = {
240 .name = "db8500-cpufreq-cooling",
241};
242
243/*
244 * TPS61052
245 */
246
247static struct tps6105x_platform_data mop500_tps61052_data = {
248 .mode = TPS6105X_MODE_VOLTAGE,
249 .regulator_data = &tps61052_regulator,
250};
251
252/*
253 * TC35892
254 */
255
256static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
257{
258 struct device *parent = NULL;
259#if 0
260 /* FIXME: Is the sdi actually part of tc3589x? */
261 parent = tc3589x->dev;
262#endif
263 mop500_sdi_tc35892_init(parent);
264}
265
266static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
267 .gpio_base = MOP500_EGPIO(0),
268 .setup = mop500_tc35892_init,
269};
270
271static struct tc3589x_platform_data mop500_tc35892_data = {
272 .block = TC3589x_BLOCK_GPIO,
273 .gpio = &mop500_tc35892_gpio_data,
274 .irq_base = MOP500_EGPIO_IRQ_BASE,
275};
276
277static struct lp55xx_led_config lp5521_pri_led[] = {
278 [0] = {
279 .chan_nr = 0,
280 .led_current = 0x2f,
281 .max_current = 0x5f,
282 },
283 [1] = {
284 .chan_nr = 1,
285 .led_current = 0x2f,
286 .max_current = 0x5f,
287 },
288 [2] = {
289 .chan_nr = 2,
290 .led_current = 0x2f,
291 .max_current = 0x5f,
292 },
293};
294
295static struct lp55xx_platform_data __initdata lp5521_pri_data = {
296 .label = "lp5521_pri",
297 .led_config = &lp5521_pri_led[0],
298 .num_channels = 3,
299 .clock_mode = LP55XX_CLOCK_EXT,
300};
301
302static struct lp55xx_led_config lp5521_sec_led[] = {
303 [0] = {
304 .chan_nr = 0,
305 .led_current = 0x2f,
306 .max_current = 0x5f,
307 },
308 [1] = {
309 .chan_nr = 1,
310 .led_current = 0x2f,
311 .max_current = 0x5f,
312 },
313 [2] = {
314 .chan_nr = 2,
315 .led_current = 0x2f,
316 .max_current = 0x5f,
317 },
318};
319
320static struct lp55xx_platform_data __initdata lp5521_sec_data = {
321 .label = "lp5521_sec",
322 .led_config = &lp5521_sec_led[0],
323 .num_channels = 3,
324 .clock_mode = LP55XX_CLOCK_EXT,
325};
326
327/* I2C0 devices only available on the first HREF/MOP500 */
328static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
329 {
330 I2C_BOARD_INFO("tc3589x", 0x42),
331 .irq = NOMADIK_GPIO_TO_IRQ(217),
332 .platform_data = &mop500_tc35892_data,
333 },
334 {
335 I2C_BOARD_INFO("tps61052", 0x33),
336 .platform_data = &mop500_tps61052_data,
337 },
338};
339
340static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
341 {
342 /* lp5521 LED driver, 1st device */
343 I2C_BOARD_INFO("lp5521", 0x33),
344 .platform_data = &lp5521_pri_data,
345 },
346 {
347 /* lp5521 LED driver, 2st device */
348 I2C_BOARD_INFO("lp5521", 0x34),
349 .platform_data = &lp5521_sec_data,
350 },
351 {
352 /* Light sensor Rohm BH1780GLI */
353 I2C_BOARD_INFO("bh1780", 0x29),
354 },
355};
356
357static int __init mop500_i2c_board_init(void)
358{
359 if (machine_is_u8500())
360 mop500_uib_i2c_add(0, mop500_i2c0_devices,
361 ARRAY_SIZE(mop500_i2c0_devices));
362 mop500_uib_i2c_add(2, mop500_i2c2_devices,
363 ARRAY_SIZE(mop500_i2c2_devices));
364 return 0;
365}
366device_initcall(mop500_i2c_board_init);
367
368static void __init mop500_i2c_init(struct device *parent)
369{
370 db8500_add_i2c0(parent, NULL);
371 db8500_add_i2c1(parent, NULL);
372 db8500_add_i2c2(parent, NULL);
373 db8500_add_i2c3(parent, NULL);
374}
375
376static struct gpio_keys_button mop500_gpio_keys[] = {
377 {
378 .desc = "SFH7741 Proximity Sensor",
379 .type = EV_SW,
380 .code = SW_FRONT_PROXIMITY,
381 .active_low = 0,
382 .can_disable = 1,
383 }
384};
385
386static struct regulator *prox_regulator;
387static int mop500_prox_activate(struct device *dev);
388static void mop500_prox_deactivate(struct device *dev);
389
390static struct gpio_keys_platform_data mop500_gpio_keys_data = {
391 .buttons = mop500_gpio_keys,
392 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
393 .enable = mop500_prox_activate,
394 .disable = mop500_prox_deactivate,
395};
396
397static struct platform_device mop500_gpio_keys_device = {
398 .name = "gpio-keys",
399 .id = 0,
400 .dev = {
401 .platform_data = &mop500_gpio_keys_data,
402 },
403};
404
405static int mop500_prox_activate(struct device *dev)
406{
407 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
408 "vcc");
409 if (IS_ERR(prox_regulator)) {
410 dev_err(&mop500_gpio_keys_device.dev,
411 "no regulator\n");
412 return PTR_ERR(prox_regulator);
413 }
414
415 return regulator_enable(prox_regulator);
416}
417
418static void mop500_prox_deactivate(struct device *dev)
419{
420 regulator_disable(prox_regulator);
421 regulator_put(prox_regulator);
422}
423
424static struct cryp_platform_data u8500_cryp1_platform_data = {
425 .mem_to_engine = {
426 .dir = DMA_MEM_TO_DEV,
427 .dev_type = DB8500_DMA_DEV48_CAC1,
428 .mode = STEDMA40_MODE_LOGICAL,
429 },
430 .engine_to_mem = {
431 .dir = DMA_DEV_TO_MEM,
432 .dev_type = DB8500_DMA_DEV48_CAC1,
433 .mode = STEDMA40_MODE_LOGICAL,
434 }
435};
436
437static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
438 .dir = DMA_MEM_TO_DEV,
439 .dev_type = DB8500_DMA_DEV50_HAC1_TX,
440 .mode = STEDMA40_MODE_LOGICAL,
441};
442
443static struct hash_platform_data u8500_hash1_platform_data = {
444 .mem_to_engine = &u8500_hash_dma_cfg_tx,
445 .dma_filter = stedma40_filter,
446};
447
448/* add any platform devices here - TODO */
449static struct platform_device *mop500_platform_devs[] __initdata = {
450 &mop500_gpio_keys_device,
451 &sdi0_regulator,
452}; 48};
453 49
454#ifdef CONFIG_STE_DMA40 50#ifdef CONFIG_STE_DMA40
@@ -480,236 +76,3 @@ struct pl022_ssp_controller ssp0_plat = {
480 */ 76 */
481 .num_chipselect = 5, 77 .num_chipselect = 5,
482}; 78};
483
484static void __init mop500_spi_init(struct device *parent)
485{
486 db8500_add_ssp0(parent, &ssp0_plat);
487}
488
489#ifdef CONFIG_STE_DMA40
490static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
491 .mode = STEDMA40_MODE_LOGICAL,
492 .dir = DMA_DEV_TO_MEM,
493 .dev_type = DB8500_DMA_DEV13_UART0,
494};
495
496static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
497 .mode = STEDMA40_MODE_LOGICAL,
498 .dir = DMA_MEM_TO_DEV,
499 .dev_type = DB8500_DMA_DEV13_UART0,
500};
501
502static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
503 .mode = STEDMA40_MODE_LOGICAL,
504 .dir = DMA_DEV_TO_MEM,
505 .dev_type = DB8500_DMA_DEV12_UART1,
506};
507
508static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
509 .mode = STEDMA40_MODE_LOGICAL,
510 .dir = DMA_MEM_TO_DEV,
511 .dev_type = DB8500_DMA_DEV12_UART1,
512};
513
514static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
515 .mode = STEDMA40_MODE_LOGICAL,
516 .dir = DMA_DEV_TO_MEM,
517 .dev_type = DB8500_DMA_DEV11_UART2,
518};
519
520static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
521 .mode = STEDMA40_MODE_LOGICAL,
522 .dir = DMA_MEM_TO_DEV,
523 .dev_type = DB8500_DMA_DEV11_UART2,
524};
525#endif
526
527struct amba_pl011_data uart0_plat = {
528#ifdef CONFIG_STE_DMA40
529 .dma_filter = stedma40_filter,
530 .dma_rx_param = &uart0_dma_cfg_rx,
531 .dma_tx_param = &uart0_dma_cfg_tx,
532#endif
533};
534
535struct amba_pl011_data uart1_plat = {
536#ifdef CONFIG_STE_DMA40
537 .dma_filter = stedma40_filter,
538 .dma_rx_param = &uart1_dma_cfg_rx,
539 .dma_tx_param = &uart1_dma_cfg_tx,
540#endif
541};
542
543struct amba_pl011_data uart2_plat = {
544#ifdef CONFIG_STE_DMA40
545 .dma_filter = stedma40_filter,
546 .dma_rx_param = &uart2_dma_cfg_rx,
547 .dma_tx_param = &uart2_dma_cfg_tx,
548#endif
549};
550
551static void __init mop500_uart_init(struct device *parent)
552{
553 db8500_add_uart0(parent, &uart0_plat);
554 db8500_add_uart1(parent, &uart1_plat);
555 db8500_add_uart2(parent, &uart2_plat);
556}
557
558static void __init u8500_cryp1_hash1_init(struct device *parent)
559{
560 db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
561 db8500_add_hash1(parent, &u8500_hash1_platform_data);
562}
563
564static struct platform_device *snowball_platform_devs[] __initdata = {
565 &snowball_led_dev,
566 &snowball_key_dev,
567 &snowball_sbnet_dev,
568 &snowball_gpio_en_3v3_regulator_dev,
569 &u8500_cpufreq_cooling_device,
570 &sdi0_regulator,
571};
572
573static void __init mop500_init_machine(void)
574{
575 struct device *parent = NULL;
576 int i;
577
578 platform_device_register(&db8500_prcmu_device);
579 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
580
581 sdi0_reg_info.enable_gpio = GPIO_SDMMC_EN;
582 sdi0_reg_info.gpios[0].gpio = GPIO_SDMMC_1V8_3V_SEL;
583
584 mop500_pinmaps_init();
585 parent = u8500_init_devices();
586
587 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
588 mop500_platform_devs[i]->dev.parent = parent;
589
590 platform_add_devices(mop500_platform_devs,
591 ARRAY_SIZE(mop500_platform_devs));
592
593 mop500_i2c_init(parent);
594 mop500_sdi_init(parent);
595 mop500_spi_init(parent);
596 mop500_audio_init(parent);
597 mop500_uart_init(parent);
598 u8500_cryp1_hash1_init(parent);
599
600 /* This board has full regulator constraints */
601 regulator_has_full_constraints();
602}
603
604
605static void __init snowball_init_machine(void)
606{
607 struct device *parent = NULL;
608 int i;
609
610 platform_device_register(&db8500_prcmu_device);
611
612 sdi0_reg_info.enable_gpio = SNOWBALL_SDMMC_EN_GPIO;
613 sdi0_reg_info.gpios[0].gpio = SNOWBALL_SDMMC_1V8_3V_GPIO;
614
615 snowball_pinmaps_init();
616 parent = u8500_init_devices();
617
618 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
619 snowball_platform_devs[i]->dev.parent = parent;
620
621 platform_add_devices(snowball_platform_devs,
622 ARRAY_SIZE(snowball_platform_devs));
623
624 mop500_i2c_init(parent);
625 snowball_sdi_init(parent);
626 mop500_spi_init(parent);
627 mop500_audio_init(parent);
628 mop500_uart_init(parent);
629
630 u8500_cryp1_hash1_init(parent);
631
632 /* This board has full regulator constraints */
633 regulator_has_full_constraints();
634}
635
636static void __init hrefv60_init_machine(void)
637{
638 struct device *parent = NULL;
639 int i;
640
641 platform_device_register(&db8500_prcmu_device);
642 /*
643 * The HREFv60 board removed a GPIO expander and routed
644 * all these GPIO pins to the internal GPIO controller
645 * instead.
646 */
647 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
648
649 sdi0_reg_info.enable_gpio = HREFV60_SDMMC_EN_GPIO;
650 sdi0_reg_info.gpios[0].gpio = HREFV60_SDMMC_1V8_3V_GPIO;
651
652 hrefv60_pinmaps_init();
653 parent = u8500_init_devices();
654
655 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
656 mop500_platform_devs[i]->dev.parent = parent;
657
658 platform_add_devices(mop500_platform_devs,
659 ARRAY_SIZE(mop500_platform_devs));
660
661 mop500_i2c_init(parent);
662 hrefv60_sdi_init(parent);
663 mop500_spi_init(parent);
664 mop500_audio_init(parent);
665 mop500_uart_init(parent);
666
667 /* This board has full regulator constraints */
668 regulator_has_full_constraints();
669}
670
671MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
672 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
673 .atag_offset = 0x100,
674 .smp = smp_ops(ux500_smp_ops),
675 .map_io = u8500_map_io,
676 .init_irq = ux500_init_irq,
677 /* we re-use nomadik timer here */
678 .init_time = ux500_timer_init,
679 .init_machine = mop500_init_machine,
680 .init_late = ux500_init_late,
681 .restart = ux500_restart,
682MACHINE_END
683
684MACHINE_START(U8520, "ST-Ericsson U8520 Platform HREFP520")
685 .atag_offset = 0x100,
686 .map_io = u8500_map_io,
687 .init_irq = ux500_init_irq,
688 .init_time = ux500_timer_init,
689 .init_machine = mop500_init_machine,
690 .init_late = ux500_init_late,
691 .restart = ux500_restart,
692MACHINE_END
693
694MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
695 .atag_offset = 0x100,
696 .smp = smp_ops(ux500_smp_ops),
697 .map_io = u8500_map_io,
698 .init_irq = ux500_init_irq,
699 .init_time = ux500_timer_init,
700 .init_machine = hrefv60_init_machine,
701 .init_late = ux500_init_late,
702 .restart = ux500_restart,
703MACHINE_END
704
705MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
706 .atag_offset = 0x100,
707 .smp = smp_ops(ux500_smp_ops),
708 .map_io = u8500_map_io,
709 .init_irq = ux500_init_irq,
710 /* we re-use nomadik timer here */
711 .init_time = ux500_timer_init,
712 .init_machine = snowball_init_machine,
713 .init_late = NULL,
714 .restart = ux500_restart,
715MACHINE_END
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index d6fab166cbf1..511d6febbe99 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -79,7 +79,6 @@
79#define SNOWBALL_EN_3V3_ETH_GPIO MOP500_AB8500_PIN_GPIO(26) /* GPIO26 */ 79#define SNOWBALL_EN_3V3_ETH_GPIO MOP500_AB8500_PIN_GPIO(26) /* GPIO26 */
80 80
81struct device; 81struct device;
82struct i2c_board_info;
83extern struct mmci_platform_data mop500_sdi0_data; 82extern struct mmci_platform_data mop500_sdi0_data;
84extern struct mmci_platform_data mop500_sdi1_data; 83extern struct mmci_platform_data mop500_sdi1_data;
85extern struct mmci_platform_data mop500_sdi2_data; 84extern struct mmci_platform_data mop500_sdi2_data;
@@ -88,25 +87,10 @@ extern struct msp_i2s_platform_data msp0_platform_data;
88extern struct msp_i2s_platform_data msp1_platform_data; 87extern struct msp_i2s_platform_data msp1_platform_data;
89extern struct msp_i2s_platform_data msp2_platform_data; 88extern struct msp_i2s_platform_data msp2_platform_data;
90extern struct msp_i2s_platform_data msp3_platform_data; 89extern struct msp_i2s_platform_data msp3_platform_data;
91extern struct arm_pmu_platdata db8500_pmu_platdata;
92extern struct amba_pl011_data uart0_plat;
93extern struct amba_pl011_data uart1_plat;
94extern struct amba_pl011_data uart2_plat;
95extern struct pl022_ssp_controller ssp0_plat; 90extern struct pl022_ssp_controller ssp0_plat;
96extern struct stedma40_platform_data dma40_plat_data;
97 91
98extern void mop500_sdi_init(struct device *parent);
99extern void snowball_sdi_init(struct device *parent);
100extern void hrefv60_sdi_init(struct device *parent);
101extern void mop500_sdi_tc35892_init(struct device *parent);
102void __init mop500_u8500uib_init(void);
103void __init mop500_stuib_init(void);
104void __init mop500_pinmaps_init(void); 92void __init mop500_pinmaps_init(void);
105void __init snowball_pinmaps_init(void); 93void __init snowball_pinmaps_init(void);
106void __init hrefv60_pinmaps_init(void); 94void __init hrefv60_pinmaps_init(void);
107void mop500_audio_init(struct device *parent);
108 95
109int __init mop500_uib_init(void);
110void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info,
111 unsigned n);
112#endif 96#endif
diff --git a/arch/arm/mach-ux500/cache-l2x0.c b/arch/arm/mach-ux500/cache-l2x0.c
index 82ccf1d98735..264f894c0e3d 100644
--- a/arch/arm/mach-ux500/cache-l2x0.c
+++ b/arch/arm/mach-ux500/cache-l2x0.c
@@ -69,6 +69,7 @@ static int __init ux500_l2x0_init(void)
69 * some SMI service available. 69 * some SMI service available.
70 */ 70 */
71 outer_cache.disable = NULL; 71 outer_cache.disable = NULL;
72 outer_cache.set_debug = NULL;
72 73
73 return 0; 74 return 0;
74} 75}
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 301c3460d96a..2e85c1e72535 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -32,7 +32,6 @@
32#include "irqs.h" 32#include "irqs.h"
33 33
34#include "devices-db8500.h" 34#include "devices-db8500.h"
35#include "ste-dma40-db8500.h"
36#include "db8500-regs.h" 35#include "db8500-regs.h"
37#include "board-mop500.h" 36#include "board-mop500.h"
38#include "id.h" 37#include "id.h"
@@ -93,14 +92,6 @@ void __init u8500_map_io(void)
93 iotable_init(u8500_io_desc, ARRAY_SIZE(u8500_io_desc)); 92 iotable_init(u8500_io_desc, ARRAY_SIZE(u8500_io_desc));
94} 93}
95 94
96static struct resource db8500_pmu_resources[] = {
97 [0] = {
98 .start = IRQ_DB8500_PMU,
99 .end = IRQ_DB8500_PMU,
100 .flags = IORESOURCE_IRQ,
101 },
102};
103
104/* 95/*
105 * The PMU IRQ lines of two cores are wired together into a single interrupt. 96 * The PMU IRQ lines of two cores are wired together into a single interrupt.
106 * Bounce the interrupt to the other core if it's not ours. 97 * Bounce the interrupt to the other core if it's not ours.
@@ -125,54 +116,6 @@ struct arm_pmu_platdata db8500_pmu_platdata = {
125 .handle_irq = db8500_pmu_handler, 116 .handle_irq = db8500_pmu_handler,
126}; 117};
127 118
128static struct platform_device db8500_pmu_device = {
129 .name = "arm-pmu",
130 .id = -1,
131 .num_resources = ARRAY_SIZE(db8500_pmu_resources),
132 .resource = db8500_pmu_resources,
133 .dev.platform_data = &db8500_pmu_platdata,
134};
135
136static struct platform_device *platform_devs[] __initdata = {
137 &u8500_dma40_device,
138 &db8500_pmu_device,
139};
140
141static resource_size_t __initdata db8500_gpio_base[] = {
142 U8500_GPIOBANK0_BASE,
143 U8500_GPIOBANK1_BASE,
144 U8500_GPIOBANK2_BASE,
145 U8500_GPIOBANK3_BASE,
146 U8500_GPIOBANK4_BASE,
147 U8500_GPIOBANK5_BASE,
148 U8500_GPIOBANK6_BASE,
149 U8500_GPIOBANK7_BASE,
150 U8500_GPIOBANK8_BASE,
151};
152
153static void __init db8500_add_gpios(struct device *parent)
154{
155 struct nmk_gpio_platform_data pdata = {
156 .supports_sleepmode = true,
157 };
158
159 dbx500_add_gpios(parent, db8500_gpio_base,
160 ARRAY_SIZE(db8500_gpio_base),
161 IRQ_DB8500_GPIO0, &pdata);
162 dbx500_add_pinctrl(parent, "pinctrl-db8500", U8500_PRCMU_BASE);
163}
164
165static int usb_db8500_dma_cfg[] = {
166 DB8500_DMA_DEV38_USB_OTG_IEP_AND_OEP_1_9,
167 DB8500_DMA_DEV37_USB_OTG_IEP_AND_OEP_2_10,
168 DB8500_DMA_DEV36_USB_OTG_IEP_AND_OEP_3_11,
169 DB8500_DMA_DEV19_USB_OTG_IEP_AND_OEP_4_12,
170 DB8500_DMA_DEV18_USB_OTG_IEP_AND_OEP_5_13,
171 DB8500_DMA_DEV17_USB_OTG_IEP_AND_OEP_6_14,
172 DB8500_DMA_DEV16_USB_OTG_IEP_AND_OEP_7_15,
173 DB8500_DMA_DEV39_USB_OTG_IEP_AND_OEP_8
174};
175
176static const char *db8500_read_soc_id(void) 119static const char *db8500_read_soc_id(void)
177{ 120{
178 void __iomem *uid = __io_address(U8500_BB_UID_BASE); 121 void __iomem *uid = __io_address(U8500_BB_UID_BASE);
@@ -192,60 +135,22 @@ static struct device * __init db8500_soc_device_init(void)
192 return ux500_soc_device_init(soc_id); 135 return ux500_soc_device_init(soc_id);
193} 136}
194 137
195/*
196 * This function is called from the board init
197 */
198struct device * __init u8500_init_devices(void)
199{
200 struct device *parent;
201 int i;
202
203 parent = db8500_soc_device_init();
204
205 db8500_add_rtc(parent);
206 db8500_add_gpios(parent);
207 db8500_add_usb(parent, usb_db8500_dma_cfg, usb_db8500_dma_cfg);
208
209 for (i = 0; i < ARRAY_SIZE(platform_devs); i++)
210 platform_devs[i]->dev.parent = parent;
211
212 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));
213
214 return parent;
215}
216
217#ifdef CONFIG_MACH_UX500_DT 138#ifdef CONFIG_MACH_UX500_DT
218static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { 139static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
219 /* Requires call-back bindings. */ 140 /* Requires call-back bindings. */
220 OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata), 141 OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata),
221 /* Requires DMA bindings. */ 142 /* Requires DMA bindings. */
222 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", NULL), 143 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000,
223 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", NULL), 144 "ux500-msp-i2s.0", &msp0_platform_data),
224 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", NULL), 145 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000,
225 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat), 146 "ux500-msp-i2s.1", &msp1_platform_data),
226 OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", NULL), 147 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80117000,
227 OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", NULL), 148 "ux500-msp-i2s.2", &msp2_platform_data),
228 OF_DEV_AUXDATA("arm,pl18x", 0x80005000, "sdi2", NULL), 149 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80125000,
229 OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", NULL), 150 "ux500-msp-i2s.3", &msp3_platform_data),
230 /* Requires clock name bindings. */ 151 /* Requires non-DT:able platform data. */
231 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
232 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
233 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL),
234 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL),
235 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL),
236 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL),
237 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
238 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
239 OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
240 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80004000, "nmk-i2c.0", NULL),
241 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80122000, "nmk-i2c.1", NULL),
242 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL),
243 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", 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),
246 OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu", 152 OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu",
247 &db8500_prcmu_pdata), 153 &db8500_prcmu_pdata),
248 OF_DEV_AUXDATA("smsc,lan9115", 0x50000000, "smsc911x.0", NULL),
249 OF_DEV_AUXDATA("stericsson,ux500-cryp", 0xa03cb000, "cryp1", NULL), 154 OF_DEV_AUXDATA("stericsson,ux500-cryp", 0xa03cb000, "cryp1", NULL),
250 OF_DEV_AUXDATA("stericsson,ux500-hash", 0xa03c2000, "hash1", NULL), 155 OF_DEV_AUXDATA("stericsson,ux500-hash", 0xa03c2000, "hash1", NULL),
251 OF_DEV_AUXDATA("stericsson,snd-soc-mop500", 0, "snd-soc-mop500.0", 156 OF_DEV_AUXDATA("stericsson,snd-soc-mop500", 0, "snd-soc-mop500.0",
@@ -253,17 +158,6 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
253 /* Requires device name bindings. */ 158 /* Requires device name bindings. */
254 OF_DEV_AUXDATA("stericsson,db8500-pinctrl", U8500_PRCMU_BASE, 159 OF_DEV_AUXDATA("stericsson,db8500-pinctrl", U8500_PRCMU_BASE,
255 "pinctrl-db8500", NULL), 160 "pinctrl-db8500", NULL),
256 /* Requires clock name and DMA bindings. */
257 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000,
258 "ux500-msp-i2s.0", &msp0_platform_data),
259 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000,
260 "ux500-msp-i2s.1", &msp1_platform_data),
261 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80117000,
262 "ux500-msp-i2s.2", &msp2_platform_data),
263 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80125000,
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 {}, 161 {},
268}; 162};
269 163
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index 5d7eebcabc63..f84d4397896b 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -78,9 +78,17 @@ void __init ux500_init_irq(void)
78 if (cpu_is_u8500_family()) { 78 if (cpu_is_u8500_family()) {
79 prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1); 79 prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1);
80 ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1); 80 ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1);
81 u8500_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE, 81
82 U8500_CLKRST3_BASE, U8500_CLKRST5_BASE, 82 if (of_have_populated_dt())
83 U8500_CLKRST6_BASE); 83 u8500_of_clk_init(U8500_CLKRST1_BASE,
84 U8500_CLKRST2_BASE,
85 U8500_CLKRST3_BASE,
86 U8500_CLKRST5_BASE,
87 U8500_CLKRST6_BASE);
88 else
89 u8500_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE,
90 U8500_CLKRST3_BASE, U8500_CLKRST5_BASE,
91 U8500_CLKRST6_BASE);
84 } else if (cpu_is_u9540()) { 92 } else if (cpu_is_u9540()) {
85 prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1); 93 prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1);
86 ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1); 94 ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1);
@@ -96,11 +104,6 @@ void __init ux500_init_irq(void)
96 } 104 }
97} 105}
98 106
99void __init ux500_init_late(void)
100{
101 mop500_uib_init();
102}
103
104static const char * __init ux500_get_machine(void) 107static const char * __init ux500_get_machine(void)
105{ 108{
106 return kasprintf(GFP_KERNEL, "DB%4x", dbx500_partnumber()); 109 return kasprintf(GFP_KERNEL, "DB%4x", dbx500_partnumber());
diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c
deleted file mode 100644
index f71b3d7bd4fb..000000000000
--- a/arch/arm/mach-ux500/devices-common.c
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL), version 2.
6 */
7
8#include <linux/kernel.h>
9#include <linux/dma-mapping.h>
10#include <linux/err.h>
11#include <linux/irq.h>
12#include <linux/slab.h>
13#include <linux/platform_device.h>
14#include <linux/platform_data/pinctrl-nomadik.h>
15
16#include "irqs.h"
17
18#include "devices-common.h"
19
20static struct platform_device *
21dbx500_add_gpio(struct device *parent, int id, resource_size_t addr, int irq,
22 struct nmk_gpio_platform_data *pdata)
23{
24 struct resource resources[] = {
25 {
26 .start = addr,
27 .end = addr + 127,
28 .flags = IORESOURCE_MEM,
29 },
30 {
31 .start = irq,
32 .end = irq,
33 .flags = IORESOURCE_IRQ,
34 }
35 };
36
37 return platform_device_register_resndata(
38 parent,
39 "gpio",
40 id,
41 resources,
42 ARRAY_SIZE(resources),
43 pdata,
44 sizeof(*pdata));
45}
46
47void dbx500_add_gpios(struct device *parent, resource_size_t *base, int num,
48 int irq, struct nmk_gpio_platform_data *pdata)
49{
50 int first = 0;
51 int i;
52
53 for (i = 0; i < num; i++, first += 32, irq++) {
54 pdata->first_gpio = first;
55 pdata->first_irq = NOMADIK_GPIO_TO_IRQ(first);
56 pdata->num_gpio = 32;
57
58 dbx500_add_gpio(parent, i, base[i], irq, pdata);
59 }
60}
diff --git a/arch/arm/mach-ux500/devices-common.h b/arch/arm/mach-ux500/devices-common.h
deleted file mode 100644
index 96fa4ac89e2e..000000000000
--- a/arch/arm/mach-ux500/devices-common.h
+++ /dev/null
@@ -1,149 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL), version 2.
6 */
7
8#ifndef __DEVICES_COMMON_H
9#define __DEVICES_COMMON_H
10
11#include <linux/platform_device.h>
12#include <linux/dma-mapping.h>
13#include <linux/sys_soc.h>
14#include <linux/amba/bus.h>
15#include <linux/platform_data/i2c-nomadik.h>
16#include <linux/platform_data/crypto-ux500.h>
17
18struct spi_master_cntlr;
19
20static inline struct amba_device *
21dbx500_add_msp_spi(struct device *parent, const char *name,
22 resource_size_t base, int irq,
23 struct spi_master_cntlr *pdata)
24{
25 return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0,
26 pdata, 0);
27}
28
29static inline struct amba_device *
30dbx500_add_spi(struct device *parent, const char *name, resource_size_t base,
31 int irq, struct spi_master_cntlr *pdata,
32 u32 periphid)
33{
34 return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0,
35 pdata, periphid);
36}
37
38struct mmci_platform_data;
39
40static inline struct amba_device *
41dbx500_add_sdi(struct device *parent, const char *name, resource_size_t base,
42 int irq, struct mmci_platform_data *pdata, u32 periphid)
43{
44 return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0,
45 pdata, periphid);
46}
47
48struct amba_pl011_data;
49
50static inline struct amba_device *
51dbx500_add_uart(struct device *parent, const char *name, resource_size_t base,
52 int irq, struct amba_pl011_data *pdata)
53{
54 return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, pdata, 0);
55}
56
57struct nmk_i2c_controller;
58
59static inline struct amba_device *
60dbx500_add_i2c(struct device *parent, int id, resource_size_t base, int irq,
61 struct nmk_i2c_controller *data)
62{
63 /* Conjure a name similar to what the platform device used to have */
64 char name[16];
65
66 snprintf(name, sizeof(name), "nmk-i2c.%d", id);
67 return amba_apb_device_add(parent, name, base, SZ_4K, irq, 0, data, 0);
68}
69
70static inline struct amba_device *
71dbx500_add_rtc(struct device *parent, resource_size_t base, int irq)
72{
73 return amba_apb_device_add(parent, "rtc-pl031", base, SZ_4K, irq,
74 0, NULL, 0);
75}
76
77struct cryp_platform_data;
78
79static inline struct platform_device *
80dbx500_add_cryp1(struct device *parent, int id, resource_size_t base, int irq,
81 struct cryp_platform_data *pdata)
82{
83 struct resource res[] = {
84 DEFINE_RES_MEM(base, SZ_4K),
85 DEFINE_RES_IRQ(irq),
86 };
87
88 struct platform_device_info pdevinfo = {
89 .parent = parent,
90 .name = "cryp1",
91 .id = id,
92 .res = res,
93 .num_res = ARRAY_SIZE(res),
94 .data = pdata,
95 .size_data = sizeof(*pdata),
96 .dma_mask = DMA_BIT_MASK(32),
97 };
98
99 return platform_device_register_full(&pdevinfo);
100}
101
102struct hash_platform_data;
103
104static inline struct platform_device *
105dbx500_add_hash1(struct device *parent, int id, resource_size_t base,
106 struct hash_platform_data *pdata)
107{
108 struct resource res[] = {
109 DEFINE_RES_MEM(base, SZ_4K),
110 };
111
112 struct platform_device_info pdevinfo = {
113 .parent = parent,
114 .name = "hash1",
115 .id = id,
116 .res = res,
117 .num_res = ARRAY_SIZE(res),
118 .data = pdata,
119 .size_data = sizeof(*pdata),
120 .dma_mask = DMA_BIT_MASK(32),
121 };
122
123 return platform_device_register_full(&pdevinfo);
124}
125
126struct nmk_gpio_platform_data;
127
128void dbx500_add_gpios(struct device *parent, resource_size_t *base, int num,
129 int irq, struct nmk_gpio_platform_data *pdata);
130
131static inline void
132dbx500_add_pinctrl(struct device *parent, const char *name,
133 resource_size_t base)
134{
135 struct resource res[] = {
136 DEFINE_RES_MEM(base, SZ_8K),
137 };
138 struct platform_device_info pdevinfo = {
139 .parent = parent,
140 .name = name,
141 .id = -1,
142 .res = res,
143 .num_res = ARRAY_SIZE(res),
144 };
145
146 platform_device_register_full(&pdevinfo);
147}
148
149#endif
diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c
index bc316062e0c2..c59f89d058ff 100644
--- a/arch/arm/mach-ux500/devices-db8500.c
+++ b/arch/arm/mach-ux500/devices-db8500.c
@@ -9,10 +9,8 @@
9#include <linux/platform_device.h> 9#include <linux/platform_device.h>
10#include <linux/interrupt.h> 10#include <linux/interrupt.h>
11#include <linux/io.h> 11#include <linux/io.h>
12#include <linux/gpio.h>
13#include <linux/amba/bus.h> 12#include <linux/amba/bus.h>
14#include <linux/amba/pl022.h> 13#include <linux/amba/pl022.h>
15#include <linux/platform_data/dma-ste-dma40.h>
16#include <linux/mfd/dbx500-prcmu.h> 14#include <linux/mfd/dbx500-prcmu.h>
17 15
18#include "setup.h" 16#include "setup.h"
@@ -20,62 +18,6 @@
20 18
21#include "db8500-regs.h" 19#include "db8500-regs.h"
22#include "devices-db8500.h" 20#include "devices-db8500.h"
23#include "ste-dma40-db8500.h"
24
25static struct resource dma40_resources[] = {
26 [0] = {
27 .start = U8500_DMA_BASE,
28 .end = U8500_DMA_BASE + SZ_4K - 1,
29 .flags = IORESOURCE_MEM,
30 .name = "base",
31 },
32 [1] = {
33 .start = U8500_DMA_LCPA_BASE,
34 .end = U8500_DMA_LCPA_BASE + 2 * SZ_1K - 1,
35 .flags = IORESOURCE_MEM,
36 .name = "lcpa",
37 },
38 [2] = {
39 .start = IRQ_DB8500_DMA,
40 .end = IRQ_DB8500_DMA,
41 .flags = IORESOURCE_IRQ,
42 }
43};
44
45struct stedma40_platform_data dma40_plat_data = {
46 .disabled_channels = {-1},
47};
48
49struct platform_device u8500_dma40_device = {
50 .dev = {
51 .platform_data = &dma40_plat_data,
52 .coherent_dma_mask = DMA_BIT_MASK(32),
53 },
54 .name = "dma40",
55 .id = 0,
56 .num_resources = ARRAY_SIZE(dma40_resources),
57 .resource = dma40_resources
58};
59
60struct resource keypad_resources[] = {
61 [0] = {
62 .start = U8500_SKE_BASE,
63 .end = U8500_SKE_BASE + SZ_4K - 1,
64 .flags = IORESOURCE_MEM,
65 },
66 [1] = {
67 .start = IRQ_DB8500_KB,
68 .end = IRQ_DB8500_KB,
69 .flags = IORESOURCE_IRQ,
70 },
71};
72
73struct platform_device u8500_ske_keypad_device = {
74 .name = "nmk-ske-keypad",
75 .id = -1,
76 .num_resources = ARRAY_SIZE(keypad_resources),
77 .resource = keypad_resources,
78};
79 21
80struct prcmu_pdata db8500_prcmu_pdata = { 22struct prcmu_pdata db8500_prcmu_pdata = {
81 .ab_platdata = &ab8500_platdata, 23 .ab_platdata = &ab8500_platdata,
@@ -84,39 +26,3 @@ struct prcmu_pdata db8500_prcmu_pdata = {
84 .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET, 26 .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET,
85 .legacy_offset = DB8500_PRCMU_LEGACY_OFFSET, 27 .legacy_offset = DB8500_PRCMU_LEGACY_OFFSET,
86}; 28};
87
88static struct resource db8500_prcmu_res[] = {
89 {
90 .name = "prcmu",
91 .start = U8500_PRCMU_BASE,
92 .end = U8500_PRCMU_BASE + SZ_8K - 1,
93 .flags = IORESOURCE_MEM,
94 },
95 {
96 .name = "prcmu-tcdm",
97 .start = U8500_PRCMU_TCDM_BASE,
98 .end = U8500_PRCMU_TCDM_BASE + SZ_4K - 1,
99 .flags = IORESOURCE_MEM,
100 },
101 {
102 .name = "irq",
103 .start = IRQ_DB8500_PRCMU1,
104 .end = IRQ_DB8500_PRCMU1,
105 .flags = IORESOURCE_IRQ,
106 },
107 {
108 .name = "prcmu-tcpm",
109 .start = U8500_PRCMU_TCPM_BASE,
110 .end = U8500_PRCMU_TCPM_BASE + SZ_32K - 1,
111 .flags = IORESOURCE_MEM,
112 },
113};
114
115struct platform_device db8500_prcmu_device = {
116 .name = "db8500-prcmu",
117 .resource = db8500_prcmu_res,
118 .num_resources = ARRAY_SIZE(db8500_prcmu_res),
119 .dev = {
120 .platform_data = &db8500_prcmu_pdata,
121 },
122};
diff --git a/arch/arm/mach-ux500/devices-db8500.h b/arch/arm/mach-ux500/devices-db8500.h
index 321998320f98..b8ffc9979bb2 100644
--- a/arch/arm/mach-ux500/devices-db8500.h
+++ b/arch/arm/mach-ux500/devices-db8500.h
@@ -8,122 +8,12 @@
8#ifndef __DEVICES_DB8500_H 8#ifndef __DEVICES_DB8500_H
9#define __DEVICES_DB8500_H 9#define __DEVICES_DB8500_H
10 10
11#include <linux/platform_data/usb-musb-ux500.h>
12#include "irqs.h" 11#include "irqs.h"
13#include "db8500-regs.h" 12#include "db8500-regs.h"
14#include "devices-common.h"
15 13
16struct ske_keypad_platform_data;
17struct pl022_ssp_controller;
18struct platform_device; 14struct platform_device;
19 15
20extern struct ab8500_platform_data ab8500_platdata; 16extern struct ab8500_platform_data ab8500_platdata;
21extern struct prcmu_pdata db8500_prcmu_pdata; 17extern struct prcmu_pdata db8500_prcmu_pdata;
22extern struct platform_device db8500_prcmu_device;
23 18
24static inline struct platform_device *
25db8500_add_ske_keypad(struct device *parent,
26 struct ske_keypad_platform_data *pdata,
27 size_t size)
28{
29 struct resource resources[] = {
30 DEFINE_RES_MEM(U8500_SKE_BASE, SZ_4K),
31 DEFINE_RES_IRQ(IRQ_DB8500_KB),
32 };
33
34 return platform_device_register_resndata(parent, "nmk-ske-keypad", -1,
35 resources, 2, pdata, size);
36}
37
38static inline struct amba_device *
39db8500_add_ssp(struct device *parent, const char *name, resource_size_t base,
40 int irq, struct pl022_ssp_controller *pdata)
41{
42 return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, pdata, 0);
43}
44
45#define db8500_add_i2c0(parent, pdata) \
46 dbx500_add_i2c(parent, 0, U8500_I2C0_BASE, IRQ_DB8500_I2C0, pdata)
47#define db8500_add_i2c1(parent, pdata) \
48 dbx500_add_i2c(parent, 1, U8500_I2C1_BASE, IRQ_DB8500_I2C1, pdata)
49#define db8500_add_i2c2(parent, pdata) \
50 dbx500_add_i2c(parent, 2, U8500_I2C2_BASE, IRQ_DB8500_I2C2, pdata)
51#define db8500_add_i2c3(parent, pdata) \
52 dbx500_add_i2c(parent, 3, U8500_I2C3_BASE, IRQ_DB8500_I2C3, pdata)
53#define db8500_add_i2c4(parent, pdata) \
54 dbx500_add_i2c(parent, 4, U8500_I2C4_BASE, IRQ_DB8500_I2C4, pdata)
55
56#define db8500_add_msp0_spi(parent, pdata) \
57 dbx500_add_msp_spi(parent, "msp0", U8500_MSP0_BASE, \
58 IRQ_DB8500_MSP0, pdata)
59#define db8500_add_msp1_spi(parent, pdata) \
60 dbx500_add_msp_spi(parent, "msp1", U8500_MSP1_BASE, \
61 IRQ_DB8500_MSP1, pdata)
62#define db8500_add_msp2_spi(parent, pdata) \
63 dbx500_add_msp_spi(parent, "msp2", U8500_MSP2_BASE, \
64 IRQ_DB8500_MSP2, pdata)
65#define db8500_add_msp3_spi(parent, pdata) \
66 dbx500_add_msp_spi(parent, "msp3", U8500_MSP3_BASE, \
67 IRQ_DB8500_MSP1, pdata)
68
69#define db8500_add_rtc(parent) \
70 dbx500_add_rtc(parent, U8500_RTC_BASE, IRQ_DB8500_RTC);
71
72#define db8500_add_usb(parent, rx_cfg, tx_cfg) \
73 ux500_add_usb(parent, U8500_USBOTG_BASE, \
74 IRQ_DB8500_USBOTG, rx_cfg, tx_cfg)
75
76#define db8500_add_sdi0(parent, pdata, pid) \
77 dbx500_add_sdi(parent, "sdi0", U8500_SDI0_BASE, \
78 IRQ_DB8500_SDMMC0, pdata, pid)
79#define db8500_add_sdi1(parent, pdata, pid) \
80 dbx500_add_sdi(parent, "sdi1", U8500_SDI1_BASE, \
81 IRQ_DB8500_SDMMC1, pdata, pid)
82#define db8500_add_sdi2(parent, pdata, pid) \
83 dbx500_add_sdi(parent, "sdi2", U8500_SDI2_BASE, \
84 IRQ_DB8500_SDMMC2, pdata, pid)
85#define db8500_add_sdi3(parent, pdata, pid) \
86 dbx500_add_sdi(parent, "sdi3", U8500_SDI3_BASE, \
87 IRQ_DB8500_SDMMC3, pdata, pid)
88#define db8500_add_sdi4(parent, pdata, pid) \
89 dbx500_add_sdi(parent, "sdi4", U8500_SDI4_BASE, \
90 IRQ_DB8500_SDMMC4, pdata, pid)
91#define db8500_add_sdi5(parent, pdata, pid) \
92 dbx500_add_sdi(parent, "sdi5", U8500_SDI5_BASE, \
93 IRQ_DB8500_SDMMC5, pdata, pid)
94
95#define db8500_add_ssp0(parent, pdata) \
96 db8500_add_ssp(parent, "ssp0", U8500_SSP0_BASE, \
97 IRQ_DB8500_SSP0, pdata)
98#define db8500_add_ssp1(parent, pdata) \
99 db8500_add_ssp(parent, "ssp1", U8500_SSP1_BASE, \
100 IRQ_DB8500_SSP1, pdata)
101
102#define db8500_add_spi0(parent, pdata) \
103 dbx500_add_spi(parent, "spi0", U8500_SPI0_BASE, \
104 IRQ_DB8500_SPI0, pdata, 0)
105#define db8500_add_spi1(parent, pdata) \
106 dbx500_add_spi(parent, "spi1", U8500_SPI1_BASE, \
107 IRQ_DB8500_SPI1, pdata, 0)
108#define db8500_add_spi2(parent, pdata) \
109 dbx500_add_spi(parent, "spi2", U8500_SPI2_BASE, \
110 IRQ_DB8500_SPI2, pdata, 0)
111#define db8500_add_spi3(parent, pdata) \
112 dbx500_add_spi(parent, "spi3", U8500_SPI3_BASE, \
113 IRQ_DB8500_SPI3, pdata, 0)
114
115#define db8500_add_uart0(parent, pdata) \
116 dbx500_add_uart(parent, "uart0", U8500_UART0_BASE, \
117 IRQ_DB8500_UART0, pdata)
118#define db8500_add_uart1(parent, pdata) \
119 dbx500_add_uart(parent, "uart1", U8500_UART1_BASE, \
120 IRQ_DB8500_UART1, pdata)
121#define db8500_add_uart2(parent, pdata) \
122 dbx500_add_uart(parent, "uart2", U8500_UART2_BASE, \
123 IRQ_DB8500_UART2, pdata)
124
125#define db8500_add_cryp1(parent, pdata) \
126 dbx500_add_cryp1(parent, -1, U8500_CRYP1_BASE, IRQ_DB8500_CRYP1, pdata)
127#define db8500_add_hash1(parent, pdata) \
128 dbx500_add_hash1(parent, -1, U8500_HASH1_BASE, pdata)
129#endif 19#endif
diff --git a/arch/arm/mach-ux500/devices.h b/arch/arm/mach-ux500/devices.h
index cbc6f1e4104d..5bca7c605cd6 100644
--- a/arch/arm/mach-ux500/devices.h
+++ b/arch/arm/mach-ux500/devices.h
@@ -10,14 +10,6 @@
10struct platform_device; 10struct platform_device;
11struct amba_device; 11struct amba_device;
12 12
13extern struct platform_device u8500_gpio_devs[];
14
15extern struct amba_device ux500_pl031_device; 13extern struct amba_device ux500_pl031_device;
16 14
17extern struct platform_device ux500_hash1_device;
18extern struct platform_device ux500_cryp1_device;
19
20extern struct platform_device u8500_dma40_device;
21extern struct platform_device ux500_ske_keypad_device;
22
23#endif 15#endif
diff --git a/arch/arm/mach-ux500/setup.h b/arch/arm/mach-ux500/setup.h
index 656324aad18e..bdb356498a74 100644
--- a/arch/arm/mach-ux500/setup.h
+++ b/arch/arm/mach-ux500/setup.h
@@ -24,7 +24,6 @@ extern void __init u8500_map_io(void);
24extern struct device * __init u8500_init_devices(void); 24extern struct device * __init u8500_init_devices(void);
25 25
26extern void __init ux500_init_irq(void); 26extern void __init ux500_init_irq(void);
27extern void __init ux500_init_late(void);
28 27
29extern struct device *ux500_soc_device_init(const char *soc_id); 28extern struct device *ux500_soc_device_init(const char *soc_id);
30 29
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c
index b6bd0efcbe64..05a4ff78b3bd 100644
--- a/arch/arm/mach-ux500/timer.c
+++ b/arch/arm/mach-ux500/timer.c
@@ -97,8 +97,8 @@ dt_fail:
97 * sched_clock with higher rating then MTU since is always-on. 97 * sched_clock with higher rating then MTU since is always-on.
98 * 98 *
99 */ 99 */
100 100 if (!of_have_populated_dt())
101 nmdk_timer_init(mtu_timer_base, IRQ_MTU0); 101 nmdk_timer_init(mtu_timer_base, IRQ_MTU0);
102 clksrc_dbx500_prcmu_init(prcmu_timer_base); 102 clksrc_dbx500_prcmu_init(prcmu_timer_base);
103 ux500_twd_init(); 103 ux500_twd_init();
104} 104}
diff --git a/arch/arm/mach-ux500/usb.c b/arch/arm/mach-ux500/usb.c
deleted file mode 100644
index b7bd8d3a5507..000000000000
--- a/arch/arm/mach-ux500/usb.c
+++ /dev/null
@@ -1,135 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2011
3 *
4 * Author: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7#include <linux/platform_device.h>
8#include <linux/usb/musb.h>
9#include <linux/dma-mapping.h>
10#include <linux/platform_data/usb-musb-ux500.h>
11#include <linux/platform_data/dma-ste-dma40.h>
12
13#include "db8500-regs.h"
14
15#define MUSB_DMA40_RX_CH { \
16 .mode = STEDMA40_MODE_LOGICAL, \
17 .dir = DMA_DEV_TO_MEM, \
18 }
19
20#define MUSB_DMA40_TX_CH { \
21 .mode = STEDMA40_MODE_LOGICAL, \
22 .dir = DMA_MEM_TO_DEV, \
23 }
24
25static struct stedma40_chan_cfg musb_dma_rx_ch[UX500_MUSB_DMA_NUM_RX_TX_CHANNELS]
26 = {
27 MUSB_DMA40_RX_CH,
28 MUSB_DMA40_RX_CH,
29 MUSB_DMA40_RX_CH,
30 MUSB_DMA40_RX_CH,
31 MUSB_DMA40_RX_CH,
32 MUSB_DMA40_RX_CH,
33 MUSB_DMA40_RX_CH,
34 MUSB_DMA40_RX_CH
35};
36
37static struct stedma40_chan_cfg musb_dma_tx_ch[UX500_MUSB_DMA_NUM_RX_TX_CHANNELS]
38 = {
39 MUSB_DMA40_TX_CH,
40 MUSB_DMA40_TX_CH,
41 MUSB_DMA40_TX_CH,
42 MUSB_DMA40_TX_CH,
43 MUSB_DMA40_TX_CH,
44 MUSB_DMA40_TX_CH,
45 MUSB_DMA40_TX_CH,
46 MUSB_DMA40_TX_CH,
47};
48
49static void *ux500_dma_rx_param_array[UX500_MUSB_DMA_NUM_RX_TX_CHANNELS] = {
50 &musb_dma_rx_ch[0],
51 &musb_dma_rx_ch[1],
52 &musb_dma_rx_ch[2],
53 &musb_dma_rx_ch[3],
54 &musb_dma_rx_ch[4],
55 &musb_dma_rx_ch[5],
56 &musb_dma_rx_ch[6],
57 &musb_dma_rx_ch[7]
58};
59
60static void *ux500_dma_tx_param_array[UX500_MUSB_DMA_NUM_RX_TX_CHANNELS] = {
61 &musb_dma_tx_ch[0],
62 &musb_dma_tx_ch[1],
63 &musb_dma_tx_ch[2],
64 &musb_dma_tx_ch[3],
65 &musb_dma_tx_ch[4],
66 &musb_dma_tx_ch[5],
67 &musb_dma_tx_ch[6],
68 &musb_dma_tx_ch[7]
69};
70
71static struct ux500_musb_board_data musb_board_data = {
72 .dma_rx_param_array = ux500_dma_rx_param_array,
73 .dma_tx_param_array = ux500_dma_tx_param_array,
74 .dma_filter = stedma40_filter,
75};
76
77static struct musb_hdrc_platform_data musb_platform_data = {
78 .mode = MUSB_OTG,
79 .board_data = &musb_board_data,
80};
81
82static struct resource usb_resources[] = {
83 [0] = {
84 .name = "usb-mem",
85 .flags = IORESOURCE_MEM,
86 },
87
88 [1] = {
89 .name = "mc", /* hard-coded in musb */
90 .flags = IORESOURCE_IRQ,
91 },
92};
93
94struct platform_device ux500_musb_device = {
95 .name = "musb-ux500",
96 .id = 0,
97 .dev = {
98 .platform_data = &musb_platform_data,
99 .coherent_dma_mask = DMA_BIT_MASK(32),
100 },
101 .num_resources = ARRAY_SIZE(usb_resources),
102 .resource = usb_resources,
103};
104
105static inline void ux500_usb_dma_update_rx_ch_config(int *dev_type)
106{
107 u32 idx;
108
109 for (idx = 0; idx < UX500_MUSB_DMA_NUM_RX_TX_CHANNELS; idx++)
110 musb_dma_rx_ch[idx].dev_type = dev_type[idx];
111}
112
113static inline void ux500_usb_dma_update_tx_ch_config(int *dev_type)
114{
115 u32 idx;
116
117 for (idx = 0; idx < UX500_MUSB_DMA_NUM_RX_TX_CHANNELS; idx++)
118 musb_dma_tx_ch[idx].dev_type = dev_type[idx];
119}
120
121void ux500_add_usb(struct device *parent, resource_size_t base, int irq,
122 int *dma_rx_cfg, int *dma_tx_cfg)
123{
124 ux500_musb_device.resource[0].start = base;
125 ux500_musb_device.resource[0].end = base + SZ_64K - 1;
126 ux500_musb_device.resource[1].start = irq;
127 ux500_musb_device.resource[1].end = irq;
128
129 ux500_usb_dma_update_rx_ch_config(dma_rx_cfg);
130 ux500_usb_dma_update_tx_ch_config(dma_tx_cfg);
131
132 ux500_musb_device.dev.parent = parent;
133
134 platform_device_register(&ux500_musb_device);
135}
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig
index 365795447804..4a70be485ff8 100644
--- a/arch/arm/mach-vexpress/Kconfig
+++ b/arch/arm/mach-vexpress/Kconfig
@@ -1,17 +1,16 @@
1config ARCH_VEXPRESS 1config ARCH_VEXPRESS
2 bool "ARM Ltd. Versatile Express family" if ARCH_MULTI_V7 2 bool "ARM Ltd. Versatile Express family" if ARCH_MULTI_V7
3 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
4 select ARCH_SUPPORTS_BIG_ENDIAN
4 select ARM_AMBA 5 select ARM_AMBA
5 select ARM_GIC 6 select ARM_GIC
6 select ARM_TIMER_SP804 7 select ARM_TIMER_SP804
7 select CLKDEV_LOOKUP
8 select COMMON_CLK 8 select COMMON_CLK
9 select COMMON_CLK_VERSATILE 9 select COMMON_CLK_VERSATILE
10 select CPU_V7 10 select CPU_V7
11 select GENERIC_CLOCKEVENTS 11 select GENERIC_CLOCKEVENTS
12 select HAVE_ARM_SCU if SMP 12 select HAVE_ARM_SCU if SMP
13 select HAVE_ARM_TWD if SMP 13 select HAVE_ARM_TWD if SMP
14 select HAVE_CLK
15 select HAVE_PATA_PLATFORM 14 select HAVE_PATA_PLATFORM
16 select HAVE_SMP 15 select HAVE_SMP
17 select ICST 16 select ICST
@@ -66,10 +65,22 @@ config ARCH_VEXPRESS_DCSCB
66 This is needed to provide CPU and cluster power management 65 This is needed to provide CPU and cluster power management
67 on RTSM implementing big.LITTLE. 66 on RTSM implementing big.LITTLE.
68 67
68config ARCH_VEXPRESS_SPC
69 bool "Versatile Express Serial Power Controller (SPC)"
70 select ARCH_HAS_CPUFREQ
71 select ARCH_HAS_OPP
72 select PM_OPP
73 help
74 The TC2 (A15x2 A7x3) versatile express core tile integrates a logic
75 block called Serial Power Controller (SPC) that provides the interface
76 between the dual cluster test-chip and the M3 microcontroller that
77 carries out power management.
78
69config ARCH_VEXPRESS_TC2_PM 79config ARCH_VEXPRESS_TC2_PM
70 bool "Versatile Express TC2 power management" 80 bool "Versatile Express TC2 power management"
71 depends on MCPM 81 depends on MCPM
72 select ARM_CCI 82 select ARM_CCI
83 select ARCH_VEXPRESS_SPC
73 help 84 help
74 Support for CPU and cluster power management on Versatile Express 85 Support for CPU and cluster power management on Versatile Express
75 with a TC2 (A15x2 A7x3) big.LITTLE core tile. 86 with a TC2 (A15x2 A7x3) big.LITTLE core tile.
diff --git a/arch/arm/mach-vexpress/Makefile b/arch/arm/mach-vexpress/Makefile
index 505e64ab3eae..0997e0b7494c 100644
--- a/arch/arm/mach-vexpress/Makefile
+++ b/arch/arm/mach-vexpress/Makefile
@@ -8,7 +8,8 @@ obj-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_ARCH_VEXPRESS_DCSCB) += dcscb.o dcscb_setup.o
10CFLAGS_dcscb.o += -march=armv7-a 10CFLAGS_dcscb.o += -march=armv7-a
11obj-$(CONFIG_ARCH_VEXPRESS_TC2_PM) += tc2_pm.o spc.o 11obj-$(CONFIG_ARCH_VEXPRESS_SPC) += spc.o
12obj-$(CONFIG_ARCH_VEXPRESS_TC2_PM) += tc2_pm.o
12CFLAGS_tc2_pm.o += -march=armv7-a 13CFLAGS_tc2_pm.o += -march=armv7-a
13obj-$(CONFIG_SMP) += platsmp.o 14obj-$(CONFIG_SMP) += platsmp.o
14obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 15obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
diff --git a/arch/arm/mach-vexpress/dcscb.c b/arch/arm/mach-vexpress/dcscb.c
index 3a6384c6c435..14d499688736 100644
--- a/arch/arm/mach-vexpress/dcscb.c
+++ b/arch/arm/mach-vexpress/dcscb.c
@@ -133,38 +133,8 @@ static void dcscb_power_down(void)
133 if (last_man && __mcpm_outbound_enter_critical(cpu, cluster)) { 133 if (last_man && __mcpm_outbound_enter_critical(cpu, cluster)) {
134 arch_spin_unlock(&dcscb_lock); 134 arch_spin_unlock(&dcscb_lock);
135 135
136 /* 136 /* Flush all cache levels for this cluster. */
137 * Flush all cache levels for this cluster. 137 v7_exit_coherency_flush(all);
138 *
139 * To do so we do:
140 * - Clear the SCTLR.C bit to prevent further cache allocations
141 * - Flush the whole cache
142 * - Clear the ACTLR "SMP" bit to disable local coherency
143 *
144 * Let's do it in the safest possible way i.e. with
145 * no memory access within the following sequence
146 * including to the stack.
147 *
148 * Note: fp is preserved to the stack explicitly prior doing
149 * this since adding it to the clobber list is incompatible
150 * with having CONFIG_FRAME_POINTER=y.
151 */
152 asm volatile(
153 "str fp, [sp, #-4]! \n\t"
154 "mrc p15, 0, r0, c1, c0, 0 @ get CR \n\t"
155 "bic r0, r0, #"__stringify(CR_C)" \n\t"
156 "mcr p15, 0, r0, c1, c0, 0 @ set CR \n\t"
157 "isb \n\t"
158 "bl v7_flush_dcache_all \n\t"
159 "clrex \n\t"
160 "mrc p15, 0, r0, c1, c0, 1 @ get AUXCR \n\t"
161 "bic r0, r0, #(1 << 6) @ disable local coherency \n\t"
162 "mcr p15, 0, r0, c1, c0, 1 @ set AUXCR \n\t"
163 "isb \n\t"
164 "dsb \n\t"
165 "ldr fp, [sp], #4"
166 : : : "r0","r1","r2","r3","r4","r5","r6","r7",
167 "r9","r10","lr","memory");
168 138
169 /* 139 /*
170 * This is a harmless no-op. On platforms with a real 140 * This is a harmless no-op. On platforms with a real
@@ -183,26 +153,8 @@ static void dcscb_power_down(void)
183 } else { 153 } else {
184 arch_spin_unlock(&dcscb_lock); 154 arch_spin_unlock(&dcscb_lock);
185 155
186 /* 156 /* Disable and flush the local CPU cache. */
187 * Flush the local CPU cache. 157 v7_exit_coherency_flush(louis);
188 * Let's do it in the safest possible way as above.
189 */
190 asm volatile(
191 "str fp, [sp, #-4]! \n\t"
192 "mrc p15, 0, r0, c1, c0, 0 @ get CR \n\t"
193 "bic r0, r0, #"__stringify(CR_C)" \n\t"
194 "mcr p15, 0, r0, c1, c0, 0 @ set CR \n\t"
195 "isb \n\t"
196 "bl v7_flush_dcache_louis \n\t"
197 "clrex \n\t"
198 "mrc p15, 0, r0, c1, c0, 1 @ get AUXCR \n\t"
199 "bic r0, r0, #(1 << 6) @ disable local coherency \n\t"
200 "mcr p15, 0, r0, c1, c0, 1 @ set AUXCR \n\t"
201 "isb \n\t"
202 "dsb \n\t"
203 "ldr fp, [sp], #4"
204 : : : "r0","r1","r2","r3","r4","r5","r6","r7",
205 "r9","r10","lr","memory");
206 } 158 }
207 159
208 __mcpm_cpu_down(cpu, cluster); 160 __mcpm_cpu_down(cpu, cluster);
diff --git a/arch/arm/mach-vexpress/spc.c b/arch/arm/mach-vexpress/spc.c
index eefb029197ca..033d34dcbd3f 100644
--- a/arch/arm/mach-vexpress/spc.c
+++ b/arch/arm/mach-vexpress/spc.c
@@ -17,14 +17,31 @@
17 * GNU General Public License for more details. 17 * GNU General Public License for more details.
18 */ 18 */
19 19
20#include <linux/clk-provider.h>
21#include <linux/clkdev.h>
22#include <linux/cpu.h>
23#include <linux/delay.h>
20#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/interrupt.h>
21#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/platform_device.h>
28#include <linux/pm_opp.h>
22#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/semaphore.h>
23 31
24#include <asm/cacheflush.h> 32#include <asm/cacheflush.h>
25 33
26#define SPCLOG "vexpress-spc: " 34#define SPCLOG "vexpress-spc: "
27 35
36#define PERF_LVL_A15 0x00
37#define PERF_REQ_A15 0x04
38#define PERF_LVL_A7 0x08
39#define PERF_REQ_A7 0x0c
40#define COMMS 0x10
41#define COMMS_REQ 0x14
42#define PWC_STATUS 0x18
43#define PWC_FLAG 0x1c
44
28/* SPC wake-up IRQs status and mask */ 45/* SPC wake-up IRQs status and mask */
29#define WAKE_INT_MASK 0x24 46#define WAKE_INT_MASK 0x24
30#define WAKE_INT_RAW 0x28 47#define WAKE_INT_RAW 0x28
@@ -36,12 +53,45 @@
36#define A15_BX_ADDR0 0x68 53#define A15_BX_ADDR0 0x68
37#define A7_BX_ADDR0 0x78 54#define A7_BX_ADDR0 0x78
38 55
56/* SPC system config interface registers */
57#define SYSCFG_WDATA 0x70
58#define SYSCFG_RDATA 0x74
59
60/* A15/A7 OPP virtual register base */
61#define A15_PERFVAL_BASE 0xC10
62#define A7_PERFVAL_BASE 0xC30
63
64/* Config interface control bits */
65#define SYSCFG_START (1 << 31)
66#define SYSCFG_SCC (6 << 20)
67#define SYSCFG_STAT (14 << 20)
68
39/* wake-up interrupt masks */ 69/* wake-up interrupt masks */
40#define GBL_WAKEUP_INT_MSK (0x3 << 10) 70#define GBL_WAKEUP_INT_MSK (0x3 << 10)
41 71
42/* TC2 static dual-cluster configuration */ 72/* TC2 static dual-cluster configuration */
43#define MAX_CLUSTERS 2 73#define MAX_CLUSTERS 2
44 74
75/*
76 * Even though the SPC takes max 3-5 ms to complete any OPP/COMMS
77 * operation, the operation could start just before jiffie is about
78 * to be incremented. So setting timeout value of 20ms = 2jiffies@100Hz
79 */
80#define TIMEOUT_US 20000
81
82#define MAX_OPPS 8
83#define CA15_DVFS 0
84#define CA7_DVFS 1
85#define SPC_SYS_CFG 2
86#define STAT_COMPLETE(type) ((1 << 0) << (type << 2))
87#define STAT_ERR(type) ((1 << 1) << (type << 2))
88#define RESPONSE_MASK(type) (STAT_COMPLETE(type) | STAT_ERR(type))
89
90struct ve_spc_opp {
91 unsigned long freq;
92 unsigned long u_volt;
93};
94
45struct ve_spc_drvdata { 95struct ve_spc_drvdata {
46 void __iomem *baseaddr; 96 void __iomem *baseaddr;
47 /* 97 /*
@@ -49,6 +99,12 @@ struct ve_spc_drvdata {
49 * It corresponds to A15 processors MPIDR[15:8] bitfield 99 * It corresponds to A15 processors MPIDR[15:8] bitfield
50 */ 100 */
51 u32 a15_clusid; 101 u32 a15_clusid;
102 uint32_t cur_rsp_mask;
103 uint32_t cur_rsp_stat;
104 struct semaphore sem;
105 struct completion done;
106 struct ve_spc_opp *opps[MAX_CLUSTERS];
107 int num_opps[MAX_CLUSTERS];
52}; 108};
53 109
54static struct ve_spc_drvdata *info; 110static struct ve_spc_drvdata *info;
@@ -157,8 +213,197 @@ void ve_spc_powerdown(u32 cluster, bool enable)
157 writel_relaxed(enable, info->baseaddr + pwdrn_reg); 213 writel_relaxed(enable, info->baseaddr + pwdrn_reg);
158} 214}
159 215
160int __init ve_spc_init(void __iomem *baseaddr, u32 a15_clusid) 216static int ve_spc_get_performance(int cluster, u32 *freq)
217{
218 struct ve_spc_opp *opps = info->opps[cluster];
219 u32 perf_cfg_reg = 0;
220 u32 perf;
221
222 perf_cfg_reg = cluster_is_a15(cluster) ? PERF_LVL_A15 : PERF_LVL_A7;
223
224 perf = readl_relaxed(info->baseaddr + perf_cfg_reg);
225 if (perf >= info->num_opps[cluster])
226 return -EINVAL;
227
228 opps += perf;
229 *freq = opps->freq;
230
231 return 0;
232}
233
234/* find closest match to given frequency in OPP table */
235static int ve_spc_round_performance(int cluster, u32 freq)
236{
237 int idx, max_opp = info->num_opps[cluster];
238 struct ve_spc_opp *opps = info->opps[cluster];
239 u32 fmin = 0, fmax = ~0, ftmp;
240
241 freq /= 1000; /* OPP entries in kHz */
242 for (idx = 0; idx < max_opp; idx++, opps++) {
243 ftmp = opps->freq;
244 if (ftmp >= freq) {
245 if (ftmp <= fmax)
246 fmax = ftmp;
247 } else {
248 if (ftmp >= fmin)
249 fmin = ftmp;
250 }
251 }
252 if (fmax != ~0)
253 return fmax * 1000;
254 else
255 return fmin * 1000;
256}
257
258static int ve_spc_find_performance_index(int cluster, u32 freq)
259{
260 int idx, max_opp = info->num_opps[cluster];
261 struct ve_spc_opp *opps = info->opps[cluster];
262
263 for (idx = 0; idx < max_opp; idx++, opps++)
264 if (opps->freq == freq)
265 break;
266 return (idx == max_opp) ? -EINVAL : idx;
267}
268
269static int ve_spc_waitforcompletion(int req_type)
270{
271 int ret = wait_for_completion_interruptible_timeout(
272 &info->done, usecs_to_jiffies(TIMEOUT_US));
273 if (ret == 0)
274 ret = -ETIMEDOUT;
275 else if (ret > 0)
276 ret = info->cur_rsp_stat & STAT_COMPLETE(req_type) ? 0 : -EIO;
277 return ret;
278}
279
280static int ve_spc_set_performance(int cluster, u32 freq)
281{
282 u32 perf_cfg_reg, perf_stat_reg;
283 int ret, perf, req_type;
284
285 if (cluster_is_a15(cluster)) {
286 req_type = CA15_DVFS;
287 perf_cfg_reg = PERF_LVL_A15;
288 perf_stat_reg = PERF_REQ_A15;
289 } else {
290 req_type = CA7_DVFS;
291 perf_cfg_reg = PERF_LVL_A7;
292 perf_stat_reg = PERF_REQ_A7;
293 }
294
295 perf = ve_spc_find_performance_index(cluster, freq);
296
297 if (perf < 0)
298 return perf;
299
300 if (down_timeout(&info->sem, usecs_to_jiffies(TIMEOUT_US)))
301 return -ETIME;
302
303 init_completion(&info->done);
304 info->cur_rsp_mask = RESPONSE_MASK(req_type);
305
306 writel(perf, info->baseaddr + perf_cfg_reg);
307 ret = ve_spc_waitforcompletion(req_type);
308
309 info->cur_rsp_mask = 0;
310 up(&info->sem);
311
312 return ret;
313}
314
315static int ve_spc_read_sys_cfg(int func, int offset, uint32_t *data)
316{
317 int ret;
318
319 if (down_timeout(&info->sem, usecs_to_jiffies(TIMEOUT_US)))
320 return -ETIME;
321
322 init_completion(&info->done);
323 info->cur_rsp_mask = RESPONSE_MASK(SPC_SYS_CFG);
324
325 /* Set the control value */
326 writel(SYSCFG_START | func | offset >> 2, info->baseaddr + COMMS);
327 ret = ve_spc_waitforcompletion(SPC_SYS_CFG);
328
329 if (ret == 0)
330 *data = readl(info->baseaddr + SYSCFG_RDATA);
331
332 info->cur_rsp_mask = 0;
333 up(&info->sem);
334
335 return ret;
336}
337
338static irqreturn_t ve_spc_irq_handler(int irq, void *data)
339{
340 struct ve_spc_drvdata *drv_data = data;
341 uint32_t status = readl_relaxed(drv_data->baseaddr + PWC_STATUS);
342
343 if (info->cur_rsp_mask & status) {
344 info->cur_rsp_stat = status;
345 complete(&drv_data->done);
346 }
347
348 return IRQ_HANDLED;
349}
350
351/*
352 * +--------------------------+
353 * | 31 20 | 19 0 |
354 * +--------------------------+
355 * | u_volt | freq(kHz) |
356 * +--------------------------+
357 */
358#define MULT_FACTOR 20
359#define VOLT_SHIFT 20
360#define FREQ_MASK (0xFFFFF)
361static int ve_spc_populate_opps(uint32_t cluster)
161{ 362{
363 uint32_t data = 0, off, ret, idx;
364 struct ve_spc_opp *opps;
365
366 opps = kzalloc(sizeof(*opps) * MAX_OPPS, GFP_KERNEL);
367 if (!opps)
368 return -ENOMEM;
369
370 info->opps[cluster] = opps;
371
372 off = cluster_is_a15(cluster) ? A15_PERFVAL_BASE : A7_PERFVAL_BASE;
373 for (idx = 0; idx < MAX_OPPS; idx++, off += 4, opps++) {
374 ret = ve_spc_read_sys_cfg(SYSCFG_SCC, off, &data);
375 if (!ret) {
376 opps->freq = (data & FREQ_MASK) * MULT_FACTOR;
377 opps->u_volt = data >> VOLT_SHIFT;
378 } else {
379 break;
380 }
381 }
382 info->num_opps[cluster] = idx;
383
384 return ret;
385}
386
387static int ve_init_opp_table(struct device *cpu_dev)
388{
389 int cluster = topology_physical_package_id(cpu_dev->id);
390 int idx, ret = 0, max_opp = info->num_opps[cluster];
391 struct ve_spc_opp *opps = info->opps[cluster];
392
393 for (idx = 0; idx < max_opp; idx++, opps++) {
394 ret = dev_pm_opp_add(cpu_dev, opps->freq * 1000, opps->u_volt);
395 if (ret) {
396 dev_warn(cpu_dev, "failed to add opp %lu %lu\n",
397 opps->freq, opps->u_volt);
398 return ret;
399 }
400 }
401 return ret;
402}
403
404int __init ve_spc_init(void __iomem *baseaddr, u32 a15_clusid, int irq)
405{
406 int ret;
162 info = kzalloc(sizeof(*info), GFP_KERNEL); 407 info = kzalloc(sizeof(*info), GFP_KERNEL);
163 if (!info) { 408 if (!info) {
164 pr_err(SPCLOG "unable to allocate mem\n"); 409 pr_err(SPCLOG "unable to allocate mem\n");
@@ -168,6 +413,25 @@ int __init ve_spc_init(void __iomem *baseaddr, u32 a15_clusid)
168 info->baseaddr = baseaddr; 413 info->baseaddr = baseaddr;
169 info->a15_clusid = a15_clusid; 414 info->a15_clusid = a15_clusid;
170 415
416 if (irq <= 0) {
417 pr_err(SPCLOG "Invalid IRQ %d\n", irq);
418 kfree(info);
419 return -EINVAL;
420 }
421
422 init_completion(&info->done);
423
424 readl_relaxed(info->baseaddr + PWC_STATUS);
425
426 ret = request_irq(irq, ve_spc_irq_handler, IRQF_TRIGGER_HIGH
427 | IRQF_ONESHOT, "vexpress-spc", info);
428 if (ret) {
429 pr_err(SPCLOG "IRQ %d request failed\n", irq);
430 kfree(info);
431 return -ENODEV;
432 }
433
434 sema_init(&info->sem, 1);
171 /* 435 /*
172 * Multi-cluster systems may need this data when non-coherent, during 436 * Multi-cluster systems may need this data when non-coherent, during
173 * cluster power-up/power-down. Make sure driver info reaches main 437 * cluster power-up/power-down. Make sure driver info reaches main
@@ -178,3 +442,103 @@ int __init ve_spc_init(void __iomem *baseaddr, u32 a15_clusid)
178 442
179 return 0; 443 return 0;
180} 444}
445
446struct clk_spc {
447 struct clk_hw hw;
448 int cluster;
449};
450
451#define to_clk_spc(spc) container_of(spc, struct clk_spc, hw)
452static unsigned long spc_recalc_rate(struct clk_hw *hw,
453 unsigned long parent_rate)
454{
455 struct clk_spc *spc = to_clk_spc(hw);
456 u32 freq;
457
458 if (ve_spc_get_performance(spc->cluster, &freq))
459 return -EIO;
460
461 return freq * 1000;
462}
463
464static long spc_round_rate(struct clk_hw *hw, unsigned long drate,
465 unsigned long *parent_rate)
466{
467 struct clk_spc *spc = to_clk_spc(hw);
468
469 return ve_spc_round_performance(spc->cluster, drate);
470}
471
472static int spc_set_rate(struct clk_hw *hw, unsigned long rate,
473 unsigned long parent_rate)
474{
475 struct clk_spc *spc = to_clk_spc(hw);
476
477 return ve_spc_set_performance(spc->cluster, rate / 1000);
478}
479
480static struct clk_ops clk_spc_ops = {
481 .recalc_rate = spc_recalc_rate,
482 .round_rate = spc_round_rate,
483 .set_rate = spc_set_rate,
484};
485
486static struct clk *ve_spc_clk_register(struct device *cpu_dev)
487{
488 struct clk_init_data init;
489 struct clk_spc *spc;
490
491 spc = kzalloc(sizeof(*spc), GFP_KERNEL);
492 if (!spc) {
493 pr_err("could not allocate spc clk\n");
494 return ERR_PTR(-ENOMEM);
495 }
496
497 spc->hw.init = &init;
498 spc->cluster = topology_physical_package_id(cpu_dev->id);
499
500 init.name = dev_name(cpu_dev);
501 init.ops = &clk_spc_ops;
502 init.flags = CLK_IS_ROOT | CLK_GET_RATE_NOCACHE;
503 init.num_parents = 0;
504
505 return devm_clk_register(cpu_dev, &spc->hw);
506}
507
508static int __init ve_spc_clk_init(void)
509{
510 int cpu;
511 struct clk *clk;
512
513 if (!info)
514 return 0; /* Continue only if SPC is initialised */
515
516 if (ve_spc_populate_opps(0) || ve_spc_populate_opps(1)) {
517 pr_err("failed to build OPP table\n");
518 return -ENODEV;
519 }
520
521 for_each_possible_cpu(cpu) {
522 struct device *cpu_dev = get_cpu_device(cpu);
523 if (!cpu_dev) {
524 pr_warn("failed to get cpu%d device\n", cpu);
525 continue;
526 }
527 clk = ve_spc_clk_register(cpu_dev);
528 if (IS_ERR(clk)) {
529 pr_warn("failed to register cpu%d clock\n", cpu);
530 continue;
531 }
532 if (clk_register_clkdev(clk, NULL, dev_name(cpu_dev))) {
533 pr_warn("failed to register cpu%d clock lookup\n", cpu);
534 continue;
535 }
536
537 if (ve_init_opp_table(cpu_dev))
538 pr_warn("failed to initialise cpu%d opp table\n", cpu);
539 }
540
541 platform_device_register_simple("vexpress-spc-cpufreq", -1, NULL, 0);
542 return 0;
543}
544module_init(ve_spc_clk_init);
diff --git a/arch/arm/mach-vexpress/spc.h b/arch/arm/mach-vexpress/spc.h
index 5f7e4a446a17..dbd44c3720f9 100644
--- a/arch/arm/mach-vexpress/spc.h
+++ b/arch/arm/mach-vexpress/spc.h
@@ -15,7 +15,7 @@
15#ifndef __SPC_H_ 15#ifndef __SPC_H_
16#define __SPC_H_ 16#define __SPC_H_
17 17
18int __init ve_spc_init(void __iomem *base, u32 a15_clusid); 18int __init ve_spc_init(void __iomem *base, u32 a15_clusid, int irq);
19void ve_spc_global_wakeup_irq(bool set); 19void ve_spc_global_wakeup_irq(bool set);
20void ve_spc_cpu_wakeup_irq(u32 cluster, u32 cpu, bool set); 20void ve_spc_cpu_wakeup_irq(u32 cluster, u32 cpu, bool set);
21void ve_spc_set_resume_addr(u32 cluster, u32 cpu, u32 addr); 21void ve_spc_set_resume_addr(u32 cluster, u32 cpu, u32 addr);
diff --git a/arch/arm/mach-vexpress/tc2_pm.c b/arch/arm/mach-vexpress/tc2_pm.c
index 7aeb5d60e484..05a364c5077a 100644
--- a/arch/arm/mach-vexpress/tc2_pm.c
+++ b/arch/arm/mach-vexpress/tc2_pm.c
@@ -16,6 +16,7 @@
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/of_address.h> 18#include <linux/of_address.h>
19#include <linux/of_irq.h>
19#include <linux/spinlock.h> 20#include <linux/spinlock.h>
20#include <linux/errno.h> 21#include <linux/errno.h>
21#include <linux/irqchip/arm-gic.h> 22#include <linux/irqchip/arm-gic.h>
@@ -131,6 +132,16 @@ static void tc2_pm_down(u64 residency)
131 } else 132 } else
132 BUG(); 133 BUG();
133 134
135 /*
136 * If the CPU is committed to power down, make sure
137 * the power controller will be in charge of waking it
138 * up upon IRQ, ie IRQ lines are cut from GIC CPU IF
139 * to the CPU by disabling the GIC CPU IF to prevent wfi
140 * from completing execution behind power controller back
141 */
142 if (!skip_wfi)
143 gic_cpu_if_down();
144
134 if (last_man && __mcpm_outbound_enter_critical(cpu, cluster)) { 145 if (last_man && __mcpm_outbound_enter_critical(cpu, cluster)) {
135 arch_spin_unlock(&tc2_pm_lock); 146 arch_spin_unlock(&tc2_pm_lock);
136 147
@@ -146,32 +157,7 @@ static void tc2_pm_down(u64 residency)
146 : : "r" (0x400) ); 157 : : "r" (0x400) );
147 } 158 }
148 159
149 /* 160 v7_exit_coherency_flush(all);
150 * We need to disable and flush the whole (L1 and L2) cache.
151 * Let's do it in the safest possible way i.e. with
152 * no memory access within the following sequence
153 * including the stack.
154 *
155 * Note: fp is preserved to the stack explicitly prior doing
156 * this since adding it to the clobber list is incompatible
157 * with having CONFIG_FRAME_POINTER=y.
158 */
159 asm volatile(
160 "str fp, [sp, #-4]! \n\t"
161 "mrc p15, 0, r0, c1, c0, 0 @ get CR \n\t"
162 "bic r0, r0, #"__stringify(CR_C)" \n\t"
163 "mcr p15, 0, r0, c1, c0, 0 @ set CR \n\t"
164 "isb \n\t"
165 "bl v7_flush_dcache_all \n\t"
166 "clrex \n\t"
167 "mrc p15, 0, r0, c1, c0, 1 @ get AUXCR \n\t"
168 "bic r0, r0, #(1 << 6) @ disable local coherency \n\t"
169 "mcr p15, 0, r0, c1, c0, 1 @ set AUXCR \n\t"
170 "isb \n\t"
171 "dsb \n\t"
172 "ldr fp, [sp], #4"
173 : : : "r0","r1","r2","r3","r4","r5","r6","r7",
174 "r9","r10","lr","memory");
175 161
176 cci_disable_port_by_cpu(mpidr); 162 cci_disable_port_by_cpu(mpidr);
177 163
@@ -187,26 +173,7 @@ static void tc2_pm_down(u64 residency)
187 173
188 arch_spin_unlock(&tc2_pm_lock); 174 arch_spin_unlock(&tc2_pm_lock);
189 175
190 /* 176 v7_exit_coherency_flush(louis);
191 * We need to disable and flush only the L1 cache.
192 * Let's do it in the safest possible way as above.
193 */
194 asm volatile(
195 "str fp, [sp, #-4]! \n\t"
196 "mrc p15, 0, r0, c1, c0, 0 @ get CR \n\t"
197 "bic r0, r0, #"__stringify(CR_C)" \n\t"
198 "mcr p15, 0, r0, c1, c0, 0 @ set CR \n\t"
199 "isb \n\t"
200 "bl v7_flush_dcache_louis \n\t"
201 "clrex \n\t"
202 "mrc p15, 0, r0, c1, c0, 1 @ get AUXCR \n\t"
203 "bic r0, r0, #(1 << 6) @ disable local coherency \n\t"
204 "mcr p15, 0, r0, c1, c0, 1 @ set AUXCR \n\t"
205 "isb \n\t"
206 "dsb \n\t"
207 "ldr fp, [sp], #4"
208 : : : "r0","r1","r2","r3","r4","r5","r6","r7",
209 "r9","r10","lr","memory");
210 } 177 }
211 178
212 __mcpm_cpu_down(cpu, cluster); 179 __mcpm_cpu_down(cpu, cluster);
@@ -231,7 +198,6 @@ static void tc2_pm_suspend(u64 residency)
231 cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); 198 cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
232 cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); 199 cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
233 ve_spc_set_resume_addr(cluster, cpu, virt_to_phys(mcpm_entry_point)); 200 ve_spc_set_resume_addr(cluster, cpu, virt_to_phys(mcpm_entry_point));
234 gic_cpu_if_down();
235 tc2_pm_down(residency); 201 tc2_pm_down(residency);
236} 202}
237 203
@@ -302,7 +268,7 @@ static void __naked tc2_pm_power_up_setup(unsigned int affinity_level)
302 268
303static int __init tc2_pm_init(void) 269static int __init tc2_pm_init(void)
304{ 270{
305 int ret; 271 int ret, irq;
306 void __iomem *scc; 272 void __iomem *scc;
307 u32 a15_cluster_id, a7_cluster_id, sys_info; 273 u32 a15_cluster_id, a7_cluster_id, sys_info;
308 struct device_node *np; 274 struct device_node *np;
@@ -327,13 +293,15 @@ static int __init tc2_pm_init(void)
327 tc2_nr_cpus[a15_cluster_id] = (sys_info >> 16) & 0xf; 293 tc2_nr_cpus[a15_cluster_id] = (sys_info >> 16) & 0xf;
328 tc2_nr_cpus[a7_cluster_id] = (sys_info >> 20) & 0xf; 294 tc2_nr_cpus[a7_cluster_id] = (sys_info >> 20) & 0xf;
329 295
296 irq = irq_of_parse_and_map(np, 0);
297
330 /* 298 /*
331 * A subset of the SCC registers is also used to communicate 299 * A subset of the SCC registers is also used to communicate
332 * with the SPC (power controller). We need to be able to 300 * with the SPC (power controller). We need to be able to
333 * drive it very early in the boot process to power up 301 * drive it very early in the boot process to power up
334 * processors, so we initialize the SPC driver here. 302 * processors, so we initialize the SPC driver here.
335 */ 303 */
336 ret = ve_spc_init(scc + SPC_BASE, a15_cluster_id); 304 ret = ve_spc_init(scc + SPC_BASE, a15_cluster_id, irq);
337 if (ret) 305 if (ret)
338 return ret; 306 return ret;
339 307
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 95a469e23e37..4f8b8cb17ff5 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -1,12 +1,10 @@
1/* 1/*
2 * Versatile Express V2M Motherboard Support 2 * Versatile Express V2M Motherboard Support
3 */ 3 */
4#include <linux/clocksource.h>
5#include <linux/device.h> 4#include <linux/device.h>
6#include <linux/amba/bus.h> 5#include <linux/amba/bus.h>
7#include <linux/amba/mmci.h> 6#include <linux/amba/mmci.h>
8#include <linux/io.h> 7#include <linux/io.h>
9#include <linux/clocksource.h>
10#include <linux/smp.h> 8#include <linux/smp.h>
11#include <linux/init.h> 9#include <linux/init.h>
12#include <linux/of_address.h> 10#include <linux/of_address.h>
@@ -22,7 +20,6 @@
22#include <linux/regulator/fixed.h> 20#include <linux/regulator/fixed.h>
23#include <linux/regulator/machine.h> 21#include <linux/regulator/machine.h>
24#include <linux/vexpress.h> 22#include <linux/vexpress.h>
25#include <linux/clk-provider.h>
26#include <linux/clkdev.h> 23#include <linux/clkdev.h>
27 24
28#include <asm/mach-types.h> 25#include <asm/mach-types.h>
@@ -422,16 +419,8 @@ void __init v2m_dt_init_early(void)
422 pr_warning("vexpress: DT HBI (%x) is not matching " 419 pr_warning("vexpress: DT HBI (%x) is not matching "
423 "hardware (%x)!\n", dt_hbi, hbi); 420 "hardware (%x)!\n", dt_hbi, hbi);
424 } 421 }
425}
426
427static void __init v2m_dt_timer_init(void)
428{
429 of_clk_init(NULL);
430 422
431 clocksource_of_init(); 423 versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), 24000000);
432
433 versatile_sched_clock_init(vexpress_get_24mhz_clock_base(),
434 24000000);
435} 424}
436 425
437static const struct of_device_id v2m_dt_bus_match[] __initconst = { 426static const struct of_device_id v2m_dt_bus_match[] __initconst = {
@@ -458,6 +447,5 @@ DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express")
458 .smp_init = smp_init_ops(vexpress_smp_init_ops), 447 .smp_init = smp_init_ops(vexpress_smp_init_ops),
459 .map_io = v2m_dt_map_io, 448 .map_io = v2m_dt_map_io,
460 .init_early = v2m_dt_init_early, 449 .init_early = v2m_dt_init_early,
461 .init_time = v2m_dt_timer_init,
462 .init_machine = v2m_dt_init, 450 .init_machine = v2m_dt_init,
463MACHINE_END 451MACHINE_END
diff --git a/arch/arm/mach-vt8500/Kconfig b/arch/arm/mach-vt8500/Kconfig
index 9b252934b206..927be93b692e 100644
--- a/arch/arm/mach-vt8500/Kconfig
+++ b/arch/arm/mach-vt8500/Kconfig
@@ -5,7 +5,6 @@ config ARCH_VT8500
5 select CLKDEV_LOOKUP 5 select CLKDEV_LOOKUP
6 select CLKSRC_OF 6 select CLKSRC_OF
7 select GENERIC_CLOCKEVENTS 7 select GENERIC_CLOCKEVENTS
8 select HAVE_CLK
9 select VT8500_TIMER 8 select VT8500_TIMER
10 select PINCTRL 9 select PINCTRL
11 help 10 help
diff --git a/arch/arm/mach-vt8500/common.h b/arch/arm/mach-vt8500/common.h
deleted file mode 100644
index 087787af62f1..000000000000
--- a/arch/arm/mach-vt8500/common.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/* linux/arch/arm/mach-vt8500/dt_common.h
2 *
3 * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef __ARCH_ARM_MACH_VT8500_DT_COMMON_H
17#define __ARCH_ARM_MACH_VT8500_DT_COMMON_H
18
19#include <linux/of.h>
20
21/* defined in drivers/clk/clk-vt8500.c */
22void __init vtwm_clk_init(void __iomem *pmc_base);
23
24#endif
diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c
index eefaa60d6614..4a73464cb11b 100644
--- a/arch/arm/mach-vt8500/vt8500.c
+++ b/arch/arm/mach-vt8500/vt8500.c
@@ -18,7 +18,6 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21#include <linux/clocksource.h>
22#include <linux/io.h> 21#include <linux/io.h>
23#include <linux/pm.h> 22#include <linux/pm.h>
24#include <linux/reboot.h> 23#include <linux/reboot.h>
@@ -33,8 +32,6 @@
33#include <linux/of_irq.h> 32#include <linux/of_irq.h>
34#include <linux/of_platform.h> 33#include <linux/of_platform.h>
35 34
36#include "common.h"
37
38#define LEGACY_GPIO_BASE 0xD8110000 35#define LEGACY_GPIO_BASE 0xD8110000
39#define LEGACY_PMC_BASE 0xD8130000 36#define LEGACY_PMC_BASE 0xD8130000
40 37
@@ -162,8 +159,6 @@ void __init vt8500_init(void)
162 else 159 else
163 pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__); 160 pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__);
164 161
165 vtwm_clk_init(pmc_base);
166
167 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 162 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
168} 163}
169 164
@@ -180,7 +175,6 @@ DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)")
180 .dt_compat = vt8500_dt_compat, 175 .dt_compat = vt8500_dt_compat,
181 .map_io = vt8500_map_io, 176 .map_io = vt8500_map_io,
182 .init_machine = vt8500_init, 177 .init_machine = vt8500_init,
183 .init_time = clocksource_of_init,
184 .restart = vt8500_restart, 178 .restart = vt8500_restart,
185MACHINE_END 179MACHINE_END
186 180
diff --git a/arch/arm/mach-w90x900/include/mach/gpio.h b/arch/arm/mach-w90x900/include/mach/gpio.h
deleted file mode 100644
index 5385a4203277..000000000000
--- a/arch/arm/mach-w90x900/include/mach/gpio.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * linux/arch/arm/mach-w90p910/include/mach/gpio.h
3 *
4 * Generic w90p910 GPIO handling
5 *
6 * Wan ZongShun <mcuos.com@gmail.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#ifndef __ASM_ARCH_W90P910_GPIO_H
14#define __ASM_ARCH_W90P910_GPIO_H
15
16#include <mach/hardware.h>
17#include <asm/irq.h>
18
19static inline int gpio_to_irq(unsigned gpio)
20{
21 return gpio;
22}
23#define gpio_to_irq gpio_to_irq
24
25static inline int irq_to_gpio(unsigned irq)
26{
27 return irq;
28}
29
30#endif
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig
index 04f8a4a6e755..6b04260aa142 100644
--- a/arch/arm/mach-zynq/Kconfig
+++ b/arch/arm/mach-zynq/Kconfig
@@ -13,5 +13,6 @@ config ARCH_ZYNQ
13 select HAVE_SMP 13 select HAVE_SMP
14 select SPARSE_IRQ 14 select SPARSE_IRQ
15 select CADENCE_TTC_TIMER 15 select CADENCE_TTC_TIMER
16 select ARM_GLOBAL_TIMER
16 help 17 help
17 Support for Xilinx Zynq ARM Cortex A9 Platform 18 Support for Xilinx Zynq ARM Cortex A9 Platform
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index 5f252569c689..9a7bd137c8fd 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -44,6 +44,10 @@ static struct of_device_id zynq_of_bus_ids[] __initdata = {
44 {} 44 {}
45}; 45};
46 46
47static struct platform_device zynq_cpuidle_device = {
48 .name = "cpuidle-zynq",
49};
50
47/** 51/**
48 * zynq_init_machine - System specific initialization, intended to be 52 * zynq_init_machine - System specific initialization, intended to be
49 * called from board specific initialization. 53 * called from board specific initialization.
@@ -56,6 +60,8 @@ static void __init zynq_init_machine(void)
56 l2x0_of_init(0x02060000, 0xF0F0FFFF); 60 l2x0_of_init(0x02060000, 0xF0F0FFFF);
57 61
58 of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL); 62 of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL);
63
64 platform_device_register(&zynq_cpuidle_device);
59} 65}
60 66
61static void __init zynq_timer_init(void) 67static void __init zynq_timer_init(void)
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index cd2c88e7a8f7..1f8fed94c2a4 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -952,3 +952,9 @@ config ARCH_HAS_BARRIERS
952 help 952 help
953 This option allows the use of custom mandatory barriers 953 This option allows the use of custom mandatory barriers
954 included via the mach/barriers.h file. 954 included via the mach/barriers.h file.
955
956config ARCH_SUPPORTS_BIG_ENDIAN
957 bool
958 help
959 This option specifies the architecture can support big endian
960 operation.
diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S
index 80741992a9fc..3815a8262af0 100644
--- a/arch/arm/mm/abort-ev6.S
+++ b/arch/arm/mm/abort-ev6.S
@@ -38,9 +38,8 @@ ENTRY(v6_early_abort)
38 bne do_DataAbort 38 bne do_DataAbort
39 bic r1, r1, #1 << 11 @ clear bit 11 of FSR 39 bic r1, r1, #1 << 11 @ clear bit 11 of FSR
40 ldr r3, [r4] @ read aborted ARM instruction 40 ldr r3, [r4] @ read aborted ARM instruction
41#ifdef CONFIG_CPU_ENDIAN_BE8 41 ARM_BE8(rev r3, r3)
42 rev r3, r3 42
43#endif
44 do_ldrd_abort tmp=ip, insn=r3 43 do_ldrd_abort tmp=ip, insn=r3
45 tst r3, #1 << 20 @ L = 0 -> write 44 tst r3, #1 << 20 @ L = 0 -> write
46 orreq r1, r1, #1 << 11 @ yes. 45 orreq r1, r1, #1 << 11 @ yes.
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 6f4585b89078..924036473b16 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -25,6 +25,7 @@
25#include <asm/cp15.h> 25#include <asm/cp15.h>
26#include <asm/system_info.h> 26#include <asm/system_info.h>
27#include <asm/unaligned.h> 27#include <asm/unaligned.h>
28#include <asm/opcodes.h>
28 29
29#include "fault.h" 30#include "fault.h"
30 31
@@ -762,21 +763,25 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
762 if (thumb_mode(regs)) { 763 if (thumb_mode(regs)) {
763 u16 *ptr = (u16 *)(instrptr & ~1); 764 u16 *ptr = (u16 *)(instrptr & ~1);
764 fault = probe_kernel_address(ptr, tinstr); 765 fault = probe_kernel_address(ptr, tinstr);
766 tinstr = __mem_to_opcode_thumb16(tinstr);
765 if (!fault) { 767 if (!fault) {
766 if (cpu_architecture() >= CPU_ARCH_ARMv7 && 768 if (cpu_architecture() >= CPU_ARCH_ARMv7 &&
767 IS_T32(tinstr)) { 769 IS_T32(tinstr)) {
768 /* Thumb-2 32-bit */ 770 /* Thumb-2 32-bit */
769 u16 tinst2 = 0; 771 u16 tinst2 = 0;
770 fault = probe_kernel_address(ptr + 1, tinst2); 772 fault = probe_kernel_address(ptr + 1, tinst2);
771 instr = (tinstr << 16) | tinst2; 773 tinst2 = __mem_to_opcode_thumb16(tinst2);
774 instr = __opcode_thumb32_compose(tinstr, tinst2);
772 thumb2_32b = 1; 775 thumb2_32b = 1;
773 } else { 776 } else {
774 isize = 2; 777 isize = 2;
775 instr = thumb2arm(tinstr); 778 instr = thumb2arm(tinstr);
776 } 779 }
777 } 780 }
778 } else 781 } else {
779 fault = probe_kernel_address(instrptr, instr); 782 fault = probe_kernel_address(instrptr, instr);
783 instr = __mem_to_opcode_arm(instr);
784 }
780 785
781 if (fault) { 786 if (fault) {
782 type = TYPE_FAULT; 787 type = TYPE_FAULT;
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index f5e1a8471714..79f8b39801a8 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -159,7 +159,7 @@ EXPORT_SYMBOL(arm_coherent_dma_ops);
159 159
160static u64 get_coherent_dma_mask(struct device *dev) 160static u64 get_coherent_dma_mask(struct device *dev)
161{ 161{
162 u64 mask = (u64)arm_dma_limit; 162 u64 mask = (u64)DMA_BIT_MASK(32);
163 163
164 if (dev) { 164 if (dev) {
165 mask = dev->coherent_dma_mask; 165 mask = dev->coherent_dma_mask;
@@ -173,10 +173,30 @@ static u64 get_coherent_dma_mask(struct device *dev)
173 return 0; 173 return 0;
174 } 174 }
175 175
176 if ((~mask) & (u64)arm_dma_limit) { 176 /*
177 dev_warn(dev, "coherent DMA mask %#llx is smaller " 177 * If the mask allows for more memory than we can address,
178 "than system GFP_DMA mask %#llx\n", 178 * and we actually have that much memory, then fail the
179 mask, (u64)arm_dma_limit); 179 * allocation.
180 */
181 if (sizeof(mask) != sizeof(dma_addr_t) &&
182 mask > (dma_addr_t)~0 &&
183 dma_to_pfn(dev, ~0) > arm_dma_pfn_limit) {
184 dev_warn(dev, "Coherent DMA mask %#llx is larger than dma_addr_t allows\n",
185 mask);
186 dev_warn(dev, "Driver did not use or check the return value from dma_set_coherent_mask()?\n");
187 return 0;
188 }
189
190 /*
191 * Now check that the mask, when translated to a PFN,
192 * fits within the allowable addresses which we can
193 * allocate.
194 */
195 if (dma_to_pfn(dev, mask) < arm_dma_pfn_limit) {
196 dev_warn(dev, "Coherent DMA mask %#llx (pfn %#lx-%#lx) covers a smaller range of system memory than the DMA zone pfn 0x0-%#lx\n",
197 mask,
198 dma_to_pfn(dev, 0), dma_to_pfn(dev, mask) + 1,
199 arm_dma_pfn_limit + 1);
180 return 0; 200 return 0;
181 } 201 }
182 } 202 }
@@ -687,7 +707,7 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
687void *arm_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, 707void *arm_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
688 gfp_t gfp, struct dma_attrs *attrs) 708 gfp_t gfp, struct dma_attrs *attrs)
689{ 709{
690 pgprot_t prot = __get_dma_pgprot(attrs, pgprot_kernel); 710 pgprot_t prot = __get_dma_pgprot(attrs, PAGE_KERNEL);
691 void *memory; 711 void *memory;
692 712
693 if (dma_alloc_from_coherent(dev, size, handle, &memory)) 713 if (dma_alloc_from_coherent(dev, size, handle, &memory))
@@ -700,7 +720,7 @@ void *arm_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
700static void *arm_coherent_dma_alloc(struct device *dev, size_t size, 720static void *arm_coherent_dma_alloc(struct device *dev, size_t size,
701 dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs) 721 dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs)
702{ 722{
703 pgprot_t prot = __get_dma_pgprot(attrs, pgprot_kernel); 723 pgprot_t prot = __get_dma_pgprot(attrs, PAGE_KERNEL);
704 void *memory; 724 void *memory;
705 725
706 if (dma_alloc_from_coherent(dev, size, handle, &memory)) 726 if (dma_alloc_from_coherent(dev, size, handle, &memory))
@@ -1007,8 +1027,27 @@ void arm_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
1007 */ 1027 */
1008int dma_supported(struct device *dev, u64 mask) 1028int dma_supported(struct device *dev, u64 mask)
1009{ 1029{
1010 if (mask < (u64)arm_dma_limit) 1030 unsigned long limit;
1031
1032 /*
1033 * If the mask allows for more memory than we can address,
1034 * and we actually have that much memory, then we must
1035 * indicate that DMA to this device is not supported.
1036 */
1037 if (sizeof(mask) != sizeof(dma_addr_t) &&
1038 mask > (dma_addr_t)~0 &&
1039 dma_to_pfn(dev, ~0) > arm_dma_pfn_limit)
1040 return 0;
1041
1042 /*
1043 * Translate the device's DMA mask to a PFN limit. This
1044 * PFN number includes the page which we can DMA to.
1045 */
1046 limit = dma_to_pfn(dev, mask);
1047
1048 if (limit < arm_dma_pfn_limit)
1011 return 0; 1049 return 0;
1050
1012 return 1; 1051 return 1;
1013} 1052}
1014EXPORT_SYMBOL(dma_supported); 1053EXPORT_SYMBOL(dma_supported);
@@ -1232,7 +1271,8 @@ __iommu_create_mapping(struct device *dev, struct page **pages, size_t size)
1232 break; 1271 break;
1233 1272
1234 len = (j - i) << PAGE_SHIFT; 1273 len = (j - i) << PAGE_SHIFT;
1235 ret = iommu_map(mapping->domain, iova, phys, len, 0); 1274 ret = iommu_map(mapping->domain, iova, phys, len,
1275 IOMMU_READ|IOMMU_WRITE);
1236 if (ret < 0) 1276 if (ret < 0)
1237 goto fail; 1277 goto fail;
1238 iova += len; 1278 iova += len;
@@ -1431,6 +1471,27 @@ static int arm_iommu_get_sgtable(struct device *dev, struct sg_table *sgt,
1431 GFP_KERNEL); 1471 GFP_KERNEL);
1432} 1472}
1433 1473
1474static int __dma_direction_to_prot(enum dma_data_direction dir)
1475{
1476 int prot;
1477
1478 switch (dir) {
1479 case DMA_BIDIRECTIONAL:
1480 prot = IOMMU_READ | IOMMU_WRITE;
1481 break;
1482 case DMA_TO_DEVICE:
1483 prot = IOMMU_READ;
1484 break;
1485 case DMA_FROM_DEVICE:
1486 prot = IOMMU_WRITE;
1487 break;
1488 default:
1489 prot = 0;
1490 }
1491
1492 return prot;
1493}
1494
1434/* 1495/*
1435 * Map a part of the scatter-gather list into contiguous io address space 1496 * Map a part of the scatter-gather list into contiguous io address space
1436 */ 1497 */
@@ -1444,6 +1505,7 @@ static int __map_sg_chunk(struct device *dev, struct scatterlist *sg,
1444 int ret = 0; 1505 int ret = 0;
1445 unsigned int count; 1506 unsigned int count;
1446 struct scatterlist *s; 1507 struct scatterlist *s;
1508 int prot;
1447 1509
1448 size = PAGE_ALIGN(size); 1510 size = PAGE_ALIGN(size);
1449 *handle = DMA_ERROR_CODE; 1511 *handle = DMA_ERROR_CODE;
@@ -1460,7 +1522,9 @@ static int __map_sg_chunk(struct device *dev, struct scatterlist *sg,
1460 !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) 1522 !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs))
1461 __dma_page_cpu_to_dev(sg_page(s), s->offset, s->length, dir); 1523 __dma_page_cpu_to_dev(sg_page(s), s->offset, s->length, dir);
1462 1524
1463 ret = iommu_map(mapping->domain, iova, phys, len, 0); 1525 prot = __dma_direction_to_prot(dir);
1526
1527 ret = iommu_map(mapping->domain, iova, phys, len, prot);
1464 if (ret < 0) 1528 if (ret < 0)
1465 goto fail; 1529 goto fail;
1466 count += len >> PAGE_SHIFT; 1530 count += len >> PAGE_SHIFT;
@@ -1665,19 +1729,7 @@ static dma_addr_t arm_coherent_iommu_map_page(struct device *dev, struct page *p
1665 if (dma_addr == DMA_ERROR_CODE) 1729 if (dma_addr == DMA_ERROR_CODE)
1666 return dma_addr; 1730 return dma_addr;
1667 1731
1668 switch (dir) { 1732 prot = __dma_direction_to_prot(dir);
1669 case DMA_BIDIRECTIONAL:
1670 prot = IOMMU_READ | IOMMU_WRITE;
1671 break;
1672 case DMA_TO_DEVICE:
1673 prot = IOMMU_READ;
1674 break;
1675 case DMA_FROM_DEVICE:
1676 prot = IOMMU_WRITE;
1677 break;
1678 default:
1679 prot = 0;
1680 }
1681 1733
1682 ret = iommu_map(mapping->domain, dma_addr, page_to_phys(page), len, prot); 1734 ret = iommu_map(mapping->domain, dma_addr, page_to_phys(page), len, prot);
1683 if (ret < 0) 1735 if (ret < 0)
diff --git a/arch/arm/mm/extable.c b/arch/arm/mm/extable.c
index 9d285626bc7d..312e15e6d00b 100644
--- a/arch/arm/mm/extable.c
+++ b/arch/arm/mm/extable.c
@@ -9,8 +9,13 @@ int fixup_exception(struct pt_regs *regs)
9 const struct exception_table_entry *fixup; 9 const struct exception_table_entry *fixup;
10 10
11 fixup = search_exception_tables(instruction_pointer(regs)); 11 fixup = search_exception_tables(instruction_pointer(regs));
12 if (fixup) 12 if (fixup) {
13 regs->ARM_pc = fixup->fixup; 13 regs->ARM_pc = fixup->fixup;
14#ifdef CONFIG_THUMB2_KERNEL
15 /* Clear the IT state to avoid nasty surprises in the fixup */
16 regs->ARM_cpsr &= ~PSR_IT_MASK;
17#endif
18 }
14 19
15 return fixup != NULL; 20 return fixup != NULL;
16} 21}
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c
index 2a5907b5c8d2..ff379ac115df 100644
--- a/arch/arm/mm/fault-armv.c
+++ b/arch/arm/mm/fault-armv.c
@@ -65,7 +65,7 @@ static int do_adjust_pte(struct vm_area_struct *vma, unsigned long address,
65 return ret; 65 return ret;
66} 66}
67 67
68#if USE_SPLIT_PTLOCKS 68#if USE_SPLIT_PTE_PTLOCKS
69/* 69/*
70 * If we are using split PTE locks, then we need to take the page 70 * If we are using split PTE locks, then we need to take the page
71 * lock here. Otherwise we are using shared mm->page_table_lock 71 * lock here. Otherwise we are using shared mm->page_table_lock
@@ -84,10 +84,10 @@ static inline void do_pte_unlock(spinlock_t *ptl)
84{ 84{
85 spin_unlock(ptl); 85 spin_unlock(ptl);
86} 86}
87#else /* !USE_SPLIT_PTLOCKS */ 87#else /* !USE_SPLIT_PTE_PTLOCKS */
88static inline void do_pte_lock(spinlock_t *ptl) {} 88static inline void do_pte_lock(spinlock_t *ptl) {}
89static inline void do_pte_unlock(spinlock_t *ptl) {} 89static inline void do_pte_unlock(spinlock_t *ptl) {}
90#endif /* USE_SPLIT_PTLOCKS */ 90#endif /* USE_SPLIT_PTE_PTLOCKS */
91 91
92static int adjust_pte(struct vm_area_struct *vma, unsigned long address, 92static int adjust_pte(struct vm_area_struct *vma, unsigned long address,
93 unsigned long pfn) 93 unsigned long pfn)
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
index 83cb3ac27095..8e0e52eb76b5 100644
--- a/arch/arm/mm/idmap.c
+++ b/arch/arm/mm/idmap.c
@@ -10,6 +10,7 @@
10#include <asm/system_info.h> 10#include <asm/system_info.h>
11 11
12pgd_t *idmap_pgd; 12pgd_t *idmap_pgd;
13phys_addr_t (*arch_virt_to_idmap) (unsigned long x);
13 14
14#ifdef CONFIG_ARM_LPAE 15#ifdef CONFIG_ARM_LPAE
15static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end, 16static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end,
@@ -67,8 +68,9 @@ static void identity_mapping_add(pgd_t *pgd, const char *text_start,
67 unsigned long addr, end; 68 unsigned long addr, end;
68 unsigned long next; 69 unsigned long next;
69 70
70 addr = virt_to_phys(text_start); 71 addr = virt_to_idmap(text_start);
71 end = virt_to_phys(text_end); 72 end = virt_to_idmap(text_end);
73 pr_info("Setting up static identity map for 0x%lx - 0x%lx\n", addr, end);
72 74
73 prot |= PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_AF; 75 prot |= PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_AF;
74 76
@@ -90,8 +92,6 @@ static int __init init_static_idmap(void)
90 if (!idmap_pgd) 92 if (!idmap_pgd)
91 return -ENOMEM; 93 return -ENOMEM;
92 94
93 pr_info("Setting up static identity map for 0x%p - 0x%p\n",
94 __idmap_text_start, __idmap_text_end);
95 identity_mapping_add(idmap_pgd, __idmap_text_start, 95 identity_mapping_add(idmap_pgd, __idmap_text_start,
96 __idmap_text_end, 0); 96 __idmap_text_end, 0);
97 97
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index febaee7ca57b..3e8f106ee5fe 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -17,7 +17,6 @@
17#include <linux/nodemask.h> 17#include <linux/nodemask.h>
18#include <linux/initrd.h> 18#include <linux/initrd.h>
19#include <linux/of_fdt.h> 19#include <linux/of_fdt.h>
20#include <linux/of_reserved_mem.h>
21#include <linux/highmem.h> 20#include <linux/highmem.h>
22#include <linux/gfp.h> 21#include <linux/gfp.h>
23#include <linux/memblock.h> 22#include <linux/memblock.h>
@@ -77,14 +76,6 @@ static int __init parse_tag_initrd2(const struct tag *tag)
77 76
78__tagtable(ATAG_INITRD2, parse_tag_initrd2); 77__tagtable(ATAG_INITRD2, parse_tag_initrd2);
79 78
80#ifdef CONFIG_OF_FLATTREE
81void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
82{
83 phys_initrd_start = start;
84 phys_initrd_size = end - start;
85}
86#endif /* CONFIG_OF_FLATTREE */
87
88/* 79/*
89 * This keeps memory configuration data used by a couple memory 80 * This keeps memory configuration data used by a couple memory
90 * initialization functions, as well as show_mem() for the skipping 81 * initialization functions, as well as show_mem() for the skipping
@@ -218,6 +209,7 @@ EXPORT_SYMBOL(arm_dma_zone_size);
218 * so a successful GFP_DMA allocation will always satisfy this. 209 * so a successful GFP_DMA allocation will always satisfy this.
219 */ 210 */
220phys_addr_t arm_dma_limit; 211phys_addr_t arm_dma_limit;
212unsigned long arm_dma_pfn_limit;
221 213
222static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole, 214static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole,
223 unsigned long dma_size) 215 unsigned long dma_size)
@@ -240,6 +232,7 @@ void __init setup_dma_zone(const struct machine_desc *mdesc)
240 arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1; 232 arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1;
241 } else 233 } else
242 arm_dma_limit = 0xffffffff; 234 arm_dma_limit = 0xffffffff;
235 arm_dma_pfn_limit = arm_dma_limit >> PAGE_SHIFT;
243#endif 236#endif
244} 237}
245 238
@@ -351,6 +344,11 @@ void __init arm_memblock_init(struct meminfo *mi,
351 memblock_reserve(__pa(_stext), _end - _stext); 344 memblock_reserve(__pa(_stext), _end - _stext);
352#endif 345#endif
353#ifdef CONFIG_BLK_DEV_INITRD 346#ifdef CONFIG_BLK_DEV_INITRD
347 /* FDT scan will populate initrd_start */
348 if (initrd_start) {
349 phys_initrd_start = __virt_to_phys(initrd_start);
350 phys_initrd_size = initrd_end - initrd_start;
351 }
354 if (phys_initrd_size && 352 if (phys_initrd_size &&
355 !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) { 353 !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) {
356 pr_err("INITRD: 0x%08llx+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",
@@ -379,8 +377,6 @@ void __init arm_memblock_init(struct meminfo *mi,
379 if (mdesc->reserve) 377 if (mdesc->reserve)
380 mdesc->reserve(); 378 mdesc->reserve();
381 379
382 early_init_dt_scan_reserved_mem();
383
384 /* 380 /*
385 * reserve memory for DMA contigouos allocations, 381 * reserve memory for DMA contigouos allocations,
386 * must come from DMA area inside low memory 382 * must come from DMA area inside low memory
@@ -424,12 +420,10 @@ void __init bootmem_init(void)
424 * This doesn't seem to be used by the Linux memory manager any 420 * This doesn't seem to be used by the Linux memory manager any
425 * more, but is used by ll_rw_block. If we can get rid of it, we 421 * more, but is used by ll_rw_block. If we can get rid of it, we
426 * also get rid of some of the stuff above as well. 422 * also get rid of some of the stuff above as well.
427 *
428 * Note: max_low_pfn and max_pfn reflect the number of _pages_ in
429 * the system, not the maximum PFN.
430 */ 423 */
431 max_low_pfn = max_low - PHYS_PFN_OFFSET; 424 min_low_pfn = min;
432 max_pfn = max_high - PHYS_PFN_OFFSET; 425 max_low_pfn = max_low;
426 max_pfn = max_high;
433} 427}
434 428
435/* 429/*
@@ -535,7 +529,7 @@ static inline void free_area_high(unsigned long pfn, unsigned long end)
535static void __init free_highpages(void) 529static void __init free_highpages(void)
536{ 530{
537#ifdef CONFIG_HIGHMEM 531#ifdef CONFIG_HIGHMEM
538 unsigned long max_low = max_low_pfn + PHYS_PFN_OFFSET; 532 unsigned long max_low = max_low_pfn;
539 struct memblock_region *mem, *res; 533 struct memblock_region *mem, *res;
540 534
541 /* set highmem page free */ 535 /* set highmem page free */
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h
index d5a4e9ad8f0f..d5a982d15a88 100644
--- a/arch/arm/mm/mm.h
+++ b/arch/arm/mm/mm.h
@@ -81,8 +81,10 @@ extern __init void add_static_vm_early(struct static_vm *svm);
81 81
82#ifdef CONFIG_ZONE_DMA 82#ifdef CONFIG_ZONE_DMA
83extern phys_addr_t arm_dma_limit; 83extern phys_addr_t arm_dma_limit;
84extern unsigned long arm_dma_pfn_limit;
84#else 85#else
85#define arm_dma_limit ((phys_addr_t)~0) 86#define arm_dma_limit ((phys_addr_t)~0)
87#define arm_dma_pfn_limit (~0ul >> PAGE_SHIFT)
86#endif 88#endif
87 89
88extern phys_addr_t arm_lowmem_limit; 90extern phys_addr_t arm_lowmem_limit;
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index 0c6356255fe3..d27158c38eb0 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -202,13 +202,11 @@ int valid_phys_addr_range(phys_addr_t addr, size_t size)
202} 202}
203 203
204/* 204/*
205 * We don't use supersection mappings for mmap() on /dev/mem, which 205 * Do not allow /dev/mem mappings beyond the supported physical range.
206 * means that we can't map the memory area above the 4G barrier into
207 * userspace.
208 */ 206 */
209int valid_mmap_phys_addr_range(unsigned long pfn, size_t size) 207int valid_mmap_phys_addr_range(unsigned long pfn, size_t size)
210{ 208{
211 return !(pfn + (size >> PAGE_SHIFT) > 0x00100000); 209 return (pfn + (size >> PAGE_SHIFT)) <= (1 + (PHYS_MASK >> PAGE_SHIFT));
212} 210}
213 211
214#ifdef CONFIG_STRICT_DEVMEM 212#ifdef CONFIG_STRICT_DEVMEM
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index b1d17eeb59b8..78eeeca78f5a 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -28,6 +28,8 @@
28#include <asm/highmem.h> 28#include <asm/highmem.h>
29#include <asm/system_info.h> 29#include <asm/system_info.h>
30#include <asm/traps.h> 30#include <asm/traps.h>
31#include <asm/procinfo.h>
32#include <asm/memory.h>
31 33
32#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
33#include <asm/mach/map.h> 35#include <asm/mach/map.h>
@@ -1315,6 +1317,86 @@ static void __init map_lowmem(void)
1315 } 1317 }
1316} 1318}
1317 1319
1320#ifdef CONFIG_ARM_LPAE
1321/*
1322 * early_paging_init() recreates boot time page table setup, allowing machines
1323 * to switch over to a high (>4G) address space on LPAE systems
1324 */
1325void __init early_paging_init(const struct machine_desc *mdesc,
1326 struct proc_info_list *procinfo)
1327{
1328 pmdval_t pmdprot = procinfo->__cpu_mm_mmu_flags;
1329 unsigned long map_start, map_end;
1330 pgd_t *pgd0, *pgdk;
1331 pud_t *pud0, *pudk, *pud_start;
1332 pmd_t *pmd0, *pmdk;
1333 phys_addr_t phys;
1334 int i;
1335
1336 if (!(mdesc->init_meminfo))
1337 return;
1338
1339 /* remap kernel code and data */
1340 map_start = init_mm.start_code;
1341 map_end = init_mm.brk;
1342
1343 /* get a handle on things... */
1344 pgd0 = pgd_offset_k(0);
1345 pud_start = pud0 = pud_offset(pgd0, 0);
1346 pmd0 = pmd_offset(pud0, 0);
1347
1348 pgdk = pgd_offset_k(map_start);
1349 pudk = pud_offset(pgdk, map_start);
1350 pmdk = pmd_offset(pudk, map_start);
1351
1352 mdesc->init_meminfo();
1353
1354 /* Run the patch stub to update the constants */
1355 fixup_pv_table(&__pv_table_begin,
1356 (&__pv_table_end - &__pv_table_begin) << 2);
1357
1358 /*
1359 * Cache cleaning operations for self-modifying code
1360 * We should clean the entries by MVA but running a
1361 * for loop over every pv_table entry pointer would
1362 * just complicate the code.
1363 */
1364 flush_cache_louis();
1365 dsb();
1366 isb();
1367
1368 /* remap level 1 table */
1369 for (i = 0; i < PTRS_PER_PGD; pud0++, i++) {
1370 set_pud(pud0,
1371 __pud(__pa(pmd0) | PMD_TYPE_TABLE | L_PGD_SWAPPER));
1372 pmd0 += PTRS_PER_PMD;
1373 }
1374
1375 /* remap pmds for kernel mapping */
1376 phys = __pa(map_start) & PMD_MASK;
1377 do {
1378 *pmdk++ = __pmd(phys | pmdprot);
1379 phys += PMD_SIZE;
1380 } while (phys < map_end);
1381
1382 flush_cache_all();
1383 cpu_switch_mm(pgd0, &init_mm);
1384 cpu_set_ttbr(1, __pa(pgd0) + TTBR1_OFFSET);
1385 local_flush_bp_all();
1386 local_flush_tlb_all();
1387}
1388
1389#else
1390
1391void __init early_paging_init(const struct machine_desc *mdesc,
1392 struct proc_info_list *procinfo)
1393{
1394 if (mdesc->init_meminfo)
1395 mdesc->init_meminfo();
1396}
1397
1398#endif
1399
1318/* 1400/*
1319 * paging_init() sets up the page tables, initialises the zone memory 1401 * paging_init() sets up the page tables, initialises the zone memory
1320 * maps, and sets up the zero page, bad page and bad page tables. 1402 * maps, and sets up the zero page, bad page and bad page tables.
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 34d4ab217bab..5c668b7a31f9 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -296,6 +296,15 @@ void __init sanity_check_meminfo(void)
296} 296}
297 297
298/* 298/*
299 * early_paging_init() recreates boot time page table setup, allowing machines
300 * to switch over to a high (>4G) address space on LPAE systems
301 */
302void __init early_paging_init(const struct machine_desc *mdesc,
303 struct proc_info_list *procinfo)
304{
305}
306
307/*
299 * paging_init() sets up the page tables, initialises the zone memory 308 * paging_init() sets up the page tables, initialises the zone memory
300 * maps, and sets up the zero page, bad page and bad page tables. 309 * maps, and sets up the zero page, bad page and bad page tables.
301 */ 310 */
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 1128064fddcb..45dc29f85d56 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -220,9 +220,7 @@ __v6_setup:
220#endif /* CONFIG_MMU */ 220#endif /* CONFIG_MMU */
221 adr r5, v6_crval 221 adr r5, v6_crval
222 ldmia r5, {r5, r6} 222 ldmia r5, {r5, r6}
223#ifdef CONFIG_CPU_ENDIAN_BE8 223 ARM_BE8(orr r6, r6, #1 << 25) @ big-endian page tables
224 orr r6, r6, #1 << 25 @ big-endian page tables
225#endif
226 mrc p15, 0, r0, c1, c0, 0 @ read control register 224 mrc p15, 0, r0, c1, c0, 0 @ read control register
227 bic r0, r0, r5 @ clear bits them 225 bic r0, r0, r5 @ clear bits them
228 orr r0, r0, r6 @ set them 226 orr r0, r0, r6 @ set them
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index c63d9bdee51e..60920f62fdf5 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -367,9 +367,7 @@ __v7_setup:
367#endif 367#endif
368 adr r5, v7_crval 368 adr r5, v7_crval
369 ldmia r5, {r5, r6} 369 ldmia r5, {r5, r6}
370#ifdef CONFIG_CPU_ENDIAN_BE8 370 ARM_BE8(orr r6, r6, #1 << 25) @ big-endian page tables
371 orr r6, r6, #1 << 25 @ big-endian page tables
372#endif
373#ifdef CONFIG_SWP_EMULATE 371#ifdef CONFIG_SWP_EMULATE
374 orr r5, r5, #(1 << 10) @ set SW bit in "clear" 372 orr r5, r5, #(1 << 10) @ set SW bit in "clear"
375 bic r6, r6, #(1 << 10) @ clear it in "mmuset" 373 bic r6, r6, #(1 << 10) @ clear it in "mmuset"
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
index f50d223a0bd3..9ed155ad0f97 100644
--- a/arch/arm/net/bpf_jit_32.c
+++ b/arch/arm/net/bpf_jit_32.c
@@ -19,6 +19,7 @@
19#include <linux/if_vlan.h> 19#include <linux/if_vlan.h>
20#include <asm/cacheflush.h> 20#include <asm/cacheflush.h>
21#include <asm/hwcap.h> 21#include <asm/hwcap.h>
22#include <asm/opcodes.h>
22 23
23#include "bpf_jit_32.h" 24#include "bpf_jit_32.h"
24 25
@@ -113,8 +114,11 @@ static u32 jit_udiv(u32 dividend, u32 divisor)
113 114
114static inline void _emit(int cond, u32 inst, struct jit_ctx *ctx) 115static inline void _emit(int cond, u32 inst, struct jit_ctx *ctx)
115{ 116{
117 inst |= (cond << 28);
118 inst = __opcode_to_mem_arm(inst);
119
116 if (ctx->target != NULL) 120 if (ctx->target != NULL)
117 ctx->target[ctx->idx] = inst | (cond << 28); 121 ctx->target[ctx->idx] = inst;
118 122
119 ctx->idx++; 123 ctx->idx++;
120} 124}
@@ -930,4 +934,5 @@ void bpf_jit_free(struct sk_filter *fp)
930{ 934{
931 if (fp->bpf_func != sk_run_filter) 935 if (fp->bpf_func != sk_run_filter)
932 module_free(NULL, fp->bpf_func); 936 module_free(NULL, fp->bpf_func);
937 kfree(fp);
933} 938}
diff --git a/arch/arm/plat-iop/Makefile b/arch/arm/plat-iop/Makefile
index a99dc15a70f7..224e56c6049b 100644
--- a/arch/arm/plat-iop/Makefile
+++ b/arch/arm/plat-iop/Makefile
@@ -5,7 +5,6 @@
5obj-y := 5obj-y :=
6 6
7# IOP32X 7# IOP32X
8obj-$(CONFIG_ARCH_IOP32X) += gpio.o
9obj-$(CONFIG_ARCH_IOP32X) += i2c.o 8obj-$(CONFIG_ARCH_IOP32X) += i2c.o
10obj-$(CONFIG_ARCH_IOP32X) += pci.o 9obj-$(CONFIG_ARCH_IOP32X) += pci.o
11obj-$(CONFIG_ARCH_IOP32X) += setup.o 10obj-$(CONFIG_ARCH_IOP32X) += setup.o
@@ -16,7 +15,6 @@ obj-$(CONFIG_ARCH_IOP32X) += pmu.o
16obj-$(CONFIG_ARCH_IOP32X) += restart.o 15obj-$(CONFIG_ARCH_IOP32X) += restart.o
17 16
18# IOP33X 17# IOP33X
19obj-$(CONFIG_ARCH_IOP33X) += gpio.o
20obj-$(CONFIG_ARCH_IOP33X) += i2c.o 18obj-$(CONFIG_ARCH_IOP33X) += i2c.o
21obj-$(CONFIG_ARCH_IOP33X) += pci.o 19obj-$(CONFIG_ARCH_IOP33X) += pci.o
22obj-$(CONFIG_ARCH_IOP33X) += setup.o 20obj-$(CONFIG_ARCH_IOP33X) += setup.o
diff --git a/arch/arm/plat-iop/gpio.c b/arch/arm/plat-iop/gpio.c
deleted file mode 100644
index 697de6dc4936..000000000000
--- a/arch/arm/plat-iop/gpio.c
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * arch/arm/plat-iop/gpio.c
3 * GPIO handling for Intel IOP3xx processors.
4 *
5 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
11 */
12
13#include <linux/device.h>
14#include <linux/init.h>
15#include <linux/types.h>
16#include <linux/errno.h>
17#include <linux/gpio.h>
18#include <linux/export.h>
19#include <asm/hardware/iop3xx.h>
20#include <mach/gpio.h>
21
22void gpio_line_config(int line, int direction)
23{
24 unsigned long flags;
25
26 local_irq_save(flags);
27 if (direction == GPIO_IN) {
28 *IOP3XX_GPOE |= 1 << line;
29 } else if (direction == GPIO_OUT) {
30 *IOP3XX_GPOE &= ~(1 << line);
31 }
32 local_irq_restore(flags);
33}
34EXPORT_SYMBOL(gpio_line_config);
35
36int gpio_line_get(int line)
37{
38 return !!(*IOP3XX_GPID & (1 << line));
39}
40EXPORT_SYMBOL(gpio_line_get);
41
42void gpio_line_set(int line, int value)
43{
44 unsigned long flags;
45
46 local_irq_save(flags);
47 if (value == GPIO_LOW) {
48 *IOP3XX_GPOD &= ~(1 << line);
49 } else if (value == GPIO_HIGH) {
50 *IOP3XX_GPOD |= 1 << line;
51 }
52 local_irq_restore(flags);
53}
54EXPORT_SYMBOL(gpio_line_set);
55
56static int iop3xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
57{
58 gpio_line_config(gpio, GPIO_IN);
59 return 0;
60}
61
62static int iop3xx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int level)
63{
64 gpio_line_set(gpio, level);
65 gpio_line_config(gpio, GPIO_OUT);
66 return 0;
67}
68
69static int iop3xx_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
70{
71 return gpio_line_get(gpio);
72}
73
74static void iop3xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
75{
76 gpio_line_set(gpio, value);
77}
78
79static struct gpio_chip iop3xx_chip = {
80 .label = "iop3xx",
81 .direction_input = iop3xx_gpio_direction_input,
82 .get = iop3xx_gpio_get_value,
83 .direction_output = iop3xx_gpio_direction_output,
84 .set = iop3xx_gpio_set_value,
85 .base = 0,
86 .ngpio = IOP3XX_N_GPIOS,
87};
88
89static int __init iop3xx_gpio_setup(void)
90{
91 return gpiochip_add(&iop3xx_chip);
92}
93arch_initcall(iop3xx_gpio_setup);
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 037660633fa4..01619c2910e3 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -1965,7 +1965,6 @@ static irqreturn_t omap2_dma_irq_handler(int irq, void *dev_id)
1965static struct irqaction omap24xx_dma_irq = { 1965static struct irqaction omap24xx_dma_irq = {
1966 .name = "DMA", 1966 .name = "DMA",
1967 .handler = omap2_dma_irq_handler, 1967 .handler = omap2_dma_irq_handler,
1968 .flags = IRQF_DISABLED
1969}; 1968};
1970 1969
1971#else 1970#else
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 7dfba937d8fc..6d95d60276d6 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -382,11 +382,6 @@ config S5P_DEV_TV
382 help 382 help
383 Compile in platform device definition for TV interface 383 Compile in platform device definition for TV interface
384 384
385config S5P_DEV_USB_EHCI
386 bool
387 help
388 Compile in platform device definition for USB EHCI
389
390config S3C24XX_PWM 385config S3C24XX_PWM
391 bool "PWM device support" 386 bool "PWM device support"
392 select PWM 387 select PWM
@@ -395,11 +390,6 @@ config S3C24XX_PWM
395 Support for exporting the PWM timer blocks via the pwm device 390 Support for exporting the PWM timer blocks via the pwm device
396 system 391 system
397 392
398config S5P_SETUP_MIPIPHY
399 bool
400 help
401 Compile in common setup code for MIPI-CSIS and MIPI-DSIM devices
402
403config S3C_SETUP_CAMIF 393config S3C_SETUP_CAMIF
404 bool 394 bool
405 help 395 help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 498c7c23e9f4..9267d29549b4 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -38,7 +38,6 @@ obj-$(CONFIG_S5P_DEV_UART) += s5p-dev-uart.o
38obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o 38obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o
39 39
40obj-$(CONFIG_S3C_SETUP_CAMIF) += setup-camif.o 40obj-$(CONFIG_S3C_SETUP_CAMIF) += setup-camif.o
41obj-$(CONFIG_S5P_SETUP_MIPIPHY) += setup-mipiphy.o
42 41
43# DMA support 42# DMA support
44 43
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 8ce0ac007eb9..99a3590f0349 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -32,6 +32,7 @@
32#include <linux/ioport.h> 32#include <linux/ioport.h>
33#include <linux/platform_data/s3c-hsudc.h> 33#include <linux/platform_data/s3c-hsudc.h>
34#include <linux/platform_data/s3c-hsotg.h> 34#include <linux/platform_data/s3c-hsotg.h>
35#include <linux/platform_data/dma-s3c24xx.h>
35 36
36#include <media/s5p_hdmi.h> 37#include <media/s5p_hdmi.h>
37 38
@@ -49,7 +50,6 @@
49#include <plat/devs.h> 50#include <plat/devs.h>
50#include <plat/adc.h> 51#include <plat/adc.h>
51#include <linux/platform_data/ata-samsung_cf.h> 52#include <linux/platform_data/ata-samsung_cf.h>
52#include <linux/platform_data/usb-ehci-s5p.h>
53#include <plat/fb.h> 53#include <plat/fb.h>
54#include <plat/fb-s3c2410.h> 54#include <plat/fb-s3c2410.h>
55#include <plat/hdmi.h> 55#include <plat/hdmi.h>
@@ -1359,39 +1359,6 @@ void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
1359} 1359}
1360#endif /* CONFIG_PLAT_S3C24XX */ 1360#endif /* CONFIG_PLAT_S3C24XX */
1361 1361
1362/* USB EHCI Host Controller */
1363
1364#ifdef CONFIG_S5P_DEV_USB_EHCI
1365static struct resource s5p_ehci_resource[] = {
1366 [0] = DEFINE_RES_MEM(S5P_PA_EHCI, SZ_256),
1367 [1] = DEFINE_RES_IRQ(IRQ_USB_HOST),
1368};
1369
1370struct platform_device s5p_device_ehci = {
1371 .name = "s5p-ehci",
1372 .id = -1,
1373 .num_resources = ARRAY_SIZE(s5p_ehci_resource),
1374 .resource = s5p_ehci_resource,
1375 .dev = {
1376 .dma_mask = &samsung_device_dma_mask,
1377 .coherent_dma_mask = DMA_BIT_MASK(32),
1378 }
1379};
1380
1381void __init s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd)
1382{
1383 struct s5p_ehci_platdata *npd;
1384
1385 npd = s3c_set_platdata(pd, sizeof(struct s5p_ehci_platdata),
1386 &s5p_device_ehci);
1387
1388 if (!npd->phy_init)
1389 npd->phy_init = s5p_usb_phy_init;
1390 if (!npd->phy_exit)
1391 npd->phy_exit = s5p_usb_phy_exit;
1392}
1393#endif /* CONFIG_S5P_DEV_USB_EHCI */
1394
1395/* USB HSOTG */ 1362/* USB HSOTG */
1396 1363
1397#ifdef CONFIG_S3C_DEV_USB_HSOTG 1364#ifdef CONFIG_S3C_DEV_USB_HSOTG
@@ -1499,8 +1466,10 @@ void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
1499 pd.num_cs = num_cs; 1466 pd.num_cs = num_cs;
1500 pd.src_clk_nr = src_clk_nr; 1467 pd.src_clk_nr = src_clk_nr;
1501 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio; 1468 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio;
1502#ifdef CONFIG_PL330_DMA 1469#if defined(CONFIG_PL330_DMA)
1503 pd.filter = pl330_filter; 1470 pd.filter = pl330_filter;
1471#elif defined(CONFIG_S3C24XX_DMAC)
1472 pd.filter = s3c24xx_dma_filter;
1504#endif 1473#endif
1505 1474
1506 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi0); 1475 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi0);
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index 4fb1f03a10d1..335beb341355 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -87,8 +87,12 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
87#endif 87#endif
88 88
89#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) 89#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
90# define soc_is_s3c6400() is_samsung_s3c6400()
91# define soc_is_s3c6410() is_samsung_s3c6410()
90# define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410()) 92# define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410())
91#else 93#else
94# define soc_is_s3c6400() 0
95# define soc_is_s3c6410() 0
92# define soc_is_s3c64xx() 0 96# define soc_is_s3c64xx() 0
93#endif 97#endif
94 98
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index 0dc4ac4909b0..eece188ed188 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -75,7 +75,6 @@ extern struct platform_device s3c_device_usb_hsotg;
75extern struct platform_device s3c_device_usb_hsudc; 75extern struct platform_device s3c_device_usb_hsudc;
76extern struct platform_device s3c_device_wdt; 76extern struct platform_device s3c_device_wdt;
77 77
78extern struct platform_device s5p_device_ehci;
79extern struct platform_device s5p_device_fimc0; 78extern struct platform_device s5p_device_fimc0;
80extern struct platform_device s5p_device_fimc1; 79extern struct platform_device s5p_device_fimc1;
81extern struct platform_device s5p_device_fimc2; 80extern struct platform_device s5p_device_fimc2;
diff --git a/arch/arm/plat-samsung/init.c b/arch/arm/plat-samsung/init.c
index 50a3ea0037db..aa9511b6914a 100644
--- a/arch/arm/plat-samsung/init.c
+++ b/arch/arm/plat-samsung/init.c
@@ -11,12 +11,18 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12*/ 12*/
13 13
14/*
15 * NOTE: Code in this file is not used on S3C64xx when booting with
16 * Device Tree support.
17 */
18
14#include <linux/init.h> 19#include <linux/init.h>
15#include <linux/module.h> 20#include <linux/module.h>
16#include <linux/interrupt.h> 21#include <linux/interrupt.h>
17#include <linux/ioport.h> 22#include <linux/ioport.h>
18#include <linux/serial_core.h> 23#include <linux/serial_core.h>
19#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/of.h>
20 26
21#include <mach/hardware.h> 27#include <mach/hardware.h>
22 28
@@ -148,8 +154,12 @@ static int __init s3c_arch_init(void)
148 154
149 // do the correct init for cpu 155 // do the correct init for cpu
150 156
151 if (cpu == NULL) 157 if (cpu == NULL) {
158 /* Not needed when booting with device tree. */
159 if (of_have_populated_dt())
160 return 0;
152 panic("s3c_arch_init: NULL cpu\n"); 161 panic("s3c_arch_init: NULL cpu\n");
162 }
153 163
154 ret = (cpu->init)(); 164 ret = (cpu->init)();
155 if (ret != 0) 165 if (ret != 0)
diff --git a/arch/arm/plat-samsung/setup-mipiphy.c b/arch/arm/plat-samsung/setup-mipiphy.c
deleted file mode 100644
index 66df315990a7..000000000000
--- a/arch/arm/plat-samsung/setup-mipiphy.c
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
3 *
4 * S5P - Helper functions for MIPI-CSIS and MIPI-DSIM D-PHY control
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/export.h>
12#include <linux/kernel.h>
13#include <linux/platform_device.h>
14#include <linux/io.h>
15#include <linux/spinlock.h>
16#include <mach/regs-clock.h>
17
18static int __s5p_mipi_phy_control(int id, bool on, u32 reset)
19{
20 static DEFINE_SPINLOCK(lock);
21 void __iomem *addr;
22 unsigned long flags;
23 u32 cfg;
24
25 id = max(0, id);
26 if (id > 1)
27 return -EINVAL;
28
29 addr = S5P_MIPI_DPHY_CONTROL(id);
30
31 spin_lock_irqsave(&lock, flags);
32
33 cfg = __raw_readl(addr);
34 cfg = on ? (cfg | reset) : (cfg & ~reset);
35 __raw_writel(cfg, addr);
36
37 if (on) {
38 cfg |= S5P_MIPI_DPHY_ENABLE;
39 } else if (!(cfg & (S5P_MIPI_DPHY_SRESETN |
40 S5P_MIPI_DPHY_MRESETN) & ~reset)) {
41 cfg &= ~S5P_MIPI_DPHY_ENABLE;
42 }
43
44 __raw_writel(cfg, addr);
45 spin_unlock_irqrestore(&lock, flags);
46
47 return 0;
48}
49
50int s5p_csis_phy_enable(int id, bool on)
51{
52 return __s5p_mipi_phy_control(id, on, S5P_MIPI_DPHY_SRESETN);
53}
54EXPORT_SYMBOL(s5p_csis_phy_enable);
55
56int s5p_dsim_phy_enable(struct platform_device *pdev, bool on)
57{
58 return __s5p_mipi_phy_control(pdev->id, on, S5P_MIPI_DPHY_MRESETN);
59}
60EXPORT_SYMBOL(s5p_dsim_phy_enable);
diff --git a/arch/arm/plat-versatile/headsmp.S b/arch/arm/plat-versatile/headsmp.S
index 2677bc3762d7..40f27e52de75 100644
--- a/arch/arm/plat-versatile/headsmp.S
+++ b/arch/arm/plat-versatile/headsmp.S
@@ -10,6 +10,7 @@
10 */ 10 */
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <asm/assembler.h>
13 14
14/* 15/*
15 * Realview/Versatile Express specific entry point for secondary CPUs. 16 * Realview/Versatile Express specific entry point for secondary CPUs.
@@ -17,6 +18,7 @@
17 * until we're ready for them to initialise. 18 * until we're ready for them to initialise.
18 */ 19 */
19ENTRY(versatile_secondary_startup) 20ENTRY(versatile_secondary_startup)
21 ARM_BE8(setend be)
20 mrc p15, 0, r0, c0, c0, 5 22 mrc p15, 0, r0, c0, c0, 5
21 bic r0, #0xff000000 23 bic r0, #0xff000000
22 adr r4, 1f 24 adr r4, 1f
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 52b8f40b1c73..2f37e1d6cb45 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -642,9 +642,9 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp,
642static int vfp_hotplug(struct notifier_block *b, unsigned long action, 642static int vfp_hotplug(struct notifier_block *b, unsigned long action,
643 void *hcpu) 643 void *hcpu)
644{ 644{
645 if (action == CPU_DYING || action == CPU_DYING_FROZEN) { 645 if (action == CPU_DYING || action == CPU_DYING_FROZEN)
646 vfp_force_reload((long)hcpu, current_thread_info()); 646 vfp_current_hw_state[(long)hcpu] = NULL;
647 } else if (action == CPU_STARTING || action == CPU_STARTING_FROZEN) 647 else if (action == CPU_STARTING || action == CPU_STARTING_FROZEN)
648 vfp_enable(NULL); 648 vfp_enable(NULL);
649 return NOTIFY_OK; 649 return NOTIFY_OK;
650} 650}
diff --git a/arch/arm/xen/Makefile b/arch/arm/xen/Makefile
index 43841033afd3..12969523414c 100644
--- a/arch/arm/xen/Makefile
+++ b/arch/arm/xen/Makefile
@@ -1 +1 @@
obj-y := enlighten.o hypercall.o grant-table.o obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o
diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c
new file mode 100644
index 000000000000..b0e77de99148
--- /dev/null
+++ b/arch/arm/xen/mm.c
@@ -0,0 +1,65 @@
1#include <linux/bootmem.h>
2#include <linux/gfp.h>
3#include <linux/export.h>
4#include <linux/slab.h>
5#include <linux/types.h>
6#include <linux/dma-mapping.h>
7#include <linux/vmalloc.h>
8#include <linux/swiotlb.h>
9
10#include <xen/xen.h>
11#include <xen/interface/memory.h>
12#include <xen/swiotlb-xen.h>
13
14#include <asm/cacheflush.h>
15#include <asm/xen/page.h>
16#include <asm/xen/hypercall.h>
17#include <asm/xen/interface.h>
18
19int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
20 unsigned int address_bits,
21 dma_addr_t *dma_handle)
22{
23 if (!xen_initial_domain())
24 return -EINVAL;
25
26 /* we assume that dom0 is mapped 1:1 for now */
27 *dma_handle = pstart;
28 return 0;
29}
30EXPORT_SYMBOL_GPL(xen_create_contiguous_region);
31
32void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order)
33{
34 return;
35}
36EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region);
37
38struct dma_map_ops *xen_dma_ops;
39EXPORT_SYMBOL_GPL(xen_dma_ops);
40
41static struct dma_map_ops xen_swiotlb_dma_ops = {
42 .mapping_error = xen_swiotlb_dma_mapping_error,
43 .alloc = xen_swiotlb_alloc_coherent,
44 .free = xen_swiotlb_free_coherent,
45 .sync_single_for_cpu = xen_swiotlb_sync_single_for_cpu,
46 .sync_single_for_device = xen_swiotlb_sync_single_for_device,
47 .sync_sg_for_cpu = xen_swiotlb_sync_sg_for_cpu,
48 .sync_sg_for_device = xen_swiotlb_sync_sg_for_device,
49 .map_sg = xen_swiotlb_map_sg_attrs,
50 .unmap_sg = xen_swiotlb_unmap_sg_attrs,
51 .map_page = xen_swiotlb_map_page,
52 .unmap_page = xen_swiotlb_unmap_page,
53 .dma_supported = xen_swiotlb_dma_supported,
54 .set_dma_mask = xen_swiotlb_set_dma_mask,
55};
56
57int __init xen_mm_init(void)
58{
59 if (!xen_initial_domain())
60 return 0;
61 xen_swiotlb_init(1, false);
62 xen_dma_ops = &xen_swiotlb_dma_ops;
63 return 0;
64}
65arch_initcall(xen_mm_init);
diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c
new file mode 100644
index 000000000000..23732cdff551
--- /dev/null
+++ b/arch/arm/xen/p2m.c
@@ -0,0 +1,208 @@
1#include <linux/bootmem.h>
2#include <linux/gfp.h>
3#include <linux/export.h>
4#include <linux/rwlock.h>
5#include <linux/slab.h>
6#include <linux/types.h>
7#include <linux/dma-mapping.h>
8#include <linux/vmalloc.h>
9#include <linux/swiotlb.h>
10
11#include <xen/xen.h>
12#include <xen/interface/memory.h>
13#include <xen/swiotlb-xen.h>
14
15#include <asm/cacheflush.h>
16#include <asm/xen/page.h>
17#include <asm/xen/hypercall.h>
18#include <asm/xen/interface.h>
19
20struct xen_p2m_entry {
21 unsigned long pfn;
22 unsigned long mfn;
23 unsigned long nr_pages;
24 struct rb_node rbnode_mach;
25 struct rb_node rbnode_phys;
26};
27
28rwlock_t p2m_lock;
29struct rb_root phys_to_mach = RB_ROOT;
30static struct rb_root mach_to_phys = RB_ROOT;
31
32static int xen_add_phys_to_mach_entry(struct xen_p2m_entry *new)
33{
34 struct rb_node **link = &phys_to_mach.rb_node;
35 struct rb_node *parent = NULL;
36 struct xen_p2m_entry *entry;
37 int rc = 0;
38
39 while (*link) {
40 parent = *link;
41 entry = rb_entry(parent, struct xen_p2m_entry, rbnode_phys);
42
43 if (new->mfn == entry->mfn)
44 goto err_out;
45 if (new->pfn == entry->pfn)
46 goto err_out;
47
48 if (new->pfn < entry->pfn)
49 link = &(*link)->rb_left;
50 else
51 link = &(*link)->rb_right;
52 }
53 rb_link_node(&new->rbnode_phys, parent, link);
54 rb_insert_color(&new->rbnode_phys, &phys_to_mach);
55 goto out;
56
57err_out:
58 rc = -EINVAL;
59 pr_warn("%s: cannot add pfn=%pa -> mfn=%pa: pfn=%pa -> mfn=%pa already exists\n",
60 __func__, &new->pfn, &new->mfn, &entry->pfn, &entry->mfn);
61out:
62 return rc;
63}
64
65unsigned long __pfn_to_mfn(unsigned long pfn)
66{
67 struct rb_node *n = phys_to_mach.rb_node;
68 struct xen_p2m_entry *entry;
69 unsigned long irqflags;
70
71 read_lock_irqsave(&p2m_lock, irqflags);
72 while (n) {
73 entry = rb_entry(n, struct xen_p2m_entry, rbnode_phys);
74 if (entry->pfn <= pfn &&
75 entry->pfn + entry->nr_pages > pfn) {
76 read_unlock_irqrestore(&p2m_lock, irqflags);
77 return entry->mfn + (pfn - entry->pfn);
78 }
79 if (pfn < entry->pfn)
80 n = n->rb_left;
81 else
82 n = n->rb_right;
83 }
84 read_unlock_irqrestore(&p2m_lock, irqflags);
85
86 return INVALID_P2M_ENTRY;
87}
88EXPORT_SYMBOL_GPL(__pfn_to_mfn);
89
90static int xen_add_mach_to_phys_entry(struct xen_p2m_entry *new)
91{
92 struct rb_node **link = &mach_to_phys.rb_node;
93 struct rb_node *parent = NULL;
94 struct xen_p2m_entry *entry;
95 int rc = 0;
96
97 while (*link) {
98 parent = *link;
99 entry = rb_entry(parent, struct xen_p2m_entry, rbnode_mach);
100
101 if (new->mfn == entry->mfn)
102 goto err_out;
103 if (new->pfn == entry->pfn)
104 goto err_out;
105
106 if (new->mfn < entry->mfn)
107 link = &(*link)->rb_left;
108 else
109 link = &(*link)->rb_right;
110 }
111 rb_link_node(&new->rbnode_mach, parent, link);
112 rb_insert_color(&new->rbnode_mach, &mach_to_phys);
113 goto out;
114
115err_out:
116 rc = -EINVAL;
117 pr_warn("%s: cannot add pfn=%pa -> mfn=%pa: pfn=%pa -> mfn=%pa already exists\n",
118 __func__, &new->pfn, &new->mfn, &entry->pfn, &entry->mfn);
119out:
120 return rc;
121}
122
123unsigned long __mfn_to_pfn(unsigned long mfn)
124{
125 struct rb_node *n = mach_to_phys.rb_node;
126 struct xen_p2m_entry *entry;
127 unsigned long irqflags;
128
129 read_lock_irqsave(&p2m_lock, irqflags);
130 while (n) {
131 entry = rb_entry(n, struct xen_p2m_entry, rbnode_mach);
132 if (entry->mfn <= mfn &&
133 entry->mfn + entry->nr_pages > mfn) {
134 read_unlock_irqrestore(&p2m_lock, irqflags);
135 return entry->pfn + (mfn - entry->mfn);
136 }
137 if (mfn < entry->mfn)
138 n = n->rb_left;
139 else
140 n = n->rb_right;
141 }
142 read_unlock_irqrestore(&p2m_lock, irqflags);
143
144 return INVALID_P2M_ENTRY;
145}
146EXPORT_SYMBOL_GPL(__mfn_to_pfn);
147
148bool __set_phys_to_machine_multi(unsigned long pfn,
149 unsigned long mfn, unsigned long nr_pages)
150{
151 int rc;
152 unsigned long irqflags;
153 struct xen_p2m_entry *p2m_entry;
154 struct rb_node *n = phys_to_mach.rb_node;
155
156 if (mfn == INVALID_P2M_ENTRY) {
157 write_lock_irqsave(&p2m_lock, irqflags);
158 while (n) {
159 p2m_entry = rb_entry(n, struct xen_p2m_entry, rbnode_phys);
160 if (p2m_entry->pfn <= pfn &&
161 p2m_entry->pfn + p2m_entry->nr_pages > pfn) {
162 rb_erase(&p2m_entry->rbnode_mach, &mach_to_phys);
163 rb_erase(&p2m_entry->rbnode_phys, &phys_to_mach);
164 write_unlock_irqrestore(&p2m_lock, irqflags);
165 kfree(p2m_entry);
166 return true;
167 }
168 if (pfn < p2m_entry->pfn)
169 n = n->rb_left;
170 else
171 n = n->rb_right;
172 }
173 write_unlock_irqrestore(&p2m_lock, irqflags);
174 return true;
175 }
176
177 p2m_entry = kzalloc(sizeof(struct xen_p2m_entry), GFP_NOWAIT);
178 if (!p2m_entry) {
179 pr_warn("cannot allocate xen_p2m_entry\n");
180 return false;
181 }
182 p2m_entry->pfn = pfn;
183 p2m_entry->nr_pages = nr_pages;
184 p2m_entry->mfn = mfn;
185
186 write_lock_irqsave(&p2m_lock, irqflags);
187 if ((rc = xen_add_phys_to_mach_entry(p2m_entry) < 0) ||
188 (rc = xen_add_mach_to_phys_entry(p2m_entry) < 0)) {
189 write_unlock_irqrestore(&p2m_lock, irqflags);
190 return false;
191 }
192 write_unlock_irqrestore(&p2m_lock, irqflags);
193 return true;
194}
195EXPORT_SYMBOL_GPL(__set_phys_to_machine_multi);
196
197bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn)
198{
199 return __set_phys_to_machine_multi(pfn, mfn, 1);
200}
201EXPORT_SYMBOL_GPL(__set_phys_to_machine);
202
203int p2m_init(void)
204{
205 rwlock_init(&p2m_lock);
206 return 0;
207}
208arch_initcall(p2m_init);
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index c04454876bcb..88c8b6c1341a 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1,6 +1,7 @@
1config ARM64 1config ARM64
2 def_bool y 2 def_bool y
3 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 3 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
4 select ARCH_USE_CMPXCHG_LOCKREF
4 select ARCH_WANT_OPTIONAL_GPIOLIB 5 select ARCH_WANT_OPTIONAL_GPIOLIB
5 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION 6 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
6 select ARCH_WANT_FRAME_POINTERS 7 select ARCH_WANT_FRAME_POINTERS
@@ -14,6 +15,7 @@ config ARM64
14 select GENERIC_IOMAP 15 select GENERIC_IOMAP
15 select GENERIC_IRQ_PROBE 16 select GENERIC_IRQ_PROBE
16 select GENERIC_IRQ_SHOW 17 select GENERIC_IRQ_SHOW
18 select GENERIC_SCHED_CLOCK
17 select GENERIC_SMP_IDLE_THREAD 19 select GENERIC_SMP_IDLE_THREAD
18 select GENERIC_TIME_VSYSCALL 20 select GENERIC_TIME_VSYSCALL
19 select HARDIRQS_SW_RESEND 21 select HARDIRQS_SW_RESEND
@@ -61,10 +63,6 @@ config LOCKDEP_SUPPORT
61config TRACE_IRQFLAGS_SUPPORT 63config TRACE_IRQFLAGS_SUPPORT
62 def_bool y 64 def_bool y
63 65
64config GENERIC_LOCKBREAK
65 def_bool y
66 depends on SMP && PREEMPT
67
68config RWSEM_GENERIC_SPINLOCK 66config RWSEM_GENERIC_SPINLOCK
69 def_bool y 67 def_bool y
70 68
@@ -138,9 +136,13 @@ config ARM64_64K_PAGES
138 look-up. AArch32 emulation is not available when this feature 136 look-up. AArch32 emulation is not available when this feature
139 is enabled. 137 is enabled.
140 138
139config CPU_BIG_ENDIAN
140 bool "Build big-endian kernel"
141 help
142 Say Y if you plan on running a kernel in big-endian mode.
143
141config SMP 144config SMP
142 bool "Symmetric Multi-Processing" 145 bool "Symmetric Multi-Processing"
143 select USE_GENERIC_SMP_HELPERS
144 help 146 help
145 This enables support for systems with more than one CPU. If 147 This enables support for systems with more than one CPU. If
146 you say N here, the kernel will run on single and 148 you say N here, the kernel will run on single and
@@ -160,6 +162,13 @@ config NR_CPUS
160 default "8" if ARCH_XGENE 162 default "8" if ARCH_XGENE
161 default "4" 163 default "4"
162 164
165config HOTPLUG_CPU
166 bool "Support for hot-pluggable CPUs"
167 depends on SMP
168 help
169 Say Y here to experiment with turning CPUs off and on. CPUs
170 can be controlled through /sys/devices/system/cpu.
171
163source kernel/Kconfig.preempt 172source kernel/Kconfig.preempt
164 173
165config HZ 174config HZ
@@ -211,6 +220,7 @@ config XEN_DOM0
211config XEN 220config XEN
212 bool "Xen guest support on ARM64 (EXPERIMENTAL)" 221 bool "Xen guest support on ARM64 (EXPERIMENTAL)"
213 depends on ARM64 && OF 222 depends on ARM64 && OF
223 select SWIOTLB_XEN
214 help 224 help
215 Say Y if you want to run Linux in a Virtual Machine on Xen on ARM64. 225 Say Y if you want to run Linux in a Virtual Machine on Xen on ARM64.
216 226
diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug
index 1a6bfe954d49..835c559786bd 100644
--- a/arch/arm64/Kconfig.debug
+++ b/arch/arm64/Kconfig.debug
@@ -6,13 +6,6 @@ config FRAME_POINTER
6 bool 6 bool
7 default y 7 default y
8 8
9config DEBUG_STACK_USAGE
10 bool "Enable stack utilization instrumentation"
11 depends on DEBUG_KERNEL
12 help
13 Enables the display of the minimum amount of free stack which each
14 task has ever had available in the sysrq-T output.
15
16config EARLY_PRINTK 9config EARLY_PRINTK
17 bool "Early printk support" 10 bool "Early printk support"
18 default y 11 default y
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index d90cf79f233a..2fceb71ac3b7 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -20,9 +20,15 @@ LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
20KBUILD_DEFCONFIG := defconfig 20KBUILD_DEFCONFIG := defconfig
21 21
22KBUILD_CFLAGS += -mgeneral-regs-only 22KBUILD_CFLAGS += -mgeneral-regs-only
23ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
24KBUILD_CPPFLAGS += -mbig-endian
25AS += -EB
26LD += -EB
27else
23KBUILD_CPPFLAGS += -mlittle-endian 28KBUILD_CPPFLAGS += -mlittle-endian
24AS += -EL 29AS += -EL
25LD += -EL 30LD += -EL
31endif
26 32
27comma = , 33comma = ,
28 34
diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi
index bfdc57834929..d37d7369e260 100644
--- a/arch/arm64/boot/dts/apm-storm.dtsi
+++ b/arch/arm64/boot/dts/apm-storm.dtsi
@@ -103,6 +103,81 @@
103 #size-cells = <2>; 103 #size-cells = <2>;
104 ranges; 104 ranges;
105 105
106 clocks {
107 #address-cells = <2>;
108 #size-cells = <2>;
109 ranges;
110 refclk: refclk {
111 compatible = "fixed-clock";
112 #clock-cells = <1>;
113 clock-frequency = <100000000>;
114 clock-output-names = "refclk";
115 };
116
117 pcppll: pcppll@17000100 {
118 compatible = "apm,xgene-pcppll-clock";
119 #clock-cells = <1>;
120 clocks = <&refclk 0>;
121 clock-names = "pcppll";
122 reg = <0x0 0x17000100 0x0 0x1000>;
123 clock-output-names = "pcppll";
124 type = <0>;
125 };
126
127 socpll: socpll@17000120 {
128 compatible = "apm,xgene-socpll-clock";
129 #clock-cells = <1>;
130 clocks = <&refclk 0>;
131 clock-names = "socpll";
132 reg = <0x0 0x17000120 0x0 0x1000>;
133 clock-output-names = "socpll";
134 type = <1>;
135 };
136
137 socplldiv2: socplldiv2 {
138 compatible = "fixed-factor-clock";
139 #clock-cells = <1>;
140 clocks = <&socpll 0>;
141 clock-names = "socplldiv2";
142 clock-mult = <1>;
143 clock-div = <2>;
144 clock-output-names = "socplldiv2";
145 };
146
147 qmlclk: qmlclk {
148 compatible = "apm,xgene-device-clock";
149 #clock-cells = <1>;
150 clocks = <&socplldiv2 0>;
151 clock-names = "qmlclk";
152 reg = <0x0 0x1703C000 0x0 0x1000>;
153 reg-names = "csr-reg";
154 clock-output-names = "qmlclk";
155 };
156
157 ethclk: ethclk {
158 compatible = "apm,xgene-device-clock";
159 #clock-cells = <1>;
160 clocks = <&socplldiv2 0>;
161 clock-names = "ethclk";
162 reg = <0x0 0x17000000 0x0 0x1000>;
163 reg-names = "div-reg";
164 divider-offset = <0x238>;
165 divider-width = <0x9>;
166 divider-shift = <0x0>;
167 clock-output-names = "ethclk";
168 };
169
170 eth8clk: eth8clk {
171 compatible = "apm,xgene-device-clock";
172 #clock-cells = <1>;
173 clocks = <&ethclk 0>;
174 clock-names = "eth8clk";
175 reg = <0x0 0x1702C000 0x0 0x1000>;
176 reg-names = "csr-reg";
177 clock-output-names = "eth8clk";
178 };
179 };
180
106 serial0: serial@1c020000 { 181 serial0: serial@1c020000 {
107 device_type = "serial"; 182 device_type = "serial";
108 compatible = "ns16550"; 183 compatible = "ns16550";
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 5b3e83217b03..84139be62ae6 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -26,7 +26,7 @@ CONFIG_MODULE_UNLOAD=y
26CONFIG_ARCH_VEXPRESS=y 26CONFIG_ARCH_VEXPRESS=y
27CONFIG_ARCH_XGENE=y 27CONFIG_ARCH_XGENE=y
28CONFIG_SMP=y 28CONFIG_SMP=y
29CONFIG_PREEMPT_VOLUNTARY=y 29CONFIG_PREEMPT=y
30CONFIG_CMDLINE="console=ttyAMA0" 30CONFIG_CMDLINE="console=ttyAMA0"
31# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 31# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
32CONFIG_COMPAT=y 32CONFIG_COMPAT=y
@@ -42,7 +42,7 @@ CONFIG_IP_PNP_BOOTP=y
42# CONFIG_WIRELESS is not set 42# CONFIG_WIRELESS is not set
43CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 43CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
44CONFIG_DEVTMPFS=y 44CONFIG_DEVTMPFS=y
45# CONFIG_BLK_DEV is not set 45CONFIG_BLK_DEV=y
46CONFIG_SCSI=y 46CONFIG_SCSI=y
47# CONFIG_SCSI_PROC_FS is not set 47# CONFIG_SCSI_PROC_FS is not set
48CONFIG_BLK_DEV_SD=y 48CONFIG_BLK_DEV_SD=y
@@ -72,6 +72,7 @@ CONFIG_LOGO=y
72# CONFIG_IOMMU_SUPPORT is not set 72# CONFIG_IOMMU_SUPPORT is not set
73CONFIG_EXT2_FS=y 73CONFIG_EXT2_FS=y
74CONFIG_EXT3_FS=y 74CONFIG_EXT3_FS=y
75CONFIG_EXT4_FS=y
75# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 76# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
76# CONFIG_EXT3_FS_XATTR is not set 77# CONFIG_EXT3_FS_XATTR is not set
77CONFIG_FUSE_FS=y 78CONFIG_FUSE_FS=y
@@ -90,3 +91,5 @@ CONFIG_DEBUG_KERNEL=y
90CONFIG_DEBUG_INFO=y 91CONFIG_DEBUG_INFO=y
91# CONFIG_FTRACE is not set 92# CONFIG_FTRACE is not set
92CONFIG_ATOMIC64_SELFTEST=y 93CONFIG_ATOMIC64_SELFTEST=y
94CONFIG_VIRTIO_MMIO=y
95CONFIG_VIRTIO_BLK=y
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index 79a642d199f2..519f89f5b6a3 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -50,3 +50,4 @@ generic-y += unaligned.h
50generic-y += user.h 50generic-y += user.h
51generic-y += vga.h 51generic-y += vga.h
52generic-y += xor.h 52generic-y += xor.h
53generic-y += preempt.h
diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
index c9f1d2816c2b..9400596a0f39 100644
--- a/arch/arm64/include/asm/arch_timer.h
+++ b/arch/arm64/include/asm/arch_timer.h
@@ -92,19 +92,49 @@ static inline u32 arch_timer_get_cntfrq(void)
92 return val; 92 return val;
93} 93}
94 94
95static inline void arch_counter_set_user_access(void) 95static inline u32 arch_timer_get_cntkctl(void)
96{ 96{
97 u32 cntkctl; 97 u32 cntkctl;
98
99 /* Disable user access to the timers and the physical counter. */
100 asm volatile("mrs %0, cntkctl_el1" : "=r" (cntkctl)); 98 asm volatile("mrs %0, cntkctl_el1" : "=r" (cntkctl));
101 cntkctl &= ~((3 << 8) | (1 << 0)); 99 return cntkctl;
100}
102 101
103 /* Enable user access to the virtual counter and frequency. */ 102static inline void arch_timer_set_cntkctl(u32 cntkctl)
104 cntkctl |= (1 << 1); 103{
105 asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl)); 104 asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl));
106} 105}
107 106
107static inline void arch_counter_set_user_access(void)
108{
109 u32 cntkctl = arch_timer_get_cntkctl();
110
111 /* Disable user access to the timers and the physical counter */
112 /* Also disable virtual event stream */
113 cntkctl &= ~(ARCH_TIMER_USR_PT_ACCESS_EN
114 | ARCH_TIMER_USR_VT_ACCESS_EN
115 | ARCH_TIMER_VIRT_EVT_EN
116 | ARCH_TIMER_USR_PCT_ACCESS_EN);
117
118 /* Enable user access to the virtual counter */
119 cntkctl |= ARCH_TIMER_USR_VCT_ACCESS_EN;
120
121 arch_timer_set_cntkctl(cntkctl);
122}
123
124static inline void arch_timer_evtstrm_enable(int divider)
125{
126 u32 cntkctl = arch_timer_get_cntkctl();
127 cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK;
128 /* Set the divider and enable virtual event stream */
129 cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT)
130 | ARCH_TIMER_VIRT_EVT_EN;
131 arch_timer_set_cntkctl(cntkctl);
132 elf_hwcap |= HWCAP_EVTSTRM;
133#ifdef CONFIG_COMPAT
134 compat_elf_hwcap |= COMPAT_HWCAP_EVTSTRM;
135#endif
136}
137
108static inline u64 arch_counter_get_cntvct(void) 138static inline u64 arch_counter_get_cntvct(void)
109{ 139{
110 u64 cval; 140 u64 cval;
diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h
index 5aceb83b3f5c..fd3e3924041b 100644
--- a/arch/arm64/include/asm/assembler.h
+++ b/arch/arm64/include/asm/assembler.h
@@ -115,3 +115,34 @@ lr .req x30 // link register
115 .align 7 115 .align 7
116 b \label 116 b \label
117 .endm 117 .endm
118
119/*
120 * Select code when configured for BE.
121 */
122#ifdef CONFIG_CPU_BIG_ENDIAN
123#define CPU_BE(code...) code
124#else
125#define CPU_BE(code...)
126#endif
127
128/*
129 * Select code when configured for LE.
130 */
131#ifdef CONFIG_CPU_BIG_ENDIAN
132#define CPU_LE(code...)
133#else
134#define CPU_LE(code...) code
135#endif
136
137/*
138 * Define a macro that constructs a 64-bit value by concatenating two
139 * 32-bit registers. Note that on big endian systems the order of the
140 * registers is swapped.
141 */
142#ifndef CONFIG_CPU_BIG_ENDIAN
143 .macro regs_to_64, rd, lbits, hbits
144#else
145 .macro regs_to_64, rd, hbits, lbits
146#endif
147 orr \rd, \lbits, \hbits, lsl #32
148 .endm
diff --git a/arch/arm64/include/asm/atomic.h b/arch/arm64/include/asm/atomic.h
index 836364468571..01de5aaa3edc 100644
--- a/arch/arm64/include/asm/atomic.h
+++ b/arch/arm64/include/asm/atomic.h
@@ -126,20 +126,6 @@ static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new)
126 return oldval; 126 return oldval;
127} 127}
128 128
129static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
130{
131 unsigned long tmp, tmp2;
132
133 asm volatile("// atomic_clear_mask\n"
134"1: ldxr %0, %2\n"
135" bic %0, %0, %3\n"
136" stxr %w1, %0, %2\n"
137" cbnz %w1, 1b"
138 : "=&r" (tmp), "=&r" (tmp2), "+Q" (*addr)
139 : "Ir" (mask)
140 : "cc");
141}
142
143#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 129#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
144 130
145static inline int __atomic_add_unless(atomic_t *v, int a, int u) 131static inline int __atomic_add_unless(atomic_t *v, int a, int u)
diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h
index 8a8ce0e73a38..3914c0dcd09c 100644
--- a/arch/arm64/include/asm/cmpxchg.h
+++ b/arch/arm64/include/asm/cmpxchg.h
@@ -173,4 +173,6 @@ static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
173#define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n)) 173#define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n))
174#define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr),(o),(n)) 174#define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr),(o),(n))
175 175
176#define cmpxchg64_relaxed(ptr,o,n) cmpxchg_local((ptr),(o),(n))
177
176#endif /* __ASM_CMPXCHG_H */ 178#endif /* __ASM_CMPXCHG_H */
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h
index 899af807ef0f..fda2704b3f9f 100644
--- a/arch/arm64/include/asm/compat.h
+++ b/arch/arm64/include/asm/compat.h
@@ -26,7 +26,11 @@
26#include <linux/ptrace.h> 26#include <linux/ptrace.h>
27 27
28#define COMPAT_USER_HZ 100 28#define COMPAT_USER_HZ 100
29#ifdef __AARCH64EB__
30#define COMPAT_UTS_MACHINE "armv8b\0\0"
31#else
29#define COMPAT_UTS_MACHINE "armv8l\0\0" 32#define COMPAT_UTS_MACHINE "armv8l\0\0"
33#endif
30 34
31typedef u32 compat_size_t; 35typedef u32 compat_size_t;
32typedef s32 compat_ssize_t; 36typedef s32 compat_ssize_t;
@@ -73,13 +77,23 @@ struct compat_timeval {
73}; 77};
74 78
75struct compat_stat { 79struct compat_stat {
80#ifdef __AARCH64EB__
81 short st_dev;
82 short __pad1;
83#else
76 compat_dev_t st_dev; 84 compat_dev_t st_dev;
85#endif
77 compat_ino_t st_ino; 86 compat_ino_t st_ino;
78 compat_mode_t st_mode; 87 compat_mode_t st_mode;
79 compat_ushort_t st_nlink; 88 compat_ushort_t st_nlink;
80 __compat_uid16_t st_uid; 89 __compat_uid16_t st_uid;
81 __compat_gid16_t st_gid; 90 __compat_gid16_t st_gid;
91#ifdef __AARCH64EB__
92 short st_rdev;
93 short __pad2;
94#else
82 compat_dev_t st_rdev; 95 compat_dev_t st_rdev;
96#endif
83 compat_off_t st_size; 97 compat_off_t st_size;
84 compat_off_t st_blksize; 98 compat_off_t st_blksize;
85 compat_off_t st_blocks; 99 compat_off_t st_blocks;
diff --git a/arch/arm64/include/asm/cpu_ops.h b/arch/arm64/include/asm/cpu_ops.h
new file mode 100644
index 000000000000..c4cdb5e5b73d
--- /dev/null
+++ b/arch/arm64/include/asm/cpu_ops.h
@@ -0,0 +1,59 @@
1/*
2 * Copyright (C) 2013 ARM Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#ifndef __ASM_CPU_OPS_H
17#define __ASM_CPU_OPS_H
18
19#include <linux/init.h>
20#include <linux/threads.h>
21
22struct device_node;
23
24/**
25 * struct cpu_operations - Callback operations for hotplugging CPUs.
26 *
27 * @name: Name of the property as appears in a devicetree cpu node's
28 * enable-method property.
29 * @cpu_init: Reads any data necessary for a specific enable-method from the
30 * devicetree, for a given cpu node and proposed logical id.
31 * @cpu_prepare: Early one-time preparation step for a cpu. If there is a
32 * mechanism for doing so, tests whether it is possible to boot
33 * the given CPU.
34 * @cpu_boot: Boots a cpu into the kernel.
35 * @cpu_postboot: Optionally, perform any post-boot cleanup or necesary
36 * synchronisation. Called from the cpu being booted.
37 * @cpu_disable: Prepares a cpu to die. May fail for some mechanism-specific
38 * reason, which will cause the hot unplug to be aborted. Called
39 * from the cpu to be killed.
40 * @cpu_die: Makes a cpu leave the kernel. Must not fail. Called from the
41 * cpu being killed.
42 */
43struct cpu_operations {
44 const char *name;
45 int (*cpu_init)(struct device_node *, unsigned int);
46 int (*cpu_prepare)(unsigned int);
47 int (*cpu_boot)(unsigned int);
48 void (*cpu_postboot)(void);
49#ifdef CONFIG_HOTPLUG_CPU
50 int (*cpu_disable)(unsigned int cpu);
51 void (*cpu_die)(unsigned int cpu);
52#endif
53};
54
55extern const struct cpu_operations *cpu_ops[NR_CPUS];
56extern int __init cpu_read_ops(struct device_node *dn, int cpu);
57extern void __init cpu_read_bootcpu_ops(void);
58
59#endif /* ifndef __ASM_CPU_OPS_H */
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
index 8d1810001aef..fd0c0c0e447a 100644
--- a/arch/arm64/include/asm/dma-mapping.h
+++ b/arch/arm64/include/asm/dma-mapping.h
@@ -23,11 +23,15 @@
23 23
24#include <asm-generic/dma-coherent.h> 24#include <asm-generic/dma-coherent.h>
25 25
26#include <xen/xen.h>
27#include <asm/xen/hypervisor.h>
28
26#define ARCH_HAS_DMA_GET_REQUIRED_MASK 29#define ARCH_HAS_DMA_GET_REQUIRED_MASK
27 30
31#define DMA_ERROR_CODE (~(dma_addr_t)0)
28extern struct dma_map_ops *dma_ops; 32extern struct dma_map_ops *dma_ops;
29 33
30static inline struct dma_map_ops *get_dma_ops(struct device *dev) 34static inline struct dma_map_ops *__generic_dma_ops(struct device *dev)
31{ 35{
32 if (unlikely(!dev) || !dev->archdata.dma_ops) 36 if (unlikely(!dev) || !dev->archdata.dma_ops)
33 return dma_ops; 37 return dma_ops;
@@ -35,6 +39,14 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
35 return dev->archdata.dma_ops; 39 return dev->archdata.dma_ops;
36} 40}
37 41
42static inline struct dma_map_ops *get_dma_ops(struct device *dev)
43{
44 if (xen_initial_domain())
45 return xen_dma_ops;
46 else
47 return __generic_dma_ops(dev);
48}
49
38#include <asm-generic/dma-mapping-common.h> 50#include <asm-generic/dma-mapping-common.h>
39 51
40static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) 52static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h
index e7fa87f9201b..01d3aab64b79 100644
--- a/arch/arm64/include/asm/elf.h
+++ b/arch/arm64/include/asm/elf.h
@@ -90,11 +90,24 @@ typedef struct user_fpsimd_state elf_fpregset_t;
90 * These are used to set parameters in the core dumps. 90 * These are used to set parameters in the core dumps.
91 */ 91 */
92#define ELF_CLASS ELFCLASS64 92#define ELF_CLASS ELFCLASS64
93#ifdef __AARCH64EB__
94#define ELF_DATA ELFDATA2MSB
95#else
93#define ELF_DATA ELFDATA2LSB 96#define ELF_DATA ELFDATA2LSB
97#endif
94#define ELF_ARCH EM_AARCH64 98#define ELF_ARCH EM_AARCH64
95 99
100/*
101 * This yields a string that ld.so will use to load implementation
102 * specific libraries for optimization. This is more specific in
103 * intent than poking at uname or /proc/cpuinfo.
104 */
96#define ELF_PLATFORM_SIZE 16 105#define ELF_PLATFORM_SIZE 16
106#ifdef __AARCH64EB__
107#define ELF_PLATFORM ("aarch64_be")
108#else
97#define ELF_PLATFORM ("aarch64") 109#define ELF_PLATFORM ("aarch64")
110#endif
98 111
99/* 112/*
100 * This is used to ensure we don't load something for the wrong architecture. 113 * This is used to ensure we don't load something for the wrong architecture.
@@ -149,7 +162,12 @@ extern unsigned long arch_randomize_brk(struct mm_struct *mm);
149#define arch_randomize_brk arch_randomize_brk 162#define arch_randomize_brk arch_randomize_brk
150 163
151#ifdef CONFIG_COMPAT 164#ifdef CONFIG_COMPAT
165
166#ifdef __AARCH64EB__
167#define COMPAT_ELF_PLATFORM ("v8b")
168#else
152#define COMPAT_ELF_PLATFORM ("v8l") 169#define COMPAT_ELF_PLATFORM ("v8l")
170#endif
153 171
154#define COMPAT_ELF_ET_DYN_BASE (randomize_et_dyn(2 * TASK_SIZE_32 / 3)) 172#define COMPAT_ELF_ET_DYN_BASE (randomize_et_dyn(2 * TASK_SIZE_32 / 3))
155 173
diff --git a/arch/arm64/include/asm/hwcap.h b/arch/arm64/include/asm/hwcap.h
index 6d4482fa35bc..6cddbb0c9f54 100644
--- a/arch/arm64/include/asm/hwcap.h
+++ b/arch/arm64/include/asm/hwcap.h
@@ -30,6 +30,7 @@
30#define COMPAT_HWCAP_IDIVA (1 << 17) 30#define COMPAT_HWCAP_IDIVA (1 << 17)
31#define COMPAT_HWCAP_IDIVT (1 << 18) 31#define COMPAT_HWCAP_IDIVT (1 << 18)
32#define COMPAT_HWCAP_IDIV (COMPAT_HWCAP_IDIVA|COMPAT_HWCAP_IDIVT) 32#define COMPAT_HWCAP_IDIV (COMPAT_HWCAP_IDIVA|COMPAT_HWCAP_IDIVT)
33#define COMPAT_HWCAP_EVTSTRM (1 << 21)
33 34
34#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
35/* 36/*
@@ -37,12 +38,12 @@
37 * instruction set this cpu supports. 38 * instruction set this cpu supports.
38 */ 39 */
39#define ELF_HWCAP (elf_hwcap) 40#define ELF_HWCAP (elf_hwcap)
40#define COMPAT_ELF_HWCAP (COMPAT_HWCAP_HALF|COMPAT_HWCAP_THUMB|\
41 COMPAT_HWCAP_FAST_MULT|COMPAT_HWCAP_EDSP|\
42 COMPAT_HWCAP_TLS|COMPAT_HWCAP_VFP|\
43 COMPAT_HWCAP_VFPv3|COMPAT_HWCAP_VFPv4|\
44 COMPAT_HWCAP_NEON|COMPAT_HWCAP_IDIV)
45 41
46extern unsigned int elf_hwcap; 42#ifdef CONFIG_COMPAT
43#define COMPAT_ELF_HWCAP (compat_elf_hwcap)
44extern unsigned int compat_elf_hwcap;
45#endif
46
47extern unsigned long elf_hwcap;
47#endif 48#endif
48#endif 49#endif
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 1d12f89140ba..4cc813eddacb 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -22,11 +22,14 @@
22#ifdef __KERNEL__ 22#ifdef __KERNEL__
23 23
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/blk_types.h>
25 26
26#include <asm/byteorder.h> 27#include <asm/byteorder.h>
27#include <asm/barrier.h> 28#include <asm/barrier.h>
28#include <asm/pgtable.h> 29#include <asm/pgtable.h>
29 30
31#include <xen/xen.h>
32
30/* 33/*
31 * Generic IO read/write. These perform native-endian accesses. 34 * Generic IO read/write. These perform native-endian accesses.
32 */ 35 */
@@ -224,6 +227,7 @@ extern void __memset_io(volatile void __iomem *, int, size_t);
224 */ 227 */
225extern void __iomem *__ioremap(phys_addr_t phys_addr, size_t size, pgprot_t prot); 228extern void __iomem *__ioremap(phys_addr_t phys_addr, size_t size, pgprot_t prot);
226extern void __iounmap(volatile void __iomem *addr); 229extern void __iounmap(volatile void __iomem *addr);
230extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size);
227 231
228#define PROT_DEFAULT (PTE_TYPE_PAGE | PTE_AF | PTE_DIRTY) 232#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)) 233#define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_DEVICE_nGnRE))
@@ -233,7 +237,6 @@ extern void __iounmap(volatile void __iomem *addr);
233#define ioremap(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE)) 237#define ioremap(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
234#define ioremap_nocache(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE)) 238#define ioremap_nocache(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
235#define ioremap_wc(addr, size) __ioremap((addr), (size), __pgprot(PROT_NORMAL_NC)) 239#define ioremap_wc(addr, size) __ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
236#define ioremap_cached(addr, size) __ioremap((addr), (size), __pgprot(PROT_NORMAL))
237#define iounmap __iounmap 240#define iounmap __iounmap
238 241
239#define PROT_SECT_DEFAULT (PMD_TYPE_SECT | PMD_SECT_AF) 242#define PROT_SECT_DEFAULT (PMD_TYPE_SECT | PMD_SECT_AF)
@@ -263,5 +266,12 @@ extern int devmem_is_allowed(unsigned long pfn);
263 */ 266 */
264#define xlate_dev_kmem_ptr(p) p 267#define xlate_dev_kmem_ptr(p) p
265 268
269struct bio_vec;
270extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
271 const struct bio_vec *vec2);
272#define BIOVEC_PHYS_MERGEABLE(vec1, vec2) \
273 (__BIOVEC_PHYS_MERGEABLE(vec1, vec2) && \
274 (!xen_domain() || xen_biovec_phys_mergeable(vec1, vec2)))
275
266#endif /* __KERNEL__ */ 276#endif /* __KERNEL__ */
267#endif /* __ASM_IO_H */ 277#endif /* __ASM_IO_H */
diff --git a/arch/arm64/include/asm/irq.h b/arch/arm64/include/asm/irq.h
index 0332fc077f6e..e1f7ecdde11f 100644
--- a/arch/arm64/include/asm/irq.h
+++ b/arch/arm64/include/asm/irq.h
@@ -4,6 +4,7 @@
4#include <asm-generic/irq.h> 4#include <asm-generic/irq.h>
5 5
6extern void (*handle_arch_irq)(struct pt_regs *); 6extern void (*handle_arch_irq)(struct pt_regs *);
7extern void migrate_irqs(void);
7extern void set_handle_irq(void (*handle_irq)(struct pt_regs *)); 8extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));
8 9
9#endif 10#endif
diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
index a5f28e2720c7..c98ef4771c73 100644
--- a/arch/arm64/include/asm/kvm_arm.h
+++ b/arch/arm64/include/asm/kvm_arm.h
@@ -63,6 +63,7 @@
63 * TAC: Trap ACTLR 63 * TAC: Trap ACTLR
64 * TSC: Trap SMC 64 * TSC: Trap SMC
65 * TSW: Trap cache operations by set/way 65 * TSW: Trap cache operations by set/way
66 * TWE: Trap WFE
66 * TWI: Trap WFI 67 * TWI: Trap WFI
67 * TIDCP: Trap L2CTLR/L2ECTLR 68 * TIDCP: Trap L2CTLR/L2ECTLR
68 * BSU_IS: Upgrade barriers to the inner shareable domain 69 * BSU_IS: Upgrade barriers to the inner shareable domain
@@ -72,8 +73,9 @@
72 * FMO: Override CPSR.F and enable signaling with VF 73 * FMO: Override CPSR.F and enable signaling with VF
73 * SWIO: Turn set/way invalidates into set/way clean+invalidate 74 * SWIO: Turn set/way invalidates into set/way clean+invalidate
74 */ 75 */
75#define HCR_GUEST_FLAGS (HCR_TSC | HCR_TSW | HCR_TWI | HCR_VM | HCR_BSU_IS | \ 76#define HCR_GUEST_FLAGS (HCR_TSC | HCR_TSW | HCR_TWE | HCR_TWI | HCR_VM | \
76 HCR_FB | HCR_TAC | HCR_AMO | HCR_IMO | HCR_FMO | \ 77 HCR_BSU_IS | HCR_FB | HCR_TAC | \
78 HCR_AMO | HCR_IMO | HCR_FMO | \
77 HCR_SWIO | HCR_TIDCP | HCR_RW) 79 HCR_SWIO | HCR_TIDCP | HCR_RW)
78#define HCR_VIRT_EXCP_MASK (HCR_VA | HCR_VI | HCR_VF) 80#define HCR_VIRT_EXCP_MASK (HCR_VA | HCR_VI | HCR_VF)
79 81
@@ -242,4 +244,6 @@
242 244
243#define ESR_EL2_EC_xABT_xFSR_EXTABT 0x10 245#define ESR_EL2_EC_xABT_xFSR_EXTABT 0x10
244 246
247#define ESR_EL2_EC_WFI_ISS_WFE (1 << 0)
248
245#endif /* __ARM64_KVM_ARM_H__ */ 249#endif /* __ARM64_KVM_ARM_H__ */
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index eec073875218..dd8ecfc3f995 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -177,4 +177,65 @@ static inline u8 kvm_vcpu_trap_get_fault(const struct kvm_vcpu *vcpu)
177 return kvm_vcpu_get_hsr(vcpu) & ESR_EL2_FSC_TYPE; 177 return kvm_vcpu_get_hsr(vcpu) & ESR_EL2_FSC_TYPE;
178} 178}
179 179
180static inline unsigned long kvm_vcpu_get_mpidr(struct kvm_vcpu *vcpu)
181{
182 return vcpu_sys_reg(vcpu, MPIDR_EL1);
183}
184
185static inline void kvm_vcpu_set_be(struct kvm_vcpu *vcpu)
186{
187 if (vcpu_mode_is_32bit(vcpu))
188 *vcpu_cpsr(vcpu) |= COMPAT_PSR_E_BIT;
189 else
190 vcpu_sys_reg(vcpu, SCTLR_EL1) |= (1 << 25);
191}
192
193static inline bool kvm_vcpu_is_be(struct kvm_vcpu *vcpu)
194{
195 if (vcpu_mode_is_32bit(vcpu))
196 return !!(*vcpu_cpsr(vcpu) & COMPAT_PSR_E_BIT);
197
198 return !!(vcpu_sys_reg(vcpu, SCTLR_EL1) & (1 << 25));
199}
200
201static inline unsigned long vcpu_data_guest_to_host(struct kvm_vcpu *vcpu,
202 unsigned long data,
203 unsigned int len)
204{
205 if (kvm_vcpu_is_be(vcpu)) {
206 switch (len) {
207 case 1:
208 return data & 0xff;
209 case 2:
210 return be16_to_cpu(data & 0xffff);
211 case 4:
212 return be32_to_cpu(data & 0xffffffff);
213 default:
214 return be64_to_cpu(data);
215 }
216 }
217
218 return data; /* Leave LE untouched */
219}
220
221static inline unsigned long vcpu_data_host_to_guest(struct kvm_vcpu *vcpu,
222 unsigned long data,
223 unsigned int len)
224{
225 if (kvm_vcpu_is_be(vcpu)) {
226 switch (len) {
227 case 1:
228 return data & 0xff;
229 case 2:
230 return cpu_to_be16(data & 0xffff);
231 case 4:
232 return cpu_to_be32(data & 0xffffffff);
233 default:
234 return cpu_to_be64(data);
235 }
236 }
237
238 return data; /* Leave LE untouched */
239}
240
180#endif /* __ARM64_KVM_EMULATE_H__ */ 241#endif /* __ARM64_KVM_EMULATE_H__ */
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 0859a4ddd1e7..5d85a02d1231 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -36,11 +36,6 @@
36 36
37#define KVM_VCPU_MAX_FEATURES 2 37#define KVM_VCPU_MAX_FEATURES 2
38 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; 39struct kvm_vcpu;
45int kvm_target_cpu(void); 40int kvm_target_cpu(void);
46int kvm_reset_vcpu(struct kvm_vcpu *vcpu); 41int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
@@ -151,6 +146,7 @@ struct kvm_vcpu_stat {
151struct kvm_vcpu_init; 146struct kvm_vcpu_init;
152int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, 147int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
153 const struct kvm_vcpu_init *init); 148 const struct kvm_vcpu_init *init);
149int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init);
154unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu); 150unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
155int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices); 151int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
156struct kvm_one_reg; 152struct kvm_one_reg;
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
index efe609c6a3c9..680f74e67497 100644
--- a/arch/arm64/include/asm/kvm_mmu.h
+++ b/arch/arm64/include/asm/kvm_mmu.h
@@ -91,6 +91,7 @@ int kvm_mmu_init(void);
91void kvm_clear_hyp_idmap(void); 91void kvm_clear_hyp_idmap(void);
92 92
93#define kvm_set_pte(ptep, pte) set_pte(ptep, pte) 93#define kvm_set_pte(ptep, pte) set_pte(ptep, pte)
94#define kvm_set_pmd(pmdp, pmd) set_pmd(pmdp, pmd)
94 95
95static inline bool kvm_is_write_fault(unsigned long esr) 96static inline bool kvm_is_write_fault(unsigned long esr)
96{ 97{
@@ -116,13 +117,18 @@ static inline void kvm_set_s2pte_writable(pte_t *pte)
116 pte_val(*pte) |= PTE_S2_RDWR; 117 pte_val(*pte) |= PTE_S2_RDWR;
117} 118}
118 119
120static inline void kvm_set_s2pmd_writable(pmd_t *pmd)
121{
122 pmd_val(*pmd) |= PMD_S2_RDWR;
123}
124
119struct kvm; 125struct kvm;
120 126
121static inline void coherent_icache_guest_page(struct kvm *kvm, gfn_t gfn) 127static inline void coherent_icache_guest_page(struct kvm *kvm, hva_t hva,
128 unsigned long size)
122{ 129{
123 if (!icache_is_aliasing()) { /* PIPT */ 130 if (!icache_is_aliasing()) { /* PIPT */
124 unsigned long hva = gfn_to_hva(kvm, gfn); 131 flush_icache_range(hva, hva + size);
125 flush_icache_range(hva, hva + PAGE_SIZE);
126 } else if (!icache_is_aivivt()) { /* non ASID-tagged VIVT */ 132 } else if (!icache_is_aivivt()) { /* non ASID-tagged VIVT */
127 /* any kind of VIPT cache */ 133 /* any kind of VIPT cache */
128 __flush_icache_all(); 134 __flush_icache_all();
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index 20925bcf4e2a..37762175896f 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -33,18 +33,23 @@
33#define UL(x) _AC(x, UL) 33#define UL(x) _AC(x, UL)
34 34
35/* 35/*
36 * PAGE_OFFSET - the virtual address of the start of the kernel image. 36 * PAGE_OFFSET - the virtual address of the start of the kernel image (top
37 * (VA_BITS - 1))
37 * VA_BITS - the maximum number of bits for virtual addresses. 38 * VA_BITS - the maximum number of bits for virtual addresses.
38 * TASK_SIZE - the maximum size of a user space task. 39 * TASK_SIZE - the maximum size of a user space task.
39 * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area. 40 * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area.
40 * The module space lives between the addresses given by TASK_SIZE 41 * The module space lives between the addresses given by TASK_SIZE
41 * and PAGE_OFFSET - it must be within 128MB of the kernel text. 42 * and PAGE_OFFSET - it must be within 128MB of the kernel text.
42 */ 43 */
43#define PAGE_OFFSET UL(0xffffffc000000000) 44#ifdef CONFIG_ARM64_64K_PAGES
45#define VA_BITS (42)
46#else
47#define VA_BITS (39)
48#endif
49#define PAGE_OFFSET (UL(0xffffffffffffffff) << (VA_BITS - 1))
44#define MODULES_END (PAGE_OFFSET) 50#define MODULES_END (PAGE_OFFSET)
45#define MODULES_VADDR (MODULES_END - SZ_64M) 51#define MODULES_VADDR (MODULES_END - SZ_64M)
46#define EARLYCON_IOBASE (MODULES_VADDR - SZ_4M) 52#define EARLYCON_IOBASE (MODULES_VADDR - SZ_4M)
47#define VA_BITS (39)
48#define TASK_SIZE_64 (UL(1) << VA_BITS) 53#define TASK_SIZE_64 (UL(1) << VA_BITS)
49 54
50#ifdef CONFIG_COMPAT 55#ifdef CONFIG_COMPAT
diff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h
index f214069ec5d5..9bea6e74a001 100644
--- a/arch/arm64/include/asm/pgalloc.h
+++ b/arch/arm64/include/asm/pgalloc.h
@@ -63,9 +63,12 @@ pte_alloc_one(struct mm_struct *mm, unsigned long addr)
63 struct page *pte; 63 struct page *pte;
64 64
65 pte = alloc_pages(PGALLOC_GFP, 0); 65 pte = alloc_pages(PGALLOC_GFP, 0);
66 if (pte) 66 if (!pte)
67 pgtable_page_ctor(pte); 67 return NULL;
68 68 if (!pgtable_page_ctor(pte)) {
69 __free_page(pte);
70 return NULL;
71 }
69 return pte; 72 return pte;
70} 73}
71 74
diff --git a/arch/arm64/include/asm/pgtable-2level-hwdef.h b/arch/arm64/include/asm/pgtable-2level-hwdef.h
index 0a8ed3f94e93..2593b490c56a 100644
--- a/arch/arm64/include/asm/pgtable-2level-hwdef.h
+++ b/arch/arm64/include/asm/pgtable-2level-hwdef.h
@@ -21,10 +21,10 @@
21 * 8192 entries of 8 bytes each, occupying a 64KB page. Levels 0 and 1 are not 21 * 8192 entries of 8 bytes each, occupying a 64KB page. Levels 0 and 1 are not
22 * used. The 2nd level table (PGD for Linux) can cover a range of 4TB, each 22 * used. The 2nd level table (PGD for Linux) can cover a range of 4TB, each
23 * entry representing 512MB. The user and kernel address spaces are limited to 23 * entry representing 512MB. The user and kernel address spaces are limited to
24 * 512GB and therefore we only use 1024 entries in the PGD. 24 * 4TB in the 64KB page configuration.
25 */ 25 */
26#define PTRS_PER_PTE 8192 26#define PTRS_PER_PTE 8192
27#define PTRS_PER_PGD 1024 27#define PTRS_PER_PGD 8192
28 28
29/* 29/*
30 * PGDIR_SHIFT determines the size a top-level page table entry can map. 30 * PGDIR_SHIFT determines the size a top-level page table entry can map.
diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h
index d57e66845c86..755f86143320 100644
--- a/arch/arm64/include/asm/pgtable-hwdef.h
+++ b/arch/arm64/include/asm/pgtable-hwdef.h
@@ -85,6 +85,8 @@
85#define PTE_S2_RDONLY (_AT(pteval_t, 1) << 6) /* HAP[2:1] */ 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] */ 86#define PTE_S2_RDWR (_AT(pteval_t, 3) << 6) /* HAP[2:1] */
87 87
88#define PMD_S2_RDWR (_AT(pmdval_t, 3) << 6) /* HAP[2:1] */
89
88/* 90/*
89 * Memory Attribute override for Stage-2 (MemAttr[3:0]) 91 * Memory Attribute override for Stage-2 (MemAttr[3:0])
90 */ 92 */
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index f0bebc5e22cd..17bd3af0a117 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -33,7 +33,7 @@
33/* 33/*
34 * VMALLOC and SPARSEMEM_VMEMMAP ranges. 34 * VMALLOC and SPARSEMEM_VMEMMAP ranges.
35 */ 35 */
36#define VMALLOC_START UL(0xffffff8000000000) 36#define VMALLOC_START (UL(0xffffffffffffffff) << VA_BITS)
37#define VMALLOC_END (PAGE_OFFSET - UL(0x400000000) - SZ_64K) 37#define VMALLOC_END (PAGE_OFFSET - UL(0x400000000) - SZ_64K)
38 38
39#define vmemmap ((struct page *)(VMALLOC_END + SZ_64K)) 39#define vmemmap ((struct page *)(VMALLOC_END + SZ_64K))
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index ab239b2c456f..45b20cd6cbca 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -107,6 +107,11 @@ static inline void compat_start_thread(struct pt_regs *regs, unsigned long pc,
107 regs->pstate = COMPAT_PSR_MODE_USR; 107 regs->pstate = COMPAT_PSR_MODE_USR;
108 if (pc & 1) 108 if (pc & 1)
109 regs->pstate |= COMPAT_PSR_T_BIT; 109 regs->pstate |= COMPAT_PSR_T_BIT;
110
111#ifdef __AARCH64EB__
112 regs->pstate |= COMPAT_PSR_E_BIT;
113#endif
114
110 regs->compat_sp = sp; 115 regs->compat_sp = sp;
111} 116}
112#endif 117#endif
diff --git a/arch/arm64/include/asm/prom.h b/arch/arm64/include/asm/prom.h
deleted file mode 100644
index 68b90e682957..000000000000
--- a/arch/arm64/include/asm/prom.h
+++ /dev/null
@@ -1 +0,0 @@
1/* Empty for now */
diff --git a/arch/arm64/include/asm/psci.h b/arch/arm64/include/asm/psci.h
index 0604237ecd99..e5312ea0ec1a 100644
--- a/arch/arm64/include/asm/psci.h
+++ b/arch/arm64/include/asm/psci.h
@@ -14,25 +14,6 @@
14#ifndef __ASM_PSCI_H 14#ifndef __ASM_PSCI_H
15#define __ASM_PSCI_H 15#define __ASM_PSCI_H
16 16
17#define PSCI_POWER_STATE_TYPE_STANDBY 0
18#define PSCI_POWER_STATE_TYPE_POWER_DOWN 1
19
20struct psci_power_state {
21 u16 id;
22 u8 type;
23 u8 affinity_level;
24};
25
26struct psci_operations {
27 int (*cpu_suspend)(struct psci_power_state state,
28 unsigned long entry_point);
29 int (*cpu_off)(struct psci_power_state state);
30 int (*cpu_on)(unsigned long cpuid, unsigned long entry_point);
31 int (*migrate)(unsigned long cpuid);
32};
33
34extern struct psci_operations psci_ops;
35
36int psci_init(void); 17int psci_init(void);
37 18
38#endif /* __ASM_PSCI_H */ 19#endif /* __ASM_PSCI_H */
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h
index 0dacbbf9458b..0e7fa4963735 100644
--- a/arch/arm64/include/asm/ptrace.h
+++ b/arch/arm64/include/asm/ptrace.h
@@ -42,6 +42,7 @@
42#define COMPAT_PSR_MODE_UND 0x0000001b 42#define COMPAT_PSR_MODE_UND 0x0000001b
43#define COMPAT_PSR_MODE_SYS 0x0000001f 43#define COMPAT_PSR_MODE_SYS 0x0000001f
44#define COMPAT_PSR_T_BIT 0x00000020 44#define COMPAT_PSR_T_BIT 0x00000020
45#define COMPAT_PSR_E_BIT 0x00000200
45#define COMPAT_PSR_F_BIT 0x00000040 46#define COMPAT_PSR_F_BIT 0x00000040
46#define COMPAT_PSR_I_BIT 0x00000080 47#define COMPAT_PSR_I_BIT 0x00000080
47#define COMPAT_PSR_A_BIT 0x00000100 48#define COMPAT_PSR_A_BIT 0x00000100
diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h
index 4b8023c5d146..a498f2cd2c2a 100644
--- a/arch/arm64/include/asm/smp.h
+++ b/arch/arm64/include/asm/smp.h
@@ -60,21 +60,14 @@ struct secondary_data {
60 void *stack; 60 void *stack;
61}; 61};
62extern struct secondary_data secondary_data; 62extern struct secondary_data secondary_data;
63extern void secondary_holding_pen(void); 63extern void secondary_entry(void);
64extern volatile unsigned long secondary_holding_pen_release;
65 64
66extern void arch_send_call_function_single_ipi(int cpu); 65extern void arch_send_call_function_single_ipi(int cpu);
67extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 66extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
68 67
69struct device_node; 68extern int __cpu_disable(void);
70 69
71struct smp_enable_ops { 70extern void __cpu_die(unsigned int cpu);
72 const char *name; 71extern void cpu_die(void);
73 int (*init_cpu)(struct device_node *, int);
74 int (*prepare_cpu)(int);
75};
76
77extern const struct smp_enable_ops smp_spin_table_ops;
78extern const struct smp_enable_ops smp_psci_ops;
79 72
80#endif /* ifndef __ASM_SMP_H */ 73#endif /* ifndef __ASM_SMP_H */
diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h
index 0defa0728a9b..3d5cf064d7a1 100644
--- a/arch/arm64/include/asm/spinlock.h
+++ b/arch/arm64/include/asm/spinlock.h
@@ -22,17 +22,10 @@
22/* 22/*
23 * Spinlock implementation. 23 * Spinlock implementation.
24 * 24 *
25 * The old value is read exclusively and the new one, if unlocked, is written
26 * exclusively. In case of failure, the loop is restarted.
27 *
28 * The memory barriers are implicit with the load-acquire and store-release 25 * The memory barriers are implicit with the load-acquire and store-release
29 * instructions. 26 * instructions.
30 *
31 * Unlocked value: 0
32 * Locked value: 1
33 */ 27 */
34 28
35#define arch_spin_is_locked(x) ((x)->lock != 0)
36#define arch_spin_unlock_wait(lock) \ 29#define arch_spin_unlock_wait(lock) \
37 do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0) 30 do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0)
38 31
@@ -41,32 +34,51 @@
41static inline void arch_spin_lock(arch_spinlock_t *lock) 34static inline void arch_spin_lock(arch_spinlock_t *lock)
42{ 35{
43 unsigned int tmp; 36 unsigned int tmp;
37 arch_spinlock_t lockval, newval;
44 38
45 asm volatile( 39 asm volatile(
46 " sevl\n" 40 /* Atomically increment the next ticket. */
47 "1: wfe\n" 41" prfm pstl1strm, %3\n"
48 "2: ldaxr %w0, %1\n" 42"1: ldaxr %w0, %3\n"
49 " cbnz %w0, 1b\n" 43" add %w1, %w0, %w5\n"
50 " stxr %w0, %w2, %1\n" 44" stxr %w2, %w1, %3\n"
51 " cbnz %w0, 2b\n" 45" cbnz %w2, 1b\n"
52 : "=&r" (tmp), "+Q" (lock->lock) 46 /* Did we get the lock? */
53 : "r" (1) 47" eor %w1, %w0, %w0, ror #16\n"
54 : "cc", "memory"); 48" cbz %w1, 3f\n"
49 /*
50 * No: spin on the owner. Send a local event to avoid missing an
51 * unlock before the exclusive load.
52 */
53" sevl\n"
54"2: wfe\n"
55" ldaxrh %w2, %4\n"
56" eor %w1, %w2, %w0, lsr #16\n"
57" cbnz %w1, 2b\n"
58 /* We got the lock. Critical section starts here. */
59"3:"
60 : "=&r" (lockval), "=&r" (newval), "=&r" (tmp), "+Q" (*lock)
61 : "Q" (lock->owner), "I" (1 << TICKET_SHIFT)
62 : "memory");
55} 63}
56 64
57static inline int arch_spin_trylock(arch_spinlock_t *lock) 65static inline int arch_spin_trylock(arch_spinlock_t *lock)
58{ 66{
59 unsigned int tmp; 67 unsigned int tmp;
68 arch_spinlock_t lockval;
60 69
61 asm volatile( 70 asm volatile(
62 "2: ldaxr %w0, %1\n" 71" prfm pstl1strm, %2\n"
63 " cbnz %w0, 1f\n" 72"1: ldaxr %w0, %2\n"
64 " stxr %w0, %w2, %1\n" 73" eor %w1, %w0, %w0, ror #16\n"
65 " cbnz %w0, 2b\n" 74" cbnz %w1, 2f\n"
66 "1:\n" 75" add %w0, %w0, %3\n"
67 : "=&r" (tmp), "+Q" (lock->lock) 76" stxr %w1, %w0, %2\n"
68 : "r" (1) 77" cbnz %w1, 1b\n"
69 : "cc", "memory"); 78"2:"
79 : "=&r" (lockval), "=&r" (tmp), "+Q" (*lock)
80 : "I" (1 << TICKET_SHIFT)
81 : "memory");
70 82
71 return !tmp; 83 return !tmp;
72} 84}
@@ -74,9 +86,28 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)
74static inline void arch_spin_unlock(arch_spinlock_t *lock) 86static inline void arch_spin_unlock(arch_spinlock_t *lock)
75{ 87{
76 asm volatile( 88 asm volatile(
77 " stlr %w1, %0\n" 89" stlrh %w1, %0\n"
78 : "=Q" (lock->lock) : "r" (0) : "memory"); 90 : "=Q" (lock->owner)
91 : "r" (lock->owner + 1)
92 : "memory");
93}
94
95static inline int arch_spin_value_unlocked(arch_spinlock_t lock)
96{
97 return lock.owner == lock.next;
98}
99
100static inline int arch_spin_is_locked(arch_spinlock_t *lock)
101{
102 return !arch_spin_value_unlocked(ACCESS_ONCE(*lock));
103}
104
105static inline int arch_spin_is_contended(arch_spinlock_t *lock)
106{
107 arch_spinlock_t lockval = ACCESS_ONCE(*lock);
108 return (lockval.next - lockval.owner) > 1;
79} 109}
110#define arch_spin_is_contended arch_spin_is_contended
80 111
81/* 112/*
82 * Write lock implementation. 113 * Write lock implementation.
diff --git a/arch/arm64/include/asm/spinlock_types.h b/arch/arm64/include/asm/spinlock_types.h
index 9a494346efed..b8d383665f56 100644
--- a/arch/arm64/include/asm/spinlock_types.h
+++ b/arch/arm64/include/asm/spinlock_types.h
@@ -20,14 +20,19 @@
20# error "please don't include this file directly" 20# error "please don't include this file directly"
21#endif 21#endif
22 22
23/* We only require natural alignment for exclusive accesses. */ 23#define TICKET_SHIFT 16
24#define __lock_aligned
25 24
26typedef struct { 25typedef struct {
27 volatile unsigned int lock; 26#ifdef __AARCH64EB__
28} arch_spinlock_t; 27 u16 next;
28 u16 owner;
29#else
30 u16 owner;
31 u16 next;
32#endif
33} __aligned(4) arch_spinlock_t;
29 34
30#define __ARCH_SPIN_LOCK_UNLOCKED { 0 } 35#define __ARCH_SPIN_LOCK_UNLOCKED { 0 , 0 }
31 36
32typedef struct { 37typedef struct {
33 volatile unsigned int lock; 38 volatile unsigned int lock;
diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
index 89c047f9a971..70ba9d4ee978 100644
--- a/arch/arm64/include/asm/syscall.h
+++ b/arch/arm64/include/asm/syscall.h
@@ -59,6 +59,9 @@ static inline void syscall_get_arguments(struct task_struct *task,
59 unsigned int i, unsigned int n, 59 unsigned int i, unsigned int n,
60 unsigned long *args) 60 unsigned long *args)
61{ 61{
62 if (n == 0)
63 return;
64
62 if (i + n > SYSCALL_MAX_ARGS) { 65 if (i + n > SYSCALL_MAX_ARGS) {
63 unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i; 66 unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;
64 unsigned int n_bad = n + i - SYSCALL_MAX_ARGS; 67 unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;
@@ -82,6 +85,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
82 unsigned int i, unsigned int n, 85 unsigned int i, unsigned int n,
83 const unsigned long *args) 86 const unsigned long *args)
84{ 87{
88 if (n == 0)
89 return;
90
85 if (i + n > SYSCALL_MAX_ARGS) { 91 if (i + n > SYSCALL_MAX_ARGS) {
86 pr_warning("%s called with max args %d, handling only %d\n", 92 pr_warning("%s called with max args %d, handling only %d\n",
87 __func__, i + n, SYSCALL_MAX_ARGS); 93 __func__, i + n, SYSCALL_MAX_ARGS);
diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
index edb3d5c73a32..7ecc2b23882e 100644
--- a/arch/arm64/include/asm/uaccess.h
+++ b/arch/arm64/include/asm/uaccess.h
@@ -166,9 +166,10 @@ do { \
166 166
167#define get_user(x, ptr) \ 167#define get_user(x, ptr) \
168({ \ 168({ \
169 __typeof__(*(ptr)) __user *__p = (ptr); \
169 might_fault(); \ 170 might_fault(); \
170 access_ok(VERIFY_READ, (ptr), sizeof(*(ptr))) ? \ 171 access_ok(VERIFY_READ, __p, sizeof(*__p)) ? \
171 __get_user((x), (ptr)) : \ 172 __get_user((x), __p) : \
172 ((x) = 0, -EFAULT); \ 173 ((x) = 0, -EFAULT); \
173}) 174})
174 175
@@ -227,9 +228,10 @@ do { \
227 228
228#define put_user(x, ptr) \ 229#define put_user(x, ptr) \
229({ \ 230({ \
231 __typeof__(*(ptr)) __user *__p = (ptr); \
230 might_fault(); \ 232 might_fault(); \
231 access_ok(VERIFY_WRITE, (ptr), sizeof(*(ptr))) ? \ 233 access_ok(VERIFY_WRITE, __p, sizeof(*__p)) ? \
232 __put_user((x), (ptr)) : \ 234 __put_user((x), __p) : \
233 -EFAULT; \ 235 -EFAULT; \
234}) 236})
235 237
diff --git a/arch/arm64/include/asm/virt.h b/arch/arm64/include/asm/virt.h
index 26e310c54344..130e2be952cf 100644
--- a/arch/arm64/include/asm/virt.h
+++ b/arch/arm64/include/asm/virt.h
@@ -18,7 +18,8 @@
18#ifndef __ASM__VIRT_H 18#ifndef __ASM__VIRT_H
19#define __ASM__VIRT_H 19#define __ASM__VIRT_H
20 20
21#define BOOT_CPU_MODE_EL2 (0x0e12b007) 21#define BOOT_CPU_MODE_EL1 (0xe11)
22#define BOOT_CPU_MODE_EL2 (0xe12)
22 23
23#ifndef __ASSEMBLY__ 24#ifndef __ASSEMBLY__
24#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
diff --git a/arch/arm64/include/asm/xen/page-coherent.h b/arch/arm64/include/asm/xen/page-coherent.h
new file mode 100644
index 000000000000..2820f1a6eebe
--- /dev/null
+++ b/arch/arm64/include/asm/xen/page-coherent.h
@@ -0,0 +1,47 @@
1#ifndef _ASM_ARM64_XEN_PAGE_COHERENT_H
2#define _ASM_ARM64_XEN_PAGE_COHERENT_H
3
4#include <asm/page.h>
5#include <linux/dma-attrs.h>
6#include <linux/dma-mapping.h>
7
8static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size,
9 dma_addr_t *dma_handle, gfp_t flags,
10 struct dma_attrs *attrs)
11{
12 return __generic_dma_ops(hwdev)->alloc(hwdev, size, dma_handle, flags, attrs);
13}
14
15static inline void xen_free_coherent_pages(struct device *hwdev, size_t size,
16 void *cpu_addr, dma_addr_t dma_handle,
17 struct dma_attrs *attrs)
18{
19 __generic_dma_ops(hwdev)->free(hwdev, size, cpu_addr, dma_handle, attrs);
20}
21
22static inline void xen_dma_map_page(struct device *hwdev, struct page *page,
23 unsigned long offset, size_t size, enum dma_data_direction dir,
24 struct dma_attrs *attrs)
25{
26 __generic_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs);
27}
28
29static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle,
30 size_t size, enum dma_data_direction dir,
31 struct dma_attrs *attrs)
32{
33 __generic_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs);
34}
35
36static inline void xen_dma_sync_single_for_cpu(struct device *hwdev,
37 dma_addr_t handle, size_t size, enum dma_data_direction dir)
38{
39 __generic_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir);
40}
41
42static inline void xen_dma_sync_single_for_device(struct device *hwdev,
43 dma_addr_t handle, size_t size, enum dma_data_direction dir)
44{
45 __generic_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir);
46}
47#endif /* _ASM_ARM64_XEN_PAGE_COHERENT_H */
diff --git a/arch/arm64/include/uapi/asm/byteorder.h b/arch/arm64/include/uapi/asm/byteorder.h
index 2b92046aafc5..dc19e9537f0d 100644
--- a/arch/arm64/include/uapi/asm/byteorder.h
+++ b/arch/arm64/include/uapi/asm/byteorder.h
@@ -16,6 +16,10 @@
16#ifndef __ASM_BYTEORDER_H 16#ifndef __ASM_BYTEORDER_H
17#define __ASM_BYTEORDER_H 17#define __ASM_BYTEORDER_H
18 18
19#ifdef __AARCH64EB__
20#include <linux/byteorder/big_endian.h>
21#else
19#include <linux/byteorder/little_endian.h> 22#include <linux/byteorder/little_endian.h>
23#endif
20 24
21#endif /* __ASM_BYTEORDER_H */ 25#endif /* __ASM_BYTEORDER_H */
diff --git a/arch/arm64/include/uapi/asm/hwcap.h b/arch/arm64/include/uapi/asm/hwcap.h
index eea497578b87..9b12476e9c85 100644
--- a/arch/arm64/include/uapi/asm/hwcap.h
+++ b/arch/arm64/include/uapi/asm/hwcap.h
@@ -21,6 +21,7 @@
21 */ 21 */
22#define HWCAP_FP (1 << 0) 22#define HWCAP_FP (1 << 0)
23#define HWCAP_ASIMD (1 << 1) 23#define HWCAP_ASIMD (1 << 1)
24#define HWCAP_EVTSTRM (1 << 2)
24 25
25 26
26#endif /* _UAPI__ASM_HWCAP_H */ 27#endif /* _UAPI__ASM_HWCAP_H */
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 7b4b564961d4..5ba2fd43a75b 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -9,12 +9,12 @@ AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
9arm64-obj-y := cputable.o debug-monitors.o entry.o irq.o fpsimd.o \ 9arm64-obj-y := cputable.o debug-monitors.o entry.o irq.o fpsimd.o \
10 entry-fpsimd.o process.o ptrace.o setup.o signal.o \ 10 entry-fpsimd.o process.o ptrace.o setup.o signal.o \
11 sys.o stacktrace.o time.o traps.o io.o vdso.o \ 11 sys.o stacktrace.o time.o traps.o io.o vdso.o \
12 hyp-stub.o psci.o 12 hyp-stub.o psci.o cpu_ops.o
13 13
14arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \ 14arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \
15 sys_compat.o 15 sys_compat.o
16arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o 16arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o
17arm64-obj-$(CONFIG_SMP) += smp.o smp_spin_table.o smp_psci.o 17arm64-obj-$(CONFIG_SMP) += smp.o smp_spin_table.o
18arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o 18arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o
19arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT)+= hw_breakpoint.o 19arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT)+= hw_breakpoint.o
20arm64-obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 20arm64-obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
diff --git a/arch/arm64/kernel/arm64ksyms.c b/arch/arm64/kernel/arm64ksyms.c
index 41b4f626d554..e7ee770c0697 100644
--- a/arch/arm64/kernel/arm64ksyms.c
+++ b/arch/arm64/kernel/arm64ksyms.c
@@ -39,6 +39,7 @@ EXPORT_SYMBOL(clear_page);
39EXPORT_SYMBOL(__copy_from_user); 39EXPORT_SYMBOL(__copy_from_user);
40EXPORT_SYMBOL(__copy_to_user); 40EXPORT_SYMBOL(__copy_to_user);
41EXPORT_SYMBOL(__clear_user); 41EXPORT_SYMBOL(__clear_user);
42EXPORT_SYMBOL(__copy_in_user);
42 43
43 /* physical memory */ 44 /* physical memory */
44EXPORT_SYMBOL(memstart_addr); 45EXPORT_SYMBOL(memstart_addr);
diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c
new file mode 100644
index 000000000000..d62d12fb36c8
--- /dev/null
+++ b/arch/arm64/kernel/cpu_ops.c
@@ -0,0 +1,87 @@
1/*
2 * CPU kernel entry/exit control
3 *
4 * Copyright (C) 2013 ARM Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <asm/cpu_ops.h>
20#include <asm/smp_plat.h>
21#include <linux/errno.h>
22#include <linux/of.h>
23#include <linux/string.h>
24
25extern const struct cpu_operations smp_spin_table_ops;
26extern const struct cpu_operations cpu_psci_ops;
27
28const struct cpu_operations *cpu_ops[NR_CPUS];
29
30static const struct cpu_operations *supported_cpu_ops[] __initconst = {
31#ifdef CONFIG_SMP
32 &smp_spin_table_ops,
33 &cpu_psci_ops,
34#endif
35 NULL,
36};
37
38static const struct cpu_operations * __init cpu_get_ops(const char *name)
39{
40 const struct cpu_operations **ops = supported_cpu_ops;
41
42 while (*ops) {
43 if (!strcmp(name, (*ops)->name))
44 return *ops;
45
46 ops++;
47 }
48
49 return NULL;
50}
51
52/*
53 * Read a cpu's enable method from the device tree and record it in cpu_ops.
54 */
55int __init cpu_read_ops(struct device_node *dn, int cpu)
56{
57 const char *enable_method = of_get_property(dn, "enable-method", NULL);
58 if (!enable_method) {
59 /*
60 * The boot CPU may not have an enable method (e.g. when
61 * spin-table is used for secondaries). Don't warn spuriously.
62 */
63 if (cpu != 0)
64 pr_err("%s: missing enable-method property\n",
65 dn->full_name);
66 return -ENOENT;
67 }
68
69 cpu_ops[cpu] = cpu_get_ops(enable_method);
70 if (!cpu_ops[cpu]) {
71 pr_warn("%s: unsupported enable-method property: %s\n",
72 dn->full_name, enable_method);
73 return -EOPNOTSUPP;
74 }
75
76 return 0;
77}
78
79void __init cpu_read_bootcpu_ops(void)
80{
81 struct device_node *dn = of_get_cpu_node(0, NULL);
82 if (!dn) {
83 pr_err("Failed to find device node for boot cpu\n");
84 return;
85 }
86 cpu_read_ops(dn, 0);
87}
diff --git a/arch/arm64/kernel/cputable.c b/arch/arm64/kernel/cputable.c
index 63cfc4a43f4e..fd3993cb060f 100644
--- a/arch/arm64/kernel/cputable.c
+++ b/arch/arm64/kernel/cputable.c
@@ -22,7 +22,7 @@
22 22
23extern unsigned long __cpu_setup(void); 23extern unsigned long __cpu_setup(void);
24 24
25struct cpu_info __initdata cpu_table[] = { 25struct cpu_info cpu_table[] = {
26 { 26 {
27 .cpu_id_val = 0x000f0000, 27 .cpu_id_val = 0x000f0000,
28 .cpu_id_mask = 0x000f0000, 28 .cpu_id_mask = 0x000f0000,
diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
index cbfacf7fb438..6a0a9b132d7a 100644
--- a/arch/arm64/kernel/debug-monitors.c
+++ b/arch/arm64/kernel/debug-monitors.c
@@ -27,7 +27,6 @@
27#include <linux/uaccess.h> 27#include <linux/uaccess.h>
28 28
29#include <asm/debug-monitors.h> 29#include <asm/debug-monitors.h>
30#include <asm/local.h>
31#include <asm/cputype.h> 30#include <asm/cputype.h>
32#include <asm/system_misc.h> 31#include <asm/system_misc.h>
33 32
@@ -89,8 +88,8 @@ early_param("nodebugmon", early_debug_disable);
89 * Keep track of debug users on each core. 88 * Keep track of debug users on each core.
90 * The ref counts are per-cpu so we use a local_t type. 89 * The ref counts are per-cpu so we use a local_t type.
91 */ 90 */
92static DEFINE_PER_CPU(local_t, mde_ref_count); 91static DEFINE_PER_CPU(int, mde_ref_count);
93static DEFINE_PER_CPU(local_t, kde_ref_count); 92static DEFINE_PER_CPU(int, kde_ref_count);
94 93
95void enable_debug_monitors(enum debug_el el) 94void enable_debug_monitors(enum debug_el el)
96{ 95{
@@ -98,11 +97,11 @@ void enable_debug_monitors(enum debug_el el)
98 97
99 WARN_ON(preemptible()); 98 WARN_ON(preemptible());
100 99
101 if (local_inc_return(&__get_cpu_var(mde_ref_count)) == 1) 100 if (this_cpu_inc_return(mde_ref_count) == 1)
102 enable = DBG_MDSCR_MDE; 101 enable = DBG_MDSCR_MDE;
103 102
104 if (el == DBG_ACTIVE_EL1 && 103 if (el == DBG_ACTIVE_EL1 &&
105 local_inc_return(&__get_cpu_var(kde_ref_count)) == 1) 104 this_cpu_inc_return(kde_ref_count) == 1)
106 enable |= DBG_MDSCR_KDE; 105 enable |= DBG_MDSCR_KDE;
107 106
108 if (enable && debug_enabled) { 107 if (enable && debug_enabled) {
@@ -118,11 +117,11 @@ void disable_debug_monitors(enum debug_el el)
118 117
119 WARN_ON(preemptible()); 118 WARN_ON(preemptible());
120 119
121 if (local_dec_and_test(&__get_cpu_var(mde_ref_count))) 120 if (this_cpu_dec_return(mde_ref_count) == 0)
122 disable = ~DBG_MDSCR_MDE; 121 disable = ~DBG_MDSCR_MDE;
123 122
124 if (el == DBG_ACTIVE_EL1 && 123 if (el == DBG_ACTIVE_EL1 &&
125 local_dec_and_test(&__get_cpu_var(kde_ref_count))) 124 this_cpu_dec_return(kde_ref_count) == 0)
126 disable &= ~DBG_MDSCR_KDE; 125 disable &= ~DBG_MDSCR_KDE;
127 126
128 if (disable) { 127 if (disable) {
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index 3881fd115ebb..e1166145ca29 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -311,14 +311,14 @@ el1_irq:
311#endif 311#endif
312#ifdef CONFIG_PREEMPT 312#ifdef CONFIG_PREEMPT
313 get_thread_info tsk 313 get_thread_info tsk
314 ldr x24, [tsk, #TI_PREEMPT] // get preempt count 314 ldr w24, [tsk, #TI_PREEMPT] // get preempt count
315 add x0, x24, #1 // increment it 315 add w0, w24, #1 // increment it
316 str x0, [tsk, #TI_PREEMPT] 316 str w0, [tsk, #TI_PREEMPT]
317#endif 317#endif
318 irq_handler 318 irq_handler
319#ifdef CONFIG_PREEMPT 319#ifdef CONFIG_PREEMPT
320 str x24, [tsk, #TI_PREEMPT] // restore preempt count 320 str w24, [tsk, #TI_PREEMPT] // restore preempt count
321 cbnz x24, 1f // preempt count != 0 321 cbnz w24, 1f // preempt count != 0
322 ldr x0, [tsk, #TI_FLAGS] // get flags 322 ldr x0, [tsk, #TI_FLAGS] // get flags
323 tbz x0, #TIF_NEED_RESCHED, 1f // needs rescheduling? 323 tbz x0, #TIF_NEED_RESCHED, 1f // needs rescheduling?
324 bl el1_preempt 324 bl el1_preempt
@@ -509,15 +509,15 @@ el0_irq_naked:
509#endif 509#endif
510 get_thread_info tsk 510 get_thread_info tsk
511#ifdef CONFIG_PREEMPT 511#ifdef CONFIG_PREEMPT
512 ldr x24, [tsk, #TI_PREEMPT] // get preempt count 512 ldr w24, [tsk, #TI_PREEMPT] // get preempt count
513 add x23, x24, #1 // increment it 513 add w23, w24, #1 // increment it
514 str x23, [tsk, #TI_PREEMPT] 514 str w23, [tsk, #TI_PREEMPT]
515#endif 515#endif
516 irq_handler 516 irq_handler
517#ifdef CONFIG_PREEMPT 517#ifdef CONFIG_PREEMPT
518 ldr x0, [tsk, #TI_PREEMPT] 518 ldr w0, [tsk, #TI_PREEMPT]
519 str x24, [tsk, #TI_PREEMPT] 519 str w24, [tsk, #TI_PREEMPT]
520 cmp x0, x23 520 cmp w0, w23
521 b.eq 1f 521 b.eq 1f
522 mov x1, #0 522 mov x1, #0
523 str x1, [x1] // BUG 523 str x1, [x1] // BUG
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index 1f2e4d5a5c0f..bb785d23dbde 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -80,8 +80,10 @@ void fpsimd_thread_switch(struct task_struct *next)
80 80
81void fpsimd_flush_thread(void) 81void fpsimd_flush_thread(void)
82{ 82{
83 preempt_disable();
83 memset(&current->thread.fpsimd_state, 0, sizeof(struct fpsimd_state)); 84 memset(&current->thread.fpsimd_state, 0, sizeof(struct fpsimd_state));
84 fpsimd_load_state(&current->thread.fpsimd_state); 85 fpsimd_load_state(&current->thread.fpsimd_state);
86 preempt_enable();
85} 87}
86 88
87#ifdef CONFIG_KERNEL_MODE_NEON 89#ifdef CONFIG_KERNEL_MODE_NEON
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 7090c126797c..7009387348b7 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -123,8 +123,9 @@
123 123
124ENTRY(stext) 124ENTRY(stext)
125 mov x21, x0 // x21=FDT 125 mov x21, x0 // x21=FDT
126 bl el2_setup // Drop to EL1, w20=cpu_boot_mode
126 bl __calc_phys_offset // x24=PHYS_OFFSET, x28=PHYS_OFFSET-PAGE_OFFSET 127 bl __calc_phys_offset // x24=PHYS_OFFSET, x28=PHYS_OFFSET-PAGE_OFFSET
127 bl el2_setup // Drop to EL1 128 bl set_cpu_boot_mode_flag
128 mrs x22, midr_el1 // x22=cpuid 129 mrs x22, midr_el1 // x22=cpuid
129 mov x0, x22 130 mov x0, x22
130 bl lookup_processor_type 131 bl lookup_processor_type
@@ -150,21 +151,30 @@ ENDPROC(stext)
150/* 151/*
151 * If we're fortunate enough to boot at EL2, ensure that the world is 152 * If we're fortunate enough to boot at EL2, ensure that the world is
152 * sane before dropping to EL1. 153 * sane before dropping to EL1.
154 *
155 * Returns either BOOT_CPU_MODE_EL1 or BOOT_CPU_MODE_EL2 in x20 if
156 * booted in EL1 or EL2 respectively.
153 */ 157 */
154ENTRY(el2_setup) 158ENTRY(el2_setup)
155 mrs x0, CurrentEL 159 mrs x0, CurrentEL
156 cmp x0, #PSR_MODE_EL2t 160 cmp x0, #PSR_MODE_EL2t
157 ccmp x0, #PSR_MODE_EL2h, #0x4, ne 161 ccmp x0, #PSR_MODE_EL2h, #0x4, ne
158 ldr x0, =__boot_cpu_mode // Compute __boot_cpu_mode 162 b.ne 1f
159 add x0, x0, x28 163 mrs x0, sctlr_el2
160 b.eq 1f 164CPU_BE( orr x0, x0, #(1 << 25) ) // Set the EE bit for EL2
161 str wzr, [x0] // Remember we don't have EL2... 165CPU_LE( bic x0, x0, #(1 << 25) ) // Clear the EE bit for EL2
166 msr sctlr_el2, x0
167 b 2f
1681: mrs x0, sctlr_el1
169CPU_BE( orr x0, x0, #(3 << 24) ) // Set the EE and E0E bits for EL1
170CPU_LE( bic x0, x0, #(3 << 24) ) // Clear the EE and E0E bits for EL1
171 msr sctlr_el1, x0
172 mov w20, #BOOT_CPU_MODE_EL1 // This cpu booted in EL1
173 isb
162 ret 174 ret
163 175
164 /* Hyp configuration. */ 176 /* Hyp configuration. */
1651: ldr w1, =BOOT_CPU_MODE_EL2 1772: mov x0, #(1 << 31) // 64-bit EL1
166 str w1, [x0, #4] // This CPU has EL2
167 mov x0, #(1 << 31) // 64-bit EL1
168 msr hcr_el2, x0 178 msr hcr_el2, x0
169 179
170 /* Generic timers. */ 180 /* Generic timers. */
@@ -181,7 +191,8 @@ ENTRY(el2_setup)
181 191
182 /* sctlr_el1 */ 192 /* sctlr_el1 */
183 mov x0, #0x0800 // Set/clear RES{1,0} bits 193 mov x0, #0x0800 // Set/clear RES{1,0} bits
184 movk x0, #0x30d0, lsl #16 194CPU_BE( movk x0, #0x33d0, lsl #16 ) // Set EE and E0E on BE systems
195CPU_LE( movk x0, #0x30d0, lsl #16 ) // Clear EE and E0E on LE systems
185 msr sctlr_el1, x0 196 msr sctlr_el1, x0
186 197
187 /* Coprocessor traps. */ 198 /* Coprocessor traps. */
@@ -204,10 +215,25 @@ ENTRY(el2_setup)
204 PSR_MODE_EL1h) 215 PSR_MODE_EL1h)
205 msr spsr_el2, x0 216 msr spsr_el2, x0
206 msr elr_el2, lr 217 msr elr_el2, lr
218 mov w20, #BOOT_CPU_MODE_EL2 // This CPU booted in EL2
207 eret 219 eret
208ENDPROC(el2_setup) 220ENDPROC(el2_setup)
209 221
210/* 222/*
223 * Sets the __boot_cpu_mode flag depending on the CPU boot mode passed
224 * in x20. See arch/arm64/include/asm/virt.h for more info.
225 */
226ENTRY(set_cpu_boot_mode_flag)
227 ldr x1, =__boot_cpu_mode // Compute __boot_cpu_mode
228 add x1, x1, x28
229 cmp w20, #BOOT_CPU_MODE_EL2
230 b.ne 1f
231 add x1, x1, #4
2321: str w20, [x1] // This CPU has booted in EL1
233 ret
234ENDPROC(set_cpu_boot_mode_flag)
235
236/*
211 * We need to find out the CPU boot mode long after boot, so we need to 237 * We need to find out the CPU boot mode long after boot, so we need to
212 * store it in a writable variable. 238 * store it in a writable variable.
213 * 239 *
@@ -225,7 +251,6 @@ ENTRY(__boot_cpu_mode)
225 .quad PAGE_OFFSET 251 .quad PAGE_OFFSET
226 252
227#ifdef CONFIG_SMP 253#ifdef CONFIG_SMP
228 .pushsection .smp.pen.text, "ax"
229 .align 3 254 .align 3
2301: .quad . 2551: .quad .
231 .quad secondary_holding_pen_release 256 .quad secondary_holding_pen_release
@@ -235,8 +260,9 @@ ENTRY(__boot_cpu_mode)
235 * cores are held until we're ready for them to initialise. 260 * cores are held until we're ready for them to initialise.
236 */ 261 */
237ENTRY(secondary_holding_pen) 262ENTRY(secondary_holding_pen)
238 bl __calc_phys_offset // x24=phys offset 263 bl el2_setup // Drop to EL1, w20=cpu_boot_mode
239 bl el2_setup // Drop to EL1 264 bl __calc_phys_offset // x24=PHYS_OFFSET, x28=PHYS_OFFSET-PAGE_OFFSET
265 bl set_cpu_boot_mode_flag
240 mrs x0, mpidr_el1 266 mrs x0, mpidr_el1
241 ldr x1, =MPIDR_HWID_BITMASK 267 ldr x1, =MPIDR_HWID_BITMASK
242 and x0, x0, x1 268 and x0, x0, x1
@@ -250,7 +276,16 @@ pen: ldr x4, [x3]
250 wfe 276 wfe
251 b pen 277 b pen
252ENDPROC(secondary_holding_pen) 278ENDPROC(secondary_holding_pen)
253 .popsection 279
280 /*
281 * Secondary entry point that jumps straight into the kernel. Only to
282 * be used where CPUs are brought online dynamically by the kernel.
283 */
284ENTRY(secondary_entry)
285 bl __calc_phys_offset // x2=phys offset
286 bl el2_setup // Drop to EL1
287 b secondary_startup
288ENDPROC(secondary_entry)
254 289
255ENTRY(secondary_startup) 290ENTRY(secondary_startup)
256 /* 291 /*
diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
index 329218ca9ffb..ff516f6691e4 100644
--- a/arch/arm64/kernel/hw_breakpoint.c
+++ b/arch/arm64/kernel/hw_breakpoint.c
@@ -184,14 +184,14 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
184 /* Breakpoint */ 184 /* Breakpoint */
185 ctrl_reg = AARCH64_DBG_REG_BCR; 185 ctrl_reg = AARCH64_DBG_REG_BCR;
186 val_reg = AARCH64_DBG_REG_BVR; 186 val_reg = AARCH64_DBG_REG_BVR;
187 slots = __get_cpu_var(bp_on_reg); 187 slots = this_cpu_ptr(bp_on_reg);
188 max_slots = core_num_brps; 188 max_slots = core_num_brps;
189 reg_enable = !debug_info->bps_disabled; 189 reg_enable = !debug_info->bps_disabled;
190 } else { 190 } else {
191 /* Watchpoint */ 191 /* Watchpoint */
192 ctrl_reg = AARCH64_DBG_REG_WCR; 192 ctrl_reg = AARCH64_DBG_REG_WCR;
193 val_reg = AARCH64_DBG_REG_WVR; 193 val_reg = AARCH64_DBG_REG_WVR;
194 slots = __get_cpu_var(wp_on_reg); 194 slots = this_cpu_ptr(wp_on_reg);
195 max_slots = core_num_wrps; 195 max_slots = core_num_wrps;
196 reg_enable = !debug_info->wps_disabled; 196 reg_enable = !debug_info->wps_disabled;
197 } 197 }
@@ -230,12 +230,12 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp)
230 if (info->ctrl.type == ARM_BREAKPOINT_EXECUTE) { 230 if (info->ctrl.type == ARM_BREAKPOINT_EXECUTE) {
231 /* Breakpoint */ 231 /* Breakpoint */
232 base = AARCH64_DBG_REG_BCR; 232 base = AARCH64_DBG_REG_BCR;
233 slots = __get_cpu_var(bp_on_reg); 233 slots = this_cpu_ptr(bp_on_reg);
234 max_slots = core_num_brps; 234 max_slots = core_num_brps;
235 } else { 235 } else {
236 /* Watchpoint */ 236 /* Watchpoint */
237 base = AARCH64_DBG_REG_WCR; 237 base = AARCH64_DBG_REG_WCR;
238 slots = __get_cpu_var(wp_on_reg); 238 slots = this_cpu_ptr(wp_on_reg);
239 max_slots = core_num_wrps; 239 max_slots = core_num_wrps;
240 } 240 }
241 241
@@ -505,11 +505,11 @@ static void toggle_bp_registers(int reg, enum debug_el el, int enable)
505 505
506 switch (reg) { 506 switch (reg) {
507 case AARCH64_DBG_REG_BCR: 507 case AARCH64_DBG_REG_BCR:
508 slots = __get_cpu_var(bp_on_reg); 508 slots = this_cpu_ptr(bp_on_reg);
509 max_slots = core_num_brps; 509 max_slots = core_num_brps;
510 break; 510 break;
511 case AARCH64_DBG_REG_WCR: 511 case AARCH64_DBG_REG_WCR:
512 slots = __get_cpu_var(wp_on_reg); 512 slots = this_cpu_ptr(wp_on_reg);
513 max_slots = core_num_wrps; 513 max_slots = core_num_wrps;
514 break; 514 break;
515 default: 515 default:
@@ -546,7 +546,7 @@ static int breakpoint_handler(unsigned long unused, unsigned int esr,
546 struct debug_info *debug_info; 546 struct debug_info *debug_info;
547 struct arch_hw_breakpoint_ctrl ctrl; 547 struct arch_hw_breakpoint_ctrl ctrl;
548 548
549 slots = (struct perf_event **)__get_cpu_var(bp_on_reg); 549 slots = this_cpu_ptr(bp_on_reg);
550 addr = instruction_pointer(regs); 550 addr = instruction_pointer(regs);
551 debug_info = &current->thread.debug; 551 debug_info = &current->thread.debug;
552 552
@@ -596,7 +596,7 @@ unlock:
596 user_enable_single_step(current); 596 user_enable_single_step(current);
597 } else { 597 } else {
598 toggle_bp_registers(AARCH64_DBG_REG_BCR, DBG_ACTIVE_EL1, 0); 598 toggle_bp_registers(AARCH64_DBG_REG_BCR, DBG_ACTIVE_EL1, 0);
599 kernel_step = &__get_cpu_var(stepping_kernel_bp); 599 kernel_step = this_cpu_ptr(&stepping_kernel_bp);
600 600
601 if (*kernel_step != ARM_KERNEL_STEP_NONE) 601 if (*kernel_step != ARM_KERNEL_STEP_NONE)
602 return 0; 602 return 0;
@@ -623,7 +623,7 @@ static int watchpoint_handler(unsigned long addr, unsigned int esr,
623 struct arch_hw_breakpoint *info; 623 struct arch_hw_breakpoint *info;
624 struct arch_hw_breakpoint_ctrl ctrl; 624 struct arch_hw_breakpoint_ctrl ctrl;
625 625
626 slots = (struct perf_event **)__get_cpu_var(wp_on_reg); 626 slots = this_cpu_ptr(wp_on_reg);
627 debug_info = &current->thread.debug; 627 debug_info = &current->thread.debug;
628 628
629 for (i = 0; i < core_num_wrps; ++i) { 629 for (i = 0; i < core_num_wrps; ++i) {
@@ -698,7 +698,7 @@ unlock:
698 user_enable_single_step(current); 698 user_enable_single_step(current);
699 } else { 699 } else {
700 toggle_bp_registers(AARCH64_DBG_REG_WCR, DBG_ACTIVE_EL1, 0); 700 toggle_bp_registers(AARCH64_DBG_REG_WCR, DBG_ACTIVE_EL1, 0);
701 kernel_step = &__get_cpu_var(stepping_kernel_bp); 701 kernel_step = this_cpu_ptr(&stepping_kernel_bp);
702 702
703 if (*kernel_step != ARM_KERNEL_STEP_NONE) 703 if (*kernel_step != ARM_KERNEL_STEP_NONE)
704 return 0; 704 return 0;
@@ -722,7 +722,7 @@ int reinstall_suspended_bps(struct pt_regs *regs)
722 struct debug_info *debug_info = &current->thread.debug; 722 struct debug_info *debug_info = &current->thread.debug;
723 int handled_exception = 0, *kernel_step; 723 int handled_exception = 0, *kernel_step;
724 724
725 kernel_step = &__get_cpu_var(stepping_kernel_bp); 725 kernel_step = this_cpu_ptr(&stepping_kernel_bp);
726 726
727 /* 727 /*
728 * Called from single-step exception handler. 728 * Called from single-step exception handler.
diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c
index ecb3354292ed..473e5dbf8f39 100644
--- a/arch/arm64/kernel/irq.c
+++ b/arch/arm64/kernel/irq.c
@@ -81,3 +81,64 @@ void __init init_IRQ(void)
81 if (!handle_arch_irq) 81 if (!handle_arch_irq)
82 panic("No interrupt controller found."); 82 panic("No interrupt controller found.");
83} 83}
84
85#ifdef CONFIG_HOTPLUG_CPU
86static bool migrate_one_irq(struct irq_desc *desc)
87{
88 struct irq_data *d = irq_desc_get_irq_data(desc);
89 const struct cpumask *affinity = d->affinity;
90 struct irq_chip *c;
91 bool ret = false;
92
93 /*
94 * If this is a per-CPU interrupt, or the affinity does not
95 * include this CPU, then we have nothing to do.
96 */
97 if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity))
98 return false;
99
100 if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
101 affinity = cpu_online_mask;
102 ret = true;
103 }
104
105 c = irq_data_get_irq_chip(d);
106 if (!c->irq_set_affinity)
107 pr_debug("IRQ%u: unable to set affinity\n", d->irq);
108 else if (c->irq_set_affinity(d, affinity, true) == IRQ_SET_MASK_OK && ret)
109 cpumask_copy(d->affinity, affinity);
110
111 return ret;
112}
113
114/*
115 * The current CPU has been marked offline. Migrate IRQs off this CPU.
116 * If the affinity settings do not allow other CPUs, force them onto any
117 * available CPU.
118 *
119 * Note: we must iterate over all IRQs, whether they have an attached
120 * action structure or not, as we need to get chained interrupts too.
121 */
122void migrate_irqs(void)
123{
124 unsigned int i;
125 struct irq_desc *desc;
126 unsigned long flags;
127
128 local_irq_save(flags);
129
130 for_each_irq_desc(i, desc) {
131 bool affinity_broken;
132
133 raw_spin_lock(&desc->lock);
134 affinity_broken = migrate_one_irq(desc);
135 raw_spin_unlock(&desc->lock);
136
137 if (affinity_broken)
138 pr_warn_ratelimited("IRQ%u no longer affine to CPU%u\n",
139 i, smp_processor_id());
140 }
141
142 local_irq_restore(flags);
143}
144#endif /* CONFIG_HOTPLUG_CPU */
diff --git a/arch/arm64/kernel/kuser32.S b/arch/arm64/kernel/kuser32.S
index 8b69ecb1d8bc..63c48ffdf230 100644
--- a/arch/arm64/kernel/kuser32.S
+++ b/arch/arm64/kernel/kuser32.S
@@ -27,6 +27,9 @@
27 * 27 *
28 * See Documentation/arm/kernel_user_helpers.txt for formal definitions. 28 * See Documentation/arm/kernel_user_helpers.txt for formal definitions.
29 */ 29 */
30
31#include <asm/unistd32.h>
32
30 .align 5 33 .align 5
31 .globl __kuser_helper_start 34 .globl __kuser_helper_start
32__kuser_helper_start: 35__kuser_helper_start:
@@ -35,33 +38,30 @@ __kuser_cmpxchg64: // 0xffff0f60
35 .inst 0xe92d00f0 // push {r4, r5, r6, r7} 38 .inst 0xe92d00f0 // push {r4, r5, r6, r7}
36 .inst 0xe1c040d0 // ldrd r4, r5, [r0] 39 .inst 0xe1c040d0 // ldrd r4, r5, [r0]
37 .inst 0xe1c160d0 // ldrd r6, r7, [r1] 40 .inst 0xe1c160d0 // ldrd r6, r7, [r1]
38 .inst 0xf57ff05f // dmb sy 41 .inst 0xe1b20e9f // 1: ldaexd r0, r1, [r2]
39 .inst 0xe1b20f9f // 1: ldrexd r0, r1, [r2]
40 .inst 0xe0303004 // eors r3, r0, r4 42 .inst 0xe0303004 // eors r3, r0, r4
41 .inst 0x00313005 // eoreqs r3, r1, r5 43 .inst 0x00313005 // eoreqs r3, r1, r5
42 .inst 0x01a23f96 // strexdeq r3, r6, [r2] 44 .inst 0x01a23e96 // stlexdeq r3, r6, [r2]
43 .inst 0x03330001 // teqeq r3, #1 45 .inst 0x03330001 // teqeq r3, #1
44 .inst 0x0afffff9 // beq 1b 46 .inst 0x0afffff9 // beq 1b
45 .inst 0xf57ff05f // dmb sy
46 .inst 0xe2730000 // rsbs r0, r3, #0 47 .inst 0xe2730000 // rsbs r0, r3, #0
47 .inst 0xe8bd00f0 // pop {r4, r5, r6, r7} 48 .inst 0xe8bd00f0 // pop {r4, r5, r6, r7}
48 .inst 0xe12fff1e // bx lr 49 .inst 0xe12fff1e // bx lr
49 50
50 .align 5 51 .align 5
51__kuser_memory_barrier: // 0xffff0fa0 52__kuser_memory_barrier: // 0xffff0fa0
52 .inst 0xf57ff05f // dmb sy 53 .inst 0xf57ff05b // dmb ish
53 .inst 0xe12fff1e // bx lr 54 .inst 0xe12fff1e // bx lr
54 55
55 .align 5 56 .align 5
56__kuser_cmpxchg: // 0xffff0fc0 57__kuser_cmpxchg: // 0xffff0fc0
57 .inst 0xf57ff05f // dmb sy 58 .inst 0xe1923e9f // 1: ldaex r3, [r2]
58 .inst 0xe1923f9f // 1: ldrex r3, [r2]
59 .inst 0xe0533000 // subs r3, r3, r0 59 .inst 0xe0533000 // subs r3, r3, r0
60 .inst 0x01823f91 // strexeq r3, r1, [r2] 60 .inst 0x01823e91 // stlexeq r3, r1, [r2]
61 .inst 0x03330001 // teqeq r3, #1 61 .inst 0x03330001 // teqeq r3, #1
62 .inst 0x0afffffa // beq 1b 62 .inst 0x0afffffa // beq 1b
63 .inst 0xe2730000 // rsbs r0, r3, #0 63 .inst 0xe2730000 // rsbs r0, r3, #0
64 .inst 0xeaffffef // b <__kuser_memory_barrier> 64 .inst 0xe12fff1e // bx lr
65 65
66 .align 5 66 .align 5
67__kuser_get_tls: // 0xffff0fe0 67__kuser_get_tls: // 0xffff0fe0
@@ -75,3 +75,42 @@ __kuser_helper_version: // 0xffff0ffc
75 .word ((__kuser_helper_end - __kuser_helper_start) >> 5) 75 .word ((__kuser_helper_end - __kuser_helper_start) >> 5)
76 .globl __kuser_helper_end 76 .globl __kuser_helper_end
77__kuser_helper_end: 77__kuser_helper_end:
78
79/*
80 * AArch32 sigreturn code
81 *
82 * For ARM syscalls, the syscall number has to be loaded into r7.
83 * We do not support an OABI userspace.
84 *
85 * For Thumb syscalls, we also pass the syscall number via r7. We therefore
86 * need two 16-bit instructions.
87 */
88 .globl __aarch32_sigret_code_start
89__aarch32_sigret_code_start:
90
91 /*
92 * ARM Code
93 */
94 .byte __NR_compat_sigreturn, 0x70, 0xa0, 0xe3 // mov r7, #__NR_compat_sigreturn
95 .byte __NR_compat_sigreturn, 0x00, 0x00, 0xef // svc #__NR_compat_sigreturn
96
97 /*
98 * Thumb code
99 */
100 .byte __NR_compat_sigreturn, 0x27 // svc #__NR_compat_sigreturn
101 .byte __NR_compat_sigreturn, 0xdf // mov r7, #__NR_compat_sigreturn
102
103 /*
104 * ARM code
105 */
106 .byte __NR_compat_rt_sigreturn, 0x70, 0xa0, 0xe3 // mov r7, #__NR_compat_rt_sigreturn
107 .byte __NR_compat_rt_sigreturn, 0x00, 0x00, 0xef // svc #__NR_compat_rt_sigreturn
108
109 /*
110 * Thumb code
111 */
112 .byte __NR_compat_rt_sigreturn, 0x27 // svc #__NR_compat_rt_sigreturn
113 .byte __NR_compat_rt_sigreturn, 0xdf // mov r7, #__NR_compat_rt_sigreturn
114
115 .globl __aarch32_sigret_code_end
116__aarch32_sigret_code_end:
diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
index ca0e3d55da99..e2ad0d87721f 100644
--- a/arch/arm64/kernel/module.c
+++ b/arch/arm64/kernel/module.c
@@ -29,7 +29,7 @@
29void *module_alloc(unsigned long size) 29void *module_alloc(unsigned long size)
30{ 30{
31 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, 31 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
32 GFP_KERNEL, PAGE_KERNEL_EXEC, -1, 32 GFP_KERNEL, PAGE_KERNEL_EXEC, NUMA_NO_NODE,
33 __builtin_return_address(0)); 33 __builtin_return_address(0));
34} 34}
35 35
@@ -111,6 +111,9 @@ static u32 encode_insn_immediate(enum aarch64_imm_type type, u32 insn, u64 imm)
111 u32 immlo, immhi, lomask, himask, mask; 111 u32 immlo, immhi, lomask, himask, mask;
112 int shift; 112 int shift;
113 113
114 /* The instruction stream is always little endian. */
115 insn = le32_to_cpu(insn);
116
114 switch (type) { 117 switch (type) {
115 case INSN_IMM_MOVNZ: 118 case INSN_IMM_MOVNZ:
116 /* 119 /*
@@ -179,7 +182,7 @@ static u32 encode_insn_immediate(enum aarch64_imm_type type, u32 insn, u64 imm)
179 insn &= ~(mask << shift); 182 insn &= ~(mask << shift);
180 insn |= (imm & mask) << shift; 183 insn |= (imm & mask) << shift;
181 184
182 return insn; 185 return cpu_to_le32(insn);
183} 186}
184 187
185static int reloc_insn_movw(enum aarch64_reloc_op op, void *place, u64 val, 188static int reloc_insn_movw(enum aarch64_reloc_op op, void *place, u64 val,
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index cea1594ff933..0e63c98d224c 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -784,8 +784,8 @@ static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
784/* 784/*
785 * PMXEVTYPER: Event selection reg 785 * PMXEVTYPER: Event selection reg
786 */ 786 */
787#define ARMV8_EVTYPE_MASK 0xc80000ff /* Mask for writable bits */ 787#define ARMV8_EVTYPE_MASK 0xc80003ff /* Mask for writable bits */
788#define ARMV8_EVTYPE_EVENT 0xff /* Mask for EVENT bits */ 788#define ARMV8_EVTYPE_EVENT 0x3ff /* Mask for EVENT bits */
789 789
790/* 790/*
791 * Event filters for PMUv3 791 * Event filters for PMUv3
@@ -1044,7 +1044,7 @@ static irqreturn_t armv8pmu_handle_irq(int irq_num, void *dev)
1044 */ 1044 */
1045 regs = get_irq_regs(); 1045 regs = get_irq_regs();
1046 1046
1047 cpuc = &__get_cpu_var(cpu_hw_events); 1047 cpuc = this_cpu_ptr(&cpu_hw_events);
1048 for (idx = 0; idx < cpu_pmu->num_events; ++idx) { 1048 for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
1049 struct perf_event *event = cpuc->events[idx]; 1049 struct perf_event *event = cpuc->events[idx];
1050 struct hw_perf_event *hwc; 1050 struct hw_perf_event *hwc;
@@ -1175,7 +1175,8 @@ static void armv8pmu_reset(void *info)
1175static int armv8_pmuv3_map_event(struct perf_event *event) 1175static int armv8_pmuv3_map_event(struct perf_event *event)
1176{ 1176{
1177 return map_cpu_event(event, &armv8_pmuv3_perf_map, 1177 return map_cpu_event(event, &armv8_pmuv3_perf_map,
1178 &armv8_pmuv3_perf_cache_map, 0xFF); 1178 &armv8_pmuv3_perf_cache_map,
1179 ARMV8_EVTYPE_EVENT);
1179} 1180}
1180 1181
1181static struct arm_pmu armv8pmu = { 1182static struct arm_pmu armv8pmu = {
@@ -1257,7 +1258,7 @@ device_initcall(register_pmu_driver);
1257 1258
1258static struct pmu_hw_events *armpmu_get_cpu_events(void) 1259static struct pmu_hw_events *armpmu_get_cpu_events(void)
1259{ 1260{
1260 return &__get_cpu_var(cpu_hw_events); 1261 return this_cpu_ptr(&cpu_hw_events);
1261} 1262}
1262 1263
1263static void __init cpu_pmu_init(struct arm_pmu *armpmu) 1264static void __init cpu_pmu_init(struct arm_pmu *armpmu)
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 57fb55c44c90..de17c89985db 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -102,6 +102,13 @@ void arch_cpu_idle(void)
102 local_irq_enable(); 102 local_irq_enable();
103} 103}
104 104
105#ifdef CONFIG_HOTPLUG_CPU
106void arch_cpu_idle_dead(void)
107{
108 cpu_die();
109}
110#endif
111
105void machine_shutdown(void) 112void machine_shutdown(void)
106{ 113{
107#ifdef CONFIG_SMP 114#ifdef CONFIG_SMP
@@ -143,15 +150,26 @@ void machine_restart(char *cmd)
143 150
144void __show_regs(struct pt_regs *regs) 151void __show_regs(struct pt_regs *regs)
145{ 152{
146 int i; 153 int i, top_reg;
154 u64 lr, sp;
155
156 if (compat_user_mode(regs)) {
157 lr = regs->compat_lr;
158 sp = regs->compat_sp;
159 top_reg = 12;
160 } else {
161 lr = regs->regs[30];
162 sp = regs->sp;
163 top_reg = 29;
164 }
147 165
148 show_regs_print_info(KERN_DEFAULT); 166 show_regs_print_info(KERN_DEFAULT);
149 print_symbol("PC is at %s\n", instruction_pointer(regs)); 167 print_symbol("PC is at %s\n", instruction_pointer(regs));
150 print_symbol("LR is at %s\n", regs->regs[30]); 168 print_symbol("LR is at %s\n", lr);
151 printk("pc : [<%016llx>] lr : [<%016llx>] pstate: %08llx\n", 169 printk("pc : [<%016llx>] lr : [<%016llx>] pstate: %08llx\n",
152 regs->pc, regs->regs[30], regs->pstate); 170 regs->pc, lr, regs->pstate);
153 printk("sp : %016llx\n", regs->sp); 171 printk("sp : %016llx\n", sp);
154 for (i = 29; i >= 0; i--) { 172 for (i = top_reg; i >= 0; i--) {
155 printk("x%-2d: %016llx ", i, regs->regs[i]); 173 printk("x%-2d: %016llx ", i, regs->regs[i]);
156 if (i % 2 == 0) 174 if (i % 2 == 0)
157 printk("\n"); 175 printk("\n");
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
index 14f73c445ff5..4f97db3d7363 100644
--- a/arch/arm64/kernel/psci.c
+++ b/arch/arm64/kernel/psci.c
@@ -17,12 +17,32 @@
17 17
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/of.h> 19#include <linux/of.h>
20#include <linux/smp.h>
20 21
21#include <asm/compiler.h> 22#include <asm/compiler.h>
23#include <asm/cpu_ops.h>
22#include <asm/errno.h> 24#include <asm/errno.h>
23#include <asm/psci.h> 25#include <asm/psci.h>
26#include <asm/smp_plat.h>
24 27
25struct psci_operations psci_ops; 28#define PSCI_POWER_STATE_TYPE_STANDBY 0
29#define PSCI_POWER_STATE_TYPE_POWER_DOWN 1
30
31struct psci_power_state {
32 u16 id;
33 u8 type;
34 u8 affinity_level;
35};
36
37struct psci_operations {
38 int (*cpu_suspend)(struct psci_power_state state,
39 unsigned long entry_point);
40 int (*cpu_off)(struct psci_power_state state);
41 int (*cpu_on)(unsigned long cpuid, unsigned long entry_point);
42 int (*migrate)(unsigned long cpuid);
43};
44
45static struct psci_operations psci_ops;
26 46
27static int (*invoke_psci_fn)(u64, u64, u64, u64); 47static int (*invoke_psci_fn)(u64, u64, u64, u64);
28 48
@@ -209,3 +229,68 @@ out_put_node:
209 of_node_put(np); 229 of_node_put(np);
210 return err; 230 return err;
211} 231}
232
233#ifdef CONFIG_SMP
234
235static int __init cpu_psci_cpu_init(struct device_node *dn, unsigned int cpu)
236{
237 return 0;
238}
239
240static int __init cpu_psci_cpu_prepare(unsigned int cpu)
241{
242 if (!psci_ops.cpu_on) {
243 pr_err("no cpu_on method, not booting CPU%d\n", cpu);
244 return -ENODEV;
245 }
246
247 return 0;
248}
249
250static int cpu_psci_cpu_boot(unsigned int cpu)
251{
252 int err = psci_ops.cpu_on(cpu_logical_map(cpu), __pa(secondary_entry));
253 if (err)
254 pr_err("psci: failed to boot CPU%d (%d)\n", cpu, err);
255
256 return err;
257}
258
259#ifdef CONFIG_HOTPLUG_CPU
260static int cpu_psci_cpu_disable(unsigned int cpu)
261{
262 /* Fail early if we don't have CPU_OFF support */
263 if (!psci_ops.cpu_off)
264 return -EOPNOTSUPP;
265 return 0;
266}
267
268static void cpu_psci_cpu_die(unsigned int cpu)
269{
270 int ret;
271 /*
272 * There are no known implementations of PSCI actually using the
273 * power state field, pass a sensible default for now.
274 */
275 struct psci_power_state state = {
276 .type = PSCI_POWER_STATE_TYPE_POWER_DOWN,
277 };
278
279 ret = psci_ops.cpu_off(state);
280
281 pr_crit("psci: unable to power off CPU%u (%d)\n", cpu, ret);
282}
283#endif
284
285const struct cpu_operations cpu_psci_ops = {
286 .name = "psci",
287 .cpu_init = cpu_psci_cpu_init,
288 .cpu_prepare = cpu_psci_cpu_prepare,
289 .cpu_boot = cpu_psci_cpu_boot,
290#ifdef CONFIG_HOTPLUG_CPU
291 .cpu_disable = cpu_psci_cpu_disable,
292 .cpu_die = cpu_psci_cpu_die,
293#endif
294};
295
296#endif
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 12ad8f3d0cfd..0bc5e4cbc017 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -45,6 +45,7 @@
45#include <asm/cputype.h> 45#include <asm/cputype.h>
46#include <asm/elf.h> 46#include <asm/elf.h>
47#include <asm/cputable.h> 47#include <asm/cputable.h>
48#include <asm/cpu_ops.h>
48#include <asm/sections.h> 49#include <asm/sections.h>
49#include <asm/setup.h> 50#include <asm/setup.h>
50#include <asm/smp_plat.h> 51#include <asm/smp_plat.h>
@@ -57,9 +58,19 @@
57unsigned int processor_id; 58unsigned int processor_id;
58EXPORT_SYMBOL(processor_id); 59EXPORT_SYMBOL(processor_id);
59 60
60unsigned int elf_hwcap __read_mostly; 61unsigned long elf_hwcap __read_mostly;
61EXPORT_SYMBOL_GPL(elf_hwcap); 62EXPORT_SYMBOL_GPL(elf_hwcap);
62 63
64#ifdef CONFIG_COMPAT
65#define COMPAT_ELF_HWCAP_DEFAULT \
66 (COMPAT_HWCAP_HALF|COMPAT_HWCAP_THUMB|\
67 COMPAT_HWCAP_FAST_MULT|COMPAT_HWCAP_EDSP|\
68 COMPAT_HWCAP_TLS|COMPAT_HWCAP_VFP|\
69 COMPAT_HWCAP_VFPv3|COMPAT_HWCAP_VFPv4|\
70 COMPAT_HWCAP_NEON|COMPAT_HWCAP_IDIV)
71unsigned int compat_elf_hwcap __read_mostly = COMPAT_ELF_HWCAP_DEFAULT;
72#endif
73
63static const char *cpu_name; 74static const char *cpu_name;
64static const char *machine_name; 75static const char *machine_name;
65phys_addr_t __fdt_pointer __initdata; 76phys_addr_t __fdt_pointer __initdata;
@@ -97,6 +108,11 @@ void __init early_print(const char *str, ...)
97 printk("%s", buf); 108 printk("%s", buf);
98} 109}
99 110
111bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
112{
113 return phys_id == cpu_logical_map(cpu);
114}
115
100static void __init setup_processor(void) 116static void __init setup_processor(void)
101{ 117{
102 struct cpu_info *cpu_info; 118 struct cpu_info *cpu_info;
@@ -118,76 +134,24 @@ static void __init setup_processor(void)
118 printk("CPU: %s [%08x] revision %d\n", 134 printk("CPU: %s [%08x] revision %d\n",
119 cpu_name, read_cpuid_id(), read_cpuid_id() & 15); 135 cpu_name, read_cpuid_id(), read_cpuid_id() & 15);
120 136
121 sprintf(init_utsname()->machine, "aarch64"); 137 sprintf(init_utsname()->machine, ELF_PLATFORM);
122 elf_hwcap = 0; 138 elf_hwcap = 0;
123} 139}
124 140
125static void __init setup_machine_fdt(phys_addr_t dt_phys) 141static void __init setup_machine_fdt(phys_addr_t dt_phys)
126{ 142{
127 struct boot_param_header *devtree; 143 if (!dt_phys || !early_init_dt_scan(phys_to_virt(dt_phys))) {
128 unsigned long dt_root;
129
130 /* Check we have a non-NULL DT pointer */
131 if (!dt_phys) {
132 early_print("\n"
133 "Error: NULL or invalid device tree blob\n"
134 "The dtb must be 8-byte aligned and passed in the first 512MB of memory\n"
135 "\nPlease check your bootloader.\n");
136
137 while (true)
138 cpu_relax();
139
140 }
141
142 devtree = phys_to_virt(dt_phys);
143
144 /* Check device tree validity */
145 if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) {
146 early_print("\n" 144 early_print("\n"
147 "Error: invalid device tree blob at physical address 0x%p (virtual address 0x%p)\n" 145 "Error: invalid device tree blob at physical address 0x%p (virtual address 0x%p)\n"
148 "Expected 0x%x, found 0x%x\n" 146 "The dtb must be 8-byte aligned and passed in the first 512MB of memory\n"
149 "\nPlease check your bootloader.\n", 147 "\nPlease check your bootloader.\n",
150 dt_phys, devtree, OF_DT_HEADER, 148 dt_phys, phys_to_virt(dt_phys));
151 be32_to_cpu(devtree->magic));
152 149
153 while (true) 150 while (true)
154 cpu_relax(); 151 cpu_relax();
155 } 152 }
156 153
157 initial_boot_params = devtree; 154 machine_name = of_flat_dt_get_machine_name();
158 dt_root = of_get_flat_dt_root();
159
160 machine_name = of_get_flat_dt_prop(dt_root, "model", NULL);
161 if (!machine_name)
162 machine_name = of_get_flat_dt_prop(dt_root, "compatible", NULL);
163 if (!machine_name)
164 machine_name = "<unknown>";
165 pr_info("Machine: %s\n", machine_name);
166
167 /* Retrieve various information from the /chosen node */
168 of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
169 /* Initialize {size,address}-cells info */
170 of_scan_flat_dt(early_init_dt_scan_root, NULL);
171 /* Setup memory, calling early_init_dt_add_memory_arch */
172 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
173}
174
175void __init early_init_dt_add_memory_arch(u64 base, u64 size)
176{
177 base &= PAGE_MASK;
178 size &= PAGE_MASK;
179 if (base + size < PHYS_OFFSET) {
180 pr_warning("Ignoring memory block 0x%llx - 0x%llx\n",
181 base, base + size);
182 return;
183 }
184 if (base < PHYS_OFFSET) {
185 pr_warning("Ignoring memory range 0x%llx - 0x%llx\n",
186 base, PHYS_OFFSET);
187 size -= PHYS_OFFSET - base;
188 base = PHYS_OFFSET;
189 }
190 memblock_add(base, size);
191} 155}
192 156
193/* 157/*
@@ -264,6 +228,7 @@ void __init setup_arch(char **cmdline_p)
264 psci_init(); 228 psci_init();
265 229
266 cpu_logical_map(0) = read_cpuid_mpidr() & MPIDR_HWID_BITMASK; 230 cpu_logical_map(0) = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
231 cpu_read_bootcpu_ops();
267#ifdef CONFIG_SMP 232#ifdef CONFIG_SMP
268 smp_init_cpus(); 233 smp_init_cpus();
269#endif 234#endif
@@ -304,6 +269,7 @@ subsys_initcall(topology_init);
304static const char *hwcap_str[] = { 269static const char *hwcap_str[] = {
305 "fp", 270 "fp",
306 "asimd", 271 "asimd",
272 "evtstrm",
307 NULL 273 NULL
308}; 274};
309 275
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
index e393174fe859..b3fc9f5ec6d3 100644
--- a/arch/arm64/kernel/signal32.c
+++ b/arch/arm64/kernel/signal32.c
@@ -100,34 +100,6 @@ struct compat_rt_sigframe {
100 100
101#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 101#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
102 102
103/*
104 * For ARM syscalls, the syscall number has to be loaded into r7.
105 * We do not support an OABI userspace.
106 */
107#define MOV_R7_NR_SIGRETURN (0xe3a07000 | __NR_compat_sigreturn)
108#define SVC_SYS_SIGRETURN (0xef000000 | __NR_compat_sigreturn)
109#define MOV_R7_NR_RT_SIGRETURN (0xe3a07000 | __NR_compat_rt_sigreturn)
110#define SVC_SYS_RT_SIGRETURN (0xef000000 | __NR_compat_rt_sigreturn)
111
112/*
113 * For Thumb syscalls, we also pass the syscall number via r7. We therefore
114 * need two 16-bit instructions.
115 */
116#define SVC_THUMB_SIGRETURN (((0xdf00 | __NR_compat_sigreturn) << 16) | \
117 0x2700 | __NR_compat_sigreturn)
118#define SVC_THUMB_RT_SIGRETURN (((0xdf00 | __NR_compat_rt_sigreturn) << 16) | \
119 0x2700 | __NR_compat_rt_sigreturn)
120
121const compat_ulong_t aarch32_sigret_code[6] = {
122 /*
123 * AArch32 sigreturn code.
124 * We don't construct an OABI SWI - instead we just set the imm24 field
125 * to the EABI syscall number so that we create a sane disassembly.
126 */
127 MOV_R7_NR_SIGRETURN, SVC_SYS_SIGRETURN, SVC_THUMB_SIGRETURN,
128 MOV_R7_NR_RT_SIGRETURN, SVC_SYS_RT_SIGRETURN, SVC_THUMB_RT_SIGRETURN,
129};
130
131static inline int put_sigset_t(compat_sigset_t __user *uset, sigset_t *set) 103static inline int put_sigset_t(compat_sigset_t __user *uset, sigset_t *set)
132{ 104{
133 compat_sigset_t cset; 105 compat_sigset_t cset;
@@ -150,7 +122,7 @@ static inline int get_sigset_t(sigset_t *set,
150 return 0; 122 return 0;
151} 123}
152 124
153int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) 125int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
154{ 126{
155 int err; 127 int err;
156 128
@@ -474,12 +446,13 @@ static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka,
474 /* Check if the handler is written for ARM or Thumb */ 446 /* Check if the handler is written for ARM or Thumb */
475 thumb = handler & 1; 447 thumb = handler & 1;
476 448
477 if (thumb) { 449 if (thumb)
478 spsr |= COMPAT_PSR_T_BIT; 450 spsr |= COMPAT_PSR_T_BIT;
479 spsr &= ~COMPAT_PSR_IT_MASK; 451 else
480 } else {
481 spsr &= ~COMPAT_PSR_T_BIT; 452 spsr &= ~COMPAT_PSR_T_BIT;
482 } 453
454 /* The IT state must be cleared for both ARM and Thumb-2 */
455 spsr &= ~COMPAT_PSR_IT_MASK;
483 456
484 if (ka->sa.sa_flags & SA_RESTORER) { 457 if (ka->sa.sa_flags & SA_RESTORER) {
485 retcode = ptr_to_compat(ka->sa.sa_restorer); 458 retcode = ptr_to_compat(ka->sa.sa_restorer);
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 78db90dcc910..a5aeefab03c3 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -39,6 +39,7 @@
39#include <asm/atomic.h> 39#include <asm/atomic.h>
40#include <asm/cacheflush.h> 40#include <asm/cacheflush.h>
41#include <asm/cputype.h> 41#include <asm/cputype.h>
42#include <asm/cpu_ops.h>
42#include <asm/mmu_context.h> 43#include <asm/mmu_context.h>
43#include <asm/pgtable.h> 44#include <asm/pgtable.h>
44#include <asm/pgalloc.h> 45#include <asm/pgalloc.h>
@@ -54,7 +55,6 @@
54 * where to place its SVC stack 55 * where to place its SVC stack
55 */ 56 */
56struct secondary_data secondary_data; 57struct secondary_data secondary_data;
57volatile unsigned long secondary_holding_pen_release = INVALID_HWID;
58 58
59enum ipi_msg_type { 59enum ipi_msg_type {
60 IPI_RESCHEDULE, 60 IPI_RESCHEDULE,
@@ -63,61 +63,16 @@ enum ipi_msg_type {
63 IPI_CPU_STOP, 63 IPI_CPU_STOP,
64}; 64};
65 65
66static DEFINE_RAW_SPINLOCK(boot_lock);
67
68/*
69 * Write secondary_holding_pen_release in a way that is guaranteed to be
70 * visible to all observers, irrespective of whether they're taking part
71 * in coherency or not. This is necessary for the hotplug code to work
72 * reliably.
73 */
74static void write_pen_release(u64 val)
75{
76 void *start = (void *)&secondary_holding_pen_release;
77 unsigned long size = sizeof(secondary_holding_pen_release);
78
79 secondary_holding_pen_release = val;
80 __flush_dcache_area(start, size);
81}
82
83/* 66/*
84 * Boot a secondary CPU, and assign it the specified idle task. 67 * Boot a secondary CPU, and assign it the specified idle task.
85 * This also gives us the initial stack to use for this CPU. 68 * This also gives us the initial stack to use for this CPU.
86 */ 69 */
87static int boot_secondary(unsigned int cpu, struct task_struct *idle) 70static int boot_secondary(unsigned int cpu, struct task_struct *idle)
88{ 71{
89 unsigned long timeout; 72 if (cpu_ops[cpu]->cpu_boot)
90 73 return cpu_ops[cpu]->cpu_boot(cpu);
91 /*
92 * Set synchronisation state between this boot processor
93 * and the secondary one
94 */
95 raw_spin_lock(&boot_lock);
96
97 /*
98 * Update the pen release flag.
99 */
100 write_pen_release(cpu_logical_map(cpu));
101
102 /*
103 * Send an event, causing the secondaries to read pen_release.
104 */
105 sev();
106
107 timeout = jiffies + (1 * HZ);
108 while (time_before(jiffies, timeout)) {
109 if (secondary_holding_pen_release == INVALID_HWID)
110 break;
111 udelay(10);
112 }
113
114 /*
115 * Now the secondary core is starting up let it run its
116 * calibrations, then wait for it to finish
117 */
118 raw_spin_unlock(&boot_lock);
119 74
120 return secondary_holding_pen_release != INVALID_HWID ? -ENOSYS : 0; 75 return -EOPNOTSUPP;
121} 76}
122 77
123static DECLARE_COMPLETION(cpu_running); 78static DECLARE_COMPLETION(cpu_running);
@@ -187,17 +142,13 @@ asmlinkage void secondary_start_kernel(void)
187 preempt_disable(); 142 preempt_disable();
188 trace_hardirqs_off(); 143 trace_hardirqs_off();
189 144
190 /* 145 if (cpu_ops[cpu]->cpu_postboot)
191 * Let the primary processor know we're out of the 146 cpu_ops[cpu]->cpu_postboot();
192 * pen, then head off into the C entry point
193 */
194 write_pen_release(INVALID_HWID);
195 147
196 /* 148 /*
197 * Synchronise with the boot thread. 149 * Enable GIC and timers.
198 */ 150 */
199 raw_spin_lock(&boot_lock); 151 notify_cpu_starting(cpu);
200 raw_spin_unlock(&boot_lock);
201 152
202 /* 153 /*
203 * OK, now it's safe to let the boot CPU continue. Wait for 154 * OK, now it's safe to let the boot CPU continue. Wait for
@@ -207,11 +158,6 @@ asmlinkage void secondary_start_kernel(void)
207 set_cpu_online(cpu, true); 158 set_cpu_online(cpu, true);
208 complete(&cpu_running); 159 complete(&cpu_running);
209 160
210 /*
211 * Enable GIC and timers.
212 */
213 notify_cpu_starting(cpu);
214
215 local_irq_enable(); 161 local_irq_enable();
216 local_fiq_enable(); 162 local_fiq_enable();
217 163
@@ -221,39 +167,113 @@ asmlinkage void secondary_start_kernel(void)
221 cpu_startup_entry(CPUHP_ONLINE); 167 cpu_startup_entry(CPUHP_ONLINE);
222} 168}
223 169
224void __init smp_cpus_done(unsigned int max_cpus) 170#ifdef CONFIG_HOTPLUG_CPU
171static int op_cpu_disable(unsigned int cpu)
225{ 172{
226 pr_info("SMP: Total of %d processors activated.\n", num_online_cpus()); 173 /*
174 * If we don't have a cpu_die method, abort before we reach the point
175 * of no return. CPU0 may not have an cpu_ops, so test for it.
176 */
177 if (!cpu_ops[cpu] || !cpu_ops[cpu]->cpu_die)
178 return -EOPNOTSUPP;
179
180 /*
181 * We may need to abort a hot unplug for some other mechanism-specific
182 * reason.
183 */
184 if (cpu_ops[cpu]->cpu_disable)
185 return cpu_ops[cpu]->cpu_disable(cpu);
186
187 return 0;
227} 188}
228 189
229void __init smp_prepare_boot_cpu(void) 190/*
191 * __cpu_disable runs on the processor to be shutdown.
192 */
193int __cpu_disable(void)
230{ 194{
231} 195 unsigned int cpu = smp_processor_id();
196 int ret;
232 197
233static void (*smp_cross_call)(const struct cpumask *, unsigned int); 198 ret = op_cpu_disable(cpu);
199 if (ret)
200 return ret;
234 201
235static const struct smp_enable_ops *enable_ops[] __initconst = { 202 /*
236 &smp_spin_table_ops, 203 * Take this CPU offline. Once we clear this, we can't return,
237 &smp_psci_ops, 204 * and we must not schedule until we're ready to give up the cpu.
238 NULL, 205 */
239}; 206 set_cpu_online(cpu, false);
207
208 /*
209 * OK - migrate IRQs away from this CPU
210 */
211 migrate_irqs();
240 212
241static const struct smp_enable_ops *smp_enable_ops[NR_CPUS]; 213 /*
214 * Remove this CPU from the vm mask set of all processes.
215 */
216 clear_tasks_mm_cpumask(cpu);
242 217
243static const struct smp_enable_ops * __init smp_get_enable_ops(const char *name) 218 return 0;
244{ 219}
245 const struct smp_enable_ops **ops = enable_ops;
246 220
247 while (*ops) { 221static DECLARE_COMPLETION(cpu_died);
248 if (!strcmp(name, (*ops)->name))
249 return *ops;
250 222
251 ops++; 223/*
224 * called on the thread which is asking for a CPU to be shutdown -
225 * waits until shutdown has completed, or it is timed out.
226 */
227void __cpu_die(unsigned int cpu)
228{
229 if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) {
230 pr_crit("CPU%u: cpu didn't die\n", cpu);
231 return;
252 } 232 }
233 pr_notice("CPU%u: shutdown\n", cpu);
234}
235
236/*
237 * Called from the idle thread for the CPU which has been shutdown.
238 *
239 * Note that we disable IRQs here, but do not re-enable them
240 * before returning to the caller. This is also the behaviour
241 * of the other hotplug-cpu capable cores, so presumably coming
242 * out of idle fixes this.
243 */
244void cpu_die(void)
245{
246 unsigned int cpu = smp_processor_id();
247
248 idle_task_exit();
253 249
254 return NULL; 250 local_irq_disable();
251
252 /* Tell __cpu_die() that this CPU is now safe to dispose of */
253 complete(&cpu_died);
254
255 /*
256 * Actually shutdown the CPU. This must never fail. The specific hotplug
257 * mechanism must perform all required cache maintenance to ensure that
258 * no dirty lines are lost in the process of shutting down the CPU.
259 */
260 cpu_ops[cpu]->cpu_die(cpu);
261
262 BUG();
263}
264#endif
265
266void __init smp_cpus_done(unsigned int max_cpus)
267{
268 pr_info("SMP: Total of %d processors activated.\n", num_online_cpus());
255} 269}
256 270
271void __init smp_prepare_boot_cpu(void)
272{
273}
274
275static void (*smp_cross_call)(const struct cpumask *, unsigned int);
276
257/* 277/*
258 * Enumerate the possible CPU set from the device tree and build the 278 * Enumerate the possible CPU set from the device tree and build the
259 * cpu logical map array containing MPIDR values related to logical 279 * cpu logical map array containing MPIDR values related to logical
@@ -261,9 +281,8 @@ static const struct smp_enable_ops * __init smp_get_enable_ops(const char *name)
261 */ 281 */
262void __init smp_init_cpus(void) 282void __init smp_init_cpus(void)
263{ 283{
264 const char *enable_method;
265 struct device_node *dn = NULL; 284 struct device_node *dn = NULL;
266 int i, cpu = 1; 285 unsigned int i, cpu = 1;
267 bool bootcpu_valid = false; 286 bool bootcpu_valid = false;
268 287
269 while ((dn = of_find_node_by_type(dn, "cpu"))) { 288 while ((dn = of_find_node_by_type(dn, "cpu"))) {
@@ -332,25 +351,10 @@ void __init smp_init_cpus(void)
332 if (cpu >= NR_CPUS) 351 if (cpu >= NR_CPUS)
333 goto next; 352 goto next;
334 353
335 /* 354 if (cpu_read_ops(dn, cpu) != 0)
336 * We currently support only the "spin-table" enable-method.
337 */
338 enable_method = of_get_property(dn, "enable-method", NULL);
339 if (!enable_method) {
340 pr_err("%s: missing enable-method property\n",
341 dn->full_name);
342 goto next; 355 goto next;
343 }
344
345 smp_enable_ops[cpu] = smp_get_enable_ops(enable_method);
346
347 if (!smp_enable_ops[cpu]) {
348 pr_err("%s: invalid enable-method property: %s\n",
349 dn->full_name, enable_method);
350 goto next;
351 }
352 356
353 if (smp_enable_ops[cpu]->init_cpu(dn, cpu)) 357 if (cpu_ops[cpu]->cpu_init(dn, cpu))
354 goto next; 358 goto next;
355 359
356 pr_debug("cpu logical map 0x%llx\n", hwid); 360 pr_debug("cpu logical map 0x%llx\n", hwid);
@@ -380,8 +384,8 @@ next:
380 384
381void __init smp_prepare_cpus(unsigned int max_cpus) 385void __init smp_prepare_cpus(unsigned int max_cpus)
382{ 386{
383 int cpu, err; 387 int err;
384 unsigned int ncores = num_possible_cpus(); 388 unsigned int cpu, ncores = num_possible_cpus();
385 389
386 /* 390 /*
387 * are we trying to boot more cores than exist? 391 * are we trying to boot more cores than exist?
@@ -408,10 +412,10 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
408 if (cpu == smp_processor_id()) 412 if (cpu == smp_processor_id())
409 continue; 413 continue;
410 414
411 if (!smp_enable_ops[cpu]) 415 if (!cpu_ops[cpu])
412 continue; 416 continue;
413 417
414 err = smp_enable_ops[cpu]->prepare_cpu(cpu); 418 err = cpu_ops[cpu]->cpu_prepare(cpu);
415 if (err) 419 if (err)
416 continue; 420 continue;
417 421
@@ -451,7 +455,7 @@ void show_ipi_list(struct seq_file *p, int prec)
451 for (i = 0; i < NR_IPI; i++) { 455 for (i = 0; i < NR_IPI; i++) {
452 seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i + IPI_RESCHEDULE, 456 seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i + IPI_RESCHEDULE,
453 prec >= 4 ? " " : ""); 457 prec >= 4 ? " " : "");
454 for_each_present_cpu(cpu) 458 for_each_online_cpu(cpu)
455 seq_printf(p, "%10u ", 459 seq_printf(p, "%10u ",
456 __get_irq_stat(cpu, ipi_irqs[i])); 460 __get_irq_stat(cpu, ipi_irqs[i]));
457 seq_printf(p, " %s\n", ipi_types[i]); 461 seq_printf(p, " %s\n", ipi_types[i]);
diff --git a/arch/arm64/kernel/smp_psci.c b/arch/arm64/kernel/smp_psci.c
deleted file mode 100644
index 0c533301be77..000000000000
--- a/arch/arm64/kernel/smp_psci.c
+++ /dev/null
@@ -1,53 +0,0 @@
1/*
2 * PSCI SMP initialisation
3 *
4 * Copyright (C) 2013 ARM Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <linux/init.h>
20#include <linux/of.h>
21#include <linux/smp.h>
22
23#include <asm/psci.h>
24#include <asm/smp_plat.h>
25
26static int __init smp_psci_init_cpu(struct device_node *dn, int cpu)
27{
28 return 0;
29}
30
31static int __init smp_psci_prepare_cpu(int cpu)
32{
33 int err;
34
35 if (!psci_ops.cpu_on) {
36 pr_err("psci: no cpu_on method, not booting CPU%d\n", cpu);
37 return -ENODEV;
38 }
39
40 err = psci_ops.cpu_on(cpu_logical_map(cpu), __pa(secondary_holding_pen));
41 if (err) {
42 pr_err("psci: failed to boot CPU%d (%d)\n", cpu, err);
43 return err;
44 }
45
46 return 0;
47}
48
49const struct smp_enable_ops smp_psci_ops __initconst = {
50 .name = "psci",
51 .init_cpu = smp_psci_init_cpu,
52 .prepare_cpu = smp_psci_prepare_cpu,
53};
diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c
index 7c35fa682f76..44c22805d2e2 100644
--- a/arch/arm64/kernel/smp_spin_table.c
+++ b/arch/arm64/kernel/smp_spin_table.c
@@ -16,15 +16,39 @@
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19#include <linux/delay.h>
19#include <linux/init.h> 20#include <linux/init.h>
20#include <linux/of.h> 21#include <linux/of.h>
21#include <linux/smp.h> 22#include <linux/smp.h>
22 23
23#include <asm/cacheflush.h> 24#include <asm/cacheflush.h>
25#include <asm/cpu_ops.h>
26#include <asm/cputype.h>
27#include <asm/smp_plat.h>
28
29extern void secondary_holding_pen(void);
30volatile unsigned long secondary_holding_pen_release = INVALID_HWID;
24 31
25static phys_addr_t cpu_release_addr[NR_CPUS]; 32static phys_addr_t cpu_release_addr[NR_CPUS];
33static DEFINE_RAW_SPINLOCK(boot_lock);
34
35/*
36 * Write secondary_holding_pen_release in a way that is guaranteed to be
37 * visible to all observers, irrespective of whether they're taking part
38 * in coherency or not. This is necessary for the hotplug code to work
39 * reliably.
40 */
41static void write_pen_release(u64 val)
42{
43 void *start = (void *)&secondary_holding_pen_release;
44 unsigned long size = sizeof(secondary_holding_pen_release);
26 45
27static int __init smp_spin_table_init_cpu(struct device_node *dn, int cpu) 46 secondary_holding_pen_release = val;
47 __flush_dcache_area(start, size);
48}
49
50
51static int smp_spin_table_cpu_init(struct device_node *dn, unsigned int cpu)
28{ 52{
29 /* 53 /*
30 * Determine the address from which the CPU is polling. 54 * Determine the address from which the CPU is polling.
@@ -40,7 +64,7 @@ static int __init smp_spin_table_init_cpu(struct device_node *dn, int cpu)
40 return 0; 64 return 0;
41} 65}
42 66
43static int __init smp_spin_table_prepare_cpu(int cpu) 67static int smp_spin_table_cpu_prepare(unsigned int cpu)
44{ 68{
45 void **release_addr; 69 void **release_addr;
46 70
@@ -48,7 +72,16 @@ static int __init smp_spin_table_prepare_cpu(int cpu)
48 return -ENODEV; 72 return -ENODEV;
49 73
50 release_addr = __va(cpu_release_addr[cpu]); 74 release_addr = __va(cpu_release_addr[cpu]);
51 release_addr[0] = (void *)__pa(secondary_holding_pen); 75
76 /*
77 * We write the release address as LE regardless of the native
78 * endianess of the kernel. Therefore, any boot-loaders that
79 * read this address need to convert this address to the
80 * boot-loader's endianess before jumping. This is mandated by
81 * the boot protocol.
82 */
83 release_addr[0] = (void *) cpu_to_le64(__pa(secondary_holding_pen));
84
52 __flush_dcache_area(release_addr, sizeof(release_addr[0])); 85 __flush_dcache_area(release_addr, sizeof(release_addr[0]));
53 86
54 /* 87 /*
@@ -59,8 +92,60 @@ static int __init smp_spin_table_prepare_cpu(int cpu)
59 return 0; 92 return 0;
60} 93}
61 94
62const struct smp_enable_ops smp_spin_table_ops __initconst = { 95static int smp_spin_table_cpu_boot(unsigned int cpu)
96{
97 unsigned long timeout;
98
99 /*
100 * Set synchronisation state between this boot processor
101 * and the secondary one
102 */
103 raw_spin_lock(&boot_lock);
104
105 /*
106 * Update the pen release flag.
107 */
108 write_pen_release(cpu_logical_map(cpu));
109
110 /*
111 * Send an event, causing the secondaries to read pen_release.
112 */
113 sev();
114
115 timeout = jiffies + (1 * HZ);
116 while (time_before(jiffies, timeout)) {
117 if (secondary_holding_pen_release == INVALID_HWID)
118 break;
119 udelay(10);
120 }
121
122 /*
123 * Now the secondary core is starting up let it run its
124 * calibrations, then wait for it to finish
125 */
126 raw_spin_unlock(&boot_lock);
127
128 return secondary_holding_pen_release != INVALID_HWID ? -ENOSYS : 0;
129}
130
131void smp_spin_table_cpu_postboot(void)
132{
133 /*
134 * Let the primary processor know we're out of the pen.
135 */
136 write_pen_release(INVALID_HWID);
137
138 /*
139 * Synchronise with the boot thread.
140 */
141 raw_spin_lock(&boot_lock);
142 raw_spin_unlock(&boot_lock);
143}
144
145const struct cpu_operations smp_spin_table_ops = {
63 .name = "spin-table", 146 .name = "spin-table",
64 .init_cpu = smp_spin_table_init_cpu, 147 .cpu_init = smp_spin_table_cpu_init,
65 .prepare_cpu = smp_spin_table_prepare_cpu, 148 .cpu_prepare = smp_spin_table_cpu_prepare,
149 .cpu_boot = smp_spin_table_cpu_boot,
150 .cpu_postboot = smp_spin_table_cpu_postboot,
66}; 151};
diff --git a/arch/arm64/kernel/sys32.S b/arch/arm64/kernel/sys32.S
index a1b19ed7467c..423a5b3fc2be 100644
--- a/arch/arm64/kernel/sys32.S
+++ b/arch/arm64/kernel/sys32.S
@@ -59,48 +59,48 @@ ENDPROC(compat_sys_fstatfs64_wrapper)
59 * extension. 59 * extension.
60 */ 60 */
61compat_sys_pread64_wrapper: 61compat_sys_pread64_wrapper:
62 orr x3, x4, x5, lsl #32 62 regs_to_64 x3, x4, x5
63 b sys_pread64 63 b sys_pread64
64ENDPROC(compat_sys_pread64_wrapper) 64ENDPROC(compat_sys_pread64_wrapper)
65 65
66compat_sys_pwrite64_wrapper: 66compat_sys_pwrite64_wrapper:
67 orr x3, x4, x5, lsl #32 67 regs_to_64 x3, x4, x5
68 b sys_pwrite64 68 b sys_pwrite64
69ENDPROC(compat_sys_pwrite64_wrapper) 69ENDPROC(compat_sys_pwrite64_wrapper)
70 70
71compat_sys_truncate64_wrapper: 71compat_sys_truncate64_wrapper:
72 orr x1, x2, x3, lsl #32 72 regs_to_64 x1, x2, x3
73 b sys_truncate 73 b sys_truncate
74ENDPROC(compat_sys_truncate64_wrapper) 74ENDPROC(compat_sys_truncate64_wrapper)
75 75
76compat_sys_ftruncate64_wrapper: 76compat_sys_ftruncate64_wrapper:
77 orr x1, x2, x3, lsl #32 77 regs_to_64 x1, x2, x3
78 b sys_ftruncate 78 b sys_ftruncate
79ENDPROC(compat_sys_ftruncate64_wrapper) 79ENDPROC(compat_sys_ftruncate64_wrapper)
80 80
81compat_sys_readahead_wrapper: 81compat_sys_readahead_wrapper:
82 orr x1, x2, x3, lsl #32 82 regs_to_64 x1, x2, x3
83 mov w2, w4 83 mov w2, w4
84 b sys_readahead 84 b sys_readahead
85ENDPROC(compat_sys_readahead_wrapper) 85ENDPROC(compat_sys_readahead_wrapper)
86 86
87compat_sys_fadvise64_64_wrapper: 87compat_sys_fadvise64_64_wrapper:
88 mov w6, w1 88 mov w6, w1
89 orr x1, x2, x3, lsl #32 89 regs_to_64 x1, x2, x3
90 orr x2, x4, x5, lsl #32 90 regs_to_64 x2, x4, x5
91 mov w3, w6 91 mov w3, w6
92 b sys_fadvise64_64 92 b sys_fadvise64_64
93ENDPROC(compat_sys_fadvise64_64_wrapper) 93ENDPROC(compat_sys_fadvise64_64_wrapper)
94 94
95compat_sys_sync_file_range2_wrapper: 95compat_sys_sync_file_range2_wrapper:
96 orr x2, x2, x3, lsl #32 96 regs_to_64 x2, x2, x3
97 orr x3, x4, x5, lsl #32 97 regs_to_64 x3, x4, x5
98 b sys_sync_file_range2 98 b sys_sync_file_range2
99ENDPROC(compat_sys_sync_file_range2_wrapper) 99ENDPROC(compat_sys_sync_file_range2_wrapper)
100 100
101compat_sys_fallocate_wrapper: 101compat_sys_fallocate_wrapper:
102 orr x2, x2, x3, lsl #32 102 regs_to_64 x2, x2, x3
103 orr x3, x4, x5, lsl #32 103 regs_to_64 x3, x4, x5
104 b sys_fallocate 104 b sys_fallocate
105ENDPROC(compat_sys_fallocate_wrapper) 105ENDPROC(compat_sys_fallocate_wrapper)
106 106
diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c
index 03dc3718eb13..29c39d5d77e3 100644
--- a/arch/arm64/kernel/time.c
+++ b/arch/arm64/kernel/time.c
@@ -61,13 +61,6 @@ unsigned long profile_pc(struct pt_regs *regs)
61EXPORT_SYMBOL(profile_pc); 61EXPORT_SYMBOL(profile_pc);
62#endif 62#endif
63 63
64static u64 sched_clock_mult __read_mostly;
65
66unsigned long long notrace sched_clock(void)
67{
68 return arch_timer_read_counter() * sched_clock_mult;
69}
70
71void __init time_init(void) 64void __init time_init(void)
72{ 65{
73 u32 arch_timer_rate; 66 u32 arch_timer_rate;
@@ -78,9 +71,6 @@ void __init time_init(void)
78 if (!arch_timer_rate) 71 if (!arch_timer_rate)
79 panic("Unable to initialise architected timer.\n"); 72 panic("Unable to initialise architected timer.\n");
80 73
81 /* Cache the sched_clock multiplier to save a divide in the hot path. */
82 sched_clock_mult = NSEC_PER_SEC / arch_timer_rate;
83
84 /* Calibrate the delay loop directly */ 74 /* Calibrate the delay loop directly */
85 lpj_fine = arch_timer_rate / HZ; 75 lpj_fine = arch_timer_rate / HZ;
86} 76}
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index 6a389dc1bd49..65d40cf6945a 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -58,7 +58,10 @@ static struct page *vectors_page[1];
58static int alloc_vectors_page(void) 58static int alloc_vectors_page(void)
59{ 59{
60 extern char __kuser_helper_start[], __kuser_helper_end[]; 60 extern char __kuser_helper_start[], __kuser_helper_end[];
61 extern char __aarch32_sigret_code_start[], __aarch32_sigret_code_end[];
62
61 int kuser_sz = __kuser_helper_end - __kuser_helper_start; 63 int kuser_sz = __kuser_helper_end - __kuser_helper_start;
64 int sigret_sz = __aarch32_sigret_code_end - __aarch32_sigret_code_start;
62 unsigned long vpage; 65 unsigned long vpage;
63 66
64 vpage = get_zeroed_page(GFP_ATOMIC); 67 vpage = get_zeroed_page(GFP_ATOMIC);
@@ -72,7 +75,7 @@ static int alloc_vectors_page(void)
72 75
73 /* sigreturn code */ 76 /* sigreturn code */
74 memcpy((void *)vpage + AARCH32_KERN_SIGRET_CODE_OFFSET, 77 memcpy((void *)vpage + AARCH32_KERN_SIGRET_CODE_OFFSET,
75 aarch32_sigret_code, sizeof(aarch32_sigret_code)); 78 __aarch32_sigret_code_start, sigret_sz);
76 79
77 flush_icache_range(vpage, vpage + PAGE_SIZE); 80 flush_icache_range(vpage, vpage + PAGE_SIZE);
78 vectors_page[0] = virt_to_page(vpage); 81 vectors_page[0] = virt_to_page(vpage);
diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
index f8ab9d8e2ea3..5161ad992091 100644
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -54,7 +54,6 @@ SECTIONS
54 } 54 }
55 .text : { /* Real text segment */ 55 .text : { /* Real text segment */
56 _stext = .; /* Text and read-only data */ 56 _stext = .; /* Text and read-only data */
57 *(.smp.pen.text)
58 __exception_text_start = .; 57 __exception_text_start = .;
59 *(.exception.text) 58 *(.exception.text)
60 __exception_text_end = .; 59 __exception_text_end = .;
@@ -97,30 +96,13 @@ SECTIONS
97 PERCPU_SECTION(64) 96 PERCPU_SECTION(64)
98 97
99 __init_end = .; 98 __init_end = .;
100 . = ALIGN(THREAD_SIZE); 99
101 __data_loc = .; 100 . = ALIGN(PAGE_SIZE);
102 101 _data = .;
103 .data : AT(__data_loc) { 102 __data_loc = _data - LOAD_OFFSET;
104 _data = .; /* address in memory */ 103 _sdata = .;
105 _sdata = .; 104 RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
106 105 _edata = .;
107 /*
108 * first, the init task union, aligned
109 * to an 8192 byte boundary.
110 */
111 INIT_TASK_DATA(THREAD_SIZE)
112 NOSAVE_DATA
113 CACHELINE_ALIGNED_DATA(64)
114 READ_MOSTLY_DATA(64)
115
116 /*
117 * and the usual data section
118 */
119 DATA_DATA
120 CONSTRUCTORS
121
122 _edata = .;
123 }
124 _edata_loc = __data_loc + SIZEOF(.data); 106 _edata_loc = __data_loc + SIZEOF(.data);
125 107
126 BSS_SECTION(0, 0, 0) 108 BSS_SECTION(0, 0, 0)
diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
index 21e90820bd23..4480ab339a00 100644
--- a/arch/arm64/kvm/Kconfig
+++ b/arch/arm64/kvm/Kconfig
@@ -21,6 +21,7 @@ config KVM
21 select MMU_NOTIFIER 21 select MMU_NOTIFIER
22 select PREEMPT_NOTIFIERS 22 select PREEMPT_NOTIFIERS
23 select ANON_INODES 23 select ANON_INODES
24 select HAVE_KVM_CPU_RELAX_INTERCEPT
24 select KVM_MMIO 25 select KVM_MMIO
25 select KVM_ARM_HOST 26 select KVM_ARM_HOST
26 select KVM_ARM_VGIC 27 select KVM_ARM_VGIC
diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
index 2c3ff67a8ecb..3f0731e53274 100644
--- a/arch/arm64/kvm/guest.c
+++ b/arch/arm64/kvm/guest.c
@@ -248,6 +248,26 @@ int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
248 return kvm_reset_vcpu(vcpu); 248 return kvm_reset_vcpu(vcpu);
249} 249}
250 250
251int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init)
252{
253 int target = kvm_target_cpu();
254
255 if (target < 0)
256 return -ENODEV;
257
258 memset(init, 0, sizeof(*init));
259
260 /*
261 * For now, we don't return any features.
262 * In future, we might use features to return target
263 * specific features available for the preferred
264 * target type.
265 */
266 init->target = (__u32)target;
267
268 return 0;
269}
270
251int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) 271int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
252{ 272{
253 return -EINVAL; 273 return -EINVAL;
diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
index 9beaca033437..8da56067c304 100644
--- a/arch/arm64/kvm/handle_exit.c
+++ b/arch/arm64/kvm/handle_exit.c
@@ -47,21 +47,29 @@ static int handle_smc(struct kvm_vcpu *vcpu, struct kvm_run *run)
47} 47}
48 48
49/** 49/**
50 * kvm_handle_wfi - handle a wait-for-interrupts instruction executed by a guest 50 * kvm_handle_wfx - handle a wait-for-interrupts or wait-for-event
51 * instruction executed by a guest
52 *
51 * @vcpu: the vcpu pointer 53 * @vcpu: the vcpu pointer
52 * 54 *
53 * Simply call kvm_vcpu_block(), which will halt execution of 55 * WFE: Yield the CPU and come back to this vcpu when the scheduler
56 * decides to.
57 * WFI: Simply call kvm_vcpu_block(), which will halt execution of
54 * world-switches and schedule other host processes until there is an 58 * world-switches and schedule other host processes until there is an
55 * incoming IRQ or FIQ to the VM. 59 * incoming IRQ or FIQ to the VM.
56 */ 60 */
57static int kvm_handle_wfi(struct kvm_vcpu *vcpu, struct kvm_run *run) 61static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run)
58{ 62{
59 kvm_vcpu_block(vcpu); 63 if (kvm_vcpu_get_hsr(vcpu) & ESR_EL2_EC_WFI_ISS_WFE)
64 kvm_vcpu_on_spin(vcpu);
65 else
66 kvm_vcpu_block(vcpu);
67
60 return 1; 68 return 1;
61} 69}
62 70
63static exit_handle_fn arm_exit_handlers[] = { 71static exit_handle_fn arm_exit_handlers[] = {
64 [ESR_EL2_EC_WFI] = kvm_handle_wfi, 72 [ESR_EL2_EC_WFI] = kvm_handle_wfx,
65 [ESR_EL2_EC_CP15_32] = kvm_handle_cp15_32, 73 [ESR_EL2_EC_CP15_32] = kvm_handle_cp15_32,
66 [ESR_EL2_EC_CP15_64] = kvm_handle_cp15_64, 74 [ESR_EL2_EC_CP15_64] = kvm_handle_cp15_64,
67 [ESR_EL2_EC_CP14_MR] = kvm_handle_cp14_access, 75 [ESR_EL2_EC_CP14_MR] = kvm_handle_cp14_access,
diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S
index ba84e6705e20..2b0244d65c16 100644
--- a/arch/arm64/kvm/hyp-init.S
+++ b/arch/arm64/kvm/hyp-init.S
@@ -74,7 +74,10 @@ __do_hyp_init:
74 msr mair_el2, x4 74 msr mair_el2, x4
75 isb 75 isb
76 76
77 mov x4, #SCTLR_EL2_FLAGS 77 mrs x4, sctlr_el2
78 and x4, x4, #SCTLR_EL2_EE // preserve endianness of EL2
79 ldr x5, =SCTLR_EL2_FLAGS
80 orr x4, x4, x5
78 msr sctlr_el2, x4 81 msr sctlr_el2, x4
79 isb 82 isb
80 83
diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S
index 1ac0bbbdddb2..3b47c36e10ff 100644
--- a/arch/arm64/kvm/hyp.S
+++ b/arch/arm64/kvm/hyp.S
@@ -403,6 +403,14 @@ __kvm_hyp_code_start:
403 ldr w9, [x2, #GICH_ELRSR0] 403 ldr w9, [x2, #GICH_ELRSR0]
404 ldr w10, [x2, #GICH_ELRSR1] 404 ldr w10, [x2, #GICH_ELRSR1]
405 ldr w11, [x2, #GICH_APR] 405 ldr w11, [x2, #GICH_APR]
406CPU_BE( rev w4, w4 )
407CPU_BE( rev w5, w5 )
408CPU_BE( rev w6, w6 )
409CPU_BE( rev w7, w7 )
410CPU_BE( rev w8, w8 )
411CPU_BE( rev w9, w9 )
412CPU_BE( rev w10, w10 )
413CPU_BE( rev w11, w11 )
406 414
407 str w4, [x3, #VGIC_CPU_HCR] 415 str w4, [x3, #VGIC_CPU_HCR]
408 str w5, [x3, #VGIC_CPU_VMCR] 416 str w5, [x3, #VGIC_CPU_VMCR]
@@ -421,6 +429,7 @@ __kvm_hyp_code_start:
421 ldr w4, [x3, #VGIC_CPU_NR_LR] 429 ldr w4, [x3, #VGIC_CPU_NR_LR]
422 add x3, x3, #VGIC_CPU_LR 430 add x3, x3, #VGIC_CPU_LR
4231: ldr w5, [x2], #4 4311: ldr w5, [x2], #4
432CPU_BE( rev w5, w5 )
424 str w5, [x3], #4 433 str w5, [x3], #4
425 sub w4, w4, #1 434 sub w4, w4, #1
426 cbnz w4, 1b 435 cbnz w4, 1b
@@ -446,6 +455,9 @@ __kvm_hyp_code_start:
446 ldr w4, [x3, #VGIC_CPU_HCR] 455 ldr w4, [x3, #VGIC_CPU_HCR]
447 ldr w5, [x3, #VGIC_CPU_VMCR] 456 ldr w5, [x3, #VGIC_CPU_VMCR]
448 ldr w6, [x3, #VGIC_CPU_APR] 457 ldr w6, [x3, #VGIC_CPU_APR]
458CPU_BE( rev w4, w4 )
459CPU_BE( rev w5, w5 )
460CPU_BE( rev w6, w6 )
449 461
450 str w4, [x2, #GICH_HCR] 462 str w4, [x2, #GICH_HCR]
451 str w5, [x2, #GICH_VMCR] 463 str w5, [x2, #GICH_VMCR]
@@ -456,6 +468,7 @@ __kvm_hyp_code_start:
456 ldr w4, [x3, #VGIC_CPU_NR_LR] 468 ldr w4, [x3, #VGIC_CPU_NR_LR]
457 add x3, x3, #VGIC_CPU_LR 469 add x3, x3, #VGIC_CPU_LR
4581: ldr w5, [x3], #4 4701: ldr w5, [x3], #4
471CPU_BE( rev w5, w5 )
459 str w5, [x2], #4 472 str w5, [x2], #4
460 sub w4, w4, #1 473 sub w4, w4, #1
461 cbnz w4, 1b 474 cbnz w4, 1b
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 6d6acf153bff..c23751b06120 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -130,7 +130,7 @@ static void __do_user_fault(struct task_struct *tsk, unsigned long addr,
130 force_sig_info(sig, &si, tsk); 130 force_sig_info(sig, &si, tsk);
131} 131}
132 132
133void do_bad_area(unsigned long addr, unsigned int esr, struct pt_regs *regs) 133static void do_bad_area(unsigned long addr, unsigned int esr, struct pt_regs *regs)
134{ 134{
135 struct task_struct *tsk = current; 135 struct task_struct *tsk = current;
136 struct mm_struct *mm = tsk->active_mm; 136 struct mm_struct *mm = tsk->active_mm;
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index de2de5db628d..0cb8742de4f2 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -31,7 +31,6 @@
31#include <linux/sort.h> 31#include <linux/sort.h>
32#include <linux/of_fdt.h> 32#include <linux/of_fdt.h>
33 33
34#include <asm/prom.h>
35#include <asm/sections.h> 34#include <asm/sections.h>
36#include <asm/setup.h> 35#include <asm/setup.h>
37#include <asm/sizes.h> 36#include <asm/sizes.h>
@@ -39,17 +38,9 @@
39 38
40#include "mm.h" 39#include "mm.h"
41 40
42static unsigned long phys_initrd_start __initdata = 0;
43static unsigned long phys_initrd_size __initdata = 0;
44
45phys_addr_t memstart_addr __read_mostly = 0; 41phys_addr_t memstart_addr __read_mostly = 0;
46 42
47void __init early_init_dt_setup_initrd_arch(u64 start, u64 end) 43#ifdef CONFIG_BLK_DEV_INITRD
48{
49 phys_initrd_start = start;
50 phys_initrd_size = end - start;
51}
52
53static int __init early_initrd(char *p) 44static int __init early_initrd(char *p)
54{ 45{
55 unsigned long start, size; 46 unsigned long start, size;
@@ -59,12 +50,13 @@ static int __init early_initrd(char *p)
59 if (*endp == ',') { 50 if (*endp == ',') {
60 size = memparse(endp + 1, NULL); 51 size = memparse(endp + 1, NULL);
61 52
62 phys_initrd_start = start; 53 initrd_start = (unsigned long)__va(start);
63 phys_initrd_size = size; 54 initrd_end = (unsigned long)__va(start + size);
64 } 55 }
65 return 0; 56 return 0;
66} 57}
67early_param("initrd", early_initrd); 58early_param("initrd", early_initrd);
59#endif
68 60
69#define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT) 61#define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT)
70 62
@@ -137,13 +129,8 @@ void __init arm64_memblock_init(void)
137 /* Register the kernel text, kernel data and initrd with memblock */ 129 /* Register the kernel text, kernel data and initrd with memblock */
138 memblock_reserve(__pa(_text), _end - _text); 130 memblock_reserve(__pa(_text), _end - _text);
139#ifdef CONFIG_BLK_DEV_INITRD 131#ifdef CONFIG_BLK_DEV_INITRD
140 if (phys_initrd_size) { 132 if (initrd_start)
141 memblock_reserve(phys_initrd_start, phys_initrd_size); 133 memblock_reserve(__virt_to_phys(initrd_start), initrd_end - initrd_start);
142
143 /* Now convert initrd to virtual addresses */
144 initrd_start = __phys_to_virt(phys_initrd_start);
145 initrd_end = initrd_start + phys_initrd_size;
146 }
147#endif 134#endif
148 135
149 /* 136 /*
diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c
index 1725cd6db37a..2bb1d586664c 100644
--- a/arch/arm64/mm/ioremap.c
+++ b/arch/arm64/mm/ioremap.c
@@ -77,8 +77,24 @@ EXPORT_SYMBOL(__ioremap);
77 77
78void __iounmap(volatile void __iomem *io_addr) 78void __iounmap(volatile void __iomem *io_addr)
79{ 79{
80 void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr); 80 unsigned long addr = (unsigned long)io_addr & PAGE_MASK;
81 81
82 vunmap(addr); 82 /*
83 * We could get an address outside vmalloc range in case
84 * of ioremap_cache() reusing a RAM mapping.
85 */
86 if (VMALLOC_START <= addr && addr < VMALLOC_END)
87 vunmap((void *)addr);
83} 88}
84EXPORT_SYMBOL(__iounmap); 89EXPORT_SYMBOL(__iounmap);
90
91void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size)
92{
93 /* For normal memory we already have a cacheable mapping. */
94 if (pfn_valid(__phys_to_pfn(phys_addr)))
95 return (void __iomem *)__phys_to_virt(phys_addr);
96
97 return __ioremap_caller(phys_addr, size, __pgprot(PROT_NORMAL),
98 __builtin_return_address(0));
99}
100EXPORT_SYMBOL(ioremap_cache);
diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
index b1b31bbc967b..421b99fd635d 100644
--- a/arch/arm64/mm/proc.S
+++ b/arch/arm64/mm/proc.S
@@ -162,9 +162,9 @@ ENDPROC(__cpu_setup)
162 * CE0 XWHW CZ ME TEEA S 162 * CE0 XWHW CZ ME TEEA S
163 * .... .IEE .... NEAI TE.I ..AD DEN0 ACAM 163 * .... .IEE .... NEAI TE.I ..AD DEN0 ACAM
164 * 0011 0... 1101 ..0. ..0. 10.. .... .... < hardware reserved 164 * 0011 0... 1101 ..0. ..0. 10.. .... .... < hardware reserved
165 * .... .100 .... 01.1 11.1 ..01 0001 1101 < software settings 165 * .... .1.. .... 01.1 11.1 ..01 0001 1101 < software settings
166 */ 166 */
167 .type crval, #object 167 .type crval, #object
168crval: 168crval:
169 .word 0x030802e2 // clear 169 .word 0x000802e2 // clear
170 .word 0x0405d11d // set 170 .word 0x0405d11d // set
diff --git a/arch/arm64/mm/tlb.S b/arch/arm64/mm/tlb.S
index 8ae80a18e8ec..19da91e0cd27 100644
--- a/arch/arm64/mm/tlb.S
+++ b/arch/arm64/mm/tlb.S
@@ -35,7 +35,7 @@
35 */ 35 */
36ENTRY(__cpu_flush_user_tlb_range) 36ENTRY(__cpu_flush_user_tlb_range)
37 vma_vm_mm x3, x2 // get vma->vm_mm 37 vma_vm_mm x3, x2 // get vma->vm_mm
38 mmid x3, x3 // get vm_mm->context.id 38 mmid w3, x3 // get vm_mm->context.id
39 dsb sy 39 dsb sy
40 lsr x0, x0, #12 // align address 40 lsr x0, x0, #12 // align address
41 lsr x1, x1, #12 41 lsr x1, x1, #12
diff --git a/arch/arm64/xen/Makefile b/arch/arm64/xen/Makefile
index be240404ba96..74a8d87e542b 100644
--- a/arch/arm64/xen/Makefile
+++ b/arch/arm64/xen/Makefile
@@ -1,2 +1,2 @@
1xen-arm-y += $(addprefix ../../arm/xen/, enlighten.o grant-table.o) 1xen-arm-y += $(addprefix ../../arm/xen/, enlighten.o grant-table.o p2m.o mm.o)
2obj-y := xen-arm.o hypercall.o 2obj-y := xen-arm.o hypercall.o
diff --git a/arch/avr32/boards/atngw100/evklcd10x.c b/arch/avr32/boards/atngw100/evklcd10x.c
index 20388750d564..64919b0da7aa 100644
--- a/arch/avr32/boards/atngw100/evklcd10x.c
+++ b/arch/avr32/boards/atngw100/evklcd10x.c
@@ -58,7 +58,7 @@ static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
58 .dclkmax = 28330000, 58 .dclkmax = 28330000,
59}; 59};
60 60
61static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = { 61static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
62 .default_bpp = 16, 62 .default_bpp = 16,
63 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN, 63 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
64 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT 64 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
@@ -96,7 +96,7 @@ static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
96 .dclkmax = 7000000, 96 .dclkmax = 7000000,
97}; 97};
98 98
99static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = { 99static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
100 .default_bpp = 16, 100 .default_bpp = 16,
101 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN, 101 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
102 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT 102 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
@@ -134,7 +134,7 @@ static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
134 .dclkmax = 6400000, 134 .dclkmax = 6400000,
135}; 135};
136 136
137static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = { 137static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
138 .default_bpp = 16, 138 .default_bpp = 16,
139 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN, 139 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
140 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT 140 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
@@ -145,7 +145,7 @@ static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
145}; 145};
146#endif 146#endif
147 147
148static void atevklcd10x_lcdc_power_control(int on) 148static void atevklcd10x_lcdc_power_control(struct atmel_lcdfb_pdata *pdata, int on)
149{ 149{
150 gpio_set_value(GPIO_PIN_PB(15), on); 150 gpio_set_value(GPIO_PIN_PB(15), on);
151} 151}
diff --git a/arch/avr32/boards/atngw100/mrmt.c b/arch/avr32/boards/atngw100/mrmt.c
index 7de083d19b7e..1ba09e4c02b1 100644
--- a/arch/avr32/boards/atngw100/mrmt.c
+++ b/arch/avr32/boards/atngw100/mrmt.c
@@ -83,7 +83,7 @@ static struct fb_monspecs __initdata lcd_fb_default_monspecs = {
83 .dclkmax = 9260000, 83 .dclkmax = 9260000,
84}; 84};
85 85
86static struct atmel_lcdfb_info __initdata rmt_lcdc_data = { 86static struct atmel_lcdfb_pdata __initdata rmt_lcdc_data = {
87 .default_bpp = 24, 87 .default_bpp = 24,
88 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN, 88 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
89 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT 89 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
@@ -126,7 +126,7 @@ static struct fb_monspecs __initdata lcd_fb_default_monspecs = {
126 .dclkmax = 9260000, 126 .dclkmax = 9260000,
127}; 127};
128 128
129static struct atmel_lcdfb_info __initdata rmt_lcdc_data = { 129static struct atmel_lcdfb_pdata __initdata rmt_lcdc_data = {
130 .default_bpp = 24, 130 .default_bpp = 24,
131 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN, 131 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
132 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT 132 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
diff --git a/arch/avr32/boards/atstk1000/atstk1000.h b/arch/avr32/boards/atstk1000/atstk1000.h
index 9392d3252865..653cc09e536c 100644
--- a/arch/avr32/boards/atstk1000/atstk1000.h
+++ b/arch/avr32/boards/atstk1000/atstk1000.h
@@ -10,7 +10,7 @@
10#ifndef __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H 10#ifndef __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H
11#define __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H 11#define __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H
12 12
13extern struct atmel_lcdfb_info atstk1000_lcdc_data; 13extern struct atmel_lcdfb_pdata atstk1000_lcdc_data;
14 14
15void atstk1000_setup_j2_leds(void); 15void atstk1000_setup_j2_leds(void);
16 16
diff --git a/arch/avr32/boards/atstk1000/setup.c b/arch/avr32/boards/atstk1000/setup.c
index 2d6b560115d9..b6b88f5e0b43 100644
--- a/arch/avr32/boards/atstk1000/setup.c
+++ b/arch/avr32/boards/atstk1000/setup.c
@@ -55,7 +55,7 @@ static struct fb_monspecs __initdata atstk1000_default_monspecs = {
55 .dclkmax = 30000000, 55 .dclkmax = 30000000,
56}; 56};
57 57
58struct atmel_lcdfb_info __initdata atstk1000_lcdc_data = { 58struct atmel_lcdfb_pdata __initdata atstk1000_lcdc_data = {
59 .default_bpp = 24, 59 .default_bpp = 24,
60 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN, 60 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
61 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT 61 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c
index 27bd6fbe21cb..7b1f2cd85400 100644
--- a/arch/avr32/boards/favr-32/setup.c
+++ b/arch/avr32/boards/favr-32/setup.c
@@ -125,7 +125,7 @@ static struct fb_monspecs __initdata favr32_default_monspecs = {
125 .dclkmax = 28000000, 125 .dclkmax = 28000000,
126}; 126};
127 127
128struct atmel_lcdfb_info __initdata favr32_lcdc_data = { 128struct atmel_lcdfb_pdata __initdata favr32_lcdc_data = {
129 .default_bpp = 16, 129 .default_bpp = 16,
130 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN, 130 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
131 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT 131 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
diff --git a/arch/avr32/boards/hammerhead/setup.c b/arch/avr32/boards/hammerhead/setup.c
index 9d1efd1cd425..dc0e317f2ecd 100644
--- a/arch/avr32/boards/hammerhead/setup.c
+++ b/arch/avr32/boards/hammerhead/setup.c
@@ -77,7 +77,7 @@ static struct fb_monspecs __initdata hammerhead_hda350t_monspecs = {
77 .dclkmax = 10000000, 77 .dclkmax = 10000000,
78}; 78};
79 79
80struct atmel_lcdfb_info __initdata hammerhead_lcdc_data = { 80struct atmel_lcdfb_pdata __initdata hammerhead_lcdc_data = {
81 .default_bpp = 24, 81 .default_bpp = 24,
82 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN, 82 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
83 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT 83 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
diff --git a/arch/avr32/boards/merisc/display.c b/arch/avr32/boards/merisc/display.c
index 85a543cd4abc..e7683ee7ed40 100644
--- a/arch/avr32/boards/merisc/display.c
+++ b/arch/avr32/boards/merisc/display.c
@@ -45,7 +45,7 @@ static struct fb_monspecs merisc_fb_monspecs = {
45 .dclkmax = 30000000, 45 .dclkmax = 30000000,
46}; 46};
47 47
48struct atmel_lcdfb_info merisc_lcdc_data = { 48struct atmel_lcdfb_pdata merisc_lcdc_data = {
49 .default_bpp = 24, 49 .default_bpp = 24,
50 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN, 50 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
51 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT 51 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
diff --git a/arch/avr32/boards/mimc200/setup.c b/arch/avr32/boards/mimc200/setup.c
index 05358aa5ef7d..1cb8e9cc5cfa 100644
--- a/arch/avr32/boards/mimc200/setup.c
+++ b/arch/avr32/boards/mimc200/setup.c
@@ -8,7 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11extern struct atmel_lcdfb_info mimc200_lcdc_data; 11extern struct atmel_lcdfb_pdata mimc200_lcdc_data;
12 12
13#include <linux/clk.h> 13#include <linux/clk.h>
14#include <linux/etherdevice.h> 14#include <linux/etherdevice.h>
@@ -71,7 +71,7 @@ static struct fb_monspecs __initdata mimc200_default_monspecs = {
71 .dclkmax = 25200000, 71 .dclkmax = 25200000,
72}; 72};
73 73
74struct atmel_lcdfb_info __initdata mimc200_lcdc_data = { 74struct atmel_lcdfb_pdata __initdata mimc200_lcdc_data = {
75 .default_bpp = 16, 75 .default_bpp = 16,
76 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN, 76 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
77 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT 77 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
diff --git a/arch/avr32/include/asm/Kbuild b/arch/avr32/include/asm/Kbuild
index d22af851f3f6..658001b52400 100644
--- a/arch/avr32/include/asm/Kbuild
+++ b/arch/avr32/include/asm/Kbuild
@@ -1,5 +1,20 @@
1 1
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += cputime.h
4generic-y += delay.h
5generic-y += device.h
6generic-y += div64.h
7generic-y += emergency-restart.h
3generic-y += exec.h 8generic-y += exec.h
4generic-y += trace_clock.h 9generic-y += futex.h
10generic-y += preempt.h
11generic-y += irq_regs.h
5generic-y += param.h 12generic-y += param.h
13generic-y += local.h
14generic-y += local64.h
15generic-y += percpu.h
16generic-y += scatterlist.h
17generic-y += sections.h
18generic-y += topology.h
19generic-y += trace_clock.h
20generic-y += xor.h
diff --git a/arch/avr32/include/asm/cputime.h b/arch/avr32/include/asm/cputime.h
deleted file mode 100644
index e87e0f81cbeb..000000000000
--- a/arch/avr32/include/asm/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_AVR32_CPUTIME_H
2#define __ASM_AVR32_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __ASM_AVR32_CPUTIME_H */
diff --git a/arch/avr32/include/asm/delay.h b/arch/avr32/include/asm/delay.h
deleted file mode 100644
index 9670e127b7b2..000000000000
--- a/arch/avr32/include/asm/delay.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/delay.h>
diff --git a/arch/avr32/include/asm/device.h b/arch/avr32/include/asm/device.h
deleted file mode 100644
index d8f9872b0e2d..000000000000
--- a/arch/avr32/include/asm/device.h
+++ /dev/null
@@ -1,7 +0,0 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/arch/avr32/include/asm/div64.h b/arch/avr32/include/asm/div64.h
deleted file mode 100644
index d7ddd4fdeca6..000000000000
--- a/arch/avr32/include/asm/div64.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_AVR32_DIV64_H
2#define __ASM_AVR32_DIV64_H
3
4#include <asm-generic/div64.h>
5
6#endif /* __ASM_AVR32_DIV64_H */
diff --git a/arch/avr32/include/asm/emergency-restart.h b/arch/avr32/include/asm/emergency-restart.h
deleted file mode 100644
index 3e7e014776ba..000000000000
--- a/arch/avr32/include/asm/emergency-restart.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_AVR32_EMERGENCY_RESTART_H
2#define __ASM_AVR32_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* __ASM_AVR32_EMERGENCY_RESTART_H */
diff --git a/arch/avr32/include/asm/futex.h b/arch/avr32/include/asm/futex.h
deleted file mode 100644
index 10419f14a68a..000000000000
--- a/arch/avr32/include/asm/futex.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_AVR32_FUTEX_H
2#define __ASM_AVR32_FUTEX_H
3
4#include <asm-generic/futex.h>
5
6#endif /* __ASM_AVR32_FUTEX_H */
diff --git a/arch/avr32/include/asm/irq_regs.h b/arch/avr32/include/asm/irq_regs.h
deleted file mode 100644
index 3dd9c0b70270..000000000000
--- a/arch/avr32/include/asm/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/arch/avr32/include/asm/local.h b/arch/avr32/include/asm/local.h
deleted file mode 100644
index 1c1619694da3..000000000000
--- a/arch/avr32/include/asm/local.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_AVR32_LOCAL_H
2#define __ASM_AVR32_LOCAL_H
3
4#include <asm-generic/local.h>
5
6#endif /* __ASM_AVR32_LOCAL_H */
diff --git a/arch/avr32/include/asm/local64.h b/arch/avr32/include/asm/local64.h
deleted file mode 100644
index 36c93b5cc239..000000000000
--- a/arch/avr32/include/asm/local64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/local64.h>
diff --git a/arch/avr32/include/asm/percpu.h b/arch/avr32/include/asm/percpu.h
deleted file mode 100644
index 69227b4cd0d4..000000000000
--- a/arch/avr32/include/asm/percpu.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_AVR32_PERCPU_H
2#define __ASM_AVR32_PERCPU_H
3
4#include <asm-generic/percpu.h>
5
6#endif /* __ASM_AVR32_PERCPU_H */
diff --git a/arch/avr32/include/asm/pgalloc.h b/arch/avr32/include/asm/pgalloc.h
index bc7e8ae479ee..1aba19d68c5e 100644
--- a/arch/avr32/include/asm/pgalloc.h
+++ b/arch/avr32/include/asm/pgalloc.h
@@ -68,7 +68,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
68 return NULL; 68 return NULL;
69 69
70 page = virt_to_page(pg); 70 page = virt_to_page(pg);
71 pgtable_page_ctor(page); 71 if (!pgtable_page_ctor(page)) {
72 quicklist_free(QUICK_PT, NULL, pg);
73 return NULL;
74 }
72 75
73 return page; 76 return page;
74} 77}
diff --git a/arch/avr32/include/asm/scatterlist.h b/arch/avr32/include/asm/scatterlist.h
deleted file mode 100644
index a5902d9834e8..000000000000
--- a/arch/avr32/include/asm/scatterlist.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_AVR32_SCATTERLIST_H
2#define __ASM_AVR32_SCATTERLIST_H
3
4#include <asm-generic/scatterlist.h>
5
6#endif /* __ASM_AVR32_SCATTERLIST_H */
diff --git a/arch/avr32/include/asm/sections.h b/arch/avr32/include/asm/sections.h
deleted file mode 100644
index aa14252e4181..000000000000
--- a/arch/avr32/include/asm/sections.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_AVR32_SECTIONS_H
2#define __ASM_AVR32_SECTIONS_H
3
4#include <asm-generic/sections.h>
5
6#endif /* __ASM_AVR32_SECTIONS_H */
diff --git a/arch/avr32/include/asm/topology.h b/arch/avr32/include/asm/topology.h
deleted file mode 100644
index 5b766cbb4806..000000000000
--- a/arch/avr32/include/asm/topology.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_AVR32_TOPOLOGY_H
2#define __ASM_AVR32_TOPOLOGY_H
3
4#include <asm-generic/topology.h>
5
6#endif /* __ASM_AVR32_TOPOLOGY_H */
diff --git a/arch/avr32/include/asm/xor.h b/arch/avr32/include/asm/xor.h
deleted file mode 100644
index 99c87aa0af4f..000000000000
--- a/arch/avr32/include/asm/xor.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_XOR_H
2#define _ASM_XOR_H
3
4#include <asm-generic/xor.h>
5
6#endif
diff --git a/arch/avr32/include/uapi/asm/socket.h b/arch/avr32/include/uapi/asm/socket.h
index 11c4259c62fb..439936421434 100644
--- a/arch/avr32/include/uapi/asm/socket.h
+++ b/arch/avr32/include/uapi/asm/socket.h
@@ -76,4 +76,6 @@
76 76
77#define SO_BUSY_POLL 46 77#define SO_BUSY_POLL 46
78 78
79#define SO_MAX_PACING_RATE 47
80
79#endif /* __ASM_AVR32_SOCKET_H */ 81#endif /* __ASM_AVR32_SOCKET_H */
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
index c2731003edef..42a53e740a7e 100644
--- a/arch/avr32/kernel/process.c
+++ b/arch/avr32/kernel/process.c
@@ -289,7 +289,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
289 memset(childregs, 0, sizeof(struct pt_regs)); 289 memset(childregs, 0, sizeof(struct pt_regs));
290 p->thread.cpu_context.r0 = arg; 290 p->thread.cpu_context.r0 = arg;
291 p->thread.cpu_context.r1 = usp; /* fn */ 291 p->thread.cpu_context.r1 = usp; /* fn */
292 p->thread.cpu_context.r2 = syscall_return; 292 p->thread.cpu_context.r2 = (unsigned long)syscall_return;
293 p->thread.cpu_context.pc = (unsigned long)ret_from_kernel_thread; 293 p->thread.cpu_context.pc = (unsigned long)ret_from_kernel_thread;
294 childregs->sr = MODE_SUPERVISOR; 294 childregs->sr = MODE_SUPERVISOR;
295 } else { 295 } else {
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index 869a1c6ffeee..12f828ad5058 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -98,7 +98,14 @@ static void comparator_mode(enum clock_event_mode mode,
98 case CLOCK_EVT_MODE_SHUTDOWN: 98 case CLOCK_EVT_MODE_SHUTDOWN:
99 sysreg_write(COMPARE, 0); 99 sysreg_write(COMPARE, 0);
100 pr_debug("%s: stop\n", evdev->name); 100 pr_debug("%s: stop\n", evdev->name);
101 cpu_idle_poll_ctrl(false); 101 if (evdev->mode == CLOCK_EVT_MODE_ONESHOT ||
102 evdev->mode == CLOCK_EVT_MODE_RESUME) {
103 /*
104 * Only disable idle poll if we have forced that
105 * in a previous call.
106 */
107 cpu_idle_poll_ctrl(false);
108 }
102 break; 109 break;
103 default: 110 default:
104 BUG(); 111 BUG();
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index a68f3cf7c3c1..a1f4d1e91b52 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1439,7 +1439,7 @@ fail:
1439 * LCDC 1439 * LCDC
1440 * -------------------------------------------------------------------- */ 1440 * -------------------------------------------------------------------- */
1441#if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002) 1441#if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002)
1442static struct atmel_lcdfb_info atmel_lcdfb0_data; 1442static struct atmel_lcdfb_pdata atmel_lcdfb0_data;
1443static struct resource atmel_lcdfb0_resource[] = { 1443static struct resource atmel_lcdfb0_resource[] = {
1444 { 1444 {
1445 .start = 0xff000000, 1445 .start = 0xff000000,
@@ -1467,12 +1467,12 @@ static struct clk atmel_lcdfb0_pixclk = {
1467}; 1467};
1468 1468
1469struct platform_device *__init 1469struct platform_device *__init
1470at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, 1470at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_pdata *data,
1471 unsigned long fbmem_start, unsigned long fbmem_len, 1471 unsigned long fbmem_start, unsigned long fbmem_len,
1472 u64 pin_mask) 1472 u64 pin_mask)
1473{ 1473{
1474 struct platform_device *pdev; 1474 struct platform_device *pdev;
1475 struct atmel_lcdfb_info *info; 1475 struct atmel_lcdfb_pdata *info;
1476 struct fb_monspecs *monspecs; 1476 struct fb_monspecs *monspecs;
1477 struct fb_videomode *modedb; 1477 struct fb_videomode *modedb;
1478 unsigned int modedb_size; 1478 unsigned int modedb_size;
@@ -1529,7 +1529,7 @@ at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
1529 } 1529 }
1530 1530
1531 info = pdev->dev.platform_data; 1531 info = pdev->dev.platform_data;
1532 memcpy(info, data, sizeof(struct atmel_lcdfb_info)); 1532 memcpy(info, data, sizeof(struct atmel_lcdfb_pdata));
1533 info->default_monspecs = monspecs; 1533 info->default_monspecs = monspecs;
1534 1534
1535 pdev->name = "at32ap-lcdfb"; 1535 pdev->name = "at32ap-lcdfb";
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h
index d485b0391357..f1a316d52c73 100644
--- a/arch/avr32/mach-at32ap/include/mach/board.h
+++ b/arch/avr32/mach-at32ap/include/mach/board.h
@@ -44,9 +44,9 @@ struct platform_device *
44at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n); 44at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n);
45void at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b, unsigned int n); 45void at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b, unsigned int n);
46 46
47struct atmel_lcdfb_info; 47struct atmel_lcdfb_pdata;
48struct platform_device * 48struct platform_device *
49at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, 49at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_pdata *data,
50 unsigned long fbmem_start, unsigned long fbmem_len, 50 unsigned long fbmem_start, unsigned long fbmem_len,
51 u64 pin_mask); 51 u64 pin_mask);
52 52
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index f78c9a2c7e28..9ceccef9c649 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -34,7 +34,6 @@ config BLACKFIN
34 select ARCH_WANT_IPC_PARSE_VERSION 34 select ARCH_WANT_IPC_PARSE_VERSION
35 select GENERIC_ATOMIC64 35 select GENERIC_ATOMIC64
36 select GENERIC_IRQ_PROBE 36 select GENERIC_IRQ_PROBE
37 select USE_GENERIC_SMP_HELPERS if SMP
38 select HAVE_NMI_WATCHDOG if NMI_WATCHDOG 37 select HAVE_NMI_WATCHDOG if NMI_WATCHDOG
39 select GENERIC_SMP_IDLE_THREAD 38 select GENERIC_SMP_IDLE_THREAD
40 select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS 39 select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS
@@ -52,6 +51,9 @@ config GENERIC_BUG
52config ZONE_DMA 51config ZONE_DMA
53 def_bool y 52 def_bool y
54 53
54config GENERIC_GPIO
55 def_bool y
56
55config FORCE_MAX_ZONEORDER 57config FORCE_MAX_ZONEORDER
56 int 58 int
57 default "14" 59 default "14"
@@ -317,6 +319,14 @@ config BF53x
317 depends on (BF531 || BF532 || BF533 || BF534 || BF536 || BF537) 319 depends on (BF531 || BF532 || BF533 || BF534 || BF536 || BF537)
318 default y 320 default y
319 321
322config GPIO_ADI
323 def_bool y
324 depends on (BF51x || BF52x || BF53x || BF538 || BF539 || BF561)
325
326config PINCTRL
327 def_bool y
328 depends on BF54x || BF60x
329
320config MEM_MT48LC64M4A2FB_7E 330config MEM_MT48LC64M4A2FB_7E
321 bool 331 bool
322 depends on (BFIN533_STAMP) 332 depends on (BFIN533_STAMP)
@@ -1429,7 +1439,6 @@ source "drivers/cpufreq/Kconfig"
1429config BFIN_CPU_FREQ 1439config BFIN_CPU_FREQ
1430 bool 1440 bool
1431 depends on CPU_FREQ 1441 depends on CPU_FREQ
1432 select CPU_FREQ_TABLE
1433 default y 1442 default y
1434 1443
1435config CPU_VOLTAGE 1444config CPU_VOLTAGE
diff --git a/arch/blackfin/include/asm/Kbuild b/arch/blackfin/include/asm/Kbuild
index 127826f8a375..f2b43474b0e2 100644
--- a/arch/blackfin/include/asm/Kbuild
+++ b/arch/blackfin/include/asm/Kbuild
@@ -44,3 +44,4 @@ generic-y += ucontext.h
44generic-y += unaligned.h 44generic-y += unaligned.h
45generic-y += user.h 45generic-y += user.h
46generic-y += xor.h 46generic-y += xor.h
47generic-y += preempt.h
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h
index 98d0133346b5..99d338ca2ea4 100644
--- a/arch/blackfin/include/asm/gpio.h
+++ b/arch/blackfin/include/asm/gpio.h
@@ -25,8 +25,12 @@
25 25
26#ifndef __ASSEMBLY__ 26#ifndef __ASSEMBLY__
27 27
28#ifndef CONFIG_PINCTRL
29
28#include <linux/compiler.h> 30#include <linux/compiler.h>
29#include <linux/gpio.h> 31#include <asm/blackfin.h>
32#include <asm/portmux.h>
33#include <asm/irq_handler.h>
30 34
31/*********************************************************** 35/***********************************************************
32* 36*
@@ -45,7 +49,6 @@
45* MODIFICATION HISTORY : 49* MODIFICATION HISTORY :
46**************************************************************/ 50**************************************************************/
47 51
48#if !BFIN_GPIO_PINT
49void set_gpio_dir(unsigned, unsigned short); 52void set_gpio_dir(unsigned, unsigned short);
50void set_gpio_inen(unsigned, unsigned short); 53void set_gpio_inen(unsigned, unsigned short);
51void set_gpio_polar(unsigned, unsigned short); 54void set_gpio_polar(unsigned, unsigned short);
@@ -115,7 +118,6 @@ struct gpio_port_t {
115 unsigned short dummy16; 118 unsigned short dummy16;
116 unsigned short inen; 119 unsigned short inen;
117}; 120};
118#endif
119 121
120#ifdef BFIN_SPECIAL_GPIO_BANKS 122#ifdef BFIN_SPECIAL_GPIO_BANKS
121void bfin_special_gpio_free(unsigned gpio); 123void bfin_special_gpio_free(unsigned gpio);
@@ -127,25 +129,21 @@ void bfin_special_gpio_pm_hibernate_suspend(void);
127#endif 129#endif
128 130
129#ifdef CONFIG_PM 131#ifdef CONFIG_PM
130int bfin_pm_standby_ctrl(unsigned ctrl); 132void bfin_gpio_pm_hibernate_restore(void);
133void bfin_gpio_pm_hibernate_suspend(void);
134int bfin_gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl);
135int bfin_gpio_pm_standby_ctrl(unsigned ctrl);
131 136
132static inline int bfin_pm_standby_setup(void) 137static inline int bfin_pm_standby_setup(void)
133{ 138{
134 return bfin_pm_standby_ctrl(1); 139 return bfin_gpio_pm_standby_ctrl(1);
135} 140}
136 141
137static inline void bfin_pm_standby_restore(void) 142static inline void bfin_pm_standby_restore(void)
138{ 143{
139 bfin_pm_standby_ctrl(0); 144 bfin_gpio_pm_standby_ctrl(0);
140} 145}
141 146
142void bfin_gpio_pm_hibernate_restore(void);
143void bfin_gpio_pm_hibernate_suspend(void);
144void bfin_pint_suspend(void);
145void bfin_pint_resume(void);
146
147# if !BFIN_GPIO_PINT
148int gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl);
149 147
150struct gpio_port_s { 148struct gpio_port_s {
151 unsigned short data; 149 unsigned short data;
@@ -161,7 +159,6 @@ struct gpio_port_s {
161 unsigned short reserved; 159 unsigned short reserved;
162 unsigned short mux; 160 unsigned short mux;
163}; 161};
164# endif
165#endif /*CONFIG_PM*/ 162#endif /*CONFIG_PM*/
166 163
167/*********************************************************** 164/***********************************************************
@@ -178,36 +175,29 @@ struct gpio_port_s {
178************************************************************* 175*************************************************************
179* MODIFICATION HISTORY : 176* MODIFICATION HISTORY :
180**************************************************************/ 177**************************************************************/
181
182int bfin_gpio_request(unsigned gpio, const char *label);
183void bfin_gpio_free(unsigned gpio);
184int bfin_gpio_irq_request(unsigned gpio, const char *label); 178int bfin_gpio_irq_request(unsigned gpio, const char *label);
185void bfin_gpio_irq_free(unsigned gpio); 179void bfin_gpio_irq_free(unsigned gpio);
186int bfin_gpio_direction_input(unsigned gpio); 180void bfin_gpio_irq_prepare(unsigned gpio);
187int bfin_gpio_direction_output(unsigned gpio, int value); 181
188int bfin_gpio_get_value(unsigned gpio); 182static inline int irq_to_gpio(unsigned irq)
189void bfin_gpio_set_value(unsigned gpio, int value); 183{
184 return irq - GPIO_IRQ_BASE;
185}
186#endif /* CONFIG_PINCTRL */
190 187
191#include <asm/irq.h> 188#include <asm/irq.h>
192#include <asm/errno.h> 189#include <asm/errno.h>
193 190
194#ifdef CONFIG_GPIOLIB
195#include <asm-generic/gpio.h> /* cansleep wrappers */ 191#include <asm-generic/gpio.h> /* cansleep wrappers */
196 192
197static inline int gpio_get_value(unsigned int gpio) 193static inline int gpio_get_value(unsigned int gpio)
198{ 194{
199 if (gpio < MAX_BLACKFIN_GPIOS) 195 return __gpio_get_value(gpio);
200 return bfin_gpio_get_value(gpio);
201 else
202 return __gpio_get_value(gpio);
203} 196}
204 197
205static inline void gpio_set_value(unsigned int gpio, int value) 198static inline void gpio_set_value(unsigned int gpio, int value)
206{ 199{
207 if (gpio < MAX_BLACKFIN_GPIOS) 200 __gpio_set_value(gpio, value);
208 bfin_gpio_set_value(gpio, value);
209 else
210 __gpio_set_value(gpio, value);
211} 201}
212 202
213static inline int gpio_cansleep(unsigned int gpio) 203static inline int gpio_cansleep(unsigned int gpio)
@@ -219,113 +209,6 @@ static inline int gpio_to_irq(unsigned gpio)
219{ 209{
220 return __gpio_to_irq(gpio); 210 return __gpio_to_irq(gpio);
221} 211}
222
223#else /* !CONFIG_GPIOLIB */
224
225static inline int gpio_request(unsigned gpio, const char *label)
226{
227 return bfin_gpio_request(gpio, label);
228}
229
230static inline void gpio_free(unsigned gpio)
231{
232 return bfin_gpio_free(gpio);
233}
234
235static inline int gpio_direction_input(unsigned gpio)
236{
237 return bfin_gpio_direction_input(gpio);
238}
239
240static inline int gpio_direction_output(unsigned gpio, int value)
241{
242 return bfin_gpio_direction_output(gpio, value);
243}
244
245static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
246{
247 return -EINVAL;
248}
249
250static inline int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
251{
252 int err;
253
254 err = bfin_gpio_request(gpio, label);
255 if (err)
256 return err;
257
258 if (flags & GPIOF_DIR_IN)
259 err = bfin_gpio_direction_input(gpio);
260 else
261 err = bfin_gpio_direction_output(gpio,
262 (flags & GPIOF_INIT_HIGH) ? 1 : 0);
263
264 if (err)
265 bfin_gpio_free(gpio);
266
267 return err;
268}
269
270static inline int gpio_request_array(const struct gpio *array, size_t num)
271{
272 int i, err;
273
274 for (i = 0; i < num; i++, array++) {
275 err = gpio_request_one(array->gpio, array->flags, array->label);
276 if (err)
277 goto err_free;
278 }
279 return 0;
280
281err_free:
282 while (i--)
283 bfin_gpio_free((--array)->gpio);
284 return err;
285}
286
287static inline void gpio_free_array(const struct gpio *array, size_t num)
288{
289 while (num--)
290 bfin_gpio_free((array++)->gpio);
291}
292
293static inline int __gpio_get_value(unsigned gpio)
294{
295 return bfin_gpio_get_value(gpio);
296}
297
298static inline void __gpio_set_value(unsigned gpio, int value)
299{
300 return bfin_gpio_set_value(gpio, value);
301}
302
303static inline int gpio_get_value(unsigned gpio)
304{
305 return __gpio_get_value(gpio);
306}
307
308static inline void gpio_set_value(unsigned gpio, int value)
309{
310 return __gpio_set_value(gpio, value);
311}
312
313static inline int gpio_to_irq(unsigned gpio)
314{
315 if (likely(gpio < MAX_BLACKFIN_GPIOS))
316 return gpio + GPIO_IRQ_BASE;
317
318 return -EINVAL;
319}
320
321#include <asm-generic/gpio.h> /* cansleep wrappers */
322#endif /* !CONFIG_GPIOLIB */
323
324static inline int irq_to_gpio(unsigned irq)
325{
326 return (irq - GPIO_IRQ_BASE);
327}
328
329#endif /* __ASSEMBLY__ */ 212#endif /* __ASSEMBLY__ */
330 213
331#endif /* __ARCH_BLACKFIN_GPIO_H__ */ 214#endif /* __ARCH_BLACKFIN_GPIO_H__ */
diff --git a/arch/blackfin/include/asm/portmux.h b/arch/blackfin/include/asm/portmux.h
index 9b1e2c37b324..7aa20436e799 100644
--- a/arch/blackfin/include/asm/portmux.h
+++ b/arch/blackfin/include/asm/portmux.h
@@ -17,14 +17,29 @@
17#define P_MAYSHARE 0x2000 17#define P_MAYSHARE 0x2000
18#define P_DONTCARE 0x1000 18#define P_DONTCARE 0x1000
19 19
20 20#ifdef CONFIG_PINCTRL
21#include <asm/irq_handler.h>
22
23#define gpio_pint_regs bfin_pint_regs
24#define adi_internal_set_wake bfin_internal_set_wake
25
26#define peripheral_request(per, label) 0
27#define peripheral_free(per)
28#define peripheral_request_list(per, label) \
29 (pdev ? (IS_ERR(devm_pinctrl_get_select_default(&pdev->dev)) \
30 ? -EINVAL : 0) : 0)
31#define peripheral_free_list(per)
32#else
21int peripheral_request(unsigned short per, const char *label); 33int peripheral_request(unsigned short per, const char *label);
22void peripheral_free(unsigned short per); 34void peripheral_free(unsigned short per);
23int peripheral_request_list(const unsigned short per[], const char *label); 35int peripheral_request_list(const unsigned short per[], const char *label);
24void peripheral_free_list(const unsigned short per[]); 36void peripheral_free_list(const unsigned short per[]);
37#endif
25 38
26#include <asm/gpio.h> 39#include <linux/err.h>
40#include <linux/pinctrl/pinctrl.h>
27#include <mach/portmux.h> 41#include <mach/portmux.h>
42#include <linux/gpio.h>
28 43
29#ifndef P_SPORT2_TFS 44#ifndef P_SPORT2_TFS
30#define P_SPORT2_TFS P_UNDEF 45#define P_SPORT2_TFS P_UNDEF
diff --git a/arch/blackfin/kernel/Makefile b/arch/blackfin/kernel/Makefile
index 735f24e07425..703dc7cf2ecc 100644
--- a/arch/blackfin/kernel/Makefile
+++ b/arch/blackfin/kernel/Makefile
@@ -7,7 +7,7 @@ extra-y := vmlinux.lds
7obj-y := \ 7obj-y := \
8 entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \ 8 entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \
9 sys_bfin.o traps.o irqchip.o dma-mapping.o flat.o \ 9 sys_bfin.o traps.o irqchip.o dma-mapping.o flat.o \
10 fixed_code.o reboot.o bfin_gpio.o bfin_dma.o \ 10 fixed_code.o reboot.o bfin_dma.o \
11 exception.o dumpstack.o 11 exception.o dumpstack.o
12 12
13ifeq ($(CONFIG_GENERIC_CLOCKEVENTS),y) 13ifeq ($(CONFIG_GENERIC_CLOCKEVENTS),y)
@@ -16,6 +16,7 @@ else
16 obj-y += time.o 16 obj-y += time.o
17endif 17endif
18 18
19obj-$(CONFIG_GPIO_ADI) += bfin_gpio.o
19obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 20obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
20obj-$(CONFIG_FUNCTION_TRACER) += ftrace-entry.o 21obj-$(CONFIG_FUNCTION_TRACER) += ftrace-entry.o
21obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o 22obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
diff --git a/arch/blackfin/mach-bf548/include/mach/portmux.h b/arch/blackfin/mach-bf548/include/mach/portmux.h
index e22246202730..d9f8632d7d09 100644
--- a/arch/blackfin/mach-bf548/include/mach/portmux.h
+++ b/arch/blackfin/mach-bf548/include/mach/portmux.h
@@ -7,8 +7,6 @@
7#ifndef _MACH_PORTMUX_H_ 7#ifndef _MACH_PORTMUX_H_
8#define _MACH_PORTMUX_H_ 8#define _MACH_PORTMUX_H_
9 9
10#define MAX_RESOURCES MAX_BLACKFIN_GPIOS
11
12#define P_SPORT2_TFS (P_DEFINED | P_IDENT(GPIO_PA0) | P_FUNCT(0)) 10#define P_SPORT2_TFS (P_DEFINED | P_IDENT(GPIO_PA0) | P_FUNCT(0))
13#define P_SPORT2_DTSEC (P_DEFINED | P_IDENT(GPIO_PA1) | P_FUNCT(0)) 11#define P_SPORT2_DTSEC (P_DEFINED | P_IDENT(GPIO_PA1) | P_FUNCT(0))
14#define P_SPORT2_DTPRI (P_DEFINED | P_IDENT(GPIO_PA2) | P_FUNCT(0)) 12#define P_SPORT2_DTPRI (P_DEFINED | P_IDENT(GPIO_PA2) | P_FUNCT(0))
diff --git a/arch/blackfin/mach-bf609/include/mach/portmux.h b/arch/blackfin/mach-bf609/include/mach/portmux.h
index 2e1a51c25098..fe34191eef0b 100644
--- a/arch/blackfin/mach-bf609/include/mach/portmux.h
+++ b/arch/blackfin/mach-bf609/include/mach/portmux.h
@@ -7,8 +7,6 @@
7#ifndef _MACH_PORTMUX_H_ 7#ifndef _MACH_PORTMUX_H_
8#define _MACH_PORTMUX_H_ 8#define _MACH_PORTMUX_H_
9 9
10#define MAX_RESOURCES MAX_BLACKFIN_GPIOS
11
12/* EMAC RMII Port Mux */ 10/* EMAC RMII Port Mux */
13#define P_MII0_MDC (P_DEFINED | P_IDENT(GPIO_PC6) | P_FUNCT(0)) 11#define P_MII0_MDC (P_DEFINED | P_IDENT(GPIO_PC6) | P_FUNCT(0))
14#define P_MII0_MDIO (P_DEFINED | P_IDENT(GPIO_PC7) | P_FUNCT(0)) 12#define P_MII0_MDIO (P_DEFINED | P_IDENT(GPIO_PC7) | P_FUNCT(0))
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index e49f918531ad..fc0b3c356027 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -56,3 +56,4 @@ generic-y += ucontext.h
56generic-y += user.h 56generic-y += user.h
57generic-y += vga.h 57generic-y += vga.h
58generic-y += xor.h 58generic-y += xor.h
59generic-y += preempt.h
diff --git a/arch/c6x/include/asm/prom.h b/arch/c6x/include/asm/prom.h
deleted file mode 100644
index b4ec95f07518..000000000000
--- a/arch/c6x/include/asm/prom.h
+++ /dev/null
@@ -1 +0,0 @@
1/* dummy prom.h; here to make linux/of.h's #includes happy */
diff --git a/arch/c6x/include/asm/setup.h b/arch/c6x/include/asm/setup.h
index ecead15872a6..696804475f55 100644
--- a/arch/c6x/include/asm/setup.h
+++ b/arch/c6x/include/asm/setup.h
@@ -14,8 +14,6 @@
14#include <uapi/asm/setup.h> 14#include <uapi/asm/setup.h>
15 15
16#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
17extern char c6x_command_line[COMMAND_LINE_SIZE];
18
19extern int c6x_add_memory(phys_addr_t start, unsigned long size); 17extern int c6x_add_memory(phys_addr_t start, unsigned long size);
20 18
21extern unsigned long ram_start; 19extern unsigned long ram_start;
diff --git a/arch/c6x/kernel/devicetree.c b/arch/c6x/kernel/devicetree.c
index 9e15ab9199b2..fa3e5741514e 100644
--- a/arch/c6x/kernel/devicetree.c
+++ b/arch/c6x/kernel/devicetree.c
@@ -10,37 +10,8 @@
10 * 10 *
11 */ 11 */
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/of.h>
14#include <linux/of_fdt.h>
15#include <linux/initrd.h>
16#include <linux/memblock.h> 13#include <linux/memblock.h>
17 14
18void __init early_init_devtree(void *params)
19{
20 /* Setup flat device-tree pointer */
21 initial_boot_params = params;
22
23 /* Retrieve various informations from the /chosen node of the
24 * device-tree, including the platform type, initrd location and
25 * size and more ...
26 */
27 of_scan_flat_dt(early_init_dt_scan_chosen, c6x_command_line);
28
29 /* Scan memory nodes and rebuild MEMBLOCKs */
30 of_scan_flat_dt(early_init_dt_scan_root, NULL);
31 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
32}
33
34
35#ifdef CONFIG_BLK_DEV_INITRD
36void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
37{
38 initrd_start = (unsigned long)__va(start);
39 initrd_end = (unsigned long)__va(end);
40 initrd_below_start_ok = 1;
41}
42#endif
43
44void __init early_init_dt_add_memory_arch(u64 base, u64 size) 15void __init early_init_dt_add_memory_arch(u64 base, u64 size)
45{ 16{
46 c6x_add_memory(base, size); 17 c6x_add_memory(base, size);
diff --git a/arch/c6x/kernel/setup.c b/arch/c6x/kernel/setup.c
index f4e72bd8c103..731db4b9014d 100644
--- a/arch/c6x/kernel/setup.c
+++ b/arch/c6x/kernel/setup.c
@@ -68,13 +68,6 @@ unsigned long ram_end;
68static unsigned long dma_start __initdata; 68static unsigned long dma_start __initdata;
69static unsigned long dma_size __initdata; 69static unsigned long dma_size __initdata;
70 70
71char c6x_command_line[COMMAND_LINE_SIZE];
72
73#if defined(CONFIG_CMDLINE_BOOL)
74static const char default_command_line[COMMAND_LINE_SIZE] __section(.cmdline) =
75 CONFIG_CMDLINE;
76#endif
77
78struct cpuinfo_c6x { 71struct cpuinfo_c6x {
79 const char *cpu_name; 72 const char *cpu_name;
80 const char *cpu_voltage; 73 const char *cpu_voltage;
@@ -294,10 +287,8 @@ notrace void __init machine_init(unsigned long dt_ptr)
294 fdt = dtb; 287 fdt = dtb;
295 288
296 /* Do some early initialization based on the flat device tree */ 289 /* Do some early initialization based on the flat device tree */
297 early_init_devtree(fdt); 290 early_init_dt_scan(fdt);
298 291
299 /* parse_early_param needs a boot_command_line */
300 strlcpy(boot_command_line, c6x_command_line, COMMAND_LINE_SIZE);
301 parse_early_param(); 292 parse_early_param();
302} 293}
303 294
@@ -309,7 +300,7 @@ void __init setup_arch(char **cmdline_p)
309 printk(KERN_INFO "Initializing kernel\n"); 300 printk(KERN_INFO "Initializing kernel\n");
310 301
311 /* Initialize command line */ 302 /* Initialize command line */
312 *cmdline_p = c6x_command_line; 303 *cmdline_p = boot_command_line;
313 304
314 memory_end = ram_end; 305 memory_end = ram_end;
315 memory_end &= ~(PAGE_SIZE - 1); 306 memory_end &= ~(PAGE_SIZE - 1);
diff --git a/arch/c6x/kernel/vmlinux.lds.S b/arch/c6x/kernel/vmlinux.lds.S
index 279d80725128..5a6e141d1641 100644
--- a/arch/c6x/kernel/vmlinux.lds.S
+++ b/arch/c6x/kernel/vmlinux.lds.S
@@ -37,12 +37,6 @@ SECTIONS
37 _vectors_end = .; 37 _vectors_end = .;
38 } 38 }
39 39
40 . = ALIGN(0x1000);
41 .cmdline :
42 {
43 *(.cmdline)
44 }
45
46 /* 40 /*
47 * This section contains data which may be shared with other 41 * This section contains data which may be shared with other
48 * cores. It needs to be a fixed offset from PAGE_OFFSET 42 * cores. It needs to be a fixed offset from PAGE_OFFSET
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 02380bed189c..9c957c81c688 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -130,13 +130,11 @@ config SVINTO_SIM
130 130
131config ETRAXFS 131config ETRAXFS
132 bool "ETRAX-FS-V32" 132 bool "ETRAX-FS-V32"
133 select CPU_FREQ_TABLE if CPU_FREQ
134 help 133 help
135 Support CRIS V32. 134 Support CRIS V32.
136 135
137config CRIS_MACH_ARTPEC3 136config CRIS_MACH_ARTPEC3
138 bool "ARTPEC-3" 137 bool "ARTPEC-3"
139 select CPU_FREQ_TABLE if CPU_FREQ
140 help 138 help
141 Support Axis ARTPEC-3. 139 Support Axis ARTPEC-3.
142 140
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index c8325455520e..b06caf649a95 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -11,3 +11,4 @@ generic-y += module.h
11generic-y += trace_clock.h 11generic-y += trace_clock.h
12generic-y += vga.h 12generic-y += vga.h
13generic-y += xor.h 13generic-y += xor.h
14generic-y += preempt.h
diff --git a/arch/cris/include/asm/io.h b/arch/cris/include/asm/io.h
index 5d3047e5563b..4353cf239a13 100644
--- a/arch/cris/include/asm/io.h
+++ b/arch/cris/include/asm/io.h
@@ -3,6 +3,7 @@
3 3
4#include <asm/page.h> /* for __va, __pa */ 4#include <asm/page.h> /* for __va, __pa */
5#include <arch/io.h> 5#include <arch/io.h>
6#include <asm-generic/iomap.h>
6#include <linux/kernel.h> 7#include <linux/kernel.h>
7 8
8struct cris_io_operations 9struct cris_io_operations
diff --git a/arch/cris/include/asm/pci.h b/arch/cris/include/asm/pci.h
index 146da904cdd8..f666734926d5 100644
--- a/arch/cris/include/asm/pci.h
+++ b/arch/cris/include/asm/pci.h
@@ -11,7 +11,6 @@
11 11
12#define pcibios_assign_all_busses(void) 1 12#define pcibios_assign_all_busses(void) 1
13 13
14extern unsigned long pci_mem_start;
15#define PCIBIOS_MIN_IO 0x1000 14#define PCIBIOS_MIN_IO 0x1000
16#define PCIBIOS_MIN_MEM 0x10000000 15#define PCIBIOS_MIN_MEM 0x10000000
17 16
diff --git a/arch/cris/include/asm/pgalloc.h b/arch/cris/include/asm/pgalloc.h
index 6da975db112f..235ece437ddd 100644
--- a/arch/cris/include/asm/pgalloc.h
+++ b/arch/cris/include/asm/pgalloc.h
@@ -32,7 +32,12 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addres
32{ 32{
33 struct page *pte; 33 struct page *pte;
34 pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); 34 pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
35 pgtable_page_ctor(pte); 35 if (!pte)
36 return NULL;
37 if (!pgtable_page_ctor(pte)) {
38 __free_page(pte);
39 return NULL;
40 }
36 return pte; 41 return pte;
37} 42}
38 43
diff --git a/arch/cris/include/uapi/asm/socket.h b/arch/cris/include/uapi/asm/socket.h
index eb723e51554e..13829aaaeec5 100644
--- a/arch/cris/include/uapi/asm/socket.h
+++ b/arch/cris/include/uapi/asm/socket.h
@@ -78,6 +78,8 @@
78 78
79#define SO_BUSY_POLL 46 79#define SO_BUSY_POLL 46
80 80
81#define SO_MAX_PACING_RATE 47
82
81#endif /* _ASM_SOCKET_H */ 83#endif /* _ASM_SOCKET_H */
82 84
83 85
diff --git a/arch/frv/include/asm/Kbuild b/arch/frv/include/asm/Kbuild
index c5d767028306..74742dc6a3da 100644
--- a/arch/frv/include/asm/Kbuild
+++ b/arch/frv/include/asm/Kbuild
@@ -2,3 +2,4 @@
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += exec.h 3generic-y += exec.h
4generic-y += trace_clock.h 4generic-y += trace_clock.h
5generic-y += preempt.h
diff --git a/arch/frv/include/uapi/asm/socket.h b/arch/frv/include/uapi/asm/socket.h
index f0cb1c341163..5d4299762426 100644
--- a/arch/frv/include/uapi/asm/socket.h
+++ b/arch/frv/include/uapi/asm/socket.h
@@ -76,5 +76,7 @@
76 76
77#define SO_BUSY_POLL 46 77#define SO_BUSY_POLL 46
78 78
79#define SO_MAX_PACING_RATE 47
80
79#endif /* _ASM_SOCKET_H */ 81#endif /* _ASM_SOCKET_H */
80 82
diff --git a/arch/frv/mb93090-mb00/pci-frv.h b/arch/frv/mb93090-mb00/pci-frv.h
index 76c4e73d643d..a7e487fe76ed 100644
--- a/arch/frv/mb93090-mb00/pci-frv.h
+++ b/arch/frv/mb93090-mb00/pci-frv.h
@@ -30,7 +30,6 @@ void pcibios_resource_survey(void);
30 30
31/* pci-vdk.c */ 31/* pci-vdk.c */
32 32
33extern int __nongpreldata pcibios_last_bus;
34extern struct pci_ops *__nongpreldata pci_root_ops; 33extern struct pci_ops *__nongpreldata pci_root_ops;
35 34
36/* pci-irq.c */ 35/* pci-irq.c */
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index deb67843693c..efa5d65b0007 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -25,7 +25,6 @@
25 25
26unsigned int __nongpreldata pci_probe = 1; 26unsigned int __nongpreldata pci_probe = 1;
27 27
28int __nongpreldata pcibios_last_bus = -1;
29struct pci_ops *__nongpreldata pci_root_ops; 28struct pci_ops *__nongpreldata pci_root_ops;
30 29
31/* 30/*
@@ -220,37 +219,6 @@ static struct pci_ops * __init pci_check_direct(void)
220} 219}
221 220
222/* 221/*
223 * Discover remaining PCI buses in case there are peer host bridges.
224 * We use the number of last PCI bus provided by the PCI BIOS.
225 */
226static void __init pcibios_fixup_peer_bridges(void)
227{
228 struct pci_bus bus;
229 struct pci_dev dev;
230 int n;
231 u16 l;
232
233 if (pcibios_last_bus <= 0 || pcibios_last_bus >= 0xff)
234 return;
235 printk("PCI: Peer bridge fixup\n");
236 for (n=0; n <= pcibios_last_bus; n++) {
237 if (pci_find_bus(0, n))
238 continue;
239 bus.number = n;
240 bus.ops = pci_root_ops;
241 dev.bus = &bus;
242 for(dev.devfn=0; dev.devfn<256; dev.devfn += 8)
243 if (!pci_read_config_word(&dev, PCI_VENDOR_ID, &l) &&
244 l != 0x0000 && l != 0xffff) {
245 printk("Found device at %02x:%02x [%04x]\n", n, dev.devfn, l);
246 printk("PCI: Discovered peer bus %02x\n", n);
247 pci_scan_bus(n, pci_root_ops, NULL);
248 break;
249 }
250 }
251}
252
253/*
254 * Exceptions for specific devices. Usually work-arounds for fatal design flaws. 222 * Exceptions for specific devices. Usually work-arounds for fatal design flaws.
255 */ 223 */
256 224
@@ -418,7 +386,6 @@ int __init pcibios_init(void)
418 pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources); 386 pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
419 387
420 pcibios_irq_init(); 388 pcibios_irq_init();
421 pcibios_fixup_peer_bridges();
422 pcibios_fixup_irqs(); 389 pcibios_fixup_irqs();
423 pcibios_resource_survey(); 390 pcibios_resource_survey();
424 391
@@ -432,9 +399,6 @@ char * __init pcibios_setup(char *str)
432 if (!strcmp(str, "off")) { 399 if (!strcmp(str, "off")) {
433 pci_probe = 0; 400 pci_probe = 0;
434 return NULL; 401 return NULL;
435 } else if (!strncmp(str, "lastbus=", 8)) {
436 pcibios_last_bus = simple_strtol(str+8, NULL, 0);
437 return NULL;
438 } 402 }
439 return str; 403 return str;
440} 404}
diff --git a/arch/frv/mm/pgalloc.c b/arch/frv/mm/pgalloc.c
index f6084bc524e8..41907d25ed38 100644
--- a/arch/frv/mm/pgalloc.c
+++ b/arch/frv/mm/pgalloc.c
@@ -37,11 +37,15 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
37#else 37#else
38 page = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0); 38 page = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0);
39#endif 39#endif
40 if (page) { 40 if (!page)
41 clear_highpage(page); 41 return NULL;
42 pgtable_page_ctor(page); 42
43 flush_dcache_page(page); 43 clear_highpage(page);
44 if (!pgtable_page_ctor(page)) {
45 __free_page(page);
46 return NULL;
44 } 47 }
48 flush_dcache_page(page);
45 return page; 49 return page;
46} 50}
47 51
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
deleted file mode 100644
index 24b1dc2564f1..000000000000
--- a/arch/h8300/Kconfig
+++ /dev/null
@@ -1,108 +0,0 @@
1config H8300
2 bool
3 default y
4 select HAVE_IDE
5 select GENERIC_ATOMIC64
6 select HAVE_UID16
7 select VIRT_TO_BUS
8 select ARCH_WANT_IPC_PARSE_VERSION
9 select GENERIC_IRQ_SHOW
10 select GENERIC_CPU_DEVICES
11 select MODULES_USE_ELF_RELA
12 select OLD_SIGSUSPEND3
13 select OLD_SIGACTION
14 select HAVE_UNDERSCORE_SYMBOL_PREFIX
15
16config MMU
17 bool
18 default n
19
20config SWAP
21 bool
22 default n
23
24config ZONE_DMA
25 bool
26 default y
27
28config FPU
29 bool
30 default n
31
32config RWSEM_GENERIC_SPINLOCK
33 bool
34 default y
35
36config RWSEM_XCHGADD_ALGORITHM
37 bool
38 default n
39
40config ARCH_HAS_ILOG2_U32
41 bool
42 default n
43
44config ARCH_HAS_ILOG2_U64
45 bool
46 default n
47
48config GENERIC_HWEIGHT
49 bool
50 default y
51
52config GENERIC_CALIBRATE_DELAY
53 bool
54 default y
55
56config GENERIC_BUG
57 bool
58 depends on BUG
59
60config TIME_LOW_RES
61 bool
62 default y
63
64config NO_IOPORT
65 def_bool y
66
67config NO_DMA
68 def_bool y
69
70config ISA
71 bool
72 default y
73
74config PCI
75 bool
76 default n
77
78config HZ
79 int
80 default 100
81
82source "init/Kconfig"
83
84source "kernel/Kconfig.freezer"
85
86source "arch/h8300/Kconfig.cpu"
87
88menu "Executable file formats"
89
90source "fs/Kconfig.binfmt"
91
92endmenu
93
94source "net/Kconfig"
95
96source "drivers/Kconfig"
97
98source "arch/h8300/Kconfig.ide"
99
100source "fs/Kconfig"
101
102source "arch/h8300/Kconfig.debug"
103
104source "security/Kconfig"
105
106source "crypto/Kconfig"
107
108source "lib/Kconfig"
diff --git a/arch/h8300/Kconfig.cpu b/arch/h8300/Kconfig.cpu
deleted file mode 100644
index cdee771460ed..000000000000
--- a/arch/h8300/Kconfig.cpu
+++ /dev/null
@@ -1,171 +0,0 @@
1menu "Processor type and features"
2
3choice
4 prompt "H8/300 platform"
5 default H8300H_GENERIC
6
7config H8300H_GENERIC
8 bool "H8/300H Generic"
9 help
10 H8/300H CPU Generic Hardware Support
11
12config H8300H_AKI3068NET
13 bool "AE-3068/69"
14 select H83068
15 help
16 AKI-H8/3068F / AKI-H8/3069F Flashmicom LAN Board Support
17 More Information. (Japanese Only)
18 <http://akizukidenshi.com/catalog/default.aspx>
19 AE-3068/69 Evaluation Board Support
20 More Information.
21 <http://www.microtronique.com/ae3069lan.htm>
22
23config H8300H_H8MAX
24 bool "H8MAX"
25 select H83068
26 help
27 H8MAX Evaluation Board Support
28 More Information. (Japanese Only)
29 <http://strawberry-linux.com/h8/index.html>
30
31config H8300H_SIM
32 bool "H8/300H Simulator"
33 select H83007
34 help
35 GDB Simulator Support
36 More Information.
37 <http://sourceware.org/sid/>
38
39config H8S_GENERIC
40 bool "H8S Generic"
41 help
42 H8S CPU Generic Hardware Support
43
44config H8S_EDOSK2674
45 bool "EDOSK-2674"
46 select H8S2678
47 help
48 Renesas EDOSK-2674 Evaluation Board Support
49 More Information.
50 <http://www.azpower.com/H8-uClinux/index.html>
51 <http://www.renesas.eu/products/tools/introductory_evaluation_tools/evaluation_development_os_kits/edosk2674r/edosk2674r_software_tools_root.jsp>
52
53config H8S_SIM
54 bool "H8S Simulator"
55 help
56 GDB Simulator Support
57 More Information.
58 <http://sourceware.org/sid/>
59
60endchoice
61
62choice
63 prompt "CPU Selection"
64
65config H83002
66 bool "H8/3001,3002,3003"
67 depends on BROKEN
68 select CPU_H8300H
69
70config H83007
71 bool "H8/3006,3007"
72 select CPU_H8300H
73
74config H83048
75 bool "H8/3044,3045,3046,3047,3048,3052"
76 depends on BROKEN
77 select CPU_H8300H
78
79config H83068
80 bool "H8/3065,3066,3067,3068,3069"
81 select CPU_H8300H
82
83config H8S2678
84 bool "H8S/2670,2673,2674R,2675,2676"
85 select CPU_H8S
86
87endchoice
88
89config CPU_CLOCK
90 int "CPU Clock Frequency (/1KHz)"
91 default "20000"
92 help
93 CPU Clock Frequency divide to 1000
94
95choice
96 prompt "Kernel executes from"
97 ---help---
98 Choose the memory type that the kernel will be running in.
99
100config RAMKERNEL
101 bool "RAM"
102 help
103 The kernel will be resident in RAM when running.
104
105config ROMKERNEL
106 bool "ROM"
107 help
108 The kernel will be resident in FLASH/ROM when running.
109endchoice
110
111
112config CPU_H8300H
113 bool
114 depends on (H83002 || H83007 || H83048 || H83068)
115 default y
116
117config CPU_H8S
118 bool
119 depends on H8S2678
120 default y
121
122choice
123 prompt "Timer"
124config H8300_TIMER8
125 bool "8bit timer (2ch cascade)"
126 depends on (H83007 || H83068 || H8S2678)
127
128config H8300_TIMER16
129 bool "16bit timer"
130 depends on (H83007 || H83068)
131
132config H8300_ITU
133 bool "ITU"
134 depends on (H83002 || H83048)
135
136config H8300_TPU
137 bool "TPU"
138 depends on H8S2678
139endchoice
140
141if H8300_TIMER8
142choice
143 prompt "Timer Channel"
144config H8300_TIMER8_CH0
145 bool "Channel 0"
146config H8300_TIMER8_CH2
147 bool "Channel 2"
148 depends on CPU_H8300H
149endchoice
150endif
151
152config H8300_TIMER16_CH
153 int "16bit timer channel (0 - 2)"
154 depends on H8300_TIMER16
155 range 0 2
156
157config H8300_ITU_CH
158 int "ITU channel"
159 depends on H8300_ITU
160 range 0 4
161
162config H8300_TPU_CH
163 int "TPU channel"
164 depends on H8300_TPU
165 range 0 4
166
167source "kernel/Kconfig.preempt"
168
169source "mm/Kconfig"
170
171endmenu
diff --git a/arch/h8300/Kconfig.debug b/arch/h8300/Kconfig.debug
deleted file mode 100644
index e8d1b236ad8c..000000000000
--- a/arch/h8300/Kconfig.debug
+++ /dev/null
@@ -1,68 +0,0 @@
1menu "Kernel hacking"
2
3source "lib/Kconfig.debug"
4
5config FULLDEBUG
6 bool "Full Symbolic/Source Debugging support"
7 help
8 Enable debugging symbols on kernel build.
9
10config HIGHPROFILE
11 bool "Use fast second timer for profiling"
12 help
13 Use a fast secondary clock to produce profiling information.
14
15config NO_KERNEL_MSG
16 bool "Suppress Kernel BUG Messages"
17 help
18 Do not output any debug BUG messages within the kernel.
19
20config GDB_MAGICPRINT
21 bool "Message Output for GDB MagicPrint service"
22 depends on (H8300H_SIM || H8S_SIM)
23 help
24 kernel messages output using MagicPrint service from GDB
25
26config SYSCALL_PRINT
27 bool "SystemCall trace print"
28 help
29 output history of systemcall
30
31config GDB_DEBUG
32 bool "Use gdb stub"
33 depends on (!H8300H_SIM && !H8S_SIM)
34 help
35 gdb stub exception support
36
37config SH_STANDARD_BIOS
38 bool "Use gdb protocol serial console"
39 depends on (!H8300H_SIM && !H8S_SIM)
40 help
41 serial console output using GDB protocol.
42 Require eCos/RedBoot
43
44config DEFAULT_CMDLINE
45 bool "Use builtin commandline"
46 default n
47 help
48 builtin kernel commandline enabled.
49
50config KERNEL_COMMAND
51 string "Buildin command string"
52 depends on DEFAULT_CMDLINE
53 help
54 builtin kernel commandline strings.
55
56config BLKDEV_RESERVE
57 bool "BLKDEV Reserved Memory"
58 default n
59 help
60 Reserved BLKDEV area.
61
62config BLKDEV_RESERVE_ADDRESS
63 hex 'start address'
64 depends on BLKDEV_RESERVE
65 help
66 BLKDEV start address.
67
68endmenu
diff --git a/arch/h8300/Kconfig.ide b/arch/h8300/Kconfig.ide
deleted file mode 100644
index a38a63054ac2..000000000000
--- a/arch/h8300/Kconfig.ide
+++ /dev/null
@@ -1,44 +0,0 @@
1# uClinux H8/300 Target Board Selection Menu (IDE)
2
3if (H8300H_AKI3068NET)
4menu "IDE Extra configuration"
5
6config H8300_IDE_BASE
7 hex "IDE register base address"
8 depends on IDE
9 default 0
10 help
11 IDE registers base address
12
13config H8300_IDE_ALT
14 hex "IDE register alternate address"
15 depends on IDE
16 default 0
17 help
18 IDE alternate registers address
19
20config H8300_IDE_IRQ
21 int "IDE IRQ no"
22 depends on IDE
23 default 0
24 help
25 IDE use IRQ no
26endmenu
27endif
28
29if (H8300H_H8MAX)
30config H8300_IDE_BASE
31 hex
32 depends on IDE
33 default 0x200000
34
35config H8300_IDE_ALT
36 hex
37 depends on IDE
38 default 0x60000c
39
40config H8300_IDE_IRQ
41 int
42 depends on IDE
43 default 5
44endif
diff --git a/arch/h8300/Makefile b/arch/h8300/Makefile
deleted file mode 100644
index a556447877b4..000000000000
--- a/arch/h8300/Makefile
+++ /dev/null
@@ -1,71 +0,0 @@
1#
2# arch/h8300/Makefile
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License. See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8# (C) Copyright 2002,2003 Yoshinori Sato <ysato@users.sourceforge.jp>
9#
10
11platform-$(CONFIG_CPU_H8300H) := h8300h
12platform-$(CONFIG_CPU_H8S) := h8s
13PLATFORM := $(platform-y)
14
15board-$(CONFIG_H8300H_GENERIC) := generic
16board-$(CONFIG_H8300H_AKI3068NET) := aki3068net
17board-$(CONFIG_H8300H_H8MAX) := h8max
18board-$(CONFIG_H8300H_SIM) := generic
19board-$(CONFIG_H8S_GENERIC) := generic
20board-$(CONFIG_H8S_EDOSK2674) := edosk2674
21board-$(CONFIG_H8S_SIM) := generic
22BOARD := $(board-y)
23
24model-$(CONFIG_RAMKERNEL) := ram
25model-$(CONFIG_ROMKERNEL) := rom
26MODEL := $(model-y)
27
28cflags-$(CONFIG_CPU_H8300H) := -mh
29ldflags-$(CONFIG_CPU_H8300H) := -mh8300helf
30cflags-$(CONFIG_CPU_H8S) := -ms
31ldflags-$(CONFIG_CPU_H8S) := -mh8300self
32
33KBUILD_CFLAGS += $(cflags-y)
34KBUILD_CFLAGS += -mint32 -fno-builtin
35KBUILD_CFLAGS += -g
36KBUILD_CFLAGS += -D__linux__
37KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\"
38KBUILD_AFLAGS += -DPLATFORM=$(PLATFORM) -DMODEL=$(MODEL) $(cflags-y)
39LDFLAGS += $(ldflags-y)
40
41CROSS_COMPILE = h8300-elf-
42LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
43
44head-y := arch/$(ARCH)/platform/$(PLATFORM)/$(BOARD)/crt0_$(MODEL).o
45
46core-y += arch/$(ARCH)/kernel/ \
47 arch/$(ARCH)/mm/
48ifdef PLATFORM
49core-y += arch/$(ARCH)/platform/$(PLATFORM)/ \
50 arch/$(ARCH)/platform/$(PLATFORM)/$(BOARD)/
51endif
52
53libs-y += arch/$(ARCH)/lib/ $(LIBGCC)
54
55boot := arch/h8300/boot
56
57export MODEL PLATFORM BOARD
58
59archmrproper:
60
61archclean:
62 $(Q)$(MAKE) $(clean)=$(boot)
63
64vmlinux.srec vmlinux.bin zImage: vmlinux
65 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
66
67define archhelp
68 @echo 'vmlinux.bin - Create raw binary'
69 @echo 'vmlinux.srec - Create srec binary'
70 @echo 'zImage - Compressed kernel image'
71endef
diff --git a/arch/h8300/README b/arch/h8300/README
deleted file mode 100644
index efa805fda19b..000000000000
--- a/arch/h8300/README
+++ /dev/null
@@ -1,38 +0,0 @@
1linux-2.6 for H8/300 README
2Yoshinori Sato <ysato@users.sourceforge.jp>
3
4* Supported CPU
5H8/300H and H8S
6
7* Supported Target
81.simulator of GDB
9 require patches.
10
112.AE 3068/AE 3069
12 more information
13 MICROTRONIQUE <http://www.microtronique.com/>
14 Akizuki Denshi Tsusho Ltd. <http://akizukidenshi.com/> (Japanese Only)
15
163.H8MAX
17 see http://ip-sol.jp/h8max/ (Japanese Only)
18
194.EDOSK2674
20 see http://www.eu.renesas.com/products/mpumcu/tool/edk/support/edosk2674.html
21 http://www.uclinux.org/pub/uClinux/ports/h8/HITACHI-EDOSK2674-HOWTO
22 http://www.azpower.com/H8-uClinux/
23
24* Toolchain Version
25gcc-3.1 or higher and patch
26see arch/h8300/tools_patch/README
27binutils-2.12 or higher
28gdb-5.2 or higher
29The environment that can compile a h8300-elf binary is necessary.
30
31* Userland Develop environment
32used h8300-elf toolchains.
33see http://www.uclinux.org/pub/uClinux/ports/h8/
34
35* A few words of thanks
36Porting to H8/300 serieses is support of Information-technology Promotion Agency, Japan.
37I thank support.
38and All developer/user.
diff --git a/arch/h8300/boot/Makefile b/arch/h8300/boot/Makefile
deleted file mode 100644
index 0bb62e064eea..000000000000
--- a/arch/h8300/boot/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
1# arch/h8300/boot/Makefile
2
3targets := vmlinux.srec vmlinux.bin zImage
4subdir- := compressed
5
6OBJCOPYFLAGS_vmlinux.srec := -Osrec
7OBJCOPYFLAGS_vmlinux.bin := -Obinary
8OBJCOPYFLAGS_zImage := -O binary -R .note -R .comment -R .stab -R .stabstr -S
9
10$(obj)/vmlinux.srec $(obj)/vmlinux.bin: vmlinux FORCE
11 $(call if_changed,objcopy)
12 @echo ' Kernel: $@ is ready'
13
14$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
15 $(call if_changed,objcopy)
16 @echo 'Kernel: $@ is ready'
17
18$(obj)/compressed/vmlinux: FORCE
19 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
20
21CLEAN_FILES += arch/$(ARCH)/vmlinux.bin arch/$(ARCH)/vmlinux.srec
22
diff --git a/arch/h8300/boot/compressed/Makefile b/arch/h8300/boot/compressed/Makefile
deleted file mode 100644
index a6c98fe3bbc3..000000000000
--- a/arch/h8300/boot/compressed/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
1#
2# linux/arch/sh/boot/compressed/Makefile
3#
4# create a compressed vmlinux image from the original vmlinux
5#
6
7targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
8asflags-y := -traditional
9
10OBJECTS = $(obj)/head.o $(obj)/misc.o
11
12#
13# IMAGE_OFFSET is the load offset of the compression loader
14# Assign dummy values if these 2 variables are not defined,
15# in order to suppress error message.
16#
17CONFIG_MEMORY_START ?= 0x00400000
18CONFIG_BOOT_LINK_OFFSET ?= 0x00140000
19IMAGE_OFFSET := $(shell printf "0x%08x" $$(($(CONFIG_MEMORY_START)+$(CONFIG_BOOT_LINK_OFFSET))))
20
21LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -estartup $(obj)/vmlinux.lds
22
23$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o FORCE
24 $(call if_changed,ld)
25 @:
26
27$(obj)/vmlinux.bin: vmlinux FORCE
28 $(call if_changed,objcopy)
29
30$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
31 $(call if_changed,gzip)
32
33LDFLAGS_piggy.o := -r --format binary --oformat elf32-h8300 -T
34OBJCOPYFLAGS := -O binary
35
36$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
37 $(call if_changed,ld)
diff --git a/arch/h8300/boot/compressed/head.S b/arch/h8300/boot/compressed/head.S
deleted file mode 100644
index 10e9a2d1cc6c..000000000000
--- a/arch/h8300/boot/compressed/head.S
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * linux/arch/h8300/boot/compressed/head.S
3 *
4 * Copyright (C) 2006 Yoshinori Sato
5 */
6
7 .h8300h
8#include <linux/linkage.h>
9
10#define SRAM_START 0xff4000
11
12 .section .text..startup
13 .global startup
14startup:
15 mov.l #SRAM_START+0x8000, sp
16 mov.l #__sbss, er0
17 mov.l #__ebss, er1
18 sub.l er0, er1
19 shlr er1
20 shlr er1
21 sub.l er2, er2
221:
23 mov.l er2, @er0
24 adds #4, er0
25 dec.l #1, er1
26 bne 1b
27 jsr @_decompress_kernel
28 jmp @0x400000
29
30 .align 9
31fake_headers_as_bzImage:
32 .word 0
33 .ascii "HdrS" ; header signature
34 .word 0x0202 ; header version number (>= 0x0105)
35 ; or else old loadlin-1.5 will fail)
36 .word 0 ; default_switch
37 .word 0 ; SETUPSEG
38 .word 0x1000
39 .word 0 ; pointing to kernel version string
40 .byte 0 ; = 0, old one (LILO, Loadlin,
41 ; 0xTV: T=0 for LILO
42 ; V = version
43 .byte 1 ; Load flags bzImage=1
44 .word 0x8000 ; size to move, when setup is not
45 .long 0x100000 ; 0x100000 = default for big kernel
46 .long 0 ; address of loaded ramdisk image
47 .long 0 ; its size in bytes
diff --git a/arch/h8300/boot/compressed/misc.c b/arch/h8300/boot/compressed/misc.c
deleted file mode 100644
index 4a1e3dd43948..000000000000
--- a/arch/h8300/boot/compressed/misc.c
+++ /dev/null
@@ -1,180 +0,0 @@
1/*
2 * arch/h8300/boot/compressed/misc.c
3 *
4 * This is a collection of several routines from gzip-1.0.3
5 * adapted for Linux.
6 *
7 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
8 *
9 * Adapted for h8300 by Yoshinori Sato 2006
10 */
11
12#include <asm/uaccess.h>
13
14/*
15 * gzip declarations
16 */
17
18#define OF(args) args
19#define STATIC static
20
21#undef memset
22#undef memcpy
23#define memzero(s, n) memset ((s), 0, (n))
24
25typedef unsigned char uch;
26typedef unsigned short ush;
27typedef unsigned long ulg;
28
29#define WSIZE 0x8000 /* Window size must be at least 32k, */
30 /* and a power of two */
31
32static uch *inbuf; /* input buffer */
33static uch window[WSIZE]; /* Sliding window buffer */
34
35static unsigned insize = 0; /* valid bytes in inbuf */
36static unsigned inptr = 0; /* index of next byte to be processed in inbuf */
37static unsigned outcnt = 0; /* bytes in output buffer */
38
39/* gzip flag byte */
40#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */
41#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
42#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
43#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
44#define COMMENT 0x10 /* bit 4 set: file comment present */
45#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
46#define RESERVED 0xC0 /* bit 6,7: reserved */
47
48#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf())
49
50/* Diagnostic functions */
51#ifdef DEBUG
52# define Assert(cond,msg) {if(!(cond)) error(msg);}
53# define Trace(x) fprintf x
54# define Tracev(x) {if (verbose) fprintf x ;}
55# define Tracevv(x) {if (verbose>1) fprintf x ;}
56# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
57# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
58#else
59# define Assert(cond,msg)
60# define Trace(x)
61# define Tracev(x)
62# define Tracevv(x)
63# define Tracec(c,x)
64# define Tracecv(c,x)
65#endif
66
67static int fill_inbuf(void);
68static void flush_window(void);
69static void error(char *m);
70
71extern char input_data[];
72extern int input_len;
73
74static long bytes_out = 0;
75static uch *output_data;
76static unsigned long output_ptr = 0;
77
78static void error(char *m);
79
80int puts(const char *);
81
82extern int _end;
83static unsigned long free_mem_ptr;
84static unsigned long free_mem_end_ptr;
85
86#define HEAP_SIZE 0x10000
87
88#include "../../../../lib/inflate.c"
89
90#define SCR *((volatile unsigned char *)0xffff8a)
91#define TDR *((volatile unsigned char *)0xffff8b)
92#define SSR *((volatile unsigned char *)0xffff8c)
93
94int puts(const char *s)
95{
96 return 0;
97}
98
99void* memset(void* s, int c, size_t n)
100{
101 int i;
102 char *ss = (char*)s;
103
104 for (i=0;i<n;i++) ss[i] = c;
105 return s;
106}
107
108void* memcpy(void* __dest, __const void* __src,
109 size_t __n)
110{
111 int i;
112 char *d = (char *)__dest, *s = (char *)__src;
113
114 for (i=0;i<__n;i++) d[i] = s[i];
115 return __dest;
116}
117
118/* ===========================================================================
119 * Fill the input buffer. This is called only when the buffer is empty
120 * and at least one byte is really needed.
121 */
122static int fill_inbuf(void)
123{
124 if (insize != 0) {
125 error("ran out of input data");
126 }
127
128 inbuf = input_data;
129 insize = input_len;
130 inptr = 1;
131 return inbuf[0];
132}
133
134/* ===========================================================================
135 * Write the output window window[0..outcnt-1] and update crc and bytes_out.
136 * (Used for the decompressed data only.)
137 */
138static void flush_window(void)
139{
140 ulg c = crc; /* temporary variable */
141 unsigned n;
142 uch *in, *out, ch;
143
144 in = window;
145 out = &output_data[output_ptr];
146 for (n = 0; n < outcnt; n++) {
147 ch = *out++ = *in++;
148 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
149 }
150 crc = c;
151 bytes_out += (ulg)outcnt;
152 output_ptr += (ulg)outcnt;
153 outcnt = 0;
154}
155
156static void error(char *x)
157{
158 puts("\n\n");
159 puts(x);
160 puts("\n\n -- System halted");
161
162 while(1); /* Halt */
163}
164
165#define STACK_SIZE (4096)
166long user_stack [STACK_SIZE];
167long* stack_start = &user_stack[STACK_SIZE];
168
169void decompress_kernel(void)
170{
171 output_data = 0;
172 output_ptr = (unsigned long)0x400000;
173 free_mem_ptr = (unsigned long)&_end;
174 free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
175
176 makecrc();
177 puts("Uncompressing Linux... ");
178 gunzip();
179 puts("Ok, booting the kernel.\n");
180}
diff --git a/arch/h8300/boot/compressed/vmlinux.lds b/arch/h8300/boot/compressed/vmlinux.lds
deleted file mode 100644
index a0a3a0ed54ef..000000000000
--- a/arch/h8300/boot/compressed/vmlinux.lds
+++ /dev/null
@@ -1,32 +0,0 @@
1SECTIONS
2{
3 .text :
4 {
5 __stext = . ;
6 __text = .;
7 *(.text..startup)
8 *(.text)
9 __etext = . ;
10 }
11
12 .rodata :
13 {
14 *(.rodata)
15 }
16 .data :
17
18 {
19 __sdata = . ;
20 ___data_start = . ;
21 *(.data.*)
22 }
23 .bss :
24 {
25 . = ALIGN(0x4) ;
26 __sbss = . ;
27 *(.bss*)
28 . = ALIGN(0x4) ;
29 __ebss = . ;
30 __end = . ;
31 }
32}
diff --git a/arch/h8300/boot/compressed/vmlinux.scr b/arch/h8300/boot/compressed/vmlinux.scr
deleted file mode 100644
index a0f6962736e9..000000000000
--- a/arch/h8300/boot/compressed/vmlinux.scr
+++ /dev/null
@@ -1,9 +0,0 @@
1SECTIONS
2{
3 .data : {
4 _input_len = .;
5 LONG(_input_data_end - _input_data) _input_data = .;
6 *(.data)
7 _input_data_end = .;
8 }
9}
diff --git a/arch/h8300/defconfig b/arch/h8300/defconfig
deleted file mode 100644
index 042425a02645..000000000000
--- a/arch/h8300/defconfig
+++ /dev/null
@@ -1,42 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_EXPERT=y
5# CONFIG_UID16 is not set
6# CONFIG_SYSCTL_SYSCALL is not set
7# CONFIG_KALLSYMS is not set
8# CONFIG_HOTPLUG is not set
9# CONFIG_BASE_FULL is not set
10# CONFIG_FUTEX is not set
11# CONFIG_EPOLL is not set
12# CONFIG_SIGNALFD is not set
13# CONFIG_TIMERFD is not set
14# CONFIG_EVENTFD is not set
15# CONFIG_VM_EVENT_COUNTERS is not set
16# CONFIG_COMPAT_BRK is not set
17CONFIG_SLOB=y
18# CONFIG_BLK_DEV_BSG is not set
19# CONFIG_IOSCHED_DEADLINE is not set
20# CONFIG_IOSCHED_CFQ is not set
21CONFIG_H83007=y
22CONFIG_BINFMT_FLAT=y
23CONFIG_BINFMT_ZFLAT=y
24CONFIG_BINFMT_MISC=y
25# CONFIG_PREVENT_FIRMWARE_BUILD is not set
26CONFIG_MTD=y
27CONFIG_MTD_PARTITIONS=y
28CONFIG_MTD_REDBOOT_PARTS=y
29CONFIG_MTD_CHAR=y
30CONFIG_MTD_RAM=y
31CONFIG_MTD_ROM=y
32CONFIG_MTD_UCLINUX=y
33# CONFIG_BLK_DEV is not set
34# CONFIG_INPUT is not set
35# CONFIG_SERIO is not set
36# CONFIG_HWMON is not set
37# CONFIG_USB_SUPPORT is not set
38# CONFIG_DNOTIFY is not set
39CONFIG_ROMFS_FS=y
40# CONFIG_ENABLE_WARN_DEPRECATED is not set
41# CONFIG_ENABLE_MUST_CHECK is not set
42# CONFIG_CRC32 is not set
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild
deleted file mode 100644
index 8ada3cf0c98d..000000000000
--- a/arch/h8300/include/asm/Kbuild
+++ /dev/null
@@ -1,8 +0,0 @@
1
2generic-y += clkdev.h
3generic-y += exec.h
4generic-y += linkage.h
5generic-y += mmu.h
6generic-y += module.h
7generic-y += trace_clock.h
8generic-y += xor.h
diff --git a/arch/h8300/include/asm/asm-offsets.h b/arch/h8300/include/asm/asm-offsets.h
deleted file mode 100644
index d370ee36a182..000000000000
--- a/arch/h8300/include/asm/asm-offsets.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <generated/asm-offsets.h>
diff --git a/arch/h8300/include/asm/atomic.h b/arch/h8300/include/asm/atomic.h
deleted file mode 100644
index 40901e353c21..000000000000
--- a/arch/h8300/include/asm/atomic.h
+++ /dev/null
@@ -1,146 +0,0 @@
1#ifndef __ARCH_H8300_ATOMIC__
2#define __ARCH_H8300_ATOMIC__
3
4#include <linux/types.h>
5#include <asm/cmpxchg.h>
6
7/*
8 * Atomic operations that C can't guarantee us. Useful for
9 * resource counting etc..
10 */
11
12#define ATOMIC_INIT(i) { (i) }
13
14#define atomic_read(v) (*(volatile int *)&(v)->counter)
15#define atomic_set(v, i) (((v)->counter) = i)
16
17#include <linux/kernel.h>
18
19static __inline__ int atomic_add_return(int i, atomic_t *v)
20{
21 unsigned long flags;
22 int ret;
23 local_irq_save(flags);
24 ret = v->counter += i;
25 local_irq_restore(flags);
26 return ret;
27}
28
29#define atomic_add(i, v) atomic_add_return(i, v)
30#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
31
32static __inline__ int atomic_sub_return(int i, atomic_t *v)
33{
34 unsigned long flags;
35 int ret;
36 local_irq_save(flags);
37 ret = v->counter -= i;
38 local_irq_restore(flags);
39 return ret;
40}
41
42#define atomic_sub(i, v) atomic_sub_return(i, v)
43#define atomic_sub_and_test(i,v) (atomic_sub_return(i, v) == 0)
44
45static __inline__ int atomic_inc_return(atomic_t *v)
46{
47 unsigned long flags;
48 int ret;
49 local_irq_save(flags);
50 v->counter++;
51 ret = v->counter;
52 local_irq_restore(flags);
53 return ret;
54}
55
56#define atomic_inc(v) atomic_inc_return(v)
57
58/*
59 * atomic_inc_and_test - increment and test
60 * @v: pointer of type atomic_t
61 *
62 * Atomically increments @v by 1
63 * and returns true if the result is zero, or false for all
64 * other cases.
65 */
66#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
67
68static __inline__ int atomic_dec_return(atomic_t *v)
69{
70 unsigned long flags;
71 int ret;
72 local_irq_save(flags);
73 --v->counter;
74 ret = v->counter;
75 local_irq_restore(flags);
76 return ret;
77}
78
79#define atomic_dec(v) atomic_dec_return(v)
80
81static __inline__ int atomic_dec_and_test(atomic_t *v)
82{
83 unsigned long flags;
84 int ret;
85 local_irq_save(flags);
86 --v->counter;
87 ret = v->counter;
88 local_irq_restore(flags);
89 return ret == 0;
90}
91
92static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
93{
94 int ret;
95 unsigned long flags;
96
97 local_irq_save(flags);
98 ret = v->counter;
99 if (likely(ret == old))
100 v->counter = new;
101 local_irq_restore(flags);
102 return ret;
103}
104
105static inline int __atomic_add_unless(atomic_t *v, int a, int u)
106{
107 int ret;
108 unsigned long flags;
109
110 local_irq_save(flags);
111 ret = v->counter;
112 if (ret != u)
113 v->counter += a;
114 local_irq_restore(flags);
115 return ret;
116}
117
118static __inline__ void atomic_clear_mask(unsigned long mask, unsigned long *v)
119{
120 __asm__ __volatile__("stc ccr,r1l\n\t"
121 "orc #0x80,ccr\n\t"
122 "mov.l %0,er0\n\t"
123 "and.l %1,er0\n\t"
124 "mov.l er0,%0\n\t"
125 "ldc r1l,ccr"
126 : "=m" (*v) : "g" (~(mask)) :"er0","er1");
127}
128
129static __inline__ void atomic_set_mask(unsigned long mask, unsigned long *v)
130{
131 __asm__ __volatile__("stc ccr,r1l\n\t"
132 "orc #0x80,ccr\n\t"
133 "mov.l %0,er0\n\t"
134 "or.l %1,er0\n\t"
135 "mov.l er0,%0\n\t"
136 "ldc r1l,ccr"
137 : "=m" (*v) : "g" (mask) :"er0","er1");
138}
139
140/* Atomic operations are already serializing */
141#define smp_mb__before_atomic_dec() barrier()
142#define smp_mb__after_atomic_dec() barrier()
143#define smp_mb__before_atomic_inc() barrier()
144#define smp_mb__after_atomic_inc() barrier()
145
146#endif /* __ARCH_H8300_ATOMIC __ */
diff --git a/arch/h8300/include/asm/barrier.h b/arch/h8300/include/asm/barrier.h
deleted file mode 100644
index 9e0aa9fc195d..000000000000
--- a/arch/h8300/include/asm/barrier.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef _H8300_BARRIER_H
2#define _H8300_BARRIER_H
3
4#define nop() asm volatile ("nop"::)
5
6/*
7 * Force strict CPU ordering.
8 * Not really required on H8...
9 */
10#define mb() asm volatile ("" : : :"memory")
11#define rmb() asm volatile ("" : : :"memory")
12#define wmb() asm volatile ("" : : :"memory")
13#define set_mb(var, value) do { xchg(&var, value); } while (0)
14
15#define read_barrier_depends() do { } while (0)
16
17#ifdef CONFIG_SMP
18#define smp_mb() mb()
19#define smp_rmb() rmb()
20#define smp_wmb() wmb()
21#define smp_read_barrier_depends() read_barrier_depends()
22#else
23#define smp_mb() barrier()
24#define smp_rmb() barrier()
25#define smp_wmb() barrier()
26#define smp_read_barrier_depends() do { } while(0)
27#endif
28
29#endif /* _H8300_BARRIER_H */
diff --git a/arch/h8300/include/asm/bitops.h b/arch/h8300/include/asm/bitops.h
deleted file mode 100644
index eb34e0cd33d5..000000000000
--- a/arch/h8300/include/asm/bitops.h
+++ /dev/null
@@ -1,211 +0,0 @@
1#ifndef _H8300_BITOPS_H
2#define _H8300_BITOPS_H
3
4/*
5 * Copyright 1992, Linus Torvalds.
6 * Copyright 2002, Yoshinori Sato
7 */
8
9#include <linux/compiler.h>
10
11#ifdef __KERNEL__
12
13#ifndef _LINUX_BITOPS_H
14#error only <linux/bitops.h> can be included directly
15#endif
16
17/*
18 * Function prototypes to keep gcc -Wall happy
19 */
20
21/*
22 * ffz = Find First Zero in word. Undefined if no zero exists,
23 * so code should check against ~0UL first..
24 */
25static __inline__ unsigned long ffz(unsigned long word)
26{
27 unsigned long result;
28
29 result = -1;
30 __asm__("1:\n\t"
31 "shlr.l %2\n\t"
32 "adds #1,%0\n\t"
33 "bcs 1b"
34 : "=r" (result)
35 : "0" (result),"r" (word));
36 return result;
37}
38
39#define H8300_GEN_BITOP_CONST(OP,BIT) \
40 case BIT: \
41 __asm__(OP " #" #BIT ",@%0"::"r"(b_addr):"memory"); \
42 break;
43
44#define H8300_GEN_BITOP(FNAME,OP) \
45static __inline__ void FNAME(int nr, volatile unsigned long* addr) \
46{ \
47 volatile unsigned char *b_addr; \
48 b_addr = (volatile unsigned char *)addr + ((nr >> 3) ^ 3); \
49 if (__builtin_constant_p(nr)) { \
50 switch(nr & 7) { \
51 H8300_GEN_BITOP_CONST(OP,0) \
52 H8300_GEN_BITOP_CONST(OP,1) \
53 H8300_GEN_BITOP_CONST(OP,2) \
54 H8300_GEN_BITOP_CONST(OP,3) \
55 H8300_GEN_BITOP_CONST(OP,4) \
56 H8300_GEN_BITOP_CONST(OP,5) \
57 H8300_GEN_BITOP_CONST(OP,6) \
58 H8300_GEN_BITOP_CONST(OP,7) \
59 } \
60 } else { \
61 __asm__(OP " %w0,@%1"::"r"(nr),"r"(b_addr):"memory"); \
62 } \
63}
64
65/*
66 * clear_bit() doesn't provide any barrier for the compiler.
67 */
68#define smp_mb__before_clear_bit() barrier()
69#define smp_mb__after_clear_bit() barrier()
70
71H8300_GEN_BITOP(set_bit ,"bset")
72H8300_GEN_BITOP(clear_bit ,"bclr")
73H8300_GEN_BITOP(change_bit,"bnot")
74#define __set_bit(nr,addr) set_bit((nr),(addr))
75#define __clear_bit(nr,addr) clear_bit((nr),(addr))
76#define __change_bit(nr,addr) change_bit((nr),(addr))
77
78#undef H8300_GEN_BITOP
79#undef H8300_GEN_BITOP_CONST
80
81static __inline__ int test_bit(int nr, const unsigned long* addr)
82{
83 return (*((volatile unsigned char *)addr +
84 ((nr >> 3) ^ 3)) & (1UL << (nr & 7))) != 0;
85}
86
87#define __test_bit(nr, addr) test_bit(nr, addr)
88
89#define H8300_GEN_TEST_BITOP_CONST_INT(OP,BIT) \
90 case BIT: \
91 __asm__("stc ccr,%w1\n\t" \
92 "orc #0x80,ccr\n\t" \
93 "bld #" #BIT ",@%4\n\t" \
94 OP " #" #BIT ",@%4\n\t" \
95 "rotxl.l %0\n\t" \
96 "ldc %w1,ccr" \
97 : "=r"(retval),"=&r"(ccrsave),"=m"(*b_addr) \
98 : "0" (retval),"r" (b_addr) \
99 : "memory"); \
100 break;
101
102#define H8300_GEN_TEST_BITOP_CONST(OP,BIT) \
103 case BIT: \
104 __asm__("bld #" #BIT ",@%3\n\t" \
105 OP " #" #BIT ",@%3\n\t" \
106 "rotxl.l %0\n\t" \
107 : "=r"(retval),"=m"(*b_addr) \
108 : "0" (retval),"r" (b_addr) \
109 : "memory"); \
110 break;
111
112#define H8300_GEN_TEST_BITOP(FNNAME,OP) \
113static __inline__ int FNNAME(int nr, volatile void * addr) \
114{ \
115 int retval = 0; \
116 char ccrsave; \
117 volatile unsigned char *b_addr; \
118 b_addr = (volatile unsigned char *)addr + ((nr >> 3) ^ 3); \
119 if (__builtin_constant_p(nr)) { \
120 switch(nr & 7) { \
121 H8300_GEN_TEST_BITOP_CONST_INT(OP,0) \
122 H8300_GEN_TEST_BITOP_CONST_INT(OP,1) \
123 H8300_GEN_TEST_BITOP_CONST_INT(OP,2) \
124 H8300_GEN_TEST_BITOP_CONST_INT(OP,3) \
125 H8300_GEN_TEST_BITOP_CONST_INT(OP,4) \
126 H8300_GEN_TEST_BITOP_CONST_INT(OP,5) \
127 H8300_GEN_TEST_BITOP_CONST_INT(OP,6) \
128 H8300_GEN_TEST_BITOP_CONST_INT(OP,7) \
129 } \
130 } else { \
131 __asm__("stc ccr,%w1\n\t" \
132 "orc #0x80,ccr\n\t" \
133 "btst %w5,@%4\n\t" \
134 OP " %w5,@%4\n\t" \
135 "beq 1f\n\t" \
136 "inc.l #1,%0\n" \
137 "1:\n\t" \
138 "ldc %w1,ccr" \
139 : "=r"(retval),"=&r"(ccrsave),"=m"(*b_addr) \
140 : "0" (retval),"r" (b_addr),"r"(nr) \
141 : "memory"); \
142 } \
143 return retval; \
144} \
145 \
146static __inline__ int __ ## FNNAME(int nr, volatile void * addr) \
147{ \
148 int retval = 0; \
149 volatile unsigned char *b_addr; \
150 b_addr = (volatile unsigned char *)addr + ((nr >> 3) ^ 3); \
151 if (__builtin_constant_p(nr)) { \
152 switch(nr & 7) { \
153 H8300_GEN_TEST_BITOP_CONST(OP,0) \
154 H8300_GEN_TEST_BITOP_CONST(OP,1) \
155 H8300_GEN_TEST_BITOP_CONST(OP,2) \
156 H8300_GEN_TEST_BITOP_CONST(OP,3) \
157 H8300_GEN_TEST_BITOP_CONST(OP,4) \
158 H8300_GEN_TEST_BITOP_CONST(OP,5) \
159 H8300_GEN_TEST_BITOP_CONST(OP,6) \
160 H8300_GEN_TEST_BITOP_CONST(OP,7) \
161 } \
162 } else { \
163 __asm__("btst %w4,@%3\n\t" \
164 OP " %w4,@%3\n\t" \
165 "beq 1f\n\t" \
166 "inc.l #1,%0\n" \
167 "1:" \
168 : "=r"(retval),"=m"(*b_addr) \
169 : "0" (retval),"r" (b_addr),"r"(nr) \
170 : "memory"); \
171 } \
172 return retval; \
173}
174
175H8300_GEN_TEST_BITOP(test_and_set_bit, "bset")
176H8300_GEN_TEST_BITOP(test_and_clear_bit, "bclr")
177H8300_GEN_TEST_BITOP(test_and_change_bit,"bnot")
178#undef H8300_GEN_TEST_BITOP_CONST
179#undef H8300_GEN_TEST_BITOP_CONST_INT
180#undef H8300_GEN_TEST_BITOP
181
182#include <asm-generic/bitops/ffs.h>
183
184static __inline__ unsigned long __ffs(unsigned long word)
185{
186 unsigned long result;
187
188 result = -1;
189 __asm__("1:\n\t"
190 "shlr.l %2\n\t"
191 "adds #1,%0\n\t"
192 "bcc 1b"
193 : "=r" (result)
194 : "0"(result),"r"(word));
195 return result;
196}
197
198#include <asm-generic/bitops/find.h>
199#include <asm-generic/bitops/sched.h>
200#include <asm-generic/bitops/hweight.h>
201#include <asm-generic/bitops/lock.h>
202#include <asm-generic/bitops/le.h>
203#include <asm-generic/bitops/ext2-atomic.h>
204
205#endif /* __KERNEL__ */
206
207#include <asm-generic/bitops/fls.h>
208#include <asm-generic/bitops/__fls.h>
209#include <asm-generic/bitops/fls64.h>
210
211#endif /* _H8300_BITOPS_H */
diff --git a/arch/h8300/include/asm/bootinfo.h b/arch/h8300/include/asm/bootinfo.h
deleted file mode 100644
index 5bed7e7aac0a..000000000000
--- a/arch/h8300/include/asm/bootinfo.h
+++ /dev/null
@@ -1,2 +0,0 @@
1
2/* Nothing for h8300 */
diff --git a/arch/h8300/include/asm/bug.h b/arch/h8300/include/asm/bug.h
deleted file mode 100644
index 1e1be8119935..000000000000
--- a/arch/h8300/include/asm/bug.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _H8300_BUG_H
2#define _H8300_BUG_H
3
4/* always true */
5#define is_valid_bugaddr(addr) (1)
6
7#include <asm-generic/bug.h>
8
9struct pt_regs;
10extern void die(const char *str, struct pt_regs *fp, unsigned long err);
11
12#endif
diff --git a/arch/h8300/include/asm/bugs.h b/arch/h8300/include/asm/bugs.h
deleted file mode 100644
index 1cb4afba6eb1..000000000000
--- a/arch/h8300/include/asm/bugs.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-h8300/bugs.h
3 *
4 * Copyright (C) 1994 Linus Torvalds
5 */
6
7/*
8 * This is included by init/main.c to check for architecture-dependent bugs.
9 *
10 * Needs:
11 * void check_bugs(void);
12 */
13
14static void check_bugs(void)
15{
16}
diff --git a/arch/h8300/include/asm/cache.h b/arch/h8300/include/asm/cache.h
deleted file mode 100644
index 05887a1d80e5..000000000000
--- a/arch/h8300/include/asm/cache.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __ARCH_H8300_CACHE_H
2#define __ARCH_H8300_CACHE_H
3
4/* bytes per L1 cache line */
5#define L1_CACHE_SHIFT 2
6#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
7
8/* m68k-elf-gcc 2.95.2 doesn't like these */
9
10#define __cacheline_aligned
11#define ____cacheline_aligned
12
13#endif
diff --git a/arch/h8300/include/asm/cachectl.h b/arch/h8300/include/asm/cachectl.h
deleted file mode 100644
index c464022d8e26..000000000000
--- a/arch/h8300/include/asm/cachectl.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef _H8300_CACHECTL_H
2#define _H8300_CACHECTL_H
3
4/* Definitions for the cacheflush system call. */
5
6#define FLUSH_SCOPE_LINE 0 /* Flush a cache line */
7#define FLUSH_SCOPE_PAGE 0 /* Flush a page */
8#define FLUSH_SCOPE_ALL 0 /* Flush the whole cache -- superuser only */
9
10#define FLUSH_CACHE_DATA 0 /* Writeback and flush data cache */
11#define FLUSH_CACHE_INSN 0 /* Flush instruction cache */
12#define FLUSH_CACHE_BOTH 0 /* Flush both caches */
13
14#endif /* _H8300_CACHECTL_H */
diff --git a/arch/h8300/include/asm/cacheflush.h b/arch/h8300/include/asm/cacheflush.h
deleted file mode 100644
index 4cf2df20c1ce..000000000000
--- a/arch/h8300/include/asm/cacheflush.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * (C) Copyright 2002, Yoshinori Sato <ysato@users.sourceforge.jp>
3 */
4
5#ifndef _ASM_H8300_CACHEFLUSH_H
6#define _ASM_H8300_CACHEFLUSH_H
7
8/*
9 * Cache handling functions
10 * No Cache memory all dummy functions
11 */
12
13#define flush_cache_all()
14#define flush_cache_mm(mm)
15#define flush_cache_dup_mm(mm) do { } while (0)
16#define flush_cache_range(vma,a,b)
17#define flush_cache_page(vma,p,pfn)
18#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
19#define flush_dcache_page(page)
20#define flush_dcache_mmap_lock(mapping)
21#define flush_dcache_mmap_unlock(mapping)
22#define flush_icache()
23#define flush_icache_page(vma,page)
24#define flush_icache_range(start,len)
25#define flush_cache_vmap(start, end)
26#define flush_cache_vunmap(start, end)
27#define cache_push_v(vaddr,len)
28#define cache_push(paddr,len)
29#define cache_clear(paddr,len)
30
31#define flush_dcache_range(a,b)
32
33#define flush_icache_user_range(vma,page,addr,len)
34
35#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
36 memcpy(dst, src, len)
37#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
38 memcpy(dst, src, len)
39
40#endif /* _ASM_H8300_CACHEFLUSH_H */
diff --git a/arch/h8300/include/asm/checksum.h b/arch/h8300/include/asm/checksum.h
deleted file mode 100644
index 98724e12508c..000000000000
--- a/arch/h8300/include/asm/checksum.h
+++ /dev/null
@@ -1,102 +0,0 @@
1#ifndef _H8300_CHECKSUM_H
2#define _H8300_CHECKSUM_H
3
4/*
5 * computes the checksum of a memory block at buff, length len,
6 * and adds in "sum" (32-bit)
7 *
8 * returns a 32-bit number suitable for feeding into itself
9 * or csum_tcpudp_magic
10 *
11 * this function must be called with even lengths, except
12 * for the last fragment, which may be odd
13 *
14 * it's best to have buff aligned on a 32-bit boundary
15 */
16__wsum csum_partial(const void *buff, int len, __wsum sum);
17
18/*
19 * the same as csum_partial, but copies from src while it
20 * checksums
21 *
22 * here even more important to align src and dst on a 32-bit (or even
23 * better 64-bit) boundary
24 */
25
26__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
27
28
29/*
30 * the same as csum_partial_copy, but copies from user space.
31 *
32 * here even more important to align src and dst on a 32-bit (or even
33 * better 64-bit) boundary
34 */
35
36extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
37 int len, __wsum sum, int *csum_err);
38
39__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
40
41
42/*
43 * Fold a partial checksum
44 */
45
46static inline __sum16 csum_fold(__wsum sum)
47{
48 __asm__("mov.l %0,er0\n\t"
49 "add.w e0,r0\n\t"
50 "xor.w e0,e0\n\t"
51 "rotxl.w e0\n\t"
52 "add.w e0,r0\n\t"
53 "sub.w e0,e0\n\t"
54 "mov.l er0,%0"
55 : "=r"(sum)
56 : "0"(sum)
57 : "er0");
58 return (__force __sum16)~sum;
59}
60
61
62/*
63 * computes the checksum of the TCP/UDP pseudo-header
64 * returns a 16-bit checksum, already complemented
65 */
66
67static inline __wsum
68csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
69 unsigned short proto, __wsum sum)
70{
71 __asm__ ("sub.l er0,er0\n\t"
72 "add.l %2,%0\n\t"
73 "addx #0,r0l\n\t"
74 "add.l %3,%0\n\t"
75 "addx #0,r0l\n\t"
76 "add.l %4,%0\n\t"
77 "addx #0,r0l\n\t"
78 "add.l er0,%0\n\t"
79 "bcc 1f\n\t"
80 "inc.l #1,%0\n"
81 "1:"
82 : "=&r" (sum)
83 : "0" (sum), "r" (daddr), "r" (saddr), "r" (len + proto)
84 :"er0");
85 return sum;
86}
87
88static inline __sum16
89csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
90 unsigned short proto, __wsum sum)
91{
92 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
93}
94
95/*
96 * this routine is used for miscellaneous IP-like checksums, mainly
97 * in icmp.c
98 */
99
100extern __sum16 ip_compute_csum(const void *buff, int len);
101
102#endif /* _H8300_CHECKSUM_H */
diff --git a/arch/h8300/include/asm/cmpxchg.h b/arch/h8300/include/asm/cmpxchg.h
deleted file mode 100644
index cdb203ef681f..000000000000
--- a/arch/h8300/include/asm/cmpxchg.h
+++ /dev/null
@@ -1,60 +0,0 @@
1#ifndef __ARCH_H8300_CMPXCHG__
2#define __ARCH_H8300_CMPXCHG__
3
4#include <linux/irqflags.h>
5
6#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
7
8struct __xchg_dummy { unsigned long a[100]; };
9#define __xg(x) ((volatile struct __xchg_dummy *)(x))
10
11static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
12{
13 unsigned long tmp, flags;
14
15 local_irq_save(flags);
16
17 switch (size) {
18 case 1:
19 __asm__ __volatile__
20 ("mov.b %2,%0\n\t"
21 "mov.b %1,%2"
22 : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory");
23 break;
24 case 2:
25 __asm__ __volatile__
26 ("mov.w %2,%0\n\t"
27 "mov.w %1,%2"
28 : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory");
29 break;
30 case 4:
31 __asm__ __volatile__
32 ("mov.l %2,%0\n\t"
33 "mov.l %1,%2"
34 : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory");
35 break;
36 default:
37 tmp = 0;
38 }
39 local_irq_restore(flags);
40 return tmp;
41}
42
43#include <asm-generic/cmpxchg-local.h>
44
45/*
46 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
47 * them available.
48 */
49#define cmpxchg_local(ptr, o, n) \
50 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
51 (unsigned long)(n), sizeof(*(ptr))))
52#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
53
54#ifndef CONFIG_SMP
55#include <asm-generic/cmpxchg.h>
56#endif
57
58#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
59
60#endif /* __ARCH_H8300_CMPXCHG__ */
diff --git a/arch/h8300/include/asm/cputime.h b/arch/h8300/include/asm/cputime.h
deleted file mode 100644
index 092e187c7b08..000000000000
--- a/arch/h8300/include/asm/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __H8300_CPUTIME_H
2#define __H8300_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __H8300_CPUTIME_H */
diff --git a/arch/h8300/include/asm/current.h b/arch/h8300/include/asm/current.h
deleted file mode 100644
index 57d74ee55a14..000000000000
--- a/arch/h8300/include/asm/current.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef _H8300_CURRENT_H
2#define _H8300_CURRENT_H
3/*
4 * current.h
5 * (C) Copyright 2000, Lineo, David McCullough <davidm@lineo.com>
6 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
7 *
8 * rather than dedicate a register (as the m68k source does), we
9 * just keep a global, we should probably just change it all to be
10 * current and lose _current_task.
11 */
12
13#include <linux/thread_info.h>
14#include <asm/thread_info.h>
15
16struct task_struct;
17
18static inline struct task_struct *get_current(void)
19{
20 return(current_thread_info()->task);
21}
22
23#define current get_current()
24
25#endif /* _H8300_CURRENT_H */
diff --git a/arch/h8300/include/asm/dbg.h b/arch/h8300/include/asm/dbg.h
deleted file mode 100644
index 2c6d1cbcf736..000000000000
--- a/arch/h8300/include/asm/dbg.h
+++ /dev/null
@@ -1,2 +0,0 @@
1#define DEBUG 1
2#define BREAK asm volatile ("trap #3")
diff --git a/arch/h8300/include/asm/delay.h b/arch/h8300/include/asm/delay.h
deleted file mode 100644
index 743beba70f82..000000000000
--- a/arch/h8300/include/asm/delay.h
+++ /dev/null
@@ -1,38 +0,0 @@
1#ifndef _H8300_DELAY_H
2#define _H8300_DELAY_H
3
4#include <asm/param.h>
5
6/*
7 * Copyright (C) 2002 Yoshinori Sato <ysato@sourceforge.jp>
8 *
9 * Delay routines, using a pre-computed "loops_per_second" value.
10 */
11
12static inline void __delay(unsigned long loops)
13{
14 __asm__ __volatile__ ("1:\n\t"
15 "dec.l #1,%0\n\t"
16 "bne 1b"
17 :"=r" (loops):"0"(loops));
18}
19
20/*
21 * Use only for very small delays ( < 1 msec). Should probably use a
22 * lookup table, really, as the multiplications take much too long with
23 * short delays. This is a "reasonable" implementation, though (and the
24 * first constant multiplications gets optimized away if the delay is
25 * a constant)
26 */
27
28extern unsigned long loops_per_jiffy;
29
30static inline void udelay(unsigned long usecs)
31{
32 usecs *= 4295; /* 2**32 / 1000000 */
33 usecs /= (loops_per_jiffy*HZ);
34 if (usecs)
35 __delay(usecs);
36}
37
38#endif /* _H8300_DELAY_H */
diff --git a/arch/h8300/include/asm/device.h b/arch/h8300/include/asm/device.h
deleted file mode 100644
index d8f9872b0e2d..000000000000
--- a/arch/h8300/include/asm/device.h
+++ /dev/null
@@ -1,7 +0,0 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/arch/h8300/include/asm/div64.h b/arch/h8300/include/asm/div64.h
deleted file mode 100644
index 6cd978cefb28..000000000000
--- a/arch/h8300/include/asm/div64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/div64.h>
diff --git a/arch/h8300/include/asm/dma.h b/arch/h8300/include/asm/dma.h
deleted file mode 100644
index 3edbaaaedf5b..000000000000
--- a/arch/h8300/include/asm/dma.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _H8300_DMA_H
2#define _H8300_DMA_H
3
4
5/*
6 * Set number of channels of DMA on ColdFire for different implementations.
7 */
8#define MAX_DMA_CHANNELS 0
9#define MAX_DMA_ADDRESS PAGE_OFFSET
10
11/* These are in kernel/dma.c: */
12extern int request_dma(unsigned int dmanr, const char *device_id); /* reserve a DMA channel */
13extern void free_dma(unsigned int dmanr); /* release it again */
14
15#endif /* _H8300_DMA_H */
diff --git a/arch/h8300/include/asm/elf.h b/arch/h8300/include/asm/elf.h
deleted file mode 100644
index 6db71248a82f..000000000000
--- a/arch/h8300/include/asm/elf.h
+++ /dev/null
@@ -1,101 +0,0 @@
1#ifndef __ASMH8300_ELF_H
2#define __ASMH8300_ELF_H
3
4/*
5 * ELF register definitions..
6 */
7
8#include <asm/ptrace.h>
9#include <asm/user.h>
10
11typedef unsigned long elf_greg_t;
12
13#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
14typedef elf_greg_t elf_gregset_t[ELF_NGREG];
15typedef unsigned long elf_fpregset_t;
16
17/*
18 * This is used to ensure we don't load something for the wrong architecture.
19 */
20#define elf_check_arch(x) ((x)->e_machine == EM_H8_300)
21
22/*
23 * These are used to set parameters in the core dumps.
24 */
25#define ELF_CLASS ELFCLASS32
26#define ELF_DATA ELFDATA2MSB
27#define ELF_ARCH EM_H8_300
28#if defined(__H8300H__)
29#define ELF_CORE_EFLAGS 0x810000
30#endif
31#if defined(__H8300S__)
32#define ELF_CORE_EFLAGS 0x820000
33#endif
34
35#define ELF_PLAT_INIT(_r) _r->er1 = 0
36
37#define ELF_EXEC_PAGESIZE 4096
38
39/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
40 use of this is to invoke "./ld.so someprog" to test out a new version of
41 the loader. We need to make sure that it is out of the way of the program
42 that it will "exec", and that there is sufficient room for the brk. */
43
44#define ELF_ET_DYN_BASE 0xD0000000UL
45
46/* This yields a mask that user programs can use to figure out what
47 instruction set this cpu supports. */
48
49#define ELF_HWCAP (0)
50
51/* This yields a string that ld.so will use to load implementation
52 specific libraries for optimization. This is more specific in
53 intent than poking at uname or /proc/cpuinfo. */
54
55#define ELF_PLATFORM (NULL)
56
57#define R_H8_NONE 0
58#define R_H8_DIR32 1
59#define R_H8_DIR32_28 2
60#define R_H8_DIR32_24 3
61#define R_H8_DIR32_16 4
62#define R_H8_DIR32U 6
63#define R_H8_DIR32U_28 7
64#define R_H8_DIR32U_24 8
65#define R_H8_DIR32U_20 9
66#define R_H8_DIR32U_16 10
67#define R_H8_DIR24 11
68#define R_H8_DIR24_20 12
69#define R_H8_DIR24_16 13
70#define R_H8_DIR24U 14
71#define R_H8_DIR24U_20 15
72#define R_H8_DIR24U_16 16
73#define R_H8_DIR16 17
74#define R_H8_DIR16U 18
75#define R_H8_DIR16S_32 19
76#define R_H8_DIR16S_28 20
77#define R_H8_DIR16S_24 21
78#define R_H8_DIR16S_20 22
79#define R_H8_DIR16S 23
80#define R_H8_DIR8 24
81#define R_H8_DIR8U 25
82#define R_H8_DIR8Z_32 26
83#define R_H8_DIR8Z_28 27
84#define R_H8_DIR8Z_24 28
85#define R_H8_DIR8Z_20 29
86#define R_H8_DIR8Z_16 30
87#define R_H8_PCREL16 31
88#define R_H8_PCREL8 32
89#define R_H8_BPOS 33
90#define R_H8_PCREL32 34
91#define R_H8_GOT32O 35
92#define R_H8_GOT16O 36
93#define R_H8_DIR16A8 59
94#define R_H8_DIR16R8 60
95#define R_H8_DIR24A8 61
96#define R_H8_DIR24R8 62
97#define R_H8_DIR32A16 63
98#define R_H8_ABS32 65
99#define R_H8_ABS32A16 127
100
101#endif
diff --git a/arch/h8300/include/asm/emergency-restart.h b/arch/h8300/include/asm/emergency-restart.h
deleted file mode 100644
index 108d8c48e42e..000000000000
--- a/arch/h8300/include/asm/emergency-restart.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/arch/h8300/include/asm/fb.h b/arch/h8300/include/asm/fb.h
deleted file mode 100644
index c7df38030992..000000000000
--- a/arch/h8300/include/asm/fb.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* _ASM_FB_H_ */
diff --git a/arch/h8300/include/asm/flat.h b/arch/h8300/include/asm/flat.h
deleted file mode 100644
index bd12b31b90e6..000000000000
--- a/arch/h8300/include/asm/flat.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * include/asm-h8300/flat.h -- uClinux flat-format executables
3 */
4
5#ifndef __H8300_FLAT_H__
6#define __H8300_FLAT_H__
7
8#define flat_argvp_envp_on_stack() 1
9#define flat_old_ram_flag(flags) 1
10#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
11#define flat_set_persistent(relval, p) 0
12
13/*
14 * on the H8 a couple of the relocations have an instruction in the
15 * top byte. As there can only be 24bits of address space, we just
16 * always preserve that 8bits at the top, when it isn't an instruction
17 * is is 0 (davidm@snapgear.com)
18 */
19
20#define flat_get_relocate_addr(rel) (rel)
21#define flat_get_addr_from_rp(rp, relval, flags, persistent) \
22 (get_unaligned(rp) & ((flags & FLAT_FLAG_GOTPIC) ? 0xffffffff: 0x00ffffff))
23#define flat_put_addr_at_rp(rp, addr, rel) \
24 put_unaligned (((*(char *)(rp)) << 24) | ((addr) & 0x00ffffff), rp)
25
26#endif /* __H8300_FLAT_H__ */
diff --git a/arch/h8300/include/asm/fpu.h b/arch/h8300/include/asm/fpu.h
deleted file mode 100644
index 4fc416e80bef..000000000000
--- a/arch/h8300/include/asm/fpu.h
+++ /dev/null
@@ -1 +0,0 @@
1/* Nothing do */
diff --git a/arch/h8300/include/asm/ftrace.h b/arch/h8300/include/asm/ftrace.h
deleted file mode 100644
index 40a8c178f10d..000000000000
--- a/arch/h8300/include/asm/ftrace.h
+++ /dev/null
@@ -1 +0,0 @@
1/* empty */
diff --git a/arch/h8300/include/asm/futex.h b/arch/h8300/include/asm/futex.h
deleted file mode 100644
index 6a332a9f099c..000000000000
--- a/arch/h8300/include/asm/futex.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#include <asm-generic/futex.h>
5
6#endif
diff --git a/arch/h8300/include/asm/gpio-internal.h b/arch/h8300/include/asm/gpio-internal.h
deleted file mode 100644
index a714f0c0efbc..000000000000
--- a/arch/h8300/include/asm/gpio-internal.h
+++ /dev/null
@@ -1,52 +0,0 @@
1#ifndef _H8300_GPIO_H
2#define _H8300_GPIO_H
3
4#define H8300_GPIO_P1 0
5#define H8300_GPIO_P2 1
6#define H8300_GPIO_P3 2
7#define H8300_GPIO_P4 3
8#define H8300_GPIO_P5 4
9#define H8300_GPIO_P6 5
10#define H8300_GPIO_P7 6
11#define H8300_GPIO_P8 7
12#define H8300_GPIO_P9 8
13#define H8300_GPIO_PA 9
14#define H8300_GPIO_PB 10
15#define H8300_GPIO_PC 11
16#define H8300_GPIO_PD 12
17#define H8300_GPIO_PE 13
18#define H8300_GPIO_PF 14
19#define H8300_GPIO_PG 15
20#define H8300_GPIO_PH 16
21
22#define H8300_GPIO_B7 0x80
23#define H8300_GPIO_B6 0x40
24#define H8300_GPIO_B5 0x20
25#define H8300_GPIO_B4 0x10
26#define H8300_GPIO_B3 0x08
27#define H8300_GPIO_B2 0x04
28#define H8300_GPIO_B1 0x02
29#define H8300_GPIO_B0 0x01
30
31#define H8300_GPIO_INPUT 0
32#define H8300_GPIO_OUTPUT 1
33
34#define H8300_GPIO_RESERVE(port, bits) \
35 h8300_reserved_gpio(port, bits)
36
37#define H8300_GPIO_FREE(port, bits) \
38 h8300_free_gpio(port, bits)
39
40#define H8300_GPIO_DDR(port, bit, dir) \
41 h8300_set_gpio_dir(((port) << 8) | (bit), dir)
42
43#define H8300_GPIO_GETDIR(port, bit) \
44 h8300_get_gpio_dir(((port) << 8) | (bit))
45
46extern int h8300_reserved_gpio(int port, int bits);
47extern int h8300_free_gpio(int port, int bits);
48extern int h8300_set_gpio_dir(int port_bit, int dir);
49extern int h8300_get_gpio_dir(int port_bit);
50extern int h8300_init_gpio(void);
51
52#endif
diff --git a/arch/h8300/include/asm/hardirq.h b/arch/h8300/include/asm/hardirq.h
deleted file mode 100644
index c2e1aa0f0d14..000000000000
--- a/arch/h8300/include/asm/hardirq.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef __H8300_HARDIRQ_H
2#define __H8300_HARDIRQ_H
3
4#include <asm/irq.h>
5
6#define HARDIRQ_BITS 8
7
8/*
9 * The hardirq mask has to be large enough to have
10 * space for potentially all IRQ sources in the system
11 * nesting on a single CPU:
12 */
13#if (1 << HARDIRQ_BITS) < NR_IRQS
14# error HARDIRQ_BITS is too low!
15#endif
16
17#include <asm-generic/hardirq.h>
18
19#endif
diff --git a/arch/h8300/include/asm/hw_irq.h b/arch/h8300/include/asm/hw_irq.h
deleted file mode 100644
index d75a5a1119e8..000000000000
--- a/arch/h8300/include/asm/hw_irq.h
+++ /dev/null
@@ -1 +0,0 @@
1/* Do Nothing */
diff --git a/arch/h8300/include/asm/io.h b/arch/h8300/include/asm/io.h
deleted file mode 100644
index c1a8df22080f..000000000000
--- a/arch/h8300/include/asm/io.h
+++ /dev/null
@@ -1,358 +0,0 @@
1#ifndef _H8300_IO_H
2#define _H8300_IO_H
3
4#ifdef __KERNEL__
5
6#include <asm/virtconvert.h>
7
8#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
9#include <asm/regs306x.h>
10#elif defined(CONFIG_H8S2678)
11#include <asm/regs267x.h>
12#else
13#error UNKNOWN CPU TYPE
14#endif
15
16
17/*
18 * These are for ISA/PCI shared memory _only_ and should never be used
19 * on any other type of memory, including Zorro memory. They are meant to
20 * access the bus in the bus byte order which is little-endian!.
21 *
22 * readX/writeX() are used to access memory mapped devices. On some
23 * architectures the memory mapped IO stuff needs to be accessed
24 * differently. On the m68k architecture, we just read/write the
25 * memory location directly.
26 */
27/* ++roman: The assignments to temp. vars avoid that gcc sometimes generates
28 * two accesses to memory, which may be undesirable for some devices.
29 */
30
31/*
32 * swap functions are sometimes needed to interface little-endian hardware
33 */
34
35static inline unsigned short _swapw(volatile unsigned short v)
36{
37#ifndef H8300_IO_NOSWAP
38 unsigned short r;
39 __asm__("xor.b %w0,%x0\n\t"
40 "xor.b %x0,%w0\n\t"
41 "xor.b %w0,%x0"
42 :"=r"(r)
43 :"0"(v));
44 return r;
45#else
46 return v;
47#endif
48}
49
50static inline unsigned long _swapl(volatile unsigned long v)
51{
52#ifndef H8300_IO_NOSWAP
53 unsigned long r;
54 __asm__("xor.b %w0,%x0\n\t"
55 "xor.b %x0,%w0\n\t"
56 "xor.b %w0,%x0\n\t"
57 "xor.w %e0,%f0\n\t"
58 "xor.w %f0,%e0\n\t"
59 "xor.w %e0,%f0\n\t"
60 "xor.b %w0,%x0\n\t"
61 "xor.b %x0,%w0\n\t"
62 "xor.b %w0,%x0"
63 :"=r"(r)
64 :"0"(v));
65 return r;
66#else
67 return v;
68#endif
69}
70
71#define readb(addr) \
72 ({ unsigned char __v = \
73 *(volatile unsigned char *)((unsigned long)(addr) & 0x00ffffff); \
74 __v; })
75#define readw(addr) \
76 ({ unsigned short __v = \
77 *(volatile unsigned short *)((unsigned long)(addr) & 0x00ffffff); \
78 __v; })
79#define readl(addr) \
80 ({ unsigned long __v = \
81 *(volatile unsigned long *)((unsigned long)(addr) & 0x00ffffff); \
82 __v; })
83
84#define writeb(b,addr) (void)((*(volatile unsigned char *) \
85 ((unsigned long)(addr) & 0x00ffffff)) = (b))
86#define writew(b,addr) (void)((*(volatile unsigned short *) \
87 ((unsigned long)(addr) & 0x00ffffff)) = (b))
88#define writel(b,addr) (void)((*(volatile unsigned long *) \
89 ((unsigned long)(addr) & 0x00ffffff)) = (b))
90#define readb_relaxed(addr) readb(addr)
91#define readw_relaxed(addr) readw(addr)
92#define readl_relaxed(addr) readl(addr)
93
94#define __raw_readb readb
95#define __raw_readw readw
96#define __raw_readl readl
97#define __raw_writeb writeb
98#define __raw_writew writew
99#define __raw_writel writel
100
101static inline int h8300_buswidth(unsigned int addr)
102{
103 return (*(volatile unsigned char *)ABWCR & (1 << ((addr >> 21) & 7))) == 0;
104}
105
106static inline void io_outsb(unsigned int addr, const void *buf, int len)
107{
108 volatile unsigned char *ap_b = (volatile unsigned char *) addr;
109 volatile unsigned short *ap_w = (volatile unsigned short *) addr;
110 unsigned char *bp = (unsigned char *) buf;
111
112 if(h8300_buswidth(addr) && (addr & 1)) {
113 while (len--)
114 *ap_w = *bp++;
115 } else {
116 while (len--)
117 *ap_b = *bp++;
118 }
119}
120
121static inline void io_outsw(unsigned int addr, const void *buf, int len)
122{
123 volatile unsigned short *ap = (volatile unsigned short *) addr;
124 unsigned short *bp = (unsigned short *) buf;
125 while (len--)
126 *ap = _swapw(*bp++);
127}
128
129static inline void io_outsl(unsigned int addr, const void *buf, int len)
130{
131 volatile unsigned long *ap = (volatile unsigned long *) addr;
132 unsigned long *bp = (unsigned long *) buf;
133 while (len--)
134 *ap = _swapl(*bp++);
135}
136
137static inline void io_outsw_noswap(unsigned int addr, const void *buf, int len)
138{
139 volatile unsigned short *ap = (volatile unsigned short *) addr;
140 unsigned short *bp = (unsigned short *) buf;
141 while (len--)
142 *ap = *bp++;
143}
144
145static inline void io_outsl_noswap(unsigned int addr, const void *buf, int len)
146{
147 volatile unsigned long *ap = (volatile unsigned long *) addr;
148 unsigned long *bp = (unsigned long *) buf;
149 while (len--)
150 *ap = *bp++;
151}
152
153static inline void io_insb(unsigned int addr, void *buf, int len)
154{
155 volatile unsigned char *ap_b;
156 volatile unsigned short *ap_w;
157 unsigned char *bp = (unsigned char *) buf;
158
159 if(h8300_buswidth(addr)) {
160 ap_w = (volatile unsigned short *)(addr & ~1);
161 while (len--)
162 *bp++ = *ap_w & 0xff;
163 } else {
164 ap_b = (volatile unsigned char *)addr;
165 while (len--)
166 *bp++ = *ap_b;
167 }
168}
169
170static inline void io_insw(unsigned int addr, void *buf, int len)
171{
172 volatile unsigned short *ap = (volatile unsigned short *) addr;
173 unsigned short *bp = (unsigned short *) buf;
174 while (len--)
175 *bp++ = _swapw(*ap);
176}
177
178static inline void io_insl(unsigned int addr, void *buf, int len)
179{
180 volatile unsigned long *ap = (volatile unsigned long *) addr;
181 unsigned long *bp = (unsigned long *) buf;
182 while (len--)
183 *bp++ = _swapl(*ap);
184}
185
186static inline void io_insw_noswap(unsigned int addr, void *buf, int len)
187{
188 volatile unsigned short *ap = (volatile unsigned short *) addr;
189 unsigned short *bp = (unsigned short *) buf;
190 while (len--)
191 *bp++ = *ap;
192}
193
194static inline void io_insl_noswap(unsigned int addr, void *buf, int len)
195{
196 volatile unsigned long *ap = (volatile unsigned long *) addr;
197 unsigned long *bp = (unsigned long *) buf;
198 while (len--)
199 *bp++ = *ap;
200}
201
202/*
203 * make the short names macros so specific devices
204 * can override them as required
205 */
206
207#define memset_io(a,b,c) memset((void *)(a),(b),(c))
208#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
209#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
210
211#define mmiowb()
212
213#define inb(addr) ((h8300_buswidth(addr))?readw((addr) & ~1) & 0xff:readb(addr))
214#define inw(addr) _swapw(readw(addr))
215#define inl(addr) _swapl(readl(addr))
216#define outb(x,addr) ((void)((h8300_buswidth(addr) && \
217 ((addr) & 1))?writew(x,(addr) & ~1):writeb(x,addr)))
218#define outw(x,addr) ((void) writew(_swapw(x),addr))
219#define outl(x,addr) ((void) writel(_swapl(x),addr))
220
221#define inb_p(addr) inb(addr)
222#define inw_p(addr) inw(addr)
223#define inl_p(addr) inl(addr)
224#define outb_p(x,addr) outb(x,addr)
225#define outw_p(x,addr) outw(x,addr)
226#define outl_p(x,addr) outl(x,addr)
227
228#define outsb(a,b,l) io_outsb(a,b,l)
229#define outsw(a,b,l) io_outsw(a,b,l)
230#define outsl(a,b,l) io_outsl(a,b,l)
231
232#define insb(a,b,l) io_insb(a,b,l)
233#define insw(a,b,l) io_insw(a,b,l)
234#define insl(a,b,l) io_insl(a,b,l)
235
236#define IO_SPACE_LIMIT 0xffffff
237
238
239/* Values for nocacheflag and cmode */
240#define IOMAP_FULL_CACHING 0
241#define IOMAP_NOCACHE_SER 1
242#define IOMAP_NOCACHE_NONSER 2
243#define IOMAP_WRITETHROUGH 3
244
245extern void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag);
246extern void __iounmap(void *addr, unsigned long size);
247
248static inline void *ioremap(unsigned long physaddr, unsigned long size)
249{
250 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
251}
252static inline void *ioremap_nocache(unsigned long physaddr, unsigned long size)
253{
254 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
255}
256static inline void *ioremap_writethrough(unsigned long physaddr, unsigned long size)
257{
258 return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
259}
260static inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size)
261{
262 return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
263}
264
265extern void iounmap(void *addr);
266
267/* H8/300 internal I/O functions */
268static __inline__ unsigned char ctrl_inb(unsigned long addr)
269{
270 return *(volatile unsigned char*)addr;
271}
272
273static __inline__ unsigned short ctrl_inw(unsigned long addr)
274{
275 return *(volatile unsigned short*)addr;
276}
277
278static __inline__ unsigned long ctrl_inl(unsigned long addr)
279{
280 return *(volatile unsigned long*)addr;
281}
282
283static __inline__ void ctrl_outb(unsigned char b, unsigned long addr)
284{
285 *(volatile unsigned char*)addr = b;
286}
287
288static __inline__ void ctrl_outw(unsigned short b, unsigned long addr)
289{
290 *(volatile unsigned short*)addr = b;
291}
292
293static __inline__ void ctrl_outl(unsigned long b, unsigned long addr)
294{
295 *(volatile unsigned long*)addr = b;
296}
297
298static __inline__ void ctrl_bclr(int b, unsigned long addr)
299{
300 if (__builtin_constant_p(b))
301 switch (b) {
302 case 0: __asm__("bclr #0,@%0"::"r"(addr)); break;
303 case 1: __asm__("bclr #1,@%0"::"r"(addr)); break;
304 case 2: __asm__("bclr #2,@%0"::"r"(addr)); break;
305 case 3: __asm__("bclr #3,@%0"::"r"(addr)); break;
306 case 4: __asm__("bclr #4,@%0"::"r"(addr)); break;
307 case 5: __asm__("bclr #5,@%0"::"r"(addr)); break;
308 case 6: __asm__("bclr #6,@%0"::"r"(addr)); break;
309 case 7: __asm__("bclr #7,@%0"::"r"(addr)); break;
310 }
311 else
312 __asm__("bclr %w0,@%1"::"r"(b), "r"(addr));
313}
314
315static __inline__ void ctrl_bset(int b, unsigned long addr)
316{
317 if (__builtin_constant_p(b))
318 switch (b) {
319 case 0: __asm__("bset #0,@%0"::"r"(addr)); break;
320 case 1: __asm__("bset #1,@%0"::"r"(addr)); break;
321 case 2: __asm__("bset #2,@%0"::"r"(addr)); break;
322 case 3: __asm__("bset #3,@%0"::"r"(addr)); break;
323 case 4: __asm__("bset #4,@%0"::"r"(addr)); break;
324 case 5: __asm__("bset #5,@%0"::"r"(addr)); break;
325 case 6: __asm__("bset #6,@%0"::"r"(addr)); break;
326 case 7: __asm__("bset #7,@%0"::"r"(addr)); break;
327 }
328 else
329 __asm__("bset %w0,@%1"::"r"(b), "r"(addr));
330}
331
332/* Pages to physical address... */
333#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
334#define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT)
335
336/*
337 * Macros used for converting between virtual and physical mappings.
338 */
339#define phys_to_virt(vaddr) ((void *) (vaddr))
340#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
341
342#define virt_to_bus virt_to_phys
343#define bus_to_virt phys_to_virt
344
345/*
346 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
347 * access
348 */
349#define xlate_dev_mem_ptr(p) __va(p)
350
351/*
352 * Convert a virtual cached pointer to an uncached pointer
353 */
354#define xlate_dev_kmem_ptr(p) p
355
356#endif /* __KERNEL__ */
357
358#endif /* _H8300_IO_H */
diff --git a/arch/h8300/include/asm/irq.h b/arch/h8300/include/asm/irq.h
deleted file mode 100644
index 13d7c601cd0a..000000000000
--- a/arch/h8300/include/asm/irq.h
+++ /dev/null
@@ -1,49 +0,0 @@
1#ifndef _H8300_IRQ_H_
2#define _H8300_IRQ_H_
3
4#include <asm/ptrace.h>
5
6#if defined(CONFIG_CPU_H8300H)
7#define NR_IRQS 64
8#define EXT_IRQ0 12
9#define EXT_IRQ1 13
10#define EXT_IRQ2 14
11#define EXT_IRQ3 15
12#define EXT_IRQ4 16
13#define EXT_IRQ5 17
14#define EXT_IRQ6 18
15#define EXT_IRQ7 19
16#define EXT_IRQS 5
17#define IER_REGS *(volatile unsigned char *)IER
18#endif
19#if defined(CONFIG_CPU_H8S)
20#define NR_IRQS 128
21#define EXT_IRQ0 16
22#define EXT_IRQ1 17
23#define EXT_IRQ2 18
24#define EXT_IRQ3 19
25#define EXT_IRQ4 20
26#define EXT_IRQ5 21
27#define EXT_IRQ6 22
28#define EXT_IRQ7 23
29#define EXT_IRQ8 24
30#define EXT_IRQ9 25
31#define EXT_IRQ10 26
32#define EXT_IRQ11 27
33#define EXT_IRQ12 28
34#define EXT_IRQ13 29
35#define EXT_IRQ14 30
36#define EXT_IRQ15 31
37#define EXT_IRQS 15
38
39#define IER_REGS *(volatile unsigned short *)IER
40#endif
41
42static __inline__ int irq_canonicalize(int irq)
43{
44 return irq;
45}
46
47typedef void (*h8300_vector)(void);
48
49#endif /* _H8300_IRQ_H_ */
diff --git a/arch/h8300/include/asm/irq_regs.h b/arch/h8300/include/asm/irq_regs.h
deleted file mode 100644
index 3dd9c0b70270..000000000000
--- a/arch/h8300/include/asm/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/arch/h8300/include/asm/irqflags.h b/arch/h8300/include/asm/irqflags.h
deleted file mode 100644
index 9617cd57aebd..000000000000
--- a/arch/h8300/include/asm/irqflags.h
+++ /dev/null
@@ -1,43 +0,0 @@
1#ifndef _H8300_IRQFLAGS_H
2#define _H8300_IRQFLAGS_H
3
4static inline unsigned long arch_local_save_flags(void)
5{
6 unsigned long flags;
7 asm volatile ("stc ccr,%w0" : "=r" (flags));
8 return flags;
9}
10
11static inline void arch_local_irq_disable(void)
12{
13 asm volatile ("orc #0x80,ccr" : : : "memory");
14}
15
16static inline void arch_local_irq_enable(void)
17{
18 asm volatile ("andc #0x7f,ccr" : : : "memory");
19}
20
21static inline unsigned long arch_local_irq_save(void)
22{
23 unsigned long flags = arch_local_save_flags();
24 arch_local_irq_disable();
25 return flags;
26}
27
28static inline void arch_local_irq_restore(unsigned long flags)
29{
30 asm volatile ("ldc %w0,ccr" : : "r" (flags) : "memory");
31}
32
33static inline bool arch_irqs_disabled_flags(unsigned long flags)
34{
35 return (flags & 0x80) == 0x80;
36}
37
38static inline bool arch_irqs_disabled(void)
39{
40 return arch_irqs_disabled_flags(arch_local_save_flags());
41}
42
43#endif /* _H8300_IRQFLAGS_H */
diff --git a/arch/h8300/include/asm/kdebug.h b/arch/h8300/include/asm/kdebug.h
deleted file mode 100644
index 6ece1b037665..000000000000
--- a/arch/h8300/include/asm/kdebug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kdebug.h>
diff --git a/arch/h8300/include/asm/kmap_types.h b/arch/h8300/include/asm/kmap_types.h
deleted file mode 100644
index be12a7160116..000000000000
--- a/arch/h8300/include/asm/kmap_types.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_H8300_KMAP_TYPES_H
2#define _ASM_H8300_KMAP_TYPES_H
3
4#include <asm-generic/kmap_types.h>
5
6#endif
diff --git a/arch/h8300/include/asm/local.h b/arch/h8300/include/asm/local.h
deleted file mode 100644
index fdd4efe437cd..000000000000
--- a/arch/h8300/include/asm/local.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _H8300_LOCAL_H_
2#define _H8300_LOCAL_H_
3
4#include <asm-generic/local.h>
5
6#endif
diff --git a/arch/h8300/include/asm/local64.h b/arch/h8300/include/asm/local64.h
deleted file mode 100644
index 36c93b5cc239..000000000000
--- a/arch/h8300/include/asm/local64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/local64.h>
diff --git a/arch/h8300/include/asm/mc146818rtc.h b/arch/h8300/include/asm/mc146818rtc.h
deleted file mode 100644
index ab9d9646d241..000000000000
--- a/arch/h8300/include/asm/mc146818rtc.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * Machine dependent access functions for RTC registers.
3 */
4#ifndef _H8300_MC146818RTC_H
5#define _H8300_MC146818RTC_H
6
7/* empty include file to satisfy the include in genrtc.c/ide-geometry.c */
8
9#endif /* _H8300_MC146818RTC_H */
diff --git a/arch/h8300/include/asm/mmu_context.h b/arch/h8300/include/asm/mmu_context.h
deleted file mode 100644
index f44b730da54d..000000000000
--- a/arch/h8300/include/asm/mmu_context.h
+++ /dev/null
@@ -1,32 +0,0 @@
1#ifndef __H8300_MMU_CONTEXT_H
2#define __H8300_MMU_CONTEXT_H
3
4#include <asm/setup.h>
5#include <asm/page.h>
6#include <asm/pgalloc.h>
7#include <asm-generic/mm_hooks.h>
8
9static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
10{
11}
12
13static inline int
14init_new_context(struct task_struct *tsk, struct mm_struct *mm)
15{
16 // mm->context = virt_to_phys(mm->pgd);
17 return(0);
18}
19
20#define destroy_context(mm) do { } while(0)
21#define deactivate_mm(tsk,mm) do { } while(0)
22
23static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
24{
25}
26
27static inline void activate_mm(struct mm_struct *prev_mm,
28 struct mm_struct *next_mm)
29{
30}
31
32#endif
diff --git a/arch/h8300/include/asm/mutex.h b/arch/h8300/include/asm/mutex.h
deleted file mode 100644
index 458c1f7fbc18..000000000000
--- a/arch/h8300/include/asm/mutex.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * Pull in the generic implementation for the mutex fastpath.
3 *
4 * TODO: implement optimized primitives instead, or leave the generic
5 * implementation in place, or pick the atomic_xchg() based generic
6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */
8
9#include <asm-generic/mutex-dec.h>
diff --git a/arch/h8300/include/asm/page.h b/arch/h8300/include/asm/page.h
deleted file mode 100644
index 837381a2df46..000000000000
--- a/arch/h8300/include/asm/page.h
+++ /dev/null
@@ -1,78 +0,0 @@
1#ifndef _H8300_PAGE_H
2#define _H8300_PAGE_H
3
4/* PAGE_SHIFT determines the page size */
5
6#define PAGE_SHIFT (12)
7#define PAGE_SIZE (1UL << PAGE_SHIFT)
8#define PAGE_MASK (~(PAGE_SIZE-1))
9
10#include <asm/setup.h>
11
12#ifndef __ASSEMBLY__
13
14#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
15#define free_user_page(page, addr) free_page(addr)
16
17#define clear_page(page) memset((page), 0, PAGE_SIZE)
18#define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
19
20#define clear_user_page(page, vaddr, pg) clear_page(page)
21#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
22
23#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
24 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
25#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
26
27/*
28 * These are used to make use of C type-checking..
29 */
30typedef struct { unsigned long pte; } pte_t;
31typedef struct { unsigned long pmd[16]; } pmd_t;
32typedef struct { unsigned long pgd; } pgd_t;
33typedef struct { unsigned long pgprot; } pgprot_t;
34typedef struct page *pgtable_t;
35
36#define pte_val(x) ((x).pte)
37#define pmd_val(x) ((&x)->pmd[0])
38#define pgd_val(x) ((x).pgd)
39#define pgprot_val(x) ((x).pgprot)
40
41#define __pte(x) ((pte_t) { (x) } )
42#define __pmd(x) ((pmd_t) { (x) } )
43#define __pgd(x) ((pgd_t) { (x) } )
44#define __pgprot(x) ((pgprot_t) { (x) } )
45
46extern unsigned long memory_start;
47extern unsigned long memory_end;
48
49#endif /* !__ASSEMBLY__ */
50
51#include <asm/page_offset.h>
52
53#define PAGE_OFFSET (PAGE_OFFSET_RAW)
54
55#ifndef __ASSEMBLY__
56
57#define __pa(vaddr) virt_to_phys(vaddr)
58#define __va(paddr) phys_to_virt((unsigned long)paddr)
59
60#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
61#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
62
63#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
64#define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
65#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
66#define pfn_valid(page) (page < max_mapnr)
67
68#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
69
70#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
71 ((void *)(kaddr) < (void *)memory_end))
72
73#endif /* __ASSEMBLY__ */
74
75#include <asm-generic/memory_model.h>
76#include <asm-generic/getorder.h>
77
78#endif /* _H8300_PAGE_H */
diff --git a/arch/h8300/include/asm/page_offset.h b/arch/h8300/include/asm/page_offset.h
deleted file mode 100644
index f8706463008c..000000000000
--- a/arch/h8300/include/asm/page_offset.h
+++ /dev/null
@@ -1,3 +0,0 @@
1
2#define PAGE_OFFSET_RAW 0x00000000
3
diff --git a/arch/h8300/include/asm/param.h b/arch/h8300/include/asm/param.h
deleted file mode 100644
index c3909e7ff178..000000000000
--- a/arch/h8300/include/asm/param.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _H8300_PARAM_H
2#define _H8300_PARAM_H
3
4#include <uapi/asm/param.h>
5
6#define HZ CONFIG_HZ
7#define USER_HZ HZ
8#define CLOCKS_PER_SEC (USER_HZ)
9#endif /* _H8300_PARAM_H */
diff --git a/arch/h8300/include/asm/pci.h b/arch/h8300/include/asm/pci.h
deleted file mode 100644
index 0b2acaa3dd84..000000000000
--- a/arch/h8300/include/asm/pci.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef _ASM_H8300_PCI_H
2#define _ASM_H8300_PCI_H
3
4/*
5 * asm-h8300/pci.h - H8/300 specific PCI declarations.
6 *
7 * Yoshinori Sato <ysato@users.sourceforge.jp>
8 */
9
10#define pcibios_assign_all_busses() 0
11
12static inline void pcibios_penalize_isa_irq(int irq, int active)
13{
14 /* We don't do dynamic PCI IRQ allocation */
15}
16
17#define PCI_DMA_BUS_IS_PHYS (1)
18
19#endif /* _ASM_H8300_PCI_H */
diff --git a/arch/h8300/include/asm/percpu.h b/arch/h8300/include/asm/percpu.h
deleted file mode 100644
index 72c03e3666d8..000000000000
--- a/arch/h8300/include/asm/percpu.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ARCH_H8300_PERCPU__
2#define __ARCH_H8300_PERCPU__
3
4#include <asm-generic/percpu.h>
5
6#endif /* __ARCH_H8300_PERCPU__ */
diff --git a/arch/h8300/include/asm/pgalloc.h b/arch/h8300/include/asm/pgalloc.h
deleted file mode 100644
index c2e89a286d23..000000000000
--- a/arch/h8300/include/asm/pgalloc.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _H8300_PGALLOC_H
2#define _H8300_PGALLOC_H
3
4#include <asm/setup.h>
5
6#define check_pgt_cache() do { } while (0)
7
8#endif /* _H8300_PGALLOC_H */
diff --git a/arch/h8300/include/asm/pgtable.h b/arch/h8300/include/asm/pgtable.h
deleted file mode 100644
index 7ca20f894dd7..000000000000
--- a/arch/h8300/include/asm/pgtable.h
+++ /dev/null
@@ -1,73 +0,0 @@
1#ifndef _H8300_PGTABLE_H
2#define _H8300_PGTABLE_H
3
4#include <asm-generic/4level-fixup.h>
5
6#include <linux/slab.h>
7#include <asm/processor.h>
8#include <asm/page.h>
9#include <asm/io.h>
10
11#define pgd_present(pgd) (1) /* pages are always present on NO_MM */
12#define pgd_none(pgd) (0)
13#define pgd_bad(pgd) (0)
14#define pgd_clear(pgdp)
15#define kern_addr_valid(addr) (1)
16#define pmd_offset(a, b) ((void *)0)
17#define pmd_none(pmd) (1)
18#define pgd_offset_k(adrdress) ((pgd_t *)0)
19#define pte_offset_kernel(dir, address) ((pte_t *)0)
20
21#define PAGE_NONE __pgprot(0) /* these mean nothing to NO_MM */
22#define PAGE_SHARED __pgprot(0) /* these mean nothing to NO_MM */
23#define PAGE_COPY __pgprot(0) /* these mean nothing to NO_MM */
24#define PAGE_READONLY __pgprot(0) /* these mean nothing to NO_MM */
25#define PAGE_KERNEL __pgprot(0) /* these mean nothing to NO_MM */
26
27extern void paging_init(void);
28#define swapper_pg_dir ((pgd_t *) 0)
29
30#define __swp_type(x) (0)
31#define __swp_offset(x) (0)
32#define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) })
33#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
34#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
35
36static inline int pte_file(pte_t pte) { return 0; }
37
38/*
39 * ZERO_PAGE is a global shared page that is always zero: used
40 * for zero-mapped memory areas etc..
41 */
42#define ZERO_PAGE(vaddr) (virt_to_page(0))
43
44/*
45 * These would be in other places but having them here reduces the diffs.
46 */
47extern unsigned int kobjsize(const void *objp);
48extern int is_in_rom(unsigned long);
49
50/*
51 * No page table caches to initialise
52 */
53#define pgtable_cache_init() do { } while (0)
54
55/*
56 * All 32bit addresses are effectively valid for vmalloc...
57 * Sort of meaningless for non-VM targets.
58 */
59#define VMALLOC_START 0
60#define VMALLOC_END 0xffffffff
61
62/*
63 * All 32bit addresses are effectively valid for vmalloc...
64 * Sort of meaningless for non-VM targets.
65 */
66#define VMALLOC_START 0
67#define VMALLOC_END 0xffffffff
68
69#define arch_enter_lazy_cpu_mode() do {} while (0)
70
71#include <asm-generic/pgtable.h>
72
73#endif /* _H8300_PGTABLE_H */
diff --git a/arch/h8300/include/asm/processor.h b/arch/h8300/include/asm/processor.h
deleted file mode 100644
index 4b0ca49bb463..000000000000
--- a/arch/h8300/include/asm/processor.h
+++ /dev/null
@@ -1,139 +0,0 @@
1/*
2 * include/asm-h8300/processor.h
3 *
4 * Copyright (C) 2002 Yoshinori Sato
5 *
6 * Based on: linux/asm-m68nommu/processor.h
7 *
8 * Copyright (C) 1995 Hamish Macdonald
9 */
10
11#ifndef __ASM_H8300_PROCESSOR_H
12#define __ASM_H8300_PROCESSOR_H
13
14/*
15 * Default implementation of macro that returns current
16 * instruction pointer ("program counter").
17 */
18#define current_text_addr() ({ __label__ _l; _l: &&_l;})
19
20#include <linux/compiler.h>
21#include <asm/segment.h>
22#include <asm/fpu.h>
23#include <asm/ptrace.h>
24#include <asm/current.h>
25
26static inline unsigned long rdusp(void) {
27 extern unsigned int sw_usp;
28 return(sw_usp);
29}
30
31static inline void wrusp(unsigned long usp) {
32 extern unsigned int sw_usp;
33 sw_usp = usp;
34}
35
36/*
37 * User space process size: 3.75GB. This is hardcoded into a few places,
38 * so don't change it unless you know what you are doing.
39 */
40#define TASK_SIZE (0xFFFFFFFFUL)
41
42#ifdef __KERNEL__
43#define STACK_TOP TASK_SIZE
44#define STACK_TOP_MAX STACK_TOP
45#endif
46
47/*
48 * This decides where the kernel will search for a free chunk of vm
49 * space during mmap's. We won't be using it
50 */
51#define TASK_UNMAPPED_BASE 0
52
53struct thread_struct {
54 unsigned long ksp; /* kernel stack pointer */
55 unsigned long usp; /* user stack pointer */
56 unsigned long ccr; /* saved status register */
57 unsigned long esp0; /* points to SR of stack frame */
58 struct {
59 unsigned short *addr;
60 unsigned short inst;
61 } breakinfo;
62};
63
64#define INIT_THREAD { \
65 .ksp = sizeof(init_stack) + (unsigned long)init_stack, \
66 .usp = 0, \
67 .ccr = PS_S, \
68 .esp0 = 0, \
69 .breakinfo = { \
70 .addr = (unsigned short *)-1, \
71 .inst = 0 \
72 } \
73}
74
75/*
76 * Do necessary setup to start up a newly executed thread.
77 *
78 * pass the data segment into user programs if it exists,
79 * it can't hurt anything as far as I can tell
80 */
81#if defined(__H8300H__)
82#define start_thread(_regs, _pc, _usp) \
83do { \
84 (_regs)->pc = (_pc); \
85 (_regs)->ccr = 0x00; /* clear all flags */ \
86 (_regs)->er5 = current->mm->start_data; /* GOT base */ \
87 wrusp((unsigned long)(_usp) - sizeof(unsigned long)*3); \
88} while(0)
89#endif
90#if defined(__H8300S__)
91#define start_thread(_regs, _pc, _usp) \
92do { \
93 (_regs)->pc = (_pc); \
94 (_regs)->ccr = 0x00; /* clear kernel flag */ \
95 (_regs)->exr = 0x78; /* enable all interrupts */ \
96 (_regs)->er5 = current->mm->start_data; /* GOT base */ \
97 /* 14 = space for retaddr(4), vector(4), er0(4) and ext(2) on stack */ \
98 wrusp(((unsigned long)(_usp)) - 14); \
99} while(0)
100#endif
101
102/* Forward declaration, a strange C thing */
103struct task_struct;
104
105/* Free all resources held by a thread. */
106static inline void release_thread(struct task_struct *dead_task)
107{
108}
109
110/*
111 * Free current thread data structures etc..
112 */
113static inline void exit_thread(void)
114{
115}
116
117/*
118 * Return saved PC of a blocked thread.
119 */
120unsigned long thread_saved_pc(struct task_struct *tsk);
121unsigned long get_wchan(struct task_struct *p);
122
123#define KSTK_EIP(tsk) \
124 ({ \
125 unsigned long eip = 0; \
126 if ((tsk)->thread.esp0 > PAGE_SIZE && \
127 MAP_NR((tsk)->thread.esp0) < max_mapnr) \
128 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
129 eip; })
130#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
131
132#define cpu_relax() barrier()
133
134#define HARD_RESET_NOW() ({ \
135 local_irq_disable(); \
136 asm("jmp @@0"); \
137})
138
139#endif
diff --git a/arch/h8300/include/asm/ptrace.h b/arch/h8300/include/asm/ptrace.h
deleted file mode 100644
index c1826b95c5ca..000000000000
--- a/arch/h8300/include/asm/ptrace.h
+++ /dev/null
@@ -1,33 +0,0 @@
1#ifndef _H8300_PTRACE_H
2#define _H8300_PTRACE_H
3
4#include <uapi/asm/ptrace.h>
5
6#ifndef __ASSEMBLY__
7#if defined(CONFIG_CPU_H8S)
8#endif
9#ifndef PS_S
10#define PS_S (0x10)
11#endif
12
13#if defined(__H8300H__)
14#define H8300_REGS_NO 11
15#endif
16#if defined(__H8300S__)
17#define H8300_REGS_NO 12
18#endif
19
20/* Find the stack offset for a register, relative to thread.esp0. */
21#define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg)
22
23#define arch_has_single_step() (1)
24
25#define user_mode(regs) (!((regs)->ccr & PS_S))
26#define instruction_pointer(regs) ((regs)->pc)
27#define profile_pc(regs) instruction_pointer(regs)
28#define current_pt_regs() ((struct pt_regs *) \
29 (THREAD_SIZE + (unsigned long)current_thread_info()) - 1)
30#define signal_pt_regs() ((struct pt_regs *)current->thread.esp0)
31#define current_user_stack_pointer() rdusp()
32#endif /* __ASSEMBLY__ */
33#endif /* _H8300_PTRACE_H */
diff --git a/arch/h8300/include/asm/regs267x.h b/arch/h8300/include/asm/regs267x.h
deleted file mode 100644
index 1bff731a9f77..000000000000
--- a/arch/h8300/include/asm/regs267x.h
+++ /dev/null
@@ -1,336 +0,0 @@
1/* internal Peripherals Register address define */
2/* CPU: H8/306x */
3
4#if !defined(__REGS_H8S267x__)
5#define __REGS_H8S267x__
6
7#if defined(__KERNEL__)
8
9#define DASTCR 0xFEE01A
10#define DADR0 0xFFFFA4
11#define DADR1 0xFFFFA5
12#define DACR01 0xFFFFA6
13#define DADR2 0xFFFFA8
14#define DADR3 0xFFFFA9
15#define DACR23 0xFFFFAA
16
17#define ADDRA 0xFFFF90
18#define ADDRAH 0xFFFF90
19#define ADDRAL 0xFFFF91
20#define ADDRB 0xFFFF92
21#define ADDRBH 0xFFFF92
22#define ADDRBL 0xFFFF93
23#define ADDRC 0xFFFF94
24#define ADDRCH 0xFFFF94
25#define ADDRCL 0xFFFF95
26#define ADDRD 0xFFFF96
27#define ADDRDH 0xFFFF96
28#define ADDRDL 0xFFFF97
29#define ADDRE 0xFFFF98
30#define ADDREH 0xFFFF98
31#define ADDREL 0xFFFF99
32#define ADDRF 0xFFFF9A
33#define ADDRFH 0xFFFF9A
34#define ADDRFL 0xFFFF9B
35#define ADDRG 0xFFFF9C
36#define ADDRGH 0xFFFF9C
37#define ADDRGL 0xFFFF9D
38#define ADDRH 0xFFFF9E
39#define ADDRHH 0xFFFF9E
40#define ADDRHL 0xFFFF9F
41
42#define ADCSR 0xFFFFA0
43#define ADCR 0xFFFFA1
44
45#define ABWCR 0xFFFEC0
46#define ASTCR 0xFFFEC1
47#define WTCRAH 0xFFFEC2
48#define WTCRAL 0xFFFEC3
49#define WTCRBH 0xFFFEC4
50#define WTCRBL 0xFFFEC5
51#define RDNCR 0xFFFEC6
52#define CSACRH 0xFFFEC8
53#define CSACRL 0xFFFEC9
54#define BROMCRH 0xFFFECA
55#define BROMCRL 0xFFFECB
56#define BCR 0xFFFECC
57#define DRAMCR 0xFFFED0
58#define DRACCR 0xFFFED2
59#define REFCR 0xFFFED4
60#define RTCNT 0xFFFED6
61#define RTCOR 0xFFFED7
62
63#define MAR0AH 0xFFFEE0
64#define MAR0AL 0xFFFEE2
65#define IOAR0A 0xFFFEE4
66#define ETCR0A 0xFFFEE6
67#define MAR0BH 0xFFFEE8
68#define MAR0BL 0xFFFEEA
69#define IOAR0B 0xFFFEEC
70#define ETCR0B 0xFFFEEE
71#define MAR1AH 0xFFFEF0
72#define MAR1AL 0xFFFEF2
73#define IOAR1A 0xFFFEF4
74#define ETCR1A 0xFFFEF6
75#define MAR1BH 0xFFFEF8
76#define MAR1BL 0xFFFEFA
77#define IOAR1B 0xFFFEFC
78#define ETCR1B 0xFFFEFE
79#define DMAWER 0xFFFF20
80#define DMATCR 0xFFFF21
81#define DMACR0A 0xFFFF22
82#define DMACR0B 0xFFFF23
83#define DMACR1A 0xFFFF24
84#define DMACR1B 0xFFFF25
85#define DMABCRH 0xFFFF26
86#define DMABCRL 0xFFFF27
87
88#define EDSAR0 0xFFFDC0
89#define EDDAR0 0xFFFDC4
90#define EDTCR0 0xFFFDC8
91#define EDMDR0 0xFFFDCC
92#define EDMDR0H 0xFFFDCC
93#define EDMDR0L 0xFFFDCD
94#define EDACR0 0xFFFDCE
95#define EDSAR1 0xFFFDD0
96#define EDDAR1 0xFFFDD4
97#define EDTCR1 0xFFFDD8
98#define EDMDR1 0xFFFDDC
99#define EDMDR1H 0xFFFDDC
100#define EDMDR1L 0xFFFDDD
101#define EDACR1 0xFFFDDE
102#define EDSAR2 0xFFFDE0
103#define EDDAR2 0xFFFDE4
104#define EDTCR2 0xFFFDE8
105#define EDMDR2 0xFFFDEC
106#define EDMDR2H 0xFFFDEC
107#define EDMDR2L 0xFFFDED
108#define EDACR2 0xFFFDEE
109#define EDSAR3 0xFFFDF0
110#define EDDAR3 0xFFFDF4
111#define EDTCR3 0xFFFDF8
112#define EDMDR3 0xFFFDFC
113#define EDMDR3H 0xFFFDFC
114#define EDMDR3L 0xFFFDFD
115#define EDACR3 0xFFFDFE
116
117#define IPRA 0xFFFE00
118#define IPRB 0xFFFE02
119#define IPRC 0xFFFE04
120#define IPRD 0xFFFE06
121#define IPRE 0xFFFE08
122#define IPRF 0xFFFE0A
123#define IPRG 0xFFFE0C
124#define IPRH 0xFFFE0E
125#define IPRI 0xFFFE10
126#define IPRJ 0xFFFE12
127#define IPRK 0xFFFE14
128#define ITSR 0xFFFE16
129#define SSIER 0xFFFE18
130#define ISCRH 0xFFFE1A
131#define ISCRL 0xFFFE1C
132
133#define INTCR 0xFFFF31
134#define IER 0xFFFF32
135#define IERH 0xFFFF32
136#define IERL 0xFFFF33
137#define ISR 0xFFFF34
138#define ISRH 0xFFFF34
139#define ISRL 0xFFFF35
140
141#define P1DDR 0xFFFE20
142#define P2DDR 0xFFFE21
143#define P3DDR 0xFFFE22
144#define P4DDR 0xFFFE23
145#define P5DDR 0xFFFE24
146#define P6DDR 0xFFFE25
147#define P7DDR 0xFFFE26
148#define P8DDR 0xFFFE27
149#define P9DDR 0xFFFE28
150#define PADDR 0xFFFE29
151#define PBDDR 0xFFFE2A
152#define PCDDR 0xFFFE2B
153#define PDDDR 0xFFFE2C
154#define PEDDR 0xFFFE2D
155#define PFDDR 0xFFFE2E
156#define PGDDR 0xFFFE2F
157#define PHDDR 0xFFFF74
158
159#define PFCR0 0xFFFE32
160#define PFCR1 0xFFFE33
161#define PFCR2 0xFFFE34
162
163#define PAPCR 0xFFFE36
164#define PBPCR 0xFFFE37
165#define PCPCR 0xFFFE38
166#define PDPCR 0xFFFE39
167#define PEPCR 0xFFFE3A
168
169#define P3ODR 0xFFFE3C
170#define PAODR 0xFFFE3D
171
172#define P1DR 0xFFFF60
173#define P2DR 0xFFFF61
174#define P3DR 0xFFFF62
175#define P4DR 0xFFFF63
176#define P5DR 0xFFFF64
177#define P6DR 0xFFFF65
178#define P7DR 0xFFFF66
179#define P8DR 0xFFFF67
180#define P9DR 0xFFFF68
181#define PADR 0xFFFF69
182#define PBDR 0xFFFF6A
183#define PCDR 0xFFFF6B
184#define PDDR 0xFFFF6C
185#define PEDR 0xFFFF6D
186#define PFDR 0xFFFF6E
187#define PGDR 0xFFFF6F
188#define PHDR 0xFFFF72
189
190#define PORT1 0xFFFF50
191#define PORT2 0xFFFF51
192#define PORT3 0xFFFF52
193#define PORT4 0xFFFF53
194#define PORT5 0xFFFF54
195#define PORT6 0xFFFF55
196#define PORT7 0xFFFF56
197#define PORT8 0xFFFF57
198#define PORT9 0xFFFF58
199#define PORTA 0xFFFF59
200#define PORTB 0xFFFF5A
201#define PORTC 0xFFFF5B
202#define PORTD 0xFFFF5C
203#define PORTE 0xFFFF5D
204#define PORTF 0xFFFF5E
205#define PORTG 0xFFFF5F
206#define PORTH 0xFFFF70
207
208#define PCR 0xFFFF46
209#define PMR 0xFFFF47
210#define NDERH 0xFFFF48
211#define NDERL 0xFFFF49
212#define PODRH 0xFFFF4A
213#define PODRL 0xFFFF4B
214#define NDRH1 0xFFFF4C
215#define NDRL1 0xFFFF4D
216#define NDRH2 0xFFFF4E
217#define NDRL2 0xFFFF4F
218
219#define SMR0 0xFFFF78
220#define BRR0 0xFFFF79
221#define SCR0 0xFFFF7A
222#define TDR0 0xFFFF7B
223#define SSR0 0xFFFF7C
224#define RDR0 0xFFFF7D
225#define SCMR0 0xFFFF7E
226#define SMR1 0xFFFF80
227#define BRR1 0xFFFF81
228#define SCR1 0xFFFF82
229#define TDR1 0xFFFF83
230#define SSR1 0xFFFF84
231#define RDR1 0xFFFF85
232#define SCMR1 0xFFFF86
233#define SMR2 0xFFFF88
234#define BRR2 0xFFFF89
235#define SCR2 0xFFFF8A
236#define TDR2 0xFFFF8B
237#define SSR2 0xFFFF8C
238#define RDR2 0xFFFF8D
239#define SCMR2 0xFFFF8E
240
241#define IRCR0 0xFFFE1E
242#define SEMR 0xFFFDA8
243
244#define MDCR 0xFFFF3E
245#define SYSCR 0xFFFF3D
246#define MSTPCRH 0xFFFF40
247#define MSTPCRL 0xFFFF41
248#define FLMCR1 0xFFFFC8
249#define FLMCR2 0xFFFFC9
250#define EBR1 0xFFFFCA
251#define EBR2 0xFFFFCB
252#define CTGARC_RAMCR 0xFFFECE
253#define SBYCR 0xFFFF3A
254#define SCKCR 0xFFFF3B
255#define PLLCR 0xFFFF45
256
257#define TSTR 0xFFFFC0
258#define TSNC 0XFFFFC1
259
260#define TCR0 0xFFFFD0
261#define TMDR0 0xFFFFD1
262#define TIORH0 0xFFFFD2
263#define TIORL0 0xFFFFD3
264#define TIER0 0xFFFFD4
265#define TSR0 0xFFFFD5
266#define TCNT0 0xFFFFD6
267#define GRA0 0xFFFFD8
268#define GRB0 0xFFFFDA
269#define GRC0 0xFFFFDC
270#define GRD0 0xFFFFDE
271#define TCR1 0xFFFFE0
272#define TMDR1 0xFFFFE1
273#define TIORH1 0xFFFFE2
274#define TIORL1 0xFFFFE3
275#define TIER1 0xFFFFE4
276#define TSR1 0xFFFFE5
277#define TCNT1 0xFFFFE6
278#define GRA1 0xFFFFE8
279#define GRB1 0xFFFFEA
280#define TCR2 0xFFFFF0
281#define TMDR2 0xFFFFF1
282#define TIORH2 0xFFFFF2
283#define TIORL2 0xFFFFF3
284#define TIER2 0xFFFFF4
285#define TSR2 0xFFFFF5
286#define TCNT2 0xFFFFF6
287#define GRA2 0xFFFFF8
288#define GRB2 0xFFFFFA
289#define TCR3 0xFFFE80
290#define TMDR3 0xFFFE81
291#define TIORH3 0xFFFE82
292#define TIORL3 0xFFFE83
293#define TIER3 0xFFFE84
294#define TSR3 0xFFFE85
295#define TCNT3 0xFFFE86
296#define GRA3 0xFFFE88
297#define GRB3 0xFFFE8A
298#define GRC3 0xFFFE8C
299#define GRD3 0xFFFE8E
300#define TCR4 0xFFFE90
301#define TMDR4 0xFFFE91
302#define TIORH4 0xFFFE92
303#define TIORL4 0xFFFE93
304#define TIER4 0xFFFE94
305#define TSR4 0xFFFE95
306#define TCNT4 0xFFFE96
307#define GRA4 0xFFFE98
308#define GRB4 0xFFFE9A
309#define TCR5 0xFFFEA0
310#define TMDR5 0xFFFEA1
311#define TIORH5 0xFFFEA2
312#define TIORL5 0xFFFEA3
313#define TIER5 0xFFFEA4
314#define TSR5 0xFFFEA5
315#define TCNT5 0xFFFEA6
316#define GRA5 0xFFFEA8
317#define GRB5 0xFFFEAA
318
319#define _8TCR0 0xFFFFB0
320#define _8TCR1 0xFFFFB1
321#define _8TCSR0 0xFFFFB2
322#define _8TCSR1 0xFFFFB3
323#define _8TCORA0 0xFFFFB4
324#define _8TCORA1 0xFFFFB5
325#define _8TCORB0 0xFFFFB6
326#define _8TCORB1 0xFFFFB7
327#define _8TCNT0 0xFFFFB8
328#define _8TCNT1 0xFFFFB9
329
330#define TCSR 0xFFFFBC
331#define TCNT 0xFFFFBD
332#define RSTCSRW 0xFFFFBE
333#define RSTCSRR 0xFFFFBF
334
335#endif /* __KERNEL__ */
336#endif /* __REGS_H8S267x__ */
diff --git a/arch/h8300/include/asm/regs306x.h b/arch/h8300/include/asm/regs306x.h
deleted file mode 100644
index 027dd633fa25..000000000000
--- a/arch/h8300/include/asm/regs306x.h
+++ /dev/null
@@ -1,212 +0,0 @@
1/* internal Peripherals Register address define */
2/* CPU: H8/306x */
3
4#if !defined(__REGS_H8306x__)
5#define __REGS_H8306x__
6
7#if defined(__KERNEL__)
8
9#define DASTCR 0xFEE01A
10#define DADR0 0xFEE09C
11#define DADR1 0xFEE09D
12#define DACR 0xFEE09E
13
14#define ADDRAH 0xFFFFE0
15#define ADDRAL 0xFFFFE1
16#define ADDRBH 0xFFFFE2
17#define ADDRBL 0xFFFFE3
18#define ADDRCH 0xFFFFE4
19#define ADDRCL 0xFFFFE5
20#define ADDRDH 0xFFFFE6
21#define ADDRDL 0xFFFFE7
22#define ADCSR 0xFFFFE8
23#define ADCR 0xFFFFE9
24
25#define BRCR 0xFEE013
26#define ADRCR 0xFEE01E
27#define CSCR 0xFEE01F
28#define ABWCR 0xFEE020
29#define ASTCR 0xFEE021
30#define WCRH 0xFEE022
31#define WCRL 0xFEE023
32#define BCR 0xFEE024
33#define DRCRA 0xFEE026
34#define DRCRB 0xFEE027
35#define RTMCSR 0xFEE028
36#define RTCNT 0xFEE029
37#define RTCOR 0xFEE02A
38
39#define MAR0AR 0xFFFF20
40#define MAR0AE 0xFFFF21
41#define MAR0AH 0xFFFF22
42#define MAR0AL 0xFFFF23
43#define ETCR0AL 0xFFFF24
44#define ETCR0AH 0xFFFF25
45#define IOAR0A 0xFFFF26
46#define DTCR0A 0xFFFF27
47#define MAR0BR 0xFFFF28
48#define MAR0BE 0xFFFF29
49#define MAR0BH 0xFFFF2A
50#define MAR0BL 0xFFFF2B
51#define ETCR0BL 0xFFFF2C
52#define ETCR0BH 0xFFFF2D
53#define IOAR0B 0xFFFF2E
54#define DTCR0B 0xFFFF2F
55#define MAR1AR 0xFFFF30
56#define MAR1AE 0xFFFF31
57#define MAR1AH 0xFFFF32
58#define MAR1AL 0xFFFF33
59#define ETCR1AL 0xFFFF34
60#define ETCR1AH 0xFFFF35
61#define IOAR1A 0xFFFF36
62#define DTCR1A 0xFFFF37
63#define MAR1BR 0xFFFF38
64#define MAR1BE 0xFFFF39
65#define MAR1BH 0xFFFF3A
66#define MAR1BL 0xFFFF3B
67#define ETCR1BL 0xFFFF3C
68#define ETCR1BH 0xFFFF3D
69#define IOAR1B 0xFFFF3E
70#define DTCR1B 0xFFFF3F
71
72#define ISCR 0xFEE014
73#define IER 0xFEE015
74#define ISR 0xFEE016
75#define IPRA 0xFEE018
76#define IPRB 0xFEE019
77
78#define P1DDR 0xFEE000
79#define P2DDR 0xFEE001
80#define P3DDR 0xFEE002
81#define P4DDR 0xFEE003
82#define P5DDR 0xFEE004
83#define P6DDR 0xFEE005
84/*#define P7DDR 0xFEE006*/
85#define P8DDR 0xFEE007
86#define P9DDR 0xFEE008
87#define PADDR 0xFEE009
88#define PBDDR 0xFEE00A
89
90#define P1DR 0xFFFFD0
91#define P2DR 0xFFFFD1
92#define P3DR 0xFFFFD2
93#define P4DR 0xFFFFD3
94#define P5DR 0xFFFFD4
95#define P6DR 0xFFFFD5
96/*#define P7DR 0xFFFFD6*/
97#define P8DR 0xFFFFD7
98#define P9DR 0xFFFFD8
99#define PADR 0xFFFFD9
100#define PBDR 0xFFFFDA
101
102#define P2CR 0xFEE03C
103#define P4CR 0xFEE03E
104#define P5CR 0xFEE03F
105
106#define SMR0 0xFFFFB0
107#define BRR0 0xFFFFB1
108#define SCR0 0xFFFFB2
109#define TDR0 0xFFFFB3
110#define SSR0 0xFFFFB4
111#define RDR0 0xFFFFB5
112#define SCMR0 0xFFFFB6
113#define SMR1 0xFFFFB8
114#define BRR1 0xFFFFB9
115#define SCR1 0xFFFFBA
116#define TDR1 0xFFFFBB
117#define SSR1 0xFFFFBC
118#define RDR1 0xFFFFBD
119#define SCMR1 0xFFFFBE
120#define SMR2 0xFFFFC0
121#define BRR2 0xFFFFC1
122#define SCR2 0xFFFFC2
123#define TDR2 0xFFFFC3
124#define SSR2 0xFFFFC4
125#define RDR2 0xFFFFC5
126#define SCMR2 0xFFFFC6
127
128#define MDCR 0xFEE011
129#define SYSCR 0xFEE012
130#define DIVCR 0xFEE01B
131#define MSTCRH 0xFEE01C
132#define MSTCRL 0xFEE01D
133#define FLMCR1 0xFEE030
134#define FLMCR2 0xFEE031
135#define EBR1 0xFEE032
136#define EBR2 0xFEE033
137#define RAMCR 0xFEE077
138
139#define TSTR 0xFFFF60
140#define TSNC 0XFFFF61
141#define TMDR 0xFFFF62
142#define TOLR 0xFFFF63
143#define TISRA 0xFFFF64
144#define TISRB 0xFFFF65
145#define TISRC 0xFFFF66
146#define TCR0 0xFFFF68
147#define TIOR0 0xFFFF69
148#define TCNT0H 0xFFFF6A
149#define TCNT0L 0xFFFF6B
150#define GRA0H 0xFFFF6C
151#define GRA0L 0xFFFF6D
152#define GRB0H 0xFFFF6E
153#define GRB0L 0xFFFF6F
154#define TCR1 0xFFFF70
155#define TIOR1 0xFFFF71
156#define TCNT1H 0xFFFF72
157#define TCNT1L 0xFFFF73
158#define GRA1H 0xFFFF74
159#define GRA1L 0xFFFF75
160#define GRB1H 0xFFFF76
161#define GRB1L 0xFFFF77
162#define TCR3 0xFFFF78
163#define TIOR3 0xFFFF79
164#define TCNT3H 0xFFFF7A
165#define TCNT3L 0xFFFF7B
166#define GRA3H 0xFFFF7C
167#define GRA3L 0xFFFF7D
168#define GRB3H 0xFFFF7E
169#define GRB3L 0xFFFF7F
170
171#define _8TCR0 0xFFFF80
172#define _8TCR1 0xFFFF81
173#define _8TCSR0 0xFFFF82
174#define _8TCSR1 0xFFFF83
175#define TCORA0 0xFFFF84
176#define TCORA1 0xFFFF85
177#define TCORB0 0xFFFF86
178#define TCORB1 0xFFFF87
179#define _8TCNT0 0xFFFF88
180#define _8TCNT1 0xFFFF89
181
182#define _8TCR2 0xFFFF90
183#define _8TCR3 0xFFFF91
184#define _8TCSR2 0xFFFF92
185#define _8TCSR3 0xFFFF93
186#define TCORA2 0xFFFF94
187#define TCORA3 0xFFFF95
188#define TCORB2 0xFFFF96
189#define TCORB3 0xFFFF97
190#define _8TCNT2 0xFFFF98
191#define _8TCNT3 0xFFFF99
192
193#define TCSR 0xFFFF8C
194#define TCNT 0xFFFF8D
195#define RSTCSR 0xFFFF8F
196
197#define TPMR 0xFFFFA0
198#define TPCR 0xFFFFA1
199#define NDERB 0xFFFFA2
200#define NDERA 0xFFFFA3
201#define NDRB1 0xFFFFA4
202#define NDRA1 0xFFFFA5
203#define NDRB2 0xFFFFA6
204#define NDRA2 0xFFFFA7
205
206#define TCSR 0xFFFF8C
207#define TCNT 0xFFFF8D
208#define RSTCSRW 0xFFFF8E
209#define RSTCSRR 0xFFFF8F
210
211#endif /* __KERNEL__ */
212#endif /* __REGS_H8306x__ */
diff --git a/arch/h8300/include/asm/scatterlist.h b/arch/h8300/include/asm/scatterlist.h
deleted file mode 100644
index 82130eda0e5f..000000000000
--- a/arch/h8300/include/asm/scatterlist.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _H8300_SCATTERLIST_H
2#define _H8300_SCATTERLIST_H
3
4#include <asm-generic/scatterlist.h>
5
6#endif /* !(_H8300_SCATTERLIST_H) */
diff --git a/arch/h8300/include/asm/sections.h b/arch/h8300/include/asm/sections.h
deleted file mode 100644
index a81743e8b743..000000000000
--- a/arch/h8300/include/asm/sections.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _H8300_SECTIONS_H_
2#define _H8300_SECTIONS_H_
3
4#include <asm-generic/sections.h>
5
6#endif
diff --git a/arch/h8300/include/asm/segment.h b/arch/h8300/include/asm/segment.h
deleted file mode 100644
index b79a82d0f99d..000000000000
--- a/arch/h8300/include/asm/segment.h
+++ /dev/null
@@ -1,49 +0,0 @@
1#ifndef _H8300_SEGMENT_H
2#define _H8300_SEGMENT_H
3
4/* define constants */
5#define USER_DATA (1)
6#ifndef __USER_DS
7#define __USER_DS (USER_DATA)
8#endif
9#define USER_PROGRAM (2)
10#define SUPER_DATA (3)
11#ifndef __KERNEL_DS
12#define __KERNEL_DS (SUPER_DATA)
13#endif
14#define SUPER_PROGRAM (4)
15
16#ifndef __ASSEMBLY__
17
18typedef struct {
19 unsigned long seg;
20} mm_segment_t;
21
22#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
23#define USER_DS MAKE_MM_SEG(__USER_DS)
24#define KERNEL_DS MAKE_MM_SEG(__KERNEL_DS)
25
26/*
27 * Get/set the SFC/DFC registers for MOVES instructions
28 */
29
30static inline mm_segment_t get_fs(void)
31{
32 return USER_DS;
33}
34
35static inline mm_segment_t get_ds(void)
36{
37 /* return the supervisor data space code */
38 return KERNEL_DS;
39}
40
41static inline void set_fs(mm_segment_t val)
42{
43}
44
45#define segment_eq(a,b) ((a).seg == (b).seg)
46
47#endif /* __ASSEMBLY__ */
48
49#endif /* _H8300_SEGMENT_H */
diff --git a/arch/h8300/include/asm/sh_bios.h b/arch/h8300/include/asm/sh_bios.h
deleted file mode 100644
index b6bb6e58295c..000000000000
--- a/arch/h8300/include/asm/sh_bios.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/* eCos HAL interface header */
2
3#ifndef SH_BIOS_H
4#define SH_BIOS_H
5
6#define HAL_IF_VECTOR_TABLE 0xfffe20
7#define CALL_IF_SET_CONSOLE_COMM 13
8#define QUERY_CURRENT -1
9#define MANGLER -3
10
11/* Checking for GDB stub active */
12/* suggestion Jonathan Larmour */
13static int sh_bios_in_gdb_mode(void)
14{
15 static int gdb_active = -1;
16 if (gdb_active == -1) {
17 int (*set_console_comm)(int);
18 set_console_comm = ((void **)HAL_IF_VECTOR_TABLE)[CALL_IF_SET_CONSOLE_COMM];
19 gdb_active = (set_console_comm(QUERY_CURRENT) == MANGLER);
20 }
21 return gdb_active;
22}
23
24static void sh_bios_gdb_detach(void)
25{
26
27}
28
29#endif
diff --git a/arch/h8300/include/asm/shm.h b/arch/h8300/include/asm/shm.h
deleted file mode 100644
index ed6623c0545d..000000000000
--- a/arch/h8300/include/asm/shm.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _H8300_SHM_H
2#define _H8300_SHM_H
3
4
5/* format of page table entries that correspond to shared memory pages
6 currently out in swap space (see also mm/swap.c):
7 bits 0-1 (PAGE_PRESENT) is = 0
8 bits 8..2 (SWP_TYPE) are = SHM_SWP_TYPE
9 bits 31..9 are used like this:
10 bits 15..9 (SHM_ID) the id of the shared memory segment
11 bits 30..16 (SHM_IDX) the index of the page within the shared memory segment
12 (actually only bits 25..16 get used since SHMMAX is so low)
13 bit 31 (SHM_READ_ONLY) flag whether the page belongs to a read-only attach
14*/
15/* on the m68k both bits 0 and 1 must be zero */
16/* format on the sun3 is similar, but bits 30, 31 are set to zero and all
17 others are reduced by 2. --m */
18
19#ifndef CONFIG_SUN3
20#define SHM_ID_SHIFT 9
21#else
22#define SHM_ID_SHIFT 7
23#endif
24#define _SHM_ID_BITS 7
25#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1)
26
27#define SHM_IDX_SHIFT (SHM_ID_SHIFT+_SHM_ID_BITS)
28#define _SHM_IDX_BITS 15
29#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1)
30
31#endif /* _H8300_SHM_H */
diff --git a/arch/h8300/include/asm/shmparam.h b/arch/h8300/include/asm/shmparam.h
deleted file mode 100644
index d1863953ec64..000000000000
--- a/arch/h8300/include/asm/shmparam.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _H8300_SHMPARAM_H
2#define _H8300_SHMPARAM_H
3
4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
5
6#endif /* _H8300_SHMPARAM_H */
diff --git a/arch/h8300/include/asm/signal.h b/arch/h8300/include/asm/signal.h
deleted file mode 100644
index 6341e36386f8..000000000000
--- a/arch/h8300/include/asm/signal.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef _H8300_SIGNAL_H
2#define _H8300_SIGNAL_H
3
4#include <uapi/asm/signal.h>
5
6/* Most things should be clean enough to redefine this at will, if care
7 is taken to make libc match. */
8
9#define _NSIG 64
10#define _NSIG_BPW 32
11#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
12
13typedef unsigned long old_sigset_t; /* at least 32 bits */
14
15typedef struct {
16 unsigned long sig[_NSIG_WORDS];
17} sigset_t;
18
19#define __ARCH_HAS_SA_RESTORER
20
21#include <asm/sigcontext.h>
22#undef __HAVE_ARCH_SIG_BITOPS
23
24#endif /* _H8300_SIGNAL_H */
diff --git a/arch/h8300/include/asm/smp.h b/arch/h8300/include/asm/smp.h
deleted file mode 100644
index 9e9bd7e58922..000000000000
--- a/arch/h8300/include/asm/smp.h
+++ /dev/null
@@ -1 +0,0 @@
1/* nothing required here yet */
diff --git a/arch/h8300/include/asm/spinlock.h b/arch/h8300/include/asm/spinlock.h
deleted file mode 100644
index d5407fa173e4..000000000000
--- a/arch/h8300/include/asm/spinlock.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __H8300_SPINLOCK_H
2#define __H8300_SPINLOCK_H
3
4#error "H8/300 doesn't do SMP yet"
5
6#endif
diff --git a/arch/h8300/include/asm/string.h b/arch/h8300/include/asm/string.h
deleted file mode 100644
index ca5034897d87..000000000000
--- a/arch/h8300/include/asm/string.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef _H8300_STRING_H_
2#define _H8300_STRING_H_
3
4#ifdef __KERNEL__ /* only set these up for kernel code */
5
6#include <asm/setup.h>
7#include <asm/page.h>
8
9#define __HAVE_ARCH_MEMSET
10extern void * memset(void * s, int c, size_t count);
11
12#define __HAVE_ARCH_MEMCPY
13extern void * memcpy(void *d, const void *s, size_t count);
14
15#else /* KERNEL */
16
17/*
18 * let user libraries deal with these,
19 * IMHO the kernel has no place defining these functions for user apps
20 */
21
22#define __HAVE_ARCH_STRCPY 1
23#define __HAVE_ARCH_STRNCPY 1
24#define __HAVE_ARCH_STRCAT 1
25#define __HAVE_ARCH_STRNCAT 1
26#define __HAVE_ARCH_STRCMP 1
27#define __HAVE_ARCH_STRNCMP 1
28#define __HAVE_ARCH_STRNICMP 1
29#define __HAVE_ARCH_STRCHR 1
30#define __HAVE_ARCH_STRRCHR 1
31#define __HAVE_ARCH_STRSTR 1
32#define __HAVE_ARCH_STRLEN 1
33#define __HAVE_ARCH_STRNLEN 1
34#define __HAVE_ARCH_MEMSET 1
35#define __HAVE_ARCH_MEMCPY 1
36#define __HAVE_ARCH_MEMMOVE 1
37#define __HAVE_ARCH_MEMSCAN 1
38#define __HAVE_ARCH_MEMCMP 1
39#define __HAVE_ARCH_MEMCHR 1
40#define __HAVE_ARCH_STRTOK 1
41
42#endif /* KERNEL */
43
44#endif /* _M68K_STRING_H_ */
diff --git a/arch/h8300/include/asm/switch_to.h b/arch/h8300/include/asm/switch_to.h
deleted file mode 100644
index cdd8731ce487..000000000000
--- a/arch/h8300/include/asm/switch_to.h
+++ /dev/null
@@ -1,50 +0,0 @@
1#ifndef _H8300_SWITCH_TO_H
2#define _H8300_SWITCH_TO_H
3
4/*
5 * switch_to(n) should switch tasks to task ptr, first checking that
6 * ptr isn't the current task, in which case it does nothing. This
7 * also clears the TS-flag if the task we switched to has used the
8 * math co-processor latest.
9 */
10/*
11 * switch_to() saves the extra registers, that are not saved
12 * automatically by SAVE_SWITCH_STACK in resume(), ie. d0-d5 and
13 * a0-a1. Some of these are used by schedule() and its predecessors
14 * and so we might get see unexpected behaviors when a task returns
15 * with unexpected register values.
16 *
17 * syscall stores these registers itself and none of them are used
18 * by syscall after the function in the syscall has been called.
19 *
20 * Beware that resume now expects *next to be in d1 and the offset of
21 * tss to be in a1. This saves a few instructions as we no longer have
22 * to push them onto the stack and read them back right after.
23 *
24 * 02/17/96 - Jes Sorensen (jds@kom.auc.dk)
25 *
26 * Changed 96/09/19 by Andreas Schwab
27 * pass prev in a0, next in a1, offset of tss in d1, and whether
28 * the mm structures are shared in d2 (to avoid atc flushing).
29 *
30 * H8/300 Porting 2002/09/04 Yoshinori Sato
31 */
32
33asmlinkage void resume(void);
34#define switch_to(prev,next,last) { \
35 void *_last; \
36 __asm__ __volatile__( \
37 "mov.l %1, er0\n\t" \
38 "mov.l %2, er1\n\t" \
39 "mov.l %3, er2\n\t" \
40 "jsr @_resume\n\t" \
41 "mov.l er2,%0\n\t" \
42 : "=r" (_last) \
43 : "r" (&(prev->thread)), \
44 "r" (&(next->thread)), \
45 "g" (prev) \
46 : "cc", "er0", "er1", "er2", "er3"); \
47 (last) = _last; \
48}
49
50#endif /* _H8300_SWITCH_TO_H */
diff --git a/arch/h8300/include/asm/target_time.h b/arch/h8300/include/asm/target_time.h
deleted file mode 100644
index 9f2a9aa1fe6f..000000000000
--- a/arch/h8300/include/asm/target_time.h
+++ /dev/null
@@ -1,4 +0,0 @@
1extern int platform_timer_setup(void (*timer_int)(int, void *, struct pt_regs *));
2extern void platform_timer_eoi(void);
3extern void platform_gettod(unsigned int *year, unsigned int *mon, unsigned int *day,
4 unsigned int *hour, unsigned int *min, unsigned int *sec);
diff --git a/arch/h8300/include/asm/termios.h b/arch/h8300/include/asm/termios.h
deleted file mode 100644
index 93a63df56247..000000000000
--- a/arch/h8300/include/asm/termios.h
+++ /dev/null
@@ -1,50 +0,0 @@
1#ifndef _H8300_TERMIOS_H
2#define _H8300_TERMIOS_H
3
4#include <uapi/asm/termios.h>
5
6/* intr=^C quit=^| erase=del kill=^U
7 eof=^D vtime=\0 vmin=\1 sxtc=\0
8 start=^Q stop=^S susp=^Z eol=\0
9 reprint=^R discard=^U werase=^W lnext=^V
10 eol2=\0
11*/
12#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
13
14/*
15 * Translate a "termio" structure into a "termios". Ugh.
16 */
17#define user_termio_to_kernel_termios(termios, termio) \
18({ \
19 unsigned short tmp; \
20 get_user(tmp, &(termio)->c_iflag); \
21 (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
22 get_user(tmp, &(termio)->c_oflag); \
23 (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
24 get_user(tmp, &(termio)->c_cflag); \
25 (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
26 get_user(tmp, &(termio)->c_lflag); \
27 (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
28 get_user((termios)->c_line, &(termio)->c_line); \
29 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
30})
31
32/*
33 * Translate a "termios" structure into a "termio". Ugh.
34 */
35#define kernel_termios_to_user_termio(termio, termios) \
36({ \
37 put_user((termios)->c_iflag, &(termio)->c_iflag); \
38 put_user((termios)->c_oflag, &(termio)->c_oflag); \
39 put_user((termios)->c_cflag, &(termio)->c_cflag); \
40 put_user((termios)->c_lflag, &(termio)->c_lflag); \
41 put_user((termios)->c_line, &(termio)->c_line); \
42 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
43})
44
45#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
46#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
47#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
48#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
49
50#endif /* _H8300_TERMIOS_H */
diff --git a/arch/h8300/include/asm/thread_info.h b/arch/h8300/include/asm/thread_info.h
deleted file mode 100644
index ec2f7777c65a..000000000000
--- a/arch/h8300/include/asm/thread_info.h
+++ /dev/null
@@ -1,103 +0,0 @@
1/* thread_info.h: h8300 low-level thread information
2 * adapted from the i386 and PPC versions by Yoshinori Sato <ysato@users.sourceforge.jp>
3 *
4 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
5 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
6 */
7
8#ifndef _ASM_THREAD_INFO_H
9#define _ASM_THREAD_INFO_H
10
11#include <asm/page.h>
12
13#ifdef __KERNEL__
14
15#ifndef __ASSEMBLY__
16
17/*
18 * low level task data.
19 * If you change this, change the TI_* offsets below to match.
20 */
21struct thread_info {
22 struct task_struct *task; /* main task structure */
23 struct exec_domain *exec_domain; /* execution domain */
24 unsigned long flags; /* low level flags */
25 int cpu; /* cpu we're on */
26 int preempt_count; /* 0 => preemptable, <0 => BUG */
27 struct restart_block restart_block;
28};
29
30/*
31 * macros/functions for gaining access to the thread information structure
32 */
33#define INIT_THREAD_INFO(tsk) \
34{ \
35 .task = &tsk, \
36 .exec_domain = &default_exec_domain, \
37 .flags = 0, \
38 .cpu = 0, \
39 .preempt_count = INIT_PREEMPT_COUNT, \
40 .restart_block = { \
41 .fn = do_no_restart_syscall, \
42 }, \
43}
44
45#define init_thread_info (init_thread_union.thread_info)
46#define init_stack (init_thread_union.stack)
47
48
49/*
50 * Size of kernel stack for each process. This must be a power of 2...
51 */
52#define THREAD_SIZE_ORDER 1
53#define THREAD_SIZE 8192 /* 2 pages */
54
55
56/* how to get the thread information struct from C */
57static inline struct thread_info *current_thread_info(void)
58{
59 struct thread_info *ti;
60 __asm__(
61 "mov.l sp, %0 \n\t"
62 "and.l %1, %0"
63 : "=&r"(ti)
64 : "i" (~(THREAD_SIZE-1))
65 );
66 return ti;
67}
68
69#endif /* __ASSEMBLY__ */
70
71/*
72 * Offsets in thread_info structure, used in assembly code
73 */
74#define TI_TASK 0
75#define TI_EXECDOMAIN 4
76#define TI_FLAGS 8
77#define TI_CPU 12
78#define TI_PRE_COUNT 16
79
80#define PREEMPT_ACTIVE 0x4000000
81
82/*
83 * thread information flag bit numbers
84 */
85#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
86#define TIF_SIGPENDING 1 /* signal pending */
87#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
88#define TIF_MEMDIE 4 /* is terminating due to OOM killer */
89#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
90#define TIF_NOTIFY_RESUME 6 /* callback before returning to user */
91
92/* as above, but as bit values */
93#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
94#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
95#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
96#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
97
98#define _TIF_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
99 _TIF_NOTIFY_RESUME)
100
101#endif /* __KERNEL__ */
102
103#endif /* _ASM_THREAD_INFO_H */
diff --git a/arch/h8300/include/asm/timer.h b/arch/h8300/include/asm/timer.h
deleted file mode 100644
index def80464d38f..000000000000
--- a/arch/h8300/include/asm/timer.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef __H8300_TIMER_H
2#define __H8300_TIMER_H
3
4void h8300_timer_tick(void);
5void h8300_timer_setup(void);
6void h8300_gettod(unsigned int *year, unsigned int *mon, unsigned int *day,
7 unsigned int *hour, unsigned int *min, unsigned int *sec);
8
9#define TIMER_FREQ (CONFIG_CPU_CLOCK*10000) /* Timer input freq. */
10
11#define calc_param(cnt, div, rate, limit) \
12do { \
13 cnt = TIMER_FREQ / HZ; \
14 for (div = 0; div < ARRAY_SIZE(divide_rate); div++) { \
15 if (rate[div] == 0) \
16 continue; \
17 if ((cnt / rate[div]) > limit) \
18 break; \
19 } \
20 if (div == ARRAY_SIZE(divide_rate)) \
21 panic("Timer counter overflow"); \
22 cnt /= divide_rate[div]; \
23} while(0)
24
25#endif
diff --git a/arch/h8300/include/asm/timex.h b/arch/h8300/include/asm/timex.h
deleted file mode 100644
index 23e67013439f..000000000000
--- a/arch/h8300/include/asm/timex.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * linux/include/asm-h8300/timex.h
3 *
4 * H8/300 architecture timex specifications
5 */
6#ifndef _ASM_H8300_TIMEX_H
7#define _ASM_H8300_TIMEX_H
8
9#define CLOCK_TICK_RATE (CONFIG_CPU_CLOCK*1000/8192) /* Timer input freq. */
10
11typedef unsigned long cycles_t;
12extern short h8300_timer_count;
13
14static inline cycles_t get_cycles(void)
15{
16 return 0;
17}
18
19#endif
diff --git a/arch/h8300/include/asm/tlb.h b/arch/h8300/include/asm/tlb.h
deleted file mode 100644
index 7f0743051ad5..000000000000
--- a/arch/h8300/include/asm/tlb.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __H8300_TLB_H__
2#define __H8300_TLB_H__
3
4#define tlb_flush(tlb) do { } while(0)
5
6#include <asm-generic/tlb.h>
7
8#endif
diff --git a/arch/h8300/include/asm/tlbflush.h b/arch/h8300/include/asm/tlbflush.h
deleted file mode 100644
index 41c148a9208e..000000000000
--- a/arch/h8300/include/asm/tlbflush.h
+++ /dev/null
@@ -1,55 +0,0 @@
1#ifndef _H8300_TLBFLUSH_H
2#define _H8300_TLBFLUSH_H
3
4/*
5 * Copyright (C) 2000 Lineo, David McCullough <davidm@uclinux.org>
6 * Copyright (C) 2000-2002, Greg Ungerer <gerg@snapgear.com>
7 */
8
9#include <asm/setup.h>
10
11/*
12 * flush all user-space atc entries.
13 */
14static inline void __flush_tlb(void)
15{
16 BUG();
17}
18
19static inline void __flush_tlb_one(unsigned long addr)
20{
21 BUG();
22}
23
24#define flush_tlb() __flush_tlb()
25
26/*
27 * flush all atc entries (both kernel and user-space entries).
28 */
29static inline void flush_tlb_all(void)
30{
31 BUG();
32}
33
34static inline void flush_tlb_mm(struct mm_struct *mm)
35{
36 BUG();
37}
38
39static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
40{
41 BUG();
42}
43
44static inline void flush_tlb_range(struct mm_struct *mm,
45 unsigned long start, unsigned long end)
46{
47 BUG();
48}
49
50static inline void flush_tlb_kernel_page(unsigned long addr)
51{
52 BUG();
53}
54
55#endif /* _H8300_TLBFLUSH_H */
diff --git a/arch/h8300/include/asm/topology.h b/arch/h8300/include/asm/topology.h
deleted file mode 100644
index fdc121924d4c..000000000000
--- a/arch/h8300/include/asm/topology.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_H8300_TOPOLOGY_H
2#define _ASM_H8300_TOPOLOGY_H
3
4#include <asm-generic/topology.h>
5
6#endif /* _ASM_H8300_TOPOLOGY_H */
diff --git a/arch/h8300/include/asm/traps.h b/arch/h8300/include/asm/traps.h
deleted file mode 100644
index 41cf6be02f68..000000000000
--- a/arch/h8300/include/asm/traps.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * linux/include/asm-h8300/traps.h
3 *
4 * Copyright (C) 2003 Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef _H8300_TRAPS_H
12#define _H8300_TRAPS_H
13
14extern void system_call(void);
15extern void interrupt_entry(void);
16extern void trace_break(void);
17
18#define JMP_OP 0x5a000000
19#define JSR_OP 0x5e000000
20#define VECTOR(address) ((JMP_OP)|((unsigned long)address))
21#define REDIRECT(address) ((JSR_OP)|((unsigned long)address))
22
23#define TRACE_VEC 5
24
25#define TRAP0_VEC 8
26#define TRAP1_VEC 9
27#define TRAP2_VEC 10
28#define TRAP3_VEC 11
29
30#if defined(__H8300H__)
31#define NR_TRAPS 12
32#endif
33#if defined(__H8300S__)
34#define NR_TRAPS 16
35#endif
36
37#endif /* _H8300_TRAPS_H */
diff --git a/arch/h8300/include/asm/types.h b/arch/h8300/include/asm/types.h
deleted file mode 100644
index c012707f6037..000000000000
--- a/arch/h8300/include/asm/types.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _H8300_TYPES_H
2#define _H8300_TYPES_H
3
4#include <uapi/asm/types.h>
5
6
7#define BITS_PER_LONG 32
8
9#endif /* _H8300_TYPES_H */
diff --git a/arch/h8300/include/asm/uaccess.h b/arch/h8300/include/asm/uaccess.h
deleted file mode 100644
index 8725d1ad4272..000000000000
--- a/arch/h8300/include/asm/uaccess.h
+++ /dev/null
@@ -1,163 +0,0 @@
1#ifndef __H8300_UACCESS_H
2#define __H8300_UACCESS_H
3
4/*
5 * User space memory access functions
6 */
7#include <linux/sched.h>
8#include <linux/mm.h>
9#include <linux/string.h>
10
11#include <asm/segment.h>
12
13#define VERIFY_READ 0
14#define VERIFY_WRITE 1
15
16/* We let the MMU do all checking */
17#define access_ok(type, addr, size) __access_ok((unsigned long)addr,size)
18static inline int __access_ok(unsigned long addr, unsigned long size)
19{
20#define RANGE_CHECK_OK(addr, size, lower, upper) \
21 (((addr) >= (lower)) && (((addr) + (size)) < (upper)))
22
23 extern unsigned long _ramend;
24 return(RANGE_CHECK_OK(addr, size, 0L, (unsigned long)&_ramend));
25}
26
27/*
28 * The exception table consists of pairs of addresses: the first is the
29 * address of an instruction that is allowed to fault, and the second is
30 * the address at which the program should continue. No registers are
31 * modified, so it is entirely up to the continuation code to figure out
32 * what to do.
33 *
34 * All the routines below use bits of fixup code that are out of line
35 * with the main instruction path. This means when everything is well,
36 * we don't even have to jump over them. Further, they do not intrude
37 * on our cache or tlb entries.
38 */
39
40struct exception_table_entry
41{
42 unsigned long insn, fixup;
43};
44
45/* Returns 0 if exception not found and fixup otherwise. */
46extern unsigned long search_exception_table(unsigned long);
47
48
49/*
50 * These are the main single-value transfer routines. They automatically
51 * use the right size if we just have the right pointer type.
52 */
53
54#define put_user(x, ptr) \
55({ \
56 int __pu_err = 0; \
57 typeof(*(ptr)) __pu_val = (x); \
58 switch (sizeof (*(ptr))) { \
59 case 1: \
60 case 2: \
61 case 4: \
62 *(ptr) = (__pu_val); \
63 break; \
64 case 8: \
65 memcpy(ptr, &__pu_val, sizeof (*(ptr))); \
66 break; \
67 default: \
68 __pu_err = __put_user_bad(); \
69 break; \
70 } \
71 __pu_err; \
72})
73#define __put_user(x, ptr) put_user(x, ptr)
74
75extern int __put_user_bad(void);
76
77/*
78 * Tell gcc we read from memory instead of writing: this is because
79 * we do not write to any memory gcc knows about, so there are no
80 * aliasing issues.
81 */
82
83#define __ptr(x) ((unsigned long *)(x))
84
85/*
86 * Tell gcc we read from memory instead of writing: this is because
87 * we do not write to any memory gcc knows about, so there are no
88 * aliasing issues.
89 */
90
91#define get_user(x, ptr) \
92({ \
93 int __gu_err = 0; \
94 typeof(*(ptr)) __gu_val = *ptr; \
95 switch (sizeof(*(ptr))) { \
96 case 1: \
97 case 2: \
98 case 4: \
99 case 8: \
100 break; \
101 default: \
102 __gu_err = __get_user_bad(); \
103 break; \
104 } \
105 (x) = __gu_val; \
106 __gu_err; \
107})
108#define __get_user(x, ptr) get_user(x, ptr)
109
110extern int __get_user_bad(void);
111
112#define copy_from_user(to, from, n) (memcpy(to, from, n), 0)
113#define copy_to_user(to, from, n) (memcpy(to, from, n), 0)
114
115#define __copy_from_user(to, from, n) copy_from_user(to, from, n)
116#define __copy_to_user(to, from, n) copy_to_user(to, from, n)
117#define __copy_to_user_inatomic __copy_to_user
118#define __copy_from_user_inatomic __copy_from_user
119
120#define copy_to_user_ret(to,from,n,retval) ({ if (copy_to_user(to,from,n)) return retval; })
121
122#define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n)) return retval; })
123
124/*
125 * Copy a null terminated string from userspace.
126 */
127
128static inline long
129strncpy_from_user(char *dst, const char *src, long count)
130{
131 char *tmp;
132 strncpy(dst, src, count);
133 for (tmp = dst; *tmp && count > 0; tmp++, count--)
134 ;
135 return(tmp - dst); /* DAVIDM should we count a NUL ? check getname */
136}
137
138/*
139 * Return the size of a string (including the ending 0)
140 *
141 * Return 0 on exception, a value greater than N if too long
142 */
143static inline long strnlen_user(const char *src, long n)
144{
145 return(strlen(src) + 1); /* DAVIDM make safer */
146}
147
148#define strlen_user(str) strnlen_user(str, 32767)
149
150/*
151 * Zero Userspace
152 */
153
154static inline unsigned long
155clear_user(void *to, unsigned long n)
156{
157 memset(to, 0, n);
158 return 0;
159}
160
161#define __clear_user clear_user
162
163#endif /* _H8300_UACCESS_H */
diff --git a/arch/h8300/include/asm/ucontext.h b/arch/h8300/include/asm/ucontext.h
deleted file mode 100644
index 0bcf8f85fab9..000000000000
--- a/arch/h8300/include/asm/ucontext.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _H8300_UCONTEXT_H
2#define _H8300_UCONTEXT_H
3
4struct ucontext {
5 unsigned long uc_flags;
6 struct ucontext *uc_link;
7 stack_t uc_stack;
8 struct sigcontext uc_mcontext;
9 sigset_t uc_sigmask; /* mask last for extensibility */
10};
11
12#endif
diff --git a/arch/h8300/include/asm/unaligned.h b/arch/h8300/include/asm/unaligned.h
deleted file mode 100644
index b8d06c70c2da..000000000000
--- a/arch/h8300/include/asm/unaligned.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _ASM_H8300_UNALIGNED_H
2#define _ASM_H8300_UNALIGNED_H
3
4#include <linux/unaligned/be_memmove.h>
5#include <linux/unaligned/le_byteshift.h>
6#include <linux/unaligned/generic.h>
7
8#define get_unaligned __get_unaligned_be
9#define put_unaligned __put_unaligned_be
10
11#endif /* _ASM_H8300_UNALIGNED_H */
diff --git a/arch/h8300/include/asm/unistd.h b/arch/h8300/include/asm/unistd.h
deleted file mode 100644
index ab671ecf5196..000000000000
--- a/arch/h8300/include/asm/unistd.h
+++ /dev/null
@@ -1,36 +0,0 @@
1#ifndef _ASM_H8300_UNISTD_H_
2#define _ASM_H8300_UNISTD_H_
3
4#include <uapi/asm/unistd.h>
5
6
7#define NR_syscalls 321
8
9#define __ARCH_WANT_OLD_READDIR
10#define __ARCH_WANT_OLD_STAT
11#define __ARCH_WANT_STAT64
12#define __ARCH_WANT_SYS_ALARM
13#define __ARCH_WANT_SYS_GETHOSTNAME
14#define __ARCH_WANT_SYS_IPC
15#define __ARCH_WANT_SYS_PAUSE
16#define __ARCH_WANT_SYS_SGETMASK
17#define __ARCH_WANT_SYS_SIGNAL
18#define __ARCH_WANT_SYS_TIME
19#define __ARCH_WANT_SYS_UTIME
20#define __ARCH_WANT_SYS_WAITPID
21#define __ARCH_WANT_SYS_SOCKETCALL
22#define __ARCH_WANT_SYS_FADVISE64
23#define __ARCH_WANT_SYS_GETPGRP
24#define __ARCH_WANT_SYS_LLSEEK
25#define __ARCH_WANT_SYS_NICE
26#define __ARCH_WANT_SYS_OLD_GETRLIMIT
27#define __ARCH_WANT_SYS_OLD_MMAP
28#define __ARCH_WANT_SYS_OLD_SELECT
29#define __ARCH_WANT_SYS_OLDUMOUNT
30#define __ARCH_WANT_SYS_SIGPENDING
31#define __ARCH_WANT_SYS_SIGPROCMASK
32#define __ARCH_WANT_SYS_FORK
33#define __ARCH_WANT_SYS_VFORK
34#define __ARCH_WANT_SYS_CLONE
35
36#endif /* _ASM_H8300_UNISTD_H_ */
diff --git a/arch/h8300/include/asm/user.h b/arch/h8300/include/asm/user.h
deleted file mode 100644
index 14a9e18950f1..000000000000
--- a/arch/h8300/include/asm/user.h
+++ /dev/null
@@ -1,75 +0,0 @@
1#ifndef _H8300_USER_H
2#define _H8300_USER_H
3
4#include <asm/page.h>
5
6/* Core file format: The core file is written in such a way that gdb
7 can understand it and provide useful information to the user (under
8 linux we use the 'trad-core' bfd). There are quite a number of
9 obstacles to being able to view the contents of the floating point
10 registers, and until these are solved you will not be able to view the
11 contents of them. Actually, you can read in the core file and look at
12 the contents of the user struct to find out what the floating point
13 registers contain.
14 The actual file contents are as follows:
15 UPAGE: 1 page consisting of a user struct that tells gdb what is present
16 in the file. Directly after this is a copy of the task_struct, which
17 is currently not used by gdb, but it may come in useful at some point.
18 All of the registers are stored as part of the upage. The upage should
19 always be only one page.
20 DATA: The data area is stored. We use current->end_text to
21 current->brk to pick up all of the user variables, plus any memory
22 that may have been malloced. No attempt is made to determine if a page
23 is demand-zero or if a page is totally unused, we just cover the entire
24 range. All of the addresses are rounded in such a way that an integral
25 number of pages is written.
26 STACK: We need the stack information in order to get a meaningful
27 backtrace. We need to write the data from (esp) to
28 current->start_stack, so we round each of these off in order to be able
29 to write an integer number of pages.
30 The minimum core file size is 3 pages, or 12288 bytes.
31*/
32
33/* This is the old layout of "struct pt_regs" as of Linux 1.x, and
34 is still the layout used by user (the new pt_regs doesn't have
35 all registers). */
36struct user_regs_struct {
37 long er1,er2,er3,er4,er5,er6;
38 long er0;
39 long usp;
40 long orig_er0;
41 short ccr;
42 long pc;
43};
44
45
46/* When the kernel dumps core, it starts by dumping the user struct -
47 this will be used by gdb to figure out where the data and stack segments
48 are within the file, and what virtual addresses to use. */
49struct user{
50/* We start with the registers, to mimic the way that "memory" is returned
51 from the ptrace(3,...) function. */
52 struct user_regs_struct regs; /* Where the registers are actually stored */
53/* ptrace does not yet supply these. Someday.... */
54/* The rest of this junk is to help gdb figure out what goes where */
55 unsigned long int u_tsize; /* Text segment size (pages). */
56 unsigned long int u_dsize; /* Data segment size (pages). */
57 unsigned long int u_ssize; /* Stack segment size (pages). */
58 unsigned long start_code; /* Starting virtual address of text. */
59 unsigned long start_stack; /* Starting virtual address of stack area.
60 This is actually the bottom of the stack,
61 the top of the stack is always found in the
62 esp register. */
63 long int signal; /* Signal that caused the core dump. */
64 int reserved; /* No longer used */
65 unsigned long u_ar0; /* Used by gdb to help find the values for */
66 /* the registers. */
67 unsigned long magic; /* To uniquely identify a core file */
68 char u_comm[32]; /* User command that was responsible */
69};
70#define NBPG PAGE_SIZE
71#define UPAGES 1
72#define HOST_TEXT_START_ADDR (u.start_code)
73#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
74
75#endif
diff --git a/arch/h8300/include/asm/virtconvert.h b/arch/h8300/include/asm/virtconvert.h
deleted file mode 100644
index 19cfd62b11c3..000000000000
--- a/arch/h8300/include/asm/virtconvert.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef __H8300_VIRT_CONVERT__
2#define __H8300_VIRT_CONVERT__
3
4/*
5 * Macros used for converting between virtual and physical mappings.
6 */
7
8#ifdef __KERNEL__
9
10#include <asm/setup.h>
11#include <asm/page.h>
12
13#define phys_to_virt(vaddr) ((void *) (vaddr))
14#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
15
16#define virt_to_bus virt_to_phys
17#define bus_to_virt phys_to_virt
18
19#endif
20#endif
diff --git a/arch/h8300/include/uapi/asm/Kbuild b/arch/h8300/include/uapi/asm/Kbuild
deleted file mode 100644
index 040178cdb3eb..000000000000
--- a/arch/h8300/include/uapi/asm/Kbuild
+++ /dev/null
@@ -1,34 +0,0 @@
1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm
3
4header-y += auxvec.h
5header-y += bitsperlong.h
6header-y += byteorder.h
7header-y += errno.h
8header-y += fcntl.h
9header-y += ioctl.h
10header-y += ioctls.h
11header-y += ipcbuf.h
12header-y += kvm_para.h
13header-y += mman.h
14header-y += msgbuf.h
15header-y += param.h
16header-y += poll.h
17header-y += posix_types.h
18header-y += ptrace.h
19header-y += resource.h
20header-y += sembuf.h
21header-y += setup.h
22header-y += shmbuf.h
23header-y += sigcontext.h
24header-y += siginfo.h
25header-y += signal.h
26header-y += socket.h
27header-y += sockios.h
28header-y += stat.h
29header-y += statfs.h
30header-y += swab.h
31header-y += termbits.h
32header-y += termios.h
33header-y += types.h
34header-y += unistd.h
diff --git a/arch/h8300/include/uapi/asm/auxvec.h b/arch/h8300/include/uapi/asm/auxvec.h
deleted file mode 100644
index 1d36fe38b088..000000000000
--- a/arch/h8300/include/uapi/asm/auxvec.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef __ASMH8300_AUXVEC_H
2#define __ASMH8300_AUXVEC_H
3
4#endif
diff --git a/arch/h8300/include/uapi/asm/bitsperlong.h b/arch/h8300/include/uapi/asm/bitsperlong.h
deleted file mode 100644
index 6dc0bb0c13b2..000000000000
--- a/arch/h8300/include/uapi/asm/bitsperlong.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/bitsperlong.h>
diff --git a/arch/h8300/include/uapi/asm/byteorder.h b/arch/h8300/include/uapi/asm/byteorder.h
deleted file mode 100644
index 13539da99efd..000000000000
--- a/arch/h8300/include/uapi/asm/byteorder.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _H8300_BYTEORDER_H
2#define _H8300_BYTEORDER_H
3
4#include <linux/byteorder/big_endian.h>
5
6#endif /* _H8300_BYTEORDER_H */
diff --git a/arch/h8300/include/uapi/asm/errno.h b/arch/h8300/include/uapi/asm/errno.h
deleted file mode 100644
index 0c2f5641fdcc..000000000000
--- a/arch/h8300/include/uapi/asm/errno.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _H8300_ERRNO_H
2#define _H8300_ERRNO_H
3
4#include <asm-generic/errno.h>
5
6#endif /* _H8300_ERRNO_H */
diff --git a/arch/h8300/include/uapi/asm/fcntl.h b/arch/h8300/include/uapi/asm/fcntl.h
deleted file mode 100644
index 1952cb2e3b06..000000000000
--- a/arch/h8300/include/uapi/asm/fcntl.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _H8300_FCNTL_H
2#define _H8300_FCNTL_H
3
4#define O_DIRECTORY 040000 /* must be a directory */
5#define O_NOFOLLOW 0100000 /* don't follow links */
6#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
7#define O_LARGEFILE 0400000
8
9#include <asm-generic/fcntl.h>
10
11#endif /* _H8300_FCNTL_H */
diff --git a/arch/h8300/include/uapi/asm/ioctl.h b/arch/h8300/include/uapi/asm/ioctl.h
deleted file mode 100644
index b279fe06dfe5..000000000000
--- a/arch/h8300/include/uapi/asm/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ioctl.h>
diff --git a/arch/h8300/include/uapi/asm/ioctls.h b/arch/h8300/include/uapi/asm/ioctls.h
deleted file mode 100644
index 30eaed2facdb..000000000000
--- a/arch/h8300/include/uapi/asm/ioctls.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __ARCH_H8300_IOCTLS_H__
2#define __ARCH_H8300_IOCTLS_H__
3
4#define FIOQSIZE 0x545E
5
6#include <asm-generic/ioctls.h>
7
8#endif /* __ARCH_H8300_IOCTLS_H__ */
diff --git a/arch/h8300/include/uapi/asm/ipcbuf.h b/arch/h8300/include/uapi/asm/ipcbuf.h
deleted file mode 100644
index 84c7e51cb6d0..000000000000
--- a/arch/h8300/include/uapi/asm/ipcbuf.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipcbuf.h>
diff --git a/arch/h8300/include/uapi/asm/kvm_para.h b/arch/h8300/include/uapi/asm/kvm_para.h
deleted file mode 100644
index 14fab8f0b957..000000000000
--- a/arch/h8300/include/uapi/asm/kvm_para.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kvm_para.h>
diff --git a/arch/h8300/include/uapi/asm/mman.h b/arch/h8300/include/uapi/asm/mman.h
deleted file mode 100644
index 8eebf89f5ab1..000000000000
--- a/arch/h8300/include/uapi/asm/mman.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/mman.h>
diff --git a/arch/h8300/include/uapi/asm/msgbuf.h b/arch/h8300/include/uapi/asm/msgbuf.h
deleted file mode 100644
index 6b148cd09aa5..000000000000
--- a/arch/h8300/include/uapi/asm/msgbuf.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _H8300_MSGBUF_H
2#define _H8300_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for H8/300 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16 __kernel_time_t msg_stime; /* last msgsnd time */
17 unsigned long __unused1;
18 __kernel_time_t msg_rtime; /* last msgrcv time */
19 unsigned long __unused2;
20 __kernel_time_t msg_ctime; /* last change time */
21 unsigned long __unused3;
22 unsigned long msg_cbytes; /* current number of bytes on queue */
23 unsigned long msg_qnum; /* number of messages in queue */
24 unsigned long msg_qbytes; /* max number of bytes on queue */
25 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
26 __kernel_pid_t msg_lrpid; /* last receive pid */
27 unsigned long __unused4;
28 unsigned long __unused5;
29};
30
31#endif /* _H8300_MSGBUF_H */
diff --git a/arch/h8300/include/uapi/asm/param.h b/arch/h8300/include/uapi/asm/param.h
deleted file mode 100644
index 3dd18ae15f03..000000000000
--- a/arch/h8300/include/uapi/asm/param.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _UAPI_H8300_PARAM_H
2#define _UAPI_H8300_PARAM_H
3
4#ifndef __KERNEL__
5#define HZ 100
6#endif
7
8#define EXEC_PAGESIZE 4096
9
10#ifndef NOGROUP
11#define NOGROUP (-1)
12#endif
13
14#define MAXHOSTNAMELEN 64 /* max length of hostname */
15
16#endif /* _UAPI_H8300_PARAM_H */
diff --git a/arch/h8300/include/uapi/asm/poll.h b/arch/h8300/include/uapi/asm/poll.h
deleted file mode 100644
index f61540c22d94..000000000000
--- a/arch/h8300/include/uapi/asm/poll.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef __H8300_POLL_H
2#define __H8300_POLL_H
3
4#define POLLWRNORM POLLOUT
5#define POLLWRBAND 256
6
7#include <asm-generic/poll.h>
8
9#undef POLLREMOVE
10
11#endif
diff --git a/arch/h8300/include/uapi/asm/posix_types.h b/arch/h8300/include/uapi/asm/posix_types.h
deleted file mode 100644
index 91e62ba4c7b0..000000000000
--- a/arch/h8300/include/uapi/asm/posix_types.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#ifndef __ARCH_H8300_POSIX_TYPES_H
2#define __ARCH_H8300_POSIX_TYPES_H
3
4/*
5 * This file is generally used by user-level software, so you need to
6 * be a little careful about namespace pollution etc. Also, we cannot
7 * assume GCC is being used.
8 */
9
10typedef unsigned short __kernel_mode_t;
11#define __kernel_mode_t __kernel_mode_t
12
13typedef unsigned short __kernel_ipc_pid_t;
14#define __kernel_ipc_pid_t __kernel_ipc_pid_t
15
16typedef unsigned short __kernel_uid_t;
17typedef unsigned short __kernel_gid_t;
18#define __kernel_uid_t __kernel_uid_t
19
20typedef unsigned short __kernel_old_uid_t;
21typedef unsigned short __kernel_old_gid_t;
22#define __kernel_old_uid_t __kernel_old_uid_t
23
24#include <asm-generic/posix_types.h>
25
26#endif
diff --git a/arch/h8300/include/uapi/asm/ptrace.h b/arch/h8300/include/uapi/asm/ptrace.h
deleted file mode 100644
index ef39ec5977b6..000000000000
--- a/arch/h8300/include/uapi/asm/ptrace.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef _UAPI_H8300_PTRACE_H
2#define _UAPI_H8300_PTRACE_H
3
4#ifndef __ASSEMBLY__
5
6#define PT_ER1 0
7#define PT_ER2 1
8#define PT_ER3 2
9#define PT_ER4 3
10#define PT_ER5 4
11#define PT_ER6 5
12#define PT_ER0 6
13#define PT_ORIG_ER0 7
14#define PT_CCR 8
15#define PT_PC 9
16#define PT_USP 10
17#define PT_EXR 12
18
19/* this struct defines the way the registers are stored on the
20 stack during a system call. */
21
22struct pt_regs {
23 long retpc;
24 long er4;
25 long er5;
26 long er6;
27 long er3;
28 long er2;
29 long er1;
30 long orig_er0;
31 unsigned short ccr;
32 long er0;
33 long vector;
34#if defined(CONFIG_CPU_H8S)
35 unsigned short exr;
36#endif
37 unsigned long pc;
38} __attribute__((aligned(2),packed));
39
40#define PTRACE_GETREGS 12
41#define PTRACE_SETREGS 13
42
43#endif /* __ASSEMBLY__ */
44#endif /* _UAPI_H8300_PTRACE_H */
diff --git a/arch/h8300/include/uapi/asm/resource.h b/arch/h8300/include/uapi/asm/resource.h
deleted file mode 100644
index 46c5f4391607..000000000000
--- a/arch/h8300/include/uapi/asm/resource.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _H8300_RESOURCE_H
2#define _H8300_RESOURCE_H
3
4#include <asm-generic/resource.h>
5
6#endif /* _H8300_RESOURCE_H */
diff --git a/arch/h8300/include/uapi/asm/sembuf.h b/arch/h8300/include/uapi/asm/sembuf.h
deleted file mode 100644
index e04a3ec0cb92..000000000000
--- a/arch/h8300/include/uapi/asm/sembuf.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef _H8300_SEMBUF_H
2#define _H8300_SEMBUF_H
3
4/*
5 * The semid64_ds structure for m68k architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */
17 unsigned long __unused1;
18 __kernel_time_t sem_ctime; /* last change time */
19 unsigned long __unused2;
20 unsigned long sem_nsems; /* no. of semaphores in array */
21 unsigned long __unused3;
22 unsigned long __unused4;
23};
24
25#endif /* _H8300_SEMBUF_H */
diff --git a/arch/h8300/include/uapi/asm/setup.h b/arch/h8300/include/uapi/asm/setup.h
deleted file mode 100644
index e2c600e96733..000000000000
--- a/arch/h8300/include/uapi/asm/setup.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __H8300_SETUP_H
2#define __H8300_SETUP_H
3
4#define COMMAND_LINE_SIZE 512
5
6#endif
diff --git a/arch/h8300/include/uapi/asm/shmbuf.h b/arch/h8300/include/uapi/asm/shmbuf.h
deleted file mode 100644
index 64e77993a7a9..000000000000
--- a/arch/h8300/include/uapi/asm/shmbuf.h
+++ /dev/null
@@ -1,42 +0,0 @@
1#ifndef _H8300_SHMBUF_H
2#define _H8300_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for m68k architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */
17 __kernel_time_t shm_atime; /* last attach time */
18 unsigned long __unused1;
19 __kernel_time_t shm_dtime; /* last detach time */
20 unsigned long __unused2;
21 __kernel_time_t shm_ctime; /* last change time */
22 unsigned long __unused3;
23 __kernel_pid_t shm_cpid; /* pid of creator */
24 __kernel_pid_t shm_lpid; /* pid of last operator */
25 unsigned long shm_nattch; /* no. of current attaches */
26 unsigned long __unused4;
27 unsigned long __unused5;
28};
29
30struct shminfo64 {
31 unsigned long shmmax;
32 unsigned long shmmin;
33 unsigned long shmmni;
34 unsigned long shmseg;
35 unsigned long shmall;
36 unsigned long __unused1;
37 unsigned long __unused2;
38 unsigned long __unused3;
39 unsigned long __unused4;
40};
41
42#endif /* _H8300_SHMBUF_H */
diff --git a/arch/h8300/include/uapi/asm/sigcontext.h b/arch/h8300/include/uapi/asm/sigcontext.h
deleted file mode 100644
index e4b81505f8f8..000000000000
--- a/arch/h8300/include/uapi/asm/sigcontext.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _ASM_H8300_SIGCONTEXT_H
2#define _ASM_H8300_SIGCONTEXT_H
3
4struct sigcontext {
5 unsigned long sc_mask; /* old sigmask */
6 unsigned long sc_usp; /* old user stack pointer */
7 unsigned long sc_er0;
8 unsigned long sc_er1;
9 unsigned long sc_er2;
10 unsigned long sc_er3;
11 unsigned long sc_er4;
12 unsigned long sc_er5;
13 unsigned long sc_er6;
14 unsigned short sc_ccr;
15 unsigned long sc_pc;
16};
17
18#endif
diff --git a/arch/h8300/include/uapi/asm/siginfo.h b/arch/h8300/include/uapi/asm/siginfo.h
deleted file mode 100644
index bc8fbea931a5..000000000000
--- a/arch/h8300/include/uapi/asm/siginfo.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _H8300_SIGINFO_H
2#define _H8300_SIGINFO_H
3
4#include <asm-generic/siginfo.h>
5
6#endif
diff --git a/arch/h8300/include/uapi/asm/signal.h b/arch/h8300/include/uapi/asm/signal.h
deleted file mode 100644
index af3a6c37fee6..000000000000
--- a/arch/h8300/include/uapi/asm/signal.h
+++ /dev/null
@@ -1,115 +0,0 @@
1#ifndef _UAPI_H8300_SIGNAL_H
2#define _UAPI_H8300_SIGNAL_H
3
4#include <linux/types.h>
5
6/* Avoid too many header ordering problems. */
7struct siginfo;
8
9#ifndef __KERNEL__
10/* Here we must cater to libcs that poke about in kernel headers. */
11
12#define NSIG 32
13typedef unsigned long sigset_t;
14
15#endif /* __KERNEL__ */
16
17#define SIGHUP 1
18#define SIGINT 2
19#define SIGQUIT 3
20#define SIGILL 4
21#define SIGTRAP 5
22#define SIGABRT 6
23#define SIGIOT 6
24#define SIGBUS 7
25#define SIGFPE 8
26#define SIGKILL 9
27#define SIGUSR1 10
28#define SIGSEGV 11
29#define SIGUSR2 12
30#define SIGPIPE 13
31#define SIGALRM 14
32#define SIGTERM 15
33#define SIGSTKFLT 16
34#define SIGCHLD 17
35#define SIGCONT 18
36#define SIGSTOP 19
37#define SIGTSTP 20
38#define SIGTTIN 21
39#define SIGTTOU 22
40#define SIGURG 23
41#define SIGXCPU 24
42#define SIGXFSZ 25
43#define SIGVTALRM 26
44#define SIGPROF 27
45#define SIGWINCH 28
46#define SIGIO 29
47#define SIGPOLL SIGIO
48/*
49#define SIGLOST 29
50*/
51#define SIGPWR 30
52#define SIGSYS 31
53#define SIGUNUSED 31
54
55/* These should not be considered constants from userland. */
56#define SIGRTMIN 32
57#define SIGRTMAX _NSIG
58
59/*
60 * SA_FLAGS values:
61 *
62 * SA_ONSTACK indicates that a registered stack_t will be used.
63 * SA_RESTART flag to get restarting signals (which were the default long ago)
64 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
65 * SA_RESETHAND clears the handler when the signal is delivered.
66 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
67 * SA_NODEFER prevents the current signal from being masked in the handler.
68 *
69 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
70 * Unix names RESETHAND and NODEFER respectively.
71 */
72#define SA_NOCLDSTOP 0x00000001
73#define SA_NOCLDWAIT 0x00000002 /* not supported yet */
74#define SA_SIGINFO 0x00000004
75#define SA_ONSTACK 0x08000000
76#define SA_RESTART 0x10000000
77#define SA_NODEFER 0x40000000
78#define SA_RESETHAND 0x80000000
79
80#define SA_NOMASK SA_NODEFER
81#define SA_ONESHOT SA_RESETHAND
82
83#define SA_RESTORER 0x04000000
84
85#define MINSIGSTKSZ 2048
86#define SIGSTKSZ 8192
87
88#include <asm-generic/signal-defs.h>
89
90#ifndef __KERNEL__
91/* Here we must cater to libcs that poke about in kernel headers. */
92
93struct sigaction {
94 union {
95 __sighandler_t _sa_handler;
96 void (*_sa_sigaction)(int, struct siginfo *, void *);
97 } _u;
98 sigset_t sa_mask;
99 unsigned long sa_flags;
100 void (*sa_restorer)(void);
101};
102
103#define sa_handler _u._sa_handler
104#define sa_sigaction _u._sa_sigaction
105
106#endif /* __KERNEL__ */
107
108typedef struct sigaltstack {
109 void *ss_sp;
110 int ss_flags;
111 size_t ss_size;
112} stack_t;
113
114
115#endif /* _UAPI_H8300_SIGNAL_H */
diff --git a/arch/h8300/include/uapi/asm/socket.h b/arch/h8300/include/uapi/asm/socket.h
deleted file mode 100644
index 9490758c5e2b..000000000000
--- a/arch/h8300/include/uapi/asm/socket.h
+++ /dev/null
@@ -1,79 +0,0 @@
1#ifndef _ASM_SOCKET_H
2#define _ASM_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockoptions(2) */
7#define SOL_SOCKET 1
8
9#define SO_DEBUG 1
10#define SO_REUSEADDR 2
11#define SO_TYPE 3
12#define SO_ERROR 4
13#define SO_DONTROUTE 5
14#define SO_BROADCAST 6
15#define SO_SNDBUF 7
16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
19#define SO_KEEPALIVE 9
20#define SO_OOBINLINE 10
21#define SO_NO_CHECK 11
22#define SO_PRIORITY 12
23#define SO_LINGER 13
24#define SO_BSDCOMPAT 14
25#define SO_REUSEPORT 15
26#define SO_PASSCRED 16
27#define SO_PEERCRED 17
28#define SO_RCVLOWAT 18
29#define SO_SNDLOWAT 19
30#define SO_RCVTIMEO 20
31#define SO_SNDTIMEO 21
32
33/* Security levels - as per NRL IPv6 - don't actually do anything */
34#define SO_SECURITY_AUTHENTICATION 22
35#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
36#define SO_SECURITY_ENCRYPTION_NETWORK 24
37
38#define SO_BINDTODEVICE 25
39
40/* Socket filtering */
41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27
43#define SO_GET_FILTER SO_ATTACH_FILTER
44
45#define SO_PEERNAME 28
46#define SO_TIMESTAMP 29
47#define SCM_TIMESTAMP SO_TIMESTAMP
48
49#define SO_ACCEPTCONN 30
50
51#define SO_PEERSEC 31
52#define SO_PASSSEC 34
53#define SO_TIMESTAMPNS 35
54#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
55
56#define SO_MARK 36
57
58#define SO_TIMESTAMPING 37
59#define SCM_TIMESTAMPING SO_TIMESTAMPING
60
61#define SO_PROTOCOL 38
62#define SO_DOMAIN 39
63
64#define SO_RXQ_OVFL 40
65
66#define SO_WIFI_STATUS 41
67#define SCM_WIFI_STATUS SO_WIFI_STATUS
68#define SO_PEEK_OFF 42
69
70/* Instruct lower device to use last 4-bytes of skb data as FCS */
71#define SO_NOFCS 43
72
73#define SO_LOCK_FILTER 44
74
75#define SO_SELECT_ERR_QUEUE 45
76
77#define SO_BUSY_POLL 46
78
79#endif /* _ASM_SOCKET_H */
diff --git a/arch/h8300/include/uapi/asm/sockios.h b/arch/h8300/include/uapi/asm/sockios.h
deleted file mode 100644
index e9c7ec810c23..000000000000
--- a/arch/h8300/include/uapi/asm/sockios.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __ARCH_H8300_SOCKIOS__
2#define __ARCH_H8300_SOCKIOS__
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
12
13#endif /* __ARCH_H8300_SOCKIOS__ */
diff --git a/arch/h8300/include/uapi/asm/stat.h b/arch/h8300/include/uapi/asm/stat.h
deleted file mode 100644
index 62c3cc24dfe6..000000000000
--- a/arch/h8300/include/uapi/asm/stat.h
+++ /dev/null
@@ -1,78 +0,0 @@
1#ifndef _H8300_STAT_H
2#define _H8300_STAT_H
3
4struct __old_kernel_stat {
5 unsigned short st_dev;
6 unsigned short st_ino;
7 unsigned short st_mode;
8 unsigned short st_nlink;
9 unsigned short st_uid;
10 unsigned short st_gid;
11 unsigned short st_rdev;
12 unsigned long st_size;
13 unsigned long st_atime;
14 unsigned long st_mtime;
15 unsigned long st_ctime;
16};
17
18struct stat {
19 unsigned short st_dev;
20 unsigned short __pad1;
21 unsigned long st_ino;
22 unsigned short st_mode;
23 unsigned short st_nlink;
24 unsigned short st_uid;
25 unsigned short st_gid;
26 unsigned short st_rdev;
27 unsigned short __pad2;
28 unsigned long st_size;
29 unsigned long st_blksize;
30 unsigned long st_blocks;
31 unsigned long st_atime;
32 unsigned long __unused1;
33 unsigned long st_mtime;
34 unsigned long __unused2;
35 unsigned long st_ctime;
36 unsigned long __unused3;
37 unsigned long __unused4;
38 unsigned long __unused5;
39};
40
41/* This matches struct stat64 in glibc2.1, hence the absolutely
42 * insane amounts of padding around dev_t's.
43 */
44struct stat64 {
45 unsigned long long st_dev;
46 unsigned char __pad1[2];
47
48#define STAT64_HAS_BROKEN_ST_INO 1
49 unsigned long __st_ino;
50
51 unsigned int st_mode;
52 unsigned int st_nlink;
53
54 unsigned long st_uid;
55 unsigned long st_gid;
56
57 unsigned long long st_rdev;
58 unsigned char __pad3[2];
59
60 long long st_size;
61 unsigned long st_blksize;
62
63 unsigned long __pad4; /* future possible st_blocks high bits */
64 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
65
66 unsigned long st_atime;
67 unsigned long st_atime_nsec;
68
69 unsigned long st_mtime;
70 unsigned long st_mtime_nsec;
71
72 unsigned long st_ctime;
73 unsigned long st_ctime_nsec;
74
75 unsigned long long st_ino;
76};
77
78#endif /* _H8300_STAT_H */
diff --git a/arch/h8300/include/uapi/asm/statfs.h b/arch/h8300/include/uapi/asm/statfs.h
deleted file mode 100644
index b96efa712aac..000000000000
--- a/arch/h8300/include/uapi/asm/statfs.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _H8300_STATFS_H
2#define _H8300_STATFS_H
3
4#include <asm-generic/statfs.h>
5
6#endif /* _H8300_STATFS_H */
diff --git a/arch/h8300/include/uapi/asm/swab.h b/arch/h8300/include/uapi/asm/swab.h
deleted file mode 100644
index 39abbf52807d..000000000000
--- a/arch/h8300/include/uapi/asm/swab.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _H8300_SWAB_H
2#define _H8300_SWAB_H
3
4#include <linux/types.h>
5
6#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
7# define __SWAB_64_THRU_32__
8#endif
9
10#endif /* _H8300_SWAB_H */
diff --git a/arch/h8300/include/uapi/asm/termbits.h b/arch/h8300/include/uapi/asm/termbits.h
deleted file mode 100644
index 3287a6244d74..000000000000
--- a/arch/h8300/include/uapi/asm/termbits.h
+++ /dev/null
@@ -1,201 +0,0 @@
1#ifndef __ARCH_H8300_TERMBITS_H__
2#define __ARCH_H8300_TERMBITS_H__
3
4#include <linux/posix_types.h>
5
6typedef unsigned char cc_t;
7typedef unsigned int speed_t;
8typedef unsigned int tcflag_t;
9
10#define NCCS 19
11struct termios {
12 tcflag_t c_iflag; /* input mode flags */
13 tcflag_t c_oflag; /* output mode flags */
14 tcflag_t c_cflag; /* control mode flags */
15 tcflag_t c_lflag; /* local mode flags */
16 cc_t c_line; /* line discipline */
17 cc_t c_cc[NCCS]; /* control characters */
18};
19
20struct termios2 {
21 tcflag_t c_iflag; /* input mode flags */
22 tcflag_t c_oflag; /* output mode flags */
23 tcflag_t c_cflag; /* control mode flags */
24 tcflag_t c_lflag; /* local mode flags */
25 cc_t c_line; /* line discipline */
26 cc_t c_cc[NCCS]; /* control characters */
27 speed_t c_ispeed; /* input speed */
28 speed_t c_ospeed; /* output speed */
29};
30
31struct ktermios {
32 tcflag_t c_iflag; /* input mode flags */
33 tcflag_t c_oflag; /* output mode flags */
34 tcflag_t c_cflag; /* control mode flags */
35 tcflag_t c_lflag; /* local mode flags */
36 cc_t c_line; /* line discipline */
37 cc_t c_cc[NCCS]; /* control characters */
38 speed_t c_ispeed; /* input speed */
39 speed_t c_ospeed; /* output speed */
40};
41
42/* c_cc characters */
43#define VINTR 0
44#define VQUIT 1
45#define VERASE 2
46#define VKILL 3
47#define VEOF 4
48#define VTIME 5
49#define VMIN 6
50#define VSWTC 7
51#define VSTART 8
52#define VSTOP 9
53#define VSUSP 10
54#define VEOL 11
55#define VREPRINT 12
56#define VDISCARD 13
57#define VWERASE 14
58#define VLNEXT 15
59#define VEOL2 16
60
61
62/* c_iflag bits */
63#define IGNBRK 0000001
64#define BRKINT 0000002
65#define IGNPAR 0000004
66#define PARMRK 0000010
67#define INPCK 0000020
68#define ISTRIP 0000040
69#define INLCR 0000100
70#define IGNCR 0000200
71#define ICRNL 0000400
72#define IUCLC 0001000
73#define IXON 0002000
74#define IXANY 0004000
75#define IXOFF 0010000
76#define IMAXBEL 0020000
77#define IUTF8 0040000
78
79/* c_oflag bits */
80#define OPOST 0000001
81#define OLCUC 0000002
82#define ONLCR 0000004
83#define OCRNL 0000010
84#define ONOCR 0000020
85#define ONLRET 0000040
86#define OFILL 0000100
87#define OFDEL 0000200
88#define NLDLY 0000400
89#define NL0 0000000
90#define NL1 0000400
91#define CRDLY 0003000
92#define CR0 0000000
93#define CR1 0001000
94#define CR2 0002000
95#define CR3 0003000
96#define TABDLY 0014000
97#define TAB0 0000000
98#define TAB1 0004000
99#define TAB2 0010000
100#define TAB3 0014000
101#define XTABS 0014000
102#define BSDLY 0020000
103#define BS0 0000000
104#define BS1 0020000
105#define VTDLY 0040000
106#define VT0 0000000
107#define VT1 0040000
108#define FFDLY 0100000
109#define FF0 0000000
110#define FF1 0100000
111
112/* c_cflag bit meaning */
113#define CBAUD 0010017
114#define B0 0000000 /* hang up */
115#define B50 0000001
116#define B75 0000002
117#define B110 0000003
118#define B134 0000004
119#define B150 0000005
120#define B200 0000006
121#define B300 0000007
122#define B600 0000010
123#define B1200 0000011
124#define B1800 0000012
125#define B2400 0000013
126#define B4800 0000014
127#define B9600 0000015
128#define B19200 0000016
129#define B38400 0000017
130#define EXTA B19200
131#define EXTB B38400
132#define CSIZE 0000060
133#define CS5 0000000
134#define CS6 0000020
135#define CS7 0000040
136#define CS8 0000060
137#define CSTOPB 0000100
138#define CREAD 0000200
139#define PARENB 0000400
140#define PARODD 0001000
141#define HUPCL 0002000
142#define CLOCAL 0004000
143#define CBAUDEX 0010000
144#define BOTHER 0010000
145#define B57600 0010001
146#define B115200 0010002
147#define B230400 0010003
148#define B460800 0010004
149#define B500000 0010005
150#define B576000 0010006
151#define B921600 0010007
152#define B1000000 0010010
153#define B1152000 0010011
154#define B1500000 0010012
155#define B2000000 0010013
156#define B2500000 0010014
157#define B3000000 0010015
158#define B3500000 0010016
159#define B4000000 0010017
160#define CIBAUD 002003600000 /* input baud rate */
161#define CMSPAR 010000000000 /* mark or space (stick) parity */
162#define CRTSCTS 020000000000 /* flow control */
163
164#define IBSHIFT 16 /* shift from CBAUD to CIBAUD */
165
166/* c_lflag bits */
167#define ISIG 0000001
168#define ICANON 0000002
169#define XCASE 0000004
170#define ECHO 0000010
171#define ECHOE 0000020
172#define ECHOK 0000040
173#define ECHONL 0000100
174#define NOFLSH 0000200
175#define TOSTOP 0000400
176#define ECHOCTL 0001000
177#define ECHOPRT 0002000
178#define ECHOKE 0004000
179#define FLUSHO 0010000
180#define PENDIN 0040000
181#define IEXTEN 0100000
182#define EXTPROC 0200000
183
184
185/* tcflow() and TCXONC use these */
186#define TCOOFF 0
187#define TCOON 1
188#define TCIOFF 2
189#define TCION 3
190
191/* tcflush() and TCFLSH use these */
192#define TCIFLUSH 0
193#define TCOFLUSH 1
194#define TCIOFLUSH 2
195
196/* tcsetattr uses these */
197#define TCSANOW 0
198#define TCSADRAIN 1
199#define TCSAFLUSH 2
200
201#endif /* __ARCH_H8300_TERMBITS_H__ */
diff --git a/arch/h8300/include/uapi/asm/termios.h b/arch/h8300/include/uapi/asm/termios.h
deleted file mode 100644
index 5a67d7e38843..000000000000
--- a/arch/h8300/include/uapi/asm/termios.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef _UAPI_H8300_TERMIOS_H
2#define _UAPI_H8300_TERMIOS_H
3
4#include <asm/termbits.h>
5#include <asm/ioctls.h>
6
7struct winsize {
8 unsigned short ws_row;
9 unsigned short ws_col;
10 unsigned short ws_xpixel;
11 unsigned short ws_ypixel;
12};
13
14#define NCC 8
15struct termio {
16 unsigned short c_iflag; /* input mode flags */
17 unsigned short c_oflag; /* output mode flags */
18 unsigned short c_cflag; /* control mode flags */
19 unsigned short c_lflag; /* local mode flags */
20 unsigned char c_line; /* line discipline */
21 unsigned char c_cc[NCC]; /* control characters */
22};
23
24
25/* modem lines */
26#define TIOCM_LE 0x001
27#define TIOCM_DTR 0x002
28#define TIOCM_RTS 0x004
29#define TIOCM_ST 0x008
30#define TIOCM_SR 0x010
31#define TIOCM_CTS 0x020
32#define TIOCM_CAR 0x040
33#define TIOCM_RNG 0x080
34#define TIOCM_DSR 0x100
35#define TIOCM_CD TIOCM_CAR
36#define TIOCM_RI TIOCM_RNG
37#define TIOCM_OUT1 0x2000
38#define TIOCM_OUT2 0x4000
39#define TIOCM_LOOP 0x8000
40
41/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
42
43
44#endif /* _UAPI_H8300_TERMIOS_H */
diff --git a/arch/h8300/include/uapi/asm/types.h b/arch/h8300/include/uapi/asm/types.h
deleted file mode 100644
index 9ec9d4c5ac4d..000000000000
--- a/arch/h8300/include/uapi/asm/types.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/int-ll64.h>
diff --git a/arch/h8300/include/uapi/asm/unistd.h b/arch/h8300/include/uapi/asm/unistd.h
deleted file mode 100644
index 8cb5d429f840..000000000000
--- a/arch/h8300/include/uapi/asm/unistd.h
+++ /dev/null
@@ -1,330 +0,0 @@
1#ifndef _UAPI_ASM_H8300_UNISTD_H_
2#define _UAPI_ASM_H8300_UNISTD_H_
3
4/*
5 * This file contains the system call numbers.
6 */
7
8#define __NR_restart_syscall 0
9#define __NR_exit 1
10#define __NR_fork 2
11#define __NR_read 3
12#define __NR_write 4
13#define __NR_open 5
14#define __NR_close 6
15#define __NR_waitpid 7
16#define __NR_creat 8
17#define __NR_link 9
18#define __NR_unlink 10
19#define __NR_execve 11
20#define __NR_chdir 12
21#define __NR_time 13
22#define __NR_mknod 14
23#define __NR_chmod 15
24#define __NR_lchown 16
25#define __NR_break 17
26#define __NR_oldstat 18
27#define __NR_lseek 19
28#define __NR_getpid 20
29#define __NR_mount 21
30#define __NR_umount 22
31#define __NR_setuid 23
32#define __NR_getuid 24
33#define __NR_stime 25
34#define __NR_ptrace 26
35#define __NR_alarm 27
36#define __NR_oldfstat 28
37#define __NR_pause 29
38#define __NR_utime 30
39#define __NR_stty 31
40#define __NR_gtty 32
41#define __NR_access 33
42#define __NR_nice 34
43#define __NR_ftime 35
44#define __NR_sync 36
45#define __NR_kill 37
46#define __NR_rename 38
47#define __NR_mkdir 39
48#define __NR_rmdir 40
49#define __NR_dup 41
50#define __NR_pipe 42
51#define __NR_times 43
52#define __NR_prof 44
53#define __NR_brk 45
54#define __NR_setgid 46
55#define __NR_getgid 47
56#define __NR_signal 48
57#define __NR_geteuid 49
58#define __NR_getegid 50
59#define __NR_acct 51
60#define __NR_umount2 52
61#define __NR_lock 53
62#define __NR_ioctl 54
63#define __NR_fcntl 55
64#define __NR_mpx 56
65#define __NR_setpgid 57
66#define __NR_ulimit 58
67#define __NR_oldolduname 59
68#define __NR_umask 60
69#define __NR_chroot 61
70#define __NR_ustat 62
71#define __NR_dup2 63
72#define __NR_getppid 64
73#define __NR_getpgrp 65
74#define __NR_setsid 66
75#define __NR_sigaction 67
76#define __NR_sgetmask 68
77#define __NR_ssetmask 69
78#define __NR_setreuid 70
79#define __NR_setregid 71
80#define __NR_sigsuspend 72
81#define __NR_sigpending 73
82#define __NR_sethostname 74
83#define __NR_setrlimit 75
84#define __NR_getrlimit 76
85#define __NR_getrusage 77
86#define __NR_gettimeofday 78
87#define __NR_settimeofday 79
88#define __NR_getgroups 80
89#define __NR_setgroups 81
90#define __NR_select 82
91#define __NR_symlink 83
92#define __NR_oldlstat 84
93#define __NR_readlink 85
94#define __NR_uselib 86
95#define __NR_swapon 87
96#define __NR_reboot 88
97#define __NR_readdir 89
98#define __NR_mmap 90
99#define __NR_munmap 91
100#define __NR_truncate 92
101#define __NR_ftruncate 93
102#define __NR_fchmod 94
103#define __NR_fchown 95
104#define __NR_getpriority 96
105#define __NR_setpriority 97
106#define __NR_profil 98
107#define __NR_statfs 99
108#define __NR_fstatfs 100
109#define __NR_ioperm 101
110#define __NR_socketcall 102
111#define __NR_syslog 103
112#define __NR_setitimer 104
113#define __NR_getitimer 105
114#define __NR_stat 106
115#define __NR_lstat 107
116#define __NR_fstat 108
117#define __NR_olduname 109
118#define __NR_iopl 110
119#define __NR_vhangup 111
120#define __NR_idle 112
121#define __NR_vm86old 113
122#define __NR_wait4 114
123#define __NR_swapoff 115
124#define __NR_sysinfo 116
125#define __NR_ipc 117
126#define __NR_fsync 118
127#define __NR_sigreturn 119
128#define __NR_clone 120
129#define __NR_setdomainname 121
130#define __NR_uname 122
131#define __NR_modify_ldt 123
132#define __NR_adjtimex 124
133#define __NR_mprotect 125
134#define __NR_sigprocmask 126
135#define __NR_create_module 127
136#define __NR_init_module 128
137#define __NR_delete_module 129
138#define __NR_get_kernel_syms 130
139#define __NR_quotactl 131
140#define __NR_getpgid 132
141#define __NR_fchdir 133
142#define __NR_bdflush 134
143#define __NR_sysfs 135
144#define __NR_personality 136
145#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
146#define __NR_setfsuid 138
147#define __NR_setfsgid 139
148#define __NR__llseek 140
149#define __NR_getdents 141
150#define __NR__newselect 142
151#define __NR_flock 143
152#define __NR_msync 144
153#define __NR_readv 145
154#define __NR_writev 146
155#define __NR_getsid 147
156#define __NR_fdatasync 148
157#define __NR__sysctl 149
158#define __NR_mlock 150
159#define __NR_munlock 151
160#define __NR_mlockall 152
161#define __NR_munlockall 153
162#define __NR_sched_setparam 154
163#define __NR_sched_getparam 155
164#define __NR_sched_setscheduler 156
165#define __NR_sched_getscheduler 157
166#define __NR_sched_yield 158
167#define __NR_sched_get_priority_max 159
168#define __NR_sched_get_priority_min 160
169#define __NR_sched_rr_get_interval 161
170#define __NR_nanosleep 162
171#define __NR_mremap 163
172#define __NR_setresuid 164
173#define __NR_getresuid 165
174#define __NR_vm86 166
175#define __NR_query_module 167
176#define __NR_poll 168
177#define __NR_nfsservctl 169
178#define __NR_setresgid 170
179#define __NR_getresgid 171
180#define __NR_prctl 172
181#define __NR_rt_sigreturn 173
182#define __NR_rt_sigaction 174
183#define __NR_rt_sigprocmask 175
184#define __NR_rt_sigpending 176
185#define __NR_rt_sigtimedwait 177
186#define __NR_rt_sigqueueinfo 178
187#define __NR_rt_sigsuspend 179
188#define __NR_pread64 180
189#define __NR_pwrite64 181
190#define __NR_chown 182
191#define __NR_getcwd 183
192#define __NR_capget 184
193#define __NR_capset 185
194#define __NR_sigaltstack 186
195#define __NR_sendfile 187
196#define __NR_getpmsg 188 /* some people actually want streams */
197#define __NR_putpmsg 189 /* some people actually want streams */
198#define __NR_vfork 190
199#define __NR_ugetrlimit 191
200#define __NR_mmap2 192
201#define __NR_truncate64 193
202#define __NR_ftruncate64 194
203#define __NR_stat64 195
204#define __NR_lstat64 196
205#define __NR_fstat64 197
206#define __NR_lchown32 198
207#define __NR_getuid32 199
208#define __NR_getgid32 200
209#define __NR_geteuid32 201
210#define __NR_getegid32 202
211#define __NR_setreuid32 203
212#define __NR_setregid32 204
213#define __NR_getgroups32 205
214#define __NR_setgroups32 206
215#define __NR_fchown32 207
216#define __NR_setresuid32 208
217#define __NR_getresuid32 209
218#define __NR_setresgid32 210
219#define __NR_getresgid32 211
220#define __NR_chown32 212
221#define __NR_setuid32 213
222#define __NR_setgid32 214
223#define __NR_setfsuid32 215
224#define __NR_setfsgid32 216
225#define __NR_pivot_root 217
226#define __NR_mincore 218
227#define __NR_madvise 219
228#define __NR_madvise1 219
229#define __NR_getdents64 220
230#define __NR_fcntl64 221
231/* 223 is unused */
232#define __NR_gettid 224
233#define __NR_readahead 225
234#define __NR_setxattr 226
235#define __NR_lsetxattr 227
236#define __NR_fsetxattr 228
237#define __NR_getxattr 229
238#define __NR_lgetxattr 230
239#define __NR_fgetxattr 231
240#define __NR_listxattr 232
241#define __NR_llistxattr 233
242#define __NR_flistxattr 234
243#define __NR_removexattr 235
244#define __NR_lremovexattr 236
245#define __NR_fremovexattr 237
246#define __NR_tkill 238
247#define __NR_sendfile64 239
248#define __NR_futex 240
249#define __NR_sched_setaffinity 241
250#define __NR_sched_getaffinity 242
251#define __NR_set_thread_area 243
252#define __NR_get_thread_area 244
253#define __NR_io_setup 245
254#define __NR_io_destroy 246
255#define __NR_io_getevents 247
256#define __NR_io_submit 248
257#define __NR_io_cancel 249
258#define __NR_fadvise64 250
259/* 251 is available for reuse (was briefly sys_set_zone_reclaim) */
260#define __NR_exit_group 252
261#define __NR_lookup_dcookie 253
262#define __NR_epoll_create 254
263#define __NR_epoll_ctl 255
264#define __NR_epoll_wait 256
265#define __NR_remap_file_pages 257
266#define __NR_set_tid_address 258
267#define __NR_timer_create 259
268#define __NR_timer_settime (__NR_timer_create+1)
269#define __NR_timer_gettime (__NR_timer_create+2)
270#define __NR_timer_getoverrun (__NR_timer_create+3)
271#define __NR_timer_delete (__NR_timer_create+4)
272#define __NR_clock_settime (__NR_timer_create+5)
273#define __NR_clock_gettime (__NR_timer_create+6)
274#define __NR_clock_getres (__NR_timer_create+7)
275#define __NR_clock_nanosleep (__NR_timer_create+8)
276#define __NR_statfs64 268
277#define __NR_fstatfs64 269
278#define __NR_tgkill 270
279#define __NR_utimes 271
280#define __NR_fadvise64_64 272
281#define __NR_vserver 273
282#define __NR_mbind 274
283#define __NR_get_mempolicy 275
284#define __NR_set_mempolicy 276
285#define __NR_mq_open 277
286#define __NR_mq_unlink (__NR_mq_open+1)
287#define __NR_mq_timedsend (__NR_mq_open+2)
288#define __NR_mq_timedreceive (__NR_mq_open+3)
289#define __NR_mq_notify (__NR_mq_open+4)
290#define __NR_mq_getsetattr (__NR_mq_open+5)
291#define __NR_kexec_load 283
292#define __NR_waitid 284
293/* #define __NR_sys_setaltroot 285 */
294#define __NR_add_key 286
295#define __NR_request_key 287
296#define __NR_keyctl 288
297#define __NR_ioprio_set 289
298#define __NR_ioprio_get 290
299#define __NR_inotify_init 291
300#define __NR_inotify_add_watch 292
301#define __NR_inotify_rm_watch 293
302#define __NR_migrate_pages 294
303#define __NR_openat 295
304#define __NR_mkdirat 296
305#define __NR_mknodat 297
306#define __NR_fchownat 298
307#define __NR_futimesat 299
308#define __NR_fstatat64 300
309#define __NR_unlinkat 301
310#define __NR_renameat 302
311#define __NR_linkat 303
312#define __NR_symlinkat 304
313#define __NR_readlinkat 305
314#define __NR_fchmodat 306
315#define __NR_faccessat 307
316#define __NR_pselect6 308
317#define __NR_ppoll 309
318#define __NR_unshare 310
319#define __NR_set_robust_list 311
320#define __NR_get_robust_list 312
321#define __NR_splice 313
322#define __NR_sync_file_range 314
323#define __NR_tee 315
324#define __NR_vmsplice 316
325#define __NR_move_pages 317
326#define __NR_getcpu 318
327#define __NR_epoll_pwait 319
328#define __NR_setns 320
329
330#endif /* _UAPI_ASM_H8300_UNISTD_H_ */
diff --git a/arch/h8300/kernel/Makefile b/arch/h8300/kernel/Makefile
deleted file mode 100644
index 1cc57f872d34..000000000000
--- a/arch/h8300/kernel/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5extra-y := vmlinux.lds
6
7obj-y := process.o traps.o ptrace.o irq.o \
8 sys_h8300.o time.o signal.o \
9 setup.o gpio.o syscalls.o \
10 entry.o timer/
11
12obj-$(CONFIG_MODULES) += module.o h8300_ksyms.o
diff --git a/arch/h8300/kernel/asm-offsets.c b/arch/h8300/kernel/asm-offsets.c
deleted file mode 100644
index fd961e0bd741..000000000000
--- a/arch/h8300/kernel/asm-offsets.c
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * This program is used to generate definitions needed by
3 * assembly language modules.
4 *
5 * We use the technique used in the OSF Mach kernel code:
6 * generate asm statements containing #defines,
7 * compile this file to assembler, and then extract the
8 * #defines from the assembly-language output.
9 */
10
11#include <linux/stddef.h>
12#include <linux/sched.h>
13#include <linux/kernel_stat.h>
14#include <linux/ptrace.h>
15#include <linux/hardirq.h>
16#include <linux/kbuild.h>
17#include <asm/bootinfo.h>
18#include <asm/irq.h>
19#include <asm/ptrace.h>
20
21int main(void)
22{
23 /* offsets into the task struct */
24 DEFINE(TASK_STATE, offsetof(struct task_struct, state));
25 DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
26 DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));
27 DEFINE(TASK_BLOCKED, offsetof(struct task_struct, blocked));
28 DEFINE(TASK_THREAD, offsetof(struct task_struct, thread));
29 DEFINE(TASK_THREAD_INFO, offsetof(struct task_struct, stack));
30 DEFINE(TASK_MM, offsetof(struct task_struct, mm));
31 DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
32
33 /* offsets into the irq_cpustat_t struct */
34 DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending));
35
36 /* offsets into the thread struct */
37 DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp));
38 DEFINE(THREAD_USP, offsetof(struct thread_struct, usp));
39 DEFINE(THREAD_CCR, offsetof(struct thread_struct, ccr));
40
41 /* offsets into the pt_regs struct */
42 DEFINE(LER0, offsetof(struct pt_regs, er0) - sizeof(long));
43 DEFINE(LER1, offsetof(struct pt_regs, er1) - sizeof(long));
44 DEFINE(LER2, offsetof(struct pt_regs, er2) - sizeof(long));
45 DEFINE(LER3, offsetof(struct pt_regs, er3) - sizeof(long));
46 DEFINE(LER4, offsetof(struct pt_regs, er4) - sizeof(long));
47 DEFINE(LER5, offsetof(struct pt_regs, er5) - sizeof(long));
48 DEFINE(LER6, offsetof(struct pt_regs, er6) - sizeof(long));
49 DEFINE(LORIG, offsetof(struct pt_regs, orig_er0) - sizeof(long));
50 DEFINE(LCCR, offsetof(struct pt_regs, ccr) - sizeof(long));
51 DEFINE(LVEC, offsetof(struct pt_regs, vector) - sizeof(long));
52#if defined(__H8300S__)
53 DEFINE(LEXR, offsetof(struct pt_regs, exr) - sizeof(long));
54#endif
55 DEFINE(LRET, offsetof(struct pt_regs, pc) - sizeof(long));
56
57 DEFINE(PT_PTRACED, PT_PTRACED);
58
59 return 0;
60}
diff --git a/arch/h8300/kernel/entry.S b/arch/h8300/kernel/entry.S
deleted file mode 100644
index 94bd30f11df6..000000000000
--- a/arch/h8300/kernel/entry.S
+++ /dev/null
@@ -1,402 +0,0 @@
1/* -*- mode: asm -*-
2 *
3 * linux/arch/h8300/platform/h8300h/entry.S
4 *
5 * Yoshinori Sato <ysato@users.sourceforge.jp>
6 * David McCullough <davidm@snapgear.com>
7 *
8 */
9
10/*
11 * entry.S
12 * include exception/interrupt gateway
13 * system call entry
14 */
15
16#include <linux/sys.h>
17#include <asm/unistd.h>
18#include <asm/setup.h>
19#include <asm/segment.h>
20#include <asm/linkage.h>
21#include <asm/asm-offsets.h>
22#include <asm/thread_info.h>
23#include <asm/errno.h>
24
25#if defined(CONFIG_CPU_H8300H)
26#define USERRET 8
27INTERRUPTS = 64
28 .h8300h
29 .macro SHLL2 reg
30 shll.l \reg
31 shll.l \reg
32 .endm
33 .macro SHLR2 reg
34 shlr.l \reg
35 shlr.l \reg
36 .endm
37 .macro SAVEREGS
38 mov.l er0,@-sp
39 mov.l er1,@-sp
40 mov.l er2,@-sp
41 mov.l er3,@-sp
42 .endm
43 .macro RESTOREREGS
44 mov.l @sp+,er3
45 mov.l @sp+,er2
46 .endm
47 .macro SAVEEXR
48 .endm
49 .macro RESTOREEXR
50 .endm
51#endif
52#if defined(CONFIG_CPU_H8S)
53#define USERRET 10
54#define USEREXR 8
55INTERRUPTS = 128
56 .h8300s
57 .macro SHLL2 reg
58 shll.l #2,\reg
59 .endm
60 .macro SHLR2 reg
61 shlr.l #2,\reg
62 .endm
63 .macro SAVEREGS
64 stm.l er0-er3,@-sp
65 .endm
66 .macro RESTOREREGS
67 ldm.l @sp+,er2-er3
68 .endm
69 .macro SAVEEXR
70 mov.w @(USEREXR:16,er0),r1
71 mov.w r1,@(LEXR-LER3:16,sp) /* copy EXR */
72 .endm
73 .macro RESTOREEXR
74 mov.w @(LEXR-LER1:16,sp),r1 /* restore EXR */
75 mov.b r1l,r1h
76 mov.w r1,@(USEREXR:16,er0)
77 .endm
78#endif
79
80
81/* CPU context save/restore macros. */
82
83 .macro SAVE_ALL
84 mov.l er0,@-sp
85 stc ccr,r0l /* check kernel mode */
86 btst #4,r0l
87 bne 5f
88
89 /* user mode */
90 mov.l sp,@_sw_usp
91 mov.l @sp,er0 /* restore saved er0 */
92 orc #0x10,ccr /* switch kernel stack */
93 mov.l @_sw_ksp,sp
94 sub.l #(LRET-LORIG),sp /* allocate LORIG - LRET */
95 SAVEREGS
96 mov.l @_sw_usp,er0
97 mov.l @(USERRET:16,er0),er1 /* copy the RET addr */
98 mov.l er1,@(LRET-LER3:16,sp)
99 SAVEEXR
100
101 mov.l @(LORIG-LER3:16,sp),er0
102 mov.l er0,@(LER0-LER3:16,sp) /* copy ER0 */
103 mov.w e1,r1 /* e1 highbyte = ccr */
104 and #0xef,r1h /* mask mode? flag */
105 bra 6f
1065:
107 /* kernel mode */
108 mov.l @sp,er0 /* restore saved er0 */
109 subs #2,sp /* set dummy ccr */
110 SAVEREGS
111 mov.w @(LRET-LER3:16,sp),r1 /* copy old ccr */
1126:
113 mov.b r1h,r1l
114 mov.b #0,r1h
115 mov.w r1,@(LCCR-LER3:16,sp) /* set ccr */
116 mov.l er6,@-sp /* syscall arg #6 */
117 mov.l er5,@-sp /* syscall arg #5 */
118 mov.l er4,@-sp /* syscall arg #4 */
119 .endm /* r1 = ccr */
120
121 .macro RESTORE_ALL
122 mov.l @sp+,er4
123 mov.l @sp+,er5
124 mov.l @sp+,er6
125 RESTOREREGS
126 mov.w @(LCCR-LER1:16,sp),r0 /* check kernel mode */
127 btst #4,r0l
128 bne 7f
129
130 orc #0x80,ccr
131 mov.l @_sw_usp,er0
132 mov.l @(LER0-LER1:16,sp),er1 /* restore ER0 */
133 mov.l er1,@er0
134 RESTOREEXR
135 mov.w @(LCCR-LER1:16,sp),r1 /* restore the RET addr */
136 mov.b r1l,r1h
137 mov.b @(LRET+1-LER1:16,sp),r1l
138 mov.w r1,e1
139 mov.w @(LRET+2-LER1:16,sp),r1
140 mov.l er1,@(USERRET:16,er0)
141
142 mov.l @sp+,er1
143 add.l #(LRET-LER1),sp /* remove LORIG - LRET */
144 mov.l sp,@_sw_ksp
145 andc #0xef,ccr /* switch to user mode */
146 mov.l er0,sp
147 bra 8f
1487:
149 mov.l @sp+,er1
150 adds #4,sp
151 adds #2,sp
1528:
153 mov.l @sp+,er0
154 adds #4,sp /* remove the sw created LVEC */
155 rte
156 .endm
157
158.globl _system_call
159.globl _ret_from_exception
160.globl _ret_from_fork
161.globl _ret_from_kernel_thread
162.globl _ret_from_interrupt
163.globl _interrupt_redirect_table
164.globl _sw_ksp,_sw_usp
165.globl _resume
166.globl _interrupt_entry
167.globl _trace_break
168
169#if defined(CONFIG_ROMKERNEL)
170 .section .int_redirect,"ax"
171_interrupt_redirect_table:
172#if defined(CONFIG_CPU_H8300H)
173 .rept 7
174 .long 0
175 .endr
176#endif
177#if defined(CONFIG_CPU_H8S)
178 .rept 5
179 .long 0
180 .endr
181 jmp @_trace_break
182 .long 0
183#endif
184
185 jsr @_interrupt_entry /* NMI */
186 jmp @_system_call /* TRAPA #0 (System call) */
187 .long 0
188 .long 0
189 jmp @_trace_break /* TRAPA #3 (breakpoint) */
190 .rept INTERRUPTS-12
191 jsr @_interrupt_entry
192 .endr
193#endif
194#if defined(CONFIG_RAMKERNEL)
195.globl _interrupt_redirect_table
196 .section .bss
197_interrupt_redirect_table:
198 .space 4
199#endif
200
201 .section .text
202 .align 2
203_interrupt_entry:
204 SAVE_ALL
205 mov.l sp,er0
206 add.l #LVEC,er0
207 btst #4,r1l
208 bne 1f
209 /* user LVEC */
210 mov.l @_sw_usp,er0
211 adds #4,er0
2121:
213 mov.l @er0,er0 /* LVEC address */
214#if defined(CONFIG_ROMKERNEL)
215 sub.l #_interrupt_redirect_table,er0
216#endif
217#if defined(CONFIG_RAMKERNEL)
218 mov.l @_interrupt_redirect_table,er1
219 sub.l er1,er0
220#endif
221 SHLR2 er0
222 dec.l #1,er0
223 mov.l sp,er1
224 subs #4,er1 /* adjust ret_pc */
225 jsr @_do_IRQ
226 jmp @_ret_from_interrupt
227
228_system_call:
229 subs #4,sp /* dummy LVEC */
230 SAVE_ALL
231 andc #0x7f,ccr
232 mov.l er0,er4
233
234 /* save top of frame */
235 mov.l sp,er0
236 jsr @_set_esp0
237 mov.l sp,er2
238 and.w #0xe000,r2
239 mov.b @((TI_FLAGS+3-(TIF_SYSCALL_TRACE >> 3)):16,er2),r2l
240 btst #(TIF_SYSCALL_TRACE & 7),r2l
241 beq 1f
242 jsr @_do_syscall_trace
2431:
244 cmp.l #NR_syscalls,er4
245 bcc badsys
246 SHLL2 er4
247 mov.l #_sys_call_table,er0
248 add.l er4,er0
249 mov.l @er0,er4
250 beq _ret_from_exception:16
251 mov.l @(LER1:16,sp),er0
252 mov.l @(LER2:16,sp),er1
253 mov.l @(LER3:16,sp),er2
254 jsr @er4
255 mov.l er0,@(LER0:16,sp) /* save the return value */
256 mov.l sp,er2
257 and.w #0xe000,r2
258 mov.b @((TI_FLAGS+3-(TIF_SYSCALL_TRACE >> 3)):16,er2),r2l
259 btst #(TIF_SYSCALL_TRACE & 7),r2l
260 beq 2f
261 jsr @_do_syscall_trace
2622:
263#if defined(CONFIG_SYSCALL_PRINT)
264 jsr @_syscall_print
265#endif
266 orc #0x80,ccr
267 bra resume_userspace
268
269badsys:
270 mov.l #-ENOSYS,er0
271 mov.l er0,@(LER0:16,sp)
272 bra resume_userspace
273
274#if !defined(CONFIG_PREEMPT)
275#define resume_kernel restore_all
276#endif
277
278_ret_from_exception:
279#if defined(CONFIG_PREEMPT)
280 orc #0x80,ccr
281#endif
282_ret_from_interrupt:
283 mov.b @(LCCR+1:16,sp),r0l
284 btst #4,r0l
285 bne resume_kernel:8 /* return from kernel */
286resume_userspace:
287 andc #0x7f,ccr
288 mov.l sp,er4
289 and.w #0xe000,r4 /* er4 <- current thread info */
290 mov.l @(TI_FLAGS:16,er4),er1
291 and.l #_TIF_WORK_MASK,er1
292 beq restore_all:8
293work_pending:
294 btst #TIF_NEED_RESCHED,r1l
295 bne work_resched:8
296 /* work notifysig */
297 mov.l sp,er0
298 subs #4,er0 /* er0: pt_regs */
299 jsr @_do_notify_resume
300 bra restore_all:8
301work_resched:
302 mov.l sp,er0
303 jsr @_set_esp0
304 jsr @_schedule
305 bra resume_userspace:8
306restore_all:
307 RESTORE_ALL /* Does RTE */
308
309#if defined(CONFIG_PREEMPT)
310resume_kernel:
311 mov.l @(TI_PRE_COUNT:16,er4),er0
312 bne restore_all:8
313need_resched:
314 mov.l @(TI_FLAGS:16,er4),er0
315 btst #TIF_NEED_RESCHED,r0l
316 beq restore_all:8
317 mov.b @(LCCR+1:16,sp),r0l /* Interrupt Enabled? */
318 bmi restore_all:8
319 mov.l #PREEMPT_ACTIVE,er0
320 mov.l er0,@(TI_PRE_COUNT:16,er4)
321 andc #0x7f,ccr
322 mov.l sp,er0
323 jsr @_set_esp0
324 jsr @_schedule
325 orc #0x80,ccr
326 bra need_resched:8
327#endif
328
329_ret_from_fork:
330 mov.l er2,er0
331 jsr @_schedule_tail
332 jmp @_ret_from_exception
333
334_ret_from_kernel_thread:
335 mov.l er2,er0
336 jsr @_schedule_tail
337 mov.l @(LER4:16,sp),er0
338 mov.l @(LER5:16,sp),er1
339 jsr @er1
340 jmp @_ret_from_exception
341
342_resume:
343 /*
344 * Beware - when entering resume, offset of tss is in d1,
345 * prev (the current task) is in a0, next (the new task)
346 * is in a1 and d2.b is non-zero if the mm structure is
347 * shared between the tasks, so don't change these
348 * registers until their contents are no longer needed.
349 */
350
351 /* save sr */
352 sub.w r3,r3
353 stc ccr,r3l
354 mov.w r3,@(THREAD_CCR+2:16,er0)
355
356 /* disable interrupts */
357 orc #0x80,ccr
358 mov.l @_sw_usp,er3
359 mov.l er3,@(THREAD_USP:16,er0)
360 mov.l sp,@(THREAD_KSP:16,er0)
361
362 /* Skip address space switching if they are the same. */
363 /* FIXME: what did we hack out of here, this does nothing! */
364
365 mov.l @(THREAD_USP:16,er1),er0
366 mov.l er0,@_sw_usp
367 mov.l @(THREAD_KSP:16,er1),sp
368
369 /* restore status register */
370 mov.w @(THREAD_CCR+2:16,er1),r3
371
372 ldc r3l,ccr
373 rts
374
375_trace_break:
376 subs #4,sp
377 SAVE_ALL
378 sub.l er1,er1
379 dec.l #1,er1
380 mov.l er1,@(LORIG,sp)
381 mov.l sp,er0
382 jsr @_set_esp0
383 mov.l @_sw_usp,er0
384 mov.l @er0,er1
385 mov.w @(-2:16,er1),r2
386 cmp.w #0x5730,r2
387 beq 1f
388 subs #2,er1
389 mov.l er1,@er0
3901:
391 and.w #0xff,e1
392 mov.l er1,er0
393 jsr @_trace_trap
394 jmp @_ret_from_exception
395
396 .section .bss
397_sw_ksp:
398 .space 4
399_sw_usp:
400 .space 4
401
402 .end
diff --git a/arch/h8300/kernel/gpio.c b/arch/h8300/kernel/gpio.c
deleted file mode 100644
index 084bfd0c107e..000000000000
--- a/arch/h8300/kernel/gpio.c
+++ /dev/null
@@ -1,178 +0,0 @@
1/*
2 * linux/arch/h8300/kernel/gpio.c
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 */
7
8/*
9 * Internal I/O Port Management
10 */
11
12#include <linux/stddef.h>
13#include <linux/proc_fs.h>
14#include <linux/seq_file.h>
15#include <linux/kernel.h>
16#include <linux/string.h>
17#include <linux/fs.h>
18#include <linux/init.h>
19
20#define _(addr) (volatile unsigned char *)(addr)
21#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
22#include <asm/regs306x.h>
23static volatile unsigned char *ddrs[] = {
24 _(P1DDR),_(P2DDR),_(P3DDR),_(P4DDR),_(P5DDR),_(P6DDR),
25 NULL, _(P8DDR),_(P9DDR),_(PADDR),_(PBDDR),
26};
27#define MAX_PORT 11
28#endif
29
30 #if defined(CONFIG_H83002) || defined(CONFIG_H8048)
31/* Fix me!! */
32#include <asm/regs306x.h>
33static volatile unsigned char *ddrs[] = {
34 _(P1DDR),_(P2DDR),_(P3DDR),_(P4DDR),_(P5DDR),_(P6DDR),
35 NULL, _(P8DDR),_(P9DDR),_(PADDR),_(PBDDR),
36};
37#define MAX_PORT 11
38#endif
39
40#if defined(CONFIG_H8S2678)
41#include <asm/regs267x.h>
42static volatile unsigned char *ddrs[] = {
43 _(P1DDR),_(P2DDR),_(P3DDR),NULL ,_(P5DDR),_(P6DDR),
44 _(P7DDR),_(P8DDR),NULL, _(PADDR),_(PBDDR),_(PCDDR),
45 _(PDDDR),_(PEDDR),_(PFDDR),_(PGDDR),_(PHDDR),
46 _(PADDR),_(PBDDR),_(PCDDR),_(PDDDR),_(PEDDR),_(PFDDR),
47 _(PGDDR),_(PHDDR)
48};
49#define MAX_PORT 17
50#endif
51#undef _
52
53#if !defined(P1DDR)
54#error Unsuppoted CPU Selection
55#endif
56
57static struct {
58 unsigned char used;
59 unsigned char ddr;
60} gpio_regs[MAX_PORT];
61
62extern char *_platform_gpio_table(int length);
63
64int h8300_reserved_gpio(int port, unsigned int bits)
65{
66 unsigned char *used;
67
68 if (port < 0 || port >= MAX_PORT)
69 return -1;
70 used = &(gpio_regs[port].used);
71 if ((*used & bits) != 0)
72 return 0;
73 *used |= bits;
74 return 1;
75}
76
77int h8300_free_gpio(int port, unsigned int bits)
78{
79 unsigned char *used;
80
81 if (port < 0 || port >= MAX_PORT)
82 return -1;
83 used = &(gpio_regs[port].used);
84 if ((*used & bits) != bits)
85 return 0;
86 *used &= (~bits);
87 return 1;
88}
89
90int h8300_set_gpio_dir(int port_bit,int dir)
91{
92 int port = (port_bit >> 8) & 0xff;
93 int bit = port_bit & 0xff;
94
95 if (ddrs[port] == NULL)
96 return 0;
97 if (gpio_regs[port].used & bit) {
98 if (dir)
99 gpio_regs[port].ddr |= bit;
100 else
101 gpio_regs[port].ddr &= ~bit;
102 *ddrs[port] = gpio_regs[port].ddr;
103 return 1;
104 } else
105 return 0;
106}
107
108int h8300_get_gpio_dir(int port_bit)
109{
110 int port = (port_bit >> 8) & 0xff;
111 int bit = port_bit & 0xff;
112
113 if (ddrs[port] == NULL)
114 return 0;
115 if (gpio_regs[port].used & bit) {
116 return (gpio_regs[port].ddr & bit) != 0;
117 } else
118 return -1;
119}
120
121#if defined(CONFIG_PROC_FS)
122static char *port_status(int portno)
123{
124 static char result[10];
125 static const char io[2]={'I','O'};
126 char *rp;
127 int c;
128 unsigned char used,ddr;
129
130 used = gpio_regs[portno].used;
131 ddr = gpio_regs[portno].ddr;
132 result[8]='\0';
133 rp = result + 7;
134 for (c = 8; c > 0; c--,rp--,used >>= 1, ddr >>= 1)
135 if (used & 0x01)
136 *rp = io[ ddr & 0x01];
137 else
138 *rp = '-';
139 return result;
140}
141
142static int gpio_proc_show(struct seq_file *m, void *v)
143{
144 static const char port_name[]="123456789ABCDEFGH";
145 int c;
146
147 for (c = 0; c < MAX_PORT; c++) {
148 if (ddrs[c] == NULL)
149 continue;
150 seq_printf(m, "P%c: %s\n", port_name[c], port_status(c));
151 }
152 return 0;
153}
154
155static int gpio_proc_open(struct inode *inode, struct file *file)
156{
157 return single_open(file, gpio_proc_show, PDE_DATA(inode));
158}
159
160static const struct file_operations gpio_proc_fops = {
161 .open = gpio_proc_open,
162 .read = seq_read,
163 .llseek = seq_lseek,
164 .release = single_release,
165};
166
167static __init int register_proc(void)
168{
169 return proc_create("gpio", S_IRUGO, NULL, &gpio_proc_fops) != NULL;
170}
171
172__initcall(register_proc);
173#endif
174
175void __init h8300_gpio_init(void)
176{
177 memcpy(gpio_regs,_platform_gpio_table(sizeof(gpio_regs)),sizeof(gpio_regs));
178}
diff --git a/arch/h8300/kernel/h8300_ksyms.c b/arch/h8300/kernel/h8300_ksyms.c
deleted file mode 100644
index 53d7c0e4bd83..000000000000
--- a/arch/h8300/kernel/h8300_ksyms.c
+++ /dev/null
@@ -1,100 +0,0 @@
1#include <linux/module.h>
2#include <linux/linkage.h>
3#include <linux/sched.h>
4#include <linux/string.h>
5#include <linux/mm.h>
6#include <linux/user.h>
7#include <linux/elfcore.h>
8#include <linux/in6.h>
9#include <linux/interrupt.h>
10
11#include <asm/setup.h>
12#include <asm/pgalloc.h>
13#include <asm/irq.h>
14#include <asm/io.h>
15#include <asm/checksum.h>
16#include <asm/current.h>
17#include <asm/gpio.h>
18
19//asmlinkage long long __ashrdi3 (long long, int);
20//asmlinkage long long __lshrdi3 (long long, int);
21extern char h8300_debug_device[];
22
23/* platform dependent support */
24
25EXPORT_SYMBOL(strnlen);
26EXPORT_SYMBOL(strrchr);
27EXPORT_SYMBOL(strstr);
28EXPORT_SYMBOL(strchr);
29EXPORT_SYMBOL(strcat);
30EXPORT_SYMBOL(strlen);
31EXPORT_SYMBOL(strcmp);
32EXPORT_SYMBOL(strncmp);
33
34EXPORT_SYMBOL(ip_fast_csum);
35
36EXPORT_SYMBOL(enable_irq);
37EXPORT_SYMBOL(disable_irq);
38
39/* Networking helper routines. */
40EXPORT_SYMBOL(csum_partial_copy_nocheck);
41
42/* The following are special because they're not called
43 explicitly (the C compiler generates them). Fortunately,
44 their interface isn't gonna change any time soon now, so
45 it's OK to leave it out of version control. */
46//EXPORT_SYMBOL(__ashrdi3);
47//EXPORT_SYMBOL(__lshrdi3);
48EXPORT_SYMBOL(memcpy);
49EXPORT_SYMBOL(memset);
50EXPORT_SYMBOL(memcmp);
51EXPORT_SYMBOL(memscan);
52EXPORT_SYMBOL(memmove);
53
54/*
55 * libgcc functions - functions that are used internally by the
56 * compiler... (prototypes are not correct though, but that
57 * doesn't really matter since they're not versioned).
58 */
59extern void __gcc_bcmp(void);
60extern void __ashldi3(void);
61extern void __ashrdi3(void);
62extern void __cmpdi2(void);
63extern void __divdi3(void);
64extern void __divsi3(void);
65extern void __lshrdi3(void);
66extern void __moddi3(void);
67extern void __modsi3(void);
68extern void __muldi3(void);
69extern void __mulsi3(void);
70extern void __negdi2(void);
71extern void __ucmpdi2(void);
72extern void __udivdi3(void);
73extern void __udivmoddi4(void);
74extern void __udivsi3(void);
75extern void __umoddi3(void);
76extern void __umodsi3(void);
77
78 /* gcc lib functions */
79EXPORT_SYMBOL(__gcc_bcmp);
80EXPORT_SYMBOL(__ashldi3);
81EXPORT_SYMBOL(__ashrdi3);
82EXPORT_SYMBOL(__cmpdi2);
83EXPORT_SYMBOL(__divdi3);
84EXPORT_SYMBOL(__divsi3);
85EXPORT_SYMBOL(__lshrdi3);
86EXPORT_SYMBOL(__moddi3);
87EXPORT_SYMBOL(__modsi3);
88EXPORT_SYMBOL(__muldi3);
89EXPORT_SYMBOL(__mulsi3);
90EXPORT_SYMBOL(__negdi2);
91EXPORT_SYMBOL(__ucmpdi2);
92EXPORT_SYMBOL(__udivdi3);
93EXPORT_SYMBOL(__udivmoddi4);
94EXPORT_SYMBOL(__udivsi3);
95EXPORT_SYMBOL(__umoddi3);
96EXPORT_SYMBOL(__umodsi3);
97
98EXPORT_SYMBOL(h8300_reserved_gpio);
99EXPORT_SYMBOL(h8300_free_gpio);
100EXPORT_SYMBOL(h8300_set_gpio_dir);
diff --git a/arch/h8300/kernel/irq.c b/arch/h8300/kernel/irq.c
deleted file mode 100644
index 2fa8ac7b79b5..000000000000
--- a/arch/h8300/kernel/irq.c
+++ /dev/null
@@ -1,165 +0,0 @@
1/*
2 * linux/arch/h8300/kernel/irq.c
3 *
4 * Copyright 2007 Yoshinori Sato <ysato@users.sourceforge.jp>
5 */
6
7#include <linux/module.h>
8#include <linux/types.h>
9#include <linux/kernel.h>
10#include <linux/sched.h>
11#include <linux/kernel_stat.h>
12#include <linux/seq_file.h>
13#include <linux/init.h>
14#include <linux/random.h>
15#include <linux/bootmem.h>
16#include <linux/irq.h>
17#include <linux/interrupt.h>
18
19#include <asm/traps.h>
20#include <asm/io.h>
21#include <asm/setup.h>
22#include <asm/errno.h>
23
24/*#define DEBUG*/
25
26extern unsigned long *interrupt_redirect_table;
27extern const int h8300_saved_vectors[];
28extern const h8300_vector h8300_trap_table[];
29int h8300_enable_irq_pin(unsigned int irq);
30void h8300_disable_irq_pin(unsigned int irq);
31
32#define CPU_VECTOR ((unsigned long *)0x000000)
33#define ADDR_MASK (0xffffff)
34
35static inline int is_ext_irq(unsigned int irq)
36{
37 return (irq >= EXT_IRQ0 && irq <= (EXT_IRQ0 + EXT_IRQS));
38}
39
40static void h8300_enable_irq(struct irq_data *data)
41{
42 if (is_ext_irq(data->irq))
43 IER_REGS |= 1 << (data->irq - EXT_IRQ0);
44}
45
46static void h8300_disable_irq(struct irq_data *data)
47{
48 if (is_ext_irq(data->irq))
49 IER_REGS &= ~(1 << (data->irq - EXT_IRQ0));
50}
51
52static unsigned int h8300_startup_irq(struct irq_data *data)
53{
54 if (is_ext_irq(data->irq))
55 return h8300_enable_irq_pin(data->irq);
56 else
57 return 0;
58}
59
60static void h8300_shutdown_irq(struct irq_data *data)
61{
62 if (is_ext_irq(data->irq))
63 h8300_disable_irq_pin(data->irq);
64}
65
66/*
67 * h8300 interrupt controller implementation
68 */
69struct irq_chip h8300irq_chip = {
70 .name = "H8300-INTC",
71 .irq_startup = h8300_startup_irq,
72 .irq_shutdown = h8300_shutdown_irq,
73 .irq_enable = h8300_enable_irq,
74 .irq_disable = h8300_disable_irq,
75};
76
77#if defined(CONFIG_RAMKERNEL)
78static unsigned long __init *get_vector_address(void)
79{
80 unsigned long *rom_vector = CPU_VECTOR;
81 unsigned long base,tmp;
82 int vec_no;
83
84 base = rom_vector[EXT_IRQ0] & ADDR_MASK;
85
86 /* check romvector format */
87 for (vec_no = EXT_IRQ1; vec_no <= EXT_IRQ0+EXT_IRQS; vec_no++) {
88 if ((base+(vec_no - EXT_IRQ0)*4) != (rom_vector[vec_no] & ADDR_MASK))
89 return NULL;
90 }
91
92 /* ramvector base address */
93 base -= EXT_IRQ0*4;
94
95 /* writerble check */
96 tmp = ~(*(volatile unsigned long *)base);
97 (*(volatile unsigned long *)base) = tmp;
98 if ((*(volatile unsigned long *)base) != tmp)
99 return NULL;
100 return (unsigned long *)base;
101}
102
103static void __init setup_vector(void)
104{
105 int i;
106 unsigned long *ramvec,*ramvec_p;
107 const h8300_vector *trap_entry;
108 const int *saved_vector;
109
110 ramvec = get_vector_address();
111 if (ramvec == NULL)
112 panic("interrupt vector serup failed.");
113 else
114 printk(KERN_INFO "virtual vector at 0x%08lx\n",(unsigned long)ramvec);
115
116 /* create redirect table */
117 ramvec_p = ramvec;
118 trap_entry = h8300_trap_table;
119 saved_vector = h8300_saved_vectors;
120 for ( i = 0; i < NR_IRQS; i++) {
121 if (i == *saved_vector) {
122 ramvec_p++;
123 saved_vector++;
124 } else {
125 if ( i < NR_TRAPS ) {
126 if (*trap_entry)
127 *ramvec_p = VECTOR(*trap_entry);
128 ramvec_p++;
129 trap_entry++;
130 } else
131 *ramvec_p++ = REDIRECT(interrupt_entry);
132 }
133 }
134 interrupt_redirect_table = ramvec;
135#ifdef DEBUG
136 ramvec_p = ramvec;
137 for (i = 0; i < NR_IRQS; i++) {
138 if ((i % 8) == 0)
139 printk(KERN_DEBUG "\n%p: ",ramvec_p);
140 printk(KERN_DEBUG "%p ",*ramvec_p);
141 ramvec_p++;
142 }
143 printk(KERN_DEBUG "\n");
144#endif
145}
146#else
147#define setup_vector() do { } while(0)
148#endif
149
150void __init init_IRQ(void)
151{
152 int c;
153
154 setup_vector();
155
156 for (c = 0; c < NR_IRQS; c++)
157 irq_set_chip_and_handler(c, &h8300irq_chip, handle_simple_irq);
158}
159
160asmlinkage void do_IRQ(int irq)
161{
162 irq_enter();
163 generic_handle_irq(irq);
164 irq_exit();
165}
diff --git a/arch/h8300/kernel/module.c b/arch/h8300/kernel/module.c
deleted file mode 100644
index 1d526e05db19..000000000000
--- a/arch/h8300/kernel/module.c
+++ /dev/null
@@ -1,75 +0,0 @@
1#include <linux/moduleloader.h>
2#include <linux/elf.h>
3#include <linux/vmalloc.h>
4#include <linux/fs.h>
5#include <linux/string.h>
6#include <linux/kernel.h>
7
8#if 0
9#define DEBUGP printk
10#else
11#define DEBUGP(fmt...)
12#endif
13
14int apply_relocate_add(Elf32_Shdr *sechdrs,
15 const char *strtab,
16 unsigned int symindex,
17 unsigned int relsec,
18 struct module *me)
19{
20 unsigned int i;
21 Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr;
22
23 DEBUGP("Applying relocate section %u to %u\n", relsec,
24 sechdrs[relsec].sh_info);
25 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++) {
26 /* This is where to make the change */
27 uint32_t *loc = (uint32_t *)(sechdrs[sechdrs[relsec].sh_info].sh_addr
28 + rela[i].r_offset);
29 /* This is the symbol it is referring to. Note that all
30 undefined symbols have been resolved. */
31 Elf32_Sym *sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
32 + ELF32_R_SYM(rela[i].r_info);
33 uint32_t v = sym->st_value + rela[i].r_addend;
34
35 switch (ELF32_R_TYPE(rela[i].r_info)) {
36 case R_H8_DIR24R8:
37 loc = (uint32_t *)((uint32_t)loc - 1);
38 *loc = (*loc & 0xff000000) | ((*loc & 0xffffff) + v);
39 break;
40 case R_H8_DIR24A8:
41 if (ELF32_R_SYM(rela[i].r_info))
42 *loc += v;
43 break;
44 case R_H8_DIR32:
45 case R_H8_DIR32A16:
46 *loc += v;
47 break;
48 case R_H8_PCREL16:
49 v -= (unsigned long)loc + 2;
50 if ((Elf32_Sword)v > 0x7fff ||
51 (Elf32_Sword)v < -(Elf32_Sword)0x8000)
52 goto overflow;
53 else
54 *(unsigned short *)loc = v;
55 break;
56 case R_H8_PCREL8:
57 v -= (unsigned long)loc + 1;
58 if ((Elf32_Sword)v > 0x7f ||
59 (Elf32_Sword)v < -(Elf32_Sword)0x80)
60 goto overflow;
61 else
62 *(unsigned char *)loc = v;
63 break;
64 default:
65 printk(KERN_ERR "module %s: Unknown relocation: %u\n",
66 me->name, ELF32_R_TYPE(rela[i].r_info));
67 return -ENOEXEC;
68 }
69 }
70 return 0;
71 overflow:
72 printk(KERN_ERR "module %s: relocation offset overflow: %08x\n",
73 me->name, rela[i].r_offset);
74 return -ENOEXEC;
75}
diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c
deleted file mode 100644
index 1a744ab7e7e5..000000000000
--- a/arch/h8300/kernel/process.c
+++ /dev/null
@@ -1,154 +0,0 @@
1/*
2 * linux/arch/h8300/kernel/process.c
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * Based on:
7 *
8 * linux/arch/m68knommu/kernel/process.c
9 *
10 * Copyright (C) 1998 D. Jeff Dionne <jeff@ryeham.ee.ryerson.ca>,
11 * Kenneth Albanowski <kjahds@kjahds.com>,
12 * The Silver Hammer Group, Ltd.
13 *
14 * linux/arch/m68k/kernel/process.c
15 *
16 * Copyright (C) 1995 Hamish Macdonald
17 *
18 * 68060 fixes by Jesper Skov
19 */
20
21/*
22 * This file handles the architecture-dependent parts of process handling..
23 */
24
25#include <linux/errno.h>
26#include <linux/module.h>
27#include <linux/sched.h>
28#include <linux/kernel.h>
29#include <linux/mm.h>
30#include <linux/smp.h>
31#include <linux/stddef.h>
32#include <linux/unistd.h>
33#include <linux/ptrace.h>
34#include <linux/user.h>
35#include <linux/interrupt.h>
36#include <linux/reboot.h>
37#include <linux/fs.h>
38#include <linux/slab.h>
39#include <linux/rcupdate.h>
40
41#include <asm/uaccess.h>
42#include <asm/traps.h>
43#include <asm/setup.h>
44#include <asm/pgtable.h>
45
46void (*pm_power_off)(void) = NULL;
47EXPORT_SYMBOL(pm_power_off);
48
49asmlinkage void ret_from_fork(void);
50asmlinkage void ret_from_kernel_thread(void);
51
52/*
53 * The idle loop on an H8/300..
54 */
55#if !defined(CONFIG_H8300H_SIM) && !defined(CONFIG_H8S_SIM)
56void arch_cpu_idle(void)
57{
58 local_irq_enable();
59 /* XXX: race here! What if need_resched() gets set now? */
60 __asm__("sleep");
61}
62#endif
63
64void machine_restart(char * __unused)
65{
66 local_irq_disable();
67 __asm__("jmp @@0");
68}
69
70void machine_halt(void)
71{
72 local_irq_disable();
73 __asm__("sleep");
74 for (;;);
75}
76
77void machine_power_off(void)
78{
79 local_irq_disable();
80 __asm__("sleep");
81 for (;;);
82}
83
84void show_regs(struct pt_regs * regs)
85{
86 show_regs_print_info(KERN_DEFAULT);
87
88 printk("\nPC: %08lx Status: %02x",
89 regs->pc, regs->ccr);
90 printk("\nORIG_ER0: %08lx ER0: %08lx ER1: %08lx",
91 regs->orig_er0, regs->er0, regs->er1);
92 printk("\nER2: %08lx ER3: %08lx ER4: %08lx ER5: %08lx",
93 regs->er2, regs->er3, regs->er4, regs->er5);
94 printk("\nER6' %08lx ",regs->er6);
95 if (user_mode(regs))
96 printk("USP: %08lx\n", rdusp());
97 else
98 printk("\n");
99}
100
101void flush_thread(void)
102{
103}
104
105int copy_thread(unsigned long clone_flags,
106 unsigned long usp, unsigned long topstk,
107 struct task_struct * p)
108{
109 struct pt_regs * childregs;
110
111 childregs = (struct pt_regs *) (THREAD_SIZE + task_stack_page(p)) - 1;
112
113 if (unlikely(p->flags & PF_KTHREAD)) {
114 memset(childregs, 0, sizeof(struct pt_regs));
115 childregs->retpc = (unsigned long) ret_from_kernel_thread;
116 childregs->er4 = topstk; /* arg */
117 childregs->er5 = usp; /* fn */
118 p->thread.ksp = (unsigned long)childregs;
119 }
120 *childregs = *current_pt_regs();
121 childregs->retpc = (unsigned long) ret_from_fork;
122 childregs->er0 = 0;
123 p->thread.usp = usp ?: rdusp();
124 p->thread.ksp = (unsigned long)childregs;
125
126 return 0;
127}
128
129unsigned long thread_saved_pc(struct task_struct *tsk)
130{
131 return ((struct pt_regs *)tsk->thread.esp0)->pc;
132}
133
134unsigned long get_wchan(struct task_struct *p)
135{
136 unsigned long fp, pc;
137 unsigned long stack_page;
138 int count = 0;
139 if (!p || p == current || p->state == TASK_RUNNING)
140 return 0;
141
142 stack_page = (unsigned long)p;
143 fp = ((struct pt_regs *)p->thread.ksp)->er6;
144 do {
145 if (fp < stack_page+sizeof(struct thread_info) ||
146 fp >= 8184+stack_page)
147 return 0;
148 pc = ((unsigned long *)fp)[1];
149 if (!in_sched_functions(pc))
150 return pc;
151 fp = *(unsigned long *) fp;
152 } while (count++ < 16);
153 return 0;
154}
diff --git a/arch/h8300/kernel/ptrace.c b/arch/h8300/kernel/ptrace.c
deleted file mode 100644
index 748cf6585aa4..000000000000
--- a/arch/h8300/kernel/ptrace.c
+++ /dev/null
@@ -1,168 +0,0 @@
1/*
2 * linux/arch/h8300/kernel/ptrace.c
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * Based on:
7 * linux/arch/m68k/kernel/ptrace.c
8 *
9 * Copyright (C) 1994 by Hamish Macdonald
10 * Taken from linux/kernel/ptrace.c and modified for M680x0.
11 * linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds
12 *
13 * This file is subject to the terms and conditions of the GNU General
14 * Public License. See the file COPYING in the main directory of
15 * this archive for more details.
16 */
17
18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/mm.h>
21#include <linux/smp.h>
22#include <linux/errno.h>
23#include <linux/ptrace.h>
24#include <linux/user.h>
25#include <linux/signal.h>
26
27#include <asm/uaccess.h>
28#include <asm/page.h>
29#include <asm/pgtable.h>
30#include <asm/processor.h>
31#include <asm/signal.h>
32
33/* cpu depend functions */
34extern long h8300_get_reg(struct task_struct *task, int regno);
35extern int h8300_put_reg(struct task_struct *task, int regno, unsigned long data);
36
37
38void user_disable_single_step(struct task_struct *child)
39{
40}
41
42/*
43 * does not yet catch signals sent when the child dies.
44 * in exit.c or in signal.c.
45 */
46
47void ptrace_disable(struct task_struct *child)
48{
49 user_disable_single_step(child);
50}
51
52long arch_ptrace(struct task_struct *child, long request,
53 unsigned long addr, unsigned long data)
54{
55 int ret;
56 int regno = addr >> 2;
57 unsigned long __user *datap = (unsigned long __user *) data;
58
59 switch (request) {
60 /* read the word at location addr in the USER area. */
61 case PTRACE_PEEKUSR: {
62 unsigned long tmp = 0;
63
64 if ((addr & 3) || addr >= sizeof(struct user)) {
65 ret = -EIO;
66 break ;
67 }
68
69 ret = 0; /* Default return condition */
70
71 if (regno < H8300_REGS_NO)
72 tmp = h8300_get_reg(child, regno);
73 else {
74 switch (regno) {
75 case 49:
76 tmp = child->mm->start_code;
77 break ;
78 case 50:
79 tmp = child->mm->start_data;
80 break ;
81 case 51:
82 tmp = child->mm->end_code;
83 break ;
84 case 52:
85 tmp = child->mm->end_data;
86 break ;
87 default:
88 ret = -EIO;
89 }
90 }
91 if (!ret)
92 ret = put_user(tmp, datap);
93 break ;
94 }
95
96 /* when I and D space are separate, this will have to be fixed. */
97 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
98 if ((addr & 3) || addr >= sizeof(struct user)) {
99 ret = -EIO;
100 break ;
101 }
102
103 if (regno == PT_ORIG_ER0) {
104 ret = -EIO;
105 break ;
106 }
107 if (regno < H8300_REGS_NO) {
108 ret = h8300_put_reg(child, regno, data);
109 break ;
110 }
111 ret = -EIO;
112 break ;
113
114 case PTRACE_GETREGS: { /* Get all gp regs from the child. */
115 int i;
116 unsigned long tmp;
117 for (i = 0; i < H8300_REGS_NO; i++) {
118 tmp = h8300_get_reg(child, i);
119 if (put_user(tmp, datap)) {
120 ret = -EFAULT;
121 break;
122 }
123 datap++;
124 }
125 ret = 0;
126 break;
127 }
128
129 case PTRACE_SETREGS: { /* Set all gp regs in the child. */
130 int i;
131 unsigned long tmp;
132 for (i = 0; i < H8300_REGS_NO; i++) {
133 if (get_user(tmp, datap)) {
134 ret = -EFAULT;
135 break;
136 }
137 h8300_put_reg(child, i, tmp);
138 datap++;
139 }
140 ret = 0;
141 break;
142 }
143
144 default:
145 ret = ptrace_request(child, request, addr, data);
146 break;
147 }
148 return ret;
149}
150
151asmlinkage void do_syscall_trace(void)
152{
153 if (!test_thread_flag(TIF_SYSCALL_TRACE))
154 return;
155 if (!(current->ptrace & PT_PTRACED))
156 return;
157 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
158 ? 0x80 : 0));
159 /*
160 * this isn't the same as continuing with a signal, but it will do
161 * for normal use. strace only continues with a signal if the
162 * stopping signal is not SIGTRAP. -brl
163 */
164 if (current->exit_code) {
165 send_sig(current->exit_code, current, 1);
166 current->exit_code = 0;
167 }
168}
diff --git a/arch/h8300/kernel/setup.c b/arch/h8300/kernel/setup.c
deleted file mode 100644
index d0b1607f2711..000000000000
--- a/arch/h8300/kernel/setup.c
+++ /dev/null
@@ -1,242 +0,0 @@
1/*
2 * linux/arch/h8300/kernel/setup.c
3 *
4 * Copyleft ()) 2000 James D. Schettine {james@telos-systems.com}
5 * Copyright (C) 1999,2000 Greg Ungerer (gerg@snapgear.com)
6 * Copyright (C) 1998,1999 D. Jeff Dionne <jeff@lineo.ca>
7 * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
8 * Copyright (C) 1995 Hamish Macdonald
9 * Copyright (C) 2000 Lineo Inc. (www.lineo.com)
10 * Copyright (C) 2001 Lineo, Inc. <www.lineo.com>
11 *
12 * H8/300 porting Yoshinori Sato <ysato@users.sourceforge.jp>
13 */
14
15/*
16 * This file handles the architecture-dependent parts of system setup
17 */
18
19#include <linux/kernel.h>
20#include <linux/sched.h>
21#include <linux/delay.h>
22#include <linux/interrupt.h>
23#include <linux/mm.h>
24#include <linux/fs.h>
25#include <linux/fb.h>
26#include <linux/console.h>
27#include <linux/genhd.h>
28#include <linux/errno.h>
29#include <linux/string.h>
30#include <linux/major.h>
31#include <linux/bootmem.h>
32#include <linux/seq_file.h>
33#include <linux/init.h>
34
35#include <asm/setup.h>
36#include <asm/irq.h>
37#include <asm/pgtable.h>
38#include <asm/sections.h>
39
40#if defined(__H8300H__)
41#define CPU "H8/300H"
42#include <asm/regs306x.h>
43#endif
44
45#if defined(__H8300S__)
46#define CPU "H8S"
47#include <asm/regs267x.h>
48#endif
49
50#define STUBSIZE 0xc000
51
52unsigned long rom_length;
53unsigned long memory_start;
54unsigned long memory_end;
55
56char __initdata command_line[COMMAND_LINE_SIZE];
57
58extern int _ramstart, _ramend;
59extern char _target_name[];
60extern void h8300_gpio_init(void);
61
62#if (defined(CONFIG_H8300H_SIM) || defined(CONFIG_H8S_SIM)) \
63 && defined(CONFIG_GDB_MAGICPRINT)
64/* printk with gdb service */
65static void gdb_console_output(struct console *c, const char *msg, unsigned len)
66{
67 for (; len > 0; len--) {
68 asm("mov.w %0,r2\n\t"
69 "jsr @0xc4"::"r"(*msg++):"er2");
70 }
71}
72
73/*
74 * Setup initial baud/bits/parity. We do two things here:
75 * - construct a cflag setting for the first rs_open()
76 * - initialize the serial port
77 * Return non-zero if we didn't find a serial port.
78 */
79static int __init gdb_console_setup(struct console *co, char *options)
80{
81 return 0;
82}
83
84static const struct console gdb_console = {
85 .name = "gdb_con",
86 .write = gdb_console_output,
87 .device = NULL,
88 .setup = gdb_console_setup,
89 .flags = CON_PRINTBUFFER,
90 .index = -1,
91};
92#endif
93
94void __init setup_arch(char **cmdline_p)
95{
96 int bootmap_size;
97
98 memory_start = (unsigned long) &_ramstart;
99
100 /* allow for ROMFS on the end of the kernel */
101 if (memcmp((void *)memory_start, "-rom1fs-", 8) == 0) {
102#if defined(CONFIG_BLK_DEV_INITRD)
103 initrd_start = memory_start;
104 initrd_end = memory_start += be32_to_cpu(((unsigned long *) (memory_start))[2]);
105#else
106 memory_start += be32_to_cpu(((unsigned long *) memory_start)[2]);
107#endif
108 }
109 memory_start = PAGE_ALIGN(memory_start);
110#if !defined(CONFIG_BLKDEV_RESERVE)
111 memory_end = (unsigned long) &_ramend; /* by now the stack is part of the init task */
112#if defined(CONFIG_GDB_DEBUG)
113 memory_end -= STUBSIZE;
114#endif
115#else
116 if ((memory_end < CONFIG_BLKDEV_RESERVE_ADDRESS) &&
117 (memory_end > CONFIG_BLKDEV_RESERVE_ADDRESS))
118 /* overlap userarea */
119 memory_end = CONFIG_BLKDEV_RESERVE_ADDRESS;
120#endif
121
122 init_mm.start_code = (unsigned long) _stext;
123 init_mm.end_code = (unsigned long) _etext;
124 init_mm.end_data = (unsigned long) _edata;
125 init_mm.brk = (unsigned long) 0;
126
127#if (defined(CONFIG_H8300H_SIM) || defined(CONFIG_H8S_SIM)) && defined(CONFIG_GDB_MAGICPRINT)
128 register_console((struct console *)&gdb_console);
129#endif
130
131 printk(KERN_INFO "\r\n\nuClinux " CPU "\n");
132 printk(KERN_INFO "Target Hardware: %s\n",_target_name);
133 printk(KERN_INFO "Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne\n");
134 printk(KERN_INFO "H8/300 series support by Yoshinori Sato <ysato@users.sourceforge.jp>\n");
135
136#ifdef DEBUG
137 printk(KERN_DEBUG "KERNEL -> TEXT=0x%p-0x%p DATA=0x%p-0x%p "
138 "BSS=0x%p-0x%p\n", _stext, _etext, _sdata, _edata, __bss_start,
139 __bss_stop);
140 printk(KERN_DEBUG "KERNEL -> ROMFS=0x%p-0x%06lx MEM=0x%06lx-0x%06lx "
141 "STACK=0x%06lx-0x%p\n", __bss_stop, memory_start, memory_start,
142 memory_end, memory_end, &_ramend);
143#endif
144
145#ifdef CONFIG_DEFAULT_CMDLINE
146 /* set from default command line */
147 if (*command_line == '\0')
148 strcpy(command_line,CONFIG_KERNEL_COMMAND);
149#endif
150 /* Keep a copy of command line */
151 *cmdline_p = &command_line[0];
152 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
153 boot_command_line[COMMAND_LINE_SIZE-1] = 0;
154
155#ifdef DEBUG
156 if (strlen(*cmdline_p))
157 printk(KERN_DEBUG "Command line: '%s'\n", *cmdline_p);
158#endif
159
160 /*
161 * give all the memory to the bootmap allocator, tell it to put the
162 * boot mem_map at the start of memory
163 */
164 bootmap_size = init_bootmem_node(
165 NODE_DATA(0),
166 memory_start >> PAGE_SHIFT, /* map goes here */
167 PAGE_OFFSET >> PAGE_SHIFT, /* 0 on coldfire */
168 memory_end >> PAGE_SHIFT);
169 /*
170 * free the usable memory, we have to make sure we do not free
171 * the bootmem bitmap so we then reserve it after freeing it :-)
172 */
173 free_bootmem(memory_start, memory_end - memory_start);
174 reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
175 /*
176 * get kmalloc into gear
177 */
178 paging_init();
179 h8300_gpio_init();
180#if defined(CONFIG_H8300_AKI3068NET) && defined(CONFIG_IDE)
181 {
182#define AREABIT(addr) (1 << (((addr) >> 21) & 7))
183 /* setup BSC */
184 volatile unsigned char *abwcr = (volatile unsigned char *)ABWCR;
185 volatile unsigned char *cscr = (volatile unsigned char *)CSCR;
186 *abwcr &= ~(AREABIT(CONFIG_H8300_IDE_BASE) | AREABIT(CONFIG_H8300_IDE_ALT));
187 *cscr |= (AREABIT(CONFIG_H8300_IDE_BASE) | AREABIT(CONFIG_H8300_IDE_ALT)) | 0x0f;
188 }
189#endif
190#ifdef DEBUG
191 printk(KERN_DEBUG "Done setup_arch\n");
192#endif
193}
194
195/*
196 * Get CPU information for use by the procfs.
197 */
198
199static int show_cpuinfo(struct seq_file *m, void *v)
200{
201 char *cpu;
202 int mode;
203 u_long clockfreq;
204
205 cpu = CPU;
206 mode = *(volatile unsigned char *)MDCR & 0x07;
207
208 clockfreq = CONFIG_CPU_CLOCK;
209
210 seq_printf(m, "CPU:\t\t%s (mode:%d)\n"
211 "Clock:\t\t%lu.%1luMHz\n"
212 "BogoMips:\t%lu.%02lu\n"
213 "Calibration:\t%lu loops\n",
214 cpu,mode,
215 clockfreq/1000,clockfreq%1000,
216 (loops_per_jiffy*HZ)/500000,((loops_per_jiffy*HZ)/5000)%100,
217 (loops_per_jiffy*HZ));
218
219 return 0;
220}
221
222static void *c_start(struct seq_file *m, loff_t *pos)
223{
224 return *pos < NR_CPUS ? ((void *) 0x12345678) : NULL;
225}
226
227static void *c_next(struct seq_file *m, void *v, loff_t *pos)
228{
229 ++*pos;
230 return c_start(m, pos);
231}
232
233static void c_stop(struct seq_file *m, void *v)
234{
235}
236
237const struct seq_operations cpuinfo_op = {
238 .start = c_start,
239 .next = c_next,
240 .stop = c_stop,
241 .show = show_cpuinfo,
242};
diff --git a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c
deleted file mode 100644
index a65ff3b76326..000000000000
--- a/arch/h8300/kernel/signal.c
+++ /dev/null
@@ -1,444 +0,0 @@
1/*
2 * linux/arch/h8300/kernel/signal.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11/*
12 * uClinux H8/300 support by Yoshinori Sato <ysato@users.sourceforge.jp>
13 * and David McCullough <davidm@snapgear.com>
14 *
15 * Based on
16 * Linux/m68k by Hamish Macdonald
17 */
18
19/*
20 * ++roman (07/09/96): implemented signal stacks (specially for tosemu on
21 * Atari :-) Current limitation: Only one sigstack can be active at one time.
22 * If a second signal with SA_ONSTACK set arrives while working on a sigstack,
23 * SA_ONSTACK is ignored. This behaviour avoids lots of trouble with nested
24 * signal handlers!
25 */
26
27#include <linux/sched.h>
28#include <linux/mm.h>
29#include <linux/kernel.h>
30#include <linux/signal.h>
31#include <linux/syscalls.h>
32#include <linux/errno.h>
33#include <linux/wait.h>
34#include <linux/ptrace.h>
35#include <linux/unistd.h>
36#include <linux/stddef.h>
37#include <linux/highuid.h>
38#include <linux/personality.h>
39#include <linux/tty.h>
40#include <linux/binfmts.h>
41#include <linux/tracehook.h>
42
43#include <asm/setup.h>
44#include <asm/uaccess.h>
45#include <asm/pgtable.h>
46#include <asm/traps.h>
47#include <asm/ucontext.h>
48
49/*
50 * Do a signal return; undo the signal stack.
51 *
52 * Keep the return code on the stack quadword aligned!
53 * That makes the cache flush below easier.
54 */
55
56struct sigframe
57{
58 long dummy_er0;
59 long dummy_vector;
60#if defined(CONFIG_CPU_H8S)
61 short dummy_exr;
62#endif
63 long dummy_pc;
64 char *pretcode;
65 unsigned char retcode[8];
66 unsigned long extramask[_NSIG_WORDS-1];
67 struct sigcontext sc;
68 int sig;
69} __attribute__((aligned(2),packed));
70
71struct rt_sigframe
72{
73 long dummy_er0;
74 long dummy_vector;
75#if defined(CONFIG_CPU_H8S)
76 short dummy_exr;
77#endif
78 long dummy_pc;
79 char *pretcode;
80 struct siginfo *pinfo;
81 void *puc;
82 unsigned char retcode[8];
83 struct siginfo info;
84 struct ucontext uc;
85 int sig;
86} __attribute__((aligned(2),packed));
87
88static inline int
89restore_sigcontext(struct sigcontext *usc, int *pd0)
90{
91 struct pt_regs *regs = current_pt_regs();
92 int err = 0;
93 unsigned int ccr;
94 unsigned int usp;
95 unsigned int er0;
96
97 /* Always make any pending restarted system calls return -EINTR */
98 current_thread_info()->restart_block.fn = do_no_restart_syscall;
99
100#define COPY(r) err |= __get_user(regs->r, &usc->sc_##r) /* restore passed registers */
101 COPY(er1);
102 COPY(er2);
103 COPY(er3);
104 COPY(er5);
105 COPY(pc);
106 ccr = regs->ccr & 0x10;
107 COPY(ccr);
108#undef COPY
109 regs->ccr &= 0xef;
110 regs->ccr |= ccr;
111 regs->orig_er0 = -1; /* disable syscall checks */
112 err |= __get_user(usp, &usc->sc_usp);
113 wrusp(usp);
114
115 err |= __get_user(er0, &usc->sc_er0);
116 *pd0 = er0;
117 return err;
118}
119
120asmlinkage int sys_sigreturn(void)
121{
122 unsigned long usp = rdusp();
123 struct sigframe *frame = (struct sigframe *)(usp - 4);
124 sigset_t set;
125 int er0;
126
127 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
128 goto badframe;
129 if (__get_user(set.sig[0], &frame->sc.sc_mask) ||
130 (_NSIG_WORDS > 1 &&
131 __copy_from_user(&set.sig[1], &frame->extramask,
132 sizeof(frame->extramask))))
133 goto badframe;
134
135 set_current_blocked(&set);
136
137 if (restore_sigcontext(&frame->sc, &er0))
138 goto badframe;
139 return er0;
140
141badframe:
142 force_sig(SIGSEGV, current);
143 return 0;
144}
145
146asmlinkage int sys_rt_sigreturn(void)
147{
148 unsigned long usp = rdusp();
149 struct rt_sigframe *frame = (struct rt_sigframe *)(usp - 4);
150 sigset_t set;
151 int er0;
152
153 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
154 goto badframe;
155 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
156 goto badframe;
157
158 set_current_blocked(&set);
159
160 if (restore_sigcontext(&frame->uc.uc_mcontext, &er0))
161 goto badframe;
162
163 if (restore_altstack(&frame->uc.uc_stack))
164 goto badframe;
165
166 return er0;
167
168badframe:
169 force_sig(SIGSEGV, current);
170 return 0;
171}
172
173static int setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
174 unsigned long mask)
175{
176 int err = 0;
177
178 err |= __put_user(regs->er0, &sc->sc_er0);
179 err |= __put_user(regs->er1, &sc->sc_er1);
180 err |= __put_user(regs->er2, &sc->sc_er2);
181 err |= __put_user(regs->er3, &sc->sc_er3);
182 err |= __put_user(regs->er4, &sc->sc_er4);
183 err |= __put_user(regs->er5, &sc->sc_er5);
184 err |= __put_user(regs->er6, &sc->sc_er6);
185 err |= __put_user(rdusp(), &sc->sc_usp);
186 err |= __put_user(regs->pc, &sc->sc_pc);
187 err |= __put_user(regs->ccr, &sc->sc_ccr);
188 err |= __put_user(mask, &sc->sc_mask);
189
190 return err;
191}
192
193static inline void *
194get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
195{
196 unsigned long usp;
197
198 /* Default to using normal stack. */
199 usp = rdusp();
200
201 /* This is the X/Open sanctioned signal stack switching. */
202 if (ka->sa.sa_flags & SA_ONSTACK) {
203 if (!sas_ss_flags(usp))
204 usp = current->sas_ss_sp + current->sas_ss_size;
205 }
206 return (void *)((usp - frame_size) & -8UL);
207}
208
209static int setup_frame (int sig, struct k_sigaction *ka,
210 sigset_t *set, struct pt_regs *regs)
211{
212 struct sigframe *frame;
213 int err = 0;
214 int usig;
215 unsigned char *ret;
216
217 frame = get_sigframe(ka, regs, sizeof(*frame));
218
219 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
220 goto give_sigsegv;
221
222 usig = current_thread_info()->exec_domain
223 && current_thread_info()->exec_domain->signal_invmap
224 && sig < 32
225 ? current_thread_info()->exec_domain->signal_invmap[sig]
226 : sig;
227
228 err |= __put_user(usig, &frame->sig);
229 if (err)
230 goto give_sigsegv;
231
232 err |= setup_sigcontext(&frame->sc, regs, set->sig[0]);
233 if (err)
234 goto give_sigsegv;
235
236 if (_NSIG_WORDS > 1) {
237 err |= copy_to_user(frame->extramask, &set->sig[1],
238 sizeof(frame->extramask));
239 if (err)
240 goto give_sigsegv;
241 }
242
243 ret = frame->retcode;
244 if (ka->sa.sa_flags & SA_RESTORER)
245 ret = (unsigned char *)(ka->sa.sa_restorer);
246 else {
247 /* sub.l er0,er0; mov.b #__NR_sigreturn,r0l; trapa #0 */
248 err |= __put_user(0x1a80f800 + (__NR_sigreturn & 0xff),
249 (unsigned long *)(frame->retcode + 0));
250 err |= __put_user(0x5700, (unsigned short *)(frame->retcode + 4));
251 }
252
253 /* Set up to return from userspace. */
254 err |= __put_user(ret, &frame->pretcode);
255
256 if (err)
257 goto give_sigsegv;
258
259 /* Set up registers for signal handler */
260 wrusp ((unsigned long) frame);
261 regs->pc = (unsigned long) ka->sa.sa_handler;
262 regs->er0 = (current_thread_info()->exec_domain
263 && current_thread_info()->exec_domain->signal_invmap
264 && sig < 32
265 ? current_thread_info()->exec_domain->signal_invmap[sig]
266 : sig);
267 regs->er1 = (unsigned long)&(frame->sc);
268 regs->er5 = current->mm->start_data; /* GOT base */
269
270 return 0;
271
272give_sigsegv:
273 force_sigsegv(sig, current);
274 return -EFAULT;
275}
276
277static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
278 sigset_t *set, struct pt_regs *regs)
279{
280 struct rt_sigframe *frame;
281 int err = 0;
282 int usig;
283 unsigned char *ret;
284
285 frame = get_sigframe(ka, regs, sizeof(*frame));
286
287 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
288 goto give_sigsegv;
289
290 usig = current_thread_info()->exec_domain
291 && current_thread_info()->exec_domain->signal_invmap
292 && sig < 32
293 ? current_thread_info()->exec_domain->signal_invmap[sig]
294 : sig;
295
296 err |= __put_user(usig, &frame->sig);
297 if (err)
298 goto give_sigsegv;
299
300 err |= __put_user(&frame->info, &frame->pinfo);
301 err |= __put_user(&frame->uc, &frame->puc);
302 err |= copy_siginfo_to_user(&frame->info, info);
303 if (err)
304 goto give_sigsegv;
305
306 /* Create the ucontext. */
307 err |= __put_user(0, &frame->uc.uc_flags);
308 err |= __put_user(0, &frame->uc.uc_link);
309 err |= __save_altstack(&frame->uc.uc_stack, rdusp());
310 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
311 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set));
312 if (err)
313 goto give_sigsegv;
314
315 /* Set up to return from userspace. */
316 ret = frame->retcode;
317 if (ka->sa.sa_flags & SA_RESTORER)
318 ret = (unsigned char *)(ka->sa.sa_restorer);
319 else {
320 /* sub.l er0,er0; mov.b #__NR_sigreturn,r0l; trapa #0 */
321 err |= __put_user(0x1a80f800 + (__NR_sigreturn & 0xff),
322 (unsigned long *)(frame->retcode + 0));
323 err |= __put_user(0x5700, (unsigned short *)(frame->retcode + 4));
324 }
325 err |= __put_user(ret, &frame->pretcode);
326
327 if (err)
328 goto give_sigsegv;
329
330 /* Set up registers for signal handler */
331 wrusp ((unsigned long) frame);
332 regs->pc = (unsigned long) ka->sa.sa_handler;
333 regs->er0 = (current_thread_info()->exec_domain
334 && current_thread_info()->exec_domain->signal_invmap
335 && sig < 32
336 ? current_thread_info()->exec_domain->signal_invmap[sig]
337 : sig);
338 regs->er1 = (unsigned long)&(frame->info);
339 regs->er2 = (unsigned long)&frame->uc;
340 regs->er5 = current->mm->start_data; /* GOT base */
341
342 return 0;
343
344give_sigsegv:
345 force_sigsegv(sig, current);
346 return -EFAULT;
347}
348
349/*
350 * OK, we're invoking a handler
351 */
352static void
353handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
354 struct pt_regs * regs)
355{
356 sigset_t *oldset = sigmask_to_save();
357 int ret;
358 /* are we from a system call? */
359 if (regs->orig_er0 >= 0) {
360 switch (regs->er0) {
361 case -ERESTART_RESTARTBLOCK:
362 case -ERESTARTNOHAND:
363 regs->er0 = -EINTR;
364 break;
365
366 case -ERESTARTSYS:
367 if (!(ka->sa.sa_flags & SA_RESTART)) {
368 regs->er0 = -EINTR;
369 break;
370 }
371 /* fallthrough */
372 case -ERESTARTNOINTR:
373 regs->er0 = regs->orig_er0;
374 regs->pc -= 2;
375 }
376 }
377
378 /* set up the stack frame */
379 if (ka->sa.sa_flags & SA_SIGINFO)
380 ret = setup_rt_frame(sig, ka, info, oldset, regs);
381 else
382 ret = setup_frame(sig, ka, oldset, regs);
383
384 if (!ret)
385 signal_delivered(sig, info, ka, regs, 0);
386}
387
388/*
389 * Note that 'init' is a special process: it doesn't get signals it doesn't
390 * want to handle. Thus you cannot kill init even with a SIGKILL even by
391 * mistake.
392 */
393static void do_signal(struct pt_regs *regs)
394{
395 siginfo_t info;
396 int signr;
397 struct k_sigaction ka;
398
399 /*
400 * We want the common case to go fast, which
401 * is why we may in certain cases get here from
402 * kernel mode. Just return without doing anything
403 * if so.
404 */
405 if ((regs->ccr & 0x10))
406 return;
407
408 current->thread.esp0 = (unsigned long) regs;
409
410 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
411 if (signr > 0) {
412 /* Whee! Actually deliver the signal. */
413 handle_signal(signr, &info, &ka, regs);
414 return;
415 }
416 /* Did we come from a system call? */
417 if (regs->orig_er0 >= 0) {
418 /* Restart the system call - no handlers present */
419 if (regs->er0 == -ERESTARTNOHAND ||
420 regs->er0 == -ERESTARTSYS ||
421 regs->er0 == -ERESTARTNOINTR) {
422 regs->er0 = regs->orig_er0;
423 regs->pc -= 2;
424 }
425 if (regs->er0 == -ERESTART_RESTARTBLOCK){
426 regs->er0 = __NR_restart_syscall;
427 regs->pc -= 2;
428 }
429 }
430
431 /* If there's no signal to deliver, we just restore the saved mask. */
432 restore_saved_sigmask();
433}
434
435asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags)
436{
437 if (thread_info_flags & _TIF_SIGPENDING)
438 do_signal(regs);
439
440 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
441 clear_thread_flag(TIF_NOTIFY_RESUME);
442 tracehook_notify_resume(regs);
443 }
444}
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
deleted file mode 100644
index bf350cb7f597..000000000000
--- a/arch/h8300/kernel/sys_h8300.c
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * linux/arch/h8300/kernel/sys_h8300.c
3 *
4 * This file contains various random system calls that
5 * have a non-standard calling sequence on the H8/300
6 * platform.
7 */
8
9#include <linux/errno.h>
10#include <linux/sched.h>
11#include <linux/mm.h>
12#include <linux/smp.h>
13#include <linux/sem.h>
14#include <linux/msg.h>
15#include <linux/shm.h>
16#include <linux/stat.h>
17#include <linux/syscalls.h>
18#include <linux/mman.h>
19#include <linux/file.h>
20#include <linux/fs.h>
21#include <linux/ipc.h>
22
23#include <asm/setup.h>
24#include <asm/uaccess.h>
25#include <asm/cachectl.h>
26#include <asm/traps.h>
27#include <asm/unistd.h>
28
29/* sys_cacheflush -- no support. */
30asmlinkage int
31sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
32{
33 return -EINVAL;
34}
35
36asmlinkage int sys_getpagesize(void)
37{
38 return PAGE_SIZE;
39}
40
41#if defined(CONFIG_SYSCALL_PRINT)
42asmlinkage void syscall_print(void *dummy,...)
43{
44 struct pt_regs *regs = (struct pt_regs *) ((unsigned char *)&dummy-4);
45 printk("call %06lx:%ld 1:%08lx,2:%08lx,3:%08lx,ret:%08lx\n",
46 ((regs->pc)&0xffffff)-2,regs->orig_er0,regs->er1,regs->er2,regs->er3,regs->er0);
47}
48#endif
diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S
deleted file mode 100644
index c55e0ed270d5..000000000000
--- a/arch/h8300/kernel/syscalls.S
+++ /dev/null
@@ -1,338 +0,0 @@
1/* Systemcall Entry Table */
2#include <linux/sys.h>
3#include <asm/linkage.h>
4#include <asm/unistd.h>
5
6#define CALL(x) .long _ ## x
7
8.globl _sys_call_table
9
10#if defined(CONFIG_CPU_H8300H)
11 .h8300h
12#endif
13#if defined(CONFIG_CPU_H8S)
14 .h8300s
15#endif
16 .section .text
17 .align 2
18_sys_call_table:
19 CALL(sys_ni_syscall) /* 0 - old "setup()" system call*/
20 CALL(sys_exit)
21 CALL(sys_fork)
22 CALL(sys_read)
23 CALL(sys_write)
24 CALL(sys_open) /* 5 */
25 CALL(sys_close)
26 CALL(sys_waitpid)
27 CALL(sys_creat)
28 CALL(sys_link)
29 CALL(sys_unlink) /* 10 */
30 CALL(sys_execve)
31 CALL(sys_chdir)
32 CALL(sys_time)
33 CALL(sys_mknod)
34 CALL(sys_chmod) /* 15 */
35 CALL(sys_chown16)
36 CALL(sys_ni_syscall) /* old break syscall holder */
37 CALL(sys_stat)
38 CALL(sys_lseek)
39 CALL(sys_getpid) /* 20 */
40 CALL(sys_mount)
41 CALL(sys_oldumount)
42 CALL(sys_setuid16)
43 CALL(sys_getuid16)
44 CALL(sys_stime) /* 25 */
45 CALL(sys_ptrace)
46 CALL(sys_alarm)
47 CALL(sys_fstat)
48 CALL(sys_pause)
49 CALL(sys_utime) /* 30 */
50 CALL(sys_ni_syscall) /* old stty syscall holder */
51 CALL(sys_ni_syscall) /* old gtty syscall holder */
52 CALL(sys_access)
53 CALL(sys_nice)
54 CALL(sys_ni_syscall) /* 35 old ftime syscall holder */
55 CALL(sys_sync)
56 CALL(sys_kill)
57 CALL(sys_rename)
58 CALL(sys_mkdir)
59 CALL(sys_rmdir) /* 40 */
60 CALL(sys_dup)
61 CALL(sys_pipe)
62 CALL(sys_times)
63 CALL(sys_ni_syscall) /* old prof syscall holder */
64 CALL(sys_brk) /* 45 */
65 CALL(sys_setgid16)
66 CALL(sys_getgid16)
67 CALL(sys_signal)
68 CALL(sys_geteuid16)
69 CALL(sys_getegid16) /* 50 */
70 CALL(sys_acct)
71 CALL(sys_umount) /* recycled never used phys() */
72 CALL(sys_ni_syscall) /* old lock syscall holder */
73 CALL(sys_ioctl)
74 CALL(sys_fcntl) /* 55 */
75 CALL(sys_ni_syscall) /* old mpx syscall holder */
76 CALL(sys_setpgid)
77 CALL(sys_ni_syscall) /* old ulimit syscall holder */
78 CALL(sys_ni_syscall)
79 CALL(sys_umask) /* 60 */
80 CALL(sys_chroot)
81 CALL(sys_ustat)
82 CALL(sys_dup2)
83 CALL(sys_getppid)
84 CALL(sys_getpgrp) /* 65 */
85 CALL(sys_setsid)
86 CALL(sys_sigaction)
87 CALL(sys_sgetmask)
88 CALL(sys_ssetmask)
89 CALL(sys_setreuid16) /* 70 */
90 CALL(sys_setregid16)
91 CALL(sys_sigsuspend)
92 CALL(sys_sigpending)
93 CALL(sys_sethostname)
94 CALL(sys_setrlimit) /* 75 */
95 CALL(sys_old_getrlimit)
96 CALL(sys_getrusage)
97 CALL(sys_gettimeofday)
98 CALL(sys_settimeofday)
99 CALL(sys_getgroups16) /* 80 */
100 CALL(sys_setgroups16)
101 CALL(sys_old_select)
102 CALL(sys_symlink)
103 CALL(sys_lstat)
104 CALL(sys_readlink) /* 85 */
105 CALL(sys_uselib)
106 CALL(sys_swapon)
107 CALL(sys_reboot)
108 CALL(sys_old_readdir)
109 CALL(sys_old_mmap) /* 90 */
110 CALL(sys_munmap)
111 CALL(sys_truncate)
112 CALL(sys_ftruncate)
113 CALL(sys_fchmod)
114 CALL(sys_fchown16) /* 95 */
115 CALL(sys_getpriority)
116 CALL(sys_setpriority)
117 CALL(sys_ni_syscall) /* old profil syscall holder */
118 CALL(sys_statfs)
119 CALL(sys_fstatfs) /* 100 */
120 CALL(sys_ni_syscall) /* ioperm for i386 */
121 CALL(sys_socketcall)
122 CALL(sys_syslog)
123 CALL(sys_setitimer)
124 CALL(sys_getitimer) /* 105 */
125 CALL(sys_newstat)
126 CALL(sys_newlstat)
127 CALL(sys_newfstat)
128 CALL(sys_ni_syscall)
129 CALL(sys_ni_syscall) /* iopl for i386 */ /* 110 */
130 CALL(sys_vhangup)
131 CALL(sys_ni_syscall) /* obsolete idle() syscall */
132 CALL(sys_ni_syscall) /* vm86old for i386 */
133 CALL(sys_wait4)
134 CALL(sys_swapoff) /* 115 */
135 CALL(sys_sysinfo)
136 CALL(sys_ipc)
137 CALL(sys_fsync)
138 CALL(sys_sigreturn)
139 CALL(sys_clone) /* 120 */
140 CALL(sys_setdomainname)
141 CALL(sys_newuname)
142 CALL(sys_cacheflush) /* modify_ldt for i386 */
143 CALL(sys_adjtimex)
144 CALL(sys_ni_syscall) /* 125 sys_mprotect */
145 CALL(sys_sigprocmask)
146 CALL(sys_ni_syscall) /* sys_create_module */
147 CALL(sys_init_module)
148 CALL(sys_delete_module)
149 CALL(sys_ni_syscall) /* 130 sys_get_kernel_syms */
150 CALL(sys_quotactl)
151 CALL(sys_getpgid)
152 CALL(sys_fchdir)
153 CALL(sys_bdflush)
154 CALL(sys_sysfs) /* 135 */
155 CALL(sys_personality)
156 CALL(sys_ni_syscall) /* for afs_syscall */
157 CALL(sys_setfsuid16)
158 CALL(sys_setfsgid16)
159 CALL(sys_llseek) /* 140 */
160 CALL(sys_getdents)
161 CALL(sys_select)
162 CALL(sys_flock)
163 CALL(sys_ni_syscall) /* sys_msync */
164 CALL(sys_readv) /* 145 */
165 CALL(sys_writev)
166 CALL(sys_getsid)
167 CALL(sys_fdatasync)
168 CALL(sys_sysctl)
169 CALL(sys_ni_syscall) /* 150 sys_mlock */
170 CALL(sys_ni_syscall) /* sys_munlock */
171 CALL(sys_ni_syscall) /* sys_mlockall */
172 CALL(sys_ni_syscall) /* sys_munlockall */
173 CALL(sys_sched_setparam)
174 CALL(sys_sched_getparam) /* 155 */
175 CALL(sys_sched_setscheduler)
176 CALL(sys_sched_getscheduler)
177 CALL(sys_sched_yield)
178 CALL(sys_sched_get_priority_max)
179 CALL(sys_sched_get_priority_min) /* 160 */
180 CALL(sys_sched_rr_get_interval)
181 CALL(sys_nanosleep)
182 CALL(sys_ni_syscall) /* sys_mremap */
183 CALL(sys_setresuid16)
184 CALL(sys_getresuid16) /* 165 */
185 CALL(sys_ni_syscall) /* for vm86 */
186 CALL(sys_ni_syscall) /* sys_query_module */
187 CALL(sys_poll)
188 CALL(sys_ni_syscall) /* old nfsservctl */
189 CALL(sys_setresgid16) /* 170 */
190 CALL(sys_getresgid16)
191 CALL(sys_prctl)
192 CALL(sys_rt_sigreturn)
193 CALL(sys_rt_sigaction)
194 CALL(sys_rt_sigprocmask) /* 175 */
195 CALL(sys_rt_sigpending)
196 CALL(sys_rt_sigtimedwait)
197 CALL(sys_rt_sigqueueinfo)
198 CALL(sys_rt_sigsuspend)
199 CALL(sys_pread64) /* 180 */
200 CALL(sys_pwrite64)
201 CALL(sys_lchown16);
202 CALL(sys_getcwd)
203 CALL(sys_capget)
204 CALL(sys_capset) /* 185 */
205 CALL(sys_sigaltstack)
206 CALL(sys_sendfile)
207 CALL(sys_ni_syscall) /* streams1 */
208 CALL(sys_ni_syscall) /* streams2 */
209 CALL(sys_vfork) /* 190 */
210 CALL(sys_getrlimit)
211 CALL(sys_mmap_pgoff)
212 CALL(sys_truncate64)
213 CALL(sys_ftruncate64)
214 CALL(sys_stat64) /* 195 */
215 CALL(sys_lstat64)
216 CALL(sys_fstat64)
217 CALL(sys_chown)
218 CALL(sys_getuid)
219 CALL(sys_getgid) /* 200 */
220 CALL(sys_geteuid)
221 CALL(sys_getegid)
222 CALL(sys_setreuid)
223 CALL(sys_setregid)
224 CALL(sys_getgroups) /* 205 */
225 CALL(sys_setgroups)
226 CALL(sys_fchown)
227 CALL(sys_setresuid)
228 CALL(sys_getresuid)
229 CALL(sys_setresgid) /* 210 */
230 CALL(sys_getresgid)
231 CALL(sys_lchown)
232 CALL(sys_setuid)
233 CALL(sys_setgid)
234 CALL(sys_setfsuid) /* 215 */
235 CALL(sys_setfsgid)
236 CALL(sys_pivot_root)
237 CALL(sys_ni_syscall)
238 CALL(sys_ni_syscall)
239 CALL(sys_getdents64) /* 220 */
240 CALL(sys_fcntl64)
241 CALL(sys_ni_syscall) /* reserved TUX */
242 CALL(sys_ni_syscall) /* reserved Security */
243 CALL(sys_gettid)
244 CALL(sys_readahead) /* 225 */
245 CALL(sys_setxattr)
246 CALL(sys_lsetxattr)
247 CALL(sys_fsetxattr)
248 CALL(sys_getxattr)
249 CALL(sys_lgetxattr) /* 230 */
250 CALL(sys_fgetxattr)
251 CALL(sys_listxattr)
252 CALL(sys_llistxattr)
253 CALL(sys_flistxattr)
254 CALL(sys_removexattr) /* 235 */
255 CALL(sys_lremovexattr)
256 CALL(sys_fremovexattr)
257 CALL(sys_tkill)
258 CALL(sys_sendfile64)
259 CALL(sys_futex) /* 240 */
260 CALL(sys_sched_setaffinity)
261 CALL(sys_sched_getaffinity)
262 CALL(sys_ni_syscall)
263 CALL(sys_ni_syscall)
264 CALL(sys_io_setup) /* 245 */
265 CALL(sys_io_destroy)
266 CALL(sys_io_getevents)
267 CALL(sys_io_submit)
268 CALL(sys_io_cancel)
269 CALL(sys_fadvise64) /* 250 */
270 CALL(sys_ni_syscall)
271 CALL(sys_exit_group)
272 CALL(sys_lookup_dcookie)
273 CALL(sys_epoll_create)
274 CALL(sys_epoll_ctl) /* 255 */
275 CALL(sys_epoll_wait)
276 CALL(sys_ni_syscall) /* sys_remap_file_pages */
277 CALL(sys_set_tid_address)
278 CALL(sys_timer_create)
279 CALL(sys_timer_settime) /* 260 */
280 CALL(sys_timer_gettime)
281 CALL(sys_timer_getoverrun)
282 CALL(sys_timer_delete)
283 CALL(sys_clock_settime)
284 CALL(sys_clock_gettime) /* 265 */
285 CALL(sys_clock_getres)
286 CALL(sys_clock_nanosleep)
287 CALL(sys_statfs64)
288 CALL(sys_fstatfs64)
289 CALL(sys_tgkill) /* 270 */
290 CALL(sys_utimes)
291 CALL(sys_fadvise64_64)
292 CALL(sys_ni_syscall) /* sys_vserver */
293 CALL(sys_ni_syscall)
294 CALL(sys_get_mempolicy) /* 275 */
295 CALL(sys_set_mempolicy)
296 CALL(sys_mq_open)
297 CALL(sys_mq_unlink)
298 CALL(sys_mq_timedsend)
299 CALL(sys_mq_timedreceive) /* 280 */
300 CALL(sys_mq_notify)
301 CALL(sys_mq_getsetattr)
302 CALL(sys_waitid)
303 CALL(sys_ni_syscall) /* sys_kexec_load */
304 CALL(sys_add_key) /* 285 */
305 CALL(sys_request_key)
306 CALL(sys_keyctl)
307 CALL(sys_ioprio_set)
308 CALL(sys_ioprio_get) /* 290 */
309 CALL(sys_inotify_init)
310 CALL(sys_inotify_add_watch)
311 CALL(sys_inotify_rm_watch)
312 CALL(sys_migrate_pages)
313 CALL(sys_openat) /* 295 */
314 CALL(sys_mkdirat)
315 CALL(sys_mknodat)
316 CALL(sys_fchownat)
317 CALL(sys_futimesat)
318 CALL(sys_fstatat64) /* 300 */
319 CALL(sys_unlinkat)
320 CALL(sys_renameat)
321 CALL(sys_linkat)
322 CALL(sys_symlinkat)
323 CALL(sys_readlinkat) /* 305 */
324 CALL(sys_fchmodat)
325 CALL(sys_faccessat)
326 CALL(sys_ni_syscall) /* sys_pselect6 */
327 CALL(sys_ni_syscall) /* sys_ppoll */
328 CALL(sys_unshare) /* 310 */
329 CALL(sys_set_robust_list)
330 CALL(sys_get_robust_list)
331 CALL(sys_splice)
332 CALL(sys_sync_file_range)
333 CALL(sys_tee) /* 315 */
334 CALL(sys_vmsplice)
335 CALL(sys_ni_syscall) /* sys_move_pages */
336 CALL(sys_getcpu)
337 CALL(sys_ni_syscall) /* sys_epoll_pwait */
338 CALL(sys_setns) /* 320 */
diff --git a/arch/h8300/kernel/time.c b/arch/h8300/kernel/time.c
deleted file mode 100644
index e0f74191d553..000000000000
--- a/arch/h8300/kernel/time.c
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * linux/arch/h8300/kernel/time.c
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * Copied/hacked from:
7 *
8 * linux/arch/m68k/kernel/time.c
9 *
10 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
11 *
12 * This file contains the m68k-specific time handling details.
13 * Most of the stuff is located in the machine specific files.
14 *
15 * 1997-09-10 Updated NTP code according to technical memorandum Jan '96
16 * "A Kernel Model for Precision Timekeeping" by Dave Mills
17 */
18
19#include <linux/errno.h>
20#include <linux/module.h>
21#include <linux/sched.h>
22#include <linux/kernel.h>
23#include <linux/param.h>
24#include <linux/string.h>
25#include <linux/mm.h>
26#include <linux/timex.h>
27#include <linux/profile.h>
28
29#include <asm/io.h>
30#include <asm/irq_regs.h>
31#include <asm/timer.h>
32
33#define TICK_SIZE (tick_nsec / 1000)
34
35void h8300_timer_tick(void)
36{
37 if (current->pid)
38 profile_tick(CPU_PROFILING);
39 xtime_update(1);
40 update_process_times(user_mode(get_irq_regs()));
41}
42
43void read_persistent_clock(struct timespec *ts)
44{
45 unsigned int year, mon, day, hour, min, sec;
46
47 /* FIX by dqg : Set to zero for platforms that don't have tod */
48 /* without this time is undefined and can overflow time_t, causing */
49 /* very strange errors */
50 year = 1980;
51 mon = day = 1;
52 hour = min = sec = 0;
53#ifdef CONFIG_H8300_GETTOD
54 h8300_gettod (&year, &mon, &day, &hour, &min, &sec);
55#endif
56 if ((year += 1900) < 1970)
57 year += 100;
58 ts->tv_sec = mktime(year, mon, day, hour, min, sec);
59 ts->tv_nsec = 0;
60}
61
62void __init time_init(void)
63{
64
65 h8300_timer_setup();
66}
diff --git a/arch/h8300/kernel/timer/Makefile b/arch/h8300/kernel/timer/Makefile
deleted file mode 100644
index bef0510ea6ad..000000000000
--- a/arch/h8300/kernel/timer/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
1# h8300 internal timer handler
2
3obj-$(CONFIG_H8300_TIMER8) := timer8.o
4obj-$(CONFIG_H8300_TIMER16) := timer16.o
5obj-$(CONFIG_H8300_ITU) := itu.o
6obj-$(CONFIG_H8300_TPU) := tpu.o
diff --git a/arch/h8300/kernel/timer/itu.c b/arch/h8300/kernel/timer/itu.c
deleted file mode 100644
index 0a8b5cd5bf38..000000000000
--- a/arch/h8300/kernel/timer/itu.c
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * linux/arch/h8300/kernel/timer/itu.c
3 *
4 * Yoshinori Sato <ysato@users.sourcefoge.jp>
5 *
6 * ITU Timer Handler
7 *
8 */
9
10#include <linux/errno.h>
11#include <linux/sched.h>
12#include <linux/kernel.h>
13#include <linux/param.h>
14#include <linux/string.h>
15#include <linux/mm.h>
16#include <linux/interrupt.h>
17#include <linux/init.h>
18#include <linux/timex.h>
19
20#include <asm/segment.h>
21#include <asm/io.h>
22#include <asm/irq.h>
23#include <asm/regs306x.h>
24
25#if CONFIG_H8300_ITU_CH == 0
26#define ITUBASE 0xffff64
27#define ITUIRQ 24
28#elif CONFIG_H8300_ITU_CH == 1
29#define ITUBASE 0xffff6e
30#define ITUIRQ 28
31#elif CONFIG_H8300_ITU_CH == 2
32#define ITUBASE 0xffff78
33#define ITUIRQ 32
34#elif CONFIG_H8300_ITU_CH == 3
35#define ITUBASE 0xffff82
36#define ITUIRQ 36
37#elif CONFIG_H8300_ITU_CH == 4
38#define ITUBASE 0xffff92
39#define ITUIRQ 40
40#else
41#error Unknown timer channel.
42#endif
43
44#define TCR 0
45#define TIOR 1
46#define TIER 2
47#define TSR 3
48#define TCNT 4
49#define GRA 6
50#define GRB 8
51
52static irqreturn_t timer_interrupt(int irq, void *dev_id)
53{
54 h8300_timer_tick();
55 ctrl_bclr(IMFA, ITUBASE + TSR);
56 return IRQ_HANDLED;
57}
58
59static struct irqaction itu_irq = {
60 .name = "itu",
61 .handler = timer_interrupt,
62 .flags = IRQF_DISABLED | IRQF_TIMER,
63};
64
65static const int __initconst divide_rate[] = {1, 2, 4, 8};
66
67void __init h8300_timer_setup(void)
68{
69 unsigned int div;
70 unsigned int cnt;
71
72 calc_param(cnt, div, divide_rate, 0x10000);
73
74 setup_irq(ITUIRQ, &itu_irq);
75
76 /* initialize timer */
77 ctrl_outb(0, TSTR);
78 ctrl_outb(CCLR0 | div, ITUBASE + TCR);
79 ctrl_outb(0x01, ITUBASE + TIER);
80 ctrl_outw(cnt, ITUBASE + GRA);
81 ctrl_bset(CONFIG_H8300_ITU_CH, TSTR);
82}
diff --git a/arch/h8300/kernel/timer/timer16.c b/arch/h8300/kernel/timer/timer16.c
deleted file mode 100644
index 462d9f581719..000000000000
--- a/arch/h8300/kernel/timer/timer16.c
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 * linux/arch/h8300/kernel/timer/timer16.c
3 *
4 * Yoshinori Sato <ysato@users.sourcefoge.jp>
5 *
6 * 16bit Timer Handler
7 *
8 */
9
10#include <linux/errno.h>
11#include <linux/sched.h>
12#include <linux/kernel.h>
13#include <linux/param.h>
14#include <linux/string.h>
15#include <linux/mm.h>
16#include <linux/interrupt.h>
17#include <linux/init.h>
18#include <linux/timex.h>
19
20#include <asm/segment.h>
21#include <asm/io.h>
22#include <asm/irq.h>
23#include <asm/regs306x.h>
24
25/* 16bit timer */
26#if CONFIG_H8300_TIMER16_CH == 0
27#define _16BASE 0xffff78
28#define _16IRQ 24
29#elif CONFIG_H8300_TIMER16_CH == 1
30#define _16BASE 0xffff80
31#define _16IRQ 28
32#elif CONFIG_H8300_TIMER16_CH == 2
33#define _16BASE 0xffff88
34#define _16IRQ 32
35#else
36#error Unknown timer channel.
37#endif
38
39#define TCR 0
40#define TIOR 1
41#define TCNT 2
42#define GRA 4
43#define GRB 6
44
45#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*10000 /* Timer input freq. */
46
47static irqreturn_t timer_interrupt(int irq, void *dev_id)
48{
49 h8300_timer_tick();
50 ctrl_bclr(CONFIG_H8300_TIMER16_CH, TISRA);
51 return IRQ_HANDLED;
52}
53
54static struct irqaction timer16_irq = {
55 .name = "timer-16",
56 .handler = timer_interrupt,
57 .flags = IRQF_DISABLED | IRQF_TIMER,
58};
59
60static const int __initconst divide_rate[] = {1, 2, 4, 8};
61
62void __init h8300_timer_setup(void)
63{
64 unsigned int div;
65 unsigned int cnt;
66
67 calc_param(cnt, div, divide_rate, 0x10000);
68
69 setup_irq(_16IRQ, &timer16_irq);
70
71 /* initialize timer */
72 ctrl_outb(0, TSTR);
73 ctrl_outb(CCLR0 | div, _16BASE + TCR);
74 ctrl_outw(cnt, _16BASE + GRA);
75 ctrl_bset(4 + CONFIG_H8300_TIMER16_CH, TISRA);
76 ctrl_bset(CONFIG_H8300_TIMER16_CH, TSTR);
77}
diff --git a/arch/h8300/kernel/timer/timer8.c b/arch/h8300/kernel/timer/timer8.c
deleted file mode 100644
index 505f3415b40f..000000000000
--- a/arch/h8300/kernel/timer/timer8.c
+++ /dev/null
@@ -1,102 +0,0 @@
1/*
2 * linux/arch/h8300/kernel/cpu/timer/timer8.c
3 *
4 * Yoshinori Sato <ysato@users.sourcefoge.jp>
5 *
6 * 8bit Timer Handler
7 *
8 */
9
10#include <linux/errno.h>
11#include <linux/sched.h>
12#include <linux/kernel.h>
13#include <linux/param.h>
14#include <linux/string.h>
15#include <linux/mm.h>
16#include <linux/interrupt.h>
17#include <linux/init.h>
18#include <linux/profile.h>
19
20#include <asm/io.h>
21#include <asm/irq.h>
22#include <asm/timer.h>
23#if defined(CONFIG_CPU_H8300H)
24#include <asm/regs306x.h>
25#endif
26#if defined(CONFIG_CPU_H8S)
27#include <asm/regs267x.h>
28#endif
29
30/* 8bit timer x2 */
31#define CMFA 6
32
33#if defined(CONFIG_H8300_TIMER8_CH0)
34#define _8BASE _8TCR0
35#ifdef CONFIG_CPU_H8300H
36#define _8IRQ 36
37#endif
38#ifdef CONFIG_CPU_H8S
39#define _8IRQ 72
40#endif
41#elif defined(CONFIG_H8300_TIMER8_CH2)
42#ifdef CONFIG_CPU_H8300H
43#define _8BASE _8TCR2
44#define _8IRQ 40
45#endif
46#endif
47
48#ifndef _8BASE
49#error Unknown timer channel.
50#endif
51
52#define _8TCR 0
53#define _8TCSR 2
54#define TCORA 4
55#define TCORB 6
56#define _8TCNT 8
57
58#define CMIEA 0x40
59#define CCLR_CMA 0x08
60#define CKS2 0x04
61
62/*
63 * timer_interrupt() needs to keep up the real-time clock,
64 * as well as call the "xtime_update()" routine every clocktick
65 */
66
67static irqreturn_t timer_interrupt(int irq, void *dev_id)
68{
69 h8300_timer_tick();
70 ctrl_bclr(CMFA, _8BASE + _8TCSR);
71 return IRQ_HANDLED;
72}
73
74static struct irqaction timer8_irq = {
75 .name = "timer-8",
76 .handler = timer_interrupt,
77 .flags = IRQF_DISABLED | IRQF_TIMER,
78};
79
80static const int __initconst divide_rate[] = {8, 64, 8192};
81
82void __init h8300_timer_setup(void)
83{
84 unsigned int div;
85 unsigned int cnt;
86
87 calc_param(cnt, div, divide_rate, 0x10000);
88 div++;
89
90 setup_irq(_8IRQ, &timer8_irq);
91
92#if defined(CONFIG_CPU_H8S)
93 /* Timer module enable */
94 ctrl_bclr(0, MSTPCRL)
95#endif
96
97 /* initialize timer */
98 ctrl_outw(cnt, _8BASE + TCORA);
99 ctrl_outw(0x0000, _8BASE + _8TCSR);
100 ctrl_outw((CMIEA|CCLR_CMA|CKS2) << 8 | div,
101 _8BASE + _8TCR);
102}
diff --git a/arch/h8300/kernel/timer/tpu.c b/arch/h8300/kernel/timer/tpu.c
deleted file mode 100644
index 0350f6204ecf..000000000000
--- a/arch/h8300/kernel/timer/tpu.c
+++ /dev/null
@@ -1,100 +0,0 @@
1/*
2 * linux/arch/h8300/kernel/timer/tpu.c
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * TPU Timer Handler
7 *
8 */
9
10#include <linux/errno.h>
11#include <linux/sched.h>
12#include <linux/kernel.h>
13#include <linux/param.h>
14#include <linux/string.h>
15#include <linux/mm.h>
16#include <linux/interrupt.h>
17#include <linux/init.h>
18#include <linux/timex.h>
19
20#include <asm/segment.h>
21#include <asm/io.h>
22#include <asm/irq.h>
23#include <asm/regs267x.h>
24
25/* TPU */
26#if CONFIG_H8300_TPU_CH == 0
27#define TPUBASE 0xffffd0
28#define TPUIRQ 40
29#elif CONFIG_H8300_TPU_CH == 1
30#define TPUBASE 0xffffe0
31#define TPUIRQ 48
32#elif CONFIG_H8300_TPU_CH == 2
33#define TPUBASE 0xfffff0
34#define TPUIRQ 52
35#elif CONFIG_H8300_TPU_CH == 3
36#define TPUBASE 0xfffe80
37#define TPUIRQ 56
38#elif CONFIG_H8300_TPU_CH == 4
39#define TPUBASE 0xfffe90
40#define TPUIRQ 64
41#else
42#error Unknown timer channel.
43#endif
44
45#define _TCR 0
46#define _TMDR 1
47#define _TIOR 2
48#define _TIER 4
49#define _TSR 5
50#define _TCNT 6
51#define _GRA 8
52#define _GRB 10
53
54#define CCLR0 0x20
55
56static irqreturn_t timer_interrupt(int irq, void *dev_id)
57{
58 h8300_timer_tick();
59 ctrl_bclr(0, TPUBASE + _TSR);
60 return IRQ_HANDLED;
61}
62
63static struct irqaction tpu_irq = {
64 .name = "tpu",
65 .handler = timer_interrupt,
66 .flags = IRQF_DISABLED | IRQF_TIMER,
67};
68
69static const int __initconst divide_rate[] = {
70#if CONFIG_H8300_TPU_CH == 0
71 1,4,16,64,0,0,0,0,
72#elif (CONFIG_H8300_TPU_CH == 1) || (CONFIG_H8300_TPU_CH == 5)
73 1,4,16,64,0,0,256,0,
74#elif (CONFIG_H8300_TPU_CH == 2) || (CONFIG_H8300_TPU_CH == 4)
75 1,4,16,64,0,0,0,1024,
76#elif CONFIG_H8300_TPU_CH == 3
77 1,4,16,64,0,1024,256,4096,
78#endif
79};
80
81void __init h8300_timer_setup(void)
82{
83 unsigned int cnt;
84 unsigned int div;
85
86 calc_param(cnt, div, divide_rate, 0x10000);
87
88 setup_irq(TPUIRQ, &tpu_irq);
89
90 /* TPU module enabled */
91 ctrl_bclr(3, MSTPCRH);
92
93 ctrl_outb(0, TSTR);
94 ctrl_outb(CCLR0 | div, TPUBASE + _TCR);
95 ctrl_outb(0, TPUBASE + _TMDR);
96 ctrl_outw(0, TPUBASE + _TIOR);
97 ctrl_outb(0x01, TPUBASE + _TIER);
98 ctrl_outw(cnt, TPUBASE + _GRA);
99 ctrl_bset(CONFIG_H8300_TPU_CH, TSTR);
100}
diff --git a/arch/h8300/kernel/traps.c b/arch/h8300/kernel/traps.c
deleted file mode 100644
index cfe494dbe3da..000000000000
--- a/arch/h8300/kernel/traps.c
+++ /dev/null
@@ -1,166 +0,0 @@
1/*
2 * linux/arch/h8300/boot/traps.c -- general exception handling code
3 * H8/300 support Yoshinori Sato <ysato@users.sourceforge.jp>
4 *
5 * Cloned from Linux/m68k.
6 *
7 * No original Copyright holder listed,
8 * Probable original (C) Roman Zippel (assigned DJD, 1999)
9 *
10 * Copyright 1999-2000 D. Jeff Dionne, <jeff@rt-control.com>
11 *
12 * This file is subject to the terms and conditions of the GNU General Public
13 * License. See the file COPYING in the main directory of this archive
14 * for more details.
15 */
16
17#include <linux/types.h>
18#include <linux/sched.h>
19#include <linux/kernel.h>
20#include <linux/errno.h>
21#include <linux/init.h>
22#include <linux/module.h>
23#include <linux/bug.h>
24
25#include <asm/irq.h>
26#include <asm/traps.h>
27#include <asm/page.h>
28
29static DEFINE_SPINLOCK(die_lock);
30
31/*
32 * this must be called very early as the kernel might
33 * use some instruction that are emulated on the 060
34 */
35
36void __init base_trap_init(void)
37{
38}
39
40void __init trap_init (void)
41{
42}
43
44asmlinkage void set_esp0 (unsigned long ssp)
45{
46 current->thread.esp0 = ssp;
47}
48
49/*
50 * Generic dumping code. Used for panic and debug.
51 */
52
53static void dump(struct pt_regs *fp)
54{
55 unsigned long *sp;
56 unsigned char *tp;
57 int i;
58
59 printk("\nCURRENT PROCESS:\n\n");
60 printk("COMM=%s PID=%d\n", current->comm, current->pid);
61 if (current->mm) {
62 printk("TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n",
63 (int) current->mm->start_code,
64 (int) current->mm->end_code,
65 (int) current->mm->start_data,
66 (int) current->mm->end_data,
67 (int) current->mm->end_data,
68 (int) current->mm->brk);
69 printk("USER-STACK=%08x KERNEL-STACK=%08lx\n\n",
70 (int) current->mm->start_stack,
71 (int) PAGE_SIZE+(unsigned long)current);
72 }
73
74 show_regs(fp);
75 printk("\nCODE:");
76 tp = ((unsigned char *) fp->pc) - 0x20;
77 for (sp = (unsigned long *) tp, i = 0; (i < 0x40); i += 4) {
78 if ((i % 0x10) == 0)
79 printk("\n%08x: ", (int) (tp + i));
80 printk("%08x ", (int) *sp++);
81 }
82 printk("\n");
83
84 printk("\nKERNEL STACK:");
85 tp = ((unsigned char *) fp) - 0x40;
86 for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) {
87 if ((i % 0x10) == 0)
88 printk("\n%08x: ", (int) (tp + i));
89 printk("%08x ", (int) *sp++);
90 }
91 printk("\n");
92 if (STACK_MAGIC != *(unsigned long *)((unsigned long)current+PAGE_SIZE))
93 printk("(Possibly corrupted stack page??)\n");
94
95 printk("\n\n");
96}
97
98void die(const char *str, struct pt_regs *fp, unsigned long err)
99{
100 static int diecount;
101
102 oops_enter();
103
104 console_verbose();
105 spin_lock_irq(&die_lock);
106 report_bug(fp->pc, fp);
107 printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff, ++diecount);
108 dump(fp);
109
110 spin_unlock_irq(&die_lock);
111 do_exit(SIGSEGV);
112}
113
114extern char _start, _etext;
115#define check_kernel_text(addr) \
116 ((addr >= (unsigned long)(&_start)) && \
117 (addr < (unsigned long)(&_etext)))
118
119static int kstack_depth_to_print = 24;
120
121void show_stack(struct task_struct *task, unsigned long *esp)
122{
123 unsigned long *stack, addr;
124 int i;
125
126 if (esp == NULL)
127 esp = (unsigned long *) &esp;
128
129 stack = esp;
130
131 printk("Stack from %08lx:", (unsigned long)stack);
132 for (i = 0; i < kstack_depth_to_print; i++) {
133 if (((unsigned long)stack & (THREAD_SIZE - 1)) == 0)
134 break;
135 if (i % 8 == 0)
136 printk("\n ");
137 printk(" %08lx", *stack++);
138 }
139
140 printk("\nCall Trace:");
141 i = 0;
142 stack = esp;
143 while (((unsigned long)stack & (THREAD_SIZE - 1)) != 0) {
144 addr = *stack++;
145 /*
146 * If the address is either in the text segment of the
147 * kernel, or in the region which contains vmalloc'ed
148 * memory, it *may* be the address of a calling
149 * routine; if so, print it so that someone tracing
150 * down the cause of the crash will be able to figure
151 * out the call path that was taken.
152 */
153 if (check_kernel_text(addr)) {
154 if (i % 4 == 0)
155 printk("\n ");
156 printk(" [<%08lx>]", addr);
157 i++;
158 }
159 }
160 printk("\n");
161}
162
163void show_trace_task(struct task_struct *tsk)
164{
165 show_stack(tsk,(unsigned long *)tsk->thread.esp0);
166}
diff --git a/arch/h8300/kernel/vmlinux.lds.S b/arch/h8300/kernel/vmlinux.lds.S
deleted file mode 100644
index 3253fed42ac1..000000000000
--- a/arch/h8300/kernel/vmlinux.lds.S
+++ /dev/null
@@ -1,157 +0,0 @@
1#include <asm-generic/vmlinux.lds.h>
2#include <asm/page.h>
3
4/* target memory map */
5#ifdef CONFIG_H8300H_GENERIC
6#define ROMTOP 0x000000
7#define ROMSIZE 0x400000
8#define RAMTOP 0x400000
9#define RAMSIZE 0x400000
10#endif
11
12#ifdef CONFIG_H8300H_AKI3068NET
13#define ROMTOP 0x000000
14#define ROMSIZE 0x080000
15#define RAMTOP 0x400000
16#define RAMSIZE 0x200000
17#endif
18
19#ifdef CONFIG_H8300H_H8MAX
20#define ROMTOP 0x000000
21#define ROMSIZE 0x080000
22#define RAMTOP 0x400000
23#define RAMSIZE 0x200000
24#endif
25
26#ifdef CONFIG_H8300H_SIM
27#define ROMTOP 0x000000
28#define ROMSIZE 0x400000
29#define RAMTOP 0x400000
30#define RAMSIZE 0x400000
31#endif
32
33#ifdef CONFIG_H8S_SIM
34#define ROMTOP 0x000000
35#define ROMSIZE 0x400000
36#define RAMTOP 0x400000
37#define RAMSIZE 0x800000
38#endif
39
40#ifdef CONFIG_H8S_EDOSK2674
41#define ROMTOP 0x000000
42#define ROMSIZE 0x400000
43#define RAMTOP 0x400000
44#define RAMSIZE 0x800000
45#endif
46
47#if defined(CONFIG_H8300H_SIM) || defined(CONFIG_H8S_SIM)
48INPUT(romfs.o)
49#endif
50
51_jiffies = _jiffies_64 + 4;
52
53ENTRY(__start)
54
55SECTIONS
56{
57#if defined(CONFIG_ROMKERNEL)
58 . = ROMTOP;
59 .vectors :
60 {
61 __vector = . ;
62 *(.vectors*)
63 }
64#else
65 . = RAMTOP;
66 .bootvec :
67 {
68 *(.bootvec)
69 }
70#endif
71 .text :
72 {
73 _text = .;
74#if defined(CONFIG_ROMKERNEL)
75 *(.int_redirect)
76#endif
77 __stext = . ;
78 TEXT_TEXT
79 SCHED_TEXT
80 LOCK_TEXT
81 __etext = . ;
82 }
83 EXCEPTION_TABLE(16)
84
85 RODATA
86#if defined(CONFIG_ROMKERNEL)
87 SECURITY_INIT
88#endif
89 ROEND = .;
90#if defined(CONFIG_ROMKERNEL)
91 . = RAMTOP;
92 .data : AT(ROEND)
93#else
94 .data :
95#endif
96 {
97 __sdata = . ;
98 ___data_start = . ;
99
100 INIT_TASK_DATA(0x2000)
101 . = ALIGN(0x4) ;
102 DATA_DATA
103 . = ALIGN(0x4) ;
104 *(.data.*)
105
106 . = ALIGN(0x4) ;
107 ___init_begin = .;
108 __sinittext = .;
109 INIT_TEXT
110 __einittext = .;
111 INIT_DATA
112 . = ALIGN(0x4) ;
113 INIT_SETUP(0x4)
114 ___setup_start = .;
115 *(.init.setup)
116 . = ALIGN(0x4) ;
117 ___setup_end = .;
118 INIT_CALLS
119 CON_INITCALL
120 EXIT_TEXT
121 EXIT_DATA
122 INIT_RAM_FS
123 . = ALIGN(0x4) ;
124 ___init_end = .;
125 __edata = . ;
126 }
127#if defined(CONFIG_RAMKERNEL)
128 SECURITY_INIT
129#endif
130 __begin_data = LOADADDR(.data);
131 .bss :
132 {
133 . = ALIGN(0x4) ;
134 __sbss = . ;
135 ___bss_start = . ;
136 *(.bss*)
137 . = ALIGN(0x4) ;
138 *(COMMON)
139 . = ALIGN(0x4) ;
140 ___bss_stop = . ;
141 __ebss = . ;
142 __end = . ;
143 __ramstart = .;
144 }
145 .romfs :
146 {
147 *(.romfs*)
148 }
149 . = RAMTOP+RAMSIZE;
150 .dummy :
151 {
152 COMMAND_START = . - 0x200 ;
153 __ramend = . ;
154 }
155
156 DISCARDS
157}
diff --git a/arch/h8300/lib/Makefile b/arch/h8300/lib/Makefile
deleted file mode 100644
index 1577f5075b10..000000000000
--- a/arch/h8300/lib/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for H8/300-specific library files..
3#
4
5lib-y = ashrdi3.o checksum.o memcpy.o memset.o abs.o romfs.o
diff --git a/arch/h8300/lib/abs.S b/arch/h8300/lib/abs.S
deleted file mode 100644
index ddd1fb3d01ad..000000000000
--- a/arch/h8300/lib/abs.S
+++ /dev/null
@@ -1,21 +0,0 @@
1;;; abs.S
2
3#include <asm/linkage.h>
4
5#if defined(__H8300H__)
6 .h8300h
7#endif
8#if defined(__H8300S__)
9 .h8300s
10#endif
11 .text
12.global _abs
13
14;;; int abs(int n)
15_abs:
16 mov.l er0,er0
17 bpl 1f
18 neg.l er0
191:
20 rts
21
diff --git a/arch/h8300/lib/ashrdi3.c b/arch/h8300/lib/ashrdi3.c
deleted file mode 100644
index 78efb65e315a..000000000000
--- a/arch/h8300/lib/ashrdi3.c
+++ /dev/null
@@ -1,63 +0,0 @@
1/* ashrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */
2/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING. If not, write to
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */
20
21#define BITS_PER_UNIT 8
22
23typedef int SItype __attribute__ ((mode (SI)));
24typedef unsigned int USItype __attribute__ ((mode (SI)));
25typedef int DItype __attribute__ ((mode (DI)));
26typedef int word_type __attribute__ ((mode (__word__)));
27
28struct DIstruct {SItype high, low;};
29
30typedef union
31{
32 struct DIstruct s;
33 DItype ll;
34} DIunion;
35
36DItype
37__ashrdi3 (DItype u, word_type b)
38{
39 DIunion w;
40 word_type bm;
41 DIunion uu;
42
43 if (b == 0)
44 return u;
45
46 uu.ll = u;
47
48 bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
49 if (bm <= 0)
50 {
51 /* w.s.high = 1..1 or 0..0 */
52 w.s.high = uu.s.high >> (sizeof (SItype) * BITS_PER_UNIT - 1);
53 w.s.low = uu.s.high >> -bm;
54 }
55 else
56 {
57 USItype carries = (USItype)uu.s.high << bm;
58 w.s.high = uu.s.high >> b;
59 w.s.low = ((USItype)uu.s.low >> b) | carries;
60 }
61
62 return w.ll;
63}
diff --git a/arch/h8300/lib/checksum.c b/arch/h8300/lib/checksum.c
deleted file mode 100644
index bdc5b032acd6..000000000000
--- a/arch/h8300/lib/checksum.c
+++ /dev/null
@@ -1,164 +0,0 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * IP/TCP/UDP checksumming routines
7 *
8 * Authors: Jorge Cwik, <jorge@laser.satlink.net>
9 * Arnt Gulbrandsen, <agulbra@nvg.unit.no>
10 * Tom May, <ftom@netcom.com>
11 * Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de>
12 * Lots of code moved from tcp.c and ip.c; see those files
13 * for more names.
14 *
15 * 03/02/96 Jes Sorensen, Andreas Schwab, Roman Hodek:
16 * Fixed some nasty bugs, causing some horrible crashes.
17 * A: At some points, the sum (%0) was used as
18 * length-counter instead of the length counter
19 * (%1). Thanks to Roman Hodek for pointing this out.
20 * B: GCC seems to mess up if one uses too many
21 * data-registers to hold input values and one tries to
22 * specify d0 and d1 as scratch registers. Letting gcc choose these
23 * registers itself solves the problem.
24 *
25 * This program is free software; you can redistribute it and/or
26 * modify it under the terms of the GNU General Public License
27 * as published by the Free Software Foundation; either version
28 * 2 of the License, or (at your option) any later version.
29 */
30
31/* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access kills, so most
32 of the assembly has to go. */
33
34#include <net/checksum.h>
35#include <linux/module.h>
36
37static inline unsigned short from32to16(unsigned long x)
38{
39 /* add up 16-bit and 16-bit for 16+c bit */
40 x = (x & 0xffff) + (x >> 16);
41 /* add up carry.. */
42 x = (x & 0xffff) + (x >> 16);
43 return x;
44}
45
46static unsigned long do_csum(const unsigned char * buff, int len)
47{
48 int odd, count;
49 unsigned long result = 0;
50
51 if (len <= 0)
52 goto out;
53 odd = 1 & (unsigned long) buff;
54 if (odd) {
55 result = *buff;
56 len--;
57 buff++;
58 }
59 count = len >> 1; /* nr of 16-bit words.. */
60 if (count) {
61 if (2 & (unsigned long) buff) {
62 result += *(unsigned short *) buff;
63 count--;
64 len -= 2;
65 buff += 2;
66 }
67 count >>= 1; /* nr of 32-bit words.. */
68 if (count) {
69 unsigned long carry = 0;
70 do {
71 unsigned long w = *(unsigned long *) buff;
72 count--;
73 buff += 4;
74 result += carry;
75 result += w;
76 carry = (w > result);
77 } while (count);
78 result += carry;
79 result = (result & 0xffff) + (result >> 16);
80 }
81 if (len & 2) {
82 result += *(unsigned short *) buff;
83 buff += 2;
84 }
85 }
86 if (len & 1)
87 result += (*buff << 8);
88 result = from32to16(result);
89 if (odd)
90 result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
91out:
92 return result;
93}
94
95/*
96 * This is a version of ip_compute_csum() optimized for IP headers,
97 * which always checksum on 4 octet boundaries.
98 */
99__sum16 ip_fast_csum(const void *iph, unsigned int ihl)
100{
101 return (__force __sum16)~do_csum(iph,ihl*4);
102}
103
104/*
105 * computes the checksum of a memory block at buff, length len,
106 * and adds in "sum" (32-bit)
107 *
108 * returns a 32-bit number suitable for feeding into itself
109 * or csum_tcpudp_magic
110 *
111 * this function must be called with even lengths, except
112 * for the last fragment, which may be odd
113 *
114 * it's best to have buff aligned on a 32-bit boundary
115 */
116/*
117 * Egads... That thing apparently assumes that *all* checksums it ever sees will
118 * be folded. Very likely a bug.
119 */
120__wsum csum_partial(const void *buff, int len, __wsum sum)
121{
122 unsigned int result = do_csum(buff, len);
123
124 /* add in old sum, and carry.. */
125 result += (__force u32)sum;
126 /* 16+c bits -> 16 bits */
127 result = (result & 0xffff) + (result >> 16);
128 return (__force __wsum)result;
129}
130
131EXPORT_SYMBOL(csum_partial);
132
133/*
134 * this routine is used for miscellaneous IP-like checksums, mainly
135 * in icmp.c
136 */
137__sum16 ip_compute_csum(const void *buff, int len)
138{
139 return (__force __sum16)~do_csum(buff,len);
140}
141
142/*
143 * copy from fs while checksumming, otherwise like csum_partial
144 */
145
146__wsum
147csum_partial_copy_from_user(const void __user *src, void *dst, int len,
148 __wsum sum, int *csum_err)
149{
150 if (csum_err) *csum_err = 0;
151 memcpy(dst, (__force const void *)src, len);
152 return csum_partial(dst, len, sum);
153}
154
155/*
156 * copy from ds while checksumming, otherwise like csum_partial
157 */
158
159__wsum
160csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
161{
162 memcpy(dst, src, len);
163 return csum_partial(dst, len, sum);
164}
diff --git a/arch/h8300/lib/memcpy.S b/arch/h8300/lib/memcpy.S
deleted file mode 100644
index cad325e2c0e8..000000000000
--- a/arch/h8300/lib/memcpy.S
+++ /dev/null
@@ -1,84 +0,0 @@
1;;; memcpy.S
2
3#include <asm/linkage.h>
4
5#if defined(__H8300H__)
6 .h8300h
7#endif
8#if defined(__H8300S__)
9 .h8300s
10#endif
11
12 .text
13.global _memcpy
14
15;;; void *memcpy(void *to, void *from, size_t n)
16_memcpy:
17 mov.l er2,er2
18 bne 1f
19 rts
201:
21 ;; address check
22 bld #0,r0l
23 bxor #0,r1l
24 bcs 4f
25 mov.l er4,@-sp
26 mov.l er0,@-sp
27 btst #0,r0l
28 beq 1f
29 ;; (aligned even) odd address
30 mov.b @er1,r3l
31 mov.b r3l,@er0
32 adds #1,er1
33 adds #1,er0
34 dec.l #1,er2
35 beq 3f
361:
37 ;; n < sizeof(unsigned long) check
38 sub.l er4,er4
39 adds #4,er4 ; loop count check value
40 cmp.l er4,er2
41 blo 2f
42 ;; unsigned long copy
431:
44 mov.l @er1,er3
45 mov.l er3,@er0
46 adds #4,er0
47 adds #4,er1
48 subs #4,er2
49 cmp.l er4,er2
50 bcc 1b
51 ;; rest
522:
53 mov.l er2,er2
54 beq 3f
551:
56 mov.b @er1,r3l
57 mov.b r3l,@er0
58 adds #1,er1
59 adds #1,er0
60 dec.l #1,er2
61 bne 1b
623:
63 mov.l @sp+,er0
64 mov.l @sp+,er4
65 rts
66
67 ;; odd <- even / even <- odd
684:
69 mov.l er4,er3
70 mov.l er2,er4
71 mov.l er5,er2
72 mov.l er1,er5
73 mov.l er6,er1
74 mov.l er0,er6
751:
76 eepmov.w
77 mov.w r4,r4
78 bne 1b
79 dec.w #1,e4
80 bpl 1b
81 mov.l er1,er6
82 mov.l er2,er5
83 mov.l er3,er4
84 rts
diff --git a/arch/h8300/lib/memset.S b/arch/h8300/lib/memset.S
deleted file mode 100644
index 4549a64c5b79..000000000000
--- a/arch/h8300/lib/memset.S
+++ /dev/null
@@ -1,61 +0,0 @@
1/* memset.S */
2
3#include <asm/linkage.h>
4
5#if defined(__H8300H__)
6 .h8300h
7#endif
8#if defined(__H8300S__)
9 .h8300s
10#endif
11 .text
12
13.global _memset
14
15;;void *memset(*ptr, int c, size_t count)
16;; ptr = er0
17;; c = er1(r1l)
18;; count = er2
19_memset:
20 btst #0,r0l
21 beq 2f
22
23 ;; odd address
241:
25 mov.b r1l,@er0
26 adds #1,er0
27 dec.l #1,er2
28 beq 6f
29
30 ;; even address
312:
32 mov.l er2,er3
33 cmp.l #4,er2
34 blo 4f
35 ;; count>=4 -> count/4
36#if defined(__H8300H__)
37 shlr.l er2
38 shlr.l er2
39#endif
40#if defined(__H8300S__)
41 shlr.l #2,er2
42#endif
43 ;; byte -> long
44 mov.b r1l,r1h
45 mov.w r1,e1
463:
47 mov.l er1,@er0
48 adds #4,er0
49 dec.l #1,er2
50 bne 3b
514:
52 ;; count % 4
53 and.b #3,r3l
54 beq 6f
555:
56 mov.b r1l,@er0
57 adds #1,er0
58 dec.b r3l
59 bne 5b
606:
61 rts
diff --git a/arch/h8300/lib/romfs.S b/arch/h8300/lib/romfs.S
deleted file mode 100644
index 68910d8e1ff4..000000000000
--- a/arch/h8300/lib/romfs.S
+++ /dev/null
@@ -1,57 +0,0 @@
1/* romfs move to __ebss */
2
3#include <asm/linkage.h>
4
5#if defined(__H8300H__)
6 .h8300h
7#endif
8#if defined(__H8300S__)
9 .h8300s
10#endif
11
12#define BLKOFFSET 512
13
14 .text
15.globl __move_romfs
16_romfs_sig_len = 8
17
18__move_romfs:
19 mov.l #__sbss,er0
20 mov.l #_romfs_sig,er1
21 mov.b #_romfs_sig_len,r3l
221: /* check romfs image */
23 mov.b @er0+,r2l
24 mov.b @er1+,r2h
25 cmp.b r2l,r2h
26 bne 2f
27 dec.b r3l
28 bne 1b
29
30 /* find romfs image */
31 mov.l @__sbss+8,er0 /* romfs length(be) */
32 mov.l #__sbss,er1
33 add.l er0,er1 /* romfs image end */
34 mov.l #__ebss,er2
35 add.l er0,er2 /* distination address */
36#if defined(CONFIG_INTELFLASH)
37 add.l #BLKOFFSET,er2
38#endif
39 adds #2,er0
40 adds #1,er0
41 shlr er0
42 shlr er0 /* transfer length */
431:
44 mov.l @er1,er3 /* copy image */
45 mov.l er3,@er2
46 subs #4,er1
47 subs #4,er2
48 dec.l #1,er0
49 bpl 1b
502:
51 rts
52
53 .section .rodata
54_romfs_sig:
55 .ascii "-rom1fs-"
56
57 .end
diff --git a/arch/h8300/mm/Makefile b/arch/h8300/mm/Makefile
deleted file mode 100644
index 5f4bc42b6453..000000000000
--- a/arch/h8300/mm/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the linux m68k-specific parts of the memory manager.
3#
4
5obj-y := init.o fault.o memory.o kmap.o
diff --git a/arch/h8300/mm/fault.c b/arch/h8300/mm/fault.c
deleted file mode 100644
index 472535977006..000000000000
--- a/arch/h8300/mm/fault.c
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * linux/arch/h8300/mm/fault.c
3 *
4 * Copyright (C) 1998 D. Jeff Dionne <jeff@lineo.ca>,
5 * Copyright (C) 2000 Lineo, Inc. (www.lineo.com)
6 *
7 * Based on:
8 *
9 * linux/arch/m68knommu/mm/fault.c
10 * linux/arch/m68k/mm/fault.c
11 *
12 * Copyright (C) 1995 Hamish Macdonald
13 */
14
15#include <linux/mman.h>
16#include <linux/mm.h>
17#include <linux/kernel.h>
18#include <linux/ptrace.h>
19
20#include <asm/pgtable.h>
21
22/*
23 * This routine handles page faults. It determines the problem, and
24 * then passes it off to one of the appropriate routines.
25 *
26 * error_code:
27 * bit 0 == 0 means no page found, 1 means protection fault
28 * bit 1 == 0 means read, 1 means write
29 *
30 * If this routine detects a bad access, it returns 1, otherwise it
31 * returns 0.
32 */
33asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
34 unsigned long error_code)
35{
36#ifdef DEBUG
37 printk ("regs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld\n",
38 regs->sr, regs->pc, address, error_code);
39#endif
40
41/*
42 * Oops. The kernel tried to access some bad page. We'll have to
43 * terminate things with extreme prejudice.
44 */
45 if ((unsigned long) address < PAGE_SIZE) {
46 printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
47 } else
48 printk(KERN_ALERT "Unable to handle kernel access");
49 printk(" at virtual address %08lx\n",address);
50 if (!user_mode(regs))
51 die("Oops", regs, error_code);
52 do_exit(SIGKILL);
53
54 return 1;
55}
56
diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c
deleted file mode 100644
index 6c1251e491af..000000000000
--- a/arch/h8300/mm/init.c
+++ /dev/null
@@ -1,155 +0,0 @@
1/*
2 * linux/arch/h8300/mm/init.c
3 *
4 * Copyright (C) 1998 D. Jeff Dionne <jeff@lineo.ca>,
5 * Kenneth Albanowski <kjahds@kjahds.com>,
6 * Copyright (C) 2000 Lineo, Inc. (www.lineo.com)
7 *
8 * Based on:
9 *
10 * linux/arch/m68knommu/mm/init.c
11 * linux/arch/m68k/mm/init.c
12 *
13 * Copyright (C) 1995 Hamish Macdonald
14 *
15 * JAN/1999 -- hacked to support ColdFire (gerg@snapgear.com)
16 * DEC/2000 -- linux 2.4 support <davidm@snapgear.com>
17 */
18
19#include <linux/signal.h>
20#include <linux/sched.h>
21#include <linux/kernel.h>
22#include <linux/errno.h>
23#include <linux/string.h>
24#include <linux/types.h>
25#include <linux/ptrace.h>
26#include <linux/mman.h>
27#include <linux/mm.h>
28#include <linux/swap.h>
29#include <linux/init.h>
30#include <linux/highmem.h>
31#include <linux/pagemap.h>
32#include <linux/bootmem.h>
33#include <linux/gfp.h>
34
35#include <asm/setup.h>
36#include <asm/segment.h>
37#include <asm/page.h>
38#include <asm/pgtable.h>
39#include <asm/sections.h>
40
41#undef DEBUG
42
43/*
44 * BAD_PAGE is the page that is used for page faults when linux
45 * is out-of-memory. Older versions of linux just did a
46 * do_exit(), but using this instead means there is less risk
47 * for a process dying in kernel mode, possibly leaving a inode
48 * unused etc..
49 *
50 * BAD_PAGETABLE is the accompanying page-table: it is initialized
51 * to point to BAD_PAGE entries.
52 *
53 * ZERO_PAGE is a special page that is used for zero-initialized
54 * data and COW.
55 */
56static unsigned long empty_bad_page_table;
57
58static unsigned long empty_bad_page;
59
60unsigned long empty_zero_page;
61
62extern unsigned long rom_length;
63
64extern unsigned long memory_start;
65extern unsigned long memory_end;
66
67/*
68 * paging_init() continues the virtual memory environment setup which
69 * was begun by the code in arch/head.S.
70 * The parameters are pointers to where to stick the starting and ending
71 * addresses of available kernel virtual memory.
72 */
73void __init paging_init(void)
74{
75 /*
76 * Make sure start_mem is page aligned, otherwise bootmem and
77 * page_alloc get different views og the world.
78 */
79#ifdef DEBUG
80 unsigned long start_mem = PAGE_ALIGN(memory_start);
81#endif
82 unsigned long end_mem = memory_end & PAGE_MASK;
83
84#ifdef DEBUG
85 printk ("start_mem is %#lx\nvirtual_end is %#lx\n",
86 start_mem, end_mem);
87#endif
88
89 /*
90 * Initialize the bad page table and bad page to point
91 * to a couple of allocated pages.
92 */
93 empty_bad_page_table = (unsigned long)alloc_bootmem_pages(PAGE_SIZE);
94 empty_bad_page = (unsigned long)alloc_bootmem_pages(PAGE_SIZE);
95 empty_zero_page = (unsigned long)alloc_bootmem_pages(PAGE_SIZE);
96 memset((void *)empty_zero_page, 0, PAGE_SIZE);
97
98 /*
99 * Set up SFC/DFC registers (user data space).
100 */
101 set_fs (USER_DS);
102
103#ifdef DEBUG
104 printk ("before free_area_init\n");
105
106 printk ("free_area_init -> start_mem is %#lx\nvirtual_end is %#lx\n",
107 start_mem, end_mem);
108#endif
109
110 {
111 unsigned long zones_size[MAX_NR_ZONES] = {0, };
112
113 zones_size[ZONE_DMA] = 0 >> PAGE_SHIFT;
114 zones_size[ZONE_NORMAL] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT;
115#ifdef CONFIG_HIGHMEM
116 zones_size[ZONE_HIGHMEM] = 0;
117#endif
118 free_area_init(zones_size);
119 }
120}
121
122void __init mem_init(void)
123{
124 unsigned long codesize = _etext - _stext;
125
126 pr_devel("Mem_init: start=%lx, end=%lx\n", memory_start, memory_end);
127
128 high_memory = (void *) (memory_end & PAGE_MASK);
129 max_mapnr = MAP_NR(high_memory);
130
131 /* this will put all low memory onto the freelists */
132 free_all_bootmem();
133
134 mem_init_print_info(NULL);
135 if (rom_length > 0 && rom_length > codesize)
136 pr_info("Memory available: %luK/%luK ROM\n",
137 (rom_length - codesize) >> 10, rom_length >> 10);
138}
139
140
141#ifdef CONFIG_BLK_DEV_INITRD
142void free_initrd_mem(unsigned long start, unsigned long end)
143{
144 free_reserved_area((void *)start, (void *)end, -1, "initrd");
145}
146#endif
147
148void
149free_initmem(void)
150{
151#ifdef CONFIG_RAMKERNEL
152 free_initmem_default(-1);
153#endif
154}
155
diff --git a/arch/h8300/mm/kmap.c b/arch/h8300/mm/kmap.c
deleted file mode 100644
index f79edcdadf39..000000000000
--- a/arch/h8300/mm/kmap.c
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * linux/arch/h8300/mm/kmap.c
3 *
4 * Based on
5 * linux/arch/m68knommu/mm/kmap.c
6 *
7 * Copyright (C) 2000 Lineo, <davidm@snapgear.com>
8 * Copyright (C) 2000-2002 David McCullough <davidm@snapgear.com>
9 */
10
11#include <linux/mm.h>
12#include <linux/kernel.h>
13#include <linux/string.h>
14#include <linux/types.h>
15#include <linux/vmalloc.h>
16
17#include <asm/setup.h>
18#include <asm/segment.h>
19#include <asm/page.h>
20#include <asm/pgalloc.h>
21#include <asm/io.h>
22
23#undef DEBUG
24
25#define VIRT_OFFSET (0x01000000)
26
27/*
28 * Map some physical address range into the kernel address space.
29 */
30void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag)
31{
32 return (void *)(physaddr + VIRT_OFFSET);
33}
34
35/*
36 * Unmap a ioremap()ed region again.
37 */
38void iounmap(void *addr)
39{
40}
41
42/*
43 * __iounmap unmaps nearly everything, so be careful
44 * it doesn't free currently pointer/page tables anymore but it
45 * wans't used anyway and might be added later.
46 */
47void __iounmap(void *addr, unsigned long size)
48{
49}
50
51/*
52 * Set new cache mode for some kernel address space.
53 * The caller must push data for that range itself, if such data may already
54 * be in the cache.
55 */
56void kernel_set_cachemode(void *addr, unsigned long size, int cmode)
57{
58}
diff --git a/arch/h8300/mm/memory.c b/arch/h8300/mm/memory.c
deleted file mode 100644
index 06e364641392..000000000000
--- a/arch/h8300/mm/memory.c
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * linux/arch/h8300/mm/memory.c
3 *
4 * Copyright (C) 2002 Yoshinori Sato <ysato@users.sourceforge.jp>,
5 *
6 * Based on:
7 *
8 * linux/arch/m68knommu/mm/memory.c
9 *
10 * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>,
11 * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
12 *
13 * Based on:
14 *
15 * linux/arch/m68k/mm/memory.c
16 *
17 * Copyright (C) 1995 Hamish Macdonald
18 */
19
20#include <linux/mm.h>
21#include <linux/kernel.h>
22#include <linux/string.h>
23#include <linux/types.h>
24
25#include <asm/setup.h>
26#include <asm/segment.h>
27#include <asm/page.h>
28#include <asm/pgtable.h>
29#include <asm/traps.h>
30#include <asm/io.h>
31
32void cache_clear (unsigned long paddr, int len)
33{
34}
35
36
37void cache_push (unsigned long paddr, int len)
38{
39}
40
41void cache_push_v (unsigned long vaddr, int len)
42{
43}
44
45/*
46 * Map some physical address range into the kernel address space.
47 */
48
49unsigned long kernel_map(unsigned long paddr, unsigned long size,
50 int nocacheflag, unsigned long *memavailp )
51{
52 return paddr;
53}
54
diff --git a/arch/h8300/platform/h8300h/Makefile b/arch/h8300/platform/h8300h/Makefile
deleted file mode 100644
index 420f73b0d962..000000000000
--- a/arch/h8300/platform/h8300h/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4# Reuse any files we can from the H8/300H
5#
6
7obj-y := irq.o ptrace_h8300h.o
diff --git a/arch/h8300/platform/h8300h/aki3068net/Makefile b/arch/h8300/platform/h8300h/aki3068net/Makefile
deleted file mode 100644
index b7ff78050b7f..000000000000
--- a/arch/h8300/platform/h8300h/aki3068net/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5extra-y := crt0_ram.o
diff --git a/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S b/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S
deleted file mode 100644
index b2ad0f2d0417..000000000000
--- a/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * Platform depend startup
7 * Target Archtecture: AE-3068 (aka. aki3068net)
8 * Memory Layout : RAM
9 */
10
11#define ASSEMBLY
12
13#include <asm/linkage.h>
14
15#if !defined(CONFIG_BLKDEV_RESERVE)
16#if defined(CONFIG_GDB_DEBUG)
17#define RAMEND (__ramend - 0xc000)
18#else
19#define RAMEND __ramend
20#endif
21#else
22#define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS
23#endif
24
25 .global __start
26 .global _command_line
27 .global __platform_gpio_table
28 .global __target_name
29
30 .h8300h
31
32 .section .text
33 .file "crt0_ram.S"
34
35 /* CPU Reset entry */
36__start:
37 mov.l #RAMEND,sp
38 ldc #0x80,ccr
39
40 /* Peripheral Setup */
41
42#if defined(CONFIG_MTD_UCLINUX)
43 /* move romfs image */
44 jsr @__move_romfs
45#endif
46
47 /* .bss clear */
48 mov.l #__sbss,er5
49 mov.l #__ebss,er4
50 sub.l er5,er4
51 shlr er4
52 shlr er4
53 sub.l er0,er0
541:
55 mov.l er0,@er5
56 adds #4,er5
57 dec.l #1,er4
58 bne 1b
59
60 /* copy kernel commandline */
61 mov.l #COMMAND_START,er5
62 mov.l #_command_line,er6
63 mov.w #512,r4
64 eepmov.w
65
66 /* uClinux kernel start */
67 ldc #0x90,ccr /* running kernel */
68 mov.l #_init_thread_union,sp
69 add.l #0x2000,sp
70 jsr @_start_kernel
71_exit:
72
73 jmp _exit
74
75 rts
76
77 /* I/O port assign information */
78__platform_gpio_table:
79 mov.l #gpio_table,er0
80 rts
81
82gpio_table:
83 ;; P1DDR
84 .byte 0xff,0xff
85 ;; P2DDR
86 .byte 0xff,0xff
87 ;; P3DDR
88 .byte 0xff,0x00
89 ;; P4DDR
90 .byte 0x00,0x00
91 ;; P5DDR
92 .byte 0x01,0x01
93 ;; P6DDR
94 .byte 0x00,0x00
95 ;; dummy
96 .byte 0x00,0x00
97 ;; P8DDR
98 .byte 0x0c,0x0c
99 ;; P9DDR
100 .byte 0x00,0x00
101 ;; PADDR
102 .byte 0x00,0x00
103 ;; PBDDR
104 .byte 0x30,0x30
105
106__target_name:
107 .asciz "AE-3068"
108
109 .section .bootvec,"ax"
110 jmp @__start
diff --git a/arch/h8300/platform/h8300h/generic/Makefile b/arch/h8300/platform/h8300h/generic/Makefile
deleted file mode 100644
index 2b12a170209e..000000000000
--- a/arch/h8300/platform/h8300h/generic/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5extra-y := crt0_$(MODEL).o
diff --git a/arch/h8300/platform/h8300h/generic/crt0_ram.S b/arch/h8300/platform/h8300h/generic/crt0_ram.S
deleted file mode 100644
index 5ab7d9c12910..000000000000
--- a/arch/h8300/platform/h8300h/generic/crt0_ram.S
+++ /dev/null
@@ -1,107 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8300h/generic/crt0_ram.S
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * Platform depend startup
7 * Target Archtecture: AE-3068 (aka. aki3068net)
8 * Memory Layout : RAM
9 */
10
11#define ASSEMBLY
12
13#include <asm/linkage.h>
14
15#if !defined(CONFIG_BLKDEV_RESERVE)
16#if defined(CONFIG_GDB_DEBUG)
17#define RAMEND (__ramend - 0xc000)
18#else
19#define RAMEND __ramend
20#endif
21#else
22#define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS
23#endif
24
25 .global __start
26 .global _command_line
27 .global __platform_gpio_table
28 .global __target_name
29
30 .h8300h
31
32 .section .text
33 .file "crt0_ram.S"
34
35 /* CPU Reset entry */
36__start:
37 mov.l #RAMEND,sp
38 ldc #0x80,ccr
39
40 /* Peripheral Setup */
41
42#if defined(CONFIG_BLK_DEV_BLKMEM)
43 /* move romfs image */
44 jsr @__move_romfs
45#endif
46
47 /* .bss clear */
48 mov.l #__sbss,er5
49 mov.l #__ebss,er4
50 sub.l er5,er4
51 shlr er4
52 shlr er4
53 sub.l er0,er0
541:
55 mov.l er0,@er5
56 adds #4,er5
57 dec.l #1,er4
58 bne 1b
59
60 /* copy kernel commandline */
61 mov.l #COMMAND_START,er5
62 mov.l #_command_line,er6
63 mov.w #512,r4
64 eepmov.w
65
66 /* uClinux kernel start */
67 ldc #0x90,ccr /* running kernel */
68 mov.l #_init_thread_union,sp
69 add.l #0x2000,sp
70 jsr @_start_kernel
71_exit:
72
73 jmp _exit
74
75 rts
76
77 /* I/O port assign information */
78__platform_gpio_table:
79 mov.l #gpio_table,er0
80 rts
81
82gpio_table:
83 ;; P1DDR
84 .byte 0x00,0x00
85 ;; P2DDR
86 .byte 0x00,0x00
87 ;; P3DDR
88 .byte 0x00,0x00
89 ;; P4DDR
90 .byte 0x00,0x00
91 ;; P5DDR
92 .byte 0x00,0x00
93 ;; P6DDR
94 .byte 0x00,0x00
95 ;; dummy
96 .byte 0x00,0x00
97 ;; P8DDR
98 .byte 0x00,0x00
99 ;; P9DDR
100 .byte 0x00,0x00
101 ;; PADDR
102 .byte 0x00,0x00
103 ;; PBDDR
104 .byte 0x00,0x00
105
106__target_name:
107 .asciz "generic"
diff --git a/arch/h8300/platform/h8300h/generic/crt0_rom.S b/arch/h8300/platform/h8300h/generic/crt0_rom.S
deleted file mode 100644
index dda1dfa15a5e..000000000000
--- a/arch/h8300/platform/h8300h/generic/crt0_rom.S
+++ /dev/null
@@ -1,122 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8300h/generic/crt0_rom.S
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * Platform depend startup
7 * Target Archtecture: generic
8 * Memory Layout : ROM
9 */
10
11#define ASSEMBLY
12
13#include <asm/linkage.h>
14
15 .global __start
16 .global __command_line
17 .global __platform_gpio_table
18 .global __target_name
19
20 .h8300h
21 .section .text
22 .file "crt0_rom.S"
23
24 /* CPU Reset entry */
25__start:
26 mov.l #__ramend,sp
27 ldc #0x80,ccr
28
29 /* Peripheral Setup */
30
31 /* .bss clear */
32 mov.l #__sbss,er5
33 mov.l #__ebss,er4
34 sub.l er5,er4
35 shlr er4
36 shlr er4
37 sub.l er0,er0
381:
39 mov.l er0,@er5
40 adds #4,er5
41 dec.l #1,er4
42 bne 1b
43
44 /* copy .data */
45#if !defined(CONFIG_H8300H_SIM)
46 /* copy .data */
47 mov.l #__begin_data,er5
48 mov.l #__sdata,er6
49 mov.l #__edata,er4
50 sub.l er6,er4
51 shlr.l er4
52 shlr.l er4
531:
54 mov.l @er5+,er0
55 mov.l er0,@er6
56 adds #4,er6
57 dec.l #1,er4
58 bne 1b
59#endif
60
61 /* copy kernel commandline */
62 mov.l #COMMAND_START,er5
63 mov.l #__command_line,er6
64 mov.w #512,r4
65 eepmov.w
66
67 /* linux kernel start */
68 ldc #0x90,ccr /* running kernel */
69 mov.l #_init_thread_union,sp
70 add.l #0x2000,sp
71 jsr @_start_kernel
72_exit:
73
74 jmp _exit
75
76 rts
77
78 /* I/O port assign information */
79__platform_gpio_table:
80 mov.l #gpio_table,er0
81 rts
82
83gpio_table:
84 ;; P1DDR
85 .byte 0x00,0x00
86 ;; P2DDR
87 .byte 0x00,0x00
88 ;; P3DDR
89 .byte 0x00,0x00
90 ;; P4DDR
91 .byte 0x00,0x00
92 ;; P5DDR
93 .byte 0x00,0x00
94 ;; P6DDR
95 .byte 0x00,0x00
96 ;; dummy
97 .byte 0x00,0x00
98 ;; P8DDR
99 .byte 0x00,0x00
100 ;; P9DDR
101 .byte 0x00,0x00
102 ;; PADDR
103 .byte 0x00,0x00
104 ;; PBDDR
105 .byte 0x00,0x00
106
107 .section .rodata
108__target_name:
109 .asciz "generic"
110
111 .section .bss
112__command_line:
113 .space 512
114
115 /* interrupt vector */
116 .section .vectors,"ax"
117 .long __start
118vector = 1
119 .rept 64-1
120 .long _interrupt_redirect_table+vector*4
121vector = vector + 1
122 .endr
diff --git a/arch/h8300/platform/h8300h/h8max/Makefile b/arch/h8300/platform/h8300h/h8max/Makefile
deleted file mode 100644
index b7ff78050b7f..000000000000
--- a/arch/h8300/platform/h8300h/h8max/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5extra-y := crt0_ram.o
diff --git a/arch/h8300/platform/h8300h/h8max/crt0_ram.S b/arch/h8300/platform/h8300h/h8max/crt0_ram.S
deleted file mode 100644
index 6a0d4e2d9ec6..000000000000
--- a/arch/h8300/platform/h8300h/h8max/crt0_ram.S
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8300h/h8max/crt0_ram.S
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * Platform depend startup
7 * Target Archtecture: H8MAX
8 * Memory Layout : RAM
9 */
10
11#define ASSEMBLY
12
13#include <asm/linkage.h>
14
15#if !defined(CONFIG_BLKDEV_RESERVE)
16#if defined(CONFIG_GDB_DEBUG)
17#define RAMEND (__ramend - 0xc000)
18#else
19#define RAMEND __ramend
20#endif
21#else
22#define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS
23#endif
24
25 .global __start
26 .global _command_line
27 .global __platform_gpio_table
28 .global __target_name
29
30 .h8300h
31
32 .section .text
33 .file "crt0_ram.S"
34
35 /* CPU Reset entry */
36__start:
37 mov.l #RAMEND,sp
38 ldc #0x80,ccr
39
40 /* Peripheral Setup */
41
42#if defined(CONFIG_MTD_UCLINUX)
43 /* move romfs image */
44 jsr @__move_romfs
45#endif
46
47 /* .bss clear */
48 mov.l #__sbss,er5
49 mov.l #__ebss,er4
50 sub.l er5,er4
51 shlr er4
52 shlr er4
53 sub.l er0,er0
541:
55 mov.l er0,@er5
56 adds #4,er5
57 dec.l #1,er4
58 bne 1b
59
60 /* copy kernel commandline */
61 mov.l #COMMAND_START,er5
62 mov.l #_command_line,er6
63 mov.w #512,r4
64 eepmov.w
65
66 /* uClinux kernel start */
67 ldc #0x90,ccr /* running kernel */
68 mov.l #_init_thread_union,sp
69 add.l #0x2000,sp
70 jsr @_start_kernel
71_exit:
72
73 jmp _exit
74
75 rts
76
77 /* I/O port assign information */
78__platform_gpio_table:
79 mov.l #gpio_table,er0
80 rts
81
82gpio_table:
83 ;; P1DDR
84 .byte 0xff,0xff
85 ;; P2DDR
86 .byte 0xff,0xff
87 ;; P3DDR
88 .byte 0x00,0x00
89 ;; P4DDR
90 .byte 0x00,0x00
91 ;; P5DDR
92 .byte 0x01,0x01
93 ;; P6DDR
94 .byte 0xf6,0xf6
95 ;; dummy
96 .byte 0x00,0x00
97 ;; P8DDR
98 .byte 0xee,0xee
99 ;; P9DDR
100 .byte 0x00,0x00
101 ;; PADDR
102 .byte 0x00,0x00
103 ;; PBDDR
104 .byte 0x30,0x30
105
106__target_name:
107 .asciz "H8MAX"
108
109 .section .bootvec,"ax"
110 jmp @__start
diff --git a/arch/h8300/platform/h8300h/irq.c b/arch/h8300/platform/h8300h/irq.c
deleted file mode 100644
index 0a50353e09d5..000000000000
--- a/arch/h8300/platform/h8300h/irq.c
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * Interrupt handling H8/300H depend.
3 * Yoshinori Sato <ysato@users.sourceforge.jp>
4 *
5 */
6
7#include <linux/init.h>
8#include <linux/errno.h>
9
10#include <asm/ptrace.h>
11#include <asm/traps.h>
12#include <asm/irq.h>
13#include <asm/io.h>
14#include <asm/gpio-internal.h>
15#include <asm/regs306x.h>
16
17const int __initconst h8300_saved_vectors[] = {
18#if defined(CONFIG_GDB_DEBUG)
19 TRAP3_VEC, /* TRAPA #3 is GDB breakpoint */
20#endif
21 -1,
22};
23
24const h8300_vector __initconst h8300_trap_table[] = {
25 0, 0, 0, 0, 0, 0, 0, 0,
26 system_call,
27 0,
28 0,
29 trace_break,
30};
31
32int h8300_enable_irq_pin(unsigned int irq)
33{
34 int bitmask;
35 if (irq < EXT_IRQ0 || irq > EXT_IRQ5)
36 return 0;
37
38 /* initialize IRQ pin */
39 bitmask = 1 << (irq - EXT_IRQ0);
40 switch(irq) {
41 case EXT_IRQ0:
42 case EXT_IRQ1:
43 case EXT_IRQ2:
44 case EXT_IRQ3:
45 if (H8300_GPIO_RESERVE(H8300_GPIO_P8, bitmask) == 0)
46 return -EBUSY;
47 H8300_GPIO_DDR(H8300_GPIO_P8, bitmask, H8300_GPIO_INPUT);
48 break;
49 case EXT_IRQ4:
50 case EXT_IRQ5:
51 if (H8300_GPIO_RESERVE(H8300_GPIO_P9, bitmask) == 0)
52 return -EBUSY;
53 H8300_GPIO_DDR(H8300_GPIO_P9, bitmask, H8300_GPIO_INPUT);
54 break;
55 }
56
57 return 0;
58}
59
60void h8300_disable_irq_pin(unsigned int irq)
61{
62 int bitmask;
63 if (irq < EXT_IRQ0 || irq > EXT_IRQ5)
64 return;
65
66 /* disable interrupt & release IRQ pin */
67 bitmask = 1 << (irq - EXT_IRQ0);
68 switch(irq) {
69 case EXT_IRQ0:
70 case EXT_IRQ1:
71 case EXT_IRQ2:
72 case EXT_IRQ3:
73 *(volatile unsigned char *)IER &= ~bitmask;
74 H8300_GPIO_FREE(H8300_GPIO_P8, bitmask);
75 break ;
76 case EXT_IRQ4:
77 case EXT_IRQ5:
78 *(volatile unsigned char *)IER &= ~bitmask;
79 H8300_GPIO_FREE(H8300_GPIO_P9, bitmask);
80 break;
81 }
82}
diff --git a/arch/h8300/platform/h8300h/ptrace_h8300h.c b/arch/h8300/platform/h8300h/ptrace_h8300h.c
deleted file mode 100644
index 4f1ed0279633..000000000000
--- a/arch/h8300/platform/h8300h/ptrace_h8300h.c
+++ /dev/null
@@ -1,284 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8300h/ptrace_h8300h.c
3 * ptrace cpu depend helper functions
4 *
5 * Yoshinori Sato <ysato@users.sourceforge.jp>
6 *
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of
9 * this archive for more details.
10 */
11
12#include <linux/linkage.h>
13#include <linux/sched.h>
14#include <asm/ptrace.h>
15
16#define CCR_MASK 0x6f /* mode/imask not set */
17#define BREAKINST 0x5730 /* trapa #3 */
18
19/* Mapping from PT_xxx to the stack offset at which the register is
20 saved. Notice that usp has no stack-slot and needs to be treated
21 specially (see get_reg/put_reg below). */
22static const int h8300_register_offset[] = {
23 PT_REG(er1), PT_REG(er2), PT_REG(er3), PT_REG(er4),
24 PT_REG(er5), PT_REG(er6), PT_REG(er0), PT_REG(orig_er0),
25 PT_REG(ccr), PT_REG(pc)
26};
27
28/* read register */
29long h8300_get_reg(struct task_struct *task, int regno)
30{
31 switch (regno) {
32 case PT_USP:
33 return task->thread.usp + sizeof(long)*2;
34 case PT_CCR:
35 return *(unsigned short *)(task->thread.esp0 + h8300_register_offset[regno]);
36 default:
37 return *(unsigned long *)(task->thread.esp0 + h8300_register_offset[regno]);
38 }
39}
40
41/* write register */
42int h8300_put_reg(struct task_struct *task, int regno, unsigned long data)
43{
44 unsigned short oldccr;
45 switch (regno) {
46 case PT_USP:
47 task->thread.usp = data - sizeof(long)*2;
48 case PT_CCR:
49 oldccr = *(unsigned short *)(task->thread.esp0 + h8300_register_offset[regno]);
50 oldccr &= ~CCR_MASK;
51 data &= CCR_MASK;
52 data |= oldccr;
53 *(unsigned short *)(task->thread.esp0 + h8300_register_offset[regno]) = data;
54 break;
55 default:
56 *(unsigned long *)(task->thread.esp0 + h8300_register_offset[regno]) = data;
57 break;
58 }
59 return 0;
60}
61
62/* disable singlestep */
63void user_disable_single_step(struct task_struct *child)
64{
65 if((long)child->thread.breakinfo.addr != -1L) {
66 *child->thread.breakinfo.addr = child->thread.breakinfo.inst;
67 child->thread.breakinfo.addr = (unsigned short *)-1L;
68 }
69}
70
71/* calculate next pc */
72enum jump_type {none, /* normal instruction */
73 jabs, /* absolute address jump */
74 ind, /* indirect address jump */
75 ret, /* return to subrutine */
76 reg, /* register indexed jump */
77 relb, /* pc relative jump (byte offset) */
78 relw, /* pc relative jump (word offset) */
79 };
80
81/* opcode decode table define
82 ptn: opcode pattern
83 msk: opcode bitmask
84 len: instruction length (<0 next table index)
85 jmp: jump operation mode */
86struct optable {
87 unsigned char bitpattern;
88 unsigned char bitmask;
89 signed char length;
90 signed char type;
91} __attribute__((aligned(1),packed));
92
93#define OPTABLE(ptn,msk,len,jmp) \
94 { \
95 .bitpattern = ptn, \
96 .bitmask = msk, \
97 .length = len, \
98 .type = jmp, \
99 }
100
101static const struct optable optable_0[] = {
102 OPTABLE(0x00,0xff, 1,none), /* 0x00 */
103 OPTABLE(0x01,0xff,-1,none), /* 0x01 */
104 OPTABLE(0x02,0xfe, 1,none), /* 0x02-0x03 */
105 OPTABLE(0x04,0xee, 1,none), /* 0x04-0x05/0x14-0x15 */
106 OPTABLE(0x06,0xfe, 1,none), /* 0x06-0x07 */
107 OPTABLE(0x08,0xea, 1,none), /* 0x08-0x09/0x0c-0x0d/0x18-0x19/0x1c-0x1d */
108 OPTABLE(0x0a,0xee, 1,none), /* 0x0a-0x0b/0x1a-0x1b */
109 OPTABLE(0x0e,0xee, 1,none), /* 0x0e-0x0f/0x1e-0x1f */
110 OPTABLE(0x10,0xfc, 1,none), /* 0x10-0x13 */
111 OPTABLE(0x16,0xfe, 1,none), /* 0x16-0x17 */
112 OPTABLE(0x20,0xe0, 1,none), /* 0x20-0x3f */
113 OPTABLE(0x40,0xf0, 1,relb), /* 0x40-0x4f */
114 OPTABLE(0x50,0xfc, 1,none), /* 0x50-0x53 */
115 OPTABLE(0x54,0xfd, 1,ret ), /* 0x54/0x56 */
116 OPTABLE(0x55,0xff, 1,relb), /* 0x55 */
117 OPTABLE(0x57,0xff, 1,none), /* 0x57 */
118 OPTABLE(0x58,0xfb, 2,relw), /* 0x58/0x5c */
119 OPTABLE(0x59,0xfb, 1,reg ), /* 0x59/0x5b */
120 OPTABLE(0x5a,0xfb, 2,jabs), /* 0x5a/0x5e */
121 OPTABLE(0x5b,0xfb, 2,ind ), /* 0x5b/0x5f */
122 OPTABLE(0x60,0xe8, 1,none), /* 0x60-0x67/0x70-0x77 */
123 OPTABLE(0x68,0xfa, 1,none), /* 0x68-0x69/0x6c-0x6d */
124 OPTABLE(0x6a,0xfe,-2,none), /* 0x6a-0x6b */
125 OPTABLE(0x6e,0xfe, 2,none), /* 0x6e-0x6f */
126 OPTABLE(0x78,0xff, 4,none), /* 0x78 */
127 OPTABLE(0x79,0xff, 2,none), /* 0x79 */
128 OPTABLE(0x7a,0xff, 3,none), /* 0x7a */
129 OPTABLE(0x7b,0xff, 2,none), /* 0x7b */
130 OPTABLE(0x7c,0xfc, 2,none), /* 0x7c-0x7f */
131 OPTABLE(0x80,0x80, 1,none), /* 0x80-0xff */
132};
133
134static const struct optable optable_1[] = {
135 OPTABLE(0x00,0xff,-3,none), /* 0x0100 */
136 OPTABLE(0x40,0xf0,-3,none), /* 0x0140-0x14f */
137 OPTABLE(0x80,0xf0, 1,none), /* 0x0180-0x018f */
138 OPTABLE(0xc0,0xc0, 2,none), /* 0x01c0-0x01ff */
139};
140
141static const struct optable optable_2[] = {
142 OPTABLE(0x00,0x20, 2,none), /* 0x6a0?/0x6a8?/0x6b0?/0x6b8? */
143 OPTABLE(0x20,0x20, 3,none), /* 0x6a2?/0x6aa?/0x6b2?/0x6ba? */
144};
145
146static const struct optable optable_3[] = {
147 OPTABLE(0x69,0xfb, 2,none), /* 0x010069/0x01006d/014069/0x01406d */
148 OPTABLE(0x6b,0xff,-4,none), /* 0x01006b/0x01406b */
149 OPTABLE(0x6f,0xff, 3,none), /* 0x01006f/0x01406f */
150 OPTABLE(0x78,0xff, 5,none), /* 0x010078/0x014078 */
151};
152
153static const struct optable optable_4[] = {
154 OPTABLE(0x00,0x78, 3,none), /* 0x0100690?/0x01006d0?/0140690/0x01406d0?/0x0100698?/0x01006d8?/0140698?/0x01406d8? */
155 OPTABLE(0x20,0x78, 4,none), /* 0x0100692?/0x01006d2?/0140692/0x01406d2?/0x010069a?/0x01006da?/014069a?/0x01406da? */
156};
157
158static const struct optables_list {
159 const struct optable *ptr;
160 int size;
161} optables[] = {
162#define OPTABLES(no) \
163 { \
164 .ptr = optable_##no, \
165 .size = sizeof(optable_##no) / sizeof(struct optable), \
166 }
167 OPTABLES(0),
168 OPTABLES(1),
169 OPTABLES(2),
170 OPTABLES(3),
171 OPTABLES(4),
172
173};
174
175const unsigned char condmask[] = {
176 0x00,0x40,0x01,0x04,0x02,0x08,0x10,0x20
177};
178
179static int isbranch(struct task_struct *task,int reson)
180{
181 unsigned char cond = h8300_get_reg(task, PT_CCR);
182 /* encode complex conditions */
183 /* B4: N^V
184 B5: Z|(N^V)
185 B6: C|Z */
186 __asm__("bld #3,%w0\n\t"
187 "bxor #1,%w0\n\t"
188 "bst #4,%w0\n\t"
189 "bor #2,%w0\n\t"
190 "bst #5,%w0\n\t"
191 "bld #2,%w0\n\t"
192 "bor #0,%w0\n\t"
193 "bst #6,%w0\n\t"
194 :"=&r"(cond)::"cc");
195 cond &= condmask[reson >> 1];
196 if (!(reson & 1))
197 return cond == 0;
198 else
199 return cond != 0;
200}
201
202static unsigned short *getnextpc(struct task_struct *child, unsigned short *pc)
203{
204 const struct optable *op;
205 unsigned char *fetch_p;
206 unsigned char inst;
207 unsigned long addr;
208 unsigned long *sp;
209 int op_len,regno;
210 op = optables[0].ptr;
211 op_len = optables[0].size;
212 fetch_p = (unsigned char *)pc;
213 inst = *fetch_p++;
214 do {
215 if ((inst & op->bitmask) == op->bitpattern) {
216 if (op->length < 0) {
217 op = optables[-op->length].ptr;
218 op_len = optables[-op->length].size + 1;
219 inst = *fetch_p++;
220 } else {
221 switch (op->type) {
222 case none:
223 return pc + op->length;
224 case jabs:
225 addr = *(unsigned long *)pc;
226 return (unsigned short *)(addr & 0x00ffffff);
227 case ind:
228 addr = *pc & 0xff;
229 return (unsigned short *)(*(unsigned long *)addr);
230 case ret:
231 sp = (unsigned long *)h8300_get_reg(child, PT_USP);
232 /* user stack frames
233 | er0 | temporary saved
234 +--------+
235 | exp | exception stack frames
236 +--------+
237 | ret pc | userspace return address
238 */
239 return (unsigned short *)(*(sp+2) & 0x00ffffff);
240 case reg:
241 regno = (*pc >> 4) & 0x07;
242 if (regno == 0)
243 addr = h8300_get_reg(child, PT_ER0);
244 else
245 addr = h8300_get_reg(child, regno-1+PT_ER1);
246 return (unsigned short *)addr;
247 case relb:
248 if (inst == 0x55 || isbranch(child,inst & 0x0f))
249 pc = (unsigned short *)((unsigned long)pc +
250 ((signed char)(*fetch_p)));
251 return pc+1; /* skip myself */
252 case relw:
253 if (inst == 0x5c || isbranch(child,(*fetch_p & 0xf0) >> 4))
254 pc = (unsigned short *)((unsigned long)pc +
255 ((signed short)(*(pc+1))));
256 return pc+2; /* skip myself */
257 }
258 }
259 } else
260 op++;
261 } while(--op_len > 0);
262 return NULL;
263}
264
265/* Set breakpoint(s) to simulate a single step from the current PC. */
266
267void user_enable_single_step(struct task_struct *child)
268{
269 unsigned short *nextpc;
270 nextpc = getnextpc(child,(unsigned short *)h8300_get_reg(child, PT_PC));
271 child->thread.breakinfo.addr = nextpc;
272 child->thread.breakinfo.inst = *nextpc;
273 *nextpc = BREAKINST;
274}
275
276asmlinkage void trace_trap(unsigned long bp)
277{
278 if ((unsigned long)current->thread.breakinfo.addr == bp) {
279 user_disable_single_step(current);
280 force_sig(SIGTRAP,current);
281 } else
282 force_sig(SIGILL,current);
283}
284
diff --git a/arch/h8300/platform/h8s/Makefile b/arch/h8300/platform/h8s/Makefile
deleted file mode 100644
index bf1241883766..000000000000
--- a/arch/h8300/platform/h8s/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4# Reuse any files we can from the H8S
5#
6
7obj-y := ints_h8s.o ptrace_h8s.o
diff --git a/arch/h8300/platform/h8s/edosk2674/Makefile b/arch/h8300/platform/h8s/edosk2674/Makefile
deleted file mode 100644
index 8e349723bb4f..000000000000
--- a/arch/h8300/platform/h8s/edosk2674/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5extra-y := crt0_$(MODEL).o
diff --git a/arch/h8300/platform/h8s/edosk2674/crt0_ram.S b/arch/h8300/platform/h8s/edosk2674/crt0_ram.S
deleted file mode 100644
index 5ed191b37cde..000000000000
--- a/arch/h8300/platform/h8s/edosk2674/crt0_ram.S
+++ /dev/null
@@ -1,130 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8s/edosk2674/crt0_ram.S
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * Platform depend startup
7 * Target Archtecture: EDOSK-2674
8 * Memory Layout : RAM
9 */
10
11#define ASSEMBLY
12
13#include <asm/linkage.h>
14#include <asm/regs267x.h>
15
16#if !defined(CONFIG_BLKDEV_RESERVE)
17#if defined(CONFIG_GDB_DEBUG)
18#define RAMEND (__ramend - 0xc000)
19#else
20#define RAMEND __ramend
21#endif
22#else
23#define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS
24#endif
25
26 .global __start
27 .global __command_line
28 .global __platform_gpio_table
29 .global __target_name
30
31 .h8300s
32
33 .section .text
34 .file "crt0_ram.S"
35
36 /* CPU Reset entry */
37__start:
38 mov.l #RAMEND,sp
39 ldc #0x80,ccr
40 ldc #0x00,exr
41
42 /* Peripheral Setup */
43 bclr #4,@INTCR:8 /* interrupt mode 2 */
44 bset #5,@INTCR:8
45 bclr #0,@IER+1:16
46 bset #1,@ISCRL+1:16 /* IRQ0 Positive Edge */
47 bclr #0,@ISCRL+1:16
48
49#if defined(CONFIG_MTD_UCLINUX)
50 /* move romfs image */
51 jsr @__move_romfs
52#endif
53
54 /* .bss clear */
55 mov.l #__sbss,er5
56 mov.l er5,er6
57 mov.l #__ebss,er4
58 sub.l er5,er4
59 shlr #2,er4
60 sub.l er0,er0
611:
62 mov.l er0,@er5
63 adds #4,er5
64 dec.l #1,er4
65 bne 1b
66
67 /* copy kernel commandline */
68 mov.l #COMMAND_START,er5
69 mov.l #_command_line,er6
70 mov.w #512,r4
71 eepmov.w
72
73 /* uClinux kernel start */
74 ldc #0x90,ccr /* running kernel */
75 mov.l #_init_thread_union,sp
76 add.l #0x2000,sp
77 jsr @_start_kernel
78_exit:
79
80 jmp _exit
81
82 rts
83
84 /* I/O port assign information */
85__platform_gpio_table:
86 mov.l #gpio_table,er0
87 rts
88
89gpio_table:
90 ;; P1DDR
91 ;; used,ddr
92 .byte 0x00,0x00
93 ;; P2DDR
94 .byte 0x00,0x00
95 ;; P3DDR
96 .byte 0x3f,0x3a
97 ;; dummy
98 .byte 0x00,0x00
99 ;; P5DDR
100 .byte 0x00,0x00
101 ;; P6DDR
102 .byte 0x00,0x00
103 ;; P7DDR
104 .byte 0x00,0x00
105 ;; P8DDR
106 .byte 0x00,0x00
107 ;; dummy
108 .byte 0x00,0x00
109 ;; PADDR
110 .byte 0xff,0xff
111 ;; PBDDR
112 .byte 0xff,0x00
113 ;; PCDDR
114 .byte 0xff,0x00
115 ;; PDDDR
116 .byte 0xff,0x00
117 ;; PEDDR
118 .byte 0xff,0x00
119 ;; PFDDR
120 .byte 0xff,0xff
121 ;; PGDDR
122 .byte 0x0f,0x0f
123 ;; PHDDR
124 .byte 0x0f,0x0f
125
126__target_name:
127 .asciz "EDOSK-2674"
128
129 .section .bootvec,"ax"
130 jmp @__start
diff --git a/arch/h8300/platform/h8s/edosk2674/crt0_rom.S b/arch/h8300/platform/h8s/edosk2674/crt0_rom.S
deleted file mode 100644
index 06d1d7f324ca..000000000000
--- a/arch/h8300/platform/h8s/edosk2674/crt0_rom.S
+++ /dev/null
@@ -1,186 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8s/edosk2674/crt0_rom.S
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * Platform depend startup
7 * Target Archtecture: EDOSK-2674
8 * Memory Layout : ROM
9 */
10
11#define ASSEMBLY
12
13#include <asm/linkage.h>
14#include <asm/regs267x.h>
15
16 .global __start
17 .global __command_line
18 .global __platform_gpio_table
19 .global __target_name
20
21 .h8300s
22 .section .text
23 .file "crt0_rom.S"
24
25 /* CPU Reset entry */
26__start:
27 mov.l #__ramend,sp
28 ldc #0x80,ccr
29 ldc #0,exr
30
31 /* Peripheral Setup */
32;BSC/GPIO setup
33 mov.l #init_regs,er0
34 mov.w #0xffff,e2
351:
36 mov.w @er0+,r2
37 beq 2f
38 mov.w @er0+,r1
39 mov.b r1l,@er2
40 bra 1b
41
422:
43;SDRAM setup
44#define SDRAM_SMR 0x400040
45
46 mov.b #0,r0l
47 mov.b r0l,@DRACCR:16
48 mov.w #0x188,r0
49 mov.w r0,@REFCR:16
50 mov.w #0x85b4,r0
51 mov.w r0,@DRAMCR:16
52 mov.b #0,r1l
53 mov.b r1l,@SDRAM_SMR
54 mov.w #0x84b4,r0
55 mov.w r0,@DRAMCR:16
56;special thanks to Arizona Cooperative Power
57
58 /* copy .data */
59 mov.l #__begin_data,er5
60 mov.l #__sdata,er6
61 mov.l #__edata,er4
62 sub.l er6,er4
63 shlr.l #2,er4
641:
65 mov.l @er5+,er0
66 mov.l er0,@er6
67 adds #4,er6
68 dec.l #1,er4
69 bne 1b
70
71 /* .bss clear */
72 mov.l #__sbss,er5
73 mov.l #__ebss,er4
74 sub.l er5,er4
75 shlr.l #2,er4
76 sub.l er0,er0
771:
78 mov.l er0,@er5
79 adds #4,er5
80 dec.l #1,er4
81 bne 1b
82
83 /* copy kernel commandline */
84 mov.l #COMMAND_START,er5
85 mov.l #__command_line,er6
86 mov.w #512,r4
87 eepmov.w
88
89 /* linux kernel start */
90 ldc #0x90,ccr /* running kernel */
91 mov.l #_init_thread_union,sp
92 add.l #0x2000,sp
93 jsr @_start_kernel
94_exit:
95
96 jmp _exit
97
98 rts
99
100 /* I/O port assign information */
101__platform_gpio_table:
102 mov.l #gpio_table,er0
103 rts
104
105#define INIT_REGS_DATA(REGS,DATA) \
106 .word ((REGS) & 0xffff),DATA
107
108init_regs:
109INIT_REGS_DATA(ASTCR,0xff)
110INIT_REGS_DATA(RDNCR,0x00)
111INIT_REGS_DATA(ABWCR,0x80)
112INIT_REGS_DATA(WTCRAH,0x27)
113INIT_REGS_DATA(WTCRAL,0x77)
114INIT_REGS_DATA(WTCRBH,0x71)
115INIT_REGS_DATA(WTCRBL,0x22)
116INIT_REGS_DATA(CSACRH,0x80)
117INIT_REGS_DATA(CSACRL,0x80)
118INIT_REGS_DATA(BROMCRH,0xa0)
119INIT_REGS_DATA(BROMCRL,0xa0)
120INIT_REGS_DATA(P3DDR,0x3a)
121INIT_REGS_DATA(P3ODR,0x06)
122INIT_REGS_DATA(PADDR,0xff)
123INIT_REGS_DATA(PFDDR,0xfe)
124INIT_REGS_DATA(PGDDR,0x0f)
125INIT_REGS_DATA(PHDDR,0x0f)
126INIT_REGS_DATA(PFCR0,0xff)
127INIT_REGS_DATA(PFCR2,0x0d)
128INIT_REGS_DATA(ITSR, 0x00)
129INIT_REGS_DATA(ITSR+1,0x3f)
130INIT_REGS_DATA(INTCR,0x20)
131
132 .word 0
133
134gpio_table:
135 ;; P1DDR
136 .byte 0x00,0x00
137 ;; P2DDR
138 .byte 0x00,0x00
139 ;; P3DDR
140 .byte 0x00,0x00
141 ;; dummy
142 .byte 0x00,0x00
143 ;; P5DDR
144 .byte 0x00,0x00
145 ;; P6DDR
146 .byte 0x00,0x00
147 ;; P7DDR
148 .byte 0x00,0x00
149 ;; P8DDR
150 .byte 0x00,0x00
151 ;; dummy
152 .byte 0x00,0x00
153 ;; PADDR
154 .byte 0x00,0x00
155 ;; PBDDR
156 .byte 0x00,0x00
157 ;; PCDDR
158 .byte 0x00,0x00
159 ;; PDDDR
160 .byte 0x00,0x00
161 ;; PEDDR
162 .byte 0x00,0x00
163 ;; PFDDR
164 .byte 0x00,0x00
165 ;; PGDDR
166 .byte 0x00,0x00
167 ;; PHDDR
168 .byte 0x00,0x00
169
170 .section .rodata
171__target_name:
172 .asciz "EDOSK-2674"
173
174 .section .bss
175__command_line:
176 .space 512
177
178 /* interrupt vector */
179 .section .vectors,"ax"
180 .long __start
181 .long __start
182vector = 2
183 .rept 126
184 .long _interrupt_redirect_table+vector*4
185vector = vector + 1
186 .endr
diff --git a/arch/h8300/platform/h8s/generic/Makefile b/arch/h8300/platform/h8s/generic/Makefile
deleted file mode 100644
index 44b4685c664c..000000000000
--- a/arch/h8300/platform/h8s/generic/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5extra-y = crt0_$(MODEL).o
diff --git a/arch/h8300/platform/h8s/generic/crt0_ram.S b/arch/h8300/platform/h8s/generic/crt0_ram.S
deleted file mode 100644
index 7018915de74f..000000000000
--- a/arch/h8300/platform/h8s/generic/crt0_ram.S
+++ /dev/null
@@ -1,127 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8s/edosk2674/crt0_ram.S
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * Platform depend startup
7 * Target Archtecture: generic
8 * Memory Layout : RAM
9 */
10
11#define ASSEMBLY
12
13#include <asm/linkage.h>
14#include <asm/regs267x.h>
15
16#if !defined(CONFIG_BLKDEV_RESERVE)
17#if defined(CONFIG_GDB_DEBUG)
18#define RAMEND (__ramend - 0xc000)
19#else
20#define RAMEND __ramend
21#endif
22#else
23#define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS
24#endif
25
26 .global __start
27 .global __command_line
28 .global __platform_gpio_table
29 .global __target_name
30
31 .h8300s
32
33 .section .text
34 .file "crt0_ram.S"
35
36 /* CPU Reset entry */
37__start:
38 mov.l #RAMEND,sp
39 ldc #0x80,ccr
40 ldc #0x00,exr
41
42 /* Peripheral Setup */
43 bclr #4,@INTCR:8 /* interrupt mode 2 */
44 bset #5,@INTCR:8
45
46#if defined(CONFIG_MTD_UCLINUX)
47 /* move romfs image */
48 jsr @__move_romfs
49#endif
50
51 /* .bss clear */
52 mov.l #__sbss,er5
53 mov.l er5,er6
54 mov.l #__ebss,er4
55 sub.l er5,er4
56 shlr #2,er4
57 sub.l er0,er0
581:
59 mov.l er0,@er5
60 adds #4,er5
61 dec.l #1,er4
62 bne 1b
63
64 /* copy kernel commandline */
65 mov.l #COMMAND_START,er5
66 mov.l #_command_line,er6
67 mov.w #512,r4
68 eepmov.w
69
70 /* uClinux kernel start */
71 ldc #0x90,ccr /* running kernel */
72 mov.l #_init_thread_union,sp
73 add.l #0x2000,sp
74 jsr @_start_kernel
75_exit:
76
77 jmp _exit
78
79 rts
80
81 /* I/O port assign information */
82__platform_gpio_table:
83 mov.l #gpio_table,er0
84 rts
85
86gpio_table:
87 ;; P1DDR
88 ;; used,ddr
89 .byte 0x00,0x00
90 ;; P2DDR
91 .byte 0x00,0x00
92 ;; P3DDR
93 .byte 0x00,0x00
94 ;; dummy
95 .byte 0x00,0x00
96 ;; P5DDR
97 .byte 0x00,0x00
98 ;; P6DDR
99 .byte 0x00,0x00
100 ;; P7DDR
101 .byte 0x00,0x00
102 ;; P8DDR
103 .byte 0x00,0x00
104 ;; dummy
105 .byte 0x00,0x00
106 ;; PADDR
107 .byte 0x00,0x00
108 ;; PBDDR
109 .byte 0x00,0x00
110 ;; PCDDR
111 .byte 0x00,0x00
112 ;; PDDDR
113 .byte 0x00,0x00
114 ;; PEDDR
115 .byte 0x00,0x00
116 ;; PFDDR
117 .byte 0x00,0x00
118 ;; PGDDR
119 .byte 0x00,0x00
120 ;; PHDDR
121 .byte 0x00,0x00
122
123__target_name:
124 .asciz "generic"
125
126 .section .bootvec,"ax"
127 jmp @__start
diff --git a/arch/h8300/platform/h8s/generic/crt0_rom.S b/arch/h8300/platform/h8s/generic/crt0_rom.S
deleted file mode 100644
index 623ba7828193..000000000000
--- a/arch/h8300/platform/h8s/generic/crt0_rom.S
+++ /dev/null
@@ -1,128 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8s/generic/crt0_rom.S
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * Platform depend startup
7 * Target Archtecture: generic
8 * Memory Layout : ROM
9 */
10
11#define ASSEMBLY
12
13#include <asm/linkage.h>
14#include <asm/regs267x.h>
15
16 .global __start
17 .global __command_line
18 .global __platform_gpio_table
19 .global __target_name
20
21 .h8300s
22 .section .text
23 .file "crt0_rom.S"
24
25 /* CPU Reset entry */
26__start:
27 mov.l #__ramend,sp
28 ldc #0x80,ccr
29 ldc #0,exr
30 bclr #4,@INTCR:8
31 bset #5,@INTCR:8 /* Interrupt mode 2 */
32
33 /* Peripheral Setup */
34
35 /* copy .data */
36#if !defined(CONFIG_H8S_SIM)
37 mov.l #__begin_data,er5
38 mov.l #__sdata,er6
39 mov.l #__edata,er4
40 sub.l er6,er4
41 shlr.l #2,er4
421:
43 mov.l @er5+,er0
44 mov.l er0,@er6
45 adds #4,er6
46 dec.l #1,er4
47 bne 1b
48#endif
49
50 /* .bss clear */
51 mov.l #__sbss,er5
52 mov.l #__ebss,er4
53 sub.l er5,er4
54 shlr.l #2,er4
55 sub.l er0,er0
561:
57 mov.l er0,@er5
58 adds #4,er5
59 dec.l #1,er4
60 bne 1b
61
62 /* linux kernel start */
63 ldc #0x90,ccr /* running kernel */
64 mov.l #_init_thread_union,sp
65 add.l #0x2000,sp
66 jsr @_start_kernel
67_exit:
68
69 jmp _exit
70
71 rts
72
73 /* I/O port assign information */
74__platform_gpio_table:
75 mov.l #gpio_table,er0
76 rts
77
78gpio_table:
79 ;; P1DDR
80 .byte 0x00,0x00
81 ;; P2DDR
82 .byte 0x00,0x00
83 ;; P3DDR
84 .byte 0x00,0x00
85 ;; P4DDR
86 .byte 0x00,0x00
87 ;; P5DDR
88 .byte 0x00,0x00
89 ;; P6DDR
90 .byte 0x00,0x00
91 ;; dummy
92 .byte 0x00,0x00
93 ;; P8DDR
94 .byte 0x00,0x00
95 ;; PADDR
96 .byte 0x00,0x00
97 ;; PBDDR
98 .byte 0x00,0x00
99 ;; PCDDR
100 .byte 0x00,0x00
101 ;; PDDDR
102 .byte 0x00,0x00
103 ;; PEDDR
104 .byte 0x00,0x00
105 ;; PFDDR
106 .byte 0x00,0x00
107 ;; PGDDR
108 .byte 0x00,0x00
109 ;; PHDDR
110 .byte 0x00,0x00
111
112 .section .rodata
113__target_name:
114 .asciz "generic"
115
116 .section .bss
117__command_line:
118 .space 512
119
120 /* interrupt vector */
121 .section .vectors,"ax"
122 .long __start
123 .long __start
124vector = 2
125 .rept 126-1
126 .long _interrupt_redirect_table+vector*4
127vector = vector + 1
128 .endr
diff --git a/arch/h8300/platform/h8s/irq.c b/arch/h8300/platform/h8s/irq.c
deleted file mode 100644
index f3a5511c16b1..000000000000
--- a/arch/h8300/platform/h8s/irq.c
+++ /dev/null
@@ -1,104 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8s/ints_h8s.c
3 * Interrupt handling CPU variants
4 *
5 * Yoshinori Sato <ysato@users.sourceforge.jp>
6 *
7 */
8
9#include <linux/init.h>
10#include <linux/errno.h>
11#include <linux/kernel.h>
12
13#include <asm/ptrace.h>
14#include <asm/traps.h>
15#include <asm/irq.h>
16#include <asm/io.h>
17#include <asm/gpio-internal.h>
18#include <asm/regs267x.h>
19
20/* saved vector list */
21const int __initconst h8300_saved_vectors[] = {
22#if defined(CONFIG_GDB_DEBUG)
23 TRACE_VEC,
24 TRAP3_VEC,
25#endif
26 -1
27};
28
29/* trap entry table */
30const H8300_VECTOR __initconst h8300_trap_table[] = {
31 0,0,0,0,0,
32 trace_break, /* TRACE */
33 0,0,
34 system_call, /* TRAPA #0 */
35 0,0,0,0,0,0,0
36};
37
38/* IRQ pin assignment */
39struct irq_pins {
40 unsigned char port_no;
41 unsigned char bit_no;
42} __attribute__((aligned(1),packed));
43/* ISTR = 0 */
44static const struct irq_pins irq_assign_table0[16]={
45 {H8300_GPIO_P5,H8300_GPIO_B0},{H8300_GPIO_P5,H8300_GPIO_B1},
46 {H8300_GPIO_P5,H8300_GPIO_B2},{H8300_GPIO_P5,H8300_GPIO_B3},
47 {H8300_GPIO_P5,H8300_GPIO_B4},{H8300_GPIO_P5,H8300_GPIO_B5},
48 {H8300_GPIO_P5,H8300_GPIO_B6},{H8300_GPIO_P5,H8300_GPIO_B7},
49 {H8300_GPIO_P6,H8300_GPIO_B0},{H8300_GPIO_P6,H8300_GPIO_B1},
50 {H8300_GPIO_P6,H8300_GPIO_B2},{H8300_GPIO_P6,H8300_GPIO_B3},
51 {H8300_GPIO_P6,H8300_GPIO_B4},{H8300_GPIO_P6,H8300_GPIO_B5},
52 {H8300_GPIO_PF,H8300_GPIO_B1},{H8300_GPIO_PF,H8300_GPIO_B2},
53};
54/* ISTR = 1 */
55static const struct irq_pins irq_assign_table1[16]={
56 {H8300_GPIO_P8,H8300_GPIO_B0},{H8300_GPIO_P8,H8300_GPIO_B1},
57 {H8300_GPIO_P8,H8300_GPIO_B2},{H8300_GPIO_P8,H8300_GPIO_B3},
58 {H8300_GPIO_P8,H8300_GPIO_B4},{H8300_GPIO_P8,H8300_GPIO_B5},
59 {H8300_GPIO_PH,H8300_GPIO_B2},{H8300_GPIO_PH,H8300_GPIO_B3},
60 {H8300_GPIO_P2,H8300_GPIO_B0},{H8300_GPIO_P2,H8300_GPIO_B1},
61 {H8300_GPIO_P2,H8300_GPIO_B2},{H8300_GPIO_P2,H8300_GPIO_B3},
62 {H8300_GPIO_P2,H8300_GPIO_B4},{H8300_GPIO_P2,H8300_GPIO_B5},
63 {H8300_GPIO_P2,H8300_GPIO_B6},{H8300_GPIO_P2,H8300_GPIO_B7},
64};
65
66/* IRQ to GPIO pin translation */
67#define IRQ_GPIO_MAP(irqbit,irq,port,bit) \
68do { \
69 if (*(volatile unsigned short *)ITSR & irqbit) { \
70 port = irq_assign_table1[irq - EXT_IRQ0].port_no; \
71 bit = irq_assign_table1[irq - EXT_IRQ0].bit_no; \
72 } else { \
73 port = irq_assign_table0[irq - EXT_IRQ0].port_no; \
74 bit = irq_assign_table0[irq - EXT_IRQ0].bit_no; \
75 } \
76} while(0)
77
78int h8300_enable_irq_pin(unsigned int irq)
79{
80 if (irq >= EXT_IRQ0 && irq <= EXT_IRQ15) {
81 unsigned short ptn = 1 << (irq - EXT_IRQ0);
82 unsigned int port_no,bit_no;
83 IRQ_GPIO_MAP(ptn, irq, port_no, bit_no);
84 if (H8300_GPIO_RESERVE(port_no, bit_no) == 0)
85 return -EBUSY; /* pin already use */
86 H8300_GPIO_DDR(port_no, bit_no, H8300_GPIO_INPUT);
87 *(volatile unsigned short *)ISR &= ~ptn; /* ISR clear */
88 }
89
90 return 0;
91}
92
93void h8300_disable_irq_pin(unsigned int irq)
94{
95 if (irq >= EXT_IRQ0 && irq <= EXT_IRQ15) {
96 /* disable interrupt & release IRQ pin */
97 unsigned short ptn = 1 << (irq - EXT_IRQ0);
98 unsigned short port_no,bit_no;
99 *(volatile unsigned short *)ISR &= ~ptn;
100 *(volatile unsigned short *)IER &= ~ptn;
101 IRQ_GPIO_MAP(ptn, irq, port_no, bit_no);
102 H8300_GPIO_FREE(port_no, bit_no);
103 }
104}
diff --git a/arch/h8300/platform/h8s/ptrace_h8s.c b/arch/h8300/platform/h8s/ptrace_h8s.c
deleted file mode 100644
index c058ab1a8495..000000000000
--- a/arch/h8300/platform/h8s/ptrace_h8s.c
+++ /dev/null
@@ -1,84 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8s/ptrace_h8s.c
3 * ptrace cpu depend helper functions
4 *
5 * Yoshinori Sato <ysato@users.sourceforge.jp>
6 *
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of
9 * this archive for more details.
10 */
11
12#include <linux/linkage.h>
13#include <linux/sched.h>
14#include <linux/errno.h>
15#include <asm/ptrace.h>
16
17#define CCR_MASK 0x6f
18#define EXR_TRACE 0x80
19
20/* Mapping from PT_xxx to the stack offset at which the register is
21 saved. Notice that usp has no stack-slot and needs to be treated
22 specially (see get_reg/put_reg below). */
23static const int h8300_register_offset[] = {
24 PT_REG(er1), PT_REG(er2), PT_REG(er3), PT_REG(er4),
25 PT_REG(er5), PT_REG(er6), PT_REG(er0), PT_REG(orig_er0),
26 PT_REG(ccr), PT_REG(pc), 0, PT_REG(exr)
27};
28
29/* read register */
30long h8300_get_reg(struct task_struct *task, int regno)
31{
32 switch (regno) {
33 case PT_USP:
34 return task->thread.usp + sizeof(long)*2 + 2;
35 case PT_CCR:
36 case PT_EXR:
37 return *(unsigned short *)(task->thread.esp0 + h8300_register_offset[regno]);
38 default:
39 return *(unsigned long *)(task->thread.esp0 + h8300_register_offset[regno]);
40 }
41}
42
43/* write register */
44int h8300_put_reg(struct task_struct *task, int regno, unsigned long data)
45{
46 unsigned short oldccr;
47 switch (regno) {
48 case PT_USP:
49 task->thread.usp = data - sizeof(long)*2 - 2;
50 case PT_CCR:
51 oldccr = *(unsigned short *)(task->thread.esp0 + h8300_register_offset[regno]);
52 oldccr &= ~CCR_MASK;
53 data &= CCR_MASK;
54 data |= oldccr;
55 *(unsigned short *)(task->thread.esp0 + h8300_register_offset[regno]) = data;
56 break;
57 case PT_EXR:
58 /* exr modify not support */
59 return -EIO;
60 default:
61 *(unsigned long *)(task->thread.esp0 + h8300_register_offset[regno]) = data;
62 break;
63 }
64 return 0;
65}
66
67/* disable singlestep */
68void user_disable_single_step(struct task_struct *child)
69{
70 *(unsigned short *)(child->thread.esp0 + h8300_register_offset[PT_EXR]) &= ~EXR_TRACE;
71}
72
73/* enable singlestep */
74void user_enable_single_step(struct task_struct *child)
75{
76 *(unsigned short *)(child->thread.esp0 + h8300_register_offset[PT_EXR]) |= EXR_TRACE;
77}
78
79asmlinkage void trace_trap(unsigned long bp)
80{
81 (void)bp;
82 force_sig(SIGTRAP,current);
83}
84
diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 99041b07e610..09df2608f40a 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -4,7 +4,6 @@ comment "Linux Kernel Configuration for Hexagon"
4config HEXAGON 4config HEXAGON
5 def_bool y 5 def_bool y
6 select HAVE_OPROFILE 6 select HAVE_OPROFILE
7 select USE_GENERIC_SMP_HELPERS if SMP
8 # Other pending projects/to-do items. 7 # Other pending projects/to-do items.
9 # select HAVE_REGS_AND_STACK_ACCESS_API 8 # select HAVE_REGS_AND_STACK_ACCESS_API
10 # select HAVE_HW_BREAKPOINT if PERF_EVENTS 9 # select HAVE_HW_BREAKPOINT if PERF_EVENTS
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index 1da17caac23c..67c3450309b7 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -53,3 +53,4 @@ generic-y += types.h
53generic-y += ucontext.h 53generic-y += ucontext.h
54generic-y += unaligned.h 54generic-y += unaligned.h
55generic-y += xor.h 55generic-y += xor.h
56generic-y += preempt.h
diff --git a/arch/hexagon/include/asm/pgalloc.h b/arch/hexagon/include/asm/pgalloc.h
index 679bf6d66487..4c9d382d7798 100644
--- a/arch/hexagon/include/asm/pgalloc.h
+++ b/arch/hexagon/include/asm/pgalloc.h
@@ -65,10 +65,12 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
65 struct page *pte; 65 struct page *pte;
66 66
67 pte = alloc_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO); 67 pte = alloc_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
68 68 if (!pte)
69 if (pte) 69 return NULL;
70 pgtable_page_ctor(pte); 70 if (!pgtable_page_ctor(pte)) {
71 71 __free_page(pte);
72 return NULL;
73 }
72 return pte; 74 return pte;
73} 75}
74 76
diff --git a/arch/hexagon/kernel/setup.c b/arch/hexagon/kernel/setup.c
index 29d1f1b00016..0e7c1dbb37b2 100644
--- a/arch/hexagon/kernel/setup.c
+++ b/arch/hexagon/kernel/setup.c
@@ -32,9 +32,6 @@
32#include <asm/hexagon_vm.h> 32#include <asm/hexagon_vm.h>
33#include <asm/vm_mmu.h> 33#include <asm/vm_mmu.h>
34#include <asm/time.h> 34#include <asm/time.h>
35#ifdef CONFIG_OF
36#include <asm/prom.h>
37#endif
38 35
39char cmd_line[COMMAND_LINE_SIZE]; 36char cmd_line[COMMAND_LINE_SIZE];
40static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; 37static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index b10d61bc0f2a..4e4119b0e691 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -344,7 +344,6 @@ config FORCE_MAX_ZONEORDER
344 344
345config SMP 345config SMP
346 bool "Symmetric multi-processing support" 346 bool "Symmetric multi-processing support"
347 select USE_GENERIC_SMP_HELPERS
348 help 347 help
349 This enables support for systems with more than one CPU. If you have 348 This enables support for systems with more than one CPU. If you have
350 a system with only one CPU, say N. If you have a system with more 349 a system with only one CPU, say N. If you have a system with more
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index a3456f34f672..f93ee087e8fe 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -3,4 +3,5 @@ generic-y += clkdev.h
3generic-y += exec.h 3generic-y += exec.h
4generic-y += kvm_para.h 4generic-y += kvm_para.h
5generic-y += trace_clock.h 5generic-y += trace_clock.h
6generic-y += preempt.h
6generic-y += vtime.h \ No newline at end of file 7generic-y += vtime.h \ No newline at end of file
diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
index 74a7cc3293bc..0d2bcb37ec35 100644
--- a/arch/ia64/include/asm/io.h
+++ b/arch/ia64/include/asm/io.h
@@ -424,6 +424,7 @@ extern void __iomem * ioremap(unsigned long offset, unsigned long size);
424extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size); 424extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size);
425extern void iounmap (volatile void __iomem *addr); 425extern void iounmap (volatile void __iomem *addr);
426extern void __iomem * early_ioremap (unsigned long phys_addr, unsigned long size); 426extern void __iomem * early_ioremap (unsigned long phys_addr, unsigned long size);
427#define early_memremap(phys_addr, size) early_ioremap(phys_addr, size)
427extern void early_iounmap (volatile void __iomem *addr, unsigned long size); 428extern void early_iounmap (volatile void __iomem *addr, unsigned long size);
428static inline void __iomem * ioremap_cache (unsigned long phys_addr, unsigned long size) 429static inline void __iomem * ioremap_cache (unsigned long phys_addr, unsigned long size)
429{ 430{
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
index 989dd3fe8de1..db95f570705f 100644
--- a/arch/ia64/include/asm/kvm_host.h
+++ b/arch/ia64/include/asm/kvm_host.h
@@ -234,10 +234,6 @@ struct kvm_vm_data {
234#define KVM_REQ_PTC_G 32 234#define KVM_REQ_PTC_G 32
235#define KVM_REQ_RESUME 33 235#define KVM_REQ_RESUME 33
236 236
237#define KVM_HPAGE_GFN_SHIFT(x) 0
238#define KVM_NR_PAGE_SIZES 1
239#define KVM_PAGES_PER_HPAGE(x) 1
240
241struct kvm; 237struct kvm;
242struct kvm_vcpu; 238struct kvm_vcpu;
243 239
@@ -480,7 +476,7 @@ struct kvm_arch {
480 476
481 struct list_head assigned_dev_head; 477 struct list_head assigned_dev_head;
482 struct iommu_domain *iommu_domain; 478 struct iommu_domain *iommu_domain;
483 int iommu_flags; 479 bool iommu_noncoherent;
484 480
485 unsigned long irq_sources_bitmap; 481 unsigned long irq_sources_bitmap;
486 unsigned long irq_states[KVM_IOAPIC_NUM_PINS]; 482 unsigned long irq_states[KVM_IOAPIC_NUM_PINS];
diff --git a/arch/ia64/include/asm/pgalloc.h b/arch/ia64/include/asm/pgalloc.h
index 96a8d927db28..5767cdfc08db 100644
--- a/arch/ia64/include/asm/pgalloc.h
+++ b/arch/ia64/include/asm/pgalloc.h
@@ -91,7 +91,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr)
91 if (!pg) 91 if (!pg)
92 return NULL; 92 return NULL;
93 page = virt_to_page(pg); 93 page = virt_to_page(pg);
94 pgtable_page_ctor(page); 94 if (!pgtable_page_ctor(page)) {
95 quicklist_free(0, NULL, pg);
96 return NULL;
97 }
95 return page; 98 return page;
96} 99}
97 100
diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h
index e0a899a1a8a6..5a84b3a50741 100644
--- a/arch/ia64/include/asm/processor.h
+++ b/arch/ia64/include/asm/processor.h
@@ -319,7 +319,7 @@ struct thread_struct {
319 regs->loadrs = 0; \ 319 regs->loadrs = 0; \
320 regs->r8 = get_dumpable(current->mm); /* set "don't zap registers" flag */ \ 320 regs->r8 = get_dumpable(current->mm); /* set "don't zap registers" flag */ \
321 regs->r12 = new_sp - 16; /* allocate 16 byte scratch area */ \ 321 regs->r12 = new_sp - 16; /* allocate 16 byte scratch area */ \
322 if (unlikely(!get_dumpable(current->mm))) { \ 322 if (unlikely(get_dumpable(current->mm) != SUID_DUMP_USER)) { \
323 /* \ 323 /* \
324 * Zap scratch regs to avoid leaking bits between processes with different \ 324 * Zap scratch regs to avoid leaking bits between processes with different \
325 * uid/privileges. \ 325 * uid/privileges. \
diff --git a/arch/ia64/include/asm/xen/page-coherent.h b/arch/ia64/include/asm/xen/page-coherent.h
new file mode 100644
index 000000000000..96e42f97fa1f
--- /dev/null
+++ b/arch/ia64/include/asm/xen/page-coherent.h
@@ -0,0 +1,38 @@
1#ifndef _ASM_IA64_XEN_PAGE_COHERENT_H
2#define _ASM_IA64_XEN_PAGE_COHERENT_H
3
4#include <asm/page.h>
5#include <linux/dma-attrs.h>
6#include <linux/dma-mapping.h>
7
8static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size,
9 dma_addr_t *dma_handle, gfp_t flags,
10 struct dma_attrs *attrs)
11{
12 void *vstart = (void*)__get_free_pages(flags, get_order(size));
13 *dma_handle = virt_to_phys(vstart);
14 return vstart;
15}
16
17static inline void xen_free_coherent_pages(struct device *hwdev, size_t size,
18 void *cpu_addr, dma_addr_t dma_handle,
19 struct dma_attrs *attrs)
20{
21 free_pages((unsigned long) cpu_addr, get_order(size));
22}
23
24static inline void xen_dma_map_page(struct device *hwdev, struct page *page,
25 unsigned long offset, size_t size, enum dma_data_direction dir,
26 struct dma_attrs *attrs) { }
27
28static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle,
29 size_t size, enum dma_data_direction dir,
30 struct dma_attrs *attrs) { }
31
32static inline void xen_dma_sync_single_for_cpu(struct device *hwdev,
33 dma_addr_t handle, size_t size, enum dma_data_direction dir) { }
34
35static inline void xen_dma_sync_single_for_device(struct device *hwdev,
36 dma_addr_t handle, size_t size, enum dma_data_direction dir) { }
37
38#endif /* _ASM_IA64_XEN_PAGE_COHERENT_H */
diff --git a/arch/ia64/include/uapi/asm/socket.h b/arch/ia64/include/uapi/asm/socket.h
index 556d0701a155..c25302fb48d9 100644
--- a/arch/ia64/include/uapi/asm/socket.h
+++ b/arch/ia64/include/uapi/asm/socket.h
@@ -85,4 +85,6 @@
85 85
86#define SO_BUSY_POLL 46 86#define SO_BUSY_POLL 46
87 87
88#define SO_MAX_PACING_RATE 47
89
88#endif /* _ASM_IA64_SOCKET_H */ 90#endif /* _ASM_IA64_SOCKET_H */
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 5eb71d22c3d5..59d52e3aef12 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -882,40 +882,10 @@ __init void prefill_possible_map(void)
882 set_cpu_possible(i, true); 882 set_cpu_possible(i, true);
883} 883}
884 884
885static int _acpi_map_lsapic(acpi_handle handle, int *pcpu) 885static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
886{ 886{
887 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
888 union acpi_object *obj;
889 struct acpi_madt_local_sapic *lsapic;
890 cpumask_t tmp_map; 887 cpumask_t tmp_map;
891 int cpu, physid; 888 int cpu;
892
893 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
894 return -EINVAL;
895
896 if (!buffer.length || !buffer.pointer)
897 return -EINVAL;
898
899 obj = buffer.pointer;
900 if (obj->type != ACPI_TYPE_BUFFER)
901 {
902 kfree(buffer.pointer);
903 return -EINVAL;
904 }
905
906 lsapic = (struct acpi_madt_local_sapic *)obj->buffer.pointer;
907
908 if ((lsapic->header.type != ACPI_MADT_TYPE_LOCAL_SAPIC) ||
909 (!(lsapic->lapic_flags & ACPI_MADT_ENABLED))) {
910 kfree(buffer.pointer);
911 return -EINVAL;
912 }
913
914 physid = ((lsapic->id << 8) | (lsapic->eid));
915
916 kfree(buffer.pointer);
917 buffer.length = ACPI_ALLOCATE_BUFFER;
918 buffer.pointer = NULL;
919 889
920 cpumask_complement(&tmp_map, cpu_present_mask); 890 cpumask_complement(&tmp_map, cpu_present_mask);
921 cpu = cpumask_first(&tmp_map); 891 cpu = cpumask_first(&tmp_map);
@@ -934,9 +904,9 @@ static int _acpi_map_lsapic(acpi_handle handle, int *pcpu)
934} 904}
935 905
936/* wrapper to silence section mismatch warning */ 906/* wrapper to silence section mismatch warning */
937int __ref acpi_map_lsapic(acpi_handle handle, int *pcpu) 907int __ref acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
938{ 908{
939 return _acpi_map_lsapic(handle, pcpu); 909 return _acpi_map_lsapic(handle, physid, pcpu);
940} 910}
941EXPORT_SYMBOL(acpi_map_lsapic); 911EXPORT_SYMBOL(acpi_map_lsapic);
942 912
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 51bce594eb83..da5b462e6de6 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -44,10 +44,15 @@
44 44
45#define EFI_DEBUG 0 45#define EFI_DEBUG 0
46 46
47static __initdata unsigned long palo_phys;
48
49static __initdata efi_config_table_type_t arch_tables[] = {
50 {PROCESSOR_ABSTRACTION_LAYER_OVERWRITE_GUID, "PALO", &palo_phys},
51 {NULL_GUID, NULL, 0},
52};
53
47extern efi_status_t efi_call_phys (void *, ...); 54extern efi_status_t efi_call_phys (void *, ...);
48 55
49struct efi efi;
50EXPORT_SYMBOL(efi);
51static efi_runtime_services_t *runtime; 56static efi_runtime_services_t *runtime;
52static u64 mem_limit = ~0UL, max_addr = ~0UL, min_addr = 0UL; 57static u64 mem_limit = ~0UL, max_addr = ~0UL, min_addr = 0UL;
53 58
@@ -423,9 +428,9 @@ static u8 __init palo_checksum(u8 *buffer, u32 length)
423 * Parse and handle PALO table which is published at: 428 * Parse and handle PALO table which is published at:
424 * http://www.dig64.org/home/DIG64_PALO_R1_0.pdf 429 * http://www.dig64.org/home/DIG64_PALO_R1_0.pdf
425 */ 430 */
426static void __init handle_palo(unsigned long palo_phys) 431static void __init handle_palo(unsigned long phys_addr)
427{ 432{
428 struct palo_table *palo = __va(palo_phys); 433 struct palo_table *palo = __va(phys_addr);
429 u8 checksum; 434 u8 checksum;
430 435
431 if (strncmp(palo->signature, PALO_SIG, sizeof(PALO_SIG) - 1)) { 436 if (strncmp(palo->signature, PALO_SIG, sizeof(PALO_SIG) - 1)) {
@@ -467,12 +472,10 @@ void __init
467efi_init (void) 472efi_init (void)
468{ 473{
469 void *efi_map_start, *efi_map_end; 474 void *efi_map_start, *efi_map_end;
470 efi_config_table_t *config_tables;
471 efi_char16_t *c16; 475 efi_char16_t *c16;
472 u64 efi_desc_size; 476 u64 efi_desc_size;
473 char *cp, vendor[100] = "unknown"; 477 char *cp, vendor[100] = "unknown";
474 int i; 478 int i;
475 unsigned long palo_phys;
476 479
477 /* 480 /*
478 * It's too early to be able to use the standard kernel command line 481 * It's too early to be able to use the standard kernel command line
@@ -514,8 +517,6 @@ efi_init (void)
514 efi.systab->hdr.revision >> 16, 517 efi.systab->hdr.revision >> 16,
515 efi.systab->hdr.revision & 0xffff); 518 efi.systab->hdr.revision & 0xffff);
516 519
517 config_tables = __va(efi.systab->tables);
518
519 /* Show what we know for posterity */ 520 /* Show what we know for posterity */
520 c16 = __va(efi.systab->fw_vendor); 521 c16 = __va(efi.systab->fw_vendor);
521 if (c16) { 522 if (c16) {
@@ -528,43 +529,10 @@ efi_init (void)
528 efi.systab->hdr.revision >> 16, 529 efi.systab->hdr.revision >> 16,
529 efi.systab->hdr.revision & 0xffff, vendor); 530 efi.systab->hdr.revision & 0xffff, vendor);
530 531
531 efi.mps = EFI_INVALID_TABLE_ADDR;
532 efi.acpi = EFI_INVALID_TABLE_ADDR;
533 efi.acpi20 = EFI_INVALID_TABLE_ADDR;
534 efi.smbios = EFI_INVALID_TABLE_ADDR;
535 efi.sal_systab = EFI_INVALID_TABLE_ADDR;
536 efi.boot_info = EFI_INVALID_TABLE_ADDR;
537 efi.hcdp = EFI_INVALID_TABLE_ADDR;
538 efi.uga = EFI_INVALID_TABLE_ADDR;
539
540 palo_phys = EFI_INVALID_TABLE_ADDR; 532 palo_phys = EFI_INVALID_TABLE_ADDR;
541 533
542 for (i = 0; i < (int) efi.systab->nr_tables; i++) { 534 if (efi_config_init(arch_tables) != 0)
543 if (efi_guidcmp(config_tables[i].guid, MPS_TABLE_GUID) == 0) { 535 return;
544 efi.mps = config_tables[i].table;
545 printk(" MPS=0x%lx", config_tables[i].table);
546 } else if (efi_guidcmp(config_tables[i].guid, ACPI_20_TABLE_GUID) == 0) {
547 efi.acpi20 = config_tables[i].table;
548 printk(" ACPI 2.0=0x%lx", config_tables[i].table);
549 } else if (efi_guidcmp(config_tables[i].guid, ACPI_TABLE_GUID) == 0) {
550 efi.acpi = config_tables[i].table;
551 printk(" ACPI=0x%lx", config_tables[i].table);
552 } else if (efi_guidcmp(config_tables[i].guid, SMBIOS_TABLE_GUID) == 0) {
553 efi.smbios = config_tables[i].table;
554 printk(" SMBIOS=0x%lx", config_tables[i].table);
555 } else if (efi_guidcmp(config_tables[i].guid, SAL_SYSTEM_TABLE_GUID) == 0) {
556 efi.sal_systab = config_tables[i].table;
557 printk(" SALsystab=0x%lx", config_tables[i].table);
558 } else if (efi_guidcmp(config_tables[i].guid, HCDP_TABLE_GUID) == 0) {
559 efi.hcdp = config_tables[i].table;
560 printk(" HCDP=0x%lx", config_tables[i].table);
561 } else if (efi_guidcmp(config_tables[i].guid,
562 PROCESSOR_ABSTRACTION_LAYER_OVERWRITE_GUID) == 0) {
563 palo_phys = config_tables[i].table;
564 printk(" PALO=0x%lx", config_tables[i].table);
565 }
566 }
567 printk("\n");
568 536
569 if (palo_phys != EFI_INVALID_TABLE_ADDR) 537 if (palo_phys != EFI_INVALID_TABLE_ADDR)
570 handle_palo(palo_phys); 538 handle_palo(palo_phys);
diff --git a/arch/ia64/kernel/elfcore.c b/arch/ia64/kernel/elfcore.c
index bac1639bc320..04bc8fd5f893 100644
--- a/arch/ia64/kernel/elfcore.c
+++ b/arch/ia64/kernel/elfcore.c
@@ -11,8 +11,7 @@ Elf64_Half elf_core_extra_phdrs(void)
11 return GATE_EHDR->e_phnum; 11 return GATE_EHDR->e_phnum;
12} 12}
13 13
14int elf_core_write_extra_phdrs(struct file *file, loff_t offset, size_t *size, 14int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset)
15 unsigned long limit)
16{ 15{
17 const struct elf_phdr *const gate_phdrs = 16 const struct elf_phdr *const gate_phdrs =
18 (const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff); 17 (const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff);
@@ -35,15 +34,13 @@ int elf_core_write_extra_phdrs(struct file *file, loff_t offset, size_t *size,
35 phdr.p_offset += ofs; 34 phdr.p_offset += ofs;
36 } 35 }
37 phdr.p_paddr = 0; /* match other core phdrs */ 36 phdr.p_paddr = 0; /* match other core phdrs */
38 *size += sizeof(phdr); 37 if (!dump_emit(cprm, &phdr, sizeof(phdr)))
39 if (*size > limit || !dump_write(file, &phdr, sizeof(phdr)))
40 return 0; 38 return 0;
41 } 39 }
42 return 1; 40 return 1;
43} 41}
44 42
45int elf_core_write_extra_data(struct file *file, size_t *size, 43int elf_core_write_extra_data(struct coredump_params *cprm)
46 unsigned long limit)
47{ 44{
48 const struct elf_phdr *const gate_phdrs = 45 const struct elf_phdr *const gate_phdrs =
49 (const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff); 46 (const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff);
@@ -54,8 +51,7 @@ int elf_core_write_extra_data(struct file *file, size_t *size,
54 void *addr = (void *)gate_phdrs[i].p_vaddr; 51 void *addr = (void *)gate_phdrs[i].p_vaddr;
55 size_t memsz = PAGE_ALIGN(gate_phdrs[i].p_memsz); 52 size_t memsz = PAGE_ALIGN(gate_phdrs[i].p_memsz);
56 53
57 *size += memsz; 54 if (!dump_emit(cprm, addr, memsz))
58 if (*size > limit || !dump_write(file, addr, memsz))
59 return 0; 55 return 0;
60 break; 56 break;
61 } 57 }
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 4fc2e9569bb2..d86669bcdfb2 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -1063,6 +1063,7 @@ check_bugs (void)
1063static int __init run_dmi_scan(void) 1063static int __init run_dmi_scan(void)
1064{ 1064{
1065 dmi_scan_machine(); 1065 dmi_scan_machine();
1066 dmi_memdev_walk();
1066 dmi_set_dump_stack_arch_desc(); 1067 dmi_set_dump_stack_arch_desc();
1067 return 0; 1068 return 0;
1068} 1069}
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index 3637e03d2282..33cab9a8adff 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -105,7 +105,7 @@ restore_sigcontext (struct sigcontext __user *sc, struct sigscratch *scr)
105} 105}
106 106
107int 107int
108copy_siginfo_to_user (siginfo_t __user *to, siginfo_t *from) 108copy_siginfo_to_user (siginfo_t __user *to, const siginfo_t *from)
109{ 109{
110 if (!access_ok(VERIFY_WRITE, to, sizeof(siginfo_t))) 110 if (!access_ok(VERIFY_WRITE, to, sizeof(siginfo_t)))
111 return -EFAULT; 111 return -EFAULT;
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index bdfd8789b376..985bf80c622e 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -1550,12 +1550,13 @@ int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
1550 return VM_FAULT_SIGBUS; 1550 return VM_FAULT_SIGBUS;
1551} 1551}
1552 1552
1553void kvm_arch_free_memslot(struct kvm_memory_slot *free, 1553void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
1554 struct kvm_memory_slot *dont) 1554 struct kvm_memory_slot *dont)
1555{ 1555{
1556} 1556}
1557 1557
1558int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) 1558int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
1559 unsigned long npages)
1559{ 1560{
1560 return 0; 1561 return 0;
1561} 1562}
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index b6f7f43424ec..88504abf5704 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -357,9 +357,7 @@ int vmemmap_find_next_valid_pfn(int node, int i)
357 357
358 end_address = (unsigned long) &vmem_map[pgdat->node_start_pfn + i]; 358 end_address = (unsigned long) &vmem_map[pgdat->node_start_pfn + i];
359 end_address = PAGE_ALIGN(end_address); 359 end_address = PAGE_ALIGN(end_address);
360 360 stop_address = (unsigned long) &vmem_map[pgdat_end_pfn(pgdat)];
361 stop_address = (unsigned long) &vmem_map[
362 pgdat->node_start_pfn + pgdat->node_spanned_pages];
363 361
364 do { 362 do {
365 pgd_t *pgd; 363 pgd_t *pgd;
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 75661fbf4529..09ef94a8a7c3 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -275,7 +275,6 @@ source "kernel/Kconfig.preempt"
275 275
276config SMP 276config SMP
277 bool "Symmetric multi-processing support" 277 bool "Symmetric multi-processing support"
278 select USE_GENERIC_SMP_HELPERS
279 ---help--- 278 ---help---
280 This enables support for systems with more than one CPU. If you have 279 This enables support for systems with more than one CPU. If you have
281 a system with only one CPU, like most personal computers, say N. If 280 a system with only one CPU, like most personal computers, say N. If
diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild
index bebdc36ebb0a..2b58c5f0bc38 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -3,3 +3,4 @@ generic-y += clkdev.h
3generic-y += exec.h 3generic-y += exec.h
4generic-y += module.h 4generic-y += module.h
5generic-y += trace_clock.h 5generic-y += trace_clock.h
6generic-y += preempt.h
diff --git a/arch/m32r/include/asm/pgalloc.h b/arch/m32r/include/asm/pgalloc.h
index 0fc736198979..2d55a064ccac 100644
--- a/arch/m32r/include/asm/pgalloc.h
+++ b/arch/m32r/include/asm/pgalloc.h
@@ -43,7 +43,12 @@ static __inline__ pgtable_t pte_alloc_one(struct mm_struct *mm,
43{ 43{
44 struct page *pte = alloc_page(GFP_KERNEL|__GFP_ZERO); 44 struct page *pte = alloc_page(GFP_KERNEL|__GFP_ZERO);
45 45
46 pgtable_page_ctor(pte); 46 if (!pte)
47 return NULL;
48 if (!pgtable_page_ctor(pte)) {
49 __free_page(pte);
50 return NULL;
51 }
47 return pte; 52 return pte;
48} 53}
49 54
diff --git a/arch/m32r/include/uapi/asm/socket.h b/arch/m32r/include/uapi/asm/socket.h
index 24be7c8da86a..52966650114f 100644
--- a/arch/m32r/include/uapi/asm/socket.h
+++ b/arch/m32r/include/uapi/asm/socket.h
@@ -76,4 +76,6 @@
76 76
77#define SO_BUSY_POLL 46 77#define SO_BUSY_POLL 46
78 78
79#define SO_MAX_PACING_RATE 47
80
79#endif /* _ASM_M32R_SOCKET_H */ 81#endif /* _ASM_M32R_SOCKET_H */
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild
index 09d77a862da3..a5d27f272a59 100644
--- a/arch/m68k/include/asm/Kbuild
+++ b/arch/m68k/include/asm/Kbuild
@@ -31,3 +31,4 @@ generic-y += trace_clock.h
31generic-y += types.h 31generic-y += types.h
32generic-y += word-at-a-time.h 32generic-y += word-at-a-time.h
33generic-y += xor.h 33generic-y += xor.h
34generic-y += preempt.h
diff --git a/arch/m68k/include/asm/floppy.h b/arch/m68k/include/asm/floppy.h
index 697d50393dd0..47365b1ccbec 100644
--- a/arch/m68k/include/asm/floppy.h
+++ b/arch/m68k/include/asm/floppy.h
@@ -85,7 +85,7 @@ static int fd_request_irq(void)
85{ 85{
86 if(MACH_IS_Q40) 86 if(MACH_IS_Q40)
87 return request_irq(FLOPPY_IRQ, floppy_hardint, 87 return request_irq(FLOPPY_IRQ, floppy_hardint,
88 IRQF_DISABLED, "floppy", floppy_hardint); 88 0, "floppy", floppy_hardint);
89 else if(MACH_IS_SUN3X) 89 else if(MACH_IS_SUN3X)
90 return sun3xflop_request_irq(); 90 return sun3xflop_request_irq();
91 return -ENXIO; 91 return -ENXIO;
diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h
index 313f3dd23cdc..f9924fbcfe42 100644
--- a/arch/m68k/include/asm/mcf_pgalloc.h
+++ b/arch/m68k/include/asm/mcf_pgalloc.h
@@ -56,6 +56,10 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
56 56
57 if (!page) 57 if (!page)
58 return NULL; 58 return NULL;
59 if (!pgtable_page_ctor(page)) {
60 __free_page(page);
61 return NULL;
62 }
59 63
60 pte = kmap(page); 64 pte = kmap(page);
61 if (pte) { 65 if (pte) {
diff --git a/arch/m68k/include/asm/motorola_pgalloc.h b/arch/m68k/include/asm/motorola_pgalloc.h
index 2f02f264e694..24bcba496c75 100644
--- a/arch/m68k/include/asm/motorola_pgalloc.h
+++ b/arch/m68k/include/asm/motorola_pgalloc.h
@@ -29,18 +29,22 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
29 29
30static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) 30static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
31{ 31{
32 struct page *page = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); 32 struct page *page;
33 pte_t *pte; 33 pte_t *pte;
34 34
35 page = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
35 if(!page) 36 if(!page)
36 return NULL; 37 return NULL;
38 if (!pgtable_page_ctor(page)) {
39 __free_page(page);
40 return NULL;
41 }
37 42
38 pte = kmap(page); 43 pte = kmap(page);
39 __flush_page_to_ram(pte); 44 __flush_page_to_ram(pte);
40 flush_tlb_kernel_page(pte); 45 flush_tlb_kernel_page(pte);
41 nocache_page(pte); 46 nocache_page(pte);
42 kunmap(page); 47 kunmap(page);
43 pgtable_page_ctor(page);
44 return page; 48 return page;
45} 49}
46 50
diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h
index 48d80d5a666f..f868506e3350 100644
--- a/arch/m68k/include/asm/sun3_pgalloc.h
+++ b/arch/m68k/include/asm/sun3_pgalloc.h
@@ -59,7 +59,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
59 return NULL; 59 return NULL;
60 60
61 clear_highpage(page); 61 clear_highpage(page);
62 pgtable_page_ctor(page); 62 if (!pgtable_page_ctor(page)) {
63 __free_page(page);
64 return NULL;
65 }
63 return page; 66 return page;
64 67
65} 68}
diff --git a/arch/m68k/include/asm/sun3xflop.h b/arch/m68k/include/asm/sun3xflop.h
index 95231e2f9d64..a02ea3a7bb20 100644
--- a/arch/m68k/include/asm/sun3xflop.h
+++ b/arch/m68k/include/asm/sun3xflop.h
@@ -207,7 +207,7 @@ static int sun3xflop_request_irq(void)
207 if(!once) { 207 if(!once) {
208 once = 1; 208 once = 1;
209 error = request_irq(FLOPPY_IRQ, sun3xflop_hardint, 209 error = request_irq(FLOPPY_IRQ, sun3xflop_hardint,
210 IRQF_DISABLED, "floppy", NULL); 210 0, "floppy", NULL);
211 return ((error == 0) ? 0 : -1); 211 return ((error == 0) ? 0 : -1);
212 } else return 0; 212 } else return 0;
213} 213}
diff --git a/arch/m68k/include/asm/uaccess.h b/arch/m68k/include/asm/uaccess.h
index 639c731568b0..3fadc4a93d97 100644
--- a/arch/m68k/include/asm/uaccess.h
+++ b/arch/m68k/include/asm/uaccess.h
@@ -3,3 +3,10 @@
3#else 3#else
4#include <asm/uaccess_mm.h> 4#include <asm/uaccess_mm.h>
5#endif 5#endif
6
7#ifdef CONFIG_CPU_HAS_NO_UNALIGNED
8#include <asm-generic/uaccess-unaligned.h>
9#else
10#define __get_user_unaligned(x, ptr) __get_user((x), (ptr))
11#define __put_user_unaligned(x, ptr) __put_user((x), (ptr))
12#endif
diff --git a/arch/m68k/platform/68000/timers.c b/arch/m68k/platform/68000/timers.c
index ec30acbfe6db..99a98698bc95 100644
--- a/arch/m68k/platform/68000/timers.c
+++ b/arch/m68k/platform/68000/timers.c
@@ -70,7 +70,7 @@ static irqreturn_t hw_tick(int irq, void *dummy)
70 70
71static struct irqaction m68328_timer_irq = { 71static struct irqaction m68328_timer_irq = {
72 .name = "timer", 72 .name = "timer",
73 .flags = IRQF_DISABLED | IRQF_TIMER, 73 .flags = IRQF_TIMER,
74 .handler = hw_tick, 74 .handler = hw_tick,
75}; 75};
76 76
diff --git a/arch/m68k/platform/68360/config.c b/arch/m68k/platform/68360/config.c
index 0570741e5500..d493ac43fe3f 100644
--- a/arch/m68k/platform/68360/config.c
+++ b/arch/m68k/platform/68360/config.c
@@ -59,7 +59,7 @@ static irqreturn_t hw_tick(int irq, void *dummy)
59 59
60static struct irqaction m68360_timer_irq = { 60static struct irqaction m68360_timer_irq = {
61 .name = "timer", 61 .name = "timer",
62 .flags = IRQF_DISABLED | IRQF_TIMER, 62 .flags = IRQF_TIMER,
63 .handler = hw_tick, 63 .handler = hw_tick,
64}; 64};
65 65
diff --git a/arch/m68k/platform/coldfire/pit.c b/arch/m68k/platform/coldfire/pit.c
index e8f3b97b0f77..493b3111d4c1 100644
--- a/arch/m68k/platform/coldfire/pit.c
+++ b/arch/m68k/platform/coldfire/pit.c
@@ -118,7 +118,7 @@ static irqreturn_t pit_tick(int irq, void *dummy)
118 118
119static struct irqaction pit_irq = { 119static struct irqaction pit_irq = {
120 .name = "timer", 120 .name = "timer",
121 .flags = IRQF_DISABLED | IRQF_TIMER, 121 .flags = IRQF_TIMER,
122 .handler = pit_tick, 122 .handler = pit_tick,
123}; 123};
124 124
diff --git a/arch/m68k/platform/coldfire/sltimers.c b/arch/m68k/platform/coldfire/sltimers.c
index bb5a25ada848..831a08cf6f40 100644
--- a/arch/m68k/platform/coldfire/sltimers.c
+++ b/arch/m68k/platform/coldfire/sltimers.c
@@ -51,7 +51,7 @@ irqreturn_t mcfslt_profile_tick(int irq, void *dummy)
51 51
52static struct irqaction mcfslt_profile_irq = { 52static struct irqaction mcfslt_profile_irq = {
53 .name = "profile timer", 53 .name = "profile timer",
54 .flags = IRQF_DISABLED | IRQF_TIMER, 54 .flags = IRQF_TIMER,
55 .handler = mcfslt_profile_tick, 55 .handler = mcfslt_profile_tick,
56}; 56};
57 57
@@ -93,7 +93,7 @@ static irqreturn_t mcfslt_tick(int irq, void *dummy)
93 93
94static struct irqaction mcfslt_timer_irq = { 94static struct irqaction mcfslt_timer_irq = {
95 .name = "timer", 95 .name = "timer",
96 .flags = IRQF_DISABLED | IRQF_TIMER, 96 .flags = IRQF_TIMER,
97 .handler = mcfslt_tick, 97 .handler = mcfslt_tick,
98}; 98};
99 99
diff --git a/arch/m68k/platform/coldfire/timers.c b/arch/m68k/platform/coldfire/timers.c
index d06068e45764..cd496a20fcc7 100644
--- a/arch/m68k/platform/coldfire/timers.c
+++ b/arch/m68k/platform/coldfire/timers.c
@@ -83,7 +83,7 @@ static irqreturn_t mcftmr_tick(int irq, void *dummy)
83 83
84static struct irqaction mcftmr_timer_irq = { 84static struct irqaction mcftmr_timer_irq = {
85 .name = "timer", 85 .name = "timer",
86 .flags = IRQF_DISABLED | IRQF_TIMER, 86 .flags = IRQF_TIMER,
87 .handler = mcftmr_tick, 87 .handler = mcftmr_tick,
88}; 88};
89 89
@@ -171,7 +171,7 @@ irqreturn_t coldfire_profile_tick(int irq, void *dummy)
171 171
172static struct irqaction coldfire_profile_irq = { 172static struct irqaction coldfire_profile_irq = {
173 .name = "profile timer", 173 .name = "profile timer",
174 .flags = IRQF_DISABLED | IRQF_TIMER, 174 .flags = IRQF_TIMER,
175 .handler = coldfire_profile_tick, 175 .handler = coldfire_profile_tick,
176}; 176};
177 177
diff --git a/arch/metag/Kconfig b/arch/metag/Kconfig
index 36368eb07e13..e56abd2c1b4f 100644
--- a/arch/metag/Kconfig
+++ b/arch/metag/Kconfig
@@ -111,7 +111,6 @@ config METAG_META21
111config SMP 111config SMP
112 bool "Symmetric multi-processing support" 112 bool "Symmetric multi-processing support"
113 depends on METAG_META21 && METAG_META21_MMU 113 depends on METAG_META21 && METAG_META21_MMU
114 select USE_GENERIC_SMP_HELPERS
115 help 114 help
116 This enables support for systems with more than one thread running 115 This enables support for systems with more than one thread running
117 Linux. If you have a system with only one thread running Linux, 116 Linux. If you have a system with only one thread running Linux,
diff --git a/arch/metag/include/asm/Kbuild b/arch/metag/include/asm/Kbuild
index 6ae0ccb632cb..84d0c1d6b9b3 100644
--- a/arch/metag/include/asm/Kbuild
+++ b/arch/metag/include/asm/Kbuild
@@ -52,3 +52,4 @@ generic-y += unaligned.h
52generic-y += user.h 52generic-y += user.h
53generic-y += vga.h 53generic-y += vga.h
54generic-y += xor.h 54generic-y += xor.h
55generic-y += preempt.h
diff --git a/arch/metag/include/asm/mach/arch.h b/arch/metag/include/asm/mach/arch.h
index 12c5664fea6e..433f94624fa2 100644
--- a/arch/metag/include/asm/mach/arch.h
+++ b/arch/metag/include/asm/mach/arch.h
@@ -53,7 +53,7 @@ struct machine_desc {
53/* 53/*
54 * Current machine - only accessible during boot. 54 * Current machine - only accessible during boot.
55 */ 55 */
56extern struct machine_desc *machine_desc; 56extern const struct machine_desc *machine_desc;
57 57
58/* 58/*
59 * Machine type table - also only accessible during boot 59 * Machine type table - also only accessible during boot
diff --git a/arch/metag/include/asm/pgalloc.h b/arch/metag/include/asm/pgalloc.h
index 275d9285141c..3104df0a4822 100644
--- a/arch/metag/include/asm/pgalloc.h
+++ b/arch/metag/include/asm/pgalloc.h
@@ -52,8 +52,12 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
52{ 52{
53 struct page *pte; 53 struct page *pte;
54 pte = alloc_pages(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO, 0); 54 pte = alloc_pages(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO, 0);
55 if (pte) 55 if (!pte)
56 pgtable_page_ctor(pte); 56 return NULL;
57 if (!pgtable_page_ctor(pte)) {
58 __free_page(pte);
59 return NULL;
60 }
57 return pte; 61 return pte;
58} 62}
59 63
diff --git a/arch/metag/include/asm/prom.h b/arch/metag/include/asm/prom.h
deleted file mode 100644
index d2aa35d2228e..000000000000
--- a/arch/metag/include/asm/prom.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * arch/metag/include/asm/prom.h
3 *
4 * Copyright (C) 2012 Imagination Technologies Ltd.
5 *
6 * Based on ARM version:
7 * Copyright (C) 2009 Canonical Ltd. <jeremy.kerr@canonical.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#ifndef __ASM_METAG_PROM_H
15#define __ASM_METAG_PROM_H
16
17#include <asm/setup.h>
18#define HAVE_ARCH_DEVTREE_FIXUPS
19
20extern struct machine_desc *setup_machine_fdt(void *dt);
21extern void copy_fdt(void);
22
23#endif /* __ASM_METAG_PROM_H */
diff --git a/arch/metag/include/asm/setup.h b/arch/metag/include/asm/setup.h
index e13083b15dd0..e9fdee9452b1 100644
--- a/arch/metag/include/asm/setup.h
+++ b/arch/metag/include/asm/setup.h
@@ -3,6 +3,7 @@
3 3
4#include <uapi/asm/setup.h> 4#include <uapi/asm/setup.h>
5 5
6extern const struct machine_desc *setup_machine_fdt(void *dt);
6void per_cpu_trap_init(unsigned long); 7void per_cpu_trap_init(unsigned long);
7extern void __init dump_machine_table(void); 8extern void __init dump_machine_table(void);
8#endif /* _ASM_METAG_SETUP_H */ 9#endif /* _ASM_METAG_SETUP_H */
diff --git a/arch/metag/include/asm/tbx.h b/arch/metag/include/asm/tbx.h
index 287b36ff8ad1..703b9cb0ac5c 100644
--- a/arch/metag/include/asm/tbx.h
+++ b/arch/metag/include/asm/tbx.h
@@ -150,11 +150,9 @@
150#else 150#else
151/* Reserved 0x04-0x09 */ 151/* Reserved 0x04-0x09 */
152#endif 152#endif
153#define TBID_SIGNUM_SWS 0x0A /* KICK received with SigMask != 0 */ 153/* Reserved 0x0A-0x0F */
154#define TBID_SIGNUM_SWK 0x0B /* KICK received with SigMask == 0 */
155/* Reserved 0x0C-0x0F */
156#define TBID_SIGNUM_TRT 0x10 /* Timer trigger */ 154#define TBID_SIGNUM_TRT 0x10 /* Timer trigger */
157#define TBID_SIGNUM_LWK 0x11 /* Low level kick (handler provided by TBI) */ 155#define TBID_SIGNUM_LWK 0x11 /* Low level kick */
158#define TBID_SIGNUM_XXF 0x12 /* Fault handler - receives ALL _xxF sigs */ 156#define TBID_SIGNUM_XXF 0x12 /* Fault handler - receives ALL _xxF sigs */
159#ifdef TBI_1_4 157#ifdef TBI_1_4
160#define TBID_SIGNUM_DFR 0x13 /* Deferred Exception handler */ 158#define TBID_SIGNUM_DFR 0x13 /* Deferred Exception handler */
@@ -183,8 +181,7 @@
183 each hardware signal, sometimes this is a many-to-one relationship. */ 181 each hardware signal, sometimes this is a many-to-one relationship. */
184#define TBI_TRIG_BIT(SigNum) (\ 182#define TBI_TRIG_BIT(SigNum) (\
185 ((SigNum) >= TBID_SIGNUM_TRT) ? 1<<((SigNum)-TBID_SIGNUM_TRT) :\ 183 ((SigNum) >= TBID_SIGNUM_TRT) ? 1<<((SigNum)-TBID_SIGNUM_TRT) :\
186 ( ((SigNum) == TBID_SIGNUM_SWS) || \ 184 ((SigNum) == TBID_SIGNUM_LWK) ? \
187 ((SigNum) == TBID_SIGNUM_SWK) ) ? \
188 TXSTAT_KICK_BIT : TXSTATI_BGNDHALT_BIT ) 185 TXSTAT_KICK_BIT : TXSTATI_BGNDHALT_BIT )
189 186
190/* Return the hardware trigger vector number for entries in the 187/* Return the hardware trigger vector number for entries in the
@@ -687,10 +684,8 @@ typedef union _tbires_tag_ {
687 Triggers will indicate the status of TXSTAT or TXSTATI sampled by the 684 Triggers will indicate the status of TXSTAT or TXSTATI sampled by the
688 code that called the handler. 685 code that called the handler.
689 686
690 InstOrSWSId is defined firstly as 'Inst' if the SigNum is TBID_SIGNUM_SWx 687 Inst is defined as 'Inst' if the SigNum is TBID_SIGNUM_SWx and holds the
691 and hold the actual SWITCH instruction detected, secondly if SigNum 688 actual SWITCH instruction detected, in other cases the value of this
692 is TBID_SIGNUM_SWS the 'SWSId' is defined to hold the Id of the
693 software signal detected, in other cases the value of this
694 parameter is undefined. 689 parameter is undefined.
695 690
696 pTBI points at the PTBI structure related to the thread and processing 691 pTBI points at the PTBI structure related to the thread and processing
@@ -709,7 +704,7 @@ typedef union _tbires_tag_ {
709 704
710 */ 705 */
711typedef TBIRES (*PTBIAPIFN)( TBIRES State, int SigNum, 706typedef TBIRES (*PTBIAPIFN)( TBIRES State, int SigNum,
712 int Triggers, int InstOrSWSId, 707 int Triggers, int Inst,
713 volatile struct _tbi_tag_ *pTBI ); 708 volatile struct _tbi_tag_ *pTBI );
714#endif /* ifndef __ASSEMBLY__ */ 709#endif /* ifndef __ASSEMBLY__ */
715 710
@@ -757,7 +752,7 @@ typedef volatile struct _tbi_tag_ {
757#ifndef __ASSEMBLY__ 752#ifndef __ASSEMBLY__
758/* This handler should be used for TBID_SIGNUM_DFR */ 753/* This handler should be used for TBID_SIGNUM_DFR */
759extern TBIRES __TBIHandleDFR ( TBIRES State, int SigNum, 754extern TBIRES __TBIHandleDFR ( TBIRES State, int SigNum,
760 int Triggers, int InstOrSWSId, 755 int Triggers, int Inst,
761 volatile struct _tbi_tag_ *pTBI ); 756 volatile struct _tbi_tag_ *pTBI );
762#endif 757#endif
763#endif 758#endif
diff --git a/arch/metag/include/asm/topology.h b/arch/metag/include/asm/topology.h
index 23f5118f58db..8e9c0b3b9691 100644
--- a/arch/metag/include/asm/topology.h
+++ b/arch/metag/include/asm/topology.h
@@ -26,6 +26,8 @@
26 .last_balance = jiffies, \ 26 .last_balance = jiffies, \
27 .balance_interval = 1, \ 27 .balance_interval = 1, \
28 .nr_balance_failed = 0, \ 28 .nr_balance_failed = 0, \
29 .max_newidle_lb_cost = 0, \
30 .next_decay_max_lb_cost = jiffies, \
29} 31}
30 32
31#define cpu_to_node(cpu) ((void)(cpu), 0) 33#define cpu_to_node(cpu) ((void)(cpu), 0)
diff --git a/arch/metag/kernel/devtree.c b/arch/metag/kernel/devtree.c
index 7cd02529636e..18dd7aea9fdc 100644
--- a/arch/metag/kernel/devtree.c
+++ b/arch/metag/kernel/devtree.c
@@ -34,6 +34,19 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
34 return alloc_bootmem_align(size, align); 34 return alloc_bootmem_align(size, align);
35} 35}
36 36
37static const void * __init arch_get_next_mach(const char *const **match)
38{
39 static const struct machine_desc *mdesc = __arch_info_begin;
40 const struct machine_desc *m = mdesc;
41
42 if (m >= __arch_info_end)
43 return NULL;
44
45 mdesc++;
46 *match = m->dt_compat;
47 return m;
48}
49
37/** 50/**
38 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel 51 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
39 * @dt: virtual address pointer to dt blob 52 * @dt: virtual address pointer to dt blob
@@ -41,74 +54,18 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
41 * If a dtb was passed to the kernel, then use it to choose the correct 54 * If a dtb was passed to the kernel, then use it to choose the correct
42 * machine_desc and to setup the system. 55 * machine_desc and to setup the system.
43 */ 56 */
44struct machine_desc * __init setup_machine_fdt(void *dt) 57const struct machine_desc * __init setup_machine_fdt(void *dt)
45{ 58{
46 struct boot_param_header *devtree = dt; 59 const struct machine_desc *mdesc;
47 struct machine_desc *mdesc, *mdesc_best = NULL;
48 unsigned int score, mdesc_score = ~1;
49 unsigned long dt_root;
50 const char *model;
51 60
52 /* check device tree validity */ 61 /* check device tree validity */
53 if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) 62 if (!early_init_dt_scan(dt))
54 return NULL; 63 return NULL;
55 64
56 /* Search the mdescs for the 'best' compatible value match */ 65 mdesc = of_flat_dt_match_machine(NULL, arch_get_next_mach);
57 initial_boot_params = devtree; 66 if (!mdesc)
58 dt_root = of_get_flat_dt_root();
59
60 for_each_machine_desc(mdesc) {
61 score = of_flat_dt_match(dt_root, mdesc->dt_compat);
62 if (score > 0 && score < mdesc_score) {
63 mdesc_best = mdesc;
64 mdesc_score = score;
65 }
66 }
67 if (!mdesc_best) {
68 const char *prop;
69 long size;
70
71 pr_err("\nError: unrecognized/unsupported device tree compatible list:\n[ ");
72
73 prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
74 if (prop) {
75 while (size > 0) {
76 printk("'%s' ", prop);
77 size -= strlen(prop) + 1;
78 prop += strlen(prop) + 1;
79 }
80 }
81 printk("]\n\n");
82
83 dump_machine_table(); /* does not return */ 67 dump_machine_table(); /* does not return */
84 } 68 pr_info("Machine name: %s\n", mdesc->name);
85
86 model = of_get_flat_dt_prop(dt_root, "model", NULL);
87 if (!model)
88 model = of_get_flat_dt_prop(dt_root, "compatible", NULL);
89 if (!model)
90 model = "<unknown>";
91 pr_info("Machine: %s, model: %s\n", mdesc_best->name, model);
92
93 /* Retrieve various information from the /chosen node */
94 of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
95
96 return mdesc_best;
97}
98 69
99/** 70 return mdesc;
100 * copy_fdt - Copy device tree into non-init memory.
101 *
102 * We must copy the flattened device tree blob into non-init memory because the
103 * unflattened device tree will reference the strings in it directly.
104 */
105void __init copy_fdt(void)
106{
107 void *alloc = early_init_dt_alloc_memory_arch(
108 be32_to_cpu(initial_boot_params->totalsize), 0x40);
109 if (alloc) {
110 memcpy(alloc, initial_boot_params,
111 be32_to_cpu(initial_boot_params->totalsize));
112 initial_boot_params = alloc;
113 }
114} 71}
diff --git a/arch/metag/kernel/dma.c b/arch/metag/kernel/dma.c
index 8c00dedadc54..db589ad5dbc4 100644
--- a/arch/metag/kernel/dma.c
+++ b/arch/metag/kernel/dma.c
@@ -305,9 +305,7 @@ void dma_free_coherent(struct device *dev, size_t size,
305 305
306 if (pfn_valid(pfn)) { 306 if (pfn_valid(pfn)) {
307 struct page *page = pfn_to_page(pfn); 307 struct page *page = pfn_to_page(pfn);
308 ClearPageReserved(page); 308 __free_reserved_page(page);
309
310 __free_page(page);
311 continue; 309 continue;
312 } 310 }
313 } 311 }
diff --git a/arch/metag/kernel/irq.c b/arch/metag/kernel/irq.c
index 2a2c9d55187e..3b4b7f6c0950 100644
--- a/arch/metag/kernel/irq.c
+++ b/arch/metag/kernel/irq.c
@@ -159,44 +159,30 @@ void irq_ctx_exit(int cpu)
159 159
160extern asmlinkage void __do_softirq(void); 160extern asmlinkage void __do_softirq(void);
161 161
162asmlinkage void do_softirq(void) 162void do_softirq_own_stack(void)
163{ 163{
164 unsigned long flags;
165 struct thread_info *curctx; 164 struct thread_info *curctx;
166 union irq_ctx *irqctx; 165 union irq_ctx *irqctx;
167 u32 *isp; 166 u32 *isp;
168 167
169 if (in_interrupt()) 168 curctx = current_thread_info();
170 return; 169 irqctx = softirq_ctx[smp_processor_id()];
171 170 irqctx->tinfo.task = curctx->task;
172 local_irq_save(flags); 171
173 172 /* build the stack frame on the softirq stack */
174 if (local_softirq_pending()) { 173 isp = (u32 *) ((char *)irqctx + sizeof(struct thread_info));
175 curctx = current_thread_info(); 174
176 irqctx = softirq_ctx[smp_processor_id()]; 175 asm volatile (
177 irqctx->tinfo.task = curctx->task; 176 "MOV D0.5,%0\n"
178 177 "SWAP A0StP,D0.5\n"
179 /* build the stack frame on the softirq stack */ 178 "CALLR D1RtP,___do_softirq\n"
180 isp = (u32 *) ((char *)irqctx + sizeof(struct thread_info)); 179 "MOV A0StP,D0.5\n"
181 180 :
182 asm volatile ( 181 : "r" (isp)
183 "MOV D0.5,%0\n" 182 : "memory", "cc", "D1Ar1", "D0Ar2", "D1Ar3", "D0Ar4",
184 "SWAP A0StP,D0.5\n" 183 "D1Ar5", "D0Ar6", "D0Re0", "D1Re0", "D0.4", "D1RtP",
185 "CALLR D1RtP,___do_softirq\n" 184 "D0.5"
186 "MOV A0StP,D0.5\n" 185 );
187 :
188 : "r" (isp)
189 : "memory", "cc", "D1Ar1", "D0Ar2", "D1Ar3", "D0Ar4",
190 "D1Ar5", "D0Ar6", "D0Re0", "D1Re0", "D0.4", "D1RtP",
191 "D0.5"
192 );
193 /*
194 * Shouldn't happen, we returned above if in_interrupt():
195 */
196 WARN_ON_ONCE(softirq_count());
197 }
198
199 local_irq_restore(flags);
200} 186}
201#endif 187#endif
202 188
diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c
index c396cd0b425f..129c7cdda1ce 100644
--- a/arch/metag/kernel/setup.c
+++ b/arch/metag/kernel/setup.c
@@ -42,7 +42,6 @@
42#include <asm/mmu.h> 42#include <asm/mmu.h>
43#include <asm/mmzone.h> 43#include <asm/mmzone.h>
44#include <asm/processor.h> 44#include <asm/processor.h>
45#include <asm/prom.h>
46#include <asm/sections.h> 45#include <asm/sections.h>
47#include <asm/setup.h> 46#include <asm/setup.h>
48#include <asm/traps.h> 47#include <asm/traps.h>
@@ -115,7 +114,7 @@ extern u32 __dtb_start[];
115extern struct console dash_console; 114extern struct console dash_console;
116#endif 115#endif
117 116
118struct machine_desc *machine_desc __initdata; 117const struct machine_desc *machine_desc __initdata;
119 118
120/* 119/*
121 * Map a Linux CPU number to a hardware thread ID 120 * Map a Linux CPU number to a hardware thread ID
@@ -302,13 +301,9 @@ void __init setup_arch(char **cmdline_p)
302 * rather than the version from the bootloader. This makes call 301 * rather than the version from the bootloader. This makes call
303 * stacks easier to understand and may allow us to unmap the 302 * stacks easier to understand and may allow us to unmap the
304 * bootloader at some point. 303 * bootloader at some point.
305 *
306 * We need to keep the LWK handler that TBI installed in order to
307 * be able to do inter-thread comms.
308 */ 304 */
309 for (i = 0; i <= TBID_SIGNUM_MAX; i++) 305 for (i = 0; i <= TBID_SIGNUM_MAX; i++)
310 if (i != TBID_SIGNUM_LWK) 306 _pTBI->fnSigs[i] = __TBIUnExpXXX;
311 _pTBI->fnSigs[i] = __TBIUnExpXXX;
312 307
313 /* A Meta requirement is that the kernel is loaded (virtually) 308 /* A Meta requirement is that the kernel is loaded (virtually)
314 * at the PAGE_OFFSET. 309 * at the PAGE_OFFSET.
@@ -408,9 +403,7 @@ void __init setup_arch(char **cmdline_p)
408 cpu_2_hwthread_id[smp_processor_id()] = hard_processor_id(); 403 cpu_2_hwthread_id[smp_processor_id()] = hard_processor_id();
409 hwthread_id_2_cpu[hard_processor_id()] = smp_processor_id(); 404 hwthread_id_2_cpu[hard_processor_id()] = smp_processor_id();
410 405
411 /* Copy device tree blob into non-init memory before unflattening */ 406 unflatten_and_copy_device_tree();
412 copy_fdt();
413 unflatten_device_tree();
414 407
415#ifdef CONFIG_SMP 408#ifdef CONFIG_SMP
416 smp_init_cpus(); 409 smp_init_cpus();
diff --git a/arch/metag/kernel/traps.c b/arch/metag/kernel/traps.c
index 25f9d1c2ffec..17b2e2e38d5a 100644
--- a/arch/metag/kernel/traps.c
+++ b/arch/metag/kernel/traps.c
@@ -819,8 +819,7 @@ void per_cpu_trap_init(unsigned long cpu)
819 819
820 set_trigger_mask(TBI_INTS_INIT(thread) | /* interrupts */ 820 set_trigger_mask(TBI_INTS_INIT(thread) | /* interrupts */
821 TBI_TRIG_BIT(TBID_SIGNUM_LWK) | /* low level kick */ 821 TBI_TRIG_BIT(TBID_SIGNUM_LWK) | /* low level kick */
822 TBI_TRIG_BIT(TBID_SIGNUM_SW1) | 822 TBI_TRIG_BIT(TBID_SIGNUM_SW1));
823 TBI_TRIG_BIT(TBID_SIGNUM_SWS));
824 823
825 /* non-priv - use current stack */ 824 /* non-priv - use current stack */
826 int_context.Sig.pCtx = NULL; 825 int_context.Sig.pCtx = NULL;
@@ -842,7 +841,7 @@ void __init trap_init(void)
842 _pTBI->fnSigs[TBID_SIGNUM_SW1] = switch1_handler; 841 _pTBI->fnSigs[TBID_SIGNUM_SW1] = switch1_handler;
843 _pTBI->fnSigs[TBID_SIGNUM_SW2] = switchx_handler; 842 _pTBI->fnSigs[TBID_SIGNUM_SW2] = switchx_handler;
844 _pTBI->fnSigs[TBID_SIGNUM_SW3] = switchx_handler; 843 _pTBI->fnSigs[TBID_SIGNUM_SW3] = switchx_handler;
845 _pTBI->fnSigs[TBID_SIGNUM_SWK] = kick_handler; 844 _pTBI->fnSigs[TBID_SIGNUM_LWK] = kick_handler;
846 845
847#ifdef CONFIG_METAG_META21 846#ifdef CONFIG_METAG_META21
848 _pTBI->fnSigs[TBID_SIGNUM_DFR] = __TBIHandleDFR; 847 _pTBI->fnSigs[TBID_SIGNUM_DFR] = __TBIHandleDFR;
diff --git a/arch/metag/mm/init.c b/arch/metag/mm/init.c
index 123919534b80..3cd6288f65c2 100644
--- a/arch/metag/mm/init.c
+++ b/arch/metag/mm/init.c
@@ -12,7 +12,6 @@
12#include <linux/percpu.h> 12#include <linux/percpu.h>
13#include <linux/memblock.h> 13#include <linux/memblock.h>
14#include <linux/initrd.h> 14#include <linux/initrd.h>
15#include <linux/of_fdt.h>
16 15
17#include <asm/setup.h> 16#include <asm/setup.h>
18#include <asm/page.h> 17#include <asm/page.h>
@@ -149,7 +148,7 @@ static void __init bootmem_init_one_node(unsigned int nid)
149 if (!p->node_spanned_pages) 148 if (!p->node_spanned_pages)
150 return; 149 return;
151 150
152 end_pfn = p->node_start_pfn + p->node_spanned_pages; 151 end_pfn = pgdat_end_pfn(p);
153#ifdef CONFIG_HIGHMEM 152#ifdef CONFIG_HIGHMEM
154 if (end_pfn > max_low_pfn) 153 if (end_pfn > max_low_pfn)
155 end_pfn = max_low_pfn; 154 end_pfn = max_low_pfn;
@@ -405,11 +404,3 @@ void free_initrd_mem(unsigned long start, unsigned long end)
405 "initrd"); 404 "initrd");
406} 405}
407#endif 406#endif
408
409#ifdef CONFIG_OF_FLATTREE
410void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
411{
412 pr_err("%s(%llx, %llx)\n",
413 __func__, start, end);
414}
415#endif /* CONFIG_OF_FLATTREE */
diff --git a/arch/metag/mm/numa.c b/arch/metag/mm/numa.c
index 9ae578c9b620..b172aa45fcf8 100644
--- a/arch/metag/mm/numa.c
+++ b/arch/metag/mm/numa.c
@@ -34,7 +34,7 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
34 unsigned long pgdat_paddr; 34 unsigned long pgdat_paddr;
35 35
36 /* Don't allow bogus node assignment */ 36 /* Don't allow bogus node assignment */
37 BUG_ON(nid > MAX_NUMNODES || nid <= 0); 37 BUG_ON(nid >= MAX_NUMNODES || nid <= 0);
38 38
39 start_pfn = start >> PAGE_SHIFT; 39 start_pfn = start >> PAGE_SHIFT;
40 end_pfn = end >> PAGE_SHIFT; 40 end_pfn = end >> PAGE_SHIFT;
diff --git a/arch/metag/tbx/tbidefr.S b/arch/metag/tbx/tbidefr.S
index 3eb165ebf540..8f0902b22f70 100644
--- a/arch/metag/tbx/tbidefr.S
+++ b/arch/metag/tbx/tbidefr.S
@@ -20,7 +20,7 @@
20/* D1Ar1:D0Ar2 -- State 20/* D1Ar1:D0Ar2 -- State
21 * D0Ar3 -- SigNum 21 * D0Ar3 -- SigNum
22 * D0Ar4 -- Triggers 22 * D0Ar4 -- Triggers
23 * D1Ar5 -- InstOrSWSId 23 * D1Ar5 -- Inst
24 * D0Ar6 -- pTBI (volatile) 24 * D0Ar6 -- pTBI (volatile)
25 */ 25 */
26___TBIHandleDFR: 26___TBIHandleDFR:
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 8370114e78aa..e23cccde9c27 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -83,11 +83,6 @@ config MMU
83 bool "MMU support" 83 bool "MMU support"
84 default n 84 default n
85 85
86config NO_MMU
87 bool
88 depends on !MMU
89 default y
90
91comment "Boot options" 86comment "Boot options"
92 87
93config CMDLINE_BOOL 88config CMDLINE_BOOL
@@ -251,10 +246,6 @@ config MICROBLAZE_64K_PAGES
251 246
252endchoice 247endchoice
253 248
254config KERNEL_PAD
255 hex "Kernel PAD for unpacking" if ADVANCED_OPTIONS
256 default "0x80000" if MMU
257
258endmenu 249endmenu
259 250
260source "mm/Kconfig" 251source "mm/Kconfig"
diff --git a/arch/microblaze/boot/dts/Makefile b/arch/microblaze/boot/dts/Makefile
index c3b3a5d67b89..c4982d16e555 100644
--- a/arch/microblaze/boot/dts/Makefile
+++ b/arch/microblaze/boot/dts/Makefile
@@ -1,6 +1,4 @@
1# 1#
2# arch/microblaze/boot/Makefile
3#
4 2
5obj-y += linked_dtb.o 3obj-y += linked_dtb.o
6 4
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index d3c51a6a601d..ce0bbf8f5640 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -3,3 +3,4 @@ generic-y += clkdev.h
3generic-y += exec.h 3generic-y += exec.h
4generic-y += trace_clock.h 4generic-y += trace_clock.h
5generic-y += syscalls.h 5generic-y += syscalls.h
6generic-y += preempt.h
diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h
index d52abb6812fa..935f9bec414a 100644
--- a/arch/microblaze/include/asm/pci.h
+++ b/arch/microblaze/include/asm/pci.h
@@ -127,8 +127,6 @@ extern void of_scan_pci_bridge(struct device_node *node,
127extern void of_scan_bus(struct device_node *node, struct pci_bus *bus); 127extern void of_scan_bus(struct device_node *node, struct pci_bus *bus);
128extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus); 128extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus);
129 129
130extern int pci_read_irq_line(struct pci_dev *dev);
131
132extern int pci_bus_find_capability(struct pci_bus *bus, 130extern int pci_bus_find_capability(struct pci_bus *bus,
133 unsigned int devfn, int cap); 131 unsigned int devfn, int cap);
134 132
diff --git a/arch/microblaze/include/asm/pgalloc.h b/arch/microblaze/include/asm/pgalloc.h
index ebd35792482c..7fdf7fabc7d7 100644
--- a/arch/microblaze/include/asm/pgalloc.h
+++ b/arch/microblaze/include/asm/pgalloc.h
@@ -122,8 +122,13 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
122#endif 122#endif
123 123
124 ptepage = alloc_pages(flags, 0); 124 ptepage = alloc_pages(flags, 0);
125 if (ptepage) 125 if (!ptepage)
126 clear_highpage(ptepage); 126 return NULL;
127 clear_highpage(ptepage);
128 if (!pgtable_page_ctor(ptepage)) {
129 __free_page(ptepage);
130 return NULL;
131 }
127 return ptepage; 132 return ptepage;
128} 133}
129 134
@@ -158,8 +163,9 @@ extern inline void pte_free_slow(struct page *ptepage)
158 __free_page(ptepage); 163 __free_page(ptepage);
159} 164}
160 165
161extern inline void pte_free(struct mm_struct *mm, struct page *ptepage) 166static inline void pte_free(struct mm_struct *mm, struct page *ptepage)
162{ 167{
168 pgtable_page_dtor(ptepage);
163 __free_page(ptepage); 169 __free_page(ptepage);
164} 170}
165 171
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index 9977816c5ad3..2f03ac815851 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -11,19 +11,10 @@
11 * as published by the Free Software Foundation; either version 11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 */ 13 */
14
15#include <linux/of.h> /* linux/of.h gets to determine #include ordering */
16
17#ifndef _ASM_MICROBLAZE_PROM_H 14#ifndef _ASM_MICROBLAZE_PROM_H
18#define _ASM_MICROBLAZE_PROM_H 15#define _ASM_MICROBLAZE_PROM_H
19#ifdef __KERNEL__
20#ifndef __ASSEMBLY__
21
22#include <linux/types.h>
23#include <asm/irq.h>
24#include <linux/atomic.h>
25 16
26#define HAVE_ARCH_DEVTREE_FIXUPS 17#include <linux/of.h>
27 18
28/* Other Prototypes */ 19/* Other Prototypes */
29enum early_consoles { 20enum early_consoles {
@@ -33,32 +24,4 @@ enum early_consoles {
33 24
34extern int of_early_console(void *version); 25extern int of_early_console(void *version);
35 26
36/*
37 * OF address retreival & translation
38 */
39
40#ifdef CONFIG_PCI
41extern unsigned long pci_address_to_pio(phys_addr_t address);
42#define pci_address_to_pio pci_address_to_pio
43#endif /* CONFIG_PCI */
44
45/* Parse the ibm,dma-window property of an OF node into the busno, phys and
46 * size parameters.
47 */
48void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
49 unsigned long *busno, unsigned long *phys, unsigned long *size);
50
51extern void kdump_move_device_tree(void);
52
53#endif /* __ASSEMBLY__ */
54#endif /* __KERNEL__ */
55
56/* These includes are put at the bottom because they may contain things
57 * that are overridden by this file. Ideally they shouldn't be included
58 * by this file, but there are a bunch of .c files that currently depend
59 * on it. Eventually they will be cleaned up. */
60#include <linux/of_fdt.h>
61#include <linux/of_irq.h>
62#include <linux/platform_device.h>
63
64#endif /* _ASM_MICROBLAZE_PROM_H */ 27#endif /* _ASM_MICROBLAZE_PROM_H */
diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S
index fcc797feb9db..817b7eec95b6 100644
--- a/arch/microblaze/kernel/head.S
+++ b/arch/microblaze/kernel/head.S
@@ -176,7 +176,7 @@ _invalidate:
176 /* start to do TLB calculation */ 176 /* start to do TLB calculation */
177 addik r12, r0, _end 177 addik r12, r0, _end
178 rsub r12, r3, r12 178 rsub r12, r3, r12
179 addik r12, r12, CONFIG_KERNEL_PAD /* that's the pad */ 179 addik r12, r12, CONFIG_LOWMEM_SIZE >> PTE_SHIFT /* that's the pad */
180 180
181 or r9, r0, r0 /* TLB0 = 0 */ 181 or r9, r0, r0 /* TLB0 = 0 */
182 or r10, r0, r0 /* TLB1 = 0 */ 182 or r10, r0, r0 /* TLB1 = 0 */
diff --git a/arch/microblaze/kernel/hw_exception_handler.S b/arch/microblaze/kernel/hw_exception_handler.S
index 61b3a1fed46f..fc6b89f4dd31 100644
--- a/arch/microblaze/kernel/hw_exception_handler.S
+++ b/arch/microblaze/kernel/hw_exception_handler.S
@@ -193,8 +193,8 @@
193 * - W S REG EXC 193 * - W S REG EXC
194 * 194 *
195 * 195 *
196 * STACK FRAME STRUCTURE (for NO_MMU) 196 * STACK FRAME STRUCTURE (for CONFIG_MMU=n)
197 * --------------------------------- 197 * ----------------------------------------
198 * 198 *
199 * +-------------+ + 0 199 * +-------------+ + 0
200 * | MSR | 200 * | MSR |
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 0c4453f134cb..abdfb10e7eca 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -30,6 +30,7 @@
30#include <linux/debugfs.h> 30#include <linux/debugfs.h>
31#include <linux/irq.h> 31#include <linux/irq.h>
32#include <linux/memblock.h> 32#include <linux/memblock.h>
33#include <linux/of_fdt.h>
33 34
34#include <asm/prom.h> 35#include <asm/prom.h>
35#include <asm/page.h> 36#include <asm/page.h>
@@ -41,11 +42,6 @@
41#include <asm/sections.h> 42#include <asm/sections.h>
42#include <asm/pci-bridge.h> 43#include <asm/pci-bridge.h>
43 44
44void __init early_init_dt_add_memory_arch(u64 base, u64 size)
45{
46 memblock_add(base, size);
47}
48
49#ifdef CONFIG_EARLY_PRINTK 45#ifdef CONFIG_EARLY_PRINTK
50static char *stdout; 46static char *stdout;
51 47
@@ -106,21 +102,10 @@ void __init early_init_devtree(void *params)
106{ 102{
107 pr_debug(" -> early_init_devtree(%p)\n", params); 103 pr_debug(" -> early_init_devtree(%p)\n", params);
108 104
109 /* Setup flat device-tree pointer */ 105 early_init_dt_scan(params);
110 initial_boot_params = params; 106 if (!strlen(boot_command_line))
111 107 strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
112 /* Retrieve various informations from the /chosen node of the
113 * device-tree, including the platform type, initrd location and
114 * size, TCE reserve, and more ...
115 */
116 of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line);
117
118 /* Scan memory nodes and rebuild MEMBLOCKs */
119 of_scan_flat_dt(early_init_dt_scan_root, NULL);
120 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
121 108
122 /* Save command line for /proc/cmdline and then parse parameters */
123 strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
124 parse_early_param(); 109 parse_early_param();
125 110
126 memblock_allow_resize(); 111 memblock_allow_resize();
@@ -130,15 +115,6 @@ void __init early_init_devtree(void *params)
130 pr_debug(" <- early_init_devtree()\n"); 115 pr_debug(" <- early_init_devtree()\n");
131} 116}
132 117
133#ifdef CONFIG_BLK_DEV_INITRD
134void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
135{
136 initrd_start = (unsigned long)__va(start);
137 initrd_end = (unsigned long)__va(end);
138 initrd_below_start_ok = 1;
139}
140#endif
141
142/******* 118/*******
143 * 119 *
144 * New implementation of the OF "find" APIs, return a refcounted 120 * New implementation of the OF "find" APIs, return a refcounted
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index 0775e036c526..8de8ebc309f1 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -16,6 +16,7 @@
16#include <linux/initrd.h> 16#include <linux/initrd.h>
17#include <linux/console.h> 17#include <linux/console.h>
18#include <linux/debugfs.h> 18#include <linux/debugfs.h>
19#include <linux/of_fdt.h>
19 20
20#include <asm/setup.h> 21#include <asm/setup.h>
21#include <asm/sections.h> 22#include <asm/sections.h>
@@ -50,7 +51,7 @@ char cmd_line[COMMAND_LINE_SIZE] __attribute__ ((section(".data")));
50 51
51void __init setup_arch(char **cmdline_p) 52void __init setup_arch(char **cmdline_p)
52{ 53{
53 *cmdline_p = cmd_line; 54 *cmdline_p = boot_command_line;
54 55
55 console_verbose(); 56 console_verbose();
56 57
diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c
index f905b3ae68c7..f1e1f666ddde 100644
--- a/arch/microblaze/kernel/sys_microblaze.c
+++ b/arch/microblaze/kernel/sys_microblaze.c
@@ -33,12 +33,23 @@
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <asm/syscalls.h> 34#include <asm/syscalls.h>
35 35
36asmlinkage long sys_mmap(unsigned long addr, unsigned long len, 36SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
37 unsigned long prot, unsigned long flags, 37 unsigned long, prot, unsigned long, flags, unsigned long, fd,
38 unsigned long fd, off_t pgoff) 38 off_t, pgoff)
39{ 39{
40 if (pgoff & ~PAGE_MASK) 40 if (pgoff & ~PAGE_MASK)
41 return -EINVAL; 41 return -EINVAL;
42 42
43 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT); 43 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
44} 44}
45
46SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
47 unsigned long, prot, unsigned long, flags, unsigned long, fd,
48 unsigned long, pgoff)
49{
50 if (pgoff & (~PAGE_MASK >> 12))
51 return -EINVAL;
52
53 return sys_mmap_pgoff(addr, len, prot, flags, fd,
54 pgoff >> (PAGE_SHIFT - 12));
55}
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S
index 4fca56cf02f6..b882ad50535b 100644
--- a/arch/microblaze/kernel/syscall_table.S
+++ b/arch/microblaze/kernel/syscall_table.S
@@ -192,7 +192,7 @@ ENTRY(sys_call_table)
192 .long sys_ni_syscall /* reserved for streams2 */ 192 .long sys_ni_syscall /* reserved for streams2 */
193 .long sys_vfork /* 190 */ 193 .long sys_vfork /* 190 */
194 .long sys_getrlimit 194 .long sys_getrlimit
195 .long sys_mmap_pgoff /* mmap2 */ 195 .long sys_mmap2
196 .long sys_truncate64 196 .long sys_truncate64
197 .long sys_ftruncate64 197 .long sys_ftruncate64
198 .long sys_stat64 /* 195 */ 198 .long sys_stat64 /* 195 */
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
index e4b3f33ef34c..3e39b1082fdf 100644
--- a/arch/microblaze/kernel/timer.c
+++ b/arch/microblaze/kernel/timer.c
@@ -15,6 +15,7 @@
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/clockchips.h> 16#include <linux/clockchips.h>
17#include <linux/of_address.h> 17#include <linux/of_address.h>
18#include <linux/of_irq.h>
18#include <asm/cpuinfo.h> 19#include <asm/cpuinfo.h>
19#include <linux/cnt32_to_63.h> 20#include <linux/cnt32_to_63.h>
20 21
@@ -148,7 +149,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
148 149
149static struct irqaction timer_irqaction = { 150static struct irqaction timer_irqaction = {
150 .handler = timer_interrupt, 151 .handler = timer_interrupt,
151 .flags = IRQF_DISABLED | IRQF_TIMER, 152 .flags = IRQF_TIMER,
152 .name = "timer", 153 .name = "timer",
153 .dev_id = &clockevent_xilinx_timer, 154 .dev_id = &clockevent_xilinx_timer,
154}; 155};
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index 5226b09cbbb2..dbbf2246a260 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -176,8 +176,7 @@ void consistent_free(size_t size, void *vaddr)
176 page = virt_to_page(vaddr); 176 page = virt_to_page(vaddr);
177 177
178 do { 178 do {
179 ClearPageReserved(page); 179 __free_reserved_page(page);
180 __free_page(page);
181 page++; 180 page++;
182 } while (size -= PAGE_SIZE); 181 } while (size -= PAGE_SIZE);
183#else 182#else
@@ -194,9 +193,7 @@ void consistent_free(size_t size, void *vaddr)
194 pte_clear(&init_mm, (unsigned int)vaddr, ptep); 193 pte_clear(&init_mm, (unsigned int)vaddr, ptep);
195 if (pfn_valid(pfn)) { 194 if (pfn_valid(pfn)) {
196 page = pfn_to_page(pfn); 195 page = pfn_to_page(pfn);
197 196 __free_reserved_page(page);
198 ClearPageReserved(page);
199 __free_page(page);
200 } 197 }
201 } 198 }
202 vaddr += PAGE_SIZE; 199 vaddr += PAGE_SIZE;
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 1b93bf0892a0..66804adcacf0 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -29,6 +29,7 @@
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/of.h> 30#include <linux/of.h>
31#include <linux/of_address.h> 31#include <linux/of_address.h>
32#include <linux/of_irq.h>
32#include <linux/of_pci.h> 33#include <linux/of_pci.h>
33#include <linux/export.h> 34#include <linux/export.h>
34 35
@@ -193,76 +194,6 @@ void pcibios_set_master(struct pci_dev *dev)
193} 194}
194 195
195/* 196/*
196 * Reads the interrupt pin to determine if interrupt is use by card.
197 * If the interrupt is used, then gets the interrupt line from the
198 * openfirmware and sets it in the pci_dev and pci_config line.
199 */
200int pci_read_irq_line(struct pci_dev *pci_dev)
201{
202 struct of_irq oirq;
203 unsigned int virq;
204
205 /* The current device-tree that iSeries generates from the HV
206 * PCI informations doesn't contain proper interrupt routing,
207 * and all the fallback would do is print out crap, so we
208 * don't attempt to resolve the interrupts here at all, some
209 * iSeries specific fixup does it.
210 *
211 * In the long run, we will hopefully fix the generated device-tree
212 * instead.
213 */
214 pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev));
215
216#ifdef DEBUG
217 memset(&oirq, 0xff, sizeof(oirq));
218#endif
219 /* Try to get a mapping from the device-tree */
220 if (of_irq_map_pci(pci_dev, &oirq)) {
221 u8 line, pin;
222
223 /* If that fails, lets fallback to what is in the config
224 * space and map that through the default controller. We
225 * also set the type to level low since that's what PCI
226 * interrupts are. If your platform does differently, then
227 * either provide a proper interrupt tree or don't use this
228 * function.
229 */
230 if (pci_read_config_byte(pci_dev, PCI_INTERRUPT_PIN, &pin))
231 return -1;
232 if (pin == 0)
233 return -1;
234 if (pci_read_config_byte(pci_dev, PCI_INTERRUPT_LINE, &line) ||
235 line == 0xff || line == 0) {
236 return -1;
237 }
238 pr_debug(" No map ! Using line %d (pin %d) from PCI config\n",
239 line, pin);
240
241 virq = irq_create_mapping(NULL, line);
242 if (virq)
243 irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW);
244 } else {
245 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
246 oirq.size, oirq.specifier[0], oirq.specifier[1],
247 of_node_full_name(oirq.controller));
248
249 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
250 oirq.size);
251 }
252 if (!virq) {
253 pr_debug(" Failed to map !\n");
254 return -1;
255 }
256
257 pr_debug(" Mapped to linux irq %d\n", virq);
258
259 pci_dev->irq = virq;
260
261 return 0;
262}
263EXPORT_SYMBOL(pci_read_irq_line);
264
265/*
266 * Platform support for /proc/bus/pci/X/Y mmap()s, 197 * Platform support for /proc/bus/pci/X/Y mmap()s,
267 * modelled on the sparc64 implementation by Dave Miller. 198 * modelled on the sparc64 implementation by Dave Miller.
268 * -- paulus. 199 * -- paulus.
@@ -960,7 +891,7 @@ void pcibios_setup_bus_devices(struct pci_bus *bus)
960 dev->dev.archdata.dma_data = (void *)PCI_DRAM_OFFSET; 891 dev->dev.archdata.dma_data = (void *)PCI_DRAM_OFFSET;
961 892
962 /* Read default IRQs and fixup if necessary */ 893 /* Read default IRQs and fixup if necessary */
963 pci_read_irq_line(dev); 894 dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
964 } 895 }
965} 896}
966 897
diff --git a/arch/mips/Kbuild.platforms b/arch/mips/Kbuild.platforms
index d9d81c219253..6e239123d6fe 100644
--- a/arch/mips/Kbuild.platforms
+++ b/arch/mips/Kbuild.platforms
@@ -20,7 +20,6 @@ platforms += mti-sead3
20platforms += netlogic 20platforms += netlogic
21platforms += pmcs-msp71xx 21platforms += pmcs-msp71xx
22platforms += pnx833x 22platforms += pnx833x
23platforms += powertv
24platforms += ralink 23platforms += ralink
25platforms += rb532 24platforms += rb532
26platforms += sgi-ip22 25platforms += sgi-ip22
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 7861401f3b66..650de3976e7a 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -9,6 +9,7 @@ config MIPS
9 select HAVE_PERF_EVENTS 9 select HAVE_PERF_EVENTS
10 select PERF_USE_VMALLOC 10 select PERF_USE_VMALLOC
11 select HAVE_ARCH_KGDB 11 select HAVE_ARCH_KGDB
12 select HAVE_ARCH_TRACEHOOK
12 select ARCH_HAVE_CUSTOM_GPIO_H 13 select ARCH_HAVE_CUSTOM_GPIO_H
13 select HAVE_FUNCTION_TRACER 14 select HAVE_FUNCTION_TRACER
14 select HAVE_FUNCTION_TRACE_MCOUNT_TEST 15 select HAVE_FUNCTION_TRACE_MCOUNT_TEST
@@ -19,6 +20,7 @@ config MIPS
19 select HAVE_KPROBES 20 select HAVE_KPROBES
20 select HAVE_KRETPROBES 21 select HAVE_KRETPROBES
21 select HAVE_DEBUG_KMEMLEAK 22 select HAVE_DEBUG_KMEMLEAK
23 select HAVE_SYSCALL_TRACEPOINTS
22 select ARCH_BINFMT_ELF_RANDOMIZE_PIE 24 select ARCH_BINFMT_ELF_RANDOMIZE_PIE
23 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT 25 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT
24 select RTC_LIB if !MACH_LOONGSON 26 select RTC_LIB if !MACH_LOONGSON
@@ -147,6 +149,7 @@ config MIPS_COBALT
147 select CSRC_R4K 149 select CSRC_R4K
148 select CEVT_GT641XX 150 select CEVT_GT641XX
149 select DMA_NONCOHERENT 151 select DMA_NONCOHERENT
152 select EARLY_PRINTK_8250 if EARLY_PRINTK
150 select HW_HAS_PCI 153 select HW_HAS_PCI
151 select I8253 154 select I8253
152 select I8259 155 select I8259
@@ -413,23 +416,6 @@ config PMC_MSP
413 of integrated peripherals, interfaces and DSPs in addition to 416 of integrated peripherals, interfaces and DSPs in addition to
414 a variety of MIPS cores. 417 a variety of MIPS cores.
415 418
416config POWERTV
417 bool "Cisco PowerTV"
418 select BOOT_ELF32
419 select CEVT_R4K
420 select CPU_MIPSR2_IRQ_VI
421 select CPU_MIPSR2_IRQ_EI
422 select CSRC_POWERTV
423 select DMA_NONCOHERENT
424 select HW_HAS_PCI
425 select SYS_HAS_CPU_MIPS32_R2
426 select SYS_SUPPORTS_32BIT_KERNEL
427 select SYS_SUPPORTS_BIG_ENDIAN
428 select SYS_SUPPORTS_HIGHMEM
429 select USB_OHCI_LITTLE_ENDIAN
430 help
431 This enables support for the Cisco PowerTV Platform.
432
433config RALINK 419config RALINK
434 bool "Ralink based machines" 420 bool "Ralink based machines"
435 select CEVT_R4K 421 select CEVT_R4K
@@ -812,7 +798,6 @@ source "arch/mips/jz4740/Kconfig"
812source "arch/mips/lantiq/Kconfig" 798source "arch/mips/lantiq/Kconfig"
813source "arch/mips/lasat/Kconfig" 799source "arch/mips/lasat/Kconfig"
814source "arch/mips/pmcs-msp71xx/Kconfig" 800source "arch/mips/pmcs-msp71xx/Kconfig"
815source "arch/mips/powertv/Kconfig"
816source "arch/mips/ralink/Kconfig" 801source "arch/mips/ralink/Kconfig"
817source "arch/mips/sgi-ip27/Kconfig" 802source "arch/mips/sgi-ip27/Kconfig"
818source "arch/mips/sibyte/Kconfig" 803source "arch/mips/sibyte/Kconfig"
@@ -891,9 +876,6 @@ config CSRC_BCM1480
891config CSRC_IOASIC 876config CSRC_IOASIC
892 bool 877 bool
893 878
894config CSRC_POWERTV
895 bool
896
897config CSRC_R4K 879config CSRC_R4K
898 bool 880 bool
899 881
@@ -1490,8 +1472,10 @@ config SYS_SUPPORTS_ZBOOT
1490 bool 1472 bool
1491 select HAVE_KERNEL_GZIP 1473 select HAVE_KERNEL_GZIP
1492 select HAVE_KERNEL_BZIP2 1474 select HAVE_KERNEL_BZIP2
1475 select HAVE_KERNEL_LZ4
1493 select HAVE_KERNEL_LZMA 1476 select HAVE_KERNEL_LZMA
1494 select HAVE_KERNEL_LZO 1477 select HAVE_KERNEL_LZO
1478 select HAVE_KERNEL_XZ
1495 1479
1496config SYS_SUPPORTS_ZBOOT_UART16550 1480config SYS_SUPPORTS_ZBOOT_UART16550
1497 bool 1481 bool
@@ -1978,6 +1962,7 @@ config MIPS_VPE_APSP_API
1978config MIPS_CMP 1962config MIPS_CMP
1979 bool "MIPS CMP framework support" 1963 bool "MIPS CMP framework support"
1980 depends on SYS_SUPPORTS_MIPS_CMP 1964 depends on SYS_SUPPORTS_MIPS_CMP
1965 select SMP
1981 select SYNC_R4K 1966 select SYNC_R4K
1982 select SYS_SUPPORTS_SMP 1967 select SYS_SUPPORTS_SMP
1983 select SYS_SUPPORTS_SCHED_SMT if SMP 1968 select SYS_SUPPORTS_SCHED_SMT if SMP
@@ -2141,7 +2126,6 @@ source "mm/Kconfig"
2141config SMP 2126config SMP
2142 bool "Multi-Processing support" 2127 bool "Multi-Processing support"
2143 depends on SYS_SUPPORTS_SMP 2128 depends on SYS_SUPPORTS_SMP
2144 select USE_GENERIC_SMP_HELPERS
2145 help 2129 help
2146 This enables support for systems with more than one CPU. If you have 2130 This enables support for systems with more than one CPU. If you have
2147 a system with only one CPU, like most personal computers, say N. If 2131 a system with only one CPU, like most personal computers, say N. If
diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index 37871f0de15e..b147e7038ff0 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -20,6 +20,14 @@ config EARLY_PRINTK
20 doesn't cooperate with an X server. You should normally say N here, 20 doesn't cooperate with an X server. You should normally say N here,
21 unless you want to debug such a crash. 21 unless you want to debug such a crash.
22 22
23config EARLY_PRINTK_8250
24 bool "8250/16550 and compatible serial early printk driver"
25 depends on EARLY_PRINTK
26 default n
27 help
28 If you say Y here, it will be possible to use a 8250/16550 serial
29 port as the boot console.
30
23config CMDLINE_BOOL 31config CMDLINE_BOOL
24 bool "Built-in kernel command line" 32 bool "Built-in kernel command line"
25 default n 33 default n
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 75a36ad11ff5..de300b993607 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -285,18 +285,19 @@ endif
285# Other need ECOFF, so we build a 32-bit ELF binary for them which we then 285# Other need ECOFF, so we build a 32-bit ELF binary for them which we then
286# convert to ECOFF using elf2ecoff. 286# convert to ECOFF using elf2ecoff.
287# 287#
288quiet_cmd_32 = OBJCOPY $@
289 cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
288vmlinux.32: vmlinux 290vmlinux.32: vmlinux
289 $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@ 291 $(call cmd,32)
290
291
292#obj-$(CONFIG_KPROBES) += kprobes.o
293 292
294# 293#
295# The 64-bit ELF tools are pretty broken so at this time we generate 64-bit 294# The 64-bit ELF tools are pretty broken so at this time we generate 64-bit
296# ELF files from 32-bit files by conversion. 295# ELF files from 32-bit files by conversion.
297# 296#
297quiet_cmd_64 = OBJCOPY $@
298 cmd_64 = $(OBJCOPY) -O $(64bit-bfd) $(OBJCOPYFLAGS) $< $@
298vmlinux.64: vmlinux 299vmlinux.64: vmlinux
299 $(OBJCOPY) -O $(64bit-bfd) $(OBJCOPYFLAGS) $< $@ 300 $(call cmd,64)
300 301
301all: $(all-y) 302all: $(all-y)
302 303
@@ -305,10 +306,16 @@ $(boot-y): $(vmlinux-32) FORCE
305 $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) \ 306 $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) \
306 $(bootvars-y) arch/mips/boot/$@ 307 $(bootvars-y) arch/mips/boot/$@
307 308
309ifdef CONFIG_SYS_SUPPORTS_ZBOOT
308# boot/compressed 310# boot/compressed
309$(bootz-y): $(vmlinux-32) FORCE 311$(bootz-y): $(vmlinux-32) FORCE
310 $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \ 312 $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \
311 $(bootvars-y) 32bit-bfd=$(32bit-bfd) $@ 313 $(bootvars-y) 32bit-bfd=$(32bit-bfd) $@
314else
315vmlinuz: FORCE
316 @echo ' CONFIG_SYS_SUPPORTS_ZBOOT is not enabled'
317 /bin/false
318endif
312 319
313 320
314CLEAN_FILES += vmlinux.32 vmlinux.64 321CLEAN_FILES += vmlinux.32 vmlinux.64
diff --git a/arch/mips/alchemy/board-mtx1.c b/arch/mips/alchemy/board-mtx1.c
index 4a9baa9f6330..9969dbab19e3 100644
--- a/arch/mips/alchemy/board-mtx1.c
+++ b/arch/mips/alchemy/board-mtx1.c
@@ -276,7 +276,7 @@ static struct platform_device mtx1_pci_host = {
276 .resource = alchemy_pci_host_res, 276 .resource = alchemy_pci_host_res,
277}; 277};
278 278
279static struct __initdata platform_device * mtx1_devs[] = { 279static struct platform_device *mtx1_devs[] __initdata = {
280 &mtx1_pci_host, 280 &mtx1_pci_host,
281 &mtx1_gpio_leds, 281 &mtx1_gpio_leds,
282 &mtx1_wdt, 282 &mtx1_wdt,
diff --git a/arch/mips/alchemy/common/usb.c b/arch/mips/alchemy/common/usb.c
index fcc695626117..2adc7edda49c 100644
--- a/arch/mips/alchemy/common/usb.c
+++ b/arch/mips/alchemy/common/usb.c
@@ -14,6 +14,7 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/syscore_ops.h> 16#include <linux/syscore_ops.h>
17#include <asm/cpu.h>
17#include <asm/mach-au1x00/au1000.h> 18#include <asm/mach-au1x00/au1000.h>
18 19
19/* control register offsets */ 20/* control register offsets */
@@ -358,7 +359,7 @@ static inline int au1200_coherency_bug(void)
358{ 359{
359#if defined(CONFIG_DMA_COHERENT) 360#if defined(CONFIG_DMA_COHERENT)
360 /* Au1200 AB USB does not support coherent memory */ 361 /* Au1200 AB USB does not support coherent memory */
361 if (!(read_c0_prid() & 0xff)) { 362 if (!(read_c0_prid() & PRID_REV_MASK)) {
362 printk(KERN_INFO "Au1200 USB: this is chip revision AB !!\n"); 363 printk(KERN_INFO "Au1200 USB: this is chip revision AB !!\n");
363 printk(KERN_INFO "Au1200 USB: update your board or re-configure" 364 printk(KERN_INFO "Au1200 USB: update your board or re-configure"
364 " the kernel\n"); 365 " the kernel\n");
diff --git a/arch/mips/alchemy/devboards/db1235.c b/arch/mips/alchemy/devboards/db1235.c
index c76a90f78664..bac19dc43d1d 100644
--- a/arch/mips/alchemy/devboards/db1235.c
+++ b/arch/mips/alchemy/devboards/db1235.c
@@ -59,7 +59,7 @@ void __init board_setup(void)
59 ret = -ENODEV; 59 ret = -ENODEV;
60 } 60 }
61 if (ret) 61 if (ret)
62 panic("cannot initialize board support\n"); 62 panic("cannot initialize board support");
63} 63}
64 64
65int __init db1235_arch_init(void) 65int __init db1235_arch_init(void)
diff --git a/arch/mips/ath79/dev-common.c b/arch/mips/ath79/dev-common.c
index c3b04c929f29..516225d207ee 100644
--- a/arch/mips/ath79/dev-common.c
+++ b/arch/mips/ath79/dev-common.c
@@ -20,7 +20,6 @@
20 20
21#include <asm/mach-ath79/ath79.h> 21#include <asm/mach-ath79/ath79.h>
22#include <asm/mach-ath79/ar71xx_regs.h> 22#include <asm/mach-ath79/ar71xx_regs.h>
23#include <asm/mach-ath79/ar933x_uart_platform.h>
24#include "common.h" 23#include "common.h"
25#include "dev-common.h" 24#include "dev-common.h"
26 25
@@ -68,15 +67,11 @@ static struct resource ar933x_uart_resources[] = {
68 }, 67 },
69}; 68};
70 69
71static struct ar933x_uart_platform_data ar933x_uart_data;
72static struct platform_device ar933x_uart_device = { 70static struct platform_device ar933x_uart_device = {
73 .name = "ar933x-uart", 71 .name = "ar933x-uart",
74 .id = -1, 72 .id = -1,
75 .resource = ar933x_uart_resources, 73 .resource = ar933x_uart_resources,
76 .num_resources = ARRAY_SIZE(ar933x_uart_resources), 74 .num_resources = ARRAY_SIZE(ar933x_uart_resources),
77 .dev = {
78 .platform_data = &ar933x_uart_data,
79 },
80}; 75};
81 76
82void __init ath79_register_uart(void) 77void __init ath79_register_uart(void)
@@ -93,7 +88,6 @@ void __init ath79_register_uart(void)
93 ath79_uart_data[0].uartclk = uart_clk_rate; 88 ath79_uart_data[0].uartclk = uart_clk_rate;
94 platform_device_register(&ath79_uart_device); 89 platform_device_register(&ath79_uart_device);
95 } else if (soc_is_ar933x()) { 90 } else if (soc_is_ar933x()) {
96 ar933x_uart_data.uartclk = uart_clk_rate;
97 platform_device_register(&ar933x_uart_device); 91 platform_device_register(&ar933x_uart_device);
98 } else { 92 } else {
99 BUG(); 93 BUG();
diff --git a/arch/mips/bcm47xx/Makefile b/arch/mips/bcm47xx/Makefile
index f3bf6d5bfb9d..c52daf9b05c6 100644
--- a/arch/mips/bcm47xx/Makefile
+++ b/arch/mips/bcm47xx/Makefile
@@ -4,4 +4,5 @@
4# 4#
5 5
6obj-y += irq.o nvram.o prom.o serial.o setup.o time.o sprom.o 6obj-y += irq.o nvram.o prom.o serial.o setup.o time.o sprom.o
7obj-y += board.o
7obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o 8obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o
diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
new file mode 100644
index 000000000000..f3f6bfe68a2a
--- /dev/null
+++ b/arch/mips/bcm47xx/board.c
@@ -0,0 +1,309 @@
1#include <linux/export.h>
2#include <linux/string.h>
3#include <bcm47xx_board.h>
4#include <bcm47xx_nvram.h>
5
6struct bcm47xx_board_type {
7 const enum bcm47xx_board board;
8 const char *name;
9};
10
11struct bcm47xx_board_type_list1 {
12 struct bcm47xx_board_type board;
13 const char *value1;
14};
15
16struct bcm47xx_board_type_list2 {
17 struct bcm47xx_board_type board;
18 const char *value1;
19 const char *value2;
20};
21
22struct bcm47xx_board_type_list3 {
23 struct bcm47xx_board_type board;
24 const char *value1;
25 const char *value2;
26 const char *value3;
27};
28
29struct bcm47xx_board_store {
30 enum bcm47xx_board board;
31 char name[BCM47XX_BOARD_MAX_NAME];
32};
33
34/* model_name */
35static const
36struct bcm47xx_board_type_list1 bcm47xx_board_list_model_name[] __initconst = {
37 {{BCM47XX_BOARD_DLINK_DIR130, "D-Link DIR-130"}, "DIR-130"},
38 {{BCM47XX_BOARD_DLINK_DIR330, "D-Link DIR-330"}, "DIR-330"},
39 { {0}, 0},
40};
41
42/* model_no */
43static const
44struct bcm47xx_board_type_list1 bcm47xx_board_list_model_no[] __initconst = {
45 {{BCM47XX_BOARD_ASUS_WL700GE, "Asus WL700"}, "WL700"},
46 { {0}, 0},
47};
48
49/* machine_name */
50static const
51struct bcm47xx_board_type_list1 bcm47xx_board_list_machine_name[] __initconst = {
52 {{BCM47XX_BOARD_LINKSYS_WRTSL54GS, "Linksys WRTSL54GS"}, "WRTSL54GS"},
53 { {0}, 0},
54};
55
56/* hardware_version */
57static const
58struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initconst = {
59 {{BCM47XX_BOARD_ASUS_RTN16, "Asus RT-N16"}, "RT-N16-"},
60 {{BCM47XX_BOARD_ASUS_WL320GE, "Asus WL320GE"}, "WL320G-"},
61 {{BCM47XX_BOARD_ASUS_WL330GE, "Asus WL330GE"}, "WL330GE-"},
62 {{BCM47XX_BOARD_ASUS_WL500GD, "Asus WL500GD"}, "WL500gd-"},
63 {{BCM47XX_BOARD_ASUS_WL500GPV1, "Asus WL500GP V1"}, "WL500gp-"},
64 {{BCM47XX_BOARD_ASUS_WL500GPV2, "Asus WL500GP V2"}, "WL500GPV2-"},
65 {{BCM47XX_BOARD_ASUS_WL500W, "Asus WL500W"}, "WL500gW-"},
66 {{BCM47XX_BOARD_ASUS_WL520GC, "Asus WL520GC"}, "WL520GC-"},
67 {{BCM47XX_BOARD_ASUS_WL520GU, "Asus WL520GU"}, "WL520GU-"},
68 {{BCM47XX_BOARD_BELKIN_F7D4301, "Belkin F7D4301"}, "F7D4301"},
69 { {0}, 0},
70};
71
72/* productid */
73static const
74struct bcm47xx_board_type_list1 bcm47xx_board_list_productid[] __initconst = {
75 {{BCM47XX_BOARD_ASUS_RTAC66U, "Asus RT-AC66U"}, "RT-AC66U"},
76 {{BCM47XX_BOARD_ASUS_RTN10, "Asus RT-N10"}, "RT-N10"},
77 {{BCM47XX_BOARD_ASUS_RTN10D, "Asus RT-N10D"}, "RT-N10D"},
78 {{BCM47XX_BOARD_ASUS_RTN10U, "Asus RT-N10U"}, "RT-N10U"},
79 {{BCM47XX_BOARD_ASUS_RTN12, "Asus RT-N12"}, "RT-N12"},
80 {{BCM47XX_BOARD_ASUS_RTN12B1, "Asus RT-N12B1"}, "RT-N12B1"},
81 {{BCM47XX_BOARD_ASUS_RTN12C1, "Asus RT-N12C1"}, "RT-N12C1"},
82 {{BCM47XX_BOARD_ASUS_RTN12D1, "Asus RT-N12D1"}, "RT-N12D1"},
83 {{BCM47XX_BOARD_ASUS_RTN12HP, "Asus RT-N12HP"}, "RT-N12HP"},
84 {{BCM47XX_BOARD_ASUS_RTN15U, "Asus RT-N15U"}, "RT-N15U"},
85 {{BCM47XX_BOARD_ASUS_RTN16, "Asus RT-N16"}, "RT-N16"},
86 {{BCM47XX_BOARD_ASUS_RTN53, "Asus RT-N53"}, "RT-N53"},
87 {{BCM47XX_BOARD_ASUS_RTN66U, "Asus RT-N66U"}, "RT-N66U"},
88 {{BCM47XX_BOARD_ASUS_WL300G, "Asus WL300G"}, "WL300g"},
89 {{BCM47XX_BOARD_ASUS_WLHDD, "Asus WLHDD"}, "WLHDD"},
90 { {0}, 0},
91};
92
93/* ModelId */
94static const
95struct bcm47xx_board_type_list1 bcm47xx_board_list_ModelId[] __initconst = {
96 {{BCM47XX_BOARD_DELL_TM2300, "Dell WX-5565"}, "WX-5565"},
97 {{BCM47XX_BOARD_MOTOROLA_WE800G, "Motorola WE800G"}, "WE800G"},
98 {{BCM47XX_BOARD_MOTOROLA_WR850GP, "Motorola WR850GP"}, "WR850GP"},
99 {{BCM47XX_BOARD_MOTOROLA_WR850GV2V3, "Motorola WR850G"}, "WR850G"},
100 { {0}, 0},
101};
102
103/* melco_id or buf1falo_id */
104static const
105struct bcm47xx_board_type_list1 bcm47xx_board_list_melco_id[] __initconst = {
106 {{BCM47XX_BOARD_BUFFALO_WBR2_G54, "Buffalo WBR2-G54"}, "29bb0332"},
107 {{BCM47XX_BOARD_BUFFALO_WHR2_A54G54, "Buffalo WHR2-A54G54"}, "290441dd"},
108 {{BCM47XX_BOARD_BUFFALO_WHR_G125, "Buffalo WHR-G125"}, "32093"},
109 {{BCM47XX_BOARD_BUFFALO_WHR_G54S, "Buffalo WHR-G54S"}, "30182"},
110 {{BCM47XX_BOARD_BUFFALO_WHR_HP_G54, "Buffalo WHR-HP-G54"}, "30189"},
111 {{BCM47XX_BOARD_BUFFALO_WLA2_G54L, "Buffalo WLA2-G54L"}, "29129"},
112 {{BCM47XX_BOARD_BUFFALO_WZR_G300N, "Buffalo WZR-G300N"}, "31120"},
113 {{BCM47XX_BOARD_BUFFALO_WZR_RS_G54, "Buffalo WZR-RS-G54"}, "30083"},
114 {{BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP, "Buffalo WZR-RS-G54HP"}, "30103"},
115 { {0}, 0},
116};
117
118/* boot_hw_model, boot_hw_ver */
119static const
120struct bcm47xx_board_type_list2 bcm47xx_board_list_boot_hw[] __initconst = {
121 /* like WRT160N v3.0 */
122 {{BCM47XX_BOARD_CISCO_M10V1, "Cisco M10"}, "M10", "1.0"},
123 /* like WRT310N v2.0 */
124 {{BCM47XX_BOARD_CISCO_M20V1, "Cisco M20"}, "M20", "1.0"},
125 {{BCM47XX_BOARD_LINKSYS_E900V1, "Linksys E900 V1"}, "E900", "1.0"},
126 /* like WRT160N v3.0 */
127 {{BCM47XX_BOARD_LINKSYS_E1000V1, "Linksys E1000 V1"}, "E100", "1.0"},
128 {{BCM47XX_BOARD_LINKSYS_E1000V2, "Linksys E1000 V2"}, "E1000", "2.0"},
129 {{BCM47XX_BOARD_LINKSYS_E1000V21, "Linksys E1000 V2.1"}, "E1000", "2.1"},
130 {{BCM47XX_BOARD_LINKSYS_E1200V2, "Linksys E1200 V2"}, "E1200", "2.0"},
131 {{BCM47XX_BOARD_LINKSYS_E2000V1, "Linksys E2000 V1"}, "Linksys E2000", "1.0"},
132 /* like WRT610N v2.0 */
133 {{BCM47XX_BOARD_LINKSYS_E3000V1, "Linksys E3000 V1"}, "E300", "1.0"},
134 {{BCM47XX_BOARD_LINKSYS_E3200V1, "Linksys E3200 V1"}, "E3200", "1.0"},
135 {{BCM47XX_BOARD_LINKSYS_E4200V1, "Linksys E4200 V1"}, "E4200", "1.0"},
136 {{BCM47XX_BOARD_LINKSYS_WRT150NV11, "Linksys WRT150N V1.1"}, "WRT150N", "1.1"},
137 {{BCM47XX_BOARD_LINKSYS_WRT150NV1, "Linksys WRT150N V1"}, "WRT150N", "1"},
138 {{BCM47XX_BOARD_LINKSYS_WRT160NV1, "Linksys WRT160N V1"}, "WRT160N", "1.0"},
139 {{BCM47XX_BOARD_LINKSYS_WRT160NV3, "Linksys WRT160N V3"}, "WRT160N", "3.0"},
140 {{BCM47XX_BOARD_LINKSYS_WRT300NV11, "Linksys WRT300N V1.1"}, "WRT300N", "1.1"},
141 {{BCM47XX_BOARD_LINKSYS_WRT310NV1, "Linksys WRT310N V1"}, "WRT310N", "1.0"},
142 {{BCM47XX_BOARD_LINKSYS_WRT310NV2, "Linksys WRT310N V2"}, "WRT310N", "2.0"},
143 {{BCM47XX_BOARD_LINKSYS_WRT54G3GV2, "Linksys WRT54G3GV2-VF"}, "WRT54G3GV2-VF", "1.0"},
144 {{BCM47XX_BOARD_LINKSYS_WRT610NV1, "Linksys WRT610N V1"}, "WRT610N", "1.0"},
145 {{BCM47XX_BOARD_LINKSYS_WRT610NV2, "Linksys WRT610N V2"}, "WRT610N", "2.0"},
146 { {0}, 0},
147};
148
149/* board_id */
150static const
151struct bcm47xx_board_type_list1 bcm47xx_board_list_board_id[] __initconst = {
152 {{BCM47XX_BOARD_NETGEAR_WGR614V8, "Netgear WGR614 V8"}, "U12H072T00_NETGEAR"},
153 {{BCM47XX_BOARD_NETGEAR_WGR614V9, "Netgear WGR614 V9"}, "U12H094T00_NETGEAR"},
154 {{BCM47XX_BOARD_NETGEAR_WNDR3300, "Netgear WNDR3300"}, "U12H093T00_NETGEAR"},
155 {{BCM47XX_BOARD_NETGEAR_WNDR3400V1, "Netgear WNDR3400 V1"}, "U12H155T00_NETGEAR"},
156 {{BCM47XX_BOARD_NETGEAR_WNDR3400V2, "Netgear WNDR3400 V2"}, "U12H187T00_NETGEAR"},
157 {{BCM47XX_BOARD_NETGEAR_WNDR3400VCNA, "Netgear WNDR3400 Vcna"}, "U12H155T01_NETGEAR"},
158 {{BCM47XX_BOARD_NETGEAR_WNDR3700V3, "Netgear WNDR3700 V3"}, "U12H194T00_NETGEAR"},
159 {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Netgear WNDR4000"}, "U12H181T00_NETGEAR"},
160 {{BCM47XX_BOARD_NETGEAR_WNDR4500V1, "Netgear WNDR4500 V1"}, "U12H189T00_NETGEAR"},
161 {{BCM47XX_BOARD_NETGEAR_WNDR4500V2, "Netgear WNDR4500 V2"}, "U12H224T00_NETGEAR"},
162 {{BCM47XX_BOARD_NETGEAR_WNR2000, "Netgear WNR2000"}, "U12H114T00_NETGEAR"},
163 {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "U12H136T99_NETGEAR"},
164 {{BCM47XX_BOARD_NETGEAR_WNR3500U, "Netgear WNR3500U"}, "U12H136T00_NETGEAR"},
165 {{BCM47XX_BOARD_NETGEAR_WNR3500V2, "Netgear WNR3500 V2"}, "U12H127T00_NETGEAR"},
166 {{BCM47XX_BOARD_NETGEAR_WNR3500V2VC, "Netgear WNR3500 V2vc"}, "U12H127T70_NETGEAR"},
167 {{BCM47XX_BOARD_NETGEAR_WNR834BV2, "Netgear WNR834B V2"}, "U12H081T00_NETGEAR"},
168 { {0}, 0},
169};
170
171/* boardtype, boardnum, boardrev */
172static const
173struct bcm47xx_board_type_list3 bcm47xx_board_list_board[] __initconst = {
174 {{BCM47XX_BOARD_HUAWEI_E970, "Huawei E970"}, "0x048e", "0x5347", "0x11"},
175 {{BCM47XX_BOARD_PHICOMM_M1, "Phicomm M1"}, "0x0590", "80", "0x1104"},
176 {{BCM47XX_BOARD_ZTE_H218N, "ZTE H218N"}, "0x053d", "1234", "0x1305"},
177 { {0}, 0},
178};
179
180static const
181struct bcm47xx_board_type bcm47xx_board_unknown[] __initconst = {
182 {BCM47XX_BOARD_UNKNOWN, "Unknown Board"},
183};
184
185static struct bcm47xx_board_store bcm47xx_board = {BCM47XX_BOARD_NO, "Unknown Board"};
186
187static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void)
188{
189 char buf1[30];
190 char buf2[30];
191 char buf3[30];
192 const struct bcm47xx_board_type_list1 *e1;
193 const struct bcm47xx_board_type_list2 *e2;
194 const struct bcm47xx_board_type_list3 *e3;
195
196 if (bcm47xx_nvram_getenv("model_name", buf1, sizeof(buf1)) >= 0) {
197 for (e1 = bcm47xx_board_list_model_name; e1->value1; e1++) {
198 if (!strcmp(buf1, e1->value1))
199 return &e1->board;
200 }
201 }
202
203 if (bcm47xx_nvram_getenv("model_no", buf1, sizeof(buf1)) >= 0) {
204 for (e1 = bcm47xx_board_list_model_no; e1->value1; e1++) {
205 if (strstarts(buf1, e1->value1))
206 return &e1->board;
207 }
208 }
209
210 if (bcm47xx_nvram_getenv("machine_name", buf1, sizeof(buf1)) >= 0) {
211 for (e1 = bcm47xx_board_list_machine_name; e1->value1; e1++) {
212 if (strstarts(buf1, e1->value1))
213 return &e1->board;
214 }
215 }
216
217 if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0) {
218 for (e1 = bcm47xx_board_list_hardware_version; e1->value1; e1++) {
219 if (strstarts(buf1, e1->value1))
220 return &e1->board;
221 }
222 }
223
224 if (bcm47xx_nvram_getenv("productid", buf1, sizeof(buf1)) >= 0) {
225 for (e1 = bcm47xx_board_list_productid; e1->value1; e1++) {
226 if (!strcmp(buf1, e1->value1))
227 return &e1->board;
228 }
229 }
230
231 if (bcm47xx_nvram_getenv("ModelId", buf1, sizeof(buf1)) >= 0) {
232 for (e1 = bcm47xx_board_list_ModelId; e1->value1; e1++) {
233 if (!strcmp(buf1, e1->value1))
234 return &e1->board;
235 }
236 }
237
238 if (bcm47xx_nvram_getenv("melco_id", buf1, sizeof(buf1)) >= 0 ||
239 bcm47xx_nvram_getenv("buf1falo_id", buf1, sizeof(buf1)) >= 0) {
240 /* buffalo hardware, check id for specific hardware matches */
241 for (e1 = bcm47xx_board_list_melco_id; e1->value1; e1++) {
242 if (!strcmp(buf1, e1->value1))
243 return &e1->board;
244 }
245 }
246
247 if (bcm47xx_nvram_getenv("boot_hw_model", buf1, sizeof(buf1)) >= 0 &&
248 bcm47xx_nvram_getenv("boot_hw_ver", buf2, sizeof(buf2)) >= 0) {
249 for (e2 = bcm47xx_board_list_boot_hw; e2->value1; e2++) {
250 if (!strcmp(buf1, e2->value1) &&
251 !strcmp(buf2, e2->value2))
252 return &e2->board;
253 }
254 }
255
256 if (bcm47xx_nvram_getenv("board_id", buf1, sizeof(buf1)) >= 0) {
257 for (e1 = bcm47xx_board_list_board_id; e1->value1; e1++) {
258 if (!strcmp(buf1, e1->value1))
259 return &e1->board;
260 }
261 }
262
263 if (bcm47xx_nvram_getenv("boardtype", buf1, sizeof(buf1)) >= 0 &&
264 bcm47xx_nvram_getenv("boardnum", buf2, sizeof(buf2)) >= 0 &&
265 bcm47xx_nvram_getenv("boardrev", buf3, sizeof(buf3)) >= 0) {
266 for (e3 = bcm47xx_board_list_board; e3->value1; e3++) {
267 if (!strcmp(buf1, e3->value1) &&
268 !strcmp(buf2, e3->value2) &&
269 !strcmp(buf3, e3->value3))
270 return &e3->board;
271 }
272 }
273 return bcm47xx_board_unknown;
274}
275
276void __init bcm47xx_board_detect(void)
277{
278 int err;
279 char buf[10];
280 const struct bcm47xx_board_type *board_detected;
281
282 if (bcm47xx_board.board != BCM47XX_BOARD_NO)
283 return;
284
285 /* check if the nvram is available */
286 err = bcm47xx_nvram_getenv("boardtype", buf, sizeof(buf));
287
288 /* init of nvram failed, probably too early now */
289 if (err == -ENXIO) {
290 return;
291 }
292
293 board_detected = bcm47xx_board_get_nvram();
294 bcm47xx_board.board = board_detected->board;
295 strlcpy(bcm47xx_board.name, board_detected->name,
296 BCM47XX_BOARD_MAX_NAME);
297}
298
299enum bcm47xx_board bcm47xx_board_get(void)
300{
301 return bcm47xx_board.board;
302}
303EXPORT_SYMBOL(bcm47xx_board_get);
304
305const char *bcm47xx_board_get_name(void)
306{
307 return bcm47xx_board.name;
308}
309EXPORT_SYMBOL(bcm47xx_board_get_name);
diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
index cc40b74940f5..b4c585b1c62e 100644
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -190,3 +190,23 @@ int bcm47xx_nvram_getenv(char *name, char *val, size_t val_len)
190 return -ENOENT; 190 return -ENOENT;
191} 191}
192EXPORT_SYMBOL(bcm47xx_nvram_getenv); 192EXPORT_SYMBOL(bcm47xx_nvram_getenv);
193
194int bcm47xx_nvram_gpio_pin(const char *name)
195{
196 int i, err;
197 char nvram_var[10];
198 char buf[30];
199
200 for (i = 0; i < 16; i++) {
201 err = snprintf(nvram_var, sizeof(nvram_var), "gpio%i", i);
202 if (err <= 0)
203 continue;
204 err = bcm47xx_nvram_getenv(nvram_var, buf, sizeof(buf));
205 if (err <= 0)
206 continue;
207 if (!strcmp(name, buf))
208 return i;
209 }
210 return -ENOENT;
211}
212EXPORT_SYMBOL(bcm47xx_nvram_gpio_pin);
diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c
index 8c155afb1299..5cba318bc1cd 100644
--- a/arch/mips/bcm47xx/prom.c
+++ b/arch/mips/bcm47xx/prom.c
@@ -32,12 +32,37 @@
32#include <asm/bootinfo.h> 32#include <asm/bootinfo.h>
33#include <asm/fw/cfe/cfe_api.h> 33#include <asm/fw/cfe/cfe_api.h>
34#include <asm/fw/cfe/cfe_error.h> 34#include <asm/fw/cfe/cfe_error.h>
35#include <bcm47xx.h>
36#include <bcm47xx_board.h>
35 37
36static int cfe_cons_handle; 38static int cfe_cons_handle;
37 39
40static u16 get_chip_id(void)
41{
42 switch (bcm47xx_bus_type) {
43#ifdef CONFIG_BCM47XX_SSB
44 case BCM47XX_BUS_TYPE_SSB:
45 return bcm47xx_bus.ssb.chip_id;
46#endif
47#ifdef CONFIG_BCM47XX_BCMA
48 case BCM47XX_BUS_TYPE_BCMA:
49 return bcm47xx_bus.bcma.bus.chipinfo.id;
50#endif
51 }
52 return 0;
53}
54
38const char *get_system_type(void) 55const char *get_system_type(void)
39{ 56{
40 return "Broadcom BCM47XX"; 57 static char buf[50];
58 u16 chip_id = get_chip_id();
59
60 snprintf(buf, sizeof(buf),
61 (chip_id > 0x9999) ? "Broadcom BCM%d (%s)" :
62 "Broadcom BCM%04X (%s)",
63 chip_id, bcm47xx_board_get_name());
64
65 return buf;
41} 66}
42 67
43void prom_putchar(char c) 68void prom_putchar(char c)
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index b2246cd9ca12..1f30571968e7 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -36,6 +36,7 @@
36#include <asm/time.h> 36#include <asm/time.h>
37#include <bcm47xx.h> 37#include <bcm47xx.h>
38#include <bcm47xx_nvram.h> 38#include <bcm47xx_nvram.h>
39#include <bcm47xx_board.h>
39 40
40union bcm47xx_bus bcm47xx_bus; 41union bcm47xx_bus bcm47xx_bus;
41EXPORT_SYMBOL(bcm47xx_bus); 42EXPORT_SYMBOL(bcm47xx_bus);
@@ -221,6 +222,7 @@ void __init plat_mem_setup(void)
221 _machine_restart = bcm47xx_machine_restart; 222 _machine_restart = bcm47xx_machine_restart;
222 _machine_halt = bcm47xx_machine_halt; 223 _machine_halt = bcm47xx_machine_halt;
223 pm_power_off = bcm47xx_machine_halt; 224 pm_power_off = bcm47xx_machine_halt;
225 bcm47xx_board_detect();
224} 226}
225 227
226static int __init bcm47xx_register_bus_complete(void) 228static int __init bcm47xx_register_bus_complete(void)
diff --git a/arch/mips/bcm47xx/time.c b/arch/mips/bcm47xx/time.c
index 536374dcba78..2c85d9254b5e 100644
--- a/arch/mips/bcm47xx/time.c
+++ b/arch/mips/bcm47xx/time.c
@@ -27,10 +27,16 @@
27#include <linux/ssb/ssb.h> 27#include <linux/ssb/ssb.h>
28#include <asm/time.h> 28#include <asm/time.h>
29#include <bcm47xx.h> 29#include <bcm47xx.h>
30#include <bcm47xx_nvram.h>
31#include <bcm47xx_board.h>
30 32
31void __init plat_time_init(void) 33void __init plat_time_init(void)
32{ 34{
33 unsigned long hz = 0; 35 unsigned long hz = 0;
36 u16 chip_id = 0;
37 char buf[10];
38 int len;
39 enum bcm47xx_board board = bcm47xx_board_get();
34 40
35 /* 41 /*
36 * Use deterministic values for initial counter interrupt 42 * Use deterministic values for initial counter interrupt
@@ -43,15 +49,32 @@ void __init plat_time_init(void)
43#ifdef CONFIG_BCM47XX_SSB 49#ifdef CONFIG_BCM47XX_SSB
44 case BCM47XX_BUS_TYPE_SSB: 50 case BCM47XX_BUS_TYPE_SSB:
45 hz = ssb_cpu_clock(&bcm47xx_bus.ssb.mipscore) / 2; 51 hz = ssb_cpu_clock(&bcm47xx_bus.ssb.mipscore) / 2;
52 chip_id = bcm47xx_bus.ssb.chip_id;
46 break; 53 break;
47#endif 54#endif
48#ifdef CONFIG_BCM47XX_BCMA 55#ifdef CONFIG_BCM47XX_BCMA
49 case BCM47XX_BUS_TYPE_BCMA: 56 case BCM47XX_BUS_TYPE_BCMA:
50 hz = bcma_cpu_clock(&bcm47xx_bus.bcma.bus.drv_mips) / 2; 57 hz = bcma_cpu_clock(&bcm47xx_bus.bcma.bus.drv_mips) / 2;
58 chip_id = bcm47xx_bus.bcma.bus.chipinfo.id;
51 break; 59 break;
52#endif 60#endif
53 } 61 }
54 62
63 if (chip_id == 0x5354) {
64 len = bcm47xx_nvram_getenv("clkfreq", buf, sizeof(buf));
65 if (len >= 0 && !strncmp(buf, "200", 4))
66 hz = 100000000;
67 }
68
69 switch (board) {
70 case BCM47XX_BOARD_ASUS_WL520GC:
71 case BCM47XX_BOARD_ASUS_WL520GU:
72 hz = 100000000;
73 break;
74 default:
75 break;
76 }
77
55 if (!hz) 78 if (!hz)
56 hz = 100000000; 79 hz = 100000000;
57 80
diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
index 7e17374a9ae8..b713cd64b087 100644
--- a/arch/mips/bcm63xx/cpu.c
+++ b/arch/mips/bcm63xx/cpu.c
@@ -306,14 +306,14 @@ void __init bcm63xx_cpu_init(void)
306 306
307 switch (c->cputype) { 307 switch (c->cputype) {
308 case CPU_BMIPS3300: 308 case CPU_BMIPS3300:
309 if ((read_c0_prid() & 0xff00) != PRID_IMP_BMIPS3300_ALT) 309 if ((read_c0_prid() & PRID_IMP_MASK) != PRID_IMP_BMIPS3300_ALT)
310 __cpu_name[cpu] = "Broadcom BCM6338"; 310 __cpu_name[cpu] = "Broadcom BCM6338";
311 /* fall-through */ 311 /* fall-through */
312 case CPU_BMIPS32: 312 case CPU_BMIPS32:
313 chipid_reg = BCM_6345_PERF_BASE; 313 chipid_reg = BCM_6345_PERF_BASE;
314 break; 314 break;
315 case CPU_BMIPS4350: 315 case CPU_BMIPS4350:
316 switch ((read_c0_prid() & 0xff)) { 316 switch ((read_c0_prid() & PRID_REV_MASK)) {
317 case 0x04: 317 case 0x04:
318 chipid_reg = BCM_3368_PERF_BASE; 318 chipid_reg = BCM_3368_PERF_BASE;
319 break; 319 break;
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index 0048c0897896..ca0c343c9ea5 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -37,6 +37,10 @@ vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
37vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o 37vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o
38endif 38endif
39 39
40ifdef CONFIG_KERNEL_XZ
41vmlinuzobjs-y += $(obj)/../../lib/ashldi3.o
42endif
43
40targets += vmlinux.bin 44targets += vmlinux.bin
41OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S 45OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S
42$(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE 46$(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE
@@ -44,8 +48,10 @@ $(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE
44 48
45tool_$(CONFIG_KERNEL_GZIP) = gzip 49tool_$(CONFIG_KERNEL_GZIP) = gzip
46tool_$(CONFIG_KERNEL_BZIP2) = bzip2 50tool_$(CONFIG_KERNEL_BZIP2) = bzip2
51tool_$(CONFIG_KERNEL_LZ4) = lz4
47tool_$(CONFIG_KERNEL_LZMA) = lzma 52tool_$(CONFIG_KERNEL_LZMA) = lzma
48tool_$(CONFIG_KERNEL_LZO) = lzo 53tool_$(CONFIG_KERNEL_LZO) = lzo
54tool_$(CONFIG_KERNEL_XZ) = xzkern
49 55
50targets += vmlinux.bin.z 56targets += vmlinux.bin.z
51$(obj)/vmlinux.bin.z: $(obj)/vmlinux.bin FORCE 57$(obj)/vmlinux.bin.z: $(obj)/vmlinux.bin FORCE
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
index 2c9573098c0d..a8c6fd6a4406 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -43,7 +43,8 @@ void error(char *x)
43/* activate the code for pre-boot environment */ 43/* activate the code for pre-boot environment */
44#define STATIC static 44#define STATIC static
45 45
46#ifdef CONFIG_KERNEL_GZIP 46#if defined(CONFIG_KERNEL_GZIP) || defined(CONFIG_KERNEL_XZ) || \
47 defined(CONFIG_KERNEL_LZ4)
47void *memcpy(void *dest, const void *src, size_t n) 48void *memcpy(void *dest, const void *src, size_t n)
48{ 49{
49 int i; 50 int i;
@@ -54,6 +55,8 @@ void *memcpy(void *dest, const void *src, size_t n)
54 d[i] = s[i]; 55 d[i] = s[i];
55 return dest; 56 return dest;
56} 57}
58#endif
59#ifdef CONFIG_KERNEL_GZIP
57#include "../../../../lib/decompress_inflate.c" 60#include "../../../../lib/decompress_inflate.c"
58#endif 61#endif
59 62
@@ -70,6 +73,10 @@ void *memset(void *s, int c, size_t n)
70#include "../../../../lib/decompress_bunzip2.c" 73#include "../../../../lib/decompress_bunzip2.c"
71#endif 74#endif
72 75
76#ifdef CONFIG_KERNEL_LZ4
77#include "../../../../lib/decompress_unlz4.c"
78#endif
79
73#ifdef CONFIG_KERNEL_LZMA 80#ifdef CONFIG_KERNEL_LZMA
74#include "../../../../lib/decompress_unlzma.c" 81#include "../../../../lib/decompress_unlzma.c"
75#endif 82#endif
@@ -78,6 +85,10 @@ void *memset(void *s, int c, size_t n)
78#include "../../../../lib/decompress_unlzo.c" 85#include "../../../../lib/decompress_unlzo.c"
79#endif 86#endif
80 87
88#ifdef CONFIG_KERNEL_XZ
89#include "../../../../lib/decompress_unxz.c"
90#endif
91
81void decompress_kernel(unsigned long boot_heap_start) 92void decompress_kernel(unsigned long boot_heap_start)
82{ 93{
83 unsigned long zimage_start, zimage_size; 94 unsigned long zimage_start, zimage_size;
diff --git a/arch/mips/boot/compressed/ld.script b/arch/mips/boot/compressed/ld.script
index 8e6b07ca2f5e..5a33409c7f63 100644
--- a/arch/mips/boot/compressed/ld.script
+++ b/arch/mips/boot/compressed/ld.script
@@ -8,6 +8,9 @@
8 8
9OUTPUT_ARCH(mips) 9OUTPUT_ARCH(mips)
10ENTRY(start) 10ENTRY(start)
11PHDRS {
12 text PT_LOAD FLAGS(7); /* RWX */
13}
11SECTIONS 14SECTIONS
12{ 15{
13 /* Text and read-only data */ 16 /* Text and read-only data */
@@ -15,7 +18,7 @@ SECTIONS
15 .text : { 18 .text : {
16 *(.text) 19 *(.text)
17 *(.rodata) 20 *(.rodata)
18 } 21 }: text
19 /* End of text section */ 22 /* End of text section */
20 23
21 /* Writable data */ 24 /* Writable data */
diff --git a/arch/mips/boot/dts/include/dt-bindings b/arch/mips/boot/dts/include/dt-bindings
index 68ae3887b3e5..08c00e4972fa 120000
--- a/arch/mips/boot/dts/include/dt-bindings
+++ b/arch/mips/boot/dts/include/dt-bindings
@@ -1 +1 @@
../../../../../include/dt-bindings ../../../../../include/dt-bindings \ No newline at end of file
diff --git a/arch/mips/boot/ecoff.h b/arch/mips/boot/ecoff.h
index 83e5c3813d67..7a75ce2c1bcd 100644
--- a/arch/mips/boot/ecoff.h
+++ b/arch/mips/boot/ecoff.h
@@ -12,7 +12,6 @@ typedef struct filehdr {
12} FILHDR; 12} FILHDR;
13#define FILHSZ sizeof(FILHDR) 13#define FILHSZ sizeof(FILHDR)
14 14
15#define OMAGIC 0407
16#define MIPSEBMAGIC 0x160 15#define MIPSEBMAGIC 0x160
17#define MIPSELMAGIC 0x162 16#define MIPSELMAGIC 0x162
18 17
diff --git a/arch/mips/cavium-octeon/csrc-octeon.c b/arch/mips/cavium-octeon/csrc-octeon.c
index 02193953eb9e..b752c4ed0b79 100644
--- a/arch/mips/cavium-octeon/csrc-octeon.c
+++ b/arch/mips/cavium-octeon/csrc-octeon.c
@@ -12,6 +12,7 @@
12#include <linux/smp.h> 12#include <linux/smp.h>
13 13
14#include <asm/cpu-info.h> 14#include <asm/cpu-info.h>
15#include <asm/cpu-type.h>
15#include <asm/time.h> 16#include <asm/time.h>
16 17
17#include <asm/octeon/octeon.h> 18#include <asm/octeon/octeon.h>
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index b212ae12e5ac..331b837cec57 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -999,7 +999,7 @@ void __init plat_mem_setup(void)
999 999
1000 if (total == 0) 1000 if (total == 0)
1001 panic("Unable to allocate memory from " 1001 panic("Unable to allocate memory from "
1002 "cvmx_bootmem_phy_alloc\n"); 1002 "cvmx_bootmem_phy_alloc");
1003} 1003}
1004 1004
1005/* 1005/*
@@ -1081,7 +1081,7 @@ void __init device_tree_init(void)
1081 /* Copy the default tree from init memory. */ 1081 /* Copy the default tree from init memory. */
1082 initial_boot_params = early_init_dt_alloc_memory_arch(dt_size, 8); 1082 initial_boot_params = early_init_dt_alloc_memory_arch(dt_size, 8);
1083 if (initial_boot_params == NULL) 1083 if (initial_boot_params == NULL)
1084 panic("Could not allocate initial_boot_params\n"); 1084 panic("Could not allocate initial_boot_params");
1085 memcpy(initial_boot_params, fdt, dt_size); 1085 memcpy(initial_boot_params, fdt, dt_size);
1086 1086
1087 if (do_prune) { 1087 if (do_prune) {
diff --git a/arch/mips/cobalt/Makefile b/arch/mips/cobalt/Makefile
index 61a334ac43ac..558e94977942 100644
--- a/arch/mips/cobalt/Makefile
+++ b/arch/mips/cobalt/Makefile
@@ -5,5 +5,4 @@
5obj-y := buttons.o irq.o lcd.o led.o reset.o rtc.o serial.o setup.o time.o 5obj-y := buttons.o irq.o lcd.o led.o reset.o rtc.o serial.o setup.o time.o
6 6
7obj-$(CONFIG_PCI) += pci.o 7obj-$(CONFIG_PCI) += pci.o
8obj-$(CONFIG_EARLY_PRINTK) += console.o
9obj-$(CONFIG_MTD_PHYSMAP) += mtd.o 8obj-$(CONFIG_MTD_PHYSMAP) += mtd.o
diff --git a/arch/mips/cobalt/console.c b/arch/mips/cobalt/console.c
deleted file mode 100644
index d1ba701c9dd1..000000000000
--- a/arch/mips/cobalt/console.c
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * (C) P. Horton 2006
3 */
4#include <linux/io.h>
5#include <linux/serial_reg.h>
6
7#include <cobalt.h>
8
9#define UART_BASE ((void __iomem *)CKSEG1ADDR(0x1c800000))
10
11void prom_putchar(char c)
12{
13 if (cobalt_board_id <= COBALT_BRD_ID_QUBE1)
14 return;
15
16 while (!(readb(UART_BASE + UART_LSR) & UART_LSR_THRE))
17 ;
18
19 writeb(c, UART_BASE + UART_TX);
20}
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
index ec3b2c417f7c..9a8c2fe8d334 100644
--- a/arch/mips/cobalt/setup.c
+++ b/arch/mips/cobalt/setup.c
@@ -17,6 +17,7 @@
17 17
18#include <asm/bootinfo.h> 18#include <asm/bootinfo.h>
19#include <asm/reboot.h> 19#include <asm/reboot.h>
20#include <asm/setup.h>
20#include <asm/gt64120.h> 21#include <asm/gt64120.h>
21 22
22#include <cobalt.h> 23#include <cobalt.h>
@@ -112,6 +113,8 @@ void __init prom_init(void)
112 } 113 }
113 114
114 add_memory_region(0x0, memsz, BOOT_MEM_RAM); 115 add_memory_region(0x0, memsz, BOOT_MEM_RAM);
116
117 setup_8250_early_printk_port(CKSEG1ADDR(0x1c800000), 0, 0);
115} 118}
116 119
117void __init prom_free_prom_memory(void) 120void __init prom_free_prom_memory(void)
diff --git a/arch/mips/configs/powertv_defconfig b/arch/mips/configs/powertv_defconfig
deleted file mode 100644
index 7fda0ce5f692..000000000000
--- a/arch/mips/configs/powertv_defconfig
+++ /dev/null
@@ -1,136 +0,0 @@
1CONFIG_POWERTV=y
2CONFIG_BOOTLOADER_FAMILY="R2"
3CONFIG_NO_HZ=y
4CONFIG_HIGH_RES_TIMERS=y
5CONFIG_HZ_1000=y
6CONFIG_PREEMPT=y
7# CONFIG_SECCOMP is not set
8CONFIG_EXPERIMENTAL=y
9CONFIG_CROSS_COMPILE=""
10# CONFIG_SWAP is not set
11CONFIG_SYSVIPC=y
12CONFIG_LOG_BUF_SHIFT=16
13CONFIG_RELAY=y
14CONFIG_BLK_DEV_INITRD=y
15# CONFIG_RD_GZIP is not set
16# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
17CONFIG_EXPERT=y
18# CONFIG_SYSCTL_SYSCALL is not set
19CONFIG_KALLSYMS_ALL=y
20# CONFIG_PCSPKR_PLATFORM is not set
21# CONFIG_EPOLL is not set
22# CONFIG_SIGNALFD is not set
23# CONFIG_EVENTFD is not set
24# CONFIG_VM_EVENT_COUNTERS is not set
25# CONFIG_SLUB_DEBUG is not set
26CONFIG_MODULES=y
27CONFIG_MODULE_UNLOAD=y
28CONFIG_MODVERSIONS=y
29CONFIG_MODULE_SRCVERSION_ALL=y
30# CONFIG_BLK_DEV_BSG is not set
31# CONFIG_IOSCHED_DEADLINE is not set
32# CONFIG_IOSCHED_CFQ is not set
33CONFIG_PCI=y
34CONFIG_NET=y
35CONFIG_PACKET=y
36CONFIG_UNIX=y
37CONFIG_INET=y
38CONFIG_IP_MULTICAST=y
39CONFIG_IP_ADVANCED_ROUTER=y
40CONFIG_IP_PNP=y
41CONFIG_SYN_COOKIES=y
42# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
43# CONFIG_INET_XFRM_MODE_TUNNEL is not set
44# CONFIG_INET_XFRM_MODE_BEET is not set
45# CONFIG_INET_LRO is not set
46# CONFIG_INET_DIAG is not set
47CONFIG_IPV6=y
48CONFIG_IPV6_PRIVACY=y
49CONFIG_INET6_AH=y
50CONFIG_INET6_ESP=y
51CONFIG_INET6_IPCOMP=y
52# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
53# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
54# CONFIG_INET6_XFRM_MODE_BEET is not set
55# CONFIG_IPV6_SIT is not set
56CONFIG_IPV6_TUNNEL=y
57CONFIG_NETFILTER=y
58# CONFIG_BRIDGE_NETFILTER is not set
59CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
60CONFIG_IP_NF_IPTABLES=y
61CONFIG_IP_NF_FILTER=y
62CONFIG_IP_NF_ARPTABLES=y
63CONFIG_IP_NF_ARPFILTER=y
64CONFIG_IP6_NF_IPTABLES=y
65CONFIG_IP6_NF_FILTER=y
66CONFIG_BRIDGE=y
67CONFIG_NET_SCHED=y
68CONFIG_NET_SCH_TBF=y
69CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
70CONFIG_MTD=y
71CONFIG_MTD_PARTITIONS=y
72CONFIG_MTD_CMDLINE_PARTS=y
73CONFIG_MTD_CHAR=y
74CONFIG_MTD_BLOCK=y
75CONFIG_MTD_NAND=y
76CONFIG_BLK_DEV_LOOP=y
77CONFIG_BLK_DEV_RAM=y
78CONFIG_BLK_DEV_RAM_SIZE=32768
79# CONFIG_MISC_DEVICES is not set
80# CONFIG_SCSI_PROC_FS is not set
81CONFIG_BLK_DEV_SD=y
82# CONFIG_SCSI_LOWLEVEL is not set
83CONFIG_ATA=y
84CONFIG_NETDEVICES=y
85CONFIG_NET_ETHERNET=y
86# CONFIG_WLAN is not set
87CONFIG_USB_RTL8150=y
88# CONFIG_INPUT_MOUSEDEV is not set
89CONFIG_INPUT_EVDEV=y
90# CONFIG_INPUT_KEYBOARD is not set
91# CONFIG_INPUT_MOUSE is not set
92# CONFIG_SERIO is not set
93# CONFIG_VT is not set
94# CONFIG_DEVKMEM is not set
95# CONFIG_LEGACY_PTYS is not set
96# CONFIG_HW_RANDOM is not set
97# CONFIG_HWMON is not set
98# CONFIG_MFD_SUPPORT is not set
99# CONFIG_VGA_ARB is not set
100CONFIG_USB_HIDDEV=y
101CONFIG_USB=y
102CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
103CONFIG_USB_DEVICEFS=y
104# CONFIG_USB_DEVICE_CLASS is not set
105CONFIG_USB_EHCI_HCD=y
106# CONFIG_USB_EHCI_TT_NEWSCHED is not set
107CONFIG_USB_OHCI_HCD=y
108CONFIG_USB_STORAGE=y
109CONFIG_USB_SERIAL=y
110CONFIG_USB_SERIAL_CONSOLE=y
111CONFIG_USB_SERIAL_CP210X=y
112CONFIG_EXT2_FS=y
113CONFIG_EXT3_FS=y
114# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
115# CONFIG_EXT3_FS_XATTR is not set
116# CONFIG_DNOTIFY is not set
117CONFIG_FUSE_FS=y
118CONFIG_PROC_KCORE=y
119CONFIG_TMPFS=y
120CONFIG_JFFS2_FS=y
121CONFIG_CRAMFS=y
122CONFIG_NFS_FS=y
123CONFIG_NFS_V3=y
124CONFIG_ROOT_NFS=y
125CONFIG_PRINTK_TIME=y
126CONFIG_DEBUG_FS=y
127CONFIG_DEBUG_KERNEL=y
128CONFIG_DETECT_HUNG_TASK=y
129# CONFIG_SCHED_DEBUG is not set
130# CONFIG_DEBUG_PREEMPT is not set
131CONFIG_DEBUG_INFO=y
132# CONFIG_RCU_CPU_STALL_DETECTOR is not set
133# CONFIG_EARLY_PRINTK is not set
134CONFIG_CMDLINE_BOOL=y
135# CONFIG_CRYPTO_ANSI_CPRNG is not set
136# CONFIG_CRYPTO_HW is not set
diff --git a/arch/mips/dec/int-handler.S b/arch/mips/dec/int-handler.S
index 22afed16ccde..41a2fa1fa12e 100644
--- a/arch/mips/dec/int-handler.S
+++ b/arch/mips/dec/int-handler.S
@@ -118,7 +118,7 @@
118 * 7 FPU/R4k timer 118 * 7 FPU/R4k timer
119 * 119 *
120 * We handle the IRQ according to _our_ priority (see setup.c), 120 * We handle the IRQ according to _our_ priority (see setup.c),
121 * then we just return. If multiple IRQs are pending then we will 121 * then we just return. If multiple IRQs are pending then we will
122 * just take another exception, big deal. 122 * just take another exception, big deal.
123 */ 123 */
124 .align 5 124 .align 5
@@ -146,7 +146,7 @@
146 /* 146 /*
147 * Find irq with highest priority 147 * Find irq with highest priority
148 */ 148 */
149 PTR_LA t1,cpu_mask_nr_tbl 149 PTR_LA t1,cpu_mask_nr_tbl
1501: lw t2,(t1) 1501: lw t2,(t1)
151 nop 151 nop
152 and t2,t0 152 and t2,t0
@@ -195,7 +195,7 @@
195 /* 195 /*
196 * Find irq with highest priority 196 * Find irq with highest priority
197 */ 197 */
198 PTR_LA t1,asic_mask_nr_tbl 198 PTR_LA t1,asic_mask_nr_tbl
1992: lw t2,(t1) 1992: lw t2,(t1)
200 nop 200 nop
201 and t2,t0 201 and t2,t0
@@ -221,7 +221,7 @@
221 FEXPORT(cpu_all_int) # HALT, timers, software junk 221 FEXPORT(cpu_all_int) # HALT, timers, software junk
222 li a0,DEC_CPU_IRQ_BASE 222 li a0,DEC_CPU_IRQ_BASE
223 srl t0,CAUSEB_IP 223 srl t0,CAUSEB_IP
224 li t1,CAUSEF_IP>>CAUSEB_IP # mask 224 li t1,CAUSEF_IP>>CAUSEB_IP # mask
225 b 1f 225 b 1f
226 li t2,4 # nr of bits / 2 226 li t2,4 # nr of bits / 2
227 227
diff --git a/arch/mips/dec/ioasic-irq.c b/arch/mips/dec/ioasic-irq.c
index 4b3e3a4375a6..e04d973ce5aa 100644
--- a/arch/mips/dec/ioasic-irq.c
+++ b/arch/mips/dec/ioasic-irq.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * DEC I/O ASIC interrupts. 2 * DEC I/O ASIC interrupts.
3 * 3 *
4 * Copyright (c) 2002, 2003 Maciej W. Rozycki 4 * Copyright (c) 2002, 2003, 2013 Maciej W. Rozycki
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
@@ -51,22 +51,51 @@ static struct irq_chip ioasic_irq_type = {
51 .irq_unmask = unmask_ioasic_irq, 51 .irq_unmask = unmask_ioasic_irq,
52}; 52};
53 53
54void clear_ioasic_dma_irq(unsigned int irq) 54static void clear_ioasic_dma_irq(struct irq_data *d)
55{ 55{
56 u32 sir; 56 u32 sir;
57 57
58 sir = ~(1 << (irq - ioasic_irq_base)); 58 sir = ~(1 << (d->irq - ioasic_irq_base));
59 ioasic_write(IO_REG_SIR, sir); 59 ioasic_write(IO_REG_SIR, sir);
60 fast_iob();
60} 61}
61 62
62static struct irq_chip ioasic_dma_irq_type = { 63static struct irq_chip ioasic_dma_irq_type = {
63 .name = "IO-ASIC-DMA", 64 .name = "IO-ASIC-DMA",
64 .irq_ack = ack_ioasic_irq, 65 .irq_ack = clear_ioasic_dma_irq,
65 .irq_mask = mask_ioasic_irq, 66 .irq_mask = mask_ioasic_irq,
66 .irq_mask_ack = ack_ioasic_irq,
67 .irq_unmask = unmask_ioasic_irq, 67 .irq_unmask = unmask_ioasic_irq,
68 .irq_eoi = clear_ioasic_dma_irq,
68}; 69};
69 70
71/*
72 * I/O ASIC implements two kinds of DMA interrupts, informational and
73 * error interrupts.
74 *
75 * The formers do not stop DMA and should be cleared as soon as possible
76 * so that if they retrigger before the handler has completed, usually as
77 * a side effect of actions taken by the handler, then they are reissued.
78 * These use the `handle_edge_irq' handler that clears the request right
79 * away.
80 *
81 * The latters stop DMA and do not resume it until the interrupt has been
82 * cleared. This cannot be done until after a corrective action has been
83 * taken and this also means they will not retrigger. Therefore they use
84 * the `handle_fasteoi_irq' handler that only clears the request on the
85 * way out. Because MIPS processor interrupt inputs, one of which the I/O
86 * ASIC is cascaded to, are level-triggered it is recommended that error
87 * DMA interrupt action handlers are registered with the IRQF_ONESHOT flag
88 * set so that they are run with the interrupt line masked.
89 *
90 * This mask has `1' bits in the positions of informational interrupts.
91 */
92#define IO_IRQ_DMA_INFO \
93 (IO_IRQ_MASK(IO_INR_SCC0A_RXDMA) | \
94 IO_IRQ_MASK(IO_INR_SCC1A_RXDMA) | \
95 IO_IRQ_MASK(IO_INR_ISDN_TXDMA) | \
96 IO_IRQ_MASK(IO_INR_ISDN_RXDMA) | \
97 IO_IRQ_MASK(IO_INR_ASC_DMA))
98
70void __init init_ioasic_irqs(int base) 99void __init init_ioasic_irqs(int base)
71{ 100{
72 int i; 101 int i;
@@ -79,7 +108,9 @@ void __init init_ioasic_irqs(int base)
79 irq_set_chip_and_handler(i, &ioasic_irq_type, 108 irq_set_chip_and_handler(i, &ioasic_irq_type,
80 handle_level_irq); 109 handle_level_irq);
81 for (; i < base + IO_IRQ_LINES; i++) 110 for (; i < base + IO_IRQ_LINES; i++)
82 irq_set_chip(i, &ioasic_dma_irq_type); 111 irq_set_chip_and_handler(i, &ioasic_dma_irq_type,
112 1 << (i - base) & IO_IRQ_DMA_INFO ?
113 handle_edge_irq : handle_fasteoi_irq);
83 114
84 ioasic_irq_base = base; 115 ioasic_irq_base = base;
85} 116}
diff --git a/arch/mips/dec/prom/call_o32.S b/arch/mips/dec/prom/call_o32.S
index c0d1522d448f..8c8498159e43 100644
--- a/arch/mips/dec/prom/call_o32.S
+++ b/arch/mips/dec/prom/call_o32.S
@@ -14,7 +14,7 @@
14 14
15/* Maximum number of arguments supported. Must be even! */ 15/* Maximum number of arguments supported. Must be even! */
16#define O32_ARGC 32 16#define O32_ARGC 32
17/* Number of static registers we save. */ 17/* Number of static registers we save. */
18#define O32_STATC 11 18#define O32_STATC 11
19/* Frame size for both of the above. */ 19/* Frame size for both of the above. */
20#define O32_FRAMESZ (4 * O32_ARGC + SZREG * O32_STATC) 20#define O32_FRAMESZ (4 * O32_ARGC + SZREG * O32_STATC)
diff --git a/arch/mips/dec/prom/init.c b/arch/mips/dec/prom/init.c
index ab169046e442..4e1761e0a09a 100644
--- a/arch/mips/dec/prom/init.c
+++ b/arch/mips/dec/prom/init.c
@@ -13,6 +13,7 @@
13 13
14#include <asm/bootinfo.h> 14#include <asm/bootinfo.h>
15#include <asm/cpu.h> 15#include <asm/cpu.h>
16#include <asm/cpu-type.h>
16#include <asm/processor.h> 17#include <asm/processor.h>
17 18
18#include <asm/dec/prom.h> 19#include <asm/dec/prom.h>
@@ -103,7 +104,7 @@ void __init prom_init(void)
103 if (prom_is_rex(magic)) 104 if (prom_is_rex(magic))
104 rex_clear_cache(); 105 rex_clear_cache();
105 106
106 /* Register the early console. */ 107 /* Register the early console. */
107 register_prom_console(); 108 register_prom_console();
108 109
109 /* Were we compiled with the right CPU option? */ 110 /* Were we compiled with the right CPU option? */
diff --git a/arch/mips/dec/prom/memory.c b/arch/mips/dec/prom/memory.c
index 0aadac742900..8c62316f22f4 100644
--- a/arch/mips/dec/prom/memory.c
+++ b/arch/mips/dec/prom/memory.c
@@ -22,7 +22,7 @@ volatile unsigned long mem_err; /* So we know an error occurred */
22 22
23/* 23/*
24 * Probe memory in 4MB chunks, waiting for an error to tell us we've fallen 24 * Probe memory in 4MB chunks, waiting for an error to tell us we've fallen
25 * off the end of real memory. Only suitable for the 2100/3100's (PMAX). 25 * off the end of real memory. Only suitable for the 2100/3100's (PMAX).
26 */ 26 */
27 27
28#define CHUNK_SIZE 0x400000 28#define CHUNK_SIZE 0x400000
diff --git a/arch/mips/dec/setup.c b/arch/mips/dec/setup.c
index 741cb4235bde..56e6e2c23683 100644
--- a/arch/mips/dec/setup.c
+++ b/arch/mips/dec/setup.c
@@ -65,7 +65,7 @@ EXPORT_SYMBOL(ioasic_base);
65/* 65/*
66 * IRQ routing and priority tables. Priorites are set as follows: 66 * IRQ routing and priority tables. Priorites are set as follows:
67 * 67 *
68 * KN01 KN230 KN02 KN02-BA KN02-CA KN03 68 * KN01 KN230 KN02 KN02-BA KN02-CA KN03
69 * 69 *
70 * MEMORY CPU CPU CPU ASIC CPU CPU 70 * MEMORY CPU CPU CPU ASIC CPU CPU
71 * RTC CPU CPU CPU ASIC CPU CPU 71 * RTC CPU CPU CPU ASIC CPU CPU
@@ -413,7 +413,7 @@ static void __init dec_init_kn02(void)
413 413
414/* 414/*
415 * Machine-specific initialisation for KN02-BA, aka DS5000/1xx 415 * Machine-specific initialisation for KN02-BA, aka DS5000/1xx
416 * (xx = 20, 25, 33), aka 3min. Also applies to KN04(-BA), aka 416 * (xx = 20, 25, 33), aka 3min. Also applies to KN04(-BA), aka
417 * DS5000/150, aka 4min. 417 * DS5000/150, aka 4min.
418 */ 418 */
419static int kn02ba_interrupt[DEC_NR_INTS] __initdata = { 419static int kn02ba_interrupt[DEC_NR_INTS] __initdata = {
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index 454ddf9bb76f..1acbb8b77a71 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -11,5 +11,6 @@ generic-y += sections.h
11generic-y += segment.h 11generic-y += segment.h
12generic-y += serial.h 12generic-y += serial.h
13generic-y += trace_clock.h 13generic-y += trace_clock.h
14generic-y += preempt.h
14generic-y += ucontext.h 15generic-y += ucontext.h
15generic-y += xor.h 16generic-y += xor.h
diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h
index 13d61c002e4f..3f745459fdb5 100644
--- a/arch/mips/include/asm/addrspace.h
+++ b/arch/mips/include/asm/addrspace.h
@@ -58,7 +58,7 @@
58 58
59/* 59/*
60 * Memory segments (64bit kernel mode addresses) 60 * Memory segments (64bit kernel mode addresses)
61 * The compatibility segments use the full 64-bit sign extended value. Note 61 * The compatibility segments use the full 64-bit sign extended value. Note
62 * the R8000 doesn't have them so don't reference these in generic MIPS code. 62 * the R8000 doesn't have them so don't reference these in generic MIPS code.
63 */ 63 */
64#define XKUSEG _CONST64_(0x0000000000000000) 64#define XKUSEG _CONST64_(0x0000000000000000)
@@ -131,7 +131,7 @@
131 131
132/* 132/*
133 * The ultimate limited of the 64-bit MIPS architecture: 2 bits for selecting 133 * The ultimate limited of the 64-bit MIPS architecture: 2 bits for selecting
134 * the region, 3 bits for the CCA mode. This leaves 59 bits of which the 134 * the region, 3 bits for the CCA mode. This leaves 59 bits of which the
135 * R8000 implements most with its 48-bit physical address space. 135 * R8000 implements most with its 48-bit physical address space.
136 */ 136 */
137#define TO_PHYS_MASK _CONST64_(0x07ffffffffffffff) /* 2^^59 - 1 */ 137#define TO_PHYS_MASK _CONST64_(0x07ffffffffffffff) /* 2^^59 - 1 */
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h
index 08b607969a16..7eed2f261710 100644
--- a/arch/mips/include/asm/atomic.h
+++ b/arch/mips/include/asm/atomic.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Atomic operations that C can't guarantee us. Useful for 2 * Atomic operations that C can't guarantee us. Useful for
3 * resource counting etc.. 3 * resource counting etc..
4 * 4 *
5 * But use these as seldom as possible since they are much more slower 5 * But use these as seldom as possible since they are much more slower
diff --git a/arch/mips/include/asm/barrier.h b/arch/mips/include/asm/barrier.h
index 314ab5532019..f26d8e1bf3c3 100644
--- a/arch/mips/include/asm/barrier.h
+++ b/arch/mips/include/asm/barrier.h
@@ -18,7 +18,7 @@
18 * over this barrier. All reads preceding this primitive are guaranteed 18 * over this barrier. All reads preceding this primitive are guaranteed
19 * to access memory (but not necessarily other CPUs' caches) before any 19 * to access memory (but not necessarily other CPUs' caches) before any
20 * reads following this primitive that depend on the data return by 20 * reads following this primitive that depend on the data return by
21 * any of the preceding reads. This primitive is much lighter weight than 21 * any of the preceding reads. This primitive is much lighter weight than
22 * rmb() on most CPUs, and is never heavier weight than is 22 * rmb() on most CPUs, and is never heavier weight than is
23 * rmb(). 23 * rmb().
24 * 24 *
@@ -43,7 +43,7 @@
43 * </programlisting> 43 * </programlisting>
44 * 44 *
45 * because the read of "*q" depends on the read of "p" and these 45 * because the read of "*q" depends on the read of "p" and these
46 * two reads are separated by a read_barrier_depends(). However, 46 * two reads are separated by a read_barrier_depends(). However,
47 * the following code, with the same initial values for "a" and "b": 47 * the following code, with the same initial values for "a" and "b":
48 * 48 *
49 * <programlisting> 49 * <programlisting>
@@ -57,7 +57,7 @@
57 * </programlisting> 57 * </programlisting>
58 * 58 *
59 * does not enforce ordering, since there is no data dependency between 59 * does not enforce ordering, since there is no data dependency between
60 * the read of "a" and the read of "b". Therefore, on some CPUs, such 60 * the read of "a" and the read of "b". Therefore, on some CPUs, such
61 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb() 61 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb()
62 * in cases like this where there are no data dependencies. 62 * in cases like this where there are no data dependencies.
63 */ 63 */
diff --git a/arch/mips/include/asm/cacheops.h b/arch/mips/include/asm/cacheops.h
index 68f37e3eccc7..c75025f27c20 100644
--- a/arch/mips/include/asm/cacheops.h
+++ b/arch/mips/include/asm/cacheops.h
@@ -14,56 +14,52 @@
14/* 14/*
15 * Cache Operations available on all MIPS processors with R4000-style caches 15 * Cache Operations available on all MIPS processors with R4000-style caches
16 */ 16 */
17#define Index_Invalidate_I 0x00 17#define Index_Invalidate_I 0x00
18#define Index_Writeback_Inv_D 0x01 18#define Index_Writeback_Inv_D 0x01
19#define Index_Load_Tag_I 0x04 19#define Index_Load_Tag_I 0x04
20#define Index_Load_Tag_D 0x05 20#define Index_Load_Tag_D 0x05
21#define Index_Store_Tag_I 0x08 21#define Index_Store_Tag_I 0x08
22#define Index_Store_Tag_D 0x09 22#define Index_Store_Tag_D 0x09
23#if defined(CONFIG_CPU_LOONGSON2) 23#define Hit_Invalidate_I 0x10
24#define Hit_Invalidate_I 0x00 24#define Hit_Invalidate_D 0x11
25#else 25#define Hit_Writeback_Inv_D 0x15
26#define Hit_Invalidate_I 0x10
27#endif
28#define Hit_Invalidate_D 0x11
29#define Hit_Writeback_Inv_D 0x15
30 26
31/* 27/*
32 * R4000-specific cacheops 28 * R4000-specific cacheops
33 */ 29 */
34#define Create_Dirty_Excl_D 0x0d 30#define Create_Dirty_Excl_D 0x0d
35#define Fill 0x14 31#define Fill 0x14
36#define Hit_Writeback_I 0x18 32#define Hit_Writeback_I 0x18
37#define Hit_Writeback_D 0x19 33#define Hit_Writeback_D 0x19
38 34
39/* 35/*
40 * R4000SC and R4400SC-specific cacheops 36 * R4000SC and R4400SC-specific cacheops
41 */ 37 */
42#define Index_Invalidate_SI 0x02 38#define Index_Invalidate_SI 0x02
43#define Index_Writeback_Inv_SD 0x03 39#define Index_Writeback_Inv_SD 0x03
44#define Index_Load_Tag_SI 0x06 40#define Index_Load_Tag_SI 0x06
45#define Index_Load_Tag_SD 0x07 41#define Index_Load_Tag_SD 0x07
46#define Index_Store_Tag_SI 0x0A 42#define Index_Store_Tag_SI 0x0A
47#define Index_Store_Tag_SD 0x0B 43#define Index_Store_Tag_SD 0x0B
48#define Create_Dirty_Excl_SD 0x0f 44#define Create_Dirty_Excl_SD 0x0f
49#define Hit_Invalidate_SI 0x12 45#define Hit_Invalidate_SI 0x12
50#define Hit_Invalidate_SD 0x13 46#define Hit_Invalidate_SD 0x13
51#define Hit_Writeback_Inv_SD 0x17 47#define Hit_Writeback_Inv_SD 0x17
52#define Hit_Writeback_SD 0x1b 48#define Hit_Writeback_SD 0x1b
53#define Hit_Set_Virtual_SI 0x1e 49#define Hit_Set_Virtual_SI 0x1e
54#define Hit_Set_Virtual_SD 0x1f 50#define Hit_Set_Virtual_SD 0x1f
55 51
56/* 52/*
57 * R5000-specific cacheops 53 * R5000-specific cacheops
58 */ 54 */
59#define R5K_Page_Invalidate_S 0x17 55#define R5K_Page_Invalidate_S 0x17
60 56
61/* 57/*
62 * RM7000-specific cacheops 58 * RM7000-specific cacheops
63 */ 59 */
64#define Page_Invalidate_T 0x16 60#define Page_Invalidate_T 0x16
65#define Index_Store_Tag_T 0x0a 61#define Index_Store_Tag_T 0x0a
66#define Index_Load_Tag_T 0x06 62#define Index_Load_Tag_T 0x06
67 63
68/* 64/*
69 * R10000-specific cacheops 65 * R10000-specific cacheops
@@ -71,17 +67,22 @@
71 * Cacheops 0x02, 0x06, 0x0a, 0x0c-0x0e, 0x16, 0x1a and 0x1e are unused. 67 * Cacheops 0x02, 0x06, 0x0a, 0x0c-0x0e, 0x16, 0x1a and 0x1e are unused.
72 * Most of the _S cacheops are identical to the R4000SC _SD cacheops. 68 * Most of the _S cacheops are identical to the R4000SC _SD cacheops.
73 */ 69 */
74#define Index_Writeback_Inv_S 0x03 70#define Index_Writeback_Inv_S 0x03
75#define Index_Load_Tag_S 0x07 71#define Index_Load_Tag_S 0x07
76#define Index_Store_Tag_S 0x0B 72#define Index_Store_Tag_S 0x0B
77#define Hit_Invalidate_S 0x13 73#define Hit_Invalidate_S 0x13
78#define Cache_Barrier 0x14 74#define Cache_Barrier 0x14
79#define Hit_Writeback_Inv_S 0x17 75#define Hit_Writeback_Inv_S 0x17
80#define Index_Load_Data_I 0x18 76#define Index_Load_Data_I 0x18
81#define Index_Load_Data_D 0x19 77#define Index_Load_Data_D 0x19
82#define Index_Load_Data_S 0x1b 78#define Index_Load_Data_S 0x1b
83#define Index_Store_Data_I 0x1c 79#define Index_Store_Data_I 0x1c
84#define Index_Store_Data_D 0x1d 80#define Index_Store_Data_D 0x1d
85#define Index_Store_Data_S 0x1f 81#define Index_Store_Data_S 0x1f
82
83/*
84 * Loongson2-specific cacheops
85 */
86#define Hit_Invalidate_I_Loongson23 0x00
86 87
87#endif /* __ASM_CACHEOPS_H */ 88#endif /* __ASM_CACHEOPS_H */
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index fa44f3ec5302..d445d060e346 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -13,12 +13,6 @@
13#include <asm/cpu-info.h> 13#include <asm/cpu-info.h>
14#include <cpu-feature-overrides.h> 14#include <cpu-feature-overrides.h>
15 15
16#ifndef current_cpu_type
17#define current_cpu_type() current_cpu_data.cputype
18#endif
19
20#define boot_cpu_type() cpu_data[0].cputype
21
22/* 16/*
23 * SMP assumption: Options of CPU 0 are a superset of all processors. 17 * SMP assumption: Options of CPU 0 are a superset of all processors.
24 * This is true for all known MIPS systems. 18 * This is true for all known MIPS systems.
@@ -193,7 +187,7 @@
193 187
194/* 188/*
195 * MIPS32, MIPS64, VR5500, IDT32332, IDT32334 and maybe a few other 189 * MIPS32, MIPS64, VR5500, IDT32332, IDT32334 and maybe a few other
196 * pre-MIPS32/MIPS53 processors have CLO, CLZ. The IDT RC64574 is 64-bit and 190 * pre-MIPS32/MIPS64 processors have CLO, CLZ. The IDT RC64574 is 64-bit and
197 * has CLO and CLZ but not DCLO nor DCLZ. For 64-bit kernels 191 * has CLO and CLZ but not DCLO nor DCLZ. For 64-bit kernels
198 * cpu_has_clo_clz also indicates the availability of DCLO and DCLZ. 192 * cpu_has_clo_clz also indicates the availability of DCLO and DCLZ.
199 */ 193 */
diff --git a/arch/mips/include/asm/cpu-info.h b/arch/mips/include/asm/cpu-info.h
index 41401d8eb7d1..21c8e29c8f91 100644
--- a/arch/mips/include/asm/cpu-info.h
+++ b/arch/mips/include/asm/cpu-info.h
@@ -84,6 +84,7 @@ struct cpuinfo_mips {
84extern struct cpuinfo_mips cpu_data[]; 84extern struct cpuinfo_mips cpu_data[];
85#define current_cpu_data cpu_data[smp_processor_id()] 85#define current_cpu_data cpu_data[smp_processor_id()]
86#define raw_current_cpu_data cpu_data[raw_smp_processor_id()] 86#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
87#define boot_cpu_data cpu_data[0]
87 88
88extern void cpu_probe(void); 89extern void cpu_probe(void);
89extern void cpu_report(void); 90extern void cpu_report(void);
diff --git a/arch/mips/include/asm/cpu-type.h b/arch/mips/include/asm/cpu-type.h
new file mode 100644
index 000000000000..4a402cc60c03
--- /dev/null
+++ b/arch/mips/include/asm/cpu-type.h
@@ -0,0 +1,203 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 2004 Ralf Baechle
7 * Copyright (C) 2004 Maciej W. Rozycki
8 */
9#ifndef __ASM_CPU_TYPE_H
10#define __ASM_CPU_TYPE_H
11
12#include <linux/smp.h>
13#include <linux/compiler.h>
14
15static inline int __pure __get_cpu_type(const int cpu_type)
16{
17 switch (cpu_type) {
18#if defined(CONFIG_SYS_HAS_CPU_LOONGSON2E) || \
19 defined(CONFIG_SYS_HAS_CPU_LOONGSON2F)
20 case CPU_LOONGSON2:
21#endif
22
23#ifdef CONFIG_SYS_HAS_CPU_LOONGSON1B
24 case CPU_LOONGSON1:
25#endif
26
27#ifdef CONFIG_SYS_HAS_CPU_MIPS32_R1
28 case CPU_4KC:
29 case CPU_ALCHEMY:
30 case CPU_BMIPS3300:
31 case CPU_BMIPS4350:
32 case CPU_PR4450:
33 case CPU_BMIPS32:
34 case CPU_JZRISC:
35#endif
36
37#if defined(CONFIG_SYS_HAS_CPU_MIPS32_R1) || \
38 defined(CONFIG_SYS_HAS_CPU_MIPS32_R2)
39 case CPU_4KEC:
40#endif
41
42#ifdef CONFIG_SYS_HAS_CPU_MIPS32_R2
43 case CPU_4KSC:
44 case CPU_24K:
45 case CPU_34K:
46 case CPU_1004K:
47 case CPU_74K:
48 case CPU_M14KC:
49 case CPU_M14KEC:
50#endif
51
52#ifdef CONFIG_SYS_HAS_CPU_MIPS64_R1
53 case CPU_5KC:
54 case CPU_5KE:
55 case CPU_20KC:
56 case CPU_25KF:
57 case CPU_SB1:
58 case CPU_SB1A:
59#endif
60
61#ifdef CONFIG_SYS_HAS_CPU_MIPS64_R2
62 /*
63 * All MIPS64 R2 processors have their own special symbols. That is,
64 * there currently is no pure R2 core
65 */
66#endif
67
68#ifdef CONFIG_SYS_HAS_CPU_R3000
69 case CPU_R2000:
70 case CPU_R3000:
71 case CPU_R3000A:
72 case CPU_R3041:
73 case CPU_R3051:
74 case CPU_R3052:
75 case CPU_R3081:
76 case CPU_R3081E:
77#endif
78
79#ifdef CONFIG_SYS_HAS_CPU_TX39XX
80 case CPU_TX3912:
81 case CPU_TX3922:
82 case CPU_TX3927:
83#endif
84
85#ifdef CONFIG_SYS_HAS_CPU_VR41XX
86 case CPU_VR41XX:
87 case CPU_VR4111:
88 case CPU_VR4121:
89 case CPU_VR4122:
90 case CPU_VR4131:
91 case CPU_VR4133:
92 case CPU_VR4181:
93 case CPU_VR4181A:
94#endif
95
96#ifdef CONFIG_SYS_HAS_CPU_R4300
97 case CPU_R4300:
98 case CPU_R4310:
99#endif
100
101#ifdef CONFIG_SYS_HAS_CPU_R4X00
102 case CPU_R4000PC:
103 case CPU_R4000SC:
104 case CPU_R4000MC:
105 case CPU_R4200:
106 case CPU_R4400PC:
107 case CPU_R4400SC:
108 case CPU_R4400MC:
109 case CPU_R4600:
110 case CPU_R4700:
111 case CPU_R4640:
112 case CPU_R4650:
113#endif
114
115#ifdef CONFIG_SYS_HAS_CPU_TX49XX
116 case CPU_TX49XX:
117#endif
118
119#ifdef CONFIG_SYS_HAS_CPU_R5000
120 case CPU_R5000:
121#endif
122
123#ifdef CONFIG_SYS_HAS_CPU_R5432
124 case CPU_R5432:
125#endif
126
127#ifdef CONFIG_SYS_HAS_CPU_R5500
128 case CPU_R5500:
129#endif
130
131#ifdef CONFIG_SYS_HAS_CPU_R6000
132 case CPU_R6000:
133 case CPU_R6000A:
134#endif
135
136#ifdef CONFIG_SYS_HAS_CPU_NEVADA
137 case CPU_NEVADA:
138#endif
139
140#ifdef CONFIG_SYS_HAS_CPU_R8000
141 case CPU_R8000:
142#endif
143
144#ifdef CONFIG_SYS_HAS_CPU_R10000
145 case CPU_R10000:
146 case CPU_R12000:
147 case CPU_R14000:
148#endif
149#ifdef CONFIG_SYS_HAS_CPU_RM7000
150 case CPU_RM7000:
151 case CPU_SR71000:
152#endif
153#ifdef CONFIG_SYS_HAS_CPU_RM9000
154 case CPU_RM9000:
155#endif
156#ifdef CONFIG_SYS_HAS_CPU_SB1
157 case CPU_SB1:
158 case CPU_SB1A:
159#endif
160#ifdef CONFIG_SYS_HAS_CPU_CAVIUM_OCTEON
161 case CPU_CAVIUM_OCTEON:
162 case CPU_CAVIUM_OCTEON_PLUS:
163 case CPU_CAVIUM_OCTEON2:
164#endif
165
166#ifdef CONFIG_SYS_HAS_CPU_BMIPS4380
167 case CPU_BMIPS4380:
168#endif
169
170#ifdef CONFIG_SYS_HAS_CPU_BMIPS5000
171 case CPU_BMIPS5000:
172#endif
173
174#ifdef CONFIG_SYS_HAS_CPU_XLP
175 case CPU_XLP:
176#endif
177
178#ifdef CONFIG_SYS_HAS_CPU_XLR
179 case CPU_XLR:
180#endif
181 break;
182 default:
183 unreachable();
184 }
185
186 return cpu_type;
187}
188
189static inline int __pure current_cpu_type(void)
190{
191 const int cpu_type = current_cpu_data.cputype;
192
193 return __get_cpu_type(cpu_type);
194}
195
196static inline int __pure boot_cpu_type(void)
197{
198 const int cpu_type = cpu_data[0].cputype;
199
200 return __get_cpu_type(cpu_type);
201}
202
203#endif /* __ASM_CPU_TYPE_H */
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index 71b9f1998be7..d2035e16502a 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -3,15 +3,14 @@
3 * various MIPS cpu types. 3 * various MIPS cpu types.
4 * 4 *
5 * Copyright (C) 1996 David S. Miller (davem@davemloft.net) 5 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
6 * Copyright (C) 2004 Maciej W. Rozycki 6 * Copyright (C) 2004, 2013 Maciej W. Rozycki
7 */ 7 */
8#ifndef _ASM_CPU_H 8#ifndef _ASM_CPU_H
9#define _ASM_CPU_H 9#define _ASM_CPU_H
10 10
11/* Assigned Company values for bits 23:16 of the PRId Register 11/*
12 (CP0 register 15, select 0). As of the MIPS32 and MIPS64 specs from 12 As of the MIPS32 and MIPS64 specs from MTI, the PRId register (CP0
13 MTI, the PRId register is defined in this (backwards compatible) 13 register 15, select 0) is defined in this (backwards compatible) way:
14 way:
15 14
16 +----------------+----------------+----------------+----------------+ 15 +----------------+----------------+----------------+----------------+
17 | Company Options| Company ID | Processor ID | Revision | 16 | Company Options| Company ID | Processor ID | Revision |
@@ -23,6 +22,14 @@
23 spec. 22 spec.
24*/ 23*/
25 24
25#define PRID_OPT_MASK 0xff000000
26
27/*
28 * Assigned Company values for bits 23:16 of the PRId register.
29 */
30
31#define PRID_COMP_MASK 0xff0000
32
26#define PRID_COMP_LEGACY 0x000000 33#define PRID_COMP_LEGACY 0x000000
27#define PRID_COMP_MIPS 0x010000 34#define PRID_COMP_MIPS 0x010000
28#define PRID_COMP_BROADCOM 0x020000 35#define PRID_COMP_BROADCOM 0x020000
@@ -38,10 +45,17 @@
38#define PRID_COMP_INGENIC 0xd00000 45#define PRID_COMP_INGENIC 0xd00000
39 46
40/* 47/*
41 * Assigned values for the product ID register. In order to detect a 48 * Assigned Processor ID (implementation) values for bits 15:8 of the PRId
42 * certain CPU type exactly eventually additional registers may need to 49 * register. In order to detect a certain CPU type exactly eventually
43 * be examined. These are valid when 23:16 == PRID_COMP_LEGACY 50 * additional registers may need to be examined.
44 */ 51 */
52
53#define PRID_IMP_MASK 0xff00
54
55/*
56 * These are valid when 23:16 == PRID_COMP_LEGACY
57 */
58
45#define PRID_IMP_R2000 0x0100 59#define PRID_IMP_R2000 0x0100
46#define PRID_IMP_AU1_REV1 0x0100 60#define PRID_IMP_AU1_REV1 0x0100
47#define PRID_IMP_AU1_REV2 0x0200 61#define PRID_IMP_AU1_REV2 0x0200
@@ -182,11 +196,15 @@
182#define PRID_IMP_NETLOGIC_XLP2XX 0x1200 196#define PRID_IMP_NETLOGIC_XLP2XX 0x1200
183 197
184/* 198/*
185 * Definitions for 7:0 on legacy processors 199 * Particular Revision values for bits 7:0 of the PRId register.
186 */ 200 */
187 201
188#define PRID_REV_MASK 0x00ff 202#define PRID_REV_MASK 0x00ff
189 203
204/*
205 * Definitions for 7:0 on legacy processors
206 */
207
190#define PRID_REV_TX4927 0x0022 208#define PRID_REV_TX4927 0x0022
191#define PRID_REV_TX4937 0x0030 209#define PRID_REV_TX4937 0x0030
192#define PRID_REV_R4400 0x0040 210#define PRID_REV_R4400 0x0040
@@ -227,6 +245,8 @@
227 * 31 16 15 8 7 0 245 * 31 16 15 8 7 0
228 */ 246 */
229 247
248#define FPIR_IMP_MASK 0xff00
249
230#define FPIR_IMP_NONE 0x0000 250#define FPIR_IMP_NONE 0x0000
231 251
232enum cpu_type_enum { 252enum cpu_type_enum {
diff --git a/arch/mips/include/asm/dec/ioasic.h b/arch/mips/include/asm/dec/ioasic.h
index a6e505a0e44b..be4d62a5a10e 100644
--- a/arch/mips/include/asm/dec/ioasic.h
+++ b/arch/mips/include/asm/dec/ioasic.h
@@ -31,8 +31,6 @@ static inline u32 ioasic_read(unsigned int reg)
31 return ioasic_base[reg / 4]; 31 return ioasic_base[reg / 4];
32} 32}
33 33
34extern void clear_ioasic_dma_irq(unsigned int irq);
35
36extern void init_ioasic_irqs(int base); 34extern void init_ioasic_irqs(int base);
37 35
38extern int dec_ioasic_clocksource_init(void); 36extern int dec_ioasic_clocksource_init(void);
diff --git a/arch/mips/include/asm/dec/ioasic_addrs.h b/arch/mips/include/asm/dec/ioasic_addrs.h
index a8665a7611c2..8bd95971fe2d 100644
--- a/arch/mips/include/asm/dec/ioasic_addrs.h
+++ b/arch/mips/include/asm/dec/ioasic_addrs.h
@@ -40,7 +40,7 @@
40#define IOASIC_FLOPPY (11*IOASIC_SLOT_SIZE) /* FDC (maxine) */ 40#define IOASIC_FLOPPY (11*IOASIC_SLOT_SIZE) /* FDC (maxine) */
41#define IOASIC_SCSI (12*IOASIC_SLOT_SIZE) /* ASC SCSI */ 41#define IOASIC_SCSI (12*IOASIC_SLOT_SIZE) /* ASC SCSI */
42#define IOASIC_FDC_DMA (13*IOASIC_SLOT_SIZE) /* FDC DMA (maxine) */ 42#define IOASIC_FDC_DMA (13*IOASIC_SLOT_SIZE) /* FDC DMA (maxine) */
43#define IOASIC_SCSI_DMA (14*IOASIC_SLOT_SIZE) /* ??? */ 43#define IOASIC_SCSI_DMA (14*IOASIC_SLOT_SIZE) /* ??? */
44#define IOASIC_RES_15 (15*IOASIC_SLOT_SIZE) /* unused? */ 44#define IOASIC_RES_15 (15*IOASIC_SLOT_SIZE) /* unused? */
45 45
46 46
diff --git a/arch/mips/include/asm/dec/kn01.h b/arch/mips/include/asm/dec/kn01.h
index 0eb3241de706..88d9ffd74258 100644
--- a/arch/mips/include/asm/dec/kn01.h
+++ b/arch/mips/include/asm/dec/kn01.h
@@ -57,12 +57,12 @@
57/* 57/*
58 * System Control & Status Register bits. 58 * System Control & Status Register bits.
59 */ 59 */
60#define KN01_CSR_MNFMOD (1<<15) /* MNFMOD manufacturing jumper */ 60#define KN01_CSR_MNFMOD (1<<15) /* MNFMOD manufacturing jumper */
61#define KN01_CSR_STATUS (1<<14) /* self-test result status output */ 61#define KN01_CSR_STATUS (1<<14) /* self-test result status output */
62#define KN01_CSR_PARDIS (1<<13) /* parity error disable */ 62#define KN01_CSR_PARDIS (1<<13) /* parity error disable */
63#define KN01_CSR_CRSRTST (1<<12) /* PCC test output */ 63#define KN01_CSR_CRSRTST (1<<12) /* PCC test output */
64#define KN01_CSR_MONO (1<<11) /* mono/color fb SIMM installed */ 64#define KN01_CSR_MONO (1<<11) /* mono/color fb SIMM installed */
65#define KN01_CSR_MEMERR (1<<10) /* write timeout error status & ack*/ 65#define KN01_CSR_MEMERR (1<<10) /* write timeout error status & ack*/
66#define KN01_CSR_VINT (1<<9) /* PCC area detect #2 status & ack */ 66#define KN01_CSR_VINT (1<<9) /* PCC area detect #2 status & ack */
67#define KN01_CSR_TXDIS (1<<8) /* DZ11 transmit disable */ 67#define KN01_CSR_TXDIS (1<<8) /* DZ11 transmit disable */
68#define KN01_CSR_VBGTRG (1<<2) /* blue DAC voltage over green (r/o) */ 68#define KN01_CSR_VBGTRG (1<<2) /* blue DAC voltage over green (r/o) */
diff --git a/arch/mips/include/asm/dec/kn02ca.h b/arch/mips/include/asm/dec/kn02ca.h
index 69dc2a9a2d0f..92c0fe256099 100644
--- a/arch/mips/include/asm/dec/kn02ca.h
+++ b/arch/mips/include/asm/dec/kn02ca.h
@@ -68,7 +68,7 @@
68#define KN03CA_IO_SSR_ISDN_RST (1<<12) /* ~ISDN (Am79C30A) reset */ 68#define KN03CA_IO_SSR_ISDN_RST (1<<12) /* ~ISDN (Am79C30A) reset */
69 69
70#define KN03CA_IO_SSR_FLOPPY_RST (1<<7) /* ~FDC (82077) reset */ 70#define KN03CA_IO_SSR_FLOPPY_RST (1<<7) /* ~FDC (82077) reset */
71#define KN03CA_IO_SSR_VIDEO_RST (1<<6) /* ~framebuffer reset */ 71#define KN03CA_IO_SSR_VIDEO_RST (1<<6) /* ~framebuffer reset */
72#define KN03CA_IO_SSR_AB_RST (1<<5) /* ACCESS.bus reset */ 72#define KN03CA_IO_SSR_AB_RST (1<<5) /* ACCESS.bus reset */
73#define KN03CA_IO_SSR_RES_4 (1<<4) /* unused */ 73#define KN03CA_IO_SSR_RES_4 (1<<4) /* unused */
74#define KN03CA_IO_SSR_RES_3 (1<<4) /* unused */ 74#define KN03CA_IO_SSR_RES_3 (1<<4) /* unused */
diff --git a/arch/mips/include/asm/dec/prom.h b/arch/mips/include/asm/dec/prom.h
index 446577712bee..c0ead6313845 100644
--- a/arch/mips/include/asm/dec/prom.h
+++ b/arch/mips/include/asm/dec/prom.h
@@ -49,7 +49,7 @@
49 49
50#ifdef CONFIG_64BIT 50#ifdef CONFIG_64BIT
51 51
52#define prom_is_rex(magic) 1 /* KN04 and KN05 are REX PROMs. */ 52#define prom_is_rex(magic) 1 /* KN04 and KN05 are REX PROMs. */
53 53
54#else /* !CONFIG_64BIT */ 54#else /* !CONFIG_64BIT */
55 55
diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h
index cf3ae2480b1d..a66359ef4ece 100644
--- a/arch/mips/include/asm/elf.h
+++ b/arch/mips/include/asm/elf.h
@@ -331,6 +331,7 @@ extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
331#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) \ 331#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) \
332 dump_task_fpu(tsk, elf_fpregs) 332 dump_task_fpu(tsk, elf_fpregs)
333 333
334#define CORE_DUMP_USE_REGSET
334#define ELF_EXEC_PAGESIZE PAGE_SIZE 335#define ELF_EXEC_PAGESIZE PAGE_SIZE
335 336
336/* This yields a mask that user programs can use to figure out what 337/* This yields a mask that user programs can use to figure out what
diff --git a/arch/mips/include/asm/jump_label.h b/arch/mips/include/asm/jump_label.h
index 4d6d77ed9b9d..e194f957ca8c 100644
--- a/arch/mips/include/asm/jump_label.h
+++ b/arch/mips/include/asm/jump_label.h
@@ -22,7 +22,7 @@
22 22
23static __always_inline bool arch_static_branch(struct static_key *key) 23static __always_inline bool arch_static_branch(struct static_key *key)
24{ 24{
25 asm goto("1:\tnop\n\t" 25 asm_volatile_goto("1:\tnop\n\t"
26 "nop\n\t" 26 "nop\n\t"
27 ".pushsection __jump_table, \"aw\"\n\t" 27 ".pushsection __jump_table, \"aw\"\n\t"
28 WORD_INSN " 1b, %l[l_yes], %0\n\t" 28 WORD_INSN " 1b, %l[l_yes], %0\n\t"
diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
index 4d6fa0bf1305..32966969f2f9 100644
--- a/arch/mips/include/asm/kvm_host.h
+++ b/arch/mips/include/asm/kvm_host.h
@@ -27,13 +27,6 @@
27 27
28#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 28#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
29 29
30/* Don't support huge pages */
31#define KVM_HPAGE_GFN_SHIFT(x) 0
32
33/* We don't currently support large pages. */
34#define KVM_NR_PAGE_SIZES 1
35#define KVM_PAGES_PER_HPAGE(x) 1
36
37 30
38 31
39/* Special address that contains the comm page, used for reducing # of traps */ 32/* Special address that contains the comm page, used for reducing # of traps */
diff --git a/arch/mips/include/asm/mach-ath79/ar933x_uart_platform.h b/arch/mips/include/asm/mach-ath79/ar933x_uart_platform.h
deleted file mode 100644
index 6cb30f2b7198..000000000000
--- a/arch/mips/include/asm/mach-ath79/ar933x_uart_platform.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * Platform data definition for Atheros AR933X UART
3 *
4 * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
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 version 2 as published
8 * by the Free Software Foundation.
9 */
10
11#ifndef _AR933X_UART_PLATFORM_H
12#define _AR933X_UART_PLATFORM_H
13
14struct ar933x_uart_platform_data {
15 unsigned uartclk;
16};
17
18#endif /* _AR933X_UART_PLATFORM_H */
diff --git a/arch/mips/include/asm/mach-au1x00/au1000.h b/arch/mips/include/asm/mach-au1x00/au1000.h
index 3e11a468cdf8..54f9e84db8ac 100644
--- a/arch/mips/include/asm/mach-au1x00/au1000.h
+++ b/arch/mips/include/asm/mach-au1x00/au1000.h
@@ -43,6 +43,8 @@
43#include <linux/io.h> 43#include <linux/io.h>
44#include <linux/irq.h> 44#include <linux/irq.h>
45 45
46#include <asm/cpu.h>
47
46/* cpu pipeline flush */ 48/* cpu pipeline flush */
47void static inline au_sync(void) 49void static inline au_sync(void)
48{ 50{
@@ -140,7 +142,7 @@ static inline int au1xxx_cpu_needs_config_od(void)
140 142
141static inline int alchemy_get_cputype(void) 143static inline int alchemy_get_cputype(void)
142{ 144{
143 switch (read_c0_prid() & 0xffff0000) { 145 switch (read_c0_prid() & (PRID_OPT_MASK | PRID_COMP_MASK)) {
144 case 0x00030000: 146 case 0x00030000:
145 return ALCHEMY_CPU_AU1000; 147 return ALCHEMY_CPU_AU1000;
146 break; 148 break;
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
new file mode 100644
index 000000000000..00867dd05a69
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
@@ -0,0 +1,110 @@
1#ifndef __BCM47XX_BOARD_H
2#define __BCM47XX_BOARD_H
3
4enum bcm47xx_board {
5 BCM47XX_BOARD_ASUS_RTAC66U,
6 BCM47XX_BOARD_ASUS_RTN10,
7 BCM47XX_BOARD_ASUS_RTN10D,
8 BCM47XX_BOARD_ASUS_RTN10U,
9 BCM47XX_BOARD_ASUS_RTN12,
10 BCM47XX_BOARD_ASUS_RTN12B1,
11 BCM47XX_BOARD_ASUS_RTN12C1,
12 BCM47XX_BOARD_ASUS_RTN12D1,
13 BCM47XX_BOARD_ASUS_RTN12HP,
14 BCM47XX_BOARD_ASUS_RTN15U,
15 BCM47XX_BOARD_ASUS_RTN16,
16 BCM47XX_BOARD_ASUS_RTN53,
17 BCM47XX_BOARD_ASUS_RTN66U,
18 BCM47XX_BOARD_ASUS_WL300G,
19 BCM47XX_BOARD_ASUS_WL320GE,
20 BCM47XX_BOARD_ASUS_WL330GE,
21 BCM47XX_BOARD_ASUS_WL500GD,
22 BCM47XX_BOARD_ASUS_WL500GPV1,
23 BCM47XX_BOARD_ASUS_WL500GPV2,
24 BCM47XX_BOARD_ASUS_WL500W,
25 BCM47XX_BOARD_ASUS_WL520GC,
26 BCM47XX_BOARD_ASUS_WL520GU,
27 BCM47XX_BOARD_ASUS_WL700GE,
28 BCM47XX_BOARD_ASUS_WLHDD,
29
30 BCM47XX_BOARD_BELKIN_F7D4301,
31
32 BCM47XX_BOARD_BUFFALO_WBR2_G54,
33 BCM47XX_BOARD_BUFFALO_WHR2_A54G54,
34 BCM47XX_BOARD_BUFFALO_WHR_G125,
35 BCM47XX_BOARD_BUFFALO_WHR_G54S,
36 BCM47XX_BOARD_BUFFALO_WHR_HP_G54,
37 BCM47XX_BOARD_BUFFALO_WLA2_G54L,
38 BCM47XX_BOARD_BUFFALO_WZR_G300N,
39 BCM47XX_BOARD_BUFFALO_WZR_RS_G54,
40 BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP,
41
42 BCM47XX_BOARD_CISCO_M10V1,
43 BCM47XX_BOARD_CISCO_M20V1,
44
45 BCM47XX_BOARD_DELL_TM2300,
46
47 BCM47XX_BOARD_DLINK_DIR130,
48 BCM47XX_BOARD_DLINK_DIR330,
49
50 BCM47XX_BOARD_HUAWEI_E970,
51
52 BCM47XX_BOARD_LINKSYS_E900V1,
53 BCM47XX_BOARD_LINKSYS_E1000V1,
54 BCM47XX_BOARD_LINKSYS_E1000V2,
55 BCM47XX_BOARD_LINKSYS_E1000V21,
56 BCM47XX_BOARD_LINKSYS_E1200V2,
57 BCM47XX_BOARD_LINKSYS_E2000V1,
58 BCM47XX_BOARD_LINKSYS_E3000V1,
59 BCM47XX_BOARD_LINKSYS_E3200V1,
60 BCM47XX_BOARD_LINKSYS_E4200V1,
61 BCM47XX_BOARD_LINKSYS_WRT150NV1,
62 BCM47XX_BOARD_LINKSYS_WRT150NV11,
63 BCM47XX_BOARD_LINKSYS_WRT160NV1,
64 BCM47XX_BOARD_LINKSYS_WRT160NV3,
65 BCM47XX_BOARD_LINKSYS_WRT300NV11,
66 BCM47XX_BOARD_LINKSYS_WRT310NV1,
67 BCM47XX_BOARD_LINKSYS_WRT310NV2,
68 BCM47XX_BOARD_LINKSYS_WRT54G3GV2,
69 BCM47XX_BOARD_LINKSYS_WRT610NV1,
70 BCM47XX_BOARD_LINKSYS_WRT610NV2,
71 BCM47XX_BOARD_LINKSYS_WRTSL54GS,
72
73 BCM47XX_BOARD_MOTOROLA_WE800G,
74 BCM47XX_BOARD_MOTOROLA_WR850GP,
75 BCM47XX_BOARD_MOTOROLA_WR850GV2V3,
76
77 BCM47XX_BOARD_NETGEAR_WGR614V8,
78 BCM47XX_BOARD_NETGEAR_WGR614V9,
79 BCM47XX_BOARD_NETGEAR_WNDR3300,
80 BCM47XX_BOARD_NETGEAR_WNDR3400V1,
81 BCM47XX_BOARD_NETGEAR_WNDR3400V2,
82 BCM47XX_BOARD_NETGEAR_WNDR3400VCNA,
83 BCM47XX_BOARD_NETGEAR_WNDR3700V3,
84 BCM47XX_BOARD_NETGEAR_WNDR4000,
85 BCM47XX_BOARD_NETGEAR_WNDR4500V1,
86 BCM47XX_BOARD_NETGEAR_WNDR4500V2,
87 BCM47XX_BOARD_NETGEAR_WNR2000,
88 BCM47XX_BOARD_NETGEAR_WNR3500L,
89 BCM47XX_BOARD_NETGEAR_WNR3500U,
90 BCM47XX_BOARD_NETGEAR_WNR3500V2,
91 BCM47XX_BOARD_NETGEAR_WNR3500V2VC,
92 BCM47XX_BOARD_NETGEAR_WNR834BV2,
93
94 BCM47XX_BOARD_PHICOMM_M1,
95
96 BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE,
97
98 BCM47XX_BOARD_ZTE_H218N,
99
100 BCM47XX_BOARD_UNKNOWN,
101 BCM47XX_BOARD_NO,
102};
103
104#define BCM47XX_BOARD_MAX_NAME 30
105
106void bcm47xx_board_detect(void);
107enum bcm47xx_board bcm47xx_board_get(void);
108const char *bcm47xx_board_get_name(void);
109
110#endif /* __BCM47XX_BOARD_H */
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h
index b8e7be8f34dd..36a3fc1aa3ae 100644
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h
@@ -48,4 +48,6 @@ static inline void bcm47xx_nvram_parse_macaddr(char *buf, u8 macaddr[6])
48 printk(KERN_WARNING "Can not parse mac address: %s\n", buf); 48 printk(KERN_WARNING "Can not parse mac address: %s\n", buf);
49} 49}
50 50
51int bcm47xx_nvram_gpio_pin(const char *name);
52
51#endif /* __BCM47XX_NVRAM_H */ 53#endif /* __BCM47XX_NVRAM_H */
diff --git a/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h b/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
index 47fb247f9663..f9f448650505 100644
--- a/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
+++ b/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
@@ -52,23 +52,11 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
52 return 0; 52 return 0;
53} 53}
54 54
55static inline void plat_extra_sync_for_device(struct device *dev)
56{
57 BUG();
58}
59
60static inline int plat_device_is_coherent(struct device *dev) 55static inline int plat_device_is_coherent(struct device *dev)
61{ 56{
62 return 1; 57 return 1;
63} 58}
64 59
65static inline int plat_dma_mapping_error(struct device *dev,
66 dma_addr_t dma_addr)
67{
68 BUG();
69 return 0;
70}
71
72dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr); 60dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr);
73phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr); 61phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr);
74 62
diff --git a/arch/mips/include/asm/mach-dec/cpu-feature-overrides.h b/arch/mips/include/asm/mach-dec/cpu-feature-overrides.h
new file mode 100644
index 000000000000..acce27fd2bb8
--- /dev/null
+++ b/arch/mips/include/asm/mach-dec/cpu-feature-overrides.h
@@ -0,0 +1,87 @@
1/*
2 * CPU feature overrides for DECstation systems. Two variations
3 * are generally applicable.
4 *
5 * Copyright (C) 2013 Maciej W. Rozycki
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12#ifndef __ASM_MACH_DEC_CPU_FEATURE_OVERRIDES_H
13#define __ASM_MACH_DEC_CPU_FEATURE_OVERRIDES_H
14
15/* Generic ones first. */
16#define cpu_has_tlb 1
17#define cpu_has_tx39_cache 0
18#define cpu_has_fpu 1
19#define cpu_has_divec 0
20#define cpu_has_prefetch 0
21#define cpu_has_mcheck 0
22#define cpu_has_ejtag 0
23#define cpu_has_mips16 0
24#define cpu_has_mdmx 0
25#define cpu_has_mips3d 0
26#define cpu_has_smartmips 0
27#define cpu_has_rixi 0
28#define cpu_has_vtag_icache 0
29#define cpu_has_ic_fills_f_dc 0
30#define cpu_has_pindexed_dcache 0
31#define cpu_has_local_ebase 0
32#define cpu_icache_snoops_remote_store 1
33#define cpu_has_mips_4 0
34#define cpu_has_mips_5 0
35#define cpu_has_mips32r1 0
36#define cpu_has_mips32r2 0
37#define cpu_has_mips64r1 0
38#define cpu_has_mips64r2 0
39#define cpu_has_dsp 0
40#define cpu_has_mipsmt 0
41#define cpu_has_userlocal 0
42
43/* R3k-specific ones. */
44#ifdef CONFIG_CPU_R3000
45#define cpu_has_4kex 0
46#define cpu_has_3k_cache 1
47#define cpu_has_4k_cache 0
48#define cpu_has_32fpr 0
49#define cpu_has_counter 0
50#define cpu_has_watch 0
51#define cpu_has_vce 0
52#define cpu_has_cache_cdex_p 0
53#define cpu_has_cache_cdex_s 0
54#define cpu_has_llsc 0
55#define cpu_has_dc_aliases 0
56#define cpu_has_mips_2 0
57#define cpu_has_mips_3 0
58#define cpu_has_nofpuex 1
59#define cpu_has_inclusive_pcaches 0
60#define cpu_dcache_line_size() 4
61#define cpu_icache_line_size() 4
62#define cpu_scache_line_size() 0
63#endif /* CONFIG_CPU_R3000 */
64
65/* R4k-specific ones. */
66#ifdef CONFIG_CPU_R4X00
67#define cpu_has_4kex 1
68#define cpu_has_3k_cache 0
69#define cpu_has_4k_cache 1
70#define cpu_has_32fpr 1
71#define cpu_has_counter 1
72#define cpu_has_watch 1
73#define cpu_has_vce 1
74#define cpu_has_cache_cdex_p 1
75#define cpu_has_cache_cdex_s 1
76#define cpu_has_llsc 1
77#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
78#define cpu_has_mips_2 1
79#define cpu_has_mips_3 1
80#define cpu_has_nofpuex 0
81#define cpu_has_inclusive_pcaches 1
82#define cpu_dcache_line_size() 16
83#define cpu_icache_line_size() 16
84#define cpu_scache_line_size() 32
85#endif /* CONFIG_CPU_R4X00 */
86
87#endif /* __ASM_MACH_DEC_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-generic/dma-coherence.h b/arch/mips/include/asm/mach-generic/dma-coherence.h
index 74cb99257d5b..a9e8f6b62b0b 100644
--- a/arch/mips/include/asm/mach-generic/dma-coherence.h
+++ b/arch/mips/include/asm/mach-generic/dma-coherence.h
@@ -47,16 +47,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
47 return 1; 47 return 1;
48} 48}
49 49
50static inline void plat_extra_sync_for_device(struct device *dev)
51{
52}
53
54static inline int plat_dma_mapping_error(struct device *dev,
55 dma_addr_t dma_addr)
56{
57 return 0;
58}
59
60static inline int plat_device_is_coherent(struct device *dev) 50static inline int plat_device_is_coherent(struct device *dev)
61{ 51{
62#ifdef CONFIG_DMA_COHERENT 52#ifdef CONFIG_DMA_COHERENT
diff --git a/arch/mips/include/asm/mach-ip22/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ip22/cpu-feature-overrides.h
index f4caacd25552..1bcb6421205e 100644
--- a/arch/mips/include/asm/mach-ip22/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-ip22/cpu-feature-overrides.h
@@ -8,6 +8,8 @@
8#ifndef __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H 8#ifndef __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H 9#define __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H
10 10
11#include <asm/cpu.h>
12
11/* 13/*
12 * IP22 with a variety of processors so we can't use defaults for everything. 14 * IP22 with a variety of processors so we can't use defaults for everything.
13 */ 15 */
diff --git a/arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h
index 1d2b6ff60d33..d6111aa2e886 100644
--- a/arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h
@@ -8,6 +8,8 @@
8#ifndef __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H 8#ifndef __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H 9#define __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H
10 10
11#include <asm/cpu.h>
12
11/* 13/*
12 * IP27 only comes with R10000 family processors all using the same config 14 * IP27 only comes with R10000 family processors all using the same config
13 */ 15 */
diff --git a/arch/mips/include/asm/mach-ip27/dma-coherence.h b/arch/mips/include/asm/mach-ip27/dma-coherence.h
index 06c441968e6e..4ffddfdb5062 100644
--- a/arch/mips/include/asm/mach-ip27/dma-coherence.h
+++ b/arch/mips/include/asm/mach-ip27/dma-coherence.h
@@ -58,16 +58,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
58 return 1; 58 return 1;
59} 59}
60 60
61static inline void plat_extra_sync_for_device(struct device *dev)
62{
63}
64
65static inline int plat_dma_mapping_error(struct device *dev,
66 dma_addr_t dma_addr)
67{
68 return 0;
69}
70
71static inline int plat_device_is_coherent(struct device *dev) 61static inline int plat_device_is_coherent(struct device *dev)
72{ 62{
73 return 1; /* IP27 non-cohernet mode is unsupported */ 63 return 1; /* IP27 non-cohernet mode is unsupported */
diff --git a/arch/mips/include/asm/mach-ip28/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ip28/cpu-feature-overrides.h
index 65e9c856390d..4cec06d133db 100644
--- a/arch/mips/include/asm/mach-ip28/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-ip28/cpu-feature-overrides.h
@@ -9,6 +9,8 @@
9#ifndef __ASM_MACH_IP28_CPU_FEATURE_OVERRIDES_H 9#ifndef __ASM_MACH_IP28_CPU_FEATURE_OVERRIDES_H
10#define __ASM_MACH_IP28_CPU_FEATURE_OVERRIDES_H 10#define __ASM_MACH_IP28_CPU_FEATURE_OVERRIDES_H
11 11
12#include <asm/cpu.h>
13
12/* 14/*
13 * IP28 only comes with R10000 family processors all using the same config 15 * IP28 only comes with R10000 family processors all using the same config
14 */ 16 */
diff --git a/arch/mips/include/asm/mach-ip32/dma-coherence.h b/arch/mips/include/asm/mach-ip32/dma-coherence.h
index 073f0c4760ba..104cfbc3ed63 100644
--- a/arch/mips/include/asm/mach-ip32/dma-coherence.h
+++ b/arch/mips/include/asm/mach-ip32/dma-coherence.h
@@ -80,17 +80,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
80 return 1; 80 return 1;
81} 81}
82 82
83static inline void plat_extra_sync_for_device(struct device *dev)
84{
85 return;
86}
87
88static inline int plat_dma_mapping_error(struct device *dev,
89 dma_addr_t dma_addr)
90{
91 return 0;
92}
93
94static inline int plat_device_is_coherent(struct device *dev) 83static inline int plat_device_is_coherent(struct device *dev)
95{ 84{
96 return 0; /* IP32 is non-cohernet */ 85 return 0; /* IP32 is non-cohernet */
diff --git a/arch/mips/include/asm/mach-jazz/dma-coherence.h b/arch/mips/include/asm/mach-jazz/dma-coherence.h
index 9fc1e9ad7038..949003ef97b3 100644
--- a/arch/mips/include/asm/mach-jazz/dma-coherence.h
+++ b/arch/mips/include/asm/mach-jazz/dma-coherence.h
@@ -48,16 +48,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
48 return 1; 48 return 1;
49} 49}
50 50
51static inline void plat_extra_sync_for_device(struct device *dev)
52{
53}
54
55static inline int plat_dma_mapping_error(struct device *dev,
56 dma_addr_t dma_addr)
57{
58 return 0;
59}
60
61static inline int plat_device_is_coherent(struct device *dev) 51static inline int plat_device_is_coherent(struct device *dev)
62{ 52{
63 return 0; 53 return 0;
diff --git a/arch/mips/include/asm/mach-loongson/dma-coherence.h b/arch/mips/include/asm/mach-loongson/dma-coherence.h
index e1433055fe98..aeb2c05d6145 100644
--- a/arch/mips/include/asm/mach-loongson/dma-coherence.h
+++ b/arch/mips/include/asm/mach-loongson/dma-coherence.h
@@ -53,16 +53,6 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
53 return 1; 53 return 1;
54} 54}
55 55
56static inline void plat_extra_sync_for_device(struct device *dev)
57{
58}
59
60static inline int plat_dma_mapping_error(struct device *dev,
61 dma_addr_t dma_addr)
62{
63 return 0;
64}
65
66static inline int plat_device_is_coherent(struct device *dev) 56static inline int plat_device_is_coherent(struct device *dev)
67{ 57{
68 return 0; 58 return 0;
diff --git a/arch/mips/include/asm/mach-powertv/asic.h b/arch/mips/include/asm/mach-powertv/asic.h
deleted file mode 100644
index b341108d12f1..000000000000
--- a/arch/mips/include/asm/mach-powertv/asic.h
+++ /dev/null
@@ -1,120 +0,0 @@
1/*
2 * Copyright (C) 2009 Cisco Systems, 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 * 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 St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef _ASM_MACH_POWERTV_ASIC_H
20#define _ASM_MACH_POWERTV_ASIC_H
21
22#include <linux/ioport.h>
23#include <linux/platform_device.h>
24#include <asm/mach-powertv/asic_regs.h>
25
26#define DVR_CAPABLE (1<<0)
27#define PCIE_CAPABLE (1<<1)
28#define FFS_CAPABLE (1<<2)
29#define DISPLAY_CAPABLE (1<<3)
30
31/* Platform Family types
32 * For compitability, the new value must be added in the end */
33enum family_type {
34 FAMILY_8500,
35 FAMILY_8500RNG,
36 FAMILY_4500,
37 FAMILY_1500,
38 FAMILY_8600,
39 FAMILY_4600,
40 FAMILY_4600VZA,
41 FAMILY_8600VZB,
42 FAMILY_1500VZE,
43 FAMILY_1500VZF,
44 FAMILY_8700,
45 FAMILIES
46};
47
48/* Register maps for each ASIC */
49extern const struct register_map calliope_register_map;
50extern const struct register_map cronus_register_map;
51extern const struct register_map gaia_register_map;
52extern const struct register_map zeus_register_map;
53
54extern struct resource dvr_cronus_resources[];
55extern struct resource dvr_gaia_resources[];
56extern struct resource dvr_zeus_resources[];
57extern struct resource non_dvr_calliope_resources[];
58extern struct resource non_dvr_cronus_resources[];
59extern struct resource non_dvr_cronuslite_resources[];
60extern struct resource non_dvr_gaia_resources[];
61extern struct resource non_dvr_vz_calliope_resources[];
62extern struct resource non_dvr_vze_calliope_resources[];
63extern struct resource non_dvr_vzf_calliope_resources[];
64extern struct resource non_dvr_zeus_resources[];
65
66extern void powertv_platform_init(void);
67extern void platform_alloc_bootmem(void);
68extern enum asic_type platform_get_asic(void);
69extern enum family_type platform_get_family(void);
70extern int platform_supports_dvr(void);
71extern int platform_supports_ffs(void);
72extern int platform_supports_pcie(void);
73extern int platform_supports_display(void);
74extern void configure_platform(void);
75
76/* Platform Resources */
77#define ASIC_RESOURCE_GET_EXISTS 1
78extern struct resource *asic_resource_get(const char *name);
79extern void platform_release_memory(void *baddr, int size);
80
81/* USB configuration */
82struct usb_hcd; /* Forward reference */
83extern void platform_configure_usb_ehci(void);
84extern void platform_unconfigure_usb_ehci(void);
85extern void platform_configure_usb_ohci(void);
86extern void platform_unconfigure_usb_ohci(void);
87
88/* Resource for ASIC registers */
89extern struct resource asic_resource;
90extern int platform_usb_devices_init(struct platform_device **echi_dev,
91 struct platform_device **ohci_dev);
92
93/* Reboot Cause */
94extern void set_reboot_cause(char code, unsigned int data, unsigned int data2);
95extern void set_locked_reboot_cause(char code, unsigned int data,
96 unsigned int data2);
97
98enum sys_reboot_type {
99 sys_unknown_reboot = 0x00, /* Unknown reboot cause */
100 sys_davic_change = 0x01, /* Reboot due to change in DAVIC
101 * mode */
102 sys_user_reboot = 0x02, /* Reboot initiated by user */
103 sys_system_reboot = 0x03, /* Reboot initiated by OS */
104 sys_trap_reboot = 0x04, /* Reboot due to a CPU trap */
105 sys_silent_reboot = 0x05, /* Silent reboot */
106 sys_boot_ldr_reboot = 0x06, /* Bootloader reboot */
107 sys_power_up_reboot = 0x07, /* Power on bootup. Older
108 * drivers may report as
109 * userReboot. */
110 sys_code_change = 0x08, /* Reboot to take code change.
111 * Older drivers may report as
112 * userReboot. */
113 sys_hardware_reset = 0x09, /* HW watchdog or front-panel
114 * reset button reset. Older
115 * drivers may report as
116 * userReboot. */
117 sys_watchdogInterrupt = 0x0A /* Pre-watchdog interrupt */
118};
119
120#endif /* _ASM_MACH_POWERTV_ASIC_H */
diff --git a/arch/mips/include/asm/mach-powertv/asic_reg_map.h b/arch/mips/include/asm/mach-powertv/asic_reg_map.h
deleted file mode 100644
index 20348e817b09..000000000000
--- a/arch/mips/include/asm/mach-powertv/asic_reg_map.h
+++ /dev/null
@@ -1,90 +0,0 @@
1/*
2 * asic_reg_map.h
3 *
4 * A macro-enclosed list of the elements for the register_map structure for
5 * use in defining and manipulating the structure.
6 *
7 * Copyright (C) 2009 Cisco Systems, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24REGISTER_MAP_ELEMENT(eic_slow0_strt_add)
25REGISTER_MAP_ELEMENT(eic_cfg_bits)
26REGISTER_MAP_ELEMENT(eic_ready_status)
27REGISTER_MAP_ELEMENT(chipver3)
28REGISTER_MAP_ELEMENT(chipver2)
29REGISTER_MAP_ELEMENT(chipver1)
30REGISTER_MAP_ELEMENT(chipver0)
31REGISTER_MAP_ELEMENT(uart1_intstat)
32REGISTER_MAP_ELEMENT(uart1_inten)
33REGISTER_MAP_ELEMENT(uart1_config1)
34REGISTER_MAP_ELEMENT(uart1_config2)
35REGISTER_MAP_ELEMENT(uart1_divisorhi)
36REGISTER_MAP_ELEMENT(uart1_divisorlo)
37REGISTER_MAP_ELEMENT(uart1_data)
38REGISTER_MAP_ELEMENT(uart1_status)
39REGISTER_MAP_ELEMENT(int_stat_3)
40REGISTER_MAP_ELEMENT(int_stat_2)
41REGISTER_MAP_ELEMENT(int_stat_1)
42REGISTER_MAP_ELEMENT(int_stat_0)
43REGISTER_MAP_ELEMENT(int_config)
44REGISTER_MAP_ELEMENT(int_int_scan)
45REGISTER_MAP_ELEMENT(ien_int_3)
46REGISTER_MAP_ELEMENT(ien_int_2)
47REGISTER_MAP_ELEMENT(ien_int_1)
48REGISTER_MAP_ELEMENT(ien_int_0)
49REGISTER_MAP_ELEMENT(int_level_3_3)
50REGISTER_MAP_ELEMENT(int_level_3_2)
51REGISTER_MAP_ELEMENT(int_level_3_1)
52REGISTER_MAP_ELEMENT(int_level_3_0)
53REGISTER_MAP_ELEMENT(int_level_2_3)
54REGISTER_MAP_ELEMENT(int_level_2_2)
55REGISTER_MAP_ELEMENT(int_level_2_1)
56REGISTER_MAP_ELEMENT(int_level_2_0)
57REGISTER_MAP_ELEMENT(int_level_1_3)
58REGISTER_MAP_ELEMENT(int_level_1_2)
59REGISTER_MAP_ELEMENT(int_level_1_1)
60REGISTER_MAP_ELEMENT(int_level_1_0)
61REGISTER_MAP_ELEMENT(int_level_0_3)
62REGISTER_MAP_ELEMENT(int_level_0_2)
63REGISTER_MAP_ELEMENT(int_level_0_1)
64REGISTER_MAP_ELEMENT(int_level_0_0)
65REGISTER_MAP_ELEMENT(int_docsis_en)
66REGISTER_MAP_ELEMENT(mips_pll_setup)
67REGISTER_MAP_ELEMENT(fs432x4b4_usb_ctl)
68REGISTER_MAP_ELEMENT(test_bus)
69REGISTER_MAP_ELEMENT(crt_spare)
70REGISTER_MAP_ELEMENT(usb2_ohci_int_mask)
71REGISTER_MAP_ELEMENT(usb2_strap)
72REGISTER_MAP_ELEMENT(ehci_hcapbase)
73REGISTER_MAP_ELEMENT(ohci_hc_revision)
74REGISTER_MAP_ELEMENT(bcm1_bs_lmi_steer)
75REGISTER_MAP_ELEMENT(usb2_control)
76REGISTER_MAP_ELEMENT(usb2_stbus_obc)
77REGISTER_MAP_ELEMENT(usb2_stbus_mess_size)
78REGISTER_MAP_ELEMENT(usb2_stbus_chunk_size)
79REGISTER_MAP_ELEMENT(pcie_regs)
80REGISTER_MAP_ELEMENT(tim_ch)
81REGISTER_MAP_ELEMENT(tim_cl)
82REGISTER_MAP_ELEMENT(gpio_dout)
83REGISTER_MAP_ELEMENT(gpio_din)
84REGISTER_MAP_ELEMENT(gpio_dir)
85REGISTER_MAP_ELEMENT(watchdog)
86REGISTER_MAP_ELEMENT(front_panel)
87REGISTER_MAP_ELEMENT(misc_clk_ctl1)
88REGISTER_MAP_ELEMENT(misc_clk_ctl2)
89REGISTER_MAP_ELEMENT(crt_ext_ctl)
90REGISTER_MAP_ELEMENT(register_maps)
diff --git a/arch/mips/include/asm/mach-powertv/asic_regs.h b/arch/mips/include/asm/mach-powertv/asic_regs.h
deleted file mode 100644
index 06712abb3e55..000000000000
--- a/arch/mips/include/asm/mach-powertv/asic_regs.h
+++ /dev/null
@@ -1,125 +0,0 @@
1/*
2 * Copyright (C) 2009 Cisco Systems, 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 * 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 St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef __ASM_MACH_POWERTV_ASIC_H_
20#define __ASM_MACH_POWERTV_ASIC_H_
21#include <linux/io.h>
22
23/* ASIC types */
24enum asic_type {
25 ASIC_UNKNOWN,
26 ASIC_ZEUS,
27 ASIC_CALLIOPE,
28 ASIC_CRONUS,
29 ASIC_CRONUSLITE,
30 ASIC_GAIA,
31 ASICS /* Number of supported ASICs */
32};
33
34/* hardcoded values read from Chip Version registers */
35#define CRONUS_10 0x0B4C1C20
36#define CRONUS_11 0x0B4C1C21
37#define CRONUSLITE_10 0x0B4C1C40
38
39#define NAND_FLASH_BASE 0x03000000
40#define CALLIOPE_IO_BASE 0x08000000
41#define GAIA_IO_BASE 0x09000000
42#define CRONUS_IO_BASE 0x09000000
43#define ZEUS_IO_BASE 0x09000000
44
45#define ASIC_IO_SIZE 0x01000000
46
47/* Definitions for backward compatibility */
48#define UART1_INTSTAT uart1_intstat
49#define UART1_INTEN uart1_inten
50#define UART1_CONFIG1 uart1_config1
51#define UART1_CONFIG2 uart1_config2
52#define UART1_DIVISORHI uart1_divisorhi
53#define UART1_DIVISORLO uart1_divisorlo
54#define UART1_DATA uart1_data
55#define UART1_STATUS uart1_status
56
57/* ASIC register enumeration */
58union register_map_entry {
59 unsigned long phys;
60 u32 *virt;
61};
62
63#define REGISTER_MAP_ELEMENT(x) union register_map_entry x;
64struct register_map {
65#include <asm/mach-powertv/asic_reg_map.h>
66};
67#undef REGISTER_MAP_ELEMENT
68
69/**
70 * register_map_offset_phys - add an offset to the physical address
71 * @map: Pointer to the &struct register_map
72 * @offset: Value to add
73 *
74 * Only adds the base to non-zero physical addresses
75 */
76static inline void register_map_offset_phys(struct register_map *map,
77 unsigned long offset)
78{
79#define REGISTER_MAP_ELEMENT(x) do { \
80 if (map->x.phys != 0) \
81 map->x.phys += offset; \
82 } while (false);
83
84#include <asm/mach-powertv/asic_reg_map.h>
85#undef REGISTER_MAP_ELEMENT
86}
87
88/**
89 * register_map_virtualize - Convert &register_map to virtual addresses
90 * @map: Pointer to &register_map to virtualize
91 */
92static inline void register_map_virtualize(struct register_map *map)
93{
94#define REGISTER_MAP_ELEMENT(x) do { \
95 map->x.virt = (!map->x.phys) ? NULL : \
96 UNCAC_ADDR(phys_to_virt(map->x.phys)); \
97 } while (false);
98
99#include <asm/mach-powertv/asic_reg_map.h>
100#undef REGISTER_MAP_ELEMENT
101}
102
103extern struct register_map _asic_register_map;
104extern unsigned long asic_phy_base;
105
106/*
107 * Macros to interface to registers through their ioremapped address
108 * asic_reg_phys_addr Returns the physical address of the given register
109 * asic_reg_addr Returns the iomapped virtual address of the given
110 * register.
111 */
112#define asic_reg_addr(x) (_asic_register_map.x.virt)
113#define asic_reg_phys_addr(x) (virt_to_phys((void *) CAC_ADDR( \
114 (unsigned long) asic_reg_addr(x))))
115
116/*
117 * The asic_reg macro is gone. It should be replaced by either asic_read or
118 * asic_write, as appropriate.
119 */
120
121#define asic_read(x) readl(asic_reg_addr(x))
122#define asic_write(v, x) writel(v, asic_reg_addr(x))
123
124extern void asic_irq_init(void);
125#endif
diff --git a/arch/mips/include/asm/mach-powertv/cpu-feature-overrides.h b/arch/mips/include/asm/mach-powertv/cpu-feature-overrides.h
deleted file mode 100644
index 58c76ec32a19..000000000000
--- a/arch/mips/include/asm/mach-powertv/cpu-feature-overrides.h
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * Copyright (C) 2010 Cisco Systems, 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 * 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 St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef _ASM_MACH_POWERTV_CPU_FEATURE_OVERRIDES_H_
20#define _ASM_MACH_POWERTV_CPU_FEATURE_OVERRIDES_H_
21#define cpu_has_tlb 1
22#define cpu_has_4kex 1
23#define cpu_has_3k_cache 0
24#define cpu_has_4k_cache 1
25#define cpu_has_tx39_cache 0
26#define cpu_has_fpu 0
27#define cpu_has_counter 1
28#define cpu_has_watch 1
29#define cpu_has_divec 1
30#define cpu_has_vce 0
31#define cpu_has_cache_cdex_p 0
32#define cpu_has_cache_cdex_s 0
33#define cpu_has_mcheck 1
34#define cpu_has_ejtag 1
35#define cpu_has_llsc 1
36#define cpu_has_mips16 0
37#define cpu_has_mdmx 0
38#define cpu_has_mips3d 0
39#define cpu_has_smartmips 0
40#define cpu_has_vtag_icache 0
41#define cpu_has_dc_aliases 0
42#define cpu_has_ic_fills_f_dc 0
43#define cpu_has_mips32r1 0
44#define cpu_has_mips32r2 1
45#define cpu_has_mips64r1 0
46#define cpu_has_mips64r2 0
47#define cpu_has_dsp 0
48#define cpu_has_dsp2 0
49#define cpu_has_mipsmt 0
50#define cpu_has_userlocal 0
51#define cpu_has_nofpuex 0
52#define cpu_has_64bits 0
53#define cpu_has_64bit_zero_reg 0
54#define cpu_has_vint 1
55#define cpu_has_veic 1
56#define cpu_has_inclusive_pcaches 0
57
58#define cpu_dcache_line_size() 32
59#define cpu_icache_line_size() 32
60#endif
diff --git a/arch/mips/include/asm/mach-powertv/dma-coherence.h b/arch/mips/include/asm/mach-powertv/dma-coherence.h
deleted file mode 100644
index f8316720a218..000000000000
--- a/arch/mips/include/asm/mach-powertv/dma-coherence.h
+++ /dev/null
@@ -1,117 +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 * Version from mach-generic modified to support PowerTV port
7 * Portions Copyright (C) 2009 Cisco Systems, Inc.
8 * Copyright (C) 2006 Ralf Baechle <ralf@linux-mips.org>
9 *
10 */
11
12#ifndef __ASM_MACH_POWERTV_DMA_COHERENCE_H
13#define __ASM_MACH_POWERTV_DMA_COHERENCE_H
14
15#include <linux/sched.h>
16#include <linux/device.h>
17#include <asm/mach-powertv/asic.h>
18
19static inline bool is_kseg2(void *addr)
20{
21 return (unsigned long)addr >= KSEG2;
22}
23
24static inline unsigned long virt_to_phys_from_pte(void *addr)
25{
26 pgd_t *pgd;
27 pud_t *pud;
28 pmd_t *pmd;
29 pte_t *ptep, pte;
30
31 unsigned long virt_addr = (unsigned long)addr;
32 unsigned long phys_addr = 0UL;
33
34 /* get the page global directory. */
35 pgd = pgd_offset_k(virt_addr);
36
37 if (!pgd_none(*pgd)) {
38 /* get the page upper directory */
39 pud = pud_offset(pgd, virt_addr);
40 if (!pud_none(*pud)) {
41 /* get the page middle directory */
42 pmd = pmd_offset(pud, virt_addr);
43 if (!pmd_none(*pmd)) {
44 /* get a pointer to the page table entry */
45 ptep = pte_offset(pmd, virt_addr);
46 pte = *ptep;
47 /* check for a valid page */
48 if (pte_present(pte)) {
49 /* get the physical address the page is
50 * referring to */
51 phys_addr = (unsigned long)
52 page_to_phys(pte_page(pte));
53 /* add the offset within the page */
54 phys_addr |= (virt_addr & ~PAGE_MASK);
55 }
56 }
57 }
58 }
59
60 return phys_addr;
61}
62
63static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
64 size_t size)
65{
66 if (is_kseg2(addr))
67 return phys_to_dma(virt_to_phys_from_pte(addr));
68 else
69 return phys_to_dma(virt_to_phys(addr));
70}
71
72static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
73 struct page *page)
74{
75 return phys_to_dma(page_to_phys(page));
76}
77
78static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
79 dma_addr_t dma_addr)
80{
81 return dma_to_phys(dma_addr);
82}
83
84static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
85 size_t size, enum dma_data_direction direction)
86{
87}
88
89static inline int plat_dma_supported(struct device *dev, u64 mask)
90{
91 /*
92 * we fall back to GFP_DMA when the mask isn't all 1s,
93 * so we can't guarantee allocations that must be
94 * within a tighter range than GFP_DMA..
95 */
96 if (mask < DMA_BIT_MASK(24))
97 return 0;
98
99 return 1;
100}
101
102static inline void plat_extra_sync_for_device(struct device *dev)
103{
104}
105
106static inline int plat_dma_mapping_error(struct device *dev,
107 dma_addr_t dma_addr)
108{
109 return 0;
110}
111
112static inline int plat_device_is_coherent(struct device *dev)
113{
114 return 0;
115}
116
117#endif /* __ASM_MACH_POWERTV_DMA_COHERENCE_H */
diff --git a/arch/mips/include/asm/mach-powertv/interrupts.h b/arch/mips/include/asm/mach-powertv/interrupts.h
deleted file mode 100644
index 6c463be62156..000000000000
--- a/arch/mips/include/asm/mach-powertv/interrupts.h
+++ /dev/null
@@ -1,253 +0,0 @@
1/*
2 * Copyright (C) 2009 Cisco Systems, 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 * 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 St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef _ASM_MACH_POWERTV_INTERRUPTS_H_
20#define _ASM_MACH_POWERTV_INTERRUPTS_H_
21
22/*
23 * Defines for all of the interrupt lines
24 */
25
26/* Definitions for backward compatibility */
27#define kIrq_Uart1 irq_uart1
28
29#define ibase 0
30
31/*------------- Register: int_stat_3 */
32/* 126 unused (bit 31) */
33#define irq_asc2video (ibase+126) /* ASC 2 Video Interrupt */
34#define irq_asc1video (ibase+125) /* ASC 1 Video Interrupt */
35#define irq_comms_block_wd (ibase+124) /* ASC 1 Video Interrupt */
36#define irq_fdma_mailbox (ibase+123) /* FDMA Mailbox Output */
37#define irq_fdma_gp (ibase+122) /* FDMA GP Output */
38#define irq_mips_pic (ibase+121) /* MIPS Performance Counter
39 * Interrupt */
40#define irq_mips_timer (ibase+120) /* MIPS Timer Interrupt */
41#define irq_memory_protect (ibase+119) /* Memory Protection Interrupt
42 * -- Ored by glue logic inside
43 * SPARC ILC (see
44 * INT_MEM_PROT_STAT, below,
45 * for individual interrupts)
46 */
47/* 118 unused (bit 22) */
48#define irq_sbag (ibase+117) /* SBAG Interrupt -- Ored by
49 * glue logic inside SPARC ILC
50 * (see INT_SBAG_STAT, below,
51 * for individual interrupts) */
52#define irq_qam_b_fec (ibase+116) /* QAM B FEC Interrupt */
53#define irq_qam_a_fec (ibase+115) /* QAM A FEC Interrupt */
54/* 114 unused (bit 18) */
55#define irq_mailbox (ibase+113) /* Mailbox Debug Interrupt --
56 * Ored by glue logic inside
57 * SPARC ILC (see
58 * INT_MAILBOX_STAT, below, for
59 * individual interrupts) */
60#define irq_fuse_stat1 (ibase+112) /* Fuse Status 1 */
61#define irq_fuse_stat2 (ibase+111) /* Fuse Status 2 */
62#define irq_fuse_stat3 (ibase+110) /* Blitter Interrupt / Fuse
63 * Status 3 */
64#define irq_blitter (ibase+110) /* Blitter Interrupt / Fuse
65 * Status 3 */
66#define irq_avc1_pp0 (ibase+109) /* AVC Decoder #1 PP0
67 * Interrupt */
68#define irq_avc1_pp1 (ibase+108) /* AVC Decoder #1 PP1
69 * Interrupt */
70#define irq_avc1_mbe (ibase+107) /* AVC Decoder #1 MBE
71 * Interrupt */
72#define irq_avc2_pp0 (ibase+106) /* AVC Decoder #2 PP0
73 * Interrupt */
74#define irq_avc2_pp1 (ibase+105) /* AVC Decoder #2 PP1
75 * Interrupt */
76#define irq_avc2_mbe (ibase+104) /* AVC Decoder #2 MBE
77 * Interrupt */
78#define irq_zbug_spi (ibase+103) /* Zbug SPI Slave Interrupt */
79#define irq_qam_mod2 (ibase+102) /* QAM Modulator 2 DMA
80 * Interrupt */
81#define irq_ir_rx (ibase+101) /* IR RX 2 Interrupt */
82#define irq_aud_dsp2 (ibase+100) /* Audio DSP #2 Interrupt */
83#define irq_aud_dsp1 (ibase+99) /* Audio DSP #1 Interrupt */
84#define irq_docsis (ibase+98) /* DOCSIS Debug Interrupt */
85#define irq_sd_dvp1 (ibase+97) /* SD DVP #1 Interrupt */
86#define irq_sd_dvp2 (ibase+96) /* SD DVP #2 Interrupt */
87/*------------- Register: int_stat_2 */
88#define irq_hd_dvp (ibase+95) /* HD DVP Interrupt */
89#define kIrq_Prewatchdog (ibase+94) /* watchdog Pre-Interrupt */
90#define irq_timer2 (ibase+93) /* Programmable Timer
91 * Interrupt 2 */
92#define irq_1394 (ibase+92) /* 1394 Firewire Interrupt */
93#define irq_usbohci (ibase+91) /* USB 2.0 OHCI Interrupt */
94#define irq_usbehci (ibase+90) /* USB 2.0 EHCI Interrupt */
95#define irq_pciexp (ibase+89) /* PCI Express 0 Interrupt */
96#define irq_pciexp0 (ibase+89) /* PCI Express 0 Interrupt */
97#define irq_afe1 (ibase+88) /* AFE 1 Interrupt */
98#define irq_sata (ibase+87) /* SATA 1 Interrupt */
99#define irq_sata1 (ibase+87) /* SATA 1 Interrupt */
100#define irq_dtcp (ibase+86) /* DTCP Interrupt */
101#define irq_pciexp1 (ibase+85) /* PCI Express 1 Interrupt */
102/* 84 unused (bit 20) */
103/* 83 unused (bit 19) */
104/* 82 unused (bit 18) */
105#define irq_sata2 (ibase+81) /* SATA2 Interrupt */
106#define irq_uart2 (ibase+80) /* UART2 Interrupt */
107#define irq_legacy_usb (ibase+79) /* Legacy USB Host ISR (1.1
108 * Host module) */
109#define irq_pod (ibase+78) /* POD Interrupt */
110#define irq_slave_usb (ibase+77) /* Slave USB */
111#define irq_denc1 (ibase+76) /* DENC #1 VTG Interrupt */
112#define irq_vbi_vtg (ibase+75) /* VBI VTG Interrupt */
113#define irq_afe2 (ibase+74) /* AFE 2 Interrupt */
114#define irq_denc2 (ibase+73) /* DENC #2 VTG Interrupt */
115#define irq_asc2 (ibase+72) /* ASC #2 Interrupt */
116#define irq_asc1 (ibase+71) /* ASC #1 Interrupt */
117#define irq_mod_dma (ibase+70) /* Modulator DMA Interrupt */
118#define irq_byte_eng1 (ibase+69) /* Byte Engine Interrupt [1] */
119#define irq_byte_eng0 (ibase+68) /* Byte Engine Interrupt [0] */
120/* 67 unused (bit 03) */
121/* 66 unused (bit 02) */
122/* 65 unused (bit 01) */
123/* 64 unused (bit 00) */
124/*------------- Register: int_stat_1 */
125/* 63 unused (bit 31) */
126/* 62 unused (bit 30) */
127/* 61 unused (bit 29) */
128/* 60 unused (bit 28) */
129/* 59 unused (bit 27) */
130/* 58 unused (bit 26) */
131/* 57 unused (bit 25) */
132/* 56 unused (bit 24) */
133#define irq_buf_dma_mem2mem (ibase+55) /* BufDMA Memory to Memory
134 * Interrupt */
135#define irq_buf_dma_usbtransmit (ibase+54) /* BufDMA USB Transmit
136 * Interrupt */
137#define irq_buf_dma_qpskpodtransmit (ibase+53) /* BufDMA QPSK/POD Tramsit
138 * Interrupt */
139#define irq_buf_dma_transmit_error (ibase+52) /* BufDMA Transmit Error
140 * Interrupt */
141#define irq_buf_dma_usbrecv (ibase+51) /* BufDMA USB Receive
142 * Interrupt */
143#define irq_buf_dma_qpskpodrecv (ibase+50) /* BufDMA QPSK/POD Receive
144 * Interrupt */
145#define irq_buf_dma_recv_error (ibase+49) /* BufDMA Receive Error
146 * Interrupt */
147#define irq_qamdma_transmit_play (ibase+48) /* QAMDMA Transmit/Play
148 * Interrupt */
149#define irq_qamdma_transmit_error (ibase+47) /* QAMDMA Transmit Error
150 * Interrupt */
151#define irq_qamdma_recv2high (ibase+46) /* QAMDMA Receive 2 High
152 * (Chans 63-32) */
153#define irq_qamdma_recv2low (ibase+45) /* QAMDMA Receive 2 Low
154 * (Chans 31-0) */
155#define irq_qamdma_recv1high (ibase+44) /* QAMDMA Receive 1 High
156 * (Chans 63-32) */
157#define irq_qamdma_recv1low (ibase+43) /* QAMDMA Receive 1 Low
158 * (Chans 31-0) */
159#define irq_qamdma_recv_error (ibase+42) /* QAMDMA Receive Error
160 * Interrupt */
161#define irq_mpegsplice (ibase+41) /* MPEG Splice Interrupt */
162#define irq_deinterlace_rdy (ibase+40) /* Deinterlacer Frame Ready
163 * Interrupt */
164#define irq_ext_in0 (ibase+39) /* External Interrupt irq_in0 */
165#define irq_gpio3 (ibase+38) /* GP I/O IRQ 3 - From GP I/O
166 * Module */
167#define irq_gpio2 (ibase+37) /* GP I/O IRQ 2 - From GP I/O
168 * Module (ABE_intN) */
169#define irq_pcrcmplt1 (ibase+36) /* PCR Capture Complete or
170 * Discontinuity 1 */
171#define irq_pcrcmplt2 (ibase+35) /* PCR Capture Complete or
172 * Discontinuity 2 */
173#define irq_parse_peierr (ibase+34) /* PID Parser Error Detect
174 * (PEI) */
175#define irq_parse_cont_err (ibase+33) /* PID Parser continuity error
176 * detect */
177#define irq_ds1framer (ibase+32) /* DS1 Framer Interrupt */
178/*------------- Register: int_stat_0 */
179#define irq_gpio1 (ibase+31) /* GP I/O IRQ 1 - From GP I/O
180 * Module */
181#define irq_gpio0 (ibase+30) /* GP I/O IRQ 0 - From GP I/O
182 * Module */
183#define irq_qpsk_out_aloha (ibase+29) /* QPSK Output Slotted Aloha
184 * (chan 3) Transmission
185 * Completed OK */
186#define irq_qpsk_out_tdma (ibase+28) /* QPSK Output TDMA (chan 2)
187 * Transmission Completed OK */
188#define irq_qpsk_out_reserve (ibase+27) /* QPSK Output Reservation
189 * (chan 1) Transmission
190 * Completed OK */
191#define irq_qpsk_out_aloha_err (ibase+26) /* QPSK Output Slotted Aloha
192 * (chan 3)Transmission
193 * completed with Errors. */
194#define irq_qpsk_out_tdma_err (ibase+25) /* QPSK Output TDMA (chan 2)
195 * Transmission completed with
196 * Errors. */
197#define irq_qpsk_out_rsrv_err (ibase+24) /* QPSK Output Reservation
198 * (chan 1) Transmission
199 * completed with Errors */
200#define irq_aloha_fail (ibase+23) /* Unsuccessful Resend of Aloha
201 * for N times. Aloha retry
202 * timeout for channel 3. */
203#define irq_timer1 (ibase+22) /* Programmable Timer
204 * Interrupt */
205#define irq_keyboard (ibase+21) /* Keyboard Module Interrupt */
206#define irq_i2c (ibase+20) /* I2C Module Interrupt */
207#define irq_spi (ibase+19) /* SPI Module Interrupt */
208#define irq_irblaster (ibase+18) /* IR Blaster Interrupt */
209#define irq_splice_detect (ibase+17) /* PID Key Change Interrupt or
210 * Splice Detect Interrupt */
211#define irq_se_micro (ibase+16) /* Secure Micro I/F Module
212 * Interrupt */
213#define irq_uart1 (ibase+15) /* UART Interrupt */
214#define irq_irrecv (ibase+14) /* IR Receiver Interrupt */
215#define irq_host_int1 (ibase+13) /* Host-to-Host Interrupt 1 */
216#define irq_host_int0 (ibase+12) /* Host-to-Host Interrupt 0 */
217#define irq_qpsk_hecerr (ibase+11) /* QPSK HEC Error Interrupt */
218#define irq_qpsk_crcerr (ibase+10) /* QPSK AAL-5 CRC Error
219 * Interrupt */
220/* 9 unused (bit 09) */
221/* 8 unused (bit 08) */
222#define irq_psicrcerr (ibase+7) /* QAM PSI CRC Error
223 * Interrupt */
224#define irq_psilength_err (ibase+6) /* QAM PSI Length Error
225 * Interrupt */
226#define irq_esfforward (ibase+5) /* ESF Interrupt Mark From
227 * Forward Path Reference -
228 * every 3ms when forward Mbits
229 * and forward slot control
230 * bytes are updated. */
231#define irq_esfreverse (ibase+4) /* ESF Interrupt Mark from
232 * Reverse Path Reference -
233 * delayed from forward mark by
234 * the ranging delay plus a
235 * fixed amount. When reverse
236 * Mbits and reverse slot
237 * control bytes are updated.
238 * Occurs every 3ms for 3.0M and
239 * 1.554 M upstream rates and
240 * every 6 ms for 256K upstream
241 * rate. */
242#define irq_aloha_timeout (ibase+3) /* Slotted-Aloha timeout on
243 * Channel 1. */
244#define irq_reservation (ibase+2) /* Partial (or Incremental)
245 * Reservation Message Completed
246 * or Slotted aloha verify for
247 * channel 1. */
248#define irq_aloha3 (ibase+1) /* Slotted-Aloha Message Verify
249 * Interrupt or Reservation
250 * increment completed for
251 * channel 3. */
252#define irq_mpeg_d (ibase+0) /* MPEG Decoder Interrupt */
253#endif /* _ASM_MACH_POWERTV_INTERRUPTS_H_ */
diff --git a/arch/mips/include/asm/mach-powertv/ioremap.h b/arch/mips/include/asm/mach-powertv/ioremap.h
deleted file mode 100644
index c86ef094ec37..000000000000
--- a/arch/mips/include/asm/mach-powertv/ioremap.h
+++ /dev/null
@@ -1,167 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version
5 * 2 of the License, or (at your option) any later version.
6 *
7 * Portions Copyright (C) Cisco Systems, Inc.
8 */
9#ifndef __ASM_MACH_POWERTV_IOREMAP_H
10#define __ASM_MACH_POWERTV_IOREMAP_H
11
12#include <linux/types.h>
13#include <linux/log2.h>
14#include <linux/compiler.h>
15
16#include <asm/pgtable-bits.h>
17#include <asm/addrspace.h>
18
19/* We're going to mess with bits, so get sizes */
20#define IOR_BPC 8 /* Bits per char */
21#define IOR_PHYS_BITS (IOR_BPC * sizeof(phys_addr_t))
22#define IOR_DMA_BITS (IOR_BPC * sizeof(dma_addr_t))
23
24/*
25 * Define the granularity of physical/DMA mapping in terms of the number
26 * of bits that defines the offset within a grain. These will be the
27 * least significant bits of the address. The rest of a physical or DMA
28 * address will be used to index into an appropriate table to find the
29 * offset to add to the address to yield the corresponding DMA or physical
30 * address, respectively.
31 */
32#define IOR_LSBITS 22 /* Bits in a grain */
33
34/*
35 * Compute the number of most significant address bits after removing those
36 * used for the offset within a grain and then compute the number of table
37 * entries for the conversion.
38 */
39#define IOR_PHYS_MSBITS (IOR_PHYS_BITS - IOR_LSBITS)
40#define IOR_NUM_PHYS_TO_DMA ((phys_addr_t) 1 << IOR_PHYS_MSBITS)
41
42#define IOR_DMA_MSBITS (IOR_DMA_BITS - IOR_LSBITS)
43#define IOR_NUM_DMA_TO_PHYS ((dma_addr_t) 1 << IOR_DMA_MSBITS)
44
45/*
46 * Define data structures used as elements in the arrays for the conversion
47 * between physical and DMA addresses. We do some slightly fancy math to
48 * compute the width of the offset element of the conversion tables so
49 * that we can have the smallest conversion tables. Next, round up the
50 * sizes to the next higher power of two, i.e. the offset element will have
51 * 8, 16, 32, 64, etc. bits. This eliminates the need to mask off any
52 * bits. Finally, we compute a shift value that puts the most significant
53 * bits of the offset into the most significant bits of the offset element.
54 * This makes it more efficient on processors without barrel shifters and
55 * easier to see the values if the conversion table is dumped in binary.
56 */
57#define _IOR_OFFSET_WIDTH(n) (1 << order_base_2(n))
58#define IOR_OFFSET_WIDTH(n) \
59 (_IOR_OFFSET_WIDTH(n) < 8 ? 8 : _IOR_OFFSET_WIDTH(n))
60
61#define IOR_PHYS_OFFSET_BITS IOR_OFFSET_WIDTH(IOR_PHYS_MSBITS)
62#define IOR_PHYS_SHIFT (IOR_PHYS_BITS - IOR_PHYS_OFFSET_BITS)
63
64#define IOR_DMA_OFFSET_BITS IOR_OFFSET_WIDTH(IOR_DMA_MSBITS)
65#define IOR_DMA_SHIFT (IOR_DMA_BITS - IOR_DMA_OFFSET_BITS)
66
67struct ior_phys_to_dma {
68 dma_addr_t offset:IOR_DMA_OFFSET_BITS __packed
69 __aligned((IOR_DMA_OFFSET_BITS / IOR_BPC));
70};
71
72struct ior_dma_to_phys {
73 dma_addr_t offset:IOR_PHYS_OFFSET_BITS __packed
74 __aligned((IOR_PHYS_OFFSET_BITS / IOR_BPC));
75};
76
77extern struct ior_phys_to_dma _ior_phys_to_dma[IOR_NUM_PHYS_TO_DMA];
78extern struct ior_dma_to_phys _ior_dma_to_phys[IOR_NUM_DMA_TO_PHYS];
79
80static inline dma_addr_t _phys_to_dma_offset_raw(phys_addr_t phys)
81{
82 return (dma_addr_t)_ior_phys_to_dma[phys >> IOR_LSBITS].offset;
83}
84
85static inline dma_addr_t _dma_to_phys_offset_raw(dma_addr_t dma)
86{
87 return (dma_addr_t)_ior_dma_to_phys[dma >> IOR_LSBITS].offset;
88}
89
90/* These are not portable and should not be used in drivers. Drivers should
91 * be using ioremap() and friends to map physical addresses to virtual
92 * addresses and dma_map*() and friends to map virtual addresses into DMA
93 * addresses and back.
94 */
95static inline dma_addr_t phys_to_dma(phys_addr_t phys)
96{
97 return phys + (_phys_to_dma_offset_raw(phys) << IOR_PHYS_SHIFT);
98}
99
100static inline phys_addr_t dma_to_phys(dma_addr_t dma)
101{
102 return dma + (_dma_to_phys_offset_raw(dma) << IOR_DMA_SHIFT);
103}
104
105extern void ioremap_add_map(dma_addr_t phys, phys_addr_t alias,
106 dma_addr_t size);
107
108/*
109 * Allow physical addresses to be fixed up to help peripherals located
110 * outside the low 32-bit range -- generic pass-through version.
111 */
112static inline phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size)
113{
114 return phys_addr;
115}
116
117/*
118 * Handle the special case of addresses the area aliased into the first
119 * 512 MiB of the processor's physical address space. These turn into either
120 * kseg0 or kseg1 addresses, depending on flags.
121 */
122static inline void __iomem *plat_ioremap(phys_t start, unsigned long size,
123 unsigned long flags)
124{
125 phys_addr_t start_offset;
126 void __iomem *result = NULL;
127
128 /* Start by checking to see whether this is an aliased address */
129 start_offset = _dma_to_phys_offset_raw(start);
130
131 /*
132 * If:
133 * o the memory is aliased into the first 512 MiB, and
134 * o the start and end are in the same RAM bank, and
135 * o we don't have a zero size or wrap around, and
136 * o we are supposed to create an uncached mapping,
137 * handle this is a kseg0 or kseg1 address
138 */
139 if (start_offset != 0) {
140 phys_addr_t last;
141 dma_addr_t dma_to_phys_offset;
142
143 last = start + size - 1;
144 dma_to_phys_offset =
145 _dma_to_phys_offset_raw(last) << IOR_DMA_SHIFT;
146
147 if (dma_to_phys_offset == start_offset &&
148 size != 0 && start <= last) {
149 phys_t adjusted_start;
150 adjusted_start = start + start_offset;
151 if (flags == _CACHE_UNCACHED)
152 result = (void __iomem *) (unsigned long)
153 CKSEG1ADDR(adjusted_start);
154 else
155 result = (void __iomem *) (unsigned long)
156 CKSEG0ADDR(adjusted_start);
157 }
158 }
159
160 return result;
161}
162
163static inline int plat_iounmap(const volatile void __iomem *addr)
164{
165 return 0;
166}
167#endif /* __ASM_MACH_POWERTV_IOREMAP_H */
diff --git a/arch/mips/include/asm/mach-powertv/war.h b/arch/mips/include/asm/mach-powertv/war.h
deleted file mode 100644
index c5651c8e58d1..000000000000
--- a/arch/mips/include/asm/mach-powertv/war.h
+++ /dev/null
@@ -1,27 +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 * This version for the PowerTV platform copied from the Malta version.
7 *
8 * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
9 * Portions copyright (C) 2009 Cisco Systems, Inc.
10 */
11#ifndef __ASM_MACH_POWERTV_WAR_H
12#define __ASM_MACH_POWERTV_WAR_H
13
14#define R4600_V1_INDEX_ICACHEOP_WAR 0
15#define R4600_V1_HIT_CACHEOP_WAR 0
16#define R4600_V2_HIT_CACHEOP_WAR 0
17#define R5432_CP0_INTERRUPT_WAR 0
18#define BCM1250_M3_WAR 0
19#define SIBYTE_1956_WAR 0
20#define MIPS4K_ICACHE_REFILL_WAR 1
21#define MIPS_CACHE_SYNC_WAR 1
22#define TX49XX_ICACHE_INDEX_INV_WAR 0
23#define ICACHE_REFILLS_WORKAROUND_WAR 1
24#define R10000_LLSC_WAR 0
25#define MIPS34K_MISSED_ITLB_WAR 0
26
27#endif /* __ASM_MACH_POWERTV_WAR_H */
diff --git a/arch/mips/include/asm/mips-boards/piix4.h b/arch/mips/include/asm/mips-boards/piix4.h
index a02596cf1abd..e33227998713 100644
--- a/arch/mips/include/asm/mips-boards/piix4.h
+++ b/arch/mips/include/asm/mips-boards/piix4.h
@@ -1,6 +1,7 @@
1/* 1/*
2 * Carsten Langgaard, carstenl@mips.com 2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. 3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 * Copyright (C) 2013 Imagination Technologies Ltd.
4 * 5 *
5 * This program is free software; you can distribute it and/or modify it 6 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as 7 * under the terms of the GNU General Public License (Version 2) as
@@ -20,61 +21,26 @@
20#ifndef __ASM_MIPS_BOARDS_PIIX4_H 21#ifndef __ASM_MIPS_BOARDS_PIIX4_H
21#define __ASM_MIPS_BOARDS_PIIX4_H 22#define __ASM_MIPS_BOARDS_PIIX4_H
22 23
23/************************************************************************ 24/* PIRQX Route Control */
24 * IO register offsets 25#define PIIX4_FUNC0_PIRQRC 0x60
25 ************************************************************************/ 26#define PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_DISABLE (1 << 7)
26#define PIIX4_ICTLR1_ICW1 0x20 27#define PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_MASK 0xf
27#define PIIX4_ICTLR1_ICW2 0x21 28#define PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_MAX 16
28#define PIIX4_ICTLR1_ICW3 0x21 29/* Top Of Memory */
29#define PIIX4_ICTLR1_ICW4 0x21 30#define PIIX4_FUNC0_TOM 0x69
30#define PIIX4_ICTLR2_ICW1 0xa0 31#define PIIX4_FUNC0_TOM_TOP_OF_MEMORY_MASK 0xf0
31#define PIIX4_ICTLR2_ICW2 0xa1 32/* Deterministic Latency Control */
32#define PIIX4_ICTLR2_ICW3 0xa1 33#define PIIX4_FUNC0_DLC 0x82
33#define PIIX4_ICTLR2_ICW4 0xa1 34#define PIIX4_FUNC0_DLC_USBPR_EN (1 << 2)
34#define PIIX4_ICTLR1_OCW1 0x21 35#define PIIX4_FUNC0_DLC_PASSIVE_RELEASE_EN (1 << 1)
35#define PIIX4_ICTLR1_OCW2 0x20 36#define PIIX4_FUNC0_DLC_DELAYED_TRANSACTION_EN (1 << 0)
36#define PIIX4_ICTLR1_OCW3 0x20 37
37#define PIIX4_ICTLR1_OCW4 0x20 38/* IDE Timing */
38#define PIIX4_ICTLR2_OCW1 0xa1 39#define PIIX4_FUNC1_IDETIM_PRIMARY_LO 0x40
39#define PIIX4_ICTLR2_OCW2 0xa0 40#define PIIX4_FUNC1_IDETIM_PRIMARY_HI 0x41
40#define PIIX4_ICTLR2_OCW3 0xa0 41#define PIIX4_FUNC1_IDETIM_PRIMARY_HI_IDE_DECODE_EN (1 << 7)
41#define PIIX4_ICTLR2_OCW4 0xa0 42#define PIIX4_FUNC1_IDETIM_SECONDARY_LO 0x42
42 43#define PIIX4_FUNC1_IDETIM_SECONDARY_HI 0x43
43 44#define PIIX4_FUNC1_IDETIM_SECONDARY_HI_IDE_DECODE_EN (1 << 7)
44/************************************************************************
45 * Register encodings.
46 ************************************************************************/
47#define PIIX4_OCW2_NSEOI (0x1 << 5)
48#define PIIX4_OCW2_SEOI (0x3 << 5)
49#define PIIX4_OCW2_RNSEOI (0x5 << 5)
50#define PIIX4_OCW2_RAEOIS (0x4 << 5)
51#define PIIX4_OCW2_RAEOIC (0x0 << 5)
52#define PIIX4_OCW2_RSEOI (0x7 << 5)
53#define PIIX4_OCW2_SP (0x6 << 5)
54#define PIIX4_OCW2_NOP (0x2 << 5)
55
56#define PIIX4_OCW2_SEL (0x0 << 3)
57
58#define PIIX4_OCW2_ILS_0 0
59#define PIIX4_OCW2_ILS_1 1
60#define PIIX4_OCW2_ILS_2 2
61#define PIIX4_OCW2_ILS_3 3
62#define PIIX4_OCW2_ILS_4 4
63#define PIIX4_OCW2_ILS_5 5
64#define PIIX4_OCW2_ILS_6 6
65#define PIIX4_OCW2_ILS_7 7
66#define PIIX4_OCW2_ILS_8 0
67#define PIIX4_OCW2_ILS_9 1
68#define PIIX4_OCW2_ILS_10 2
69#define PIIX4_OCW2_ILS_11 3
70#define PIIX4_OCW2_ILS_12 4
71#define PIIX4_OCW2_ILS_13 5
72#define PIIX4_OCW2_ILS_14 6
73#define PIIX4_OCW2_ILS_15 7
74
75#define PIIX4_OCW3_SEL (0x1 << 3)
76
77#define PIIX4_OCW3_IRR 0x2
78#define PIIX4_OCW3_ISR 0x3
79 45
80#endif /* __ASM_MIPS_BOARDS_PIIX4_H */ 46#endif /* __ASM_MIPS_BOARDS_PIIX4_H */
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index fed1c3e9b486..e0331414c7d6 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -603,6 +603,13 @@
603#define MIPS_CONF4_MMUEXTDEF (_ULCAST_(3) << 14) 603#define MIPS_CONF4_MMUEXTDEF (_ULCAST_(3) << 14)
604#define MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT (_ULCAST_(1) << 14) 604#define MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT (_ULCAST_(1) << 14)
605 605
606#define MIPS_CONF5_NF (_ULCAST_(1) << 0)
607#define MIPS_CONF5_UFR (_ULCAST_(1) << 2)
608#define MIPS_CONF5_MSAEN (_ULCAST_(1) << 27)
609#define MIPS_CONF5_EVA (_ULCAST_(1) << 28)
610#define MIPS_CONF5_CV (_ULCAST_(1) << 29)
611#define MIPS_CONF5_K (_ULCAST_(1) << 30)
612
606#define MIPS_CONF6_SYND (_ULCAST_(1) << 13) 613#define MIPS_CONF6_SYND (_ULCAST_(1) << 13)
607 614
608#define MIPS_CONF7_WII (_ULCAST_(1) << 31) 615#define MIPS_CONF7_WII (_ULCAST_(1) << 31)
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h
index 3b29079b5424..e277bbad2871 100644
--- a/arch/mips/include/asm/mmu_context.h
+++ b/arch/mips/include/asm/mmu_context.h
@@ -24,21 +24,21 @@
24#endif /* SMTC */ 24#endif /* SMTC */
25#include <asm-generic/mm_hooks.h> 25#include <asm-generic/mm_hooks.h>
26 26
27#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
28
29#define TLBMISS_HANDLER_SETUP_PGD(pgd) \ 27#define TLBMISS_HANDLER_SETUP_PGD(pgd) \
30do { \ 28do { \
31 extern void tlbmiss_handler_setup_pgd(unsigned long); \ 29 extern void tlbmiss_handler_setup_pgd(unsigned long); \
32 tlbmiss_handler_setup_pgd((unsigned long)(pgd)); \ 30 tlbmiss_handler_setup_pgd((unsigned long)(pgd)); \
33} while (0) 31} while (0)
34 32
33#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
35#define TLBMISS_HANDLER_SETUP() \ 34#define TLBMISS_HANDLER_SETUP() \
36 do { \ 35 do { \
37 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir); \ 36 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir); \
38 write_c0_xcontext((unsigned long) smp_processor_id() << 51); \ 37 write_c0_xcontext((unsigned long) smp_processor_id() << \
38 SMP_CPUID_REGSHIFT); \
39 } while (0) 39 } while (0)
40 40
41#else /* CONFIG_MIPS_PGD_C0_CONTEXT: using pgd_current*/ 41#else /* !CONFIG_MIPS_PGD_C0_CONTEXT: using pgd_current*/
42 42
43/* 43/*
44 * For the fast tlb miss handlers, we keep a per cpu array of pointers 44 * For the fast tlb miss handlers, we keep a per cpu array of pointers
@@ -47,21 +47,11 @@ do { \
47 */ 47 */
48extern unsigned long pgd_current[]; 48extern unsigned long pgd_current[];
49 49
50#define TLBMISS_HANDLER_SETUP_PGD(pgd) \
51 pgd_current[smp_processor_id()] = (unsigned long)(pgd)
52
53#ifdef CONFIG_32BIT
54#define TLBMISS_HANDLER_SETUP() \ 50#define TLBMISS_HANDLER_SETUP() \
55 write_c0_context((unsigned long) smp_processor_id() << 25); \ 51 write_c0_context((unsigned long) smp_processor_id() << \
52 SMP_CPUID_REGSHIFT); \
56 back_to_back_c0_hazard(); \ 53 back_to_back_c0_hazard(); \
57 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) 54 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
58#endif
59#ifdef CONFIG_64BIT
60#define TLBMISS_HANDLER_SETUP() \
61 write_c0_context((unsigned long) smp_processor_id() << 26); \
62 back_to_back_c0_hazard(); \
63 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
64#endif
65#endif /* CONFIG_MIPS_PGD_C0_CONTEXT*/ 55#endif /* CONFIG_MIPS_PGD_C0_CONTEXT*/
66#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) 56#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
67 57
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
index 17daffb280a3..470f2095b346 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
@@ -69,6 +69,7 @@ void nlm_hal_init(void);
69int xlp_get_dram_map(int n, uint64_t *dram_map); 69int xlp_get_dram_map(int n, uint64_t *dram_map);
70 70
71/* Device tree related */ 71/* Device tree related */
72void xlp_early_init_devtree(void);
72void *xlp_dt_init(void *fdtp); 73void *xlp_dt_init(void *fdtp);
73 74
74static inline int cpu_is_xlpii(void) 75static inline int cpu_is_xlpii(void)
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index f194c08bd057..12d6842962be 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -83,6 +83,18 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
83extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 83extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
84 enum pci_mmap_state mmap_state, int write_combine); 84 enum pci_mmap_state mmap_state, int write_combine);
85 85
86#define HAVE_ARCH_PCI_RESOURCE_TO_USER
87
88static inline void pci_resource_to_user(const struct pci_dev *dev, int bar,
89 const struct resource *rsrc, resource_size_t *start,
90 resource_size_t *end)
91{
92 phys_t size = resource_size(rsrc);
93
94 *start = fixup_bigphys_addr(rsrc->start, size);
95 *end = rsrc->start + size;
96}
97
86/* 98/*
87 * Dynamic DMA mapping stuff. 99 * Dynamic DMA mapping stuff.
88 * MIPS has everything mapped statically. 100 * MIPS has everything mapped statically.
diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
index 881d18b4e298..b336037e8768 100644
--- a/arch/mips/include/asm/pgalloc.h
+++ b/arch/mips/include/asm/pgalloc.h
@@ -80,9 +80,12 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
80 struct page *pte; 80 struct page *pte;
81 81
82 pte = alloc_pages(GFP_KERNEL | __GFP_REPEAT, PTE_ORDER); 82 pte = alloc_pages(GFP_KERNEL | __GFP_REPEAT, PTE_ORDER);
83 if (pte) { 83 if (!pte)
84 clear_highpage(pte); 84 return NULL;
85 pgtable_page_ctor(pte); 85 clear_highpage(pte);
86 if (!pgtable_page_ctor(pte)) {
87 __free_page(pte);
88 return NULL;
86 } 89 }
87 return pte; 90 return pte;
88} 91}
diff --git a/arch/mips/include/asm/prom.h b/arch/mips/include/asm/prom.h
index 1e7e0961064b..ccd2b75f152c 100644
--- a/arch/mips/include/asm/prom.h
+++ b/arch/mips/include/asm/prom.h
@@ -17,22 +17,8 @@
17#include <linux/types.h> 17#include <linux/types.h>
18#include <asm/bootinfo.h> 18#include <asm/bootinfo.h>
19 19
20extern int early_init_dt_scan_memory_arch(unsigned long node,
21 const char *uname, int depth, void *data);
22
23extern void device_tree_init(void); 20extern void device_tree_init(void);
24 21
25static inline unsigned long pci_address_to_pio(phys_addr_t address)
26{
27 /*
28 * The ioport address can be directly used by inX() / outX()
29 */
30 BUG_ON(address > IO_SPACE_LIMIT);
31
32 return (unsigned long) address;
33}
34#define pci_address_to_pio pci_address_to_pio
35
36struct boot_param_header; 22struct boot_param_header;
37 23
38extern void __dt_setup_arch(struct boot_param_header *bph); 24extern void __dt_setup_arch(struct boot_param_header *bph);
diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h
index 5e6cd0947393..7bba9da110af 100644
--- a/arch/mips/include/asm/ptrace.h
+++ b/arch/mips/include/asm/ptrace.h
@@ -81,7 +81,6 @@ static inline long regs_return_value(struct pt_regs *regs)
81 81
82#define instruction_pointer(regs) ((regs)->cp0_epc) 82#define instruction_pointer(regs) ((regs)->cp0_epc)
83#define profile_pc(regs) instruction_pointer(regs) 83#define profile_pc(regs) instruction_pointer(regs)
84#define user_stack_pointer(r) ((r)->regs[29])
85 84
86extern asmlinkage void syscall_trace_enter(struct pt_regs *regs); 85extern asmlinkage void syscall_trace_enter(struct pt_regs *regs);
87extern asmlinkage void syscall_trace_leave(struct pt_regs *regs); 86extern asmlinkage void syscall_trace_leave(struct pt_regs *regs);
@@ -100,4 +99,17 @@ static inline void die_if_kernel(const char *str, struct pt_regs *regs)
100 (struct pt_regs *)((sp | (THREAD_SIZE - 1)) + 1 - 32) - 1; \ 99 (struct pt_regs *)((sp | (THREAD_SIZE - 1)) + 1 - 32) - 1; \
101}) 100})
102 101
102/* Helpers for working with the user stack pointer */
103
104static inline unsigned long user_stack_pointer(struct pt_regs *regs)
105{
106 return regs->regs[29];
107}
108
109static inline void user_stack_pointer_set(struct pt_regs *regs,
110 unsigned long val)
111{
112 regs->regs[29] = val;
113}
114
103#endif /* _ASM_PTRACE_H */ 115#endif /* _ASM_PTRACE_H */
diff --git a/arch/mips/include/asm/r4kcache.h b/arch/mips/include/asm/r4kcache.h
index a0b2650516ac..34d1a1917125 100644
--- a/arch/mips/include/asm/r4kcache.h
+++ b/arch/mips/include/asm/r4kcache.h
@@ -15,6 +15,7 @@
15#include <asm/asm.h> 15#include <asm/asm.h>
16#include <asm/cacheops.h> 16#include <asm/cacheops.h>
17#include <asm/cpu-features.h> 17#include <asm/cpu-features.h>
18#include <asm/cpu-type.h>
18#include <asm/mipsmtregs.h> 19#include <asm/mipsmtregs.h>
19 20
20/* 21/*
@@ -162,7 +163,15 @@ static inline void flush_scache_line_indexed(unsigned long addr)
162static inline void flush_icache_line(unsigned long addr) 163static inline void flush_icache_line(unsigned long addr)
163{ 164{
164 __iflush_prologue 165 __iflush_prologue
165 cache_op(Hit_Invalidate_I, addr); 166 switch (boot_cpu_type()) {
167 case CPU_LOONGSON2:
168 cache_op(Hit_Invalidate_I_Loongson23, addr);
169 break;
170
171 default:
172 cache_op(Hit_Invalidate_I, addr);
173 break;
174 }
166 __iflush_epilogue 175 __iflush_epilogue
167} 176}
168 177
@@ -208,7 +217,15 @@ static inline void flush_scache_line(unsigned long addr)
208 */ 217 */
209static inline void protected_flush_icache_line(unsigned long addr) 218static inline void protected_flush_icache_line(unsigned long addr)
210{ 219{
211 protected_cache_op(Hit_Invalidate_I, addr); 220 switch (boot_cpu_type()) {
221 case CPU_LOONGSON2:
222 protected_cache_op(Hit_Invalidate_I_Loongson23, addr);
223 break;
224
225 default:
226 protected_cache_op(Hit_Invalidate_I, addr);
227 break;
228 }
212} 229}
213 230
214/* 231/*
@@ -412,8 +429,8 @@ __BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 64
412__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 128) 429__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 128)
413 430
414/* build blast_xxx_range, protected_blast_xxx_range */ 431/* build blast_xxx_range, protected_blast_xxx_range */
415#define __BUILD_BLAST_CACHE_RANGE(pfx, desc, hitop, prot) \ 432#define __BUILD_BLAST_CACHE_RANGE(pfx, desc, hitop, prot, extra) \
416static inline void prot##blast_##pfx##cache##_range(unsigned long start, \ 433static inline void prot##extra##blast_##pfx##cache##_range(unsigned long start, \
417 unsigned long end) \ 434 unsigned long end) \
418{ \ 435{ \
419 unsigned long lsize = cpu_##desc##_line_size(); \ 436 unsigned long lsize = cpu_##desc##_line_size(); \
@@ -432,13 +449,15 @@ static inline void prot##blast_##pfx##cache##_range(unsigned long start, \
432 __##pfx##flush_epilogue \ 449 __##pfx##flush_epilogue \
433} 450}
434 451
435__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, protected_) 452__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, protected_, )
436__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, protected_) 453__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, protected_, )
437__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I, protected_) 454__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I, protected_, )
438__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, ) 455__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I_Loongson23, \
439__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, ) 456 protected_, loongson23_)
457__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, , )
458__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, , )
440/* blast_inv_dcache_range */ 459/* blast_inv_dcache_range */
441__BUILD_BLAST_CACHE_RANGE(inv_d, dcache, Hit_Invalidate_D, ) 460__BUILD_BLAST_CACHE_RANGE(inv_d, dcache, Hit_Invalidate_D, , )
442__BUILD_BLAST_CACHE_RANGE(inv_s, scache, Hit_Invalidate_SD, ) 461__BUILD_BLAST_CACHE_RANGE(inv_s, scache, Hit_Invalidate_SD, , )
443 462
444#endif /* _ASM_R4KCACHE_H */ 463#endif /* _ASM_R4KCACHE_H */
diff --git a/arch/mips/include/asm/setup.h b/arch/mips/include/asm/setup.h
index e26589ef36ee..d7bfdeba9e84 100644
--- a/arch/mips/include/asm/setup.h
+++ b/arch/mips/include/asm/setup.h
@@ -5,6 +5,14 @@
5 5
6extern void setup_early_printk(void); 6extern void setup_early_printk(void);
7 7
8#ifdef CONFIG_EARLY_PRINTK_8250
9extern void setup_8250_early_printk_port(unsigned long base,
10 unsigned int reg_shift, unsigned int timeout);
11#else
12static inline void setup_8250_early_printk_port(unsigned long base,
13 unsigned int reg_shift, unsigned int timeout) {}
14#endif
15
8extern void set_handler(unsigned long offset, void *addr, unsigned long len); 16extern void set_handler(unsigned long offset, void *addr, unsigned long len);
9extern void set_uncached_handler(unsigned long offset, void *addr, unsigned long len); 17extern void set_uncached_handler(unsigned long offset, void *addr, unsigned long len);
10 18
diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h
index 23fc95e65673..4857e2c8df5a 100644
--- a/arch/mips/include/asm/stackframe.h
+++ b/arch/mips/include/asm/stackframe.h
@@ -17,6 +17,7 @@
17#include <asm/asmmacro.h> 17#include <asm/asmmacro.h>
18#include <asm/mipsregs.h> 18#include <asm/mipsregs.h>
19#include <asm/asm-offsets.h> 19#include <asm/asm-offsets.h>
20#include <asm/thread_info.h>
20 21
21/* 22/*
22 * For SMTC kernel, global IE should be left set, and interrupts 23 * For SMTC kernel, global IE should be left set, and interrupts
@@ -93,21 +94,8 @@
93 .endm 94 .endm
94 95
95#ifdef CONFIG_SMP 96#ifdef CONFIG_SMP
96#ifdef CONFIG_MIPS_MT_SMTC
97#define PTEBASE_SHIFT 19 /* TCBIND */
98#define CPU_ID_REG CP0_TCBIND
99#define CPU_ID_MFC0 mfc0
100#elif defined(CONFIG_MIPS_PGD_C0_CONTEXT)
101#define PTEBASE_SHIFT 48 /* XCONTEXT */
102#define CPU_ID_REG CP0_XCONTEXT
103#define CPU_ID_MFC0 MFC0
104#else
105#define PTEBASE_SHIFT 23 /* CONTEXT */
106#define CPU_ID_REG CP0_CONTEXT
107#define CPU_ID_MFC0 MFC0
108#endif
109 .macro get_saved_sp /* SMP variation */ 97 .macro get_saved_sp /* SMP variation */
110 CPU_ID_MFC0 k0, CPU_ID_REG 98 ASM_CPUID_MFC0 k0, ASM_SMP_CPUID_REG
111#if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32) 99#if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32)
112 lui k1, %hi(kernelsp) 100 lui k1, %hi(kernelsp)
113#else 101#else
@@ -117,17 +105,17 @@
117 daddiu k1, %hi(kernelsp) 105 daddiu k1, %hi(kernelsp)
118 dsll k1, 16 106 dsll k1, 16
119#endif 107#endif
120 LONG_SRL k0, PTEBASE_SHIFT 108 LONG_SRL k0, SMP_CPUID_PTRSHIFT
121 LONG_ADDU k1, k0 109 LONG_ADDU k1, k0
122 LONG_L k1, %lo(kernelsp)(k1) 110 LONG_L k1, %lo(kernelsp)(k1)
123 .endm 111 .endm
124 112
125 .macro set_saved_sp stackp temp temp2 113 .macro set_saved_sp stackp temp temp2
126 CPU_ID_MFC0 \temp, CPU_ID_REG 114 ASM_CPUID_MFC0 \temp, ASM_SMP_CPUID_REG
127 LONG_SRL \temp, PTEBASE_SHIFT 115 LONG_SRL \temp, SMP_CPUID_PTRSHIFT
128 LONG_S \stackp, kernelsp(\temp) 116 LONG_S \stackp, kernelsp(\temp)
129 .endm 117 .endm
130#else 118#else /* !CONFIG_SMP */
131 .macro get_saved_sp /* Uniprocessor variation */ 119 .macro get_saved_sp /* Uniprocessor variation */
132#ifdef CONFIG_CPU_JUMP_WORKAROUNDS 120#ifdef CONFIG_CPU_JUMP_WORKAROUNDS
133 /* 121 /*
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
new file mode 100644
index 000000000000..81c89132c59d
--- /dev/null
+++ b/arch/mips/include/asm/syscall.h
@@ -0,0 +1,116 @@
1/*
2 * Access to user system call parameters and results
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * See asm-generic/syscall.h for descriptions of what we must do here.
9 *
10 * Copyright (C) 2012 Ralf Baechle <ralf@linux-mips.org>
11 */
12
13#ifndef __ASM_MIPS_SYSCALL_H
14#define __ASM_MIPS_SYSCALL_H
15
16#include <linux/audit.h>
17#include <linux/elf-em.h>
18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/uaccess.h>
21#include <asm/ptrace.h>
22
23static inline long syscall_get_nr(struct task_struct *task,
24 struct pt_regs *regs)
25{
26 return regs->regs[2];
27}
28
29static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
30 struct task_struct *task, struct pt_regs *regs, unsigned int n)
31{
32 unsigned long usp = regs->regs[29];
33
34 switch (n) {
35 case 0: case 1: case 2: case 3:
36 *arg = regs->regs[4 + n];
37
38 return 0;
39
40#ifdef CONFIG_32BIT
41 case 4: case 5: case 6: case 7:
42 return get_user(*arg, (int *)usp + 4 * n);
43#endif
44
45#ifdef CONFIG_64BIT
46 case 4: case 5: case 6: case 7:
47#ifdef CONFIG_MIPS32_O32
48 if (test_thread_flag(TIF_32BIT_REGS))
49 return get_user(*arg, (int *)usp + 4 * n);
50 else
51#endif
52 *arg = regs->regs[4 + n];
53
54 return 0;
55#endif
56
57 default:
58 BUG();
59 }
60}
61
62static inline long syscall_get_return_value(struct task_struct *task,
63 struct pt_regs *regs)
64{
65 return regs->regs[2];
66}
67
68static inline void syscall_set_return_value(struct task_struct *task,
69 struct pt_regs *regs,
70 int error, long val)
71{
72 if (error) {
73 regs->regs[2] = -error;
74 regs->regs[7] = -1;
75 } else {
76 regs->regs[2] = val;
77 regs->regs[7] = 0;
78 }
79}
80
81static inline void syscall_get_arguments(struct task_struct *task,
82 struct pt_regs *regs,
83 unsigned int i, unsigned int n,
84 unsigned long *args)
85{
86 unsigned long arg;
87 int ret;
88
89 while (n--)
90 ret |= mips_get_syscall_arg(&arg, task, regs, i++);
91
92 /*
93 * No way to communicate an error because this is a void function.
94 */
95#if 0
96 return ret;
97#endif
98}
99
100extern const unsigned long sys_call_table[];
101extern const unsigned long sys32_call_table[];
102extern const unsigned long sysn32_call_table[];
103
104static inline int __syscall_get_arch(void)
105{
106 int arch = EM_MIPS;
107#ifdef CONFIG_64BIT
108 arch |= __AUDIT_ARCH_64BIT;
109#endif
110#if defined(__LITTLE_ENDIAN)
111 arch |= __AUDIT_ARCH_LE;
112#endif
113 return arch;
114}
115
116#endif /* __ASM_MIPS_SYSCALL_H */
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index 61215a34acc6..f9b24bfbdbae 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -116,6 +116,7 @@ static inline struct thread_info *current_thread_info(void)
116#define TIF_32BIT_ADDR 23 /* 32-bit address space (o32/n32) */ 116#define TIF_32BIT_ADDR 23 /* 32-bit address space (o32/n32) */
117#define TIF_FPUBOUND 24 /* thread bound to FPU-full CPU set */ 117#define TIF_FPUBOUND 24 /* thread bound to FPU-full CPU set */
118#define TIF_LOAD_WATCH 25 /* If set, load watch registers */ 118#define TIF_LOAD_WATCH 25 /* If set, load watch registers */
119#define TIF_SYSCALL_TRACEPOINT 26 /* syscall tracepoint instrumentation */
119#define TIF_SYSCALL_TRACE 31 /* syscall trace active */ 120#define TIF_SYSCALL_TRACE 31 /* syscall trace active */
120 121
121#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 122#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -132,21 +133,54 @@ static inline struct thread_info *current_thread_info(void)
132#define _TIF_32BIT_ADDR (1<<TIF_32BIT_ADDR) 133#define _TIF_32BIT_ADDR (1<<TIF_32BIT_ADDR)
133#define _TIF_FPUBOUND (1<<TIF_FPUBOUND) 134#define _TIF_FPUBOUND (1<<TIF_FPUBOUND)
134#define _TIF_LOAD_WATCH (1<<TIF_LOAD_WATCH) 135#define _TIF_LOAD_WATCH (1<<TIF_LOAD_WATCH)
136#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
135 137
136#define _TIF_WORK_SYSCALL_ENTRY (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \ 138#define _TIF_WORK_SYSCALL_ENTRY (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \
137 _TIF_SYSCALL_AUDIT) 139 _TIF_SYSCALL_AUDIT | _TIF_SYSCALL_TRACEPOINT)
138 140
139/* work to do in syscall_trace_leave() */ 141/* work to do in syscall_trace_leave() */
140#define _TIF_WORK_SYSCALL_EXIT (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \ 142#define _TIF_WORK_SYSCALL_EXIT (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \
141 _TIF_SYSCALL_AUDIT) 143 _TIF_SYSCALL_AUDIT | _TIF_SYSCALL_TRACEPOINT)
142 144
143/* work to do on interrupt/exception return */ 145/* work to do on interrupt/exception return */
144#define _TIF_WORK_MASK \ 146#define _TIF_WORK_MASK \
145 (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME) 147 (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME)
146/* work to do on any return to u-space */ 148/* work to do on any return to u-space */
147#define _TIF_ALLWORK_MASK (_TIF_NOHZ | _TIF_WORK_MASK | \ 149#define _TIF_ALLWORK_MASK (_TIF_NOHZ | _TIF_WORK_MASK | \
148 _TIF_WORK_SYSCALL_EXIT) 150 _TIF_WORK_SYSCALL_EXIT | \
151 _TIF_SYSCALL_TRACEPOINT)
149 152
150#endif /* __KERNEL__ */ 153/*
154 * We stash processor id into a COP0 register to retrieve it fast
155 * at kernel exception entry.
156 */
157#if defined(CONFIG_MIPS_MT_SMTC)
158#define SMP_CPUID_REG 2, 2 /* TCBIND */
159#define ASM_SMP_CPUID_REG $2, 2
160#define SMP_CPUID_PTRSHIFT 19
161#elif defined(CONFIG_MIPS_PGD_C0_CONTEXT)
162#define SMP_CPUID_REG 20, 0 /* XCONTEXT */
163#define ASM_SMP_CPUID_REG $20
164#define SMP_CPUID_PTRSHIFT 48
165#else
166#define SMP_CPUID_REG 4, 0 /* CONTEXT */
167#define ASM_SMP_CPUID_REG $4
168#define SMP_CPUID_PTRSHIFT 23
169#endif
151 170
171#ifdef CONFIG_64BIT
172#define SMP_CPUID_REGSHIFT (SMP_CPUID_PTRSHIFT + 3)
173#else
174#define SMP_CPUID_REGSHIFT (SMP_CPUID_PTRSHIFT + 2)
175#endif
176
177#ifdef CONFIG_MIPS_MT_SMTC
178#define ASM_CPUID_MFC0 mfc0
179#define UASM_i_CPUID_MFC0 uasm_i_mfc0
180#else
181#define ASM_CPUID_MFC0 MFC0
182#define UASM_i_CPUID_MFC0 UASM_i_MFC0
183#endif
184
185#endif /* __KERNEL__ */
152#endif /* _ASM_THREAD_INFO_H */ 186#endif /* _ASM_THREAD_INFO_H */
diff --git a/arch/mips/include/asm/time.h b/arch/mips/include/asm/time.h
index 2d7b9df4542d..24f534a7fbc3 100644
--- a/arch/mips/include/asm/time.h
+++ b/arch/mips/include/asm/time.h
@@ -75,7 +75,7 @@ extern int init_r4k_clocksource(void);
75 75
76static inline int init_mips_clocksource(void) 76static inline int init_mips_clocksource(void)
77{ 77{
78#if defined(CONFIG_CSRC_R4K) && !defined(CONFIG_CSRC_GIC) 78#ifdef CONFIG_CSRC_R4K
79 return init_r4k_clocksource(); 79 return init_r4k_clocksource();
80#else 80#else
81 return 0; 81 return 0;
diff --git a/arch/mips/include/asm/timex.h b/arch/mips/include/asm/timex.h
index 6529704aa73a..c5424757da65 100644
--- a/arch/mips/include/asm/timex.h
+++ b/arch/mips/include/asm/timex.h
@@ -10,7 +10,9 @@
10 10
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12 12
13#include <asm/cpu-features.h>
13#include <asm/mipsregs.h> 14#include <asm/mipsregs.h>
15#include <asm/cpu-type.h>
14 16
15/* 17/*
16 * This is the clock rate of the i8253 PIT. A MIPS system may not have 18 * This is the clock rate of the i8253 PIT. A MIPS system may not have
@@ -33,9 +35,38 @@
33 35
34typedef unsigned int cycles_t; 36typedef unsigned int cycles_t;
35 37
38/*
39 * On R4000/R4400 before version 5.0 an erratum exists such that if the
40 * cycle counter is read in the exact moment that it is matching the
41 * compare register, no interrupt will be generated.
42 *
43 * There is a suggested workaround and also the erratum can't strike if
44 * the compare interrupt isn't being used as the clock source device.
45 * However for now the implementaton of this function doesn't get these
46 * fine details right.
47 */
36static inline cycles_t get_cycles(void) 48static inline cycles_t get_cycles(void)
37{ 49{
38 return 0; 50 switch (boot_cpu_type()) {
51 case CPU_R4400PC:
52 case CPU_R4400SC:
53 case CPU_R4400MC:
54 if ((read_c0_prid() & 0xff) >= 0x0050)
55 return read_c0_count();
56 break;
57
58 case CPU_R4000PC:
59 case CPU_R4000SC:
60 case CPU_R4000MC:
61 break;
62
63 default:
64 if (cpu_has_counter)
65 return read_c0_count();
66 break;
67 }
68
69 return 0; /* no usable counter */
39} 70}
40 71
41#endif /* __KERNEL__ */ 72#endif /* __KERNEL__ */
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
index 63c9c886173a..4d3b92886665 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -14,6 +14,13 @@
14 14
15#include <uapi/asm/unistd.h> 15#include <uapi/asm/unistd.h>
16 16
17#ifdef CONFIG_MIPS32_N32
18#define NR_syscalls (__NR_N32_Linux + __NR_N32_Linux_syscalls)
19#elif defined(CONFIG_64BIT)
20#define NR_syscalls (__NR_64_Linux + __NR_64_Linux_syscalls)
21#else
22#define NR_syscalls (__NR_O32_Linux + __NR_O32_Linux_syscalls)
23#endif
17 24
18#ifndef __ASSEMBLY__ 25#ifndef __ASSEMBLY__
19 26
diff --git a/arch/mips/include/asm/vga.h b/arch/mips/include/asm/vga.h
index f4cff7e4fa8a..f82c83749a08 100644
--- a/arch/mips/include/asm/vga.h
+++ b/arch/mips/include/asm/vga.h
@@ -6,6 +6,7 @@
6#ifndef _ASM_VGA_H 6#ifndef _ASM_VGA_H
7#define _ASM_VGA_H 7#define _ASM_VGA_H
8 8
9#include <asm/addrspace.h>
9#include <asm/byteorder.h> 10#include <asm/byteorder.h>
10 11
11/* 12/*
@@ -13,7 +14,7 @@
13 * access the videoram directly without any black magic. 14 * access the videoram directly without any black magic.
14 */ 15 */
15 16
16#define VGA_MAP_MEM(x, s) (0xb0000000L + (unsigned long)(x)) 17#define VGA_MAP_MEM(x, s) CKSEG1ADDR(0x10000000L + (unsigned long)(x))
17 18
18#define vga_readb(x) (*(x)) 19#define vga_readb(x) (*(x))
19#define vga_writeb(x, y) (*(y) = (x)) 20#define vga_writeb(x, y) (*(y) = (x))
diff --git a/arch/mips/include/uapi/asm/errno.h b/arch/mips/include/uapi/asm/errno.h
index 31575e2fd1bd..02d645d7aa9a 100644
--- a/arch/mips/include/uapi/asm/errno.h
+++ b/arch/mips/include/uapi/asm/errno.h
@@ -102,7 +102,7 @@
102#define EWOULDBLOCK EAGAIN /* Operation would block */ 102#define EWOULDBLOCK EAGAIN /* Operation would block */
103#define EALREADY 149 /* Operation already in progress */ 103#define EALREADY 149 /* Operation already in progress */
104#define EINPROGRESS 150 /* Operation now in progress */ 104#define EINPROGRESS 150 /* Operation now in progress */
105#define ESTALE 151 /* Stale NFS file handle */ 105#define ESTALE 151 /* Stale file handle */
106#define ECANCELED 158 /* AIO operation canceled */ 106#define ECANCELED 158 /* AIO operation canceled */
107 107
108/* 108/*
diff --git a/arch/mips/include/uapi/asm/siginfo.h b/arch/mips/include/uapi/asm/siginfo.h
index 88e292b7719e..e81174432bab 100644
--- a/arch/mips/include/uapi/asm/siginfo.h
+++ b/arch/mips/include/uapi/asm/siginfo.h
@@ -33,6 +33,8 @@ struct siginfo;
33#error _MIPS_SZLONG neither 32 nor 64 33#error _MIPS_SZLONG neither 32 nor 64
34#endif 34#endif
35 35
36#define __ARCH_SIGSYS
37
36#include <asm-generic/siginfo.h> 38#include <asm-generic/siginfo.h>
37 39
38typedef struct siginfo { 40typedef struct siginfo {
@@ -97,6 +99,13 @@ typedef struct siginfo {
97 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 99 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
98 int _fd; 100 int _fd;
99 } _sigpoll; 101 } _sigpoll;
102
103 /* SIGSYS */
104 struct {
105 void __user *_call_addr; /* calling user insn */
106 int _syscall; /* triggering system call number */
107 unsigned int _arch; /* AUDIT_ARCH_* of syscall */
108 } _sigsys;
100 } _sifields; 109 } _sifields;
101} siginfo_t; 110} siginfo_t;
102 111
diff --git a/arch/mips/include/uapi/asm/socket.h b/arch/mips/include/uapi/asm/socket.h
index 61c01f054d1b..0df9787cd84d 100644
--- a/arch/mips/include/uapi/asm/socket.h
+++ b/arch/mips/include/uapi/asm/socket.h
@@ -94,4 +94,6 @@
94 94
95#define SO_BUSY_POLL 46 95#define SO_BUSY_POLL 46
96 96
97#define SO_MAX_PACING_RATE 47
98
97#endif /* _UAPI_ASM_SOCKET_H */ 99#endif /* _UAPI_ASM_SOCKET_H */
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 423d871a946b..1c1b71752c84 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -26,7 +26,6 @@ obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o
26obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o 26obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o
27obj-$(CONFIG_CSRC_GIC) += csrc-gic.o 27obj-$(CONFIG_CSRC_GIC) += csrc-gic.o
28obj-$(CONFIG_CSRC_IOASIC) += csrc-ioasic.o 28obj-$(CONFIG_CSRC_IOASIC) += csrc-ioasic.o
29obj-$(CONFIG_CSRC_POWERTV) += csrc-powertv.o
30obj-$(CONFIG_CSRC_R4K) += csrc-r4k.o 29obj-$(CONFIG_CSRC_R4K) += csrc-r4k.o
31obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o 30obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o
32obj-$(CONFIG_SYNC_R4K) += sync-r4k.o 31obj-$(CONFIG_SYNC_R4K) += sync-r4k.o
@@ -35,6 +34,7 @@ obj-$(CONFIG_STACKTRACE) += stacktrace.o
35obj-$(CONFIG_MODULES) += mips_ksyms.o module.o 34obj-$(CONFIG_MODULES) += mips_ksyms.o module.o
36obj-$(CONFIG_MODULES_USE_ELF_RELA) += module-rela.o 35obj-$(CONFIG_MODULES_USE_ELF_RELA) += module-rela.o
37 36
37obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
38obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o 38obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o
39 39
40obj-$(CONFIG_CPU_R4K_FPU) += r4k_fpu.o r4k_switch.o 40obj-$(CONFIG_CPU_R4K_FPU) += r4k_fpu.o r4k_switch.o
@@ -84,6 +84,7 @@ obj-$(CONFIG_GPIO_TXX9) += gpio_txx9.o
84obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o 84obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o
85obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 85obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
86obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 86obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
87obj-$(CONFIG_EARLY_PRINTK_8250) += early_printk_8250.o
87obj-$(CONFIG_SPINLOCK_TEST) += spinlock_test.o 88obj-$(CONFIG_SPINLOCK_TEST) += spinlock_test.o
88obj-$(CONFIG_MIPS_MACHINE) += mips_machine.o 89obj-$(CONFIG_MIPS_MACHINE) += mips_machine.o
89 90
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 37663c7862a5..c814287bdf5d 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -20,6 +20,7 @@
20 20
21#include <asm/bugs.h> 21#include <asm/bugs.h>
22#include <asm/cpu.h> 22#include <asm/cpu.h>
23#include <asm/cpu-type.h>
23#include <asm/fpu.h> 24#include <asm/fpu.h>
24#include <asm/mipsregs.h> 25#include <asm/mipsregs.h>
25#include <asm/watch.h> 26#include <asm/watch.h>
@@ -55,7 +56,7 @@ static inline void check_errata(void)
55{ 56{
56 struct cpuinfo_mips *c = &current_cpu_data; 57 struct cpuinfo_mips *c = &current_cpu_data;
57 58
58 switch (c->cputype) { 59 switch (current_cpu_type()) {
59 case CPU_34K: 60 case CPU_34K:
60 /* 61 /*
61 * Erratum "RPS May Cause Incorrect Instruction Execution" 62 * Erratum "RPS May Cause Incorrect Instruction Execution"
@@ -122,7 +123,7 @@ static inline unsigned long cpu_get_fpu_id(void)
122 */ 123 */
123static inline int __cpu_has_fpu(void) 124static inline int __cpu_has_fpu(void)
124{ 125{
125 return ((cpu_get_fpu_id() & 0xff00) != FPIR_IMP_NONE); 126 return ((cpu_get_fpu_id() & FPIR_IMP_MASK) != FPIR_IMP_NONE);
126} 127}
127 128
128static inline void cpu_probe_vmbits(struct cpuinfo_mips *c) 129static inline void cpu_probe_vmbits(struct cpuinfo_mips *c)
@@ -290,6 +291,17 @@ static inline unsigned int decode_config4(struct cpuinfo_mips *c)
290 return config4 & MIPS_CONF_M; 291 return config4 & MIPS_CONF_M;
291} 292}
292 293
294static inline unsigned int decode_config5(struct cpuinfo_mips *c)
295{
296 unsigned int config5;
297
298 config5 = read_c0_config5();
299 config5 &= ~MIPS_CONF5_UFR;
300 write_c0_config5(config5);
301
302 return config5 & MIPS_CONF_M;
303}
304
293static void decode_configs(struct cpuinfo_mips *c) 305static void decode_configs(struct cpuinfo_mips *c)
294{ 306{
295 int ok; 307 int ok;
@@ -310,6 +322,8 @@ static void decode_configs(struct cpuinfo_mips *c)
310 ok = decode_config3(c); 322 ok = decode_config3(c);
311 if (ok) 323 if (ok)
312 ok = decode_config4(c); 324 ok = decode_config4(c);
325 if (ok)
326 ok = decode_config5(c);
313 327
314 mips_probe_watch_registers(c); 328 mips_probe_watch_registers(c);
315 329
@@ -322,7 +336,7 @@ static void decode_configs(struct cpuinfo_mips *c)
322 336
323static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) 337static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
324{ 338{
325 switch (c->processor_id & 0xff00) { 339 switch (c->processor_id & PRID_IMP_MASK) {
326 case PRID_IMP_R2000: 340 case PRID_IMP_R2000:
327 c->cputype = CPU_R2000; 341 c->cputype = CPU_R2000;
328 __cpu_name[cpu] = "R2000"; 342 __cpu_name[cpu] = "R2000";
@@ -333,7 +347,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
333 c->tlbsize = 64; 347 c->tlbsize = 64;
334 break; 348 break;
335 case PRID_IMP_R3000: 349 case PRID_IMP_R3000:
336 if ((c->processor_id & 0xff) == PRID_REV_R3000A) { 350 if ((c->processor_id & PRID_REV_MASK) == PRID_REV_R3000A) {
337 if (cpu_has_confreg()) { 351 if (cpu_has_confreg()) {
338 c->cputype = CPU_R3081E; 352 c->cputype = CPU_R3081E;
339 __cpu_name[cpu] = "R3081"; 353 __cpu_name[cpu] = "R3081";
@@ -353,7 +367,8 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
353 break; 367 break;
354 case PRID_IMP_R4000: 368 case PRID_IMP_R4000:
355 if (read_c0_config() & CONF_SC) { 369 if (read_c0_config() & CONF_SC) {
356 if ((c->processor_id & 0xff) >= PRID_REV_R4400) { 370 if ((c->processor_id & PRID_REV_MASK) >=
371 PRID_REV_R4400) {
357 c->cputype = CPU_R4400PC; 372 c->cputype = CPU_R4400PC;
358 __cpu_name[cpu] = "R4400PC"; 373 __cpu_name[cpu] = "R4400PC";
359 } else { 374 } else {
@@ -361,12 +376,33 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
361 __cpu_name[cpu] = "R4000PC"; 376 __cpu_name[cpu] = "R4000PC";
362 } 377 }
363 } else { 378 } else {
364 if ((c->processor_id & 0xff) >= PRID_REV_R4400) { 379 int cca = read_c0_config() & CONF_CM_CMASK;
365 c->cputype = CPU_R4400SC; 380 int mc;
366 __cpu_name[cpu] = "R4400SC"; 381
382 /*
383 * SC and MC versions can't be reliably told apart,
384 * but only the latter support coherent caching
385 * modes so assume the firmware has set the KSEG0
386 * coherency attribute reasonably (if uncached, we
387 * assume SC).
388 */
389 switch (cca) {
390 case CONF_CM_CACHABLE_CE:
391 case CONF_CM_CACHABLE_COW:
392 case CONF_CM_CACHABLE_CUW:
393 mc = 1;
394 break;
395 default:
396 mc = 0;
397 break;
398 }
399 if ((c->processor_id & PRID_REV_MASK) >=
400 PRID_REV_R4400) {
401 c->cputype = mc ? CPU_R4400MC : CPU_R4400SC;
402 __cpu_name[cpu] = mc ? "R4400MC" : "R4400SC";
367 } else { 403 } else {
368 c->cputype = CPU_R4000SC; 404 c->cputype = mc ? CPU_R4000MC : CPU_R4000SC;
369 __cpu_name[cpu] = "R4000SC"; 405 __cpu_name[cpu] = mc ? "R4000MC" : "R4000SC";
370 } 406 }
371 } 407 }
372 408
@@ -454,7 +490,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
454 __cpu_name[cpu] = "TX3927"; 490 __cpu_name[cpu] = "TX3927";
455 c->tlbsize = 64; 491 c->tlbsize = 64;
456 } else { 492 } else {
457 switch (c->processor_id & 0xff) { 493 switch (c->processor_id & PRID_REV_MASK) {
458 case PRID_REV_TX3912: 494 case PRID_REV_TX3912:
459 c->cputype = CPU_TX3912; 495 c->cputype = CPU_TX3912;
460 __cpu_name[cpu] = "TX3912"; 496 __cpu_name[cpu] = "TX3912";
@@ -640,7 +676,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
640static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu) 676static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
641{ 677{
642 decode_configs(c); 678 decode_configs(c);
643 switch (c->processor_id & 0xff00) { 679 switch (c->processor_id & PRID_IMP_MASK) {
644 case PRID_IMP_4KC: 680 case PRID_IMP_4KC:
645 c->cputype = CPU_4KC; 681 c->cputype = CPU_4KC;
646 __cpu_name[cpu] = "MIPS 4Kc"; 682 __cpu_name[cpu] = "MIPS 4Kc";
@@ -711,7 +747,7 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
711static inline void cpu_probe_alchemy(struct cpuinfo_mips *c, unsigned int cpu) 747static inline void cpu_probe_alchemy(struct cpuinfo_mips *c, unsigned int cpu)
712{ 748{
713 decode_configs(c); 749 decode_configs(c);
714 switch (c->processor_id & 0xff00) { 750 switch (c->processor_id & PRID_IMP_MASK) {
715 case PRID_IMP_AU1_REV1: 751 case PRID_IMP_AU1_REV1:
716 case PRID_IMP_AU1_REV2: 752 case PRID_IMP_AU1_REV2:
717 c->cputype = CPU_ALCHEMY; 753 c->cputype = CPU_ALCHEMY;
@@ -730,7 +766,7 @@ static inline void cpu_probe_alchemy(struct cpuinfo_mips *c, unsigned int cpu)
730 break; 766 break;
731 case 4: 767 case 4:
732 __cpu_name[cpu] = "Au1200"; 768 __cpu_name[cpu] = "Au1200";
733 if ((c->processor_id & 0xff) == 2) 769 if ((c->processor_id & PRID_REV_MASK) == 2)
734 __cpu_name[cpu] = "Au1250"; 770 __cpu_name[cpu] = "Au1250";
735 break; 771 break;
736 case 5: 772 case 5:
@@ -748,12 +784,12 @@ static inline void cpu_probe_sibyte(struct cpuinfo_mips *c, unsigned int cpu)
748{ 784{
749 decode_configs(c); 785 decode_configs(c);
750 786
751 switch (c->processor_id & 0xff00) { 787 switch (c->processor_id & PRID_IMP_MASK) {
752 case PRID_IMP_SB1: 788 case PRID_IMP_SB1:
753 c->cputype = CPU_SB1; 789 c->cputype = CPU_SB1;
754 __cpu_name[cpu] = "SiByte SB1"; 790 __cpu_name[cpu] = "SiByte SB1";
755 /* FPU in pass1 is known to have issues. */ 791 /* FPU in pass1 is known to have issues. */
756 if ((c->processor_id & 0xff) < 0x02) 792 if ((c->processor_id & PRID_REV_MASK) < 0x02)
757 c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR); 793 c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR);
758 break; 794 break;
759 case PRID_IMP_SB1A: 795 case PRID_IMP_SB1A:
@@ -766,7 +802,7 @@ static inline void cpu_probe_sibyte(struct cpuinfo_mips *c, unsigned int cpu)
766static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c, unsigned int cpu) 802static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c, unsigned int cpu)
767{ 803{
768 decode_configs(c); 804 decode_configs(c);
769 switch (c->processor_id & 0xff00) { 805 switch (c->processor_id & PRID_IMP_MASK) {
770 case PRID_IMP_SR71000: 806 case PRID_IMP_SR71000:
771 c->cputype = CPU_SR71000; 807 c->cputype = CPU_SR71000;
772 __cpu_name[cpu] = "Sandcraft SR71000"; 808 __cpu_name[cpu] = "Sandcraft SR71000";
@@ -779,7 +815,7 @@ static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c, unsigned int cpu)
779static inline void cpu_probe_nxp(struct cpuinfo_mips *c, unsigned int cpu) 815static inline void cpu_probe_nxp(struct cpuinfo_mips *c, unsigned int cpu)
780{ 816{
781 decode_configs(c); 817 decode_configs(c);
782 switch (c->processor_id & 0xff00) { 818 switch (c->processor_id & PRID_IMP_MASK) {
783 case PRID_IMP_PR4450: 819 case PRID_IMP_PR4450:
784 c->cputype = CPU_PR4450; 820 c->cputype = CPU_PR4450;
785 __cpu_name[cpu] = "Philips PR4450"; 821 __cpu_name[cpu] = "Philips PR4450";
@@ -791,7 +827,7 @@ static inline void cpu_probe_nxp(struct cpuinfo_mips *c, unsigned int cpu)
791static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) 827static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
792{ 828{
793 decode_configs(c); 829 decode_configs(c);
794 switch (c->processor_id & 0xff00) { 830 switch (c->processor_id & PRID_IMP_MASK) {
795 case PRID_IMP_BMIPS32_REV4: 831 case PRID_IMP_BMIPS32_REV4:
796 case PRID_IMP_BMIPS32_REV8: 832 case PRID_IMP_BMIPS32_REV8:
797 c->cputype = CPU_BMIPS32; 833 c->cputype = CPU_BMIPS32;
@@ -806,7 +842,7 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
806 set_elf_platform(cpu, "bmips3300"); 842 set_elf_platform(cpu, "bmips3300");
807 break; 843 break;
808 case PRID_IMP_BMIPS43XX: { 844 case PRID_IMP_BMIPS43XX: {
809 int rev = c->processor_id & 0xff; 845 int rev = c->processor_id & PRID_REV_MASK;
810 846
811 if (rev >= PRID_REV_BMIPS4380_LO && 847 if (rev >= PRID_REV_BMIPS4380_LO &&
812 rev <= PRID_REV_BMIPS4380_HI) { 848 rev <= PRID_REV_BMIPS4380_HI) {
@@ -832,7 +868,7 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
832static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu) 868static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu)
833{ 869{
834 decode_configs(c); 870 decode_configs(c);
835 switch (c->processor_id & 0xff00) { 871 switch (c->processor_id & PRID_IMP_MASK) {
836 case PRID_IMP_CAVIUM_CN38XX: 872 case PRID_IMP_CAVIUM_CN38XX:
837 case PRID_IMP_CAVIUM_CN31XX: 873 case PRID_IMP_CAVIUM_CN31XX:
838 case PRID_IMP_CAVIUM_CN30XX: 874 case PRID_IMP_CAVIUM_CN30XX:
@@ -875,7 +911,7 @@ static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu)
875 decode_configs(c); 911 decode_configs(c);
876 /* JZRISC does not implement the CP0 counter. */ 912 /* JZRISC does not implement the CP0 counter. */
877 c->options &= ~MIPS_CPU_COUNTER; 913 c->options &= ~MIPS_CPU_COUNTER;
878 switch (c->processor_id & 0xff00) { 914 switch (c->processor_id & PRID_IMP_MASK) {
879 case PRID_IMP_JZRISC: 915 case PRID_IMP_JZRISC:
880 c->cputype = CPU_JZRISC; 916 c->cputype = CPU_JZRISC;
881 __cpu_name[cpu] = "Ingenic JZRISC"; 917 __cpu_name[cpu] = "Ingenic JZRISC";
@@ -890,7 +926,7 @@ static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu)
890{ 926{
891 decode_configs(c); 927 decode_configs(c);
892 928
893 if ((c->processor_id & 0xff00) == PRID_IMP_NETLOGIC_AU13XX) { 929 if ((c->processor_id & PRID_IMP_MASK) == PRID_IMP_NETLOGIC_AU13XX) {
894 c->cputype = CPU_ALCHEMY; 930 c->cputype = CPU_ALCHEMY;
895 __cpu_name[cpu] = "Au1300"; 931 __cpu_name[cpu] = "Au1300";
896 /* following stuff is not for Alchemy */ 932 /* following stuff is not for Alchemy */
@@ -905,7 +941,7 @@ static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu)
905 MIPS_CPU_EJTAG | 941 MIPS_CPU_EJTAG |
906 MIPS_CPU_LLSC); 942 MIPS_CPU_LLSC);
907 943
908 switch (c->processor_id & 0xff00) { 944 switch (c->processor_id & PRID_IMP_MASK) {
909 case PRID_IMP_NETLOGIC_XLP2XX: 945 case PRID_IMP_NETLOGIC_XLP2XX:
910 c->cputype = CPU_XLP; 946 c->cputype = CPU_XLP;
911 __cpu_name[cpu] = "Broadcom XLPII"; 947 __cpu_name[cpu] = "Broadcom XLPII";
@@ -984,7 +1020,7 @@ void cpu_probe(void)
984 c->cputype = CPU_UNKNOWN; 1020 c->cputype = CPU_UNKNOWN;
985 1021
986 c->processor_id = read_c0_prid(); 1022 c->processor_id = read_c0_prid();
987 switch (c->processor_id & 0xff0000) { 1023 switch (c->processor_id & PRID_COMP_MASK) {
988 case PRID_COMP_LEGACY: 1024 case PRID_COMP_LEGACY:
989 cpu_probe_legacy(c, cpu); 1025 cpu_probe_legacy(c, cpu);
990 break; 1026 break;
@@ -1063,8 +1099,8 @@ void cpu_report(void)
1063{ 1099{
1064 struct cpuinfo_mips *c = &current_cpu_data; 1100 struct cpuinfo_mips *c = &current_cpu_data;
1065 1101
1066 printk(KERN_INFO "CPU revision is: %08x (%s)\n", 1102 pr_info("CPU%d revision is: %08x (%s)\n",
1067 c->processor_id, cpu_name_string()); 1103 smp_processor_id(), c->processor_id, cpu_name_string());
1068 if (c->options & MIPS_CPU_FPU) 1104 if (c->options & MIPS_CPU_FPU)
1069 printk(KERN_INFO "FPU revision is: %08x\n", c->fpu_id); 1105 printk(KERN_INFO "FPU revision is: %08x\n", c->fpu_id);
1070} 1106}
diff --git a/arch/mips/kernel/csrc-powertv.c b/arch/mips/kernel/csrc-powertv.c
deleted file mode 100644
index abd99ea911ae..000000000000
--- a/arch/mips/kernel/csrc-powertv.c
+++ /dev/null
@@ -1,151 +0,0 @@
1/*
2 * Copyright (C) 2008 Scientific-Atlanta, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
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 * The file comes from kernel/csrc-r4k.c
20 */
21#include <linux/clocksource.h>
22#include <linux/init.h>
23
24#include <asm/time.h> /* Not included in linux/time.h */
25
26#include <asm/mach-powertv/asic_regs.h>
27#include "powertv-clock.h"
28
29/* MIPS PLL Register Definitions */
30#define PLL_GET_M(x) (((x) >> 8) & 0x000000FF)
31#define PLL_GET_N(x) (((x) >> 16) & 0x000000FF)
32#define PLL_GET_P(x) (((x) >> 24) & 0x00000007)
33
34/*
35 * returns: Clock frequency in kHz
36 */
37unsigned int __init mips_get_pll_freq(void)
38{
39 unsigned int pll_reg, m, n, p;
40 unsigned int fin = 54000; /* Base frequency in kHz */
41 unsigned int fout;
42
43 /* Read PLL register setting */
44 pll_reg = asic_read(mips_pll_setup);
45 m = PLL_GET_M(pll_reg);
46 n = PLL_GET_N(pll_reg);
47 p = PLL_GET_P(pll_reg);
48 pr_info("MIPS PLL Register:0x%x M=%d N=%d P=%d\n", pll_reg, m, n, p);
49
50 /* Calculate clock frequency = (2 * N * 54MHz) / (M * (2**P)) */
51 fout = ((2 * n * fin) / (m * (0x01 << p)));
52
53 pr_info("MIPS Clock Freq=%d kHz\n", fout);
54
55 return fout;
56}
57
58static cycle_t c0_hpt_read(struct clocksource *cs)
59{
60 return read_c0_count();
61}
62
63static struct clocksource clocksource_mips = {
64 .name = "powertv-counter",
65 .read = c0_hpt_read,
66 .mask = CLOCKSOURCE_MASK(32),
67 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
68};
69
70static void __init powertv_c0_hpt_clocksource_init(void)
71{
72 unsigned int pll_freq = mips_get_pll_freq();
73
74 pr_info("CPU frequency %d.%02d MHz\n", pll_freq / 1000,
75 (pll_freq % 1000) * 100 / 1000);
76
77 mips_hpt_frequency = pll_freq / 2 * 1000;
78
79 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
80
81 clocksource_register_hz(&clocksource_mips, mips_hpt_frequency);
82}
83
84/**
85 * struct tim_c - free running counter
86 * @hi: High 16 bits of the counter
87 * @lo: Low 32 bits of the counter
88 *
89 * Lays out the structure of the free running counter in memory. This counter
90 * increments at a rate of 27 MHz/8 on all platforms.
91 */
92struct tim_c {
93 unsigned int hi;
94 unsigned int lo;
95};
96
97static struct tim_c *tim_c;
98
99static cycle_t tim_c_read(struct clocksource *cs)
100{
101 unsigned int hi;
102 unsigned int next_hi;
103 unsigned int lo;
104
105 hi = readl(&tim_c->hi);
106
107 for (;;) {
108 lo = readl(&tim_c->lo);
109 next_hi = readl(&tim_c->hi);
110 if (next_hi == hi)
111 break;
112 hi = next_hi;
113 }
114
115pr_crit("%s: read %llx\n", __func__, ((u64) hi << 32) | lo);
116 return ((u64) hi << 32) | lo;
117}
118
119#define TIM_C_SIZE 48 /* # bits in the timer */
120
121static struct clocksource clocksource_tim_c = {
122 .name = "powertv-tim_c",
123 .read = tim_c_read,
124 .mask = CLOCKSOURCE_MASK(TIM_C_SIZE),
125 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
126};
127
128/**
129 * powertv_tim_c_clocksource_init - set up a clock source for the TIM_C clock
130 *
131 * We know that TIM_C counts at 27 MHz/8, so each cycle corresponds to
132 * 1 / (27,000,000/8) seconds.
133 */
134static void __init powertv_tim_c_clocksource_init(void)
135{
136 const unsigned long counts_per_second = 27000000 / 8;
137
138 clocksource_tim_c.rating = 200;
139
140 clocksource_register_hz(&clocksource_tim_c, counts_per_second);
141 tim_c = (struct tim_c *) asic_reg_addr(tim_ch);
142}
143
144/**
145 powertv_clocksource_init - initialize all clocksources
146 */
147void __init powertv_clocksource_init(void)
148{
149 powertv_c0_hpt_clocksource_init();
150 powertv_tim_c_clocksource_init();
151}
diff --git a/arch/mips/kernel/early_printk_8250.c b/arch/mips/kernel/early_printk_8250.c
new file mode 100644
index 000000000000..83cea3767556
--- /dev/null
+++ b/arch/mips/kernel/early_printk_8250.c
@@ -0,0 +1,66 @@
1/*
2 * 8250/16550-type serial ports prom_putchar()
3 *
4 * Copyright (C) 2010 Yoichi Yuasa <yuasa@linux-mips.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/io.h>
21#include <linux/serial_core.h>
22#include <linux/serial_reg.h>
23
24static void __iomem *serial8250_base;
25static unsigned int serial8250_reg_shift;
26static unsigned int serial8250_tx_timeout;
27
28void setup_8250_early_printk_port(unsigned long base, unsigned int reg_shift,
29 unsigned int timeout)
30{
31 serial8250_base = (void __iomem *)base;
32 serial8250_reg_shift = reg_shift;
33 serial8250_tx_timeout = timeout;
34}
35
36static inline u8 serial_in(int offset)
37{
38 return readb(serial8250_base + (offset << serial8250_reg_shift));
39}
40
41static inline void serial_out(int offset, char value)
42{
43 writeb(value, serial8250_base + (offset << serial8250_reg_shift));
44}
45
46void prom_putchar(char c)
47{
48 unsigned int timeout;
49 int status, bits;
50
51 if (!serial8250_base)
52 return;
53
54 timeout = serial8250_tx_timeout;
55 bits = UART_LSR_TEMT | UART_LSR_THRE;
56
57 do {
58 status = serial_in(UART_LSR);
59
60 if (--timeout == 0)
61 break;
62 } while ((status & bits) != bits);
63
64 if (timeout)
65 serial_out(UART_TX, c);
66}
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index dba90ec0dc38..185ba258361b 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -11,11 +11,14 @@
11#include <linux/uaccess.h> 11#include <linux/uaccess.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/ftrace.h> 13#include <linux/ftrace.h>
14#include <linux/syscalls.h>
14 15
15#include <asm/asm.h> 16#include <asm/asm.h>
16#include <asm/asm-offsets.h> 17#include <asm/asm-offsets.h>
17#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/syscall.h>
18#include <asm/uasm.h> 20#include <asm/uasm.h>
21#include <asm/unistd.h>
19 22
20#include <asm-generic/sections.h> 23#include <asm-generic/sections.h>
21 24
@@ -364,3 +367,33 @@ out:
364 WARN_ON(1); 367 WARN_ON(1);
365} 368}
366#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 369#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
370
371#ifdef CONFIG_FTRACE_SYSCALLS
372
373#ifdef CONFIG_32BIT
374unsigned long __init arch_syscall_addr(int nr)
375{
376 return (unsigned long)sys_call_table[nr - __NR_O32_Linux];
377}
378#endif
379
380#ifdef CONFIG_64BIT
381
382unsigned long __init arch_syscall_addr(int nr)
383{
384#ifdef CONFIG_MIPS32_N32
385 if (nr >= __NR_N32_Linux && nr <= __NR_N32_Linux + __NR_N32_Linux_syscalls)
386 return (unsigned long)sysn32_call_table[nr - __NR_N32_Linux];
387#endif
388 if (nr >= __NR_64_Linux && nr <= __NR_64_Linux + __NR_64_Linux_syscalls)
389 return (unsigned long)sys_call_table[nr - __NR_64_Linux];
390#ifdef CONFIG_MIPS32_O32
391 if (nr >= __NR_O32_Linux && nr <= __NR_O32_Linux + __NR_O32_Linux_syscalls)
392 return (unsigned long)sys32_call_table[nr - __NR_O32_Linux];
393#endif
394
395 return (unsigned long) &sys_ni_syscall;
396}
397#endif
398
399#endif /* CONFIG_FTRACE_SYSCALLS */
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index 31fa856829cb..47d7583cd67f 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -374,12 +374,20 @@ NESTED(except_vec_nmi, 0, sp)
374NESTED(nmi_handler, PT_SIZE, sp) 374NESTED(nmi_handler, PT_SIZE, sp)
375 .set push 375 .set push
376 .set noat 376 .set noat
377 /*
378 * Clear ERL - restore segment mapping
379 * Clear BEV - required for page fault exception handler to work
380 */
381 mfc0 k0, CP0_STATUS
382 ori k0, k0, ST0_EXL
383 li k1, ~(ST0_BEV | ST0_ERL)
384 and k0, k0, k1
385 mtc0 k0, CP0_STATUS
386 _ehb
377 SAVE_ALL 387 SAVE_ALL
378 move a0, sp 388 move a0, sp
379 jal nmi_exception_handler 389 jal nmi_exception_handler
380 RESTORE_ALL 390 /* nmi_exception_handler never returns */
381 .set mips3
382 eret
383 .set pop 391 .set pop
384 END(nmi_handler) 392 END(nmi_handler)
385 393
diff --git a/arch/mips/kernel/idle.c b/arch/mips/kernel/idle.c
index 42f8875d2444..f7991d95bff9 100644
--- a/arch/mips/kernel/idle.c
+++ b/arch/mips/kernel/idle.c
@@ -18,6 +18,7 @@
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <asm/cpu.h> 19#include <asm/cpu.h>
20#include <asm/cpu-info.h> 20#include <asm/cpu-info.h>
21#include <asm/cpu-type.h>
21#include <asm/idle.h> 22#include <asm/idle.h>
22#include <asm/mipsregs.h> 23#include <asm/mipsregs.h>
23 24
@@ -136,7 +137,7 @@ void __init check_wait(void)
136 return; 137 return;
137 } 138 }
138 139
139 switch (c->cputype) { 140 switch (current_cpu_type()) {
140 case CPU_R3081: 141 case CPU_R3081:
141 case CPU_R3081E: 142 case CPU_R3081E:
142 cpu_wait = r3081_wait; 143 cpu_wait = r3081_wait;
diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
index 72ef2d25cbf2..e498f2b3646a 100644
--- a/arch/mips/kernel/irq_cpu.c
+++ b/arch/mips/kernel/irq_cpu.c
@@ -150,7 +150,7 @@ int __init mips_cpu_intc_init(struct device_node *of_node,
150 domain = irq_domain_add_legacy(of_node, 8, MIPS_CPU_IRQ_BASE, 0, 150 domain = irq_domain_add_legacy(of_node, 8, MIPS_CPU_IRQ_BASE, 0,
151 &mips_cpu_intc_irq_domain_ops, NULL); 151 &mips_cpu_intc_irq_domain_ops, NULL);
152 if (!domain) 152 if (!domain)
153 panic("Failed to add irqdomain for MIPS CPU\n"); 153 panic("Failed to add irqdomain for MIPS CPU");
154 154
155 return 0; 155 return 0;
156} 156}
diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c
index 977a623d9253..2a52568dbcd6 100644
--- a/arch/mips/kernel/module.c
+++ b/arch/mips/kernel/module.c
@@ -23,6 +23,7 @@
23#include <linux/moduleloader.h> 23#include <linux/moduleloader.h>
24#include <linux/elf.h> 24#include <linux/elf.h>
25#include <linux/mm.h> 25#include <linux/mm.h>
26#include <linux/numa.h>
26#include <linux/vmalloc.h> 27#include <linux/vmalloc.h>
27#include <linux/slab.h> 28#include <linux/slab.h>
28#include <linux/fs.h> 29#include <linux/fs.h>
@@ -46,7 +47,7 @@ static DEFINE_SPINLOCK(dbe_lock);
46void *module_alloc(unsigned long size) 47void *module_alloc(unsigned long size)
47{ 48{
48 return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END, 49 return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END,
49 GFP_KERNEL, PAGE_KERNEL, -1, 50 GFP_KERNEL, PAGE_KERNEL, NUMA_NO_NODE,
50 __builtin_return_address(0)); 51 __builtin_return_address(0));
51} 52}
52#endif 53#endif
diff --git a/arch/mips/kernel/octeon_switch.S b/arch/mips/kernel/octeon_switch.S
index 4204d76af854..029e002a4ea0 100644
--- a/arch/mips/kernel/octeon_switch.S
+++ b/arch/mips/kernel/octeon_switch.S
@@ -73,7 +73,7 @@
733: 733:
74 74
75#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP) 75#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
76 PTR_L t8, __stack_chk_guard 76 PTR_LA t8, __stack_chk_guard
77 LONG_L t9, TASK_STACK_CANARY(a1) 77 LONG_L t9, TASK_STACK_CANARY(a1)
78 LONG_S t9, 0(t8) 78 LONG_S t9, 0(t8)
79#endif 79#endif
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
index 45f1ffcf1a4b..24cdf64789c3 100644
--- a/arch/mips/kernel/perf_event_mipsxx.c
+++ b/arch/mips/kernel/perf_event_mipsxx.c
@@ -971,11 +971,11 @@ static const struct mips_perf_event mipsxx74Kcore_cache_map
971[C(LL)] = { 971[C(LL)] = {
972 [C(OP_READ)] = { 972 [C(OP_READ)] = {
973 [C(RESULT_ACCESS)] = { 0x1c, CNTR_ODD, P }, 973 [C(RESULT_ACCESS)] = { 0x1c, CNTR_ODD, P },
974 [C(RESULT_MISS)] = { 0x1d, CNTR_EVEN | CNTR_ODD, P }, 974 [C(RESULT_MISS)] = { 0x1d, CNTR_EVEN, P },
975 }, 975 },
976 [C(OP_WRITE)] = { 976 [C(OP_WRITE)] = {
977 [C(RESULT_ACCESS)] = { 0x1c, CNTR_ODD, P }, 977 [C(RESULT_ACCESS)] = { 0x1c, CNTR_ODD, P },
978 [C(RESULT_MISS)] = { 0x1d, CNTR_EVEN | CNTR_ODD, P }, 978 [C(RESULT_MISS)] = { 0x1d, CNTR_EVEN, P },
979 }, 979 },
980}, 980},
981[C(ITLB)] = { 981[C(ITLB)] = {
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
index 0fa0b69cdd53..3c3b0df8f48d 100644
--- a/arch/mips/kernel/prom.c
+++ b/arch/mips/kernel/prom.c
@@ -13,12 +13,9 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/bootmem.h> 15#include <linux/bootmem.h>
16#include <linux/initrd.h>
17#include <linux/debugfs.h> 16#include <linux/debugfs.h>
18#include <linux/of.h> 17#include <linux/of.h>
19#include <linux/of_fdt.h> 18#include <linux/of_fdt.h>
20#include <linux/of_irq.h>
21#include <linux/of_platform.h>
22 19
23#include <asm/page.h> 20#include <asm/page.h>
24#include <asm/prom.h> 21#include <asm/prom.h>
@@ -40,13 +37,6 @@ char *mips_get_machine_name(void)
40} 37}
41 38
42#ifdef CONFIG_OF 39#ifdef CONFIG_OF
43int __init early_init_dt_scan_memory_arch(unsigned long node,
44 const char *uname, int depth,
45 void *data)
46{
47 return early_init_dt_scan_memory(node, uname, depth, data);
48}
49
50void __init early_init_dt_add_memory_arch(u64 base, u64 size) 40void __init early_init_dt_add_memory_arch(u64 base, u64 size)
51{ 41{
52 return add_memory_region(base, size, BOOT_MEM_RAM); 42 return add_memory_region(base, size, BOOT_MEM_RAM);
@@ -57,57 +47,11 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
57 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)); 47 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS));
58} 48}
59 49
60#ifdef CONFIG_BLK_DEV_INITRD
61void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
62{
63 initrd_start = (unsigned long)__va(start);
64 initrd_end = (unsigned long)__va(end);
65 initrd_below_start_ok = 1;
66}
67#endif
68
69int __init early_init_dt_scan_model(unsigned long node, const char *uname,
70 int depth, void *data)
71{
72 if (!depth) {
73 char *model = of_get_flat_dt_prop(node, "model", NULL);
74
75 if (model)
76 mips_set_machine_name(model);
77 }
78 return 0;
79}
80
81void __init early_init_devtree(void *params)
82{
83 /* Setup flat device-tree pointer */
84 initial_boot_params = params;
85
86 /* Retrieve various informations from the /chosen node of the
87 * device-tree, including the platform type, initrd location and
88 * size, and more ...
89 */
90 of_scan_flat_dt(early_init_dt_scan_chosen, arcs_cmdline);
91
92
93 /* Scan memory nodes */
94 of_scan_flat_dt(early_init_dt_scan_root, NULL);
95 of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL);
96
97 /* try to load the mips machine name */
98 of_scan_flat_dt(early_init_dt_scan_model, NULL);
99}
100
101void __init __dt_setup_arch(struct boot_param_header *bph) 50void __init __dt_setup_arch(struct boot_param_header *bph)
102{ 51{
103 if (be32_to_cpu(bph->magic) != OF_DT_HEADER) { 52 if (!early_init_dt_scan(bph))
104 pr_err("DTB has bad magic, ignoring builtin OF DTB\n");
105
106 return; 53 return;
107 }
108
109 initial_boot_params = bph;
110 54
111 early_init_devtree(initial_boot_params); 55 mips_set_machine_name(of_flat_dt_get_machine_name());
112} 56}
113#endif 57#endif
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 8ae1ebef8b71..b52e1d2b33e0 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -16,16 +16,20 @@
16 */ 16 */
17#include <linux/compiler.h> 17#include <linux/compiler.h>
18#include <linux/context_tracking.h> 18#include <linux/context_tracking.h>
19#include <linux/elf.h>
19#include <linux/kernel.h> 20#include <linux/kernel.h>
20#include <linux/sched.h> 21#include <linux/sched.h>
21#include <linux/mm.h> 22#include <linux/mm.h>
22#include <linux/errno.h> 23#include <linux/errno.h>
23#include <linux/ptrace.h> 24#include <linux/ptrace.h>
25#include <linux/regset.h>
24#include <linux/smp.h> 26#include <linux/smp.h>
25#include <linux/user.h> 27#include <linux/user.h>
26#include <linux/security.h> 28#include <linux/security.h>
29#include <linux/tracehook.h>
27#include <linux/audit.h> 30#include <linux/audit.h>
28#include <linux/seccomp.h> 31#include <linux/seccomp.h>
32#include <linux/ftrace.h>
29 33
30#include <asm/byteorder.h> 34#include <asm/byteorder.h>
31#include <asm/cpu.h> 35#include <asm/cpu.h>
@@ -35,10 +39,14 @@
35#include <asm/mipsmtregs.h> 39#include <asm/mipsmtregs.h>
36#include <asm/pgtable.h> 40#include <asm/pgtable.h>
37#include <asm/page.h> 41#include <asm/page.h>
42#include <asm/syscall.h>
38#include <asm/uaccess.h> 43#include <asm/uaccess.h>
39#include <asm/bootinfo.h> 44#include <asm/bootinfo.h>
40#include <asm/reg.h> 45#include <asm/reg.h>
41 46
47#define CREATE_TRACE_POINTS
48#include <trace/events/syscalls.h>
49
42/* 50/*
43 * Called by kernel/ptrace.c when detaching.. 51 * Called by kernel/ptrace.c when detaching..
44 * 52 *
@@ -255,6 +263,133 @@ int ptrace_set_watch_regs(struct task_struct *child,
255 return 0; 263 return 0;
256} 264}
257 265
266/* regset get/set implementations */
267
268static int gpr_get(struct task_struct *target,
269 const struct user_regset *regset,
270 unsigned int pos, unsigned int count,
271 void *kbuf, void __user *ubuf)
272{
273 struct pt_regs *regs = task_pt_regs(target);
274
275 return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
276 regs, 0, sizeof(*regs));
277}
278
279static int gpr_set(struct task_struct *target,
280 const struct user_regset *regset,
281 unsigned int pos, unsigned int count,
282 const void *kbuf, const void __user *ubuf)
283{
284 struct pt_regs newregs;
285 int ret;
286
287 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
288 &newregs,
289 0, sizeof(newregs));
290 if (ret)
291 return ret;
292
293 *task_pt_regs(target) = newregs;
294
295 return 0;
296}
297
298static int fpr_get(struct task_struct *target,
299 const struct user_regset *regset,
300 unsigned int pos, unsigned int count,
301 void *kbuf, void __user *ubuf)
302{
303 return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
304 &target->thread.fpu,
305 0, sizeof(elf_fpregset_t));
306 /* XXX fcr31 */
307}
308
309static int fpr_set(struct task_struct *target,
310 const struct user_regset *regset,
311 unsigned int pos, unsigned int count,
312 const void *kbuf, const void __user *ubuf)
313{
314 return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
315 &target->thread.fpu,
316 0, sizeof(elf_fpregset_t));
317 /* XXX fcr31 */
318}
319
320enum mips_regset {
321 REGSET_GPR,
322 REGSET_FPR,
323};
324
325static const struct user_regset mips_regsets[] = {
326 [REGSET_GPR] = {
327 .core_note_type = NT_PRSTATUS,
328 .n = ELF_NGREG,
329 .size = sizeof(unsigned int),
330 .align = sizeof(unsigned int),
331 .get = gpr_get,
332 .set = gpr_set,
333 },
334 [REGSET_FPR] = {
335 .core_note_type = NT_PRFPREG,
336 .n = ELF_NFPREG,
337 .size = sizeof(elf_fpreg_t),
338 .align = sizeof(elf_fpreg_t),
339 .get = fpr_get,
340 .set = fpr_set,
341 },
342};
343
344static const struct user_regset_view user_mips_view = {
345 .name = "mips",
346 .e_machine = ELF_ARCH,
347 .ei_osabi = ELF_OSABI,
348 .regsets = mips_regsets,
349 .n = ARRAY_SIZE(mips_regsets),
350};
351
352static const struct user_regset mips64_regsets[] = {
353 [REGSET_GPR] = {
354 .core_note_type = NT_PRSTATUS,
355 .n = ELF_NGREG,
356 .size = sizeof(unsigned long),
357 .align = sizeof(unsigned long),
358 .get = gpr_get,
359 .set = gpr_set,
360 },
361 [REGSET_FPR] = {
362 .core_note_type = NT_PRFPREG,
363 .n = ELF_NFPREG,
364 .size = sizeof(elf_fpreg_t),
365 .align = sizeof(elf_fpreg_t),
366 .get = fpr_get,
367 .set = fpr_set,
368 },
369};
370
371static const struct user_regset_view user_mips64_view = {
372 .name = "mips",
373 .e_machine = ELF_ARCH,
374 .ei_osabi = ELF_OSABI,
375 .regsets = mips64_regsets,
376 .n = ARRAY_SIZE(mips_regsets),
377};
378
379const struct user_regset_view *task_user_regset_view(struct task_struct *task)
380{
381#ifdef CONFIG_32BIT
382 return &user_mips_view;
383#endif
384
385#ifdef CONFIG_MIPS32_O32
386 if (test_thread_flag(TIF_32BIT_REGS))
387 return &user_mips_view;
388#endif
389
390 return &user_mips64_view;
391}
392
258long arch_ptrace(struct task_struct *child, long request, 393long arch_ptrace(struct task_struct *child, long request,
259 unsigned long addr, unsigned long data) 394 unsigned long addr, unsigned long data)
260{ 395{
@@ -517,52 +652,27 @@ long arch_ptrace(struct task_struct *child, long request,
517 return ret; 652 return ret;
518} 653}
519 654
520static inline int audit_arch(void)
521{
522 int arch = EM_MIPS;
523#ifdef CONFIG_64BIT
524 arch |= __AUDIT_ARCH_64BIT;
525#endif
526#if defined(__LITTLE_ENDIAN)
527 arch |= __AUDIT_ARCH_LE;
528#endif
529 return arch;
530}
531
532/* 655/*
533 * Notification of system call entry/exit 656 * Notification of system call entry/exit
534 * - triggered by current->work.syscall_trace 657 * - triggered by current->work.syscall_trace
535 */ 658 */
536asmlinkage void syscall_trace_enter(struct pt_regs *regs) 659asmlinkage void syscall_trace_enter(struct pt_regs *regs)
537{ 660{
661 long ret = 0;
538 user_exit(); 662 user_exit();
539 663
540 /* do the secure computing check first */ 664 /* do the secure computing check first */
541 secure_computing_strict(regs->regs[2]); 665 secure_computing_strict(regs->regs[2]);
542 666
543 if (!(current->ptrace & PT_PTRACED)) 667 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
544 goto out; 668 tracehook_report_syscall_entry(regs))
545 669 ret = -1;
546 if (!test_thread_flag(TIF_SYSCALL_TRACE))
547 goto out;
548 670
549 /* The 0x80 provides a way for the tracing parent to distinguish 671 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
550 between a syscall stop and SIGTRAP delivery */ 672 trace_sys_enter(regs, regs->regs[2]);
551 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) ?
552 0x80 : 0));
553
554 /*
555 * this isn't the same as continuing with a signal, but it will do
556 * for normal use. strace only continues with a signal if the
557 * stopping signal is not SIGTRAP. -brl
558 */
559 if (current->exit_code) {
560 send_sig(current->exit_code, current, 1);
561 current->exit_code = 0;
562 }
563 673
564out: 674 audit_syscall_entry(__syscall_get_arch(),
565 audit_syscall_entry(audit_arch(), regs->regs[2], 675 regs->regs[2],
566 regs->regs[4], regs->regs[5], 676 regs->regs[4], regs->regs[5],
567 regs->regs[6], regs->regs[7]); 677 regs->regs[6], regs->regs[7]);
568} 678}
@@ -582,26 +692,11 @@ asmlinkage void syscall_trace_leave(struct pt_regs *regs)
582 692
583 audit_syscall_exit(regs); 693 audit_syscall_exit(regs);
584 694
585 if (!(current->ptrace & PT_PTRACED)) 695 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
586 return; 696 trace_sys_exit(regs, regs->regs[2]);
587
588 if (!test_thread_flag(TIF_SYSCALL_TRACE))
589 return;
590
591 /* The 0x80 provides a way for the tracing parent to distinguish
592 between a syscall stop and SIGTRAP delivery */
593 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) ?
594 0x80 : 0));
595 697
596 /* 698 if (test_thread_flag(TIF_SYSCALL_TRACE))
597 * this isn't the same as continuing with a signal, but it will do 699 tracehook_report_syscall_exit(regs, 0);
598 * for normal use. strace only continues with a signal if the
599 * stopping signal is not SIGTRAP. -brl
600 */
601 if (current->exit_code) {
602 send_sig(current->exit_code, current, 1);
603 current->exit_code = 0;
604 }
605 700
606 user_enter(); 701 user_enter();
607} 702}
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S
index 38af83f84c4a..20b7b040e76f 100644
--- a/arch/mips/kernel/r2300_switch.S
+++ b/arch/mips/kernel/r2300_switch.S
@@ -67,7 +67,7 @@ LEAF(resume)
671: 671:
68 68
69#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP) 69#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
70 PTR_L t8, __stack_chk_guard 70 PTR_LA t8, __stack_chk_guard
71 LONG_L t9, TASK_STACK_CANARY(a1) 71 LONG_L t9, TASK_STACK_CANARY(a1)
72 LONG_S t9, 0(t8) 72 LONG_S t9, 0(t8)
73#endif 73#endif
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index 921238a6bd26..078de5eaca8f 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -69,7 +69,7 @@
691: 691:
70 70
71#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP) 71#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
72 PTR_L t8, __stack_chk_guard 72 PTR_LA t8, __stack_chk_guard
73 LONG_L t9, TASK_STACK_CANARY(a1) 73 LONG_L t9, TASK_STACK_CANARY(a1)
74 LONG_S t9, 0(t8) 74 LONG_S t9, 0(t8)
75#endif 75#endif
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index d763f11e35e2..2c12ea1668d1 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -172,8 +172,9 @@ int rtlx_open(int index, int can_sleep)
172 if (rtlx == NULL) { 172 if (rtlx == NULL) {
173 if( (p = vpe_get_shared(tclimit)) == NULL) { 173 if( (p = vpe_get_shared(tclimit)) == NULL) {
174 if (can_sleep) { 174 if (can_sleep) {
175 __wait_event_interruptible(channel_wqs[index].lx_queue, 175 ret = __wait_event_interruptible(
176 (p = vpe_get_shared(tclimit)), ret); 176 channel_wqs[index].lx_queue,
177 (p = vpe_get_shared(tclimit)));
177 if (ret) 178 if (ret)
178 goto out_fail; 179 goto out_fail;
179 } else { 180 } else {
@@ -263,11 +264,10 @@ unsigned int rtlx_read_poll(int index, int can_sleep)
263 /* data available to read? */ 264 /* data available to read? */
264 if (chan->lx_read == chan->lx_write) { 265 if (chan->lx_read == chan->lx_write) {
265 if (can_sleep) { 266 if (can_sleep) {
266 int ret = 0; 267 int ret = __wait_event_interruptible(
267 268 channel_wqs[index].lx_queue,
268 __wait_event_interruptible(channel_wqs[index].lx_queue,
269 (chan->lx_read != chan->lx_write) || 269 (chan->lx_read != chan->lx_write) ||
270 sp_stopping, ret); 270 sp_stopping);
271 if (ret) 271 if (ret)
272 return ret; 272 return ret;
273 273
@@ -440,14 +440,13 @@ static ssize_t file_write(struct file *file, const char __user * buffer,
440 440
441 /* any space left... */ 441 /* any space left... */
442 if (!rtlx_write_poll(minor)) { 442 if (!rtlx_write_poll(minor)) {
443 int ret = 0; 443 int ret;
444 444
445 if (file->f_flags & O_NONBLOCK) 445 if (file->f_flags & O_NONBLOCK)
446 return -EAGAIN; 446 return -EAGAIN;
447 447
448 __wait_event_interruptible(channel_wqs[minor].rt_queue, 448 ret = __wait_event_interruptible(channel_wqs[minor].rt_queue,
449 rtlx_write_poll(minor), 449 rtlx_write_poll(minor));
450 ret);
451 if (ret) 450 if (ret)
452 return ret; 451 return ret;
453 } 452 }
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index e774bb1088b5..e8e541b40d86 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -40,17 +40,58 @@ NESTED(handle_sys, PT_SIZE, sp)
40 sw t1, PT_EPC(sp) 40 sw t1, PT_EPC(sp)
41 beqz t0, illegal_syscall 41 beqz t0, illegal_syscall
42 42
43 sll t0, v0, 3 43 sll t0, v0, 2
44 la t1, sys_call_table 44 la t1, sys_call_table
45 addu t1, t0 45 addu t1, t0
46 lw t2, (t1) # syscall routine 46 lw t2, (t1) # syscall routine
47 lw t3, 4(t1) # >= 0 if we need stack arguments
48 beqz t2, illegal_syscall 47 beqz t2, illegal_syscall
49 48
50 sw a3, PT_R26(sp) # save a3 for syscall restarting 49 sw a3, PT_R26(sp) # save a3 for syscall restarting
51 bgez t3, stackargs
52 50
53stack_done: 51 /*
52 * More than four arguments. Try to deal with it by copying the
53 * stack arguments from the user stack to the kernel stack.
54 * This Sucks (TM).
55 */
56 lw t0, PT_R29(sp) # get old user stack pointer
57
58 /*
59 * We intentionally keep the kernel stack a little below the top of
60 * userspace so we don't have to do a slower byte accurate check here.
61 */
62 lw t5, TI_ADDR_LIMIT($28)
63 addu t4, t0, 32
64 and t5, t4
65 bltz t5, bad_stack # -> sp is bad
66
67 /*
68 * Ok, copy the args from the luser stack to the kernel stack.
69 * t3 is the precomputed number of instruction bytes needed to
70 * load or store arguments 6-8.
71 */
72
73 .set push
74 .set noreorder
75 .set nomacro
76
771: lw t5, 16(t0) # argument #5 from usp
784: lw t6, 20(t0) # argument #6 from usp
793: lw t7, 24(t0) # argument #7 from usp
802: lw t8, 28(t0) # argument #8 from usp
81
82 sw t5, 16(sp) # argument #5 to ksp
83 sw t6, 20(sp) # argument #6 to ksp
84 sw t7, 24(sp) # argument #7 to ksp
85 sw t8, 28(sp) # argument #8 to ksp
86 .set pop
87
88 .section __ex_table,"a"
89 PTR 1b,bad_stack
90 PTR 2b,bad_stack
91 PTR 3b,bad_stack
92 PTR 4b,bad_stack
93 .previous
94
54 lw t0, TI_FLAGS($28) # syscall tracing enabled? 95 lw t0, TI_FLAGS($28) # syscall tracing enabled?
55 li t1, _TIF_WORK_SYSCALL_ENTRY 96 li t1, _TIF_WORK_SYSCALL_ENTRY
56 and t0, t1 97 and t0, t1
@@ -102,66 +143,6 @@ syscall_trace_entry:
102/* ------------------------------------------------------------------------ */ 143/* ------------------------------------------------------------------------ */
103 144
104 /* 145 /*
105 * More than four arguments. Try to deal with it by copying the
106 * stack arguments from the user stack to the kernel stack.
107 * This Sucks (TM).
108 */
109stackargs:
110 lw t0, PT_R29(sp) # get old user stack pointer
111
112 /*
113 * We intentionally keep the kernel stack a little below the top of
114 * userspace so we don't have to do a slower byte accurate check here.
115 */
116 lw t5, TI_ADDR_LIMIT($28)
117 addu t4, t0, 32
118 and t5, t4
119 bltz t5, bad_stack # -> sp is bad
120
121 /* Ok, copy the args from the luser stack to the kernel stack.
122 * t3 is the precomputed number of instruction bytes needed to
123 * load or store arguments 6-8.
124 */
125
126 la t1, 5f # load up to 3 arguments
127 subu t1, t3
1281: lw t5, 16(t0) # argument #5 from usp
129 .set push
130 .set noreorder
131 .set nomacro
132 jr t1
133 addiu t1, 6f - 5f
134
1352: lw t8, 28(t0) # argument #8 from usp
1363: lw t7, 24(t0) # argument #7 from usp
1374: lw t6, 20(t0) # argument #6 from usp
1385: jr t1
139 sw t5, 16(sp) # argument #5 to ksp
140
141#ifdef CONFIG_CPU_MICROMIPS
142 sw t8, 28(sp) # argument #8 to ksp
143 nop
144 sw t7, 24(sp) # argument #7 to ksp
145 nop
146 sw t6, 20(sp) # argument #6 to ksp
147 nop
148#else
149 sw t8, 28(sp) # argument #8 to ksp
150 sw t7, 24(sp) # argument #7 to ksp
151 sw t6, 20(sp) # argument #6 to ksp
152#endif
1536: j stack_done # go back
154 nop
155 .set pop
156
157 .section __ex_table,"a"
158 PTR 1b,bad_stack
159 PTR 2b,bad_stack
160 PTR 3b,bad_stack
161 PTR 4b,bad_stack
162 .previous
163
164 /*
165 * The stackpointer for a call with more than 4 arguments is bad. 146 * The stackpointer for a call with more than 4 arguments is bad.
166 * We probably should handle this case a bit more drastic. 147 * We probably should handle this case a bit more drastic.
167 */ 148 */
@@ -187,7 +168,7 @@ illegal_syscall:
187 subu t0, a0, __NR_O32_Linux # check syscall number 168 subu t0, a0, __NR_O32_Linux # check syscall number
188 sltiu v0, t0, __NR_O32_Linux_syscalls + 1 169 sltiu v0, t0, __NR_O32_Linux_syscalls + 1
189 beqz t0, einval # do not recurse 170 beqz t0, einval # do not recurse
190 sll t1, t0, 3 171 sll t1, t0, 2
191 beqz v0, einval 172 beqz v0, einval
192 lw t2, sys_call_table(t1) # syscall routine 173 lw t2, sys_call_table(t1) # syscall routine
193 174
@@ -218,260 +199,248 @@ einval: li v0, -ENOSYS
218 jr ra 199 jr ra
219 END(sys_syscall) 200 END(sys_syscall)
220 201
221 .macro fifty ptr, nargs, from=1, to=50 202 .align 2
222 sys \ptr \nargs 203 .type sys_call_table, @object
223 .if \to-\from 204EXPORT(sys_call_table)
224 fifty \ptr,\nargs,"(\from+1)",\to 205 PTR sys_syscall /* 4000 */
225 .endif 206 PTR sys_exit
226 .endm 207 PTR __sys_fork
227 208 PTR sys_read
228 .macro mille ptr, nargs, from=1, to=20 209 PTR sys_write
229 fifty \ptr,\nargs 210 PTR sys_open /* 4005 */
230 .if \to-\from 211 PTR sys_close
231 mille \ptr,\nargs,"(\from+1)",\to 212 PTR sys_waitpid
232 .endif 213 PTR sys_creat
233 .endm 214 PTR sys_link
234 215 PTR sys_unlink /* 4010 */
235 .macro syscalltable 216 PTR sys_execve
236 sys sys_syscall 8 /* 4000 */ 217 PTR sys_chdir
237 sys sys_exit 1 218 PTR sys_time
238 sys __sys_fork 0 219 PTR sys_mknod
239 sys sys_read 3 220 PTR sys_chmod /* 4015 */
240 sys sys_write 3 221 PTR sys_lchown
241 sys sys_open 3 /* 4005 */ 222 PTR sys_ni_syscall
242 sys sys_close 1 223 PTR sys_ni_syscall /* was sys_stat */
243 sys sys_waitpid 3 224 PTR sys_lseek
244 sys sys_creat 2 225 PTR sys_getpid /* 4020 */
245 sys sys_link 2 226 PTR sys_mount
246 sys sys_unlink 1 /* 4010 */ 227 PTR sys_oldumount
247 sys sys_execve 0 228 PTR sys_setuid
248 sys sys_chdir 1 229 PTR sys_getuid
249 sys sys_time 1 230 PTR sys_stime /* 4025 */
250 sys sys_mknod 3 231 PTR sys_ptrace
251 sys sys_chmod 2 /* 4015 */ 232 PTR sys_alarm
252 sys sys_lchown 3 233 PTR sys_ni_syscall /* was sys_fstat */
253 sys sys_ni_syscall 0 234 PTR sys_pause
254 sys sys_ni_syscall 0 /* was sys_stat */ 235 PTR sys_utime /* 4030 */
255 sys sys_lseek 3 236 PTR sys_ni_syscall
256 sys sys_getpid 0 /* 4020 */ 237 PTR sys_ni_syscall
257 sys sys_mount 5 238 PTR sys_access
258 sys sys_oldumount 1 239 PTR sys_nice
259 sys sys_setuid 1 240 PTR sys_ni_syscall /* 4035 */
260 sys sys_getuid 0 241 PTR sys_sync
261 sys sys_stime 1 /* 4025 */ 242 PTR sys_kill
262 sys sys_ptrace 4 243 PTR sys_rename
263 sys sys_alarm 1 244 PTR sys_mkdir
264 sys sys_ni_syscall 0 /* was sys_fstat */ 245 PTR sys_rmdir /* 4040 */
265 sys sys_pause 0 246 PTR sys_dup
266 sys sys_utime 2 /* 4030 */ 247 PTR sysm_pipe
267 sys sys_ni_syscall 0 248 PTR sys_times
268 sys sys_ni_syscall 0 249 PTR sys_ni_syscall
269 sys sys_access 2 250 PTR sys_brk /* 4045 */
270 sys sys_nice 1 251 PTR sys_setgid
271 sys sys_ni_syscall 0 /* 4035 */ 252 PTR sys_getgid
272 sys sys_sync 0 253 PTR sys_ni_syscall /* was signal(2) */
273 sys sys_kill 2 254 PTR sys_geteuid
274 sys sys_rename 2 255 PTR sys_getegid /* 4050 */
275 sys sys_mkdir 2 256 PTR sys_acct
276 sys sys_rmdir 1 /* 4040 */ 257 PTR sys_umount
277 sys sys_dup 1 258 PTR sys_ni_syscall
278 sys sysm_pipe 0 259 PTR sys_ioctl
279 sys sys_times 1 260 PTR sys_fcntl /* 4055 */
280 sys sys_ni_syscall 0 261 PTR sys_ni_syscall
281 sys sys_brk 1 /* 4045 */ 262 PTR sys_setpgid
282 sys sys_setgid 1 263 PTR sys_ni_syscall
283 sys sys_getgid 0 264 PTR sys_olduname
284 sys sys_ni_syscall 0 /* was signal(2) */ 265 PTR sys_umask /* 4060 */
285 sys sys_geteuid 0 266 PTR sys_chroot
286 sys sys_getegid 0 /* 4050 */ 267 PTR sys_ustat
287 sys sys_acct 1 268 PTR sys_dup2
288 sys sys_umount 2 269 PTR sys_getppid
289 sys sys_ni_syscall 0 270 PTR sys_getpgrp /* 4065 */
290 sys sys_ioctl 3 271 PTR sys_setsid
291 sys sys_fcntl 3 /* 4055 */ 272 PTR sys_sigaction
292 sys sys_ni_syscall 2 273 PTR sys_sgetmask
293 sys sys_setpgid 2 274 PTR sys_ssetmask
294 sys sys_ni_syscall 0 275 PTR sys_setreuid /* 4070 */
295 sys sys_olduname 1 276 PTR sys_setregid
296 sys sys_umask 1 /* 4060 */ 277 PTR sys_sigsuspend
297 sys sys_chroot 1 278 PTR sys_sigpending
298 sys sys_ustat 2 279 PTR sys_sethostname
299 sys sys_dup2 2 280 PTR sys_setrlimit /* 4075 */
300 sys sys_getppid 0 281 PTR sys_getrlimit
301 sys sys_getpgrp 0 /* 4065 */ 282 PTR sys_getrusage
302 sys sys_setsid 0 283 PTR sys_gettimeofday
303 sys sys_sigaction 3 284 PTR sys_settimeofday
304 sys sys_sgetmask 0 285 PTR sys_getgroups /* 4080 */
305 sys sys_ssetmask 1 286 PTR sys_setgroups
306 sys sys_setreuid 2 /* 4070 */ 287 PTR sys_ni_syscall /* old_select */
307 sys sys_setregid 2 288 PTR sys_symlink
308 sys sys_sigsuspend 0 289 PTR sys_ni_syscall /* was sys_lstat */
309 sys sys_sigpending 1 290 PTR sys_readlink /* 4085 */
310 sys sys_sethostname 2 291 PTR sys_uselib
311 sys sys_setrlimit 2 /* 4075 */ 292 PTR sys_swapon
312 sys sys_getrlimit 2 293 PTR sys_reboot
313 sys sys_getrusage 2 294 PTR sys_old_readdir
314 sys sys_gettimeofday 2 295 PTR sys_mips_mmap /* 4090 */
315 sys sys_settimeofday 2 296 PTR sys_munmap
316 sys sys_getgroups 2 /* 4080 */ 297 PTR sys_truncate
317 sys sys_setgroups 2 298 PTR sys_ftruncate
318 sys sys_ni_syscall 0 /* old_select */ 299 PTR sys_fchmod
319 sys sys_symlink 2 300 PTR sys_fchown /* 4095 */
320 sys sys_ni_syscall 0 /* was sys_lstat */ 301 PTR sys_getpriority
321 sys sys_readlink 3 /* 4085 */ 302 PTR sys_setpriority
322 sys sys_uselib 1 303 PTR sys_ni_syscall
323 sys sys_swapon 2 304 PTR sys_statfs
324 sys sys_reboot 3 305 PTR sys_fstatfs /* 4100 */
325 sys sys_old_readdir 3 306 PTR sys_ni_syscall /* was ioperm(2) */
326 sys sys_mips_mmap 6 /* 4090 */ 307 PTR sys_socketcall
327 sys sys_munmap 2 308 PTR sys_syslog
328 sys sys_truncate 2 309 PTR sys_setitimer
329 sys sys_ftruncate 2 310 PTR sys_getitimer /* 4105 */
330 sys sys_fchmod 2 311 PTR sys_newstat
331 sys sys_fchown 3 /* 4095 */ 312 PTR sys_newlstat
332 sys sys_getpriority 2 313 PTR sys_newfstat
333 sys sys_setpriority 3 314 PTR sys_uname
334 sys sys_ni_syscall 0 315 PTR sys_ni_syscall /* 4110 was iopl(2) */
335 sys sys_statfs 2 316 PTR sys_vhangup
336 sys sys_fstatfs 2 /* 4100 */ 317 PTR sys_ni_syscall /* was sys_idle() */
337 sys sys_ni_syscall 0 /* was ioperm(2) */ 318 PTR sys_ni_syscall /* was sys_vm86 */
338 sys sys_socketcall 2 319 PTR sys_wait4
339 sys sys_syslog 3 320 PTR sys_swapoff /* 4115 */
340 sys sys_setitimer 3 321 PTR sys_sysinfo
341 sys sys_getitimer 2 /* 4105 */ 322 PTR sys_ipc
342 sys sys_newstat 2 323 PTR sys_fsync
343 sys sys_newlstat 2 324 PTR sys_sigreturn
344 sys sys_newfstat 2 325 PTR __sys_clone /* 4120 */
345 sys sys_uname 1 326 PTR sys_setdomainname
346 sys sys_ni_syscall 0 /* 4110 was iopl(2) */ 327 PTR sys_newuname
347 sys sys_vhangup 0 328 PTR sys_ni_syscall /* sys_modify_ldt */
348 sys sys_ni_syscall 0 /* was sys_idle() */ 329 PTR sys_adjtimex
349 sys sys_ni_syscall 0 /* was sys_vm86 */ 330 PTR sys_mprotect /* 4125 */
350 sys sys_wait4 4 331 PTR sys_sigprocmask
351 sys sys_swapoff 1 /* 4115 */ 332 PTR sys_ni_syscall /* was create_module */
352 sys sys_sysinfo 1 333 PTR sys_init_module
353 sys sys_ipc 6 334 PTR sys_delete_module
354 sys sys_fsync 1 335 PTR sys_ni_syscall /* 4130 was get_kernel_syms */
355 sys sys_sigreturn 0 336 PTR sys_quotactl
356 sys __sys_clone 6 /* 4120 */ 337 PTR sys_getpgid
357 sys sys_setdomainname 2 338 PTR sys_fchdir
358 sys sys_newuname 1 339 PTR sys_bdflush
359 sys sys_ni_syscall 0 /* sys_modify_ldt */ 340 PTR sys_sysfs /* 4135 */
360 sys sys_adjtimex 1 341 PTR sys_personality
361 sys sys_mprotect 3 /* 4125 */ 342 PTR sys_ni_syscall /* for afs_syscall */
362 sys sys_sigprocmask 3 343 PTR sys_setfsuid
363 sys sys_ni_syscall 0 /* was create_module */ 344 PTR sys_setfsgid
364 sys sys_init_module 5 345 PTR sys_llseek /* 4140 */
365 sys sys_delete_module 1 346 PTR sys_getdents
366 sys sys_ni_syscall 0 /* 4130 was get_kernel_syms */ 347 PTR sys_select
367 sys sys_quotactl 4 348 PTR sys_flock
368 sys sys_getpgid 1 349 PTR sys_msync
369 sys sys_fchdir 1 350 PTR sys_readv /* 4145 */
370 sys sys_bdflush 2 351 PTR sys_writev
371 sys sys_sysfs 3 /* 4135 */ 352 PTR sys_cacheflush
372 sys sys_personality 1 353 PTR sys_cachectl
373 sys sys_ni_syscall 0 /* for afs_syscall */ 354 PTR sys_sysmips
374 sys sys_setfsuid 1 355 PTR sys_ni_syscall /* 4150 */
375 sys sys_setfsgid 1 356 PTR sys_getsid
376 sys sys_llseek 5 /* 4140 */ 357 PTR sys_fdatasync
377 sys sys_getdents 3 358 PTR sys_sysctl
378 sys sys_select 5 359 PTR sys_mlock
379 sys sys_flock 2 360 PTR sys_munlock /* 4155 */
380 sys sys_msync 3 361 PTR sys_mlockall
381 sys sys_readv 3 /* 4145 */ 362 PTR sys_munlockall
382 sys sys_writev 3 363 PTR sys_sched_setparam
383 sys sys_cacheflush 3 364 PTR sys_sched_getparam
384 sys sys_cachectl 3 365 PTR sys_sched_setscheduler /* 4160 */
385 sys sys_sysmips 4 366 PTR sys_sched_getscheduler
386 sys sys_ni_syscall 0 /* 4150 */ 367 PTR sys_sched_yield
387 sys sys_getsid 1 368 PTR sys_sched_get_priority_max
388 sys sys_fdatasync 1 369 PTR sys_sched_get_priority_min
389 sys sys_sysctl 1 370 PTR sys_sched_rr_get_interval /* 4165 */
390 sys sys_mlock 2 371 PTR sys_nanosleep
391 sys sys_munlock 2 /* 4155 */ 372 PTR sys_mremap
392 sys sys_mlockall 1 373 PTR sys_accept
393 sys sys_munlockall 0 374 PTR sys_bind
394 sys sys_sched_setparam 2 375 PTR sys_connect /* 4170 */
395 sys sys_sched_getparam 2 376 PTR sys_getpeername
396 sys sys_sched_setscheduler 3 /* 4160 */ 377 PTR sys_getsockname
397 sys sys_sched_getscheduler 1 378 PTR sys_getsockopt
398 sys sys_sched_yield 0 379 PTR sys_listen
399 sys sys_sched_get_priority_max 1 380 PTR sys_recv /* 4175 */
400 sys sys_sched_get_priority_min 1 381 PTR sys_recvfrom
401 sys sys_sched_rr_get_interval 2 /* 4165 */ 382 PTR sys_recvmsg
402 sys sys_nanosleep, 2 383 PTR sys_send
403 sys sys_mremap, 5 384 PTR sys_sendmsg
404 sys sys_accept 3 385 PTR sys_sendto /* 4180 */
405 sys sys_bind 3 386 PTR sys_setsockopt
406 sys sys_connect 3 /* 4170 */ 387 PTR sys_shutdown
407 sys sys_getpeername 3 388 PTR sys_socket
408 sys sys_getsockname 3 389 PTR sys_socketpair
409 sys sys_getsockopt 5 390 PTR sys_setresuid /* 4185 */
410 sys sys_listen 2 391 PTR sys_getresuid
411 sys sys_recv 4 /* 4175 */ 392 PTR sys_ni_syscall /* was sys_query_module */
412 sys sys_recvfrom 6 393 PTR sys_poll
413 sys sys_recvmsg 3 394 PTR sys_ni_syscall /* was nfsservctl */
414 sys sys_send 4 395 PTR sys_setresgid /* 4190 */
415 sys sys_sendmsg 3 396 PTR sys_getresgid
416 sys sys_sendto 6 /* 4180 */ 397 PTR sys_prctl
417 sys sys_setsockopt 5 398 PTR sys_rt_sigreturn
418 sys sys_shutdown 2 399 PTR sys_rt_sigaction
419 sys sys_socket 3 400 PTR sys_rt_sigprocmask /* 4195 */
420 sys sys_socketpair 4 401 PTR sys_rt_sigpending
421 sys sys_setresuid 3 /* 4185 */ 402 PTR sys_rt_sigtimedwait
422 sys sys_getresuid 3 403 PTR sys_rt_sigqueueinfo
423 sys sys_ni_syscall 0 /* was sys_query_module */ 404 PTR sys_rt_sigsuspend
424 sys sys_poll 3 405 PTR sys_pread64 /* 4200 */
425 sys sys_ni_syscall 0 /* was nfsservctl */ 406 PTR sys_pwrite64
426 sys sys_setresgid 3 /* 4190 */ 407 PTR sys_chown
427 sys sys_getresgid 3 408 PTR sys_getcwd
428 sys sys_prctl 5 409 PTR sys_capget
429 sys sys_rt_sigreturn 0 410 PTR sys_capset /* 4205 */
430 sys sys_rt_sigaction 4 411 PTR sys_sigaltstack
431 sys sys_rt_sigprocmask 4 /* 4195 */ 412 PTR sys_sendfile
432 sys sys_rt_sigpending 2 413 PTR sys_ni_syscall
433 sys sys_rt_sigtimedwait 4 414 PTR sys_ni_syscall
434 sys sys_rt_sigqueueinfo 3 415 PTR sys_mips_mmap2 /* 4210 */
435 sys sys_rt_sigsuspend 0 416 PTR sys_truncate64
436 sys sys_pread64 6 /* 4200 */ 417 PTR sys_ftruncate64
437 sys sys_pwrite64 6 418 PTR sys_stat64
438 sys sys_chown 3 419 PTR sys_lstat64
439 sys sys_getcwd 2 420 PTR sys_fstat64 /* 4215 */
440 sys sys_capget 2 421 PTR sys_pivot_root
441 sys sys_capset 2 /* 4205 */ 422 PTR sys_mincore
442 sys sys_sigaltstack 0 423 PTR sys_madvise
443 sys sys_sendfile 4 424 PTR sys_getdents64
444 sys sys_ni_syscall 0 425 PTR sys_fcntl64 /* 4220 */
445 sys sys_ni_syscall 0 426 PTR sys_ni_syscall
446 sys sys_mips_mmap2 6 /* 4210 */ 427 PTR sys_gettid
447 sys sys_truncate64 4 428 PTR sys_readahead
448 sys sys_ftruncate64 4 429 PTR sys_setxattr
449 sys sys_stat64 2 430 PTR sys_lsetxattr /* 4225 */
450 sys sys_lstat64 2 431 PTR sys_fsetxattr
451 sys sys_fstat64 2 /* 4215 */ 432 PTR sys_getxattr
452 sys sys_pivot_root 2 433 PTR sys_lgetxattr
453 sys sys_mincore 3 434 PTR sys_fgetxattr
454 sys sys_madvise 3 435 PTR sys_listxattr /* 4230 */
455 sys sys_getdents64 3 436 PTR sys_llistxattr
456 sys sys_fcntl64 3 /* 4220 */ 437 PTR sys_flistxattr
457 sys sys_ni_syscall 0 438 PTR sys_removexattr
458 sys sys_gettid 0 439 PTR sys_lremovexattr
459 sys sys_readahead 5 440 PTR sys_fremovexattr /* 4235 */
460 sys sys_setxattr 5 441 PTR sys_tkill
461 sys sys_lsetxattr 5 /* 4225 */ 442 PTR sys_sendfile64
462 sys sys_fsetxattr 5 443 PTR sys_futex
463 sys sys_getxattr 4
464 sys sys_lgetxattr 4
465 sys sys_fgetxattr 4
466 sys sys_listxattr 3 /* 4230 */
467 sys sys_llistxattr 3
468 sys sys_flistxattr 3
469 sys sys_removexattr 2
470 sys sys_lremovexattr 2
471 sys sys_fremovexattr 2 /* 4235 */
472 sys sys_tkill 2
473 sys sys_sendfile64 5
474 sys sys_futex 6
475#ifdef CONFIG_MIPS_MT_FPAFF 444#ifdef CONFIG_MIPS_MT_FPAFF
476 /* 445 /*
477 * For FPU affinity scheduling on MIPS MT processors, we need to 446 * For FPU affinity scheduling on MIPS MT processors, we need to
@@ -480,132 +449,117 @@ einval: li v0, -ENOSYS
480 * these hooks for the 32-bit kernel - there is no MIPS64 MT processor 449 * these hooks for the 32-bit kernel - there is no MIPS64 MT processor
481 * atm. 450 * atm.
482 */ 451 */
483 sys mipsmt_sys_sched_setaffinity 3 452 PTR mipsmt_sys_sched_setaffinity
484 sys mipsmt_sys_sched_getaffinity 3 453 PTR mipsmt_sys_sched_getaffinity
485#else 454#else
486 sys sys_sched_setaffinity 3 455 PTR sys_sched_setaffinity
487 sys sys_sched_getaffinity 3 /* 4240 */ 456 PTR sys_sched_getaffinity /* 4240 */
488#endif /* CONFIG_MIPS_MT_FPAFF */ 457#endif /* CONFIG_MIPS_MT_FPAFF */
489 sys sys_io_setup 2 458 PTR sys_io_setup
490 sys sys_io_destroy 1 459 PTR sys_io_destroy
491 sys sys_io_getevents 5 460 PTR sys_io_getevents
492 sys sys_io_submit 3 461 PTR sys_io_submit
493 sys sys_io_cancel 3 /* 4245 */ 462 PTR sys_io_cancel /* 4245 */
494 sys sys_exit_group 1 463 PTR sys_exit_group
495 sys sys_lookup_dcookie 4 464 PTR sys_lookup_dcookie
496 sys sys_epoll_create 1 465 PTR sys_epoll_create
497 sys sys_epoll_ctl 4 466 PTR sys_epoll_ctl
498 sys sys_epoll_wait 4 /* 4250 */ 467 PTR sys_epoll_wait /* 4250 */
499 sys sys_remap_file_pages 5 468 PTR sys_remap_file_pages
500 sys sys_set_tid_address 1 469 PTR sys_set_tid_address
501 sys sys_restart_syscall 0 470 PTR sys_restart_syscall
502 sys sys_fadvise64_64 7 471 PTR sys_fadvise64_64
503 sys sys_statfs64 3 /* 4255 */ 472 PTR sys_statfs64 /* 4255 */
504 sys sys_fstatfs64 2 473 PTR sys_fstatfs64
505 sys sys_timer_create 3 474 PTR sys_timer_create
506 sys sys_timer_settime 4 475 PTR sys_timer_settime
507 sys sys_timer_gettime 2 476 PTR sys_timer_gettime
508 sys sys_timer_getoverrun 1 /* 4260 */ 477 PTR sys_timer_getoverrun /* 4260 */
509 sys sys_timer_delete 1 478 PTR sys_timer_delete
510 sys sys_clock_settime 2 479 PTR sys_clock_settime
511 sys sys_clock_gettime 2 480 PTR sys_clock_gettime
512 sys sys_clock_getres 2 481 PTR sys_clock_getres
513 sys sys_clock_nanosleep 4 /* 4265 */ 482 PTR sys_clock_nanosleep /* 4265 */
514 sys sys_tgkill 3 483 PTR sys_tgkill
515 sys sys_utimes 2 484 PTR sys_utimes
516 sys sys_mbind 4 485 PTR sys_mbind
517 sys sys_ni_syscall 0 /* sys_get_mempolicy */ 486 PTR sys_ni_syscall /* sys_get_mempolicy */
518 sys sys_ni_syscall 0 /* 4270 sys_set_mempolicy */ 487 PTR sys_ni_syscall /* 4270 sys_set_mempolicy */
519 sys sys_mq_open 4 488 PTR sys_mq_open
520 sys sys_mq_unlink 1 489 PTR sys_mq_unlink
521 sys sys_mq_timedsend 5 490 PTR sys_mq_timedsend
522 sys sys_mq_timedreceive 5 491 PTR sys_mq_timedreceive
523 sys sys_mq_notify 2 /* 4275 */ 492 PTR sys_mq_notify /* 4275 */
524 sys sys_mq_getsetattr 3 493 PTR sys_mq_getsetattr
525 sys sys_ni_syscall 0 /* sys_vserver */ 494 PTR sys_ni_syscall /* sys_vserver */
526 sys sys_waitid 5 495 PTR sys_waitid
527 sys sys_ni_syscall 0 /* available, was setaltroot */ 496 PTR sys_ni_syscall /* available, was setaltroot */
528 sys sys_add_key 5 /* 4280 */ 497 PTR sys_add_key /* 4280 */
529 sys sys_request_key 4 498 PTR sys_request_key
530 sys sys_keyctl 5 499 PTR sys_keyctl
531 sys sys_set_thread_area 1 500 PTR sys_set_thread_area
532 sys sys_inotify_init 0 501 PTR sys_inotify_init
533 sys sys_inotify_add_watch 3 /* 4285 */ 502 PTR sys_inotify_add_watch /* 4285 */
534 sys sys_inotify_rm_watch 2 503 PTR sys_inotify_rm_watch
535 sys sys_migrate_pages 4 504 PTR sys_migrate_pages
536 sys sys_openat 4 505 PTR sys_openat
537 sys sys_mkdirat 3 506 PTR sys_mkdirat
538 sys sys_mknodat 4 /* 4290 */ 507 PTR sys_mknodat /* 4290 */
539 sys sys_fchownat 5 508 PTR sys_fchownat
540 sys sys_futimesat 3 509 PTR sys_futimesat
541 sys sys_fstatat64 4 510 PTR sys_fstatat64
542 sys sys_unlinkat 3 511 PTR sys_unlinkat
543 sys sys_renameat 4 /* 4295 */ 512 PTR sys_renameat /* 4295 */
544 sys sys_linkat 5 513 PTR sys_linkat
545 sys sys_symlinkat 3 514 PTR sys_symlinkat
546 sys sys_readlinkat 4 515 PTR sys_readlinkat
547 sys sys_fchmodat 3 516 PTR sys_fchmodat
548 sys sys_faccessat 3 /* 4300 */ 517 PTR sys_faccessat /* 4300 */
549 sys sys_pselect6 6 518 PTR sys_pselect6
550 sys sys_ppoll 5 519 PTR sys_ppoll
551 sys sys_unshare 1 520 PTR sys_unshare
552 sys sys_splice 6 521 PTR sys_splice
553 sys sys_sync_file_range 7 /* 4305 */ 522 PTR sys_sync_file_range /* 4305 */
554 sys sys_tee 4 523 PTR sys_tee
555 sys sys_vmsplice 4 524 PTR sys_vmsplice
556 sys sys_move_pages 6 525 PTR sys_move_pages
557 sys sys_set_robust_list 2 526 PTR sys_set_robust_list
558 sys sys_get_robust_list 3 /* 4310 */ 527 PTR sys_get_robust_list /* 4310 */
559 sys sys_kexec_load 4 528 PTR sys_kexec_load
560 sys sys_getcpu 3 529 PTR sys_getcpu
561 sys sys_epoll_pwait 6 530 PTR sys_epoll_pwait
562 sys sys_ioprio_set 3 531 PTR sys_ioprio_set
563 sys sys_ioprio_get 2 /* 4315 */ 532 PTR sys_ioprio_get /* 4315 */
564 sys sys_utimensat 4 533 PTR sys_utimensat
565 sys sys_signalfd 3 534 PTR sys_signalfd
566 sys sys_ni_syscall 0 /* was timerfd */ 535 PTR sys_ni_syscall /* was timerfd */
567 sys sys_eventfd 1 536 PTR sys_eventfd
568 sys sys_fallocate 6 /* 4320 */ 537 PTR sys_fallocate /* 4320 */
569 sys sys_timerfd_create 2 538 PTR sys_timerfd_create
570 sys sys_timerfd_gettime 2 539 PTR sys_timerfd_gettime
571 sys sys_timerfd_settime 4 540 PTR sys_timerfd_settime
572 sys sys_signalfd4 4 541 PTR sys_signalfd4
573 sys sys_eventfd2 2 /* 4325 */ 542 PTR sys_eventfd2 /* 4325 */
574 sys sys_epoll_create1 1 543 PTR sys_epoll_create1
575 sys sys_dup3 3 544 PTR sys_dup3
576 sys sys_pipe2 2 545 PTR sys_pipe2
577 sys sys_inotify_init1 1 546 PTR sys_inotify_init1
578 sys sys_preadv 6 /* 4330 */ 547 PTR sys_preadv /* 4330 */
579 sys sys_pwritev 6 548 PTR sys_pwritev
580 sys sys_rt_tgsigqueueinfo 4 549 PTR sys_rt_tgsigqueueinfo
581 sys sys_perf_event_open 5 550 PTR sys_perf_event_open
582 sys sys_accept4 4 551 PTR sys_accept4
583 sys sys_recvmmsg 5 /* 4335 */ 552 PTR sys_recvmmsg /* 4335 */
584 sys sys_fanotify_init 2 553 PTR sys_fanotify_init
585 sys sys_fanotify_mark 6 554 PTR sys_fanotify_mark
586 sys sys_prlimit64 4 555 PTR sys_prlimit64
587 sys sys_name_to_handle_at 5 556 PTR sys_name_to_handle_at
588 sys sys_open_by_handle_at 3 /* 4340 */ 557 PTR sys_open_by_handle_at /* 4340 */
589 sys sys_clock_adjtime 2 558 PTR sys_clock_adjtime
590 sys sys_syncfs 1 559 PTR sys_syncfs
591 sys sys_sendmmsg 4 560 PTR sys_sendmmsg
592 sys sys_setns 2 561 PTR sys_setns
593 sys sys_process_vm_readv 6 /* 4345 */ 562 PTR sys_process_vm_readv /* 4345 */
594 sys sys_process_vm_writev 6 563 PTR sys_process_vm_writev
595 sys sys_kcmp 5 564 PTR sys_kcmp
596 sys sys_finit_module 3 565 PTR sys_finit_module
597 .endm
598
599 /* We pre-compute the number of _instruction_ bytes needed to
600 load or store the arguments 6-8. Negative values are ignored. */
601
602 .macro sys function, nargs
603 PTR \function
604 LONG (\nargs << 2) - (5 << 2)
605 .endm
606
607 .align 3
608 .type sys_call_table,@object
609EXPORT(sys_call_table)
610 syscalltable
611 .size sys_call_table, . - sys_call_table
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index be6627ead619..57e3742fec59 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -114,7 +114,8 @@ illegal_syscall:
114 END(handle_sys64) 114 END(handle_sys64)
115 115
116 .align 3 116 .align 3
117sys_call_table: 117 .type sys_call_table, @object
118EXPORT(sys_call_table)
118 PTR sys_read /* 5000 */ 119 PTR sys_read /* 5000 */
119 PTR sys_write 120 PTR sys_write
120 PTR sys_open 121 PTR sys_open
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index cab150789c8d..2f48f5934399 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -103,6 +103,7 @@ not_n32_scall:
103 103
104 END(handle_sysn32) 104 END(handle_sysn32)
105 105
106 .type sysn32_call_table, @object
106EXPORT(sysn32_call_table) 107EXPORT(sysn32_call_table)
107 PTR sys_read /* 6000 */ 108 PTR sys_read /* 6000 */
108 PTR sys_write 109 PTR sys_write
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 37605dc8eef7..f1acdb429f4f 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -53,7 +53,7 @@ NESTED(handle_sys, PT_SIZE, sp)
53 sll a3, a3, 0 53 sll a3, a3, 0
54 54
55 dsll t0, v0, 3 # offset into table 55 dsll t0, v0, 3 # offset into table
56 ld t2, (sys_call_table - (__NR_O32_Linux * 8))(t0) 56 ld t2, (sys32_call_table - (__NR_O32_Linux * 8))(t0)
57 57
58 sd a3, PT_R26(sp) # save a3 for syscall restarting 58 sd a3, PT_R26(sp) # save a3 for syscall restarting
59 59
@@ -168,7 +168,7 @@ LEAF(sys32_syscall)
168 beqz t0, einval # do not recurse 168 beqz t0, einval # do not recurse
169 dsll t1, t0, 3 169 dsll t1, t0, 3
170 beqz v0, einval 170 beqz v0, einval
171 ld t2, sys_call_table(t1) # syscall routine 171 ld t2, sys32_call_table(t1) # syscall routine
172 172
173 move a0, a1 # shift argument registers 173 move a0, a1 # shift argument registers
174 move a1, a2 174 move a1, a2
@@ -190,8 +190,8 @@ einval: li v0, -ENOSYS
190 END(sys32_syscall) 190 END(sys32_syscall)
191 191
192 .align 3 192 .align 3
193 .type sys_call_table,@object 193 .type sys32_call_table,@object
194sys_call_table: 194EXPORT(sys32_call_table)
195 PTR sys32_syscall /* 4000 */ 195 PTR sys32_syscall /* 4000 */
196 PTR sys_exit 196 PTR sys_exit
197 PTR __sys_fork 197 PTR __sys_fork
@@ -541,4 +541,4 @@ sys_call_table:
541 PTR compat_sys_process_vm_writev 541 PTR compat_sys_process_vm_writev
542 PTR sys_kcmp 542 PTR sys_kcmp
543 PTR sys_finit_module 543 PTR sys_finit_module
544 .size sys_call_table,.-sys_call_table 544 .size sys32_call_table,.-sys32_call_table
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index c538d6e01b7b..a842154d57dc 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -300,12 +300,13 @@ static void __init bootmem_init(void)
300 int i; 300 int i;
301 301
302 /* 302 /*
303 * Init any data related to initrd. It's a nop if INITRD is 303 * Sanity check any INITRD first. We don't take it into account
304 * not selected. Once that done we can determine the low bound 304 * for bootmem setup initially, rely on the end-of-kernel-code
305 * of usable memory. 305 * as our memory range starting point. Once bootmem is inited we
306 * will reserve the area used for the initrd.
306 */ 307 */
307 reserved_end = max(init_initrd(), 308 init_initrd();
308 (unsigned long) PFN_UP(__pa_symbol(&_end))); 309 reserved_end = (unsigned long) PFN_UP(__pa_symbol(&_end));
309 310
310 /* 311 /*
311 * max_low_pfn is not a number of pages. The number of pages 312 * max_low_pfn is not a number of pages. The number of pages
@@ -362,6 +363,14 @@ static void __init bootmem_init(void)
362 max_low_pfn = PFN_DOWN(HIGHMEM_START); 363 max_low_pfn = PFN_DOWN(HIGHMEM_START);
363 } 364 }
364 365
366#ifdef CONFIG_BLK_DEV_INITRD
367 /*
368 * mapstart should be after initrd_end
369 */
370 if (initrd_end)
371 mapstart = max(mapstart, (unsigned long)PFN_UP(__pa(initrd_end)));
372#endif
373
365 /* 374 /*
366 * Initialize the boot-time allocator with low memory only. 375 * Initialize the boot-time allocator with low memory only.
367 */ 376 */
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 57de8b751627..1905a419aa46 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -314,7 +314,7 @@ SYSCALL_DEFINE3(32_sigaction, long, sig, const struct compat_sigaction __user *,
314 return ret; 314 return ret;
315} 315}
316 316
317int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) 317int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
318{ 318{
319 int err; 319 int err;
320 320
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index 126da74d4c55..2362665ba496 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -136,10 +136,10 @@ static void bmips_prepare_cpus(unsigned int max_cpus)
136{ 136{
137 if (request_irq(IPI0_IRQ, bmips_ipi_interrupt, IRQF_PERCPU, 137 if (request_irq(IPI0_IRQ, bmips_ipi_interrupt, IRQF_PERCPU,
138 "smp_ipi0", NULL)) 138 "smp_ipi0", NULL))
139 panic("Can't request IPI0 interrupt\n"); 139 panic("Can't request IPI0 interrupt");
140 if (request_irq(IPI1_IRQ, bmips_ipi_interrupt, IRQF_PERCPU, 140 if (request_irq(IPI1_IRQ, bmips_ipi_interrupt, IRQF_PERCPU,
141 "smp_ipi1", NULL)) 141 "smp_ipi1", NULL))
142 panic("Can't request IPI1 interrupt\n"); 142 panic("Can't request IPI1 interrupt");
143} 143}
144 144
145/* 145/*
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 5c208ed8f856..0a022ee33b2a 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -150,7 +150,6 @@ asmlinkage void start_secondary(void)
150void __irq_entry smp_call_function_interrupt(void) 150void __irq_entry smp_call_function_interrupt(void)
151{ 151{
152 irq_enter(); 152 irq_enter();
153 generic_smp_call_function_single_interrupt();
154 generic_smp_call_function_interrupt(); 153 generic_smp_call_function_interrupt();
155 irq_exit(); 154 irq_exit();
156} 155}
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 364d26ae4215..dcb8e5d3bb8a 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -24,6 +24,7 @@
24#include <linux/export.h> 24#include <linux/export.h>
25 25
26#include <asm/cpu-features.h> 26#include <asm/cpu-features.h>
27#include <asm/cpu-type.h>
27#include <asm/div64.h> 28#include <asm/div64.h>
28#include <asm/smtc_ipi.h> 29#include <asm/smtc_ipi.h>
29#include <asm/time.h> 30#include <asm/time.h>
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index aec3408edd4b..f9c8746be8d6 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -39,6 +39,7 @@
39#include <asm/break.h> 39#include <asm/break.h>
40#include <asm/cop2.h> 40#include <asm/cop2.h>
41#include <asm/cpu.h> 41#include <asm/cpu.h>
42#include <asm/cpu-type.h>
42#include <asm/dsp.h> 43#include <asm/dsp.h>
43#include <asm/fpu.h> 44#include <asm/fpu.h>
44#include <asm/fpu_emulator.h> 45#include <asm/fpu_emulator.h>
@@ -329,6 +330,7 @@ void show_regs(struct pt_regs *regs)
329void show_registers(struct pt_regs *regs) 330void show_registers(struct pt_regs *regs)
330{ 331{
331 const int field = 2 * sizeof(unsigned long); 332 const int field = 2 * sizeof(unsigned long);
333 mm_segment_t old_fs = get_fs();
332 334
333 __show_regs(regs); 335 __show_regs(regs);
334 print_modules(); 336 print_modules();
@@ -343,9 +345,13 @@ void show_registers(struct pt_regs *regs)
343 printk("*HwTLS: %0*lx\n", field, tls); 345 printk("*HwTLS: %0*lx\n", field, tls);
344 } 346 }
345 347
348 if (!user_mode(regs))
349 /* Necessary for getting the correct stack content */
350 set_fs(KERNEL_DS);
346 show_stacktrace(current, regs); 351 show_stacktrace(current, regs);
347 show_code((unsigned int __user *) regs->cp0_epc); 352 show_code((unsigned int __user *) regs->cp0_epc);
348 printk("\n"); 353 printk("\n");
354 set_fs(old_fs);
349} 355}
350 356
351static int regs_to_trapnr(struct pt_regs *regs) 357static int regs_to_trapnr(struct pt_regs *regs)
@@ -365,7 +371,8 @@ void __noreturn die(const char *str, struct pt_regs *regs)
365 371
366 oops_enter(); 372 oops_enter();
367 373
368 if (notify_die(DIE_OOPS, str, regs, 0, regs_to_trapnr(regs), SIGSEGV) == NOTIFY_STOP) 374 if (notify_die(DIE_OOPS, str, regs, 0, regs_to_trapnr(regs),
375 SIGSEGV) == NOTIFY_STOP)
369 sig = 0; 376 sig = 0;
370 377
371 console_verbose(); 378 console_verbose();
@@ -456,8 +463,8 @@ asmlinkage void do_be(struct pt_regs *regs)
456 printk(KERN_ALERT "%s bus error, epc == %0*lx, ra == %0*lx\n", 463 printk(KERN_ALERT "%s bus error, epc == %0*lx, ra == %0*lx\n",
457 data ? "Data" : "Instruction", 464 data ? "Data" : "Instruction",
458 field, regs->cp0_epc, field, regs->regs[31]); 465 field, regs->cp0_epc, field, regs->regs[31]);
459 if (notify_die(DIE_OOPS, "bus error", regs, 0, regs_to_trapnr(regs), SIGBUS) 466 if (notify_die(DIE_OOPS, "bus error", regs, 0, regs_to_trapnr(regs),
460 == NOTIFY_STOP) 467 SIGBUS) == NOTIFY_STOP)
461 goto out; 468 goto out;
462 469
463 die_if_kernel("Oops", regs); 470 die_if_kernel("Oops", regs);
@@ -622,7 +629,7 @@ static int simulate_rdhwr(struct pt_regs *regs, int rd, int rt)
622 regs->regs[rt] = read_c0_count(); 629 regs->regs[rt] = read_c0_count();
623 return 0; 630 return 0;
624 case 3: /* Count register resolution */ 631 case 3: /* Count register resolution */
625 switch (current_cpu_data.cputype) { 632 switch (current_cpu_type()) {
626 case CPU_20KC: 633 case CPU_20KC:
627 case CPU_25KF: 634 case CPU_25KF:
628 regs->regs[rt] = 1; 635 regs->regs[rt] = 1;
@@ -726,8 +733,8 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
726 siginfo_t info = {0}; 733 siginfo_t info = {0};
727 734
728 prev_state = exception_enter(); 735 prev_state = exception_enter();
729 if (notify_die(DIE_FP, "FP exception", regs, 0, regs_to_trapnr(regs), SIGFPE) 736 if (notify_die(DIE_FP, "FP exception", regs, 0, regs_to_trapnr(regs),
730 == NOTIFY_STOP) 737 SIGFPE) == NOTIFY_STOP)
731 goto out; 738 goto out;
732 die_if_kernel("FP exception in kernel code", regs); 739 die_if_kernel("FP exception in kernel code", regs);
733 740
@@ -797,7 +804,8 @@ static void do_trap_or_bp(struct pt_regs *regs, unsigned int code,
797 return; 804 return;
798#endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */ 805#endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */
799 806
800 if (notify_die(DIE_TRAP, str, regs, code, regs_to_trapnr(regs), SIGTRAP) == NOTIFY_STOP) 807 if (notify_die(DIE_TRAP, str, regs, code, regs_to_trapnr(regs),
808 SIGTRAP) == NOTIFY_STOP)
801 return; 809 return;
802 810
803 /* 811 /*
@@ -891,12 +899,14 @@ asmlinkage void do_bp(struct pt_regs *regs)
891 */ 899 */
892 switch (bcode) { 900 switch (bcode) {
893 case BRK_KPROBE_BP: 901 case BRK_KPROBE_BP:
894 if (notify_die(DIE_BREAK, "debug", regs, bcode, regs_to_trapnr(regs), SIGTRAP) == NOTIFY_STOP) 902 if (notify_die(DIE_BREAK, "debug", regs, bcode,
903 regs_to_trapnr(regs), SIGTRAP) == NOTIFY_STOP)
895 goto out; 904 goto out;
896 else 905 else
897 break; 906 break;
898 case BRK_KPROBE_SSTEPBP: 907 case BRK_KPROBE_SSTEPBP:
899 if (notify_die(DIE_SSTEPBP, "single_step", regs, bcode, regs_to_trapnr(regs), SIGTRAP) == NOTIFY_STOP) 908 if (notify_die(DIE_SSTEPBP, "single_step", regs, bcode,
909 regs_to_trapnr(regs), SIGTRAP) == NOTIFY_STOP)
900 goto out; 910 goto out;
901 else 911 else
902 break; 912 break;
@@ -960,8 +970,8 @@ asmlinkage void do_ri(struct pt_regs *regs)
960 int status = -1; 970 int status = -1;
961 971
962 prev_state = exception_enter(); 972 prev_state = exception_enter();
963 if (notify_die(DIE_RI, "RI Fault", regs, 0, regs_to_trapnr(regs), SIGILL) 973 if (notify_die(DIE_RI, "RI Fault", regs, 0, regs_to_trapnr(regs),
964 == NOTIFY_STOP) 974 SIGILL) == NOTIFY_STOP)
965 goto out; 975 goto out;
966 976
967 die_if_kernel("Reserved instruction in kernel code", regs); 977 die_if_kernel("Reserved instruction in kernel code", regs);
@@ -1487,10 +1497,14 @@ int register_nmi_notifier(struct notifier_block *nb)
1487 1497
1488void __noreturn nmi_exception_handler(struct pt_regs *regs) 1498void __noreturn nmi_exception_handler(struct pt_regs *regs)
1489{ 1499{
1500 char str[100];
1501
1490 raw_notifier_call_chain(&nmi_chain, 0, regs); 1502 raw_notifier_call_chain(&nmi_chain, 0, regs);
1491 bust_spinlocks(1); 1503 bust_spinlocks(1);
1492 printk("NMI taken!!!!\n"); 1504 snprintf(str, 100, "CPU%d NMI taken, CP0_EPC=%lx\n",
1493 die("NMI", regs); 1505 smp_processor_id(), regs->cp0_epc);
1506 regs->cp0_epc = read_c0_errorepc();
1507 die(str, regs);
1494} 1508}
1495 1509
1496#define VECTORSPACING 0x100 /* for EI/VI mode */ 1510#define VECTORSPACING 0x100 /* for EI/VI mode */
@@ -1553,7 +1567,6 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
1553 unsigned char *b; 1567 unsigned char *b;
1554 1568
1555 BUG_ON(!cpu_has_veic && !cpu_has_vint); 1569 BUG_ON(!cpu_has_veic && !cpu_has_vint);
1556 BUG_ON((n < 0) && (n > 9));
1557 1570
1558 if (addr == NULL) { 1571 if (addr == NULL) {
1559 handler = (unsigned long) do_default_vi; 1572 handler = (unsigned long) do_default_vi;
diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index a7b044536de4..73b34827826c 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -198,12 +198,13 @@ kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
198 return -ENOIOCTLCMD; 198 return -ENOIOCTLCMD;
199} 199}
200 200
201void kvm_arch_free_memslot(struct kvm_memory_slot *free, 201void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
202 struct kvm_memory_slot *dont) 202 struct kvm_memory_slot *dont)
203{ 203{
204} 204}
205 205
206int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) 206int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
207 unsigned long npages)
207{ 208{
208 return 0; 209 return 0;
209} 210}
diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c
index eb3e18659630..85685e1cdb89 100644
--- a/arch/mips/lantiq/irq.c
+++ b/arch/mips/lantiq/irq.c
@@ -390,7 +390,7 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent)
390 ret = of_irq_to_resource_table(eiu_node, 390 ret = of_irq_to_resource_table(eiu_node,
391 ltq_eiu_irq, exin_avail); 391 ltq_eiu_irq, exin_avail);
392 if (ret != exin_avail) 392 if (ret != exin_avail)
393 panic("failed to load external irq resources\n"); 393 panic("failed to load external irq resources");
394 394
395 if (request_mem_region(res.start, resource_size(&res), 395 if (request_mem_region(res.start, resource_size(&res),
396 res.name) < 0) 396 res.name) < 0)
diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c
index 49c460370285..19686c5bc5ed 100644
--- a/arch/mips/lantiq/prom.c
+++ b/arch/mips/lantiq/prom.c
@@ -14,6 +14,7 @@
14 14
15#include <asm/bootinfo.h> 15#include <asm/bootinfo.h>
16#include <asm/time.h> 16#include <asm/time.h>
17#include <asm/prom.h>
17 18
18#include <lantiq.h> 19#include <lantiq.h>
19 20
diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
index c24924fe087d..51804b10a036 100644
--- a/arch/mips/lantiq/xway/sysctrl.c
+++ b/arch/mips/lantiq/xway/sysctrl.c
@@ -128,7 +128,7 @@ static int pmu_enable(struct clk *clk)
128 do {} while (--retry && (pmu_r32(PWDSR(clk->module)) & clk->bits)); 128 do {} while (--retry && (pmu_r32(PWDSR(clk->module)) & clk->bits));
129 129
130 if (!retry) 130 if (!retry)
131 panic("activating PMU module failed!\n"); 131 panic("activating PMU module failed!");
132 132
133 return 0; 133 return 0;
134} 134}
diff --git a/arch/mips/mm/c-octeon.c b/arch/mips/mm/c-octeon.c
index 729e7702b1de..c8efdb5b6ee0 100644
--- a/arch/mips/mm/c-octeon.c
+++ b/arch/mips/mm/c-octeon.c
@@ -19,6 +19,7 @@
19#include <asm/bootinfo.h> 19#include <asm/bootinfo.h>
20#include <asm/cacheops.h> 20#include <asm/cacheops.h>
21#include <asm/cpu-features.h> 21#include <asm/cpu-features.h>
22#include <asm/cpu-type.h>
22#include <asm/page.h> 23#include <asm/page.h>
23#include <asm/pgtable.h> 24#include <asm/pgtable.h>
24#include <asm/r4kcache.h> 25#include <asm/r4kcache.h>
@@ -186,9 +187,10 @@ static void probe_octeon(void)
186 unsigned long dcache_size; 187 unsigned long dcache_size;
187 unsigned int config1; 188 unsigned int config1;
188 struct cpuinfo_mips *c = &current_cpu_data; 189 struct cpuinfo_mips *c = &current_cpu_data;
190 int cputype = current_cpu_type();
189 191
190 config1 = read_c0_config1(); 192 config1 = read_c0_config1();
191 switch (c->cputype) { 193 switch (cputype) {
192 case CPU_CAVIUM_OCTEON: 194 case CPU_CAVIUM_OCTEON:
193 case CPU_CAVIUM_OCTEON_PLUS: 195 case CPU_CAVIUM_OCTEON_PLUS:
194 c->icache.linesz = 2 << ((config1 >> 19) & 7); 196 c->icache.linesz = 2 << ((config1 >> 19) & 7);
@@ -199,7 +201,7 @@ static void probe_octeon(void)
199 c->icache.sets * c->icache.ways * c->icache.linesz; 201 c->icache.sets * c->icache.ways * c->icache.linesz;
200 c->icache.waybit = ffs(icache_size / c->icache.ways) - 1; 202 c->icache.waybit = ffs(icache_size / c->icache.ways) - 1;
201 c->dcache.linesz = 128; 203 c->dcache.linesz = 128;
202 if (c->cputype == CPU_CAVIUM_OCTEON_PLUS) 204 if (cputype == CPU_CAVIUM_OCTEON_PLUS)
203 c->dcache.sets = 2; /* CN5XXX has two Dcache sets */ 205 c->dcache.sets = 2; /* CN5XXX has two Dcache sets */
204 else 206 else
205 c->dcache.sets = 1; /* CN3XXX has one Dcache set */ 207 c->dcache.sets = 1; /* CN3XXX has one Dcache set */
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index f749f687ee87..62ffd20ea869 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -12,6 +12,7 @@
12#include <linux/highmem.h> 12#include <linux/highmem.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/linkage.h> 14#include <linux/linkage.h>
15#include <linux/preempt.h>
15#include <linux/sched.h> 16#include <linux/sched.h>
16#include <linux/smp.h> 17#include <linux/smp.h>
17#include <linux/mm.h> 18#include <linux/mm.h>
@@ -24,6 +25,7 @@
24#include <asm/cacheops.h> 25#include <asm/cacheops.h>
25#include <asm/cpu.h> 26#include <asm/cpu.h>
26#include <asm/cpu-features.h> 27#include <asm/cpu-features.h>
28#include <asm/cpu-type.h>
27#include <asm/io.h> 29#include <asm/io.h>
28#include <asm/page.h> 30#include <asm/page.h>
29#include <asm/pgtable.h> 31#include <asm/pgtable.h>
@@ -344,14 +346,8 @@ static void r4k_blast_scache_setup(void)
344 346
345static inline void local_r4k___flush_cache_all(void * args) 347static inline void local_r4k___flush_cache_all(void * args)
346{ 348{
347#if defined(CONFIG_CPU_LOONGSON2)
348 r4k_blast_scache();
349 return;
350#endif
351 r4k_blast_dcache();
352 r4k_blast_icache();
353
354 switch (current_cpu_type()) { 349 switch (current_cpu_type()) {
350 case CPU_LOONGSON2:
355 case CPU_R4000SC: 351 case CPU_R4000SC:
356 case CPU_R4000MC: 352 case CPU_R4000MC:
357 case CPU_R4400SC: 353 case CPU_R4400SC:
@@ -359,7 +355,18 @@ static inline void local_r4k___flush_cache_all(void * args)
359 case CPU_R10000: 355 case CPU_R10000:
360 case CPU_R12000: 356 case CPU_R12000:
361 case CPU_R14000: 357 case CPU_R14000:
358 /*
359 * These caches are inclusive caches, that is, if something
360 * is not cached in the S-cache, we know it also won't be
361 * in one of the primary caches.
362 */
362 r4k_blast_scache(); 363 r4k_blast_scache();
364 break;
365
366 default:
367 r4k_blast_dcache();
368 r4k_blast_icache();
369 break;
363 } 370 }
364} 371}
365 372
@@ -570,8 +577,17 @@ static inline void local_r4k_flush_icache_range(unsigned long start, unsigned lo
570 577
571 if (end - start > icache_size) 578 if (end - start > icache_size)
572 r4k_blast_icache(); 579 r4k_blast_icache();
573 else 580 else {
574 protected_blast_icache_range(start, end); 581 switch (boot_cpu_type()) {
582 case CPU_LOONGSON2:
583 protected_blast_icache_range(start, end);
584 break;
585
586 default:
587 protected_loongson23_blast_icache_range(start, end);
588 break;
589 }
590 }
575} 591}
576 592
577static inline void local_r4k_flush_icache_range_ipi(void *args) 593static inline void local_r4k_flush_icache_range_ipi(void *args)
@@ -601,11 +617,13 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
601 /* Catch bad driver code */ 617 /* Catch bad driver code */
602 BUG_ON(size == 0); 618 BUG_ON(size == 0);
603 619
620 preempt_disable();
604 if (cpu_has_inclusive_pcaches) { 621 if (cpu_has_inclusive_pcaches) {
605 if (size >= scache_size) 622 if (size >= scache_size)
606 r4k_blast_scache(); 623 r4k_blast_scache();
607 else 624 else
608 blast_scache_range(addr, addr + size); 625 blast_scache_range(addr, addr + size);
626 preempt_enable();
609 __sync(); 627 __sync();
610 return; 628 return;
611 } 629 }
@@ -621,6 +639,7 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
621 R4600_HIT_CACHEOP_WAR_IMPL; 639 R4600_HIT_CACHEOP_WAR_IMPL;
622 blast_dcache_range(addr, addr + size); 640 blast_dcache_range(addr, addr + size);
623 } 641 }
642 preempt_enable();
624 643
625 bc_wback_inv(addr, size); 644 bc_wback_inv(addr, size);
626 __sync(); 645 __sync();
@@ -631,6 +650,7 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
631 /* Catch bad driver code */ 650 /* Catch bad driver code */
632 BUG_ON(size == 0); 651 BUG_ON(size == 0);
633 652
653 preempt_disable();
634 if (cpu_has_inclusive_pcaches) { 654 if (cpu_has_inclusive_pcaches) {
635 if (size >= scache_size) 655 if (size >= scache_size)
636 r4k_blast_scache(); 656 r4k_blast_scache();
@@ -645,6 +665,7 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
645 */ 665 */
646 blast_inv_scache_range(addr, addr + size); 666 blast_inv_scache_range(addr, addr + size);
647 } 667 }
668 preempt_enable();
648 __sync(); 669 __sync();
649 return; 670 return;
650 } 671 }
@@ -655,6 +676,7 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
655 R4600_HIT_CACHEOP_WAR_IMPL; 676 R4600_HIT_CACHEOP_WAR_IMPL;
656 blast_inv_dcache_range(addr, addr + size); 677 blast_inv_dcache_range(addr, addr + size);
657 } 678 }
679 preempt_enable();
658 680
659 bc_inv(addr, size); 681 bc_inv(addr, size);
660 __sync(); 682 __sync();
@@ -780,20 +802,30 @@ static inline void rm7k_erratum31(void)
780 802
781static inline void alias_74k_erratum(struct cpuinfo_mips *c) 803static inline void alias_74k_erratum(struct cpuinfo_mips *c)
782{ 804{
805 unsigned int imp = c->processor_id & PRID_IMP_MASK;
806 unsigned int rev = c->processor_id & PRID_REV_MASK;
807
783 /* 808 /*
784 * Early versions of the 74K do not update the cache tags on a 809 * Early versions of the 74K do not update the cache tags on a
785 * vtag miss/ptag hit which can occur in the case of KSEG0/KUSEG 810 * vtag miss/ptag hit which can occur in the case of KSEG0/KUSEG
786 * aliases. In this case it is better to treat the cache as always 811 * aliases. In this case it is better to treat the cache as always
787 * having aliases. 812 * having aliases.
788 */ 813 */
789 if ((c->processor_id & 0xff) <= PRID_REV_ENCODE_332(2, 4, 0)) 814 switch (imp) {
790 c->dcache.flags |= MIPS_CACHE_VTAG; 815 case PRID_IMP_74K:
791 if ((c->processor_id & 0xff) == PRID_REV_ENCODE_332(2, 4, 0)) 816 if (rev <= PRID_REV_ENCODE_332(2, 4, 0))
792 write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND); 817 c->dcache.flags |= MIPS_CACHE_VTAG;
793 if (((c->processor_id & 0xff00) == PRID_IMP_1074K) && 818 if (rev == PRID_REV_ENCODE_332(2, 4, 0))
794 ((c->processor_id & 0xff) <= PRID_REV_ENCODE_332(1, 1, 0))) { 819 write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND);
795 c->dcache.flags |= MIPS_CACHE_VTAG; 820 break;
796 write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND); 821 case PRID_IMP_1074K:
822 if (rev <= PRID_REV_ENCODE_332(1, 1, 0)) {
823 c->dcache.flags |= MIPS_CACHE_VTAG;
824 write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND);
825 }
826 break;
827 default:
828 BUG();
797 } 829 }
798} 830}
799 831
@@ -809,7 +841,7 @@ static void probe_pcache(void)
809 unsigned long config1; 841 unsigned long config1;
810 unsigned int lsize; 842 unsigned int lsize;
811 843
812 switch (c->cputype) { 844 switch (current_cpu_type()) {
813 case CPU_R4600: /* QED style two way caches? */ 845 case CPU_R4600: /* QED style two way caches? */
814 case CPU_R4700: 846 case CPU_R4700:
815 case CPU_R5000: 847 case CPU_R5000:
@@ -1025,7 +1057,8 @@ static void probe_pcache(void)
1025 * presumably no vendor is shipping his hardware in the "bad" 1057 * presumably no vendor is shipping his hardware in the "bad"
1026 * configuration. 1058 * configuration.
1027 */ 1059 */
1028 if ((prid & 0xff00) == PRID_IMP_R4000 && (prid & 0xff) < 0x40 && 1060 if ((prid & PRID_IMP_MASK) == PRID_IMP_R4000 &&
1061 (prid & PRID_REV_MASK) < PRID_REV_R4400 &&
1029 !(config & CONF_SC) && c->icache.linesz != 16 && 1062 !(config & CONF_SC) && c->icache.linesz != 16 &&
1030 PAGE_SIZE <= 0x8000) 1063 PAGE_SIZE <= 0x8000)
1031 panic("Improper R4000SC processor configuration detected"); 1064 panic("Improper R4000SC processor configuration detected");
@@ -1045,7 +1078,7 @@ static void probe_pcache(void)
1045 * normally they'd suffer from aliases but magic in the hardware deals 1078 * normally they'd suffer from aliases but magic in the hardware deals
1046 * with that for us so we don't need to take care ourselves. 1079 * with that for us so we don't need to take care ourselves.
1047 */ 1080 */
1048 switch (c->cputype) { 1081 switch (current_cpu_type()) {
1049 case CPU_20KC: 1082 case CPU_20KC:
1050 case CPU_25KF: 1083 case CPU_25KF:
1051 case CPU_SB1: 1084 case CPU_SB1:
@@ -1065,7 +1098,7 @@ static void probe_pcache(void)
1065 case CPU_34K: 1098 case CPU_34K:
1066 case CPU_74K: 1099 case CPU_74K:
1067 case CPU_1004K: 1100 case CPU_1004K:
1068 if (c->cputype == CPU_74K) 1101 if (current_cpu_type() == CPU_74K)
1069 alias_74k_erratum(c); 1102 alias_74k_erratum(c);
1070 if ((read_c0_config7() & (1 << 16))) { 1103 if ((read_c0_config7() & (1 << 16))) {
1071 /* effectively physically indexed dcache, 1104 /* effectively physically indexed dcache,
@@ -1078,7 +1111,7 @@ static void probe_pcache(void)
1078 c->dcache.flags |= MIPS_CACHE_ALIASES; 1111 c->dcache.flags |= MIPS_CACHE_ALIASES;
1079 } 1112 }
1080 1113
1081 switch (c->cputype) { 1114 switch (current_cpu_type()) {
1082 case CPU_20KC: 1115 case CPU_20KC:
1083 /* 1116 /*
1084 * Some older 20Kc chips doesn't have the 'VI' bit in 1117 * Some older 20Kc chips doesn't have the 'VI' bit in
@@ -1090,15 +1123,14 @@ static void probe_pcache(void)
1090 case CPU_ALCHEMY: 1123 case CPU_ALCHEMY:
1091 c->icache.flags |= MIPS_CACHE_IC_F_DC; 1124 c->icache.flags |= MIPS_CACHE_IC_F_DC;
1092 break; 1125 break;
1093 }
1094 1126
1095#ifdef CONFIG_CPU_LOONGSON2 1127 case CPU_LOONGSON2:
1096 /* 1128 /*
1097 * LOONGSON2 has 4 way icache, but when using indexed cache op, 1129 * LOONGSON2 has 4 way icache, but when using indexed cache op,
1098 * one op will act on all 4 ways 1130 * one op will act on all 4 ways
1099 */ 1131 */
1100 c->icache.ways = 1; 1132 c->icache.ways = 1;
1101#endif 1133 }
1102 1134
1103 printk("Primary instruction cache %ldkB, %s, %s, linesize %d bytes.\n", 1135 printk("Primary instruction cache %ldkB, %s, %s, linesize %d bytes.\n",
1104 icache_size >> 10, 1136 icache_size >> 10,
@@ -1174,7 +1206,6 @@ static int probe_scache(void)
1174 return 1; 1206 return 1;
1175} 1207}
1176 1208
1177#if defined(CONFIG_CPU_LOONGSON2)
1178static void __init loongson2_sc_init(void) 1209static void __init loongson2_sc_init(void)
1179{ 1210{
1180 struct cpuinfo_mips *c = &current_cpu_data; 1211 struct cpuinfo_mips *c = &current_cpu_data;
@@ -1190,7 +1221,6 @@ static void __init loongson2_sc_init(void)
1190 1221
1191 c->options |= MIPS_CPU_INCLUSIVE_CACHES; 1222 c->options |= MIPS_CPU_INCLUSIVE_CACHES;
1192} 1223}
1193#endif
1194 1224
1195extern int r5k_sc_init(void); 1225extern int r5k_sc_init(void);
1196extern int rm7k_sc_init(void); 1226extern int rm7k_sc_init(void);
@@ -1207,7 +1237,7 @@ static void setup_scache(void)
1207 * processors don't have a S-cache that would be relevant to the 1237 * processors don't have a S-cache that would be relevant to the
1208 * Linux memory management. 1238 * Linux memory management.
1209 */ 1239 */
1210 switch (c->cputype) { 1240 switch (current_cpu_type()) {
1211 case CPU_R4000SC: 1241 case CPU_R4000SC:
1212 case CPU_R4000MC: 1242 case CPU_R4000MC:
1213 case CPU_R4400SC: 1243 case CPU_R4400SC:
@@ -1240,11 +1270,10 @@ static void setup_scache(void)
1240#endif 1270#endif
1241 return; 1271 return;
1242 1272
1243#if defined(CONFIG_CPU_LOONGSON2)
1244 case CPU_LOONGSON2: 1273 case CPU_LOONGSON2:
1245 loongson2_sc_init(); 1274 loongson2_sc_init();
1246 return; 1275 return;
1247#endif 1276
1248 case CPU_XLP: 1277 case CPU_XLP:
1249 /* don't need to worry about L2, fully coherent */ 1278 /* don't need to worry about L2, fully coherent */
1250 return; 1279 return;
@@ -1384,9 +1413,8 @@ static void r4k_cache_error_setup(void)
1384{ 1413{
1385 extern char __weak except_vec2_generic; 1414 extern char __weak except_vec2_generic;
1386 extern char __weak except_vec2_sb1; 1415 extern char __weak except_vec2_sb1;
1387 struct cpuinfo_mips *c = &current_cpu_data;
1388 1416
1389 switch (c->cputype) { 1417 switch (current_cpu_type()) {
1390 case CPU_SB1: 1418 case CPU_SB1:
1391 case CPU_SB1A: 1419 case CPU_SB1A:
1392 set_uncached_handler(0x100, &except_vec2_sb1, 0x80); 1420 set_uncached_handler(0x100, &except_vec2_sb1, 0x80);
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index 664e523653d0..2e9418562258 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -18,6 +18,7 @@
18#include <linux/highmem.h> 18#include <linux/highmem.h>
19 19
20#include <asm/cache.h> 20#include <asm/cache.h>
21#include <asm/cpu-type.h>
21#include <asm/io.h> 22#include <asm/io.h>
22 23
23#include <dma-coherence.h> 24#include <dma-coherence.h>
@@ -296,7 +297,6 @@ static void mips_dma_sync_single_for_cpu(struct device *dev,
296static void mips_dma_sync_single_for_device(struct device *dev, 297static void mips_dma_sync_single_for_device(struct device *dev,
297 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction) 298 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction)
298{ 299{
299 plat_extra_sync_for_device(dev);
300 if (!plat_device_is_coherent(dev)) 300 if (!plat_device_is_coherent(dev))
301 __dma_sync(dma_addr_to_page(dev, dma_handle), 301 __dma_sync(dma_addr_to_page(dev, dma_handle),
302 dma_handle & ~PAGE_MASK, size, direction); 302 dma_handle & ~PAGE_MASK, size, direction);
@@ -307,12 +307,10 @@ static void mips_dma_sync_sg_for_cpu(struct device *dev,
307{ 307{
308 int i; 308 int i;
309 309
310 /* Make sure that gcc doesn't leave the empty loop body. */ 310 if (cpu_needs_post_dma_flush(dev))
311 for (i = 0; i < nelems; i++, sg++) { 311 for (i = 0; i < nelems; i++, sg++)
312 if (cpu_needs_post_dma_flush(dev))
313 __dma_sync(sg_page(sg), sg->offset, sg->length, 312 __dma_sync(sg_page(sg), sg->offset, sg->length,
314 direction); 313 direction);
315 }
316} 314}
317 315
318static void mips_dma_sync_sg_for_device(struct device *dev, 316static void mips_dma_sync_sg_for_device(struct device *dev,
@@ -320,17 +318,15 @@ static void mips_dma_sync_sg_for_device(struct device *dev,
320{ 318{
321 int i; 319 int i;
322 320
323 /* Make sure that gcc doesn't leave the empty loop body. */ 321 if (!plat_device_is_coherent(dev))
324 for (i = 0; i < nelems; i++, sg++) { 322 for (i = 0; i < nelems; i++, sg++)
325 if (!plat_device_is_coherent(dev))
326 __dma_sync(sg_page(sg), sg->offset, sg->length, 323 __dma_sync(sg_page(sg), sg->offset, sg->length,
327 direction); 324 direction);
328 }
329} 325}
330 326
331int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 327int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
332{ 328{
333 return plat_dma_mapping_error(dev, dma_addr); 329 return 0;
334} 330}
335 331
336int mips_dma_supported(struct device *dev, u64 mask) 332int mips_dma_supported(struct device *dev, u64 mask)
@@ -343,7 +339,6 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
343{ 339{
344 BUG_ON(direction == DMA_NONE); 340 BUG_ON(direction == DMA_NONE);
345 341
346 plat_extra_sync_for_device(dev);
347 if (!plat_device_is_coherent(dev)) 342 if (!plat_device_is_coherent(dev))
348 __dma_sync_virtual(vaddr, size, direction); 343 __dma_sync_virtual(vaddr, size, direction);
349} 344}
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index e205ef598e97..12156176c7ca 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -124,7 +124,7 @@ void *kmap_coherent(struct page *page, unsigned long addr)
124 124
125 BUG_ON(Page_dcache_dirty(page)); 125 BUG_ON(Page_dcache_dirty(page));
126 126
127 inc_preempt_count(); 127 pagefault_disable();
128 idx = (addr >> PAGE_SHIFT) & (FIX_N_COLOURS - 1); 128 idx = (addr >> PAGE_SHIFT) & (FIX_N_COLOURS - 1);
129#ifdef CONFIG_MIPS_MT_SMTC 129#ifdef CONFIG_MIPS_MT_SMTC
130 idx += FIX_N_COLOURS * smp_processor_id() + 130 idx += FIX_N_COLOURS * smp_processor_id() +
@@ -193,8 +193,7 @@ void kunmap_coherent(void)
193 write_c0_entryhi(old_ctx); 193 write_c0_entryhi(old_ctx);
194 EXIT_CRITICAL(flags); 194 EXIT_CRITICAL(flags);
195#endif 195#endif
196 dec_preempt_count(); 196 pagefault_enable();
197 preempt_check_resched();
198} 197}
199 198
200void copy_user_highpage(struct page *to, struct page *from, 199void copy_user_highpage(struct page *to, struct page *from,
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index 218c2109a55d..cbd81d17793a 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -18,6 +18,7 @@
18 18
19#include <asm/bugs.h> 19#include <asm/bugs.h>
20#include <asm/cacheops.h> 20#include <asm/cacheops.h>
21#include <asm/cpu-type.h>
21#include <asm/inst.h> 22#include <asm/inst.h>
22#include <asm/io.h> 23#include <asm/io.h>
23#include <asm/page.h> 24#include <asm/page.h>
diff --git a/arch/mips/mm/sc-mips.c b/arch/mips/mm/sc-mips.c
index 5d01392e3518..08d05aee8788 100644
--- a/arch/mips/mm/sc-mips.c
+++ b/arch/mips/mm/sc-mips.c
@@ -6,6 +6,7 @@
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/mm.h> 7#include <linux/mm.h>
8 8
9#include <asm/cpu-type.h>
9#include <asm/mipsregs.h> 10#include <asm/mipsregs.h>
10#include <asm/bcache.h> 11#include <asm/bcache.h>
11#include <asm/cacheops.h> 12#include <asm/cacheops.h>
@@ -71,7 +72,7 @@ static inline int mips_sc_is_activated(struct cpuinfo_mips *c)
71 unsigned int tmp; 72 unsigned int tmp;
72 73
73 /* Check the bypass bit (L2B) */ 74 /* Check the bypass bit (L2B) */
74 switch (c->cputype) { 75 switch (current_cpu_type()) {
75 case CPU_34K: 76 case CPU_34K:
76 case CPU_74K: 77 case CPU_74K:
77 case CPU_1004K: 78 case CPU_1004K:
diff --git a/arch/mips/mm/tlb-funcs.S b/arch/mips/mm/tlb-funcs.S
index 79bca3130bd1..30a494db99c2 100644
--- a/arch/mips/mm/tlb-funcs.S
+++ b/arch/mips/mm/tlb-funcs.S
@@ -16,12 +16,10 @@
16 16
17#define FASTPATH_SIZE 128 17#define FASTPATH_SIZE 128
18 18
19#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
20LEAF(tlbmiss_handler_setup_pgd) 19LEAF(tlbmiss_handler_setup_pgd)
21 .space 16 * 4 20 .space 16 * 4
22END(tlbmiss_handler_setup_pgd) 21END(tlbmiss_handler_setup_pgd)
23EXPORT(tlbmiss_handler_setup_pgd_end) 22EXPORT(tlbmiss_handler_setup_pgd_end)
24#endif
25 23
26LEAF(handle_tlbm) 24LEAF(handle_tlbm)
27 .space FASTPATH_SIZE * 4 25 .space FASTPATH_SIZE * 4
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index 00b26a67a06d..da3b0b9c9eae 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -16,6 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17 17
18#include <asm/cpu.h> 18#include <asm/cpu.h>
19#include <asm/cpu-type.h>
19#include <asm/bootinfo.h> 20#include <asm/bootinfo.h>
20#include <asm/mmu_context.h> 21#include <asm/mmu_context.h>
21#include <asm/pgtable.h> 22#include <asm/pgtable.h>
@@ -51,21 +52,26 @@ extern void build_tlb_refill_handler(void);
51 52
52#endif /* CONFIG_MIPS_MT_SMTC */ 53#endif /* CONFIG_MIPS_MT_SMTC */
53 54
54#if defined(CONFIG_CPU_LOONGSON2)
55/* 55/*
56 * LOONGSON2 has a 4 entry itlb which is a subset of dtlb, 56 * LOONGSON2 has a 4 entry itlb which is a subset of dtlb,
57 * unfortrunately, itlb is not totally transparent to software. 57 * unfortrunately, itlb is not totally transparent to software.
58 */ 58 */
59#define FLUSH_ITLB write_c0_diag(4); 59static inline void flush_itlb(void)
60 60{
61#define FLUSH_ITLB_VM(vma) { if ((vma)->vm_flags & VM_EXEC) write_c0_diag(4); } 61 switch (current_cpu_type()) {
62 62 case CPU_LOONGSON2:
63#else 63 write_c0_diag(4);
64 64 break;
65#define FLUSH_ITLB 65 default:
66#define FLUSH_ITLB_VM(vma) 66 break;
67 }
68}
67 69
68#endif 70static inline void flush_itlb_vm(struct vm_area_struct *vma)
71{
72 if (vma->vm_flags & VM_EXEC)
73 flush_itlb();
74}
69 75
70void local_flush_tlb_all(void) 76void local_flush_tlb_all(void)
71{ 77{
@@ -92,7 +98,7 @@ void local_flush_tlb_all(void)
92 } 98 }
93 tlbw_use_hazard(); 99 tlbw_use_hazard();
94 write_c0_entryhi(old_ctx); 100 write_c0_entryhi(old_ctx);
95 FLUSH_ITLB; 101 flush_itlb();
96 EXIT_CRITICAL(flags); 102 EXIT_CRITICAL(flags);
97} 103}
98EXPORT_SYMBOL(local_flush_tlb_all); 104EXPORT_SYMBOL(local_flush_tlb_all);
@@ -154,7 +160,7 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
154 } else { 160 } else {
155 drop_mmu_context(mm, cpu); 161 drop_mmu_context(mm, cpu);
156 } 162 }
157 FLUSH_ITLB; 163 flush_itlb();
158 EXIT_CRITICAL(flags); 164 EXIT_CRITICAL(flags);
159 } 165 }
160} 166}
@@ -196,7 +202,7 @@ void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
196 } else { 202 } else {
197 local_flush_tlb_all(); 203 local_flush_tlb_all();
198 } 204 }
199 FLUSH_ITLB; 205 flush_itlb();
200 EXIT_CRITICAL(flags); 206 EXIT_CRITICAL(flags);
201} 207}
202 208
@@ -229,7 +235,7 @@ void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
229 235
230 finish: 236 finish:
231 write_c0_entryhi(oldpid); 237 write_c0_entryhi(oldpid);
232 FLUSH_ITLB_VM(vma); 238 flush_itlb_vm(vma);
233 EXIT_CRITICAL(flags); 239 EXIT_CRITICAL(flags);
234 } 240 }
235} 241}
@@ -261,7 +267,7 @@ void local_flush_tlb_one(unsigned long page)
261 tlbw_use_hazard(); 267 tlbw_use_hazard();
262 } 268 }
263 write_c0_entryhi(oldpid); 269 write_c0_entryhi(oldpid);
264 FLUSH_ITLB; 270 flush_itlb();
265 EXIT_CRITICAL(flags); 271 EXIT_CRITICAL(flags);
266} 272}
267 273
@@ -334,7 +340,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
334 tlb_write_indexed(); 340 tlb_write_indexed();
335 } 341 }
336 tlbw_use_hazard(); 342 tlbw_use_hazard();
337 FLUSH_ITLB_VM(vma); 343 flush_itlb_vm(vma);
338 EXIT_CRITICAL(flags); 344 EXIT_CRITICAL(flags);
339} 345}
340 346
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 821b45175dc1..183f2b583e4d 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -30,6 +30,7 @@
30#include <linux/cache.h> 30#include <linux/cache.h>
31 31
32#include <asm/cacheflush.h> 32#include <asm/cacheflush.h>
33#include <asm/cpu-type.h>
33#include <asm/pgtable.h> 34#include <asm/pgtable.h>
34#include <asm/war.h> 35#include <asm/war.h>
35#include <asm/uasm.h> 36#include <asm/uasm.h>
@@ -339,10 +340,6 @@ static struct work_registers build_get_work_registers(u32 **p)
339{ 340{
340 struct work_registers r; 341 struct work_registers r;
341 342
342 int smp_processor_id_reg;
343 int smp_processor_id_sel;
344 int smp_processor_id_shift;
345
346 if (scratch_reg >= 0) { 343 if (scratch_reg >= 0) {
347 /* Save in CPU local C0_KScratch? */ 344 /* Save in CPU local C0_KScratch? */
348 UASM_i_MTC0(p, 1, c0_kscratch(), scratch_reg); 345 UASM_i_MTC0(p, 1, c0_kscratch(), scratch_reg);
@@ -353,25 +350,9 @@ static struct work_registers build_get_work_registers(u32 **p)
353 } 350 }
354 351
355 if (num_possible_cpus() > 1) { 352 if (num_possible_cpus() > 1) {
356#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
357 smp_processor_id_shift = 51;
358 smp_processor_id_reg = 20; /* XContext */
359 smp_processor_id_sel = 0;
360#else
361# ifdef CONFIG_32BIT
362 smp_processor_id_shift = 25;
363 smp_processor_id_reg = 4; /* Context */
364 smp_processor_id_sel = 0;
365# endif
366# ifdef CONFIG_64BIT
367 smp_processor_id_shift = 26;
368 smp_processor_id_reg = 4; /* Context */
369 smp_processor_id_sel = 0;
370# endif
371#endif
372 /* Get smp_processor_id */ 353 /* Get smp_processor_id */
373 UASM_i_MFC0(p, K0, smp_processor_id_reg, smp_processor_id_sel); 354 UASM_i_CPUID_MFC0(p, K0, SMP_CPUID_REG);
374 UASM_i_SRL_SAFE(p, K0, K0, smp_processor_id_shift); 355 UASM_i_SRL_SAFE(p, K0, K0, SMP_CPUID_REGSHIFT);
375 356
376 /* handler_reg_save index in K0 */ 357 /* handler_reg_save index in K0 */
377 UASM_i_SLL(p, K0, K0, ilog2(sizeof(struct tlb_reg_save))); 358 UASM_i_SLL(p, K0, K0, ilog2(sizeof(struct tlb_reg_save)));
@@ -818,11 +799,11 @@ build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
818 } 799 }
819 /* No uasm_i_nop needed here, since the next insn doesn't touch TMP. */ 800 /* No uasm_i_nop needed here, since the next insn doesn't touch TMP. */
820 801
821#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
822 if (pgd_reg != -1) { 802 if (pgd_reg != -1) {
823 /* pgd is in pgd_reg */ 803 /* pgd is in pgd_reg */
824 UASM_i_MFC0(p, ptr, c0_kscratch(), pgd_reg); 804 UASM_i_MFC0(p, ptr, c0_kscratch(), pgd_reg);
825 } else { 805 } else {
806#if defined(CONFIG_MIPS_PGD_C0_CONTEXT)
826 /* 807 /*
827 * &pgd << 11 stored in CONTEXT [23..63]. 808 * &pgd << 11 stored in CONTEXT [23..63].
828 */ 809 */
@@ -834,30 +815,18 @@ build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
834 /* 1 0 1 0 1 << 6 xkphys cached */ 815 /* 1 0 1 0 1 << 6 xkphys cached */
835 uasm_i_ori(p, ptr, ptr, 0x540); 816 uasm_i_ori(p, ptr, ptr, 0x540);
836 uasm_i_drotr(p, ptr, ptr, 11); 817 uasm_i_drotr(p, ptr, ptr, 11);
837 }
838#elif defined(CONFIG_SMP) 818#elif defined(CONFIG_SMP)
839# ifdef CONFIG_MIPS_MT_SMTC 819 UASM_i_CPUID_MFC0(p, ptr, SMP_CPUID_REG);
840 /* 820 uasm_i_dsrl_safe(p, ptr, ptr, SMP_CPUID_PTRSHIFT);
841 * SMTC uses TCBind value as "CPU" index 821 UASM_i_LA_mostly(p, tmp, pgdc);
842 */ 822 uasm_i_daddu(p, ptr, ptr, tmp);
843 uasm_i_mfc0(p, ptr, C0_TCBIND); 823 uasm_i_dmfc0(p, tmp, C0_BADVADDR);
844 uasm_i_dsrl_safe(p, ptr, ptr, 19); 824 uasm_i_ld(p, ptr, uasm_rel_lo(pgdc), ptr);
845# else
846 /*
847 * 64 bit SMP running in XKPHYS has smp_processor_id() << 3
848 * stored in CONTEXT.
849 */
850 uasm_i_dmfc0(p, ptr, C0_CONTEXT);
851 uasm_i_dsrl_safe(p, ptr, ptr, 23);
852# endif
853 UASM_i_LA_mostly(p, tmp, pgdc);
854 uasm_i_daddu(p, ptr, ptr, tmp);
855 uasm_i_dmfc0(p, tmp, C0_BADVADDR);
856 uasm_i_ld(p, ptr, uasm_rel_lo(pgdc), ptr);
857#else 825#else
858 UASM_i_LA_mostly(p, ptr, pgdc); 826 UASM_i_LA_mostly(p, ptr, pgdc);
859 uasm_i_ld(p, ptr, uasm_rel_lo(pgdc), ptr); 827 uasm_i_ld(p, ptr, uasm_rel_lo(pgdc), ptr);
860#endif 828#endif
829 }
861 830
862 uasm_l_vmalloc_done(l, *p); 831 uasm_l_vmalloc_done(l, *p);
863 832
@@ -952,31 +921,25 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
952static void __maybe_unused 921static void __maybe_unused
953build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr) 922build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr)
954{ 923{
955 long pgdc = (long)pgd_current; 924 if (pgd_reg != -1) {
925 /* pgd is in pgd_reg */
926 uasm_i_mfc0(p, ptr, c0_kscratch(), pgd_reg);
927 uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */
928 } else {
929 long pgdc = (long)pgd_current;
956 930
957 /* 32 bit SMP has smp_processor_id() stored in CONTEXT. */ 931 /* 32 bit SMP has smp_processor_id() stored in CONTEXT. */
958#ifdef CONFIG_SMP 932#ifdef CONFIG_SMP
959#ifdef CONFIG_MIPS_MT_SMTC 933 uasm_i_mfc0(p, ptr, SMP_CPUID_REG);
960 /* 934 UASM_i_LA_mostly(p, tmp, pgdc);
961 * SMTC uses TCBind value as "CPU" index 935 uasm_i_srl(p, ptr, ptr, SMP_CPUID_PTRSHIFT);
962 */ 936 uasm_i_addu(p, ptr, tmp, ptr);
963 uasm_i_mfc0(p, ptr, C0_TCBIND);
964 UASM_i_LA_mostly(p, tmp, pgdc);
965 uasm_i_srl(p, ptr, ptr, 19);
966#else
967 /*
968 * smp_processor_id() << 2 is stored in CONTEXT.
969 */
970 uasm_i_mfc0(p, ptr, C0_CONTEXT);
971 UASM_i_LA_mostly(p, tmp, pgdc);
972 uasm_i_srl(p, ptr, ptr, 23);
973#endif
974 uasm_i_addu(p, ptr, tmp, ptr);
975#else 937#else
976 UASM_i_LA_mostly(p, ptr, pgdc); 938 UASM_i_LA_mostly(p, ptr, pgdc);
977#endif 939#endif
978 uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */ 940 uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */
979 uasm_i_lw(p, ptr, uasm_rel_lo(pgdc), ptr); 941 uasm_i_lw(p, ptr, uasm_rel_lo(pgdc), ptr);
942 }
980 uasm_i_srl(p, tmp, tmp, PGDIR_SHIFT); /* get pgd only bits */ 943 uasm_i_srl(p, tmp, tmp, PGDIR_SHIFT); /* get pgd only bits */
981 uasm_i_sll(p, tmp, tmp, PGD_T_LOG2); 944 uasm_i_sll(p, tmp, tmp, PGD_T_LOG2);
982 uasm_i_addu(p, ptr, ptr, tmp); /* add in pgd offset */ 945 uasm_i_addu(p, ptr, ptr, tmp); /* add in pgd offset */
@@ -1348,95 +1311,100 @@ static void build_r4000_tlb_refill_handler(void)
1348 * need three, with the second nop'ed and the third being 1311 * need three, with the second nop'ed and the third being
1349 * unused. 1312 * unused.
1350 */ 1313 */
1351 /* Loongson2 ebase is different than r4k, we have more space */ 1314 switch (boot_cpu_type()) {
1352#if defined(CONFIG_32BIT) || defined(CONFIG_CPU_LOONGSON2) 1315 default:
1353 if ((p - tlb_handler) > 64) 1316 if (sizeof(long) == 4) {
1354 panic("TLB refill handler space exceeded"); 1317 case CPU_LOONGSON2:
1355#else 1318 /* Loongson2 ebase is different than r4k, we have more space */
1356 if (((p - tlb_handler) > (MIPS64_REFILL_INSNS * 2) - 1) 1319 if ((p - tlb_handler) > 64)
1357 || (((p - tlb_handler) > (MIPS64_REFILL_INSNS * 2) - 3) 1320 panic("TLB refill handler space exceeded");
1358 && uasm_insn_has_bdelay(relocs,
1359 tlb_handler + MIPS64_REFILL_INSNS - 3)))
1360 panic("TLB refill handler space exceeded");
1361#endif
1362
1363 /*
1364 * Now fold the handler in the TLB refill handler space.
1365 */
1366#if defined(CONFIG_32BIT) || defined(CONFIG_CPU_LOONGSON2)
1367 f = final_handler;
1368 /* Simplest case, just copy the handler. */
1369 uasm_copy_handler(relocs, labels, tlb_handler, p, f);
1370 final_len = p - tlb_handler;
1371#else /* CONFIG_64BIT */
1372 f = final_handler + MIPS64_REFILL_INSNS;
1373 if ((p - tlb_handler) <= MIPS64_REFILL_INSNS) {
1374 /* Just copy the handler. */
1375 uasm_copy_handler(relocs, labels, tlb_handler, p, f);
1376 final_len = p - tlb_handler;
1377 } else {
1378#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
1379 const enum label_id ls = label_tlb_huge_update;
1380#else
1381 const enum label_id ls = label_vmalloc;
1382#endif
1383 u32 *split;
1384 int ov = 0;
1385 int i;
1386
1387 for (i = 0; i < ARRAY_SIZE(labels) && labels[i].lab != ls; i++)
1388 ;
1389 BUG_ON(i == ARRAY_SIZE(labels));
1390 split = labels[i].addr;
1391
1392 /*
1393 * See if we have overflown one way or the other.
1394 */
1395 if (split > tlb_handler + MIPS64_REFILL_INSNS ||
1396 split < p - MIPS64_REFILL_INSNS)
1397 ov = 1;
1398
1399 if (ov) {
1400 /* 1321 /*
1401 * Split two instructions before the end. One 1322 * Now fold the handler in the TLB refill handler space.
1402 * for the branch and one for the instruction
1403 * in the delay slot.
1404 */ 1323 */
1405 split = tlb_handler + MIPS64_REFILL_INSNS - 2; 1324 f = final_handler;
1406 1325 /* Simplest case, just copy the handler. */
1326 uasm_copy_handler(relocs, labels, tlb_handler, p, f);
1327 final_len = p - tlb_handler;
1328 break;
1329 } else {
1330 if (((p - tlb_handler) > (MIPS64_REFILL_INSNS * 2) - 1)
1331 || (((p - tlb_handler) > (MIPS64_REFILL_INSNS * 2) - 3)
1332 && uasm_insn_has_bdelay(relocs,
1333 tlb_handler + MIPS64_REFILL_INSNS - 3)))
1334 panic("TLB refill handler space exceeded");
1407 /* 1335 /*
1408 * If the branch would fall in a delay slot, 1336 * Now fold the handler in the TLB refill handler space.
1409 * we must back up an additional instruction
1410 * so that it is no longer in a delay slot.
1411 */ 1337 */
1412 if (uasm_insn_has_bdelay(relocs, split - 1)) 1338 f = final_handler + MIPS64_REFILL_INSNS;
1413 split--; 1339 if ((p - tlb_handler) <= MIPS64_REFILL_INSNS) {
1414 } 1340 /* Just copy the handler. */
1415 /* Copy first part of the handler. */ 1341 uasm_copy_handler(relocs, labels, tlb_handler, p, f);
1416 uasm_copy_handler(relocs, labels, tlb_handler, split, f); 1342 final_len = p - tlb_handler;
1417 f += split - tlb_handler; 1343 } else {
1418 1344#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
1419 if (ov) { 1345 const enum label_id ls = label_tlb_huge_update;
1420 /* Insert branch. */ 1346#else
1421 uasm_l_split(&l, final_handler); 1347 const enum label_id ls = label_vmalloc;
1422 uasm_il_b(&f, &r, label_split); 1348#endif
1423 if (uasm_insn_has_bdelay(relocs, split)) 1349 u32 *split;
1424 uasm_i_nop(&f); 1350 int ov = 0;
1425 else { 1351 int i;
1426 uasm_copy_handler(relocs, labels, 1352
1427 split, split + 1, f); 1353 for (i = 0; i < ARRAY_SIZE(labels) && labels[i].lab != ls; i++)
1428 uasm_move_labels(labels, f, f + 1, -1); 1354 ;
1429 f++; 1355 BUG_ON(i == ARRAY_SIZE(labels));
1430 split++; 1356 split = labels[i].addr;
1357
1358 /*
1359 * See if we have overflown one way or the other.
1360 */
1361 if (split > tlb_handler + MIPS64_REFILL_INSNS ||
1362 split < p - MIPS64_REFILL_INSNS)
1363 ov = 1;
1364
1365 if (ov) {
1366 /*
1367 * Split two instructions before the end. One
1368 * for the branch and one for the instruction
1369 * in the delay slot.
1370 */
1371 split = tlb_handler + MIPS64_REFILL_INSNS - 2;
1372
1373 /*
1374 * If the branch would fall in a delay slot,
1375 * we must back up an additional instruction
1376 * so that it is no longer in a delay slot.
1377 */
1378 if (uasm_insn_has_bdelay(relocs, split - 1))
1379 split--;
1380 }
1381 /* Copy first part of the handler. */
1382 uasm_copy_handler(relocs, labels, tlb_handler, split, f);
1383 f += split - tlb_handler;
1384
1385 if (ov) {
1386 /* Insert branch. */
1387 uasm_l_split(&l, final_handler);
1388 uasm_il_b(&f, &r, label_split);
1389 if (uasm_insn_has_bdelay(relocs, split))
1390 uasm_i_nop(&f);
1391 else {
1392 uasm_copy_handler(relocs, labels,
1393 split, split + 1, f);
1394 uasm_move_labels(labels, f, f + 1, -1);
1395 f++;
1396 split++;
1397 }
1398 }
1399
1400 /* Copy the rest of the handler. */
1401 uasm_copy_handler(relocs, labels, split, p, final_handler);
1402 final_len = (f - (final_handler + MIPS64_REFILL_INSNS)) +
1403 (p - split);
1431 } 1404 }
1432 } 1405 }
1433 1406 break;
1434 /* Copy the rest of the handler. */
1435 uasm_copy_handler(relocs, labels, split, p, final_handler);
1436 final_len = (f - (final_handler + MIPS64_REFILL_INSNS)) +
1437 (p - split);
1438 } 1407 }
1439#endif /* CONFIG_64BIT */
1440 1408
1441 uasm_resolve_relocs(relocs, labels); 1409 uasm_resolve_relocs(relocs, labels);
1442 pr_debug("Wrote TLB refill handler (%u instructions).\n", 1410 pr_debug("Wrote TLB refill handler (%u instructions).\n",
@@ -1450,28 +1418,30 @@ static void build_r4000_tlb_refill_handler(void)
1450extern u32 handle_tlbl[], handle_tlbl_end[]; 1418extern u32 handle_tlbl[], handle_tlbl_end[];
1451extern u32 handle_tlbs[], handle_tlbs_end[]; 1419extern u32 handle_tlbs[], handle_tlbs_end[];
1452extern u32 handle_tlbm[], handle_tlbm_end[]; 1420extern u32 handle_tlbm[], handle_tlbm_end[];
1453
1454#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
1455extern u32 tlbmiss_handler_setup_pgd[], tlbmiss_handler_setup_pgd_end[]; 1421extern u32 tlbmiss_handler_setup_pgd[], tlbmiss_handler_setup_pgd_end[];
1456 1422
1457static void build_r4000_setup_pgd(void) 1423static void build_setup_pgd(void)
1458{ 1424{
1459 const int a0 = 4; 1425 const int a0 = 4;
1460 const int a1 = 5; 1426 const int __maybe_unused a1 = 5;
1427 const int __maybe_unused a2 = 6;
1461 u32 *p = tlbmiss_handler_setup_pgd; 1428 u32 *p = tlbmiss_handler_setup_pgd;
1462 const int tlbmiss_handler_setup_pgd_size = 1429 const int tlbmiss_handler_setup_pgd_size =
1463 tlbmiss_handler_setup_pgd_end - tlbmiss_handler_setup_pgd; 1430 tlbmiss_handler_setup_pgd_end - tlbmiss_handler_setup_pgd;
1464 struct uasm_label *l = labels; 1431#ifndef CONFIG_MIPS_PGD_C0_CONTEXT
1465 struct uasm_reloc *r = relocs; 1432 long pgdc = (long)pgd_current;
1433#endif
1466 1434
1467 memset(tlbmiss_handler_setup_pgd, 0, tlbmiss_handler_setup_pgd_size * 1435 memset(tlbmiss_handler_setup_pgd, 0, tlbmiss_handler_setup_pgd_size *
1468 sizeof(tlbmiss_handler_setup_pgd[0])); 1436 sizeof(tlbmiss_handler_setup_pgd[0]));
1469 memset(labels, 0, sizeof(labels)); 1437 memset(labels, 0, sizeof(labels));
1470 memset(relocs, 0, sizeof(relocs)); 1438 memset(relocs, 0, sizeof(relocs));
1471
1472 pgd_reg = allocate_kscratch(); 1439 pgd_reg = allocate_kscratch();
1473 1440#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
1474 if (pgd_reg == -1) { 1441 if (pgd_reg == -1) {
1442 struct uasm_label *l = labels;
1443 struct uasm_reloc *r = relocs;
1444
1475 /* PGD << 11 in c0_Context */ 1445 /* PGD << 11 in c0_Context */
1476 /* 1446 /*
1477 * If it is a ckseg0 address, convert to a physical 1447 * If it is a ckseg0 address, convert to a physical
@@ -1493,6 +1463,26 @@ static void build_r4000_setup_pgd(void)
1493 uasm_i_jr(&p, 31); 1463 uasm_i_jr(&p, 31);
1494 UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg); 1464 UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg);
1495 } 1465 }
1466#else
1467#ifdef CONFIG_SMP
1468 /* Save PGD to pgd_current[smp_processor_id()] */
1469 UASM_i_CPUID_MFC0(&p, a1, SMP_CPUID_REG);
1470 UASM_i_SRL_SAFE(&p, a1, a1, SMP_CPUID_PTRSHIFT);
1471 UASM_i_LA_mostly(&p, a2, pgdc);
1472 UASM_i_ADDU(&p, a2, a2, a1);
1473 UASM_i_SW(&p, a0, uasm_rel_lo(pgdc), a2);
1474#else
1475 UASM_i_LA_mostly(&p, a2, pgdc);
1476 UASM_i_SW(&p, a0, uasm_rel_lo(pgdc), a2);
1477#endif /* SMP */
1478 uasm_i_jr(&p, 31);
1479
1480 /* if pgd_reg is allocated, save PGD also to scratch register */
1481 if (pgd_reg != -1)
1482 UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg);
1483 else
1484 uasm_i_nop(&p);
1485#endif
1496 if (p >= tlbmiss_handler_setup_pgd_end) 1486 if (p >= tlbmiss_handler_setup_pgd_end)
1497 panic("tlbmiss_handler_setup_pgd space exceeded"); 1487 panic("tlbmiss_handler_setup_pgd space exceeded");
1498 1488
@@ -1503,7 +1493,6 @@ static void build_r4000_setup_pgd(void)
1503 dump_handler("tlbmiss_handler", tlbmiss_handler_setup_pgd, 1493 dump_handler("tlbmiss_handler", tlbmiss_handler_setup_pgd,
1504 tlbmiss_handler_setup_pgd_size); 1494 tlbmiss_handler_setup_pgd_size);
1505} 1495}
1506#endif
1507 1496
1508static void 1497static void
1509iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr) 1498iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr)
@@ -2196,10 +2185,8 @@ static void flush_tlb_handlers(void)
2196 (unsigned long)handle_tlbs_end); 2185 (unsigned long)handle_tlbs_end);
2197 local_flush_icache_range((unsigned long)handle_tlbm, 2186 local_flush_icache_range((unsigned long)handle_tlbm,
2198 (unsigned long)handle_tlbm_end); 2187 (unsigned long)handle_tlbm_end);
2199#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
2200 local_flush_icache_range((unsigned long)tlbmiss_handler_setup_pgd, 2188 local_flush_icache_range((unsigned long)tlbmiss_handler_setup_pgd,
2201 (unsigned long)tlbmiss_handler_setup_pgd_end); 2189 (unsigned long)tlbmiss_handler_setup_pgd_end);
2202#endif
2203} 2190}
2204 2191
2205void build_tlb_refill_handler(void) 2192void build_tlb_refill_handler(void)
@@ -2231,6 +2218,7 @@ void build_tlb_refill_handler(void)
2231 if (!run_once) { 2218 if (!run_once) {
2232 if (!cpu_has_local_ebase) 2219 if (!cpu_has_local_ebase)
2233 build_r3000_tlb_refill_handler(); 2220 build_r3000_tlb_refill_handler();
2221 build_setup_pgd();
2234 build_r3000_tlb_load_handler(); 2222 build_r3000_tlb_load_handler();
2235 build_r3000_tlb_store_handler(); 2223 build_r3000_tlb_store_handler();
2236 build_r3000_tlb_modify_handler(); 2224 build_r3000_tlb_modify_handler();
@@ -2254,9 +2242,7 @@ void build_tlb_refill_handler(void)
2254 default: 2242 default:
2255 if (!run_once) { 2243 if (!run_once) {
2256 scratch_reg = allocate_kscratch(); 2244 scratch_reg = allocate_kscratch();
2257#ifdef CONFIG_MIPS_PGD_C0_CONTEXT 2245 build_setup_pgd();
2258 build_r4000_setup_pgd();
2259#endif
2260 build_r4000_tlb_load_handler(); 2246 build_r4000_tlb_load_handler();
2261 build_r4000_tlb_store_handler(); 2247 build_r4000_tlb_store_handler();
2262 build_r4000_tlb_modify_handler(); 2248 build_r4000_tlb_modify_handler();
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index c69da3734699..0892575f829d 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -37,7 +37,6 @@
37#include <asm/irq_regs.h> 37#include <asm/irq_regs.h>
38#include <asm/mips-boards/malta.h> 38#include <asm/mips-boards/malta.h>
39#include <asm/mips-boards/maltaint.h> 39#include <asm/mips-boards/maltaint.h>
40#include <asm/mips-boards/piix4.h>
41#include <asm/gt64120.h> 40#include <asm/gt64120.h>
42#include <asm/mips-boards/generic.h> 41#include <asm/mips-boards/generic.h>
43#include <asm/mips-boards/msc01_pci.h> 42#include <asm/mips-boards/msc01_pci.h>
@@ -473,7 +472,7 @@ static void __init fill_ipi_map(void)
473{ 472{
474 int cpu; 473 int cpu;
475 474
476 for (cpu = 0; cpu < NR_CPUS; cpu++) { 475 for (cpu = 0; cpu < nr_cpu_ids; cpu++) {
477 fill_ipi_map1(gic_resched_int_base, cpu, GIC_CPU_INT1); 476 fill_ipi_map1(gic_resched_int_base, cpu, GIC_CPU_INT1);
478 fill_ipi_map1(gic_call_int_base, cpu, GIC_CPU_INT2); 477 fill_ipi_map1(gic_call_int_base, cpu, GIC_CPU_INT2);
479 } 478 }
@@ -574,8 +573,9 @@ void __init arch_init_irq(void)
574 /* FIXME */ 573 /* FIXME */
575 int i; 574 int i;
576#if defined(CONFIG_MIPS_MT_SMP) 575#if defined(CONFIG_MIPS_MT_SMP)
577 gic_call_int_base = GIC_NUM_INTRS - NR_CPUS; 576 gic_call_int_base = GIC_NUM_INTRS -
578 gic_resched_int_base = gic_call_int_base - NR_CPUS; 577 (NR_CPUS - nr_cpu_ids) * 2 - nr_cpu_ids;
578 gic_resched_int_base = gic_call_int_base - nr_cpu_ids;
579 fill_ipi_map(); 579 fill_ipi_map();
580#endif 580#endif
581 gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map, 581 gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map,
@@ -599,7 +599,7 @@ void __init arch_init_irq(void)
599 printk("CPU%d: status register now %08x\n", smp_processor_id(), read_c0_status()); 599 printk("CPU%d: status register now %08x\n", smp_processor_id(), read_c0_status());
600 write_c0_status(0x1100dc00); 600 write_c0_status(0x1100dc00);
601 printk("CPU%d: status register frc %08x\n", smp_processor_id(), read_c0_status()); 601 printk("CPU%d: status register frc %08x\n", smp_processor_id(), read_c0_status());
602 for (i = 0; i < NR_CPUS; i++) { 602 for (i = 0; i < nr_cpu_ids; i++) {
603 arch_init_ipiirq(MIPS_GIC_IRQ_BASE + 603 arch_init_ipiirq(MIPS_GIC_IRQ_BASE +
604 GIC_RESCHED_INT(i), &irq_resched); 604 GIC_RESCHED_INT(i), &irq_resched);
605 arch_init_ipiirq(MIPS_GIC_IRQ_BASE + 605 arch_init_ipiirq(MIPS_GIC_IRQ_BASE +
diff --git a/arch/mips/mti-malta/malta-time.c b/arch/mips/mti-malta/malta-time.c
index 53aad4a35375..a18af5fce67e 100644
--- a/arch/mips/mti-malta/malta-time.c
+++ b/arch/mips/mti-malta/malta-time.c
@@ -27,6 +27,7 @@
27#include <linux/timex.h> 27#include <linux/timex.h>
28#include <linux/mc146818rtc.h> 28#include <linux/mc146818rtc.h>
29 29
30#include <asm/cpu.h>
30#include <asm/mipsregs.h> 31#include <asm/mipsregs.h>
31#include <asm/mipsmtregs.h> 32#include <asm/mipsmtregs.h>
32#include <asm/hardirq.h> 33#include <asm/hardirq.h>
@@ -76,7 +77,7 @@ static void __init estimate_frequencies(void)
76#endif 77#endif
77 78
78#if defined (CONFIG_KVM_GUEST) && defined (CONFIG_KVM_HOST_FREQ) 79#if defined (CONFIG_KVM_GUEST) && defined (CONFIG_KVM_HOST_FREQ)
79 unsigned int prid = read_c0_prid() & 0xffff00; 80 unsigned int prid = read_c0_prid() & (PRID_COMP_MASK | PRID_IMP_MASK);
80 81
81 /* 82 /*
82 * XXXKYMA: hardwire the CPU frequency to Host Freq/4 83 * XXXKYMA: hardwire the CPU frequency to Host Freq/4
@@ -169,7 +170,7 @@ unsigned int get_c0_compare_int(void)
169 170
170void __init plat_time_init(void) 171void __init plat_time_init(void)
171{ 172{
172 unsigned int prid = read_c0_prid() & 0xffff00; 173 unsigned int prid = read_c0_prid() & (PRID_COMP_MASK | PRID_IMP_MASK);
173 unsigned int freq; 174 unsigned int freq;
174 175
175 estimate_frequencies(); 176 estimate_frequencies();
diff --git a/arch/mips/mti-sead3/sead3-setup.c b/arch/mips/mti-sead3/sead3-setup.c
index b5059dc899f4..928ba84c8a78 100644
--- a/arch/mips/mti-sead3/sead3-setup.c
+++ b/arch/mips/mti-sead3/sead3-setup.c
@@ -10,6 +10,8 @@
10#include <linux/of_fdt.h> 10#include <linux/of_fdt.h>
11#include <linux/bootmem.h> 11#include <linux/bootmem.h>
12 12
13#include <asm/prom.h>
14
13#include <asm/mips-boards/generic.h> 15#include <asm/mips-boards/generic.h>
14 16
15const char *get_system_type(void) 17const char *get_system_type(void)
diff --git a/arch/mips/mti-sead3/sead3-time.c b/arch/mips/mti-sead3/sead3-time.c
index a43ea3cc0a3b..552d26c34386 100644
--- a/arch/mips/mti-sead3/sead3-time.c
+++ b/arch/mips/mti-sead3/sead3-time.c
@@ -7,6 +7,7 @@
7 */ 7 */
8#include <linux/init.h> 8#include <linux/init.h>
9 9
10#include <asm/cpu.h>
10#include <asm/setup.h> 11#include <asm/setup.h>
11#include <asm/time.h> 12#include <asm/time.h>
12#include <asm/irq.h> 13#include <asm/irq.h>
@@ -34,7 +35,7 @@ static void __iomem *status_reg = (void __iomem *)0xbf000410;
34 */ 35 */
35static unsigned int __init estimate_cpu_frequency(void) 36static unsigned int __init estimate_cpu_frequency(void)
36{ 37{
37 unsigned int prid = read_c0_prid() & 0xffff00; 38 unsigned int prid = read_c0_prid() & (PRID_COMP_MASK | PRID_IMP_MASK);
38 unsigned int tick = 0; 39 unsigned int tick = 0;
39 unsigned int freq; 40 unsigned int freq;
40 unsigned int orig; 41 unsigned int orig;
diff --git a/arch/mips/netlogic/common/smp.c b/arch/mips/netlogic/common/smp.c
index 6f8feb9efcff..c0eded01fde9 100644
--- a/arch/mips/netlogic/common/smp.c
+++ b/arch/mips/netlogic/common/smp.c
@@ -245,7 +245,7 @@ static int nlm_parse_cpumask(cpumask_t *wakeup_mask)
245 return threadmode; 245 return threadmode;
246 246
247unsupp: 247unsupp:
248 panic("Unsupported CPU mask %lx\n", 248 panic("Unsupported CPU mask %lx",
249 (unsigned long)cpumask_bits(wakeup_mask)[0]); 249 (unsigned long)cpumask_bits(wakeup_mask)[0]);
250 return 0; 250 return 0;
251} 251}
diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
index 88df445dda76..8316d5454b17 100644
--- a/arch/mips/netlogic/xlp/dt.c
+++ b/arch/mips/netlogic/xlp/dt.c
@@ -39,8 +39,11 @@
39#include <linux/of_platform.h> 39#include <linux/of_platform.h>
40#include <linux/of_device.h> 40#include <linux/of_device.h>
41 41
42#include <asm/prom.h>
43
42extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[], 44extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[],
43 __dtb_xlp_fvp_begin[], __dtb_start[]; 45 __dtb_xlp_fvp_begin[], __dtb_start[];
46static void *xlp_fdt_blob;
44 47
45void __init *xlp_dt_init(void *fdtp) 48void __init *xlp_dt_init(void *fdtp)
46{ 49{
@@ -67,19 +70,26 @@ void __init *xlp_dt_init(void *fdtp)
67 break; 70 break;
68 } 71 }
69 } 72 }
70 initial_boot_params = fdtp; 73 xlp_fdt_blob = fdtp;
71 return fdtp; 74 return fdtp;
72} 75}
73 76
77void __init xlp_early_init_devtree(void)
78{
79 __dt_setup_arch(xlp_fdt_blob);
80 strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
81}
82
74void __init device_tree_init(void) 83void __init device_tree_init(void)
75{ 84{
76 unsigned long base, size; 85 unsigned long base, size;
86 struct boot_param_header *fdtp = xlp_fdt_blob;
77 87
78 if (!initial_boot_params) 88 if (!fdtp)
79 return; 89 return;
80 90
81 base = virt_to_phys((void *)initial_boot_params); 91 base = virt_to_phys(fdtp);
82 size = be32_to_cpu(initial_boot_params->totalsize); 92 size = be32_to_cpu(fdtp->totalsize);
83 93
84 /* Before we do anything, lets reserve the dt blob */ 94 /* Before we do anything, lets reserve the dt blob */
85 reserve_bootmem(base, size, BOOTMEM_DEFAULT); 95 reserve_bootmem(base, size, BOOTMEM_DEFAULT);
diff --git a/arch/mips/netlogic/xlp/setup.c b/arch/mips/netlogic/xlp/setup.c
index 76a7131e486e..6d981bb337ec 100644
--- a/arch/mips/netlogic/xlp/setup.c
+++ b/arch/mips/netlogic/xlp/setup.c
@@ -98,7 +98,7 @@ void __init plat_mem_setup(void)
98 pm_power_off = nlm_linux_exit; 98 pm_power_off = nlm_linux_exit;
99 99
100 /* memory and bootargs from DT */ 100 /* memory and bootargs from DT */
101 early_init_devtree(initial_boot_params); 101 xlp_early_init_devtree();
102 102
103 if (boot_mem_map.nr_map == 0) { 103 if (boot_mem_map.nr_map == 0) {
104 pr_info("Using DRAM BARs for memory map.\n"); 104 pr_info("Using DRAM BARs for memory map.\n");
diff --git a/arch/mips/netlogic/xlr/fmn-config.c b/arch/mips/netlogic/xlr/fmn-config.c
index ed3bf0e3f309..c7622c6e5f67 100644
--- a/arch/mips/netlogic/xlr/fmn-config.c
+++ b/arch/mips/netlogic/xlr/fmn-config.c
@@ -36,6 +36,7 @@
36#include <linux/irq.h> 36#include <linux/irq.h>
37#include <linux/interrupt.h> 37#include <linux/interrupt.h>
38 38
39#include <asm/cpu.h>
39#include <asm/mipsregs.h> 40#include <asm/mipsregs.h>
40#include <asm/netlogic/xlr/fmn.h> 41#include <asm/netlogic/xlr/fmn.h>
41#include <asm/netlogic/xlr/xlr.h> 42#include <asm/netlogic/xlr/xlr.h>
@@ -187,7 +188,7 @@ void xlr_board_info_setup(void)
187 int processor_id, num_core; 188 int processor_id, num_core;
188 189
189 num_core = hweight32(nlm_current_node()->coremask); 190 num_core = hweight32(nlm_current_node()->coremask);
190 processor_id = read_c0_prid() & 0xff00; 191 processor_id = read_c0_prid() & PRID_IMP_MASK;
191 192
192 setup_cpu_fmninfo(cpu, num_core); 193 setup_cpu_fmninfo(cpu, num_core);
193 switch (processor_id) { 194 switch (processor_id) {
diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c
index 5e5424753b56..4d1736fc1955 100644
--- a/arch/mips/oprofile/common.c
+++ b/arch/mips/oprofile/common.c
@@ -12,6 +12,7 @@
12#include <linux/oprofile.h> 12#include <linux/oprofile.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <asm/cpu-info.h> 14#include <asm/cpu-info.h>
15#include <asm/cpu-type.h>
15 16
16#include "op_impl.h" 17#include "op_impl.h"
17 18
diff --git a/arch/mips/pci/fixup-lantiq.c b/arch/mips/pci/fixup-lantiq.c
index 6c829df28dc7..c2ce41ea61d7 100644
--- a/arch/mips/pci/fixup-lantiq.c
+++ b/arch/mips/pci/fixup-lantiq.c
@@ -25,16 +25,5 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
25 25
26int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 26int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
27{ 27{
28 struct of_irq dev_irq; 28 return of_irq_parse_and_map_pci(dev, slot, pin);
29 int irq;
30
31 if (of_irq_map_pci(dev, &dev_irq)) {
32 dev_err(&dev->dev, "trying to map irq for unknown slot:%d pin:%d\n",
33 slot, pin);
34 return 0;
35 }
36 irq = irq_create_of_mapping(dev_irq.controller, dev_irq.specifier,
37 dev_irq.size);
38 dev_info(&dev->dev, "SLOT:%d PIN:%d IRQ:%d\n", slot, pin, irq);
39 return irq;
40} 29}
diff --git a/arch/mips/pci/fixup-malta.c b/arch/mips/pci/fixup-malta.c
index 07ada7f8441e..df36e2327c54 100644
--- a/arch/mips/pci/fixup-malta.c
+++ b/arch/mips/pci/fixup-malta.c
@@ -1,5 +1,6 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <linux/pci.h> 2#include <linux/pci.h>
3#include <asm/mips-boards/piix4.h>
3 4
4/* PCI interrupt pins */ 5/* PCI interrupt pins */
5#define PCIA 1 6#define PCIA 1
@@ -53,7 +54,8 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
53static void malta_piix_func0_fixup(struct pci_dev *pdev) 54static void malta_piix_func0_fixup(struct pci_dev *pdev)
54{ 55{
55 unsigned char reg_val; 56 unsigned char reg_val;
56 static int piixirqmap[16] = { /* PIIX PIRQC[A:D] irq mappings */ 57 /* PIIX PIRQC[A:D] irq mappings */
58 static int piixirqmap[PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_MAX] = {
57 0, 0, 0, 3, 59 0, 0, 0, 3,
58 4, 5, 6, 7, 60 4, 5, 6, 7,
59 0, 9, 10, 11, 61 0, 9, 10, 11,
@@ -63,11 +65,12 @@ static void malta_piix_func0_fixup(struct pci_dev *pdev)
63 65
64 /* Interrogate PIIX4 to get PCI IRQ mapping */ 66 /* Interrogate PIIX4 to get PCI IRQ mapping */
65 for (i = 0; i <= 3; i++) { 67 for (i = 0; i <= 3; i++) {
66 pci_read_config_byte(pdev, 0x60+i, &reg_val); 68 pci_read_config_byte(pdev, PIIX4_FUNC0_PIRQRC+i, &reg_val);
67 if (reg_val & 0x80) 69 if (reg_val & PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_DISABLE)
68 pci_irq[PCIA+i] = 0; /* Disabled */ 70 pci_irq[PCIA+i] = 0; /* Disabled */
69 else 71 else
70 pci_irq[PCIA+i] = piixirqmap[reg_val & 15]; 72 pci_irq[PCIA+i] = piixirqmap[reg_val &
73 PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_MASK];
71 } 74 }
72 75
73 /* Done by YAMON 2.00 onwards */ 76 /* Done by YAMON 2.00 onwards */
@@ -76,8 +79,9 @@ static void malta_piix_func0_fixup(struct pci_dev *pdev)
76 * Set top of main memory accessible by ISA or DMA 79 * Set top of main memory accessible by ISA or DMA
77 * devices to 16 Mb. 80 * devices to 16 Mb.
78 */ 81 */
79 pci_read_config_byte(pdev, 0x69, &reg_val); 82 pci_read_config_byte(pdev, PIIX4_FUNC0_TOM, &reg_val);
80 pci_write_config_byte(pdev, 0x69, reg_val | 0xf0); 83 pci_write_config_byte(pdev, PIIX4_FUNC0_TOM, reg_val |
84 PIIX4_FUNC0_TOM_TOP_OF_MEMORY_MASK);
81 } 85 }
82} 86}
83 87
@@ -93,10 +97,14 @@ static void malta_piix_func1_fixup(struct pci_dev *pdev)
93 /* 97 /*
94 * IDE Decode enable. 98 * IDE Decode enable.
95 */ 99 */
96 pci_read_config_byte(pdev, 0x41, &reg_val); 100 pci_read_config_byte(pdev, PIIX4_FUNC1_IDETIM_PRIMARY_HI,
97 pci_write_config_byte(pdev, 0x41, reg_val|0x80); 101 &reg_val);
98 pci_read_config_byte(pdev, 0x43, &reg_val); 102 pci_write_config_byte(pdev, PIIX4_FUNC1_IDETIM_PRIMARY_HI,
99 pci_write_config_byte(pdev, 0x43, reg_val|0x80); 103 reg_val|PIIX4_FUNC1_IDETIM_PRIMARY_HI_IDE_DECODE_EN);
104 pci_read_config_byte(pdev, PIIX4_FUNC1_IDETIM_SECONDARY_HI,
105 &reg_val);
106 pci_write_config_byte(pdev, PIIX4_FUNC1_IDETIM_SECONDARY_HI,
107 reg_val|PIIX4_FUNC1_IDETIM_SECONDARY_HI_IDE_DECODE_EN);
100 } 108 }
101} 109}
102 110
@@ -108,10 +116,12 @@ static void quirk_dlcsetup(struct pci_dev *dev)
108{ 116{
109 u8 odlc, ndlc; 117 u8 odlc, ndlc;
110 118
111 (void) pci_read_config_byte(dev, 0x82, &odlc); 119 (void) pci_read_config_byte(dev, PIIX4_FUNC0_DLC, &odlc);
112 /* Enable passive releases and delayed transaction */ 120 /* Enable passive releases and delayed transaction */
113 ndlc = odlc | 7; 121 ndlc = odlc | PIIX4_FUNC0_DLC_USBPR_EN |
114 (void) pci_write_config_byte(dev, 0x82, ndlc); 122 PIIX4_FUNC0_DLC_PASSIVE_RELEASE_EN |
123 PIIX4_FUNC0_DLC_DELAYED_TRANSACTION_EN;
124 (void) pci_write_config_byte(dev, PIIX4_FUNC0_DLC, ndlc);
115} 125}
116 126
117DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0, 127DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0,
diff --git a/arch/mips/pci/pci-ar71xx.c b/arch/mips/pci/pci-ar71xx.c
index 18517dd0f709..d471a26dd5f8 100644
--- a/arch/mips/pci/pci-ar71xx.c
+++ b/arch/mips/pci/pci-ar71xx.c
@@ -363,9 +363,6 @@ static int ar71xx_pci_probe(struct platform_device *pdev)
363 spin_lock_init(&apc->lock); 363 spin_lock_init(&apc->lock);
364 364
365 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base"); 365 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base");
366 if (!res)
367 return -EINVAL;
368
369 apc->cfg_base = devm_ioremap_resource(&pdev->dev, res); 366 apc->cfg_base = devm_ioremap_resource(&pdev->dev, res);
370 if (IS_ERR(apc->cfg_base)) 367 if (IS_ERR(apc->cfg_base))
371 return PTR_ERR(apc->cfg_base); 368 return PTR_ERR(apc->cfg_base);
diff --git a/arch/mips/pci/pci-ar724x.c b/arch/mips/pci/pci-ar724x.c
index 65ec032fa0b4..785b2659b519 100644
--- a/arch/mips/pci/pci-ar724x.c
+++ b/arch/mips/pci/pci-ar724x.c
@@ -362,25 +362,16 @@ static int ar724x_pci_probe(struct platform_device *pdev)
362 return -ENOMEM; 362 return -ENOMEM;
363 363
364 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl_base"); 364 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl_base");
365 if (!res)
366 return -EINVAL;
367
368 apc->ctrl_base = devm_ioremap_resource(&pdev->dev, res); 365 apc->ctrl_base = devm_ioremap_resource(&pdev->dev, res);
369 if (IS_ERR(apc->ctrl_base)) 366 if (IS_ERR(apc->ctrl_base))
370 return PTR_ERR(apc->ctrl_base); 367 return PTR_ERR(apc->ctrl_base);
371 368
372 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base"); 369 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base");
373 if (!res)
374 return -EINVAL;
375
376 apc->devcfg_base = devm_ioremap_resource(&pdev->dev, res); 370 apc->devcfg_base = devm_ioremap_resource(&pdev->dev, res);
377 if (IS_ERR(apc->devcfg_base)) 371 if (IS_ERR(apc->devcfg_base))
378 return PTR_ERR(apc->devcfg_base); 372 return PTR_ERR(apc->devcfg_base);
379 373
380 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "crp_base"); 374 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "crp_base");
381 if (!res)
382 return -EINVAL;
383
384 apc->crp_base = devm_ioremap_resource(&pdev->dev, res); 375 apc->crp_base = devm_ioremap_resource(&pdev->dev, res);
385 if (IS_ERR(apc->crp_base)) 376 if (IS_ERR(apc->crp_base))
386 return PTR_ERR(apc->crp_base); 377 return PTR_ERR(apc->crp_base);
diff --git a/arch/mips/pci/pci-bcm1480.c b/arch/mips/pci/pci-bcm1480.c
index 44dd5aa2e36f..5ec2a7bae02c 100644
--- a/arch/mips/pci/pci-bcm1480.c
+++ b/arch/mips/pci/pci-bcm1480.c
@@ -39,6 +39,7 @@
39#include <linux/mm.h> 39#include <linux/mm.h>
40#include <linux/console.h> 40#include <linux/console.h>
41#include <linux/tty.h> 41#include <linux/tty.h>
42#include <linux/vt.h>
42 43
43#include <asm/sibyte/bcm1480_regs.h> 44#include <asm/sibyte/bcm1480_regs.h>
44#include <asm/sibyte/bcm1480_scd.h> 45#include <asm/sibyte/bcm1480_scd.h>
diff --git a/arch/mips/pci/pci-rt3883.c b/arch/mips/pci/pci-rt3883.c
index 95c9d41382e7..adeff2bfe4cd 100644
--- a/arch/mips/pci/pci-rt3883.c
+++ b/arch/mips/pci/pci-rt3883.c
@@ -583,29 +583,7 @@ err_put_intc_node:
583 583
584int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 584int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
585{ 585{
586 struct of_irq dev_irq; 586 return of_irq_parse_and_map_pci(dev, slot, pin);
587 int err;
588 int irq;
589
590 err = of_irq_map_pci(dev, &dev_irq);
591 if (err) {
592 pr_err("pci %s: unable to get irq map, err=%d\n",
593 pci_name((struct pci_dev *) dev), err);
594 return 0;
595 }
596
597 irq = irq_create_of_mapping(dev_irq.controller,
598 dev_irq.specifier,
599 dev_irq.size);
600
601 if (irq == 0)
602 pr_crit("pci %s: no irq found for pin %u\n",
603 pci_name((struct pci_dev *) dev), pin);
604 else
605 pr_info("pci %s: using irq %d for pin %u\n",
606 pci_name((struct pci_dev *) dev), irq, pin);
607
608 return irq;
609} 587}
610 588
611int pcibios_plat_dev_init(struct pci_dev *dev) 589int pcibios_plat_dev_init(struct pci_dev *dev)
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 33e7aa52d9c4..1bf60b127377 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -120,51 +120,37 @@ static void pcibios_scanbus(struct pci_controller *hose)
120#ifdef CONFIG_OF 120#ifdef CONFIG_OF
121void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node) 121void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node)
122{ 122{
123 const __be32 *ranges; 123 struct of_pci_range range;
124 int rlen; 124 struct of_pci_range_parser parser;
125 int pna = of_n_addr_cells(node);
126 int np = pna + 5;
127 125
128 pr_info("PCI host bridge %s ranges:\n", node->full_name); 126 pr_info("PCI host bridge %s ranges:\n", node->full_name);
129 ranges = of_get_property(node, "ranges", &rlen);
130 if (ranges == NULL)
131 return;
132 hose->of_node = node; 127 hose->of_node = node;
133 128
134 while ((rlen -= np * 4) >= 0) { 129 if (of_pci_range_parser_init(&parser, node))
135 u32 pci_space; 130 return;
131
132 for_each_of_pci_range(&parser, &range) {
136 struct resource *res = NULL; 133 struct resource *res = NULL;
137 u64 addr, size; 134
138 135 switch (range.flags & IORESOURCE_TYPE_BITS) {
139 pci_space = be32_to_cpup(&ranges[0]); 136 case IORESOURCE_IO:
140 addr = of_translate_address(node, ranges + 3);
141 size = of_read_number(ranges + pna + 3, 2);
142 ranges += np;
143 switch ((pci_space >> 24) & 0x3) {
144 case 1: /* PCI IO space */
145 pr_info(" IO 0x%016llx..0x%016llx\n", 137 pr_info(" IO 0x%016llx..0x%016llx\n",
146 addr, addr + size - 1); 138 range.cpu_addr,
139 range.cpu_addr + range.size - 1);
147 hose->io_map_base = 140 hose->io_map_base =
148 (unsigned long)ioremap(addr, size); 141 (unsigned long)ioremap(range.cpu_addr,
142 range.size);
149 res = hose->io_resource; 143 res = hose->io_resource;
150 res->flags = IORESOURCE_IO;
151 break; 144 break;
152 case 2: /* PCI Memory space */ 145 case IORESOURCE_MEM:
153 case 3: /* PCI 64 bits Memory space */
154 pr_info(" MEM 0x%016llx..0x%016llx\n", 146 pr_info(" MEM 0x%016llx..0x%016llx\n",
155 addr, addr + size - 1); 147 range.cpu_addr,
148 range.cpu_addr + range.size - 1);
156 res = hose->mem_resource; 149 res = hose->mem_resource;
157 res->flags = IORESOURCE_MEM;
158 break; 150 break;
159 } 151 }
160 if (res != NULL) { 152 if (res != NULL)
161 res->start = addr; 153 of_pci_range_to_resource(&range, node, res);
162 res->name = node->full_name;
163 res->end = res->start + size - 1;
164 res->parent = NULL;
165 res->sibling = NULL;
166 res->child = NULL;
167 }
168 } 154 }
169} 155}
170 156
diff --git a/arch/mips/powertv/Kconfig b/arch/mips/powertv/Kconfig
deleted file mode 100644
index dd91fbacbcba..000000000000
--- a/arch/mips/powertv/Kconfig
+++ /dev/null
@@ -1,12 +0,0 @@
1config BOOTLOADER_FAMILY
2 string "POWERTV Bootloader Family string"
3 default "85"
4 depends on POWERTV
5 help
6 This value should be specified when the bootloader driver is disabled
7 and must be exactly two characters long. Families supported are:
8 R1 - RNG-100 R2 - RNG-200
9 A1 - Class A B1 - Class B
10 E1 - Class E F1 - Class F
11 44 - 45xx 46 - 46xx
12 85 - 85xx 86 - 86xx
diff --git a/arch/mips/powertv/Makefile b/arch/mips/powertv/Makefile
deleted file mode 100644
index 39ca9f8d63ae..000000000000
--- a/arch/mips/powertv/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
1#
2# Carsten Langgaard, carstenl@mips.com
3# Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4#
5# Carsten Langgaard, carstenl@mips.com
6# Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
7# Portions copyright (C) 2009 Cisco Systems, Inc.
8#
9# This program is free software; you can distribute it and/or modify it
10# 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 it will be useful, but WITHOUT
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16# for more details.
17#
18# You should have received a copy of the GNU General Public License along
19# with this program; if not, write to the Free Software Foundation, Inc.,
20# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
21#
22# Makefile for the Cisco PowerTV-specific kernel interface routines
23# under Linux.
24#
25
26obj-y += init.o ioremap.o memory.o powertv_setup.o reset.o time.o \
27 asic/ pci/
28
29obj-$(CONFIG_USB) += powertv-usb.o
diff --git a/arch/mips/powertv/Platform b/arch/mips/powertv/Platform
deleted file mode 100644
index 4eb5af1d8eea..000000000000
--- a/arch/mips/powertv/Platform
+++ /dev/null
@@ -1,7 +0,0 @@
1#
2# Cisco PowerTV Platform
3#
4platform-$(CONFIG_POWERTV) += powertv/
5cflags-$(CONFIG_POWERTV) += \
6 -I$(srctree)/arch/mips/include/asm/mach-powertv
7load-$(CONFIG_POWERTV) += 0xffffffff90800000
diff --git a/arch/mips/powertv/asic/Makefile b/arch/mips/powertv/asic/Makefile
deleted file mode 100644
index 35dcc53eb25f..000000000000
--- a/arch/mips/powertv/asic/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
1#
2# Copyright (C) 2009 Scientific-Atlanta, 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# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
17#
18
19obj-y += asic-calliope.o asic-cronus.o asic-gaia.o asic-zeus.o \
20 asic_devices.o asic_int.o irq_asic.o prealloc-calliope.o \
21 prealloc-cronus.o prealloc-cronuslite.o prealloc-gaia.o prealloc-zeus.o
diff --git a/arch/mips/powertv/asic/asic-calliope.c b/arch/mips/powertv/asic/asic-calliope.c
deleted file mode 100644
index 2f539b43f56b..000000000000
--- a/arch/mips/powertv/asic/asic-calliope.c
+++ /dev/null
@@ -1,101 +0,0 @@
1/*
2 * Locations of devices in the Calliope ASIC.
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: Ken Eppinett
21 * David Schleef <ds@schleef.org>
22 *
23 * Description: Defines the platform resources for the SA settop.
24 */
25
26#include <linux/init.h>
27#include <asm/mach-powertv/asic.h>
28
29#define CALLIOPE_ADDR(x) (CALLIOPE_IO_BASE + (x))
30
31const struct register_map calliope_register_map __initconst = {
32 .eic_slow0_strt_add = {.phys = CALLIOPE_ADDR(0x800000)},
33 .eic_cfg_bits = {.phys = CALLIOPE_ADDR(0x800038)},
34 .eic_ready_status = {.phys = CALLIOPE_ADDR(0x80004c)},
35
36 .chipver3 = {.phys = CALLIOPE_ADDR(0xA00800)},
37 .chipver2 = {.phys = CALLIOPE_ADDR(0xA00804)},
38 .chipver1 = {.phys = CALLIOPE_ADDR(0xA00808)},
39 .chipver0 = {.phys = CALLIOPE_ADDR(0xA0080c)},
40
41 /* The registers of IRBlaster */
42 .uart1_intstat = {.phys = CALLIOPE_ADDR(0xA01800)},
43 .uart1_inten = {.phys = CALLIOPE_ADDR(0xA01804)},
44 .uart1_config1 = {.phys = CALLIOPE_ADDR(0xA01808)},
45 .uart1_config2 = {.phys = CALLIOPE_ADDR(0xA0180C)},
46 .uart1_divisorhi = {.phys = CALLIOPE_ADDR(0xA01810)},
47 .uart1_divisorlo = {.phys = CALLIOPE_ADDR(0xA01814)},
48 .uart1_data = {.phys = CALLIOPE_ADDR(0xA01818)},
49 .uart1_status = {.phys = CALLIOPE_ADDR(0xA0181C)},
50
51 .int_stat_3 = {.phys = CALLIOPE_ADDR(0xA02800)},
52 .int_stat_2 = {.phys = CALLIOPE_ADDR(0xA02804)},
53 .int_stat_1 = {.phys = CALLIOPE_ADDR(0xA02808)},
54 .int_stat_0 = {.phys = CALLIOPE_ADDR(0xA0280c)},
55 .int_config = {.phys = CALLIOPE_ADDR(0xA02810)},
56 .int_int_scan = {.phys = CALLIOPE_ADDR(0xA02818)},
57 .ien_int_3 = {.phys = CALLIOPE_ADDR(0xA02830)},
58 .ien_int_2 = {.phys = CALLIOPE_ADDR(0xA02834)},
59 .ien_int_1 = {.phys = CALLIOPE_ADDR(0xA02838)},
60 .ien_int_0 = {.phys = CALLIOPE_ADDR(0xA0283c)},
61 .int_level_3_3 = {.phys = CALLIOPE_ADDR(0xA02880)},
62 .int_level_3_2 = {.phys = CALLIOPE_ADDR(0xA02884)},
63 .int_level_3_1 = {.phys = CALLIOPE_ADDR(0xA02888)},
64 .int_level_3_0 = {.phys = CALLIOPE_ADDR(0xA0288c)},
65 .int_level_2_3 = {.phys = CALLIOPE_ADDR(0xA02890)},
66 .int_level_2_2 = {.phys = CALLIOPE_ADDR(0xA02894)},
67 .int_level_2_1 = {.phys = CALLIOPE_ADDR(0xA02898)},
68 .int_level_2_0 = {.phys = CALLIOPE_ADDR(0xA0289c)},
69 .int_level_1_3 = {.phys = CALLIOPE_ADDR(0xA028a0)},
70 .int_level_1_2 = {.phys = CALLIOPE_ADDR(0xA028a4)},
71 .int_level_1_1 = {.phys = CALLIOPE_ADDR(0xA028a8)},
72 .int_level_1_0 = {.phys = CALLIOPE_ADDR(0xA028ac)},
73 .int_level_0_3 = {.phys = CALLIOPE_ADDR(0xA028b0)},
74 .int_level_0_2 = {.phys = CALLIOPE_ADDR(0xA028b4)},
75 .int_level_0_1 = {.phys = CALLIOPE_ADDR(0xA028b8)},
76 .int_level_0_0 = {.phys = CALLIOPE_ADDR(0xA028bc)},
77 .int_docsis_en = {.phys = CALLIOPE_ADDR(0xA028F4)},
78
79 .mips_pll_setup = {.phys = CALLIOPE_ADDR(0x980000)},
80 .fs432x4b4_usb_ctl = {.phys = CALLIOPE_ADDR(0x980030)},
81 .test_bus = {.phys = CALLIOPE_ADDR(0x9800CC)},
82 .crt_spare = {.phys = CALLIOPE_ADDR(0x9800d4)},
83 .usb2_ohci_int_mask = {.phys = CALLIOPE_ADDR(0x9A000c)},
84 .usb2_strap = {.phys = CALLIOPE_ADDR(0x9A0014)},
85 .ehci_hcapbase = {.phys = CALLIOPE_ADDR(0x9BFE00)},
86 .ohci_hc_revision = {.phys = CALLIOPE_ADDR(0x9BFC00)},
87 .bcm1_bs_lmi_steer = {.phys = CALLIOPE_ADDR(0x9E0004)},
88 .usb2_control = {.phys = CALLIOPE_ADDR(0x9E0054)},
89 .usb2_stbus_obc = {.phys = CALLIOPE_ADDR(0x9BFF00)},
90 .usb2_stbus_mess_size = {.phys = CALLIOPE_ADDR(0x9BFF04)},
91 .usb2_stbus_chunk_size = {.phys = CALLIOPE_ADDR(0x9BFF08)},
92
93 .pcie_regs = {.phys = 0x000000}, /* -doesn't exist- */
94 .tim_ch = {.phys = CALLIOPE_ADDR(0xA02C10)},
95 .tim_cl = {.phys = CALLIOPE_ADDR(0xA02C14)},
96 .gpio_dout = {.phys = CALLIOPE_ADDR(0xA02c20)},
97 .gpio_din = {.phys = CALLIOPE_ADDR(0xA02c24)},
98 .gpio_dir = {.phys = CALLIOPE_ADDR(0xA02c2C)},
99 .watchdog = {.phys = CALLIOPE_ADDR(0xA02c30)},
100 .front_panel = {.phys = 0x000000}, /* -not used- */
101};
diff --git a/arch/mips/powertv/asic/asic-cronus.c b/arch/mips/powertv/asic/asic-cronus.c
deleted file mode 100644
index 7f8f3429b35a..000000000000
--- a/arch/mips/powertv/asic/asic-cronus.c
+++ /dev/null
@@ -1,101 +0,0 @@
1/*
2 * Locations of devices in the Cronus ASIC
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: Ken Eppinett
21 * David Schleef <ds@schleef.org>
22 *
23 * Description: Defines the platform resources for the SA settop.
24 */
25
26#include <linux/init.h>
27#include <asm/mach-powertv/asic.h>
28
29#define CRONUS_ADDR(x) (CRONUS_IO_BASE + (x))
30
31const struct register_map cronus_register_map __initconst = {
32 .eic_slow0_strt_add = {.phys = CRONUS_ADDR(0x000000)},
33 .eic_cfg_bits = {.phys = CRONUS_ADDR(0x000038)},
34 .eic_ready_status = {.phys = CRONUS_ADDR(0x00004C)},
35
36 .chipver3 = {.phys = CRONUS_ADDR(0x2A0800)},
37 .chipver2 = {.phys = CRONUS_ADDR(0x2A0804)},
38 .chipver1 = {.phys = CRONUS_ADDR(0x2A0808)},
39 .chipver0 = {.phys = CRONUS_ADDR(0x2A080C)},
40
41 /* The registers of IRBlaster */
42 .uart1_intstat = {.phys = CRONUS_ADDR(0x2A1800)},
43 .uart1_inten = {.phys = CRONUS_ADDR(0x2A1804)},
44 .uart1_config1 = {.phys = CRONUS_ADDR(0x2A1808)},
45 .uart1_config2 = {.phys = CRONUS_ADDR(0x2A180C)},
46 .uart1_divisorhi = {.phys = CRONUS_ADDR(0x2A1810)},
47 .uart1_divisorlo = {.phys = CRONUS_ADDR(0x2A1814)},
48 .uart1_data = {.phys = CRONUS_ADDR(0x2A1818)},
49 .uart1_status = {.phys = CRONUS_ADDR(0x2A181C)},
50
51 .int_stat_3 = {.phys = CRONUS_ADDR(0x2A2800)},
52 .int_stat_2 = {.phys = CRONUS_ADDR(0x2A2804)},
53 .int_stat_1 = {.phys = CRONUS_ADDR(0x2A2808)},
54 .int_stat_0 = {.phys = CRONUS_ADDR(0x2A280C)},
55 .int_config = {.phys = CRONUS_ADDR(0x2A2810)},
56 .int_int_scan = {.phys = CRONUS_ADDR(0x2A2818)},
57 .ien_int_3 = {.phys = CRONUS_ADDR(0x2A2830)},
58 .ien_int_2 = {.phys = CRONUS_ADDR(0x2A2834)},
59 .ien_int_1 = {.phys = CRONUS_ADDR(0x2A2838)},
60 .ien_int_0 = {.phys = CRONUS_ADDR(0x2A283C)},
61 .int_level_3_3 = {.phys = CRONUS_ADDR(0x2A2880)},
62 .int_level_3_2 = {.phys = CRONUS_ADDR(0x2A2884)},
63 .int_level_3_1 = {.phys = CRONUS_ADDR(0x2A2888)},
64 .int_level_3_0 = {.phys = CRONUS_ADDR(0x2A288C)},
65 .int_level_2_3 = {.phys = CRONUS_ADDR(0x2A2890)},
66 .int_level_2_2 = {.phys = CRONUS_ADDR(0x2A2894)},
67 .int_level_2_1 = {.phys = CRONUS_ADDR(0x2A2898)},
68 .int_level_2_0 = {.phys = CRONUS_ADDR(0x2A289C)},
69 .int_level_1_3 = {.phys = CRONUS_ADDR(0x2A28A0)},
70 .int_level_1_2 = {.phys = CRONUS_ADDR(0x2A28A4)},
71 .int_level_1_1 = {.phys = CRONUS_ADDR(0x2A28A8)},
72 .int_level_1_0 = {.phys = CRONUS_ADDR(0x2A28AC)},
73 .int_level_0_3 = {.phys = CRONUS_ADDR(0x2A28B0)},
74 .int_level_0_2 = {.phys = CRONUS_ADDR(0x2A28B4)},
75 .int_level_0_1 = {.phys = CRONUS_ADDR(0x2A28B8)},
76 .int_level_0_0 = {.phys = CRONUS_ADDR(0x2A28BC)},
77 .int_docsis_en = {.phys = CRONUS_ADDR(0x2A28F4)},
78
79 .mips_pll_setup = {.phys = CRONUS_ADDR(0x1C0000)},
80 .fs432x4b4_usb_ctl = {.phys = CRONUS_ADDR(0x1C0028)},
81 .test_bus = {.phys = CRONUS_ADDR(0x1C00CC)},
82 .crt_spare = {.phys = CRONUS_ADDR(0x1c00d4)},
83 .usb2_ohci_int_mask = {.phys = CRONUS_ADDR(0x20000C)},
84 .usb2_strap = {.phys = CRONUS_ADDR(0x200014)},
85 .ehci_hcapbase = {.phys = CRONUS_ADDR(0x21FE00)},
86 .ohci_hc_revision = {.phys = CRONUS_ADDR(0x21fc00)},
87 .bcm1_bs_lmi_steer = {.phys = CRONUS_ADDR(0x2E0008)},
88 .usb2_control = {.phys = CRONUS_ADDR(0x2E004C)},
89 .usb2_stbus_obc = {.phys = CRONUS_ADDR(0x21FF00)},
90 .usb2_stbus_mess_size = {.phys = CRONUS_ADDR(0x21FF04)},
91 .usb2_stbus_chunk_size = {.phys = CRONUS_ADDR(0x21FF08)},
92
93 .pcie_regs = {.phys = CRONUS_ADDR(0x220000)},
94 .tim_ch = {.phys = CRONUS_ADDR(0x2A2C10)},
95 .tim_cl = {.phys = CRONUS_ADDR(0x2A2C14)},
96 .gpio_dout = {.phys = CRONUS_ADDR(0x2A2C20)},
97 .gpio_din = {.phys = CRONUS_ADDR(0x2A2C24)},
98 .gpio_dir = {.phys = CRONUS_ADDR(0x2A2C2C)},
99 .watchdog = {.phys = CRONUS_ADDR(0x2A2C30)},
100 .front_panel = {.phys = CRONUS_ADDR(0x2A3800)},
101};
diff --git a/arch/mips/powertv/asic/asic-gaia.c b/arch/mips/powertv/asic/asic-gaia.c
deleted file mode 100644
index 1265b49012e6..000000000000
--- a/arch/mips/powertv/asic/asic-gaia.c
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2 * Locations of devices in the Gaia ASIC
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: David VomLehn
21 */
22
23#include <linux/init.h>
24#include <asm/mach-powertv/asic.h>
25
26const struct register_map gaia_register_map __initconst = {
27 .eic_slow0_strt_add = {.phys = GAIA_IO_BASE + 0x000000},
28 .eic_cfg_bits = {.phys = GAIA_IO_BASE + 0x000038},
29 .eic_ready_status = {.phys = GAIA_IO_BASE + 0x00004C},
30
31 .chipver3 = {.phys = GAIA_IO_BASE + 0x2A0800},
32 .chipver2 = {.phys = GAIA_IO_BASE + 0x2A0804},
33 .chipver1 = {.phys = GAIA_IO_BASE + 0x2A0808},
34 .chipver0 = {.phys = GAIA_IO_BASE + 0x2A080C},
35
36 /* The registers of IRBlaster */
37 .uart1_intstat = {.phys = GAIA_IO_BASE + 0x2A1800},
38 .uart1_inten = {.phys = GAIA_IO_BASE + 0x2A1804},
39 .uart1_config1 = {.phys = GAIA_IO_BASE + 0x2A1808},
40 .uart1_config2 = {.phys = GAIA_IO_BASE + 0x2A180C},
41 .uart1_divisorhi = {.phys = GAIA_IO_BASE + 0x2A1810},
42 .uart1_divisorlo = {.phys = GAIA_IO_BASE + 0x2A1814},
43 .uart1_data = {.phys = GAIA_IO_BASE + 0x2A1818},
44 .uart1_status = {.phys = GAIA_IO_BASE + 0x2A181C},
45
46 .int_stat_3 = {.phys = GAIA_IO_BASE + 0x2A2800},
47 .int_stat_2 = {.phys = GAIA_IO_BASE + 0x2A2804},
48 .int_stat_1 = {.phys = GAIA_IO_BASE + 0x2A2808},
49 .int_stat_0 = {.phys = GAIA_IO_BASE + 0x2A280C},
50 .int_config = {.phys = GAIA_IO_BASE + 0x2A2810},
51 .int_int_scan = {.phys = GAIA_IO_BASE + 0x2A2818},
52 .ien_int_3 = {.phys = GAIA_IO_BASE + 0x2A2830},
53 .ien_int_2 = {.phys = GAIA_IO_BASE + 0x2A2834},
54 .ien_int_1 = {.phys = GAIA_IO_BASE + 0x2A2838},
55 .ien_int_0 = {.phys = GAIA_IO_BASE + 0x2A283C},
56 .int_level_3_3 = {.phys = GAIA_IO_BASE + 0x2A2880},
57 .int_level_3_2 = {.phys = GAIA_IO_BASE + 0x2A2884},
58 .int_level_3_1 = {.phys = GAIA_IO_BASE + 0x2A2888},
59 .int_level_3_0 = {.phys = GAIA_IO_BASE + 0x2A288C},
60 .int_level_2_3 = {.phys = GAIA_IO_BASE + 0x2A2890},
61 .int_level_2_2 = {.phys = GAIA_IO_BASE + 0x2A2894},
62 .int_level_2_1 = {.phys = GAIA_IO_BASE + 0x2A2898},
63 .int_level_2_0 = {.phys = GAIA_IO_BASE + 0x2A289C},
64 .int_level_1_3 = {.phys = GAIA_IO_BASE + 0x2A28A0},
65 .int_level_1_2 = {.phys = GAIA_IO_BASE + 0x2A28A4},
66 .int_level_1_1 = {.phys = GAIA_IO_BASE + 0x2A28A8},
67 .int_level_1_0 = {.phys = GAIA_IO_BASE + 0x2A28AC},
68 .int_level_0_3 = {.phys = GAIA_IO_BASE + 0x2A28B0},
69 .int_level_0_2 = {.phys = GAIA_IO_BASE + 0x2A28B4},
70 .int_level_0_1 = {.phys = GAIA_IO_BASE + 0x2A28B8},
71 .int_level_0_0 = {.phys = GAIA_IO_BASE + 0x2A28BC},
72 .int_docsis_en = {.phys = GAIA_IO_BASE + 0x2A28F4},
73
74 .mips_pll_setup = {.phys = GAIA_IO_BASE + 0x1C0000},
75 .fs432x4b4_usb_ctl = {.phys = GAIA_IO_BASE + 0x1C0024},
76 .test_bus = {.phys = GAIA_IO_BASE + 0x1C00CC},
77 .crt_spare = {.phys = GAIA_IO_BASE + 0x1c0108},
78 .usb2_ohci_int_mask = {.phys = GAIA_IO_BASE + 0x20000C},
79 .usb2_strap = {.phys = GAIA_IO_BASE + 0x200014},
80 .ehci_hcapbase = {.phys = GAIA_IO_BASE + 0x21FE00},
81 .ohci_hc_revision = {.phys = GAIA_IO_BASE + 0x21fc00},
82 .bcm1_bs_lmi_steer = {.phys = GAIA_IO_BASE + 0x2E0004},
83 .usb2_control = {.phys = GAIA_IO_BASE + 0x2E004C},
84 .usb2_stbus_obc = {.phys = GAIA_IO_BASE + 0x21FF00},
85 .usb2_stbus_mess_size = {.phys = GAIA_IO_BASE + 0x21FF04},
86 .usb2_stbus_chunk_size = {.phys = GAIA_IO_BASE + 0x21FF08},
87
88 .pcie_regs = {.phys = GAIA_IO_BASE + 0x220000},
89 .tim_ch = {.phys = GAIA_IO_BASE + 0x2A2C10},
90 .tim_cl = {.phys = GAIA_IO_BASE + 0x2A2C14},
91 .gpio_dout = {.phys = GAIA_IO_BASE + 0x2A2C20},
92 .gpio_din = {.phys = GAIA_IO_BASE + 0x2A2C24},
93 .gpio_dir = {.phys = GAIA_IO_BASE + 0x2A2C2C},
94 .watchdog = {.phys = GAIA_IO_BASE + 0x2A2C30},
95 .front_panel = {.phys = GAIA_IO_BASE + 0x2A3800},
96};
diff --git a/arch/mips/powertv/asic/asic-zeus.c b/arch/mips/powertv/asic/asic-zeus.c
deleted file mode 100644
index 14e7de137e03..000000000000
--- a/arch/mips/powertv/asic/asic-zeus.c
+++ /dev/null
@@ -1,101 +0,0 @@
1/*
2 * Locations of devices in the Zeus ASIC
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: Ken Eppinett
21 * David Schleef <ds@schleef.org>
22 *
23 * Description: Defines the platform resources for the SA settop.
24 */
25
26#include <linux/init.h>
27#include <asm/mach-powertv/asic.h>
28
29#define ZEUS_ADDR(x) (ZEUS_IO_BASE + (x))
30
31const struct register_map zeus_register_map __initconst = {
32 .eic_slow0_strt_add = {.phys = ZEUS_ADDR(0x000000)},
33 .eic_cfg_bits = {.phys = ZEUS_ADDR(0x000038)},
34 .eic_ready_status = {.phys = ZEUS_ADDR(0x00004c)},
35
36 .chipver3 = {.phys = ZEUS_ADDR(0x280800)},
37 .chipver2 = {.phys = ZEUS_ADDR(0x280804)},
38 .chipver1 = {.phys = ZEUS_ADDR(0x280808)},
39 .chipver0 = {.phys = ZEUS_ADDR(0x28080c)},
40
41 /* The registers of IRBlaster */
42 .uart1_intstat = {.phys = ZEUS_ADDR(0x281800)},
43 .uart1_inten = {.phys = ZEUS_ADDR(0x281804)},
44 .uart1_config1 = {.phys = ZEUS_ADDR(0x281808)},
45 .uart1_config2 = {.phys = ZEUS_ADDR(0x28180C)},
46 .uart1_divisorhi = {.phys = ZEUS_ADDR(0x281810)},
47 .uart1_divisorlo = {.phys = ZEUS_ADDR(0x281814)},
48 .uart1_data = {.phys = ZEUS_ADDR(0x281818)},
49 .uart1_status = {.phys = ZEUS_ADDR(0x28181C)},
50
51 .int_stat_3 = {.phys = ZEUS_ADDR(0x282800)},
52 .int_stat_2 = {.phys = ZEUS_ADDR(0x282804)},
53 .int_stat_1 = {.phys = ZEUS_ADDR(0x282808)},
54 .int_stat_0 = {.phys = ZEUS_ADDR(0x28280c)},
55 .int_config = {.phys = ZEUS_ADDR(0x282810)},
56 .int_int_scan = {.phys = ZEUS_ADDR(0x282818)},
57 .ien_int_3 = {.phys = ZEUS_ADDR(0x282830)},
58 .ien_int_2 = {.phys = ZEUS_ADDR(0x282834)},
59 .ien_int_1 = {.phys = ZEUS_ADDR(0x282838)},
60 .ien_int_0 = {.phys = ZEUS_ADDR(0x28283c)},
61 .int_level_3_3 = {.phys = ZEUS_ADDR(0x282880)},
62 .int_level_3_2 = {.phys = ZEUS_ADDR(0x282884)},
63 .int_level_3_1 = {.phys = ZEUS_ADDR(0x282888)},
64 .int_level_3_0 = {.phys = ZEUS_ADDR(0x28288c)},
65 .int_level_2_3 = {.phys = ZEUS_ADDR(0x282890)},
66 .int_level_2_2 = {.phys = ZEUS_ADDR(0x282894)},
67 .int_level_2_1 = {.phys = ZEUS_ADDR(0x282898)},
68 .int_level_2_0 = {.phys = ZEUS_ADDR(0x28289c)},
69 .int_level_1_3 = {.phys = ZEUS_ADDR(0x2828a0)},
70 .int_level_1_2 = {.phys = ZEUS_ADDR(0x2828a4)},
71 .int_level_1_1 = {.phys = ZEUS_ADDR(0x2828a8)},
72 .int_level_1_0 = {.phys = ZEUS_ADDR(0x2828ac)},
73 .int_level_0_3 = {.phys = ZEUS_ADDR(0x2828b0)},
74 .int_level_0_2 = {.phys = ZEUS_ADDR(0x2828b4)},
75 .int_level_0_1 = {.phys = ZEUS_ADDR(0x2828b8)},
76 .int_level_0_0 = {.phys = ZEUS_ADDR(0x2828bc)},
77 .int_docsis_en = {.phys = ZEUS_ADDR(0x2828F4)},
78
79 .mips_pll_setup = {.phys = ZEUS_ADDR(0x1a0000)},
80 .fs432x4b4_usb_ctl = {.phys = ZEUS_ADDR(0x1a0018)},
81 .test_bus = {.phys = ZEUS_ADDR(0x1a0238)},
82 .crt_spare = {.phys = ZEUS_ADDR(0x1a0090)},
83 .usb2_ohci_int_mask = {.phys = ZEUS_ADDR(0x1e000c)},
84 .usb2_strap = {.phys = ZEUS_ADDR(0x1e0014)},
85 .ehci_hcapbase = {.phys = ZEUS_ADDR(0x1FFE00)},
86 .ohci_hc_revision = {.phys = ZEUS_ADDR(0x1FFC00)},
87 .bcm1_bs_lmi_steer = {.phys = ZEUS_ADDR(0x2C0008)},
88 .usb2_control = {.phys = ZEUS_ADDR(0x2c01a0)},
89 .usb2_stbus_obc = {.phys = ZEUS_ADDR(0x1FFF00)},
90 .usb2_stbus_mess_size = {.phys = ZEUS_ADDR(0x1FFF04)},
91 .usb2_stbus_chunk_size = {.phys = ZEUS_ADDR(0x1FFF08)},
92
93 .pcie_regs = {.phys = ZEUS_ADDR(0x200000)},
94 .tim_ch = {.phys = ZEUS_ADDR(0x282C10)},
95 .tim_cl = {.phys = ZEUS_ADDR(0x282C14)},
96 .gpio_dout = {.phys = ZEUS_ADDR(0x282c20)},
97 .gpio_din = {.phys = ZEUS_ADDR(0x282c24)},
98 .gpio_dir = {.phys = ZEUS_ADDR(0x282c2C)},
99 .watchdog = {.phys = ZEUS_ADDR(0x282c30)},
100 .front_panel = {.phys = ZEUS_ADDR(0x283800)},
101};
diff --git a/arch/mips/powertv/asic/asic_devices.c b/arch/mips/powertv/asic/asic_devices.c
deleted file mode 100644
index 8380605d597d..000000000000
--- a/arch/mips/powertv/asic/asic_devices.c
+++ /dev/null
@@ -1,549 +0,0 @@
1/*
2 *
3 * Description: Defines the platform resources for Gaia-based settops.
4 *
5 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 *
21 * NOTE: The bootloader allocates persistent memory at an address which is
22 * 16 MiB below the end of the highest address in KSEG0. All fixed
23 * address memory reservations must avoid this region.
24 */
25
26#include <linux/device.h>
27#include <linux/kernel.h>
28#include <linux/init.h>
29#include <linux/resource.h>
30#include <linux/serial_reg.h>
31#include <linux/io.h>
32#include <linux/bootmem.h>
33#include <linux/mm.h>
34#include <linux/platform_device.h>
35#include <linux/module.h>
36#include <asm/page.h>
37#include <linux/swap.h>
38#include <linux/highmem.h>
39#include <linux/dma-mapping.h>
40
41#include <asm/mach-powertv/asic.h>
42#include <asm/mach-powertv/asic_regs.h>
43#include <asm/mach-powertv/interrupts.h>
44
45#ifdef CONFIG_BOOTLOADER_DRIVER
46#include <asm/mach-powertv/kbldr.h>
47#endif
48#include <asm/bootinfo.h>
49
50#define BOOTLDRFAMILY(byte1, byte0) (((byte1) << 8) | (byte0))
51
52/*
53 * Forward Prototypes
54 */
55static void pmem_setup_resource(void);
56
57/*
58 * Global Variables
59 */
60enum asic_type asic;
61
62unsigned int platform_features;
63unsigned int platform_family;
64struct register_map _asic_register_map;
65EXPORT_SYMBOL(_asic_register_map); /* Exported for testing */
66unsigned long asic_phy_base;
67unsigned long asic_base;
68EXPORT_SYMBOL(asic_base); /* Exported for testing */
69struct resource *gp_resources;
70
71/*
72 * Don't recommend to use it directly, it is usually used by kernel internally.
73 * Portable code should be using interfaces such as ioremp, dma_map_single, etc.
74 */
75unsigned long phys_to_dma_offset;
76EXPORT_SYMBOL(phys_to_dma_offset);
77
78/*
79 *
80 * IO Resource Definition
81 *
82 */
83
84struct resource asic_resource = {
85 .name = "ASIC Resource",
86 .start = 0,
87 .end = ASIC_IO_SIZE,
88 .flags = IORESOURCE_MEM,
89};
90
91/*
92 * Allow override of bootloader-specified model
93 * Returns zero on success, a negative errno value on failure. This parameter
94 * allows overriding of the bootloader-specified model.
95 */
96static char __initdata cmdline[COMMAND_LINE_SIZE];
97
98#define FORCEFAMILY_PARAM "forcefamily"
99
100/*
101 * check_forcefamily - check for, and parse, forcefamily command line parameter
102 * @forced_family: Pointer to two-character array in which to store the
103 * value of the forcedfamily parameter, if any.
104 */
105static __init int check_forcefamily(unsigned char forced_family[2])
106{
107 const char *p;
108
109 forced_family[0] = '\0';
110 forced_family[1] = '\0';
111
112 /* Check the command line for a forcefamily directive */
113 strncpy(cmdline, arcs_cmdline, COMMAND_LINE_SIZE - 1);
114 p = strstr(cmdline, FORCEFAMILY_PARAM);
115 if (p && (p != cmdline) && (*(p - 1) != ' '))
116 p = strstr(p, " " FORCEFAMILY_PARAM "=");
117
118 if (p) {
119 p += strlen(FORCEFAMILY_PARAM "=");
120
121 if (*p == '\0' || *(p + 1) == '\0' ||
122 (*(p + 2) != '\0' && *(p + 2) != ' '))
123 pr_err(FORCEFAMILY_PARAM " must be exactly two "
124 "characters long, ignoring value\n");
125
126 else {
127 forced_family[0] = *p;
128 forced_family[1] = *(p + 1);
129 }
130 }
131
132 return 0;
133}
134
135/*
136 * platform_set_family - determine major platform family type.
137 *
138 * Returns family type; -1 if none
139 * Returns the family type; -1 if none
140 *
141 */
142static __init noinline void platform_set_family(void)
143{
144 unsigned char forced_family[2];
145 unsigned short bootldr_family;
146
147 if (check_forcefamily(forced_family) == 0)
148 bootldr_family = BOOTLDRFAMILY(forced_family[0],
149 forced_family[1]);
150 else
151 bootldr_family = (unsigned short) BOOTLDRFAMILY(
152 CONFIG_BOOTLOADER_FAMILY[0],
153 CONFIG_BOOTLOADER_FAMILY[1]);
154
155 pr_info("Bootloader Family = 0x%04X\n", bootldr_family);
156
157 switch (bootldr_family) {
158 case BOOTLDRFAMILY('R', '1'):
159 platform_family = FAMILY_1500;
160 break;
161 case BOOTLDRFAMILY('4', '4'):
162 platform_family = FAMILY_4500;
163 break;
164 case BOOTLDRFAMILY('4', '6'):
165 platform_family = FAMILY_4600;
166 break;
167 case BOOTLDRFAMILY('A', '1'):
168 platform_family = FAMILY_4600VZA;
169 break;
170 case BOOTLDRFAMILY('8', '5'):
171 platform_family = FAMILY_8500;
172 break;
173 case BOOTLDRFAMILY('R', '2'):
174 platform_family = FAMILY_8500RNG;
175 break;
176 case BOOTLDRFAMILY('8', '6'):
177 platform_family = FAMILY_8600;
178 break;
179 case BOOTLDRFAMILY('B', '1'):
180 platform_family = FAMILY_8600VZB;
181 break;
182 case BOOTLDRFAMILY('E', '1'):
183 platform_family = FAMILY_1500VZE;
184 break;
185 case BOOTLDRFAMILY('F', '1'):
186 platform_family = FAMILY_1500VZF;
187 break;
188 case BOOTLDRFAMILY('8', '7'):
189 platform_family = FAMILY_8700;
190 break;
191 default:
192 platform_family = -1;
193 }
194}
195
196unsigned int platform_get_family(void)
197{
198 return platform_family;
199}
200EXPORT_SYMBOL(platform_get_family);
201
202/*
203 * platform_get_asic - determine the ASIC type.
204 *
205 * Returns the ASIC type, or ASIC_UNKNOWN if unknown
206 *
207 */
208enum asic_type platform_get_asic(void)
209{
210 return asic;
211}
212EXPORT_SYMBOL(platform_get_asic);
213
214/*
215 * set_register_map - set ASIC register configuration
216 * @phys_base: Physical address of the base of the ASIC registers
217 * @map: Description of key ASIC registers
218 */
219static void __init set_register_map(unsigned long phys_base,
220 const struct register_map *map)
221{
222 asic_phy_base = phys_base;
223 _asic_register_map = *map;
224 register_map_virtualize(&_asic_register_map);
225 asic_base = (unsigned long)ioremap_nocache(phys_base, ASIC_IO_SIZE);
226}
227
228/**
229 * configure_platform - configuration based on platform type.
230 */
231void __init configure_platform(void)
232{
233 platform_set_family();
234
235 switch (platform_family) {
236 case FAMILY_1500:
237 case FAMILY_1500VZE:
238 case FAMILY_1500VZF:
239 platform_features = FFS_CAPABLE;
240 asic = ASIC_CALLIOPE;
241 set_register_map(CALLIOPE_IO_BASE, &calliope_register_map);
242
243 if (platform_family == FAMILY_1500VZE) {
244 gp_resources = non_dvr_vze_calliope_resources;
245 pr_info("Platform: 1500/Vz Class E - "
246 "CALLIOPE, NON_DVR_CAPABLE\n");
247 } else if (platform_family == FAMILY_1500VZF) {
248 gp_resources = non_dvr_vzf_calliope_resources;
249 pr_info("Platform: 1500/Vz Class F - "
250 "CALLIOPE, NON_DVR_CAPABLE\n");
251 } else {
252 gp_resources = non_dvr_calliope_resources;
253 pr_info("Platform: 1500/RNG100 - CALLIOPE, "
254 "NON_DVR_CAPABLE\n");
255 }
256 break;
257
258 case FAMILY_4500:
259 platform_features = FFS_CAPABLE | PCIE_CAPABLE |
260 DISPLAY_CAPABLE;
261 asic = ASIC_ZEUS;
262 set_register_map(ZEUS_IO_BASE, &zeus_register_map);
263 gp_resources = non_dvr_zeus_resources;
264
265 pr_info("Platform: 4500 - ZEUS, NON_DVR_CAPABLE\n");
266 break;
267
268 case FAMILY_4600:
269 {
270 unsigned int chipversion = 0;
271
272 /* The settop has PCIE but it isn't used, so don't advertise
273 * it*/
274 platform_features = FFS_CAPABLE | DISPLAY_CAPABLE;
275
276 /* Cronus and Cronus Lite have the same register map */
277 set_register_map(CRONUS_IO_BASE, &cronus_register_map);
278
279 /* ASIC version will determine if this is a real CronusLite or
280 * Castrati(Cronus) */
281 chipversion = asic_read(chipver3) << 24;
282 chipversion |= asic_read(chipver2) << 16;
283 chipversion |= asic_read(chipver1) << 8;
284 chipversion |= asic_read(chipver0);
285
286 if ((chipversion == CRONUS_10) || (chipversion == CRONUS_11))
287 asic = ASIC_CRONUS;
288 else
289 asic = ASIC_CRONUSLITE;
290
291 gp_resources = non_dvr_cronuslite_resources;
292 pr_info("Platform: 4600 - %s, NON_DVR_CAPABLE, "
293 "chipversion=0x%08X\n",
294 (asic == ASIC_CRONUS) ? "CRONUS" : "CRONUS LITE",
295 chipversion);
296 break;
297 }
298 case FAMILY_4600VZA:
299 platform_features = FFS_CAPABLE | DISPLAY_CAPABLE;
300 asic = ASIC_CRONUS;
301 set_register_map(CRONUS_IO_BASE, &cronus_register_map);
302 gp_resources = non_dvr_cronus_resources;
303
304 pr_info("Platform: Vz Class A - CRONUS, NON_DVR_CAPABLE\n");
305 break;
306
307 case FAMILY_8500:
308 case FAMILY_8500RNG:
309 platform_features = DVR_CAPABLE | PCIE_CAPABLE |
310 DISPLAY_CAPABLE;
311 asic = ASIC_ZEUS;
312 set_register_map(ZEUS_IO_BASE, &zeus_register_map);
313 gp_resources = dvr_zeus_resources;
314
315 pr_info("Platform: 8500/RNG200 - ZEUS, DVR_CAPABLE\n");
316 break;
317
318 case FAMILY_8600:
319 case FAMILY_8600VZB:
320 platform_features = DVR_CAPABLE | PCIE_CAPABLE |
321 DISPLAY_CAPABLE;
322 asic = ASIC_CRONUS;
323 set_register_map(CRONUS_IO_BASE, &cronus_register_map);
324 gp_resources = dvr_cronus_resources;
325
326 pr_info("Platform: 8600/Vz Class B - CRONUS, "
327 "DVR_CAPABLE\n");
328 break;
329
330 case FAMILY_8700:
331 platform_features = FFS_CAPABLE | PCIE_CAPABLE;
332 asic = ASIC_GAIA;
333 set_register_map(GAIA_IO_BASE, &gaia_register_map);
334 gp_resources = dvr_gaia_resources;
335
336 pr_info("Platform: 8700 - GAIA, DVR_CAPABLE\n");
337 break;
338
339 default:
340 pr_crit("Platform: UNKNOWN PLATFORM\n");
341 break;
342 }
343
344 switch (asic) {
345 case ASIC_ZEUS:
346 phys_to_dma_offset = 0x30000000;
347 break;
348 case ASIC_CALLIOPE:
349 phys_to_dma_offset = 0x10000000;
350 break;
351 case ASIC_CRONUSLITE:
352 /* Fall through */
353 case ASIC_CRONUS:
354 /*
355 * TODO: We suppose 0x10000000 aliases into 0x20000000-
356 * 0x2XXXXXXX. If 0x10000000 aliases into 0x60000000-
357 * 0x6XXXXXXX, the offset should be 0x50000000, not 0x10000000.
358 */
359 phys_to_dma_offset = 0x10000000;
360 break;
361 default:
362 phys_to_dma_offset = 0x00000000;
363 break;
364 }
365}
366
367/*
368 * RESOURCE ALLOCATION
369 *
370 */
371/*
372 * Allocates/reserves the Platform memory resources early in the boot process.
373 * This ignores any resources that are designated IORESOURCE_IO
374 */
375void __init platform_alloc_bootmem(void)
376{
377 int i;
378 int total = 0;
379
380 /* Get persistent memory data from command line before allocating
381 * resources. This need to happen before normal command line parsing
382 * has been done */
383 pmem_setup_resource();
384
385 /* Loop through looking for resources that want a particular address */
386 for (i = 0; gp_resources[i].flags != 0; i++) {
387 int size = resource_size(&gp_resources[i]);
388 if ((gp_resources[i].start != 0) &&
389 ((gp_resources[i].flags & IORESOURCE_MEM) != 0)) {
390 reserve_bootmem(dma_to_phys(gp_resources[i].start),
391 size, 0);
392 total += resource_size(&gp_resources[i]);
393 pr_info("reserve resource %s at %08x (%u bytes)\n",
394 gp_resources[i].name, gp_resources[i].start,
395 resource_size(&gp_resources[i]));
396 }
397 }
398
399 /* Loop through assigning addresses for those that are left */
400 for (i = 0; gp_resources[i].flags != 0; i++) {
401 int size = resource_size(&gp_resources[i]);
402 if ((gp_resources[i].start == 0) &&
403 ((gp_resources[i].flags & IORESOURCE_MEM) != 0)) {
404 void *mem = alloc_bootmem_pages(size);
405
406 if (mem == NULL)
407 pr_err("Unable to allocate bootmem pages "
408 "for %s\n", gp_resources[i].name);
409
410 else {
411 gp_resources[i].start =
412 phys_to_dma(virt_to_phys(mem));
413 gp_resources[i].end =
414 gp_resources[i].start + size - 1;
415 total += size;
416 pr_info("allocate resource %s at %08x "
417 "(%u bytes)\n",
418 gp_resources[i].name,
419 gp_resources[i].start, size);
420 }
421 }
422 }
423
424 pr_info("Total Platform driver memory allocation: 0x%08x\n", total);
425
426 /* indicate resources that are platform I/O related */
427 for (i = 0; gp_resources[i].flags != 0; i++) {
428 if ((gp_resources[i].start != 0) &&
429 ((gp_resources[i].flags & IORESOURCE_IO) != 0)) {
430 pr_info("reserved platform resource %s at %08x\n",
431 gp_resources[i].name, gp_resources[i].start);
432 }
433 }
434}
435
436/*
437 *
438 * PERSISTENT MEMORY (PMEM) CONFIGURATION
439 *
440 */
441static unsigned long pmemaddr __initdata;
442
443static int __init early_param_pmemaddr(char *p)
444{
445 pmemaddr = (unsigned long)simple_strtoul(p, NULL, 0);
446 return 0;
447}
448early_param("pmemaddr", early_param_pmemaddr);
449
450static long pmemlen __initdata;
451
452static int __init early_param_pmemlen(char *p)
453{
454/* TODO: we can use this code when and if the bootloader ever changes this */
455#if 0
456 pmemlen = (unsigned long)simple_strtoul(p, NULL, 0);
457#else
458 pmemlen = 0x20000;
459#endif
460 return 0;
461}
462early_param("pmemlen", early_param_pmemlen);
463
464/*
465 * Set up persistent memory. If we were given values, we patch the array of
466 * resources. Otherwise, persistent memory may be allocated anywhere at all.
467 */
468static void __init pmem_setup_resource(void)
469{
470 struct resource *resource;
471 resource = asic_resource_get("DiagPersistentMemory");
472
473 if (resource && pmemaddr && pmemlen) {
474 /* The address provided by bootloader is in kseg0. Convert to
475 * a bus address. */
476 resource->start = phys_to_dma(pmemaddr - 0x80000000);
477 resource->end = resource->start + pmemlen - 1;
478
479 pr_info("persistent memory: start=0x%x end=0x%x\n",
480 resource->start, resource->end);
481 }
482}
483
484/*
485 *
486 * RESOURCE ACCESS FUNCTIONS
487 *
488 */
489
490/**
491 * asic_resource_get - retrieves parameters for a platform resource.
492 * @name: string to match resource
493 *
494 * Returns a pointer to a struct resource corresponding to the given name.
495 *
496 * CANNOT BE NAMED platform_resource_get, which would be the obvious choice,
497 * as this function name is already declared
498 */
499struct resource *asic_resource_get(const char *name)
500{
501 int i;
502
503 for (i = 0; gp_resources[i].flags != 0; i++) {
504 if (strcmp(gp_resources[i].name, name) == 0)
505 return &gp_resources[i];
506 }
507
508 return NULL;
509}
510EXPORT_SYMBOL(asic_resource_get);
511
512/**
513 * platform_release_memory - release pre-allocated memory
514 * @ptr: pointer to memory to release
515 * @size: size of resource
516 *
517 * This must only be called for memory allocated or reserved via the boot
518 * memory allocator.
519 */
520void platform_release_memory(void *ptr, int size)
521{
522 free_reserved_area(ptr, ptr + size, -1, NULL);
523}
524EXPORT_SYMBOL(platform_release_memory);
525
526/*
527 *
528 * FEATURE AVAILABILITY FUNCTIONS
529 *
530 */
531int platform_supports_dvr(void)
532{
533 return (platform_features & DVR_CAPABLE) != 0;
534}
535
536int platform_supports_ffs(void)
537{
538 return (platform_features & FFS_CAPABLE) != 0;
539}
540
541int platform_supports_pcie(void)
542{
543 return (platform_features & PCIE_CAPABLE) != 0;
544}
545
546int platform_supports_display(void)
547{
548 return (platform_features & DISPLAY_CAPABLE) != 0;
549}
diff --git a/arch/mips/powertv/asic/asic_int.c b/arch/mips/powertv/asic/asic_int.c
deleted file mode 100644
index f44cd9295cae..000000000000
--- a/arch/mips/powertv/asic/asic_int.c
+++ /dev/null
@@ -1,125 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000, 2001, 2004 MIPS Technologies, Inc.
4 * Copyright (C) 2001 Ralf Baechle
5 * Portions copyright (C) 2009 Cisco Systems, Inc.
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * 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 it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * Routines for generic manipulation of the interrupts found on the PowerTV
21 * platform.
22 *
23 * The interrupt controller is located in the South Bridge a PIIX4 device
24 * with two internal 82C95 interrupt controllers.
25 */
26#include <linux/init.h>
27#include <linux/irq.h>
28#include <linux/sched.h>
29#include <linux/interrupt.h>
30#include <linux/kernel_stat.h>
31#include <linux/kernel.h>
32#include <linux/random.h>
33
34#include <asm/irq_cpu.h>
35#include <linux/io.h>
36#include <asm/irq_regs.h>
37#include <asm/setup.h>
38#include <asm/mips-boards/generic.h>
39
40#include <asm/mach-powertv/asic_regs.h>
41
42static DEFINE_RAW_SPINLOCK(asic_irq_lock);
43
44static inline int get_int(void)
45{
46 unsigned long flags;
47 int irq;
48
49 raw_spin_lock_irqsave(&asic_irq_lock, flags);
50
51 irq = (asic_read(int_int_scan) >> 4) - 1;
52
53 if (irq == 0 || irq >= NR_IRQS)
54 irq = -1;
55
56 raw_spin_unlock_irqrestore(&asic_irq_lock, flags);
57
58 return irq;
59}
60
61static void asic_irqdispatch(void)
62{
63 int irq;
64
65 irq = get_int();
66 if (irq < 0)
67 return; /* interrupt has already been cleared */
68
69 do_IRQ(irq);
70}
71
72static inline int clz(unsigned long x)
73{
74 __asm__(
75 " .set push \n"
76 " .set mips32 \n"
77 " clz %0, %1 \n"
78 " .set pop \n"
79 : "=r" (x)
80 : "r" (x));
81
82 return x;
83}
84
85/*
86 * Version of ffs that only looks at bits 12..15.
87 */
88static inline unsigned int irq_ffs(unsigned int pending)
89{
90 return fls(pending) - 1 + CAUSEB_IP;
91}
92
93/*
94 * TODO: check how it works under EIC mode.
95 */
96asmlinkage void plat_irq_dispatch(void)
97{
98 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
99 int irq;
100
101 irq = irq_ffs(pending);
102
103 if (irq == CAUSEF_IP3)
104 asic_irqdispatch();
105 else if (irq >= 0)
106 do_IRQ(irq);
107 else
108 spurious_interrupt();
109}
110
111void __init arch_init_irq(void)
112{
113 int i;
114
115 asic_irq_init();
116
117 /*
118 * Initialize interrupt exception vectors.
119 */
120 if (cpu_has_veic || cpu_has_vint) {
121 int nvec = cpu_has_veic ? 64 : 8;
122 for (i = 0; i < nvec; i++)
123 set_vi_handler(i, asic_irqdispatch);
124 }
125}
diff --git a/arch/mips/powertv/asic/irq_asic.c b/arch/mips/powertv/asic/irq_asic.c
deleted file mode 100644
index 9344902dc586..000000000000
--- a/arch/mips/powertv/asic/irq_asic.c
+++ /dev/null
@@ -1,115 +0,0 @@
1/*
2 * Portions copyright (C) 2005-2009 Scientific Atlanta
3 * Portions copyright (C) 2009 Cisco Systems, Inc.
4 *
5 * Modified from arch/mips/kernel/irq-rm7000.c:
6 * Copyright (C) 2003 Ralf Baechle
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13#include <linux/init.h>
14#include <linux/interrupt.h>
15#include <linux/kernel.h>
16#include <linux/irq.h>
17
18#include <asm/irq_cpu.h>
19#include <asm/mipsregs.h>
20
21#include <asm/mach-powertv/asic_regs.h>
22
23static inline void unmask_asic_irq(struct irq_data *d)
24{
25 unsigned long enable_bit;
26 unsigned int irq = d->irq;
27
28 enable_bit = (1 << (irq & 0x1f));
29
30 switch (irq >> 5) {
31 case 0:
32 asic_write(asic_read(ien_int_0) | enable_bit, ien_int_0);
33 break;
34 case 1:
35 asic_write(asic_read(ien_int_1) | enable_bit, ien_int_1);
36 break;
37 case 2:
38 asic_write(asic_read(ien_int_2) | enable_bit, ien_int_2);
39 break;
40 case 3:
41 asic_write(asic_read(ien_int_3) | enable_bit, ien_int_3);
42 break;
43 default:
44 BUG();
45 }
46}
47
48static inline void mask_asic_irq(struct irq_data *d)
49{
50 unsigned long disable_mask;
51 unsigned int irq = d->irq;
52
53 disable_mask = ~(1 << (irq & 0x1f));
54
55 switch (irq >> 5) {
56 case 0:
57 asic_write(asic_read(ien_int_0) & disable_mask, ien_int_0);
58 break;
59 case 1:
60 asic_write(asic_read(ien_int_1) & disable_mask, ien_int_1);
61 break;
62 case 2:
63 asic_write(asic_read(ien_int_2) & disable_mask, ien_int_2);
64 break;
65 case 3:
66 asic_write(asic_read(ien_int_3) & disable_mask, ien_int_3);
67 break;
68 default:
69 BUG();
70 }
71}
72
73static struct irq_chip asic_irq_chip = {
74 .name = "ASIC Level",
75 .irq_mask = mask_asic_irq,
76 .irq_unmask = unmask_asic_irq,
77};
78
79void __init asic_irq_init(void)
80{
81 int i;
82
83 /* set priority to 0 */
84 write_c0_status(read_c0_status() & ~(0x0000fc00));
85
86 asic_write(0, ien_int_0);
87 asic_write(0, ien_int_1);
88 asic_write(0, ien_int_2);
89 asic_write(0, ien_int_3);
90
91 asic_write(0x0fffffff, int_level_3_3);
92 asic_write(0xffffffff, int_level_3_2);
93 asic_write(0xffffffff, int_level_3_1);
94 asic_write(0xffffffff, int_level_3_0);
95 asic_write(0xffffffff, int_level_2_3);
96 asic_write(0xffffffff, int_level_2_2);
97 asic_write(0xffffffff, int_level_2_1);
98 asic_write(0xffffffff, int_level_2_0);
99 asic_write(0xffffffff, int_level_1_3);
100 asic_write(0xffffffff, int_level_1_2);
101 asic_write(0xffffffff, int_level_1_1);
102 asic_write(0xffffffff, int_level_1_0);
103 asic_write(0xffffffff, int_level_0_3);
104 asic_write(0xffffffff, int_level_0_2);
105 asic_write(0xffffffff, int_level_0_1);
106 asic_write(0xffffffff, int_level_0_0);
107
108 asic_write(0xf, int_int_scan);
109
110 /*
111 * Initialize interrupt handlers.
112 */
113 for (i = 0; i < NR_IRQS; i++)
114 irq_set_chip_and_handler(i, &asic_irq_chip, handle_level_irq);
115}
diff --git a/arch/mips/powertv/asic/prealloc-calliope.c b/arch/mips/powertv/asic/prealloc-calliope.c
deleted file mode 100644
index 98dc51650577..000000000000
--- a/arch/mips/powertv/asic/prealloc-calliope.c
+++ /dev/null
@@ -1,385 +0,0 @@
1/*
2 * Memory pre-allocations for Calliope boxes.
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: Ken Eppinett
21 * David Schleef <ds@schleef.org>
22 */
23
24#include <linux/init.h>
25#include <linux/ioport.h>
26#include <asm/mach-powertv/asic.h>
27#include "prealloc.h"
28
29/*
30 * NON_DVR_CAPABLE CALLIOPE RESOURCES
31 */
32struct resource non_dvr_calliope_resources[] __initdata =
33{
34 /*
35 * VIDEO / LX1
36 */
37 /* Delta-Mu 1 image (2MiB) */
38 PREALLOC_NORMAL("ST231aImage", 0x24000000, 0x24200000-1,
39 IORESOURCE_MEM)
40 /* Delta-Mu 1 monitor (8KiB) */
41 PREALLOC_NORMAL("ST231aMonitor", 0x24200000, 0x24202000-1,
42 IORESOURCE_MEM)
43 /* Delta-Mu 1 RAM (~36.9MiB (32MiB - (2MiB + 8KiB))) */
44 PREALLOC_NORMAL("MediaMemory1", 0x24202000, 0x26700000-1,
45 IORESOURCE_MEM)
46
47 /*
48 * Sysaudio Driver
49 */
50 /* DSP code and data images (1MiB) */
51 PREALLOC_NORMAL("DSP_Image_Buff", 0x00000000, 0x00100000-1,
52 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
53 /* ADSC CPU PCM buffer (40KiB) */
54 PREALLOC_NORMAL("ADSC_CPU_PCM_Buff", 0x00000000, 0x0000A000-1,
55 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
56 /* ADSC AUX buffer (128KiB) */
57 PREALLOC_NORMAL("ADSC_AUX_Buff", 0x00000000, 0x00020000-1,
58 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
59 /* ADSC Main buffer (128KiB) */
60 PREALLOC_NORMAL("ADSC_Main_Buff", 0x00000000, 0x00020000-1,
61 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
62
63 /*
64 * STAVEM driver/STAPI
65 */
66 /* 6MiB */
67 PREALLOC_NORMAL("AVMEMPartition0", 0x00000000, 0x00600000-1,
68 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
69
70 /*
71 * DOCSIS Subsystem
72 */
73 /* 7MiB */
74 PREALLOC_DOCSIS("Docsis", 0x27500000, 0x27c00000-1, IORESOURCE_MEM)
75
76 /*
77 * GHW HAL Driver
78 */
79 /* PowerTV Graphics Heap (14MiB) */
80 PREALLOC_NORMAL("GraphicsHeap", 0x26700000, 0x26700000+(14*1048576)-1,
81 IORESOURCE_MEM)
82
83 /*
84 * multi com buffer area
85 */
86 /* 128KiB */
87 PREALLOC_NORMAL("MulticomSHM", 0x23700000, 0x23720000-1,
88 IORESOURCE_MEM)
89
90 /*
91 * DMA Ring buffer (don't need recording buffers)
92 */
93 /* 680KiB */
94 PREALLOC_NORMAL("BMM_Buffer", 0x00000000, 0x000AA000-1,
95 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
96
97 /*
98 * Display bins buffer for unit0
99 */
100 /* 4KiB */
101 PREALLOC_NORMAL("DisplayBins0", 0x00000000, 0x00001000-1,
102 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
103
104 /*
105 * AVFS: player HAL memory
106 */
107 /* 945K * 3 for playback */
108 PREALLOC_NORMAL("AvfsDmaMem", 0x00000000, 0x002c4c00-1,
109 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
110
111 /*
112 * PMEM
113 */
114 /* Persistent memory for diagnostics (64KiB) */
115 PREALLOC_PMEM("DiagPersistentMemory", 0x00000000, 0x10000-1,
116 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
117
118 /*
119 * Smartcard
120 */
121 /* Read and write buffers for Internal/External cards (10KiB) */
122 PREALLOC_NORMAL("SmartCardInfo", 0x00000000, 0x2800-1,
123 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
124
125 /*
126 * NAND Flash
127 */
128 /* 10KiB */
129 PREALLOC_NORMAL("NandFlash", NAND_FLASH_BASE, NAND_FLASH_BASE+0x400-1,
130 IORESOURCE_MEM)
131
132 /*
133 * Synopsys GMAC Memory Region
134 */
135 /* 64KiB */
136 PREALLOC_NORMAL("GMAC", 0x00000000, 0x00010000-1,
137 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
138
139 /*
140 * TFTPBuffer
141 *
142 * This buffer is used in some minimal configurations (e.g. two-way
143 * loader) for storing software images
144 */
145 PREALLOC_TFTP("TFTPBuffer", 0x00000000, MEBIBYTE(80)-1,
146 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
147
148 /*
149 * Add other resources here
150 */
151
152 /*
153 * End of Resource marker
154 */
155 {
156 .flags = 0,
157 },
158};
159
160
161struct resource non_dvr_vze_calliope_resources[] __initdata =
162{
163 /*
164 * VIDEO / LX1
165 */
166 /* Delta-Mu 1 image (2MiB) */
167 PREALLOC_NORMAL("ST231aImage", 0x22000000, 0x22200000-1,
168 IORESOURCE_MEM)
169 /* Delta-Mu 1 monitor (8KiB) */
170 PREALLOC_NORMAL("ST231aMonitor", 0x22200000, 0x22202000-1,
171 IORESOURCE_MEM)
172 /* Delta-Mu 1 RAM (10.12MiB) */
173 PREALLOC_NORMAL("MediaMemory1", 0x22202000, 0x22C20B85-1,
174 IORESOURCE_MEM)
175
176 /*
177 * Sysaudio Driver
178 */
179 /* DSP code and data images (1MiB) */
180 PREALLOC_NORMAL("DSP_Image_Buff", 0x00000000, 0x00100000-1,
181 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
182 /* ADSC CPU PCM buffer (40KiB) */
183 PREALLOC_NORMAL("ADSC_CPU_PCM_Buff", 0x00000000, 0x0000A000-1,
184 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
185 /* ADSC AUX buffer (16KiB) */
186 PREALLOC_NORMAL("ADSC_AUX_Buff", 0x00000000, 0x00004000-1,
187 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
188 /* ADSC Main buffer (16KiB) */
189 PREALLOC_NORMAL("ADSC_Main_Buff", 0x00000000, 0x00004000-1,
190 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
191
192 /*
193 * STAVEM driver/STAPI
194 */
195 /* 3.125MiB */
196 PREALLOC_NORMAL("AVMEMPartition0", 0x20396000, 0x206B6000-1,
197 IORESOURCE_MEM)
198
199 /*
200 * GHW HAL Driver
201 */
202 /* PowerTV Graphics Heap (2.59MiB) */
203 PREALLOC_NORMAL("GraphicsHeap", 0x20100000, 0x20396000-1,
204 IORESOURCE_MEM)
205
206 /*
207 * multi com buffer area
208 */
209 /* 128KiB */
210 PREALLOC_NORMAL("MulticomSHM", 0x206B6000, 0x206D6000-1,
211 IORESOURCE_MEM)
212
213 /*
214 * DMA Ring buffer (don't need recording buffers)
215 */
216 /* 680KiB */
217 PREALLOC_NORMAL("BMM_Buffer", 0x00000000, 0x000AA000-1,
218 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
219
220 /*
221 * Display bins buffer for unit0
222 */
223 /* 4KiB */
224 PREALLOC_NORMAL("DisplayBins0", 0x00000000, 0x00001000-1,
225 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
226
227 /*
228 * PMEM
229 */
230 /* Persistent memory for diagnostics (64KiB) */
231 PREALLOC_PMEM("DiagPersistentMemory", 0x00000000, 0x10000-1,
232 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
233
234 /*
235 * Smartcard
236 */
237 /* Read and write buffers for Internal/External cards (10KiB) */
238 PREALLOC_NORMAL("SmartCardInfo", 0x00000000, 0x2800-1,
239 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
240
241 /*
242 * NAND Flash
243 */
244 /* 10KiB */
245 PREALLOC_NORMAL("NandFlash", NAND_FLASH_BASE, NAND_FLASH_BASE+0x400-1,
246 IORESOURCE_MEM)
247
248 /*
249 * Synopsys GMAC Memory Region
250 */
251 /* 64KiB */
252 PREALLOC_NORMAL("GMAC", 0x00000000, 0x00010000-1,
253 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
254
255 /*
256 * Add other resources here
257 */
258
259 /*
260 * End of Resource marker
261 */
262 {
263 .flags = 0,
264 },
265};
266
267struct resource non_dvr_vzf_calliope_resources[] __initdata =
268{
269 /*
270 * VIDEO / LX1
271 */
272 /* Delta-Mu 1 image (2MiB) */
273 PREALLOC_NORMAL("ST231aImage", 0x24000000, 0x24200000-1,
274 IORESOURCE_MEM)
275 /* Delta-Mu 1 monitor (8KiB) */
276 PREALLOC_NORMAL("ST231aMonitor", 0x24200000, 0x24202000-1,
277 IORESOURCE_MEM)
278 /* Delta-Mu 1 RAM (~19.4 (21.5MiB - (2MiB + 8KiB))) */
279 PREALLOC_NORMAL("MediaMemory1", 0x24202000, 0x25580000-1,
280 IORESOURCE_MEM)
281
282 /*
283 * Sysaudio Driver
284 */
285 /* DSP code and data images (1MiB) */
286 PREALLOC_NORMAL("DSP_Image_Buff", 0x00000000, 0x00100000-1,
287 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
288 /* ADSC CPU PCM buffer (40KiB) */
289 PREALLOC_NORMAL("ADSC_CPU_PCM_Buff", 0x00000000, 0x0000A000-1,
290 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
291 /* ADSC AUX buffer (128KiB) */
292 PREALLOC_NORMAL("ADSC_AUX_Buff", 0x00000000, 0x00020000-1,
293 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
294 /* ADSC Main buffer (128KiB) */
295 PREALLOC_NORMAL("ADSC_Main_Buff", 0x00000000, 0x00020000-1,
296 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
297
298 /*
299 * STAVEM driver/STAPI
300 */
301 /* 4.5MiB */
302 PREALLOC_NORMAL("AVMEMPartition0", 0x00000000, 0x00480000-1,
303 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
304
305 /*
306 * GHW HAL Driver
307 */
308 /* PowerTV Graphics Heap (14MiB) */
309 PREALLOC_NORMAL("GraphicsHeap", 0x25600000, 0x25600000+(14*1048576)-1,
310 IORESOURCE_MEM)
311
312 /*
313 * multi com buffer area
314 */
315 /* 128KiB */
316 PREALLOC_NORMAL("MulticomSHM", 0x23700000, 0x23720000-1,
317 IORESOURCE_MEM)
318
319 /*
320 * DMA Ring buffer (don't need recording buffers)
321 */
322 /* 680KiB */
323 PREALLOC_NORMAL("BMM_Buffer", 0x00000000, 0x000AA000-1,
324 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
325
326 /*
327 * Display bins buffer for unit0
328 */
329 /* 4KiB */
330 PREALLOC_NORMAL("DisplayBins0", 0x00000000, 0x00001000-1,
331 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
332
333 /*
334 * Display bins buffer for unit1
335 */
336 /* 4KiB */
337 PREALLOC_NORMAL("DisplayBins1", 0x00000000, 0x00001000-1,
338 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
339
340 /*
341 * AVFS: player HAL memory
342 */
343 /* 945K * 3 for playback */
344 PREALLOC_NORMAL("AvfsDmaMem", 0x00000000, 0x002c4c00-1,
345 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
346
347 /*
348 * PMEM
349 */
350 /* Persistent memory for diagnostics (64KiB) */
351 PREALLOC_PMEM("DiagPersistentMemory", 0x00000000, 0x10000-1,
352 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
353
354 /*
355 * Smartcard
356 */
357 /* Read and write buffers for Internal/External cards (10KiB) */
358 PREALLOC_NORMAL("SmartCardInfo", 0x00000000, 0x2800-1,
359 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
360
361 /*
362 * NAND Flash
363 */
364 /* 10KiB */
365 PREALLOC_NORMAL("NandFlash", NAND_FLASH_BASE, NAND_FLASH_BASE+0x400-1,
366 IORESOURCE_MEM)
367
368 /*
369 * Synopsys GMAC Memory Region
370 */
371 /* 64KiB */
372 PREALLOC_NORMAL("GMAC", 0x00000000, 0x00010000-1,
373 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
374
375 /*
376 * Add other resources here
377 */
378
379 /*
380 * End of Resource marker
381 */
382 {
383 .flags = 0,
384 },
385};
diff --git a/arch/mips/powertv/asic/prealloc-cronus.c b/arch/mips/powertv/asic/prealloc-cronus.c
deleted file mode 100644
index 7c6ce7596935..000000000000
--- a/arch/mips/powertv/asic/prealloc-cronus.c
+++ /dev/null
@@ -1,340 +0,0 @@
1/*
2 * Memory pre-allocations for Cronus boxes.
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: Ken Eppinett
21 * David Schleef <ds@schleef.org>
22 */
23
24#include <linux/init.h>
25#include <linux/ioport.h>
26#include <asm/mach-powertv/asic.h>
27#include "prealloc.h"
28
29/*
30 * DVR_CAPABLE CRONUS RESOURCES
31 */
32struct resource dvr_cronus_resources[] __initdata =
33{
34 /*
35 * VIDEO1 / LX1
36 */
37 /* Delta-Mu 1 image (2MiB) */
38 PREALLOC_NORMAL("ST231aImage", 0x24000000, 0x24200000-1,
39 IORESOURCE_MEM)
40 /* Delta-Mu 1 monitor (8KiB) */
41 PREALLOC_NORMAL("ST231aMonitor", 0x24200000, 0x24202000-1,
42 IORESOURCE_MEM)
43 /* Delta-Mu 1 RAM (~29.9MiB (32MiB - (2MiB + 8KiB))) */
44 PREALLOC_NORMAL("MediaMemory1", 0x24202000, 0x26000000-1,
45 IORESOURCE_MEM)
46
47 /*
48 * VIDEO2 / LX2
49 */
50 /* Delta-Mu 2 image (2MiB) */
51 PREALLOC_NORMAL("ST231bImage", 0x60000000, 0x60200000-1,
52 IORESOURCE_MEM)
53 /* Delta-Mu 2 monitor (8KiB) */
54 PREALLOC_NORMAL("ST231bMonitor", 0x60200000, 0x60202000-1,
55 IORESOURCE_MEM)
56 /* Delta-Mu 2 RAM (~29.9MiB (32MiB - (2MiB + 8KiB))) */
57 PREALLOC_NORMAL("MediaMemory2", 0x60202000, 0x62000000-1,
58 IORESOURCE_MEM)
59
60 /*
61 * Sysaudio Driver
62 */
63 /* DSP code and data images (1MiB) */
64 PREALLOC_NORMAL("DSP_Image_Buff", 0x00000000, 0x00100000-1,
65 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
66 /* ADSC CPU PCM buffer (40KiB) */
67 PREALLOC_NORMAL("ADSC_CPU_PCM_Buff", 0x00000000, 0x0000A000-1,
68 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
69 /* ADSC AUX buffer (128KiB) */
70 PREALLOC_NORMAL("ADSC_AUX_Buff", 0x00000000, 0x00020000-1,
71 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
72 /* ADSC Main buffer (128KiB) */
73 PREALLOC_NORMAL("ADSC_Main_Buff", 0x00000000, 0x00020000-1,
74 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
75
76 /*
77 * STAVEM driver/STAPI
78 *
79 * This memory area is used for allocating buffers for Video decoding
80 * purposes. Allocation/De-allocation within this buffer is managed
81 * by the STAVMEM driver of the STAPI. They could be Decimated
82 * Picture Buffers, Intermediate Buffers, as deemed necessary for
83 * video decoding purposes, for any video decoders on Zeus.
84 */
85 /* 12MiB */
86 PREALLOC_NORMAL("AVMEMPartition0", 0x00000000, 0x00c00000-1,
87 IORESOURCE_MEM)
88
89 /*
90 * DOCSIS Subsystem
91 */
92 /* 7MiB */
93 PREALLOC_DOCSIS("Docsis", 0x67500000, 0x67c00000-1, IORESOURCE_MEM)
94
95 /*
96 * GHW HAL Driver
97 */
98 /* PowerTV Graphics Heap (14MiB) */
99 PREALLOC_NORMAL("GraphicsHeap", 0x62700000, 0x63500000-1,
100 IORESOURCE_MEM)
101
102 /*
103 * multi com buffer area
104 */
105 /* 128KiB */
106 PREALLOC_NORMAL("MulticomSHM", 0x26000000, 0x26020000-1,
107 IORESOURCE_MEM)
108
109 /*
110 * DMA Ring buffer
111 */
112 PREALLOC_NORMAL("BMM_Buffer", 0x00000000, 0x002EA000-1,
113 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
114
115 /*
116 * Display bins buffer for unit0
117 */
118 /* 4KiB */
119 PREALLOC_NORMAL("DisplayBins0", 0x00000000, 0x00001000-1,
120 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
121
122 /*
123 * Display bins buffer for unit1
124 */
125 /* 4KiB */
126 PREALLOC_NORMAL("DisplayBins1", 0x00000000, 0x00001000-1,
127 IORESOURCE_MEM)
128
129 /*
130 * ITFS
131 */
132 /* 815,104 bytes each for 2 ITFS partitions. */
133 PREALLOC_NORMAL("ITFS", 0x00000000, 0x0018E000-1, IORESOURCE_MEM)
134
135 /*
136 * AVFS
137 */
138 /* (945K * 8) = (128K * 3) 5 playbacks / 3 server */
139 PREALLOC_NORMAL("AvfsDmaMem", 0x00000000, 0x007c2000-1,
140 IORESOURCE_MEM)
141
142 /* 4KiB */
143 PREALLOC_NORMAL("AvfsFileSys", 0x00000000, 0x00001000-1,
144 IORESOURCE_MEM)
145
146 /*
147 * PMEM
148 */
149 /* Persistent memory for diagnostics (64KiB) */
150 PREALLOC_PMEM("DiagPersistentMemory", 0x00000000, 0x10000-1,
151 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
152
153 /*
154 * Smartcard
155 */
156 /* Read and write buffers for Internal/External cards (10KiB) */
157 PREALLOC_NORMAL("SmartCardInfo", 0x00000000, 0x2800-1,
158 IORESOURCE_MEM)
159
160 /*
161 * KAVNET
162 */
163 /* NP Reset Vector - must be of the form xxCxxxxx (4KiB) */
164 PREALLOC_NORMAL("NP_Reset_Vector", 0x27c00000, 0x27c01000-1,
165 IORESOURCE_MEM)
166 /* NP Image - must be video bank 1 (320KiB) */
167 PREALLOC_NORMAL("NP_Image", 0x27020000, 0x27070000-1, IORESOURCE_MEM)
168 /* NP IPC - must be video bank 2 (512KiB) */
169 PREALLOC_NORMAL("NP_IPC", 0x63500000, 0x63580000-1, IORESOURCE_MEM)
170
171 /*
172 * TFTPBuffer
173 *
174 * This buffer is used in some minimal configurations (e.g. two-way
175 * loader) for storing software images
176 */
177 PREALLOC_TFTP("TFTPBuffer", 0x00000000, MEBIBYTE(80)-1,
178 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
179
180 /*
181 * Add other resources here
182 */
183
184 /*
185 * End of Resource marker
186 */
187 {
188 .flags = 0,
189 },
190};
191
192/*
193 * NON_DVR_CAPABLE CRONUS RESOURCES
194 */
195struct resource non_dvr_cronus_resources[] __initdata =
196{
197 /*
198 * VIDEO1 / LX1
199 */
200 /* Delta-Mu 1 image (2MiB) */
201 PREALLOC_NORMAL("ST231aImage", 0x24000000, 0x24200000-1,
202 IORESOURCE_MEM)
203 /* Delta-Mu 1 monitor (8KiB) */
204 PREALLOC_NORMAL("ST231aMonitor", 0x24200000, 0x24202000-1,
205 IORESOURCE_MEM)
206 /* Delta-Mu 1 RAM (~29.9MiB (32MiB - (2MiB + 8KiB))) */
207 PREALLOC_NORMAL("MediaMemory1", 0x24202000, 0x26000000-1,
208 IORESOURCE_MEM)
209
210 /*
211 * VIDEO2 / LX2
212 */
213 /* Delta-Mu 2 image (2MiB) */
214 PREALLOC_NORMAL("ST231bImage", 0x60000000, 0x60200000-1,
215 IORESOURCE_MEM)
216 /* Delta-Mu 2 monitor (8KiB) */
217 PREALLOC_NORMAL("ST231bMonitor", 0x60200000, 0x60202000-1,
218 IORESOURCE_MEM)
219 /* Delta-Mu 2 RAM (~29.9MiB (32MiB - (2MiB + 8KiB))) */
220 PREALLOC_NORMAL("MediaMemory2", 0x60202000, 0x62000000-1,
221 IORESOURCE_MEM)
222
223 /*
224 * Sysaudio Driver
225 */
226 /* DSP code and data images (1MiB) */
227 PREALLOC_NORMAL("DSP_Image_Buff", 0x00000000, 0x00100000-1,
228 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
229 /* ADSC CPU PCM buffer (40KiB) */
230 PREALLOC_NORMAL("ADSC_CPU_PCM_Buff", 0x00000000, 0x0000A000-1,
231 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
232 /* ADSC AUX buffer (128KiB) */
233 PREALLOC_NORMAL("ADSC_AUX_Buff", 0x00000000, 0x00020000-1,
234 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
235 /* ADSC Main buffer (128KiB) */
236 PREALLOC_NORMAL("ADSC_Main_Buff", 0x00000000, 0x00020000-1,
237 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
238
239 /*
240 * STAVEM driver/STAPI
241 *
242 * This memory area is used for allocating buffers for Video decoding
243 * purposes. Allocation/De-allocation within this buffer is managed
244 * by the STAVMEM driver of the STAPI. They could be Decimated
245 * Picture Buffers, Intermediate Buffers, as deemed necessary for
246 * video decoding purposes, for any video decoders on Zeus.
247 */
248 /* 12MiB */
249 PREALLOC_NORMAL("AVMEMPartition0", 0x00000000, 0x00c00000-1,
250 IORESOURCE_MEM)
251
252 /*
253 * DOCSIS Subsystem
254 */
255 /* 7MiB */
256 PREALLOC_DOCSIS("Docsis", 0x67500000, 0x67c00000-1, IORESOURCE_MEM)
257
258 /*
259 * GHW HAL Driver
260 */
261 /* PowerTV Graphics Heap (14MiB) */
262 PREALLOC_NORMAL("GraphicsHeap", 0x62700000, 0x63500000-1,
263 IORESOURCE_MEM)
264
265 /*
266 * multi com buffer area
267 */
268 /* 128KiB */
269 PREALLOC_NORMAL("MulticomSHM", 0x26000000, 0x26020000-1,
270 IORESOURCE_MEM)
271
272 /*
273 * DMA Ring buffer (don't need recording buffers)
274 */
275 /* 680KiB */
276 PREALLOC_NORMAL("BMM_Buffer", 0x00000000, 0x000AA000-1,
277 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
278
279 /*
280 * Display bins buffer for unit0
281 */
282 /* 4KiB */
283 PREALLOC_NORMAL("DisplayBins0", 0x00000000, 0x00001000-1,
284 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
285
286 /*
287 * Display bins buffer for unit1
288 */
289 /* 4KiB */
290 PREALLOC_NORMAL("DisplayBins1", 0x00000000, 0x00001000-1,
291 IORESOURCE_MEM)
292
293 /*
294 * AVFS: player HAL memory
295 */
296 /* 945K * 3 for playback */
297 PREALLOC_NORMAL("AvfsDmaMem", 0x00000000, 0x002c4c00-1, IORESOURCE_MEM)
298
299 /*
300 * PMEM
301 */
302 /* Persistent memory for diagnostics (64KiB) */
303 PREALLOC_PMEM("DiagPersistentMemory", 0x00000000, 0x10000-1,
304 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
305
306 /*
307 * Smartcard
308 */
309 /* Read and write buffers for Internal/External cards (10KiB) */
310 PREALLOC_NORMAL("SmartCardInfo", 0x00000000, 0x2800-1, IORESOURCE_MEM)
311
312 /*
313 * KAVNET
314 */
315 /* NP Reset Vector - must be of the form xxCxxxxx (4KiB) */
316 PREALLOC_NORMAL("NP_Reset_Vector", 0x27c00000, 0x27c01000-1,
317 IORESOURCE_MEM)
318 /* NP Image - must be video bank 1 (320KiB) */
319 PREALLOC_NORMAL("NP_Image", 0x27020000, 0x27070000-1, IORESOURCE_MEM)
320 /* NP IPC - must be video bank 2 (512KiB) */
321 PREALLOC_NORMAL("NP_IPC", 0x63500000, 0x63580000-1, IORESOURCE_MEM)
322
323 /*
324 * NAND Flash
325 */
326 /* 10KiB */
327 PREALLOC_NORMAL("NandFlash", NAND_FLASH_BASE, NAND_FLASH_BASE+0x400-1,
328 IORESOURCE_MEM)
329
330 /*
331 * Add other resources here
332 */
333
334 /*
335 * End of Resource marker
336 */
337 {
338 .flags = 0,
339 },
340};
diff --git a/arch/mips/powertv/asic/prealloc-cronuslite.c b/arch/mips/powertv/asic/prealloc-cronuslite.c
deleted file mode 100644
index a7937ba7b4c0..000000000000
--- a/arch/mips/powertv/asic/prealloc-cronuslite.c
+++ /dev/null
@@ -1,174 +0,0 @@
1/*
2 * Memory pre-allocations for Cronus Lite boxes.
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: Ken Eppinett
21 * David Schleef <ds@schleef.org>
22 */
23
24#include <linux/init.h>
25#include <linux/ioport.h>
26#include <asm/mach-powertv/asic.h>
27#include "prealloc.h"
28
29/*
30 * NON_DVR_CAPABLE CRONUSLITE RESOURCES
31 */
32struct resource non_dvr_cronuslite_resources[] __initdata =
33{
34 /*
35 * VIDEO2 / LX2
36 */
37 /* Delta-Mu 1 image (2MiB) */
38 PREALLOC_NORMAL("ST231aImage", 0x60000000, 0x60200000-1,
39 IORESOURCE_MEM)
40 /* Delta-Mu 1 monitor (8KiB) */
41 PREALLOC_NORMAL("ST231aMonitor", 0x60200000, 0x60202000-1,
42 IORESOURCE_MEM)
43 /* Delta-Mu 1 RAM (~29.9MiB (32MiB - (2MiB + 8KiB))) */
44 PREALLOC_NORMAL("MediaMemory1", 0x60202000, 0x62000000-1,
45 IORESOURCE_MEM)
46
47 /*
48 * Sysaudio Driver
49 */
50 /* DSP code and data images (1MiB) */
51 PREALLOC_NORMAL("DSP_Image_Buff", 0x00000000, 0x00100000-1,
52 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
53 /* ADSC CPU PCM buffer (40KiB) */
54 PREALLOC_NORMAL("ADSC_CPU_PCM_Buff", 0x00000000, 0x0000A000-1,
55 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
56 /* ADSC AUX buffer (128KiB) */
57 PREALLOC_NORMAL("ADSC_AUX_Buff", 0x00000000, 0x00020000-1,
58 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
59 /* ADSC Main buffer (128KiB) */
60 PREALLOC_NORMAL("ADSC_Main_Buff", 0x00000000, 0x00020000-1,
61 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
62
63 /*
64 * STAVEM driver/STAPI
65 *
66 * This memory area is used for allocating buffers for Video decoding
67 * purposes. Allocation/De-allocation within this buffer is managed
68 * by the STAVMEM driver of the STAPI. They could be Decimated
69 * Picture Buffers, Intermediate Buffers, as deemed necessary for
70 * video decoding purposes, for any video decoders on Zeus.
71 */
72 /* 6MiB */
73 PREALLOC_NORMAL("AVMEMPartition0", 0x00000000, 0x00600000-1,
74 IORESOURCE_MEM)
75
76 /*
77 * DOCSIS Subsystem
78 */
79 /* 7MiB */
80 PREALLOC_DOCSIS("Docsis", 0x67500000, 0x67c00000-1, IORESOURCE_MEM)
81
82 /*
83 * GHW HAL Driver
84 */
85 /* PowerTV Graphics Heap (14MiB) */
86 PREALLOC_NORMAL("GraphicsHeap", 0x62700000, 0x63500000-1,
87 IORESOURCE_MEM)
88
89 /*
90 * multi com buffer area
91 */
92 /* 128KiB */
93 PREALLOC_NORMAL("MulticomSHM", 0x26000000, 0x26020000-1,
94 IORESOURCE_MEM)
95
96 /*
97 * DMA Ring buffer (don't need recording buffers)
98 */
99 /* 680KiB */
100 PREALLOC_NORMAL("BMM_Buffer", 0x00000000, 0x000AA000-1,
101 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
102
103 /*
104 * Display bins buffer for unit0
105 */
106 /* 4KiB */
107 PREALLOC_NORMAL("DisplayBins0", 0x00000000, 0x00001000-1,
108 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
109
110 /*
111 * Display bins buffer for unit1
112 */
113 /* 4KiB */
114 PREALLOC_NORMAL("DisplayBins1", 0x00000000, 0x00001000-1,
115 IORESOURCE_MEM)
116
117 /*
118 * AVFS: player HAL memory
119 */
120 /* 945K * 3 for playback */
121 PREALLOC_NORMAL("AvfsDmaMem", 0x00000000, 0x002c4c00-1,
122 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
123
124 /*
125 * PMEM
126 */
127 /* Persistent memory for diagnostics (64KiB) */
128 PREALLOC_PMEM("DiagPersistentMemory", 0x00000000, 0x10000-1,
129 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
130
131 /*
132 * Smartcard
133 */
134 /* Read and write buffers for Internal/External cards (10KiB) */
135 PREALLOC_NORMAL("SmartCardInfo", 0x00000000, 0x2800-1, IORESOURCE_MEM)
136
137 /*
138 * KAVNET
139 */
140 /* NP Reset Vector - must be of the form xxCxxxxx (4KiB) */
141 PREALLOC_NORMAL("NP_Reset_Vector", 0x27c00000, 0x27c01000-1,
142 IORESOURCE_MEM)
143 /* NP Image - must be video bank 1 (320KiB) */
144 PREALLOC_NORMAL("NP_Image", 0x27020000, 0x27070000-1, IORESOURCE_MEM)
145 /* NP IPC - must be video bank 2 (512KiB) */
146 PREALLOC_NORMAL("NP_IPC", 0x63500000, 0x63580000-1, IORESOURCE_MEM)
147
148 /*
149 * NAND Flash
150 */
151 /* 10KiB */
152 PREALLOC_NORMAL("NandFlash", NAND_FLASH_BASE, NAND_FLASH_BASE+0x400-1,
153 IORESOURCE_MEM)
154
155 /*
156 * TFTPBuffer
157 *
158 * This buffer is used in some minimal configurations (e.g. two-way
159 * loader) for storing software images
160 */
161 PREALLOC_TFTP("TFTPBuffer", 0x00000000, MEBIBYTE(80)-1,
162 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
163
164 /*
165 * Add other resources here
166 */
167
168 /*
169 * End of Resource marker
170 */
171 {
172 .flags = 0,
173 },
174};
diff --git a/arch/mips/powertv/asic/prealloc-gaia.c b/arch/mips/powertv/asic/prealloc-gaia.c
deleted file mode 100644
index 2303bbfe6b82..000000000000
--- a/arch/mips/powertv/asic/prealloc-gaia.c
+++ /dev/null
@@ -1,589 +0,0 @@
1/*
2 * Memory pre-allocations for Gaia boxes.
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: David VomLehn
21 */
22
23#include <linux/init.h>
24#include <asm/mach-powertv/asic.h>
25
26/*
27 * DVR_CAPABLE GAIA RESOURCES
28 */
29struct resource dvr_gaia_resources[] __initdata = {
30 /*
31 *
32 * VIDEO1 / LX1
33 *
34 */
35 {
36 .name = "ST231aImage", /* Delta-Mu 1 image and ram */
37 .start = 0x24000000,
38 .end = 0x241FFFFF, /* 2MiB */
39 .flags = IORESOURCE_MEM,
40 },
41 {
42 .name = "ST231aMonitor", /* 8KiB block ST231a monitor */
43 .start = 0x24200000,
44 .end = 0x24201FFF,
45 .flags = IORESOURCE_MEM,
46 },
47 {
48 .name = "MediaMemory1",
49 .start = 0x24202000,
50 .end = 0x25FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
51 .flags = IORESOURCE_MEM,
52 },
53 /*
54 *
55 * VIDEO2 / LX2
56 *
57 */
58 {
59 .name = "ST231bImage", /* Delta-Mu 2 image and ram */
60 .start = 0x60000000,
61 .end = 0x601FFFFF, /* 2MiB */
62 .flags = IORESOURCE_IO,
63 },
64 {
65 .name = "ST231bMonitor", /* 8KiB block ST231b monitor */
66 .start = 0x60200000,
67 .end = 0x60201FFF,
68 .flags = IORESOURCE_IO,
69 },
70 {
71 .name = "MediaMemory2",
72 .start = 0x60202000,
73 .end = 0x61FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
74 .flags = IORESOURCE_IO,
75 },
76 /*
77 *
78 * Sysaudio Driver
79 *
80 * This driver requires:
81 *
82 * Arbitrary Based Buffers:
83 * DSP_Image_Buff - DSP code and data images (1MB)
84 * ADSC_CPU_PCM_Buff - ADSC CPU PCM buffer (40KB)
85 * ADSC_AUX_Buff - ADSC AUX buffer (16KB)
86 * ADSC_Main_Buff - ADSC Main buffer (16KB)
87 *
88 */
89 {
90 .name = "DSP_Image_Buff",
91 .start = 0x00000000,
92 .end = 0x000FFFFF,
93 .flags = IORESOURCE_MEM,
94 },
95 {
96 .name = "ADSC_CPU_PCM_Buff",
97 .start = 0x00000000,
98 .end = 0x00009FFF,
99 .flags = IORESOURCE_MEM,
100 },
101 {
102 .name = "ADSC_AUX_Buff",
103 .start = 0x00000000,
104 .end = 0x00003FFF,
105 .flags = IORESOURCE_MEM,
106 },
107 {
108 .name = "ADSC_Main_Buff",
109 .start = 0x00000000,
110 .end = 0x00003FFF,
111 .flags = IORESOURCE_MEM,
112 },
113 /*
114 *
115 * STAVEM driver/STAPI
116 *
117 * This driver requires:
118 *
119 * Arbitrary Based Buffers:
120 * This memory area is used for allocating buffers for Video decoding
121 * purposes. Allocation/De-allocation within this buffer is managed
122 * by the STAVMEM driver of the STAPI. They could be Decimated
123 * Picture Buffers, Intermediate Buffers, as deemed necessary for
124 * video decoding purposes, for any video decoders on Zeus.
125 *
126 */
127 {
128 .name = "AVMEMPartition0",
129 .start = 0x63580000,
130 .end = 0x64180000 - 1, /* 12 MB total */
131 .flags = IORESOURCE_IO,
132 },
133 /*
134 *
135 * DOCSIS Subsystem
136 *
137 * This driver requires:
138 *
139 * Arbitrary Based Buffers:
140 * Docsis -
141 *
142 */
143 {
144 .name = "Docsis",
145 .start = 0x62000000,
146 .end = 0x62700000 - 1, /* 7 MB total */
147 .flags = IORESOURCE_IO,
148 },
149 /*
150 *
151 * GHW HAL Driver
152 *
153 * This driver requires:
154 *
155 * Arbitrary Based Buffers:
156 * GraphicsHeap - PowerTV Graphics Heap
157 *
158 */
159 {
160 .name = "GraphicsHeap",
161 .start = 0x62700000,
162 .end = 0x63500000 - 1, /* 14 MB total */
163 .flags = IORESOURCE_IO,
164 },
165 /*
166 *
167 * multi com buffer area
168 *
169 * This driver requires:
170 *
171 * Arbitrary Based Buffers:
172 * Docsis -
173 *
174 */
175 {
176 .name = "MulticomSHM",
177 .start = 0x26000000,
178 .end = 0x26020000 - 1,
179 .flags = IORESOURCE_MEM,
180 },
181 /*
182 *
183 * DMA Ring buffer
184 *
185 * This driver requires:
186 *
187 * Arbitrary Based Buffers:
188 * Docsis -
189 *
190 */
191 {
192 .name = "BMM_Buffer",
193 .start = 0x00000000,
194 .end = 0x00280000 - 1,
195 .flags = IORESOURCE_MEM,
196 },
197 /*
198 *
199 * Display bins buffer for unit0
200 *
201 * This driver requires:
202 *
203 * Arbitrary Based Buffers:
204 * Display Bins for unit0
205 *
206 */
207 {
208 .name = "DisplayBins0",
209 .start = 0x00000000,
210 .end = 0x00000FFF, /* 4 KB total */
211 .flags = IORESOURCE_MEM,
212 },
213 /*
214 *
215 * Display bins buffer
216 *
217 * This driver requires:
218 *
219 * Arbitrary Based Buffers:
220 * Display Bins for unit1
221 *
222 */
223 {
224 .name = "DisplayBins1",
225 .start = 0x64AD4000,
226 .end = 0x64AD5000 - 1, /* 4 KB total */
227 .flags = IORESOURCE_IO,
228 },
229 /*
230 *
231 * ITFS
232 *
233 * This driver requires:
234 *
235 * Arbitrary Based Buffers:
236 * Docsis -
237 *
238 */
239 {
240 .name = "ITFS",
241 .start = 0x64180000,
242 /* 815,104 bytes each for 2 ITFS partitions. */
243 .end = 0x6430DFFF,
244 .flags = IORESOURCE_IO,
245 },
246 /*
247 *
248 * AVFS
249 *
250 * This driver requires:
251 *
252 * Arbitrary Based Buffers:
253 * Docsis -
254 *
255 */
256 {
257 .name = "AvfsDmaMem",
258 .start = 0x6430E000,
259 /* (945K * 8) = (128K *3) 5 playbacks / 3 server */
260 .end = 0x64AD0000 - 1,
261 .flags = IORESOURCE_IO,
262 },
263 {
264 .name = "AvfsFileSys",
265 .start = 0x64AD0000,
266 .end = 0x64AD1000 - 1, /* 4K */
267 .flags = IORESOURCE_IO,
268 },
269 /*
270 *
271 * Smartcard
272 *
273 * This driver requires:
274 *
275 * Arbitrary Based Buffers:
276 * Read and write buffers for Internal/External cards
277 *
278 */
279 {
280 .name = "SmartCardInfo",
281 .start = 0x64AD1000,
282 .end = 0x64AD3800 - 1,
283 .flags = IORESOURCE_IO,
284 },
285 /*
286 *
287 * KAVNET
288 * NP Reset Vector - must be of the form xxCxxxxx
289 * NP Image - must be video bank 1
290 * NP IPC - must be video bank 2
291 */
292 {
293 .name = "NP_Reset_Vector",
294 .start = 0x27c00000,
295 .end = 0x27c01000 - 1,
296 .flags = IORESOURCE_MEM,
297 },
298 {
299 .name = "NP_Image",
300 .start = 0x27020000,
301 .end = 0x27060000 - 1,
302 .flags = IORESOURCE_MEM,
303 },
304 {
305 .name = "NP_IPC",
306 .start = 0x63500000,
307 .end = 0x63580000 - 1,
308 .flags = IORESOURCE_IO,
309 },
310 /*
311 * Add other resources here
312 */
313 { },
314};
315
316/*
317 * NON_DVR_CAPABLE GAIA RESOURCES
318 */
319struct resource non_dvr_gaia_resources[] __initdata = {
320 /*
321 *
322 * VIDEO1 / LX1
323 *
324 */
325 {
326 .name = "ST231aImage", /* Delta-Mu 1 image and ram */
327 .start = 0x24000000,
328 .end = 0x241FFFFF, /* 2MiB */
329 .flags = IORESOURCE_MEM,
330 },
331 {
332 .name = "ST231aMonitor", /* 8KiB block ST231a monitor */
333 .start = 0x24200000,
334 .end = 0x24201FFF,
335 .flags = IORESOURCE_MEM,
336 },
337 {
338 .name = "MediaMemory1",
339 .start = 0x24202000,
340 .end = 0x25FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
341 .flags = IORESOURCE_MEM,
342 },
343 /*
344 *
345 * VIDEO2 / LX2
346 *
347 */
348 {
349 .name = "ST231bImage", /* Delta-Mu 2 image and ram */
350 .start = 0x60000000,
351 .end = 0x601FFFFF, /* 2MiB */
352 .flags = IORESOURCE_IO,
353 },
354 {
355 .name = "ST231bMonitor", /* 8KiB block ST231b monitor */
356 .start = 0x60200000,
357 .end = 0x60201FFF,
358 .flags = IORESOURCE_IO,
359 },
360 {
361 .name = "MediaMemory2",
362 .start = 0x60202000,
363 .end = 0x61FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
364 .flags = IORESOURCE_IO,
365 },
366 /*
367 *
368 * Sysaudio Driver
369 *
370 * This driver requires:
371 *
372 * Arbitrary Based Buffers:
373 * DSP_Image_Buff - DSP code and data images (1MB)
374 * ADSC_CPU_PCM_Buff - ADSC CPU PCM buffer (40KB)
375 * ADSC_AUX_Buff - ADSC AUX buffer (16KB)
376 * ADSC_Main_Buff - ADSC Main buffer (16KB)
377 *
378 */
379 {
380 .name = "DSP_Image_Buff",
381 .start = 0x00000000,
382 .end = 0x000FFFFF,
383 .flags = IORESOURCE_MEM,
384 },
385 {
386 .name = "ADSC_CPU_PCM_Buff",
387 .start = 0x00000000,
388 .end = 0x00009FFF,
389 .flags = IORESOURCE_MEM,
390 },
391 {
392 .name = "ADSC_AUX_Buff",
393 .start = 0x00000000,
394 .end = 0x00003FFF,
395 .flags = IORESOURCE_MEM,
396 },
397 {
398 .name = "ADSC_Main_Buff",
399 .start = 0x00000000,
400 .end = 0x00003FFF,
401 .flags = IORESOURCE_MEM,
402 },
403 /*
404 *
405 * STAVEM driver/STAPI
406 *
407 * This driver requires:
408 *
409 * Arbitrary Based Buffers:
410 * This memory area is used for allocating buffers for Video decoding
411 * purposes. Allocation/De-allocation within this buffer is managed
412 * by the STAVMEM driver of the STAPI. They could be Decimated
413 * Picture Buffers, Intermediate Buffers, as deemed necessary for
414 * video decoding purposes, for any video decoders on Zeus.
415 *
416 */
417 {
418 .name = "AVMEMPartition0",
419 .start = 0x63580000,
420 .end = 0x64180000 - 1, /* 12 MB total */
421 .flags = IORESOURCE_IO,
422 },
423 /*
424 *
425 * DOCSIS Subsystem
426 *
427 * This driver requires:
428 *
429 * Arbitrary Based Buffers:
430 * Docsis -
431 *
432 */
433 {
434 .name = "Docsis",
435 .start = 0x62000000,
436 .end = 0x62700000 - 1, /* 7 MB total */
437 .flags = IORESOURCE_IO,
438 },
439 /*
440 *
441 * GHW HAL Driver
442 *
443 * This driver requires:
444 *
445 * Arbitrary Based Buffers:
446 * GraphicsHeap - PowerTV Graphics Heap
447 *
448 */
449 {
450 .name = "GraphicsHeap",
451 .start = 0x62700000,
452 .end = 0x63500000 - 1, /* 14 MB total */
453 .flags = IORESOURCE_IO,
454 },
455 /*
456 *
457 * multi com buffer area
458 *
459 * This driver requires:
460 *
461 * Arbitrary Based Buffers:
462 * Docsis -
463 *
464 */
465 {
466 .name = "MulticomSHM",
467 .start = 0x26000000,
468 .end = 0x26020000 - 1,
469 .flags = IORESOURCE_MEM,
470 },
471 /*
472 *
473 * DMA Ring buffer
474 *
475 * This driver requires:
476 *
477 * Arbitrary Based Buffers:
478 * Docsis -
479 *
480 */
481 {
482 .name = "BMM_Buffer",
483 .start = 0x00000000,
484 .end = 0x000AA000 - 1,
485 .flags = IORESOURCE_MEM,
486 },
487 /*
488 *
489 * Display bins buffer for unit0
490 *
491 * This driver requires:
492 *
493 * Arbitrary Based Buffers:
494 * Display Bins for unit0
495 *
496 */
497 {
498 .name = "DisplayBins0",
499 .start = 0x00000000,
500 .end = 0x00000FFF, /* 4 KB total */
501 .flags = IORESOURCE_MEM,
502 },
503 /*
504 *
505 * Display bins buffer
506 *
507 * This driver requires:
508 *
509 * Arbitrary Based Buffers:
510 * Display Bins for unit1
511 *
512 */
513 {
514 .name = "DisplayBins1",
515 .start = 0x64AD4000,
516 .end = 0x64AD5000 - 1, /* 4 KB total */
517 .flags = IORESOURCE_IO,
518 },
519 /*
520 *
521 * AVFS: player HAL memory
522 *
523 *
524 */
525 {
526 .name = "AvfsDmaMem",
527 .start = 0x6430E000,
528 .end = 0x645D2C00 - 1, /* 945K * 3 for playback */
529 .flags = IORESOURCE_IO,
530 },
531 /*
532 *
533 * PMEM
534 *
535 * This driver requires:
536 *
537 * Arbitrary Based Buffers:
538 * Persistent memory for diagnostics.
539 *
540 */
541 {
542 .name = "DiagPersistentMemory",
543 .start = 0x00000000,
544 .end = 0x10000 - 1,
545 .flags = IORESOURCE_MEM,
546 },
547 /*
548 *
549 * Smartcard
550 *
551 * This driver requires:
552 *
553 * Arbitrary Based Buffers:
554 * Read and write buffers for Internal/External cards
555 *
556 */
557 {
558 .name = "SmartCardInfo",
559 .start = 0x64AD1000,
560 .end = 0x64AD3800 - 1,
561 .flags = IORESOURCE_IO,
562 },
563 /*
564 *
565 * KAVNET
566 * NP Reset Vector - must be of the form xxCxxxxx
567 * NP Image - must be video bank 1
568 * NP IPC - must be video bank 2
569 */
570 {
571 .name = "NP_Reset_Vector",
572 .start = 0x27c00000,
573 .end = 0x27c01000 - 1,
574 .flags = IORESOURCE_MEM,
575 },
576 {
577 .name = "NP_Image",
578 .start = 0x27020000,
579 .end = 0x27060000 - 1,
580 .flags = IORESOURCE_MEM,
581 },
582 {
583 .name = "NP_IPC",
584 .start = 0x63500000,
585 .end = 0x63580000 - 1,
586 .flags = IORESOURCE_IO,
587 },
588 { },
589};
diff --git a/arch/mips/powertv/asic/prealloc-zeus.c b/arch/mips/powertv/asic/prealloc-zeus.c
deleted file mode 100644
index 6e76f09c68d6..000000000000
--- a/arch/mips/powertv/asic/prealloc-zeus.c
+++ /dev/null
@@ -1,304 +0,0 @@
1/*
2 * Memory pre-allocations for Zeus boxes.
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: Ken Eppinett
21 * David Schleef <ds@schleef.org>
22 */
23
24#include <linux/init.h>
25#include <linux/ioport.h>
26#include <asm/mach-powertv/asic.h>
27#include "prealloc.h"
28
29/*
30 * DVR_CAPABLE RESOURCES
31 */
32struct resource dvr_zeus_resources[] __initdata =
33{
34 /*
35 * VIDEO1 / LX1
36 */
37 /* Delta-Mu 1 image (2MiB) */
38 PREALLOC_NORMAL("ST231aImage", 0x20000000, 0x20200000-1,
39 IORESOURCE_MEM)
40 /* Delta-Mu 1 monitor (8KiB) */
41 PREALLOC_NORMAL("ST231aMonitor", 0x20200000, 0x20202000-1,
42 IORESOURCE_MEM)
43 /* Delta-Mu 1 RAM (~29.9MiB (32MiB - (2MiB + 8KiB))) */
44 PREALLOC_NORMAL("MediaMemory1", 0x20202000, 0x22000000-1,
45 IORESOURCE_MEM)
46
47 /*
48 * VIDEO2 / LX2
49 */
50 /* Delta-Mu 2 image (2MiB) */
51 PREALLOC_NORMAL("ST231bImage", 0x30000000, 0x30200000-1,
52 IORESOURCE_MEM)
53 /* Delta-Mu 2 monitor (8KiB) */
54 PREALLOC_NORMAL("ST231bMonitor", 0x30200000, 0x30202000-1,
55 IORESOURCE_MEM)
56 /* Delta-Mu 2 RAM (~29.9MiB (32MiB - (2MiB + 8KiB))) */
57 PREALLOC_NORMAL("MediaMemory2", 0x30202000, 0x32000000-1,
58 IORESOURCE_MEM)
59
60 /*
61 * Sysaudio Driver
62 */
63 /* DSP code and data images (1MiB) */
64 PREALLOC_NORMAL("DSP_Image_Buff", 0x00000000, 0x00100000-1,
65 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
66 /* ADSC CPU PCM buffer (40KiB) */
67 PREALLOC_NORMAL("ADSC_CPU_PCM_Buff", 0x00000000, 0x0000A000-1,
68 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
69 /* ADSC AUX buffer (16KiB) */
70 PREALLOC_NORMAL("ADSC_AUX_Buff", 0x00000000, 0x00004000-1,
71 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
72 /* ADSC Main buffer (16KiB) */
73 PREALLOC_NORMAL("ADSC_Main_Buff", 0x00000000, 0x00004000-1,
74 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
75
76 /*
77 * STAVEM driver/STAPI
78 *
79 * This memory area is used for allocating buffers for Video decoding
80 * purposes. Allocation/De-allocation within this buffer is managed
81 * by the STAVMEM driver of the STAPI. They could be Decimated
82 * Picture Buffers, Intermediate Buffers, as deemed necessary for
83 * video decoding purposes, for any video decoders on Zeus.
84 */
85 /* 12MiB */
86 PREALLOC_NORMAL("AVMEMPartition0", 0x00000000, 0x00c00000-1,
87 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
88
89 /*
90 * DOCSIS Subsystem
91 */
92 /* 7MiB */
93 PREALLOC_DOCSIS("Docsis", 0x40100000, 0x40800000-1, IORESOURCE_MEM)
94
95 /*
96 * GHW HAL Driver
97 */
98 /* PowerTV Graphics Heap (14MiB) */
99 PREALLOC_NORMAL("GraphicsHeap", 0x46900000, 0x47700000-1,
100 IORESOURCE_MEM)
101
102 /*
103 * multi com buffer area
104 */
105 /* 128KiB */
106 PREALLOC_NORMAL("MulticomSHM", 0x47900000, 0x47920000-1,
107 IORESOURCE_MEM)
108
109 /*
110 * DMA Ring buffer
111 */
112 /* 2.5MiB */
113 PREALLOC_NORMAL("BMM_Buffer", 0x00000000, 0x00280000-1,
114 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
115
116 /*
117 * Display bins buffer for unit0
118 */
119 /* 4KiB */
120 PREALLOC_NORMAL("DisplayBins0", 0x00000000, 0x00001000-1,
121 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
122
123 /*
124 * Display bins buffer for unit1
125 */
126 /* 4KiB */
127 PREALLOC_NORMAL("DisplayBins1", 0x00000000, 0x00001000-1,
128 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
129
130 /*
131 * ITFS
132 */
133 /* 815,104 bytes each for 2 ITFS partitions. */
134 PREALLOC_NORMAL("ITFS", 0x00000000, 0x0018E000-1,
135 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
136
137 /*
138 * AVFS
139 */
140 /* (945K * 8) = (128K * 3) 5 playbacks / 3 server */
141 PREALLOC_NORMAL("AvfsDmaMem", 0x00000000, 0x007c2000-1,
142 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
143 /* 4KiB */
144 PREALLOC_NORMAL("AvfsFileSys", 0x00000000, 0x00001000-1,
145 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
146
147 /*
148 * PMEM
149 */
150 /* Persistent memory for diagnostics (64KiB) */
151 PREALLOC_PMEM("DiagPersistentMemory", 0x00000000, 0x10000-1,
152 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
153
154 /*
155 * Smartcard
156 */
157 /* Read and write buffers for Internal/External cards (10KiB) */
158 PREALLOC_NORMAL("SmartCardInfo", 0x00000000, 0x2800-1,
159 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
160
161 /*
162 * TFTPBuffer
163 *
164 * This buffer is used in some minimal configurations (e.g. two-way
165 * loader) for storing software images
166 */
167 PREALLOC_TFTP("TFTPBuffer", 0x00000000, MEBIBYTE(80)-1,
168 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
169
170 /*
171 * Add other resources here
172 */
173
174 /*
175 * End of Resource marker
176 */
177 {
178 .flags = 0,
179 },
180};
181
182/*
183 * NON_DVR_CAPABLE ZEUS RESOURCES
184 */
185struct resource non_dvr_zeus_resources[] __initdata =
186{
187 /*
188 * VIDEO1 / LX1
189 */
190 /* Delta-Mu 1 image (2MiB) */
191 PREALLOC_NORMAL("ST231aImage", 0x20000000, 0x20200000-1,
192 IORESOURCE_MEM)
193 /* Delta-Mu 1 monitor (8KiB) */
194 PREALLOC_NORMAL("ST231aMonitor", 0x20200000, 0x20202000-1,
195 IORESOURCE_MEM)
196 /* Delta-Mu 1 RAM (~29.9MiB (32MiB - (2MiB + 8KiB))) */
197 PREALLOC_NORMAL("MediaMemory1", 0x20202000, 0x22000000-1,
198 IORESOURCE_MEM)
199
200 /*
201 * Sysaudio Driver
202 */
203 /* DSP code and data images (1MiB) */
204 PREALLOC_NORMAL("DSP_Image_Buff", 0x00000000, 0x00100000-1,
205 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
206 /* ADSC CPU PCM buffer (40KiB) */
207 PREALLOC_NORMAL("ADSC_CPU_PCM_Buff", 0x00000000, 0x0000A000-1,
208 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
209 /* ADSC AUX buffer (16KiB) */
210 PREALLOC_NORMAL("ADSC_AUX_Buff", 0x00000000, 0x00004000-1,
211 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
212 /* ADSC Main buffer (16KiB) */
213 PREALLOC_NORMAL("ADSC_Main_Buff", 0x00000000, 0x00004000-1,
214 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
215
216 /*
217 * STAVEM driver/STAPI
218 */
219 /* 6MiB */
220 PREALLOC_NORMAL("AVMEMPartition0", 0x00000000, 0x00600000-1,
221 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
222
223 /*
224 * DOCSIS Subsystem
225 */
226 /* 7MiB */
227 PREALLOC_DOCSIS("Docsis", 0x40100000, 0x40800000-1, IORESOURCE_MEM)
228
229 /*
230 * GHW HAL Driver
231 */
232 /* PowerTV Graphics Heap (14MiB) */
233 PREALLOC_NORMAL("GraphicsHeap", 0x46900000, 0x47700000-1,
234 IORESOURCE_MEM)
235
236 /*
237 * multi com buffer area
238 */
239 /* 128KiB */
240 PREALLOC_NORMAL("MulticomSHM", 0x47900000, 0x47920000-1,
241 IORESOURCE_MEM)
242
243 /*
244 * DMA Ring buffer
245 */
246 /* 2.5MiB */
247 PREALLOC_NORMAL("BMM_Buffer", 0x00000000, 0x00280000-1,
248 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
249
250 /*
251 * Display bins buffer for unit0
252 */
253 /* 4KiB */
254 PREALLOC_NORMAL("DisplayBins0", 0x00000000, 0x00001000-1,
255 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
256
257 /*
258 * AVFS: player HAL memory
259 */
260 /* 945K * 3 for playback */
261 PREALLOC_NORMAL("AvfsDmaMem", 0x00000000, 0x002c4c00-1,
262 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
263
264 /*
265 * PMEM
266 */
267 /* Persistent memory for diagnostics (64KiB) */
268 PREALLOC_PMEM("DiagPersistentMemory", 0x00000000, 0x10000-1,
269 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
270
271 /*
272 * Smartcard
273 */
274 /* Read and write buffers for Internal/External cards (10KiB) */
275 PREALLOC_NORMAL("SmartCardInfo", 0x00000000, 0x2800-1,
276 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
277
278 /*
279 * NAND Flash
280 */
281 /* 10KiB */
282 PREALLOC_NORMAL("NandFlash", NAND_FLASH_BASE, NAND_FLASH_BASE+0x400-1,
283 IORESOURCE_MEM)
284
285 /*
286 * TFTPBuffer
287 *
288 * This buffer is used in some minimal configurations (e.g. two-way
289 * loader) for storing software images
290 */
291 PREALLOC_TFTP("TFTPBuffer", 0x00000000, MEBIBYTE(80)-1,
292 (IORESOURCE_MEM|IORESOURCE_PTV_RES_LOEXT))
293
294 /*
295 * Add other resources here
296 */
297
298 /*
299 * End of Resource marker
300 */
301 {
302 .flags = 0,
303 },
304};
diff --git a/arch/mips/powertv/asic/prealloc.h b/arch/mips/powertv/asic/prealloc.h
deleted file mode 100644
index 8e682df17856..000000000000
--- a/arch/mips/powertv/asic/prealloc.h
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * Definitions for memory preallocations
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef _ARCH_MIPS_POWERTV_ASIC_PREALLOC_H
22#define _ARCH_MIPS_POWERTV_ASIC_PREALLOC_H
23
24#define KIBIBYTE(n) ((n) * 1024) /* Number of kibibytes */
25#define MEBIBYTE(n) ((n) * KIBIBYTE(1024)) /* Number of mebibytes */
26
27/* "struct resource" array element definition */
28#define PREALLOC(NAME, START, END, FLAGS) { \
29 .name = (NAME), \
30 .start = (START), \
31 .end = (END), \
32 .flags = (FLAGS) \
33 },
34
35/* Individual resources in the preallocated resource arrays are defined using
36 * macros. These macros are conditionally defined based on their
37 * corresponding kernel configuration flag:
38 * - CONFIG_PREALLOC_NORMAL: preallocate resources for a normal settop box
39 * - CONFIG_PREALLOC_TFTP: preallocate the TFTP download resource
40 * - CONFIG_PREALLOC_DOCSIS: preallocate the DOCSIS resource
41 * - CONFIG_PREALLOC_PMEM: reserve space for persistent memory
42 */
43#ifdef CONFIG_PREALLOC_NORMAL
44#define PREALLOC_NORMAL(name, start, end, flags) \
45 PREALLOC(name, start, end, flags)
46#else
47#define PREALLOC_NORMAL(name, start, end, flags)
48#endif
49
50#ifdef CONFIG_PREALLOC_TFTP
51#define PREALLOC_TFTP(name, start, end, flags) \
52 PREALLOC(name, start, end, flags)
53#else
54#define PREALLOC_TFTP(name, start, end, flags)
55#endif
56
57#ifdef CONFIG_PREALLOC_DOCSIS
58#define PREALLOC_DOCSIS(name, start, end, flags) \
59 PREALLOC(name, start, end, flags)
60#else
61#define PREALLOC_DOCSIS(name, start, end, flags)
62#endif
63
64#ifdef CONFIG_PREALLOC_PMEM
65#define PREALLOC_PMEM(name, start, end, flags) \
66 PREALLOC(name, start, end, flags)
67#else
68#define PREALLOC_PMEM(name, start, end, flags)
69#endif
70#endif
diff --git a/arch/mips/powertv/init.c b/arch/mips/powertv/init.c
deleted file mode 100644
index 498926377e51..000000000000
--- a/arch/mips/powertv/init.c
+++ /dev/null
@@ -1,90 +0,0 @@
1/*
2 * Copyright (C) 1999, 2000, 2004, 2005 MIPS Technologies, Inc.
3 * All rights reserved.
4 * Authors: Carsten Langgaard <carstenl@mips.com>
5 * Maciej W. Rozycki <macro@mips.com>
6 * Portions copyright (C) 2009 Cisco Systems, Inc.
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * 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 it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 *
21 * PROM library initialisation code.
22 */
23#include <linux/init.h>
24#include <linux/string.h>
25#include <linux/kernel.h>
26
27#include <asm/bootinfo.h>
28#include <linux/io.h>
29#include <asm/cacheflush.h>
30#include <asm/traps.h>
31
32#include <asm/mips-boards/generic.h>
33#include <asm/mach-powertv/asic.h>
34
35#include "init.h"
36
37static int *_prom_envp;
38unsigned long _prom_memsize;
39
40/*
41 * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
42 * This macro take care of sign extension, if running in 64-bit mode.
43 */
44#define prom_envp(index) ((char *)(long)_prom_envp[(index)])
45
46char *prom_getenv(char *envname)
47{
48 char *result = NULL;
49
50 if (_prom_envp != NULL) {
51 /*
52 * Return a pointer to the given environment variable.
53 * In 64-bit mode: we're using 64-bit pointers, but all pointers
54 * in the PROM structures are only 32-bit, so we need some
55 * workarounds, if we are running in 64-bit mode.
56 */
57 int i, index = 0;
58
59 i = strlen(envname);
60
61 while (prom_envp(index)) {
62 if (strncmp(envname, prom_envp(index), i) == 0) {
63 result = prom_envp(index + 1);
64 break;
65 }
66 index += 2;
67 }
68 }
69
70 return result;
71}
72
73void __init prom_init(void)
74{
75 int prom_argc;
76 char *prom_argv;
77
78 prom_argc = fw_arg0;
79 prom_argv = (char *) fw_arg1;
80 _prom_envp = (int *) fw_arg2;
81 _prom_memsize = (unsigned long) fw_arg3;
82
83 if (prom_argc == 1) {
84 strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
85 strlcat(arcs_cmdline, prom_argv, COMMAND_LINE_SIZE);
86 }
87
88 configure_platform();
89 prom_meminit();
90}
diff --git a/arch/mips/powertv/init.h b/arch/mips/powertv/init.h
deleted file mode 100644
index c1a8bd0dbe4b..000000000000
--- a/arch/mips/powertv/init.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * Definitions from powertv init.c file
3 *
4 * Copyright (C) 2009 Cisco Systems, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: David VomLehn
21 */
22
23#ifndef _POWERTV_INIT_H
24#define _POWERTV_INIT_H
25extern unsigned long _prom_memsize;
26extern void prom_meminit(void);
27extern char *prom_getenv(char *name);
28#endif
diff --git a/arch/mips/powertv/ioremap.c b/arch/mips/powertv/ioremap.c
deleted file mode 100644
index d060478aab03..000000000000
--- a/arch/mips/powertv/ioremap.c
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * ioremap.c
3 *
4 * Support for mapping between dma_addr_t values a phys_addr_t values.
5 *
6 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 * Author: David VomLehn <dvomlehn@cisco.com>
23 *
24 * Description: Defines the platform resources for the SA settop.
25 *
26 * NOTE: The bootloader allocates persistent memory at an address which is
27 * 16 MiB below the end of the highest address in KSEG0. All fixed
28 * address memory reservations must avoid this region.
29 */
30
31#include <linux/kernel.h>
32#include <linux/module.h>
33
34#include <asm/mach-powertv/ioremap.h>
35
36/*
37 * Define the sizes of and masks for grains in physical and DMA space. The
38 * values are the same but the types are not.
39 */
40#define IOR_PHYS_GRAIN ((phys_addr_t) 1 << IOR_LSBITS)
41#define IOR_PHYS_GRAIN_MASK (IOR_PHYS_GRAIN - 1)
42
43#define IOR_DMA_GRAIN ((dma_addr_t) 1 << IOR_LSBITS)
44#define IOR_DMA_GRAIN_MASK (IOR_DMA_GRAIN - 1)
45
46/*
47 * Values that, when accessed by an index derived from a phys_addr_t and
48 * added to phys_addr_t value, yield a DMA address
49 */
50struct ior_phys_to_dma _ior_phys_to_dma[IOR_NUM_PHYS_TO_DMA];
51EXPORT_SYMBOL(_ior_phys_to_dma);
52
53/*
54 * Values that, when accessed by an index derived from a dma_addr_t and
55 * added to that dma_addr_t value, yield a physical address
56 */
57struct ior_dma_to_phys _ior_dma_to_phys[IOR_NUM_DMA_TO_PHYS];
58EXPORT_SYMBOL(_ior_dma_to_phys);
59
60/**
61 * setup_dma_to_phys - set up conversion from DMA to physical addresses
62 * @dma_idx: Top IOR_LSBITS bits of the DMA address, i.e. an index
63 * into the array _dma_to_phys.
64 * @delta: Value that, when added to the DMA address, will yield the
65 * physical address
66 * @s: Number of bytes in the section of memory with the given delta
67 * between DMA and physical addresses.
68 */
69static void setup_dma_to_phys(dma_addr_t dma, phys_addr_t delta, dma_addr_t s)
70{
71 int dma_idx, first_idx, last_idx;
72 phys_addr_t first, last;
73
74 /*
75 * Calculate the first and last indices, rounding the first up and
76 * the second down.
77 */
78 first = dma & ~IOR_DMA_GRAIN_MASK;
79 last = (dma + s - 1) & ~IOR_DMA_GRAIN_MASK;
80 first_idx = first >> IOR_LSBITS; /* Convert to indices */
81 last_idx = last >> IOR_LSBITS;
82
83 for (dma_idx = first_idx; dma_idx <= last_idx; dma_idx++)
84 _ior_dma_to_phys[dma_idx].offset = delta >> IOR_DMA_SHIFT;
85}
86
87/**
88 * setup_phys_to_dma - set up conversion from DMA to physical addresses
89 * @phys_idx: Top IOR_LSBITS bits of the DMA address, i.e. an index
90 * into the array _phys_to_dma.
91 * @delta: Value that, when added to the DMA address, will yield the
92 * physical address
93 * @s: Number of bytes in the section of memory with the given delta
94 * between DMA and physical addresses.
95 */
96static void setup_phys_to_dma(phys_addr_t phys, dma_addr_t delta, phys_addr_t s)
97{
98 int phys_idx, first_idx, last_idx;
99 phys_addr_t first, last;
100
101 /*
102 * Calculate the first and last indices, rounding the first up and
103 * the second down.
104 */
105 first = phys & ~IOR_PHYS_GRAIN_MASK;
106 last = (phys + s - 1) & ~IOR_PHYS_GRAIN_MASK;
107 first_idx = first >> IOR_LSBITS; /* Convert to indices */
108 last_idx = last >> IOR_LSBITS;
109
110 for (phys_idx = first_idx; phys_idx <= last_idx; phys_idx++)
111 _ior_phys_to_dma[phys_idx].offset = delta >> IOR_PHYS_SHIFT;
112}
113
114/**
115 * ioremap_add_map - add to the physical and DMA address conversion arrays
116 * @phys: Process's view of the address of the start of the memory chunk
117 * @dma: DMA address of the start of the memory chunk
118 * @size: Size, in bytes, of the chunk of memory
119 *
120 * NOTE: It might be obvious, but the assumption is that all @size bytes have
121 * the same offset between the physical address and the DMA address.
122 */
123void ioremap_add_map(phys_addr_t phys, phys_addr_t dma, phys_addr_t size)
124{
125 if (size == 0)
126 return;
127
128 if ((dma & IOR_DMA_GRAIN_MASK) != 0 ||
129 (phys & IOR_PHYS_GRAIN_MASK) != 0 ||
130 (size & IOR_PHYS_GRAIN_MASK) != 0)
131 pr_crit("Memory allocation must be in chunks of 0x%x bytes\n",
132 IOR_PHYS_GRAIN);
133
134 setup_dma_to_phys(dma, phys - dma, size);
135 setup_phys_to_dma(phys, dma - phys, size);
136}
diff --git a/arch/mips/powertv/memory.c b/arch/mips/powertv/memory.c
deleted file mode 100644
index bc2f3ca22b41..000000000000
--- a/arch/mips/powertv/memory.c
+++ /dev/null
@@ -1,353 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 * Portions copyright (C) 2009 Cisco Systems, Inc.
5 *
6 * This program is free software; you can distribute it and/or modify it
7 * under the terms of the GNU General Public License (Version 2) as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18 *
19 * Apparently originally from arch/mips/malta-memory.c. Modified to work
20 * with the PowerTV bootloader.
21 */
22#include <linux/init.h>
23#include <linux/mm.h>
24#include <linux/bootmem.h>
25#include <linux/pfn.h>
26#include <linux/string.h>
27
28#include <asm/bootinfo.h>
29#include <asm/page.h>
30#include <asm/sections.h>
31
32#include <asm/mach-powertv/asic.h>
33#include <asm/mach-powertv/ioremap.h>
34
35#include "init.h"
36
37/* Memory constants */
38#define KIBIBYTE(n) ((n) * 1024) /* Number of kibibytes */
39#define MEBIBYTE(n) ((n) * KIBIBYTE(1024)) /* Number of mebibytes */
40#define DEFAULT_MEMSIZE MEBIBYTE(128) /* If no memsize provided */
41
42#define BLDR_SIZE KIBIBYTE(256) /* Memory reserved for bldr */
43#define RV_SIZE MEBIBYTE(4) /* Size of reset vector */
44
45#define LOW_MEM_END 0x20000000 /* Highest low memory address */
46#define BLDR_ALIAS 0x10000000 /* Bootloader address */
47#define RV_PHYS 0x1fc00000 /* Reset vector address */
48#define LOW_RAM_END RV_PHYS /* End of real RAM in low mem */
49
50/*
51 * Very low-level conversion from processor physical address to device
52 * DMA address for the first bank of memory.
53 */
54#define PHYS_TO_DMA(paddr) ((paddr) + (CONFIG_LOW_RAM_DMA - LOW_RAM_ALIAS))
55
56unsigned long ptv_memsize;
57
58/*
59 * struct low_mem_reserved - Items in low memory that are reserved
60 * @start: Physical address of item
61 * @size: Size, in bytes, of this item
62 * @is_aliased: True if this is RAM aliased from another location. If false,
63 * it is something other than aliased RAM and the RAM in the
64 * unaliased address is still visible outside of low memory.
65 */
66struct low_mem_reserved {
67 phys_addr_t start;
68 phys_addr_t size;
69 bool is_aliased;
70};
71
72/*
73 * Must be in ascending address order
74 */
75struct low_mem_reserved low_mem_reserved[] = {
76 {BLDR_ALIAS, BLDR_SIZE, true}, /* Bootloader RAM */
77 {RV_PHYS, RV_SIZE, false}, /* Reset vector */
78};
79
80/*
81 * struct mem_layout - layout of a piece of the system RAM
82 * @phys: Physical address of the start of this piece of RAM. This is the
83 * address at which both the processor and I/O devices see the
84 * RAM.
85 * @alias: Alias of this piece of memory in order to make it appear in
86 * the low memory part of the processor's address space. I/O
87 * devices don't see anything here.
88 * @size: Size, in bytes, of this piece of RAM
89 */
90struct mem_layout {
91 phys_addr_t phys;
92 phys_addr_t alias;
93 phys_addr_t size;
94};
95
96/*
97 * struct mem_layout_list - list descriptor for layouts of system RAM pieces
98 * @family: Specifies the family being described
99 * @n: Number of &struct mem_layout elements
100 * @layout: Pointer to the list of &mem_layout structures
101 */
102struct mem_layout_list {
103 enum family_type family;
104 size_t n;
105 struct mem_layout *layout;
106};
107
108static struct mem_layout f1500_layout[] = {
109 {0x20000000, 0x10000000, MEBIBYTE(256)},
110};
111
112static struct mem_layout f4500_layout[] = {
113 {0x40000000, 0x10000000, MEBIBYTE(256)},
114 {0x20000000, 0x20000000, MEBIBYTE(32)},
115};
116
117static struct mem_layout f8500_layout[] = {
118 {0x40000000, 0x10000000, MEBIBYTE(256)},
119 {0x20000000, 0x20000000, MEBIBYTE(32)},
120 {0x30000000, 0x30000000, MEBIBYTE(32)},
121};
122
123static struct mem_layout fx600_layout[] = {
124 {0x20000000, 0x10000000, MEBIBYTE(256)},
125 {0x60000000, 0x60000000, MEBIBYTE(128)},
126};
127
128static struct mem_layout_list layout_list[] = {
129 {FAMILY_1500, ARRAY_SIZE(f1500_layout), f1500_layout},
130 {FAMILY_1500VZE, ARRAY_SIZE(f1500_layout), f1500_layout},
131 {FAMILY_1500VZF, ARRAY_SIZE(f1500_layout), f1500_layout},
132 {FAMILY_4500, ARRAY_SIZE(f4500_layout), f4500_layout},
133 {FAMILY_8500, ARRAY_SIZE(f8500_layout), f8500_layout},
134 {FAMILY_8500RNG, ARRAY_SIZE(f8500_layout), f8500_layout},
135 {FAMILY_4600, ARRAY_SIZE(fx600_layout), fx600_layout},
136 {FAMILY_4600VZA, ARRAY_SIZE(fx600_layout), fx600_layout},
137 {FAMILY_8600, ARRAY_SIZE(fx600_layout), fx600_layout},
138 {FAMILY_8600VZB, ARRAY_SIZE(fx600_layout), fx600_layout},
139};
140
141/* If we can't determine the layout, use this */
142static struct mem_layout default_layout[] = {
143 {0x20000000, 0x10000000, MEBIBYTE(128)},
144};
145
146/**
147 * register_non_ram - register low memory not available for RAM usage
148 */
149static __init void register_non_ram(void)
150{
151 int i;
152
153 for (i = 0; i < ARRAY_SIZE(low_mem_reserved); i++)
154 add_memory_region(low_mem_reserved[i].start,
155 low_mem_reserved[i].size, BOOT_MEM_RESERVED);
156}
157
158/**
159 * get_memsize - get the size of memory as a single bank
160 */
161static phys_addr_t get_memsize(void)
162{
163 static char cmdline[COMMAND_LINE_SIZE] __initdata;
164 phys_addr_t memsize = 0;
165 char *memsize_str;
166 char *ptr;
167
168 /* Check the command line first for a memsize directive */
169 strcpy(cmdline, arcs_cmdline);
170 ptr = strstr(cmdline, "memsize=");
171 if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' '))
172 ptr = strstr(ptr, " memsize=");
173
174 if (ptr) {
175 memsize = memparse(ptr + 8, &ptr);
176 } else {
177 /* otherwise look in the environment */
178 memsize_str = prom_getenv("memsize");
179
180 if (memsize_str != NULL) {
181 pr_info("prom memsize = %s\n", memsize_str);
182 memsize = simple_strtol(memsize_str, NULL, 0);
183 }
184
185 if (memsize == 0) {
186 if (_prom_memsize != 0) {
187 memsize = _prom_memsize;
188 pr_info("_prom_memsize = 0x%x\n", memsize);
189 /* add in memory that the bootloader doesn't
190 * report */
191 memsize += BLDR_SIZE;
192 } else {
193 memsize = DEFAULT_MEMSIZE;
194 pr_info("Memsize not passed by bootloader, "
195 "defaulting to 0x%x\n", memsize);
196 }
197 }
198 }
199
200 return memsize;
201}
202
203/**
204 * register_low_ram - register an aliased section of RAM
205 * @p: Alias address of memory
206 * @n: Number of bytes in this section of memory
207 *
208 * Returns the number of bytes registered
209 *
210 */
211static __init phys_addr_t register_low_ram(phys_addr_t p, phys_addr_t n)
212{
213 phys_addr_t s;
214 int i;
215 phys_addr_t orig_n;
216
217 orig_n = n;
218
219 BUG_ON(p + n > RV_PHYS);
220
221 for (i = 0; n != 0 && i < ARRAY_SIZE(low_mem_reserved); i++) {
222 phys_addr_t start;
223 phys_addr_t size;
224
225 start = low_mem_reserved[i].start;
226 size = low_mem_reserved[i].size;
227
228 /* Handle memory before this low memory section */
229 if (p < start) {
230 phys_addr_t s;
231 s = min(n, start - p);
232 add_memory_region(p, s, BOOT_MEM_RAM);
233 p += s;
234 n -= s;
235 }
236
237 /* Handle the low memory section itself. If it's aliased,
238 * we reduce the number of byes left, but if not, the RAM
239 * is available elsewhere and we don't reduce the number of
240 * bytes remaining. */
241 if (p == start) {
242 if (low_mem_reserved[i].is_aliased) {
243 s = min(n, size);
244 n -= s;
245 p += s;
246 } else
247 p += n;
248 }
249 }
250
251 return orig_n - n;
252}
253
254/*
255 * register_ram - register real RAM
256 * @p: Address of memory as seen by devices
257 * @alias: If the memory is seen at an additional address by the processor,
258 * this will be the address, otherwise it is the same as @p.
259 * @n: Number of bytes in this section of memory
260 */
261static __init void register_ram(phys_addr_t p, phys_addr_t alias,
262 phys_addr_t n)
263{
264 /*
265 * If some or all of this memory has an alias, break it into the
266 * aliased and non-aliased portion.
267 */
268 if (p != alias) {
269 phys_addr_t alias_size;
270 phys_addr_t registered;
271
272 alias_size = min(n, LOW_RAM_END - alias);
273 registered = register_low_ram(alias, alias_size);
274 ioremap_add_map(alias, p, n);
275 n -= registered;
276 p += registered;
277 }
278
279#ifdef CONFIG_HIGHMEM
280 if (n != 0) {
281 add_memory_region(p, n, BOOT_MEM_RAM);
282 ioremap_add_map(p, p, n);
283 }
284#endif
285}
286
287/**
288 * register_address_space - register things in the address space
289 * @memsize: Number of bytes of RAM installed
290 *
291 * Takes the given number of bytes of RAM and registers as many of the regions,
292 * or partial regions, as it can. So, the default configuration might have
293 * two regions with 256 MiB each. If the memsize passed in on the command line
294 * is 384 MiB, it will register the first region with 256 MiB and the second
295 * with 128 MiB.
296 */
297static __init void register_address_space(phys_addr_t memsize)
298{
299 int i;
300 phys_addr_t size;
301 size_t n;
302 struct mem_layout *layout;
303 enum family_type family;
304
305 /*
306 * Register all of the things that aren't available to the kernel as
307 * memory.
308 */
309 register_non_ram();
310
311 /* Find the appropriate memory description */
312 family = platform_get_family();
313
314 for (i = 0; i < ARRAY_SIZE(layout_list); i++) {
315 if (layout_list[i].family == family)
316 break;
317 }
318
319 if (i == ARRAY_SIZE(layout_list)) {
320 n = ARRAY_SIZE(default_layout);
321 layout = default_layout;
322 } else {
323 n = layout_list[i].n;
324 layout = layout_list[i].layout;
325 }
326
327 for (i = 0; memsize != 0 && i < n; i++) {
328 size = min(memsize, layout[i].size);
329 register_ram(layout[i].phys, layout[i].alias, size);
330 memsize -= size;
331 }
332}
333
334void __init prom_meminit(void)
335{
336 ptv_memsize = get_memsize();
337 register_address_space(ptv_memsize);
338}
339
340void __init prom_free_prom_memory(void)
341{
342 unsigned long addr;
343 int i;
344
345 for (i = 0; i < boot_mem_map.nr_map; i++) {
346 if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
347 continue;
348
349 addr = boot_mem_map.map[i].addr;
350 free_init_pages("prom memory",
351 addr, addr + boot_mem_map.map[i].size);
352 }
353}
diff --git a/arch/mips/powertv/pci/Makefile b/arch/mips/powertv/pci/Makefile
deleted file mode 100644
index 2610a6af5b2c..000000000000
--- a/arch/mips/powertv/pci/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
1#
2# Copyright (C) 2009 Scientific-Atlanta, 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# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
17#
18
19obj-$(CONFIG_PCI) += fixup-powertv.o
diff --git a/arch/mips/powertv/pci/fixup-powertv.c b/arch/mips/powertv/pci/fixup-powertv.c
deleted file mode 100644
index d7ecbae64a6e..000000000000
--- a/arch/mips/powertv/pci/fixup-powertv.c
+++ /dev/null
@@ -1,37 +0,0 @@
1#include <linux/init.h>
2#include <linux/export.h>
3#include <linux/pci.h>
4#include <asm/mach-powertv/interrupts.h>
5#include "powertv-pci.h"
6
7int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
8{
9 return asic_pcie_map_irq(dev, slot, pin);
10}
11
12/* Do platform specific device initialization at pci_enable_device() time */
13int pcibios_plat_dev_init(struct pci_dev *dev)
14{
15 return 0;
16}
17
18/*
19 * asic_pcie_map_irq
20 *
21 * Parameters:
22 * *dev - pointer to a pci_dev structure (not used)
23 * slot - slot number (not used)
24 * pin - pin number (not used)
25 *
26 * Return Value:
27 * Returns: IRQ number (always the PCI Express IRQ number)
28 *
29 * Description:
30 * asic_pcie_map_irq will return the IRQ number of the PCI Express interrupt.
31 *
32 */
33int asic_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
34{
35 return irq_pciexp;
36}
37EXPORT_SYMBOL(asic_pcie_map_irq);
diff --git a/arch/mips/powertv/pci/powertv-pci.h b/arch/mips/powertv/pci/powertv-pci.h
deleted file mode 100644
index 1b5886bbd759..000000000000
--- a/arch/mips/powertv/pci/powertv-pci.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * powertv-pci.c
3 *
4 * Copyright (C) 2009 Cisco Systems, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20/*
21 * Local definitions for the powertv PCI code
22 */
23
24#ifndef _POWERTV_PCI_POWERTV_PCI_H_
25#define _POWERTV_PCI_POWERTV_PCI_H_
26extern int asic_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
27extern int asic_pcie_init(void);
28extern int asic_pcie_init(void);
29
30extern int log_level;
31#endif
diff --git a/arch/mips/powertv/powertv-clock.h b/arch/mips/powertv/powertv-clock.h
deleted file mode 100644
index d94c54311485..000000000000
--- a/arch/mips/powertv/powertv-clock.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright (C) 2009 Cisco Systems, 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 * 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 St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 * Author: David VomLehn
19 */
20
21#ifndef _POWERTV_POWERTV_CLOCK_H
22#define _POWERTV_POWERTV_CLOCK_H
23extern int powertv_clockevent_init(void);
24extern void powertv_clocksource_init(void);
25extern unsigned int mips_get_pll_freq(void);
26#endif
diff --git a/arch/mips/powertv/powertv-usb.c b/arch/mips/powertv/powertv-usb.c
deleted file mode 100644
index d845eace58e9..000000000000
--- a/arch/mips/powertv/powertv-usb.c
+++ /dev/null
@@ -1,404 +0,0 @@
1/*
2 * powertv-usb.c
3 *
4 * Description: ASIC-specific USB device setup and shutdown
5 *
6 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
7 * Copyright (C) 2009 Cisco Systems, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 *
23 * Author: Ken Eppinett
24 * David Schleef <ds@schleef.org>
25 *
26 * NOTE: The bootloader allocates persistent memory at an address which is
27 * 16 MiB below the end of the highest address in KSEG0. All fixed
28 * address memory reservations must avoid this region.
29 */
30
31#include <linux/kernel.h>
32#include <linux/export.h>
33#include <linux/ioport.h>
34#include <linux/platform_device.h>
35#include <asm/mach-powertv/asic.h>
36#include <asm/mach-powertv/interrupts.h>
37
38/* misc_clk_ctl1 values */
39#define MCC1_30MHZ_POWERUP_SELECT (1 << 14)
40#define MCC1_DIV9 (1 << 13)
41#define MCC1_ETHMIPS_POWERUP_SELECT (1 << 11)
42#define MCC1_USB_POWERUP_SELECT (1 << 1)
43#define MCC1_CLOCK108_POWERUP_SELECT (1 << 0)
44
45/* Possible values for clock select */
46#define MCC1_USB_CLOCK_HIGH_Z (0 << 4)
47#define MCC1_USB_CLOCK_48MHZ (1 << 4)
48#define MCC1_USB_CLOCK_24MHZ (2 << 4)
49#define MCC1_USB_CLOCK_6MHZ (3 << 4)
50
51#define MCC1_CONFIG (MCC1_30MHZ_POWERUP_SELECT | \
52 MCC1_DIV9 | \
53 MCC1_ETHMIPS_POWERUP_SELECT | \
54 MCC1_USB_POWERUP_SELECT | \
55 MCC1_CLOCK108_POWERUP_SELECT)
56
57/* misc_clk_ctl2 values */
58#define MCC2_GMII_GCLK_TO_PAD (1 << 31)
59#define MCC2_ETHER125_0_CLOCK_SELECT (1 << 29)
60#define MCC2_RMII_0_CLOCK_SELECT (1 << 28)
61#define MCC2_GMII_TX0_CLOCK_SELECT (1 << 27)
62#define MCC2_GMII_RX0_CLOCK_SELECT (1 << 26)
63#define MCC2_ETHER125_1_CLOCK_SELECT (1 << 24)
64#define MCC2_RMII_1_CLOCK_SELECT (1 << 23)
65#define MCC2_GMII_TX1_CLOCK_SELECT (1 << 22)
66#define MCC2_GMII_RX1_CLOCK_SELECT (1 << 21)
67#define MCC2_ETHER125_2_CLOCK_SELECT (1 << 19)
68#define MCC2_RMII_2_CLOCK_SELECT (1 << 18)
69#define MCC2_GMII_TX2_CLOCK_SELECT (1 << 17)
70#define MCC2_GMII_RX2_CLOCK_SELECT (1 << 16)
71
72#define ETHER_CLK_CONFIG (MCC2_GMII_GCLK_TO_PAD | \
73 MCC2_ETHER125_0_CLOCK_SELECT | \
74 MCC2_RMII_0_CLOCK_SELECT | \
75 MCC2_GMII_TX0_CLOCK_SELECT | \
76 MCC2_GMII_RX0_CLOCK_SELECT | \
77 MCC2_ETHER125_1_CLOCK_SELECT | \
78 MCC2_RMII_1_CLOCK_SELECT | \
79 MCC2_GMII_TX1_CLOCK_SELECT | \
80 MCC2_GMII_RX1_CLOCK_SELECT | \
81 MCC2_ETHER125_2_CLOCK_SELECT | \
82 MCC2_RMII_2_CLOCK_SELECT | \
83 MCC2_GMII_TX2_CLOCK_SELECT | \
84 MCC2_GMII_RX2_CLOCK_SELECT)
85
86/* misc_clk_ctl2 definitions for Gaia */
87#define FSX4A_REF_SELECT (1 << 16)
88#define FSX4B_REF_SELECT (1 << 17)
89#define FSX4C_REF_SELECT (1 << 18)
90#define DDR_PLL_REF_SELECT (1 << 19)
91#define MIPS_PLL_REF_SELECT (1 << 20)
92
93/* Definitions for the QAM frequency select register FS432X4A4_QAM_CTL */
94#define QAM_FS_SDIV_SHIFT 29
95#define QAM_FS_MD_SHIFT 24
96#define QAM_FS_MD_MASK 0x1f /* Cut down to 5 bits */
97#define QAM_FS_PE_SHIFT 8
98
99#define QAM_FS_DISABLE_DIVIDE_BY_3 (1 << 5)
100#define QAM_FS_ENABLE_PROGRAM (1 << 4)
101#define QAM_FS_ENABLE_OUTPUT (1 << 3)
102#define QAM_FS_SELECT_TEST_BYPASS (1 << 2)
103#define QAM_FS_DISABLE_DIGITAL_STANDBY (1 << 1)
104#define QAM_FS_CHOOSE_FS (1 << 0)
105
106/* Definitions for fs432x4a_ctl register */
107#define QAM_FS_NSDIV_54MHZ (1 << 2)
108
109/* Definitions for bcm1_usb2_ctl register */
110#define BCM1_USB2_CTL_BISTOK (1 << 11)
111#define BCM1_USB2_CTL_PORT2_SHIFT_JK (1 << 7)
112#define BCM1_USB2_CTL_PORT1_SHIFT_JK (1 << 6)
113#define BCM1_USB2_CTL_PORT2_FAST_EDGE (1 << 5)
114#define BCM1_USB2_CTL_PORT1_FAST_EDGE (1 << 4)
115#define BCM1_USB2_CTL_EHCI_PRT_PWR_ACTIVE_HIGH (1 << 1)
116#define BCM1_USB2_CTL_APP_PRT_OVRCUR_IN_ACTIVE_HIGH (1 << 0)
117
118/* Definitions for crt_spare register */
119#define CRT_SPARE_PORT2_SHIFT_JK (1 << 21)
120#define CRT_SPARE_PORT1_SHIFT_JK (1 << 20)
121#define CRT_SPARE_PORT2_FAST_EDGE (1 << 19)
122#define CRT_SPARE_PORT1_FAST_EDGE (1 << 18)
123#define CRT_SPARE_DIVIDE_BY_9_FROM_432 (1 << 17)
124#define CRT_SPARE_USB_DIVIDE_BY_9 (1 << 16)
125
126/* Definitions for usb2_stbus_obc register */
127#define USB_STBUS_OBC_STORE32_LOAD32 0x3
128
129/* Definitions for usb2_stbus_mess_size register */
130#define USB2_STBUS_MESS_SIZE_2 0x1 /* 2 packets */
131
132/* Definitions for usb2_stbus_chunk_size register */
133#define USB2_STBUS_CHUNK_SIZE_2 0x1 /* 2 packets */
134
135/* Definitions for usb2_strap register */
136#define USB2_STRAP_HFREQ_SELECT 0x1
137
138/*
139 * USB Host Resource Definition
140 */
141
142static struct resource ehci_resources[] = {
143 {
144 .parent = &asic_resource,
145 .start = 0,
146 .end = 0xff,
147 .flags = IORESOURCE_MEM,
148 },
149 {
150 .start = irq_usbehci,
151 .end = irq_usbehci,
152 .flags = IORESOURCE_IRQ,
153 },
154};
155
156static u64 ehci_dmamask = 0xffffffffULL;
157
158static struct platform_device ehci_device = {
159 .name = "powertv-ehci",
160 .id = 0,
161 .num_resources = 2,
162 .resource = ehci_resources,
163 .dev = {
164 .dma_mask = &ehci_dmamask,
165 .coherent_dma_mask = 0xffffffff,
166 },
167};
168
169static struct resource ohci_resources[] = {
170 {
171 .parent = &asic_resource,
172 .start = 0,
173 .end = 0xff,
174 .flags = IORESOURCE_MEM,
175 },
176 {
177 .start = irq_usbohci,
178 .end = irq_usbohci,
179 .flags = IORESOURCE_IRQ,
180 },
181};
182
183static u64 ohci_dmamask = 0xffffffffULL;
184
185static struct platform_device ohci_device = {
186 .name = "powertv-ohci",
187 .id = 0,
188 .num_resources = 2,
189 .resource = ohci_resources,
190 .dev = {
191 .dma_mask = &ohci_dmamask,
192 .coherent_dma_mask = 0xffffffff,
193 },
194};
195
196static unsigned usb_users;
197static DEFINE_SPINLOCK(usb_regs_lock);
198
199/*
200 *
201 * fs_update - set frequency synthesizer for USB
202 * @pe_bits Phase tap setting
203 * @md_bits Coarse selector bus for algorithm of phase tap
204 * @sdiv_bits Output divider setting
205 * @disable_div_by_3 Either QAM_FS_DISABLE_DIVIDE_BY_3 or zero
206 * @standby Either QAM_FS_DISABLE_DIGITAL_STANDBY or zero
207 *
208 * QAM frequency selection code, which affects the frequency at which USB
209 * runs. The frequency is calculated as:
210 * 2^15 * ndiv * Fin
211 * Fout = ------------------------------------------------------------
212 * (sdiv * (ipe * (1 + md/32) - (ipe - 2^15)*(1 + (md + 1)/32)))
213 * where:
214 * Fin 54 MHz
215 * ndiv QAM_FS_NSDIV_54MHZ ? 8 : 16
216 * sdiv 1 << (sdiv_bits + 1)
217 * ipe Same as pe_bits
218 * md A five-bit, two's-complement integer (range [-16, 15]), which
219 * is the lower 5 bits of md_bits.
220 */
221static void fs_update(u32 pe_bits, int md_bits, u32 sdiv_bits,
222 u32 disable_div_by_3, u32 standby)
223{
224 u32 val;
225
226 val = ((sdiv_bits << QAM_FS_SDIV_SHIFT) |
227 ((md_bits & QAM_FS_MD_MASK) << QAM_FS_MD_SHIFT) |
228 (pe_bits << QAM_FS_PE_SHIFT) |
229 QAM_FS_ENABLE_OUTPUT |
230 standby |
231 disable_div_by_3);
232 asic_write(val, fs432x4b4_usb_ctl);
233 asic_write(val | QAM_FS_ENABLE_PROGRAM, fs432x4b4_usb_ctl);
234 asic_write(val | QAM_FS_ENABLE_PROGRAM | QAM_FS_CHOOSE_FS,
235 fs432x4b4_usb_ctl);
236}
237
238/*
239 * usb_eye_configure - for optimizing the shape USB eye waveform
240 * @set: Bits to set in the register
241 * @clear: Bits to clear in the register; each bit with a one will
242 * be set in the register, zero bits will not be modified
243 */
244static void usb_eye_configure(u32 set, u32 clear)
245{
246 u32 old;
247
248 old = asic_read(crt_spare);
249 old |= set;
250 old &= ~clear;
251 asic_write(old, crt_spare);
252}
253
254/*
255 * platform_configure_usb - usb configuration based on platform type.
256 */
257static void platform_configure_usb(void)
258{
259 u32 bcm1_usb2_ctl_value;
260 enum asic_type asic_type;
261 unsigned long flags;
262
263 spin_lock_irqsave(&usb_regs_lock, flags);
264 usb_users++;
265
266 if (usb_users != 1) {
267 spin_unlock_irqrestore(&usb_regs_lock, flags);
268 return;
269 }
270
271 asic_type = platform_get_asic();
272
273 switch (asic_type) {
274 case ASIC_ZEUS:
275 fs_update(0x0000, -15, 0x02, 0, 0);
276 bcm1_usb2_ctl_value = BCM1_USB2_CTL_EHCI_PRT_PWR_ACTIVE_HIGH |
277 BCM1_USB2_CTL_APP_PRT_OVRCUR_IN_ACTIVE_HIGH;
278 break;
279
280 case ASIC_CRONUS:
281 case ASIC_CRONUSLITE:
282 usb_eye_configure(0, CRT_SPARE_USB_DIVIDE_BY_9);
283 fs_update(0x8000, -14, 0x03, QAM_FS_DISABLE_DIVIDE_BY_3,
284 QAM_FS_DISABLE_DIGITAL_STANDBY);
285 bcm1_usb2_ctl_value = BCM1_USB2_CTL_EHCI_PRT_PWR_ACTIVE_HIGH |
286 BCM1_USB2_CTL_APP_PRT_OVRCUR_IN_ACTIVE_HIGH;
287 break;
288
289 case ASIC_CALLIOPE:
290 fs_update(0x0000, -15, 0x02, QAM_FS_DISABLE_DIVIDE_BY_3,
291 QAM_FS_DISABLE_DIGITAL_STANDBY);
292
293 switch (platform_get_family()) {
294 case FAMILY_1500VZE:
295 break;
296
297 case FAMILY_1500VZF:
298 usb_eye_configure(CRT_SPARE_PORT2_SHIFT_JK |
299 CRT_SPARE_PORT1_SHIFT_JK |
300 CRT_SPARE_PORT2_FAST_EDGE |
301 CRT_SPARE_PORT1_FAST_EDGE, 0);
302 break;
303
304 default:
305 usb_eye_configure(CRT_SPARE_PORT2_SHIFT_JK |
306 CRT_SPARE_PORT1_SHIFT_JK, 0);
307 break;
308 }
309
310 bcm1_usb2_ctl_value = BCM1_USB2_CTL_BISTOK |
311 BCM1_USB2_CTL_EHCI_PRT_PWR_ACTIVE_HIGH |
312 BCM1_USB2_CTL_APP_PRT_OVRCUR_IN_ACTIVE_HIGH;
313 break;
314
315 case ASIC_GAIA:
316 fs_update(0x8000, -14, 0x03, QAM_FS_DISABLE_DIVIDE_BY_3,
317 QAM_FS_DISABLE_DIGITAL_STANDBY);
318 bcm1_usb2_ctl_value = BCM1_USB2_CTL_BISTOK |
319 BCM1_USB2_CTL_EHCI_PRT_PWR_ACTIVE_HIGH |
320 BCM1_USB2_CTL_APP_PRT_OVRCUR_IN_ACTIVE_HIGH;
321 break;
322
323 default:
324 pr_err("Unknown ASIC type: %d\n", asic_type);
325 bcm1_usb2_ctl_value = 0;
326 break;
327 }
328
329 /* turn on USB power */
330 asic_write(0, usb2_strap);
331 /* Enable all OHCI interrupts */
332 asic_write(bcm1_usb2_ctl_value, usb2_control);
333 /* usb2_stbus_obc store32/load32 */
334 asic_write(USB_STBUS_OBC_STORE32_LOAD32, usb2_stbus_obc);
335 /* usb2_stbus_mess_size 2 packets */
336 asic_write(USB2_STBUS_MESS_SIZE_2, usb2_stbus_mess_size);
337 /* usb2_stbus_chunk_size 2 packets */
338 asic_write(USB2_STBUS_CHUNK_SIZE_2, usb2_stbus_chunk_size);
339 spin_unlock_irqrestore(&usb_regs_lock, flags);
340}
341
342static void platform_unconfigure_usb(void)
343{
344 unsigned long flags;
345
346 spin_lock_irqsave(&usb_regs_lock, flags);
347 usb_users--;
348 if (usb_users == 0)
349 asic_write(USB2_STRAP_HFREQ_SELECT, usb2_strap);
350 spin_unlock_irqrestore(&usb_regs_lock, flags);
351}
352
353/*
354 * Set up the USB EHCI interface
355 */
356void platform_configure_usb_ehci()
357{
358 platform_configure_usb();
359}
360EXPORT_SYMBOL(platform_configure_usb_ehci);
361
362/*
363 * Set up the USB OHCI interface
364 */
365void platform_configure_usb_ohci()
366{
367 platform_configure_usb();
368}
369EXPORT_SYMBOL(platform_configure_usb_ohci);
370
371/*
372 * Shut the USB EHCI interface down
373 */
374void platform_unconfigure_usb_ehci()
375{
376 platform_unconfigure_usb();
377}
378EXPORT_SYMBOL(platform_unconfigure_usb_ehci);
379
380/*
381 * Shut the USB OHCI interface down
382 */
383void platform_unconfigure_usb_ohci()
384{
385 platform_unconfigure_usb();
386}
387EXPORT_SYMBOL(platform_unconfigure_usb_ohci);
388
389/**
390 * platform_devices_init - sets up USB device resourse.
391 */
392int __init platform_usb_devices_init(struct platform_device **ehci_dev,
393 struct platform_device **ohci_dev)
394{
395 *ehci_dev = &ehci_device;
396 ehci_resources[0].start = asic_reg_phys_addr(ehci_hcapbase);
397 ehci_resources[0].end += ehci_resources[0].start;
398
399 *ohci_dev = &ohci_device;
400 ohci_resources[0].start = asic_reg_phys_addr(ohci_hc_revision);
401 ohci_resources[0].end += ohci_resources[0].start;
402
403 return 0;
404}
diff --git a/arch/mips/powertv/powertv_setup.c b/arch/mips/powertv/powertv_setup.c
deleted file mode 100644
index 24689bff1039..000000000000
--- a/arch/mips/powertv/powertv_setup.c
+++ /dev/null
@@ -1,319 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 * Portions copyright (C) 2009 Cisco Systems, Inc.
5 *
6 * This program is free software; you can distribute it and/or modify it
7 * under the terms of the GNU General Public License (Version 2) as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18 */
19#include <linux/init.h>
20#include <linux/sched.h>
21#include <linux/ioport.h>
22#include <linux/pci.h>
23#include <linux/screen_info.h>
24#include <linux/notifier.h>
25#include <linux/etherdevice.h>
26#include <linux/if_ether.h>
27#include <linux/ctype.h>
28#include <linux/cpu.h>
29#include <linux/time.h>
30
31#include <asm/bootinfo.h>
32#include <asm/irq.h>
33#include <asm/mips-boards/generic.h>
34#include <asm/dma.h>
35#include <asm/asm.h>
36#include <asm/traps.h>
37#include <asm/asm-offsets.h>
38#include "reset.h"
39
40#define VAL(n) STR(n)
41
42/*
43 * Macros for loading addresses and storing registers:
44 * LONG_L_ Stringified version of LONG_L for use in asm() statement
45 * LONG_S_ Stringified version of LONG_S for use in asm() statement
46 * PTR_LA_ Stringified version of PTR_LA for use in asm() statement
47 * REG_SIZE Number of 8-bit bytes in a full width register
48 */
49#define LONG_L_ VAL(LONG_L) " "
50#define LONG_S_ VAL(LONG_S) " "
51#define PTR_LA_ VAL(PTR_LA) " "
52
53#ifdef CONFIG_64BIT
54#warning TODO: 64-bit code needs to be verified
55#define REG_SIZE "8" /* In bytes */
56#endif
57
58#ifdef CONFIG_32BIT
59#define REG_SIZE "4" /* In bytes */
60#endif
61
62static void register_panic_notifier(void);
63static int panic_handler(struct notifier_block *notifier_block,
64 unsigned long event, void *cause_string);
65
66const char *get_system_type(void)
67{
68 return "PowerTV";
69}
70
71void __init plat_mem_setup(void)
72{
73 panic_on_oops = 1;
74 register_panic_notifier();
75
76#if 0
77 mips_pcibios_init();
78#endif
79 mips_reboot_setup();
80}
81
82/*
83 * Install a panic notifier for platform-specific diagnostics
84 */
85static void register_panic_notifier()
86{
87 static struct notifier_block panic_notifier = {
88 .notifier_call = panic_handler,
89 .next = NULL,
90 .priority = INT_MAX
91 };
92 atomic_notifier_chain_register(&panic_notifier_list, &panic_notifier);
93}
94
95static int panic_handler(struct notifier_block *notifier_block,
96 unsigned long event, void *cause_string)
97{
98 struct pt_regs my_regs;
99
100 /* Save all of the registers */
101 {
102 unsigned long at, v0, v1; /* Must be on the stack */
103
104 /* Start by saving $at and v0 on the stack. We use $at
105 * ourselves, but it looks like the compiler may use v0 or v1
106 * to load the address of the pt_regs structure. We'll come
107 * back later to store the registers in the pt_regs
108 * structure. */
109 __asm__ __volatile__ (
110 ".set noat\n"
111 LONG_S_ "$at, %[at]\n"
112 LONG_S_ "$2, %[v0]\n"
113 LONG_S_ "$3, %[v1]\n"
114 :
115 [at] "=m" (at),
116 [v0] "=m" (v0),
117 [v1] "=m" (v1)
118 :
119 : "at"
120 );
121
122 __asm__ __volatile__ (
123 ".set noat\n"
124 "move $at, %[pt_regs]\n"
125
126 /* Argument registers */
127 LONG_S_ "$4, " VAL(PT_R4) "($at)\n"
128 LONG_S_ "$5, " VAL(PT_R5) "($at)\n"
129 LONG_S_ "$6, " VAL(PT_R6) "($at)\n"
130 LONG_S_ "$7, " VAL(PT_R7) "($at)\n"
131
132 /* Temporary regs */
133 LONG_S_ "$8, " VAL(PT_R8) "($at)\n"
134 LONG_S_ "$9, " VAL(PT_R9) "($at)\n"
135 LONG_S_ "$10, " VAL(PT_R10) "($at)\n"
136 LONG_S_ "$11, " VAL(PT_R11) "($at)\n"
137 LONG_S_ "$12, " VAL(PT_R12) "($at)\n"
138 LONG_S_ "$13, " VAL(PT_R13) "($at)\n"
139 LONG_S_ "$14, " VAL(PT_R14) "($at)\n"
140 LONG_S_ "$15, " VAL(PT_R15) "($at)\n"
141
142 /* "Saved" registers */
143 LONG_S_ "$16, " VAL(PT_R16) "($at)\n"
144 LONG_S_ "$17, " VAL(PT_R17) "($at)\n"
145 LONG_S_ "$18, " VAL(PT_R18) "($at)\n"
146 LONG_S_ "$19, " VAL(PT_R19) "($at)\n"
147 LONG_S_ "$20, " VAL(PT_R20) "($at)\n"
148 LONG_S_ "$21, " VAL(PT_R21) "($at)\n"
149 LONG_S_ "$22, " VAL(PT_R22) "($at)\n"
150 LONG_S_ "$23, " VAL(PT_R23) "($at)\n"
151
152 /* Add'l temp regs */
153 LONG_S_ "$24, " VAL(PT_R24) "($at)\n"
154 LONG_S_ "$25, " VAL(PT_R25) "($at)\n"
155
156 /* Kernel temp regs */
157 LONG_S_ "$26, " VAL(PT_R26) "($at)\n"
158 LONG_S_ "$27, " VAL(PT_R27) "($at)\n"
159
160 /* Global pointer, stack pointer, frame pointer and
161 * return address */
162 LONG_S_ "$gp, " VAL(PT_R28) "($at)\n"
163 LONG_S_ "$sp, " VAL(PT_R29) "($at)\n"
164 LONG_S_ "$fp, " VAL(PT_R30) "($at)\n"
165 LONG_S_ "$ra, " VAL(PT_R31) "($at)\n"
166
167 /* Now we can get the $at and v0 registers back and
168 * store them */
169 LONG_L_ "$8, %[at]\n"
170 LONG_S_ "$8, " VAL(PT_R1) "($at)\n"
171 LONG_L_ "$8, %[v0]\n"
172 LONG_S_ "$8, " VAL(PT_R2) "($at)\n"
173 LONG_L_ "$8, %[v1]\n"
174 LONG_S_ "$8, " VAL(PT_R3) "($at)\n"
175 :
176 :
177 [at] "m" (at),
178 [v0] "m" (v0),
179 [v1] "m" (v1),
180 [pt_regs] "r" (&my_regs)
181 : "at", "t0"
182 );
183
184 /* Set the current EPC value to be the current location in this
185 * function */
186 __asm__ __volatile__ (
187 ".set noat\n"
188 "1:\n"
189 PTR_LA_ "$at, 1b\n"
190 LONG_S_ "$at, %[cp0_epc]\n"
191 :
192 [cp0_epc] "=m" (my_regs.cp0_epc)
193 :
194 : "at"
195 );
196
197 my_regs.cp0_cause = read_c0_cause();
198 my_regs.cp0_status = read_c0_status();
199 }
200
201 pr_crit("I'm feeling a bit sleepy. hmmmmm... perhaps a nap would... "
202 "zzzz... \n");
203
204 return NOTIFY_DONE;
205}
206
207/* Information about the RF MAC address, if one was supplied on the
208 * command line. */
209static bool have_rfmac;
210static u8 rfmac[ETH_ALEN];
211
212static int rfmac_param(char *p)
213{
214 u8 *q;
215 bool is_high_nibble;
216 int c;
217
218 /* Skip a leading "0x", if present */
219 if (*p == '0' && *(p+1) == 'x')
220 p += 2;
221
222 q = rfmac;
223 is_high_nibble = true;
224
225 for (c = (unsigned char) *p++;
226 isxdigit(c) && q - rfmac < ETH_ALEN;
227 c = (unsigned char) *p++) {
228 int nibble;
229
230 nibble = (isdigit(c) ? (c - '0') :
231 (isupper(c) ? c - 'A' + 10 : c - 'a' + 10));
232
233 if (is_high_nibble)
234 *q = nibble << 4;
235 else
236 *q++ |= nibble;
237
238 is_high_nibble = !is_high_nibble;
239 }
240
241 /* If we parsed all the way to the end of the parameter value and
242 * parsed all ETH_ALEN bytes, we have a usable RF MAC address */
243 have_rfmac = (c == '\0' && q - rfmac == ETH_ALEN);
244
245 return 0;
246}
247
248early_param("rfmac", rfmac_param);
249
250/*
251 * Generate an Ethernet MAC address that has a good chance of being unique.
252 * @addr: Pointer to six-byte array containing the Ethernet address
253 * Generates an Ethernet MAC address that is highly likely to be unique for
254 * this particular system on a network with other systems of the same type.
255 *
256 * The problem we are solving is that, when eth_random_addr() is used to
257 * generate MAC addresses at startup, there isn't much entropy for the random
258 * number generator to use and the addresses it produces are fairly likely to
259 * be the same as those of other identical systems on the same local network.
260 * This is true even for relatively small numbers of systems (for the reason
261 * why, see the Wikipedia entry for "Birthday problem" at:
262 * http://en.wikipedia.org/wiki/Birthday_problem
263 *
264 * The good news is that we already have a MAC address known to be unique, the
265 * RF MAC address. The bad news is that this address is already in use on the
266 * RF interface. Worse, the obvious trick, taking the RF MAC address and
267 * turning on the locally managed bit, has already been used for other devices.
268 * Still, this does give us something to work with.
269 *
270 * The approach we take is:
271 * 1. If we can't get the RF MAC Address, just call eth_random_addr.
272 * 2. Use the 24-bit NIC-specific bits of the RF MAC address as the last 24
273 * bits of the new address. This is very likely to be unique, except for
274 * the current box.
275 * 3. To avoid using addresses already on the current box, we set the top
276 * six bits of the address with a value different from any currently
277 * registered Scientific Atlanta organizationally unique identifyer
278 * (OUI). This avoids duplication with any addresses on the system that
279 * were generated from valid Scientific Atlanta-registered address by
280 * simply flipping the locally managed bit.
281 * 4. We aren't generating a multicast address, so we leave the multicast
282 * bit off. Since we aren't using a registered address, we have to set
283 * the locally managed bit.
284 * 5. We then randomly generate the remaining 16-bits. This does two
285 * things:
286 * a. It allows us to call this function for more than one device
287 * in this system
288 * b. It ensures that things will probably still work even if
289 * some device on the device network has a locally managed
290 * address that matches the top six bits from step 2.
291 */
292void platform_random_ether_addr(u8 addr[ETH_ALEN])
293{
294 const int num_random_bytes = 2;
295 const unsigned char non_sciatl_oui_bits = 0xc0u;
296 const unsigned char mac_addr_locally_managed = (1 << 1);
297
298 if (!have_rfmac) {
299 pr_warning("rfmac not available on command line; "
300 "generating random MAC address\n");
301 eth_random_addr(addr);
302 }
303
304 else {
305 int i;
306
307 /* Set the first byte to something that won't match a Scientific
308 * Atlanta OUI, is locally managed, and isn't a multicast
309 * address */
310 addr[0] = non_sciatl_oui_bits | mac_addr_locally_managed;
311
312 /* Get some bytes of random address information */
313 get_random_bytes(&addr[1], num_random_bytes);
314
315 /* Copy over the NIC-specific bits of the RF MAC address */
316 for (i = 1 + num_random_bytes; i < ETH_ALEN; i++)
317 addr[i] = rfmac[i];
318 }
319}
diff --git a/arch/mips/powertv/reset.c b/arch/mips/powertv/reset.c
deleted file mode 100644
index 11c32fbf2784..000000000000
--- a/arch/mips/powertv/reset.c
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 * Portions copyright (C) 2009 Cisco Systems, Inc.
5 *
6 * This program is free software; you can distribute it and/or modify it
7 * under the terms of the GNU General Public License (Version 2) as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18 */
19#include <linux/pm.h>
20
21#include <linux/io.h>
22#include <asm/reboot.h> /* Not included by linux/reboot.h */
23
24#include <asm/mach-powertv/asic_regs.h>
25#include "reset.h"
26
27static void mips_machine_restart(char *command)
28{
29 writel(0x1, asic_reg_addr(watchdog));
30}
31
32void mips_reboot_setup(void)
33{
34 _machine_restart = mips_machine_restart;
35}
diff --git a/arch/mips/powertv/reset.h b/arch/mips/powertv/reset.h
deleted file mode 100644
index 888fd09e2620..000000000000
--- a/arch/mips/powertv/reset.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Definitions from powertv reset.c file
3 *
4 * Copyright (C) 2009 Cisco Systems, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: David VomLehn
21 */
22
23#ifndef _POWERTV_POWERTV_RESET_H
24#define _POWERTV_POWERTV_RESET_H
25extern void mips_reboot_setup(void);
26#endif
diff --git a/arch/mips/powertv/time.c b/arch/mips/powertv/time.c
deleted file mode 100644
index f38b0d45eca9..000000000000
--- a/arch/mips/powertv/time.c
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 * Portions copyright (C) 2009 Cisco Systems, Inc.
5 *
6 * This program is free software; you can distribute it and/or modify it
7 * under the terms of the GNU General Public License (Version 2) as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18 *
19 * Setting up the clock on the MIPS boards.
20 */
21
22#include <linux/init.h>
23#include <asm/mach-powertv/interrupts.h>
24#include <asm/time.h>
25
26#include "powertv-clock.h"
27
28unsigned int get_c0_compare_int(void)
29{
30 return irq_mips_timer;
31}
32
33void __init plat_time_init(void)
34{
35 powertv_clocksource_init();
36}
diff --git a/arch/mips/ralink/clk.c b/arch/mips/ralink/clk.c
index bba0cdfd83bc..5d0983d47161 100644
--- a/arch/mips/ralink/clk.c
+++ b/arch/mips/ralink/clk.c
@@ -26,7 +26,7 @@ void ralink_clk_add(const char *dev, unsigned long rate)
26 struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL); 26 struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
27 27
28 if (!clk) 28 if (!clk)
29 panic("failed to add clock\n"); 29 panic("failed to add clock");
30 30
31 clk->cl.dev_id = dev; 31 clk->cl.dev_id = dev;
32 clk->cl.clk = clk; 32 clk->cl.clk = clk;
diff --git a/arch/mips/ralink/mt7620.c b/arch/mips/ralink/mt7620.c
index d217509e5300..a3ad56c2372d 100644
--- a/arch/mips/ralink/mt7620.c
+++ b/arch/mips/ralink/mt7620.c
@@ -350,7 +350,7 @@ void prom_soc_init(struct ralink_soc_info *soc_info)
350 name = "MT7620A"; 350 name = "MT7620A";
351 soc_info->compatible = "ralink,mt7620a-soc"; 351 soc_info->compatible = "ralink,mt7620a-soc";
352 } else { 352 } else {
353 panic("mt7620: unknown SoC, n0:%08x n1:%08x\n", n0, n1); 353 panic("mt7620: unknown SoC, n0:%08x n1:%08x", n0, n1);
354 } 354 }
355 355
356 rev = __raw_readl(sysc + SYSC_REG_CHIP_REV); 356 rev = __raw_readl(sysc + SYSC_REG_CHIP_REV);
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index ce38d11f9da5..eccc5526155e 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -21,6 +21,7 @@
21#include <asm/reboot.h> 21#include <asm/reboot.h>
22#include <asm/bootinfo.h> 22#include <asm/bootinfo.h>
23#include <asm/addrspace.h> 23#include <asm/addrspace.h>
24#include <asm/prom.h>
24 25
25#include "common.h" 26#include "common.h"
26 27
@@ -108,7 +109,7 @@ static int __init plat_of_setup(void)
108 strncpy(of_ids[1].compatible, "palmbus", len); 109 strncpy(of_ids[1].compatible, "palmbus", len);
109 110
110 if (of_platform_populate(NULL, of_ids, NULL, NULL)) 111 if (of_platform_populate(NULL, of_ids, NULL, NULL))
111 panic("failed to populate DT\n"); 112 panic("failed to populate DT");
112 113
113 /* make sure ithat the reset controller is setup early */ 114 /* make sure ithat the reset controller is setup early */
114 ralink_rst_init(); 115 ralink_rst_init();
diff --git a/arch/mips/ralink/rt305x.c b/arch/mips/ralink/rt305x.c
index ca7ee3a33790..bb82a82da9e7 100644
--- a/arch/mips/ralink/rt305x.c
+++ b/arch/mips/ralink/rt305x.c
@@ -276,7 +276,7 @@ void prom_soc_init(struct ralink_soc_info *soc_info)
276 name = "RT5350"; 276 name = "RT5350";
277 soc_info->compatible = "ralink,rt5350-soc"; 277 soc_info->compatible = "ralink,rt5350-soc";
278 } else { 278 } else {
279 panic("rt305x: unknown SoC, n0:%08x n1:%08x\n", n0, n1); 279 panic("rt305x: unknown SoC, n0:%08x n1:%08x", n0, n1);
280 } 280 }
281 281
282 id = __raw_readl(sysc + SYSC_REG_CHIP_ID); 282 id = __raw_readl(sysc + SYSC_REG_CHIP_ID);
diff --git a/arch/mips/ralink/timer.c b/arch/mips/ralink/timer.c
index e49241a2c39a..202785709441 100644
--- a/arch/mips/ralink/timer.c
+++ b/arch/mips/ralink/timer.c
@@ -126,7 +126,7 @@ static int rt_timer_probe(struct platform_device *pdev)
126 return -ENOENT; 126 return -ENOENT;
127 } 127 }
128 128
129 rt->membase = devm_request_and_ioremap(&pdev->dev, res); 129 rt->membase = devm_ioremap_resource(&pdev->dev, res);
130 if (IS_ERR(rt->membase)) 130 if (IS_ERR(rt->membase))
131 return PTR_ERR(rt->membase); 131 return PTR_ERR(rt->membase);
132 132
diff --git a/arch/mips/sibyte/bcm1480/setup.c b/arch/mips/sibyte/bcm1480/setup.c
index 05ed92c92b69..8e2e04f77870 100644
--- a/arch/mips/sibyte/bcm1480/setup.c
+++ b/arch/mips/sibyte/bcm1480/setup.c
@@ -22,6 +22,7 @@
22#include <linux/string.h> 22#include <linux/string.h>
23 23
24#include <asm/bootinfo.h> 24#include <asm/bootinfo.h>
25#include <asm/cpu.h>
25#include <asm/mipsregs.h> 26#include <asm/mipsregs.h>
26#include <asm/io.h> 27#include <asm/io.h>
27#include <asm/sibyte/sb1250.h> 28#include <asm/sibyte/sb1250.h>
@@ -119,7 +120,7 @@ void __init bcm1480_setup(void)
119 uint64_t sys_rev; 120 uint64_t sys_rev;
120 int plldiv; 121 int plldiv;
121 122
122 sb1_pass = read_c0_prid() & 0xff; 123 sb1_pass = read_c0_prid() & PRID_REV_MASK;
123 sys_rev = __raw_readq(IOADDR(A_SCD_SYSTEM_REVISION)); 124 sys_rev = __raw_readq(IOADDR(A_SCD_SYSTEM_REVISION));
124 soc_type = SYS_SOC_TYPE(sys_rev); 125 soc_type = SYS_SOC_TYPE(sys_rev);
125 part_type = G_SYS_PART(sys_rev); 126 part_type = G_SYS_PART(sys_rev);
diff --git a/arch/mips/sibyte/sb1250/setup.c b/arch/mips/sibyte/sb1250/setup.c
index a14bd4cb0bc0..3c02b2a77ae9 100644
--- a/arch/mips/sibyte/sb1250/setup.c
+++ b/arch/mips/sibyte/sb1250/setup.c
@@ -22,6 +22,7 @@
22#include <linux/string.h> 22#include <linux/string.h>
23 23
24#include <asm/bootinfo.h> 24#include <asm/bootinfo.h>
25#include <asm/cpu.h>
25#include <asm/mipsregs.h> 26#include <asm/mipsregs.h>
26#include <asm/io.h> 27#include <asm/io.h>
27#include <asm/sibyte/sb1250.h> 28#include <asm/sibyte/sb1250.h>
@@ -182,7 +183,7 @@ void __init sb1250_setup(void)
182 int plldiv; 183 int plldiv;
183 int bad_config = 0; 184 int bad_config = 0;
184 185
185 sb1_pass = read_c0_prid() & 0xff; 186 sb1_pass = read_c0_prid() & PRID_REV_MASK;
186 sys_rev = __raw_readq(IOADDR(A_SCD_SYSTEM_REVISION)); 187 sys_rev = __raw_readq(IOADDR(A_SCD_SYSTEM_REVISION));
187 soc_type = SYS_SOC_TYPE(sys_rev); 188 soc_type = SYS_SOC_TYPE(sys_rev);
188 soc_pass = G_SYS_REVISION(sys_rev); 189 soc_pass = G_SYS_REVISION(sys_rev);
diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c
index 5b09b3544edd..efad85c8c823 100644
--- a/arch/mips/sni/setup.c
+++ b/arch/mips/sni/setup.c
@@ -25,6 +25,7 @@
25#endif 25#endif
26 26
27#include <asm/bootinfo.h> 27#include <asm/bootinfo.h>
28#include <asm/cpu.h>
28#include <asm/io.h> 29#include <asm/io.h>
29#include <asm/reboot.h> 30#include <asm/reboot.h>
30#include <asm/sni.h> 31#include <asm/sni.h>
@@ -173,7 +174,7 @@ void __init plat_mem_setup(void)
173 system_type = "RM300-Cxx"; 174 system_type = "RM300-Cxx";
174 break; 175 break;
175 case SNI_BRD_PCI_DESKTOP: 176 case SNI_BRD_PCI_DESKTOP:
176 switch (read_c0_prid() & 0xff00) { 177 switch (read_c0_prid() & PRID_IMP_MASK) {
177 case PRID_IMP_R4600: 178 case PRID_IMP_R4600:
178 case PRID_IMP_R4700: 179 case PRID_IMP_R4700:
179 system_type = "RM200-C20"; 180 system_type = "RM200-C20";
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 6aaa1607001a..8bde9237d13b 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -181,7 +181,6 @@ endmenu
181config SMP 181config SMP
182 bool "Symmetric multi-processing support" 182 bool "Symmetric multi-processing support"
183 default y 183 default y
184 select USE_GENERIC_SMP_HELPERS
185 depends on MN10300_PROC_MN2WS0038 || MN10300_PROC_MN2WS0050 184 depends on MN10300_PROC_MN2WS0038 || MN10300_PROC_MN2WS0050
186 ---help--- 185 ---help---
187 This enables support for systems with more than one CPU. If you have 186 This enables support for systems with more than one CPU. If you have
diff --git a/arch/mn10300/include/asm/Kbuild b/arch/mn10300/include/asm/Kbuild
index c5d767028306..74742dc6a3da 100644
--- a/arch/mn10300/include/asm/Kbuild
+++ b/arch/mn10300/include/asm/Kbuild
@@ -2,3 +2,4 @@
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += exec.h 3generic-y += exec.h
4generic-y += trace_clock.h 4generic-y += trace_clock.h
5generic-y += preempt.h
diff --git a/arch/mn10300/include/asm/pci.h b/arch/mn10300/include/asm/pci.h
index 6f31cc0f1a87..166323824683 100644
--- a/arch/mn10300/include/asm/pci.h
+++ b/arch/mn10300/include/asm/pci.h
@@ -44,7 +44,6 @@ extern void unit_pci_init(void);
44#define pcibios_assign_all_busses() 0 44#define pcibios_assign_all_busses() 0
45#endif 45#endif
46 46
47extern unsigned long pci_mem_start;
48#define PCIBIOS_MIN_IO 0xBE000004 47#define PCIBIOS_MIN_IO 0xBE000004
49#define PCIBIOS_MIN_MEM 0xB8000000 48#define PCIBIOS_MIN_MEM 0xB8000000
50 49
diff --git a/arch/mn10300/include/asm/pgalloc.h b/arch/mn10300/include/asm/pgalloc.h
index 146bacf193ea..0f25d5fa86f3 100644
--- a/arch/mn10300/include/asm/pgalloc.h
+++ b/arch/mn10300/include/asm/pgalloc.h
@@ -46,6 +46,7 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
46 46
47static inline void pte_free(struct mm_struct *mm, struct page *pte) 47static inline void pte_free(struct mm_struct *mm, struct page *pte)
48{ 48{
49 pgtable_page_dtor(pte);
49 __free_page(pte); 50 __free_page(pte);
50} 51}
51 52
diff --git a/arch/mn10300/include/uapi/asm/socket.h b/arch/mn10300/include/uapi/asm/socket.h
index e2a2b203eb00..71dedcae55a6 100644
--- a/arch/mn10300/include/uapi/asm/socket.h
+++ b/arch/mn10300/include/uapi/asm/socket.h
@@ -76,4 +76,6 @@
76 76
77#define SO_BUSY_POLL 46 77#define SO_BUSY_POLL 46
78 78
79#define SO_MAX_PACING_RATE 47
80
79#endif /* _ASM_SOCKET_H */ 81#endif /* _ASM_SOCKET_H */
diff --git a/arch/mn10300/kernel/setup.c b/arch/mn10300/kernel/setup.c
index ebac9c11f796..2ad7f32fa122 100644
--- a/arch/mn10300/kernel/setup.c
+++ b/arch/mn10300/kernel/setup.c
@@ -35,9 +35,6 @@
35 35
36struct mn10300_cpuinfo boot_cpu_data; 36struct mn10300_cpuinfo boot_cpu_data;
37 37
38/* For PCI or other memory-mapped resources */
39unsigned long pci_mem_start = 0x18000000;
40
41static char __initdata cmd_line[COMMAND_LINE_SIZE]; 38static char __initdata cmd_line[COMMAND_LINE_SIZE];
42char redboot_command_line[COMMAND_LINE_SIZE] = 39char redboot_command_line[COMMAND_LINE_SIZE] =
43 "console=ttyS0,115200 root=/dev/mtdblock3 rw"; 40 "console=ttyS0,115200 root=/dev/mtdblock3 rw";
diff --git a/arch/mn10300/mm/pgtable.c b/arch/mn10300/mm/pgtable.c
index bd9ada693f95..e77a7c728081 100644
--- a/arch/mn10300/mm/pgtable.c
+++ b/arch/mn10300/mm/pgtable.c
@@ -78,8 +78,13 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
78#else 78#else
79 pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0); 79 pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0);
80#endif 80#endif
81 if (pte) 81 if (!pte)
82 clear_highpage(pte); 82 return NULL;
83 clear_highpage(pte);
84 if (!pgtable_page_ctor(pte)) {
85 __free_page(pte);
86 return NULL;
87 }
83 return pte; 88 return pte;
84} 89}
85 90
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.h b/arch/mn10300/unit-asb2305/pci-asb2305.h
index 7fa66a0e4624..9e17aca5a2a1 100644
--- a/arch/mn10300/unit-asb2305/pci-asb2305.h
+++ b/arch/mn10300/unit-asb2305/pci-asb2305.h
@@ -35,7 +35,6 @@ extern void pcibios_resource_survey(void);
35 35
36/* pci.c */ 36/* pci.c */
37 37
38extern int pcibios_last_bus;
39extern struct pci_ops *pci_root_ops; 38extern struct pci_ops *pci_root_ops;
40 39
41extern struct irq_routing_table *pcibios_get_irq_routing_table(void); 40extern struct irq_routing_table *pcibios_get_irq_routing_table(void);
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index e37fac0461f3..6b4339f8c9c2 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -24,7 +24,6 @@
24 24
25unsigned int pci_probe = 1; 25unsigned int pci_probe = 1;
26 26
27int pcibios_last_bus = -1;
28struct pci_ops *pci_root_ops; 27struct pci_ops *pci_root_ops;
29 28
30/* 29/*
@@ -392,10 +391,6 @@ char *__init pcibios_setup(char *str)
392 if (!strcmp(str, "off")) { 391 if (!strcmp(str, "off")) {
393 pci_probe = 0; 392 pci_probe = 0;
394 return NULL; 393 return NULL;
395
396 } else if (!strncmp(str, "lastbus=", 8)) {
397 pcibios_last_bus = simple_strtol(str+8, NULL, 0);
398 return NULL;
399 } 394 }
400 395
401 return str; 396 return str;
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index 195653e851da..78405625e799 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -67,3 +67,4 @@ generic-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 69generic-y += xor.h
70generic-y += preempt.h
diff --git a/arch/openrisc/include/asm/pgalloc.h b/arch/openrisc/include/asm/pgalloc.h
index 05c39ecd2efd..21484e5b9e9a 100644
--- a/arch/openrisc/include/asm/pgalloc.h
+++ b/arch/openrisc/include/asm/pgalloc.h
@@ -78,8 +78,13 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
78{ 78{
79 struct page *pte; 79 struct page *pte;
80 pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0); 80 pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0);
81 if (pte) 81 if (!pte)
82 clear_page(page_address(pte)); 82 return NULL;
83 clear_page(page_address(pte));
84 if (!pgtable_page_ctor(pte)) {
85 __free_page(pte);
86 return NULL;
87 }
83 return pte; 88 return pte;
84} 89}
85 90
@@ -90,6 +95,7 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
90 95
91static inline void pte_free(struct mm_struct *mm, struct page *pte) 96static inline void pte_free(struct mm_struct *mm, struct page *pte)
92{ 97{
98 pgtable_page_dtor(pte);
93 __free_page(pte); 99 __free_page(pte);
94} 100}
95 101
diff --git a/arch/openrisc/include/asm/prom.h b/arch/openrisc/include/asm/prom.h
deleted file mode 100644
index eb59bfe23e85..000000000000
--- a/arch/openrisc/include/asm/prom.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * OpenRISC Linux
3 *
4 * Linux architectural port borrowing liberally from similar works of
5 * others. All original copyrights apply as per the original source
6 * declaration.
7 *
8 * OpenRISC implementation:
9 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
10 * et al.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 */
17
18#include <linux/of.h> /* linux/of.h gets to determine #include ordering */
19
20#ifndef _ASM_OPENRISC_PROM_H
21#define _ASM_OPENRISC_PROM_H
22#ifdef __KERNEL__
23#ifndef __ASSEMBLY__
24
25#include <linux/types.h>
26#include <asm/irq.h>
27#include <linux/irqdomain.h>
28#include <linux/atomic.h>
29#include <linux/of_irq.h>
30#include <linux/of_fdt.h>
31#include <linux/of_address.h>
32#include <linux/proc_fs.h>
33#include <linux/platform_device.h>
34#define HAVE_ARCH_DEVTREE_FIXUPS
35
36/* Other Prototypes */
37extern int early_uartlite_console(void);
38
39/* Parse the ibm,dma-window property of an OF node into the busno, phys and
40 * size parameters.
41 */
42void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
43 unsigned long *busno, unsigned long *phys, unsigned long *size);
44
45extern void kdump_move_device_tree(void);
46
47/* Get the MAC address */
48extern const void *of_get_mac_address(struct device_node *np);
49
50/**
51 * of_irq_map_pci - Resolve the interrupt for a PCI device
52 * @pdev: the device whose interrupt is to be resolved
53 * @out_irq: structure of_irq filled by this function
54 *
55 * This function resolves the PCI interrupt for a given PCI device. If a
56 * device-node exists for a given pci_dev, it will use normal OF tree
57 * walking. If not, it will implement standard swizzling and walk up the
58 * PCI tree until an device-node is found, at which point it will finish
59 * resolving using the OF tree walking.
60 */
61struct pci_dev;
62extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
63
64#endif /* __ASSEMBLY__ */
65#endif /* __KERNEL__ */
66#endif /* _ASM_OPENRISC_PROM_H */
diff --git a/arch/openrisc/kernel/prom.c b/arch/openrisc/kernel/prom.c
index a63e76872f84..6a44340d1b18 100644
--- a/arch/openrisc/kernel/prom.c
+++ b/arch/openrisc/kernel/prom.c
@@ -18,83 +18,15 @@
18 * 18 *
19 */ 19 */
20 20
21#include <stdarg.h>
22#include <linux/kernel.h>
23#include <linux/string.h>
24#include <linux/init.h> 21#include <linux/init.h>
25#include <linux/threads.h>
26#include <linux/spinlock.h>
27#include <linux/types.h> 22#include <linux/types.h>
28#include <linux/pci.h>
29#include <linux/stringify.h>
30#include <linux/delay.h>
31#include <linux/initrd.h>
32#include <linux/bitops.h>
33#include <linux/module.h>
34#include <linux/kexec.h>
35#include <linux/debugfs.h>
36#include <linux/irq.h>
37#include <linux/memblock.h> 23#include <linux/memblock.h>
38#include <linux/of_fdt.h> 24#include <linux/of_fdt.h>
39 25
40#include <asm/prom.h>
41#include <asm/page.h> 26#include <asm/page.h>
42#include <asm/processor.h>
43#include <asm/irq.h>
44#include <linux/io.h>
45#include <asm/mmu.h>
46#include <asm/pgtable.h>
47#include <asm/sections.h>
48#include <asm/setup.h>
49
50extern char cmd_line[COMMAND_LINE_SIZE];
51
52void __init early_init_dt_add_memory_arch(u64 base, u64 size)
53{
54 size &= PAGE_MASK;
55 memblock_add(base, size);
56}
57 27
58void __init early_init_devtree(void *params) 28void __init early_init_devtree(void *params)
59{ 29{
60 void *alloc; 30 early_init_dt_scan(params);
61
62 /* Setup flat device-tree pointer */
63 initial_boot_params = params;
64
65
66 /* Retrieve various informations from the /chosen node of the
67 * device-tree, including the platform type, initrd location and
68 * size, TCE reserve, and more ...
69 */
70 of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line);
71
72 /* Scan memory nodes and rebuild MEMBLOCKs */
73 of_scan_flat_dt(early_init_dt_scan_root, NULL);
74 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
75
76 /* Save command line for /proc/cmdline and then parse parameters */
77 strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
78
79 memblock_allow_resize(); 31 memblock_allow_resize();
80
81 /* We must copy the flattend device tree from init memory to regular
82 * memory because the device tree references the strings in it
83 * directly.
84 */
85
86 alloc = __va(memblock_alloc(initial_boot_params->totalsize, PAGE_SIZE));
87
88 memcpy(alloc, initial_boot_params, initial_boot_params->totalsize);
89
90 initial_boot_params = alloc;
91}
92
93#ifdef CONFIG_BLK_DEV_INITRD
94void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
95{
96 initrd_start = (unsigned long)__va(start);
97 initrd_end = (unsigned long)__va(end);
98 initrd_below_start_ok = 1;
99} 32}
100#endif
diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index d7359ffbcbdd..09a769b69572 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -50,8 +50,6 @@
50 50
51#include "vmlinux.h" 51#include "vmlinux.h"
52 52
53char __initdata cmd_line[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
54
55static unsigned long __init setup_memory(void) 53static unsigned long __init setup_memory(void)
56{ 54{
57 unsigned long bootmap_size; 55 unsigned long bootmap_size;
@@ -285,7 +283,7 @@ void __init setup_arch(char **cmdline_p)
285{ 283{
286 unsigned long max_low_pfn; 284 unsigned long max_low_pfn;
287 285
288 unflatten_device_tree(); 286 unflatten_and_copy_device_tree();
289 287
290 setup_cpuinfo(); 288 setup_cpuinfo();
291 289
@@ -316,7 +314,7 @@ void __init setup_arch(char **cmdline_p)
316 conswitchp = &dummy_con; 314 conswitchp = &dummy_con;
317#endif 315#endif
318 316
319 *cmdline_p = cmd_line; 317 *cmdline_p = boot_command_line;
320 318
321 printk(KERN_INFO "OpenRISC Linux -- http://openrisc.net\n"); 319 printk(KERN_INFO "OpenRISC Linux -- http://openrisc.net\n");
322} 320}
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index deb713c647f4..b5f1858baf33 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -227,7 +227,6 @@ endchoice
227 227
228config SMP 228config SMP
229 bool "Symmetric multi-processing support" 229 bool "Symmetric multi-processing support"
230 select USE_GENERIC_SMP_HELPERS
231 ---help--- 230 ---help---
232 This enables support for systems with more than one CPU. If you have 231 This enables support for systems with more than one CPU. If you have
233 a system with only one CPU, like most personal computers, say N. If 232 a system with only one CPU, like most personal computers, say N. If
@@ -288,6 +287,9 @@ config SYSVIPC_COMPAT
288 def_bool y 287 def_bool y
289 depends on COMPAT && SYSVIPC 288 depends on COMPAT && SYSVIPC
290 289
290config AUDIT_ARCH
291 def_bool y
292
291config HPUX 293config HPUX
292 bool "Support for HP-UX binaries" 294 bool "Support for HP-UX binaries"
293 depends on !64BIT 295 depends on !64BIT
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index e02f665f804a..7187664034c3 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -94,7 +94,7 @@ PALOCONF := $(shell if [ -f $(src)/palo.conf ]; then echo $(src)/palo.conf; \
94 else echo $(obj)/palo.conf; \ 94 else echo $(obj)/palo.conf; \
95 fi) 95 fi)
96 96
97palo: vmlinuz 97palo lifimage: vmlinuz
98 @if test ! -x "$(PALO)"; then \ 98 @if test ! -x "$(PALO)"; then \
99 echo 'ERROR: Please install palo first (apt-get install palo)';\ 99 echo 'ERROR: Please install palo first (apt-get install palo)';\
100 echo 'or build it from source and install it somewhere in your $$PATH';\ 100 echo 'or build it from source and install it somewhere in your $$PATH';\
@@ -109,16 +109,23 @@ palo: vmlinuz
109 fi 109 fi
110 $(PALO) -f $(PALOCONF) 110 $(PALO) -f $(PALOCONF)
111 111
112# Shorthands for known targets not supported by parisc, use vmlinux/vmlinuz as default 112BOOT_TARGETS = zImage Image palo lifimage
113INSTALL_TARGETS = zinstall install
114
115PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
116
117bzImage zImage: vmlinuz
113Image: vmlinux 118Image: vmlinux
114zImage bzImage: vmlinuz
115 119
116vmlinuz: vmlinux 120vmlinuz: vmlinux
117 @gzip -cf -9 $< > $@ 121 @gzip -cf -9 $< > $@
118 122
119install: vmlinuz 123install:
120 sh $(src)/arch/parisc/install.sh \ 124 $(CONFIG_SHELL) $(src)/arch/parisc/install.sh \
121 $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)" 125 $(KERNELRELEASE) vmlinux System.map "$(INSTALL_PATH)"
126zinstall:
127 $(CONFIG_SHELL) $(src)/arch/parisc/install.sh \
128 $(KERNELRELEASE) vmlinuz System.map "$(INSTALL_PATH)"
122 129
123CLEAN_FILES += lifimage 130CLEAN_FILES += lifimage
124MRPROPER_FILES += palo.conf 131MRPROPER_FILES += palo.conf
@@ -127,10 +134,11 @@ define archhelp
127 @echo '* vmlinux - Uncompressed kernel image (./vmlinux)' 134 @echo '* vmlinux - Uncompressed kernel image (./vmlinux)'
128 @echo ' vmlinuz - Compressed kernel image (./vmlinuz)' 135 @echo ' vmlinuz - Compressed kernel image (./vmlinuz)'
129 @echo ' palo - Bootable image (./lifimage)' 136 @echo ' palo - Bootable image (./lifimage)'
130 @echo ' install - Install kernel using' 137 @echo ' install - Install uncompressed vmlinux kernel using'
131 @echo ' (your) ~/bin/$(INSTALLKERNEL) or' 138 @echo ' (your) ~/bin/$(INSTALLKERNEL) or'
132 @echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 139 @echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
133 @echo ' copy to $$(INSTALL_PATH)' 140 @echo ' copy to $$(INSTALL_PATH)'
141 @echo ' zinstall - Install compressed vmlinuz kernel'
134endef 142endef
135 143
136# we require gcc 3.3 or above to compile the kernel 144# we require gcc 3.3 or above to compile the kernel
diff --git a/arch/parisc/configs/712_defconfig b/arch/parisc/configs/712_defconfig
index 0f90569b9d85..9387cc2693f6 100644
--- a/arch/parisc/configs/712_defconfig
+++ b/arch/parisc/configs/712_defconfig
@@ -40,6 +40,8 @@ CONFIG_IP_NF_QUEUE=m
40CONFIG_LLC2=m 40CONFIG_LLC2=m
41CONFIG_NET_PKTGEN=m 41CONFIG_NET_PKTGEN=m
42CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 42CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
43CONFIG_DEVTMPFS=y
44CONFIG_DEVTMPFS_MOUNT=y
43# CONFIG_STANDALONE is not set 45# CONFIG_STANDALONE is not set
44# CONFIG_PREVENT_FIRMWARE_BUILD is not set 46# CONFIG_PREVENT_FIRMWARE_BUILD is not set
45CONFIG_PARPORT=y 47CONFIG_PARPORT=y
diff --git a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig
index b647b182dacc..90025322b75e 100644
--- a/arch/parisc/configs/a500_defconfig
+++ b/arch/parisc/configs/a500_defconfig
@@ -79,6 +79,8 @@ CONFIG_IP_DCCP=m
79CONFIG_LLC2=m 79CONFIG_LLC2=m
80CONFIG_NET_PKTGEN=m 80CONFIG_NET_PKTGEN=m
81CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 81CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
82CONFIG_DEVTMPFS=y
83CONFIG_DEVTMPFS_MOUNT=y
82# CONFIG_STANDALONE is not set 84# CONFIG_STANDALONE is not set
83# CONFIG_PREVENT_FIRMWARE_BUILD is not set 85# CONFIG_PREVENT_FIRMWARE_BUILD is not set
84CONFIG_BLK_DEV_UMEM=m 86CONFIG_BLK_DEV_UMEM=m
diff --git a/arch/parisc/configs/b180_defconfig b/arch/parisc/configs/b180_defconfig
index e289f5bf3148..f1a0c25bef8d 100644
--- a/arch/parisc/configs/b180_defconfig
+++ b/arch/parisc/configs/b180_defconfig
@@ -4,6 +4,7 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16 5CONFIG_LOG_BUF_SHIFT=16
6CONFIG_SYSFS_DEPRECATED_V2=y 6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_BLK_DEV_INITRD=y
7CONFIG_SLAB=y 8CONFIG_SLAB=y
8CONFIG_MODULES=y 9CONFIG_MODULES=y
9CONFIG_MODVERSIONS=y 10CONFIG_MODVERSIONS=y
@@ -27,6 +28,8 @@ CONFIG_IP_PNP_BOOTP=y
27# CONFIG_INET_LRO is not set 28# CONFIG_INET_LRO is not set
28CONFIG_IPV6=y 29CONFIG_IPV6=y
29CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 30CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
31CONFIG_DEVTMPFS=y
32CONFIG_DEVTMPFS_MOUNT=y
30# CONFIG_PREVENT_FIRMWARE_BUILD is not set 33# CONFIG_PREVENT_FIRMWARE_BUILD is not set
31CONFIG_PARPORT=y 34CONFIG_PARPORT=y
32CONFIG_PARPORT_PC=y 35CONFIG_PARPORT_PC=y
diff --git a/arch/parisc/configs/c3000_defconfig b/arch/parisc/configs/c3000_defconfig
index 311ca367b622..ec1b014952b6 100644
--- a/arch/parisc/configs/c3000_defconfig
+++ b/arch/parisc/configs/c3000_defconfig
@@ -5,6 +5,7 @@ CONFIG_IKCONFIG=y
5CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=16 6CONFIG_LOG_BUF_SHIFT=16
7CONFIG_SYSFS_DEPRECATED_V2=y 7CONFIG_SYSFS_DEPRECATED_V2=y
8CONFIG_BLK_DEV_INITRD=y
8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
9CONFIG_EXPERT=y 10CONFIG_EXPERT=y
10CONFIG_KALLSYMS_ALL=y 11CONFIG_KALLSYMS_ALL=y
@@ -39,6 +40,8 @@ CONFIG_NETFILTER_DEBUG=y
39CONFIG_IP_NF_QUEUE=m 40CONFIG_IP_NF_QUEUE=m
40CONFIG_NET_PKTGEN=m 41CONFIG_NET_PKTGEN=m
41CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 42CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
43CONFIG_DEVTMPFS=y
44CONFIG_DEVTMPFS_MOUNT=y
42# CONFIG_STANDALONE is not set 45# CONFIG_STANDALONE is not set
43# CONFIG_PREVENT_FIRMWARE_BUILD is not set 46# CONFIG_PREVENT_FIRMWARE_BUILD is not set
44CONFIG_BLK_DEV_UMEM=m 47CONFIG_BLK_DEV_UMEM=m
diff --git a/arch/parisc/configs/c8000_defconfig b/arch/parisc/configs/c8000_defconfig
index f11006361297..e1c8d2015c89 100644
--- a/arch/parisc/configs/c8000_defconfig
+++ b/arch/parisc/configs/c8000_defconfig
@@ -62,6 +62,8 @@ CONFIG_TIPC=m
62CONFIG_LLC2=m 62CONFIG_LLC2=m
63CONFIG_DNS_RESOLVER=y 63CONFIG_DNS_RESOLVER=y
64CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 64CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
65CONFIG_DEVTMPFS=y
66CONFIG_DEVTMPFS_MOUNT=y
65# CONFIG_STANDALONE is not set 67# CONFIG_STANDALONE is not set
66CONFIG_PARPORT=y 68CONFIG_PARPORT=y
67CONFIG_PARPORT_PC=y 69CONFIG_PARPORT_PC=y
diff --git a/arch/parisc/configs/default_defconfig b/arch/parisc/configs/default_defconfig
index dfe88f6c95c4..ba61495e1fa4 100644
--- a/arch/parisc/configs/default_defconfig
+++ b/arch/parisc/configs/default_defconfig
@@ -49,6 +49,8 @@ CONFIG_INET6_ESP=y
49CONFIG_INET6_IPCOMP=y 49CONFIG_INET6_IPCOMP=y
50CONFIG_LLC2=m 50CONFIG_LLC2=m
51CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 51CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
52CONFIG_DEVTMPFS=y
53CONFIG_DEVTMPFS_MOUNT=y
52# CONFIG_STANDALONE is not set 54# CONFIG_STANDALONE is not set
53# CONFIG_PREVENT_FIRMWARE_BUILD is not set 55# CONFIG_PREVENT_FIRMWARE_BUILD is not set
54CONFIG_PARPORT=y 56CONFIG_PARPORT=y
diff --git a/arch/parisc/configs/generic-32bit_defconfig b/arch/parisc/configs/generic-32bit_defconfig
new file mode 100644
index 000000000000..33b148f825ba
--- /dev/null
+++ b/arch/parisc/configs/generic-32bit_defconfig
@@ -0,0 +1,328 @@
1CONFIG_LOCALVERSION="-32bit"
2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y
5CONFIG_FHANDLE=y
6CONFIG_BSD_PROCESS_ACCT=y
7CONFIG_IKCONFIG=y
8CONFIG_IKCONFIG_PROC=y
9CONFIG_LOG_BUF_SHIFT=16
10CONFIG_BLK_DEV_INITRD=y
11CONFIG_RD_BZIP2=y
12CONFIG_RD_LZMA=y
13CONFIG_RD_LZO=y
14CONFIG_EXPERT=y
15CONFIG_SYSCTL_SYSCALL=y
16CONFIG_PERF_EVENTS=y
17CONFIG_SLAB=y
18CONFIG_MODULES=y
19CONFIG_MODULE_UNLOAD=y
20CONFIG_MODULE_FORCE_UNLOAD=y
21# CONFIG_LBDAF is not set
22# CONFIG_BLK_DEV_BSG is not set
23CONFIG_PA7100LC=y
24CONFIG_SMP=y
25CONFIG_HZ_100=y
26CONFIG_IOMMU_CCIO=y
27CONFIG_GSC_LASI=y
28CONFIG_GSC_WAX=y
29CONFIG_EISA=y
30CONFIG_PCI=y
31CONFIG_GSC_DINO=y
32CONFIG_PCI_LBA=y
33CONFIG_PCCARD=m
34CONFIG_YENTA=m
35# CONFIG_PDC_CHASSIS is not set
36# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
37CONFIG_BINFMT_MISC=m
38CONFIG_NET=y
39CONFIG_PACKET=y
40CONFIG_UNIX=y
41CONFIG_XFRM_USER=m
42CONFIG_NET_KEY=m
43CONFIG_INET=y
44CONFIG_IP_MULTICAST=y
45CONFIG_IP_PNP=y
46CONFIG_IP_PNP_BOOTP=y
47CONFIG_INET_AH=m
48CONFIG_INET_ESP=m
49# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
50# CONFIG_INET_XFRM_MODE_TUNNEL is not set
51# CONFIG_INET_XFRM_MODE_BEET is not set
52# CONFIG_INET_LRO is not set
53CONFIG_INET_DIAG=m
54CONFIG_LLC2=m
55# CONFIG_WIRELESS is not set
56CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
57CONFIG_DEVTMPFS=y
58CONFIG_DEVTMPFS_MOUNT=y
59# CONFIG_STANDALONE is not set
60# CONFIG_PREVENT_FIRMWARE_BUILD is not set
61CONFIG_PARPORT=y
62CONFIG_PARPORT_PC=m
63CONFIG_PARPORT_1284=y
64CONFIG_BLK_DEV_LOOP=y
65CONFIG_BLK_DEV_CRYPTOLOOP=y
66CONFIG_BLK_DEV_RAM=y
67CONFIG_BLK_DEV_RAM_SIZE=6144
68CONFIG_IDE=y
69CONFIG_BLK_DEV_IDECD=y
70CONFIG_BLK_DEV_GENERIC=y
71CONFIG_BLK_DEV_NS87415=y
72CONFIG_BLK_DEV_SD=y
73CONFIG_CHR_DEV_ST=y
74CONFIG_BLK_DEV_SR=y
75CONFIG_CHR_DEV_SG=y
76CONFIG_SCSI_LASI700=y
77CONFIG_SCSI_SYM53C8XX_2=y
78CONFIG_SCSI_ZALON=y
79CONFIG_SCSI_DH=y
80CONFIG_ATA=y
81CONFIG_MD=y
82CONFIG_BLK_DEV_MD=m
83CONFIG_MD_LINEAR=m
84CONFIG_MD_RAID0=m
85CONFIG_MD_RAID1=m
86CONFIG_MD_RAID10=m
87CONFIG_MD_RAID456=m
88CONFIG_BLK_DEV_DM=y
89CONFIG_DM_UEVENT=y
90CONFIG_NETDEVICES=y
91CONFIG_BONDING=m
92CONFIG_DUMMY=m
93CONFIG_TUN=m
94# CONFIG_NET_VENDOR_3COM is not set
95# CONFIG_NET_VENDOR_ADAPTEC is not set
96# CONFIG_NET_VENDOR_ALTEON is not set
97# CONFIG_NET_VENDOR_AMD is not set
98# CONFIG_NET_VENDOR_ATHEROS is not set
99# CONFIG_NET_CADENCE is not set
100# CONFIG_NET_VENDOR_BROADCOM is not set
101# CONFIG_NET_VENDOR_BROCADE is not set
102# CONFIG_NET_VENDOR_CHELSIO is not set
103# CONFIG_NET_VENDOR_CISCO is not set
104CONFIG_NET_TULIP=y
105CONFIG_TULIP=y
106# CONFIG_NET_VENDOR_DLINK is not set
107# CONFIG_NET_VENDOR_EMULEX is not set
108# CONFIG_NET_VENDOR_EXAR is not set
109# CONFIG_NET_VENDOR_HP is not set
110CONFIG_LASI_82596=y
111# CONFIG_NET_VENDOR_MELLANOX is not set
112# CONFIG_NET_VENDOR_MICREL is not set
113# CONFIG_NET_VENDOR_MYRI is not set
114# CONFIG_NET_VENDOR_NATSEMI is not set
115# CONFIG_NET_VENDOR_NVIDIA is not set
116# CONFIG_NET_VENDOR_OKI is not set
117# CONFIG_NET_PACKET_ENGINE is not set
118# CONFIG_NET_VENDOR_QLOGIC is not set
119# CONFIG_NET_VENDOR_REALTEK is not set
120# CONFIG_NET_VENDOR_RDC is not set
121# CONFIG_NET_VENDOR_SEEQ is not set
122# CONFIG_NET_VENDOR_SILAN is not set
123# CONFIG_NET_VENDOR_SIS is not set
124# CONFIG_NET_VENDOR_STMICRO is not set
125# CONFIG_NET_VENDOR_SUN is not set
126# CONFIG_NET_VENDOR_TEHUTI is not set
127# CONFIG_NET_VENDOR_TI is not set
128# CONFIG_NET_VENDOR_VIA is not set
129CONFIG_PPP=m
130CONFIG_PPP_BSDCOMP=m
131CONFIG_PPP_DEFLATE=m
132CONFIG_PPPOE=m
133# CONFIG_WLAN is not set
134CONFIG_INPUT_POLLDEV=y
135CONFIG_KEYBOARD_HIL_OLD=m
136CONFIG_KEYBOARD_HIL=m
137CONFIG_MOUSE_SERIAL=y
138CONFIG_INPUT_MISC=y
139CONFIG_INPUT_UINPUT=m
140CONFIG_LEGACY_PTY_COUNT=64
141CONFIG_SERIAL_8250=y
142# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
143CONFIG_SERIAL_8250_CONSOLE=y
144CONFIG_SERIAL_8250_NR_UARTS=8
145CONFIG_SERIAL_8250_EXTENDED=y
146CONFIG_SERIAL_8250_MANY_PORTS=y
147CONFIG_SERIAL_8250_SHARE_IRQ=y
148CONFIG_PRINTER=m
149CONFIG_PPDEV=m
150# CONFIG_HW_RANDOM is not set
151CONFIG_I2C=y
152CONFIG_POWER_SUPPLY=y
153# CONFIG_HWMON is not set
154CONFIG_AGP=y
155CONFIG_VIDEO_OUTPUT_CONTROL=y
156CONFIG_FB=y
157CONFIG_FB_FOREIGN_ENDIAN=y
158CONFIG_FB_MODE_HELPERS=y
159CONFIG_FB_MATROX=m
160CONFIG_FB_MATROX_G=y
161CONFIG_FB_VOODOO1=m
162CONFIG_DUMMY_CONSOLE_COLUMNS=128
163CONFIG_DUMMY_CONSOLE_ROWS=48
164CONFIG_FRAMEBUFFER_CONSOLE=y
165CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
166CONFIG_LOGO=y
167# CONFIG_LOGO_LINUX_MONO is not set
168# CONFIG_LOGO_LINUX_VGA16 is not set
169# CONFIG_LOGO_LINUX_CLUT224 is not set
170CONFIG_SOUND=m
171CONFIG_SND=m
172CONFIG_SND_SEQUENCER=m
173CONFIG_SND_MIXER_OSS=m
174CONFIG_SND_PCM_OSS=m
175CONFIG_SND_SEQUENCER_OSS=y
176CONFIG_SND_DYNAMIC_MINORS=y
177CONFIG_SND_AD1889=m
178CONFIG_SND_HARMONY=m
179CONFIG_HIDRAW=y
180CONFIG_HID_A4TECH=y
181CONFIG_HID_APPLE=y
182CONFIG_HID_BELKIN=y
183CONFIG_HID_CHERRY=y
184CONFIG_HID_CHICONY=y
185CONFIG_HID_CYPRESS=y
186CONFIG_HID_DRAGONRISE=y
187CONFIG_HID_EZKEY=y
188CONFIG_HID_KYE=y
189CONFIG_HID_GYRATION=y
190CONFIG_HID_TWINHAN=y
191CONFIG_HID_KENSINGTON=y
192CONFIG_HID_LOGITECH=y
193CONFIG_HID_LOGITECH_DJ=m
194CONFIG_HID_MICROSOFT=y
195CONFIG_HID_MONTEREY=y
196CONFIG_HID_NTRIG=y
197CONFIG_HID_ORTEK=y
198CONFIG_HID_PANTHERLORD=y
199CONFIG_HID_PETALYNX=y
200CONFIG_HID_SAMSUNG=y
201CONFIG_HID_SONY=y
202CONFIG_HID_SUNPLUS=y
203CONFIG_HID_GREENASIA=y
204CONFIG_HID_SMARTJOYPLUS=y
205CONFIG_HID_TOPSEED=y
206CONFIG_HID_THRUSTMASTER=y
207CONFIG_HID_ZEROPLUS=y
208CONFIG_USB=y
209CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
210CONFIG_USB_MON=y
211CONFIG_USB_OHCI_HCD=y
212CONFIG_USB_UHCI_HCD=y
213CONFIG_NEW_LEDS=y
214CONFIG_LEDS_CLASS=y
215CONFIG_LEDS_TRIGGERS=y
216CONFIG_LEDS_TRIGGER_TIMER=y
217CONFIG_LEDS_TRIGGER_IDE_DISK=y
218CONFIG_LEDS_TRIGGER_HEARTBEAT=y
219CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
220CONFIG_DMADEVICES=y
221CONFIG_AUXDISPLAY=y
222CONFIG_EXT2_FS=y
223CONFIG_EXT2_FS_XATTR=y
224CONFIG_EXT2_FS_SECURITY=y
225CONFIG_EXT3_FS=y
226# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
227CONFIG_EXT3_FS_SECURITY=y
228CONFIG_EXT4_FS=y
229CONFIG_XFS_FS=m
230CONFIG_XFS_QUOTA=y
231CONFIG_XFS_RT=y
232CONFIG_QUOTA=y
233CONFIG_QUOTA_NETLINK_INTERFACE=y
234CONFIG_QFMT_V2=y
235CONFIG_AUTOFS4_FS=y
236CONFIG_ISO9660_FS=y
237CONFIG_JOLIET=y
238CONFIG_VFAT_FS=y
239CONFIG_PROC_KCORE=y
240CONFIG_TMPFS=y
241CONFIG_TMPFS_XATTR=y
242CONFIG_NFS_FS=m
243# CONFIG_NFS_V2 is not set
244CONFIG_NFSD=m
245CONFIG_NFSD_V3=y
246CONFIG_CIFS=m
247CONFIG_CIFS_WEAK_PW_HASH=y
248CONFIG_CIFS_XATTR=y
249CONFIG_CIFS_POSIX=y
250# CONFIG_CIFS_DEBUG is not set
251CONFIG_NLS_CODEPAGE_437=y
252CONFIG_NLS_CODEPAGE_737=m
253CONFIG_NLS_CODEPAGE_775=m
254CONFIG_NLS_CODEPAGE_850=m
255CONFIG_NLS_CODEPAGE_852=m
256CONFIG_NLS_CODEPAGE_855=m
257CONFIG_NLS_CODEPAGE_857=m
258CONFIG_NLS_CODEPAGE_860=m
259CONFIG_NLS_CODEPAGE_861=m
260CONFIG_NLS_CODEPAGE_862=m
261CONFIG_NLS_CODEPAGE_863=m
262CONFIG_NLS_CODEPAGE_864=m
263CONFIG_NLS_CODEPAGE_865=m
264CONFIG_NLS_CODEPAGE_866=m
265CONFIG_NLS_CODEPAGE_869=m
266CONFIG_NLS_CODEPAGE_936=m
267CONFIG_NLS_CODEPAGE_950=m
268CONFIG_NLS_CODEPAGE_932=m
269CONFIG_NLS_CODEPAGE_949=m
270CONFIG_NLS_CODEPAGE_874=m
271CONFIG_NLS_ISO8859_8=m
272CONFIG_NLS_CODEPAGE_1250=y
273CONFIG_NLS_CODEPAGE_1251=m
274CONFIG_NLS_ASCII=m
275CONFIG_NLS_ISO8859_1=y
276CONFIG_NLS_ISO8859_2=m
277CONFIG_NLS_ISO8859_3=m
278CONFIG_NLS_ISO8859_4=m
279CONFIG_NLS_ISO8859_5=m
280CONFIG_NLS_ISO8859_6=m
281CONFIG_NLS_ISO8859_7=m
282CONFIG_NLS_ISO8859_9=m
283CONFIG_NLS_ISO8859_13=m
284CONFIG_NLS_ISO8859_14=m
285CONFIG_NLS_ISO8859_15=m
286CONFIG_NLS_KOI8_R=m
287CONFIG_NLS_KOI8_U=m
288CONFIG_NLS_UTF8=y
289CONFIG_UNUSED_SYMBOLS=y
290CONFIG_DEBUG_FS=y
291CONFIG_MAGIC_SYSRQ=y
292CONFIG_DEBUG_MEMORY_INIT=y
293CONFIG_DEBUG_STACKOVERFLOW=y
294CONFIG_DEBUG_SHIRQ=y
295CONFIG_DETECT_HUNG_TASK=y
296CONFIG_TIMER_STATS=y
297CONFIG_DEBUG_RT_MUTEXES=y
298CONFIG_RT_MUTEX_TESTER=y
299CONFIG_DEBUG_SPINLOCK=y
300CONFIG_DEBUG_MUTEXES=y
301CONFIG_RCU_CPU_STALL_INFO=y
302CONFIG_LATENCYTOP=y
303CONFIG_LKDTM=m
304CONFIG_KEYS=y
305CONFIG_KEYS_DEBUG_PROC_KEYS=y
306CONFIG_CRYPTO_NULL=m
307CONFIG_CRYPTO_TEST=m
308CONFIG_CRYPTO_HMAC=y
309CONFIG_CRYPTO_MD5=y
310CONFIG_CRYPTO_MICHAEL_MIC=m
311CONFIG_CRYPTO_SHA1=y
312CONFIG_CRYPTO_SHA512=m
313CONFIG_CRYPTO_TGR192=m
314CONFIG_CRYPTO_WP512=m
315CONFIG_CRYPTO_ANUBIS=m
316CONFIG_CRYPTO_BLOWFISH=m
317CONFIG_CRYPTO_CAST5=m
318CONFIG_CRYPTO_CAST6=m
319CONFIG_CRYPTO_DES=y
320CONFIG_CRYPTO_KHAZAD=m
321CONFIG_CRYPTO_SERPENT=m
322CONFIG_CRYPTO_TEA=m
323CONFIG_CRYPTO_TWOFISH=m
324CONFIG_CRYPTO_DEFLATE=y
325# CONFIG_CRYPTO_ANSI_CPRNG is not set
326CONFIG_CRC_CCITT=m
327CONFIG_CRC_T10DIF=y
328CONFIG_FONTS=y
diff --git a/arch/parisc/configs/generic-64bit_defconfig b/arch/parisc/configs/generic-64bit_defconfig
new file mode 100644
index 000000000000..5874cebee077
--- /dev/null
+++ b/arch/parisc/configs/generic-64bit_defconfig
@@ -0,0 +1,346 @@
1CONFIG_LOCALVERSION="-64bit"
2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y
5CONFIG_BSD_PROCESS_ACCT=y
6CONFIG_BSD_PROCESS_ACCT_V3=y
7CONFIG_TASKSTATS=y
8CONFIG_TASK_DELAY_ACCT=y
9CONFIG_TASK_XACCT=y
10CONFIG_TASK_IO_ACCOUNTING=y
11# CONFIG_UTS_NS is not set
12# CONFIG_IPC_NS is not set
13# CONFIG_PID_NS is not set
14# CONFIG_NET_NS is not set
15CONFIG_RELAY=y
16CONFIG_BLK_DEV_INITRD=y
17CONFIG_CC_OPTIMIZE_FOR_SIZE=y
18# CONFIG_COMPAT_BRK is not set
19CONFIG_MODULES=y
20CONFIG_MODULE_FORCE_LOAD=y
21CONFIG_MODULE_UNLOAD=y
22CONFIG_MODULE_FORCE_UNLOAD=y
23CONFIG_MODVERSIONS=y
24CONFIG_BLK_DEV_INTEGRITY=y
25# CONFIG_IOSCHED_DEADLINE is not set
26CONFIG_PA8X00=y
27CONFIG_MLONGCALLS=y
28CONFIG_64BIT=y
29CONFIG_SMP=y
30# CONFIG_COMPACTION is not set
31CONFIG_HPPB=y
32CONFIG_IOMMU_CCIO=y
33CONFIG_GSC_LASI=y
34CONFIG_GSC_WAX=y
35CONFIG_PCI=y
36CONFIG_PCI_STUB=m
37CONFIG_PCI_IOV=y
38CONFIG_GSC_DINO=y
39CONFIG_PCI_LBA=y
40CONFIG_BINFMT_MISC=m
41CONFIG_NET=y
42CONFIG_PACKET=y
43CONFIG_UNIX=y
44CONFIG_XFRM_USER=m
45CONFIG_XFRM_SUB_POLICY=y
46CONFIG_XFRM_MIGRATE=y
47CONFIG_INET=y
48CONFIG_IP_MULTICAST=y
49CONFIG_IP_PNP=y
50CONFIG_IP_PNP_BOOTP=y
51CONFIG_INET_AH=m
52CONFIG_INET_ESP=m
53CONFIG_INET_XFRM_MODE_TRANSPORT=m
54CONFIG_INET_XFRM_MODE_TUNNEL=m
55CONFIG_INET_XFRM_MODE_BEET=m
56CONFIG_INET_LRO=m
57CONFIG_INET_DIAG=m
58CONFIG_NETFILTER=y
59# CONFIG_NETFILTER_ADVANCED is not set
60CONFIG_NETFILTER_NETLINK_LOG=y
61CONFIG_DCB=y
62# CONFIG_WIRELESS is not set
63CONFIG_DEVTMPFS=y
64CONFIG_DEVTMPFS_MOUNT=y
65CONFIG_BLK_DEV_LOOP=y
66CONFIG_IDE=y
67CONFIG_IDE_GD=m
68CONFIG_IDE_GD_ATAPI=y
69CONFIG_BLK_DEV_IDECD=m
70CONFIG_BLK_DEV_NS87415=y
71CONFIG_BLK_DEV_SIIMAGE=y
72# CONFIG_SCSI_PROC_FS is not set
73CONFIG_BLK_DEV_SD=y
74CONFIG_BLK_DEV_SR=y
75CONFIG_SCSI_ISCSI_ATTRS=y
76CONFIG_SCSI_SRP_ATTRS=y
77CONFIG_ISCSI_BOOT_SYSFS=y
78CONFIG_SCSI_MPT2SAS=y
79CONFIG_SCSI_LASI700=m
80CONFIG_SCSI_SYM53C8XX_2=y
81CONFIG_SCSI_ZALON=y
82CONFIG_SCSI_QLA_ISCSI=m
83CONFIG_SCSI_DH=y
84CONFIG_ATA=y
85CONFIG_ATA_GENERIC=y
86CONFIG_MD=y
87CONFIG_MD_LINEAR=m
88CONFIG_MD_RAID0=m
89CONFIG_BLK_DEV_DM=m
90CONFIG_DM_RAID=m
91CONFIG_DM_UEVENT=y
92CONFIG_FUSION=y
93CONFIG_FUSION_SPI=y
94CONFIG_FUSION_SAS=y
95CONFIG_NETDEVICES=y
96CONFIG_DUMMY=m
97CONFIG_MACVLAN=m
98CONFIG_MACVTAP=m
99CONFIG_NETCONSOLE=m
100CONFIG_NETCONSOLE_DYNAMIC=y
101CONFIG_TUN=y
102# CONFIG_NET_VENDOR_3COM is not set
103# CONFIG_NET_VENDOR_ADAPTEC is not set
104# CONFIG_NET_VENDOR_ALTEON is not set
105# CONFIG_NET_VENDOR_AMD is not set
106# CONFIG_NET_VENDOR_ATHEROS is not set
107# CONFIG_NET_CADENCE is not set
108# CONFIG_NET_VENDOR_BROADCOM is not set
109# CONFIG_NET_VENDOR_BROCADE is not set
110# CONFIG_NET_VENDOR_CHELSIO is not set
111# CONFIG_NET_VENDOR_CISCO is not set
112CONFIG_NET_TULIP=y
113CONFIG_TULIP=y
114# CONFIG_NET_VENDOR_DLINK is not set
115# CONFIG_NET_VENDOR_EMULEX is not set
116# CONFIG_NET_VENDOR_EXAR is not set
117CONFIG_HP100=m
118CONFIG_E1000=y
119CONFIG_LASI_82596=y
120# CONFIG_NET_VENDOR_MARVELL is not set
121# CONFIG_NET_VENDOR_MELLANOX is not set
122# CONFIG_NET_VENDOR_MICREL is not set
123# CONFIG_NET_VENDOR_MYRI is not set
124# CONFIG_NET_VENDOR_NATSEMI is not set
125# CONFIG_NET_VENDOR_NVIDIA is not set
126# CONFIG_NET_VENDOR_OKI is not set
127CONFIG_QLA3XXX=m
128CONFIG_QLCNIC=m
129CONFIG_QLGE=m
130# CONFIG_NET_VENDOR_REALTEK is not set
131# CONFIG_NET_VENDOR_RDC is not set
132# CONFIG_NET_VENDOR_SEEQ is not set
133# CONFIG_NET_VENDOR_SILAN is not set
134# CONFIG_NET_VENDOR_SIS is not set
135# CONFIG_NET_VENDOR_SMSC is not set
136# CONFIG_NET_VENDOR_STMICRO is not set
137# CONFIG_NET_VENDOR_SUN is not set
138# CONFIG_NET_VENDOR_TEHUTI is not set
139# CONFIG_NET_VENDOR_TI is not set
140# CONFIG_NET_VENDOR_VIA is not set
141# CONFIG_NET_VENDOR_WIZNET is not set
142CONFIG_PHYLIB=y
143CONFIG_MARVELL_PHY=m
144CONFIG_DAVICOM_PHY=m
145CONFIG_QSEMI_PHY=m
146CONFIG_LXT_PHY=m
147CONFIG_CICADA_PHY=m
148CONFIG_VITESSE_PHY=m
149CONFIG_SMSC_PHY=m
150CONFIG_BROADCOM_PHY=m
151CONFIG_ICPLUS_PHY=m
152CONFIG_REALTEK_PHY=m
153CONFIG_NATIONAL_PHY=m
154CONFIG_STE10XP=m
155CONFIG_LSI_ET1011C_PHY=m
156CONFIG_MDIO_BITBANG=m
157CONFIG_SLIP=m
158CONFIG_SLIP_COMPRESSED=y
159CONFIG_SLIP_SMART=y
160CONFIG_SLIP_MODE_SLIP6=y
161# CONFIG_WLAN is not set
162CONFIG_INPUT_EVDEV=y
163# CONFIG_KEYBOARD_HIL_OLD is not set
164# CONFIG_KEYBOARD_HIL is not set
165# CONFIG_INPUT_MOUSE is not set
166CONFIG_INPUT_MISC=y
167CONFIG_SERIO_SERPORT=m
168# CONFIG_HP_SDC is not set
169CONFIG_SERIO_RAW=m
170CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
171# CONFIG_LEGACY_PTYS is not set
172CONFIG_NOZOMI=m
173# CONFIG_DEVKMEM is not set
174CONFIG_SERIAL_8250=y
175# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
176CONFIG_SERIAL_8250_CONSOLE=y
177CONFIG_SERIAL_8250_NR_UARTS=8
178CONFIG_SERIAL_8250_RUNTIME_UARTS=8
179CONFIG_SERIAL_8250_EXTENDED=y
180CONFIG_SERIAL_8250_MANY_PORTS=y
181CONFIG_SERIAL_8250_SHARE_IRQ=y
182CONFIG_SERIAL_JSM=m
183CONFIG_IPMI_HANDLER=y
184CONFIG_IPMI_DEVICE_INTERFACE=y
185CONFIG_IPMI_SI=y
186# CONFIG_HW_RANDOM is not set
187CONFIG_TCG_TPM=m
188CONFIG_TCG_ATMEL=m
189CONFIG_PTP_1588_CLOCK=m
190CONFIG_SENSORS_I5K_AMB=m
191CONFIG_SENSORS_F71882FG=m
192CONFIG_SENSORS_PC87427=m
193CONFIG_SENSORS_VT1211=m
194CONFIG_SENSORS_VT8231=m
195CONFIG_SENSORS_W83627EHF=m
196CONFIG_WATCHDOG=y
197CONFIG_SOFT_WATCHDOG=m
198CONFIG_SSB=m
199CONFIG_SSB_DRIVER_PCICORE=y
200CONFIG_HTC_PASIC3=m
201CONFIG_LPC_SCH=m
202CONFIG_MFD_SM501=m
203CONFIG_REGULATOR=y
204CONFIG_REGULATOR_FIXED_VOLTAGE=m
205CONFIG_REGULATOR_USERSPACE_CONSUMER=m
206CONFIG_MEDIA_SUPPORT=m
207CONFIG_AGP=y
208CONFIG_AGP_PARISC=y
209CONFIG_DRM=y
210CONFIG_DRM_RADEON=y
211CONFIG_DRM_RADEON_UMS=y
212CONFIG_FIRMWARE_EDID=y
213CONFIG_FB_MODE_HELPERS=y
214CONFIG_BACKLIGHT_LCD_SUPPORT=y
215# CONFIG_BACKLIGHT_GENERIC is not set
216CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
217CONFIG_LOGO=y
218# CONFIG_LOGO_LINUX_MONO is not set
219CONFIG_HID=m
220CONFIG_HIDRAW=y
221CONFIG_HID_DRAGONRISE=m
222CONFIG_DRAGONRISE_FF=y
223CONFIG_HID_KYE=m
224CONFIG_HID_GYRATION=m
225CONFIG_HID_TWINHAN=m
226CONFIG_LOGITECH_FF=y
227CONFIG_LOGIRUMBLEPAD2_FF=y
228CONFIG_HID_NTRIG=m
229CONFIG_HID_PANTHERLORD=m
230CONFIG_PANTHERLORD_FF=y
231CONFIG_HID_PETALYNX=m
232CONFIG_HID_SAMSUNG=m
233CONFIG_HID_SONY=m
234CONFIG_HID_SUNPLUS=m
235CONFIG_HID_GREENASIA=m
236CONFIG_GREENASIA_FF=y
237CONFIG_HID_SMARTJOYPLUS=m
238CONFIG_SMARTJOYPLUS_FF=y
239CONFIG_HID_TOPSEED=m
240CONFIG_HID_THRUSTMASTER=m
241CONFIG_THRUSTMASTER_FF=y
242CONFIG_HID_ZEROPLUS=m
243CONFIG_ZEROPLUS_FF=y
244CONFIG_USB_HID=m
245CONFIG_HID_PID=y
246CONFIG_USB_HIDDEV=y
247CONFIG_USB=y
248CONFIG_USB_DEBUG=y
249CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
250CONFIG_USB_DYNAMIC_MINORS=y
251CONFIG_USB_MON=m
252CONFIG_USB_WUSB_CBAF=m
253CONFIG_USB_XHCI_HCD=m
254CONFIG_USB_EHCI_HCD=m
255CONFIG_USB_OHCI_HCD=m
256CONFIG_USB_R8A66597_HCD=m
257CONFIG_USB_ACM=m
258CONFIG_USB_PRINTER=m
259CONFIG_USB_WDM=m
260CONFIG_USB_TMC=m
261CONFIG_NEW_LEDS=y
262CONFIG_LEDS_CLASS=y
263CONFIG_LEDS_TRIGGERS=y
264CONFIG_LEDS_TRIGGER_TIMER=y
265CONFIG_LEDS_TRIGGER_ONESHOT=y
266CONFIG_LEDS_TRIGGER_IDE_DISK=y
267CONFIG_LEDS_TRIGGER_HEARTBEAT=m
268CONFIG_LEDS_TRIGGER_BACKLIGHT=m
269CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
270CONFIG_UIO=y
271CONFIG_UIO_PDRV_GENIRQ=m
272CONFIG_UIO_AEC=m
273CONFIG_UIO_SERCOS3=m
274CONFIG_UIO_PCI_GENERIC=m
275CONFIG_STAGING=y
276# CONFIG_NET_VENDOR_SILICOM is not set
277CONFIG_EXT2_FS=y
278CONFIG_EXT2_FS_XATTR=y
279CONFIG_EXT2_FS_SECURITY=y
280CONFIG_EXT3_FS=y
281CONFIG_EXT3_FS_SECURITY=y
282CONFIG_EXT4_FS=y
283CONFIG_EXT4_FS_SECURITY=y
284CONFIG_XFS_FS=m
285CONFIG_BTRFS_FS=m
286CONFIG_QUOTA=y
287CONFIG_QUOTA_NETLINK_INTERFACE=y
288CONFIG_QFMT_V2=y
289CONFIG_AUTOFS4_FS=y
290CONFIG_FUSE_FS=y
291CONFIG_CUSE=y
292CONFIG_ISO9660_FS=y
293CONFIG_UDF_FS=y
294CONFIG_VFAT_FS=m
295CONFIG_PROC_KCORE=y
296CONFIG_TMPFS=y
297CONFIG_TMPFS_XATTR=y
298CONFIG_CONFIGFS_FS=y
299CONFIG_SYSV_FS=y
300CONFIG_NFS_FS=m
301CONFIG_NFS_V4=m
302CONFIG_NFS_V4_1=y
303CONFIG_NFSD=m
304CONFIG_NFSD_V4=y
305CONFIG_NLS_DEFAULT="utf8"
306CONFIG_NLS_CODEPAGE_437=m
307CONFIG_NLS_CODEPAGE_850=m
308CONFIG_NLS_CODEPAGE_852=m
309CONFIG_NLS_CODEPAGE_1250=m
310CONFIG_NLS_CODEPAGE_1251=m
311CONFIG_NLS_ASCII=m
312CONFIG_NLS_ISO8859_1=m
313CONFIG_NLS_ISO8859_2=m
314CONFIG_NLS_UTF8=m
315CONFIG_PRINTK_TIME=y
316CONFIG_STRIP_ASM_SYMS=y
317CONFIG_UNUSED_SYMBOLS=y
318CONFIG_DEBUG_FS=y
319CONFIG_MAGIC_SYSRQ=y
320CONFIG_DEBUG_KERNEL=y
321CONFIG_DEBUG_STACKOVERFLOW=y
322CONFIG_LOCKUP_DETECTOR=y
323CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
324CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y
325# CONFIG_SCHED_DEBUG is not set
326CONFIG_TIMER_STATS=y
327CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y
328CONFIG_CRYPTO_MANAGER=y
329CONFIG_CRYPTO_ECB=m
330CONFIG_CRYPTO_PCBC=m
331CONFIG_CRYPTO_MD4=m
332CONFIG_CRYPTO_MD5=y
333CONFIG_CRYPTO_MICHAEL_MIC=m
334CONFIG_CRYPTO_SHA256=m
335CONFIG_CRYPTO_ARC4=m
336CONFIG_CRYPTO_FCRYPT=m
337CONFIG_CRYPTO_DEFLATE=m
338# CONFIG_CRYPTO_HW is not set
339CONFIG_CRC_CCITT=m
340CONFIG_LIBCRC32C=y
341CONFIG_XZ_DEC_X86=y
342CONFIG_XZ_DEC_POWERPC=y
343CONFIG_XZ_DEC_IA64=y
344CONFIG_XZ_DEC_ARM=y
345CONFIG_XZ_DEC_ARMTHUMB=y
346CONFIG_XZ_DEC_SPARC=y
diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild
index ff4c9faed546..a603b9ebe54c 100644
--- a/arch/parisc/include/asm/Kbuild
+++ b/arch/parisc/include/asm/Kbuild
@@ -4,3 +4,4 @@ generic-y += word-at-a-time.h auxvec.h user.h cputime.h emergency-restart.h \
4 div64.h irq_regs.h kdebug.h kvm_para.h local64.h local.h param.h \ 4 div64.h irq_regs.h kdebug.h kvm_para.h local64.h local.h param.h \
5 poll.h xor.h clkdev.h exec.h 5 poll.h xor.h clkdev.h exec.h
6generic-y += trace_clock.h 6generic-y += trace_clock.h
7generic-y += preempt.h
diff --git a/arch/parisc/include/asm/assembly.h b/arch/parisc/include/asm/assembly.h
index 0da848232344..b3069fd83468 100644
--- a/arch/parisc/include/asm/assembly.h
+++ b/arch/parisc/include/asm/assembly.h
@@ -515,5 +515,17 @@
515 nop /* 7 */ 515 nop /* 7 */
516 .endm 516 .endm
517 517
518 /*
519 * ASM_EXCEPTIONTABLE_ENTRY
520 *
521 * Creates an exception table entry.
522 * Do not convert to a assembler macro. This won't work.
523 */
524#define ASM_EXCEPTIONTABLE_ENTRY(fault_addr, except_addr) \
525 .section __ex_table,"aw" ! \
526 ASM_ULONG_INSN fault_addr, except_addr ! \
527 .previous
528
529
518#endif /* __ASSEMBLY__ */ 530#endif /* __ASSEMBLY__ */
519#endif 531#endif
diff --git a/arch/parisc/include/asm/delay.h b/arch/parisc/include/asm/delay.h
index 912ee7e6a579..08e58e679e3e 100644
--- a/arch/parisc/include/asm/delay.h
+++ b/arch/parisc/include/asm/delay.h
@@ -1,15 +1,5 @@
1#ifndef _PARISC_DELAY_H 1#ifndef _ASM_PARISC_DELAY_H
2#define _PARISC_DELAY_H 2#define _ASM_PARISC_DELAY_H
3
4#include <asm/special_insns.h> /* for mfctl() */
5#include <asm/processor.h> /* for boot_cpu_data */
6
7
8/*
9 * Copyright (C) 1993 Linus Torvalds
10 *
11 * Delay routines
12 */
13 3
14static __inline__ void __delay(unsigned long loops) { 4static __inline__ void __delay(unsigned long loops) {
15 asm volatile( 5 asm volatile(
@@ -19,25 +9,14 @@ static __inline__ void __delay(unsigned long loops) {
19 : "=r" (loops) : "0" (loops)); 9 : "=r" (loops) : "0" (loops));
20} 10}
21 11
22static __inline__ void __cr16_delay(unsigned long clocks) { 12extern void __udelay(unsigned long usecs);
23 unsigned long start; 13extern void __udelay_bad(unsigned long usecs);
24
25 /*
26 * Note: Due to unsigned math, cr16 rollovers shouldn't be
27 * a problem here. However, on 32 bit, we need to make sure
28 * we don't pass in too big a value. The current default
29 * value of MAX_UDELAY_MS should help prevent this.
30 */
31 14
32 start = mfctl(16); 15static inline void udelay(unsigned long usecs)
33 while ((mfctl(16) - start) < clocks) 16{
34 ; 17 if (__builtin_constant_p(usecs) && (usecs) > 20000)
18 __udelay_bad(usecs);
19 __udelay(usecs);
35} 20}
36 21
37static __inline__ void __udelay(unsigned long usecs) { 22#endif /* _ASM_PARISC_DELAY_H */
38 __cr16_delay(usecs * ((unsigned long)boot_cpu_data.cpu_hz / 1000000UL));
39}
40
41#define udelay(n) __udelay(n)
42
43#endif /* defined(_PARISC_DELAY_H) */
diff --git a/arch/parisc/include/asm/hardirq.h b/arch/parisc/include/asm/hardirq.h
index 241c34518465..9b3bd039a609 100644
--- a/arch/parisc/include/asm/hardirq.h
+++ b/arch/parisc/include/asm/hardirq.h
@@ -21,7 +21,6 @@ typedef struct {
21 unsigned int irq_stack_usage; 21 unsigned int irq_stack_usage;
22#ifdef CONFIG_SMP 22#ifdef CONFIG_SMP
23 unsigned int irq_resched_count; 23 unsigned int irq_resched_count;
24 unsigned int irq_call_count;
25#endif 24#endif
26 unsigned int irq_unaligned_count; 25 unsigned int irq_unaligned_count;
27 unsigned int irq_fpassist_count; 26 unsigned int irq_fpassist_count;
diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h
index fc987a1c12a8..f213f5b4c423 100644
--- a/arch/parisc/include/asm/pgalloc.h
+++ b/arch/parisc/include/asm/pgalloc.h
@@ -121,8 +121,12 @@ static inline pgtable_t
121pte_alloc_one(struct mm_struct *mm, unsigned long address) 121pte_alloc_one(struct mm_struct *mm, unsigned long address)
122{ 122{
123 struct page *page = alloc_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); 123 struct page *page = alloc_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
124 if (page) 124 if (!page)
125 pgtable_page_ctor(page); 125 return NULL;
126 if (!pgtable_page_ctor(page)) {
127 __free_page(page);
128 return NULL;
129 }
126 return page; 130 return page;
127} 131}
128 132
diff --git a/arch/parisc/include/asm/ptrace.h b/arch/parisc/include/asm/ptrace.h
index a2db278a5def..3c3cb004b7e2 100644
--- a/arch/parisc/include/asm/ptrace.h
+++ b/arch/parisc/include/asm/ptrace.h
@@ -19,5 +19,9 @@
19#define user_stack_pointer(regs) ((regs)->gr[30]) 19#define user_stack_pointer(regs) ((regs)->gr[30])
20unsigned long profile_pc(struct pt_regs *); 20unsigned long profile_pc(struct pt_regs *);
21 21
22static inline unsigned long regs_return_value(struct pt_regs *regs)
23{
24 return regs->gr[20];
25}
22 26
23#endif 27#endif
diff --git a/arch/parisc/include/asm/thread_info.h b/arch/parisc/include/asm/thread_info.h
index 540c88fa8f86..bc7cf120106b 100644
--- a/arch/parisc/include/asm/thread_info.h
+++ b/arch/parisc/include/asm/thread_info.h
@@ -59,6 +59,7 @@ struct thread_info {
59#define TIF_32BIT 4 /* 32 bit binary */ 59#define TIF_32BIT 4 /* 32 bit binary */
60#define TIF_MEMDIE 5 /* is terminating due to OOM killer */ 60#define TIF_MEMDIE 5 /* is terminating due to OOM killer */
61#define TIF_RESTORE_SIGMASK 6 /* restore saved signal mask */ 61#define TIF_RESTORE_SIGMASK 6 /* restore saved signal mask */
62#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
62#define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ 63#define TIF_NOTIFY_RESUME 8 /* callback before returning to user */
63#define TIF_SINGLESTEP 9 /* single stepping? */ 64#define TIF_SINGLESTEP 9 /* single stepping? */
64#define TIF_BLOCKSTEP 10 /* branch stepping? */ 65#define TIF_BLOCKSTEP 10 /* branch stepping? */
@@ -68,6 +69,7 @@ struct thread_info {
68#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 69#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
69#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 70#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
70#define _TIF_32BIT (1 << TIF_32BIT) 71#define _TIF_32BIT (1 << TIF_32BIT)
72#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
71#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 73#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
72#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) 74#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
73#define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) 75#define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP)
@@ -75,7 +77,7 @@ struct thread_info {
75#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \ 77#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \
76 _TIF_NEED_RESCHED) 78 _TIF_NEED_RESCHED)
77#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ 79#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
78 _TIF_BLOCKSTEP) 80 _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT)
79 81
80#endif /* __KERNEL__ */ 82#endif /* __KERNEL__ */
81 83
diff --git a/arch/parisc/include/asm/traps.h b/arch/parisc/include/asm/traps.h
index 1945f995f2df..4736020ba5ea 100644
--- a/arch/parisc/include/asm/traps.h
+++ b/arch/parisc/include/asm/traps.h
@@ -6,7 +6,7 @@ struct pt_regs;
6 6
7/* traps.c */ 7/* traps.c */
8void parisc_terminate(char *msg, struct pt_regs *regs, 8void parisc_terminate(char *msg, struct pt_regs *regs,
9 int code, unsigned long offset); 9 int code, unsigned long offset) __noreturn __cold;
10 10
11/* mm/fault.c */ 11/* mm/fault.c */
12void do_page_fault(struct pt_regs *regs, unsigned long code, 12void do_page_fault(struct pt_regs *regs, unsigned long code,
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h
index e0a82358517e..63f4dd0b49c2 100644
--- a/arch/parisc/include/asm/uaccess.h
+++ b/arch/parisc/include/asm/uaccess.h
@@ -4,11 +4,14 @@
4/* 4/*
5 * User space memory access functions 5 * User space memory access functions
6 */ 6 */
7#include <asm/processor.h>
7#include <asm/page.h> 8#include <asm/page.h>
8#include <asm/cache.h> 9#include <asm/cache.h>
9#include <asm/errno.h> 10#include <asm/errno.h>
10#include <asm-generic/uaccess-unaligned.h> 11#include <asm-generic/uaccess-unaligned.h>
11 12
13#include <linux/sched.h>
14
12#define VERIFY_READ 0 15#define VERIFY_READ 0
13#define VERIFY_WRITE 1 16#define VERIFY_WRITE 1
14 17
@@ -33,12 +36,43 @@ extern int __get_user_bad(void);
33extern int __put_kernel_bad(void); 36extern int __put_kernel_bad(void);
34extern int __put_user_bad(void); 37extern int __put_user_bad(void);
35 38
36static inline long access_ok(int type, const void __user * addr, 39
37 unsigned long size) 40/*
41 * Test whether a block of memory is a valid user space address.
42 * Returns 0 if the range is valid, nonzero otherwise.
43 */
44static inline int __range_not_ok(unsigned long addr, unsigned long size,
45 unsigned long limit)
38{ 46{
39 return 1; 47 unsigned long __newaddr = addr + size;
48 return (__newaddr < addr || __newaddr > limit || size > limit);
40} 49}
41 50
51/**
52 * access_ok: - Checks if a user space pointer is valid
53 * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that
54 * %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe
55 * to write to a block, it is always safe to read from it.
56 * @addr: User space pointer to start of block to check
57 * @size: Size of block to check
58 *
59 * Context: User context only. This function may sleep.
60 *
61 * Checks if a pointer to a block of memory in user space is valid.
62 *
63 * Returns true (nonzero) if the memory block may be valid, false (zero)
64 * if it is definitely invalid.
65 *
66 * Note that, depending on architecture, this function probably just
67 * checks that the pointer is in the user space range - after calling
68 * this function, memory access functions may still return -EFAULT.
69 */
70#define access_ok(type, addr, size) \
71( __chk_user_ptr(addr), \
72 !__range_not_ok((unsigned long) (__force void *) (addr), \
73 size, user_addr_max()) \
74)
75
42#define put_user __put_user 76#define put_user __put_user
43#define get_user __get_user 77#define get_user __get_user
44 78
@@ -59,12 +93,13 @@ static inline long access_ok(int type, const void __user * addr,
59/* 93/*
60 * The exception table contains two values: the first is an address 94 * The exception table contains two values: the first is an address
61 * for an instruction that is allowed to fault, and the second is 95 * for an instruction that is allowed to fault, and the second is
62 * the address to the fixup routine. 96 * the address to the fixup routine. Even on a 64bit kernel we could
97 * use a 32bit (unsigned int) address here.
63 */ 98 */
64 99
65struct exception_table_entry { 100struct exception_table_entry {
66 unsigned long insn; /* address of insn that is allowed to fault. */ 101 unsigned long insn; /* address of insn that is allowed to fault. */
67 long fixup; /* fixup routine */ 102 unsigned long fixup; /* fixup routine */
68}; 103};
69 104
70#define ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr )\ 105#define ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr )\
@@ -218,7 +253,11 @@ extern long lstrnlen_user(const char __user *,long);
218/* 253/*
219 * Complex access routines -- macros 254 * Complex access routines -- macros
220 */ 255 */
221#define user_addr_max() (~0UL) 256#ifdef CONFIG_COMPAT
257#define user_addr_max() (TASK_SIZE)
258#else
259#define user_addr_max() (DEFAULT_TASK_SIZE)
260#endif
222 261
223#define strnlen_user lstrnlen_user 262#define strnlen_user lstrnlen_user
224#define strlen_user(str) lstrnlen_user(str, 0x7fffffffL) 263#define strlen_user(str) lstrnlen_user(str, 0x7fffffffL)
diff --git a/arch/parisc/include/uapi/asm/errno.h b/arch/parisc/include/uapi/asm/errno.h
index 135ad6047e51..f3a8aa554841 100644
--- a/arch/parisc/include/uapi/asm/errno.h
+++ b/arch/parisc/include/uapi/asm/errno.h
@@ -37,7 +37,7 @@
37#define EBADMSG 67 /* Not a data message */ 37#define EBADMSG 67 /* Not a data message */
38#define EUSERS 68 /* Too many users */ 38#define EUSERS 68 /* Too many users */
39#define EDQUOT 69 /* Quota exceeded */ 39#define EDQUOT 69 /* Quota exceeded */
40#define ESTALE 70 /* Stale NFS file handle */ 40#define ESTALE 70 /* Stale file handle */
41#define EREMOTE 71 /* Object is remote */ 41#define EREMOTE 71 /* Object is remote */
42#define EOVERFLOW 72 /* Value too large for defined data type */ 42#define EOVERFLOW 72 /* Value too large for defined data type */
43 43
diff --git a/arch/parisc/include/uapi/asm/socket.h b/arch/parisc/include/uapi/asm/socket.h
index 71700e636a8e..7c614d01f1fa 100644
--- a/arch/parisc/include/uapi/asm/socket.h
+++ b/arch/parisc/include/uapi/asm/socket.h
@@ -75,6 +75,8 @@
75 75
76#define SO_BUSY_POLL 0x4027 76#define SO_BUSY_POLL 0x4027
77 77
78#define SO_MAX_PACING_RATE 0x4048
79
78/* O_NONBLOCK clashes with the bits used for socket types. Therefore we 80/* O_NONBLOCK clashes with the bits used for socket types. Therefore we
79 * have to define SOCK_NONBLOCK to a different value here. 81 * have to define SOCK_NONBLOCK to a different value here.
80 */ 82 */
diff --git a/arch/parisc/install.sh b/arch/parisc/install.sh
index 4da682b466d0..6f68784fea25 100644
--- a/arch/parisc/install.sh
+++ b/arch/parisc/install.sh
@@ -19,20 +19,48 @@
19# $4 - default install path (blank if root directory) 19# $4 - default install path (blank if root directory)
20# 20#
21 21
22verify () {
23 if [ ! -f "$1" ]; then
24 echo "" 1>&2
25 echo " *** Missing file: $1" 1>&2
26 echo ' *** You need to run "make" before "make install".' 1>&2
27 echo "" 1>&2
28 exit 1
29 fi
30}
31
32# Make sure the files actually exist
33
34verify "$2"
35verify "$3"
36
22# User may have a custom install script 37# User may have a custom install script
23 38
24if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi 39if [ -n "${INSTALLKERNEL}" ]; then
25if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi 40 if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
41 if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
42fi
26 43
27# Default install 44# Default install
28 45
29if [ -f $4/vmlinuz ]; then 46if [ "$(basename $2)" = "zImage" ]; then
30 mv $4/vmlinuz $4/vmlinuz.old 47# Compressed install
48 echo "Installing compressed kernel"
49 base=vmlinuz
50else
51# Normal install
52 echo "Installing normal kernel"
53 base=vmlinux
54fi
55
56if [ -f $4/$base-$1 ]; then
57 mv $4/$base-$1 $4/$base-$1.old
31fi 58fi
59cat $2 > $4/$base-$1
32 60
33if [ -f $4/System.map ]; then 61# Install system map file
34 mv $4/System.map $4/System.old 62if [ -f $4/System.map-$1 ]; then
63 mv $4/System.map-$1 $4/System.map-$1.old
35fi 64fi
65cp $3 $4/System.map-$1
36 66
37cat $2 > $4/vmlinuz
38cp $3 $4/System.map
diff --git a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile
index 66ee3f12df58..ff87b4603e3d 100644
--- a/arch/parisc/kernel/Makefile
+++ b/arch/parisc/kernel/Makefile
@@ -29,7 +29,9 @@ obj-$(CONFIG_PCI) += pci.o
29obj-$(CONFIG_MODULES) += module.o 29obj-$(CONFIG_MODULES) += module.o
30obj-$(CONFIG_64BIT) += binfmt_elf32.o sys_parisc32.o signal32.o 30obj-$(CONFIG_64BIT) += binfmt_elf32.o sys_parisc32.o signal32.o
31obj-$(CONFIG_STACKTRACE)+= stacktrace.o 31obj-$(CONFIG_STACKTRACE)+= stacktrace.o
32obj-$(CONFIG_AUDIT) += audit.o
33obj64-$(CONFIG_AUDIT) += compat_audit.o
32# only supported for PCX-W/U in 64-bit mode at the moment 34# only supported for PCX-W/U in 64-bit mode at the moment
33obj-$(CONFIG_64BIT) += perf.o perf_asm.o 35obj-$(CONFIG_64BIT) += perf.o perf_asm.o $(obj64-y)
34obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o 36obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o
35obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o 37obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
diff --git a/arch/parisc/kernel/audit.c b/arch/parisc/kernel/audit.c
new file mode 100644
index 000000000000..eb64a6148c82
--- /dev/null
+++ b/arch/parisc/kernel/audit.c
@@ -0,0 +1,81 @@
1#include <linux/init.h>
2#include <linux/types.h>
3#include <linux/audit.h>
4#include <asm/unistd.h>
5
6static unsigned dir_class[] = {
7#include <asm-generic/audit_dir_write.h>
8~0U
9};
10
11static unsigned read_class[] = {
12#include <asm-generic/audit_read.h>
13~0U
14};
15
16static unsigned write_class[] = {
17#include <asm-generic/audit_write.h>
18~0U
19};
20
21static unsigned chattr_class[] = {
22#include <asm-generic/audit_change_attr.h>
23~0U
24};
25
26static unsigned signal_class[] = {
27#include <asm-generic/audit_signal.h>
28~0U
29};
30
31int audit_classify_arch(int arch)
32{
33#ifdef CONFIG_COMPAT
34 if (arch == AUDIT_ARCH_PARISC)
35 return 1;
36#endif
37 return 0;
38}
39
40int audit_classify_syscall(int abi, unsigned syscall)
41{
42#ifdef CONFIG_COMPAT
43 extern int parisc32_classify_syscall(unsigned);
44 if (abi == AUDIT_ARCH_PARISC)
45 return parisc32_classify_syscall(syscall);
46#endif
47 switch (syscall) {
48 case __NR_open:
49 return 2;
50 case __NR_openat:
51 return 3;
52 case __NR_execve:
53 return 5;
54 default:
55 return 0;
56 }
57}
58
59static int __init audit_classes_init(void)
60{
61#ifdef CONFIG_COMPAT
62 extern __u32 parisc32_dir_class[];
63 extern __u32 parisc32_write_class[];
64 extern __u32 parisc32_read_class[];
65 extern __u32 parisc32_chattr_class[];
66 extern __u32 parisc32_signal_class[];
67 audit_register_class(AUDIT_CLASS_WRITE_32, parisc32_write_class);
68 audit_register_class(AUDIT_CLASS_READ_32, parisc32_read_class);
69 audit_register_class(AUDIT_CLASS_DIR_WRITE_32, parisc32_dir_class);
70 audit_register_class(AUDIT_CLASS_CHATTR_32, parisc32_chattr_class);
71 audit_register_class(AUDIT_CLASS_SIGNAL_32, parisc32_signal_class);
72#endif
73 audit_register_class(AUDIT_CLASS_WRITE, write_class);
74 audit_register_class(AUDIT_CLASS_READ, read_class);
75 audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class);
76 audit_register_class(AUDIT_CLASS_CHATTR, chattr_class);
77 audit_register_class(AUDIT_CLASS_SIGNAL, signal_class);
78 return 0;
79}
80
81__initcall(audit_classes_init);
diff --git a/arch/parisc/kernel/compat_audit.c b/arch/parisc/kernel/compat_audit.c
new file mode 100644
index 000000000000..c74478f6bc74
--- /dev/null
+++ b/arch/parisc/kernel/compat_audit.c
@@ -0,0 +1,40 @@
1#include <asm/unistd.h>
2
3unsigned int parisc32_dir_class[] = {
4#include <asm-generic/audit_dir_write.h>
5~0U
6};
7
8unsigned int parisc32_chattr_class[] = {
9#include <asm-generic/audit_change_attr.h>
10~0U
11};
12
13unsigned int parisc32_write_class[] = {
14#include <asm-generic/audit_write.h>
15~0U
16};
17
18unsigned int parisc32_read_class[] = {
19#include <asm-generic/audit_read.h>
20~0U
21};
22
23unsigned int parisc32_signal_class[] = {
24#include <asm-generic/audit_signal.h>
25~0U
26};
27
28int parisc32_classify_syscall(unsigned syscall)
29{
30 switch (syscall) {
31 case __NR_open:
32 return 2;
33 case __NR_openat:
34 return 3;
35 case __NR_execve:
36 return 5;
37 default:
38 return 1;
39 }
40}
diff --git a/arch/parisc/kernel/head.S b/arch/parisc/kernel/head.S
index 37aabd772fbb..d2d58258aea6 100644
--- a/arch/parisc/kernel/head.S
+++ b/arch/parisc/kernel/head.S
@@ -195,6 +195,8 @@ common_stext:
195 ldw MEM_PDC_HI(%r0),%r6 195 ldw MEM_PDC_HI(%r0),%r6
196 depd %r6, 31, 32, %r3 /* move to upper word */ 196 depd %r6, 31, 32, %r3 /* move to upper word */
197 197
198 mfctl %cr30,%r6 /* PCX-W2 firmware bug */
199
198 ldo PDC_PSW(%r0),%arg0 /* 21 */ 200 ldo PDC_PSW(%r0),%arg0 /* 21 */
199 ldo PDC_PSW_SET_DEFAULTS(%r0),%arg1 /* 2 */ 201 ldo PDC_PSW_SET_DEFAULTS(%r0),%arg1 /* 2 */
200 ldo PDC_PSW_WIDE_BIT(%r0),%arg2 /* 2 */ 202 ldo PDC_PSW_WIDE_BIT(%r0),%arg2 /* 2 */
@@ -203,6 +205,8 @@ common_stext:
203 copy %r0,%arg3 205 copy %r0,%arg3
204 206
205stext_pdc_ret: 207stext_pdc_ret:
208 mtctl %r6,%cr30 /* restore task thread info */
209
206 /* restore rfi target address*/ 210 /* restore rfi target address*/
207 ldd TI_TASK-THREAD_SZ_ALGN(%sp), %r10 211 ldd TI_TASK-THREAD_SZ_ALGN(%sp), %r10
208 tophys_r1 %r10 212 tophys_r1 %r10
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index 2e6443b1e922..8ceac4785609 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -179,10 +179,6 @@ int arch_show_interrupts(struct seq_file *p, int prec)
179 for_each_online_cpu(j) 179 for_each_online_cpu(j)
180 seq_printf(p, "%10u ", irq_stats(j)->irq_resched_count); 180 seq_printf(p, "%10u ", irq_stats(j)->irq_resched_count);
181 seq_puts(p, " Rescheduling interrupts\n"); 181 seq_puts(p, " Rescheduling interrupts\n");
182 seq_printf(p, "%*s: ", prec, "CAL");
183 for_each_online_cpu(j)
184 seq_printf(p, "%10u ", irq_stats(j)->irq_call_count);
185 seq_puts(p, " Function call interrupts\n");
186#endif 182#endif
187 seq_printf(p, "%*s: ", prec, "UAH"); 183 seq_printf(p, "%*s: ", prec, "UAH");
188 for_each_online_cpu(j) 184 for_each_online_cpu(j)
@@ -499,22 +495,9 @@ static void execute_on_irq_stack(void *func, unsigned long param1)
499 *irq_stack_in_use = 1; 495 *irq_stack_in_use = 1;
500} 496}
501 497
502asmlinkage void do_softirq(void) 498void do_softirq_own_stack(void)
503{ 499{
504 __u32 pending; 500 execute_on_irq_stack(__do_softirq, 0);
505 unsigned long flags;
506
507 if (in_interrupt())
508 return;
509
510 local_irq_save(flags);
511
512 pending = local_softirq_pending();
513
514 if (pending)
515 execute_on_irq_stack(__do_softirq, 0);
516
517 local_irq_restore(flags);
518} 501}
519#endif /* CONFIG_IRQSTACKS */ 502#endif /* CONFIG_IRQSTACKS */
520 503
diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
index 2a625fb063e1..50dfafc3f2c1 100644
--- a/arch/parisc/kernel/module.c
+++ b/arch/parisc/kernel/module.c
@@ -219,7 +219,7 @@ void *module_alloc(unsigned long size)
219 * init_data correctly */ 219 * init_data correctly */
220 return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END, 220 return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END,
221 GFP_KERNEL | __GFP_HIGHMEM, 221 GFP_KERNEL | __GFP_HIGHMEM,
222 PAGE_KERNEL_RWX, -1, 222 PAGE_KERNEL_RWX, NUMA_NO_NODE,
223 __builtin_return_address(0)); 223 __builtin_return_address(0));
224} 224}
225 225
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index 534abd4936e1..e842ee233db4 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -19,6 +19,7 @@
19#include <linux/security.h> 19#include <linux/security.h>
20#include <linux/compat.h> 20#include <linux/compat.h>
21#include <linux/signal.h> 21#include <linux/signal.h>
22#include <linux/audit.h>
22 23
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
24#include <asm/pgtable.h> 25#include <asm/pgtable.h>
@@ -267,11 +268,28 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
267 268
268long do_syscall_trace_enter(struct pt_regs *regs) 269long do_syscall_trace_enter(struct pt_regs *regs)
269{ 270{
271 long ret = 0;
272
270 if (test_thread_flag(TIF_SYSCALL_TRACE) && 273 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
271 tracehook_report_syscall_entry(regs)) 274 tracehook_report_syscall_entry(regs))
272 return -1L; 275 ret = -1L;
273 276
274 return regs->gr[20]; 277#ifdef CONFIG_64BIT
278 if (!is_compat_task())
279 audit_syscall_entry(AUDIT_ARCH_PARISC64,
280 regs->gr[20],
281 regs->gr[26], regs->gr[25],
282 regs->gr[24], regs->gr[23]);
283 else
284#endif
285 audit_syscall_entry(AUDIT_ARCH_PARISC,
286 regs->gr[20] & 0xffffffff,
287 regs->gr[26] & 0xffffffff,
288 regs->gr[25] & 0xffffffff,
289 regs->gr[24] & 0xffffffff,
290 regs->gr[23] & 0xffffffff);
291
292 return ret ? : regs->gr[20];
275} 293}
276 294
277void do_syscall_trace_exit(struct pt_regs *regs) 295void do_syscall_trace_exit(struct pt_regs *regs)
@@ -279,6 +297,8 @@ void do_syscall_trace_exit(struct pt_regs *regs)
279 int stepping = test_thread_flag(TIF_SINGLESTEP) || 297 int stepping = test_thread_flag(TIF_SINGLESTEP) ||
280 test_thread_flag(TIF_BLOCKSTEP); 298 test_thread_flag(TIF_BLOCKSTEP);
281 299
300 audit_syscall_exit(regs);
301
282 if (stepping || test_thread_flag(TIF_SYSCALL_TRACE)) 302 if (stepping || test_thread_flag(TIF_SYSCALL_TRACE))
283 tracehook_report_syscall_exit(regs, stepping); 303 tracehook_report_syscall_exit(regs, stepping);
284} 304}
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 7349a3fedfc7..72a3c658ad7b 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -318,8 +318,12 @@ static int __init parisc_init(void)
318 pdc_stable_write(0x40, &osid, sizeof(osid)); 318 pdc_stable_write(0x40, &osid, sizeof(osid));
319 319
320 processor_init(); 320 processor_init();
321 printk(KERN_INFO "CPU(s): %d x %s at %d.%06d MHz\n", 321#ifdef CONFIG_SMP
322 num_present_cpus(), 322 pr_info("CPU(s): %d out of %d %s at %d.%06d MHz online\n",
323 num_online_cpus(), num_present_cpus(),
324#else
325 pr_info("CPU(s): 1 x %s at %d.%06d MHz\n",
326#endif
323 boot_cpu_data.cpu_name, 327 boot_cpu_data.cpu_name,
324 boot_cpu_data.cpu_hz / 1000000, 328 boot_cpu_data.cpu_hz / 1000000,
325 boot_cpu_data.cpu_hz % 1000000 ); 329 boot_cpu_data.cpu_hz % 1000000 );
diff --git a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c
index 6c6a271a6140..984abbee71ca 100644
--- a/arch/parisc/kernel/signal32.c
+++ b/arch/parisc/kernel/signal32.c
@@ -319,7 +319,7 @@ copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from)
319} 319}
320 320
321int 321int
322copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from) 322copy_siginfo_to_user32 (compat_siginfo_t __user *to, const siginfo_t *from)
323{ 323{
324 compat_uptr_t addr; 324 compat_uptr_t addr;
325 compat_int_t val; 325 compat_int_t val;
diff --git a/arch/parisc/kernel/signal32.h b/arch/parisc/kernel/signal32.h
index 72ab41a51f32..af51d4ccee42 100644
--- a/arch/parisc/kernel/signal32.h
+++ b/arch/parisc/kernel/signal32.h
@@ -34,7 +34,7 @@ struct compat_ucontext {
34 34
35/* ELF32 signal handling */ 35/* ELF32 signal handling */
36 36
37int copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from); 37int copy_siginfo_to_user32 (compat_siginfo_t __user *to, const siginfo_t *from);
38int copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from); 38int copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from);
39 39
40/* In a deft move of uber-hackery, we decide to carry the top half of all 40/* In a deft move of uber-hackery, we decide to carry the top half of all
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index 8a252f2d6c08..ceda229ea6c2 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -72,7 +72,6 @@ enum ipi_message_type {
72 IPI_NOP=0, 72 IPI_NOP=0,
73 IPI_RESCHEDULE=1, 73 IPI_RESCHEDULE=1,
74 IPI_CALL_FUNC, 74 IPI_CALL_FUNC,
75 IPI_CALL_FUNC_SINGLE,
76 IPI_CPU_START, 75 IPI_CPU_START,
77 IPI_CPU_STOP, 76 IPI_CPU_STOP,
78 IPI_CPU_TEST 77 IPI_CPU_TEST
@@ -126,11 +125,6 @@ ipi_interrupt(int irq, void *dev_id)
126 unsigned long ops; 125 unsigned long ops;
127 unsigned long flags; 126 unsigned long flags;
128 127
129 /* Count this now; we may make a call that never returns. */
130 inc_irq_stat(irq_call_count);
131
132 mb(); /* Order interrupt and bit testing. */
133
134 for (;;) { 128 for (;;) {
135 spinlock_t *lock = &per_cpu(ipi_lock, this_cpu); 129 spinlock_t *lock = &per_cpu(ipi_lock, this_cpu);
136 spin_lock_irqsave(lock, flags); 130 spin_lock_irqsave(lock, flags);
@@ -164,11 +158,6 @@ ipi_interrupt(int irq, void *dev_id)
164 generic_smp_call_function_interrupt(); 158 generic_smp_call_function_interrupt();
165 break; 159 break;
166 160
167 case IPI_CALL_FUNC_SINGLE:
168 smp_debug(100, KERN_DEBUG "CPU%d IPI_CALL_FUNC_SINGLE\n", this_cpu);
169 generic_smp_call_function_single_interrupt();
170 break;
171
172 case IPI_CPU_START: 161 case IPI_CPU_START:
173 smp_debug(100, KERN_DEBUG "CPU%d IPI_CPU_START\n", this_cpu); 162 smp_debug(100, KERN_DEBUG "CPU%d IPI_CPU_START\n", this_cpu);
174 break; 163 break;
@@ -260,7 +249,7 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)
260 249
261void arch_send_call_function_single_ipi(int cpu) 250void arch_send_call_function_single_ipi(int cpu)
262{ 251{
263 send_IPI_single(cpu, IPI_CALL_FUNC_SINGLE); 252 send_IPI_single(cpu, IPI_CALL_FUNC);
264} 253}
265 254
266/* 255/*
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index e767ab733e32..a63bb179f79a 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -649,10 +649,8 @@ cas_action:
649 /* Two exception table entries, one for the load, 649 /* Two exception table entries, one for the load,
650 the other for the store. Either return -EFAULT. 650 the other for the store. Either return -EFAULT.
651 Each of the entries must be relocated. */ 651 Each of the entries must be relocated. */
652 .section __ex_table,"aw" 652 ASM_EXCEPTIONTABLE_ENTRY(1b-linux_gateway_page, 3b-linux_gateway_page)
653 ASM_ULONG_INSN (1b - linux_gateway_page), (3b - linux_gateway_page) 653 ASM_EXCEPTIONTABLE_ENTRY(2b-linux_gateway_page, 3b-linux_gateway_page)
654 ASM_ULONG_INSN (2b - linux_gateway_page), (3b - linux_gateway_page)
655 .previous
656 654
657 655
658 /* Make sure nothing else is placed on this page */ 656 /* Make sure nothing else is placed on this page */
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index 04e47c6a4562..1cd1d0c83b6d 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -291,11 +291,6 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
291 do_exit(SIGSEGV); 291 do_exit(SIGSEGV);
292} 292}
293 293
294int syscall_ipi(int (*syscall) (struct pt_regs *), struct pt_regs *regs)
295{
296 return syscall(regs);
297}
298
299/* gdb uses break 4,8 */ 294/* gdb uses break 4,8 */
300#define GDB_BREAK_INSN 0x10004 295#define GDB_BREAK_INSN 0x10004
301static void handle_gdb_break(struct pt_regs *regs, int wot) 296static void handle_gdb_break(struct pt_regs *regs, int wot)
@@ -805,14 +800,14 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
805 else { 800 else {
806 801
807 /* 802 /*
808 * The kernel should never fault on its own address space. 803 * The kernel should never fault on its own address space,
804 * unless pagefault_disable() was called before.
809 */ 805 */
810 806
811 if (fault_space == 0) 807 if (fault_space == 0 && !in_atomic())
812 { 808 {
813 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_PANIC); 809 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_PANIC);
814 parisc_terminate("Kernel Fault", regs, code, fault_address); 810 parisc_terminate("Kernel Fault", regs, code, fault_address);
815
816 } 811 }
817 } 812 }
818 813
diff --git a/arch/parisc/lib/Makefile b/arch/parisc/lib/Makefile
index 5651536ac733..8fa92b8d839a 100644
--- a/arch/parisc/lib/Makefile
+++ b/arch/parisc/lib/Makefile
@@ -3,6 +3,6 @@
3# 3#
4 4
5lib-y := lusercopy.o bitops.o checksum.o io.o memset.o fixup.o memcpy.o \ 5lib-y := lusercopy.o bitops.o checksum.o io.o memset.o fixup.o memcpy.o \
6 ucmpdi2.o 6 ucmpdi2.o delay.o
7 7
8obj-y := iomap.o 8obj-y := iomap.o
diff --git a/arch/parisc/lib/delay.c b/arch/parisc/lib/delay.c
new file mode 100644
index 000000000000..ec9255f27a81
--- /dev/null
+++ b/arch/parisc/lib/delay.c
@@ -0,0 +1,73 @@
1/*
2 * Precise Delay Loops for parisc
3 *
4 * based on code by:
5 * Copyright (C) 1993 Linus Torvalds
6 * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
7 * Copyright (C) 2008 Jiri Hladky <hladky _dot_ jiri _at_ gmail _dot_ com>
8 *
9 * parisc implementation:
10 * Copyright (C) 2013 Helge Deller <deller@gmx.de>
11 */
12
13
14#include <linux/module.h>
15#include <linux/preempt.h>
16#include <linux/init.h>
17
18#include <asm/processor.h>
19#include <asm/delay.h>
20
21#include <asm/special_insns.h> /* for mfctl() */
22#include <asm/processor.h> /* for boot_cpu_data */
23
24/* CR16 based delay: */
25static void __cr16_delay(unsigned long __loops)
26{
27 /*
28 * Note: Due to unsigned math, cr16 rollovers shouldn't be
29 * a problem here. However, on 32 bit, we need to make sure
30 * we don't pass in too big a value. The current default
31 * value of MAX_UDELAY_MS should help prevent this.
32 */
33 u32 bclock, now, loops = __loops;
34 int cpu;
35
36 preempt_disable();
37 cpu = smp_processor_id();
38 bclock = mfctl(16);
39 for (;;) {
40 now = mfctl(16);
41 if ((now - bclock) >= loops)
42 break;
43
44 /* Allow RT tasks to run */
45 preempt_enable();
46 asm volatile(" nop\n");
47 barrier();
48 preempt_disable();
49
50 /*
51 * It is possible that we moved to another CPU, and
52 * since CR16's are per-cpu we need to calculate
53 * that. The delay must guarantee that we wait "at
54 * least" the amount of time. Being moved to another
55 * CPU could make the wait longer but we just need to
56 * make sure we waited long enough. Rebalance the
57 * counter for this CPU.
58 */
59 if (unlikely(cpu != smp_processor_id())) {
60 loops -= (now - bclock);
61 cpu = smp_processor_id();
62 bclock = mfctl(16);
63 }
64 }
65 preempt_enable();
66}
67
68
69void __udelay(unsigned long usecs)
70{
71 __cr16_delay(usecs * ((unsigned long)boot_cpu_data.cpu_hz / 1000000UL));
72}
73EXPORT_SYMBOL(__udelay);
diff --git a/arch/parisc/lib/lusercopy.S b/arch/parisc/lib/lusercopy.S
index 6f2d9355efe2..a512f07d4feb 100644
--- a/arch/parisc/lib/lusercopy.S
+++ b/arch/parisc/lib/lusercopy.S
@@ -88,9 +88,7 @@ ENDPROC(lclear_user)
88 ldo 1(%r25),%r25 88 ldo 1(%r25),%r25
89 .previous 89 .previous
90 90
91 .section __ex_table,"aw" 91 ASM_EXCEPTIONTABLE_ENTRY(1b,2b)
92 ASM_ULONG_INSN 1b,2b
93 .previous
94 92
95 .procend 93 .procend
96 94
@@ -129,10 +127,8 @@ ENDPROC(lstrnlen_user)
129 copy %r24,%r26 /* reset r26 so 0 is returned on fault */ 127 copy %r24,%r26 /* reset r26 so 0 is returned on fault */
130 .previous 128 .previous
131 129
132 .section __ex_table,"aw" 130 ASM_EXCEPTIONTABLE_ENTRY(1b,3b)
133 ASM_ULONG_INSN 1b,3b 131 ASM_EXCEPTIONTABLE_ENTRY(2b,3b)
134 ASM_ULONG_INSN 2b,3b
135 .previous
136 132
137 .procend 133 .procend
138 134
diff --git a/arch/parisc/lib/memcpy.c b/arch/parisc/lib/memcpy.c
index ac4370b1ca40..b5507ec06b84 100644
--- a/arch/parisc/lib/memcpy.c
+++ b/arch/parisc/lib/memcpy.c
@@ -56,7 +56,7 @@
56#ifdef __KERNEL__ 56#ifdef __KERNEL__
57#include <linux/module.h> 57#include <linux/module.h>
58#include <linux/compiler.h> 58#include <linux/compiler.h>
59#include <asm/uaccess.h> 59#include <linux/uaccess.h>
60#define s_space "%%sr1" 60#define s_space "%%sr1"
61#define d_space "%%sr2" 61#define d_space "%%sr2"
62#else 62#else
@@ -524,4 +524,17 @@ EXPORT_SYMBOL(copy_to_user);
524EXPORT_SYMBOL(copy_from_user); 524EXPORT_SYMBOL(copy_from_user);
525EXPORT_SYMBOL(copy_in_user); 525EXPORT_SYMBOL(copy_in_user);
526EXPORT_SYMBOL(memcpy); 526EXPORT_SYMBOL(memcpy);
527
528long probe_kernel_read(void *dst, const void *src, size_t size)
529{
530 unsigned long addr = (unsigned long)src;
531
532 if (size < 0 || addr < PAGE_SIZE)
533 return -EFAULT;
534
535 /* check for I/O space F_EXTEND(0xfff00000) access as well? */
536
537 return __probe_kernel_read(dst, src, size);
538}
539
527#endif 540#endif
diff --git a/arch/parisc/math-emu/float.h b/arch/parisc/math-emu/float.h
index ce76f6dfa25b..7a51f97e72e6 100644
--- a/arch/parisc/math-emu/float.h
+++ b/arch/parisc/math-emu/float.h
@@ -484,7 +484,6 @@ typedef int VOID;
484 * | |G|L|E|U|X| 484 * | |G|L|E|U|X|
485 * +-------+-------+-------+-------+-------+-------+-------+-------+ 485 * +-------+-------+-------+-------+-------+-------+-------+-------+
486 */ 486 */
487#define Allexception(object) (object)
488#define Greaterthanbit(object) Bitfield_extract( 27, 1,object) 487#define Greaterthanbit(object) Bitfield_extract( 27, 1,object)
489#define Lessthanbit(object) Bitfield_extract( 28, 1,object) 488#define Lessthanbit(object) Bitfield_extract( 28, 1,object)
490#define Equalbit(object) Bitfield_extract( 29, 1,object) 489#define Equalbit(object) Bitfield_extract( 29, 1,object)
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index d10d27a720c0..7584a5df0fa4 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -142,6 +142,12 @@ int fixup_exception(struct pt_regs *regs)
142{ 142{
143 const struct exception_table_entry *fix; 143 const struct exception_table_entry *fix;
144 144
145 /* If we only stored 32bit addresses in the exception table we can drop
146 * out if we faulted on a 64bit address. */
147 if ((sizeof(regs->iaoq[0]) > sizeof(fix->insn))
148 && (regs->iaoq[0] >> 32))
149 return 0;
150
145 fix = search_exception_tables(regs->iaoq[0]); 151 fix = search_exception_tables(regs->iaoq[0]);
146 if (fix) { 152 if (fix) {
147 struct exception_data *d; 153 struct exception_data *d;
@@ -171,17 +177,25 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
171 unsigned long address) 177 unsigned long address)
172{ 178{
173 struct vm_area_struct *vma, *prev_vma; 179 struct vm_area_struct *vma, *prev_vma;
174 struct task_struct *tsk = current; 180 struct task_struct *tsk;
175 struct mm_struct *mm = tsk->mm; 181 struct mm_struct *mm;
176 unsigned long acc_type; 182 unsigned long acc_type;
177 int fault; 183 int fault;
178 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 184 unsigned int flags;
185
186 if (in_atomic())
187 goto no_context;
179 188
180 if (in_atomic() || !mm) 189 tsk = current;
190 mm = tsk->mm;
191 if (!mm)
181 goto no_context; 192 goto no_context;
182 193
194 flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
183 if (user_mode(regs)) 195 if (user_mode(regs))
184 flags |= FAULT_FLAG_USER; 196 flags |= FAULT_FLAG_USER;
197
198 acc_type = parisc_acctyp(code, regs->iir);
185 if (acc_type & VM_WRITE) 199 if (acc_type & VM_WRITE)
186 flags |= FAULT_FLAG_WRITE; 200 flags |= FAULT_FLAG_WRITE;
187retry: 201retry:
@@ -196,8 +210,6 @@ retry:
196 210
197good_area: 211good_area:
198 212
199 acc_type = parisc_acctyp(code,regs->iir);
200
201 if ((vma->vm_flags & acc_type) != acc_type) 213 if ((vma->vm_flags & acc_type) != acc_type)
202 goto bad_area; 214 goto bad_area;
203 215
@@ -268,12 +280,22 @@ bad_area:
268 } 280 }
269 show_regs(regs); 281 show_regs(regs);
270#endif 282#endif
271 /* FIXME: actually we need to get the signo and code correct */ 283 switch (code) {
272 si.si_signo = SIGSEGV; 284 case 15: /* Data TLB miss fault/Data page fault */
285 case 17: /* NA data TLB miss / page fault */
286 case 18: /* Unaligned access - PCXS only */
287 si.si_signo = SIGBUS;
288 si.si_code = BUS_ADRERR;
289 break;
290 case 16: /* Non-access instruction TLB miss fault */
291 case 26: /* PCXL: Data memory access rights trap */
292 default:
293 si.si_signo = SIGSEGV;
294 si.si_code = SEGV_MAPERR;
295 }
273 si.si_errno = 0; 296 si.si_errno = 0;
274 si.si_code = SEGV_MAPERR;
275 si.si_addr = (void __user *) address; 297 si.si_addr = (void __user *) address;
276 force_sig_info(SIGSEGV, &si, current); 298 force_sig_info(si.si_signo, &si, current);
277 return; 299 return;
278 } 300 }
279 301
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index fcc626cc577b..b44b52c0a8f0 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -98,7 +98,7 @@ config PPC
98 select VIRT_TO_BUS if !PPC64 98 select VIRT_TO_BUS if !PPC64
99 select HAVE_IDE 99 select HAVE_IDE
100 select HAVE_IOREMAP_PROT 100 select HAVE_IOREMAP_PROT
101 select HAVE_EFFICIENT_UNALIGNED_ACCESS 101 select HAVE_EFFICIENT_UNALIGNED_ACCESS if !CPU_LITTLE_ENDIAN
102 select HAVE_KPROBES 102 select HAVE_KPROBES
103 select HAVE_ARCH_KGDB 103 select HAVE_ARCH_KGDB
104 select HAVE_KRETPROBES 104 select HAVE_KRETPROBES
@@ -107,7 +107,6 @@ config PPC
107 select HAVE_MEMBLOCK_NODE_MAP 107 select HAVE_MEMBLOCK_NODE_MAP
108 select HAVE_DMA_ATTRS 108 select HAVE_DMA_ATTRS
109 select HAVE_DMA_API_DEBUG 109 select HAVE_DMA_API_DEBUG
110 select USE_GENERIC_SMP_HELPERS if SMP
111 select HAVE_OPROFILE 110 select HAVE_OPROFILE
112 select HAVE_DEBUG_KMEMLEAK 111 select HAVE_DEBUG_KMEMLEAK
113 select GENERIC_ATOMIC64 if PPC32 112 select GENERIC_ATOMIC64 if PPC32
@@ -139,6 +138,10 @@ config PPC
139 select OLD_SIGSUSPEND 138 select OLD_SIGSUSPEND
140 select OLD_SIGACTION if PPC32 139 select OLD_SIGACTION if PPC32
141 select HAVE_DEBUG_STACKOVERFLOW 140 select HAVE_DEBUG_STACKOVERFLOW
141 select HAVE_IRQ_EXIT_ON_IRQ_STACK
142
143config GENERIC_CSUM
144 def_bool CPU_LITTLE_ENDIAN
142 145
143config EARLY_PRINTK 146config EARLY_PRINTK
144 bool 147 bool
@@ -405,7 +408,7 @@ config CRASH_DUMP
405 408
406config FA_DUMP 409config FA_DUMP
407 bool "Firmware-assisted dump" 410 bool "Firmware-assisted dump"
408 depends on PPC64 && PPC_RTAS && CRASH_DUMP 411 depends on PPC64 && PPC_RTAS && CRASH_DUMP && KEXEC
409 help 412 help
410 A robust mechanism to get reliable kernel crash dump with 413 A robust mechanism to get reliable kernel crash dump with
411 assistance from firmware. This approach does not use kexec, 414 assistance from firmware. This approach does not use kexec,
@@ -418,7 +421,7 @@ config FA_DUMP
418 421
419config IRQ_ALL_CPUS 422config IRQ_ALL_CPUS
420 bool "Distribute interrupts on all CPUs by default" 423 bool "Distribute interrupts on all CPUs by default"
421 depends on SMP && !MV64360 424 depends on SMP
422 help 425 help
423 This option gives the kernel permission to distribute IRQs across 426 This option gives the kernel permission to distribute IRQs across
424 multiple CPUs. Saying N here will route all IRQs to the first 427 multiple CPUs. Saying N here will route all IRQs to the first
@@ -1010,6 +1013,9 @@ config PHYSICAL_START
1010 default "0x00000000" 1013 default "0x00000000"
1011endif 1014endif
1012 1015
1016config ARCH_RANDOM
1017 def_bool n
1018
1013source "net/Kconfig" 1019source "net/Kconfig"
1014 1020
1015source "drivers/Kconfig" 1021source "drivers/Kconfig"
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 51cfb78d4061..607acf54a425 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -36,17 +36,26 @@ KBUILD_DEFCONFIG := ppc64_defconfig
36endif 36endif
37 37
38ifeq ($(CONFIG_PPC64),y) 38ifeq ($(CONFIG_PPC64),y)
39OLDARCH := ppc64
40
41new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) 39new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi)
42 40
43ifeq ($(new_nm),y) 41ifeq ($(new_nm),y)
44NM := $(NM) --synthetic 42NM := $(NM) --synthetic
45endif 43endif
44endif
46 45
46ifeq ($(CONFIG_PPC64),y)
47ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
48OLDARCH := ppc64le
49else
50OLDARCH := ppc64
51endif
52else
53ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
54OLDARCH := ppcle
47else 55else
48OLDARCH := ppc 56OLDARCH := ppc
49endif 57endif
58endif
50 59
51# It seems there are times we use this Makefile without 60# It seems there are times we use this Makefile without
52# including the config file, but this replicates the old behaviour 61# including the config file, but this replicates the old behaviour
@@ -56,11 +65,29 @@ endif
56 65
57UTS_MACHINE := $(OLDARCH) 66UTS_MACHINE := $(OLDARCH)
58 67
68ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
69override CC += -mlittle-endian -mno-strict-align
70override AS += -mlittle-endian
71override LD += -EL
72override CROSS32CC += -mlittle-endian
73override CROSS32AS += -mlittle-endian
74LDEMULATION := lppc
75GNUTARGET := powerpcle
76MULTIPLEWORD := -mno-multiple
77else
78override CC += -mbig-endian
79override AS += -mbig-endian
80override LD += -EB
81LDEMULATION := ppc
82GNUTARGET := powerpc
83MULTIPLEWORD := -mmultiple
84endif
85
59ifeq ($(HAS_BIARCH),y) 86ifeq ($(HAS_BIARCH),y)
60override AS += -a$(CONFIG_WORD_SIZE) 87override AS += -a$(CONFIG_WORD_SIZE)
61override LD += -m elf$(CONFIG_WORD_SIZE)ppc 88override LD += -m elf$(CONFIG_WORD_SIZE)$(LDEMULATION)
62override CC += -m$(CONFIG_WORD_SIZE) 89override CC += -m$(CONFIG_WORD_SIZE)
63override AR := GNUTARGET=elf$(CONFIG_WORD_SIZE)-powerpc $(AR) 90override AR := GNUTARGET=elf$(CONFIG_WORD_SIZE)-$(GNUTARGET) $(AR)
64endif 91endif
65 92
66LDFLAGS_vmlinux-y := -Bstatic 93LDFLAGS_vmlinux-y := -Bstatic
@@ -86,7 +113,7 @@ endif
86CFLAGS-$(CONFIG_PPC64) := -mtraceback=no -mcall-aixdesc 113CFLAGS-$(CONFIG_PPC64) := -mtraceback=no -mcall-aixdesc
87CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,-mminimal-toc) 114CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,-mminimal-toc)
88CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions) 115CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)
89CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple 116CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 $(MULTIPLEWORD)
90 117
91ifeq ($(CONFIG_PPC_BOOK3S_64),y) 118ifeq ($(CONFIG_PPC_BOOK3S_64),y)
92CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,-mtune=power4) 119CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,-mtune=power4)
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 6a15c968d214..ca7f08cc4afd 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -22,7 +22,8 @@ all: $(obj)/zImage
22BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 22BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
23 -fno-strict-aliasing -Os -msoft-float -pipe \ 23 -fno-strict-aliasing -Os -msoft-float -pipe \
24 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ 24 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
25 -isystem $(shell $(CROSS32CC) -print-file-name=include) 25 -isystem $(shell $(CROSS32CC) -print-file-name=include) \
26 -mbig-endian
26BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc 27BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
27 28
28ifdef CONFIG_DEBUG_INFO 29ifdef CONFIG_DEBUG_INFO
@@ -74,7 +75,7 @@ src-wlib-$(CONFIG_8xx) += mpc8xx.c planetcore.c
74src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c 75src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c
75src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c mv64x60_i2c.c ugecon.c 76src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c mv64x60_i2c.c ugecon.c
76 77
77src-plat-y := of.c 78src-plat-y := of.c epapr.c
78src-plat-$(CONFIG_40x) += fixed-head.S ep405.c cuboot-hotfoot.c \ 79src-plat-$(CONFIG_40x) += fixed-head.S ep405.c cuboot-hotfoot.c \
79 treeboot-walnut.c cuboot-acadia.c \ 80 treeboot-walnut.c cuboot-acadia.c \
80 cuboot-kilauea.c simpleboot.c \ 81 cuboot-kilauea.c simpleboot.c \
@@ -97,7 +98,7 @@ src-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c cuboot-mpc7448hpc2.c \
97 prpmc2800.c 98 prpmc2800.c
98src-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c 99src-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c
99src-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c 100src-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c
100src-plat-$(CONFIG_EPAPR_BOOT) += epapr.c 101src-plat-$(CONFIG_EPAPR_BOOT) += epapr.c epapr-wrapper.c
101 102
102src-wlib := $(sort $(src-wlib-y)) 103src-wlib := $(sort $(src-wlib-y))
103src-plat := $(sort $(src-plat-y)) 104src-plat := $(sort $(src-plat-y))
diff --git a/arch/powerpc/boot/dts/b4860emu.dts b/arch/powerpc/boot/dts/b4860emu.dts
new file mode 100644
index 000000000000..7290021f2dfc
--- /dev/null
+++ b/arch/powerpc/boot/dts/b4860emu.dts
@@ -0,0 +1,218 @@
1/*
2 * B4860 emulator Device Tree Source
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * This software is provided by Freescale Semiconductor "as is" and any
24 * express or implied warranties, including, but not limited to, the implied
25 * warranties of merchantability and fitness for a particular purpose are
26 * disclaimed. In no event shall Freescale Semiconductor be liable for any
27 * direct, indirect, incidental, special, exemplary, or consequential damages
28 * (including, but not limited to, procurement of substitute goods or services;
29 * loss of use, data, or profits; or business interruption) however caused and
30 * on any theory of liability, whether in contract, strict liability, or tort
31 * (including negligence or otherwise) arising in any way out of the use of
32 * this software, even if advised of the possibility of such damage.
33 */
34
35/dts-v1/;
36
37/include/ "fsl/e6500_power_isa.dtsi"
38
39/ {
40 compatible = "fsl,B4860";
41 #address-cells = <2>;
42 #size-cells = <2>;
43 interrupt-parent = <&mpic>;
44
45 aliases {
46 ccsr = &soc;
47
48 serial0 = &serial0;
49 serial1 = &serial1;
50 serial2 = &serial2;
51 serial3 = &serial3;
52 dma0 = &dma0;
53 dma1 = &dma1;
54 };
55
56 cpus {
57 #address-cells = <1>;
58 #size-cells = <0>;
59
60 cpu0: PowerPC,e6500@0 {
61 device_type = "cpu";
62 reg = <0 1>;
63 next-level-cache = <&L2>;
64 };
65 cpu1: PowerPC,e6500@2 {
66 device_type = "cpu";
67 reg = <2 3>;
68 next-level-cache = <&L2>;
69 };
70 cpu2: PowerPC,e6500@4 {
71 device_type = "cpu";
72 reg = <4 5>;
73 next-level-cache = <&L2>;
74 };
75 cpu3: PowerPC,e6500@6 {
76 device_type = "cpu";
77 reg = <6 7>;
78 next-level-cache = <&L2>;
79 };
80 };
81};
82
83/ {
84 model = "fsl,B4860QDS";
85 compatible = "fsl,B4860EMU", "fsl,B4860QDS";
86 #address-cells = <2>;
87 #size-cells = <2>;
88 interrupt-parent = <&mpic>;
89
90 ifc: localbus@ffe124000 {
91 reg = <0xf 0xfe124000 0 0x2000>;
92 ranges = <0 0 0xf 0xe8000000 0x08000000
93 2 0 0xf 0xff800000 0x00010000
94 3 0 0xf 0xffdf0000 0x00008000>;
95
96 nor@0,0 {
97 #address-cells = <1>;
98 #size-cells = <1>;
99 compatible = "cfi-flash";
100 reg = <0x0 0x0 0x8000000>;
101 bank-width = <2>;
102 device-width = <1>;
103 };
104 };
105
106 memory {
107 device_type = "memory";
108 };
109
110 soc: soc@ffe000000 {
111 ranges = <0x00000000 0xf 0xfe000000 0x1000000>;
112 reg = <0xf 0xfe000000 0 0x00001000>;
113 };
114};
115
116&ifc {
117 #address-cells = <2>;
118 #size-cells = <1>;
119 compatible = "fsl,ifc", "simple-bus";
120 interrupts = <25 2 0 0>;
121};
122
123&soc {
124 #address-cells = <1>;
125 #size-cells = <1>;
126 device_type = "soc";
127 compatible = "simple-bus";
128
129 soc-sram-error {
130 compatible = "fsl,soc-sram-error";
131 interrupts = <16 2 1 2>;
132 };
133
134 corenet-law@0 {
135 compatible = "fsl,corenet-law";
136 reg = <0x0 0x1000>;
137 fsl,num-laws = <32>;
138 };
139
140 ddr1: memory-controller@8000 {
141 compatible = "fsl,qoriq-memory-controller-v4.5", "fsl,qoriq-memory-controller";
142 reg = <0x8000 0x1000>;
143 interrupts = <16 2 1 8>;
144 };
145
146 ddr2: memory-controller@9000 {
147 compatible = "fsl,qoriq-memory-controller-v4.5","fsl,qoriq-memory-controller";
148 reg = <0x9000 0x1000>;
149 interrupts = <16 2 1 9>;
150 };
151
152 cpc: l3-cache-controller@10000 {
153 compatible = "fsl,b4-l3-cache-controller", "cache";
154 reg = <0x10000 0x1000
155 0x11000 0x1000>;
156 interrupts = <16 2 1 4>;
157 };
158
159 corenet-cf@18000 {
160 compatible = "fsl,b4-corenet-cf";
161 reg = <0x18000 0x1000>;
162 interrupts = <16 2 1 0>;
163 fsl,ccf-num-csdids = <32>;
164 fsl,ccf-num-snoopids = <32>;
165 };
166
167 iommu@20000 {
168 compatible = "fsl,pamu-v1.0", "fsl,pamu";
169 reg = <0x20000 0x4000>;
170 #address-cells = <1>;
171 #size-cells = <1>;
172 interrupts = <
173 24 2 0 0
174 16 2 1 1>;
175 pamu0: pamu@0 {
176 reg = <0 0x1000>;
177 fsl,primary-cache-geometry = <8 1>;
178 fsl,secondary-cache-geometry = <32 2>;
179 };
180 };
181
182/include/ "fsl/qoriq-mpic.dtsi"
183
184 guts: global-utilities@e0000 {
185 compatible = "fsl,b4-device-config";
186 reg = <0xe0000 0xe00>;
187 fsl,has-rstcr;
188 fsl,liodn-bits = <12>;
189 };
190
191 clockgen: global-utilities@e1000 {
192 compatible = "fsl,b4-clockgen", "fsl,qoriq-clockgen-2.0";
193 reg = <0xe1000 0x1000>;
194 };
195
196/include/ "fsl/qoriq-dma-0.dtsi"
197 dma@100300 {
198 fsl,iommu-parent = <&pamu0>;
199 fsl,liodn-reg = <&guts 0x580>; /* DMA1LIODNR */
200 };
201
202/include/ "fsl/qoriq-dma-1.dtsi"
203 dma@101300 {
204 fsl,iommu-parent = <&pamu0>;
205 fsl,liodn-reg = <&guts 0x584>; /* DMA2LIODNR */
206 };
207
208/include/ "fsl/qoriq-i2c-0.dtsi"
209/include/ "fsl/qoriq-i2c-1.dtsi"
210/include/ "fsl/qoriq-duart-0.dtsi"
211/include/ "fsl/qoriq-duart-1.dtsi"
212
213 L2: l2-cache-controller@c20000 {
214 compatible = "fsl,b4-l2-cache-controller";
215 reg = <0xc20000 0x1000>;
216 next-level-cache = <&cpc>;
217 };
218};
diff --git a/arch/powerpc/boot/dts/b4qds.dtsi b/arch/powerpc/boot/dts/b4qds.dtsi
index e6d2f8f90544..8b47edcfabf0 100644
--- a/arch/powerpc/boot/dts/b4qds.dtsi
+++ b/arch/powerpc/boot/dts/b4qds.dtsi
@@ -120,25 +120,38 @@
120 }; 120 };
121 121
122 i2c@118000 { 122 i2c@118000 {
123 eeprom@50 { 123 mux@77 {
124 compatible = "at24,24c64"; 124 compatible = "nxp,pca9547";
125 reg = <0x50>; 125 reg = <0x77>;
126 }; 126 #address-cells = <1>;
127 eeprom@51 { 127 #size-cells = <0>;
128 compatible = "at24,24c256"; 128
129 reg = <0x51>; 129 i2c@0 {
130 }; 130 #address-cells = <1>;
131 eeprom@53 { 131 #size-cells = <0>;
132 compatible = "at24,24c256"; 132 reg = <0>;
133 reg = <0x53>; 133
134 }; 134 eeprom@50 {
135 eeprom@57 { 135 compatible = "at24,24c64";
136 compatible = "at24,24c256"; 136 reg = <0x50>;
137 reg = <0x57>; 137 };
138 }; 138 eeprom@51 {
139 rtc@68 { 139 compatible = "at24,24c256";
140 compatible = "dallas,ds3232"; 140 reg = <0x51>;
141 reg = <0x68>; 141 };
142 eeprom@53 {
143 compatible = "at24,24c256";
144 reg = <0x53>;
145 };
146 eeprom@57 {
147 compatible = "at24,24c256";
148 reg = <0x57>;
149 };
150 rtc@68 {
151 compatible = "dallas,ds3232";
152 reg = <0x68>;
153 };
154 };
142 }; 155 };
143 }; 156 };
144 157
diff --git a/arch/powerpc/boot/dts/c293pcie.dts b/arch/powerpc/boot/dts/c293pcie.dts
index 1238bda8901f..6681cc21030b 100644
--- a/arch/powerpc/boot/dts/c293pcie.dts
+++ b/arch/powerpc/boot/dts/c293pcie.dts
@@ -45,6 +45,7 @@
45 ifc: ifc@fffe1e000 { 45 ifc: ifc@fffe1e000 {
46 reg = <0xf 0xffe1e000 0 0x2000>; 46 reg = <0xf 0xffe1e000 0 0x2000>;
47 ranges = <0x0 0x0 0xf 0xec000000 0x04000000 47 ranges = <0x0 0x0 0xf 0xec000000 0x04000000
48 0x1 0x0 0xf 0xff800000 0x00010000
48 0x2 0x0 0xf 0xffdf0000 0x00010000>; 49 0x2 0x0 0xf 0xffdf0000 0x00010000>;
49 50
50 }; 51 };
diff --git a/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi b/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi
index 7b4426e0a5a5..c6e451affb05 100644
--- a/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi
@@ -34,6 +34,8 @@
34 34
35/dts-v1/; 35/dts-v1/;
36 36
37/include/ "e6500_power_isa.dtsi"
38
37/ { 39/ {
38 compatible = "fsl,B4420"; 40 compatible = "fsl,B4420";
39 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi
index e5cf6c81dd66..981397518fc6 100644
--- a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi
@@ -41,7 +41,7 @@
41 41
42&rio { 42&rio {
43 compatible = "fsl,srio"; 43 compatible = "fsl,srio";
44 interrupts = <16 2 1 11>; 44 interrupts = <16 2 1 20>;
45 #address-cells = <2>; 45 #address-cells = <2>;
46 #size-cells = <2>; 46 #size-cells = <2>;
47 fsl,iommu-parent = <&pamu0>; 47 fsl,iommu-parent = <&pamu0>;
diff --git a/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi b/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi
index 5263fa46a3fb..9bc26b147900 100644
--- a/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi
@@ -34,6 +34,8 @@
34 34
35/dts-v1/; 35/dts-v1/;
36 36
37/include/ "e6500_power_isa.dtsi"
38
37/ { 39/ {
38 compatible = "fsl,B4860"; 40 compatible = "fsl,B4860";
39 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/fsl/bsc9131si-post.dtsi b/arch/powerpc/boot/dts/fsl/bsc9131si-post.dtsi
index 5180d9d37989..0c0efa94cfb4 100644
--- a/arch/powerpc/boot/dts/fsl/bsc9131si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/bsc9131si-post.dtsi
@@ -130,7 +130,7 @@ usb@22000 {
130 130
131/include/ "pq3-esdhc-0.dtsi" 131/include/ "pq3-esdhc-0.dtsi"
132 sdhc@2e000 { 132 sdhc@2e000 {
133 fsl,sdhci-auto-cmd12; 133 sdhci,auto-cmd12;
134 interrupts = <41 0x2 0 0>; 134 interrupts = <41 0x2 0 0>;
135 }; 135 };
136 136
diff --git a/arch/powerpc/boot/dts/fsl/bsc9131si-pre.dtsi b/arch/powerpc/boot/dts/fsl/bsc9131si-pre.dtsi
index 743e4aeda349..f6ec4a67560c 100644
--- a/arch/powerpc/boot/dts/fsl/bsc9131si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/bsc9131si-pre.dtsi
@@ -33,6 +33,9 @@
33 */ 33 */
34 34
35/dts-v1/; 35/dts-v1/;
36
37/include/ "e500v2_power_isa.dtsi"
38
36/ { 39/ {
37 compatible = "fsl,BSC9131"; 40 compatible = "fsl,BSC9131";
38 #address-cells = <2>; 41 #address-cells = <2>;
diff --git a/arch/powerpc/boot/dts/t4240emu.dts b/arch/powerpc/boot/dts/t4240emu.dts
new file mode 100644
index 000000000000..ee24ab335598
--- /dev/null
+++ b/arch/powerpc/boot/dts/t4240emu.dts
@@ -0,0 +1,268 @@
1/*
2 * T4240 emulator Device Tree Source
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/dts-v1/;
36
37/include/ "fsl/e6500_power_isa.dtsi"
38/ {
39 compatible = "fsl,T4240";
40 #address-cells = <2>;
41 #size-cells = <2>;
42 interrupt-parent = <&mpic>;
43
44 aliases {
45 ccsr = &soc;
46
47 serial0 = &serial0;
48 serial1 = &serial1;
49 serial2 = &serial2;
50 serial3 = &serial3;
51 dma0 = &dma0;
52 dma1 = &dma1;
53 };
54
55 cpus {
56 #address-cells = <1>;
57 #size-cells = <0>;
58
59 cpu0: PowerPC,e6500@0 {
60 device_type = "cpu";
61 reg = <0 1>;
62 next-level-cache = <&L2_1>;
63 };
64 cpu1: PowerPC,e6500@2 {
65 device_type = "cpu";
66 reg = <2 3>;
67 next-level-cache = <&L2_1>;
68 };
69 cpu2: PowerPC,e6500@4 {
70 device_type = "cpu";
71 reg = <4 5>;
72 next-level-cache = <&L2_1>;
73 };
74 cpu3: PowerPC,e6500@6 {
75 device_type = "cpu";
76 reg = <6 7>;
77 next-level-cache = <&L2_1>;
78 };
79
80 cpu4: PowerPC,e6500@8 {
81 device_type = "cpu";
82 reg = <8 9>;
83 next-level-cache = <&L2_2>;
84 };
85 cpu5: PowerPC,e6500@10 {
86 device_type = "cpu";
87 reg = <10 11>;
88 next-level-cache = <&L2_2>;
89 };
90 cpu6: PowerPC,e6500@12 {
91 device_type = "cpu";
92 reg = <12 13>;
93 next-level-cache = <&L2_2>;
94 };
95 cpu7: PowerPC,e6500@14 {
96 device_type = "cpu";
97 reg = <14 15>;
98 next-level-cache = <&L2_2>;
99 };
100
101 cpu8: PowerPC,e6500@16 {
102 device_type = "cpu";
103 reg = <16 17>;
104 next-level-cache = <&L2_3>;
105 };
106 cpu9: PowerPC,e6500@18 {
107 device_type = "cpu";
108 reg = <18 19>;
109 next-level-cache = <&L2_3>;
110 };
111 cpu10: PowerPC,e6500@20 {
112 device_type = "cpu";
113 reg = <20 21>;
114 next-level-cache = <&L2_3>;
115 };
116 cpu11: PowerPC,e6500@22 {
117 device_type = "cpu";
118 reg = <22 23>;
119 next-level-cache = <&L2_3>;
120 };
121 };
122};
123
124/ {
125 model = "fsl,T4240QDS";
126 compatible = "fsl,T4240EMU", "fsl,T4240QDS";
127 #address-cells = <2>;
128 #size-cells = <2>;
129 interrupt-parent = <&mpic>;
130
131 ifc: localbus@ffe124000 {
132 reg = <0xf 0xfe124000 0 0x2000>;
133 ranges = <0 0 0xf 0xe8000000 0x08000000
134 2 0 0xf 0xff800000 0x00010000
135 3 0 0xf 0xffdf0000 0x00008000>;
136
137 nor@0,0 {
138 #address-cells = <1>;
139 #size-cells = <1>;
140 compatible = "cfi-flash";
141 reg = <0x0 0x0 0x8000000>;
142
143 bank-width = <2>;
144 device-width = <1>;
145 };
146
147 };
148
149 memory {
150 device_type = "memory";
151 };
152
153 soc: soc@ffe000000 {
154 ranges = <0x00000000 0xf 0xfe000000 0x1000000>;
155 reg = <0xf 0xfe000000 0 0x00001000>;
156
157 };
158};
159
160&ifc {
161 #address-cells = <2>;
162 #size-cells = <1>;
163 compatible = "fsl,ifc", "simple-bus";
164 interrupts = <25 2 0 0>;
165};
166
167&soc {
168 #address-cells = <1>;
169 #size-cells = <1>;
170 device_type = "soc";
171 compatible = "simple-bus";
172
173 soc-sram-error {
174 compatible = "fsl,soc-sram-error";
175 interrupts = <16 2 1 29>;
176 };
177
178 corenet-law@0 {
179 compatible = "fsl,corenet-law";
180 reg = <0x0 0x1000>;
181 fsl,num-laws = <32>;
182 };
183
184 ddr1: memory-controller@8000 {
185 compatible = "fsl,qoriq-memory-controller-v4.7",
186 "fsl,qoriq-memory-controller";
187 reg = <0x8000 0x1000>;
188 interrupts = <16 2 1 23>;
189 };
190
191 ddr2: memory-controller@9000 {
192 compatible = "fsl,qoriq-memory-controller-v4.7",
193 "fsl,qoriq-memory-controller";
194 reg = <0x9000 0x1000>;
195 interrupts = <16 2 1 22>;
196 };
197
198 ddr3: memory-controller@a000 {
199 compatible = "fsl,qoriq-memory-controller-v4.7",
200 "fsl,qoriq-memory-controller";
201 reg = <0xa000 0x1000>;
202 interrupts = <16 2 1 21>;
203 };
204
205 cpc: l3-cache-controller@10000 {
206 compatible = "fsl,t4240-l3-cache-controller", "cache";
207 reg = <0x10000 0x1000
208 0x11000 0x1000
209 0x12000 0x1000>;
210 interrupts = <16 2 1 27
211 16 2 1 26
212 16 2 1 25>;
213 };
214
215 corenet-cf@18000 {
216 compatible = "fsl,corenet-cf";
217 reg = <0x18000 0x1000>;
218 interrupts = <16 2 1 31>;
219 fsl,ccf-num-csdids = <32>;
220 fsl,ccf-num-snoopids = <32>;
221 };
222
223 iommu@20000 {
224 compatible = "fsl,pamu-v1.0", "fsl,pamu";
225 reg = <0x20000 0x6000>;
226 interrupts = <
227 24 2 0 0
228 16 2 1 30>;
229 };
230
231/include/ "fsl/qoriq-mpic.dtsi"
232
233 guts: global-utilities@e0000 {
234 compatible = "fsl,t4240-device-config", "fsl,qoriq-device-config-2.0";
235 reg = <0xe0000 0xe00>;
236 fsl,has-rstcr;
237 fsl,liodn-bits = <12>;
238 };
239
240 clockgen: global-utilities@e1000 {
241 compatible = "fsl,t4240-clockgen", "fsl,qoriq-clockgen-2.0";
242 reg = <0xe1000 0x1000>;
243 };
244
245/include/ "fsl/qoriq-dma-0.dtsi"
246/include/ "fsl/qoriq-dma-1.dtsi"
247
248/include/ "fsl/qoriq-i2c-0.dtsi"
249/include/ "fsl/qoriq-i2c-1.dtsi"
250/include/ "fsl/qoriq-duart-0.dtsi"
251/include/ "fsl/qoriq-duart-1.dtsi"
252
253 L2_1: l2-cache-controller@c20000 {
254 compatible = "fsl,t4240-l2-cache-controller";
255 reg = <0xc20000 0x40000>;
256 next-level-cache = <&cpc>;
257 };
258 L2_2: l2-cache-controller@c60000 {
259 compatible = "fsl,t4240-l2-cache-controller";
260 reg = <0xc60000 0x40000>;
261 next-level-cache = <&cpc>;
262 };
263 L2_3: l2-cache-controller@ca0000 {
264 compatible = "fsl,t4240-l2-cache-controller";
265 reg = <0xca0000 0x40000>;
266 next-level-cache = <&cpc>;
267 };
268};
diff --git a/arch/powerpc/boot/dts/t4240qds.dts b/arch/powerpc/boot/dts/t4240qds.dts
index 0555976dd0f3..63e81b010804 100644
--- a/arch/powerpc/boot/dts/t4240qds.dts
+++ b/arch/powerpc/boot/dts/t4240qds.dts
@@ -118,36 +118,53 @@
118 }; 118 };
119 119
120 i2c@118000 { 120 i2c@118000 {
121 eeprom@51 { 121 mux@77 {
122 compatible = "at24,24c256"; 122 compatible = "nxp,pca9547";
123 reg = <0x51>; 123 reg = <0x77>;
124 }; 124 #address-cells = <1>;
125 eeprom@52 { 125 #size-cells = <0>;
126 compatible = "at24,24c256"; 126
127 reg = <0x52>; 127 i2c@0 {
128 }; 128 #address-cells = <1>;
129 eeprom@53 { 129 #size-cells = <0>;
130 compatible = "at24,24c256"; 130 reg = <0>;
131 reg = <0x53>; 131
132 }; 132 eeprom@51 {
133 eeprom@54 { 133 compatible = "at24,24c256";
134 compatible = "at24,24c256"; 134 reg = <0x51>;
135 reg = <0x54>; 135 };
136 }; 136 eeprom@52 {
137 eeprom@55 { 137 compatible = "at24,24c256";
138 compatible = "at24,24c256"; 138 reg = <0x52>;
139 reg = <0x55>; 139 };
140 }; 140 eeprom@53 {
141 eeprom@56 { 141 compatible = "at24,24c256";
142 compatible = "at24,24c256"; 142 reg = <0x53>;
143 reg = <0x56>; 143 };
144 }; 144 eeprom@54 {
145 rtc@68 { 145 compatible = "at24,24c256";
146 compatible = "dallas,ds3232"; 146 reg = <0x54>;
147 reg = <0x68>; 147 };
148 interrupts = <0x1 0x1 0 0>; 148 eeprom@55 {
149 compatible = "at24,24c256";
150 reg = <0x55>;
151 };
152 eeprom@56 {
153 compatible = "at24,24c256";
154 reg = <0x56>;
155 };
156 rtc@68 {
157 compatible = "dallas,ds3232";
158 reg = <0x68>;
159 interrupts = <0x1 0x1 0 0>;
160 };
161 };
149 }; 162 };
150 }; 163 };
164
165 sdhc@114000 {
166 voltage-ranges = <1800 1800 3300 3300>;
167 };
151 }; 168 };
152 169
153 pci0: pcie@ffe240000 { 170 pci0: pcie@ffe240000 {
diff --git a/arch/powerpc/boot/epapr-wrapper.c b/arch/powerpc/boot/epapr-wrapper.c
new file mode 100644
index 000000000000..c10191006673
--- /dev/null
+++ b/arch/powerpc/boot/epapr-wrapper.c
@@ -0,0 +1,9 @@
1extern void epapr_platform_init(unsigned long r3, unsigned long r4,
2 unsigned long r5, unsigned long r6,
3 unsigned long r7);
4
5void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
6 unsigned long r6, unsigned long r7)
7{
8 epapr_platform_init(r3, r4, r5, r6, r7);
9}
diff --git a/arch/powerpc/boot/epapr.c b/arch/powerpc/boot/epapr.c
index 06c1961bd124..02e91aa2194a 100644
--- a/arch/powerpc/boot/epapr.c
+++ b/arch/powerpc/boot/epapr.c
@@ -48,8 +48,8 @@ static void platform_fixups(void)
48 fdt_addr, fdt_totalsize((void *)fdt_addr), ima_size); 48 fdt_addr, fdt_totalsize((void *)fdt_addr), ima_size);
49} 49}
50 50
51void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, 51void epapr_platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
52 unsigned long r6, unsigned long r7) 52 unsigned long r6, unsigned long r7)
53{ 53{
54 epapr_magic = r6; 54 epapr_magic = r6;
55 ima_size = r7; 55 ima_size = r7;
diff --git a/arch/powerpc/boot/of.c b/arch/powerpc/boot/of.c
index 61d9899aa0d0..62e2f43ec1df 100644
--- a/arch/powerpc/boot/of.c
+++ b/arch/powerpc/boot/of.c
@@ -26,6 +26,9 @@
26 26
27static unsigned long claim_base; 27static unsigned long claim_base;
28 28
29void epapr_platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
30 unsigned long r6, unsigned long r7);
31
29static void *of_try_claim(unsigned long size) 32static void *of_try_claim(unsigned long size)
30{ 33{
31 unsigned long addr = 0; 34 unsigned long addr = 0;
@@ -61,7 +64,7 @@ static void of_image_hdr(const void *hdr)
61 } 64 }
62} 65}
63 66
64void platform_init(unsigned long a1, unsigned long a2, void *promptr) 67static void of_platform_init(unsigned long a1, unsigned long a2, void *promptr)
65{ 68{
66 platform_ops.image_hdr = of_image_hdr; 69 platform_ops.image_hdr = of_image_hdr;
67 platform_ops.malloc = of_try_claim; 70 platform_ops.malloc = of_try_claim;
@@ -81,3 +84,14 @@ void platform_init(unsigned long a1, unsigned long a2, void *promptr)
81 loader_info.initrd_size = a2; 84 loader_info.initrd_size = a2;
82 } 85 }
83} 86}
87
88void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
89 unsigned long r6, unsigned long r7)
90{
91 /* Detect OF vs. ePAPR boot */
92 if (r5)
93 of_platform_init(r3, r4, (void *)r5);
94 else
95 epapr_platform_init(r3, r4, r5, r6, r7);
96}
97
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 6761c746048d..2e1af74a64be 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -147,21 +147,29 @@ link_address='0x400000'
147make_space=y 147make_space=y
148 148
149case "$platform" in 149case "$platform" in
150of)
151 platformo="$object/of.o $object/epapr.o"
152 make_space=n
153 ;;
150pseries) 154pseries)
151 platformo=$object/of.o 155 platformo="$object/of.o $object/epapr.o"
152 link_address='0x4000000' 156 link_address='0x4000000'
157 make_space=n
153 ;; 158 ;;
154maple) 159maple)
155 platformo=$object/of.o 160 platformo="$object/of.o $object/epapr.o"
156 link_address='0x400000' 161 link_address='0x400000'
162 make_space=n
157 ;; 163 ;;
158pmac|chrp) 164pmac|chrp)
159 platformo=$object/of.o 165 platformo="$object/of.o $object/epapr.o"
166 make_space=n
160 ;; 167 ;;
161coff) 168coff)
162 platformo="$object/crt0.o $object/of.o" 169 platformo="$object/crt0.o $object/of.o $object/epapr.o"
163 lds=$object/zImage.coff.lds 170 lds=$object/zImage.coff.lds
164 link_address='0x500000' 171 link_address='0x500000'
172 make_space=n
165 pie= 173 pie=
166 ;; 174 ;;
167miboot|uboot*) 175miboot|uboot*)
@@ -253,6 +261,7 @@ treeboot-iss4xx-mpic)
253 platformo="$object/treeboot-iss4xx.o" 261 platformo="$object/treeboot-iss4xx.o"
254 ;; 262 ;;
255epapr) 263epapr)
264 platformo="$object/epapr.o $object/epapr-wrapper.o"
256 link_address='0x20000000' 265 link_address='0x20000000'
257 pie=-pie 266 pie=-pie
258 ;; 267 ;;
diff --git a/arch/powerpc/configs/corenet32_smp_defconfig b/arch/powerpc/configs/corenet32_smp_defconfig
index 3dfab4c40c76..bbd794deb6eb 100644
--- a/arch/powerpc/configs/corenet32_smp_defconfig
+++ b/arch/powerpc/configs/corenet32_smp_defconfig
@@ -23,11 +23,7 @@ CONFIG_MODVERSIONS=y
23# CONFIG_BLK_DEV_BSG is not set 23# CONFIG_BLK_DEV_BSG is not set
24CONFIG_PARTITION_ADVANCED=y 24CONFIG_PARTITION_ADVANCED=y
25CONFIG_MAC_PARTITION=y 25CONFIG_MAC_PARTITION=y
26CONFIG_P2041_RDB=y 26CONFIG_CORENET_GENERIC=y
27CONFIG_P3041_DS=y
28CONFIG_P4080_DS=y
29CONFIG_P5020_DS=y
30CONFIG_P5040_DS=y
31CONFIG_HIGHMEM=y 27CONFIG_HIGHMEM=y
32# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 28# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
33CONFIG_BINFMT_MISC=m 29CONFIG_BINFMT_MISC=m
@@ -104,6 +100,7 @@ CONFIG_FSL_PQ_MDIO=y
104CONFIG_E1000=y 100CONFIG_E1000=y
105CONFIG_E1000E=y 101CONFIG_E1000E=y
106CONFIG_VITESSE_PHY=y 102CONFIG_VITESSE_PHY=y
103CONFIG_AT803X_PHY=y
107CONFIG_FIXED_PHY=y 104CONFIG_FIXED_PHY=y
108# CONFIG_INPUT_MOUSEDEV is not set 105# CONFIG_INPUT_MOUSEDEV is not set
109# CONFIG_INPUT_KEYBOARD is not set 106# CONFIG_INPUT_KEYBOARD is not set
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig b/arch/powerpc/configs/corenet64_smp_defconfig
index fa94fb3bb44d..63508ddee11c 100644
--- a/arch/powerpc/configs/corenet64_smp_defconfig
+++ b/arch/powerpc/configs/corenet64_smp_defconfig
@@ -21,10 +21,7 @@ CONFIG_MODVERSIONS=y
21# CONFIG_BLK_DEV_BSG is not set 21# CONFIG_BLK_DEV_BSG is not set
22CONFIG_PARTITION_ADVANCED=y 22CONFIG_PARTITION_ADVANCED=y
23CONFIG_MAC_PARTITION=y 23CONFIG_MAC_PARTITION=y
24CONFIG_B4_QDS=y 24CONFIG_CORENET_GENERIC=y
25CONFIG_P5020_DS=y
26CONFIG_P5040_DS=y
27CONFIG_T4240_QDS=y
28# CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set 25# CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set
29CONFIG_BINFMT_MISC=m 26CONFIG_BINFMT_MISC=m
30CONFIG_MATH_EMULATION=y 27CONFIG_MATH_EMULATION=y
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index dc098d988211..d2e0fab5ee5b 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -138,6 +138,7 @@ CONFIG_MARVELL_PHY=y
138CONFIG_DAVICOM_PHY=y 138CONFIG_DAVICOM_PHY=y
139CONFIG_CICADA_PHY=y 139CONFIG_CICADA_PHY=y
140CONFIG_VITESSE_PHY=y 140CONFIG_VITESSE_PHY=y
141CONFIG_AT803X_PHY=y
141CONFIG_FIXED_PHY=y 142CONFIG_FIXED_PHY=y
142CONFIG_INPUT_FF_MEMLESS=m 143CONFIG_INPUT_FF_MEMLESS=m
143# CONFIG_INPUT_MOUSEDEV is not set 144# CONFIG_INPUT_MOUSEDEV is not set
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index 5bca60161bb3..4cb7b59e98bd 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -138,6 +138,7 @@ CONFIG_MARVELL_PHY=y
138CONFIG_DAVICOM_PHY=y 138CONFIG_DAVICOM_PHY=y
139CONFIG_CICADA_PHY=y 139CONFIG_CICADA_PHY=y
140CONFIG_VITESSE_PHY=y 140CONFIG_VITESSE_PHY=y
141CONFIG_AT803X_PHY=y
141CONFIG_FIXED_PHY=y 142CONFIG_FIXED_PHY=y
142CONFIG_INPUT_FF_MEMLESS=m 143CONFIG_INPUT_FF_MEMLESS=m
143# CONFIG_INPUT_MOUSEDEV is not set 144# CONFIG_INPUT_MOUSEDEV is not set
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index 0e8cfd09da2f..581a3bcae728 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -2,7 +2,6 @@ CONFIG_PPC64=y
2CONFIG_ALTIVEC=y 2CONFIG_ALTIVEC=y
3CONFIG_VSX=y 3CONFIG_VSX=y
4CONFIG_SMP=y 4CONFIG_SMP=y
5CONFIG_EXPERIMENTAL=y
6CONFIG_SYSVIPC=y 5CONFIG_SYSVIPC=y
7CONFIG_POSIX_MQUEUE=y 6CONFIG_POSIX_MQUEUE=y
8CONFIG_IRQ_DOMAIN_DEBUG=y 7CONFIG_IRQ_DOMAIN_DEBUG=y
@@ -25,7 +24,6 @@ CONFIG_MODULE_UNLOAD=y
25CONFIG_MODVERSIONS=y 24CONFIG_MODVERSIONS=y
26CONFIG_MODULE_SRCVERSION_ALL=y 25CONFIG_MODULE_SRCVERSION_ALL=y
27CONFIG_PARTITION_ADVANCED=y 26CONFIG_PARTITION_ADVANCED=y
28CONFIG_EFI_PARTITION=y
29CONFIG_PPC_SPLPAR=y 27CONFIG_PPC_SPLPAR=y
30CONFIG_SCANLOG=m 28CONFIG_SCANLOG=m
31CONFIG_PPC_SMLPAR=y 29CONFIG_PPC_SMLPAR=y
@@ -50,12 +48,10 @@ CONFIG_CPU_FREQ_PMAC64=y
50CONFIG_HZ_100=y 48CONFIG_HZ_100=y
51CONFIG_BINFMT_MISC=m 49CONFIG_BINFMT_MISC=m
52CONFIG_PPC_TRANSACTIONAL_MEM=y 50CONFIG_PPC_TRANSACTIONAL_MEM=y
53CONFIG_HOTPLUG_CPU=y
54CONFIG_KEXEC=y 51CONFIG_KEXEC=y
55CONFIG_IRQ_ALL_CPUS=y 52CONFIG_IRQ_ALL_CPUS=y
56CONFIG_MEMORY_HOTREMOVE=y 53CONFIG_MEMORY_HOTREMOVE=y
57CONFIG_SCHED_SMT=y 54CONFIG_SCHED_SMT=y
58CONFIG_PPC_DENORMALISATION=y
59CONFIG_PCCARD=y 55CONFIG_PCCARD=y
60CONFIG_ELECTRA_CF=y 56CONFIG_ELECTRA_CF=y
61CONFIG_HOTPLUG_PCI=y 57CONFIG_HOTPLUG_PCI=y
@@ -89,7 +85,6 @@ CONFIG_NF_CONNTRACK_PPTP=m
89CONFIG_NF_CONNTRACK_SIP=m 85CONFIG_NF_CONNTRACK_SIP=m
90CONFIG_NF_CONNTRACK_TFTP=m 86CONFIG_NF_CONNTRACK_TFTP=m
91CONFIG_NF_CT_NETLINK=m 87CONFIG_NF_CT_NETLINK=m
92CONFIG_NETFILTER_TPROXY=m
93CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m 88CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
94CONFIG_NETFILTER_XT_TARGET_CONNMARK=m 89CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
95CONFIG_NETFILTER_XT_TARGET_DSCP=m 90CONFIG_NETFILTER_XT_TARGET_DSCP=m
@@ -131,7 +126,6 @@ CONFIG_NETFILTER_XT_MATCH_STRING=m
131CONFIG_NETFILTER_XT_MATCH_TCPMSS=m 126CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
132CONFIG_NETFILTER_XT_MATCH_U32=m 127CONFIG_NETFILTER_XT_MATCH_U32=m
133CONFIG_NF_CONNTRACK_IPV4=m 128CONFIG_NF_CONNTRACK_IPV4=m
134CONFIG_IP_NF_QUEUE=m
135CONFIG_IP_NF_IPTABLES=m 129CONFIG_IP_NF_IPTABLES=m
136CONFIG_IP_NF_MATCH_AH=m 130CONFIG_IP_NF_MATCH_AH=m
137CONFIG_IP_NF_MATCH_ECN=m 131CONFIG_IP_NF_MATCH_ECN=m
@@ -157,6 +151,7 @@ CONFIG_BLK_DEV_LOOP=y
157CONFIG_BLK_DEV_NBD=m 151CONFIG_BLK_DEV_NBD=m
158CONFIG_BLK_DEV_RAM=y 152CONFIG_BLK_DEV_RAM=y
159CONFIG_BLK_DEV_RAM_SIZE=65536 153CONFIG_BLK_DEV_RAM_SIZE=65536
154CONFIG_VIRTIO_BLK=m
160CONFIG_IDE=y 155CONFIG_IDE=y
161CONFIG_BLK_DEV_IDECD=y 156CONFIG_BLK_DEV_IDECD=y
162CONFIG_BLK_DEV_GENERIC=y 157CONFIG_BLK_DEV_GENERIC=y
@@ -185,6 +180,10 @@ CONFIG_SCSI_IPR=y
185CONFIG_SCSI_QLA_FC=m 180CONFIG_SCSI_QLA_FC=m
186CONFIG_SCSI_QLA_ISCSI=m 181CONFIG_SCSI_QLA_ISCSI=m
187CONFIG_SCSI_LPFC=m 182CONFIG_SCSI_LPFC=m
183CONFIG_SCSI_VIRTIO=m
184CONFIG_SCSI_DH=m
185CONFIG_SCSI_DH_RDAC=m
186CONFIG_SCSI_DH_ALUA=m
188CONFIG_ATA=y 187CONFIG_ATA=y
189CONFIG_SATA_SIL24=y 188CONFIG_SATA_SIL24=y
190CONFIG_SATA_SVW=y 189CONFIG_SATA_SVW=y
@@ -203,6 +202,9 @@ CONFIG_DM_SNAPSHOT=m
203CONFIG_DM_MIRROR=m 202CONFIG_DM_MIRROR=m
204CONFIG_DM_ZERO=m 203CONFIG_DM_ZERO=m
205CONFIG_DM_MULTIPATH=m 204CONFIG_DM_MULTIPATH=m
205CONFIG_DM_MULTIPATH_QL=m
206CONFIG_DM_MULTIPATH_ST=m
207CONFIG_DM_UEVENT=y
206CONFIG_ADB_PMU=y 208CONFIG_ADB_PMU=y
207CONFIG_PMAC_SMU=y 209CONFIG_PMAC_SMU=y
208CONFIG_THERM_PM72=y 210CONFIG_THERM_PM72=y
@@ -216,6 +218,8 @@ CONFIG_DUMMY=m
216CONFIG_NETCONSOLE=y 218CONFIG_NETCONSOLE=y
217CONFIG_NETPOLL_TRAP=y 219CONFIG_NETPOLL_TRAP=y
218CONFIG_TUN=m 220CONFIG_TUN=m
221CONFIG_VIRTIO_NET=m
222CONFIG_VHOST_NET=m
219CONFIG_VORTEX=y 223CONFIG_VORTEX=y
220CONFIG_ACENIC=m 224CONFIG_ACENIC=m
221CONFIG_ACENIC_OMIT_TIGON_I=y 225CONFIG_ACENIC_OMIT_TIGON_I=y
@@ -262,6 +266,7 @@ CONFIG_HVC_CONSOLE=y
262CONFIG_HVC_RTAS=y 266CONFIG_HVC_RTAS=y
263CONFIG_HVC_BEAT=y 267CONFIG_HVC_BEAT=y
264CONFIG_HVCS=m 268CONFIG_HVCS=m
269CONFIG_VIRTIO_CONSOLE=m
265CONFIG_IBM_BSR=m 270CONFIG_IBM_BSR=m
266CONFIG_RAW_DRIVER=y 271CONFIG_RAW_DRIVER=y
267CONFIG_I2C_CHARDEV=y 272CONFIG_I2C_CHARDEV=y
@@ -301,7 +306,6 @@ CONFIG_HID_GYRATION=y
301CONFIG_HID_PANTHERLORD=y 306CONFIG_HID_PANTHERLORD=y
302CONFIG_HID_PETALYNX=y 307CONFIG_HID_PETALYNX=y
303CONFIG_HID_SAMSUNG=y 308CONFIG_HID_SAMSUNG=y
304CONFIG_HID_SONY=y
305CONFIG_HID_SUNPLUS=y 309CONFIG_HID_SUNPLUS=y
306CONFIG_USB_HIDDEV=y 310CONFIG_USB_HIDDEV=y
307CONFIG_USB=y 311CONFIG_USB=y
@@ -328,6 +332,8 @@ CONFIG_EDAC_MM_EDAC=y
328CONFIG_EDAC_PASEMI=y 332CONFIG_EDAC_PASEMI=y
329CONFIG_RTC_CLASS=y 333CONFIG_RTC_CLASS=y
330CONFIG_RTC_DRV_DS1307=y 334CONFIG_RTC_DRV_DS1307=y
335CONFIG_VIRTIO_PCI=m
336CONFIG_VIRTIO_BALLOON=m
331CONFIG_EXT2_FS=y 337CONFIG_EXT2_FS=y
332CONFIG_EXT2_FS_XATTR=y 338CONFIG_EXT2_FS_XATTR=y
333CONFIG_EXT2_FS_POSIX_ACL=y 339CONFIG_EXT2_FS_POSIX_ACL=y
@@ -386,21 +392,19 @@ CONFIG_NLS_UTF8=y
386CONFIG_CRC_T10DIF=y 392CONFIG_CRC_T10DIF=y
387CONFIG_MAGIC_SYSRQ=y 393CONFIG_MAGIC_SYSRQ=y
388CONFIG_DEBUG_KERNEL=y 394CONFIG_DEBUG_KERNEL=y
395CONFIG_DEBUG_STACK_USAGE=y
396CONFIG_DEBUG_STACKOVERFLOW=y
389CONFIG_LOCKUP_DETECTOR=y 397CONFIG_LOCKUP_DETECTOR=y
390CONFIG_DEBUG_MUTEXES=y 398CONFIG_DEBUG_MUTEXES=y
391CONFIG_DEBUG_STACK_USAGE=y
392CONFIG_LATENCYTOP=y 399CONFIG_LATENCYTOP=y
393CONFIG_SCHED_TRACER=y 400CONFIG_SCHED_TRACER=y
394CONFIG_BLK_DEV_IO_TRACE=y 401CONFIG_BLK_DEV_IO_TRACE=y
395CONFIG_DEBUG_STACKOVERFLOW=y
396CONFIG_CODE_PATCHING_SELFTEST=y 402CONFIG_CODE_PATCHING_SELFTEST=y
397CONFIG_FTR_FIXUP_SELFTEST=y 403CONFIG_FTR_FIXUP_SELFTEST=y
398CONFIG_MSI_BITMAP_SELFTEST=y 404CONFIG_MSI_BITMAP_SELFTEST=y
399CONFIG_XMON=y 405CONFIG_XMON=y
400CONFIG_BOOTX_TEXT=y 406CONFIG_BOOTX_TEXT=y
401CONFIG_PPC_EARLY_DEBUG=y 407CONFIG_PPC_EARLY_DEBUG=y
402CONFIG_PPC_EARLY_DEBUG_BOOTX=y
403CONFIG_CRYPTO_NULL=m
404CONFIG_CRYPTO_TEST=m 408CONFIG_CRYPTO_TEST=m
405CONFIG_CRYPTO_PCBC=m 409CONFIG_CRYPTO_PCBC=m
406CONFIG_CRYPTO_HMAC=y 410CONFIG_CRYPTO_HMAC=y
@@ -422,4 +426,3 @@ CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
422CONFIG_VIRTUALIZATION=y 426CONFIG_VIRTUALIZATION=y
423CONFIG_KVM_BOOK3S_64=m 427CONFIG_KVM_BOOK3S_64=m
424CONFIG_KVM_BOOK3S_64_HV=y 428CONFIG_KVM_BOOK3S_64_HV=y
425CONFIG_VHOST_NET=m
diff --git a/arch/powerpc/configs/ppc64e_defconfig b/arch/powerpc/configs/ppc64e_defconfig
index 0085dc4642c5..f627fda08953 100644
--- a/arch/powerpc/configs/ppc64e_defconfig
+++ b/arch/powerpc/configs/ppc64e_defconfig
@@ -1,7 +1,6 @@
1CONFIG_PPC64=y 1CONFIG_PPC64=y
2CONFIG_PPC_BOOK3E_64=y 2CONFIG_PPC_BOOK3E_64=y
3CONFIG_SMP=y 3CONFIG_SMP=y
4CONFIG_EXPERIMENTAL=y
5CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
6CONFIG_POSIX_MQUEUE=y 5CONFIG_POSIX_MQUEUE=y
7CONFIG_NO_HZ=y 6CONFIG_NO_HZ=y
@@ -23,7 +22,7 @@ CONFIG_MODULE_SRCVERSION_ALL=y
23CONFIG_PARTITION_ADVANCED=y 22CONFIG_PARTITION_ADVANCED=y
24CONFIG_MAC_PARTITION=y 23CONFIG_MAC_PARTITION=y
25CONFIG_EFI_PARTITION=y 24CONFIG_EFI_PARTITION=y
26CONFIG_P5020_DS=y 25CONFIG_CORENET_GENERIC=y
27CONFIG_CPU_FREQ=y 26CONFIG_CPU_FREQ=y
28CONFIG_CPU_FREQ_GOV_POWERSAVE=y 27CONFIG_CPU_FREQ_GOV_POWERSAVE=y
29CONFIG_CPU_FREQ_GOV_USERSPACE=y 28CONFIG_CPU_FREQ_GOV_USERSPACE=y
@@ -61,7 +60,6 @@ CONFIG_NF_CONNTRACK_PPTP=m
61CONFIG_NF_CONNTRACK_SIP=m 60CONFIG_NF_CONNTRACK_SIP=m
62CONFIG_NF_CONNTRACK_TFTP=m 61CONFIG_NF_CONNTRACK_TFTP=m
63CONFIG_NF_CT_NETLINK=m 62CONFIG_NF_CT_NETLINK=m
64CONFIG_NETFILTER_TPROXY=m
65CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m 63CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
66CONFIG_NETFILTER_XT_TARGET_CONNMARK=m 64CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
67CONFIG_NETFILTER_XT_TARGET_DSCP=m 65CONFIG_NETFILTER_XT_TARGET_DSCP=m
@@ -103,7 +101,6 @@ CONFIG_NETFILTER_XT_MATCH_STRING=m
103CONFIG_NETFILTER_XT_MATCH_TCPMSS=m 101CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
104CONFIG_NETFILTER_XT_MATCH_U32=m 102CONFIG_NETFILTER_XT_MATCH_U32=m
105CONFIG_NF_CONNTRACK_IPV4=m 103CONFIG_NF_CONNTRACK_IPV4=m
106CONFIG_IP_NF_QUEUE=m
107CONFIG_IP_NF_IPTABLES=m 104CONFIG_IP_NF_IPTABLES=m
108CONFIG_IP_NF_MATCH_AH=m 105CONFIG_IP_NF_MATCH_AH=m
109CONFIG_IP_NF_MATCH_ECN=m 106CONFIG_IP_NF_MATCH_ECN=m
@@ -193,7 +190,6 @@ CONFIG_PPP_SYNC_TTY=m
193CONFIG_INPUT_EVDEV=m 190CONFIG_INPUT_EVDEV=m
194CONFIG_INPUT_MISC=y 191CONFIG_INPUT_MISC=y
195# CONFIG_SERIO_SERPORT is not set 192# CONFIG_SERIO_SERPORT is not set
196CONFIG_VT_HW_CONSOLE_BINDING=y
197CONFIG_SERIAL_8250=y 193CONFIG_SERIAL_8250=y
198CONFIG_SERIAL_8250_CONSOLE=y 194CONFIG_SERIAL_8250_CONSOLE=y
199# CONFIG_HW_RANDOM is not set 195# CONFIG_HW_RANDOM is not set
@@ -230,7 +226,6 @@ CONFIG_HID_NTRIG=y
230CONFIG_HID_PANTHERLORD=y 226CONFIG_HID_PANTHERLORD=y
231CONFIG_HID_PETALYNX=y 227CONFIG_HID_PETALYNX=y
232CONFIG_HID_SAMSUNG=y 228CONFIG_HID_SAMSUNG=y
233CONFIG_HID_SONY=y
234CONFIG_HID_SUNPLUS=y 229CONFIG_HID_SUNPLUS=y
235CONFIG_HID_GREENASIA=y 230CONFIG_HID_GREENASIA=y
236CONFIG_HID_SMARTJOYPLUS=y 231CONFIG_HID_SMARTJOYPLUS=y
@@ -302,19 +297,18 @@ CONFIG_NLS_UTF8=y
302CONFIG_CRC_T10DIF=y 297CONFIG_CRC_T10DIF=y
303CONFIG_MAGIC_SYSRQ=y 298CONFIG_MAGIC_SYSRQ=y
304CONFIG_DEBUG_KERNEL=y 299CONFIG_DEBUG_KERNEL=y
300CONFIG_DEBUG_STACK_USAGE=y
301CONFIG_DEBUG_STACKOVERFLOW=y
305CONFIG_DETECT_HUNG_TASK=y 302CONFIG_DETECT_HUNG_TASK=y
306CONFIG_DEBUG_MUTEXES=y 303CONFIG_DEBUG_MUTEXES=y
307CONFIG_DEBUG_STACK_USAGE=y
308CONFIG_LATENCYTOP=y 304CONFIG_LATENCYTOP=y
309CONFIG_IRQSOFF_TRACER=y 305CONFIG_IRQSOFF_TRACER=y
310CONFIG_SCHED_TRACER=y 306CONFIG_SCHED_TRACER=y
311CONFIG_BLK_DEV_IO_TRACE=y 307CONFIG_BLK_DEV_IO_TRACE=y
312CONFIG_DEBUG_STACKOVERFLOW=y
313CONFIG_CODE_PATCHING_SELFTEST=y 308CONFIG_CODE_PATCHING_SELFTEST=y
314CONFIG_FTR_FIXUP_SELFTEST=y 309CONFIG_FTR_FIXUP_SELFTEST=y
315CONFIG_MSI_BITMAP_SELFTEST=y 310CONFIG_MSI_BITMAP_SELFTEST=y
316CONFIG_XMON=y 311CONFIG_XMON=y
317CONFIG_CRYPTO_NULL=m
318CONFIG_CRYPTO_TEST=m 312CONFIG_CRYPTO_TEST=m
319CONFIG_CRYPTO_CCM=m 313CONFIG_CRYPTO_CCM=m
320CONFIG_CRYPTO_GCM=m 314CONFIG_CRYPTO_GCM=m
diff --git a/arch/powerpc/configs/ppc6xx_defconfig b/arch/powerpc/configs/ppc6xx_defconfig
index 20ebfaf7234b..c2353bf059fd 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -71,7 +71,7 @@ CONFIG_QUICC_ENGINE=y
71CONFIG_QE_GPIO=y 71CONFIG_QE_GPIO=y
72CONFIG_PPC_BESTCOMM=y 72CONFIG_PPC_BESTCOMM=y
73CONFIG_GPIO_MPC8XXX=y 73CONFIG_GPIO_MPC8XXX=y
74CONFIG_MCU_MPC8349EMITX=m 74CONFIG_MCU_MPC8349EMITX=y
75CONFIG_HIGHMEM=y 75CONFIG_HIGHMEM=y
76CONFIG_NO_HZ=y 76CONFIG_NO_HZ=y
77CONFIG_HIGH_RES_TIMERS=y 77CONFIG_HIGH_RES_TIMERS=y
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index 1d4b9763895d..e9a8b4e0a0f6 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -3,7 +3,6 @@ CONFIG_ALTIVEC=y
3CONFIG_VSX=y 3CONFIG_VSX=y
4CONFIG_SMP=y 4CONFIG_SMP=y
5CONFIG_NR_CPUS=2048 5CONFIG_NR_CPUS=2048
6CONFIG_EXPERIMENTAL=y
7CONFIG_SYSVIPC=y 6CONFIG_SYSVIPC=y
8CONFIG_POSIX_MQUEUE=y 7CONFIG_POSIX_MQUEUE=y
9CONFIG_AUDIT=y 8CONFIG_AUDIT=y
@@ -33,7 +32,6 @@ CONFIG_MODULE_UNLOAD=y
33CONFIG_MODVERSIONS=y 32CONFIG_MODVERSIONS=y
34CONFIG_MODULE_SRCVERSION_ALL=y 33CONFIG_MODULE_SRCVERSION_ALL=y
35CONFIG_PARTITION_ADVANCED=y 34CONFIG_PARTITION_ADVANCED=y
36CONFIG_EFI_PARTITION=y
37CONFIG_PPC_SPLPAR=y 35CONFIG_PPC_SPLPAR=y
38CONFIG_SCANLOG=m 36CONFIG_SCANLOG=m
39CONFIG_PPC_SMLPAR=y 37CONFIG_PPC_SMLPAR=y
@@ -44,7 +42,6 @@ CONFIG_IBMEBUS=y
44CONFIG_HZ_100=y 42CONFIG_HZ_100=y
45CONFIG_BINFMT_MISC=m 43CONFIG_BINFMT_MISC=m
46CONFIG_PPC_TRANSACTIONAL_MEM=y 44CONFIG_PPC_TRANSACTIONAL_MEM=y
47CONFIG_HOTPLUG_CPU=y
48CONFIG_KEXEC=y 45CONFIG_KEXEC=y
49CONFIG_IRQ_ALL_CPUS=y 46CONFIG_IRQ_ALL_CPUS=y
50CONFIG_MEMORY_HOTPLUG=y 47CONFIG_MEMORY_HOTPLUG=y
@@ -52,7 +49,6 @@ CONFIG_MEMORY_HOTREMOVE=y
52CONFIG_PPC_64K_PAGES=y 49CONFIG_PPC_64K_PAGES=y
53CONFIG_PPC_SUBPAGE_PROT=y 50CONFIG_PPC_SUBPAGE_PROT=y
54CONFIG_SCHED_SMT=y 51CONFIG_SCHED_SMT=y
55CONFIG_PPC_DENORMALISATION=y
56CONFIG_HOTPLUG_PCI=y 52CONFIG_HOTPLUG_PCI=y
57CONFIG_HOTPLUG_PCI_RPA=m 53CONFIG_HOTPLUG_PCI_RPA=m
58CONFIG_HOTPLUG_PCI_RPA_DLPAR=m 54CONFIG_HOTPLUG_PCI_RPA_DLPAR=m
@@ -113,7 +109,6 @@ CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
113CONFIG_NETFILTER_XT_MATCH_TIME=m 109CONFIG_NETFILTER_XT_MATCH_TIME=m
114CONFIG_NETFILTER_XT_MATCH_U32=m 110CONFIG_NETFILTER_XT_MATCH_U32=m
115CONFIG_NF_CONNTRACK_IPV4=m 111CONFIG_NF_CONNTRACK_IPV4=m
116CONFIG_IP_NF_QUEUE=m
117CONFIG_IP_NF_IPTABLES=m 112CONFIG_IP_NF_IPTABLES=m
118CONFIG_IP_NF_MATCH_AH=m 113CONFIG_IP_NF_MATCH_AH=m
119CONFIG_IP_NF_MATCH_ECN=m 114CONFIG_IP_NF_MATCH_ECN=m
@@ -132,6 +127,7 @@ CONFIG_BLK_DEV_LOOP=y
132CONFIG_BLK_DEV_NBD=m 127CONFIG_BLK_DEV_NBD=m
133CONFIG_BLK_DEV_RAM=y 128CONFIG_BLK_DEV_RAM=y
134CONFIG_BLK_DEV_RAM_SIZE=65536 129CONFIG_BLK_DEV_RAM_SIZE=65536
130CONFIG_VIRTIO_BLK=m
135CONFIG_IDE=y 131CONFIG_IDE=y
136CONFIG_BLK_DEV_IDECD=y 132CONFIG_BLK_DEV_IDECD=y
137CONFIG_BLK_DEV_GENERIC=y 133CONFIG_BLK_DEV_GENERIC=y
@@ -157,6 +153,10 @@ CONFIG_SCSI_IPR=y
157CONFIG_SCSI_QLA_FC=m 153CONFIG_SCSI_QLA_FC=m
158CONFIG_SCSI_QLA_ISCSI=m 154CONFIG_SCSI_QLA_ISCSI=m
159CONFIG_SCSI_LPFC=m 155CONFIG_SCSI_LPFC=m
156CONFIG_SCSI_VIRTIO=m
157CONFIG_SCSI_DH=m
158CONFIG_SCSI_DH_RDAC=m
159CONFIG_SCSI_DH_ALUA=m
160CONFIG_ATA=y 160CONFIG_ATA=y
161# CONFIG_ATA_SFF is not set 161# CONFIG_ATA_SFF is not set
162CONFIG_MD=y 162CONFIG_MD=y
@@ -174,11 +174,16 @@ CONFIG_DM_SNAPSHOT=m
174CONFIG_DM_MIRROR=m 174CONFIG_DM_MIRROR=m
175CONFIG_DM_ZERO=m 175CONFIG_DM_ZERO=m
176CONFIG_DM_MULTIPATH=m 176CONFIG_DM_MULTIPATH=m
177CONFIG_DM_MULTIPATH_QL=m
178CONFIG_DM_MULTIPATH_ST=m
179CONFIG_DM_UEVENT=y
177CONFIG_BONDING=m 180CONFIG_BONDING=m
178CONFIG_DUMMY=m 181CONFIG_DUMMY=m
179CONFIG_NETCONSOLE=y 182CONFIG_NETCONSOLE=y
180CONFIG_NETPOLL_TRAP=y 183CONFIG_NETPOLL_TRAP=y
181CONFIG_TUN=m 184CONFIG_TUN=m
185CONFIG_VIRTIO_NET=m
186CONFIG_VHOST_NET=m
182CONFIG_VORTEX=y 187CONFIG_VORTEX=y
183CONFIG_ACENIC=m 188CONFIG_ACENIC=m
184CONFIG_ACENIC_OMIT_TIGON_I=y 189CONFIG_ACENIC_OMIT_TIGON_I=y
@@ -216,6 +221,7 @@ CONFIG_SERIAL_JSM=m
216CONFIG_HVC_CONSOLE=y 221CONFIG_HVC_CONSOLE=y
217CONFIG_HVC_RTAS=y 222CONFIG_HVC_RTAS=y
218CONFIG_HVCS=m 223CONFIG_HVCS=m
224CONFIG_VIRTIO_CONSOLE=m
219CONFIG_IBM_BSR=m 225CONFIG_IBM_BSR=m
220CONFIG_GEN_RTC=y 226CONFIG_GEN_RTC=y
221CONFIG_RAW_DRIVER=y 227CONFIG_RAW_DRIVER=y
@@ -237,7 +243,6 @@ CONFIG_HID_GYRATION=y
237CONFIG_HID_PANTHERLORD=y 243CONFIG_HID_PANTHERLORD=y
238CONFIG_HID_PETALYNX=y 244CONFIG_HID_PETALYNX=y
239CONFIG_HID_SAMSUNG=y 245CONFIG_HID_SAMSUNG=y
240CONFIG_HID_SONY=y
241CONFIG_HID_SUNPLUS=y 246CONFIG_HID_SUNPLUS=y
242CONFIG_USB_HIDDEV=y 247CONFIG_USB_HIDDEV=y
243CONFIG_USB=y 248CONFIG_USB=y
@@ -258,6 +263,8 @@ CONFIG_INFINIBAND_IPOIB=m
258CONFIG_INFINIBAND_IPOIB_CM=y 263CONFIG_INFINIBAND_IPOIB_CM=y
259CONFIG_INFINIBAND_SRP=m 264CONFIG_INFINIBAND_SRP=m
260CONFIG_INFINIBAND_ISER=m 265CONFIG_INFINIBAND_ISER=m
266CONFIG_VIRTIO_PCI=m
267CONFIG_VIRTIO_BALLOON=m
261CONFIG_EXT2_FS=y 268CONFIG_EXT2_FS=y
262CONFIG_EXT2_FS_XATTR=y 269CONFIG_EXT2_FS_XATTR=y
263CONFIG_EXT2_FS_POSIX_ACL=y 270CONFIG_EXT2_FS_POSIX_ACL=y
@@ -314,18 +321,17 @@ CONFIG_NLS_UTF8=y
314CONFIG_CRC_T10DIF=y 321CONFIG_CRC_T10DIF=y
315CONFIG_MAGIC_SYSRQ=y 322CONFIG_MAGIC_SYSRQ=y
316CONFIG_DEBUG_KERNEL=y 323CONFIG_DEBUG_KERNEL=y
317CONFIG_LOCKUP_DETECTOR=y
318CONFIG_DEBUG_STACK_USAGE=y 324CONFIG_DEBUG_STACK_USAGE=y
325CONFIG_DEBUG_STACKOVERFLOW=y
326CONFIG_LOCKUP_DETECTOR=y
319CONFIG_LATENCYTOP=y 327CONFIG_LATENCYTOP=y
320CONFIG_SCHED_TRACER=y 328CONFIG_SCHED_TRACER=y
321CONFIG_BLK_DEV_IO_TRACE=y 329CONFIG_BLK_DEV_IO_TRACE=y
322CONFIG_DEBUG_STACKOVERFLOW=y
323CONFIG_CODE_PATCHING_SELFTEST=y 330CONFIG_CODE_PATCHING_SELFTEST=y
324CONFIG_FTR_FIXUP_SELFTEST=y 331CONFIG_FTR_FIXUP_SELFTEST=y
325CONFIG_MSI_BITMAP_SELFTEST=y 332CONFIG_MSI_BITMAP_SELFTEST=y
326CONFIG_XMON=y 333CONFIG_XMON=y
327CONFIG_XMON_DEFAULT=y 334CONFIG_XMON_DEFAULT=y
328CONFIG_CRYPTO_NULL=m
329CONFIG_CRYPTO_TEST=m 335CONFIG_CRYPTO_TEST=m
330CONFIG_CRYPTO_PCBC=m 336CONFIG_CRYPTO_PCBC=m
331CONFIG_CRYPTO_HMAC=y 337CONFIG_CRYPTO_HMAC=y
@@ -347,4 +353,3 @@ CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
347CONFIG_VIRTUALIZATION=y 353CONFIG_VIRTUALIZATION=y
348CONFIG_KVM_BOOK3S_64=m 354CONFIG_KVM_BOOK3S_64=m
349CONFIG_KVM_BOOK3S_64_HV=y 355CONFIG_KVM_BOOK3S_64_HV=y
350CONFIG_VHOST_NET=m
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index 704e6f10ae80..d8f9d2f18a23 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -2,4 +2,5 @@
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += rwsem.h 3generic-y += rwsem.h
4generic-y += trace_clock.h 4generic-y += trace_clock.h
5generic-y += preempt.h
5generic-y += vtime.h \ No newline at end of file 6generic-y += vtime.h \ No newline at end of file
diff --git a/arch/powerpc/include/asm/archrandom.h b/arch/powerpc/include/asm/archrandom.h
new file mode 100644
index 000000000000..d853d163ba47
--- /dev/null
+++ b/arch/powerpc/include/asm/archrandom.h
@@ -0,0 +1,32 @@
1#ifndef _ASM_POWERPC_ARCHRANDOM_H
2#define _ASM_POWERPC_ARCHRANDOM_H
3
4#ifdef CONFIG_ARCH_RANDOM
5
6#include <asm/machdep.h>
7
8static inline int arch_get_random_long(unsigned long *v)
9{
10 if (ppc_md.get_random_long)
11 return ppc_md.get_random_long(v);
12
13 return 0;
14}
15
16static inline int arch_get_random_int(unsigned int *v)
17{
18 unsigned long val;
19 int rc;
20
21 rc = arch_get_random_long(&val);
22 if (rc)
23 *v = val;
24
25 return rc;
26}
27
28int powernv_get_random_long(unsigned long *v);
29
30#endif /* CONFIG_ARCH_RANDOM */
31
32#endif /* _ASM_POWERPC_ARCHRANDOM_H */
diff --git a/arch/powerpc/include/asm/checksum.h b/arch/powerpc/include/asm/checksum.h
index ce0c28495f9a..8251a3ba870f 100644
--- a/arch/powerpc/include/asm/checksum.h
+++ b/arch/powerpc/include/asm/checksum.h
@@ -14,6 +14,9 @@
14 * which always checksum on 4 octet boundaries. ihl is the number 14 * which always checksum on 4 octet boundaries. ihl is the number
15 * of 32-bit words and is always >= 5. 15 * of 32-bit words and is always >= 5.
16 */ 16 */
17#ifdef CONFIG_GENERIC_CSUM
18#include <asm-generic/checksum.h>
19#else
17extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl); 20extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
18 21
19/* 22/*
@@ -123,5 +126,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
123 return sum; 126 return sum;
124#endif 127#endif
125} 128}
129
130#endif
126#endif /* __KERNEL__ */ 131#endif /* __KERNEL__ */
127#endif 132#endif
diff --git a/arch/powerpc/include/asm/disassemble.h b/arch/powerpc/include/asm/disassemble.h
index 9b198d1b3b2b..856f8deb557a 100644
--- a/arch/powerpc/include/asm/disassemble.h
+++ b/arch/powerpc/include/asm/disassemble.h
@@ -77,4 +77,8 @@ static inline unsigned int get_d(u32 inst)
77 return inst & 0xffff; 77 return inst & 0xffff;
78} 78}
79 79
80static inline unsigned int get_oc(u32 inst)
81{
82 return (inst >> 11) & 0x7fff;
83}
80#endif /* __ASM_PPC_DISASSEMBLE_H__ */ 84#endif /* __ASM_PPC_DISASSEMBLE_H__ */
diff --git a/arch/powerpc/include/asm/emulated_ops.h b/arch/powerpc/include/asm/emulated_ops.h
index 5a8b82aa7241..4358e3002f35 100644
--- a/arch/powerpc/include/asm/emulated_ops.h
+++ b/arch/powerpc/include/asm/emulated_ops.h
@@ -43,6 +43,7 @@ extern struct ppc_emulated {
43 struct ppc_emulated_entry popcntb; 43 struct ppc_emulated_entry popcntb;
44 struct ppc_emulated_entry spe; 44 struct ppc_emulated_entry spe;
45 struct ppc_emulated_entry string; 45 struct ppc_emulated_entry string;
46 struct ppc_emulated_entry sync;
46 struct ppc_emulated_entry unaligned; 47 struct ppc_emulated_entry unaligned;
47#ifdef CONFIG_MATH_EMULATION 48#ifdef CONFIG_MATH_EMULATION
48 struct ppc_emulated_entry math; 49 struct ppc_emulated_entry math;
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index cca12f084842..894662a5d4d5 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -198,12 +198,27 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
198 cmpwi r10,0; \ 198 cmpwi r10,0; \
199 bne do_kvm_##n 199 bne do_kvm_##n
200 200
201#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
202/*
203 * If hv is possible, interrupts come into to the hv version
204 * of the kvmppc_interrupt code, which then jumps to the PR handler,
205 * kvmppc_interrupt_pr, if the guest is a PR guest.
206 */
207#define kvmppc_interrupt kvmppc_interrupt_hv
208#else
209#define kvmppc_interrupt kvmppc_interrupt_pr
210#endif
211
201#define __KVM_HANDLER(area, h, n) \ 212#define __KVM_HANDLER(area, h, n) \
202do_kvm_##n: \ 213do_kvm_##n: \
203 BEGIN_FTR_SECTION_NESTED(947) \ 214 BEGIN_FTR_SECTION_NESTED(947) \
204 ld r10,area+EX_CFAR(r13); \ 215 ld r10,area+EX_CFAR(r13); \
205 std r10,HSTATE_CFAR(r13); \ 216 std r10,HSTATE_CFAR(r13); \
206 END_FTR_SECTION_NESTED(CPU_FTR_CFAR,CPU_FTR_CFAR,947); \ 217 END_FTR_SECTION_NESTED(CPU_FTR_CFAR,CPU_FTR_CFAR,947); \
218 BEGIN_FTR_SECTION_NESTED(948) \
219 ld r10,area+EX_PPR(r13); \
220 std r10,HSTATE_PPR(r13); \
221 END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,948); \
207 ld r10,area+EX_R10(r13); \ 222 ld r10,area+EX_R10(r13); \
208 stw r9,HSTATE_SCRATCH1(r13); \ 223 stw r9,HSTATE_SCRATCH1(r13); \
209 ld r9,area+EX_R9(r13); \ 224 ld r9,area+EX_R9(r13); \
@@ -217,6 +232,10 @@ do_kvm_##n: \
217 ld r10,area+EX_R10(r13); \ 232 ld r10,area+EX_R10(r13); \
218 beq 89f; \ 233 beq 89f; \
219 stw r9,HSTATE_SCRATCH1(r13); \ 234 stw r9,HSTATE_SCRATCH1(r13); \
235 BEGIN_FTR_SECTION_NESTED(948) \
236 ld r9,area+EX_PPR(r13); \
237 std r9,HSTATE_PPR(r13); \
238 END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,948); \
220 ld r9,area+EX_R9(r13); \ 239 ld r9,area+EX_R9(r13); \
221 std r12,HSTATE_SCRATCH0(r13); \ 240 std r12,HSTATE_SCRATCH0(r13); \
222 li r12,n; \ 241 li r12,n; \
@@ -236,7 +255,7 @@ do_kvm_##n: \
236#define KVM_HANDLER_SKIP(area, h, n) 255#define KVM_HANDLER_SKIP(area, h, n)
237#endif 256#endif
238 257
239#ifdef CONFIG_KVM_BOOK3S_PR 258#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
240#define KVMTEST_PR(n) __KVMTEST(n) 259#define KVMTEST_PR(n) __KVMTEST(n)
241#define KVM_HANDLER_PR(area, h, n) __KVM_HANDLER(area, h, n) 260#define KVM_HANDLER_PR(area, h, n) __KVM_HANDLER(area, h, n)
242#define KVM_HANDLER_PR_SKIP(area, h, n) __KVM_HANDLER_SKIP(area, h, n) 261#define KVM_HANDLER_PR_SKIP(area, h, n) __KVM_HANDLER_SKIP(area, h, n)
diff --git a/arch/powerpc/include/asm/fsl_ifc.h b/arch/powerpc/include/asm/fsl_ifc.h
index b8a4b9bc50b3..f49ddb1b2273 100644
--- a/arch/powerpc/include/asm/fsl_ifc.h
+++ b/arch/powerpc/include/asm/fsl_ifc.h
@@ -93,6 +93,7 @@
93#define CSOR_NAND_PGS_512 0x00000000 93#define CSOR_NAND_PGS_512 0x00000000
94#define CSOR_NAND_PGS_2K 0x00080000 94#define CSOR_NAND_PGS_2K 0x00080000
95#define CSOR_NAND_PGS_4K 0x00100000 95#define CSOR_NAND_PGS_4K 0x00100000
96#define CSOR_NAND_PGS_8K 0x00180000
96/* Spare region Size */ 97/* Spare region Size */
97#define CSOR_NAND_SPRZ_MASK 0x0000E000 98#define CSOR_NAND_SPRZ_MASK 0x0000E000
98#define CSOR_NAND_SPRZ_SHIFT 13 99#define CSOR_NAND_SPRZ_SHIFT 13
@@ -102,6 +103,7 @@
102#define CSOR_NAND_SPRZ_210 0x00006000 103#define CSOR_NAND_SPRZ_210 0x00006000
103#define CSOR_NAND_SPRZ_218 0x00008000 104#define CSOR_NAND_SPRZ_218 0x00008000
104#define CSOR_NAND_SPRZ_224 0x0000A000 105#define CSOR_NAND_SPRZ_224 0x0000A000
106#define CSOR_NAND_SPRZ_CSOR_EXT 0x0000C000
105/* Pages Per Block */ 107/* Pages Per Block */
106#define CSOR_NAND_PB_MASK 0x00000700 108#define CSOR_NAND_PB_MASK 0x00000700
107#define CSOR_NAND_PB_SHIFT 8 109#define CSOR_NAND_PB_SHIFT 8
diff --git a/arch/powerpc/include/asm/hvsi.h b/arch/powerpc/include/asm/hvsi.h
index d3f64f361814..d4a5315718ca 100644
--- a/arch/powerpc/include/asm/hvsi.h
+++ b/arch/powerpc/include/asm/hvsi.h
@@ -25,7 +25,7 @@
25struct hvsi_header { 25struct hvsi_header {
26 uint8_t type; 26 uint8_t type;
27 uint8_t len; 27 uint8_t len;
28 uint16_t seqno; 28 __be16 seqno;
29} __attribute__((packed)); 29} __attribute__((packed));
30 30
31struct hvsi_data { 31struct hvsi_data {
@@ -35,24 +35,24 @@ struct hvsi_data {
35 35
36struct hvsi_control { 36struct hvsi_control {
37 struct hvsi_header hdr; 37 struct hvsi_header hdr;
38 uint16_t verb; 38 __be16 verb;
39 /* optional depending on verb: */ 39 /* optional depending on verb: */
40 uint32_t word; 40 __be32 word;
41 uint32_t mask; 41 __be32 mask;
42} __attribute__((packed)); 42} __attribute__((packed));
43 43
44struct hvsi_query { 44struct hvsi_query {
45 struct hvsi_header hdr; 45 struct hvsi_header hdr;
46 uint16_t verb; 46 __be16 verb;
47} __attribute__((packed)); 47} __attribute__((packed));
48 48
49struct hvsi_query_response { 49struct hvsi_query_response {
50 struct hvsi_header hdr; 50 struct hvsi_header hdr;
51 uint16_t verb; 51 __be16 verb;
52 uint16_t query_seqno; 52 __be16 query_seqno;
53 union { 53 union {
54 uint8_t version; 54 uint8_t version;
55 uint32_t mctrl_word; 55 __be32 mctrl_word;
56 } u; 56 } u;
57} __attribute__((packed)); 57} __attribute__((packed));
58 58
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 5a64757dc0d1..575fbf81fad0 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -21,7 +21,7 @@ extern struct pci_dev *isa_bridge_pcidev;
21/* 21/*
22 * has legacy ISA devices ? 22 * has legacy ISA devices ?
23 */ 23 */
24#define arch_has_dev_port() (isa_bridge_pcidev != NULL) 24#define arch_has_dev_port() (isa_bridge_pcidev != NULL || isa_io_special)
25#endif 25#endif
26 26
27#include <linux/device.h> 27#include <linux/device.h>
@@ -113,7 +113,7 @@ extern bool isa_io_special;
113 113
114/* gcc 4.0 and older doesn't have 'Z' constraint */ 114/* gcc 4.0 and older doesn't have 'Z' constraint */
115#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 0) 115#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 0)
116#define DEF_MMIO_IN_LE(name, size, insn) \ 116#define DEF_MMIO_IN_X(name, size, insn) \
117static inline u##size name(const volatile u##size __iomem *addr) \ 117static inline u##size name(const volatile u##size __iomem *addr) \
118{ \ 118{ \
119 u##size ret; \ 119 u##size ret; \
@@ -122,7 +122,7 @@ static inline u##size name(const volatile u##size __iomem *addr) \
122 return ret; \ 122 return ret; \
123} 123}
124 124
125#define DEF_MMIO_OUT_LE(name, size, insn) \ 125#define DEF_MMIO_OUT_X(name, size, insn) \
126static inline void name(volatile u##size __iomem *addr, u##size val) \ 126static inline void name(volatile u##size __iomem *addr, u##size val) \
127{ \ 127{ \
128 __asm__ __volatile__("sync;"#insn" %1,0,%2" \ 128 __asm__ __volatile__("sync;"#insn" %1,0,%2" \
@@ -130,7 +130,7 @@ static inline void name(volatile u##size __iomem *addr, u##size val) \
130 IO_SET_SYNC_FLAG(); \ 130 IO_SET_SYNC_FLAG(); \
131} 131}
132#else /* newer gcc */ 132#else /* newer gcc */
133#define DEF_MMIO_IN_LE(name, size, insn) \ 133#define DEF_MMIO_IN_X(name, size, insn) \
134static inline u##size name(const volatile u##size __iomem *addr) \ 134static inline u##size name(const volatile u##size __iomem *addr) \
135{ \ 135{ \
136 u##size ret; \ 136 u##size ret; \
@@ -139,7 +139,7 @@ static inline u##size name(const volatile u##size __iomem *addr) \
139 return ret; \ 139 return ret; \
140} 140}
141 141
142#define DEF_MMIO_OUT_LE(name, size, insn) \ 142#define DEF_MMIO_OUT_X(name, size, insn) \
143static inline void name(volatile u##size __iomem *addr, u##size val) \ 143static inline void name(volatile u##size __iomem *addr, u##size val) \
144{ \ 144{ \
145 __asm__ __volatile__("sync;"#insn" %1,%y0" \ 145 __asm__ __volatile__("sync;"#insn" %1,%y0" \
@@ -148,7 +148,7 @@ static inline void name(volatile u##size __iomem *addr, u##size val) \
148} 148}
149#endif 149#endif
150 150
151#define DEF_MMIO_IN_BE(name, size, insn) \ 151#define DEF_MMIO_IN_D(name, size, insn) \
152static inline u##size name(const volatile u##size __iomem *addr) \ 152static inline u##size name(const volatile u##size __iomem *addr) \
153{ \ 153{ \
154 u##size ret; \ 154 u##size ret; \
@@ -157,7 +157,7 @@ static inline u##size name(const volatile u##size __iomem *addr) \
157 return ret; \ 157 return ret; \
158} 158}
159 159
160#define DEF_MMIO_OUT_BE(name, size, insn) \ 160#define DEF_MMIO_OUT_D(name, size, insn) \
161static inline void name(volatile u##size __iomem *addr, u##size val) \ 161static inline void name(volatile u##size __iomem *addr, u##size val) \
162{ \ 162{ \
163 __asm__ __volatile__("sync;"#insn"%U0%X0 %1,%0" \ 163 __asm__ __volatile__("sync;"#insn"%U0%X0 %1,%0" \
@@ -165,22 +165,37 @@ static inline void name(volatile u##size __iomem *addr, u##size val) \
165 IO_SET_SYNC_FLAG(); \ 165 IO_SET_SYNC_FLAG(); \
166} 166}
167 167
168DEF_MMIO_IN_D(in_8, 8, lbz);
169DEF_MMIO_OUT_D(out_8, 8, stb);
168 170
169DEF_MMIO_IN_BE(in_8, 8, lbz); 171#ifdef __BIG_ENDIAN__
170DEF_MMIO_IN_BE(in_be16, 16, lhz); 172DEF_MMIO_IN_D(in_be16, 16, lhz);
171DEF_MMIO_IN_BE(in_be32, 32, lwz); 173DEF_MMIO_IN_D(in_be32, 32, lwz);
172DEF_MMIO_IN_LE(in_le16, 16, lhbrx); 174DEF_MMIO_IN_X(in_le16, 16, lhbrx);
173DEF_MMIO_IN_LE(in_le32, 32, lwbrx); 175DEF_MMIO_IN_X(in_le32, 32, lwbrx);
174 176
175DEF_MMIO_OUT_BE(out_8, 8, stb); 177DEF_MMIO_OUT_D(out_be16, 16, sth);
176DEF_MMIO_OUT_BE(out_be16, 16, sth); 178DEF_MMIO_OUT_D(out_be32, 32, stw);
177DEF_MMIO_OUT_BE(out_be32, 32, stw); 179DEF_MMIO_OUT_X(out_le16, 16, sthbrx);
178DEF_MMIO_OUT_LE(out_le16, 16, sthbrx); 180DEF_MMIO_OUT_X(out_le32, 32, stwbrx);
179DEF_MMIO_OUT_LE(out_le32, 32, stwbrx); 181#else
182DEF_MMIO_IN_X(in_be16, 16, lhbrx);
183DEF_MMIO_IN_X(in_be32, 32, lwbrx);
184DEF_MMIO_IN_D(in_le16, 16, lhz);
185DEF_MMIO_IN_D(in_le32, 32, lwz);
186
187DEF_MMIO_OUT_X(out_be16, 16, sthbrx);
188DEF_MMIO_OUT_X(out_be32, 32, stwbrx);
189DEF_MMIO_OUT_D(out_le16, 16, sth);
190DEF_MMIO_OUT_D(out_le32, 32, stw);
191
192#endif /* __BIG_ENDIAN */
180 193
181#ifdef __powerpc64__ 194#ifdef __powerpc64__
182DEF_MMIO_OUT_BE(out_be64, 64, std); 195
183DEF_MMIO_IN_BE(in_be64, 64, ld); 196#ifdef __BIG_ENDIAN__
197DEF_MMIO_OUT_D(out_be64, 64, std);
198DEF_MMIO_IN_D(in_be64, 64, ld);
184 199
185/* There is no asm instructions for 64 bits reverse loads and stores */ 200/* There is no asm instructions for 64 bits reverse loads and stores */
186static inline u64 in_le64(const volatile u64 __iomem *addr) 201static inline u64 in_le64(const volatile u64 __iomem *addr)
@@ -192,6 +207,22 @@ static inline void out_le64(volatile u64 __iomem *addr, u64 val)
192{ 207{
193 out_be64(addr, swab64(val)); 208 out_be64(addr, swab64(val));
194} 209}
210#else
211DEF_MMIO_OUT_D(out_le64, 64, std);
212DEF_MMIO_IN_D(in_le64, 64, ld);
213
214/* There is no asm instructions for 64 bits reverse loads and stores */
215static inline u64 in_be64(const volatile u64 __iomem *addr)
216{
217 return swab64(in_le64(addr));
218}
219
220static inline void out_be64(volatile u64 __iomem *addr, u64 val)
221{
222 out_le64(addr, swab64(val));
223}
224
225#endif
195#endif /* __powerpc64__ */ 226#endif /* __powerpc64__ */
196 227
197/* 228/*
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
index 0e40843a1c6e..41f13cec8a8f 100644
--- a/arch/powerpc/include/asm/irq.h
+++ b/arch/powerpc/include/asm/irq.h
@@ -69,9 +69,9 @@ extern struct thread_info *softirq_ctx[NR_CPUS];
69 69
70extern void irq_ctx_init(void); 70extern void irq_ctx_init(void);
71extern void call_do_softirq(struct thread_info *tp); 71extern void call_do_softirq(struct thread_info *tp);
72extern int call_handle_irq(int irq, void *p1, 72extern void call_do_irq(struct pt_regs *regs, struct thread_info *tp);
73 struct thread_info *tp, void *func);
74extern void do_IRQ(struct pt_regs *regs); 73extern void do_IRQ(struct pt_regs *regs);
74extern void __do_irq(struct pt_regs *regs);
75 75
76int irq_choose_cpu(const struct cpumask *mask); 76int irq_choose_cpu(const struct cpumask *mask);
77 77
diff --git a/arch/powerpc/include/asm/jump_label.h b/arch/powerpc/include/asm/jump_label.h
index ae098c438f00..f016bb699b5f 100644
--- a/arch/powerpc/include/asm/jump_label.h
+++ b/arch/powerpc/include/asm/jump_label.h
@@ -19,7 +19,7 @@
19 19
20static __always_inline bool arch_static_branch(struct static_key *key) 20static __always_inline bool arch_static_branch(struct static_key *key)
21{ 21{
22 asm goto("1:\n\t" 22 asm_volatile_goto("1:\n\t"
23 "nop\n\t" 23 "nop\n\t"
24 ".pushsection __jump_table, \"aw\"\n\t" 24 ".pushsection __jump_table, \"aw\"\n\t"
25 JUMP_ENTRY_TYPE "1b, %l[l_yes], %c0\n\t" 25 JUMP_ENTRY_TYPE "1b, %l[l_yes], %c0\n\t"
diff --git a/arch/powerpc/include/asm/kvm_asm.h b/arch/powerpc/include/asm/kvm_asm.h
index 851bac7afa4b..1bd92fd43cfb 100644
--- a/arch/powerpc/include/asm/kvm_asm.h
+++ b/arch/powerpc/include/asm/kvm_asm.h
@@ -123,6 +123,8 @@
123#define BOOK3S_HFLAG_SLB 0x2 123#define BOOK3S_HFLAG_SLB 0x2
124#define BOOK3S_HFLAG_PAIRED_SINGLE 0x4 124#define BOOK3S_HFLAG_PAIRED_SINGLE 0x4
125#define BOOK3S_HFLAG_NATIVE_PS 0x8 125#define BOOK3S_HFLAG_NATIVE_PS 0x8
126#define BOOK3S_HFLAG_MULTI_PGSIZE 0x10
127#define BOOK3S_HFLAG_NEW_TLBIE 0x20
126 128
127#define RESUME_FLAG_NV (1<<0) /* Reload guest nonvolatile state? */ 129#define RESUME_FLAG_NV (1<<0) /* Reload guest nonvolatile state? */
128#define RESUME_FLAG_HOST (1<<1) /* Resume host? */ 130#define RESUME_FLAG_HOST (1<<1) /* Resume host? */
@@ -136,6 +138,8 @@
136#define KVM_GUEST_MODE_NONE 0 138#define KVM_GUEST_MODE_NONE 0
137#define KVM_GUEST_MODE_GUEST 1 139#define KVM_GUEST_MODE_GUEST 1
138#define KVM_GUEST_MODE_SKIP 2 140#define KVM_GUEST_MODE_SKIP 2
141#define KVM_GUEST_MODE_GUEST_HV 3
142#define KVM_GUEST_MODE_HOST_HV 4
139 143
140#define KVM_INST_FETCH_FAILED -1 144#define KVM_INST_FETCH_FAILED -1
141 145
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index fa19e2f1a874..4a594b76674d 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -58,16 +58,18 @@ struct hpte_cache {
58 struct hlist_node list_pte_long; 58 struct hlist_node list_pte_long;
59 struct hlist_node list_vpte; 59 struct hlist_node list_vpte;
60 struct hlist_node list_vpte_long; 60 struct hlist_node list_vpte_long;
61#ifdef CONFIG_PPC_BOOK3S_64
62 struct hlist_node list_vpte_64k;
63#endif
61 struct rcu_head rcu_head; 64 struct rcu_head rcu_head;
62 u64 host_vpn; 65 u64 host_vpn;
63 u64 pfn; 66 u64 pfn;
64 ulong slot; 67 ulong slot;
65 struct kvmppc_pte pte; 68 struct kvmppc_pte pte;
69 int pagesize;
66}; 70};
67 71
68struct kvmppc_vcpu_book3s { 72struct kvmppc_vcpu_book3s {
69 struct kvm_vcpu vcpu;
70 struct kvmppc_book3s_shadow_vcpu *shadow_vcpu;
71 struct kvmppc_sid_map sid_map[SID_MAP_NUM]; 73 struct kvmppc_sid_map sid_map[SID_MAP_NUM];
72 struct { 74 struct {
73 u64 esid; 75 u64 esid;
@@ -99,6 +101,9 @@ struct kvmppc_vcpu_book3s {
99 struct hlist_head hpte_hash_pte_long[HPTEG_HASH_NUM_PTE_LONG]; 101 struct hlist_head hpte_hash_pte_long[HPTEG_HASH_NUM_PTE_LONG];
100 struct hlist_head hpte_hash_vpte[HPTEG_HASH_NUM_VPTE]; 102 struct hlist_head hpte_hash_vpte[HPTEG_HASH_NUM_VPTE];
101 struct hlist_head hpte_hash_vpte_long[HPTEG_HASH_NUM_VPTE_LONG]; 103 struct hlist_head hpte_hash_vpte_long[HPTEG_HASH_NUM_VPTE_LONG];
104#ifdef CONFIG_PPC_BOOK3S_64
105 struct hlist_head hpte_hash_vpte_64k[HPTEG_HASH_NUM_VPTE_64K];
106#endif
102 int hpte_cache_count; 107 int hpte_cache_count;
103 spinlock_t mmu_lock; 108 spinlock_t mmu_lock;
104}; 109};
@@ -107,8 +112,9 @@ struct kvmppc_vcpu_book3s {
107#define CONTEXT_GUEST 1 112#define CONTEXT_GUEST 1
108#define CONTEXT_GUEST_END 2 113#define CONTEXT_GUEST_END 2
109 114
110#define VSID_REAL 0x0fffffffffc00000ULL 115#define VSID_REAL 0x07ffffffffc00000ULL
111#define VSID_BAT 0x0fffffffffb00000ULL 116#define VSID_BAT 0x07ffffffffb00000ULL
117#define VSID_64K 0x0800000000000000ULL
112#define VSID_1T 0x1000000000000000ULL 118#define VSID_1T 0x1000000000000000ULL
113#define VSID_REAL_DR 0x2000000000000000ULL 119#define VSID_REAL_DR 0x2000000000000000ULL
114#define VSID_REAL_IR 0x4000000000000000ULL 120#define VSID_REAL_IR 0x4000000000000000ULL
@@ -118,11 +124,12 @@ extern void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, ulong ea, ulong ea_mask)
118extern void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 vp, u64 vp_mask); 124extern void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 vp, u64 vp_mask);
119extern void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, ulong pa_start, ulong pa_end); 125extern void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, ulong pa_start, ulong pa_end);
120extern void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 new_msr); 126extern void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 new_msr);
121extern void kvmppc_set_pvr(struct kvm_vcpu *vcpu, u32 pvr);
122extern void kvmppc_mmu_book3s_64_init(struct kvm_vcpu *vcpu); 127extern void kvmppc_mmu_book3s_64_init(struct kvm_vcpu *vcpu);
123extern void kvmppc_mmu_book3s_32_init(struct kvm_vcpu *vcpu); 128extern void kvmppc_mmu_book3s_32_init(struct kvm_vcpu *vcpu);
124extern void kvmppc_mmu_book3s_hv_init(struct kvm_vcpu *vcpu); 129extern void kvmppc_mmu_book3s_hv_init(struct kvm_vcpu *vcpu);
125extern int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte); 130extern int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte,
131 bool iswrite);
132extern void kvmppc_mmu_unmap_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte);
126extern int kvmppc_mmu_map_segment(struct kvm_vcpu *vcpu, ulong eaddr); 133extern 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); 134extern void kvmppc_mmu_flush_segment(struct kvm_vcpu *vcpu, ulong eaddr, ulong seg_size);
128extern void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu); 135extern void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu);
@@ -134,6 +141,7 @@ extern long kvmppc_hv_find_lock_hpte(struct kvm *kvm, gva_t eaddr,
134 141
135extern void kvmppc_mmu_hpte_cache_map(struct kvm_vcpu *vcpu, struct hpte_cache *pte); 142extern void kvmppc_mmu_hpte_cache_map(struct kvm_vcpu *vcpu, struct hpte_cache *pte);
136extern struct hpte_cache *kvmppc_mmu_hpte_cache_next(struct kvm_vcpu *vcpu); 143extern struct hpte_cache *kvmppc_mmu_hpte_cache_next(struct kvm_vcpu *vcpu);
144extern void kvmppc_mmu_hpte_cache_free(struct hpte_cache *pte);
137extern void kvmppc_mmu_hpte_destroy(struct kvm_vcpu *vcpu); 145extern void kvmppc_mmu_hpte_destroy(struct kvm_vcpu *vcpu);
138extern int kvmppc_mmu_hpte_init(struct kvm_vcpu *vcpu); 146extern int kvmppc_mmu_hpte_init(struct kvm_vcpu *vcpu);
139extern void kvmppc_mmu_invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte); 147extern void kvmppc_mmu_invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte);
@@ -151,7 +159,8 @@ extern void kvmppc_set_bat(struct kvm_vcpu *vcpu, struct kvmppc_bat *bat,
151 bool upper, u32 val); 159 bool upper, u32 val);
152extern void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr); 160extern void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr);
153extern int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu); 161extern int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu);
154extern pfn_t kvmppc_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn); 162extern pfn_t kvmppc_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn, bool writing,
163 bool *writable);
155extern void kvmppc_add_revmap_chain(struct kvm *kvm, struct revmap_entry *rev, 164extern void kvmppc_add_revmap_chain(struct kvm *kvm, struct revmap_entry *rev,
156 unsigned long *rmap, long pte_index, int realmode); 165 unsigned long *rmap, long pte_index, int realmode);
157extern void kvmppc_invalidate_hpte(struct kvm *kvm, unsigned long *hptep, 166extern void kvmppc_invalidate_hpte(struct kvm *kvm, unsigned long *hptep,
@@ -172,6 +181,8 @@ extern long kvmppc_do_h_remove(struct kvm *kvm, unsigned long flags,
172 unsigned long *hpret); 181 unsigned long *hpret);
173extern long kvmppc_hv_get_dirty_log(struct kvm *kvm, 182extern long kvmppc_hv_get_dirty_log(struct kvm *kvm,
174 struct kvm_memory_slot *memslot, unsigned long *map); 183 struct kvm_memory_slot *memslot, unsigned long *map);
184extern void kvmppc_update_lpcr(struct kvm *kvm, unsigned long lpcr,
185 unsigned long mask);
175 186
176extern void kvmppc_entry_trampoline(void); 187extern void kvmppc_entry_trampoline(void);
177extern void kvmppc_hv_entry_trampoline(void); 188extern void kvmppc_hv_entry_trampoline(void);
@@ -184,11 +195,9 @@ extern int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd);
184 195
185static inline struct kvmppc_vcpu_book3s *to_book3s(struct kvm_vcpu *vcpu) 196static inline struct kvmppc_vcpu_book3s *to_book3s(struct kvm_vcpu *vcpu)
186{ 197{
187 return container_of(vcpu, struct kvmppc_vcpu_book3s, vcpu); 198 return vcpu->arch.book3s;
188} 199}
189 200
190extern void kvm_return_point(void);
191
192/* Also add subarch specific defines */ 201/* Also add subarch specific defines */
193 202
194#ifdef CONFIG_KVM_BOOK3S_32_HANDLER 203#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
@@ -198,203 +207,6 @@ extern void kvm_return_point(void);
198#include <asm/kvm_book3s_64.h> 207#include <asm/kvm_book3s_64.h>
199#endif 208#endif
200 209
201#ifdef CONFIG_KVM_BOOK3S_PR
202
203static inline unsigned long kvmppc_interrupt_offset(struct kvm_vcpu *vcpu)
204{
205 return to_book3s(vcpu)->hior;
206}
207
208static inline void kvmppc_update_int_pending(struct kvm_vcpu *vcpu,
209 unsigned long pending_now, unsigned long old_pending)
210{
211 if (pending_now)
212 vcpu->arch.shared->int_pending = 1;
213 else if (old_pending)
214 vcpu->arch.shared->int_pending = 0;
215}
216
217static inline void kvmppc_set_gpr(struct kvm_vcpu *vcpu, int num, ulong val)
218{
219 if ( num < 14 ) {
220 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
221 svcpu->gpr[num] = val;
222 svcpu_put(svcpu);
223 to_book3s(vcpu)->shadow_vcpu->gpr[num] = val;
224 } else
225 vcpu->arch.gpr[num] = val;
226}
227
228static inline ulong kvmppc_get_gpr(struct kvm_vcpu *vcpu, int num)
229{
230 if ( num < 14 ) {
231 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
232 ulong r = svcpu->gpr[num];
233 svcpu_put(svcpu);
234 return r;
235 } else
236 return vcpu->arch.gpr[num];
237}
238
239static inline void kvmppc_set_cr(struct kvm_vcpu *vcpu, u32 val)
240{
241 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
242 svcpu->cr = val;
243 svcpu_put(svcpu);
244 to_book3s(vcpu)->shadow_vcpu->cr = val;
245}
246
247static inline u32 kvmppc_get_cr(struct kvm_vcpu *vcpu)
248{
249 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
250 u32 r;
251 r = svcpu->cr;
252 svcpu_put(svcpu);
253 return r;
254}
255
256static inline void kvmppc_set_xer(struct kvm_vcpu *vcpu, u32 val)
257{
258 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
259 svcpu->xer = val;
260 to_book3s(vcpu)->shadow_vcpu->xer = val;
261 svcpu_put(svcpu);
262}
263
264static inline u32 kvmppc_get_xer(struct kvm_vcpu *vcpu)
265{
266 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
267 u32 r;
268 r = svcpu->xer;
269 svcpu_put(svcpu);
270 return r;
271}
272
273static inline void kvmppc_set_ctr(struct kvm_vcpu *vcpu, ulong val)
274{
275 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
276 svcpu->ctr = val;
277 svcpu_put(svcpu);
278}
279
280static inline ulong kvmppc_get_ctr(struct kvm_vcpu *vcpu)
281{
282 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
283 ulong r;
284 r = svcpu->ctr;
285 svcpu_put(svcpu);
286 return r;
287}
288
289static inline void kvmppc_set_lr(struct kvm_vcpu *vcpu, ulong val)
290{
291 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
292 svcpu->lr = val;
293 svcpu_put(svcpu);
294}
295
296static inline ulong kvmppc_get_lr(struct kvm_vcpu *vcpu)
297{
298 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
299 ulong r;
300 r = svcpu->lr;
301 svcpu_put(svcpu);
302 return r;
303}
304
305static inline void kvmppc_set_pc(struct kvm_vcpu *vcpu, ulong val)
306{
307 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
308 svcpu->pc = val;
309 svcpu_put(svcpu);
310}
311
312static inline ulong kvmppc_get_pc(struct kvm_vcpu *vcpu)
313{
314 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
315 ulong r;
316 r = svcpu->pc;
317 svcpu_put(svcpu);
318 return r;
319}
320
321static inline u32 kvmppc_get_last_inst(struct kvm_vcpu *vcpu)
322{
323 ulong pc = kvmppc_get_pc(vcpu);
324 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
325 u32 r;
326
327 /* Load the instruction manually if it failed to do so in the
328 * exit path */
329 if (svcpu->last_inst == KVM_INST_FETCH_FAILED)
330 kvmppc_ld(vcpu, &pc, sizeof(u32), &svcpu->last_inst, false);
331
332 r = svcpu->last_inst;
333 svcpu_put(svcpu);
334 return r;
335}
336
337/*
338 * Like kvmppc_get_last_inst(), but for fetching a sc instruction.
339 * Because the sc instruction sets SRR0 to point to the following
340 * instruction, we have to fetch from pc - 4.
341 */
342static inline u32 kvmppc_get_last_sc(struct kvm_vcpu *vcpu)
343{
344 ulong pc = kvmppc_get_pc(vcpu) - 4;
345 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
346 u32 r;
347
348 /* Load the instruction manually if it failed to do so in the
349 * exit path */
350 if (svcpu->last_inst == KVM_INST_FETCH_FAILED)
351 kvmppc_ld(vcpu, &pc, sizeof(u32), &svcpu->last_inst, false);
352
353 r = svcpu->last_inst;
354 svcpu_put(svcpu);
355 return r;
356}
357
358static inline ulong kvmppc_get_fault_dar(struct kvm_vcpu *vcpu)
359{
360 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
361 ulong r;
362 r = svcpu->fault_dar;
363 svcpu_put(svcpu);
364 return r;
365}
366
367static inline bool kvmppc_critical_section(struct kvm_vcpu *vcpu)
368{
369 ulong crit_raw = vcpu->arch.shared->critical;
370 ulong crit_r1 = kvmppc_get_gpr(vcpu, 1);
371 bool crit;
372
373 /* Truncate crit indicators in 32 bit mode */
374 if (!(vcpu->arch.shared->msr & MSR_SF)) {
375 crit_raw &= 0xffffffff;
376 crit_r1 &= 0xffffffff;
377 }
378
379 /* Critical section when crit == r1 */
380 crit = (crit_raw == crit_r1);
381 /* ... and we're in supervisor mode */
382 crit = crit && !(vcpu->arch.shared->msr & MSR_PR);
383
384 return crit;
385}
386#else /* CONFIG_KVM_BOOK3S_PR */
387
388static inline unsigned long kvmppc_interrupt_offset(struct kvm_vcpu *vcpu)
389{
390 return 0;
391}
392
393static inline void kvmppc_update_int_pending(struct kvm_vcpu *vcpu,
394 unsigned long pending_now, unsigned long old_pending)
395{
396}
397
398static inline void kvmppc_set_gpr(struct kvm_vcpu *vcpu, int num, ulong val) 210static inline void kvmppc_set_gpr(struct kvm_vcpu *vcpu, int num, ulong val)
399{ 211{
400 vcpu->arch.gpr[num] = val; 212 vcpu->arch.gpr[num] = val;
@@ -489,12 +301,6 @@ static inline ulong kvmppc_get_fault_dar(struct kvm_vcpu *vcpu)
489 return vcpu->arch.fault_dar; 301 return vcpu->arch.fault_dar;
490} 302}
491 303
492static inline bool kvmppc_critical_section(struct kvm_vcpu *vcpu)
493{
494 return false;
495}
496#endif
497
498/* Magic register values loaded into r3 and r4 before the 'sc' assembly 304/* Magic register values loaded into r3 and r4 before the 'sc' assembly
499 * instruction for the OSI hypercalls */ 305 * instruction for the OSI hypercalls */
500#define OSI_SC_MAGIC_R3 0x113724FA 306#define OSI_SC_MAGIC_R3 0x113724FA
diff --git a/arch/powerpc/include/asm/kvm_book3s_32.h b/arch/powerpc/include/asm/kvm_book3s_32.h
index ce0ef6ce8f86..c720e0b3238d 100644
--- a/arch/powerpc/include/asm/kvm_book3s_32.h
+++ b/arch/powerpc/include/asm/kvm_book3s_32.h
@@ -22,7 +22,7 @@
22 22
23static inline struct kvmppc_book3s_shadow_vcpu *svcpu_get(struct kvm_vcpu *vcpu) 23static inline struct kvmppc_book3s_shadow_vcpu *svcpu_get(struct kvm_vcpu *vcpu)
24{ 24{
25 return to_book3s(vcpu)->shadow_vcpu; 25 return vcpu->arch.shadow_vcpu;
26} 26}
27 27
28static inline void svcpu_put(struct kvmppc_book3s_shadow_vcpu *svcpu) 28static inline void svcpu_put(struct kvmppc_book3s_shadow_vcpu *svcpu)
diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h
index 86d638a3b359..bf0fa8b0a883 100644
--- a/arch/powerpc/include/asm/kvm_book3s_64.h
+++ b/arch/powerpc/include/asm/kvm_book3s_64.h
@@ -20,7 +20,7 @@
20#ifndef __ASM_KVM_BOOK3S_64_H__ 20#ifndef __ASM_KVM_BOOK3S_64_H__
21#define __ASM_KVM_BOOK3S_64_H__ 21#define __ASM_KVM_BOOK3S_64_H__
22 22
23#ifdef CONFIG_KVM_BOOK3S_PR 23#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
24static inline struct kvmppc_book3s_shadow_vcpu *svcpu_get(struct kvm_vcpu *vcpu) 24static inline struct kvmppc_book3s_shadow_vcpu *svcpu_get(struct kvm_vcpu *vcpu)
25{ 25{
26 preempt_disable(); 26 preempt_disable();
@@ -35,7 +35,7 @@ static inline void svcpu_put(struct kvmppc_book3s_shadow_vcpu *svcpu)
35 35
36#define SPAPR_TCE_SHIFT 12 36#define SPAPR_TCE_SHIFT 12
37 37
38#ifdef CONFIG_KVM_BOOK3S_64_HV 38#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
39#define KVM_DEFAULT_HPT_ORDER 24 /* 16MB HPT by default */ 39#define KVM_DEFAULT_HPT_ORDER 24 /* 16MB HPT by default */
40extern unsigned long kvm_rma_pages; 40extern unsigned long kvm_rma_pages;
41#endif 41#endif
@@ -278,7 +278,7 @@ static inline int is_vrma_hpte(unsigned long hpte_v)
278 (HPTE_V_1TB_SEG | (VRMA_VSID << (40 - 16))); 278 (HPTE_V_1TB_SEG | (VRMA_VSID << (40 - 16)));
279} 279}
280 280
281#ifdef CONFIG_KVM_BOOK3S_64_HV 281#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
282/* 282/*
283 * Note modification of an HPTE; set the HPTE modified bit 283 * Note modification of an HPTE; set the HPTE modified bit
284 * if anyone is interested. 284 * if anyone is interested.
@@ -289,6 +289,6 @@ static inline void note_hpte_modification(struct kvm *kvm,
289 if (atomic_read(&kvm->arch.hpte_mod_interest)) 289 if (atomic_read(&kvm->arch.hpte_mod_interest))
290 rev->guest_rpte |= HPTE_GR_MODIFIED; 290 rev->guest_rpte |= HPTE_GR_MODIFIED;
291} 291}
292#endif /* CONFIG_KVM_BOOK3S_64_HV */ 292#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */
293 293
294#endif /* __ASM_KVM_BOOK3S_64_H__ */ 294#endif /* __ASM_KVM_BOOK3S_64_H__ */
diff --git a/arch/powerpc/include/asm/kvm_book3s_asm.h b/arch/powerpc/include/asm/kvm_book3s_asm.h
index 9039d3c97eec..0bd9348a4db9 100644
--- a/arch/powerpc/include/asm/kvm_book3s_asm.h
+++ b/arch/powerpc/include/asm/kvm_book3s_asm.h
@@ -83,7 +83,7 @@ struct kvmppc_host_state {
83 u8 restore_hid5; 83 u8 restore_hid5;
84 u8 napping; 84 u8 napping;
85 85
86#ifdef CONFIG_KVM_BOOK3S_64_HV 86#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
87 u8 hwthread_req; 87 u8 hwthread_req;
88 u8 hwthread_state; 88 u8 hwthread_state;
89 u8 host_ipi; 89 u8 host_ipi;
@@ -101,6 +101,7 @@ struct kvmppc_host_state {
101#endif 101#endif
102#ifdef CONFIG_PPC_BOOK3S_64 102#ifdef CONFIG_PPC_BOOK3S_64
103 u64 cfar; 103 u64 cfar;
104 u64 ppr;
104#endif 105#endif
105}; 106};
106 107
@@ -108,14 +109,14 @@ struct kvmppc_book3s_shadow_vcpu {
108 ulong gpr[14]; 109 ulong gpr[14];
109 u32 cr; 110 u32 cr;
110 u32 xer; 111 u32 xer;
111
112 u32 fault_dsisr;
113 u32 last_inst;
114 ulong ctr; 112 ulong ctr;
115 ulong lr; 113 ulong lr;
116 ulong pc; 114 ulong pc;
115
117 ulong shadow_srr1; 116 ulong shadow_srr1;
118 ulong fault_dar; 117 ulong fault_dar;
118 u32 fault_dsisr;
119 u32 last_inst;
119 120
120#ifdef CONFIG_PPC_BOOK3S_32 121#ifdef CONFIG_PPC_BOOK3S_32
121 u32 sr[16]; /* Guest SRs */ 122 u32 sr[16]; /* Guest SRs */
diff --git a/arch/powerpc/include/asm/kvm_booke.h b/arch/powerpc/include/asm/kvm_booke.h
index d3c1eb34c986..dd8f61510dfd 100644
--- a/arch/powerpc/include/asm/kvm_booke.h
+++ b/arch/powerpc/include/asm/kvm_booke.h
@@ -26,7 +26,12 @@
26/* LPIDs we support with this build -- runtime limit may be lower */ 26/* LPIDs we support with this build -- runtime limit may be lower */
27#define KVMPPC_NR_LPIDS 64 27#define KVMPPC_NR_LPIDS 64
28 28
29#define KVMPPC_INST_EHPRIV 0x7c00021c 29#define KVMPPC_INST_EHPRIV 0x7c00021c
30#define EHPRIV_OC_SHIFT 11
31/* "ehpriv 1" : ehpriv with OC = 1 is used for debug emulation */
32#define EHPRIV_OC_DEBUG 1
33#define KVMPPC_INST_EHPRIV_DEBUG (KVMPPC_INST_EHPRIV | \
34 (EHPRIV_OC_DEBUG << EHPRIV_OC_SHIFT))
30 35
31static inline void kvmppc_set_gpr(struct kvm_vcpu *vcpu, int num, ulong val) 36static inline void kvmppc_set_gpr(struct kvm_vcpu *vcpu, int num, ulong val)
32{ 37{
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 33283532e9d8..237d1d25b448 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -63,20 +63,17 @@ extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
63 63
64#endif 64#endif
65 65
66/* We don't currently support large pages. */
67#define KVM_HPAGE_GFN_SHIFT(x) 0
68#define KVM_NR_PAGE_SIZES 1
69#define KVM_PAGES_PER_HPAGE(x) (1UL<<31)
70
71#define HPTEG_CACHE_NUM (1 << 15) 66#define HPTEG_CACHE_NUM (1 << 15)
72#define HPTEG_HASH_BITS_PTE 13 67#define HPTEG_HASH_BITS_PTE 13
73#define HPTEG_HASH_BITS_PTE_LONG 12 68#define HPTEG_HASH_BITS_PTE_LONG 12
74#define HPTEG_HASH_BITS_VPTE 13 69#define HPTEG_HASH_BITS_VPTE 13
75#define HPTEG_HASH_BITS_VPTE_LONG 5 70#define HPTEG_HASH_BITS_VPTE_LONG 5
71#define HPTEG_HASH_BITS_VPTE_64K 11
76#define HPTEG_HASH_NUM_PTE (1 << HPTEG_HASH_BITS_PTE) 72#define HPTEG_HASH_NUM_PTE (1 << HPTEG_HASH_BITS_PTE)
77#define HPTEG_HASH_NUM_PTE_LONG (1 << HPTEG_HASH_BITS_PTE_LONG) 73#define HPTEG_HASH_NUM_PTE_LONG (1 << HPTEG_HASH_BITS_PTE_LONG)
78#define HPTEG_HASH_NUM_VPTE (1 << HPTEG_HASH_BITS_VPTE) 74#define HPTEG_HASH_NUM_VPTE (1 << HPTEG_HASH_BITS_VPTE)
79#define HPTEG_HASH_NUM_VPTE_LONG (1 << HPTEG_HASH_BITS_VPTE_LONG) 75#define HPTEG_HASH_NUM_VPTE_LONG (1 << HPTEG_HASH_BITS_VPTE_LONG)
76#define HPTEG_HASH_NUM_VPTE_64K (1 << HPTEG_HASH_BITS_VPTE_64K)
80 77
81/* Physical Address Mask - allowed range of real mode RAM access */ 78/* Physical Address Mask - allowed range of real mode RAM access */
82#define KVM_PAM 0x0fffffffffffffffULL 79#define KVM_PAM 0x0fffffffffffffffULL
@@ -89,6 +86,9 @@ struct lppaca;
89struct slb_shadow; 86struct slb_shadow;
90struct dtl_entry; 87struct dtl_entry;
91 88
89struct kvmppc_vcpu_book3s;
90struct kvmppc_book3s_shadow_vcpu;
91
92struct kvm_vm_stat { 92struct kvm_vm_stat {
93 u32 remote_tlb_flush; 93 u32 remote_tlb_flush;
94}; 94};
@@ -224,15 +224,15 @@ struct revmap_entry {
224#define KVMPPC_GOT_PAGE 0x80 224#define KVMPPC_GOT_PAGE 0x80
225 225
226struct kvm_arch_memory_slot { 226struct kvm_arch_memory_slot {
227#ifdef CONFIG_KVM_BOOK3S_64_HV 227#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
228 unsigned long *rmap; 228 unsigned long *rmap;
229 unsigned long *slot_phys; 229 unsigned long *slot_phys;
230#endif /* CONFIG_KVM_BOOK3S_64_HV */ 230#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */
231}; 231};
232 232
233struct kvm_arch { 233struct kvm_arch {
234 unsigned int lpid; 234 unsigned int lpid;
235#ifdef CONFIG_KVM_BOOK3S_64_HV 235#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
236 unsigned long hpt_virt; 236 unsigned long hpt_virt;
237 struct revmap_entry *revmap; 237 struct revmap_entry *revmap;
238 unsigned int host_lpid; 238 unsigned int host_lpid;
@@ -256,7 +256,10 @@ struct kvm_arch {
256 cpumask_t need_tlb_flush; 256 cpumask_t need_tlb_flush;
257 struct kvmppc_vcore *vcores[KVM_MAX_VCORES]; 257 struct kvmppc_vcore *vcores[KVM_MAX_VCORES];
258 int hpt_cma_alloc; 258 int hpt_cma_alloc;
259#endif /* CONFIG_KVM_BOOK3S_64_HV */ 259#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */
260#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
261 struct mutex hpt_mutex;
262#endif
260#ifdef CONFIG_PPC_BOOK3S_64 263#ifdef CONFIG_PPC_BOOK3S_64
261 struct list_head spapr_tce_tables; 264 struct list_head spapr_tce_tables;
262 struct list_head rtas_tokens; 265 struct list_head rtas_tokens;
@@ -267,6 +270,7 @@ struct kvm_arch {
267#ifdef CONFIG_KVM_XICS 270#ifdef CONFIG_KVM_XICS
268 struct kvmppc_xics *xics; 271 struct kvmppc_xics *xics;
269#endif 272#endif
273 struct kvmppc_ops *kvm_ops;
270}; 274};
271 275
272/* 276/*
@@ -294,6 +298,10 @@ struct kvmppc_vcore {
294 u64 stolen_tb; 298 u64 stolen_tb;
295 u64 preempt_tb; 299 u64 preempt_tb;
296 struct kvm_vcpu *runner; 300 struct kvm_vcpu *runner;
301 u64 tb_offset; /* guest timebase - host timebase */
302 ulong lpcr;
303 u32 arch_compat;
304 ulong pcr;
297}; 305};
298 306
299#define VCORE_ENTRY_COUNT(vc) ((vc)->entry_exit_count & 0xff) 307#define VCORE_ENTRY_COUNT(vc) ((vc)->entry_exit_count & 0xff)
@@ -328,6 +336,7 @@ struct kvmppc_pte {
328 bool may_read : 1; 336 bool may_read : 1;
329 bool may_write : 1; 337 bool may_write : 1;
330 bool may_execute : 1; 338 bool may_execute : 1;
339 u8 page_size; /* MMU_PAGE_xxx */
331}; 340};
332 341
333struct kvmppc_mmu { 342struct kvmppc_mmu {
@@ -340,7 +349,8 @@ struct kvmppc_mmu {
340 /* book3s */ 349 /* book3s */
341 void (*mtsrin)(struct kvm_vcpu *vcpu, u32 srnum, ulong value); 350 void (*mtsrin)(struct kvm_vcpu *vcpu, u32 srnum, ulong value);
342 u32 (*mfsrin)(struct kvm_vcpu *vcpu, u32 srnum); 351 u32 (*mfsrin)(struct kvm_vcpu *vcpu, u32 srnum);
343 int (*xlate)(struct kvm_vcpu *vcpu, gva_t eaddr, struct kvmppc_pte *pte, bool data); 352 int (*xlate)(struct kvm_vcpu *vcpu, gva_t eaddr,
353 struct kvmppc_pte *pte, bool data, bool iswrite);
344 void (*reset_msr)(struct kvm_vcpu *vcpu); 354 void (*reset_msr)(struct kvm_vcpu *vcpu);
345 void (*tlbie)(struct kvm_vcpu *vcpu, ulong addr, bool large); 355 void (*tlbie)(struct kvm_vcpu *vcpu, ulong addr, bool large);
346 int (*esid_to_vsid)(struct kvm_vcpu *vcpu, ulong esid, u64 *vsid); 356 int (*esid_to_vsid)(struct kvm_vcpu *vcpu, ulong esid, u64 *vsid);
@@ -360,6 +370,7 @@ struct kvmppc_slb {
360 bool large : 1; /* PTEs are 16MB */ 370 bool large : 1; /* PTEs are 16MB */
361 bool tb : 1; /* 1TB segment */ 371 bool tb : 1; /* 1TB segment */
362 bool class : 1; 372 bool class : 1;
373 u8 base_page_size; /* MMU_PAGE_xxx */
363}; 374};
364 375
365# ifdef CONFIG_PPC_FSL_BOOK3E 376# ifdef CONFIG_PPC_FSL_BOOK3E
@@ -377,17 +388,6 @@ struct kvmppc_slb {
377#define KVMPPC_EPR_USER 1 /* exit to userspace to fill EPR */ 388#define KVMPPC_EPR_USER 1 /* exit to userspace to fill EPR */
378#define KVMPPC_EPR_KERNEL 2 /* in-kernel irqchip */ 389#define KVMPPC_EPR_KERNEL 2 /* in-kernel irqchip */
379 390
380struct kvmppc_booke_debug_reg {
381 u32 dbcr0;
382 u32 dbcr1;
383 u32 dbcr2;
384#ifdef CONFIG_KVM_E500MC
385 u32 dbcr4;
386#endif
387 u64 iac[KVMPPC_BOOKE_MAX_IAC];
388 u64 dac[KVMPPC_BOOKE_MAX_DAC];
389};
390
391#define KVMPPC_IRQ_DEFAULT 0 391#define KVMPPC_IRQ_DEFAULT 0
392#define KVMPPC_IRQ_MPIC 1 392#define KVMPPC_IRQ_MPIC 1
393#define KVMPPC_IRQ_XICS 2 393#define KVMPPC_IRQ_XICS 2
@@ -402,6 +402,10 @@ struct kvm_vcpu_arch {
402 int slb_max; /* 1 + index of last valid entry in slb[] */ 402 int slb_max; /* 1 + index of last valid entry in slb[] */
403 int slb_nr; /* total number of entries in SLB */ 403 int slb_nr; /* total number of entries in SLB */
404 struct kvmppc_mmu mmu; 404 struct kvmppc_mmu mmu;
405 struct kvmppc_vcpu_book3s *book3s;
406#endif
407#ifdef CONFIG_PPC_BOOK3S_32
408 struct kvmppc_book3s_shadow_vcpu *shadow_vcpu;
405#endif 409#endif
406 410
407 ulong gpr[32]; 411 ulong gpr[32];
@@ -463,6 +467,8 @@ struct kvm_vcpu_arch {
463 u32 ctrl; 467 u32 ctrl;
464 ulong dabr; 468 ulong dabr;
465 ulong cfar; 469 ulong cfar;
470 ulong ppr;
471 ulong shadow_srr1;
466#endif 472#endif
467 u32 vrsave; /* also USPRG0 */ 473 u32 vrsave; /* also USPRG0 */
468 u32 mmucr; 474 u32 mmucr;
@@ -498,6 +504,8 @@ struct kvm_vcpu_arch {
498 504
499 u64 mmcr[3]; 505 u64 mmcr[3];
500 u32 pmc[8]; 506 u32 pmc[8];
507 u64 siar;
508 u64 sdar;
501 509
502#ifdef CONFIG_KVM_EXIT_TIMING 510#ifdef CONFIG_KVM_EXIT_TIMING
503 struct mutex exit_timing_lock; 511 struct mutex exit_timing_lock;
@@ -531,7 +539,10 @@ struct kvm_vcpu_arch {
531 u32 eptcfg; 539 u32 eptcfg;
532 u32 epr; 540 u32 epr;
533 u32 crit_save; 541 u32 crit_save;
534 struct kvmppc_booke_debug_reg dbg_reg; 542 /* guest debug registers*/
543 struct debug_reg dbg_reg;
544 /* hardware visible debug registers when in guest state */
545 struct debug_reg shadow_dbg_reg;
535#endif 546#endif
536 gpa_t paddr_accessed; 547 gpa_t paddr_accessed;
537 gva_t vaddr_accessed; 548 gva_t vaddr_accessed;
@@ -582,7 +593,7 @@ struct kvm_vcpu_arch {
582 struct kvmppc_icp *icp; /* XICS presentation controller */ 593 struct kvmppc_icp *icp; /* XICS presentation controller */
583#endif 594#endif
584 595
585#ifdef CONFIG_KVM_BOOK3S_64_HV 596#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
586 struct kvm_vcpu_arch_shared shregs; 597 struct kvm_vcpu_arch_shared shregs;
587 598
588 unsigned long pgfault_addr; 599 unsigned long pgfault_addr;
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index b15554a26c20..c8317fbf92c4 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -106,13 +106,6 @@ extern void kvmppc_core_queue_external(struct kvm_vcpu *vcpu,
106 struct kvm_interrupt *irq); 106 struct kvm_interrupt *irq);
107extern void kvmppc_core_dequeue_external(struct kvm_vcpu *vcpu); 107extern void kvmppc_core_dequeue_external(struct kvm_vcpu *vcpu);
108extern void kvmppc_core_flush_tlb(struct kvm_vcpu *vcpu); 108extern void kvmppc_core_flush_tlb(struct kvm_vcpu *vcpu);
109
110extern int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
111 unsigned int op, int *advance);
112extern int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn,
113 ulong val);
114extern int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn,
115 ulong *val);
116extern int kvmppc_core_check_requests(struct kvm_vcpu *vcpu); 109extern int kvmppc_core_check_requests(struct kvm_vcpu *vcpu);
117 110
118extern int kvmppc_booke_init(void); 111extern int kvmppc_booke_init(void);
@@ -135,17 +128,17 @@ extern long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
135 struct kvm_create_spapr_tce *args); 128 struct kvm_create_spapr_tce *args);
136extern long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn, 129extern long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn,
137 unsigned long ioba, unsigned long tce); 130 unsigned long ioba, unsigned long tce);
138extern long kvm_vm_ioctl_allocate_rma(struct kvm *kvm,
139 struct kvm_allocate_rma *rma);
140extern struct kvm_rma_info *kvm_alloc_rma(void); 131extern struct kvm_rma_info *kvm_alloc_rma(void);
141extern void kvm_release_rma(struct kvm_rma_info *ri); 132extern void kvm_release_rma(struct kvm_rma_info *ri);
142extern struct page *kvm_alloc_hpt(unsigned long nr_pages); 133extern struct page *kvm_alloc_hpt(unsigned long nr_pages);
143extern void kvm_release_hpt(struct page *page, unsigned long nr_pages); 134extern void kvm_release_hpt(struct page *page, unsigned long nr_pages);
144extern int kvmppc_core_init_vm(struct kvm *kvm); 135extern int kvmppc_core_init_vm(struct kvm *kvm);
145extern void kvmppc_core_destroy_vm(struct kvm *kvm); 136extern void kvmppc_core_destroy_vm(struct kvm *kvm);
146extern void kvmppc_core_free_memslot(struct kvm_memory_slot *free, 137extern void kvmppc_core_free_memslot(struct kvm *kvm,
138 struct kvm_memory_slot *free,
147 struct kvm_memory_slot *dont); 139 struct kvm_memory_slot *dont);
148extern int kvmppc_core_create_memslot(struct kvm_memory_slot *slot, 140extern int kvmppc_core_create_memslot(struct kvm *kvm,
141 struct kvm_memory_slot *slot,
149 unsigned long npages); 142 unsigned long npages);
150extern int kvmppc_core_prepare_memory_region(struct kvm *kvm, 143extern int kvmppc_core_prepare_memory_region(struct kvm *kvm,
151 struct kvm_memory_slot *memslot, 144 struct kvm_memory_slot *memslot,
@@ -177,6 +170,72 @@ extern int kvmppc_xics_get_xive(struct kvm *kvm, u32 irq, u32 *server,
177extern int kvmppc_xics_int_on(struct kvm *kvm, u32 irq); 170extern int kvmppc_xics_int_on(struct kvm *kvm, u32 irq);
178extern int kvmppc_xics_int_off(struct kvm *kvm, u32 irq); 171extern int kvmppc_xics_int_off(struct kvm *kvm, u32 irq);
179 172
173union kvmppc_one_reg {
174 u32 wval;
175 u64 dval;
176 vector128 vval;
177 u64 vsxval[2];
178 struct {
179 u64 addr;
180 u64 length;
181 } vpaval;
182};
183
184struct kvmppc_ops {
185 struct module *owner;
186 int (*get_sregs)(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs);
187 int (*set_sregs)(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs);
188 int (*get_one_reg)(struct kvm_vcpu *vcpu, u64 id,
189 union kvmppc_one_reg *val);
190 int (*set_one_reg)(struct kvm_vcpu *vcpu, u64 id,
191 union kvmppc_one_reg *val);
192 void (*vcpu_load)(struct kvm_vcpu *vcpu, int cpu);
193 void (*vcpu_put)(struct kvm_vcpu *vcpu);
194 void (*set_msr)(struct kvm_vcpu *vcpu, u64 msr);
195 int (*vcpu_run)(struct kvm_run *run, struct kvm_vcpu *vcpu);
196 struct kvm_vcpu *(*vcpu_create)(struct kvm *kvm, unsigned int id);
197 void (*vcpu_free)(struct kvm_vcpu *vcpu);
198 int (*check_requests)(struct kvm_vcpu *vcpu);
199 int (*get_dirty_log)(struct kvm *kvm, struct kvm_dirty_log *log);
200 void (*flush_memslot)(struct kvm *kvm, struct kvm_memory_slot *memslot);
201 int (*prepare_memory_region)(struct kvm *kvm,
202 struct kvm_memory_slot *memslot,
203 struct kvm_userspace_memory_region *mem);
204 void (*commit_memory_region)(struct kvm *kvm,
205 struct kvm_userspace_memory_region *mem,
206 const struct kvm_memory_slot *old);
207 int (*unmap_hva)(struct kvm *kvm, unsigned long hva);
208 int (*unmap_hva_range)(struct kvm *kvm, unsigned long start,
209 unsigned long end);
210 int (*age_hva)(struct kvm *kvm, unsigned long hva);
211 int (*test_age_hva)(struct kvm *kvm, unsigned long hva);
212 void (*set_spte_hva)(struct kvm *kvm, unsigned long hva, pte_t pte);
213 void (*mmu_destroy)(struct kvm_vcpu *vcpu);
214 void (*free_memslot)(struct kvm_memory_slot *free,
215 struct kvm_memory_slot *dont);
216 int (*create_memslot)(struct kvm_memory_slot *slot,
217 unsigned long npages);
218 int (*init_vm)(struct kvm *kvm);
219 void (*destroy_vm)(struct kvm *kvm);
220 int (*get_smmu_info)(struct kvm *kvm, struct kvm_ppc_smmu_info *info);
221 int (*emulate_op)(struct kvm_run *run, struct kvm_vcpu *vcpu,
222 unsigned int inst, int *advance);
223 int (*emulate_mtspr)(struct kvm_vcpu *vcpu, int sprn, ulong spr_val);
224 int (*emulate_mfspr)(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val);
225 void (*fast_vcpu_kick)(struct kvm_vcpu *vcpu);
226 long (*arch_vm_ioctl)(struct file *filp, unsigned int ioctl,
227 unsigned long arg);
228
229};
230
231extern struct kvmppc_ops *kvmppc_hv_ops;
232extern struct kvmppc_ops *kvmppc_pr_ops;
233
234static inline bool is_kvmppc_hv_enabled(struct kvm *kvm)
235{
236 return kvm->arch.kvm_ops == kvmppc_hv_ops;
237}
238
180/* 239/*
181 * Cuts out inst bits with ordering according to spec. 240 * Cuts out inst bits with ordering according to spec.
182 * That means the leftmost bit is zero. All given bits are included. 241 * That means the leftmost bit is zero. All given bits are included.
@@ -210,17 +269,6 @@ static inline u32 kvmppc_set_field(u64 inst, int msb, int lsb, int value)
210 return r; 269 return r;
211} 270}
212 271
213union kvmppc_one_reg {
214 u32 wval;
215 u64 dval;
216 vector128 vval;
217 u64 vsxval[2];
218 struct {
219 u64 addr;
220 u64 length;
221 } vpaval;
222};
223
224#define one_reg_size(id) \ 272#define one_reg_size(id) \
225 (1ul << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) 273 (1ul << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
226 274
@@ -245,10 +293,10 @@ union kvmppc_one_reg {
245 __v; \ 293 __v; \
246}) 294})
247 295
248void kvmppc_core_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs); 296int kvmppc_core_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs);
249int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs); 297int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs);
250 298
251void kvmppc_get_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs); 299int kvmppc_get_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs);
252int kvmppc_set_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs); 300int kvmppc_set_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs);
253 301
254int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg); 302int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg);
@@ -260,7 +308,7 @@ void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 pid);
260 308
261struct openpic; 309struct openpic;
262 310
263#ifdef CONFIG_KVM_BOOK3S_64_HV 311#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
264extern void kvm_cma_reserve(void) __init; 312extern void kvm_cma_reserve(void) __init;
265static inline void kvmppc_set_xics_phys(int cpu, unsigned long addr) 313static inline void kvmppc_set_xics_phys(int cpu, unsigned long addr)
266{ 314{
@@ -269,10 +317,10 @@ static inline void kvmppc_set_xics_phys(int cpu, unsigned long addr)
269 317
270static inline u32 kvmppc_get_xics_latch(void) 318static inline u32 kvmppc_get_xics_latch(void)
271{ 319{
272 u32 xirr = get_paca()->kvm_hstate.saved_xirr; 320 u32 xirr;
273 321
322 xirr = get_paca()->kvm_hstate.saved_xirr;
274 get_paca()->kvm_hstate.saved_xirr = 0; 323 get_paca()->kvm_hstate.saved_xirr = 0;
275
276 return xirr; 324 return xirr;
277} 325}
278 326
@@ -281,7 +329,10 @@ static inline void kvmppc_set_host_ipi(int cpu, u8 host_ipi)
281 paca[cpu].kvm_hstate.host_ipi = host_ipi; 329 paca[cpu].kvm_hstate.host_ipi = host_ipi;
282} 330}
283 331
284extern void kvmppc_fast_vcpu_kick(struct kvm_vcpu *vcpu); 332static inline void kvmppc_fast_vcpu_kick(struct kvm_vcpu *vcpu)
333{
334 vcpu->kvm->arch.kvm_ops->fast_vcpu_kick(vcpu);
335}
285 336
286#else 337#else
287static inline void __init kvm_cma_reserve(void) 338static inline void __init kvm_cma_reserve(void)
diff --git a/arch/powerpc/include/asm/lppaca.h b/arch/powerpc/include/asm/lppaca.h
index 4470d1e34d23..844c28de7ec0 100644
--- a/arch/powerpc/include/asm/lppaca.h
+++ b/arch/powerpc/include/asm/lppaca.h
@@ -84,8 +84,8 @@ struct lppaca {
84 * the processor is yielded (either because of an OS yield or a 84 * the processor is yielded (either because of an OS yield or a
85 * hypervisor preempt). An even value implies that the processor is 85 * hypervisor preempt). An even value implies that the processor is
86 * currently executing. 86 * currently executing.
87 * NOTE: This value will ALWAYS be zero for dedicated processors and 87 * NOTE: Even dedicated processor partitions can yield so this
88 * will NEVER be zero for shared processors (ie, initialized to a 1). 88 * field cannot be used to determine if we are shared or dedicated.
89 */ 89 */
90 volatile __be32 yield_count; 90 volatile __be32 yield_count;
91 volatile __be32 dispersion_count; /* dispatch changed physical cpu */ 91 volatile __be32 dispersion_count; /* dispatch changed physical cpu */
@@ -106,15 +106,15 @@ extern struct lppaca lppaca[];
106#define lppaca_of(cpu) (*paca[cpu].lppaca_ptr) 106#define lppaca_of(cpu) (*paca[cpu].lppaca_ptr)
107 107
108/* 108/*
109 * Old kernels used a reserved bit in the VPA to determine if it was running 109 * We are using a non architected field to determine if a partition is
110 * in shared processor mode. New kernels look for a non zero yield count 110 * shared or dedicated. This currently works on both KVM and PHYP, but
111 * but KVM still needs to set the bit to keep the old stuff happy. 111 * we will have to transition to something better.
112 */ 112 */
113#define LPPACA_OLD_SHARED_PROC 2 113#define LPPACA_OLD_SHARED_PROC 2
114 114
115static inline bool lppaca_shared_proc(struct lppaca *l) 115static inline bool lppaca_shared_proc(struct lppaca *l)
116{ 116{
117 return l->yield_count != 0; 117 return !!(l->__old_status & LPPACA_OLD_SHARED_PROC);
118} 118}
119 119
120/* 120/*
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 8b480901165a..ad3025d0880b 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -78,6 +78,18 @@ struct machdep_calls {
78 long index); 78 long index);
79 void (*tce_flush)(struct iommu_table *tbl); 79 void (*tce_flush)(struct iommu_table *tbl);
80 80
81 /* _rm versions are for real mode use only */
82 int (*tce_build_rm)(struct iommu_table *tbl,
83 long index,
84 long npages,
85 unsigned long uaddr,
86 enum dma_data_direction direction,
87 struct dma_attrs *attrs);
88 void (*tce_free_rm)(struct iommu_table *tbl,
89 long index,
90 long npages);
91 void (*tce_flush_rm)(struct iommu_table *tbl);
92
81 void __iomem * (*ioremap)(phys_addr_t addr, unsigned long size, 93 void __iomem * (*ioremap)(phys_addr_t addr, unsigned long size,
82 unsigned long flags, void *caller); 94 unsigned long flags, void *caller);
83 void (*iounmap)(volatile void __iomem *token); 95 void (*iounmap)(volatile void __iomem *token);
@@ -263,6 +275,10 @@ struct machdep_calls {
263 ssize_t (*cpu_probe)(const char *, size_t); 275 ssize_t (*cpu_probe)(const char *, size_t);
264 ssize_t (*cpu_release)(const char *, size_t); 276 ssize_t (*cpu_release)(const char *, size_t);
265#endif 277#endif
278
279#ifdef CONFIG_ARCH_RANDOM
280 int (*get_random_long)(unsigned long *v);
281#endif
266}; 282};
267 283
268extern void e500_idle(void); 284extern void e500_idle(void);
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
index c4cf01197273..807014dde821 100644
--- a/arch/powerpc/include/asm/mmu-hash64.h
+++ b/arch/powerpc/include/asm/mmu-hash64.h
@@ -135,8 +135,8 @@ extern char initial_stab[];
135#ifndef __ASSEMBLY__ 135#ifndef __ASSEMBLY__
136 136
137struct hash_pte { 137struct hash_pte {
138 unsigned long v; 138 __be64 v;
139 unsigned long r; 139 __be64 r;
140}; 140};
141 141
142extern struct hash_pte *htab_address; 142extern struct hash_pte *htab_address;
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index c5cd72833d6e..033c06be1d84 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -129,6 +129,9 @@ extern int opal_enter_rtas(struct rtas_args *args,
129#define OPAL_LPC_READ 67 129#define OPAL_LPC_READ 67
130#define OPAL_LPC_WRITE 68 130#define OPAL_LPC_WRITE 68
131#define OPAL_RETURN_CPU 69 131#define OPAL_RETURN_CPU 69
132#define OPAL_FLASH_VALIDATE 76
133#define OPAL_FLASH_MANAGE 77
134#define OPAL_FLASH_UPDATE 78
132 135
133#ifndef __ASSEMBLY__ 136#ifndef __ASSEMBLY__
134 137
@@ -460,10 +463,12 @@ enum {
460 463
461enum { 464enum {
462 OPAL_PHB_ERROR_DATA_TYPE_P7IOC = 1, 465 OPAL_PHB_ERROR_DATA_TYPE_P7IOC = 1,
466 OPAL_PHB_ERROR_DATA_TYPE_PHB3 = 2
463}; 467};
464 468
465enum { 469enum {
466 OPAL_P7IOC_NUM_PEST_REGS = 128, 470 OPAL_P7IOC_NUM_PEST_REGS = 128,
471 OPAL_PHB3_NUM_PEST_REGS = 256
467}; 472};
468 473
469struct OpalIoPhbErrorCommon { 474struct OpalIoPhbErrorCommon {
@@ -531,28 +536,94 @@ struct OpalIoP7IOCPhbErrorData {
531 uint64_t pestB[OPAL_P7IOC_NUM_PEST_REGS]; 536 uint64_t pestB[OPAL_P7IOC_NUM_PEST_REGS];
532}; 537};
533 538
539struct OpalIoPhb3ErrorData {
540 struct OpalIoPhbErrorCommon common;
541
542 uint32_t brdgCtl;
543
544 /* PHB3 UTL regs */
545 uint32_t portStatusReg;
546 uint32_t rootCmplxStatus;
547 uint32_t busAgentStatus;
548
549 /* PHB3 cfg regs */
550 uint32_t deviceStatus;
551 uint32_t slotStatus;
552 uint32_t linkStatus;
553 uint32_t devCmdStatus;
554 uint32_t devSecStatus;
555
556 /* cfg AER regs */
557 uint32_t rootErrorStatus;
558 uint32_t uncorrErrorStatus;
559 uint32_t corrErrorStatus;
560 uint32_t tlpHdr1;
561 uint32_t tlpHdr2;
562 uint32_t tlpHdr3;
563 uint32_t tlpHdr4;
564 uint32_t sourceId;
565
566 uint32_t rsv3;
567
568 /* Record data about the call to allocate a buffer */
569 uint64_t errorClass;
570 uint64_t correlator;
571
572 uint64_t nFir; /* 000 */
573 uint64_t nFirMask; /* 003 */
574 uint64_t nFirWOF; /* 008 */
575
576 /* PHB3 MMIO Error Regs */
577 uint64_t phbPlssr; /* 120 */
578 uint64_t phbCsr; /* 110 */
579 uint64_t lemFir; /* C00 */
580 uint64_t lemErrorMask; /* C18 */
581 uint64_t lemWOF; /* C40 */
582 uint64_t phbErrorStatus; /* C80 */
583 uint64_t phbFirstErrorStatus; /* C88 */
584 uint64_t phbErrorLog0; /* CC0 */
585 uint64_t phbErrorLog1; /* CC8 */
586 uint64_t mmioErrorStatus; /* D00 */
587 uint64_t mmioFirstErrorStatus; /* D08 */
588 uint64_t mmioErrorLog0; /* D40 */
589 uint64_t mmioErrorLog1; /* D48 */
590 uint64_t dma0ErrorStatus; /* D80 */
591 uint64_t dma0FirstErrorStatus; /* D88 */
592 uint64_t dma0ErrorLog0; /* DC0 */
593 uint64_t dma0ErrorLog1; /* DC8 */
594 uint64_t dma1ErrorStatus; /* E00 */
595 uint64_t dma1FirstErrorStatus; /* E08 */
596 uint64_t dma1ErrorLog0; /* E40 */
597 uint64_t dma1ErrorLog1; /* E48 */
598 uint64_t pestA[OPAL_PHB3_NUM_PEST_REGS];
599 uint64_t pestB[OPAL_PHB3_NUM_PEST_REGS];
600};
601
534typedef struct oppanel_line { 602typedef struct oppanel_line {
535 const char * line; 603 const char * line;
536 uint64_t line_len; 604 uint64_t line_len;
537} oppanel_line_t; 605} oppanel_line_t;
538 606
607/* /sys/firmware/opal */
608extern struct kobject *opal_kobj;
609
539/* API functions */ 610/* API functions */
540int64_t opal_console_write(int64_t term_number, int64_t *length, 611int64_t opal_console_write(int64_t term_number, __be64 *length,
541 const uint8_t *buffer); 612 const uint8_t *buffer);
542int64_t opal_console_read(int64_t term_number, int64_t *length, 613int64_t opal_console_read(int64_t term_number, __be64 *length,
543 uint8_t *buffer); 614 uint8_t *buffer);
544int64_t opal_console_write_buffer_space(int64_t term_number, 615int64_t opal_console_write_buffer_space(int64_t term_number,
545 int64_t *length); 616 __be64 *length);
546int64_t opal_rtc_read(uint32_t *year_month_day, 617int64_t opal_rtc_read(__be32 *year_month_day,
547 uint64_t *hour_minute_second_millisecond); 618 __be64 *hour_minute_second_millisecond);
548int64_t opal_rtc_write(uint32_t year_month_day, 619int64_t opal_rtc_write(uint32_t year_month_day,
549 uint64_t hour_minute_second_millisecond); 620 uint64_t hour_minute_second_millisecond);
550int64_t opal_cec_power_down(uint64_t request); 621int64_t opal_cec_power_down(uint64_t request);
551int64_t opal_cec_reboot(void); 622int64_t opal_cec_reboot(void);
552int64_t opal_read_nvram(uint64_t buffer, uint64_t size, uint64_t offset); 623int64_t opal_read_nvram(uint64_t buffer, uint64_t size, uint64_t offset);
553int64_t opal_write_nvram(uint64_t buffer, uint64_t size, uint64_t offset); 624int64_t opal_write_nvram(uint64_t buffer, uint64_t size, uint64_t offset);
554int64_t opal_handle_interrupt(uint64_t isn, uint64_t *outstanding_event_mask); 625int64_t opal_handle_interrupt(uint64_t isn, __be64 *outstanding_event_mask);
555int64_t opal_poll_events(uint64_t *outstanding_event_mask); 626int64_t opal_poll_events(__be64 *outstanding_event_mask);
556int64_t opal_pci_set_hub_tce_memory(uint64_t hub_id, uint64_t tce_mem_addr, 627int64_t opal_pci_set_hub_tce_memory(uint64_t hub_id, uint64_t tce_mem_addr,
557 uint64_t tce_mem_size); 628 uint64_t tce_mem_size);
558int64_t opal_pci_set_phb_tce_memory(uint64_t phb_id, uint64_t tce_mem_addr, 629int64_t opal_pci_set_phb_tce_memory(uint64_t phb_id, uint64_t tce_mem_addr,
@@ -560,9 +631,9 @@ int64_t opal_pci_set_phb_tce_memory(uint64_t phb_id, uint64_t tce_mem_addr,
560int64_t opal_pci_config_read_byte(uint64_t phb_id, uint64_t bus_dev_func, 631int64_t opal_pci_config_read_byte(uint64_t phb_id, uint64_t bus_dev_func,
561 uint64_t offset, uint8_t *data); 632 uint64_t offset, uint8_t *data);
562int64_t opal_pci_config_read_half_word(uint64_t phb_id, uint64_t bus_dev_func, 633int64_t opal_pci_config_read_half_word(uint64_t phb_id, uint64_t bus_dev_func,
563 uint64_t offset, uint16_t *data); 634 uint64_t offset, __be16 *data);
564int64_t opal_pci_config_read_word(uint64_t phb_id, uint64_t bus_dev_func, 635int64_t opal_pci_config_read_word(uint64_t phb_id, uint64_t bus_dev_func,
565 uint64_t offset, uint32_t *data); 636 uint64_t offset, __be32 *data);
566int64_t opal_pci_config_write_byte(uint64_t phb_id, uint64_t bus_dev_func, 637int64_t opal_pci_config_write_byte(uint64_t phb_id, uint64_t bus_dev_func,
567 uint64_t offset, uint8_t data); 638 uint64_t offset, uint8_t data);
568int64_t opal_pci_config_write_half_word(uint64_t phb_id, uint64_t bus_dev_func, 639int64_t opal_pci_config_write_half_word(uint64_t phb_id, uint64_t bus_dev_func,
@@ -570,14 +641,14 @@ int64_t opal_pci_config_write_half_word(uint64_t phb_id, uint64_t bus_dev_func,
570int64_t opal_pci_config_write_word(uint64_t phb_id, uint64_t bus_dev_func, 641int64_t opal_pci_config_write_word(uint64_t phb_id, uint64_t bus_dev_func,
571 uint64_t offset, uint32_t data); 642 uint64_t offset, uint32_t data);
572int64_t opal_set_xive(uint32_t isn, uint16_t server, uint8_t priority); 643int64_t opal_set_xive(uint32_t isn, uint16_t server, uint8_t priority);
573int64_t opal_get_xive(uint32_t isn, uint16_t *server, uint8_t *priority); 644int64_t opal_get_xive(uint32_t isn, __be16 *server, uint8_t *priority);
574int64_t opal_register_exception_handler(uint64_t opal_exception, 645int64_t opal_register_exception_handler(uint64_t opal_exception,
575 uint64_t handler_address, 646 uint64_t handler_address,
576 uint64_t glue_cache_line); 647 uint64_t glue_cache_line);
577int64_t opal_pci_eeh_freeze_status(uint64_t phb_id, uint64_t pe_number, 648int64_t opal_pci_eeh_freeze_status(uint64_t phb_id, uint64_t pe_number,
578 uint8_t *freeze_state, 649 uint8_t *freeze_state,
579 uint16_t *pci_error_type, 650 __be16 *pci_error_type,
580 uint64_t *phb_status); 651 __be64 *phb_status);
581int64_t opal_pci_eeh_freeze_clear(uint64_t phb_id, uint64_t pe_number, 652int64_t opal_pci_eeh_freeze_clear(uint64_t phb_id, uint64_t pe_number,
582 uint64_t eeh_action_token); 653 uint64_t eeh_action_token);
583int64_t opal_pci_shpc(uint64_t phb_id, uint64_t shpc_action, uint8_t *state); 654int64_t opal_pci_shpc(uint64_t phb_id, uint64_t shpc_action, uint8_t *state);
@@ -614,13 +685,13 @@ int64_t opal_pci_msi_eoi(uint64_t phb_id, uint32_t hw_irq);
614int64_t opal_pci_set_xive_pe(uint64_t phb_id, uint32_t pe_number, 685int64_t opal_pci_set_xive_pe(uint64_t phb_id, uint32_t pe_number,
615 uint32_t xive_num); 686 uint32_t xive_num);
616int64_t opal_get_xive_source(uint64_t phb_id, uint32_t xive_num, 687int64_t opal_get_xive_source(uint64_t phb_id, uint32_t xive_num,
617 int32_t *interrupt_source_number); 688 __be32 *interrupt_source_number);
618int64_t opal_get_msi_32(uint64_t phb_id, uint32_t mve_number, uint32_t xive_num, 689int64_t opal_get_msi_32(uint64_t phb_id, uint32_t mve_number, uint32_t xive_num,
619 uint8_t msi_range, uint32_t *msi_address, 690 uint8_t msi_range, __be32 *msi_address,
620 uint32_t *message_data); 691 __be32 *message_data);
621int64_t opal_get_msi_64(uint64_t phb_id, uint32_t mve_number, 692int64_t opal_get_msi_64(uint64_t phb_id, uint32_t mve_number,
622 uint32_t xive_num, uint8_t msi_range, 693 uint32_t xive_num, uint8_t msi_range,
623 uint64_t *msi_address, uint32_t *message_data); 694 __be64 *msi_address, __be32 *message_data);
624int64_t opal_start_cpu(uint64_t thread_number, uint64_t start_address); 695int64_t opal_start_cpu(uint64_t thread_number, uint64_t start_address);
625int64_t opal_query_cpu_status(uint64_t thread_number, uint8_t *thread_status); 696int64_t opal_query_cpu_status(uint64_t thread_number, uint8_t *thread_status);
626int64_t opal_write_oppanel(oppanel_line_t *lines, uint64_t num_lines); 697int64_t opal_write_oppanel(oppanel_line_t *lines, uint64_t num_lines);
@@ -642,7 +713,7 @@ int64_t opal_pci_fence_phb(uint64_t phb_id);
642int64_t opal_pci_reinit(uint64_t phb_id, uint8_t reinit_scope); 713int64_t opal_pci_reinit(uint64_t phb_id, uint8_t reinit_scope);
643int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action); 714int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action);
644int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action); 715int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action);
645int64_t opal_get_epow_status(uint64_t *status); 716int64_t opal_get_epow_status(__be64 *status);
646int64_t opal_set_system_attention_led(uint8_t led_action); 717int64_t opal_set_system_attention_led(uint8_t led_action);
647int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe, 718int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe,
648 uint16_t *pci_error_type, uint16_t *severity); 719 uint16_t *pci_error_type, uint16_t *severity);
@@ -656,6 +727,9 @@ int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type,
656 uint32_t addr, uint32_t data, uint32_t sz); 727 uint32_t addr, uint32_t data, uint32_t sz);
657int64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type, 728int64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type,
658 uint32_t addr, uint32_t *data, uint32_t sz); 729 uint32_t addr, uint32_t *data, uint32_t sz);
730int64_t opal_validate_flash(uint64_t buffer, uint32_t *size, uint32_t *result);
731int64_t opal_manage_flash(uint8_t op);
732int64_t opal_update_flash(uint64_t blk_list);
659 733
660/* Internal functions */ 734/* Internal functions */
661extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data); 735extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data);
@@ -684,6 +758,7 @@ extern int opal_set_rtc_time(struct rtc_time *tm);
684extern void opal_get_rtc_time(struct rtc_time *tm); 758extern void opal_get_rtc_time(struct rtc_time *tm);
685extern unsigned long opal_get_boot_time(void); 759extern unsigned long opal_get_boot_time(void);
686extern void opal_nvram_init(void); 760extern void opal_nvram_init(void);
761extern void opal_flash_init(void);
687 762
688extern int opal_machine_check(struct pt_regs *regs); 763extern int opal_machine_check(struct pt_regs *regs);
689 764
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index a5954cebbc55..b6ea9e068c13 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -166,7 +166,7 @@ struct paca_struct {
166 struct dtl_entry *dtl_curr; /* pointer corresponding to dtl_ridx */ 166 struct dtl_entry *dtl_curr; /* pointer corresponding to dtl_ridx */
167 167
168#ifdef CONFIG_KVM_BOOK3S_HANDLER 168#ifdef CONFIG_KVM_BOOK3S_HANDLER
169#ifdef CONFIG_KVM_BOOK3S_PR 169#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
170 /* We use this to store guest state in */ 170 /* We use this to store guest state in */
171 struct kvmppc_book3s_shadow_vcpu shadow_vcpu; 171 struct kvmppc_book3s_shadow_vcpu shadow_vcpu;
172#endif 172#endif
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index b9f426212d3a..32e4e212b9c1 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -78,7 +78,7 @@ extern unsigned int HPAGE_SHIFT;
78 * 78 *
79 * Also, KERNELBASE >= PAGE_OFFSET and PHYSICAL_START >= MEMORY_START 79 * Also, KERNELBASE >= PAGE_OFFSET and PHYSICAL_START >= MEMORY_START
80 * 80 *
81 * There are two was to determine a physical address from a virtual one: 81 * There are two ways to determine a physical address from a virtual one:
82 * va = pa + PAGE_OFFSET - MEMORY_START 82 * va = pa + PAGE_OFFSET - MEMORY_START
83 * va = pa + KERNELBASE - PHYSICAL_START 83 * va = pa + KERNELBASE - PHYSICAL_START
84 * 84 *
@@ -403,7 +403,7 @@ void arch_free_page(struct page *page, int order);
403 403
404struct vm_area_struct; 404struct vm_area_struct;
405 405
406#ifdef CONFIG_PPC_64K_PAGES 406#if defined(CONFIG_PPC_64K_PAGES) && defined(CONFIG_PPC64)
407typedef pte_t *pgtable_t; 407typedef pte_t *pgtable_t;
408#else 408#else
409typedef struct page *pgtable_t; 409typedef struct page *pgtable_t;
diff --git a/arch/powerpc/include/asm/pgalloc-64.h b/arch/powerpc/include/asm/pgalloc-64.h
index f65e27b09bd3..16cb92d215d2 100644
--- a/arch/powerpc/include/asm/pgalloc-64.h
+++ b/arch/powerpc/include/asm/pgalloc-64.h
@@ -91,7 +91,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
91 if (!pte) 91 if (!pte)
92 return NULL; 92 return NULL;
93 page = virt_to_page(pte); 93 page = virt_to_page(pte);
94 pgtable_page_ctor(page); 94 if (!pgtable_page_ctor(page)) {
95 __free_page(page);
96 return NULL;
97 }
95 return page; 98 return page;
96} 99}
97 100
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index 46db09414a10..4a191c472867 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -394,6 +394,8 @@ static inline void mark_hpte_slot_valid(unsigned char *hpte_slot_array,
394 hpte_slot_array[index] = hidx << 4 | 0x1 << 3; 394 hpte_slot_array[index] = hidx << 4 | 0x1 << 3;
395} 395}
396 396
397struct page *realmode_pfn_to_page(unsigned long pfn);
398
397static inline char *get_hpte_slot_array(pmd_t *pmdp) 399static inline char *get_hpte_slot_array(pmd_t *pmdp)
398{ 400{
399 /* 401 /*
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index d7fe9f5b46d4..3132bb9365f3 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -143,6 +143,8 @@
143#define PPC_INST_LSWX 0x7c00042a 143#define PPC_INST_LSWX 0x7c00042a
144#define PPC_INST_LWARX 0x7c000028 144#define PPC_INST_LWARX 0x7c000028
145#define PPC_INST_LWSYNC 0x7c2004ac 145#define PPC_INST_LWSYNC 0x7c2004ac
146#define PPC_INST_SYNC 0x7c0004ac
147#define PPC_INST_SYNC_MASK 0xfc0007fe
146#define PPC_INST_LXVD2X 0x7c000698 148#define PPC_INST_LXVD2X 0x7c000698
147#define PPC_INST_MCRXR 0x7c000400 149#define PPC_INST_MCRXR 0x7c000400
148#define PPC_INST_MCRXR_MASK 0xfc0007fe 150#define PPC_INST_MCRXR_MASK 0xfc0007fe
@@ -181,6 +183,7 @@
181#define PPC_INST_TLBIVAX 0x7c000624 183#define PPC_INST_TLBIVAX 0x7c000624
182#define PPC_INST_TLBSRX_DOT 0x7c0006a5 184#define PPC_INST_TLBSRX_DOT 0x7c0006a5
183#define PPC_INST_XXLOR 0xf0000510 185#define PPC_INST_XXLOR 0xf0000510
186#define PPC_INST_XXSWAPD 0xf0000250
184#define PPC_INST_XVCPSGNDP 0xf0000780 187#define PPC_INST_XVCPSGNDP 0xf0000780
185#define PPC_INST_TRECHKPT 0x7c0007dd 188#define PPC_INST_TRECHKPT 0x7c0007dd
186#define PPC_INST_TRECLAIM 0x7c00075d 189#define PPC_INST_TRECLAIM 0x7c00075d
@@ -200,6 +203,7 @@
200/* Misc instructions for BPF compiler */ 203/* Misc instructions for BPF compiler */
201#define PPC_INST_LD 0xe8000000 204#define PPC_INST_LD 0xe8000000
202#define PPC_INST_LHZ 0xa0000000 205#define PPC_INST_LHZ 0xa0000000
206#define PPC_INST_LHBRX 0x7c00062c
203#define PPC_INST_LWZ 0x80000000 207#define PPC_INST_LWZ 0x80000000
204#define PPC_INST_STD 0xf8000000 208#define PPC_INST_STD 0xf8000000
205#define PPC_INST_STDU 0xf8000001 209#define PPC_INST_STDU 0xf8000001
@@ -218,7 +222,7 @@
218#define PPC_INST_MULLW 0x7c0001d6 222#define PPC_INST_MULLW 0x7c0001d6
219#define PPC_INST_MULHWU 0x7c000016 223#define PPC_INST_MULHWU 0x7c000016
220#define PPC_INST_MULLI 0x1c000000 224#define PPC_INST_MULLI 0x1c000000
221#define PPC_INST_DIVWU 0x7c0003d6 225#define PPC_INST_DIVWU 0x7c000396
222#define PPC_INST_RLWINM 0x54000000 226#define PPC_INST_RLWINM 0x54000000
223#define PPC_INST_RLDICR 0x78000004 227#define PPC_INST_RLDICR 0x78000004
224#define PPC_INST_SLW 0x7c000030 228#define PPC_INST_SLW 0x7c000030
@@ -344,6 +348,8 @@
344 VSX_XX1((s), a, b)) 348 VSX_XX1((s), a, b))
345#define XXLOR(t, a, b) stringify_in_c(.long PPC_INST_XXLOR | \ 349#define XXLOR(t, a, b) stringify_in_c(.long PPC_INST_XXLOR | \
346 VSX_XX3((t), a, b)) 350 VSX_XX3((t), a, b))
351#define XXSWAPD(t, a) stringify_in_c(.long PPC_INST_XXSWAPD | \
352 VSX_XX3((t), a, a))
347#define XVCPSGNDP(t, a, b) stringify_in_c(.long (PPC_INST_XVCPSGNDP | \ 353#define XVCPSGNDP(t, a, b) stringify_in_c(.long (PPC_INST_XVCPSGNDP | \
348 VSX_XX3((t), (a), (b)))) 354 VSX_XX3((t), (a), (b))))
349 355
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index 599545738af3..3c1acc31a092 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -98,123 +98,51 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
98#define REST_8GPRS(n, base) REST_4GPRS(n, base); REST_4GPRS(n+4, base) 98#define REST_8GPRS(n, base) REST_4GPRS(n, base); REST_4GPRS(n+4, base)
99#define REST_10GPRS(n, base) REST_8GPRS(n, base); REST_2GPRS(n+8, base) 99#define REST_10GPRS(n, base) REST_8GPRS(n, base); REST_2GPRS(n+8, base)
100 100
101#define SAVE_FPR(n, base) stfd n,THREAD_FPR0+8*TS_FPRWIDTH*(n)(base) 101#define SAVE_FPR(n, base) stfd n,8*TS_FPRWIDTH*(n)(base)
102#define SAVE_2FPRS(n, base) SAVE_FPR(n, base); SAVE_FPR(n+1, base) 102#define SAVE_2FPRS(n, base) SAVE_FPR(n, base); SAVE_FPR(n+1, base)
103#define SAVE_4FPRS(n, base) SAVE_2FPRS(n, base); SAVE_2FPRS(n+2, base) 103#define SAVE_4FPRS(n, base) SAVE_2FPRS(n, base); SAVE_2FPRS(n+2, base)
104#define SAVE_8FPRS(n, base) SAVE_4FPRS(n, base); SAVE_4FPRS(n+4, base) 104#define SAVE_8FPRS(n, base) SAVE_4FPRS(n, base); SAVE_4FPRS(n+4, base)
105#define SAVE_16FPRS(n, base) SAVE_8FPRS(n, base); SAVE_8FPRS(n+8, base) 105#define SAVE_16FPRS(n, base) SAVE_8FPRS(n, base); SAVE_8FPRS(n+8, base)
106#define SAVE_32FPRS(n, base) SAVE_16FPRS(n, base); SAVE_16FPRS(n+16, base) 106#define SAVE_32FPRS(n, base) SAVE_16FPRS(n, base); SAVE_16FPRS(n+16, base)
107#define REST_FPR(n, base) lfd n,THREAD_FPR0+8*TS_FPRWIDTH*(n)(base) 107#define REST_FPR(n, base) lfd n,8*TS_FPRWIDTH*(n)(base)
108#define REST_2FPRS(n, base) REST_FPR(n, base); REST_FPR(n+1, base) 108#define REST_2FPRS(n, base) REST_FPR(n, base); REST_FPR(n+1, base)
109#define REST_4FPRS(n, base) REST_2FPRS(n, base); REST_2FPRS(n+2, base) 109#define REST_4FPRS(n, base) REST_2FPRS(n, base); REST_2FPRS(n+2, base)
110#define REST_8FPRS(n, base) REST_4FPRS(n, base); REST_4FPRS(n+4, base) 110#define REST_8FPRS(n, base) REST_4FPRS(n, base); REST_4FPRS(n+4, base)
111#define REST_16FPRS(n, base) REST_8FPRS(n, base); REST_8FPRS(n+8, base) 111#define REST_16FPRS(n, base) REST_8FPRS(n, base); REST_8FPRS(n+8, base)
112#define REST_32FPRS(n, base) REST_16FPRS(n, base); REST_16FPRS(n+16, base) 112#define REST_32FPRS(n, base) REST_16FPRS(n, base); REST_16FPRS(n+16, base)
113 113
114#define SAVE_VR(n,b,base) li b,THREAD_VR0+(16*(n)); stvx n,base,b 114#define SAVE_VR(n,b,base) li b,16*(n); stvx n,base,b
115#define SAVE_2VRS(n,b,base) SAVE_VR(n,b,base); SAVE_VR(n+1,b,base) 115#define SAVE_2VRS(n,b,base) SAVE_VR(n,b,base); SAVE_VR(n+1,b,base)
116#define SAVE_4VRS(n,b,base) SAVE_2VRS(n,b,base); SAVE_2VRS(n+2,b,base) 116#define SAVE_4VRS(n,b,base) SAVE_2VRS(n,b,base); SAVE_2VRS(n+2,b,base)
117#define SAVE_8VRS(n,b,base) SAVE_4VRS(n,b,base); SAVE_4VRS(n+4,b,base) 117#define SAVE_8VRS(n,b,base) SAVE_4VRS(n,b,base); SAVE_4VRS(n+4,b,base)
118#define SAVE_16VRS(n,b,base) SAVE_8VRS(n,b,base); SAVE_8VRS(n+8,b,base) 118#define SAVE_16VRS(n,b,base) SAVE_8VRS(n,b,base); SAVE_8VRS(n+8,b,base)
119#define SAVE_32VRS(n,b,base) SAVE_16VRS(n,b,base); SAVE_16VRS(n+16,b,base) 119#define SAVE_32VRS(n,b,base) SAVE_16VRS(n,b,base); SAVE_16VRS(n+16,b,base)
120#define REST_VR(n,b,base) li b,THREAD_VR0+(16*(n)); lvx n,base,b 120#define REST_VR(n,b,base) li b,16*(n); lvx n,base,b
121#define REST_2VRS(n,b,base) REST_VR(n,b,base); REST_VR(n+1,b,base) 121#define REST_2VRS(n,b,base) REST_VR(n,b,base); REST_VR(n+1,b,base)
122#define REST_4VRS(n,b,base) REST_2VRS(n,b,base); REST_2VRS(n+2,b,base) 122#define REST_4VRS(n,b,base) REST_2VRS(n,b,base); REST_2VRS(n+2,b,base)
123#define REST_8VRS(n,b,base) REST_4VRS(n,b,base); REST_4VRS(n+4,b,base) 123#define REST_8VRS(n,b,base) REST_4VRS(n,b,base); REST_4VRS(n+4,b,base)
124#define REST_16VRS(n,b,base) REST_8VRS(n,b,base); REST_8VRS(n+8,b,base) 124#define REST_16VRS(n,b,base) REST_8VRS(n,b,base); REST_8VRS(n+8,b,base)
125#define REST_32VRS(n,b,base) REST_16VRS(n,b,base); REST_16VRS(n+16,b,base) 125#define REST_32VRS(n,b,base) REST_16VRS(n,b,base); REST_16VRS(n+16,b,base)
126 126
127/* Save/restore FPRs, VRs and VSRs from their checkpointed backups in 127#ifdef __BIG_ENDIAN__
128 * thread_struct: 128#define STXVD2X_ROT(n,b,base) STXVD2X(n,b,base)
129 */ 129#define LXVD2X_ROT(n,b,base) LXVD2X(n,b,base)
130#define SAVE_FPR_TRANSACT(n, base) stfd n,THREAD_TRANSACT_FPR0+ \ 130#else
131 8*TS_FPRWIDTH*(n)(base) 131#define STXVD2X_ROT(n,b,base) XXSWAPD(n,n); \
132#define SAVE_2FPRS_TRANSACT(n, base) SAVE_FPR_TRANSACT(n, base); \ 132 STXVD2X(n,b,base); \
133 SAVE_FPR_TRANSACT(n+1, base) 133 XXSWAPD(n,n)
134#define SAVE_4FPRS_TRANSACT(n, base) SAVE_2FPRS_TRANSACT(n, base); \
135 SAVE_2FPRS_TRANSACT(n+2, base)
136#define SAVE_8FPRS_TRANSACT(n, base) SAVE_4FPRS_TRANSACT(n, base); \
137 SAVE_4FPRS_TRANSACT(n+4, base)
138#define SAVE_16FPRS_TRANSACT(n, base) SAVE_8FPRS_TRANSACT(n, base); \
139 SAVE_8FPRS_TRANSACT(n+8, base)
140#define SAVE_32FPRS_TRANSACT(n, base) SAVE_16FPRS_TRANSACT(n, base); \
141 SAVE_16FPRS_TRANSACT(n+16, base)
142
143#define REST_FPR_TRANSACT(n, base) lfd n,THREAD_TRANSACT_FPR0+ \
144 8*TS_FPRWIDTH*(n)(base)
145#define REST_2FPRS_TRANSACT(n, base) REST_FPR_TRANSACT(n, base); \
146 REST_FPR_TRANSACT(n+1, base)
147#define REST_4FPRS_TRANSACT(n, base) REST_2FPRS_TRANSACT(n, base); \
148 REST_2FPRS_TRANSACT(n+2, base)
149#define REST_8FPRS_TRANSACT(n, base) REST_4FPRS_TRANSACT(n, base); \
150 REST_4FPRS_TRANSACT(n+4, base)
151#define REST_16FPRS_TRANSACT(n, base) REST_8FPRS_TRANSACT(n, base); \
152 REST_8FPRS_TRANSACT(n+8, base)
153#define REST_32FPRS_TRANSACT(n, base) REST_16FPRS_TRANSACT(n, base); \
154 REST_16FPRS_TRANSACT(n+16, base)
155
156
157#define SAVE_VR_TRANSACT(n,b,base) li b,THREAD_TRANSACT_VR0+(16*(n)); \
158 stvx n,b,base
159#define SAVE_2VRS_TRANSACT(n,b,base) SAVE_VR_TRANSACT(n,b,base); \
160 SAVE_VR_TRANSACT(n+1,b,base)
161#define SAVE_4VRS_TRANSACT(n,b,base) SAVE_2VRS_TRANSACT(n,b,base); \
162 SAVE_2VRS_TRANSACT(n+2,b,base)
163#define SAVE_8VRS_TRANSACT(n,b,base) SAVE_4VRS_TRANSACT(n,b,base); \
164 SAVE_4VRS_TRANSACT(n+4,b,base)
165#define SAVE_16VRS_TRANSACT(n,b,base) SAVE_8VRS_TRANSACT(n,b,base); \
166 SAVE_8VRS_TRANSACT(n+8,b,base)
167#define SAVE_32VRS_TRANSACT(n,b,base) SAVE_16VRS_TRANSACT(n,b,base); \
168 SAVE_16VRS_TRANSACT(n+16,b,base)
169
170#define REST_VR_TRANSACT(n,b,base) li b,THREAD_TRANSACT_VR0+(16*(n)); \
171 lvx n,b,base
172#define REST_2VRS_TRANSACT(n,b,base) REST_VR_TRANSACT(n,b,base); \
173 REST_VR_TRANSACT(n+1,b,base)
174#define REST_4VRS_TRANSACT(n,b,base) REST_2VRS_TRANSACT(n,b,base); \
175 REST_2VRS_TRANSACT(n+2,b,base)
176#define REST_8VRS_TRANSACT(n,b,base) REST_4VRS_TRANSACT(n,b,base); \
177 REST_4VRS_TRANSACT(n+4,b,base)
178#define REST_16VRS_TRANSACT(n,b,base) REST_8VRS_TRANSACT(n,b,base); \
179 REST_8VRS_TRANSACT(n+8,b,base)
180#define REST_32VRS_TRANSACT(n,b,base) REST_16VRS_TRANSACT(n,b,base); \
181 REST_16VRS_TRANSACT(n+16,b,base)
182
183
184#define SAVE_VSR_TRANSACT(n,b,base) li b,THREAD_TRANSACT_VSR0+(16*(n)); \
185 STXVD2X(n,R##base,R##b)
186#define SAVE_2VSRS_TRANSACT(n,b,base) SAVE_VSR_TRANSACT(n,b,base); \
187 SAVE_VSR_TRANSACT(n+1,b,base)
188#define SAVE_4VSRS_TRANSACT(n,b,base) SAVE_2VSRS_TRANSACT(n,b,base); \
189 SAVE_2VSRS_TRANSACT(n+2,b,base)
190#define SAVE_8VSRS_TRANSACT(n,b,base) SAVE_4VSRS_TRANSACT(n,b,base); \
191 SAVE_4VSRS_TRANSACT(n+4,b,base)
192#define SAVE_16VSRS_TRANSACT(n,b,base) SAVE_8VSRS_TRANSACT(n,b,base); \
193 SAVE_8VSRS_TRANSACT(n+8,b,base)
194#define SAVE_32VSRS_TRANSACT(n,b,base) SAVE_16VSRS_TRANSACT(n,b,base); \
195 SAVE_16VSRS_TRANSACT(n+16,b,base)
196
197#define REST_VSR_TRANSACT(n,b,base) li b,THREAD_TRANSACT_VSR0+(16*(n)); \
198 LXVD2X(n,R##base,R##b)
199#define REST_2VSRS_TRANSACT(n,b,base) REST_VSR_TRANSACT(n,b,base); \
200 REST_VSR_TRANSACT(n+1,b,base)
201#define REST_4VSRS_TRANSACT(n,b,base) REST_2VSRS_TRANSACT(n,b,base); \
202 REST_2VSRS_TRANSACT(n+2,b,base)
203#define REST_8VSRS_TRANSACT(n,b,base) REST_4VSRS_TRANSACT(n,b,base); \
204 REST_4VSRS_TRANSACT(n+4,b,base)
205#define REST_16VSRS_TRANSACT(n,b,base) REST_8VSRS_TRANSACT(n,b,base); \
206 REST_8VSRS_TRANSACT(n+8,b,base)
207#define REST_32VSRS_TRANSACT(n,b,base) REST_16VSRS_TRANSACT(n,b,base); \
208 REST_16VSRS_TRANSACT(n+16,b,base)
209 134
135#define LXVD2X_ROT(n,b,base) LXVD2X(n,b,base); \
136 XXSWAPD(n,n)
137#endif
210/* Save the lower 32 VSRs in the thread VSR region */ 138/* Save the lower 32 VSRs in the thread VSR region */
211#define SAVE_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); STXVD2X(n,R##base,R##b) 139#define SAVE_VSR(n,b,base) li b,16*(n); STXVD2X_ROT(n,R##base,R##b)
212#define SAVE_2VSRS(n,b,base) SAVE_VSR(n,b,base); SAVE_VSR(n+1,b,base) 140#define SAVE_2VSRS(n,b,base) SAVE_VSR(n,b,base); SAVE_VSR(n+1,b,base)
213#define SAVE_4VSRS(n,b,base) SAVE_2VSRS(n,b,base); SAVE_2VSRS(n+2,b,base) 141#define SAVE_4VSRS(n,b,base) SAVE_2VSRS(n,b,base); SAVE_2VSRS(n+2,b,base)
214#define SAVE_8VSRS(n,b,base) SAVE_4VSRS(n,b,base); SAVE_4VSRS(n+4,b,base) 142#define SAVE_8VSRS(n,b,base) SAVE_4VSRS(n,b,base); SAVE_4VSRS(n+4,b,base)
215#define SAVE_16VSRS(n,b,base) SAVE_8VSRS(n,b,base); SAVE_8VSRS(n+8,b,base) 143#define SAVE_16VSRS(n,b,base) SAVE_8VSRS(n,b,base); SAVE_8VSRS(n+8,b,base)
216#define SAVE_32VSRS(n,b,base) SAVE_16VSRS(n,b,base); SAVE_16VSRS(n+16,b,base) 144#define SAVE_32VSRS(n,b,base) SAVE_16VSRS(n,b,base); SAVE_16VSRS(n+16,b,base)
217#define REST_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); LXVD2X(n,R##base,R##b) 145#define REST_VSR(n,b,base) li b,16*(n); LXVD2X_ROT(n,R##base,R##b)
218#define REST_2VSRS(n,b,base) REST_VSR(n,b,base); REST_VSR(n+1,b,base) 146#define REST_2VSRS(n,b,base) REST_VSR(n,b,base); REST_VSR(n+1,b,base)
219#define REST_4VSRS(n,b,base) REST_2VSRS(n,b,base); REST_2VSRS(n+2,b,base) 147#define REST_4VSRS(n,b,base) REST_2VSRS(n,b,base); REST_2VSRS(n+2,b,base)
220#define REST_8VSRS(n,b,base) REST_4VSRS(n,b,base); REST_4VSRS(n+4,b,base) 148#define REST_8VSRS(n,b,base) REST_4VSRS(n,b,base); REST_4VSRS(n+4,b,base)
@@ -478,13 +406,6 @@ BEGIN_FTR_SECTION_NESTED(945) \
478 std ra,TASKTHREADPPR(rb); \ 406 std ra,TASKTHREADPPR(rb); \
479END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,945) 407END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,945)
480 408
481#define RESTORE_PPR(ra, rb) \
482BEGIN_FTR_SECTION_NESTED(946) \
483 ld ra,PACACURRENT(r13); \
484 ld rb,TASKTHREADPPR(ra); \
485 mtspr SPRN_PPR,rb; /* Restore PPR */ \
486END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,946)
487
488#endif 409#endif
489 410
490/* 411/*
@@ -832,6 +753,35 @@ END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,946)
832#define N_SLINE 68 753#define N_SLINE 68
833#define N_SO 100 754#define N_SO 100
834 755
835#endif /* __ASSEMBLY__ */ 756/*
757 * Create an endian fixup trampoline
758 *
759 * This starts with a "tdi 0,0,0x48" instruction which is
760 * essentially a "trap never", and thus akin to a nop.
761 *
762 * The opcode for this instruction read with the wrong endian
763 * however results in a b . + 8
764 *
765 * So essentially we use that trick to execute the following
766 * trampoline in "reverse endian" if we are running with the
767 * MSR_LE bit set the "wrong" way for whatever endianness the
768 * kernel is built for.
769 */
836 770
771#ifdef CONFIG_PPC_BOOK3E
772#define FIXUP_ENDIAN
773#else
774#define FIXUP_ENDIAN \
775 tdi 0,0,0x48; /* Reverse endian of b . + 8 */ \
776 b $+36; /* Skip trampoline if endian is good */ \
777 .long 0x05009f42; /* bcl 20,31,$+4 */ \
778 .long 0xa602487d; /* mflr r10 */ \
779 .long 0x1c004a39; /* addi r10,r10,28 */ \
780 .long 0xa600607d; /* mfmsr r11 */ \
781 .long 0x01006b69; /* xori r11,r11,1 */ \
782 .long 0xa6035a7d; /* mtsrr0 r10 */ \
783 .long 0xa6037b7d; /* mtsrr1 r11 */ \
784 .long 0x2400004c /* rfid */
785#endif /* !CONFIG_PPC_BOOK3E */
786#endif /* __ASSEMBLY__ */
837#endif /* _ASM_POWERPC_PPC_ASM_H */ 787#endif /* _ASM_POWERPC_PPC_ASM_H */
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index e378cccfca55..fc14a38c7ccf 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -14,8 +14,18 @@
14 14
15#ifdef CONFIG_VSX 15#ifdef CONFIG_VSX
16#define TS_FPRWIDTH 2 16#define TS_FPRWIDTH 2
17
18#ifdef __BIG_ENDIAN__
19#define TS_FPROFFSET 0
20#define TS_VSRLOWOFFSET 1
21#else
22#define TS_FPROFFSET 1
23#define TS_VSRLOWOFFSET 0
24#endif
25
17#else 26#else
18#define TS_FPRWIDTH 1 27#define TS_FPRWIDTH 1
28#define TS_FPROFFSET 0
19#endif 29#endif
20 30
21#ifdef CONFIG_PPC64 31#ifdef CONFIG_PPC64
@@ -142,27 +152,22 @@ typedef struct {
142 unsigned long seg; 152 unsigned long seg;
143} mm_segment_t; 153} mm_segment_t;
144 154
145#define TS_FPROFFSET 0 155#define TS_FPR(i) fp_state.fpr[i][TS_FPROFFSET]
146#define TS_VSRLOWOFFSET 1 156#define TS_TRANS_FPR(i) transact_fp.fpr[i][TS_FPROFFSET]
147#define TS_FPR(i) fpr[i][TS_FPROFFSET]
148#define TS_TRANS_FPR(i) transact_fpr[i][TS_FPROFFSET]
149 157
150struct thread_struct { 158/* FP and VSX 0-31 register set */
151 unsigned long ksp; /* Kernel stack pointer */ 159struct thread_fp_state {
152 unsigned long ksp_limit; /* if ksp <= ksp_limit stack overflow */ 160 u64 fpr[32][TS_FPRWIDTH] __attribute__((aligned(16)));
161 u64 fpscr; /* Floating point status */
162};
153 163
154#ifdef CONFIG_PPC64 164/* Complete AltiVec register set including VSCR */
155 unsigned long ksp_vsid; 165struct thread_vr_state {
156#endif 166 vector128 vr[32] __attribute__((aligned(16)));
157 struct pt_regs *regs; /* Pointer to saved register state */ 167 vector128 vscr __attribute__((aligned(16)));
158 mm_segment_t fs; /* for get_fs() validation */ 168};
159#ifdef CONFIG_BOOKE 169
160 /* BookE base exception scratch space; align on cacheline */ 170struct debug_reg {
161 unsigned long normsave[8] ____cacheline_aligned;
162#endif
163#ifdef CONFIG_PPC32
164 void *pgdir; /* root of page-table tree */
165#endif
166#ifdef CONFIG_PPC_ADV_DEBUG_REGS 171#ifdef CONFIG_PPC_ADV_DEBUG_REGS
167 /* 172 /*
168 * The following help to manage the use of Debug Control Registers 173 * The following help to manage the use of Debug Control Registers
@@ -199,13 +204,28 @@ struct thread_struct {
199 unsigned long dvc2; 204 unsigned long dvc2;
200#endif 205#endif
201#endif 206#endif
202 /* FP and VSX 0-31 register set */ 207};
203 double fpr[32][TS_FPRWIDTH] __attribute__((aligned(16)));
204 struct {
205 208
206 unsigned int pad; 209struct thread_struct {
207 unsigned int val; /* Floating point status */ 210 unsigned long ksp; /* Kernel stack pointer */
208 } fpscr; 211
212#ifdef CONFIG_PPC64
213 unsigned long ksp_vsid;
214#endif
215 struct pt_regs *regs; /* Pointer to saved register state */
216 mm_segment_t fs; /* for get_fs() validation */
217#ifdef CONFIG_BOOKE
218 /* BookE base exception scratch space; align on cacheline */
219 unsigned long normsave[8] ____cacheline_aligned;
220#endif
221#ifdef CONFIG_PPC32
222 void *pgdir; /* root of page-table tree */
223 unsigned long ksp_limit; /* if ksp <= ksp_limit stack overflow */
224#endif
225 /* Debug Registers */
226 struct debug_reg debug;
227 struct thread_fp_state fp_state;
228 struct thread_fp_state *fp_save_area;
209 int fpexc_mode; /* floating-point exception mode */ 229 int fpexc_mode; /* floating-point exception mode */
210 unsigned int align_ctl; /* alignment handling control */ 230 unsigned int align_ctl; /* alignment handling control */
211#ifdef CONFIG_PPC64 231#ifdef CONFIG_PPC64
@@ -223,10 +243,8 @@ struct thread_struct {
223 struct arch_hw_breakpoint hw_brk; /* info on the hardware breakpoint */ 243 struct arch_hw_breakpoint hw_brk; /* info on the hardware breakpoint */
224 unsigned long trap_nr; /* last trap # on this thread */ 244 unsigned long trap_nr; /* last trap # on this thread */
225#ifdef CONFIG_ALTIVEC 245#ifdef CONFIG_ALTIVEC
226 /* Complete AltiVec register set */ 246 struct thread_vr_state vr_state;
227 vector128 vr[32] __attribute__((aligned(16))); 247 struct thread_vr_state *vr_save_area;
228 /* AltiVec status */
229 vector128 vscr __attribute__((aligned(16)));
230 unsigned long vrsave; 248 unsigned long vrsave;
231 int used_vr; /* set if process has used altivec */ 249 int used_vr; /* set if process has used altivec */
232#endif /* CONFIG_ALTIVEC */ 250#endif /* CONFIG_ALTIVEC */
@@ -263,13 +281,8 @@ struct thread_struct {
263 * transact_fpr[] is the new set of transactional values. 281 * transact_fpr[] is the new set of transactional values.
264 * VRs work the same way. 282 * VRs work the same way.
265 */ 283 */
266 double transact_fpr[32][TS_FPRWIDTH]; 284 struct thread_fp_state transact_fp;
267 struct { 285 struct thread_vr_state transact_vr;
268 unsigned int pad;
269 unsigned int val; /* Floating point status */
270 } transact_fpscr;
271 vector128 transact_vr[32] __attribute__((aligned(16)));
272 vector128 transact_vscr __attribute__((aligned(16)));
273 unsigned long transact_vrsave; 286 unsigned long transact_vrsave;
274#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ 287#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
275#ifdef CONFIG_KVM_BOOK3S_32_HANDLER 288#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
@@ -321,11 +334,8 @@ struct thread_struct {
321#else 334#else
322#define INIT_THREAD { \ 335#define INIT_THREAD { \
323 .ksp = INIT_SP, \ 336 .ksp = INIT_SP, \
324 .ksp_limit = INIT_SP_LIMIT, \
325 .regs = (struct pt_regs *)INIT_SP - 1, /* XXX bogus, I think */ \ 337 .regs = (struct pt_regs *)INIT_SP - 1, /* XXX bogus, I think */ \
326 .fs = KERNEL_DS, \ 338 .fs = KERNEL_DS, \
327 .fpr = {{0}}, \
328 .fpscr = { .val = 0, }, \
329 .fpexc_mode = 0, \ 339 .fpexc_mode = 0, \
330 .ppr = INIT_PPR, \ 340 .ppr = INIT_PPR, \
331} 341}
@@ -363,6 +373,11 @@ extern int set_endian(struct task_struct *tsk, unsigned int val);
363extern int get_unalign_ctl(struct task_struct *tsk, unsigned long adr); 373extern int get_unalign_ctl(struct task_struct *tsk, unsigned long adr);
364extern int set_unalign_ctl(struct task_struct *tsk, unsigned int val); 374extern int set_unalign_ctl(struct task_struct *tsk, unsigned int val);
365 375
376extern void load_fp_state(struct thread_fp_state *fp);
377extern void store_fp_state(struct thread_fp_state *fp);
378extern void load_vr_state(struct thread_vr_state *vr);
379extern void store_vr_state(struct thread_vr_state *vr);
380
366static inline unsigned int __unpack_fe01(unsigned long msr_bits) 381static inline unsigned int __unpack_fe01(unsigned long msr_bits)
367{ 382{
368 return ((msr_bits & MSR_FE0) >> 10) | ((msr_bits & MSR_FE1) >> 8); 383 return ((msr_bits & MSR_FE0) >> 10) | ((msr_bits & MSR_FE1) >> 8);
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index 7d0c7f3a7171..d977b9b78696 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -1,4 +1,3 @@
1#include <linux/of.h> /* linux/of.h gets to determine #include ordering */
2#ifndef _POWERPC_PROM_H 1#ifndef _POWERPC_PROM_H
3#define _POWERPC_PROM_H 2#define _POWERPC_PROM_H
4#ifdef __KERNEL__ 3#ifdef __KERNEL__
@@ -20,21 +19,17 @@
20#include <asm/irq.h> 19#include <asm/irq.h>
21#include <linux/atomic.h> 20#include <linux/atomic.h>
22 21
23#define HAVE_ARCH_DEVTREE_FIXUPS 22/* These includes should be removed once implicit includes are cleaned up. */
23#include <linux/of.h>
24#include <linux/of_fdt.h>
25#include <linux/of_address.h>
26#include <linux/of_irq.h>
27#include <linux/platform_device.h>
24 28
25/* 29/*
26 * OF address retreival & translation 30 * OF address retreival & translation
27 */ 31 */
28 32
29/* Translate a DMA address from device space to CPU space */
30extern u64 of_translate_dma_address(struct device_node *dev,
31 const __be32 *in_addr);
32
33#ifdef CONFIG_PCI
34extern unsigned long pci_address_to_pio(phys_addr_t address);
35#define pci_address_to_pio pci_address_to_pio
36#endif /* CONFIG_PCI */
37
38/* Parse the ibm,dma-window property of an OF node into the busno, phys and 33/* Parse the ibm,dma-window property of an OF node into the busno, phys and
39 * size parameters. 34 * size parameters.
40 */ 35 */
@@ -44,16 +39,6 @@ void of_parse_dma_window(struct device_node *dn, const __be32 *dma_window,
44 39
45extern void kdump_move_device_tree(void); 40extern void kdump_move_device_tree(void);
46 41
47/* cache lookup */
48struct device_node *of_find_next_cache_node(struct device_node *np);
49
50#ifdef CONFIG_NUMA
51extern int of_node_to_nid(struct device_node *device);
52#else
53static inline int of_node_to_nid(struct device_node *device) { return 0; }
54#endif
55#define of_node_to_nid of_node_to_nid
56
57extern void of_instantiate_rtc(void); 42extern void of_instantiate_rtc(void);
58 43
59extern int of_get_ibm_chip_id(struct device_node *np); 44extern int of_get_ibm_chip_id(struct device_node *np);
@@ -143,14 +128,5 @@ struct of_drconf_cell {
143 */ 128 */
144extern unsigned char ibm_architecture_vec[]; 129extern unsigned char ibm_architecture_vec[];
145 130
146/* These includes are put at the bottom because they may contain things
147 * that are overridden by this file. Ideally they shouldn't be included
148 * by this file, but there are a bunch of .c files that currently depend
149 * on it. Eventually they will be cleaned up. */
150#include <linux/of_fdt.h>
151#include <linux/of_address.h>
152#include <linux/of_irq.h>
153#include <linux/platform_device.h>
154
155#endif /* __KERNEL__ */ 131#endif /* __KERNEL__ */
156#endif /* _POWERPC_PROM_H */ 132#endif /* _POWERPC_PROM_H */
diff --git a/arch/powerpc/include/asm/pte-book3e.h b/arch/powerpc/include/asm/pte-book3e.h
index 0156702ba24e..576ad88104cb 100644
--- a/arch/powerpc/include/asm/pte-book3e.h
+++ b/arch/powerpc/include/asm/pte-book3e.h
@@ -40,7 +40,7 @@
40#define _PAGE_U1 0x010000 40#define _PAGE_U1 0x010000
41#define _PAGE_U0 0x020000 41#define _PAGE_U0 0x020000
42#define _PAGE_ACCESSED 0x040000 42#define _PAGE_ACCESSED 0x040000
43#define _PAGE_LENDIAN 0x080000 43#define _PAGE_ENDIAN 0x080000
44#define _PAGE_GUARDED 0x100000 44#define _PAGE_GUARDED 0x100000
45#define _PAGE_COHERENT 0x200000 /* M: enforce memory coherence */ 45#define _PAGE_COHERENT 0x200000 /* M: enforce memory coherence */
46#define _PAGE_NO_CACHE 0x400000 /* I: cache inhibit */ 46#define _PAGE_NO_CACHE 0x400000 /* I: cache inhibit */
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 10d1ef016bf1..5c45787d551e 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -115,7 +115,12 @@
115#define MSR_64BIT MSR_SF 115#define MSR_64BIT MSR_SF
116 116
117/* Server variant */ 117/* Server variant */
118#define MSR_ (MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_ISF |MSR_HV) 118#define __MSR (MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_ISF |MSR_HV)
119#ifdef __BIG_ENDIAN__
120#define MSR_ __MSR
121#else
122#define MSR_ (__MSR | MSR_LE)
123#endif
119#define MSR_KERNEL (MSR_ | MSR_64BIT) 124#define MSR_KERNEL (MSR_ | MSR_64BIT)
120#define MSR_USER32 (MSR_ | MSR_PR | MSR_EE) 125#define MSR_USER32 (MSR_ | MSR_PR | MSR_EE)
121#define MSR_USER64 (MSR_USER32 | MSR_64BIT) 126#define MSR_USER64 (MSR_USER32 | MSR_64BIT)
@@ -243,6 +248,7 @@
243#define SPRN_TBRU 0x10D /* Time Base Read Upper Register (user, R/O) */ 248#define SPRN_TBRU 0x10D /* Time Base Read Upper Register (user, R/O) */
244#define SPRN_TBWL 0x11C /* Time Base Lower Register (super, R/W) */ 249#define SPRN_TBWL 0x11C /* Time Base Lower Register (super, R/W) */
245#define SPRN_TBWU 0x11D /* Time Base Upper Register (super, R/W) */ 250#define SPRN_TBWU 0x11D /* Time Base Upper Register (super, R/W) */
251#define SPRN_TBU40 0x11E /* Timebase upper 40 bits (hyper, R/W) */
246#define SPRN_SPURR 0x134 /* Scaled PURR */ 252#define SPRN_SPURR 0x134 /* Scaled PURR */
247#define SPRN_HSPRG0 0x130 /* Hypervisor Scratch 0 */ 253#define SPRN_HSPRG0 0x130 /* Hypervisor Scratch 0 */
248#define SPRN_HSPRG1 0x131 /* Hypervisor Scratch 1 */ 254#define SPRN_HSPRG1 0x131 /* Hypervisor Scratch 1 */
@@ -283,6 +289,7 @@
283#define LPCR_ISL (1ul << (63-2)) 289#define LPCR_ISL (1ul << (63-2))
284#define LPCR_VC_SH (63-2) 290#define LPCR_VC_SH (63-2)
285#define LPCR_DPFD_SH (63-11) 291#define LPCR_DPFD_SH (63-11)
292#define LPCR_DPFD (7ul << LPCR_DPFD_SH)
286#define LPCR_VRMASD (0x1ful << (63-16)) 293#define LPCR_VRMASD (0x1ful << (63-16))
287#define LPCR_VRMA_L (1ul << (63-12)) 294#define LPCR_VRMA_L (1ul << (63-12))
288#define LPCR_VRMA_LP0 (1ul << (63-15)) 295#define LPCR_VRMA_LP0 (1ul << (63-15))
@@ -299,6 +306,7 @@
299#define LPCR_PECE2 0x00001000 /* machine check etc can cause exit */ 306#define LPCR_PECE2 0x00001000 /* machine check etc can cause exit */
300#define LPCR_MER 0x00000800 /* Mediated External Exception */ 307#define LPCR_MER 0x00000800 /* Mediated External Exception */
301#define LPCR_MER_SH 11 308#define LPCR_MER_SH 11
309#define LPCR_TC 0x00000200 /* Translation control */
302#define LPCR_LPES 0x0000000c 310#define LPCR_LPES 0x0000000c
303#define LPCR_LPES0 0x00000008 /* LPAR Env selector 0 */ 311#define LPCR_LPES0 0x00000008 /* LPAR Env selector 0 */
304#define LPCR_LPES1 0x00000004 /* LPAR Env selector 1 */ 312#define LPCR_LPES1 0x00000004 /* LPAR Env selector 1 */
@@ -311,6 +319,10 @@
311#define LPID_RSVD 0x3ff /* Reserved LPID for partn switching */ 319#define LPID_RSVD 0x3ff /* Reserved LPID for partn switching */
312#define SPRN_HMER 0x150 /* Hardware m? error recovery */ 320#define SPRN_HMER 0x150 /* Hardware m? error recovery */
313#define SPRN_HMEER 0x151 /* Hardware m? enable error recovery */ 321#define SPRN_HMEER 0x151 /* Hardware m? enable error recovery */
322#define SPRN_PCR 0x152 /* Processor compatibility register */
323#define PCR_VEC_DIS (1ul << (63-0)) /* Vec. disable (bit NA since POWER8) */
324#define PCR_VSX_DIS (1ul << (63-1)) /* VSX disable (bit NA since POWER8) */
325#define PCR_ARCH_205 0x2 /* Architecture 2.05 */
314#define SPRN_HEIR 0x153 /* Hypervisor Emulated Instruction Register */ 326#define SPRN_HEIR 0x153 /* Hypervisor Emulated Instruction Register */
315#define SPRN_TLBINDEXR 0x154 /* P7 TLB control register */ 327#define SPRN_TLBINDEXR 0x154 /* P7 TLB control register */
316#define SPRN_TLBVPNR 0x155 /* P7 TLB control register */ 328#define SPRN_TLBVPNR 0x155 /* P7 TLB control register */
@@ -420,6 +432,7 @@
420#define HID4_RMLS2_SH (63 - 2) /* Real mode limit bottom 2 bits */ 432#define HID4_RMLS2_SH (63 - 2) /* Real mode limit bottom 2 bits */
421#define HID4_LPID5_SH (63 - 6) /* partition ID bottom 4 bits */ 433#define HID4_LPID5_SH (63 - 6) /* partition ID bottom 4 bits */
422#define HID4_RMOR_SH (63 - 22) /* real mode offset (16 bits) */ 434#define HID4_RMOR_SH (63 - 22) /* real mode offset (16 bits) */
435#define HID4_RMOR (0xFFFFul << HID4_RMOR_SH)
423#define HID4_LPES1 (1 << (63-57)) /* LPAR env. sel. bit 1 */ 436#define HID4_LPES1 (1 << (63-57)) /* LPAR env. sel. bit 1 */
424#define HID4_RMLS0_SH (63 - 58) /* Real mode limit top bit */ 437#define HID4_RMLS0_SH (63 - 58) /* Real mode limit top bit */
425#define HID4_LPID1_SH 0 /* partition ID top 2 bits */ 438#define HID4_LPID1_SH 0 /* partition ID top 2 bits */
@@ -1102,6 +1115,13 @@
1102#define PVR_BE 0x0070 1115#define PVR_BE 0x0070
1103#define PVR_PA6T 0x0090 1116#define PVR_PA6T 0x0090
1104 1117
1118/* "Logical" PVR values defined in PAPR, representing architecture levels */
1119#define PVR_ARCH_204 0x0f000001
1120#define PVR_ARCH_205 0x0f000002
1121#define PVR_ARCH_206 0x0f000003
1122#define PVR_ARCH_206p 0x0f100003
1123#define PVR_ARCH_207 0x0f000004
1124
1105/* Macros for setting and retrieving special purpose registers */ 1125/* Macros for setting and retrieving special purpose registers */
1106#ifndef __ASSEMBLY__ 1126#ifndef __ASSEMBLY__
1107#define mfmsr() ({unsigned long rval; \ 1127#define mfmsr() ({unsigned long rval; \
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h
index ed8f836da094..2e31aacd8acc 100644
--- a/arch/powerpc/include/asm/reg_booke.h
+++ b/arch/powerpc/include/asm/reg_booke.h
@@ -381,7 +381,7 @@
381#define DBCR0_IA34T 0x00004000 /* Instr Addr 3-4 range Toggle */ 381#define DBCR0_IA34T 0x00004000 /* Instr Addr 3-4 range Toggle */
382#define DBCR0_FT 0x00000001 /* Freeze Timers on debug event */ 382#define DBCR0_FT 0x00000001 /* Freeze Timers on debug event */
383 383
384#define dbcr_iac_range(task) ((task)->thread.dbcr0) 384#define dbcr_iac_range(task) ((task)->thread.debug.dbcr0)
385#define DBCR_IAC12I DBCR0_IA12 /* Range Inclusive */ 385#define DBCR_IAC12I DBCR0_IA12 /* Range Inclusive */
386#define DBCR_IAC12X (DBCR0_IA12 | DBCR0_IA12X) /* Range Exclusive */ 386#define DBCR_IAC12X (DBCR0_IA12 | DBCR0_IA12X) /* Range Exclusive */
387#define DBCR_IAC12MODE (DBCR0_IA12 | DBCR0_IA12X) /* IAC 1-2 Mode Bits */ 387#define DBCR_IAC12MODE (DBCR0_IA12 | DBCR0_IA12X) /* IAC 1-2 Mode Bits */
@@ -395,7 +395,7 @@
395#define DBCR1_DAC1W 0x20000000 /* DAC1 Write Debug Event */ 395#define DBCR1_DAC1W 0x20000000 /* DAC1 Write Debug Event */
396#define DBCR1_DAC2W 0x10000000 /* DAC2 Write Debug Event */ 396#define DBCR1_DAC2W 0x10000000 /* DAC2 Write Debug Event */
397 397
398#define dbcr_dac(task) ((task)->thread.dbcr1) 398#define dbcr_dac(task) ((task)->thread.debug.dbcr1)
399#define DBCR_DAC1R DBCR1_DAC1R 399#define DBCR_DAC1R DBCR1_DAC1R
400#define DBCR_DAC1W DBCR1_DAC1W 400#define DBCR_DAC1W DBCR1_DAC1W
401#define DBCR_DAC2R DBCR1_DAC2R 401#define DBCR_DAC2R DBCR1_DAC2R
@@ -441,7 +441,7 @@
441#define DBCR0_CRET 0x00000020 /* Critical Return Debug Event */ 441#define DBCR0_CRET 0x00000020 /* Critical Return Debug Event */
442#define DBCR0_FT 0x00000001 /* Freeze Timers on debug event */ 442#define DBCR0_FT 0x00000001 /* Freeze Timers on debug event */
443 443
444#define dbcr_dac(task) ((task)->thread.dbcr0) 444#define dbcr_dac(task) ((task)->thread.debug.dbcr0)
445#define DBCR_DAC1R DBCR0_DAC1R 445#define DBCR_DAC1R DBCR0_DAC1R
446#define DBCR_DAC1W DBCR0_DAC1W 446#define DBCR_DAC1W DBCR0_DAC1W
447#define DBCR_DAC2R DBCR0_DAC2R 447#define DBCR_DAC2R DBCR0_DAC2R
@@ -475,7 +475,7 @@
475#define DBCR1_IAC34MX 0x000000C0 /* Instr Addr 3-4 range eXclusive */ 475#define DBCR1_IAC34MX 0x000000C0 /* Instr Addr 3-4 range eXclusive */
476#define DBCR1_IAC34AT 0x00000001 /* Instr Addr 3-4 range Toggle */ 476#define DBCR1_IAC34AT 0x00000001 /* Instr Addr 3-4 range Toggle */
477 477
478#define dbcr_iac_range(task) ((task)->thread.dbcr1) 478#define dbcr_iac_range(task) ((task)->thread.debug.dbcr1)
479#define DBCR_IAC12I DBCR1_IAC12M /* Range Inclusive */ 479#define DBCR_IAC12I DBCR1_IAC12M /* Range Inclusive */
480#define DBCR_IAC12X DBCR1_IAC12MX /* Range Exclusive */ 480#define DBCR_IAC12X DBCR1_IAC12MX /* Range Exclusive */
481#define DBCR_IAC12MODE DBCR1_IAC12MX /* IAC 1-2 Mode Bits */ 481#define DBCR_IAC12MODE DBCR1_IAC12MX /* IAC 1-2 Mode Bits */
diff --git a/arch/powerpc/include/asm/scom.h b/arch/powerpc/include/asm/scom.h
index 0cabfd7bc2d1..f5cde45b1161 100644
--- a/arch/powerpc/include/asm/scom.h
+++ b/arch/powerpc/include/asm/scom.h
@@ -54,8 +54,8 @@ struct scom_controller {
54 scom_map_t (*map)(struct device_node *ctrl_dev, u64 reg, u64 count); 54 scom_map_t (*map)(struct device_node *ctrl_dev, u64 reg, u64 count);
55 void (*unmap)(scom_map_t map); 55 void (*unmap)(scom_map_t map);
56 56
57 u64 (*read)(scom_map_t map, u32 reg); 57 int (*read)(scom_map_t map, u64 reg, u64 *value);
58 void (*write)(scom_map_t map, u32 reg, u64 value); 58 int (*write)(scom_map_t map, u64 reg, u64 value);
59}; 59};
60 60
61extern const struct scom_controller *scom_controller; 61extern const struct scom_controller *scom_controller;
@@ -133,10 +133,18 @@ static inline void scom_unmap(scom_map_t map)
133 * scom_read - Read a SCOM register 133 * scom_read - Read a SCOM register
134 * @map: Result of scom_map 134 * @map: Result of scom_map
135 * @reg: Register index within that map 135 * @reg: Register index within that map
136 * @value: Updated with the value read
137 *
138 * Returns 0 (success) or a negative error code
136 */ 139 */
137static inline u64 scom_read(scom_map_t map, u32 reg) 140static inline int scom_read(scom_map_t map, u64 reg, u64 *value)
138{ 141{
139 return scom_controller->read(map, reg); 142 int rc;
143
144 rc = scom_controller->read(map, reg, value);
145 if (rc)
146 *value = 0xfffffffffffffffful;
147 return rc;
140} 148}
141 149
142/** 150/**
@@ -144,12 +152,15 @@ static inline u64 scom_read(scom_map_t map, u32 reg)
144 * @map: Result of scom_map 152 * @map: Result of scom_map
145 * @reg: Register index within that map 153 * @reg: Register index within that map
146 * @value: Value to write 154 * @value: Value to write
155 *
156 * Returns 0 (success) or a negative error code
147 */ 157 */
148static inline void scom_write(scom_map_t map, u32 reg, u64 value) 158static inline int scom_write(scom_map_t map, u64 reg, u64 value)
149{ 159{
150 scom_controller->write(map, reg, value); 160 return scom_controller->write(map, reg, value);
151} 161}
152 162
163
153#endif /* CONFIG_PPC_SCOM */ 164#endif /* CONFIG_PPC_SCOM */
154#endif /* __ASSEMBLY__ */ 165#endif /* __ASSEMBLY__ */
155#endif /* __KERNEL__ */ 166#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h
index d3ca85529b8b..703a8412dac2 100644
--- a/arch/powerpc/include/asm/setup.h
+++ b/arch/powerpc/include/asm/setup.h
@@ -23,6 +23,10 @@ extern void reloc_got2(unsigned long);
23 23
24#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x))) 24#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
25 25
26void check_for_initrd(void);
27void do_init_bootmem(void);
28void setup_panic(void);
29
26#endif /* !__ASSEMBLY__ */ 30#endif /* !__ASSEMBLY__ */
27 31
28#endif /* _ASM_POWERPC_SETUP_H */ 32#endif /* _ASM_POWERPC_SETUP_H */
diff --git a/arch/powerpc/include/asm/sfp-machine.h b/arch/powerpc/include/asm/sfp-machine.h
index 3a7a67a0d006..d89beaba26ff 100644
--- a/arch/powerpc/include/asm/sfp-machine.h
+++ b/arch/powerpc/include/asm/sfp-machine.h
@@ -125,7 +125,7 @@
125#define FP_EX_DIVZERO (1 << (31 - 5)) 125#define FP_EX_DIVZERO (1 << (31 - 5))
126#define FP_EX_INEXACT (1 << (31 - 6)) 126#define FP_EX_INEXACT (1 << (31 - 6))
127 127
128#define __FPU_FPSCR (current->thread.fpscr.val) 128#define __FPU_FPSCR (current->thread.fp_state.fpscr)
129 129
130/* We only actually write to the destination register 130/* We only actually write to the destination register
131 * if exceptions signalled (if any) will not trap. 131 * if exceptions signalled (if any) will not trap.
diff --git a/arch/powerpc/include/asm/spu.h b/arch/powerpc/include/asm/spu.h
index 93f280e23279..37b7ca39ec9f 100644
--- a/arch/powerpc/include/asm/spu.h
+++ b/arch/powerpc/include/asm/spu.h
@@ -235,6 +235,7 @@ extern long spu_sys_callback(struct spu_syscall_block *s);
235 235
236/* syscalls implemented in spufs */ 236/* syscalls implemented in spufs */
237struct file; 237struct file;
238struct coredump_params;
238struct spufs_calls { 239struct spufs_calls {
239 long (*create_thread)(const char __user *name, 240 long (*create_thread)(const char __user *name,
240 unsigned int flags, umode_t mode, 241 unsigned int flags, umode_t mode,
@@ -242,7 +243,7 @@ struct spufs_calls {
242 long (*spu_run)(struct file *filp, __u32 __user *unpc, 243 long (*spu_run)(struct file *filp, __u32 __user *unpc,
243 __u32 __user *ustatus); 244 __u32 __user *ustatus);
244 int (*coredump_extra_notes_size)(void); 245 int (*coredump_extra_notes_size)(void);
245 int (*coredump_extra_notes_write)(struct file *file, loff_t *foffset); 246 int (*coredump_extra_notes_write)(struct coredump_params *cprm);
246 void (*notify_spus_active)(void); 247 void (*notify_spus_active)(void);
247 struct module *owner; 248 struct module *owner;
248}; 249};
diff --git a/arch/powerpc/include/asm/string.h b/arch/powerpc/include/asm/string.h
index e40010abcaf1..0dffad6bcc84 100644
--- a/arch/powerpc/include/asm/string.h
+++ b/arch/powerpc/include/asm/string.h
@@ -10,7 +10,9 @@
10#define __HAVE_ARCH_STRNCMP 10#define __HAVE_ARCH_STRNCMP
11#define __HAVE_ARCH_STRCAT 11#define __HAVE_ARCH_STRCAT
12#define __HAVE_ARCH_MEMSET 12#define __HAVE_ARCH_MEMSET
13#ifdef __BIG_ENDIAN__
13#define __HAVE_ARCH_MEMCPY 14#define __HAVE_ARCH_MEMCPY
15#endif
14#define __HAVE_ARCH_MEMMOVE 16#define __HAVE_ARCH_MEMMOVE
15#define __HAVE_ARCH_MEMCMP 17#define __HAVE_ARCH_MEMCMP
16#define __HAVE_ARCH_MEMCHR 18#define __HAVE_ARCH_MEMCHR
@@ -22,7 +24,9 @@ extern int strcmp(const char *,const char *);
22extern int strncmp(const char *, const char *, __kernel_size_t); 24extern int strncmp(const char *, const char *, __kernel_size_t);
23extern char * strcat(char *, const char *); 25extern char * strcat(char *, const char *);
24extern void * memset(void *,int,__kernel_size_t); 26extern void * memset(void *,int,__kernel_size_t);
27#ifdef __BIG_ENDIAN__
25extern void * memcpy(void *,const void *,__kernel_size_t); 28extern void * memcpy(void *,const void *,__kernel_size_t);
29#endif
26extern void * memmove(void *,const void *,__kernel_size_t); 30extern void * memmove(void *,const void *,__kernel_size_t);
27extern int memcmp(const void *,const void *,__kernel_size_t); 31extern int memcmp(const void *,const void *,__kernel_size_t);
28extern void * memchr(const void *,int,__kernel_size_t); 32extern void * memchr(const void *,int,__kernel_size_t);
diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
index 2be5618cdec6..9ee12610af02 100644
--- a/arch/powerpc/include/asm/switch_to.h
+++ b/arch/powerpc/include/asm/switch_to.h
@@ -35,6 +35,7 @@ extern void giveup_vsx(struct task_struct *);
35extern void enable_kernel_spe(void); 35extern void enable_kernel_spe(void);
36extern void giveup_spe(struct task_struct *); 36extern void giveup_spe(struct task_struct *);
37extern void load_up_spe(struct task_struct *); 37extern void load_up_spe(struct task_struct *);
38extern void switch_booke_debug_regs(struct thread_struct *new_thread);
38 39
39#ifndef CONFIG_SMP 40#ifndef CONFIG_SMP
40extern void discard_lazy_cpu_state(void); 41extern void discard_lazy_cpu_state(void);
diff --git a/arch/powerpc/include/asm/uprobes.h b/arch/powerpc/include/asm/uprobes.h
index 23016020915e..75c6ecdb8f37 100644
--- a/arch/powerpc/include/asm/uprobes.h
+++ b/arch/powerpc/include/asm/uprobes.h
@@ -37,6 +37,7 @@ typedef ppc_opcode_t uprobe_opcode_t;
37struct arch_uprobe { 37struct arch_uprobe {
38 union { 38 union {
39 u8 insn[MAX_UINSN_BYTES]; 39 u8 insn[MAX_UINSN_BYTES];
40 u8 ixol[MAX_UINSN_BYTES];
40 u32 ainsn; 41 u32 ainsn;
41 }; 42 };
42}; 43};
@@ -45,11 +46,4 @@ struct arch_uprobe_task {
45 unsigned long saved_trap_nr; 46 unsigned long saved_trap_nr;
46}; 47};
47 48
48extern int arch_uprobe_analyze_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long addr);
49extern int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs);
50extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);
51extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
52extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
53extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
54extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
55#endif /* _ASM_UPROBES_H */ 49#endif /* _ASM_UPROBES_H */
diff --git a/arch/powerpc/include/asm/word-at-a-time.h b/arch/powerpc/include/asm/word-at-a-time.h
index d0b6d4ac6dda..9a5c928bb3c6 100644
--- a/arch/powerpc/include/asm/word-at-a-time.h
+++ b/arch/powerpc/include/asm/word-at-a-time.h
@@ -8,6 +8,8 @@
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <asm/asm-compat.h> 9#include <asm/asm-compat.h>
10 10
11#ifdef __BIG_ENDIAN__
12
11struct word_at_a_time { 13struct word_at_a_time {
12 const unsigned long high_bits, low_bits; 14 const unsigned long high_bits, low_bits;
13}; 15};
@@ -38,4 +40,80 @@ static inline bool has_zero(unsigned long val, unsigned long *data, const struct
38 return (val + c->high_bits) & ~rhs; 40 return (val + c->high_bits) & ~rhs;
39} 41}
40 42
43#else
44
45struct word_at_a_time {
46 const unsigned long one_bits, high_bits;
47};
48
49#define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE(0x01), REPEAT_BYTE(0x80) }
50
51#ifdef CONFIG_64BIT
52
53/* Alan Modra's little-endian strlen tail for 64-bit */
54#define create_zero_mask(mask) (mask)
55
56static inline unsigned long find_zero(unsigned long mask)
57{
58 unsigned long leading_zero_bits;
59 long trailing_zero_bit_mask;
60
61 asm ("addi %1,%2,-1\n\t"
62 "andc %1,%1,%2\n\t"
63 "popcntd %0,%1"
64 : "=r" (leading_zero_bits), "=&r" (trailing_zero_bit_mask)
65 : "r" (mask));
66 return leading_zero_bits >> 3;
67}
68
69#else /* 32-bit case */
70
71/*
72 * This is largely generic for little-endian machines, but the
73 * optimal byte mask counting is probably going to be something
74 * that is architecture-specific. If you have a reliably fast
75 * bit count instruction, that might be better than the multiply
76 * and shift, for example.
77 */
78
79/* Carl Chatfield / Jan Achrenius G+ version for 32-bit */
80static inline long count_masked_bytes(long mask)
81{
82 /* (000000 0000ff 00ffff ffffff) -> ( 1 1 2 3 ) */
83 long a = (0x0ff0001+mask) >> 23;
84 /* Fix the 1 for 00 case */
85 return a & mask;
86}
87
88static inline unsigned long create_zero_mask(unsigned long bits)
89{
90 bits = (bits - 1) & ~bits;
91 return bits >> 7;
92}
93
94static inline unsigned long find_zero(unsigned long mask)
95{
96 return count_masked_bytes(mask);
97}
98
99#endif
100
101/* Return nonzero if it has a zero */
102static inline unsigned long has_zero(unsigned long a, unsigned long *bits, const struct word_at_a_time *c)
103{
104 unsigned long mask = ((a - c->one_bits) & ~a) & c->high_bits;
105 *bits = mask;
106 return mask;
107}
108
109static inline unsigned long prep_zero_mask(unsigned long a, unsigned long bits, const struct word_at_a_time *c)
110{
111 return bits;
112}
113
114/* The mask we created is directly usable as a bytemask */
115#define zero_bytemask(mask) (mask)
116
117#endif
118
41#endif /* _ASM_WORD_AT_A_TIME_H */ 119#endif /* _ASM_WORD_AT_A_TIME_H */
diff --git a/arch/powerpc/include/asm/xor.h b/arch/powerpc/include/asm/xor.h
index c82eb12a5b18..0abb97f3be10 100644
--- a/arch/powerpc/include/asm/xor.h
+++ b/arch/powerpc/include/asm/xor.h
@@ -1 +1,68 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 *
16 * Copyright (C) IBM Corporation, 2012
17 *
18 * Author: Anton Blanchard <anton@au.ibm.com>
19 */
20#ifndef _ASM_POWERPC_XOR_H
21#define _ASM_POWERPC_XOR_H
22
23#ifdef CONFIG_ALTIVEC
24
25#include <asm/cputable.h>
26
27void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
28 unsigned long *v2_in);
29void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
30 unsigned long *v2_in, unsigned long *v3_in);
31void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
32 unsigned long *v2_in, unsigned long *v3_in,
33 unsigned long *v4_in);
34void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
35 unsigned long *v2_in, unsigned long *v3_in,
36 unsigned long *v4_in, unsigned long *v5_in);
37
38static struct xor_block_template xor_block_altivec = {
39 .name = "altivec",
40 .do_2 = xor_altivec_2,
41 .do_3 = xor_altivec_3,
42 .do_4 = xor_altivec_4,
43 .do_5 = xor_altivec_5,
44};
45
46#define XOR_SPEED_ALTIVEC() \
47 do { \
48 if (cpu_has_feature(CPU_FTR_ALTIVEC)) \
49 xor_speed(&xor_block_altivec); \
50 } while (0)
51#else
52#define XOR_SPEED_ALTIVEC()
53#endif
54
55/* Also try the generic routines. */
1#include <asm-generic/xor.h> 56#include <asm-generic/xor.h>
57
58#undef XOR_TRY_TEMPLATES
59#define XOR_TRY_TEMPLATES \
60do { \
61 xor_speed(&xor_block_8regs); \
62 xor_speed(&xor_block_8regs_p); \
63 xor_speed(&xor_block_32regs); \
64 xor_speed(&xor_block_32regs_p); \
65 XOR_SPEED_ALTIVEC(); \
66} while (0)
67
68#endif /* _ASM_POWERPC_XOR_H */
diff --git a/arch/powerpc/include/uapi/asm/byteorder.h b/arch/powerpc/include/uapi/asm/byteorder.h
index aa6cc4fac965..ca931d074000 100644
--- a/arch/powerpc/include/uapi/asm/byteorder.h
+++ b/arch/powerpc/include/uapi/asm/byteorder.h
@@ -7,6 +7,10 @@
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#ifdef __LITTLE_ENDIAN__
11#include <linux/byteorder/little_endian.h>
12#else
10#include <linux/byteorder/big_endian.h> 13#include <linux/byteorder/big_endian.h>
14#endif
11 15
12#endif /* _ASM_POWERPC_BYTEORDER_H */ 16#endif /* _ASM_POWERPC_BYTEORDER_H */
diff --git a/arch/powerpc/include/uapi/asm/kvm.h b/arch/powerpc/include/uapi/asm/kvm.h
index 0fb1a6e9ff90..6836ec79a830 100644
--- a/arch/powerpc/include/uapi/asm/kvm.h
+++ b/arch/powerpc/include/uapi/asm/kvm.h
@@ -27,6 +27,7 @@
27#define __KVM_HAVE_PPC_SMT 27#define __KVM_HAVE_PPC_SMT
28#define __KVM_HAVE_IRQCHIP 28#define __KVM_HAVE_IRQCHIP
29#define __KVM_HAVE_IRQ_LINE 29#define __KVM_HAVE_IRQ_LINE
30#define __KVM_HAVE_GUEST_DEBUG
30 31
31struct kvm_regs { 32struct kvm_regs {
32 __u64 pc; 33 __u64 pc;
@@ -269,7 +270,24 @@ struct kvm_fpu {
269 __u64 fpr[32]; 270 __u64 fpr[32];
270}; 271};
271 272
273/*
274 * Defines for h/w breakpoint, watchpoint (read, write or both) and
275 * software breakpoint.
276 * These are used as "type" in KVM_SET_GUEST_DEBUG ioctl and "status"
277 * for KVM_DEBUG_EXIT.
278 */
279#define KVMPPC_DEBUG_NONE 0x0
280#define KVMPPC_DEBUG_BREAKPOINT (1UL << 1)
281#define KVMPPC_DEBUG_WATCH_WRITE (1UL << 2)
282#define KVMPPC_DEBUG_WATCH_READ (1UL << 3)
272struct kvm_debug_exit_arch { 283struct kvm_debug_exit_arch {
284 __u64 address;
285 /*
286 * exiting to userspace because of h/w breakpoint, watchpoint
287 * (read, write or both) and software breakpoint.
288 */
289 __u32 status;
290 __u32 reserved;
273}; 291};
274 292
275/* for KVM_SET_GUEST_DEBUG */ 293/* for KVM_SET_GUEST_DEBUG */
@@ -281,10 +299,6 @@ struct kvm_guest_debug_arch {
281 * Type denotes h/w breakpoint, read watchpoint, write 299 * Type denotes h/w breakpoint, read watchpoint, write
282 * watchpoint or watchpoint (both read and write). 300 * watchpoint or watchpoint (both read and write).
283 */ 301 */
284#define KVMPPC_DEBUG_NONE 0x0
285#define KVMPPC_DEBUG_BREAKPOINT (1UL << 1)
286#define KVMPPC_DEBUG_WATCH_WRITE (1UL << 2)
287#define KVMPPC_DEBUG_WATCH_READ (1UL << 3)
288 __u32 type; 302 __u32 type;
289 __u32 reserved; 303 __u32 reserved;
290 } bp[16]; 304 } bp[16];
@@ -429,6 +443,11 @@ struct kvm_get_htab_header {
429#define KVM_REG_PPC_MMCR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x10) 443#define KVM_REG_PPC_MMCR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x10)
430#define KVM_REG_PPC_MMCR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x11) 444#define KVM_REG_PPC_MMCR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x11)
431#define KVM_REG_PPC_MMCRA (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x12) 445#define KVM_REG_PPC_MMCRA (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x12)
446#define KVM_REG_PPC_MMCR2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x13)
447#define KVM_REG_PPC_MMCRS (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x14)
448#define KVM_REG_PPC_SIAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x15)
449#define KVM_REG_PPC_SDAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x16)
450#define KVM_REG_PPC_SIER (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x17)
432 451
433#define KVM_REG_PPC_PMC1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x18) 452#define KVM_REG_PPC_PMC1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x18)
434#define KVM_REG_PPC_PMC2 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x19) 453#define KVM_REG_PPC_PMC2 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x19)
@@ -499,6 +518,65 @@ struct kvm_get_htab_header {
499#define KVM_REG_PPC_TLB3PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9a) 518#define KVM_REG_PPC_TLB3PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9a)
500#define KVM_REG_PPC_EPTCFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9b) 519#define KVM_REG_PPC_EPTCFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9b)
501 520
521/* Timebase offset */
522#define KVM_REG_PPC_TB_OFFSET (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9c)
523
524/* POWER8 registers */
525#define KVM_REG_PPC_SPMC1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9d)
526#define KVM_REG_PPC_SPMC2 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9e)
527#define KVM_REG_PPC_IAMR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9f)
528#define KVM_REG_PPC_TFHAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa0)
529#define KVM_REG_PPC_TFIAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa1)
530#define KVM_REG_PPC_TEXASR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa2)
531#define KVM_REG_PPC_FSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa3)
532#define KVM_REG_PPC_PSPB (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xa4)
533#define KVM_REG_PPC_EBBHR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa5)
534#define KVM_REG_PPC_EBBRR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa6)
535#define KVM_REG_PPC_BESCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa7)
536#define KVM_REG_PPC_TAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa8)
537#define KVM_REG_PPC_DPDES (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa9)
538#define KVM_REG_PPC_DAWR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xaa)
539#define KVM_REG_PPC_DAWRX (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xab)
540#define KVM_REG_PPC_CIABR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xac)
541#define KVM_REG_PPC_IC (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xad)
542#define KVM_REG_PPC_VTB (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xae)
543#define KVM_REG_PPC_CSIGR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xaf)
544#define KVM_REG_PPC_TACR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb0)
545#define KVM_REG_PPC_TCSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb1)
546#define KVM_REG_PPC_PID (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb2)
547#define KVM_REG_PPC_ACOP (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb3)
548
549#define KVM_REG_PPC_VRSAVE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb4)
550#define KVM_REG_PPC_LPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb5)
551#define KVM_REG_PPC_PPR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb6)
552
553/* Architecture compatibility level */
554#define KVM_REG_PPC_ARCH_COMPAT (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb7)
555
556/* Transactional Memory checkpointed state:
557 * This is all GPRs, all VSX regs and a subset of SPRs
558 */
559#define KVM_REG_PPC_TM (KVM_REG_PPC | 0x80000000)
560/* TM GPRs */
561#define KVM_REG_PPC_TM_GPR0 (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0)
562#define KVM_REG_PPC_TM_GPR(n) (KVM_REG_PPC_TM_GPR0 + (n))
563#define KVM_REG_PPC_TM_GPR31 (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x1f)
564/* TM VSX */
565#define KVM_REG_PPC_TM_VSR0 (KVM_REG_PPC_TM | KVM_REG_SIZE_U128 | 0x20)
566#define KVM_REG_PPC_TM_VSR(n) (KVM_REG_PPC_TM_VSR0 + (n))
567#define KVM_REG_PPC_TM_VSR63 (KVM_REG_PPC_TM | KVM_REG_SIZE_U128 | 0x5f)
568/* TM SPRS */
569#define KVM_REG_PPC_TM_CR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x60)
570#define KVM_REG_PPC_TM_LR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x61)
571#define KVM_REG_PPC_TM_CTR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x62)
572#define KVM_REG_PPC_TM_FPSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x63)
573#define KVM_REG_PPC_TM_AMR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x64)
574#define KVM_REG_PPC_TM_PPR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x65)
575#define KVM_REG_PPC_TM_VRSAVE (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x66)
576#define KVM_REG_PPC_TM_VSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U32 | 0x67)
577#define KVM_REG_PPC_TM_DSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x68)
578#define KVM_REG_PPC_TM_TAR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x69)
579
502/* PPC64 eXternal Interrupt Controller Specification */ 580/* PPC64 eXternal Interrupt Controller Specification */
503#define KVM_DEV_XICS_GRP_SOURCES 1 /* 64-bit source attributes */ 581#define KVM_DEV_XICS_GRP_SOURCES 1 /* 64-bit source attributes */
504 582
diff --git a/arch/powerpc/include/uapi/asm/socket.h b/arch/powerpc/include/uapi/asm/socket.h
index a6d74467c9ed..fa698324a1fd 100644
--- a/arch/powerpc/include/uapi/asm/socket.h
+++ b/arch/powerpc/include/uapi/asm/socket.h
@@ -83,4 +83,6 @@
83 83
84#define SO_BUSY_POLL 46 84#define SO_BUSY_POLL 46
85 85
86#define SO_MAX_PACING_RATE 47
87
86#endif /* _ASM_POWERPC_SOCKET_H */ 88#endif /* _ASM_POWERPC_SOCKET_H */
diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index a27ccd5dc6b9..de91f3ae631e 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -54,8 +54,6 @@ struct aligninfo {
54/* DSISR bits reported for a DCBZ instruction: */ 54/* DSISR bits reported for a DCBZ instruction: */
55#define DCBZ 0x5f /* 8xx/82xx dcbz faults when cache not enabled */ 55#define DCBZ 0x5f /* 8xx/82xx dcbz faults when cache not enabled */
56 56
57#define SWAP(a, b) (t = (a), (a) = (b), (b) = t)
58
59/* 57/*
60 * The PowerPC stores certain bits of the instruction that caused the 58 * The PowerPC stores certain bits of the instruction that caused the
61 * alignment exception in the DSISR register. This array maps those 59 * alignment exception in the DSISR register. This array maps those
@@ -256,11 +254,17 @@ static int emulate_dcbz(struct pt_regs *regs, unsigned char __user *addr)
256 * bottom 4 bytes of each register, and the loads clear the 254 * bottom 4 bytes of each register, and the loads clear the
257 * top 4 bytes of the affected register. 255 * top 4 bytes of the affected register.
258 */ 256 */
257#ifdef __BIG_ENDIAN__
259#ifdef CONFIG_PPC64 258#ifdef CONFIG_PPC64
260#define REG_BYTE(rp, i) *((u8 *)((rp) + ((i) >> 2)) + ((i) & 3) + 4) 259#define REG_BYTE(rp, i) *((u8 *)((rp) + ((i) >> 2)) + ((i) & 3) + 4)
261#else 260#else
262#define REG_BYTE(rp, i) *((u8 *)(rp) + (i)) 261#define REG_BYTE(rp, i) *((u8 *)(rp) + (i))
263#endif 262#endif
263#endif
264
265#ifdef __LITTLE_ENDIAN__
266#define REG_BYTE(rp, i) (*(((u8 *)((rp) + ((i)>>2)) + ((i)&3))))
267#endif
264 268
265#define SWIZ_PTR(p) ((unsigned char __user *)((p) ^ swiz)) 269#define SWIZ_PTR(p) ((unsigned char __user *)((p) ^ swiz))
266 270
@@ -305,6 +309,15 @@ static int emulate_multiple(struct pt_regs *regs, unsigned char __user *addr,
305 nb0 = nb + reg * 4 - 128; 309 nb0 = nb + reg * 4 - 128;
306 nb = 128 - reg * 4; 310 nb = 128 - reg * 4;
307 } 311 }
312#ifdef __LITTLE_ENDIAN__
313 /*
314 * String instructions are endian neutral but the code
315 * below is not. Force byte swapping on so that the
316 * effects of swizzling are undone in the load/store
317 * loops below.
318 */
319 flags ^= SW;
320#endif
308 } else { 321 } else {
309 /* lwm, stmw */ 322 /* lwm, stmw */
310 nb = (32 - reg) * 4; 323 nb = (32 - reg) * 4;
@@ -458,7 +471,7 @@ static struct aligninfo spe_aligninfo[32] = {
458static int emulate_spe(struct pt_regs *regs, unsigned int reg, 471static int emulate_spe(struct pt_regs *regs, unsigned int reg,
459 unsigned int instr) 472 unsigned int instr)
460{ 473{
461 int t, ret; 474 int ret;
462 union { 475 union {
463 u64 ll; 476 u64 ll;
464 u32 w[2]; 477 u32 w[2];
@@ -581,24 +594,18 @@ static int emulate_spe(struct pt_regs *regs, unsigned int reg,
581 if (flags & SW) { 594 if (flags & SW) {
582 switch (flags & 0xf0) { 595 switch (flags & 0xf0) {
583 case E8: 596 case E8:
584 SWAP(data.v[0], data.v[7]); 597 data.ll = swab64(data.ll);
585 SWAP(data.v[1], data.v[6]);
586 SWAP(data.v[2], data.v[5]);
587 SWAP(data.v[3], data.v[4]);
588 break; 598 break;
589 case E4: 599 case E4:
590 600 data.w[0] = swab32(data.w[0]);
591 SWAP(data.v[0], data.v[3]); 601 data.w[1] = swab32(data.w[1]);
592 SWAP(data.v[1], data.v[2]);
593 SWAP(data.v[4], data.v[7]);
594 SWAP(data.v[5], data.v[6]);
595 break; 602 break;
596 /* Its half word endian */ 603 /* Its half word endian */
597 default: 604 default:
598 SWAP(data.v[0], data.v[1]); 605 data.h[0] = swab16(data.h[0]);
599 SWAP(data.v[2], data.v[3]); 606 data.h[1] = swab16(data.h[1]);
600 SWAP(data.v[4], data.v[5]); 607 data.h[2] = swab16(data.h[2]);
601 SWAP(data.v[6], data.v[7]); 608 data.h[3] = swab16(data.h[3]);
602 break; 609 break;
603 } 610 }
604 } 611 }
@@ -658,14 +665,31 @@ static int emulate_vsx(unsigned char __user *addr, unsigned int reg,
658 flush_vsx_to_thread(current); 665 flush_vsx_to_thread(current);
659 666
660 if (reg < 32) 667 if (reg < 32)
661 ptr = (char *) &current->thread.TS_FPR(reg); 668 ptr = (char *) &current->thread.fp_state.fpr[reg][0];
662 else 669 else
663 ptr = (char *) &current->thread.vr[reg - 32]; 670 ptr = (char *) &current->thread.vr_state.vr[reg - 32];
664 671
665 lptr = (unsigned long *) ptr; 672 lptr = (unsigned long *) ptr;
666 673
674#ifdef __LITTLE_ENDIAN__
675 if (flags & SW) {
676 elsize = length;
677 sw = length-1;
678 } else {
679 /*
680 * The elements are BE ordered, even in LE mode, so process
681 * them in reverse order.
682 */
683 addr += length - elsize;
684
685 /* 8 byte memory accesses go in the top 8 bytes of the VR */
686 if (length == 8)
687 ptr += 8;
688 }
689#else
667 if (flags & SW) 690 if (flags & SW)
668 sw = elsize-1; 691 sw = elsize-1;
692#endif
669 693
670 for (j = 0; j < length; j += elsize) { 694 for (j = 0; j < length; j += elsize) {
671 for (i = 0; i < elsize; ++i) { 695 for (i = 0; i < elsize; ++i) {
@@ -675,19 +699,31 @@ static int emulate_vsx(unsigned char __user *addr, unsigned int reg,
675 ret |= __get_user(ptr[i^sw], addr + i); 699 ret |= __get_user(ptr[i^sw], addr + i);
676 } 700 }
677 ptr += elsize; 701 ptr += elsize;
702#ifdef __LITTLE_ENDIAN__
703 addr -= elsize;
704#else
678 addr += elsize; 705 addr += elsize;
706#endif
679 } 707 }
680 708
709#ifdef __BIG_ENDIAN__
710#define VSX_HI 0
711#define VSX_LO 1
712#else
713#define VSX_HI 1
714#define VSX_LO 0
715#endif
716
681 if (!ret) { 717 if (!ret) {
682 if (flags & U) 718 if (flags & U)
683 regs->gpr[areg] = regs->dar; 719 regs->gpr[areg] = regs->dar;
684 720
685 /* Splat load copies the same data to top and bottom 8 bytes */ 721 /* Splat load copies the same data to top and bottom 8 bytes */
686 if (flags & SPLT) 722 if (flags & SPLT)
687 lptr[1] = lptr[0]; 723 lptr[VSX_LO] = lptr[VSX_HI];
688 /* For 8 byte loads, zero the top 8 bytes */ 724 /* For 8 byte loads, zero the low 8 bytes */
689 else if (!(flags & ST) && (8 == length)) 725 else if (!(flags & ST) && (8 == length))
690 lptr[1] = 0; 726 lptr[VSX_LO] = 0;
691 } else 727 } else
692 return -EFAULT; 728 return -EFAULT;
693 729
@@ -710,18 +746,28 @@ int fix_alignment(struct pt_regs *regs)
710 unsigned int dsisr; 746 unsigned int dsisr;
711 unsigned char __user *addr; 747 unsigned char __user *addr;
712 unsigned long p, swiz; 748 unsigned long p, swiz;
713 int ret, t; 749 int ret, i;
714 union { 750 union data {
715 u64 ll; 751 u64 ll;
716 double dd; 752 double dd;
717 unsigned char v[8]; 753 unsigned char v[8];
718 struct { 754 struct {
755#ifdef __LITTLE_ENDIAN__
756 int low32;
757 unsigned hi32;
758#else
719 unsigned hi32; 759 unsigned hi32;
720 int low32; 760 int low32;
761#endif
721 } x32; 762 } x32;
722 struct { 763 struct {
764#ifdef __LITTLE_ENDIAN__
765 short low16;
766 unsigned char hi48[6];
767#else
723 unsigned char hi48[6]; 768 unsigned char hi48[6];
724 short low16; 769 short low16;
770#endif
725 } x16; 771 } x16;
726 } data; 772 } data;
727 773
@@ -780,8 +826,9 @@ int fix_alignment(struct pt_regs *regs)
780 826
781 /* Byteswap little endian loads and stores */ 827 /* Byteswap little endian loads and stores */
782 swiz = 0; 828 swiz = 0;
783 if (regs->msr & MSR_LE) { 829 if ((regs->msr & MSR_LE) != (MSR_KERNEL & MSR_LE)) {
784 flags ^= SW; 830 flags ^= SW;
831#ifdef __BIG_ENDIAN__
785 /* 832 /*
786 * So-called "PowerPC little endian" mode works by 833 * So-called "PowerPC little endian" mode works by
787 * swizzling addresses rather than by actually doing 834 * swizzling addresses rather than by actually doing
@@ -794,6 +841,7 @@ int fix_alignment(struct pt_regs *regs)
794 */ 841 */
795 if (cpu_has_feature(CPU_FTR_PPC_LE)) 842 if (cpu_has_feature(CPU_FTR_PPC_LE))
796 swiz = 7; 843 swiz = 7;
844#endif
797 } 845 }
798 846
799 /* DAR has the operand effective address */ 847 /* DAR has the operand effective address */
@@ -818,7 +866,7 @@ int fix_alignment(struct pt_regs *regs)
818 elsize = 8; 866 elsize = 8;
819 867
820 flags = 0; 868 flags = 0;
821 if (regs->msr & MSR_LE) 869 if ((regs->msr & MSR_LE) != (MSR_KERNEL & MSR_LE))
822 flags |= SW; 870 flags |= SW;
823 if (instruction & 0x100) 871 if (instruction & 0x100)
824 flags |= ST; 872 flags |= ST;
@@ -878,32 +926,36 @@ int fix_alignment(struct pt_regs *regs)
878 * get it from register values 926 * get it from register values
879 */ 927 */
880 if (!(flags & ST)) { 928 if (!(flags & ST)) {
881 data.ll = 0; 929 unsigned int start = 0;
882 ret = 0; 930
883 p = (unsigned long) addr;
884 switch (nb) { 931 switch (nb) {
885 case 8:
886 ret |= __get_user_inatomic(data.v[0], SWIZ_PTR(p++));
887 ret |= __get_user_inatomic(data.v[1], SWIZ_PTR(p++));
888 ret |= __get_user_inatomic(data.v[2], SWIZ_PTR(p++));
889 ret |= __get_user_inatomic(data.v[3], SWIZ_PTR(p++));
890 case 4: 932 case 4:
891 ret |= __get_user_inatomic(data.v[4], SWIZ_PTR(p++)); 933 start = offsetof(union data, x32.low32);
892 ret |= __get_user_inatomic(data.v[5], SWIZ_PTR(p++)); 934 break;
893 case 2: 935 case 2:
894 ret |= __get_user_inatomic(data.v[6], SWIZ_PTR(p++)); 936 start = offsetof(union data, x16.low16);
895 ret |= __get_user_inatomic(data.v[7], SWIZ_PTR(p++)); 937 break;
896 if (unlikely(ret))
897 return -EFAULT;
898 } 938 }
939
940 data.ll = 0;
941 ret = 0;
942 p = (unsigned long)addr;
943
944 for (i = 0; i < nb; i++)
945 ret |= __get_user_inatomic(data.v[start + i],
946 SWIZ_PTR(p++));
947
948 if (unlikely(ret))
949 return -EFAULT;
950
899 } else if (flags & F) { 951 } else if (flags & F) {
900 data.dd = current->thread.TS_FPR(reg); 952 data.ll = current->thread.TS_FPR(reg);
901 if (flags & S) { 953 if (flags & S) {
902 /* Single-precision FP store requires conversion... */ 954 /* Single-precision FP store requires conversion... */
903#ifdef CONFIG_PPC_FPU 955#ifdef CONFIG_PPC_FPU
904 preempt_disable(); 956 preempt_disable();
905 enable_kernel_fp(); 957 enable_kernel_fp();
906 cvt_df(&data.dd, (float *)&data.v[4]); 958 cvt_df(&data.dd, (float *)&data.x32.low32);
907 preempt_enable(); 959 preempt_enable();
908#else 960#else
909 return 0; 961 return 0;
@@ -915,17 +967,13 @@ int fix_alignment(struct pt_regs *regs)
915 if (flags & SW) { 967 if (flags & SW) {
916 switch (nb) { 968 switch (nb) {
917 case 8: 969 case 8:
918 SWAP(data.v[0], data.v[7]); 970 data.ll = swab64(data.ll);
919 SWAP(data.v[1], data.v[6]);
920 SWAP(data.v[2], data.v[5]);
921 SWAP(data.v[3], data.v[4]);
922 break; 971 break;
923 case 4: 972 case 4:
924 SWAP(data.v[4], data.v[7]); 973 data.x32.low32 = swab32(data.x32.low32);
925 SWAP(data.v[5], data.v[6]);
926 break; 974 break;
927 case 2: 975 case 2:
928 SWAP(data.v[6], data.v[7]); 976 data.x16.low16 = swab16(data.x16.low16);
929 break; 977 break;
930 } 978 }
931 } 979 }
@@ -947,7 +995,7 @@ int fix_alignment(struct pt_regs *regs)
947#ifdef CONFIG_PPC_FPU 995#ifdef CONFIG_PPC_FPU
948 preempt_disable(); 996 preempt_disable();
949 enable_kernel_fp(); 997 enable_kernel_fp();
950 cvt_fd((float *)&data.v[4], &data.dd); 998 cvt_fd((float *)&data.x32.low32, &data.dd);
951 preempt_enable(); 999 preempt_enable();
952#else 1000#else
953 return 0; 1001 return 0;
@@ -957,25 +1005,28 @@ int fix_alignment(struct pt_regs *regs)
957 1005
958 /* Store result to memory or update registers */ 1006 /* Store result to memory or update registers */
959 if (flags & ST) { 1007 if (flags & ST) {
960 ret = 0; 1008 unsigned int start = 0;
961 p = (unsigned long) addr; 1009
962 switch (nb) { 1010 switch (nb) {
963 case 8:
964 ret |= __put_user_inatomic(data.v[0], SWIZ_PTR(p++));
965 ret |= __put_user_inatomic(data.v[1], SWIZ_PTR(p++));
966 ret |= __put_user_inatomic(data.v[2], SWIZ_PTR(p++));
967 ret |= __put_user_inatomic(data.v[3], SWIZ_PTR(p++));
968 case 4: 1011 case 4:
969 ret |= __put_user_inatomic(data.v[4], SWIZ_PTR(p++)); 1012 start = offsetof(union data, x32.low32);
970 ret |= __put_user_inatomic(data.v[5], SWIZ_PTR(p++)); 1013 break;
971 case 2: 1014 case 2:
972 ret |= __put_user_inatomic(data.v[6], SWIZ_PTR(p++)); 1015 start = offsetof(union data, x16.low16);
973 ret |= __put_user_inatomic(data.v[7], SWIZ_PTR(p++)); 1016 break;
974 } 1017 }
1018
1019 ret = 0;
1020 p = (unsigned long)addr;
1021
1022 for (i = 0; i < nb; i++)
1023 ret |= __put_user_inatomic(data.v[start + i],
1024 SWIZ_PTR(p++));
1025
975 if (unlikely(ret)) 1026 if (unlikely(ret))
976 return -EFAULT; 1027 return -EFAULT;
977 } else if (flags & F) 1028 } else if (flags & F)
978 current->thread.TS_FPR(reg) = data.dd; 1029 current->thread.TS_FPR(reg) = data.ll;
979 else 1030 else
980 regs->gpr[reg] = data.ll; 1031 regs->gpr[reg] = data.ll;
981 1032
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index d8958be5f31a..2ea5cc033ec8 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -80,25 +80,27 @@ int main(void)
80 DEFINE(TASKTHREADPPR, offsetof(struct task_struct, thread.ppr)); 80 DEFINE(TASKTHREADPPR, offsetof(struct task_struct, thread.ppr));
81#else 81#else
82 DEFINE(THREAD_INFO, offsetof(struct task_struct, stack)); 82 DEFINE(THREAD_INFO, offsetof(struct task_struct, stack));
83 DEFINE(THREAD_INFO_GAP, _ALIGN_UP(sizeof(struct thread_info), 16));
84 DEFINE(KSP_LIMIT, offsetof(struct thread_struct, ksp_limit));
83#endif /* CONFIG_PPC64 */ 85#endif /* CONFIG_PPC64 */
84 86
85 DEFINE(KSP, offsetof(struct thread_struct, ksp)); 87 DEFINE(KSP, offsetof(struct thread_struct, ksp));
86 DEFINE(KSP_LIMIT, offsetof(struct thread_struct, ksp_limit));
87 DEFINE(PT_REGS, offsetof(struct thread_struct, regs)); 88 DEFINE(PT_REGS, offsetof(struct thread_struct, regs));
88#ifdef CONFIG_BOOKE 89#ifdef CONFIG_BOOKE
89 DEFINE(THREAD_NORMSAVES, offsetof(struct thread_struct, normsave[0])); 90 DEFINE(THREAD_NORMSAVES, offsetof(struct thread_struct, normsave[0]));
90#endif 91#endif
91 DEFINE(THREAD_FPEXC_MODE, offsetof(struct thread_struct, fpexc_mode)); 92 DEFINE(THREAD_FPEXC_MODE, offsetof(struct thread_struct, fpexc_mode));
92 DEFINE(THREAD_FPR0, offsetof(struct thread_struct, fpr[0])); 93 DEFINE(THREAD_FPSTATE, offsetof(struct thread_struct, fp_state));
93 DEFINE(THREAD_FPSCR, offsetof(struct thread_struct, fpscr)); 94 DEFINE(THREAD_FPSAVEAREA, offsetof(struct thread_struct, fp_save_area));
95 DEFINE(FPSTATE_FPSCR, offsetof(struct thread_fp_state, fpscr));
94#ifdef CONFIG_ALTIVEC 96#ifdef CONFIG_ALTIVEC
95 DEFINE(THREAD_VR0, offsetof(struct thread_struct, vr[0])); 97 DEFINE(THREAD_VRSTATE, offsetof(struct thread_struct, vr_state));
98 DEFINE(THREAD_VRSAVEAREA, offsetof(struct thread_struct, vr_save_area));
96 DEFINE(THREAD_VRSAVE, offsetof(struct thread_struct, vrsave)); 99 DEFINE(THREAD_VRSAVE, offsetof(struct thread_struct, vrsave));
97 DEFINE(THREAD_VSCR, offsetof(struct thread_struct, vscr));
98 DEFINE(THREAD_USED_VR, offsetof(struct thread_struct, used_vr)); 100 DEFINE(THREAD_USED_VR, offsetof(struct thread_struct, used_vr));
101 DEFINE(VRSTATE_VSCR, offsetof(struct thread_vr_state, vscr));
99#endif /* CONFIG_ALTIVEC */ 102#endif /* CONFIG_ALTIVEC */
100#ifdef CONFIG_VSX 103#ifdef CONFIG_VSX
101 DEFINE(THREAD_VSR0, offsetof(struct thread_struct, fpr));
102 DEFINE(THREAD_USED_VSR, offsetof(struct thread_struct, used_vsr)); 104 DEFINE(THREAD_USED_VSR, offsetof(struct thread_struct, used_vsr));
103#endif /* CONFIG_VSX */ 105#endif /* CONFIG_VSX */
104#ifdef CONFIG_PPC64 106#ifdef CONFIG_PPC64
@@ -113,7 +115,7 @@ int main(void)
113#endif /* CONFIG_SPE */ 115#endif /* CONFIG_SPE */
114#endif /* CONFIG_PPC64 */ 116#endif /* CONFIG_PPC64 */
115#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) 117#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
116 DEFINE(THREAD_DBCR0, offsetof(struct thread_struct, dbcr0)); 118 DEFINE(THREAD_DBCR0, offsetof(struct thread_struct, debug.dbcr0));
117#endif 119#endif
118#ifdef CONFIG_KVM_BOOK3S_32_HANDLER 120#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
119 DEFINE(THREAD_KVM_SVCPU, offsetof(struct thread_struct, kvm_shadow_vcpu)); 121 DEFINE(THREAD_KVM_SVCPU, offsetof(struct thread_struct, kvm_shadow_vcpu));
@@ -142,20 +144,12 @@ int main(void)
142 DEFINE(THREAD_TM_PPR, offsetof(struct thread_struct, tm_ppr)); 144 DEFINE(THREAD_TM_PPR, offsetof(struct thread_struct, tm_ppr));
143 DEFINE(THREAD_TM_DSCR, offsetof(struct thread_struct, tm_dscr)); 145 DEFINE(THREAD_TM_DSCR, offsetof(struct thread_struct, tm_dscr));
144 DEFINE(PT_CKPT_REGS, offsetof(struct thread_struct, ckpt_regs)); 146 DEFINE(PT_CKPT_REGS, offsetof(struct thread_struct, ckpt_regs));
145 DEFINE(THREAD_TRANSACT_VR0, offsetof(struct thread_struct, 147 DEFINE(THREAD_TRANSACT_VRSTATE, offsetof(struct thread_struct,
146 transact_vr[0])); 148 transact_vr));
147 DEFINE(THREAD_TRANSACT_VSCR, offsetof(struct thread_struct,
148 transact_vscr));
149 DEFINE(THREAD_TRANSACT_VRSAVE, offsetof(struct thread_struct, 149 DEFINE(THREAD_TRANSACT_VRSAVE, offsetof(struct thread_struct,
150 transact_vrsave)); 150 transact_vrsave));
151 DEFINE(THREAD_TRANSACT_FPR0, offsetof(struct thread_struct, 151 DEFINE(THREAD_TRANSACT_FPSTATE, offsetof(struct thread_struct,
152 transact_fpr[0])); 152 transact_fp));
153 DEFINE(THREAD_TRANSACT_FPSCR, offsetof(struct thread_struct,
154 transact_fpscr));
155#ifdef CONFIG_VSX
156 DEFINE(THREAD_TRANSACT_VSR0, offsetof(struct thread_struct,
157 transact_fpr[0]));
158#endif
159 /* Local pt_regs on stack for Transactional Memory funcs. */ 153 /* Local pt_regs on stack for Transactional Memory funcs. */
160 DEFINE(TM_FRAME_SIZE, STACK_FRAME_OVERHEAD + 154 DEFINE(TM_FRAME_SIZE, STACK_FRAME_OVERHEAD +
161 sizeof(struct pt_regs) + 16); 155 sizeof(struct pt_regs) + 16);
@@ -445,7 +439,7 @@ int main(void)
445 DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr)); 439 DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr));
446 DEFINE(VCPU_CR, offsetof(struct kvm_vcpu, arch.cr)); 440 DEFINE(VCPU_CR, offsetof(struct kvm_vcpu, arch.cr));
447 DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, arch.pc)); 441 DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, arch.pc));
448#ifdef CONFIG_KVM_BOOK3S_64_HV 442#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
449 DEFINE(VCPU_MSR, offsetof(struct kvm_vcpu, arch.shregs.msr)); 443 DEFINE(VCPU_MSR, offsetof(struct kvm_vcpu, arch.shregs.msr));
450 DEFINE(VCPU_SRR0, offsetof(struct kvm_vcpu, arch.shregs.srr0)); 444 DEFINE(VCPU_SRR0, offsetof(struct kvm_vcpu, arch.shregs.srr0));
451 DEFINE(VCPU_SRR1, offsetof(struct kvm_vcpu, arch.shregs.srr1)); 445 DEFINE(VCPU_SRR1, offsetof(struct kvm_vcpu, arch.shregs.srr1));
@@ -476,7 +470,7 @@ int main(void)
476 DEFINE(KVM_LPID, offsetof(struct kvm, arch.lpid)); 470 DEFINE(KVM_LPID, offsetof(struct kvm, arch.lpid));
477 471
478 /* book3s */ 472 /* book3s */
479#ifdef CONFIG_KVM_BOOK3S_64_HV 473#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
480 DEFINE(KVM_SDR1, offsetof(struct kvm, arch.sdr1)); 474 DEFINE(KVM_SDR1, offsetof(struct kvm, arch.sdr1));
481 DEFINE(KVM_HOST_LPID, offsetof(struct kvm, arch.host_lpid)); 475 DEFINE(KVM_HOST_LPID, offsetof(struct kvm, arch.host_lpid));
482 DEFINE(KVM_HOST_LPCR, offsetof(struct kvm, arch.host_lpcr)); 476 DEFINE(KVM_HOST_LPCR, offsetof(struct kvm, arch.host_lpcr));
@@ -508,6 +502,8 @@ int main(void)
508 DEFINE(VCPU_PRODDED, offsetof(struct kvm_vcpu, arch.prodded)); 502 DEFINE(VCPU_PRODDED, offsetof(struct kvm_vcpu, arch.prodded));
509 DEFINE(VCPU_MMCR, offsetof(struct kvm_vcpu, arch.mmcr)); 503 DEFINE(VCPU_MMCR, offsetof(struct kvm_vcpu, arch.mmcr));
510 DEFINE(VCPU_PMC, offsetof(struct kvm_vcpu, arch.pmc)); 504 DEFINE(VCPU_PMC, offsetof(struct kvm_vcpu, arch.pmc));
505 DEFINE(VCPU_SIAR, offsetof(struct kvm_vcpu, arch.siar));
506 DEFINE(VCPU_SDAR, offsetof(struct kvm_vcpu, arch.sdar));
511 DEFINE(VCPU_SLB, offsetof(struct kvm_vcpu, arch.slb)); 507 DEFINE(VCPU_SLB, offsetof(struct kvm_vcpu, arch.slb));
512 DEFINE(VCPU_SLB_MAX, offsetof(struct kvm_vcpu, arch.slb_max)); 508 DEFINE(VCPU_SLB_MAX, offsetof(struct kvm_vcpu, arch.slb_max));
513 DEFINE(VCPU_SLB_NR, offsetof(struct kvm_vcpu, arch.slb_nr)); 509 DEFINE(VCPU_SLB_NR, offsetof(struct kvm_vcpu, arch.slb_nr));
@@ -517,18 +513,22 @@ int main(void)
517 DEFINE(VCPU_TRAP, offsetof(struct kvm_vcpu, arch.trap)); 513 DEFINE(VCPU_TRAP, offsetof(struct kvm_vcpu, arch.trap));
518 DEFINE(VCPU_PTID, offsetof(struct kvm_vcpu, arch.ptid)); 514 DEFINE(VCPU_PTID, offsetof(struct kvm_vcpu, arch.ptid));
519 DEFINE(VCPU_CFAR, offsetof(struct kvm_vcpu, arch.cfar)); 515 DEFINE(VCPU_CFAR, offsetof(struct kvm_vcpu, arch.cfar));
516 DEFINE(VCPU_PPR, offsetof(struct kvm_vcpu, arch.ppr));
517 DEFINE(VCPU_SHADOW_SRR1, offsetof(struct kvm_vcpu, arch.shadow_srr1));
520 DEFINE(VCORE_ENTRY_EXIT, offsetof(struct kvmppc_vcore, entry_exit_count)); 518 DEFINE(VCORE_ENTRY_EXIT, offsetof(struct kvmppc_vcore, entry_exit_count));
521 DEFINE(VCORE_NAP_COUNT, offsetof(struct kvmppc_vcore, nap_count)); 519 DEFINE(VCORE_NAP_COUNT, offsetof(struct kvmppc_vcore, nap_count));
522 DEFINE(VCORE_IN_GUEST, offsetof(struct kvmppc_vcore, in_guest)); 520 DEFINE(VCORE_IN_GUEST, offsetof(struct kvmppc_vcore, in_guest));
523 DEFINE(VCORE_NAPPING_THREADS, offsetof(struct kvmppc_vcore, napping_threads)); 521 DEFINE(VCORE_NAPPING_THREADS, offsetof(struct kvmppc_vcore, napping_threads));
524 DEFINE(VCPU_SVCPU, offsetof(struct kvmppc_vcpu_book3s, shadow_vcpu) - 522 DEFINE(VCORE_TB_OFFSET, offsetof(struct kvmppc_vcore, tb_offset));
525 offsetof(struct kvmppc_vcpu_book3s, vcpu)); 523 DEFINE(VCORE_LPCR, offsetof(struct kvmppc_vcore, lpcr));
524 DEFINE(VCORE_PCR, offsetof(struct kvmppc_vcore, pcr));
526 DEFINE(VCPU_SLB_E, offsetof(struct kvmppc_slb, orige)); 525 DEFINE(VCPU_SLB_E, offsetof(struct kvmppc_slb, orige));
527 DEFINE(VCPU_SLB_V, offsetof(struct kvmppc_slb, origv)); 526 DEFINE(VCPU_SLB_V, offsetof(struct kvmppc_slb, origv));
528 DEFINE(VCPU_SLB_SIZE, sizeof(struct kvmppc_slb)); 527 DEFINE(VCPU_SLB_SIZE, sizeof(struct kvmppc_slb));
529 528
530#ifdef CONFIG_PPC_BOOK3S_64 529#ifdef CONFIG_PPC_BOOK3S_64
531#ifdef CONFIG_KVM_BOOK3S_PR 530#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
531 DEFINE(PACA_SVCPU, offsetof(struct paca_struct, shadow_vcpu));
532# define SVCPU_FIELD(x, f) DEFINE(x, offsetof(struct paca_struct, shadow_vcpu.f)) 532# define SVCPU_FIELD(x, f) DEFINE(x, offsetof(struct paca_struct, shadow_vcpu.f))
533#else 533#else
534# define SVCPU_FIELD(x, f) 534# define SVCPU_FIELD(x, f)
@@ -580,7 +580,7 @@ int main(void)
580 HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5); 580 HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5);
581 HSTATE_FIELD(HSTATE_NAPPING, napping); 581 HSTATE_FIELD(HSTATE_NAPPING, napping);
582 582
583#ifdef CONFIG_KVM_BOOK3S_64_HV 583#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
584 HSTATE_FIELD(HSTATE_HWTHREAD_REQ, hwthread_req); 584 HSTATE_FIELD(HSTATE_HWTHREAD_REQ, hwthread_req);
585 HSTATE_FIELD(HSTATE_HWTHREAD_STATE, hwthread_state); 585 HSTATE_FIELD(HSTATE_HWTHREAD_STATE, hwthread_state);
586 HSTATE_FIELD(HSTATE_KVM_VCPU, kvm_vcpu); 586 HSTATE_FIELD(HSTATE_KVM_VCPU, kvm_vcpu);
@@ -596,10 +596,11 @@ int main(void)
596 HSTATE_FIELD(HSTATE_DABR, dabr); 596 HSTATE_FIELD(HSTATE_DABR, dabr);
597 HSTATE_FIELD(HSTATE_DECEXP, dec_expires); 597 HSTATE_FIELD(HSTATE_DECEXP, dec_expires);
598 DEFINE(IPI_PRIORITY, IPI_PRIORITY); 598 DEFINE(IPI_PRIORITY, IPI_PRIORITY);
599#endif /* CONFIG_KVM_BOOK3S_64_HV */ 599#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */
600 600
601#ifdef CONFIG_PPC_BOOK3S_64 601#ifdef CONFIG_PPC_BOOK3S_64
602 HSTATE_FIELD(HSTATE_CFAR, cfar); 602 HSTATE_FIELD(HSTATE_CFAR, cfar);
603 HSTATE_FIELD(HSTATE_PPR, ppr);
603#endif /* CONFIG_PPC_BOOK3S_64 */ 604#endif /* CONFIG_PPC_BOOK3S_64 */
604 605
605#else /* CONFIG_PPC_BOOK3S */ 606#else /* CONFIG_PPC_BOOK3S */
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 55593ee2d5aa..671302065347 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -189,14 +189,13 @@ static size_t eeh_gather_pci_data(struct eeh_dev *edev, char * buf, size_t len)
189 } 189 }
190 190
191 /* If PCI-E capable, dump PCI-E cap 10, and the AER */ 191 /* If PCI-E capable, dump PCI-E cap 10, and the AER */
192 cap = pci_find_capability(dev, PCI_CAP_ID_EXP); 192 if (pci_is_pcie(dev)) {
193 if (cap) {
194 n += scnprintf(buf+n, len-n, "pci-e cap10:\n"); 193 n += scnprintf(buf+n, len-n, "pci-e cap10:\n");
195 printk(KERN_WARNING 194 printk(KERN_WARNING
196 "EEH: PCI-E capabilities and status follow:\n"); 195 "EEH: PCI-E capabilities and status follow:\n");
197 196
198 for (i=0; i<=8; i++) { 197 for (i=0; i<=8; i++) {
199 eeh_ops->read_config(dn, cap+4*i, 4, &cfg); 198 eeh_ops->read_config(dn, dev->pcie_cap+4*i, 4, &cfg);
200 n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg); 199 n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg);
201 printk(KERN_WARNING "EEH: PCI-E %02x: %08x\n", i, cfg); 200 printk(KERN_WARNING "EEH: PCI-E %02x: %08x\n", i, cfg);
202 } 201 }
@@ -327,11 +326,11 @@ static int eeh_phb_check_failure(struct eeh_pe *pe)
327 /* Isolate the PHB and send event */ 326 /* Isolate the PHB and send event */
328 eeh_pe_state_mark(phb_pe, EEH_PE_ISOLATED); 327 eeh_pe_state_mark(phb_pe, EEH_PE_ISOLATED);
329 eeh_serialize_unlock(flags); 328 eeh_serialize_unlock(flags);
330 eeh_send_failure_event(phb_pe);
331 329
332 pr_err("EEH: PHB#%x failure detected\n", 330 pr_err("EEH: PHB#%x failure detected\n",
333 phb_pe->phb->global_number); 331 phb_pe->phb->global_number);
334 dump_stack(); 332 dump_stack();
333 eeh_send_failure_event(phb_pe);
335 334
336 return 1; 335 return 1;
337out: 336out:
@@ -454,8 +453,6 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
454 eeh_pe_state_mark(pe, EEH_PE_ISOLATED); 453 eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
455 eeh_serialize_unlock(flags); 454 eeh_serialize_unlock(flags);
456 455
457 eeh_send_failure_event(pe);
458
459 /* Most EEH events are due to device driver bugs. Having 456 /* Most EEH events are due to device driver bugs. Having
460 * a stack trace will help the device-driver authors figure 457 * a stack trace will help the device-driver authors figure
461 * out what happened. So print that out. 458 * out what happened. So print that out.
@@ -464,6 +461,8 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
464 pe->addr, pe->phb->global_number); 461 pe->addr, pe->phb->global_number);
465 dump_stack(); 462 dump_stack();
466 463
464 eeh_send_failure_event(pe);
465
467 return 1; 466 return 1;
468 467
469dn_unlock: 468dn_unlock:
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index c04cdf70d487..bbfb0294b354 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -673,9 +673,7 @@ _GLOBAL(ret_from_except_lite)
673 673
674resume_kernel: 674resume_kernel:
675 /* check current_thread_info, _TIF_EMULATE_STACK_STORE */ 675 /* check current_thread_info, _TIF_EMULATE_STACK_STORE */
676 CURRENT_THREAD_INFO(r9, r1) 676 andis. r8,r4,_TIF_EMULATE_STACK_STORE@h
677 ld r8,TI_FLAGS(r9)
678 andis. r8,r8,_TIF_EMULATE_STACK_STORE@h
679 beq+ 1f 677 beq+ 1f
680 678
681 addi r8,r1,INT_FRAME_SIZE /* Get the kprobed function entry */ 679 addi r8,r1,INT_FRAME_SIZE /* Get the kprobed function entry */
@@ -820,6 +818,12 @@ fast_exception_return:
820 andi. r0,r3,MSR_RI 818 andi. r0,r3,MSR_RI
821 beq- unrecov_restore 819 beq- unrecov_restore
822 820
821 /* Load PPR from thread struct before we clear MSR:RI */
822BEGIN_FTR_SECTION
823 ld r2,PACACURRENT(r13)
824 ld r2,TASKTHREADPPR(r2)
825END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
826
823 /* 827 /*
824 * Clear RI before restoring r13. If we are returning to 828 * Clear RI before restoring r13. If we are returning to
825 * userspace and we take an exception after restoring r13, 829 * userspace and we take an exception after restoring r13,
@@ -840,8 +844,10 @@ fast_exception_return:
840 */ 844 */
841 andi. r0,r3,MSR_PR 845 andi. r0,r3,MSR_PR
842 beq 1f 846 beq 1f
847BEGIN_FTR_SECTION
848 mtspr SPRN_PPR,r2 /* Restore PPR */
849END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
843 ACCOUNT_CPU_USER_EXIT(r2, r4) 850 ACCOUNT_CPU_USER_EXIT(r2, r4)
844 RESTORE_PPR(r2, r4)
845 REST_GPR(13, r1) 851 REST_GPR(13, r1)
8461: 8521:
847 mtspr SPRN_SRR1,r3 853 mtspr SPRN_SRR1,r3
@@ -1017,7 +1023,7 @@ _GLOBAL(enter_rtas)
1017 1023
1018 li r9,1 1024 li r9,1
1019 rldicr r9,r9,MSR_SF_LG,(63-MSR_SF_LG) 1025 rldicr r9,r9,MSR_SF_LG,(63-MSR_SF_LG)
1020 ori r9,r9,MSR_IR|MSR_DR|MSR_FE0|MSR_FE1|MSR_FP|MSR_RI 1026 ori r9,r9,MSR_IR|MSR_DR|MSR_FE0|MSR_FE1|MSR_FP|MSR_RI|MSR_LE
1021 andc r6,r0,r9 1027 andc r6,r0,r9
1022 sync /* disable interrupts so SRR0/1 */ 1028 sync /* disable interrupts so SRR0/1 */
1023 mtmsrd r0 /* don't get trashed */ 1029 mtmsrd r0 /* don't get trashed */
@@ -1032,6 +1038,8 @@ _GLOBAL(enter_rtas)
1032 b . /* prevent speculative execution */ 1038 b . /* prevent speculative execution */
1033 1039
1034_STATIC(rtas_return_loc) 1040_STATIC(rtas_return_loc)
1041 FIXUP_ENDIAN
1042
1035 /* relocation is off at this point */ 1043 /* relocation is off at this point */
1036 GET_PACA(r4) 1044 GET_PACA(r4)
1037 clrldi r4,r4,2 /* convert to realmode address */ 1045 clrldi r4,r4,2 /* convert to realmode address */
@@ -1103,28 +1111,30 @@ _GLOBAL(enter_prom)
1103 std r10,_CCR(r1) 1111 std r10,_CCR(r1)
1104 std r11,_MSR(r1) 1112 std r11,_MSR(r1)
1105 1113
1106 /* Get the PROM entrypoint */ 1114 /* Put PROM address in SRR0 */
1107 mtlr r4 1115 mtsrr0 r4
1108 1116
1109 /* Switch MSR to 32 bits mode 1117 /* Setup our trampoline return addr in LR */
1118 bcl 20,31,$+4
11190: mflr r4
1120 addi r4,r4,(1f - 0b)
1121 mtlr r4
1122
1123 /* Prepare a 32-bit mode big endian MSR
1110 */ 1124 */
1111#ifdef CONFIG_PPC_BOOK3E 1125#ifdef CONFIG_PPC_BOOK3E
1112 rlwinm r11,r11,0,1,31 1126 rlwinm r11,r11,0,1,31
1113 mtmsr r11 1127 mtsrr1 r11
1128 rfi
1114#else /* CONFIG_PPC_BOOK3E */ 1129#else /* CONFIG_PPC_BOOK3E */
1115 mfmsr r11 1130 LOAD_REG_IMMEDIATE(r12, MSR_SF | MSR_ISF | MSR_LE)
1116 li r12,1 1131 andc r11,r11,r12
1117 rldicr r12,r12,MSR_SF_LG,(63-MSR_SF_LG) 1132 mtsrr1 r11
1118 andc r11,r11,r12 1133 rfid
1119 li r12,1
1120 rldicr r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG)
1121 andc r11,r11,r12
1122 mtmsrd r11
1123#endif /* CONFIG_PPC_BOOK3E */ 1134#endif /* CONFIG_PPC_BOOK3E */
1124 isync
1125 1135
1126 /* Enter PROM here... */ 11361: /* Return from OF */
1127 blrl 1137 FIXUP_ENDIAN
1128 1138
1129 /* Just make sure that r1 top 32 bits didn't get 1139 /* Just make sure that r1 top 32 bits didn't get
1130 * corrupt by OF 1140 * corrupt by OF
diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
index 6300c13bbde4..7898be90f2dc 100644
--- a/arch/powerpc/kernel/epapr_paravirt.c
+++ b/arch/powerpc/kernel/epapr_paravirt.c
@@ -18,6 +18,7 @@
18 */ 18 */
19 19
20#include <linux/of.h> 20#include <linux/of.h>
21#include <linux/of_fdt.h>
21#include <asm/epapr_hcalls.h> 22#include <asm/epapr_hcalls.h>
22#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
23#include <asm/code-patching.h> 24#include <asm/code-patching.h>
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 2d067049db27..e7751561fd1d 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -399,7 +399,7 @@ interrupt_end_book3e:
399 399
400/* Altivec Unavailable Interrupt */ 400/* Altivec Unavailable Interrupt */
401 START_EXCEPTION(altivec_unavailable); 401 START_EXCEPTION(altivec_unavailable);
402 NORMAL_EXCEPTION_PROLOG(0x200, BOOKE_INTERRUPT_ALTIVEC_UNAVAIL, 402 NORMAL_EXCEPTION_PROLOG(0x200, BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL,
403 PROLOG_ADDITION_NONE) 403 PROLOG_ADDITION_NONE)
404 /* we can probably do a shorter exception entry for that one... */ 404 /* we can probably do a shorter exception entry for that one... */
405 EXCEPTION_COMMON(0x200, PACA_EXGEN, INTS_KEEP) 405 EXCEPTION_COMMON(0x200, PACA_EXGEN, INTS_KEEP)
@@ -421,7 +421,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
421 421
422/* AltiVec Assist */ 422/* AltiVec Assist */
423 START_EXCEPTION(altivec_assist); 423 START_EXCEPTION(altivec_assist);
424 NORMAL_EXCEPTION_PROLOG(0x220, BOOKE_INTERRUPT_ALTIVEC_ASSIST, 424 NORMAL_EXCEPTION_PROLOG(0x220,
425 BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST,
425 PROLOG_ADDITION_NONE) 426 PROLOG_ADDITION_NONE)
426 EXCEPTION_COMMON(0x220, PACA_EXGEN, INTS_DISABLE) 427 EXCEPTION_COMMON(0x220, PACA_EXGEN, INTS_DISABLE)
427 bl .save_nvgprs 428 bl .save_nvgprs
@@ -607,6 +608,7 @@ kernel_dbg_exc:
607 NORMAL_EXCEPTION_PROLOG(0x260, BOOKE_INTERRUPT_PERFORMANCE_MONITOR, 608 NORMAL_EXCEPTION_PROLOG(0x260, BOOKE_INTERRUPT_PERFORMANCE_MONITOR,
608 PROLOG_ADDITION_NONE) 609 PROLOG_ADDITION_NONE)
609 EXCEPTION_COMMON(0x260, PACA_EXGEN, INTS_DISABLE) 610 EXCEPTION_COMMON(0x260, PACA_EXGEN, INTS_DISABLE)
611 CHECK_NAPPING()
610 addi r3,r1,STACK_FRAME_OVERHEAD 612 addi r3,r1,STACK_FRAME_OVERHEAD
611 bl .performance_monitor_exception 613 bl .performance_monitor_exception
612 b .ret_from_except_lite 614 b .ret_from_except_lite
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 3a9ed6ac224b..9f905e40922e 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -126,7 +126,7 @@ BEGIN_FTR_SECTION
126 bgt cr1,. 126 bgt cr1,.
127 GET_PACA(r13) 127 GET_PACA(r13)
128 128
129#ifdef CONFIG_KVM_BOOK3S_64_HV 129#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
130 li r0,KVM_HWTHREAD_IN_KERNEL 130 li r0,KVM_HWTHREAD_IN_KERNEL
131 stb r0,HSTATE_HWTHREAD_STATE(r13) 131 stb r0,HSTATE_HWTHREAD_STATE(r13)
132 /* Order setting hwthread_state vs. testing hwthread_req */ 132 /* Order setting hwthread_state vs. testing hwthread_req */
@@ -425,7 +425,7 @@ data_access_check_stab:
425 mfspr r9,SPRN_DSISR 425 mfspr r9,SPRN_DSISR
426 srdi r10,r10,60 426 srdi r10,r10,60
427 rlwimi r10,r9,16,0x20 427 rlwimi r10,r9,16,0x20
428#ifdef CONFIG_KVM_BOOK3S_PR 428#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
429 lbz r9,HSTATE_IN_GUEST(r13) 429 lbz r9,HSTATE_IN_GUEST(r13)
430 rlwimi r10,r9,8,0x300 430 rlwimi r10,r9,8,0x300
431#endif 431#endif
@@ -650,6 +650,32 @@ slb_miss_user_pseries:
650 b . /* prevent spec. execution */ 650 b . /* prevent spec. execution */
651#endif /* __DISABLED__ */ 651#endif /* __DISABLED__ */
652 652
653#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
654kvmppc_skip_interrupt:
655 /*
656 * Here all GPRs are unchanged from when the interrupt happened
657 * except for r13, which is saved in SPRG_SCRATCH0.
658 */
659 mfspr r13, SPRN_SRR0
660 addi r13, r13, 4
661 mtspr SPRN_SRR0, r13
662 GET_SCRATCH0(r13)
663 rfid
664 b .
665
666kvmppc_skip_Hinterrupt:
667 /*
668 * Here all GPRs are unchanged from when the interrupt happened
669 * except for r13, which is saved in SPRG_SCRATCH0.
670 */
671 mfspr r13, SPRN_HSRR0
672 addi r13, r13, 4
673 mtspr SPRN_HSRR0, r13
674 GET_SCRATCH0(r13)
675 hrfid
676 b .
677#endif
678
653/* 679/*
654 * Code from here down to __end_handlers is invoked from the 680 * Code from here down to __end_handlers is invoked from the
655 * exception prologs above. Because the prologs assemble the 681 * exception prologs above. Because the prologs assemble the
diff --git a/arch/powerpc/kernel/fpu.S b/arch/powerpc/kernel/fpu.S
index caeaabf11a2f..f7f5b8bed68f 100644
--- a/arch/powerpc/kernel/fpu.S
+++ b/arch/powerpc/kernel/fpu.S
@@ -35,15 +35,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX); \
352: REST_32VSRS(n,c,base); \ 352: REST_32VSRS(n,c,base); \
363: 363:
37 37
38#define __REST_32FPVSRS_TRANSACT(n,c,base) \
39BEGIN_FTR_SECTION \
40 b 2f; \
41END_FTR_SECTION_IFSET(CPU_FTR_VSX); \
42 REST_32FPRS_TRANSACT(n,base); \
43 b 3f; \
442: REST_32VSRS_TRANSACT(n,c,base); \
453:
46
47#define __SAVE_32FPVSRS(n,c,base) \ 38#define __SAVE_32FPVSRS(n,c,base) \
48BEGIN_FTR_SECTION \ 39BEGIN_FTR_SECTION \
49 b 2f; \ 40 b 2f; \
@@ -54,40 +45,12 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX); \
543: 453:
55#else 46#else
56#define __REST_32FPVSRS(n,b,base) REST_32FPRS(n, base) 47#define __REST_32FPVSRS(n,b,base) REST_32FPRS(n, base)
57#define __REST_32FPVSRS_TRANSACT(n,b,base) REST_32FPRS(n, base)
58#define __SAVE_32FPVSRS(n,b,base) SAVE_32FPRS(n, base) 48#define __SAVE_32FPVSRS(n,b,base) SAVE_32FPRS(n, base)
59#endif 49#endif
60#define REST_32FPVSRS(n,c,base) __REST_32FPVSRS(n,__REG_##c,__REG_##base) 50#define REST_32FPVSRS(n,c,base) __REST_32FPVSRS(n,__REG_##c,__REG_##base)
61#define REST_32FPVSRS_TRANSACT(n,c,base) \
62 __REST_32FPVSRS_TRANSACT(n,__REG_##c,__REG_##base)
63#define SAVE_32FPVSRS(n,c,base) __SAVE_32FPVSRS(n,__REG_##c,__REG_##base) 51#define SAVE_32FPVSRS(n,c,base) __SAVE_32FPVSRS(n,__REG_##c,__REG_##base)
64 52
65#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 53#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
66/*
67 * Wrapper to call load_up_fpu from C.
68 * void do_load_up_fpu(struct pt_regs *regs);
69 */
70_GLOBAL(do_load_up_fpu)
71 mflr r0
72 std r0, 16(r1)
73 stdu r1, -112(r1)
74
75 subi r6, r3, STACK_FRAME_OVERHEAD
76 /* load_up_fpu expects r12=MSR, r13=PACA, and returns
77 * with r12 = new MSR.
78 */
79 ld r12,_MSR(r6)
80 GET_PACA(r13)
81
82 bl load_up_fpu
83 std r12,_MSR(r6)
84
85 ld r0, 112+16(r1)
86 addi r1, r1, 112
87 mtlr r0
88 blr
89
90
91/* void do_load_up_transact_fpu(struct thread_struct *thread) 54/* void do_load_up_transact_fpu(struct thread_struct *thread)
92 * 55 *
93 * This is similar to load_up_fpu but for the transactional version of the FP 56 * This is similar to load_up_fpu but for the transactional version of the FP
@@ -105,9 +68,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
105 SYNC 68 SYNC
106 MTMSRD(r5) 69 MTMSRD(r5)
107 70
108 lfd fr0,THREAD_TRANSACT_FPSCR(r3) 71 addi r7,r3,THREAD_TRANSACT_FPSTATE
72 lfd fr0,FPSTATE_FPSCR(r7)
109 MTFSF_L(fr0) 73 MTFSF_L(fr0)
110 REST_32FPVSRS_TRANSACT(0, R4, R3) 74 REST_32FPVSRS(0, R4, R7)
111 75
112 /* FP/VSX off again */ 76 /* FP/VSX off again */
113 MTMSRD(r6) 77 MTMSRD(r6)
@@ -117,11 +81,33 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
117#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ 81#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
118 82
119/* 83/*
84 * Load state from memory into FP registers including FPSCR.
85 * Assumes the caller has enabled FP in the MSR.
86 */
87_GLOBAL(load_fp_state)
88 lfd fr0,FPSTATE_FPSCR(r3)
89 MTFSF_L(fr0)
90 REST_32FPVSRS(0, R4, R3)
91 blr
92
93/*
94 * Store FP state into memory, including FPSCR
95 * Assumes the caller has enabled FP in the MSR.
96 */
97_GLOBAL(store_fp_state)
98 SAVE_32FPVSRS(0, R4, R3)
99 mffs fr0
100 stfd fr0,FPSTATE_FPSCR(r3)
101 blr
102
103/*
120 * This task wants to use the FPU now. 104 * This task wants to use the FPU now.
121 * On UP, disable FP for the task which had the FPU previously, 105 * On UP, disable FP for the task which had the FPU previously,
122 * and save its floating-point registers in its thread_struct. 106 * and save its floating-point registers in its thread_struct.
123 * Load up this task's FP registers from its thread_struct, 107 * Load up this task's FP registers from its thread_struct,
124 * enable the FPU for the current task and return to the task. 108 * enable the FPU for the current task and return to the task.
109 * Note that on 32-bit this can only use registers that will be
110 * restored by fast_exception_return, i.e. r3 - r6, r10 and r11.
125 */ 111 */
126_GLOBAL(load_up_fpu) 112_GLOBAL(load_up_fpu)
127 mfmsr r5 113 mfmsr r5
@@ -147,9 +133,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
147 beq 1f 133 beq 1f
148 toreal(r4) 134 toreal(r4)
149 addi r4,r4,THREAD /* want last_task_used_math->thread */ 135 addi r4,r4,THREAD /* want last_task_used_math->thread */
150 SAVE_32FPVSRS(0, R5, R4) 136 addi r10,r4,THREAD_FPSTATE
137 SAVE_32FPVSRS(0, R5, R10)
151 mffs fr0 138 mffs fr0
152 stfd fr0,THREAD_FPSCR(r4) 139 stfd fr0,FPSTATE_FPSCR(r10)
153 PPC_LL r5,PT_REGS(r4) 140 PPC_LL r5,PT_REGS(r4)
154 toreal(r5) 141 toreal(r5)
155 PPC_LL r4,_MSR-STACK_FRAME_OVERHEAD(r5) 142 PPC_LL r4,_MSR-STACK_FRAME_OVERHEAD(r5)
@@ -160,7 +147,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
160#endif /* CONFIG_SMP */ 147#endif /* CONFIG_SMP */
161 /* enable use of FP after return */ 148 /* enable use of FP after return */
162#ifdef CONFIG_PPC32 149#ifdef CONFIG_PPC32
163 mfspr r5,SPRN_SPRG_THREAD /* current task's THREAD (phys) */ 150 mfspr r5,SPRN_SPRG_THREAD /* current task's THREAD (phys) */
164 lwz r4,THREAD_FPEXC_MODE(r5) 151 lwz r4,THREAD_FPEXC_MODE(r5)
165 ori r9,r9,MSR_FP /* enable FP for current */ 152 ori r9,r9,MSR_FP /* enable FP for current */
166 or r9,r9,r4 153 or r9,r9,r4
@@ -172,9 +159,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
172 or r12,r12,r4 159 or r12,r12,r4
173 std r12,_MSR(r1) 160 std r12,_MSR(r1)
174#endif 161#endif
175 lfd fr0,THREAD_FPSCR(r5) 162 addi r10,r5,THREAD_FPSTATE
163 lfd fr0,FPSTATE_FPSCR(r10)
176 MTFSF_L(fr0) 164 MTFSF_L(fr0)
177 REST_32FPVSRS(0, R4, R5) 165 REST_32FPVSRS(0, R4, R10)
178#ifndef CONFIG_SMP 166#ifndef CONFIG_SMP
179 subi r4,r5,THREAD 167 subi r4,r5,THREAD
180 fromreal(r4) 168 fromreal(r4)
@@ -206,11 +194,15 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
206 PPC_LCMPI 0,r3,0 194 PPC_LCMPI 0,r3,0
207 beqlr- /* if no previous owner, done */ 195 beqlr- /* if no previous owner, done */
208 addi r3,r3,THREAD /* want THREAD of task */ 196 addi r3,r3,THREAD /* want THREAD of task */
197 PPC_LL r6,THREAD_FPSAVEAREA(r3)
209 PPC_LL r5,PT_REGS(r3) 198 PPC_LL r5,PT_REGS(r3)
210 PPC_LCMPI 0,r5,0 199 PPC_LCMPI 0,r6,0
211 SAVE_32FPVSRS(0, R4 ,R3) 200 bne 2f
201 addi r6,r3,THREAD_FPSTATE
2022: PPC_LCMPI 0,r5,0
203 SAVE_32FPVSRS(0, R4, R6)
212 mffs fr0 204 mffs fr0
213 stfd fr0,THREAD_FPSCR(r3) 205 stfd fr0,FPSTATE_FPSCR(r6)
214 beq 1f 206 beq 1f
215 PPC_LL r4,_MSR-STACK_FRAME_OVERHEAD(r5) 207 PPC_LL r4,_MSR-STACK_FRAME_OVERHEAD(r5)
216 li r3,MSR_FP|MSR_FE0|MSR_FE1 208 li r3,MSR_FP|MSR_FE0|MSR_FE1
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index 1fb78561096a..9b27b293a922 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -174,7 +174,11 @@ __ftrace_make_nop(struct module *mod,
174 174
175 pr_devel(" %08x %08x\n", jmp[0], jmp[1]); 175 pr_devel(" %08x %08x\n", jmp[0], jmp[1]);
176 176
177#ifdef __LITTLE_ENDIAN__
178 ptr = ((unsigned long)jmp[1] << 32) + jmp[0];
179#else
177 ptr = ((unsigned long)jmp[0] << 32) + jmp[1]; 180 ptr = ((unsigned long)jmp[0] << 32) + jmp[1];
181#endif
178 182
179 /* This should match what was called */ 183 /* This should match what was called */
180 if (ptr != ppc_function_entry((void *)addr)) { 184 if (ptr != ppc_function_entry((void *)addr)) {
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 3d11d8038dee..2ae41aba4053 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -68,6 +68,7 @@ _stext:
68_GLOBAL(__start) 68_GLOBAL(__start)
69 /* NOP this out unconditionally */ 69 /* NOP this out unconditionally */
70BEGIN_FTR_SECTION 70BEGIN_FTR_SECTION
71 FIXUP_ENDIAN
71 b .__start_initialization_multiplatform 72 b .__start_initialization_multiplatform
72END_FTR_SECTION(0, 1) 73END_FTR_SECTION(0, 1)
73 74
@@ -115,6 +116,7 @@ __run_at_load:
115 */ 116 */
116 .globl __secondary_hold 117 .globl __secondary_hold
117__secondary_hold: 118__secondary_hold:
119 FIXUP_ENDIAN
118#ifndef CONFIG_PPC_BOOK3E 120#ifndef CONFIG_PPC_BOOK3E
119 mfmsr r24 121 mfmsr r24
120 ori r24,r24,MSR_RI 122 ori r24,r24,MSR_RI
@@ -205,6 +207,7 @@ _GLOBAL(generic_secondary_thread_init)
205 * as SCOM before entry). 207 * as SCOM before entry).
206 */ 208 */
207_GLOBAL(generic_secondary_smp_init) 209_GLOBAL(generic_secondary_smp_init)
210 FIXUP_ENDIAN
208 mr r24,r3 211 mr r24,r3
209 mr r25,r4 212 mr r25,r4
210 213
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index 1b92a97b1b04..7ee876d2adb5 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -858,6 +858,9 @@ initial_mmu:
858 addis r11, r11, 0x0080 /* Add 8M */ 858 addis r11, r11, 0x0080 /* Add 8M */
859 mtspr SPRN_MD_RPN, r11 859 mtspr SPRN_MD_RPN, r11
860 860
861 addi r10, r10, 0x0100
862 mtspr SPRN_MD_CTR, r10
863
861 addis r8, r8, 0x0080 /* Add 8M */ 864 addis r8, r8, 0x0080 /* Add 8M */
862 mtspr SPRN_MD_EPN, r8 865 mtspr SPRN_MD_EPN, r8
863 mtspr SPRN_MD_TWC, r9 866 mtspr SPRN_MD_TWC, r9
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 289afaffbbb5..f45726a1d963 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -555,27 +555,27 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
555#ifdef CONFIG_SPE 555#ifdef CONFIG_SPE
556 /* SPE Unavailable */ 556 /* SPE Unavailable */
557 START_EXCEPTION(SPEUnavailable) 557 START_EXCEPTION(SPEUnavailable)
558 NORMAL_EXCEPTION_PROLOG(SPE_UNAVAIL) 558 NORMAL_EXCEPTION_PROLOG(SPE_ALTIVEC_UNAVAIL)
559 beq 1f 559 beq 1f
560 bl load_up_spe 560 bl load_up_spe
561 b fast_exception_return 561 b fast_exception_return
5621: addi r3,r1,STACK_FRAME_OVERHEAD 5621: addi r3,r1,STACK_FRAME_OVERHEAD
563 EXC_XFER_EE_LITE(0x2010, KernelSPE) 563 EXC_XFER_EE_LITE(0x2010, KernelSPE)
564#else 564#else
565 EXCEPTION(0x2020, SPE_UNAVAIL, SPEUnavailable, \ 565 EXCEPTION(0x2020, SPE_ALTIVEC_UNAVAIL, SPEUnavailable, \
566 unknown_exception, EXC_XFER_EE) 566 unknown_exception, EXC_XFER_EE)
567#endif /* CONFIG_SPE */ 567#endif /* CONFIG_SPE */
568 568
569 /* SPE Floating Point Data */ 569 /* SPE Floating Point Data */
570#ifdef CONFIG_SPE 570#ifdef CONFIG_SPE
571 EXCEPTION(0x2030, SPE_FP_DATA, SPEFloatingPointData, \ 571 EXCEPTION(0x2030, SPE_FP_DATA_ALTIVEC_ASSIST, SPEFloatingPointData,
572 SPEFloatingPointException, EXC_XFER_EE); 572 SPEFloatingPointException, EXC_XFER_EE)
573 573
574 /* SPE Floating Point Round */ 574 /* SPE Floating Point Round */
575 EXCEPTION(0x2050, SPE_FP_ROUND, SPEFloatingPointRound, \ 575 EXCEPTION(0x2050, SPE_FP_ROUND, SPEFloatingPointRound, \
576 SPEFloatingPointRoundException, EXC_XFER_EE) 576 SPEFloatingPointRoundException, EXC_XFER_EE)
577#else 577#else
578 EXCEPTION(0x2040, SPE_FP_DATA, SPEFloatingPointData, \ 578 EXCEPTION(0x2040, SPE_FP_DATA_ALTIVEC_ASSIST, SPEFloatingPointData,
579 unknown_exception, EXC_XFER_EE) 579 unknown_exception, EXC_XFER_EE)
580 EXCEPTION(0x2050, SPE_FP_ROUND, SPEFloatingPointRound, \ 580 EXCEPTION(0x2050, SPE_FP_ROUND, SPEFloatingPointRound, \
581 unknown_exception, EXC_XFER_EE) 581 unknown_exception, EXC_XFER_EE)
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 16a7c2326d48..1114d13ac19f 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -292,6 +292,7 @@ out:
292 return rc; 292 return rc;
293 return count; 293 return count;
294} 294}
295static BUS_ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe);
295 296
296static ssize_t ibmebus_store_remove(struct bus_type *bus, 297static ssize_t ibmebus_store_remove(struct bus_type *bus,
297 const char *buf, size_t count) 298 const char *buf, size_t count)
@@ -317,13 +318,14 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus,
317 return -ENODEV; 318 return -ENODEV;
318 } 319 }
319} 320}
321static BUS_ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove);
320 322
321 323static struct attribute *ibmbus_bus_attrs[] = {
322static struct bus_attribute ibmebus_bus_attrs[] = { 324 &bus_attr_probe.attr,
323 __ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe), 325 &bus_attr_remove.attr,
324 __ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove), 326 NULL,
325 __ATTR_NULL
326}; 327};
328ATTRIBUTE_GROUPS(ibmbus_bus);
327 329
328static int ibmebus_bus_bus_match(struct device *dev, struct device_driver *drv) 330static int ibmebus_bus_bus_match(struct device *dev, struct device_driver *drv)
329{ 331{
@@ -713,7 +715,7 @@ static struct dev_pm_ops ibmebus_bus_dev_pm_ops = {
713struct bus_type ibmebus_bus_type = { 715struct bus_type ibmebus_bus_type = {
714 .name = "ibmebus", 716 .name = "ibmebus",
715 .uevent = of_device_uevent_modalias, 717 .uevent = of_device_uevent_modalias,
716 .bus_attrs = ibmebus_bus_attrs, 718 .bus_groups = ibmbus_bus_groups,
717 .match = ibmebus_bus_bus_match, 719 .match = ibmebus_bus_bus_match,
718 .probe = ibmebus_bus_device_probe, 720 .probe = ibmebus_bus_device_probe,
719 .remove = ibmebus_bus_device_remove, 721 .remove = ibmebus_bus_device_remove,
diff --git a/arch/powerpc/kernel/idle_power7.S b/arch/powerpc/kernel/idle_power7.S
index e11863f4e595..847e40e62fce 100644
--- a/arch/powerpc/kernel/idle_power7.S
+++ b/arch/powerpc/kernel/idle_power7.S
@@ -84,7 +84,7 @@ _GLOBAL(power7_nap)
84 std r9,_MSR(r1) 84 std r9,_MSR(r1)
85 std r1,PACAR1(r13) 85 std r1,PACAR1(r13)
86 86
87#ifdef CONFIG_KVM_BOOK3S_64_HV 87#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
88 /* Tell KVM we're napping */ 88 /* Tell KVM we're napping */
89 li r4,KVM_HWTHREAD_IN_NAP 89 li r4,KVM_HWTHREAD_IN_NAP
90 stb r4,HSTATE_HWTHREAD_STATE(r13) 90 stb r4,HSTATE_HWTHREAD_STATE(r13)
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 0adab06ce5c0..572bb5b95f35 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -661,7 +661,7 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
661 /* number of bytes needed for the bitmap */ 661 /* number of bytes needed for the bitmap */
662 sz = BITS_TO_LONGS(tbl->it_size) * sizeof(unsigned long); 662 sz = BITS_TO_LONGS(tbl->it_size) * sizeof(unsigned long);
663 663
664 page = alloc_pages_node(nid, GFP_ATOMIC, get_order(sz)); 664 page = alloc_pages_node(nid, GFP_KERNEL, get_order(sz));
665 if (!page) 665 if (!page)
666 panic("iommu_init_table: Can't allocate %ld bytes\n", sz); 666 panic("iommu_init_table: Can't allocate %ld bytes\n", sz);
667 tbl->it_map = page_address(page); 667 tbl->it_map = page_address(page);
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index c69440cef7af..ba0165615215 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -441,50 +441,6 @@ void migrate_irqs(void)
441} 441}
442#endif 442#endif
443 443
444static inline void handle_one_irq(unsigned int irq)
445{
446 struct thread_info *curtp, *irqtp;
447 unsigned long saved_sp_limit;
448 struct irq_desc *desc;
449
450 desc = irq_to_desc(irq);
451 if (!desc)
452 return;
453
454 /* Switch to the irq stack to handle this */
455 curtp = current_thread_info();
456 irqtp = hardirq_ctx[smp_processor_id()];
457
458 if (curtp == irqtp) {
459 /* We're already on the irq stack, just handle it */
460 desc->handle_irq(irq, desc);
461 return;
462 }
463
464 saved_sp_limit = current->thread.ksp_limit;
465
466 irqtp->task = curtp->task;
467 irqtp->flags = 0;
468
469 /* Copy the softirq bits in preempt_count so that the
470 * softirq checks work in the hardirq context. */
471 irqtp->preempt_count = (irqtp->preempt_count & ~SOFTIRQ_MASK) |
472 (curtp->preempt_count & SOFTIRQ_MASK);
473
474 current->thread.ksp_limit = (unsigned long)irqtp +
475 _ALIGN_UP(sizeof(struct thread_info), 16);
476
477 call_handle_irq(irq, desc, irqtp, desc->handle_irq);
478 current->thread.ksp_limit = saved_sp_limit;
479 irqtp->task = NULL;
480
481 /* Set any flag that may have been set on the
482 * alternate stack
483 */
484 if (irqtp->flags)
485 set_bits(irqtp->flags, &curtp->flags);
486}
487
488static inline void check_stack_overflow(void) 444static inline void check_stack_overflow(void)
489{ 445{
490#ifdef CONFIG_DEBUG_STACKOVERFLOW 446#ifdef CONFIG_DEBUG_STACKOVERFLOW
@@ -501,9 +457,9 @@ static inline void check_stack_overflow(void)
501#endif 457#endif
502} 458}
503 459
504void do_IRQ(struct pt_regs *regs) 460void __do_irq(struct pt_regs *regs)
505{ 461{
506 struct pt_regs *old_regs = set_irq_regs(regs); 462 struct irq_desc *desc;
507 unsigned int irq; 463 unsigned int irq;
508 464
509 irq_enter(); 465 irq_enter();
@@ -519,18 +475,57 @@ void do_IRQ(struct pt_regs *regs)
519 */ 475 */
520 irq = ppc_md.get_irq(); 476 irq = ppc_md.get_irq();
521 477
522 /* We can hard enable interrupts now */ 478 /* We can hard enable interrupts now to allow perf interrupts */
523 may_hard_irq_enable(); 479 may_hard_irq_enable();
524 480
525 /* And finally process it */ 481 /* And finally process it */
526 if (irq != NO_IRQ) 482 if (unlikely(irq == NO_IRQ))
527 handle_one_irq(irq);
528 else
529 __get_cpu_var(irq_stat).spurious_irqs++; 483 __get_cpu_var(irq_stat).spurious_irqs++;
484 else {
485 desc = irq_to_desc(irq);
486 if (likely(desc))
487 desc->handle_irq(irq, desc);
488 }
530 489
531 trace_irq_exit(regs); 490 trace_irq_exit(regs);
532 491
533 irq_exit(); 492 irq_exit();
493}
494
495void do_IRQ(struct pt_regs *regs)
496{
497 struct pt_regs *old_regs = set_irq_regs(regs);
498 struct thread_info *curtp, *irqtp, *sirqtp;
499
500 /* Switch to the irq stack to handle this */
501 curtp = current_thread_info();
502 irqtp = hardirq_ctx[raw_smp_processor_id()];
503 sirqtp = softirq_ctx[raw_smp_processor_id()];
504
505 /* Already there ? */
506 if (unlikely(curtp == irqtp || curtp == sirqtp)) {
507 __do_irq(regs);
508 set_irq_regs(old_regs);
509 return;
510 }
511
512 /* Prepare the thread_info in the irq stack */
513 irqtp->task = curtp->task;
514 irqtp->flags = 0;
515
516 /* Copy the preempt_count so that the [soft]irq checks work. */
517 irqtp->preempt_count = curtp->preempt_count;
518
519 /* Switch stack and call */
520 call_do_irq(regs, irqtp);
521
522 /* Restore stack limit */
523 irqtp->task = NULL;
524
525 /* Copy back updates to the thread_info */
526 if (irqtp->flags)
527 set_bits(irqtp->flags, &curtp->flags);
528
534 set_irq_regs(old_regs); 529 set_irq_regs(old_regs);
535} 530}
536 531
@@ -592,28 +587,22 @@ void irq_ctx_init(void)
592 memset((void *)softirq_ctx[i], 0, THREAD_SIZE); 587 memset((void *)softirq_ctx[i], 0, THREAD_SIZE);
593 tp = softirq_ctx[i]; 588 tp = softirq_ctx[i];
594 tp->cpu = i; 589 tp->cpu = i;
595 tp->preempt_count = 0;
596 590
597 memset((void *)hardirq_ctx[i], 0, THREAD_SIZE); 591 memset((void *)hardirq_ctx[i], 0, THREAD_SIZE);
598 tp = hardirq_ctx[i]; 592 tp = hardirq_ctx[i];
599 tp->cpu = i; 593 tp->cpu = i;
600 tp->preempt_count = HARDIRQ_OFFSET;
601 } 594 }
602} 595}
603 596
604static inline void do_softirq_onstack(void) 597void do_softirq_own_stack(void)
605{ 598{
606 struct thread_info *curtp, *irqtp; 599 struct thread_info *curtp, *irqtp;
607 unsigned long saved_sp_limit = current->thread.ksp_limit;
608 600
609 curtp = current_thread_info(); 601 curtp = current_thread_info();
610 irqtp = softirq_ctx[smp_processor_id()]; 602 irqtp = softirq_ctx[smp_processor_id()];
611 irqtp->task = curtp->task; 603 irqtp->task = curtp->task;
612 irqtp->flags = 0; 604 irqtp->flags = 0;
613 current->thread.ksp_limit = (unsigned long)irqtp +
614 _ALIGN_UP(sizeof(struct thread_info), 16);
615 call_do_softirq(irqtp); 605 call_do_softirq(irqtp);
616 current->thread.ksp_limit = saved_sp_limit;
617 irqtp->task = NULL; 606 irqtp->task = NULL;
618 607
619 /* Set any flag that may have been set on the 608 /* Set any flag that may have been set on the
@@ -623,21 +612,6 @@ static inline void do_softirq_onstack(void)
623 set_bits(irqtp->flags, &curtp->flags); 612 set_bits(irqtp->flags, &curtp->flags);
624} 613}
625 614
626void do_softirq(void)
627{
628 unsigned long flags;
629
630 if (in_interrupt())
631 return;
632
633 local_irq_save(flags);
634
635 if (local_softirq_pending())
636 do_softirq_onstack();
637
638 local_irq_restore(flags);
639}
640
641irq_hw_number_t virq_to_hw(unsigned int virq) 615irq_hw_number_t virq_to_hw(unsigned int virq)
642{ 616{
643 struct irq_data *irq_data = irq_get_irq_data(virq); 617 struct irq_data *irq_data = irq_get_irq_data(virq);
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index c1eef241017a..83e89d310734 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -151,15 +151,16 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)
151 return 1; 151 return 1;
152} 152}
153 153
154static DEFINE_PER_CPU(struct thread_info, kgdb_thread_info);
154static int kgdb_singlestep(struct pt_regs *regs) 155static int kgdb_singlestep(struct pt_regs *regs)
155{ 156{
156 struct thread_info *thread_info, *exception_thread_info; 157 struct thread_info *thread_info, *exception_thread_info;
157 struct thread_info *backup_current_thread_info; 158 struct thread_info *backup_current_thread_info =
159 &__get_cpu_var(kgdb_thread_info);
158 160
159 if (user_mode(regs)) 161 if (user_mode(regs))
160 return 0; 162 return 0;
161 163
162 backup_current_thread_info = kmalloc(sizeof(struct thread_info), GFP_KERNEL);
163 /* 164 /*
164 * On Book E and perhaps other processors, singlestep is handled on 165 * On Book E and perhaps other processors, singlestep is handled on
165 * the critical exception stack. This causes current_thread_info() 166 * the critical exception stack. This causes current_thread_info()
@@ -185,7 +186,6 @@ static int kgdb_singlestep(struct pt_regs *regs)
185 /* Restore current_thread_info lastly. */ 186 /* Restore current_thread_info lastly. */
186 memcpy(exception_thread_info, backup_current_thread_info, sizeof *thread_info); 187 memcpy(exception_thread_info, backup_current_thread_info, sizeof *thread_info);
187 188
188 kfree(backup_current_thread_info);
189 return 1; 189 return 1;
190} 190}
191 191
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 22e88dd2f34a..40bd7bd4e19a 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -35,7 +35,7 @@ static struct legacy_serial_info {
35 phys_addr_t taddr; 35 phys_addr_t taddr;
36} legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS]; 36} legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS];
37 37
38static struct __initdata of_device_id legacy_serial_parents[] = { 38static struct of_device_id legacy_serial_parents[] __initdata = {
39 {.type = "soc",}, 39 {.type = "soc",},
40 {.type = "tsi-bridge",}, 40 {.type = "tsi-bridge",},
41 {.type = "opb", }, 41 {.type = "opb", },
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 611acdf30096..be4e6d648f60 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -312,7 +312,7 @@ static union thread_union kexec_stack __init_task_data =
312 */ 312 */
313struct paca_struct kexec_paca; 313struct paca_struct kexec_paca;
314 314
315/* Our assembly helper, in kexec_stub.S */ 315/* Our assembly helper, in misc_64.S */
316extern void kexec_sequence(void *newstack, unsigned long start, 316extern void kexec_sequence(void *newstack, unsigned long start,
317 void *image, void *control, 317 void *image, void *control,
318 void (*clear_all)(void)) __noreturn; 318 void (*clear_all)(void)) __noreturn;
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 777d999f563b..e47d268727a4 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -36,26 +36,41 @@
36 36
37 .text 37 .text
38 38
39/*
40 * We store the saved ksp_limit in the unused part
41 * of the STACK_FRAME_OVERHEAD
42 */
39_GLOBAL(call_do_softirq) 43_GLOBAL(call_do_softirq)
40 mflr r0 44 mflr r0
41 stw r0,4(r1) 45 stw r0,4(r1)
46 lwz r10,THREAD+KSP_LIMIT(r2)
47 addi r11,r3,THREAD_INFO_GAP
42 stwu r1,THREAD_SIZE-STACK_FRAME_OVERHEAD(r3) 48 stwu r1,THREAD_SIZE-STACK_FRAME_OVERHEAD(r3)
43 mr r1,r3 49 mr r1,r3
50 stw r10,8(r1)
51 stw r11,THREAD+KSP_LIMIT(r2)
44 bl __do_softirq 52 bl __do_softirq
53 lwz r10,8(r1)
45 lwz r1,0(r1) 54 lwz r1,0(r1)
46 lwz r0,4(r1) 55 lwz r0,4(r1)
56 stw r10,THREAD+KSP_LIMIT(r2)
47 mtlr r0 57 mtlr r0
48 blr 58 blr
49 59
50_GLOBAL(call_handle_irq) 60_GLOBAL(call_do_irq)
51 mflr r0 61 mflr r0
52 stw r0,4(r1) 62 stw r0,4(r1)
53 mtctr r6 63 lwz r10,THREAD+KSP_LIMIT(r2)
54 stwu r1,THREAD_SIZE-STACK_FRAME_OVERHEAD(r5) 64 addi r11,r3,THREAD_INFO_GAP
55 mr r1,r5 65 stwu r1,THREAD_SIZE-STACK_FRAME_OVERHEAD(r4)
56 bctrl 66 mr r1,r4
67 stw r10,8(r1)
68 stw r11,THREAD+KSP_LIMIT(r2)
69 bl __do_irq
70 lwz r10,8(r1)
57 lwz r1,0(r1) 71 lwz r1,0(r1)
58 lwz r0,4(r1) 72 lwz r0,4(r1)
73 stw r10,THREAD+KSP_LIMIT(r2)
59 mtlr r0 74 mtlr r0
60 blr 75 blr
61 76
@@ -644,6 +659,20 @@ _GLOBAL(__lshrdi3)
644 blr 659 blr
645 660
646/* 661/*
662 * 64-bit comparison: __cmpdi2(s64 a, s64 b)
663 * Returns 0 if a < b, 1 if a == b, 2 if a > b.
664 */
665_GLOBAL(__cmpdi2)
666 cmpw r3,r5
667 li r3,1
668 bne 1f
669 cmplw r4,r6
670 beqlr
6711: li r3,0
672 bltlr
673 li r3,2
674 blr
675/*
647 * 64-bit comparison: __ucmpdi2(u64 a, u64 b) 676 * 64-bit comparison: __ucmpdi2(u64 a, u64 b)
648 * Returns 0 if a < b, 1 if a == b, 2 if a > b. 677 * Returns 0 if a < b, 1 if a == b, 2 if a > b.
649 */ 678 */
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 971d7e78aff2..e59caf874d05 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -40,14 +40,12 @@ _GLOBAL(call_do_softirq)
40 mtlr r0 40 mtlr r0
41 blr 41 blr
42 42
43_GLOBAL(call_handle_irq) 43_GLOBAL(call_do_irq)
44 ld r8,0(r6)
45 mflr r0 44 mflr r0
46 std r0,16(r1) 45 std r0,16(r1)
47 mtctr r8 46 stdu r1,THREAD_SIZE-STACK_FRAME_OVERHEAD(r4)
48 stdu r1,THREAD_SIZE-STACK_FRAME_OVERHEAD(r5) 47 mr r1,r4
49 mr r1,r5 48 bl .__do_irq
50 bctrl
51 ld r1,0(r1) 49 ld r1,0(r1)
52 ld r0,16(r1) 50 ld r0,16(r1)
53 mtlr r0 51 mtlr r0
diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c
index 2d275707f419..9547381b631a 100644
--- a/arch/powerpc/kernel/module.c
+++ b/arch/powerpc/kernel/module.c
@@ -25,8 +25,7 @@
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/firmware.h> 26#include <asm/firmware.h>
27#include <linux/sort.h> 27#include <linux/sort.h>
28 28#include <asm/setup.h>
29#include "setup.h"
30 29
31LIST_HEAD(module_bug_list); 30LIST_HEAD(module_bug_list);
32 31
diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c
index 2e3200ca485f..6cff040bf456 100644
--- a/arch/powerpc/kernel/module_32.c
+++ b/arch/powerpc/kernel/module_32.c
@@ -26,8 +26,7 @@
26#include <linux/cache.h> 26#include <linux/cache.h>
27#include <linux/bug.h> 27#include <linux/bug.h>
28#include <linux/sort.h> 28#include <linux/sort.h>
29 29#include <asm/setup.h>
30#include "setup.h"
31 30
32#if 0 31#if 0
33#define DEBUGP printk 32#define DEBUGP printk
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index 6ee59a0eb268..12664c130d73 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -26,8 +26,7 @@
26#include <asm/firmware.h> 26#include <asm/firmware.h>
27#include <asm/code-patching.h> 27#include <asm/code-patching.h>
28#include <linux/sort.h> 28#include <linux/sort.h>
29 29#include <asm/setup.h>
30#include "setup.h"
31 30
32/* FIXME: We don't do .init separately. To do this, we'd need to have 31/* FIXME: We don't do .init separately. To do this, we'd need to have
33 a separate r2 value in the init and core section, and stub between 32 a separate r2 value in the init and core section, and stub between
@@ -62,6 +61,16 @@ struct ppc64_stub_entry
62 r2) into the stub. */ 61 r2) into the stub. */
63static struct ppc64_stub_entry ppc64_stub = 62static struct ppc64_stub_entry ppc64_stub =
64{ .jump = { 63{ .jump = {
64#ifdef __LITTLE_ENDIAN__
65 0x00, 0x00, 0x82, 0x3d, /* addis r12,r2, <high> */
66 0x00, 0x00, 0x8c, 0x39, /* addi r12,r12, <low> */
67 /* Save current r2 value in magic place on the stack. */
68 0x28, 0x00, 0x41, 0xf8, /* std r2,40(r1) */
69 0x20, 0x00, 0x6c, 0xe9, /* ld r11,32(r12) */
70 0x28, 0x00, 0x4c, 0xe8, /* ld r2,40(r12) */
71 0xa6, 0x03, 0x69, 0x7d, /* mtctr r11 */
72 0x20, 0x04, 0x80, 0x4e /* bctr */
73#else
65 0x3d, 0x82, 0x00, 0x00, /* addis r12,r2, <high> */ 74 0x3d, 0x82, 0x00, 0x00, /* addis r12,r2, <high> */
66 0x39, 0x8c, 0x00, 0x00, /* addi r12,r12, <low> */ 75 0x39, 0x8c, 0x00, 0x00, /* addi r12,r12, <low> */
67 /* Save current r2 value in magic place on the stack. */ 76 /* Save current r2 value in magic place on the stack. */
@@ -70,6 +79,7 @@ static struct ppc64_stub_entry ppc64_stub =
70 0xe8, 0x4c, 0x00, 0x28, /* ld r2,40(r12) */ 79 0xe8, 0x4c, 0x00, 0x28, /* ld r2,40(r12) */
71 0x7d, 0x69, 0x03, 0xa6, /* mtctr r11 */ 80 0x7d, 0x69, 0x03, 0xa6, /* mtctr r11 */
72 0x4e, 0x80, 0x04, 0x20 /* bctr */ 81 0x4e, 0x80, 0x04, 0x20 /* bctr */
82#endif
73} }; 83} };
74 84
75/* Count how many different 24-bit relocations (different symbol, 85/* Count how many different 24-bit relocations (different symbol,
@@ -269,8 +279,13 @@ static inline int create_stub(Elf64_Shdr *sechdrs,
269 279
270 *entry = ppc64_stub; 280 *entry = ppc64_stub;
271 281
282#ifdef __LITTLE_ENDIAN__
283 loc1 = (Elf64_Half *)&entry->jump[0];
284 loc2 = (Elf64_Half *)&entry->jump[4];
285#else
272 loc1 = (Elf64_Half *)&entry->jump[2]; 286 loc1 = (Elf64_Half *)&entry->jump[2];
273 loc2 = (Elf64_Half *)&entry->jump[6]; 287 loc2 = (Elf64_Half *)&entry->jump[6];
288#endif
274 289
275 /* Stub uses address relative to r2. */ 290 /* Stub uses address relative to r2. */
276 reladdr = (unsigned long)entry - my_r2(sechdrs, me); 291 reladdr = (unsigned long)entry - my_r2(sechdrs, me);
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index 8213ee1eb05a..fd82c289ab1c 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -223,9 +223,13 @@ static int __init nvram_write_header(struct nvram_partition * part)
223{ 223{
224 loff_t tmp_index; 224 loff_t tmp_index;
225 int rc; 225 int rc;
226 226 struct nvram_header phead;
227
228 memcpy(&phead, &part->header, NVRAM_HEADER_LEN);
229 phead.length = cpu_to_be16(phead.length);
230
227 tmp_index = part->index; 231 tmp_index = part->index;
228 rc = ppc_md.nvram_write((char *)&part->header, NVRAM_HEADER_LEN, &tmp_index); 232 rc = ppc_md.nvram_write((char *)&phead, NVRAM_HEADER_LEN, &tmp_index);
229 233
230 return rc; 234 return rc;
231} 235}
@@ -505,6 +509,8 @@ int __init nvram_scan_partitions(void)
505 509
506 memcpy(&phead, header, NVRAM_HEADER_LEN); 510 memcpy(&phead, header, NVRAM_HEADER_LEN);
507 511
512 phead.length = be16_to_cpu(phead.length);
513
508 err = 0; 514 err = 0;
509 c_sum = nvram_checksum(&phead); 515 c_sum = nvram_checksum(&phead);
510 if (c_sum != phead.checksum) { 516 if (c_sum != phead.checksum) {
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 3fc16e3beb9f..0620eaaaad45 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -46,7 +46,7 @@ struct lppaca lppaca[] = {
46static struct lppaca *extra_lppacas; 46static struct lppaca *extra_lppacas;
47static long __initdata lppaca_size; 47static long __initdata lppaca_size;
48 48
49static void allocate_lppacas(int nr_cpus, unsigned long limit) 49static void __init allocate_lppacas(int nr_cpus, unsigned long limit)
50{ 50{
51 if (nr_cpus <= NR_LPPACAS) 51 if (nr_cpus <= NR_LPPACAS)
52 return; 52 return;
@@ -57,7 +57,7 @@ static void allocate_lppacas(int nr_cpus, unsigned long limit)
57 PAGE_SIZE, limit)); 57 PAGE_SIZE, limit));
58} 58}
59 59
60static struct lppaca *new_lppaca(int cpu) 60static struct lppaca * __init new_lppaca(int cpu)
61{ 61{
62 struct lppaca *lp; 62 struct lppaca *lp;
63 63
@@ -70,7 +70,7 @@ static struct lppaca *new_lppaca(int cpu)
70 return lp; 70 return lp;
71} 71}
72 72
73static void free_lppacas(void) 73static void __init free_lppacas(void)
74{ 74{
75 long new_size = 0, nr; 75 long new_size = 0, nr;
76 76
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 905a24bb7acc..a1e3e40ca3fd 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -228,7 +228,7 @@ int pcibios_add_platform_entries(struct pci_dev *pdev)
228 */ 228 */
229static int pci_read_irq_line(struct pci_dev *pci_dev) 229static int pci_read_irq_line(struct pci_dev *pci_dev)
230{ 230{
231 struct of_irq oirq; 231 struct of_phandle_args oirq;
232 unsigned int virq; 232 unsigned int virq;
233 233
234 pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev)); 234 pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev));
@@ -237,7 +237,7 @@ static int pci_read_irq_line(struct pci_dev *pci_dev)
237 memset(&oirq, 0xff, sizeof(oirq)); 237 memset(&oirq, 0xff, sizeof(oirq));
238#endif 238#endif
239 /* Try to get a mapping from the device-tree */ 239 /* Try to get a mapping from the device-tree */
240 if (of_irq_map_pci(pci_dev, &oirq)) { 240 if (of_irq_parse_pci(pci_dev, &oirq)) {
241 u8 line, pin; 241 u8 line, pin;
242 242
243 /* If that fails, lets fallback to what is in the config 243 /* If that fails, lets fallback to what is in the config
@@ -263,11 +263,10 @@ static int pci_read_irq_line(struct pci_dev *pci_dev)
263 irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW); 263 irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW);
264 } else { 264 } else {
265 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n", 265 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
266 oirq.size, oirq.specifier[0], oirq.specifier[1], 266 oirq.args_count, oirq.args[0], oirq.args[1],
267 of_node_full_name(oirq.controller)); 267 of_node_full_name(oirq.np));
268 268
269 virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 269 virq = irq_create_of_mapping(&oirq);
270 oirq.size);
271 } 270 }
272 if(virq == NO_IRQ) { 271 if(virq == NO_IRQ) {
273 pr_debug(" Failed to map !\n"); 272 pr_debug(" Failed to map !\n");
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index 4368ec6fdc8c..ac0b034f9ae0 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -302,7 +302,7 @@ static struct pci_dev *of_scan_pci_dev(struct pci_bus *bus,
302 struct device_node *dn) 302 struct device_node *dn)
303{ 303{
304 struct pci_dev *dev = NULL; 304 struct pci_dev *dev = NULL;
305 const u32 *reg; 305 const __be32 *reg;
306 int reglen, devfn; 306 int reglen, devfn;
307 307
308 pr_debug(" * %s\n", dn->full_name); 308 pr_debug(" * %s\n", dn->full_name);
@@ -312,7 +312,7 @@ static struct pci_dev *of_scan_pci_dev(struct pci_bus *bus,
312 reg = of_get_property(dn, "reg", &reglen); 312 reg = of_get_property(dn, "reg", &reglen);
313 if (reg == NULL || reglen < 20) 313 if (reg == NULL || reglen < 20)
314 return NULL; 314 return NULL;
315 devfn = (reg[0] >> 8) & 0xff; 315 devfn = (of_read_number(reg, 1) >> 8) & 0xff;
316 316
317 /* Check if the PCI device is already there */ 317 /* Check if the PCI device is already there */
318 dev = pci_get_slot(bus, devfn); 318 dev = pci_get_slot(bus, devfn);
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 21646dbe1bb3..3bd77edd7610 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -79,10 +79,12 @@ EXPORT_SYMBOL(strlen);
79EXPORT_SYMBOL(strcmp); 79EXPORT_SYMBOL(strcmp);
80EXPORT_SYMBOL(strncmp); 80EXPORT_SYMBOL(strncmp);
81 81
82#ifndef CONFIG_GENERIC_CSUM
82EXPORT_SYMBOL(csum_partial); 83EXPORT_SYMBOL(csum_partial);
83EXPORT_SYMBOL(csum_partial_copy_generic); 84EXPORT_SYMBOL(csum_partial_copy_generic);
84EXPORT_SYMBOL(ip_fast_csum); 85EXPORT_SYMBOL(ip_fast_csum);
85EXPORT_SYMBOL(csum_tcpudp_magic); 86EXPORT_SYMBOL(csum_tcpudp_magic);
87#endif
86 88
87EXPORT_SYMBOL(__copy_tofrom_user); 89EXPORT_SYMBOL(__copy_tofrom_user);
88EXPORT_SYMBOL(__clear_user); 90EXPORT_SYMBOL(__clear_user);
@@ -98,9 +100,13 @@ EXPORT_SYMBOL(start_thread);
98 100
99#ifdef CONFIG_PPC_FPU 101#ifdef CONFIG_PPC_FPU
100EXPORT_SYMBOL(giveup_fpu); 102EXPORT_SYMBOL(giveup_fpu);
103EXPORT_SYMBOL(load_fp_state);
104EXPORT_SYMBOL(store_fp_state);
101#endif 105#endif
102#ifdef CONFIG_ALTIVEC 106#ifdef CONFIG_ALTIVEC
103EXPORT_SYMBOL(giveup_altivec); 107EXPORT_SYMBOL(giveup_altivec);
108EXPORT_SYMBOL(load_vr_state);
109EXPORT_SYMBOL(store_vr_state);
104#endif /* CONFIG_ALTIVEC */ 110#endif /* CONFIG_ALTIVEC */
105#ifdef CONFIG_VSX 111#ifdef CONFIG_VSX
106EXPORT_SYMBOL(giveup_vsx); 112EXPORT_SYMBOL(giveup_vsx);
@@ -143,10 +149,14 @@ EXPORT_SYMBOL(__ashldi3);
143EXPORT_SYMBOL(__lshrdi3); 149EXPORT_SYMBOL(__lshrdi3);
144int __ucmpdi2(unsigned long long, unsigned long long); 150int __ucmpdi2(unsigned long long, unsigned long long);
145EXPORT_SYMBOL(__ucmpdi2); 151EXPORT_SYMBOL(__ucmpdi2);
152int __cmpdi2(long long, long long);
153EXPORT_SYMBOL(__cmpdi2);
146#endif 154#endif
147long long __bswapdi2(long long); 155long long __bswapdi2(long long);
148EXPORT_SYMBOL(__bswapdi2); 156EXPORT_SYMBOL(__bswapdi2);
157#ifdef __BIG_ENDIAN__
149EXPORT_SYMBOL(memcpy); 158EXPORT_SYMBOL(memcpy);
159#endif
150EXPORT_SYMBOL(memset); 160EXPORT_SYMBOL(memset);
151EXPORT_SYMBOL(memmove); 161EXPORT_SYMBOL(memmove);
152EXPORT_SYMBOL(memcmp); 162EXPORT_SYMBOL(memcmp);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 6f428da53e20..75c2d1009985 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -314,28 +314,28 @@ static DEFINE_PER_CPU(struct arch_hw_breakpoint, current_brk);
314 */ 314 */
315static void set_debug_reg_defaults(struct thread_struct *thread) 315static void set_debug_reg_defaults(struct thread_struct *thread)
316{ 316{
317 thread->iac1 = thread->iac2 = 0; 317 thread->debug.iac1 = thread->debug.iac2 = 0;
318#if CONFIG_PPC_ADV_DEBUG_IACS > 2 318#if CONFIG_PPC_ADV_DEBUG_IACS > 2
319 thread->iac3 = thread->iac4 = 0; 319 thread->debug.iac3 = thread->debug.iac4 = 0;
320#endif 320#endif
321 thread->dac1 = thread->dac2 = 0; 321 thread->debug.dac1 = thread->debug.dac2 = 0;
322#if CONFIG_PPC_ADV_DEBUG_DVCS > 0 322#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
323 thread->dvc1 = thread->dvc2 = 0; 323 thread->debug.dvc1 = thread->debug.dvc2 = 0;
324#endif 324#endif
325 thread->dbcr0 = 0; 325 thread->debug.dbcr0 = 0;
326#ifdef CONFIG_BOOKE 326#ifdef CONFIG_BOOKE
327 /* 327 /*
328 * Force User/Supervisor bits to b11 (user-only MSR[PR]=1) 328 * Force User/Supervisor bits to b11 (user-only MSR[PR]=1)
329 */ 329 */
330 thread->dbcr1 = DBCR1_IAC1US | DBCR1_IAC2US | \ 330 thread->debug.dbcr1 = DBCR1_IAC1US | DBCR1_IAC2US |
331 DBCR1_IAC3US | DBCR1_IAC4US; 331 DBCR1_IAC3US | DBCR1_IAC4US;
332 /* 332 /*
333 * Force Data Address Compare User/Supervisor bits to be User-only 333 * Force Data Address Compare User/Supervisor bits to be User-only
334 * (0b11 MSR[PR]=1) and set all other bits in DBCR2 register to be 0. 334 * (0b11 MSR[PR]=1) and set all other bits in DBCR2 register to be 0.
335 */ 335 */
336 thread->dbcr2 = DBCR2_DAC1US | DBCR2_DAC2US; 336 thread->debug.dbcr2 = DBCR2_DAC1US | DBCR2_DAC2US;
337#else 337#else
338 thread->dbcr1 = 0; 338 thread->debug.dbcr1 = 0;
339#endif 339#endif
340} 340}
341 341
@@ -348,22 +348,22 @@ static void prime_debug_regs(struct thread_struct *thread)
348 */ 348 */
349 mtmsr(mfmsr() & ~MSR_DE); 349 mtmsr(mfmsr() & ~MSR_DE);
350 350
351 mtspr(SPRN_IAC1, thread->iac1); 351 mtspr(SPRN_IAC1, thread->debug.iac1);
352 mtspr(SPRN_IAC2, thread->iac2); 352 mtspr(SPRN_IAC2, thread->debug.iac2);
353#if CONFIG_PPC_ADV_DEBUG_IACS > 2 353#if CONFIG_PPC_ADV_DEBUG_IACS > 2
354 mtspr(SPRN_IAC3, thread->iac3); 354 mtspr(SPRN_IAC3, thread->debug.iac3);
355 mtspr(SPRN_IAC4, thread->iac4); 355 mtspr(SPRN_IAC4, thread->debug.iac4);
356#endif 356#endif
357 mtspr(SPRN_DAC1, thread->dac1); 357 mtspr(SPRN_DAC1, thread->debug.dac1);
358 mtspr(SPRN_DAC2, thread->dac2); 358 mtspr(SPRN_DAC2, thread->debug.dac2);
359#if CONFIG_PPC_ADV_DEBUG_DVCS > 0 359#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
360 mtspr(SPRN_DVC1, thread->dvc1); 360 mtspr(SPRN_DVC1, thread->debug.dvc1);
361 mtspr(SPRN_DVC2, thread->dvc2); 361 mtspr(SPRN_DVC2, thread->debug.dvc2);
362#endif 362#endif
363 mtspr(SPRN_DBCR0, thread->dbcr0); 363 mtspr(SPRN_DBCR0, thread->debug.dbcr0);
364 mtspr(SPRN_DBCR1, thread->dbcr1); 364 mtspr(SPRN_DBCR1, thread->debug.dbcr1);
365#ifdef CONFIG_BOOKE 365#ifdef CONFIG_BOOKE
366 mtspr(SPRN_DBCR2, thread->dbcr2); 366 mtspr(SPRN_DBCR2, thread->debug.dbcr2);
367#endif 367#endif
368} 368}
369/* 369/*
@@ -371,12 +371,13 @@ static void prime_debug_regs(struct thread_struct *thread)
371 * debug registers, set the debug registers from the values 371 * debug registers, set the debug registers from the values
372 * stored in the new thread. 372 * stored in the new thread.
373 */ 373 */
374static void switch_booke_debug_regs(struct thread_struct *new_thread) 374void switch_booke_debug_regs(struct thread_struct *new_thread)
375{ 375{
376 if ((current->thread.dbcr0 & DBCR0_IDM) 376 if ((current->thread.debug.dbcr0 & DBCR0_IDM)
377 || (new_thread->dbcr0 & DBCR0_IDM)) 377 || (new_thread->debug.dbcr0 & DBCR0_IDM))
378 prime_debug_regs(new_thread); 378 prime_debug_regs(new_thread);
379} 379}
380EXPORT_SYMBOL_GPL(switch_booke_debug_regs);
380#else /* !CONFIG_PPC_ADV_DEBUG_REGS */ 381#else /* !CONFIG_PPC_ADV_DEBUG_REGS */
381#ifndef CONFIG_HAVE_HW_BREAKPOINT 382#ifndef CONFIG_HAVE_HW_BREAKPOINT
382static void set_debug_reg_defaults(struct thread_struct *thread) 383static void set_debug_reg_defaults(struct thread_struct *thread)
@@ -596,12 +597,13 @@ struct task_struct *__switch_to(struct task_struct *prev,
596 struct task_struct *new) 597 struct task_struct *new)
597{ 598{
598 struct thread_struct *new_thread, *old_thread; 599 struct thread_struct *new_thread, *old_thread;
599 unsigned long flags;
600 struct task_struct *last; 600 struct task_struct *last;
601#ifdef CONFIG_PPC_BOOK3S_64 601#ifdef CONFIG_PPC_BOOK3S_64
602 struct ppc64_tlb_batch *batch; 602 struct ppc64_tlb_batch *batch;
603#endif 603#endif
604 604
605 WARN_ON(!irqs_disabled());
606
605 /* Back up the TAR across context switches. 607 /* Back up the TAR across context switches.
606 * Note that the TAR is not available for use in the kernel. (To 608 * Note that the TAR is not available for use in the kernel. (To
607 * provide this, the TAR should be backed up/restored on exception 609 * provide this, the TAR should be backed up/restored on exception
@@ -721,8 +723,6 @@ struct task_struct *__switch_to(struct task_struct *prev,
721 } 723 }
722#endif /* CONFIG_PPC_BOOK3S_64 */ 724#endif /* CONFIG_PPC_BOOK3S_64 */
723 725
724 local_irq_save(flags);
725
726 /* 726 /*
727 * We can't take a PMU exception inside _switch() since there is a 727 * We can't take a PMU exception inside _switch() since there is a
728 * window where the kernel stack SLB and the kernel stack are out 728 * window where the kernel stack SLB and the kernel stack are out
@@ -742,8 +742,6 @@ struct task_struct *__switch_to(struct task_struct *prev,
742 } 742 }
743#endif /* CONFIG_PPC_BOOK3S_64 */ 743#endif /* CONFIG_PPC_BOOK3S_64 */
744 744
745 local_irq_restore(flags);
746
747 return last; 745 return last;
748} 746}
749 747
@@ -1000,13 +998,19 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
1000 kregs = (struct pt_regs *) sp; 998 kregs = (struct pt_regs *) sp;
1001 sp -= STACK_FRAME_OVERHEAD; 999 sp -= STACK_FRAME_OVERHEAD;
1002 p->thread.ksp = sp; 1000 p->thread.ksp = sp;
1001#ifdef CONFIG_PPC32
1003 p->thread.ksp_limit = (unsigned long)task_stack_page(p) + 1002 p->thread.ksp_limit = (unsigned long)task_stack_page(p) +
1004 _ALIGN_UP(sizeof(struct thread_info), 16); 1003 _ALIGN_UP(sizeof(struct thread_info), 16);
1005 1004#endif
1006#ifdef CONFIG_HAVE_HW_BREAKPOINT 1005#ifdef CONFIG_HAVE_HW_BREAKPOINT
1007 p->thread.ptrace_bps[0] = NULL; 1006 p->thread.ptrace_bps[0] = NULL;
1008#endif 1007#endif
1009 1008
1009 p->thread.fp_save_area = NULL;
1010#ifdef CONFIG_ALTIVEC
1011 p->thread.vr_save_area = NULL;
1012#endif
1013
1010#ifdef CONFIG_PPC_STD_MMU_64 1014#ifdef CONFIG_PPC_STD_MMU_64
1011 if (mmu_has_feature(MMU_FTR_SLB)) { 1015 if (mmu_has_feature(MMU_FTR_SLB)) {
1012 unsigned long sp_vsid; 1016 unsigned long sp_vsid;
@@ -1112,12 +1116,12 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
1112#ifdef CONFIG_VSX 1116#ifdef CONFIG_VSX
1113 current->thread.used_vsr = 0; 1117 current->thread.used_vsr = 0;
1114#endif 1118#endif
1115 memset(current->thread.fpr, 0, sizeof(current->thread.fpr)); 1119 memset(&current->thread.fp_state, 0, sizeof(current->thread.fp_state));
1116 current->thread.fpscr.val = 0; 1120 current->thread.fp_save_area = NULL;
1117#ifdef CONFIG_ALTIVEC 1121#ifdef CONFIG_ALTIVEC
1118 memset(current->thread.vr, 0, sizeof(current->thread.vr)); 1122 memset(&current->thread.vr_state, 0, sizeof(current->thread.vr_state));
1119 memset(&current->thread.vscr, 0, sizeof(current->thread.vscr)); 1123 current->thread.vr_state.vscr.u[3] = 0x00010000; /* Java mode disabled */
1120 current->thread.vscr.u[3] = 0x00010000; /* Java mode disabled */ 1124 current->thread.vr_save_area = NULL;
1121 current->thread.vrsave = 0; 1125 current->thread.vrsave = 0;
1122 current->thread.used_vr = 0; 1126 current->thread.used_vr = 0;
1123#endif /* CONFIG_ALTIVEC */ 1127#endif /* CONFIG_ALTIVEC */
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index b7634ce41dbc..f3a47098fb8e 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -546,15 +546,6 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
546 memblock_add(base, size); 546 memblock_add(base, size);
547} 547}
548 548
549#ifdef CONFIG_BLK_DEV_INITRD
550void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
551{
552 initrd_start = (unsigned long)__va(start);
553 initrd_end = (unsigned long)__va(end);
554 initrd_below_start_ok = 1;
555}
556#endif
557
558static void __init early_reserve_mem_dt(void) 549static void __init early_reserve_mem_dt(void)
559{ 550{
560 unsigned long i, len, dt_root; 551 unsigned long i, len, dt_root;
@@ -761,37 +752,6 @@ void __init early_init_devtree(void *params)
761 *******/ 752 *******/
762 753
763/** 754/**
764 * of_find_next_cache_node - Find a node's subsidiary cache
765 * @np: node of type "cpu" or "cache"
766 *
767 * Returns a node pointer with refcount incremented, use
768 * of_node_put() on it when done. Caller should hold a reference
769 * to np.
770 */
771struct device_node *of_find_next_cache_node(struct device_node *np)
772{
773 struct device_node *child;
774 const phandle *handle;
775
776 handle = of_get_property(np, "l2-cache", NULL);
777 if (!handle)
778 handle = of_get_property(np, "next-level-cache", NULL);
779
780 if (handle)
781 return of_find_node_by_phandle(*handle);
782
783 /* OF on pmac has nodes instead of properties named "l2-cache"
784 * beneath CPU nodes.
785 */
786 if (!strcmp(np->type, "cpu"))
787 for_each_child_of_node(np, child)
788 if (!strcmp(child->type, "cache"))
789 return child;
790
791 return NULL;
792}
793
794/**
795 * of_get_ibm_chip_id - Returns the IBM "chip-id" of a device 755 * of_get_ibm_chip_id - Returns the IBM "chip-id" of a device
796 * @np: device node of the device 756 * @np: device node of the device
797 * 757 *
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 12e656ffe60e..cb64a6e1dc51 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -196,6 +196,8 @@ static int __initdata mem_reserve_cnt;
196 196
197static cell_t __initdata regbuf[1024]; 197static cell_t __initdata regbuf[1024];
198 198
199static bool rtas_has_query_cpu_stopped;
200
199 201
200/* 202/*
201 * Error results ... some OF calls will return "-1" on error, some 203 * Error results ... some OF calls will return "-1" on error, some
@@ -856,7 +858,8 @@ static void __init prom_send_capabilities(void)
856{ 858{
857 ihandle root; 859 ihandle root;
858 prom_arg_t ret; 860 prom_arg_t ret;
859 __be32 *cores; 861 u32 cores;
862 unsigned char *ptcores;
860 863
861 root = call_prom("open", 1, 1, ADDR("/")); 864 root = call_prom("open", 1, 1, ADDR("/"));
862 if (root != 0) { 865 if (root != 0) {
@@ -866,15 +869,30 @@ static void __init prom_send_capabilities(void)
866 * (we assume this is the same for all cores) and use it to 869 * (we assume this is the same for all cores) and use it to
867 * divide NR_CPUS. 870 * divide NR_CPUS.
868 */ 871 */
869 cores = (__be32 *)&ibm_architecture_vec[IBM_ARCH_VEC_NRCORES_OFFSET]; 872
870 if (be32_to_cpup(cores) != NR_CPUS) { 873 /* The core value may start at an odd address. If such a word
874 * access is made at a cache line boundary, this leads to an
875 * exception which may not be handled at this time.
876 * Forcing a per byte access to avoid exception.
877 */
878 ptcores = &ibm_architecture_vec[IBM_ARCH_VEC_NRCORES_OFFSET];
879 cores = 0;
880 cores |= ptcores[0] << 24;
881 cores |= ptcores[1] << 16;
882 cores |= ptcores[2] << 8;
883 cores |= ptcores[3];
884 if (cores != NR_CPUS) {
871 prom_printf("WARNING ! " 885 prom_printf("WARNING ! "
872 "ibm_architecture_vec structure inconsistent: %lu!\n", 886 "ibm_architecture_vec structure inconsistent: %lu!\n",
873 be32_to_cpup(cores)); 887 cores);
874 } else { 888 } else {
875 *cores = cpu_to_be32(DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads())); 889 cores = DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads());
876 prom_printf("Max number of cores passed to firmware: %lu (NR_CPUS = %lu)\n", 890 prom_printf("Max number of cores passed to firmware: %lu (NR_CPUS = %lu)\n",
877 be32_to_cpup(cores), NR_CPUS); 891 cores, NR_CPUS);
892 ptcores[0] = (cores >> 24) & 0xff;
893 ptcores[1] = (cores >> 16) & 0xff;
894 ptcores[2] = (cores >> 8) & 0xff;
895 ptcores[3] = cores & 0xff;
878 } 896 }
879 897
880 /* try calling the ibm,client-architecture-support method */ 898 /* try calling the ibm,client-architecture-support method */
@@ -1574,6 +1592,11 @@ static void __init prom_instantiate_rtas(void)
1574 prom_setprop(rtas_node, "/rtas", "linux,rtas-entry", 1592 prom_setprop(rtas_node, "/rtas", "linux,rtas-entry",
1575 &val, sizeof(val)); 1593 &val, sizeof(val));
1576 1594
1595 /* Check if it supports "query-cpu-stopped-state" */
1596 if (prom_getprop(rtas_node, "query-cpu-stopped-state",
1597 &val, sizeof(val)) != PROM_ERROR)
1598 rtas_has_query_cpu_stopped = true;
1599
1577#if defined(CONFIG_PPC_POWERNV) && defined(__BIG_ENDIAN__) 1600#if defined(CONFIG_PPC_POWERNV) && defined(__BIG_ENDIAN__)
1578 /* PowerVN takeover hack */ 1601 /* PowerVN takeover hack */
1579 prom_rtas_data = base; 1602 prom_rtas_data = base;
@@ -1815,6 +1838,18 @@ static void __init prom_hold_cpus(void)
1815 = (void *) LOW_ADDR(__secondary_hold_acknowledge); 1838 = (void *) LOW_ADDR(__secondary_hold_acknowledge);
1816 unsigned long secondary_hold = LOW_ADDR(__secondary_hold); 1839 unsigned long secondary_hold = LOW_ADDR(__secondary_hold);
1817 1840
1841 /*
1842 * On pseries, if RTAS supports "query-cpu-stopped-state",
1843 * we skip this stage, the CPUs will be started by the
1844 * kernel using RTAS.
1845 */
1846 if ((of_platform == PLATFORM_PSERIES ||
1847 of_platform == PLATFORM_PSERIES_LPAR) &&
1848 rtas_has_query_cpu_stopped) {
1849 prom_printf("prom_hold_cpus: skipped\n");
1850 return;
1851 }
1852
1818 prom_debug("prom_hold_cpus: start...\n"); 1853 prom_debug("prom_hold_cpus: start...\n");
1819 prom_debug(" 1) spinloop = 0x%x\n", (unsigned long)spinloop); 1854 prom_debug(" 1) spinloop = 0x%x\n", (unsigned long)spinloop);
1820 prom_debug(" 1) *spinloop = 0x%x\n", *spinloop); 1855 prom_debug(" 1) *spinloop = 0x%x\n", *spinloop);
@@ -3011,6 +3046,8 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
3011 * On non-powermacs, put all CPUs in spin-loops. 3046 * On non-powermacs, put all CPUs in spin-loops.
3012 * 3047 *
3013 * PowerMacs use a different mechanism to spin CPUs 3048 * PowerMacs use a different mechanism to spin CPUs
3049 *
3050 * (This must be done after instanciating RTAS)
3014 */ 3051 */
3015 if (of_platform != PLATFORM_POWERMAC && 3052 if (of_platform != PLATFORM_POWERMAC &&
3016 of_platform != PLATFORM_OPAL) 3053 of_platform != PLATFORM_OPAL)
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 9a0d24c390a3..75fb40498b41 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -362,7 +362,7 @@ static int fpr_get(struct task_struct *target, const struct user_regset *regset,
362 void *kbuf, void __user *ubuf) 362 void *kbuf, void __user *ubuf)
363{ 363{
364#ifdef CONFIG_VSX 364#ifdef CONFIG_VSX
365 double buf[33]; 365 u64 buf[33];
366 int i; 366 int i;
367#endif 367#endif
368 flush_fp_to_thread(target); 368 flush_fp_to_thread(target);
@@ -371,15 +371,15 @@ static int fpr_get(struct task_struct *target, const struct user_regset *regset,
371 /* copy to local buffer then write that out */ 371 /* copy to local buffer then write that out */
372 for (i = 0; i < 32 ; i++) 372 for (i = 0; i < 32 ; i++)
373 buf[i] = target->thread.TS_FPR(i); 373 buf[i] = target->thread.TS_FPR(i);
374 memcpy(&buf[32], &target->thread.fpscr, sizeof(double)); 374 buf[32] = target->thread.fp_state.fpscr;
375 return user_regset_copyout(&pos, &count, &kbuf, &ubuf, buf, 0, -1); 375 return user_regset_copyout(&pos, &count, &kbuf, &ubuf, buf, 0, -1);
376 376
377#else 377#else
378 BUILD_BUG_ON(offsetof(struct thread_struct, fpscr) != 378 BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) !=
379 offsetof(struct thread_struct, TS_FPR(32))); 379 offsetof(struct thread_fp_state, fpr[32][0]));
380 380
381 return user_regset_copyout(&pos, &count, &kbuf, &ubuf, 381 return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
382 &target->thread.fpr, 0, -1); 382 &target->thread.fp_state, 0, -1);
383#endif 383#endif
384} 384}
385 385
@@ -388,7 +388,7 @@ static int fpr_set(struct task_struct *target, const struct user_regset *regset,
388 const void *kbuf, const void __user *ubuf) 388 const void *kbuf, const void __user *ubuf)
389{ 389{
390#ifdef CONFIG_VSX 390#ifdef CONFIG_VSX
391 double buf[33]; 391 u64 buf[33];
392 int i; 392 int i;
393#endif 393#endif
394 flush_fp_to_thread(target); 394 flush_fp_to_thread(target);
@@ -400,14 +400,14 @@ static int fpr_set(struct task_struct *target, const struct user_regset *regset,
400 return i; 400 return i;
401 for (i = 0; i < 32 ; i++) 401 for (i = 0; i < 32 ; i++)
402 target->thread.TS_FPR(i) = buf[i]; 402 target->thread.TS_FPR(i) = buf[i];
403 memcpy(&target->thread.fpscr, &buf[32], sizeof(double)); 403 target->thread.fp_state.fpscr = buf[32];
404 return 0; 404 return 0;
405#else 405#else
406 BUILD_BUG_ON(offsetof(struct thread_struct, fpscr) != 406 BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) !=
407 offsetof(struct thread_struct, TS_FPR(32))); 407 offsetof(struct thread_fp_state, fpr[32][0]));
408 408
409 return user_regset_copyin(&pos, &count, &kbuf, &ubuf, 409 return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
410 &target->thread.fpr, 0, -1); 410 &target->thread.fp_state, 0, -1);
411#endif 411#endif
412} 412}
413 413
@@ -440,11 +440,11 @@ static int vr_get(struct task_struct *target, const struct user_regset *regset,
440 440
441 flush_altivec_to_thread(target); 441 flush_altivec_to_thread(target);
442 442
443 BUILD_BUG_ON(offsetof(struct thread_struct, vscr) != 443 BUILD_BUG_ON(offsetof(struct thread_vr_state, vscr) !=
444 offsetof(struct thread_struct, vr[32])); 444 offsetof(struct thread_vr_state, vr[32]));
445 445
446 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, 446 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
447 &target->thread.vr, 0, 447 &target->thread.vr_state, 0,
448 33 * sizeof(vector128)); 448 33 * sizeof(vector128));
449 if (!ret) { 449 if (!ret) {
450 /* 450 /*
@@ -471,11 +471,12 @@ static int vr_set(struct task_struct *target, const struct user_regset *regset,
471 471
472 flush_altivec_to_thread(target); 472 flush_altivec_to_thread(target);
473 473
474 BUILD_BUG_ON(offsetof(struct thread_struct, vscr) != 474 BUILD_BUG_ON(offsetof(struct thread_vr_state, vscr) !=
475 offsetof(struct thread_struct, vr[32])); 475 offsetof(struct thread_vr_state, vr[32]));
476 476
477 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, 477 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
478 &target->thread.vr, 0, 33 * sizeof(vector128)); 478 &target->thread.vr_state, 0,
479 33 * sizeof(vector128));
479 if (!ret && count > 0) { 480 if (!ret && count > 0) {
480 /* 481 /*
481 * We use only the first word of vrsave. 482 * We use only the first word of vrsave.
@@ -514,13 +515,13 @@ static int vsr_get(struct task_struct *target, const struct user_regset *regset,
514 unsigned int pos, unsigned int count, 515 unsigned int pos, unsigned int count,
515 void *kbuf, void __user *ubuf) 516 void *kbuf, void __user *ubuf)
516{ 517{
517 double buf[32]; 518 u64 buf[32];
518 int ret, i; 519 int ret, i;
519 520
520 flush_vsx_to_thread(target); 521 flush_vsx_to_thread(target);
521 522
522 for (i = 0; i < 32 ; i++) 523 for (i = 0; i < 32 ; i++)
523 buf[i] = target->thread.fpr[i][TS_VSRLOWOFFSET]; 524 buf[i] = target->thread.fp_state.fpr[i][TS_VSRLOWOFFSET];
524 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, 525 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
525 buf, 0, 32 * sizeof(double)); 526 buf, 0, 32 * sizeof(double));
526 527
@@ -531,7 +532,7 @@ static int vsr_set(struct task_struct *target, const struct user_regset *regset,
531 unsigned int pos, unsigned int count, 532 unsigned int pos, unsigned int count,
532 const void *kbuf, const void __user *ubuf) 533 const void *kbuf, const void __user *ubuf)
533{ 534{
534 double buf[32]; 535 u64 buf[32];
535 int ret,i; 536 int ret,i;
536 537
537 flush_vsx_to_thread(target); 538 flush_vsx_to_thread(target);
@@ -539,7 +540,7 @@ static int vsr_set(struct task_struct *target, const struct user_regset *regset,
539 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, 540 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
540 buf, 0, 32 * sizeof(double)); 541 buf, 0, 32 * sizeof(double));
541 for (i = 0; i < 32 ; i++) 542 for (i = 0; i < 32 ; i++)
542 target->thread.fpr[i][TS_VSRLOWOFFSET] = buf[i]; 543 target->thread.fp_state.fpr[i][TS_VSRLOWOFFSET] = buf[i];
543 544
544 545
545 return ret; 546 return ret;
@@ -657,7 +658,7 @@ static const struct user_regset native_regsets[] = {
657#endif 658#endif
658#ifdef CONFIG_SPE 659#ifdef CONFIG_SPE
659 [REGSET_SPE] = { 660 [REGSET_SPE] = {
660 .n = 35, 661 .core_note_type = NT_PPC_SPE, .n = 35,
661 .size = sizeof(u32), .align = sizeof(u32), 662 .size = sizeof(u32), .align = sizeof(u32),
662 .active = evr_active, .get = evr_get, .set = evr_set 663 .active = evr_active, .get = evr_get, .set = evr_set
663 }, 664 },
@@ -854,8 +855,8 @@ void user_enable_single_step(struct task_struct *task)
854 855
855 if (regs != NULL) { 856 if (regs != NULL) {
856#ifdef CONFIG_PPC_ADV_DEBUG_REGS 857#ifdef CONFIG_PPC_ADV_DEBUG_REGS
857 task->thread.dbcr0 &= ~DBCR0_BT; 858 task->thread.debug.dbcr0 &= ~DBCR0_BT;
858 task->thread.dbcr0 |= DBCR0_IDM | DBCR0_IC; 859 task->thread.debug.dbcr0 |= DBCR0_IDM | DBCR0_IC;
859 regs->msr |= MSR_DE; 860 regs->msr |= MSR_DE;
860#else 861#else
861 regs->msr &= ~MSR_BE; 862 regs->msr &= ~MSR_BE;
@@ -871,8 +872,8 @@ void user_enable_block_step(struct task_struct *task)
871 872
872 if (regs != NULL) { 873 if (regs != NULL) {
873#ifdef CONFIG_PPC_ADV_DEBUG_REGS 874#ifdef CONFIG_PPC_ADV_DEBUG_REGS
874 task->thread.dbcr0 &= ~DBCR0_IC; 875 task->thread.debug.dbcr0 &= ~DBCR0_IC;
875 task->thread.dbcr0 = DBCR0_IDM | DBCR0_BT; 876 task->thread.debug.dbcr0 = DBCR0_IDM | DBCR0_BT;
876 regs->msr |= MSR_DE; 877 regs->msr |= MSR_DE;
877#else 878#else
878 regs->msr &= ~MSR_SE; 879 regs->msr &= ~MSR_SE;
@@ -894,16 +895,16 @@ void user_disable_single_step(struct task_struct *task)
894 * And, after doing so, if all debug flags are off, turn 895 * And, after doing so, if all debug flags are off, turn
895 * off DBCR0(IDM) and MSR(DE) .... Torez 896 * off DBCR0(IDM) and MSR(DE) .... Torez
896 */ 897 */
897 task->thread.dbcr0 &= ~DBCR0_IC; 898 task->thread.debug.dbcr0 &= ~(DBCR0_IC|DBCR0_BT);
898 /* 899 /*
899 * Test to see if any of the DBCR_ACTIVE_EVENTS bits are set. 900 * Test to see if any of the DBCR_ACTIVE_EVENTS bits are set.
900 */ 901 */
901 if (!DBCR_ACTIVE_EVENTS(task->thread.dbcr0, 902 if (!DBCR_ACTIVE_EVENTS(task->thread.debug.dbcr0,
902 task->thread.dbcr1)) { 903 task->thread.debug.dbcr1)) {
903 /* 904 /*
904 * All debug events were off..... 905 * All debug events were off.....
905 */ 906 */
906 task->thread.dbcr0 &= ~DBCR0_IDM; 907 task->thread.debug.dbcr0 &= ~DBCR0_IDM;
907 regs->msr &= ~MSR_DE; 908 regs->msr &= ~MSR_DE;
908 } 909 }
909#else 910#else
@@ -1022,14 +1023,14 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
1022 */ 1023 */
1023 1024
1024 /* DAC's hold the whole address without any mode flags */ 1025 /* DAC's hold the whole address without any mode flags */
1025 task->thread.dac1 = data & ~0x3UL; 1026 task->thread.debug.dac1 = data & ~0x3UL;
1026 1027
1027 if (task->thread.dac1 == 0) { 1028 if (task->thread.debug.dac1 == 0) {
1028 dbcr_dac(task) &= ~(DBCR_DAC1R | DBCR_DAC1W); 1029 dbcr_dac(task) &= ~(DBCR_DAC1R | DBCR_DAC1W);
1029 if (!DBCR_ACTIVE_EVENTS(task->thread.dbcr0, 1030 if (!DBCR_ACTIVE_EVENTS(task->thread.debug.dbcr0,
1030 task->thread.dbcr1)) { 1031 task->thread.debug.dbcr1)) {
1031 task->thread.regs->msr &= ~MSR_DE; 1032 task->thread.regs->msr &= ~MSR_DE;
1032 task->thread.dbcr0 &= ~DBCR0_IDM; 1033 task->thread.debug.dbcr0 &= ~DBCR0_IDM;
1033 } 1034 }
1034 return 0; 1035 return 0;
1035 } 1036 }
@@ -1041,7 +1042,7 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
1041 1042
1042 /* Set the Internal Debugging flag (IDM bit 1) for the DBCR0 1043 /* Set the Internal Debugging flag (IDM bit 1) for the DBCR0
1043 register */ 1044 register */
1044 task->thread.dbcr0 |= DBCR0_IDM; 1045 task->thread.debug.dbcr0 |= DBCR0_IDM;
1045 1046
1046 /* Check for write and read flags and set DBCR0 1047 /* Check for write and read flags and set DBCR0
1047 accordingly */ 1048 accordingly */
@@ -1071,10 +1072,10 @@ static long set_instruction_bp(struct task_struct *child,
1071 struct ppc_hw_breakpoint *bp_info) 1072 struct ppc_hw_breakpoint *bp_info)
1072{ 1073{
1073 int slot; 1074 int slot;
1074 int slot1_in_use = ((child->thread.dbcr0 & DBCR0_IAC1) != 0); 1075 int slot1_in_use = ((child->thread.debug.dbcr0 & DBCR0_IAC1) != 0);
1075 int slot2_in_use = ((child->thread.dbcr0 & DBCR0_IAC2) != 0); 1076 int slot2_in_use = ((child->thread.debug.dbcr0 & DBCR0_IAC2) != 0);
1076 int slot3_in_use = ((child->thread.dbcr0 & DBCR0_IAC3) != 0); 1077 int slot3_in_use = ((child->thread.debug.dbcr0 & DBCR0_IAC3) != 0);
1077 int slot4_in_use = ((child->thread.dbcr0 & DBCR0_IAC4) != 0); 1078 int slot4_in_use = ((child->thread.debug.dbcr0 & DBCR0_IAC4) != 0);
1078 1079
1079 if (dbcr_iac_range(child) & DBCR_IAC12MODE) 1080 if (dbcr_iac_range(child) & DBCR_IAC12MODE)
1080 slot2_in_use = 1; 1081 slot2_in_use = 1;
@@ -1093,9 +1094,9 @@ static long set_instruction_bp(struct task_struct *child,
1093 /* We need a pair of IAC regsisters */ 1094 /* We need a pair of IAC regsisters */
1094 if ((!slot1_in_use) && (!slot2_in_use)) { 1095 if ((!slot1_in_use) && (!slot2_in_use)) {
1095 slot = 1; 1096 slot = 1;
1096 child->thread.iac1 = bp_info->addr; 1097 child->thread.debug.iac1 = bp_info->addr;
1097 child->thread.iac2 = bp_info->addr2; 1098 child->thread.debug.iac2 = bp_info->addr2;
1098 child->thread.dbcr0 |= DBCR0_IAC1; 1099 child->thread.debug.dbcr0 |= DBCR0_IAC1;
1099 if (bp_info->addr_mode == 1100 if (bp_info->addr_mode ==
1100 PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE) 1101 PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE)
1101 dbcr_iac_range(child) |= DBCR_IAC12X; 1102 dbcr_iac_range(child) |= DBCR_IAC12X;
@@ -1104,9 +1105,9 @@ static long set_instruction_bp(struct task_struct *child,
1104#if CONFIG_PPC_ADV_DEBUG_IACS > 2 1105#if CONFIG_PPC_ADV_DEBUG_IACS > 2
1105 } else if ((!slot3_in_use) && (!slot4_in_use)) { 1106 } else if ((!slot3_in_use) && (!slot4_in_use)) {
1106 slot = 3; 1107 slot = 3;
1107 child->thread.iac3 = bp_info->addr; 1108 child->thread.debug.iac3 = bp_info->addr;
1108 child->thread.iac4 = bp_info->addr2; 1109 child->thread.debug.iac4 = bp_info->addr2;
1109 child->thread.dbcr0 |= DBCR0_IAC3; 1110 child->thread.debug.dbcr0 |= DBCR0_IAC3;
1110 if (bp_info->addr_mode == 1111 if (bp_info->addr_mode ==
1111 PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE) 1112 PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE)
1112 dbcr_iac_range(child) |= DBCR_IAC34X; 1113 dbcr_iac_range(child) |= DBCR_IAC34X;
@@ -1126,30 +1127,30 @@ static long set_instruction_bp(struct task_struct *child,
1126 */ 1127 */
1127 if (slot2_in_use || (slot3_in_use == slot4_in_use)) { 1128 if (slot2_in_use || (slot3_in_use == slot4_in_use)) {
1128 slot = 1; 1129 slot = 1;
1129 child->thread.iac1 = bp_info->addr; 1130 child->thread.debug.iac1 = bp_info->addr;
1130 child->thread.dbcr0 |= DBCR0_IAC1; 1131 child->thread.debug.dbcr0 |= DBCR0_IAC1;
1131 goto out; 1132 goto out;
1132 } 1133 }
1133 } 1134 }
1134 if (!slot2_in_use) { 1135 if (!slot2_in_use) {
1135 slot = 2; 1136 slot = 2;
1136 child->thread.iac2 = bp_info->addr; 1137 child->thread.debug.iac2 = bp_info->addr;
1137 child->thread.dbcr0 |= DBCR0_IAC2; 1138 child->thread.debug.dbcr0 |= DBCR0_IAC2;
1138#if CONFIG_PPC_ADV_DEBUG_IACS > 2 1139#if CONFIG_PPC_ADV_DEBUG_IACS > 2
1139 } else if (!slot3_in_use) { 1140 } else if (!slot3_in_use) {
1140 slot = 3; 1141 slot = 3;
1141 child->thread.iac3 = bp_info->addr; 1142 child->thread.debug.iac3 = bp_info->addr;
1142 child->thread.dbcr0 |= DBCR0_IAC3; 1143 child->thread.debug.dbcr0 |= DBCR0_IAC3;
1143 } else if (!slot4_in_use) { 1144 } else if (!slot4_in_use) {
1144 slot = 4; 1145 slot = 4;
1145 child->thread.iac4 = bp_info->addr; 1146 child->thread.debug.iac4 = bp_info->addr;
1146 child->thread.dbcr0 |= DBCR0_IAC4; 1147 child->thread.debug.dbcr0 |= DBCR0_IAC4;
1147#endif 1148#endif
1148 } else 1149 } else
1149 return -ENOSPC; 1150 return -ENOSPC;
1150 } 1151 }
1151out: 1152out:
1152 child->thread.dbcr0 |= DBCR0_IDM; 1153 child->thread.debug.dbcr0 |= DBCR0_IDM;
1153 child->thread.regs->msr |= MSR_DE; 1154 child->thread.regs->msr |= MSR_DE;
1154 1155
1155 return slot; 1156 return slot;
@@ -1159,49 +1160,49 @@ static int del_instruction_bp(struct task_struct *child, int slot)
1159{ 1160{
1160 switch (slot) { 1161 switch (slot) {
1161 case 1: 1162 case 1:
1162 if ((child->thread.dbcr0 & DBCR0_IAC1) == 0) 1163 if ((child->thread.debug.dbcr0 & DBCR0_IAC1) == 0)
1163 return -ENOENT; 1164 return -ENOENT;
1164 1165
1165 if (dbcr_iac_range(child) & DBCR_IAC12MODE) { 1166 if (dbcr_iac_range(child) & DBCR_IAC12MODE) {
1166 /* address range - clear slots 1 & 2 */ 1167 /* address range - clear slots 1 & 2 */
1167 child->thread.iac2 = 0; 1168 child->thread.debug.iac2 = 0;
1168 dbcr_iac_range(child) &= ~DBCR_IAC12MODE; 1169 dbcr_iac_range(child) &= ~DBCR_IAC12MODE;
1169 } 1170 }
1170 child->thread.iac1 = 0; 1171 child->thread.debug.iac1 = 0;
1171 child->thread.dbcr0 &= ~DBCR0_IAC1; 1172 child->thread.debug.dbcr0 &= ~DBCR0_IAC1;
1172 break; 1173 break;
1173 case 2: 1174 case 2:
1174 if ((child->thread.dbcr0 & DBCR0_IAC2) == 0) 1175 if ((child->thread.debug.dbcr0 & DBCR0_IAC2) == 0)
1175 return -ENOENT; 1176 return -ENOENT;
1176 1177
1177 if (dbcr_iac_range(child) & DBCR_IAC12MODE) 1178 if (dbcr_iac_range(child) & DBCR_IAC12MODE)
1178 /* used in a range */ 1179 /* used in a range */
1179 return -EINVAL; 1180 return -EINVAL;
1180 child->thread.iac2 = 0; 1181 child->thread.debug.iac2 = 0;
1181 child->thread.dbcr0 &= ~DBCR0_IAC2; 1182 child->thread.debug.dbcr0 &= ~DBCR0_IAC2;
1182 break; 1183 break;
1183#if CONFIG_PPC_ADV_DEBUG_IACS > 2 1184#if CONFIG_PPC_ADV_DEBUG_IACS > 2
1184 case 3: 1185 case 3:
1185 if ((child->thread.dbcr0 & DBCR0_IAC3) == 0) 1186 if ((child->thread.debug.dbcr0 & DBCR0_IAC3) == 0)
1186 return -ENOENT; 1187 return -ENOENT;
1187 1188
1188 if (dbcr_iac_range(child) & DBCR_IAC34MODE) { 1189 if (dbcr_iac_range(child) & DBCR_IAC34MODE) {
1189 /* address range - clear slots 3 & 4 */ 1190 /* address range - clear slots 3 & 4 */
1190 child->thread.iac4 = 0; 1191 child->thread.debug.iac4 = 0;
1191 dbcr_iac_range(child) &= ~DBCR_IAC34MODE; 1192 dbcr_iac_range(child) &= ~DBCR_IAC34MODE;
1192 } 1193 }
1193 child->thread.iac3 = 0; 1194 child->thread.debug.iac3 = 0;
1194 child->thread.dbcr0 &= ~DBCR0_IAC3; 1195 child->thread.debug.dbcr0 &= ~DBCR0_IAC3;
1195 break; 1196 break;
1196 case 4: 1197 case 4:
1197 if ((child->thread.dbcr0 & DBCR0_IAC4) == 0) 1198 if ((child->thread.debug.dbcr0 & DBCR0_IAC4) == 0)
1198 return -ENOENT; 1199 return -ENOENT;
1199 1200
1200 if (dbcr_iac_range(child) & DBCR_IAC34MODE) 1201 if (dbcr_iac_range(child) & DBCR_IAC34MODE)
1201 /* Used in a range */ 1202 /* Used in a range */
1202 return -EINVAL; 1203 return -EINVAL;
1203 child->thread.iac4 = 0; 1204 child->thread.debug.iac4 = 0;
1204 child->thread.dbcr0 &= ~DBCR0_IAC4; 1205 child->thread.debug.dbcr0 &= ~DBCR0_IAC4;
1205 break; 1206 break;
1206#endif 1207#endif
1207 default: 1208 default:
@@ -1231,18 +1232,18 @@ static int set_dac(struct task_struct *child, struct ppc_hw_breakpoint *bp_info)
1231 dbcr_dac(child) |= DBCR_DAC1R; 1232 dbcr_dac(child) |= DBCR_DAC1R;
1232 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE) 1233 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE)
1233 dbcr_dac(child) |= DBCR_DAC1W; 1234 dbcr_dac(child) |= DBCR_DAC1W;
1234 child->thread.dac1 = (unsigned long)bp_info->addr; 1235 child->thread.debug.dac1 = (unsigned long)bp_info->addr;
1235#if CONFIG_PPC_ADV_DEBUG_DVCS > 0 1236#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
1236 if (byte_enable) { 1237 if (byte_enable) {
1237 child->thread.dvc1 = 1238 child->thread.debug.dvc1 =
1238 (unsigned long)bp_info->condition_value; 1239 (unsigned long)bp_info->condition_value;
1239 child->thread.dbcr2 |= 1240 child->thread.debug.dbcr2 |=
1240 ((byte_enable << DBCR2_DVC1BE_SHIFT) | 1241 ((byte_enable << DBCR2_DVC1BE_SHIFT) |
1241 (condition_mode << DBCR2_DVC1M_SHIFT)); 1242 (condition_mode << DBCR2_DVC1M_SHIFT));
1242 } 1243 }
1243#endif 1244#endif
1244#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE 1245#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE
1245 } else if (child->thread.dbcr2 & DBCR2_DAC12MODE) { 1246 } else if (child->thread.debug.dbcr2 & DBCR2_DAC12MODE) {
1246 /* Both dac1 and dac2 are part of a range */ 1247 /* Both dac1 and dac2 are part of a range */
1247 return -ENOSPC; 1248 return -ENOSPC;
1248#endif 1249#endif
@@ -1252,19 +1253,19 @@ static int set_dac(struct task_struct *child, struct ppc_hw_breakpoint *bp_info)
1252 dbcr_dac(child) |= DBCR_DAC2R; 1253 dbcr_dac(child) |= DBCR_DAC2R;
1253 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE) 1254 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE)
1254 dbcr_dac(child) |= DBCR_DAC2W; 1255 dbcr_dac(child) |= DBCR_DAC2W;
1255 child->thread.dac2 = (unsigned long)bp_info->addr; 1256 child->thread.debug.dac2 = (unsigned long)bp_info->addr;
1256#if CONFIG_PPC_ADV_DEBUG_DVCS > 0 1257#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
1257 if (byte_enable) { 1258 if (byte_enable) {
1258 child->thread.dvc2 = 1259 child->thread.debug.dvc2 =
1259 (unsigned long)bp_info->condition_value; 1260 (unsigned long)bp_info->condition_value;
1260 child->thread.dbcr2 |= 1261 child->thread.debug.dbcr2 |=
1261 ((byte_enable << DBCR2_DVC2BE_SHIFT) | 1262 ((byte_enable << DBCR2_DVC2BE_SHIFT) |
1262 (condition_mode << DBCR2_DVC2M_SHIFT)); 1263 (condition_mode << DBCR2_DVC2M_SHIFT));
1263 } 1264 }
1264#endif 1265#endif
1265 } else 1266 } else
1266 return -ENOSPC; 1267 return -ENOSPC;
1267 child->thread.dbcr0 |= DBCR0_IDM; 1268 child->thread.debug.dbcr0 |= DBCR0_IDM;
1268 child->thread.regs->msr |= MSR_DE; 1269 child->thread.regs->msr |= MSR_DE;
1269 1270
1270 return slot + 4; 1271 return slot + 4;
@@ -1276,32 +1277,32 @@ static int del_dac(struct task_struct *child, int slot)
1276 if ((dbcr_dac(child) & (DBCR_DAC1R | DBCR_DAC1W)) == 0) 1277 if ((dbcr_dac(child) & (DBCR_DAC1R | DBCR_DAC1W)) == 0)
1277 return -ENOENT; 1278 return -ENOENT;
1278 1279
1279 child->thread.dac1 = 0; 1280 child->thread.debug.dac1 = 0;
1280 dbcr_dac(child) &= ~(DBCR_DAC1R | DBCR_DAC1W); 1281 dbcr_dac(child) &= ~(DBCR_DAC1R | DBCR_DAC1W);
1281#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE 1282#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE
1282 if (child->thread.dbcr2 & DBCR2_DAC12MODE) { 1283 if (child->thread.debug.dbcr2 & DBCR2_DAC12MODE) {
1283 child->thread.dac2 = 0; 1284 child->thread.debug.dac2 = 0;
1284 child->thread.dbcr2 &= ~DBCR2_DAC12MODE; 1285 child->thread.debug.dbcr2 &= ~DBCR2_DAC12MODE;
1285 } 1286 }
1286 child->thread.dbcr2 &= ~(DBCR2_DVC1M | DBCR2_DVC1BE); 1287 child->thread.debug.dbcr2 &= ~(DBCR2_DVC1M | DBCR2_DVC1BE);
1287#endif 1288#endif
1288#if CONFIG_PPC_ADV_DEBUG_DVCS > 0 1289#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
1289 child->thread.dvc1 = 0; 1290 child->thread.debug.dvc1 = 0;
1290#endif 1291#endif
1291 } else if (slot == 2) { 1292 } else if (slot == 2) {
1292 if ((dbcr_dac(child) & (DBCR_DAC2R | DBCR_DAC2W)) == 0) 1293 if ((dbcr_dac(child) & (DBCR_DAC2R | DBCR_DAC2W)) == 0)
1293 return -ENOENT; 1294 return -ENOENT;
1294 1295
1295#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE 1296#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE
1296 if (child->thread.dbcr2 & DBCR2_DAC12MODE) 1297 if (child->thread.debug.dbcr2 & DBCR2_DAC12MODE)
1297 /* Part of a range */ 1298 /* Part of a range */
1298 return -EINVAL; 1299 return -EINVAL;
1299 child->thread.dbcr2 &= ~(DBCR2_DVC2M | DBCR2_DVC2BE); 1300 child->thread.debug.dbcr2 &= ~(DBCR2_DVC2M | DBCR2_DVC2BE);
1300#endif 1301#endif
1301#if CONFIG_PPC_ADV_DEBUG_DVCS > 0 1302#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
1302 child->thread.dvc2 = 0; 1303 child->thread.debug.dvc2 = 0;
1303#endif 1304#endif
1304 child->thread.dac2 = 0; 1305 child->thread.debug.dac2 = 0;
1305 dbcr_dac(child) &= ~(DBCR_DAC2R | DBCR_DAC2W); 1306 dbcr_dac(child) &= ~(DBCR_DAC2R | DBCR_DAC2W);
1306 } else 1307 } else
1307 return -EINVAL; 1308 return -EINVAL;
@@ -1343,22 +1344,22 @@ static int set_dac_range(struct task_struct *child,
1343 return -EIO; 1344 return -EIO;
1344 } 1345 }
1345 1346
1346 if (child->thread.dbcr0 & 1347 if (child->thread.debug.dbcr0 &
1347 (DBCR0_DAC1R | DBCR0_DAC1W | DBCR0_DAC2R | DBCR0_DAC2W)) 1348 (DBCR0_DAC1R | DBCR0_DAC1W | DBCR0_DAC2R | DBCR0_DAC2W))
1348 return -ENOSPC; 1349 return -ENOSPC;
1349 1350
1350 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ) 1351 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ)
1351 child->thread.dbcr0 |= (DBCR0_DAC1R | DBCR0_IDM); 1352 child->thread.debug.dbcr0 |= (DBCR0_DAC1R | DBCR0_IDM);
1352 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE) 1353 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE)
1353 child->thread.dbcr0 |= (DBCR0_DAC1W | DBCR0_IDM); 1354 child->thread.debug.dbcr0 |= (DBCR0_DAC1W | DBCR0_IDM);
1354 child->thread.dac1 = bp_info->addr; 1355 child->thread.debug.dac1 = bp_info->addr;
1355 child->thread.dac2 = bp_info->addr2; 1356 child->thread.debug.dac2 = bp_info->addr2;
1356 if (mode == PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE) 1357 if (mode == PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE)
1357 child->thread.dbcr2 |= DBCR2_DAC12M; 1358 child->thread.debug.dbcr2 |= DBCR2_DAC12M;
1358 else if (mode == PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE) 1359 else if (mode == PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE)
1359 child->thread.dbcr2 |= DBCR2_DAC12MX; 1360 child->thread.debug.dbcr2 |= DBCR2_DAC12MX;
1360 else /* PPC_BREAKPOINT_MODE_MASK */ 1361 else /* PPC_BREAKPOINT_MODE_MASK */
1361 child->thread.dbcr2 |= DBCR2_DAC12MM; 1362 child->thread.debug.dbcr2 |= DBCR2_DAC12MM;
1362 child->thread.regs->msr |= MSR_DE; 1363 child->thread.regs->msr |= MSR_DE;
1363 1364
1364 return 5; 1365 return 5;
@@ -1489,9 +1490,9 @@ static long ppc_del_hwdebug(struct task_struct *child, long data)
1489 rc = del_dac(child, (int)data - 4); 1490 rc = del_dac(child, (int)data - 4);
1490 1491
1491 if (!rc) { 1492 if (!rc) {
1492 if (!DBCR_ACTIVE_EVENTS(child->thread.dbcr0, 1493 if (!DBCR_ACTIVE_EVENTS(child->thread.debug.dbcr0,
1493 child->thread.dbcr1)) { 1494 child->thread.debug.dbcr1)) {
1494 child->thread.dbcr0 &= ~DBCR0_IDM; 1495 child->thread.debug.dbcr0 &= ~DBCR0_IDM;
1495 child->thread.regs->msr &= ~MSR_DE; 1496 child->thread.regs->msr &= ~MSR_DE;
1496 } 1497 }
1497 } 1498 }
@@ -1554,10 +1555,10 @@ long arch_ptrace(struct task_struct *child, long request,
1554 1555
1555 flush_fp_to_thread(child); 1556 flush_fp_to_thread(child);
1556 if (fpidx < (PT_FPSCR - PT_FPR0)) 1557 if (fpidx < (PT_FPSCR - PT_FPR0))
1557 tmp = ((unsigned long *)child->thread.fpr) 1558 memcpy(&tmp, &child->thread.fp_state.fpr,
1558 [fpidx * TS_FPRWIDTH]; 1559 sizeof(long));
1559 else 1560 else
1560 tmp = child->thread.fpscr.val; 1561 tmp = child->thread.fp_state.fpscr;
1561 } 1562 }
1562 ret = put_user(tmp, datalp); 1563 ret = put_user(tmp, datalp);
1563 break; 1564 break;
@@ -1587,10 +1588,10 @@ long arch_ptrace(struct task_struct *child, long request,
1587 1588
1588 flush_fp_to_thread(child); 1589 flush_fp_to_thread(child);
1589 if (fpidx < (PT_FPSCR - PT_FPR0)) 1590 if (fpidx < (PT_FPSCR - PT_FPR0))
1590 ((unsigned long *)child->thread.fpr) 1591 memcpy(&child->thread.fp_state.fpr, &data,
1591 [fpidx * TS_FPRWIDTH] = data; 1592 sizeof(long));
1592 else 1593 else
1593 child->thread.fpscr.val = data; 1594 child->thread.fp_state.fpscr = data;
1594 ret = 0; 1595 ret = 0;
1595 } 1596 }
1596 break; 1597 break;
@@ -1669,7 +1670,7 @@ long arch_ptrace(struct task_struct *child, long request,
1669 if (addr > 0) 1670 if (addr > 0)
1670 break; 1671 break;
1671#ifdef CONFIG_PPC_ADV_DEBUG_REGS 1672#ifdef CONFIG_PPC_ADV_DEBUG_REGS
1672 ret = put_user(child->thread.dac1, datalp); 1673 ret = put_user(child->thread.debug.dac1, datalp);
1673#else 1674#else
1674 dabr_fake = ((child->thread.hw_brk.address & (~HW_BRK_TYPE_DABR)) | 1675 dabr_fake = ((child->thread.hw_brk.address & (~HW_BRK_TYPE_DABR)) |
1675 (child->thread.hw_brk.type & HW_BRK_TYPE_DABR)); 1676 (child->thread.hw_brk.type & HW_BRK_TYPE_DABR));
diff --git a/arch/powerpc/kernel/ptrace32.c b/arch/powerpc/kernel/ptrace32.c
index f51599e941c7..f52b7db327c8 100644
--- a/arch/powerpc/kernel/ptrace32.c
+++ b/arch/powerpc/kernel/ptrace32.c
@@ -43,7 +43,6 @@
43#define FPRNUMBER(i) (((i) - PT_FPR0) >> 1) 43#define FPRNUMBER(i) (((i) - PT_FPR0) >> 1)
44#define FPRHALF(i) (((i) - PT_FPR0) & 1) 44#define FPRHALF(i) (((i) - PT_FPR0) & 1)
45#define FPRINDEX(i) TS_FPRWIDTH * FPRNUMBER(i) * 2 + FPRHALF(i) 45#define FPRINDEX(i) TS_FPRWIDTH * FPRNUMBER(i) * 2 + FPRHALF(i)
46#define FPRINDEX_3264(i) (TS_FPRWIDTH * ((i) - PT_FPR0))
47 46
48long compat_arch_ptrace(struct task_struct *child, compat_long_t request, 47long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
49 compat_ulong_t caddr, compat_ulong_t cdata) 48 compat_ulong_t caddr, compat_ulong_t cdata)
@@ -105,7 +104,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
105 * to be an array of unsigned int (32 bits) - the 104 * to be an array of unsigned int (32 bits) - the
106 * index passed in is based on this assumption. 105 * index passed in is based on this assumption.
107 */ 106 */
108 tmp = ((unsigned int *)child->thread.fpr) 107 tmp = ((unsigned int *)child->thread.fp_state.fpr)
109 [FPRINDEX(index)]; 108 [FPRINDEX(index)];
110 } 109 }
111 ret = put_user((unsigned int)tmp, (u32 __user *)data); 110 ret = put_user((unsigned int)tmp, (u32 __user *)data);
@@ -147,8 +146,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
147 if (numReg >= PT_FPR0) { 146 if (numReg >= PT_FPR0) {
148 flush_fp_to_thread(child); 147 flush_fp_to_thread(child);
149 /* get 64 bit FPR */ 148 /* get 64 bit FPR */
150 tmp = ((u64 *)child->thread.fpr) 149 tmp = child->thread.fp_state.fpr[numReg - PT_FPR0][0];
151 [FPRINDEX_3264(numReg)];
152 } else { /* register within PT_REGS struct */ 150 } else { /* register within PT_REGS struct */
153 unsigned long tmp2; 151 unsigned long tmp2;
154 ret = ptrace_get_reg(child, numReg, &tmp2); 152 ret = ptrace_get_reg(child, numReg, &tmp2);
@@ -207,7 +205,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
207 * to be an array of unsigned int (32 bits) - the 205 * to be an array of unsigned int (32 bits) - the
208 * index passed in is based on this assumption. 206 * index passed in is based on this assumption.
209 */ 207 */
210 ((unsigned int *)child->thread.fpr) 208 ((unsigned int *)child->thread.fp_state.fpr)
211 [FPRINDEX(index)] = data; 209 [FPRINDEX(index)] = data;
212 ret = 0; 210 ret = 0;
213 } 211 }
@@ -251,8 +249,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
251 u64 *tmp; 249 u64 *tmp;
252 flush_fp_to_thread(child); 250 flush_fp_to_thread(child);
253 /* get 64 bit FPR ... */ 251 /* get 64 bit FPR ... */
254 tmp = &(((u64 *)child->thread.fpr) 252 tmp = &child->thread.fp_state.fpr[numReg - PT_FPR0][0];
255 [FPRINDEX_3264(numReg)]);
256 /* ... write the 32 bit part we want */ 253 /* ... write the 32 bit part we want */
257 ((u32 *)tmp)[index % 2] = data; 254 ((u32 *)tmp)[index % 2] = data;
258 ret = 0; 255 ret = 0;
@@ -269,7 +266,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
269 if (addr > 0) 266 if (addr > 0)
270 break; 267 break;
271#ifdef CONFIG_PPC_ADV_DEBUG_REGS 268#ifdef CONFIG_PPC_ADV_DEBUG_REGS
272 ret = put_user(child->thread.dac1, (u32 __user *)data); 269 ret = put_user(child->thread.debug.dac1, (u32 __user *)data);
273#else 270#else
274 dabr_fake = ( 271 dabr_fake = (
275 (child->thread.hw_brk.address & (~HW_BRK_TYPE_DABR)) | 272 (child->thread.hw_brk.address & (~HW_BRK_TYPE_DABR)) |
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 6e7b7cdeec65..7d4c7172f38e 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -223,7 +223,7 @@ unsigned long get_phb_buid(struct device_node *phb)
223static int phb_set_bus_ranges(struct device_node *dev, 223static int phb_set_bus_ranges(struct device_node *dev,
224 struct pci_controller *phb) 224 struct pci_controller *phb)
225{ 225{
226 const int *bus_range; 226 const __be32 *bus_range;
227 unsigned int len; 227 unsigned int len;
228 228
229 bus_range = of_get_property(dev, "bus-range", &len); 229 bus_range = of_get_property(dev, "bus-range", &len);
@@ -231,8 +231,8 @@ static int phb_set_bus_ranges(struct device_node *dev,
231 return 1; 231 return 1;
232 } 232 }
233 233
234 phb->first_busno = bus_range[0]; 234 phb->first_busno = be32_to_cpu(bus_range[0]);
235 phb->last_busno = bus_range[1]; 235 phb->last_busno = be32_to_cpu(bus_range[1]);
236 236
237 return 0; 237 return 0;
238} 238}
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 3d261c071fc8..febc80445d25 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -62,8 +62,6 @@
62#include <mm/mmu_decl.h> 62#include <mm/mmu_decl.h>
63#include <asm/fadump.h> 63#include <asm/fadump.h>
64 64
65#include "setup.h"
66
67#ifdef DEBUG 65#ifdef DEBUG
68#include <asm/udbg.h> 66#include <asm/udbg.h>
69#define DBG(fmt...) udbg_printf(fmt) 67#define DBG(fmt...) udbg_printf(fmt)
diff --git a/arch/powerpc/kernel/setup.h b/arch/powerpc/kernel/setup.h
deleted file mode 100644
index 4c67ad7fae08..000000000000
--- a/arch/powerpc/kernel/setup.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _POWERPC_KERNEL_SETUP_H
2#define _POWERPC_KERNEL_SETUP_H
3
4void check_for_initrd(void);
5void do_init_bootmem(void);
6void setup_panic(void);
7extern int do_early_xmon;
8
9#endif /* _POWERPC_KERNEL_SETUP_H */
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index a4bbcae72578..b903dc5cf944 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -40,8 +40,6 @@
40#include <asm/mmu_context.h> 40#include <asm/mmu_context.h>
41#include <asm/epapr_hcalls.h> 41#include <asm/epapr_hcalls.h>
42 42
43#include "setup.h"
44
45#define DBG(fmt...) 43#define DBG(fmt...)
46 44
47extern void bootx_init(unsigned long r4, unsigned long phys); 45extern void bootx_init(unsigned long r4, unsigned long phys);
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 278ca93e1f28..4085aaa9478f 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -68,8 +68,6 @@
68#include <asm/hugetlb.h> 68#include <asm/hugetlb.h>
69#include <asm/epapr_hcalls.h> 69#include <asm/epapr_hcalls.h>
70 70
71#include "setup.h"
72
73#ifdef DEBUG 71#ifdef DEBUG
74#define DBG(fmt...) udbg_printf(fmt) 72#define DBG(fmt...) udbg_printf(fmt)
75#else 73#else
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index bebdf1a1a540..749778e0a69d 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -265,27 +265,27 @@ struct rt_sigframe {
265unsigned long copy_fpr_to_user(void __user *to, 265unsigned long copy_fpr_to_user(void __user *to,
266 struct task_struct *task) 266 struct task_struct *task)
267{ 267{
268 double buf[ELF_NFPREG]; 268 u64 buf[ELF_NFPREG];
269 int i; 269 int i;
270 270
271 /* save FPR copy to local buffer then write to the thread_struct */ 271 /* save FPR copy to local buffer then write to the thread_struct */
272 for (i = 0; i < (ELF_NFPREG - 1) ; i++) 272 for (i = 0; i < (ELF_NFPREG - 1) ; i++)
273 buf[i] = task->thread.TS_FPR(i); 273 buf[i] = task->thread.TS_FPR(i);
274 memcpy(&buf[i], &task->thread.fpscr, sizeof(double)); 274 buf[i] = task->thread.fp_state.fpscr;
275 return __copy_to_user(to, buf, ELF_NFPREG * sizeof(double)); 275 return __copy_to_user(to, buf, ELF_NFPREG * sizeof(double));
276} 276}
277 277
278unsigned long copy_fpr_from_user(struct task_struct *task, 278unsigned long copy_fpr_from_user(struct task_struct *task,
279 void __user *from) 279 void __user *from)
280{ 280{
281 double buf[ELF_NFPREG]; 281 u64 buf[ELF_NFPREG];
282 int i; 282 int i;
283 283
284 if (__copy_from_user(buf, from, ELF_NFPREG * sizeof(double))) 284 if (__copy_from_user(buf, from, ELF_NFPREG * sizeof(double)))
285 return 1; 285 return 1;
286 for (i = 0; i < (ELF_NFPREG - 1) ; i++) 286 for (i = 0; i < (ELF_NFPREG - 1) ; i++)
287 task->thread.TS_FPR(i) = buf[i]; 287 task->thread.TS_FPR(i) = buf[i];
288 memcpy(&task->thread.fpscr, &buf[i], sizeof(double)); 288 task->thread.fp_state.fpscr = buf[i];
289 289
290 return 0; 290 return 0;
291} 291}
@@ -293,25 +293,25 @@ unsigned long copy_fpr_from_user(struct task_struct *task,
293unsigned long copy_vsx_to_user(void __user *to, 293unsigned long copy_vsx_to_user(void __user *to,
294 struct task_struct *task) 294 struct task_struct *task)
295{ 295{
296 double buf[ELF_NVSRHALFREG]; 296 u64 buf[ELF_NVSRHALFREG];
297 int i; 297 int i;
298 298
299 /* save FPR copy to local buffer then write to the thread_struct */ 299 /* save FPR copy to local buffer then write to the thread_struct */
300 for (i = 0; i < ELF_NVSRHALFREG; i++) 300 for (i = 0; i < ELF_NVSRHALFREG; i++)
301 buf[i] = task->thread.fpr[i][TS_VSRLOWOFFSET]; 301 buf[i] = task->thread.fp_state.fpr[i][TS_VSRLOWOFFSET];
302 return __copy_to_user(to, buf, ELF_NVSRHALFREG * sizeof(double)); 302 return __copy_to_user(to, buf, ELF_NVSRHALFREG * sizeof(double));
303} 303}
304 304
305unsigned long copy_vsx_from_user(struct task_struct *task, 305unsigned long copy_vsx_from_user(struct task_struct *task,
306 void __user *from) 306 void __user *from)
307{ 307{
308 double buf[ELF_NVSRHALFREG]; 308 u64 buf[ELF_NVSRHALFREG];
309 int i; 309 int i;
310 310
311 if (__copy_from_user(buf, from, ELF_NVSRHALFREG * sizeof(double))) 311 if (__copy_from_user(buf, from, ELF_NVSRHALFREG * sizeof(double)))
312 return 1; 312 return 1;
313 for (i = 0; i < ELF_NVSRHALFREG ; i++) 313 for (i = 0; i < ELF_NVSRHALFREG ; i++)
314 task->thread.fpr[i][TS_VSRLOWOFFSET] = buf[i]; 314 task->thread.fp_state.fpr[i][TS_VSRLOWOFFSET] = buf[i];
315 return 0; 315 return 0;
316} 316}
317 317
@@ -319,27 +319,27 @@ unsigned long copy_vsx_from_user(struct task_struct *task,
319unsigned long copy_transact_fpr_to_user(void __user *to, 319unsigned long copy_transact_fpr_to_user(void __user *to,
320 struct task_struct *task) 320 struct task_struct *task)
321{ 321{
322 double buf[ELF_NFPREG]; 322 u64 buf[ELF_NFPREG];
323 int i; 323 int i;
324 324
325 /* save FPR copy to local buffer then write to the thread_struct */ 325 /* save FPR copy to local buffer then write to the thread_struct */
326 for (i = 0; i < (ELF_NFPREG - 1) ; i++) 326 for (i = 0; i < (ELF_NFPREG - 1) ; i++)
327 buf[i] = task->thread.TS_TRANS_FPR(i); 327 buf[i] = task->thread.TS_TRANS_FPR(i);
328 memcpy(&buf[i], &task->thread.transact_fpscr, sizeof(double)); 328 buf[i] = task->thread.transact_fp.fpscr;
329 return __copy_to_user(to, buf, ELF_NFPREG * sizeof(double)); 329 return __copy_to_user(to, buf, ELF_NFPREG * sizeof(double));
330} 330}
331 331
332unsigned long copy_transact_fpr_from_user(struct task_struct *task, 332unsigned long copy_transact_fpr_from_user(struct task_struct *task,
333 void __user *from) 333 void __user *from)
334{ 334{
335 double buf[ELF_NFPREG]; 335 u64 buf[ELF_NFPREG];
336 int i; 336 int i;
337 337
338 if (__copy_from_user(buf, from, ELF_NFPREG * sizeof(double))) 338 if (__copy_from_user(buf, from, ELF_NFPREG * sizeof(double)))
339 return 1; 339 return 1;
340 for (i = 0; i < (ELF_NFPREG - 1) ; i++) 340 for (i = 0; i < (ELF_NFPREG - 1) ; i++)
341 task->thread.TS_TRANS_FPR(i) = buf[i]; 341 task->thread.TS_TRANS_FPR(i) = buf[i];
342 memcpy(&task->thread.transact_fpscr, &buf[i], sizeof(double)); 342 task->thread.transact_fp.fpscr = buf[i];
343 343
344 return 0; 344 return 0;
345} 345}
@@ -347,25 +347,25 @@ unsigned long copy_transact_fpr_from_user(struct task_struct *task,
347unsigned long copy_transact_vsx_to_user(void __user *to, 347unsigned long copy_transact_vsx_to_user(void __user *to,
348 struct task_struct *task) 348 struct task_struct *task)
349{ 349{
350 double buf[ELF_NVSRHALFREG]; 350 u64 buf[ELF_NVSRHALFREG];
351 int i; 351 int i;
352 352
353 /* save FPR copy to local buffer then write to the thread_struct */ 353 /* save FPR copy to local buffer then write to the thread_struct */
354 for (i = 0; i < ELF_NVSRHALFREG; i++) 354 for (i = 0; i < ELF_NVSRHALFREG; i++)
355 buf[i] = task->thread.transact_fpr[i][TS_VSRLOWOFFSET]; 355 buf[i] = task->thread.transact_fp.fpr[i][TS_VSRLOWOFFSET];
356 return __copy_to_user(to, buf, ELF_NVSRHALFREG * sizeof(double)); 356 return __copy_to_user(to, buf, ELF_NVSRHALFREG * sizeof(double));
357} 357}
358 358
359unsigned long copy_transact_vsx_from_user(struct task_struct *task, 359unsigned long copy_transact_vsx_from_user(struct task_struct *task,
360 void __user *from) 360 void __user *from)
361{ 361{
362 double buf[ELF_NVSRHALFREG]; 362 u64 buf[ELF_NVSRHALFREG];
363 int i; 363 int i;
364 364
365 if (__copy_from_user(buf, from, ELF_NVSRHALFREG * sizeof(double))) 365 if (__copy_from_user(buf, from, ELF_NVSRHALFREG * sizeof(double)))
366 return 1; 366 return 1;
367 for (i = 0; i < ELF_NVSRHALFREG ; i++) 367 for (i = 0; i < ELF_NVSRHALFREG ; i++)
368 task->thread.transact_fpr[i][TS_VSRLOWOFFSET] = buf[i]; 368 task->thread.transact_fp.fpr[i][TS_VSRLOWOFFSET] = buf[i];
369 return 0; 369 return 0;
370} 370}
371#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ 371#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
@@ -373,14 +373,14 @@ unsigned long copy_transact_vsx_from_user(struct task_struct *task,
373inline unsigned long copy_fpr_to_user(void __user *to, 373inline unsigned long copy_fpr_to_user(void __user *to,
374 struct task_struct *task) 374 struct task_struct *task)
375{ 375{
376 return __copy_to_user(to, task->thread.fpr, 376 return __copy_to_user(to, task->thread.fp_state.fpr,
377 ELF_NFPREG * sizeof(double)); 377 ELF_NFPREG * sizeof(double));
378} 378}
379 379
380inline unsigned long copy_fpr_from_user(struct task_struct *task, 380inline unsigned long copy_fpr_from_user(struct task_struct *task,
381 void __user *from) 381 void __user *from)
382{ 382{
383 return __copy_from_user(task->thread.fpr, from, 383 return __copy_from_user(task->thread.fp_state.fpr, from,
384 ELF_NFPREG * sizeof(double)); 384 ELF_NFPREG * sizeof(double));
385} 385}
386 386
@@ -388,14 +388,14 @@ inline unsigned long copy_fpr_from_user(struct task_struct *task,
388inline unsigned long copy_transact_fpr_to_user(void __user *to, 388inline unsigned long copy_transact_fpr_to_user(void __user *to,
389 struct task_struct *task) 389 struct task_struct *task)
390{ 390{
391 return __copy_to_user(to, task->thread.transact_fpr, 391 return __copy_to_user(to, task->thread.transact_fp.fpr,
392 ELF_NFPREG * sizeof(double)); 392 ELF_NFPREG * sizeof(double));
393} 393}
394 394
395inline unsigned long copy_transact_fpr_from_user(struct task_struct *task, 395inline unsigned long copy_transact_fpr_from_user(struct task_struct *task,
396 void __user *from) 396 void __user *from)
397{ 397{
398 return __copy_from_user(task->thread.transact_fpr, from, 398 return __copy_from_user(task->thread.transact_fp.fpr, from,
399 ELF_NFPREG * sizeof(double)); 399 ELF_NFPREG * sizeof(double));
400} 400}
401#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ 401#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
@@ -423,7 +423,7 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame,
423 /* save altivec registers */ 423 /* save altivec registers */
424 if (current->thread.used_vr) { 424 if (current->thread.used_vr) {
425 flush_altivec_to_thread(current); 425 flush_altivec_to_thread(current);
426 if (__copy_to_user(&frame->mc_vregs, current->thread.vr, 426 if (__copy_to_user(&frame->mc_vregs, &current->thread.vr_state,
427 ELF_NVRREG * sizeof(vector128))) 427 ELF_NVRREG * sizeof(vector128)))
428 return 1; 428 return 1;
429 /* set MSR_VEC in the saved MSR value to indicate that 429 /* set MSR_VEC in the saved MSR value to indicate that
@@ -534,17 +534,17 @@ static int save_tm_user_regs(struct pt_regs *regs,
534 /* save altivec registers */ 534 /* save altivec registers */
535 if (current->thread.used_vr) { 535 if (current->thread.used_vr) {
536 flush_altivec_to_thread(current); 536 flush_altivec_to_thread(current);
537 if (__copy_to_user(&frame->mc_vregs, current->thread.vr, 537 if (__copy_to_user(&frame->mc_vregs, &current->thread.vr_state,
538 ELF_NVRREG * sizeof(vector128))) 538 ELF_NVRREG * sizeof(vector128)))
539 return 1; 539 return 1;
540 if (msr & MSR_VEC) { 540 if (msr & MSR_VEC) {
541 if (__copy_to_user(&tm_frame->mc_vregs, 541 if (__copy_to_user(&tm_frame->mc_vregs,
542 current->thread.transact_vr, 542 &current->thread.transact_vr,
543 ELF_NVRREG * sizeof(vector128))) 543 ELF_NVRREG * sizeof(vector128)))
544 return 1; 544 return 1;
545 } else { 545 } else {
546 if (__copy_to_user(&tm_frame->mc_vregs, 546 if (__copy_to_user(&tm_frame->mc_vregs,
547 current->thread.vr, 547 &current->thread.vr_state,
548 ELF_NVRREG * sizeof(vector128))) 548 ELF_NVRREG * sizeof(vector128)))
549 return 1; 549 return 1;
550 } 550 }
@@ -692,11 +692,12 @@ static long restore_user_regs(struct pt_regs *regs,
692 regs->msr &= ~MSR_VEC; 692 regs->msr &= ~MSR_VEC;
693 if (msr & MSR_VEC) { 693 if (msr & MSR_VEC) {
694 /* restore altivec registers from the stack */ 694 /* restore altivec registers from the stack */
695 if (__copy_from_user(current->thread.vr, &sr->mc_vregs, 695 if (__copy_from_user(&current->thread.vr_state, &sr->mc_vregs,
696 sizeof(sr->mc_vregs))) 696 sizeof(sr->mc_vregs)))
697 return 1; 697 return 1;
698 } else if (current->thread.used_vr) 698 } else if (current->thread.used_vr)
699 memset(current->thread.vr, 0, ELF_NVRREG * sizeof(vector128)); 699 memset(&current->thread.vr_state, 0,
700 ELF_NVRREG * sizeof(vector128));
700 701
701 /* Always get VRSAVE back */ 702 /* Always get VRSAVE back */
702 if (__get_user(current->thread.vrsave, (u32 __user *)&sr->mc_vregs[32])) 703 if (__get_user(current->thread.vrsave, (u32 __user *)&sr->mc_vregs[32]))
@@ -722,7 +723,7 @@ static long restore_user_regs(struct pt_regs *regs,
722 return 1; 723 return 1;
723 } else if (current->thread.used_vsr) 724 } else if (current->thread.used_vsr)
724 for (i = 0; i < 32 ; i++) 725 for (i = 0; i < 32 ; i++)
725 current->thread.fpr[i][TS_VSRLOWOFFSET] = 0; 726 current->thread.fp_state.fpr[i][TS_VSRLOWOFFSET] = 0;
726#endif /* CONFIG_VSX */ 727#endif /* CONFIG_VSX */
727 /* 728 /*
728 * force the process to reload the FP registers from 729 * force the process to reload the FP registers from
@@ -798,15 +799,16 @@ static long restore_tm_user_regs(struct pt_regs *regs,
798 regs->msr &= ~MSR_VEC; 799 regs->msr &= ~MSR_VEC;
799 if (msr & MSR_VEC) { 800 if (msr & MSR_VEC) {
800 /* restore altivec registers from the stack */ 801 /* restore altivec registers from the stack */
801 if (__copy_from_user(current->thread.vr, &sr->mc_vregs, 802 if (__copy_from_user(&current->thread.vr_state, &sr->mc_vregs,
802 sizeof(sr->mc_vregs)) || 803 sizeof(sr->mc_vregs)) ||
803 __copy_from_user(current->thread.transact_vr, 804 __copy_from_user(&current->thread.transact_vr,
804 &tm_sr->mc_vregs, 805 &tm_sr->mc_vregs,
805 sizeof(sr->mc_vregs))) 806 sizeof(sr->mc_vregs)))
806 return 1; 807 return 1;
807 } else if (current->thread.used_vr) { 808 } else if (current->thread.used_vr) {
808 memset(current->thread.vr, 0, ELF_NVRREG * sizeof(vector128)); 809 memset(&current->thread.vr_state, 0,
809 memset(current->thread.transact_vr, 0, 810 ELF_NVRREG * sizeof(vector128));
811 memset(&current->thread.transact_vr, 0,
810 ELF_NVRREG * sizeof(vector128)); 812 ELF_NVRREG * sizeof(vector128));
811 } 813 }
812 814
@@ -838,8 +840,8 @@ static long restore_tm_user_regs(struct pt_regs *regs,
838 return 1; 840 return 1;
839 } else if (current->thread.used_vsr) 841 } else if (current->thread.used_vsr)
840 for (i = 0; i < 32 ; i++) { 842 for (i = 0; i < 32 ; i++) {
841 current->thread.fpr[i][TS_VSRLOWOFFSET] = 0; 843 current->thread.fp_state.fpr[i][TS_VSRLOWOFFSET] = 0;
842 current->thread.transact_fpr[i][TS_VSRLOWOFFSET] = 0; 844 current->thread.transact_fp.fpr[i][TS_VSRLOWOFFSET] = 0;
843 } 845 }
844#endif /* CONFIG_VSX */ 846#endif /* CONFIG_VSX */
845 847
@@ -891,7 +893,7 @@ static long restore_tm_user_regs(struct pt_regs *regs,
891#endif 893#endif
892 894
893#ifdef CONFIG_PPC64 895#ifdef CONFIG_PPC64
894int copy_siginfo_to_user32(struct compat_siginfo __user *d, siginfo_t *s) 896int copy_siginfo_to_user32(struct compat_siginfo __user *d, const siginfo_t *s)
895{ 897{
896 int err; 898 int err;
897 899
@@ -1030,7 +1032,7 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
1030 if (__put_user(0, &rt_sf->uc.uc_link)) 1032 if (__put_user(0, &rt_sf->uc.uc_link))
1031 goto badframe; 1033 goto badframe;
1032 1034
1033 current->thread.fpscr.val = 0; /* turn off all fp exceptions */ 1035 current->thread.fp_state.fpscr = 0; /* turn off all fp exceptions */
1034 1036
1035 /* create a stack frame for the caller of the handler */ 1037 /* create a stack frame for the caller of the handler */
1036 newsp = ((unsigned long)rt_sf) - (__SIGNAL_FRAMESIZE + 16); 1038 newsp = ((unsigned long)rt_sf) - (__SIGNAL_FRAMESIZE + 16);
@@ -1045,8 +1047,9 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
1045 regs->gpr[5] = (unsigned long) &rt_sf->uc; 1047 regs->gpr[5] = (unsigned long) &rt_sf->uc;
1046 regs->gpr[6] = (unsigned long) rt_sf; 1048 regs->gpr[6] = (unsigned long) rt_sf;
1047 regs->nip = (unsigned long) ka->sa.sa_handler; 1049 regs->nip = (unsigned long) ka->sa.sa_handler;
1048 /* enter the signal handler in big-endian mode */ 1050 /* enter the signal handler in native-endian mode */
1049 regs->msr &= ~MSR_LE; 1051 regs->msr &= ~MSR_LE;
1052 regs->msr |= (MSR_KERNEL & MSR_LE);
1050#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 1053#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1051 /* Remove TM bits from thread's MSR. The MSR in the sigcontext 1054 /* Remove TM bits from thread's MSR. The MSR in the sigcontext
1052 * just indicates to userland that we were doing a transaction, but we 1055 * just indicates to userland that we were doing a transaction, but we
@@ -1309,7 +1312,7 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
1309 unsigned char tmp; 1312 unsigned char tmp;
1310 unsigned long new_msr = regs->msr; 1313 unsigned long new_msr = regs->msr;
1311#ifdef CONFIG_PPC_ADV_DEBUG_REGS 1314#ifdef CONFIG_PPC_ADV_DEBUG_REGS
1312 unsigned long new_dbcr0 = current->thread.dbcr0; 1315 unsigned long new_dbcr0 = current->thread.debug.dbcr0;
1313#endif 1316#endif
1314 1317
1315 for (i=0; i<ndbg; i++) { 1318 for (i=0; i<ndbg; i++) {
@@ -1324,7 +1327,7 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
1324 } else { 1327 } else {
1325 new_dbcr0 &= ~DBCR0_IC; 1328 new_dbcr0 &= ~DBCR0_IC;
1326 if (!DBCR_ACTIVE_EVENTS(new_dbcr0, 1329 if (!DBCR_ACTIVE_EVENTS(new_dbcr0,
1327 current->thread.dbcr1)) { 1330 current->thread.debug.dbcr1)) {
1328 new_msr &= ~MSR_DE; 1331 new_msr &= ~MSR_DE;
1329 new_dbcr0 &= ~DBCR0_IDM; 1332 new_dbcr0 &= ~DBCR0_IDM;
1330 } 1333 }
@@ -1359,7 +1362,7 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
1359 the user is really doing something wrong. */ 1362 the user is really doing something wrong. */
1360 regs->msr = new_msr; 1363 regs->msr = new_msr;
1361#ifdef CONFIG_PPC_ADV_DEBUG_REGS 1364#ifdef CONFIG_PPC_ADV_DEBUG_REGS
1362 current->thread.dbcr0 = new_dbcr0; 1365 current->thread.debug.dbcr0 = new_dbcr0;
1363#endif 1366#endif
1364 1367
1365 if (!access_ok(VERIFY_READ, ctx, sizeof(*ctx)) 1368 if (!access_ok(VERIFY_READ, ctx, sizeof(*ctx))
@@ -1462,7 +1465,7 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka,
1462 1465
1463 regs->link = tramp; 1466 regs->link = tramp;
1464 1467
1465 current->thread.fpscr.val = 0; /* turn off all fp exceptions */ 1468 current->thread.fp_state.fpscr = 0; /* turn off all fp exceptions */
1466 1469
1467 /* create a stack frame for the caller of the handler */ 1470 /* create a stack frame for the caller of the handler */
1468 newsp = ((unsigned long)frame) - __SIGNAL_FRAMESIZE; 1471 newsp = ((unsigned long)frame) - __SIGNAL_FRAMESIZE;
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index f93ec2835a13..b3c615764c9b 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -103,7 +103,8 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
103 if (current->thread.used_vr) { 103 if (current->thread.used_vr) {
104 flush_altivec_to_thread(current); 104 flush_altivec_to_thread(current);
105 /* Copy 33 vec registers (vr0..31 and vscr) to the stack */ 105 /* Copy 33 vec registers (vr0..31 and vscr) to the stack */
106 err |= __copy_to_user(v_regs, current->thread.vr, 33 * sizeof(vector128)); 106 err |= __copy_to_user(v_regs, &current->thread.vr_state,
107 33 * sizeof(vector128));
107 /* set MSR_VEC in the MSR value in the frame to indicate that sc->v_reg) 108 /* set MSR_VEC in the MSR value in the frame to indicate that sc->v_reg)
108 * contains valid data. 109 * contains valid data.
109 */ 110 */
@@ -195,18 +196,18 @@ static long setup_tm_sigcontexts(struct sigcontext __user *sc,
195 if (current->thread.used_vr) { 196 if (current->thread.used_vr) {
196 flush_altivec_to_thread(current); 197 flush_altivec_to_thread(current);
197 /* Copy 33 vec registers (vr0..31 and vscr) to the stack */ 198 /* Copy 33 vec registers (vr0..31 and vscr) to the stack */
198 err |= __copy_to_user(v_regs, current->thread.vr, 199 err |= __copy_to_user(v_regs, &current->thread.vr_state,
199 33 * sizeof(vector128)); 200 33 * sizeof(vector128));
200 /* If VEC was enabled there are transactional VRs valid too, 201 /* If VEC was enabled there are transactional VRs valid too,
201 * else they're a copy of the checkpointed VRs. 202 * else they're a copy of the checkpointed VRs.
202 */ 203 */
203 if (msr & MSR_VEC) 204 if (msr & MSR_VEC)
204 err |= __copy_to_user(tm_v_regs, 205 err |= __copy_to_user(tm_v_regs,
205 current->thread.transact_vr, 206 &current->thread.transact_vr,
206 33 * sizeof(vector128)); 207 33 * sizeof(vector128));
207 else 208 else
208 err |= __copy_to_user(tm_v_regs, 209 err |= __copy_to_user(tm_v_regs,
209 current->thread.vr, 210 &current->thread.vr_state,
210 33 * sizeof(vector128)); 211 33 * sizeof(vector128));
211 212
212 /* set MSR_VEC in the MSR value in the frame to indicate 213 /* set MSR_VEC in the MSR value in the frame to indicate
@@ -349,10 +350,10 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
349 return -EFAULT; 350 return -EFAULT;
350 /* Copy 33 vec registers (vr0..31 and vscr) from the stack */ 351 /* Copy 33 vec registers (vr0..31 and vscr) from the stack */
351 if (v_regs != NULL && (msr & MSR_VEC) != 0) 352 if (v_regs != NULL && (msr & MSR_VEC) != 0)
352 err |= __copy_from_user(current->thread.vr, v_regs, 353 err |= __copy_from_user(&current->thread.vr_state, v_regs,
353 33 * sizeof(vector128)); 354 33 * sizeof(vector128));
354 else if (current->thread.used_vr) 355 else if (current->thread.used_vr)
355 memset(current->thread.vr, 0, 33 * sizeof(vector128)); 356 memset(&current->thread.vr_state, 0, 33 * sizeof(vector128));
356 /* Always get VRSAVE back */ 357 /* Always get VRSAVE back */
357 if (v_regs != NULL) 358 if (v_regs != NULL)
358 err |= __get_user(current->thread.vrsave, (u32 __user *)&v_regs[33]); 359 err |= __get_user(current->thread.vrsave, (u32 __user *)&v_regs[33]);
@@ -374,7 +375,7 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
374 err |= copy_vsx_from_user(current, v_regs); 375 err |= copy_vsx_from_user(current, v_regs);
375 else 376 else
376 for (i = 0; i < 32 ; i++) 377 for (i = 0; i < 32 ; i++)
377 current->thread.fpr[i][TS_VSRLOWOFFSET] = 0; 378 current->thread.fp_state.fpr[i][TS_VSRLOWOFFSET] = 0;
378#endif 379#endif
379 return err; 380 return err;
380} 381}
@@ -468,14 +469,14 @@ static long restore_tm_sigcontexts(struct pt_regs *regs,
468 return -EFAULT; 469 return -EFAULT;
469 /* Copy 33 vec registers (vr0..31 and vscr) from the stack */ 470 /* Copy 33 vec registers (vr0..31 and vscr) from the stack */
470 if (v_regs != NULL && tm_v_regs != NULL && (msr & MSR_VEC) != 0) { 471 if (v_regs != NULL && tm_v_regs != NULL && (msr & MSR_VEC) != 0) {
471 err |= __copy_from_user(current->thread.vr, v_regs, 472 err |= __copy_from_user(&current->thread.vr_state, v_regs,
472 33 * sizeof(vector128)); 473 33 * sizeof(vector128));
473 err |= __copy_from_user(current->thread.transact_vr, tm_v_regs, 474 err |= __copy_from_user(&current->thread.transact_vr, tm_v_regs,
474 33 * sizeof(vector128)); 475 33 * sizeof(vector128));
475 } 476 }
476 else if (current->thread.used_vr) { 477 else if (current->thread.used_vr) {
477 memset(current->thread.vr, 0, 33 * sizeof(vector128)); 478 memset(&current->thread.vr_state, 0, 33 * sizeof(vector128));
478 memset(current->thread.transact_vr, 0, 33 * sizeof(vector128)); 479 memset(&current->thread.transact_vr, 0, 33 * sizeof(vector128));
479 } 480 }
480 /* Always get VRSAVE back */ 481 /* Always get VRSAVE back */
481 if (v_regs != NULL && tm_v_regs != NULL) { 482 if (v_regs != NULL && tm_v_regs != NULL) {
@@ -507,8 +508,8 @@ static long restore_tm_sigcontexts(struct pt_regs *regs,
507 err |= copy_transact_vsx_from_user(current, tm_v_regs); 508 err |= copy_transact_vsx_from_user(current, tm_v_regs);
508 } else { 509 } else {
509 for (i = 0; i < 32 ; i++) { 510 for (i = 0; i < 32 ; i++) {
510 current->thread.fpr[i][TS_VSRLOWOFFSET] = 0; 511 current->thread.fp_state.fpr[i][TS_VSRLOWOFFSET] = 0;
511 current->thread.transact_fpr[i][TS_VSRLOWOFFSET] = 0; 512 current->thread.transact_fp.fpr[i][TS_VSRLOWOFFSET] = 0;
512 } 513 }
513 } 514 }
514#endif 515#endif
@@ -747,7 +748,7 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
747 goto badframe; 748 goto badframe;
748 749
749 /* Make sure signal handler doesn't get spurious FP exceptions */ 750 /* Make sure signal handler doesn't get spurious FP exceptions */
750 current->thread.fpscr.val = 0; 751 current->thread.fp_state.fpscr = 0;
751#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 752#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
752 /* Remove TM bits from thread's MSR. The MSR in the sigcontext 753 /* Remove TM bits from thread's MSR. The MSR in the sigcontext
753 * just indicates to userland that we were doing a transaction, but we 754 * just indicates to userland that we were doing a transaction, but we
@@ -773,8 +774,9 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
773 774
774 /* Set up "regs" so we "return" to the signal handler. */ 775 /* Set up "regs" so we "return" to the signal handler. */
775 err |= get_user(regs->nip, &funct_desc_ptr->entry); 776 err |= get_user(regs->nip, &funct_desc_ptr->entry);
776 /* enter the signal handler in big-endian mode */ 777 /* enter the signal handler in native-endian mode */
777 regs->msr &= ~MSR_LE; 778 regs->msr &= ~MSR_LE;
779 regs->msr |= (MSR_KERNEL & MSR_LE);
778 regs->gpr[1] = newsp; 780 regs->gpr[1] = newsp;
779 err |= get_user(regs->gpr[2], &funct_desc_ptr->toc); 781 err |= get_user(regs->gpr[2], &funct_desc_ptr->toc);
780 regs->gpr[3] = signr; 782 regs->gpr[3] = signr;
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 8e59abc237d7..930cd8af3503 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -844,18 +844,6 @@ void __cpu_die(unsigned int cpu)
844 smp_ops->cpu_die(cpu); 844 smp_ops->cpu_die(cpu);
845} 845}
846 846
847static DEFINE_MUTEX(powerpc_cpu_hotplug_driver_mutex);
848
849void cpu_hotplug_driver_lock()
850{
851 mutex_lock(&powerpc_cpu_hotplug_driver_mutex);
852}
853
854void cpu_hotplug_driver_unlock()
855{
856 mutex_unlock(&powerpc_cpu_hotplug_driver_mutex);
857}
858
859void cpu_die(void) 847void cpu_die(void)
860{ 848{
861 if (ppc_md.cpu_die) 849 if (ppc_md.cpu_die)
diff --git a/arch/powerpc/kernel/swsusp_asm64.S b/arch/powerpc/kernel/swsusp_asm64.S
index 22045984835f..988f38dced0f 100644
--- a/arch/powerpc/kernel/swsusp_asm64.S
+++ b/arch/powerpc/kernel/swsusp_asm64.S
@@ -114,7 +114,9 @@ _GLOBAL(swsusp_arch_suspend)
114 SAVE_SPECIAL(MSR) 114 SAVE_SPECIAL(MSR)
115 SAVE_SPECIAL(XER) 115 SAVE_SPECIAL(XER)
116#ifdef CONFIG_PPC_BOOK3S_64 116#ifdef CONFIG_PPC_BOOK3S_64
117BEGIN_FW_FTR_SECTION
117 SAVE_SPECIAL(SDR1) 118 SAVE_SPECIAL(SDR1)
119END_FW_FTR_SECTION_IFCLR(FW_FEATURE_LPAR)
118#else 120#else
119 SAVE_SPR(TCR) 121 SAVE_SPR(TCR)
120 122
@@ -231,7 +233,9 @@ nothing_to_copy:
231 /* can't use RESTORE_SPECIAL(MSR) */ 233 /* can't use RESTORE_SPECIAL(MSR) */
232 ld r0, SL_MSR(r11) 234 ld r0, SL_MSR(r11)
233 mtmsrd r0, 0 235 mtmsrd r0, 0
236BEGIN_FW_FTR_SECTION
234 RESTORE_SPECIAL(SDR1) 237 RESTORE_SPECIAL(SDR1)
238END_FW_FTR_SECTION_IFCLR(FW_FEATURE_LPAR)
235#else 239#else
236 /* Restore SPRG1, be used to save paca */ 240 /* Restore SPRG1, be used to save paca */
237 ld r0, SL_SPRG1(r11) 241 ld r0, SL_SPRG1(r11)
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 27a90b99ef67..b4e667663d9b 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -17,6 +17,7 @@
17#include <asm/machdep.h> 17#include <asm/machdep.h>
18#include <asm/smp.h> 18#include <asm/smp.h>
19#include <asm/pmc.h> 19#include <asm/pmc.h>
20#include <asm/firmware.h>
20 21
21#include "cacheinfo.h" 22#include "cacheinfo.h"
22 23
@@ -179,15 +180,25 @@ SYSFS_PMCSETUP(spurr, SPRN_SPURR);
179SYSFS_PMCSETUP(dscr, SPRN_DSCR); 180SYSFS_PMCSETUP(dscr, SPRN_DSCR);
180SYSFS_PMCSETUP(pir, SPRN_PIR); 181SYSFS_PMCSETUP(pir, SPRN_PIR);
181 182
183/*
184 Lets only enable read for phyp resources and
185 enable write when needed with a separate function.
186 Lets be conservative and default to pseries.
187*/
182static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra); 188static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra);
183static DEVICE_ATTR(spurr, 0400, show_spurr, NULL); 189static DEVICE_ATTR(spurr, 0400, show_spurr, NULL);
184static DEVICE_ATTR(dscr, 0600, show_dscr, store_dscr); 190static DEVICE_ATTR(dscr, 0600, show_dscr, store_dscr);
185static DEVICE_ATTR(purr, 0600, show_purr, store_purr); 191static DEVICE_ATTR(purr, 0400, show_purr, store_purr);
186static DEVICE_ATTR(pir, 0400, show_pir, NULL); 192static DEVICE_ATTR(pir, 0400, show_pir, NULL);
187 193
188unsigned long dscr_default = 0; 194unsigned long dscr_default = 0;
189EXPORT_SYMBOL(dscr_default); 195EXPORT_SYMBOL(dscr_default);
190 196
197static void add_write_permission_dev_attr(struct device_attribute *attr)
198{
199 attr->attr.mode |= 0200;
200}
201
191static ssize_t show_dscr_default(struct device *dev, 202static ssize_t show_dscr_default(struct device *dev,
192 struct device_attribute *attr, char *buf) 203 struct device_attribute *attr, char *buf)
193{ 204{
@@ -394,8 +405,11 @@ static void register_cpu_online(unsigned int cpu)
394 if (cpu_has_feature(CPU_FTR_MMCRA)) 405 if (cpu_has_feature(CPU_FTR_MMCRA))
395 device_create_file(s, &dev_attr_mmcra); 406 device_create_file(s, &dev_attr_mmcra);
396 407
397 if (cpu_has_feature(CPU_FTR_PURR)) 408 if (cpu_has_feature(CPU_FTR_PURR)) {
409 if (!firmware_has_feature(FW_FEATURE_LPAR))
410 add_write_permission_dev_attr(&dev_attr_purr);
398 device_create_file(s, &dev_attr_purr); 411 device_create_file(s, &dev_attr_purr);
412 }
399 413
400 if (cpu_has_feature(CPU_FTR_SPURR)) 414 if (cpu_has_feature(CPU_FTR_SPURR))
401 device_create_file(s, &dev_attr_spurr); 415 device_create_file(s, &dev_attr_spurr);
diff --git a/arch/powerpc/kernel/tm.S b/arch/powerpc/kernel/tm.S
index 7b60b9851469..ef47bcbd4352 100644
--- a/arch/powerpc/kernel/tm.S
+++ b/arch/powerpc/kernel/tm.S
@@ -12,16 +12,15 @@
12#include <asm/reg.h> 12#include <asm/reg.h>
13 13
14#ifdef CONFIG_VSX 14#ifdef CONFIG_VSX
15/* See fpu.S, this is very similar but to save/restore checkpointed FPRs/VSRs */ 15/* See fpu.S, this is borrowed from there */
16#define __SAVE_32FPRS_VSRS_TRANSACT(n,c,base) \ 16#define __SAVE_32FPRS_VSRS(n,c,base) \
17BEGIN_FTR_SECTION \ 17BEGIN_FTR_SECTION \
18 b 2f; \ 18 b 2f; \
19END_FTR_SECTION_IFSET(CPU_FTR_VSX); \ 19END_FTR_SECTION_IFSET(CPU_FTR_VSX); \
20 SAVE_32FPRS_TRANSACT(n,base); \ 20 SAVE_32FPRS(n,base); \
21 b 3f; \ 21 b 3f; \
222: SAVE_32VSRS_TRANSACT(n,c,base); \ 222: SAVE_32VSRS(n,c,base); \
233: 233:
24/* ...and this is just plain borrowed from there. */
25#define __REST_32FPRS_VSRS(n,c,base) \ 24#define __REST_32FPRS_VSRS(n,c,base) \
26BEGIN_FTR_SECTION \ 25BEGIN_FTR_SECTION \
27 b 2f; \ 26 b 2f; \
@@ -31,11 +30,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX); \
312: REST_32VSRS(n,c,base); \ 302: REST_32VSRS(n,c,base); \
323: 313:
33#else 32#else
34#define __SAVE_32FPRS_VSRS_TRANSACT(n,c,base) SAVE_32FPRS_TRANSACT(n, base) 33#define __SAVE_32FPRS_VSRS(n,c,base) SAVE_32FPRS(n, base)
35#define __REST_32FPRS_VSRS(n,c,base) REST_32FPRS(n, base) 34#define __REST_32FPRS_VSRS(n,c,base) REST_32FPRS(n, base)
36#endif 35#endif
37#define SAVE_32FPRS_VSRS_TRANSACT(n,c,base) \ 36#define SAVE_32FPRS_VSRS(n,c,base) \
38 __SAVE_32FPRS_VSRS_TRANSACT(n,__REG_##c,__REG_##base) 37 __SAVE_32FPRS_VSRS(n,__REG_##c,__REG_##base)
39#define REST_32FPRS_VSRS(n,c,base) \ 38#define REST_32FPRS_VSRS(n,c,base) \
40 __REST_32FPRS_VSRS(n,__REG_##c,__REG_##base) 39 __REST_32FPRS_VSRS(n,__REG_##c,__REG_##base)
41 40
@@ -79,6 +78,11 @@ _GLOBAL(tm_abort)
79 TABORT(R3) 78 TABORT(R3)
80 blr 79 blr
81 80
81 .section ".toc","aw"
82DSCR_DEFAULT:
83 .tc dscr_default[TC],dscr_default
84
85 .section ".text"
82 86
83/* void tm_reclaim(struct thread_struct *thread, 87/* void tm_reclaim(struct thread_struct *thread,
84 * unsigned long orig_msr, 88 * unsigned long orig_msr,
@@ -102,7 +106,7 @@ _GLOBAL(tm_abort)
102_GLOBAL(tm_reclaim) 106_GLOBAL(tm_reclaim)
103 mfcr r6 107 mfcr r6
104 mflr r0 108 mflr r0
105 std r6, 8(r1) 109 stw r6, 8(r1)
106 std r0, 16(r1) 110 std r0, 16(r1)
107 std r2, 40(r1) 111 std r2, 40(r1)
108 stdu r1, -TM_FRAME_SIZE(r1) 112 stdu r1, -TM_FRAME_SIZE(r1)
@@ -123,6 +127,7 @@ _GLOBAL(tm_reclaim)
123 mr r15, r14 127 mr r15, r14
124 ori r15, r15, MSR_FP 128 ori r15, r15, MSR_FP
125 li r16, MSR_RI 129 li r16, MSR_RI
130 ori r16, r16, MSR_EE /* IRQs hard off */
126 andc r15, r15, r16 131 andc r15, r15, r16
127 oris r15, r15, MSR_VEC@h 132 oris r15, r15, MSR_VEC@h
128#ifdef CONFIG_VSX 133#ifdef CONFIG_VSX
@@ -151,10 +156,11 @@ _GLOBAL(tm_reclaim)
151 andis. r0, r4, MSR_VEC@h 156 andis. r0, r4, MSR_VEC@h
152 beq dont_backup_vec 157 beq dont_backup_vec
153 158
154 SAVE_32VRS_TRANSACT(0, r6, r3) /* r6 scratch, r3 thread */ 159 addi r7, r3, THREAD_TRANSACT_VRSTATE
160 SAVE_32VRS(0, r6, r7) /* r6 scratch, r7 transact vr state */
155 mfvscr vr0 161 mfvscr vr0
156 li r6, THREAD_TRANSACT_VSCR 162 li r6, VRSTATE_VSCR
157 stvx vr0, r3, r6 163 stvx vr0, r7, r6
158dont_backup_vec: 164dont_backup_vec:
159 mfspr r0, SPRN_VRSAVE 165 mfspr r0, SPRN_VRSAVE
160 std r0, THREAD_TRANSACT_VRSAVE(r3) 166 std r0, THREAD_TRANSACT_VRSAVE(r3)
@@ -162,10 +168,11 @@ dont_backup_vec:
162 andi. r0, r4, MSR_FP 168 andi. r0, r4, MSR_FP
163 beq dont_backup_fp 169 beq dont_backup_fp
164 170
165 SAVE_32FPRS_VSRS_TRANSACT(0, R6, R3) /* r6 scratch, r3 thread */ 171 addi r7, r3, THREAD_TRANSACT_FPSTATE
172 SAVE_32FPRS_VSRS(0, R6, R7) /* r6 scratch, r7 transact fp state */
166 173
167 mffs fr0 174 mffs fr0
168 stfd fr0,THREAD_TRANSACT_FPSCR(r3) 175 stfd fr0,FPSTATE_FPSCR(r7)
169 176
170dont_backup_fp: 177dont_backup_fp:
171 /* The moment we treclaim, ALL of our GPRs will switch 178 /* The moment we treclaim, ALL of our GPRs will switch
@@ -187,11 +194,18 @@ dont_backup_fp:
187 std r1, PACATMSCRATCH(r13) 194 std r1, PACATMSCRATCH(r13)
188 ld r1, PACAR1(r13) 195 ld r1, PACAR1(r13)
189 196
197 /* Store the PPR in r11 and reset to decent value */
198 std r11, GPR11(r1) /* Temporary stash */
199 mfspr r11, SPRN_PPR
200 HMT_MEDIUM
201
190 /* Now get some more GPRS free */ 202 /* Now get some more GPRS free */
191 std r7, GPR7(r1) /* Temporary stash */ 203 std r7, GPR7(r1) /* Temporary stash */
192 std r12, GPR12(r1) /* '' '' '' */ 204 std r12, GPR12(r1) /* '' '' '' */
193 ld r12, STACK_PARAM(0)(r1) /* Param 0, thread_struct * */ 205 ld r12, STACK_PARAM(0)(r1) /* Param 0, thread_struct * */
194 206
207 std r11, THREAD_TM_PPR(r12) /* Store PPR and free r11 */
208
195 addi r7, r12, PT_CKPT_REGS /* Thread's ckpt_regs */ 209 addi r7, r12, PT_CKPT_REGS /* Thread's ckpt_regs */
196 210
197 /* Make r7 look like an exception frame so that we 211 /* Make r7 look like an exception frame so that we
@@ -203,15 +217,19 @@ dont_backup_fp:
203 SAVE_GPR(0, r7) /* user r0 */ 217 SAVE_GPR(0, r7) /* user r0 */
204 SAVE_GPR(2, r7) /* user r2 */ 218 SAVE_GPR(2, r7) /* user r2 */
205 SAVE_4GPRS(3, r7) /* user r3-r6 */ 219 SAVE_4GPRS(3, r7) /* user r3-r6 */
206 SAVE_4GPRS(8, r7) /* user r8-r11 */ 220 SAVE_GPR(8, r7) /* user r8 */
221 SAVE_GPR(9, r7) /* user r9 */
222 SAVE_GPR(10, r7) /* user r10 */
207 ld r3, PACATMSCRATCH(r13) /* user r1 */ 223 ld r3, PACATMSCRATCH(r13) /* user r1 */
208 ld r4, GPR7(r1) /* user r7 */ 224 ld r4, GPR7(r1) /* user r7 */
209 ld r5, GPR12(r1) /* user r12 */ 225 ld r5, GPR11(r1) /* user r11 */
210 GET_SCRATCH0(6) /* user r13 */ 226 ld r6, GPR12(r1) /* user r12 */
227 GET_SCRATCH0(8) /* user r13 */
211 std r3, GPR1(r7) 228 std r3, GPR1(r7)
212 std r4, GPR7(r7) 229 std r4, GPR7(r7)
213 std r5, GPR12(r7) 230 std r5, GPR11(r7)
214 std r6, GPR13(r7) 231 std r6, GPR12(r7)
232 std r8, GPR13(r7)
215 233
216 SAVE_NVGPRS(r7) /* user r14-r31 */ 234 SAVE_NVGPRS(r7) /* user r14-r31 */
217 235
@@ -234,14 +252,12 @@ dont_backup_fp:
234 std r6, _XER(r7) 252 std r6, _XER(r7)
235 253
236 254
237 /* ******************** TAR, PPR, DSCR ********** */ 255 /* ******************** TAR, DSCR ********** */
238 mfspr r3, SPRN_TAR 256 mfspr r3, SPRN_TAR
239 mfspr r4, SPRN_PPR 257 mfspr r4, SPRN_DSCR
240 mfspr r5, SPRN_DSCR
241 258
242 std r3, THREAD_TM_TAR(r12) 259 std r3, THREAD_TM_TAR(r12)
243 std r4, THREAD_TM_PPR(r12) 260 std r4, THREAD_TM_DSCR(r12)
244 std r5, THREAD_TM_DSCR(r12)
245 261
246 /* MSR and flags: We don't change CRs, and we don't need to alter 262 /* MSR and flags: We don't change CRs, and we don't need to alter
247 * MSR. 263 * MSR.
@@ -258,7 +274,7 @@ dont_backup_fp:
258 std r3, THREAD_TM_TFHAR(r12) 274 std r3, THREAD_TM_TFHAR(r12)
259 std r4, THREAD_TM_TFIAR(r12) 275 std r4, THREAD_TM_TFIAR(r12)
260 276
261 /* AMR and PPR are checkpointed too, but are unsupported by Linux. */ 277 /* AMR is checkpointed too, but is unsupported by Linux. */
262 278
263 /* Restore original MSR/IRQ state & clear TM mode */ 279 /* Restore original MSR/IRQ state & clear TM mode */
264 ld r14, TM_FRAME_L0(r1) /* Orig MSR */ 280 ld r14, TM_FRAME_L0(r1) /* Orig MSR */
@@ -269,11 +285,17 @@ dont_backup_fp:
269 REST_NVGPRS(r1) 285 REST_NVGPRS(r1)
270 286
271 addi r1, r1, TM_FRAME_SIZE 287 addi r1, r1, TM_FRAME_SIZE
272 ld r4, 8(r1) 288 lwz r4, 8(r1)
273 ld r0, 16(r1) 289 ld r0, 16(r1)
274 mtcr r4 290 mtcr r4
275 mtlr r0 291 mtlr r0
276 ld r2, 40(r1) 292 ld r2, 40(r1)
293
294 /* Load system default DSCR */
295 ld r4, DSCR_DEFAULT@toc(r2)
296 ld r0, 0(r4)
297 mtspr SPRN_DSCR, r0
298
277 blr 299 blr
278 300
279 301
@@ -288,7 +310,7 @@ dont_backup_fp:
288_GLOBAL(tm_recheckpoint) 310_GLOBAL(tm_recheckpoint)
289 mfcr r5 311 mfcr r5
290 mflr r0 312 mflr r0
291 std r5, 8(r1) 313 stw r5, 8(r1)
292 std r0, 16(r1) 314 std r0, 16(r1)
293 std r2, 40(r1) 315 std r2, 40(r1)
294 stdu r1, -TM_FRAME_SIZE(r1) 316 stdu r1, -TM_FRAME_SIZE(r1)
@@ -337,10 +359,11 @@ _GLOBAL(tm_recheckpoint)
337 andis. r0, r4, MSR_VEC@h 359 andis. r0, r4, MSR_VEC@h
338 beq dont_restore_vec 360 beq dont_restore_vec
339 361
340 li r5, THREAD_VSCR 362 addi r8, r3, THREAD_VRSTATE
341 lvx vr0, r3, r5 363 li r5, VRSTATE_VSCR
364 lvx vr0, r8, r5
342 mtvscr vr0 365 mtvscr vr0
343 REST_32VRS(0, r5, r3) /* r5 scratch, r3 THREAD ptr */ 366 REST_32VRS(0, r5, r8) /* r5 scratch, r8 ptr */
344dont_restore_vec: 367dont_restore_vec:
345 ld r5, THREAD_VRSAVE(r3) 368 ld r5, THREAD_VRSAVE(r3)
346 mtspr SPRN_VRSAVE, r5 369 mtspr SPRN_VRSAVE, r5
@@ -349,34 +372,34 @@ dont_restore_vec:
349 andi. r0, r4, MSR_FP 372 andi. r0, r4, MSR_FP
350 beq dont_restore_fp 373 beq dont_restore_fp
351 374
352 lfd fr0, THREAD_FPSCR(r3) 375 addi r8, r3, THREAD_FPSTATE
376 lfd fr0, FPSTATE_FPSCR(r8)
353 MTFSF_L(fr0) 377 MTFSF_L(fr0)
354 REST_32FPRS_VSRS(0, R4, R3) 378 REST_32FPRS_VSRS(0, R4, R8)
355 379
356dont_restore_fp: 380dont_restore_fp:
357 mtmsr r6 /* FP/Vec off again! */ 381 mtmsr r6 /* FP/Vec off again! */
358 382
359restore_gprs: 383restore_gprs:
360 384
361 /* ******************** TAR, PPR, DSCR ********** */ 385 /* ******************** CR,LR,CCR,MSR ********** */
362 ld r4, THREAD_TM_TAR(r3) 386 ld r4, _CTR(r7)
363 ld r5, THREAD_TM_PPR(r3) 387 ld r5, _LINK(r7)
364 ld r6, THREAD_TM_DSCR(r3) 388 ld r6, _CCR(r7)
389 ld r8, _XER(r7)
365 390
366 mtspr SPRN_TAR, r4 391 mtctr r4
367 mtspr SPRN_PPR, r5 392 mtlr r5
368 mtspr SPRN_DSCR, r6 393 mtcr r6
394 mtxer r8
369 395
370 /* ******************** CR,LR,CCR,MSR ********** */ 396 /* ******************** TAR ******************** */
371 ld r3, _CTR(r7) 397 ld r4, THREAD_TM_TAR(r3)
372 ld r4, _LINK(r7) 398 mtspr SPRN_TAR, r4
373 ld r5, _CCR(r7)
374 ld r6, _XER(r7)
375 399
376 mtctr r3 400 /* Load up the PPR and DSCR in GPRs only at this stage */
377 mtlr r4 401 ld r5, THREAD_TM_DSCR(r3)
378 mtcr r5 402 ld r6, THREAD_TM_PPR(r3)
379 mtxer r6
380 403
381 /* Clear the MSR RI since we are about to change R1. EE is already off 404 /* Clear the MSR RI since we are about to change R1. EE is already off
382 */ 405 */
@@ -384,19 +407,26 @@ restore_gprs:
384 mtmsrd r4, 1 407 mtmsrd r4, 1
385 408
386 REST_4GPRS(0, r7) /* GPR0-3 */ 409 REST_4GPRS(0, r7) /* GPR0-3 */
387 REST_GPR(4, r7) /* GPR4-6 */ 410 REST_GPR(4, r7) /* GPR4 */
388 REST_GPR(5, r7)
389 REST_GPR(6, r7)
390 REST_4GPRS(8, r7) /* GPR8-11 */ 411 REST_4GPRS(8, r7) /* GPR8-11 */
391 REST_2GPRS(12, r7) /* GPR12-13 */ 412 REST_2GPRS(12, r7) /* GPR12-13 */
392 413
393 REST_NVGPRS(r7) /* GPR14-31 */ 414 REST_NVGPRS(r7) /* GPR14-31 */
394 415
395 ld r7, GPR7(r7) /* GPR7 */ 416 /* Load up PPR and DSCR here so we don't run with user values for long
417 */
418 mtspr SPRN_DSCR, r5
419 mtspr SPRN_PPR, r6
420
421 REST_GPR(5, r7) /* GPR5-7 */
422 REST_GPR(6, r7)
423 ld r7, GPR7(r7)
396 424
397 /* Commit register state as checkpointed state: */ 425 /* Commit register state as checkpointed state: */
398 TRECHKPT 426 TRECHKPT
399 427
428 HMT_MEDIUM
429
400 /* Our transactional state has now changed. 430 /* Our transactional state has now changed.
401 * 431 *
402 * Now just get out of here. Transactional (current) state will be 432 * Now just get out of here. Transactional (current) state will be
@@ -414,11 +444,17 @@ restore_gprs:
414 REST_NVGPRS(r1) 444 REST_NVGPRS(r1)
415 445
416 addi r1, r1, TM_FRAME_SIZE 446 addi r1, r1, TM_FRAME_SIZE
417 ld r4, 8(r1) 447 lwz r4, 8(r1)
418 ld r0, 16(r1) 448 ld r0, 16(r1)
419 mtcr r4 449 mtcr r4
420 mtlr r0 450 mtlr r0
421 ld r2, 40(r1) 451 ld r2, 40(r1)
452
453 /* Load system default DSCR */
454 ld r4, DSCR_DEFAULT@toc(r2)
455 ld r0, 0(r4)
456 mtspr SPRN_DSCR, r0
457
422 blr 458 blr
423 459
424 /* ****************************************************************** */ 460 /* ****************************************************************** */
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index f783c932faeb..907a472f9a9e 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -351,8 +351,8 @@ static inline int check_io_access(struct pt_regs *regs)
351#define REASON_TRAP ESR_PTR 351#define REASON_TRAP ESR_PTR
352 352
353/* single-step stuff */ 353/* single-step stuff */
354#define single_stepping(regs) (current->thread.dbcr0 & DBCR0_IC) 354#define single_stepping(regs) (current->thread.debug.dbcr0 & DBCR0_IC)
355#define clear_single_step(regs) (current->thread.dbcr0 &= ~DBCR0_IC) 355#define clear_single_step(regs) (current->thread.debug.dbcr0 &= ~DBCR0_IC)
356 356
357#else 357#else
358/* On non-4xx, the reason for the machine check or program 358/* On non-4xx, the reason for the machine check or program
@@ -816,7 +816,7 @@ static void parse_fpe(struct pt_regs *regs)
816 816
817 flush_fp_to_thread(current); 817 flush_fp_to_thread(current);
818 818
819 code = __parse_fpscr(current->thread.fpscr.val); 819 code = __parse_fpscr(current->thread.fp_state.fpscr);
820 820
821 _exception(SIGFPE, regs, code, regs->nip); 821 _exception(SIGFPE, regs, code, regs->nip);
822} 822}
@@ -1018,6 +1018,13 @@ static int emulate_instruction(struct pt_regs *regs)
1018 return emulate_isel(regs, instword); 1018 return emulate_isel(regs, instword);
1019 } 1019 }
1020 1020
1021 /* Emulate sync instruction variants */
1022 if ((instword & PPC_INST_SYNC_MASK) == PPC_INST_SYNC) {
1023 PPC_WARN_EMULATED(sync, regs);
1024 asm volatile("sync");
1025 return 0;
1026 }
1027
1021#ifdef CONFIG_PPC64 1028#ifdef CONFIG_PPC64
1022 /* Emulate the mfspr rD, DSCR. */ 1029 /* Emulate the mfspr rD, DSCR. */
1023 if ((((instword & PPC_INST_MFSPR_DSCR_USER_MASK) == 1030 if ((((instword & PPC_INST_MFSPR_DSCR_USER_MASK) ==
@@ -1069,7 +1076,7 @@ static int emulate_math(struct pt_regs *regs)
1069 return 0; 1076 return 0;
1070 case 1: { 1077 case 1: {
1071 int code = 0; 1078 int code = 0;
1072 code = __parse_fpscr(current->thread.fpscr.val); 1079 code = __parse_fpscr(current->thread.fp_state.fpscr);
1073 _exception(SIGFPE, regs, code, regs->nip); 1080 _exception(SIGFPE, regs, code, regs->nip);
1074 return 0; 1081 return 0;
1075 } 1082 }
@@ -1371,8 +1378,6 @@ void facility_unavailable_exception(struct pt_regs *regs)
1371 1378
1372#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 1379#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1373 1380
1374extern void do_load_up_fpu(struct pt_regs *regs);
1375
1376void fp_unavailable_tm(struct pt_regs *regs) 1381void fp_unavailable_tm(struct pt_regs *regs)
1377{ 1382{
1378 /* Note: This does not handle any kind of FP laziness. */ 1383 /* Note: This does not handle any kind of FP laziness. */
@@ -1403,8 +1408,6 @@ void fp_unavailable_tm(struct pt_regs *regs)
1403} 1408}
1404 1409
1405#ifdef CONFIG_ALTIVEC 1410#ifdef CONFIG_ALTIVEC
1406extern void do_load_up_altivec(struct pt_regs *regs);
1407
1408void altivec_unavailable_tm(struct pt_regs *regs) 1411void altivec_unavailable_tm(struct pt_regs *regs)
1409{ 1412{
1410 /* See the comments in fp_unavailable_tm(). This function operates 1413 /* See the comments in fp_unavailable_tm(). This function operates
@@ -1465,7 +1468,8 @@ void SoftwareEmulation(struct pt_regs *regs)
1465 1468
1466 if (!user_mode(regs)) { 1469 if (!user_mode(regs)) {
1467 debugger(regs); 1470 debugger(regs);
1468 die("Kernel Mode Software FPU Emulation", regs, SIGFPE); 1471 die("Kernel Mode Unimplemented Instruction or SW FPU Emulation",
1472 regs, SIGFPE);
1469 } 1473 }
1470 1474
1471 if (!emulate_math(regs)) 1475 if (!emulate_math(regs))
@@ -1486,7 +1490,7 @@ static void handle_debug(struct pt_regs *regs, unsigned long debug_status)
1486 if (debug_status & (DBSR_DAC1R | DBSR_DAC1W)) { 1490 if (debug_status & (DBSR_DAC1R | DBSR_DAC1W)) {
1487 dbcr_dac(current) &= ~(DBCR_DAC1R | DBCR_DAC1W); 1491 dbcr_dac(current) &= ~(DBCR_DAC1R | DBCR_DAC1W);
1488#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE 1492#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE
1489 current->thread.dbcr2 &= ~DBCR2_DAC12MODE; 1493 current->thread.debug.dbcr2 &= ~DBCR2_DAC12MODE;
1490#endif 1494#endif
1491 do_send_trap(regs, mfspr(SPRN_DAC1), debug_status, TRAP_HWBKPT, 1495 do_send_trap(regs, mfspr(SPRN_DAC1), debug_status, TRAP_HWBKPT,
1492 5); 1496 5);
@@ -1497,24 +1501,24 @@ static void handle_debug(struct pt_regs *regs, unsigned long debug_status)
1497 6); 1501 6);
1498 changed |= 0x01; 1502 changed |= 0x01;
1499 } else if (debug_status & DBSR_IAC1) { 1503 } else if (debug_status & DBSR_IAC1) {
1500 current->thread.dbcr0 &= ~DBCR0_IAC1; 1504 current->thread.debug.dbcr0 &= ~DBCR0_IAC1;
1501 dbcr_iac_range(current) &= ~DBCR_IAC12MODE; 1505 dbcr_iac_range(current) &= ~DBCR_IAC12MODE;
1502 do_send_trap(regs, mfspr(SPRN_IAC1), debug_status, TRAP_HWBKPT, 1506 do_send_trap(regs, mfspr(SPRN_IAC1), debug_status, TRAP_HWBKPT,
1503 1); 1507 1);
1504 changed |= 0x01; 1508 changed |= 0x01;
1505 } else if (debug_status & DBSR_IAC2) { 1509 } else if (debug_status & DBSR_IAC2) {
1506 current->thread.dbcr0 &= ~DBCR0_IAC2; 1510 current->thread.debug.dbcr0 &= ~DBCR0_IAC2;
1507 do_send_trap(regs, mfspr(SPRN_IAC2), debug_status, TRAP_HWBKPT, 1511 do_send_trap(regs, mfspr(SPRN_IAC2), debug_status, TRAP_HWBKPT,
1508 2); 1512 2);
1509 changed |= 0x01; 1513 changed |= 0x01;
1510 } else if (debug_status & DBSR_IAC3) { 1514 } else if (debug_status & DBSR_IAC3) {
1511 current->thread.dbcr0 &= ~DBCR0_IAC3; 1515 current->thread.debug.dbcr0 &= ~DBCR0_IAC3;
1512 dbcr_iac_range(current) &= ~DBCR_IAC34MODE; 1516 dbcr_iac_range(current) &= ~DBCR_IAC34MODE;
1513 do_send_trap(regs, mfspr(SPRN_IAC3), debug_status, TRAP_HWBKPT, 1517 do_send_trap(regs, mfspr(SPRN_IAC3), debug_status, TRAP_HWBKPT,
1514 3); 1518 3);
1515 changed |= 0x01; 1519 changed |= 0x01;
1516 } else if (debug_status & DBSR_IAC4) { 1520 } else if (debug_status & DBSR_IAC4) {
1517 current->thread.dbcr0 &= ~DBCR0_IAC4; 1521 current->thread.debug.dbcr0 &= ~DBCR0_IAC4;
1518 do_send_trap(regs, mfspr(SPRN_IAC4), debug_status, TRAP_HWBKPT, 1522 do_send_trap(regs, mfspr(SPRN_IAC4), debug_status, TRAP_HWBKPT,
1519 4); 1523 4);
1520 changed |= 0x01; 1524 changed |= 0x01;
@@ -1524,19 +1528,20 @@ static void handle_debug(struct pt_regs *regs, unsigned long debug_status)
1524 * Check all other debug flags and see if that bit needs to be turned 1528 * Check all other debug flags and see if that bit needs to be turned
1525 * back on or not. 1529 * back on or not.
1526 */ 1530 */
1527 if (DBCR_ACTIVE_EVENTS(current->thread.dbcr0, current->thread.dbcr1)) 1531 if (DBCR_ACTIVE_EVENTS(current->thread.debug.dbcr0,
1532 current->thread.debug.dbcr1))
1528 regs->msr |= MSR_DE; 1533 regs->msr |= MSR_DE;
1529 else 1534 else
1530 /* Make sure the IDM flag is off */ 1535 /* Make sure the IDM flag is off */
1531 current->thread.dbcr0 &= ~DBCR0_IDM; 1536 current->thread.debug.dbcr0 &= ~DBCR0_IDM;
1532 1537
1533 if (changed & 0x01) 1538 if (changed & 0x01)
1534 mtspr(SPRN_DBCR0, current->thread.dbcr0); 1539 mtspr(SPRN_DBCR0, current->thread.debug.dbcr0);
1535} 1540}
1536 1541
1537void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status) 1542void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status)
1538{ 1543{
1539 current->thread.dbsr = debug_status; 1544 current->thread.debug.dbsr = debug_status;
1540 1545
1541 /* Hack alert: On BookE, Branch Taken stops on the branch itself, while 1546 /* Hack alert: On BookE, Branch Taken stops on the branch itself, while
1542 * on server, it stops on the target of the branch. In order to simulate 1547 * on server, it stops on the target of the branch. In order to simulate
@@ -1553,8 +1558,8 @@ void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status)
1553 1558
1554 /* Do the single step trick only when coming from userspace */ 1559 /* Do the single step trick only when coming from userspace */
1555 if (user_mode(regs)) { 1560 if (user_mode(regs)) {
1556 current->thread.dbcr0 &= ~DBCR0_BT; 1561 current->thread.debug.dbcr0 &= ~DBCR0_BT;
1557 current->thread.dbcr0 |= DBCR0_IDM | DBCR0_IC; 1562 current->thread.debug.dbcr0 |= DBCR0_IDM | DBCR0_IC;
1558 regs->msr |= MSR_DE; 1563 regs->msr |= MSR_DE;
1559 return; 1564 return;
1560 } 1565 }
@@ -1582,13 +1587,13 @@ void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status)
1582 return; 1587 return;
1583 1588
1584 if (user_mode(regs)) { 1589 if (user_mode(regs)) {
1585 current->thread.dbcr0 &= ~DBCR0_IC; 1590 current->thread.debug.dbcr0 &= ~DBCR0_IC;
1586 if (DBCR_ACTIVE_EVENTS(current->thread.dbcr0, 1591 if (DBCR_ACTIVE_EVENTS(current->thread.debug.dbcr0,
1587 current->thread.dbcr1)) 1592 current->thread.debug.dbcr1))
1588 regs->msr |= MSR_DE; 1593 regs->msr |= MSR_DE;
1589 else 1594 else
1590 /* Make sure the IDM bit is off */ 1595 /* Make sure the IDM bit is off */
1591 current->thread.dbcr0 &= ~DBCR0_IDM; 1596 current->thread.debug.dbcr0 &= ~DBCR0_IDM;
1592 } 1597 }
1593 1598
1594 _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip); 1599 _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip);
@@ -1634,7 +1639,7 @@ void altivec_assist_exception(struct pt_regs *regs)
1634 /* XXX quick hack for now: set the non-Java bit in the VSCR */ 1639 /* XXX quick hack for now: set the non-Java bit in the VSCR */
1635 printk_ratelimited(KERN_ERR "Unrecognized altivec instruction " 1640 printk_ratelimited(KERN_ERR "Unrecognized altivec instruction "
1636 "in %s at %lx\n", current->comm, regs->nip); 1641 "in %s at %lx\n", current->comm, regs->nip);
1637 current->thread.vscr.u[3] |= 0x10000; 1642 current->thread.vr_state.vscr.u[3] |= 0x10000;
1638 } 1643 }
1639} 1644}
1640#endif /* CONFIG_ALTIVEC */ 1645#endif /* CONFIG_ALTIVEC */
@@ -1815,6 +1820,7 @@ struct ppc_emulated ppc_emulated = {
1815 WARN_EMULATED_SETUP(popcntb), 1820 WARN_EMULATED_SETUP(popcntb),
1816 WARN_EMULATED_SETUP(spe), 1821 WARN_EMULATED_SETUP(spe),
1817 WARN_EMULATED_SETUP(string), 1822 WARN_EMULATED_SETUP(string),
1823 WARN_EMULATED_SETUP(sync),
1818 WARN_EMULATED_SETUP(unaligned), 1824 WARN_EMULATED_SETUP(unaligned),
1819#ifdef CONFIG_MATH_EMULATION 1825#ifdef CONFIG_MATH_EMULATION
1820 WARN_EMULATED_SETUP(math), 1826 WARN_EMULATED_SETUP(math),
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 1d9c92621b36..094e45c16a17 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -34,8 +34,7 @@
34#include <asm/firmware.h> 34#include <asm/firmware.h>
35#include <asm/vdso.h> 35#include <asm/vdso.h>
36#include <asm/vdso_datapage.h> 36#include <asm/vdso_datapage.h>
37 37#include <asm/setup.h>
38#include "setup.h"
39 38
40#undef DEBUG 39#undef DEBUG
41 40
diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S
index f223409629b9..e58ee10fa5c0 100644
--- a/arch/powerpc/kernel/vdso32/vdso32.lds.S
+++ b/arch/powerpc/kernel/vdso32/vdso32.lds.S
@@ -4,7 +4,11 @@
4 */ 4 */
5#include <asm/vdso.h> 5#include <asm/vdso.h>
6 6
7#ifdef __LITTLE_ENDIAN__
8OUTPUT_FORMAT("elf32-powerpcle", "elf32-powerpcle", "elf32-powerpcle")
9#else
7OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") 10OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
11#endif
8OUTPUT_ARCH(powerpc:common) 12OUTPUT_ARCH(powerpc:common)
9ENTRY(_start) 13ENTRY(_start)
10 14
diff --git a/arch/powerpc/kernel/vdso64/vdso64.lds.S b/arch/powerpc/kernel/vdso64/vdso64.lds.S
index e4863819663b..64fb183a47c2 100644
--- a/arch/powerpc/kernel/vdso64/vdso64.lds.S
+++ b/arch/powerpc/kernel/vdso64/vdso64.lds.S
@@ -4,7 +4,11 @@
4 */ 4 */
5#include <asm/vdso.h> 5#include <asm/vdso.h>
6 6
7#ifdef __LITTLE_ENDIAN__
8OUTPUT_FORMAT("elf64-powerpcle", "elf64-powerpcle", "elf64-powerpcle")
9#else
7OUTPUT_FORMAT("elf64-powerpc", "elf64-powerpc", "elf64-powerpc") 10OUTPUT_FORMAT("elf64-powerpc", "elf64-powerpc", "elf64-powerpc")
11#endif
8OUTPUT_ARCH(powerpc:common64) 12OUTPUT_ARCH(powerpc:common64)
9ENTRY(_start) 13ENTRY(_start)
10 14
diff --git a/arch/powerpc/kernel/vecemu.c b/arch/powerpc/kernel/vecemu.c
index 604d0947cb20..c4bfadb2606b 100644
--- a/arch/powerpc/kernel/vecemu.c
+++ b/arch/powerpc/kernel/vecemu.c
@@ -271,7 +271,7 @@ int emulate_altivec(struct pt_regs *regs)
271 vb = (instr >> 11) & 0x1f; 271 vb = (instr >> 11) & 0x1f;
272 vc = (instr >> 6) & 0x1f; 272 vc = (instr >> 6) & 0x1f;
273 273
274 vrs = current->thread.vr; 274 vrs = current->thread.vr_state.vr;
275 switch (instr & 0x3f) { 275 switch (instr & 0x3f) {
276 case 10: 276 case 10:
277 switch (vc) { 277 switch (vc) {
@@ -320,12 +320,12 @@ int emulate_altivec(struct pt_regs *regs)
320 case 14: /* vctuxs */ 320 case 14: /* vctuxs */
321 for (i = 0; i < 4; ++i) 321 for (i = 0; i < 4; ++i)
322 vrs[vd].u[i] = ctuxs(vrs[vb].u[i], va, 322 vrs[vd].u[i] = ctuxs(vrs[vb].u[i], va,
323 &current->thread.vscr.u[3]); 323 &current->thread.vr_state.vscr.u[3]);
324 break; 324 break;
325 case 15: /* vctsxs */ 325 case 15: /* vctsxs */
326 for (i = 0; i < 4; ++i) 326 for (i = 0; i < 4; ++i)
327 vrs[vd].u[i] = ctsxs(vrs[vb].u[i], va, 327 vrs[vd].u[i] = ctsxs(vrs[vb].u[i], va,
328 &current->thread.vscr.u[3]); 328 &current->thread.vr_state.vscr.u[3]);
329 break; 329 break;
330 default: 330 default:
331 return -EINVAL; 331 return -EINVAL;
diff --git a/arch/powerpc/kernel/vector.S b/arch/powerpc/kernel/vector.S
index 9e20999aaef2..0458a9aaba9d 100644
--- a/arch/powerpc/kernel/vector.S
+++ b/arch/powerpc/kernel/vector.S
@@ -8,29 +8,6 @@
8#include <asm/ptrace.h> 8#include <asm/ptrace.h>
9 9
10#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 10#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
11/*
12 * Wrapper to call load_up_altivec from C.
13 * void do_load_up_altivec(struct pt_regs *regs);
14 */
15_GLOBAL(do_load_up_altivec)
16 mflr r0
17 std r0, 16(r1)
18 stdu r1, -112(r1)
19
20 subi r6, r3, STACK_FRAME_OVERHEAD
21 /* load_up_altivec expects r12=MSR, r13=PACA, and returns
22 * with r12 = new MSR.
23 */
24 ld r12,_MSR(r6)
25 GET_PACA(r13)
26 bl load_up_altivec
27 std r12,_MSR(r6)
28
29 ld r0, 112+16(r1)
30 addi r1, r1, 112
31 mtlr r0
32 blr
33
34/* void do_load_up_transact_altivec(struct thread_struct *thread) 11/* void do_load_up_transact_altivec(struct thread_struct *thread)
35 * 12 *
36 * This is similar to load_up_altivec but for the transactional version of the 13 * This is similar to load_up_altivec but for the transactional version of the
@@ -46,10 +23,11 @@ _GLOBAL(do_load_up_transact_altivec)
46 li r4,1 23 li r4,1
47 stw r4,THREAD_USED_VR(r3) 24 stw r4,THREAD_USED_VR(r3)
48 25
49 li r10,THREAD_TRANSACT_VSCR 26 li r10,THREAD_TRANSACT_VRSTATE+VRSTATE_VSCR
50 lvx vr0,r10,r3 27 lvx vr0,r10,r3
51 mtvscr vr0 28 mtvscr vr0
52 REST_32VRS_TRANSACT(0,r4,r3) 29 addi r10,r3,THREAD_TRANSACT_VRSTATE
30 REST_32VRS(0,r4,r10)
53 31
54 /* Disable VEC again. */ 32 /* Disable VEC again. */
55 MTMSRD(r6) 33 MTMSRD(r6)
@@ -59,12 +37,36 @@ _GLOBAL(do_load_up_transact_altivec)
59#endif 37#endif
60 38
61/* 39/*
62 * load_up_altivec(unused, unused, tsk) 40 * Load state from memory into VMX registers including VSCR.
41 * Assumes the caller has enabled VMX in the MSR.
42 */
43_GLOBAL(load_vr_state)
44 li r4,VRSTATE_VSCR
45 lvx vr0,r4,r3
46 mtvscr vr0
47 REST_32VRS(0,r4,r3)
48 blr
49
50/*
51 * Store VMX state into memory, including VSCR.
52 * Assumes the caller has enabled VMX in the MSR.
53 */
54_GLOBAL(store_vr_state)
55 SAVE_32VRS(0, r4, r3)
56 mfvscr vr0
57 li r4, VRSTATE_VSCR
58 stvx vr0, r4, r3
59 blr
60
61/*
63 * Disable VMX for the task which had it previously, 62 * Disable VMX for the task which had it previously,
64 * and save its vector registers in its thread_struct. 63 * and save its vector registers in its thread_struct.
65 * Enables the VMX for use in the kernel on return. 64 * Enables the VMX for use in the kernel on return.
66 * On SMP we know the VMX is free, since we give it up every 65 * On SMP we know the VMX is free, since we give it up every
67 * switch (ie, no lazy save of the vector registers). 66 * switch (ie, no lazy save of the vector registers).
67 *
68 * Note that on 32-bit this can only use registers that will be
69 * restored by fast_exception_return, i.e. r3 - r6, r10 and r11.
68 */ 70 */
69_GLOBAL(load_up_altivec) 71_GLOBAL(load_up_altivec)
70 mfmsr r5 /* grab the current MSR */ 72 mfmsr r5 /* grab the current MSR */
@@ -90,10 +92,11 @@ _GLOBAL(load_up_altivec)
90 /* Save VMX state to last_task_used_altivec's THREAD struct */ 92 /* Save VMX state to last_task_used_altivec's THREAD struct */
91 toreal(r4) 93 toreal(r4)
92 addi r4,r4,THREAD 94 addi r4,r4,THREAD
93 SAVE_32VRS(0,r5,r4) 95 addi r6,r4,THREAD_VRSTATE
96 SAVE_32VRS(0,r5,r6)
94 mfvscr vr0 97 mfvscr vr0
95 li r10,THREAD_VSCR 98 li r10,VRSTATE_VSCR
96 stvx vr0,r10,r4 99 stvx vr0,r10,r6
97 /* Disable VMX for last_task_used_altivec */ 100 /* Disable VMX for last_task_used_altivec */
98 PPC_LL r5,PT_REGS(r4) 101 PPC_LL r5,PT_REGS(r4)
99 toreal(r5) 102 toreal(r5)
@@ -125,12 +128,13 @@ _GLOBAL(load_up_altivec)
125 oris r12,r12,MSR_VEC@h 128 oris r12,r12,MSR_VEC@h
126 std r12,_MSR(r1) 129 std r12,_MSR(r1)
127#endif 130#endif
131 addi r6,r5,THREAD_VRSTATE
128 li r4,1 132 li r4,1
129 li r10,THREAD_VSCR 133 li r10,VRSTATE_VSCR
130 stw r4,THREAD_USED_VR(r5) 134 stw r4,THREAD_USED_VR(r5)
131 lvx vr0,r10,r5 135 lvx vr0,r10,r6
132 mtvscr vr0 136 mtvscr vr0
133 REST_32VRS(0,r4,r5) 137 REST_32VRS(0,r4,r6)
134#ifndef CONFIG_SMP 138#ifndef CONFIG_SMP
135 /* Update last_task_used_altivec to 'current' */ 139 /* Update last_task_used_altivec to 'current' */
136 subi r4,r5,THREAD /* Back to 'current' */ 140 subi r4,r5,THREAD /* Back to 'current' */
@@ -165,12 +169,16 @@ _GLOBAL(giveup_altivec)
165 PPC_LCMPI 0,r3,0 169 PPC_LCMPI 0,r3,0
166 beqlr /* if no previous owner, done */ 170 beqlr /* if no previous owner, done */
167 addi r3,r3,THREAD /* want THREAD of task */ 171 addi r3,r3,THREAD /* want THREAD of task */
172 PPC_LL r7,THREAD_VRSAVEAREA(r3)
168 PPC_LL r5,PT_REGS(r3) 173 PPC_LL r5,PT_REGS(r3)
169 PPC_LCMPI 0,r5,0 174 PPC_LCMPI 0,r7,0
170 SAVE_32VRS(0,r4,r3) 175 bne 2f
176 addi r7,r3,THREAD_VRSTATE
1772: PPC_LCMPI 0,r5,0
178 SAVE_32VRS(0,r4,r7)
171 mfvscr vr0 179 mfvscr vr0
172 li r4,THREAD_VSCR 180 li r4,VRSTATE_VSCR
173 stvx vr0,r4,r3 181 stvx vr0,r4,r7
174 beq 1f 182 beq 1f
175 PPC_LL r4,_MSR-STACK_FRAME_OVERHEAD(r5) 183 PPC_LL r4,_MSR-STACK_FRAME_OVERHEAD(r5)
176#ifdef CONFIG_VSX 184#ifdef CONFIG_VSX
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 78a350670de3..e7d0c88f621a 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -997,21 +997,36 @@ static struct device_attribute vio_cmo_dev_attrs[] = {
997/* sysfs bus functions and data structures for CMO */ 997/* sysfs bus functions and data structures for CMO */
998 998
999#define viobus_cmo_rd_attr(name) \ 999#define viobus_cmo_rd_attr(name) \
1000static ssize_t \ 1000static ssize_t cmo_##name##_show(struct bus_type *bt, char *buf) \
1001viobus_cmo_##name##_show(struct bus_type *bt, char *buf) \
1002{ \ 1001{ \
1003 return sprintf(buf, "%lu\n", vio_cmo.name); \ 1002 return sprintf(buf, "%lu\n", vio_cmo.name); \
1004} 1003} \
1004static BUS_ATTR_RO(cmo_##name)
1005 1005
1006#define viobus_cmo_pool_rd_attr(name, var) \ 1006#define viobus_cmo_pool_rd_attr(name, var) \
1007static ssize_t \ 1007static ssize_t \
1008viobus_cmo_##name##_pool_show_##var(struct bus_type *bt, char *buf) \ 1008cmo_##name##_##var##_show(struct bus_type *bt, char *buf) \
1009{ \ 1009{ \
1010 return sprintf(buf, "%lu\n", vio_cmo.name.var); \ 1010 return sprintf(buf, "%lu\n", vio_cmo.name.var); \
1011} \
1012static BUS_ATTR_RO(cmo_##name##_##var)
1013
1014viobus_cmo_rd_attr(entitled);
1015viobus_cmo_rd_attr(spare);
1016viobus_cmo_rd_attr(min);
1017viobus_cmo_rd_attr(desired);
1018viobus_cmo_rd_attr(curr);
1019viobus_cmo_pool_rd_attr(reserve, size);
1020viobus_cmo_pool_rd_attr(excess, size);
1021viobus_cmo_pool_rd_attr(excess, free);
1022
1023static ssize_t cmo_high_show(struct bus_type *bt, char *buf)
1024{
1025 return sprintf(buf, "%lu\n", vio_cmo.high);
1011} 1026}
1012 1027
1013static ssize_t viobus_cmo_high_reset(struct bus_type *bt, const char *buf, 1028static ssize_t cmo_high_store(struct bus_type *bt, const char *buf,
1014 size_t count) 1029 size_t count)
1015{ 1030{
1016 unsigned long flags; 1031 unsigned long flags;
1017 1032
@@ -1021,35 +1036,26 @@ static ssize_t viobus_cmo_high_reset(struct bus_type *bt, const char *buf,
1021 1036
1022 return count; 1037 return count;
1023} 1038}
1024 1039static BUS_ATTR_RW(cmo_high);
1025viobus_cmo_rd_attr(entitled); 1040
1026viobus_cmo_pool_rd_attr(reserve, size); 1041static struct attribute *vio_bus_attrs[] = {
1027viobus_cmo_pool_rd_attr(excess, size); 1042 &bus_attr_cmo_entitled.attr,
1028viobus_cmo_pool_rd_attr(excess, free); 1043 &bus_attr_cmo_spare.attr,
1029viobus_cmo_rd_attr(spare); 1044 &bus_attr_cmo_min.attr,
1030viobus_cmo_rd_attr(min); 1045 &bus_attr_cmo_desired.attr,
1031viobus_cmo_rd_attr(desired); 1046 &bus_attr_cmo_curr.attr,
1032viobus_cmo_rd_attr(curr); 1047 &bus_attr_cmo_high.attr,
1033viobus_cmo_rd_attr(high); 1048 &bus_attr_cmo_reserve_size.attr,
1034 1049 &bus_attr_cmo_excess_size.attr,
1035static struct bus_attribute vio_cmo_bus_attrs[] = { 1050 &bus_attr_cmo_excess_free.attr,
1036 __ATTR(cmo_entitled, S_IRUGO, viobus_cmo_entitled_show, NULL), 1051 NULL,
1037 __ATTR(cmo_reserve_size, S_IRUGO, viobus_cmo_reserve_pool_show_size, NULL),
1038 __ATTR(cmo_excess_size, S_IRUGO, viobus_cmo_excess_pool_show_size, NULL),
1039 __ATTR(cmo_excess_free, S_IRUGO, viobus_cmo_excess_pool_show_free, NULL),
1040 __ATTR(cmo_spare, S_IRUGO, viobus_cmo_spare_show, NULL),
1041 __ATTR(cmo_min, S_IRUGO, viobus_cmo_min_show, NULL),
1042 __ATTR(cmo_desired, S_IRUGO, viobus_cmo_desired_show, NULL),
1043 __ATTR(cmo_curr, S_IRUGO, viobus_cmo_curr_show, NULL),
1044 __ATTR(cmo_high, S_IWUSR|S_IRUSR|S_IWGRP|S_IRGRP|S_IROTH,
1045 viobus_cmo_high_show, viobus_cmo_high_reset),
1046 __ATTR_NULL
1047}; 1052};
1053ATTRIBUTE_GROUPS(vio_bus);
1048 1054
1049static void vio_cmo_sysfs_init(void) 1055static void vio_cmo_sysfs_init(void)
1050{ 1056{
1051 vio_bus_type.dev_attrs = vio_cmo_dev_attrs; 1057 vio_bus_type.dev_attrs = vio_cmo_dev_attrs;
1052 vio_bus_type.bus_attrs = vio_cmo_bus_attrs; 1058 vio_bus_type.bus_groups = vio_bus_groups;
1053} 1059}
1054#else /* CONFIG_PPC_SMLPAR */ 1060#else /* CONFIG_PPC_SMLPAR */
1055int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; } 1061int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; }
@@ -1413,8 +1419,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
1413 1419
1414 /* needed to ensure proper operation of coherent allocations 1420 /* needed to ensure proper operation of coherent allocations
1415 * later, in case driver doesn't set it explicitly */ 1421 * later, in case driver doesn't set it explicitly */
1416 dma_set_mask(&viodev->dev, DMA_BIT_MASK(64)); 1422 dma_set_mask_and_coherent(&viodev->dev, DMA_BIT_MASK(64));
1417 dma_set_coherent_mask(&viodev->dev, DMA_BIT_MASK(64));
1418 } 1423 }
1419 1424
1420 /* register with generic device framework */ 1425 /* register with generic device framework */
@@ -1530,11 +1535,15 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
1530 const char *cp; 1535 const char *cp;
1531 1536
1532 dn = dev->of_node; 1537 dn = dev->of_node;
1533 if (!dn) 1538 if (!dn) {
1534 return -ENODEV; 1539 strcpy(buf, "\n");
1540 return strlen(buf);
1541 }
1535 cp = of_get_property(dn, "compatible", NULL); 1542 cp = of_get_property(dn, "compatible", NULL);
1536 if (!cp) 1543 if (!cp) {
1537 return -ENODEV; 1544 strcpy(buf, "\n");
1545 return strlen(buf);
1546 }
1538 1547
1539 return sprintf(buf, "vio:T%sS%s\n", vio_dev->type, cp); 1548 return sprintf(buf, "vio:T%sS%s\n", vio_dev->type, cp);
1540} 1549}
diff --git a/arch/powerpc/kvm/44x.c b/arch/powerpc/kvm/44x.c
index 2f5c6b6d6877..93221e87b911 100644
--- a/arch/powerpc/kvm/44x.c
+++ b/arch/powerpc/kvm/44x.c
@@ -31,13 +31,13 @@
31#include "44x_tlb.h" 31#include "44x_tlb.h"
32#include "booke.h" 32#include "booke.h"
33 33
34void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 34static void kvmppc_core_vcpu_load_44x(struct kvm_vcpu *vcpu, int cpu)
35{ 35{
36 kvmppc_booke_vcpu_load(vcpu, cpu); 36 kvmppc_booke_vcpu_load(vcpu, cpu);
37 kvmppc_44x_tlb_load(vcpu); 37 kvmppc_44x_tlb_load(vcpu);
38} 38}
39 39
40void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu) 40static void kvmppc_core_vcpu_put_44x(struct kvm_vcpu *vcpu)
41{ 41{
42 kvmppc_44x_tlb_put(vcpu); 42 kvmppc_44x_tlb_put(vcpu);
43 kvmppc_booke_vcpu_put(vcpu); 43 kvmppc_booke_vcpu_put(vcpu);
@@ -114,29 +114,32 @@ int kvmppc_core_vcpu_translate(struct kvm_vcpu *vcpu,
114 return 0; 114 return 0;
115} 115}
116 116
117void kvmppc_core_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) 117static int kvmppc_core_get_sregs_44x(struct kvm_vcpu *vcpu,
118 struct kvm_sregs *sregs)
118{ 119{
119 kvmppc_get_sregs_ivor(vcpu, sregs); 120 return kvmppc_get_sregs_ivor(vcpu, sregs);
120} 121}
121 122
122int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) 123static int kvmppc_core_set_sregs_44x(struct kvm_vcpu *vcpu,
124 struct kvm_sregs *sregs)
123{ 125{
124 return kvmppc_set_sregs_ivor(vcpu, sregs); 126 return kvmppc_set_sregs_ivor(vcpu, sregs);
125} 127}
126 128
127int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id, 129static int kvmppc_get_one_reg_44x(struct kvm_vcpu *vcpu, u64 id,
128 union kvmppc_one_reg *val) 130 union kvmppc_one_reg *val)
129{ 131{
130 return -EINVAL; 132 return -EINVAL;
131} 133}
132 134
133int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, 135static int kvmppc_set_one_reg_44x(struct kvm_vcpu *vcpu, u64 id,
134 union kvmppc_one_reg *val) 136 union kvmppc_one_reg *val)
135{ 137{
136 return -EINVAL; 138 return -EINVAL;
137} 139}
138 140
139struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) 141static struct kvm_vcpu *kvmppc_core_vcpu_create_44x(struct kvm *kvm,
142 unsigned int id)
140{ 143{
141 struct kvmppc_vcpu_44x *vcpu_44x; 144 struct kvmppc_vcpu_44x *vcpu_44x;
142 struct kvm_vcpu *vcpu; 145 struct kvm_vcpu *vcpu;
@@ -167,7 +170,7 @@ out:
167 return ERR_PTR(err); 170 return ERR_PTR(err);
168} 171}
169 172
170void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu) 173static void kvmppc_core_vcpu_free_44x(struct kvm_vcpu *vcpu)
171{ 174{
172 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu); 175 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
173 176
@@ -176,28 +179,53 @@ void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
176 kmem_cache_free(kvm_vcpu_cache, vcpu_44x); 179 kmem_cache_free(kvm_vcpu_cache, vcpu_44x);
177} 180}
178 181
179int kvmppc_core_init_vm(struct kvm *kvm) 182static int kvmppc_core_init_vm_44x(struct kvm *kvm)
180{ 183{
181 return 0; 184 return 0;
182} 185}
183 186
184void kvmppc_core_destroy_vm(struct kvm *kvm) 187static void kvmppc_core_destroy_vm_44x(struct kvm *kvm)
185{ 188{
186} 189}
187 190
191static struct kvmppc_ops kvm_ops_44x = {
192 .get_sregs = kvmppc_core_get_sregs_44x,
193 .set_sregs = kvmppc_core_set_sregs_44x,
194 .get_one_reg = kvmppc_get_one_reg_44x,
195 .set_one_reg = kvmppc_set_one_reg_44x,
196 .vcpu_load = kvmppc_core_vcpu_load_44x,
197 .vcpu_put = kvmppc_core_vcpu_put_44x,
198 .vcpu_create = kvmppc_core_vcpu_create_44x,
199 .vcpu_free = kvmppc_core_vcpu_free_44x,
200 .mmu_destroy = kvmppc_mmu_destroy_44x,
201 .init_vm = kvmppc_core_init_vm_44x,
202 .destroy_vm = kvmppc_core_destroy_vm_44x,
203 .emulate_op = kvmppc_core_emulate_op_44x,
204 .emulate_mtspr = kvmppc_core_emulate_mtspr_44x,
205 .emulate_mfspr = kvmppc_core_emulate_mfspr_44x,
206};
207
188static int __init kvmppc_44x_init(void) 208static int __init kvmppc_44x_init(void)
189{ 209{
190 int r; 210 int r;
191 211
192 r = kvmppc_booke_init(); 212 r = kvmppc_booke_init();
193 if (r) 213 if (r)
194 return r; 214 goto err_out;
215
216 r = kvm_init(NULL, sizeof(struct kvmppc_vcpu_44x), 0, THIS_MODULE);
217 if (r)
218 goto err_out;
219 kvm_ops_44x.owner = THIS_MODULE;
220 kvmppc_pr_ops = &kvm_ops_44x;
195 221
196 return kvm_init(NULL, sizeof(struct kvmppc_vcpu_44x), 0, THIS_MODULE); 222err_out:
223 return r;
197} 224}
198 225
199static void __exit kvmppc_44x_exit(void) 226static void __exit kvmppc_44x_exit(void)
200{ 227{
228 kvmppc_pr_ops = NULL;
201 kvmppc_booke_exit(); 229 kvmppc_booke_exit();
202} 230}
203 231
diff --git a/arch/powerpc/kvm/44x_emulate.c b/arch/powerpc/kvm/44x_emulate.c
index 35ec0a8547da..92c9ab4bcfec 100644
--- a/arch/powerpc/kvm/44x_emulate.c
+++ b/arch/powerpc/kvm/44x_emulate.c
@@ -91,8 +91,8 @@ static int emulate_mfdcr(struct kvm_vcpu *vcpu, int rt, int dcrn)
91 return EMULATE_DONE; 91 return EMULATE_DONE;
92} 92}
93 93
94int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, 94int kvmppc_core_emulate_op_44x(struct kvm_run *run, struct kvm_vcpu *vcpu,
95 unsigned int inst, int *advance) 95 unsigned int inst, int *advance)
96{ 96{
97 int emulated = EMULATE_DONE; 97 int emulated = EMULATE_DONE;
98 int dcrn = get_dcrn(inst); 98 int dcrn = get_dcrn(inst);
@@ -152,7 +152,7 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
152 return emulated; 152 return emulated;
153} 153}
154 154
155int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val) 155int kvmppc_core_emulate_mtspr_44x(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
156{ 156{
157 int emulated = EMULATE_DONE; 157 int emulated = EMULATE_DONE;
158 158
@@ -172,7 +172,7 @@ int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
172 return emulated; 172 return emulated;
173} 173}
174 174
175int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val) 175int kvmppc_core_emulate_mfspr_44x(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
176{ 176{
177 int emulated = EMULATE_DONE; 177 int emulated = EMULATE_DONE;
178 178
diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c
index ed0385448148..0deef1082e02 100644
--- a/arch/powerpc/kvm/44x_tlb.c
+++ b/arch/powerpc/kvm/44x_tlb.c
@@ -268,7 +268,7 @@ static void kvmppc_44x_shadow_release(struct kvmppc_vcpu_44x *vcpu_44x,
268 trace_kvm_stlb_inval(stlb_index); 268 trace_kvm_stlb_inval(stlb_index);
269} 269}
270 270
271void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu) 271void kvmppc_mmu_destroy_44x(struct kvm_vcpu *vcpu)
272{ 272{
273 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu); 273 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
274 int i; 274 int i;
diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
index ffaef2cb101a..141b2027189a 100644
--- a/arch/powerpc/kvm/Kconfig
+++ b/arch/powerpc/kvm/Kconfig
@@ -6,6 +6,7 @@ source "virt/kvm/Kconfig"
6 6
7menuconfig VIRTUALIZATION 7menuconfig VIRTUALIZATION
8 bool "Virtualization" 8 bool "Virtualization"
9 depends on !CPU_LITTLE_ENDIAN
9 ---help--- 10 ---help---
10 Say Y here to get to see options for using your Linux host to run 11 Say Y here to get to see options for using your Linux host to run
11 other operating systems inside virtual machines (guests). 12 other operating systems inside virtual machines (guests).
@@ -34,17 +35,20 @@ config KVM_BOOK3S_64_HANDLER
34 bool 35 bool
35 select KVM_BOOK3S_HANDLER 36 select KVM_BOOK3S_HANDLER
36 37
37config KVM_BOOK3S_PR 38config KVM_BOOK3S_PR_POSSIBLE
38 bool 39 bool
39 select KVM_MMIO 40 select KVM_MMIO
40 select MMU_NOTIFIER 41 select MMU_NOTIFIER
41 42
43config KVM_BOOK3S_HV_POSSIBLE
44 bool
45
42config KVM_BOOK3S_32 46config KVM_BOOK3S_32
43 tristate "KVM support for PowerPC book3s_32 processors" 47 tristate "KVM support for PowerPC book3s_32 processors"
44 depends on PPC_BOOK3S_32 && !SMP && !PTE_64BIT 48 depends on PPC_BOOK3S_32 && !SMP && !PTE_64BIT
45 select KVM 49 select KVM
46 select KVM_BOOK3S_32_HANDLER 50 select KVM_BOOK3S_32_HANDLER
47 select KVM_BOOK3S_PR 51 select KVM_BOOK3S_PR_POSSIBLE
48 ---help--- 52 ---help---
49 Support running unmodified book3s_32 guest kernels 53 Support running unmodified book3s_32 guest kernels
50 in virtual machines on book3s_32 host processors. 54 in virtual machines on book3s_32 host processors.
@@ -59,6 +63,7 @@ config KVM_BOOK3S_64
59 depends on PPC_BOOK3S_64 63 depends on PPC_BOOK3S_64
60 select KVM_BOOK3S_64_HANDLER 64 select KVM_BOOK3S_64_HANDLER
61 select KVM 65 select KVM
66 select KVM_BOOK3S_PR_POSSIBLE if !KVM_BOOK3S_HV_POSSIBLE
62 ---help--- 67 ---help---
63 Support running unmodified book3s_64 and book3s_32 guest kernels 68 Support running unmodified book3s_64 and book3s_32 guest kernels
64 in virtual machines on book3s_64 host processors. 69 in virtual machines on book3s_64 host processors.
@@ -69,8 +74,9 @@ config KVM_BOOK3S_64
69 If unsure, say N. 74 If unsure, say N.
70 75
71config KVM_BOOK3S_64_HV 76config KVM_BOOK3S_64_HV
72 bool "KVM support for POWER7 and PPC970 using hypervisor mode in host" 77 tristate "KVM support for POWER7 and PPC970 using hypervisor mode in host"
73 depends on KVM_BOOK3S_64 78 depends on KVM_BOOK3S_64
79 select KVM_BOOK3S_HV_POSSIBLE
74 select MMU_NOTIFIER 80 select MMU_NOTIFIER
75 select CMA 81 select CMA
76 ---help--- 82 ---help---
@@ -89,9 +95,20 @@ config KVM_BOOK3S_64_HV
89 If unsure, say N. 95 If unsure, say N.
90 96
91config KVM_BOOK3S_64_PR 97config KVM_BOOK3S_64_PR
92 def_bool y 98 tristate "KVM support without using hypervisor mode in host"
93 depends on KVM_BOOK3S_64 && !KVM_BOOK3S_64_HV 99 depends on KVM_BOOK3S_64
94 select KVM_BOOK3S_PR 100 select KVM_BOOK3S_PR_POSSIBLE
101 ---help---
102 Support running guest kernels in virtual machines on processors
103 without using hypervisor mode in the host, by running the
104 guest in user mode (problem state) and emulating all
105 privileged instructions and registers.
106
107 This is not as fast as using hypervisor mode, but works on
108 machines where hypervisor mode is not available or not usable,
109 and can emulate processors that are different from the host
110 processor, including emulating 32-bit processors on a 64-bit
111 host.
95 112
96config KVM_BOOKE_HV 113config KVM_BOOKE_HV
97 bool 114 bool
diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile
index 6646c952c5e3..ce569b6bf4d8 100644
--- a/arch/powerpc/kvm/Makefile
+++ b/arch/powerpc/kvm/Makefile
@@ -53,41 +53,51 @@ kvm-e500mc-objs := \
53 e500_emulate.o 53 e500_emulate.o
54kvm-objs-$(CONFIG_KVM_E500MC) := $(kvm-e500mc-objs) 54kvm-objs-$(CONFIG_KVM_E500MC) := $(kvm-e500mc-objs)
55 55
56kvm-book3s_64-objs-$(CONFIG_KVM_BOOK3S_64_PR) := \ 56kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) := \
57 $(KVM)/coalesced_mmio.o \ 57 book3s_64_vio_hv.o
58
59kvm-pr-y := \
58 fpu.o \ 60 fpu.o \
59 book3s_paired_singles.o \ 61 book3s_paired_singles.o \
60 book3s_pr.o \ 62 book3s_pr.o \
61 book3s_pr_papr.o \ 63 book3s_pr_papr.o \
62 book3s_64_vio_hv.o \
63 book3s_emulate.o \ 64 book3s_emulate.o \
64 book3s_interrupts.o \ 65 book3s_interrupts.o \
65 book3s_mmu_hpte.o \ 66 book3s_mmu_hpte.o \
66 book3s_64_mmu_host.o \ 67 book3s_64_mmu_host.o \
67 book3s_64_mmu.o \ 68 book3s_64_mmu.o \
68 book3s_32_mmu.o 69 book3s_32_mmu.o
69kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_PR) := \ 70
71ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
72kvm-book3s_64-module-objs := \
73 $(KVM)/coalesced_mmio.o
74
75kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) += \
70 book3s_rmhandlers.o 76 book3s_rmhandlers.o
77endif
71 78
72kvm-book3s_64-objs-$(CONFIG_KVM_BOOK3S_64_HV) := \ 79kvm-hv-y += \
73 book3s_hv.o \ 80 book3s_hv.o \
74 book3s_hv_interrupts.o \ 81 book3s_hv_interrupts.o \
75 book3s_64_mmu_hv.o 82 book3s_64_mmu_hv.o
83
76kvm-book3s_64-builtin-xics-objs-$(CONFIG_KVM_XICS) := \ 84kvm-book3s_64-builtin-xics-objs-$(CONFIG_KVM_XICS) := \
77 book3s_hv_rm_xics.o 85 book3s_hv_rm_xics.o
78kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HV) := \ 86
87ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
88kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) += \
79 book3s_hv_rmhandlers.o \ 89 book3s_hv_rmhandlers.o \
80 book3s_hv_rm_mmu.o \ 90 book3s_hv_rm_mmu.o \
81 book3s_64_vio_hv.o \
82 book3s_hv_ras.o \ 91 book3s_hv_ras.o \
83 book3s_hv_builtin.o \ 92 book3s_hv_builtin.o \
84 book3s_hv_cma.o \ 93 book3s_hv_cma.o \
85 $(kvm-book3s_64-builtin-xics-objs-y) 94 $(kvm-book3s_64-builtin-xics-objs-y)
95endif
86 96
87kvm-book3s_64-objs-$(CONFIG_KVM_XICS) += \ 97kvm-book3s_64-objs-$(CONFIG_KVM_XICS) += \
88 book3s_xics.o 98 book3s_xics.o
89 99
90kvm-book3s_64-module-objs := \ 100kvm-book3s_64-module-objs += \
91 $(KVM)/kvm_main.o \ 101 $(KVM)/kvm_main.o \
92 $(KVM)/eventfd.o \ 102 $(KVM)/eventfd.o \
93 powerpc.o \ 103 powerpc.o \
@@ -123,4 +133,7 @@ obj-$(CONFIG_KVM_E500MC) += kvm.o
123obj-$(CONFIG_KVM_BOOK3S_64) += kvm.o 133obj-$(CONFIG_KVM_BOOK3S_64) += kvm.o
124obj-$(CONFIG_KVM_BOOK3S_32) += kvm.o 134obj-$(CONFIG_KVM_BOOK3S_32) += kvm.o
125 135
136obj-$(CONFIG_KVM_BOOK3S_64_PR) += kvm-pr.o
137obj-$(CONFIG_KVM_BOOK3S_64_HV) += kvm-hv.o
138
126obj-y += $(kvm-book3s_64-builtin-objs-y) 139obj-y += $(kvm-book3s_64-builtin-objs-y)
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 700df6f1d32c..8912608b7e1b 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -34,6 +34,7 @@
34#include <linux/vmalloc.h> 34#include <linux/vmalloc.h>
35#include <linux/highmem.h> 35#include <linux/highmem.h>
36 36
37#include "book3s.h"
37#include "trace.h" 38#include "trace.h"
38 39
39#define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU 40#define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU
@@ -69,6 +70,50 @@ void kvmppc_core_load_guest_debugstate(struct kvm_vcpu *vcpu)
69{ 70{
70} 71}
71 72
73static inline unsigned long kvmppc_interrupt_offset(struct kvm_vcpu *vcpu)
74{
75 if (!is_kvmppc_hv_enabled(vcpu->kvm))
76 return to_book3s(vcpu)->hior;
77 return 0;
78}
79
80static inline void kvmppc_update_int_pending(struct kvm_vcpu *vcpu,
81 unsigned long pending_now, unsigned long old_pending)
82{
83 if (is_kvmppc_hv_enabled(vcpu->kvm))
84 return;
85 if (pending_now)
86 vcpu->arch.shared->int_pending = 1;
87 else if (old_pending)
88 vcpu->arch.shared->int_pending = 0;
89}
90
91static inline bool kvmppc_critical_section(struct kvm_vcpu *vcpu)
92{
93 ulong crit_raw;
94 ulong crit_r1;
95 bool crit;
96
97 if (is_kvmppc_hv_enabled(vcpu->kvm))
98 return false;
99
100 crit_raw = vcpu->arch.shared->critical;
101 crit_r1 = kvmppc_get_gpr(vcpu, 1);
102
103 /* Truncate crit indicators in 32 bit mode */
104 if (!(vcpu->arch.shared->msr & MSR_SF)) {
105 crit_raw &= 0xffffffff;
106 crit_r1 &= 0xffffffff;
107 }
108
109 /* Critical section when crit == r1 */
110 crit = (crit_raw == crit_r1);
111 /* ... and we're in supervisor mode */
112 crit = crit && !(vcpu->arch.shared->msr & MSR_PR);
113
114 return crit;
115}
116
72void kvmppc_inject_interrupt(struct kvm_vcpu *vcpu, int vec, u64 flags) 117void kvmppc_inject_interrupt(struct kvm_vcpu *vcpu, int vec, u64 flags)
73{ 118{
74 vcpu->arch.shared->srr0 = kvmppc_get_pc(vcpu); 119 vcpu->arch.shared->srr0 = kvmppc_get_pc(vcpu);
@@ -126,28 +171,32 @@ void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec)
126 printk(KERN_INFO "Queueing interrupt %x\n", vec); 171 printk(KERN_INFO "Queueing interrupt %x\n", vec);
127#endif 172#endif
128} 173}
129 174EXPORT_SYMBOL_GPL(kvmppc_book3s_queue_irqprio);
130 175
131void kvmppc_core_queue_program(struct kvm_vcpu *vcpu, ulong flags) 176void kvmppc_core_queue_program(struct kvm_vcpu *vcpu, ulong flags)
132{ 177{
133 /* might as well deliver this straight away */ 178 /* might as well deliver this straight away */
134 kvmppc_inject_interrupt(vcpu, BOOK3S_INTERRUPT_PROGRAM, flags); 179 kvmppc_inject_interrupt(vcpu, BOOK3S_INTERRUPT_PROGRAM, flags);
135} 180}
181EXPORT_SYMBOL_GPL(kvmppc_core_queue_program);
136 182
137void kvmppc_core_queue_dec(struct kvm_vcpu *vcpu) 183void kvmppc_core_queue_dec(struct kvm_vcpu *vcpu)
138{ 184{
139 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_DECREMENTER); 185 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_DECREMENTER);
140} 186}
187EXPORT_SYMBOL_GPL(kvmppc_core_queue_dec);
141 188
142int kvmppc_core_pending_dec(struct kvm_vcpu *vcpu) 189int kvmppc_core_pending_dec(struct kvm_vcpu *vcpu)
143{ 190{
144 return test_bit(BOOK3S_IRQPRIO_DECREMENTER, &vcpu->arch.pending_exceptions); 191 return test_bit(BOOK3S_IRQPRIO_DECREMENTER, &vcpu->arch.pending_exceptions);
145} 192}
193EXPORT_SYMBOL_GPL(kvmppc_core_pending_dec);
146 194
147void kvmppc_core_dequeue_dec(struct kvm_vcpu *vcpu) 195void kvmppc_core_dequeue_dec(struct kvm_vcpu *vcpu)
148{ 196{
149 kvmppc_book3s_dequeue_irqprio(vcpu, BOOK3S_INTERRUPT_DECREMENTER); 197 kvmppc_book3s_dequeue_irqprio(vcpu, BOOK3S_INTERRUPT_DECREMENTER);
150} 198}
199EXPORT_SYMBOL_GPL(kvmppc_core_dequeue_dec);
151 200
152void kvmppc_core_queue_external(struct kvm_vcpu *vcpu, 201void kvmppc_core_queue_external(struct kvm_vcpu *vcpu,
153 struct kvm_interrupt *irq) 202 struct kvm_interrupt *irq)
@@ -285,8 +334,10 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
285 334
286 return 0; 335 return 0;
287} 336}
337EXPORT_SYMBOL_GPL(kvmppc_core_prepare_to_enter);
288 338
289pfn_t kvmppc_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn) 339pfn_t kvmppc_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn, bool writing,
340 bool *writable)
290{ 341{
291 ulong mp_pa = vcpu->arch.magic_page_pa; 342 ulong mp_pa = vcpu->arch.magic_page_pa;
292 343
@@ -302,20 +353,23 @@ pfn_t kvmppc_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn)
302 353
303 pfn = (pfn_t)virt_to_phys((void*)shared_page) >> PAGE_SHIFT; 354 pfn = (pfn_t)virt_to_phys((void*)shared_page) >> PAGE_SHIFT;
304 get_page(pfn_to_page(pfn)); 355 get_page(pfn_to_page(pfn));
356 if (writable)
357 *writable = true;
305 return pfn; 358 return pfn;
306 } 359 }
307 360
308 return gfn_to_pfn(vcpu->kvm, gfn); 361 return gfn_to_pfn_prot(vcpu->kvm, gfn, writing, writable);
309} 362}
363EXPORT_SYMBOL_GPL(kvmppc_gfn_to_pfn);
310 364
311static int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr, bool data, 365static int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr, bool data,
312 struct kvmppc_pte *pte) 366 bool iswrite, struct kvmppc_pte *pte)
313{ 367{
314 int relocated = (vcpu->arch.shared->msr & (data ? MSR_DR : MSR_IR)); 368 int relocated = (vcpu->arch.shared->msr & (data ? MSR_DR : MSR_IR));
315 int r; 369 int r;
316 370
317 if (relocated) { 371 if (relocated) {
318 r = vcpu->arch.mmu.xlate(vcpu, eaddr, pte, data); 372 r = vcpu->arch.mmu.xlate(vcpu, eaddr, pte, data, iswrite);
319 } else { 373 } else {
320 pte->eaddr = eaddr; 374 pte->eaddr = eaddr;
321 pte->raddr = eaddr & KVM_PAM; 375 pte->raddr = eaddr & KVM_PAM;
@@ -361,7 +415,7 @@ int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
361 415
362 vcpu->stat.st++; 416 vcpu->stat.st++;
363 417
364 if (kvmppc_xlate(vcpu, *eaddr, data, &pte)) 418 if (kvmppc_xlate(vcpu, *eaddr, data, true, &pte))
365 return -ENOENT; 419 return -ENOENT;
366 420
367 *eaddr = pte.raddr; 421 *eaddr = pte.raddr;
@@ -374,6 +428,7 @@ int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
374 428
375 return EMULATE_DONE; 429 return EMULATE_DONE;
376} 430}
431EXPORT_SYMBOL_GPL(kvmppc_st);
377 432
378int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, 433int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
379 bool data) 434 bool data)
@@ -383,7 +438,7 @@ int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
383 438
384 vcpu->stat.ld++; 439 vcpu->stat.ld++;
385 440
386 if (kvmppc_xlate(vcpu, *eaddr, data, &pte)) 441 if (kvmppc_xlate(vcpu, *eaddr, data, false, &pte))
387 goto nopte; 442 goto nopte;
388 443
389 *eaddr = pte.raddr; 444 *eaddr = pte.raddr;
@@ -404,6 +459,7 @@ nopte:
404mmio: 459mmio:
405 return EMULATE_DO_MMIO; 460 return EMULATE_DO_MMIO;
406} 461}
462EXPORT_SYMBOL_GPL(kvmppc_ld);
407 463
408int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) 464int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
409{ 465{
@@ -419,6 +475,18 @@ void kvmppc_subarch_vcpu_uninit(struct kvm_vcpu *vcpu)
419{ 475{
420} 476}
421 477
478int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
479 struct kvm_sregs *sregs)
480{
481 return vcpu->kvm->arch.kvm_ops->get_sregs(vcpu, sregs);
482}
483
484int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
485 struct kvm_sregs *sregs)
486{
487 return vcpu->kvm->arch.kvm_ops->set_sregs(vcpu, sregs);
488}
489
422int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) 490int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
423{ 491{
424 int i; 492 int i;
@@ -495,8 +563,7 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
495 if (size > sizeof(val)) 563 if (size > sizeof(val))
496 return -EINVAL; 564 return -EINVAL;
497 565
498 r = kvmppc_get_one_reg(vcpu, reg->id, &val); 566 r = vcpu->kvm->arch.kvm_ops->get_one_reg(vcpu, reg->id, &val);
499
500 if (r == -EINVAL) { 567 if (r == -EINVAL) {
501 r = 0; 568 r = 0;
502 switch (reg->id) { 569 switch (reg->id) {
@@ -528,6 +595,9 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
528 } 595 }
529 val = get_reg_val(reg->id, vcpu->arch.vscr.u[3]); 596 val = get_reg_val(reg->id, vcpu->arch.vscr.u[3]);
530 break; 597 break;
598 case KVM_REG_PPC_VRSAVE:
599 val = get_reg_val(reg->id, vcpu->arch.vrsave);
600 break;
531#endif /* CONFIG_ALTIVEC */ 601#endif /* CONFIG_ALTIVEC */
532 case KVM_REG_PPC_DEBUG_INST: { 602 case KVM_REG_PPC_DEBUG_INST: {
533 u32 opcode = INS_TW; 603 u32 opcode = INS_TW;
@@ -572,8 +642,7 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
572 if (copy_from_user(&val, (char __user *)(unsigned long)reg->addr, size)) 642 if (copy_from_user(&val, (char __user *)(unsigned long)reg->addr, size))
573 return -EFAULT; 643 return -EFAULT;
574 644
575 r = kvmppc_set_one_reg(vcpu, reg->id, &val); 645 r = vcpu->kvm->arch.kvm_ops->set_one_reg(vcpu, reg->id, &val);
576
577 if (r == -EINVAL) { 646 if (r == -EINVAL) {
578 r = 0; 647 r = 0;
579 switch (reg->id) { 648 switch (reg->id) {
@@ -605,6 +674,13 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
605 } 674 }
606 vcpu->arch.vscr.u[3] = set_reg_val(reg->id, val); 675 vcpu->arch.vscr.u[3] = set_reg_val(reg->id, val);
607 break; 676 break;
677 case KVM_REG_PPC_VRSAVE:
678 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
679 r = -ENXIO;
680 break;
681 }
682 vcpu->arch.vrsave = set_reg_val(reg->id, val);
683 break;
608#endif /* CONFIG_ALTIVEC */ 684#endif /* CONFIG_ALTIVEC */
609#ifdef CONFIG_KVM_XICS 685#ifdef CONFIG_KVM_XICS
610 case KVM_REG_PPC_ICP_STATE: 686 case KVM_REG_PPC_ICP_STATE:
@@ -625,6 +701,27 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
625 return r; 701 return r;
626} 702}
627 703
704void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
705{
706 vcpu->kvm->arch.kvm_ops->vcpu_load(vcpu, cpu);
707}
708
709void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu)
710{
711 vcpu->kvm->arch.kvm_ops->vcpu_put(vcpu);
712}
713
714void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 msr)
715{
716 vcpu->kvm->arch.kvm_ops->set_msr(vcpu, msr);
717}
718EXPORT_SYMBOL_GPL(kvmppc_set_msr);
719
720int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
721{
722 return vcpu->kvm->arch.kvm_ops->vcpu_run(kvm_run, vcpu);
723}
724
628int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, 725int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
629 struct kvm_translation *tr) 726 struct kvm_translation *tr)
630{ 727{
@@ -644,3 +741,141 @@ void kvmppc_decrementer_func(unsigned long data)
644 kvmppc_core_queue_dec(vcpu); 741 kvmppc_core_queue_dec(vcpu);
645 kvm_vcpu_kick(vcpu); 742 kvm_vcpu_kick(vcpu);
646} 743}
744
745struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
746{
747 return kvm->arch.kvm_ops->vcpu_create(kvm, id);
748}
749
750void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
751{
752 vcpu->kvm->arch.kvm_ops->vcpu_free(vcpu);
753}
754
755int kvmppc_core_check_requests(struct kvm_vcpu *vcpu)
756{
757 return vcpu->kvm->arch.kvm_ops->check_requests(vcpu);
758}
759
760int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log)
761{
762 return kvm->arch.kvm_ops->get_dirty_log(kvm, log);
763}
764
765void kvmppc_core_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
766 struct kvm_memory_slot *dont)
767{
768 kvm->arch.kvm_ops->free_memslot(free, dont);
769}
770
771int kvmppc_core_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
772 unsigned long npages)
773{
774 return kvm->arch.kvm_ops->create_memslot(slot, npages);
775}
776
777void kvmppc_core_flush_memslot(struct kvm *kvm, struct kvm_memory_slot *memslot)
778{
779 kvm->arch.kvm_ops->flush_memslot(kvm, memslot);
780}
781
782int kvmppc_core_prepare_memory_region(struct kvm *kvm,
783 struct kvm_memory_slot *memslot,
784 struct kvm_userspace_memory_region *mem)
785{
786 return kvm->arch.kvm_ops->prepare_memory_region(kvm, memslot, mem);
787}
788
789void kvmppc_core_commit_memory_region(struct kvm *kvm,
790 struct kvm_userspace_memory_region *mem,
791 const struct kvm_memory_slot *old)
792{
793 kvm->arch.kvm_ops->commit_memory_region(kvm, mem, old);
794}
795
796int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
797{
798 return kvm->arch.kvm_ops->unmap_hva(kvm, hva);
799}
800EXPORT_SYMBOL_GPL(kvm_unmap_hva);
801
802int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
803{
804 return kvm->arch.kvm_ops->unmap_hva_range(kvm, start, end);
805}
806
807int kvm_age_hva(struct kvm *kvm, unsigned long hva)
808{
809 return kvm->arch.kvm_ops->age_hva(kvm, hva);
810}
811
812int kvm_test_age_hva(struct kvm *kvm, unsigned long hva)
813{
814 return kvm->arch.kvm_ops->test_age_hva(kvm, hva);
815}
816
817void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte)
818{
819 kvm->arch.kvm_ops->set_spte_hva(kvm, hva, pte);
820}
821
822void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu)
823{
824 vcpu->kvm->arch.kvm_ops->mmu_destroy(vcpu);
825}
826
827int kvmppc_core_init_vm(struct kvm *kvm)
828{
829
830#ifdef CONFIG_PPC64
831 INIT_LIST_HEAD(&kvm->arch.spapr_tce_tables);
832 INIT_LIST_HEAD(&kvm->arch.rtas_tokens);
833#endif
834
835 return kvm->arch.kvm_ops->init_vm(kvm);
836}
837
838void kvmppc_core_destroy_vm(struct kvm *kvm)
839{
840 kvm->arch.kvm_ops->destroy_vm(kvm);
841
842#ifdef CONFIG_PPC64
843 kvmppc_rtas_tokens_free(kvm);
844 WARN_ON(!list_empty(&kvm->arch.spapr_tce_tables));
845#endif
846}
847
848int kvmppc_core_check_processor_compat(void)
849{
850 /*
851 * We always return 0 for book3s. We check
852 * for compatability while loading the HV
853 * or PR module
854 */
855 return 0;
856}
857
858static int kvmppc_book3s_init(void)
859{
860 int r;
861
862 r = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE);
863 if (r)
864 return r;
865#ifdef CONFIG_KVM_BOOK3S_32
866 r = kvmppc_book3s_init_pr();
867#endif
868 return r;
869
870}
871
872static void kvmppc_book3s_exit(void)
873{
874#ifdef CONFIG_KVM_BOOK3S_32
875 kvmppc_book3s_exit_pr();
876#endif
877 kvm_exit();
878}
879
880module_init(kvmppc_book3s_init);
881module_exit(kvmppc_book3s_exit);
diff --git a/arch/powerpc/kvm/book3s.h b/arch/powerpc/kvm/book3s.h
new file mode 100644
index 000000000000..4bf956cf94d6
--- /dev/null
+++ b/arch/powerpc/kvm/book3s.h
@@ -0,0 +1,34 @@
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
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License or (at your optional) any later version of the license.
9 *
10 */
11
12#ifndef __POWERPC_KVM_BOOK3S_H__
13#define __POWERPC_KVM_BOOK3S_H__
14
15extern void kvmppc_core_flush_memslot_hv(struct kvm *kvm,
16 struct kvm_memory_slot *memslot);
17extern int kvm_unmap_hva_hv(struct kvm *kvm, unsigned long hva);
18extern int kvm_unmap_hva_range_hv(struct kvm *kvm, unsigned long start,
19 unsigned long end);
20extern int kvm_age_hva_hv(struct kvm *kvm, unsigned long hva);
21extern int kvm_test_age_hva_hv(struct kvm *kvm, unsigned long hva);
22extern void kvm_set_spte_hva_hv(struct kvm *kvm, unsigned long hva, pte_t pte);
23
24extern void kvmppc_mmu_destroy_pr(struct kvm_vcpu *vcpu);
25extern int kvmppc_core_emulate_op_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
26 unsigned int inst, int *advance);
27extern int kvmppc_core_emulate_mtspr_pr(struct kvm_vcpu *vcpu,
28 int sprn, ulong spr_val);
29extern int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu,
30 int sprn, ulong *spr_val);
31extern int kvmppc_book3s_init_pr(void);
32extern void kvmppc_book3s_exit_pr(void);
33
34#endif
diff --git a/arch/powerpc/kvm/book3s_32_mmu.c b/arch/powerpc/kvm/book3s_32_mmu.c
index c8cefdd15fd8..76a64ce6a5b6 100644
--- a/arch/powerpc/kvm/book3s_32_mmu.c
+++ b/arch/powerpc/kvm/book3s_32_mmu.c
@@ -84,7 +84,8 @@ static inline bool sr_nx(u32 sr_raw)
84} 84}
85 85
86static int kvmppc_mmu_book3s_32_xlate_bat(struct kvm_vcpu *vcpu, gva_t eaddr, 86static int kvmppc_mmu_book3s_32_xlate_bat(struct kvm_vcpu *vcpu, gva_t eaddr,
87 struct kvmppc_pte *pte, bool data); 87 struct kvmppc_pte *pte, bool data,
88 bool iswrite);
88static int kvmppc_mmu_book3s_32_esid_to_vsid(struct kvm_vcpu *vcpu, ulong esid, 89static int kvmppc_mmu_book3s_32_esid_to_vsid(struct kvm_vcpu *vcpu, ulong esid,
89 u64 *vsid); 90 u64 *vsid);
90 91
@@ -99,7 +100,7 @@ static u64 kvmppc_mmu_book3s_32_ea_to_vp(struct kvm_vcpu *vcpu, gva_t eaddr,
99 u64 vsid; 100 u64 vsid;
100 struct kvmppc_pte pte; 101 struct kvmppc_pte pte;
101 102
102 if (!kvmppc_mmu_book3s_32_xlate_bat(vcpu, eaddr, &pte, data)) 103 if (!kvmppc_mmu_book3s_32_xlate_bat(vcpu, eaddr, &pte, data, false))
103 return pte.vpage; 104 return pte.vpage;
104 105
105 kvmppc_mmu_book3s_32_esid_to_vsid(vcpu, eaddr >> SID_SHIFT, &vsid); 106 kvmppc_mmu_book3s_32_esid_to_vsid(vcpu, eaddr >> SID_SHIFT, &vsid);
@@ -111,10 +112,11 @@ static void kvmppc_mmu_book3s_32_reset_msr(struct kvm_vcpu *vcpu)
111 kvmppc_set_msr(vcpu, 0); 112 kvmppc_set_msr(vcpu, 0);
112} 113}
113 114
114static hva_t kvmppc_mmu_book3s_32_get_pteg(struct kvmppc_vcpu_book3s *vcpu_book3s, 115static hva_t kvmppc_mmu_book3s_32_get_pteg(struct kvm_vcpu *vcpu,
115 u32 sre, gva_t eaddr, 116 u32 sre, gva_t eaddr,
116 bool primary) 117 bool primary)
117{ 118{
119 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
118 u32 page, hash, pteg, htabmask; 120 u32 page, hash, pteg, htabmask;
119 hva_t r; 121 hva_t r;
120 122
@@ -132,7 +134,7 @@ static hva_t kvmppc_mmu_book3s_32_get_pteg(struct kvmppc_vcpu_book3s *vcpu_book3
132 kvmppc_get_pc(&vcpu_book3s->vcpu), eaddr, vcpu_book3s->sdr1, pteg, 134 kvmppc_get_pc(&vcpu_book3s->vcpu), eaddr, vcpu_book3s->sdr1, pteg,
133 sr_vsid(sre)); 135 sr_vsid(sre));
134 136
135 r = gfn_to_hva(vcpu_book3s->vcpu.kvm, pteg >> PAGE_SHIFT); 137 r = gfn_to_hva(vcpu->kvm, pteg >> PAGE_SHIFT);
136 if (kvm_is_error_hva(r)) 138 if (kvm_is_error_hva(r))
137 return r; 139 return r;
138 return r | (pteg & ~PAGE_MASK); 140 return r | (pteg & ~PAGE_MASK);
@@ -145,7 +147,8 @@ static u32 kvmppc_mmu_book3s_32_get_ptem(u32 sre, gva_t eaddr, bool primary)
145} 147}
146 148
147static int kvmppc_mmu_book3s_32_xlate_bat(struct kvm_vcpu *vcpu, gva_t eaddr, 149static int kvmppc_mmu_book3s_32_xlate_bat(struct kvm_vcpu *vcpu, gva_t eaddr,
148 struct kvmppc_pte *pte, bool data) 150 struct kvmppc_pte *pte, bool data,
151 bool iswrite)
149{ 152{
150 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu); 153 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
151 struct kvmppc_bat *bat; 154 struct kvmppc_bat *bat;
@@ -186,8 +189,7 @@ static int kvmppc_mmu_book3s_32_xlate_bat(struct kvm_vcpu *vcpu, gva_t eaddr,
186 printk(KERN_INFO "BAT is not readable!\n"); 189 printk(KERN_INFO "BAT is not readable!\n");
187 continue; 190 continue;
188 } 191 }
189 if (!pte->may_write) { 192 if (iswrite && !pte->may_write) {
190 /* let's treat r/o BATs as not-readable for now */
191 dprintk_pte("BAT is read-only!\n"); 193 dprintk_pte("BAT is read-only!\n");
192 continue; 194 continue;
193 } 195 }
@@ -201,9 +203,8 @@ static int kvmppc_mmu_book3s_32_xlate_bat(struct kvm_vcpu *vcpu, gva_t eaddr,
201 203
202static int kvmppc_mmu_book3s_32_xlate_pte(struct kvm_vcpu *vcpu, gva_t eaddr, 204static int kvmppc_mmu_book3s_32_xlate_pte(struct kvm_vcpu *vcpu, gva_t eaddr,
203 struct kvmppc_pte *pte, bool data, 205 struct kvmppc_pte *pte, bool data,
204 bool primary) 206 bool iswrite, bool primary)
205{ 207{
206 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
207 u32 sre; 208 u32 sre;
208 hva_t ptegp; 209 hva_t ptegp;
209 u32 pteg[16]; 210 u32 pteg[16];
@@ -218,7 +219,7 @@ static int kvmppc_mmu_book3s_32_xlate_pte(struct kvm_vcpu *vcpu, gva_t eaddr,
218 219
219 pte->vpage = kvmppc_mmu_book3s_32_ea_to_vp(vcpu, eaddr, data); 220 pte->vpage = kvmppc_mmu_book3s_32_ea_to_vp(vcpu, eaddr, data);
220 221
221 ptegp = kvmppc_mmu_book3s_32_get_pteg(vcpu_book3s, sre, eaddr, primary); 222 ptegp = kvmppc_mmu_book3s_32_get_pteg(vcpu, sre, eaddr, primary);
222 if (kvm_is_error_hva(ptegp)) { 223 if (kvm_is_error_hva(ptegp)) {
223 printk(KERN_INFO "KVM: Invalid PTEG!\n"); 224 printk(KERN_INFO "KVM: Invalid PTEG!\n");
224 goto no_page_found; 225 goto no_page_found;
@@ -258,9 +259,6 @@ static int kvmppc_mmu_book3s_32_xlate_pte(struct kvm_vcpu *vcpu, gva_t eaddr,
258 break; 259 break;
259 } 260 }
260 261
261 if ( !pte->may_read )
262 continue;
263
264 dprintk_pte("MMU: Found PTE -> %x %x - %x\n", 262 dprintk_pte("MMU: Found PTE -> %x %x - %x\n",
265 pteg[i], pteg[i+1], pp); 263 pteg[i], pteg[i+1], pp);
266 found = 1; 264 found = 1;
@@ -271,19 +269,23 @@ static int kvmppc_mmu_book3s_32_xlate_pte(struct kvm_vcpu *vcpu, gva_t eaddr,
271 /* Update PTE C and A bits, so the guest's swapper knows we used the 269 /* Update PTE C and A bits, so the guest's swapper knows we used the
272 page */ 270 page */
273 if (found) { 271 if (found) {
274 u32 oldpte = pteg[i+1]; 272 u32 pte_r = pteg[i+1];
275 273 char __user *addr = (char __user *) &pteg[i+1];
276 if (pte->may_read) 274
277 pteg[i+1] |= PTEG_FLAG_ACCESSED; 275 /*
278 if (pte->may_write) 276 * Use single-byte writes to update the HPTE, to
279 pteg[i+1] |= PTEG_FLAG_DIRTY; 277 * conform to what real hardware does.
280 else 278 */
281 dprintk_pte("KVM: Mapping read-only page!\n"); 279 if (pte->may_read && !(pte_r & PTEG_FLAG_ACCESSED)) {
282 280 pte_r |= PTEG_FLAG_ACCESSED;
283 /* Write back into the PTEG */ 281 put_user(pte_r >> 8, addr + 2);
284 if (pteg[i+1] != oldpte) 282 }
285 copy_to_user((void __user *)ptegp, pteg, sizeof(pteg)); 283 if (iswrite && pte->may_write && !(pte_r & PTEG_FLAG_DIRTY)) {
286 284 pte_r |= PTEG_FLAG_DIRTY;
285 put_user(pte_r, addr + 3);
286 }
287 if (!pte->may_read || (iswrite && !pte->may_write))
288 return -EPERM;
287 return 0; 289 return 0;
288 } 290 }
289 291
@@ -302,12 +304,14 @@ no_page_found:
302} 304}
303 305
304static int kvmppc_mmu_book3s_32_xlate(struct kvm_vcpu *vcpu, gva_t eaddr, 306static int kvmppc_mmu_book3s_32_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
305 struct kvmppc_pte *pte, bool data) 307 struct kvmppc_pte *pte, bool data,
308 bool iswrite)
306{ 309{
307 int r; 310 int r;
308 ulong mp_ea = vcpu->arch.magic_page_ea; 311 ulong mp_ea = vcpu->arch.magic_page_ea;
309 312
310 pte->eaddr = eaddr; 313 pte->eaddr = eaddr;
314 pte->page_size = MMU_PAGE_4K;
311 315
312 /* Magic page override */ 316 /* Magic page override */
313 if (unlikely(mp_ea) && 317 if (unlikely(mp_ea) &&
@@ -323,11 +327,13 @@ static int kvmppc_mmu_book3s_32_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
323 return 0; 327 return 0;
324 } 328 }
325 329
326 r = kvmppc_mmu_book3s_32_xlate_bat(vcpu, eaddr, pte, data); 330 r = kvmppc_mmu_book3s_32_xlate_bat(vcpu, eaddr, pte, data, iswrite);
327 if (r < 0) 331 if (r < 0)
328 r = kvmppc_mmu_book3s_32_xlate_pte(vcpu, eaddr, pte, data, true); 332 r = kvmppc_mmu_book3s_32_xlate_pte(vcpu, eaddr, pte,
333 data, iswrite, true);
329 if (r < 0) 334 if (r < 0)
330 r = kvmppc_mmu_book3s_32_xlate_pte(vcpu, eaddr, pte, data, false); 335 r = kvmppc_mmu_book3s_32_xlate_pte(vcpu, eaddr, pte,
336 data, iswrite, false);
331 337
332 return r; 338 return r;
333} 339}
@@ -347,7 +353,12 @@ static void kvmppc_mmu_book3s_32_mtsrin(struct kvm_vcpu *vcpu, u32 srnum,
347 353
348static void kvmppc_mmu_book3s_32_tlbie(struct kvm_vcpu *vcpu, ulong ea, bool large) 354static void kvmppc_mmu_book3s_32_tlbie(struct kvm_vcpu *vcpu, ulong ea, bool large)
349{ 355{
350 kvmppc_mmu_pte_flush(vcpu, ea, 0x0FFFF000); 356 int i;
357 struct kvm_vcpu *v;
358
359 /* flush this VA on all cpus */
360 kvm_for_each_vcpu(i, v, vcpu->kvm)
361 kvmppc_mmu_pte_flush(v, ea, 0x0FFFF000);
351} 362}
352 363
353static int kvmppc_mmu_book3s_32_esid_to_vsid(struct kvm_vcpu *vcpu, ulong esid, 364static int kvmppc_mmu_book3s_32_esid_to_vsid(struct kvm_vcpu *vcpu, ulong esid,
diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c
index 00e619bf608e..3a0abd2e5a15 100644
--- a/arch/powerpc/kvm/book3s_32_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_32_mmu_host.c
@@ -138,7 +138,8 @@ static u32 *kvmppc_mmu_get_pteg(struct kvm_vcpu *vcpu, u32 vsid, u32 eaddr,
138 138
139extern char etext[]; 139extern char etext[];
140 140
141int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte) 141int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte,
142 bool iswrite)
142{ 143{
143 pfn_t hpaddr; 144 pfn_t hpaddr;
144 u64 vpn; 145 u64 vpn;
@@ -152,9 +153,11 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
152 bool evict = false; 153 bool evict = false;
153 struct hpte_cache *pte; 154 struct hpte_cache *pte;
154 int r = 0; 155 int r = 0;
156 bool writable;
155 157
156 /* Get host physical address for gpa */ 158 /* Get host physical address for gpa */
157 hpaddr = kvmppc_gfn_to_pfn(vcpu, orig_pte->raddr >> PAGE_SHIFT); 159 hpaddr = kvmppc_gfn_to_pfn(vcpu, orig_pte->raddr >> PAGE_SHIFT,
160 iswrite, &writable);
158 if (is_error_noslot_pfn(hpaddr)) { 161 if (is_error_noslot_pfn(hpaddr)) {
159 printk(KERN_INFO "Couldn't get guest page for gfn %lx!\n", 162 printk(KERN_INFO "Couldn't get guest page for gfn %lx!\n",
160 orig_pte->eaddr); 163 orig_pte->eaddr);
@@ -204,7 +207,7 @@ next_pteg:
204 (primary ? 0 : PTE_SEC); 207 (primary ? 0 : PTE_SEC);
205 pteg1 = hpaddr | PTE_M | PTE_R | PTE_C; 208 pteg1 = hpaddr | PTE_M | PTE_R | PTE_C;
206 209
207 if (orig_pte->may_write) { 210 if (orig_pte->may_write && writable) {
208 pteg1 |= PP_RWRW; 211 pteg1 |= PP_RWRW;
209 mark_page_dirty(vcpu->kvm, orig_pte->raddr >> PAGE_SHIFT); 212 mark_page_dirty(vcpu->kvm, orig_pte->raddr >> PAGE_SHIFT);
210 } else { 213 } else {
@@ -259,6 +262,11 @@ out:
259 return r; 262 return r;
260} 263}
261 264
265void kvmppc_mmu_unmap_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte)
266{
267 kvmppc_mmu_pte_vflush(vcpu, pte->vpage, 0xfffffffffULL);
268}
269
262static struct kvmppc_sid_map *create_sid_map(struct kvm_vcpu *vcpu, u64 gvsid) 270static struct kvmppc_sid_map *create_sid_map(struct kvm_vcpu *vcpu, u64 gvsid)
263{ 271{
264 struct kvmppc_sid_map *map; 272 struct kvmppc_sid_map *map;
@@ -341,7 +349,7 @@ void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu)
341 svcpu_put(svcpu); 349 svcpu_put(svcpu);
342} 350}
343 351
344void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu) 352void kvmppc_mmu_destroy_pr(struct kvm_vcpu *vcpu)
345{ 353{
346 int i; 354 int i;
347 355
diff --git a/arch/powerpc/kvm/book3s_64_mmu.c b/arch/powerpc/kvm/book3s_64_mmu.c
index 7e345e00661a..83da1f868fd5 100644
--- a/arch/powerpc/kvm/book3s_64_mmu.c
+++ b/arch/powerpc/kvm/book3s_64_mmu.c
@@ -107,9 +107,20 @@ static u64 kvmppc_mmu_book3s_64_ea_to_vp(struct kvm_vcpu *vcpu, gva_t eaddr,
107 return kvmppc_slb_calc_vpn(slb, eaddr); 107 return kvmppc_slb_calc_vpn(slb, eaddr);
108} 108}
109 109
110static int mmu_pagesize(int mmu_pg)
111{
112 switch (mmu_pg) {
113 case MMU_PAGE_64K:
114 return 16;
115 case MMU_PAGE_16M:
116 return 24;
117 }
118 return 12;
119}
120
110static int kvmppc_mmu_book3s_64_get_pagesize(struct kvmppc_slb *slbe) 121static int kvmppc_mmu_book3s_64_get_pagesize(struct kvmppc_slb *slbe)
111{ 122{
112 return slbe->large ? 24 : 12; 123 return mmu_pagesize(slbe->base_page_size);
113} 124}
114 125
115static u32 kvmppc_mmu_book3s_64_get_page(struct kvmppc_slb *slbe, gva_t eaddr) 126static u32 kvmppc_mmu_book3s_64_get_page(struct kvmppc_slb *slbe, gva_t eaddr)
@@ -119,11 +130,11 @@ static u32 kvmppc_mmu_book3s_64_get_page(struct kvmppc_slb *slbe, gva_t eaddr)
119 return ((eaddr & kvmppc_slb_offset_mask(slbe)) >> p); 130 return ((eaddr & kvmppc_slb_offset_mask(slbe)) >> p);
120} 131}
121 132
122static hva_t kvmppc_mmu_book3s_64_get_pteg( 133static hva_t kvmppc_mmu_book3s_64_get_pteg(struct kvm_vcpu *vcpu,
123 struct kvmppc_vcpu_book3s *vcpu_book3s,
124 struct kvmppc_slb *slbe, gva_t eaddr, 134 struct kvmppc_slb *slbe, gva_t eaddr,
125 bool second) 135 bool second)
126{ 136{
137 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
127 u64 hash, pteg, htabsize; 138 u64 hash, pteg, htabsize;
128 u32 ssize; 139 u32 ssize;
129 hva_t r; 140 hva_t r;
@@ -148,10 +159,10 @@ static hva_t kvmppc_mmu_book3s_64_get_pteg(
148 159
149 /* When running a PAPR guest, SDR1 contains a HVA address instead 160 /* When running a PAPR guest, SDR1 contains a HVA address instead
150 of a GPA */ 161 of a GPA */
151 if (vcpu_book3s->vcpu.arch.papr_enabled) 162 if (vcpu->arch.papr_enabled)
152 r = pteg; 163 r = pteg;
153 else 164 else
154 r = gfn_to_hva(vcpu_book3s->vcpu.kvm, pteg >> PAGE_SHIFT); 165 r = gfn_to_hva(vcpu->kvm, pteg >> PAGE_SHIFT);
155 166
156 if (kvm_is_error_hva(r)) 167 if (kvm_is_error_hva(r))
157 return r; 168 return r;
@@ -166,18 +177,38 @@ static u64 kvmppc_mmu_book3s_64_get_avpn(struct kvmppc_slb *slbe, gva_t eaddr)
166 avpn = kvmppc_mmu_book3s_64_get_page(slbe, eaddr); 177 avpn = kvmppc_mmu_book3s_64_get_page(slbe, eaddr);
167 avpn |= slbe->vsid << (kvmppc_slb_sid_shift(slbe) - p); 178 avpn |= slbe->vsid << (kvmppc_slb_sid_shift(slbe) - p);
168 179
169 if (p < 24) 180 if (p < 16)
170 avpn >>= ((80 - p) - 56) - 8; 181 avpn >>= ((80 - p) - 56) - 8; /* 16 - p */
171 else 182 else
172 avpn <<= 8; 183 avpn <<= p - 16;
173 184
174 return avpn; 185 return avpn;
175} 186}
176 187
188/*
189 * Return page size encoded in the second word of a HPTE, or
190 * -1 for an invalid encoding for the base page size indicated by
191 * the SLB entry. This doesn't handle mixed pagesize segments yet.
192 */
193static int decode_pagesize(struct kvmppc_slb *slbe, u64 r)
194{
195 switch (slbe->base_page_size) {
196 case MMU_PAGE_64K:
197 if ((r & 0xf000) == 0x1000)
198 return MMU_PAGE_64K;
199 break;
200 case MMU_PAGE_16M:
201 if ((r & 0xff000) == 0)
202 return MMU_PAGE_16M;
203 break;
204 }
205 return -1;
206}
207
177static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr, 208static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
178 struct kvmppc_pte *gpte, bool data) 209 struct kvmppc_pte *gpte, bool data,
210 bool iswrite)
179{ 211{
180 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
181 struct kvmppc_slb *slbe; 212 struct kvmppc_slb *slbe;
182 hva_t ptegp; 213 hva_t ptegp;
183 u64 pteg[16]; 214 u64 pteg[16];
@@ -189,6 +220,7 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
189 u8 pp, key = 0; 220 u8 pp, key = 0;
190 bool found = false; 221 bool found = false;
191 bool second = false; 222 bool second = false;
223 int pgsize;
192 ulong mp_ea = vcpu->arch.magic_page_ea; 224 ulong mp_ea = vcpu->arch.magic_page_ea;
193 225
194 /* Magic page override */ 226 /* Magic page override */
@@ -202,6 +234,7 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
202 gpte->may_execute = true; 234 gpte->may_execute = true;
203 gpte->may_read = true; 235 gpte->may_read = true;
204 gpte->may_write = true; 236 gpte->may_write = true;
237 gpte->page_size = MMU_PAGE_4K;
205 238
206 return 0; 239 return 0;
207 } 240 }
@@ -222,8 +255,12 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
222 v_mask = SLB_VSID_B | HPTE_V_AVPN | HPTE_V_LARGE | HPTE_V_VALID | 255 v_mask = SLB_VSID_B | HPTE_V_AVPN | HPTE_V_LARGE | HPTE_V_VALID |
223 HPTE_V_SECONDARY; 256 HPTE_V_SECONDARY;
224 257
258 pgsize = slbe->large ? MMU_PAGE_16M : MMU_PAGE_4K;
259
260 mutex_lock(&vcpu->kvm->arch.hpt_mutex);
261
225do_second: 262do_second:
226 ptegp = kvmppc_mmu_book3s_64_get_pteg(vcpu_book3s, slbe, eaddr, second); 263 ptegp = kvmppc_mmu_book3s_64_get_pteg(vcpu, slbe, eaddr, second);
227 if (kvm_is_error_hva(ptegp)) 264 if (kvm_is_error_hva(ptegp))
228 goto no_page_found; 265 goto no_page_found;
229 266
@@ -240,6 +277,13 @@ do_second:
240 for (i=0; i<16; i+=2) { 277 for (i=0; i<16; i+=2) {
241 /* Check all relevant fields of 1st dword */ 278 /* Check all relevant fields of 1st dword */
242 if ((pteg[i] & v_mask) == v_val) { 279 if ((pteg[i] & v_mask) == v_val) {
280 /* If large page bit is set, check pgsize encoding */
281 if (slbe->large &&
282 (vcpu->arch.hflags & BOOK3S_HFLAG_MULTI_PGSIZE)) {
283 pgsize = decode_pagesize(slbe, pteg[i+1]);
284 if (pgsize < 0)
285 continue;
286 }
243 found = true; 287 found = true;
244 break; 288 break;
245 } 289 }
@@ -256,13 +300,15 @@ do_second:
256 v = pteg[i]; 300 v = pteg[i];
257 r = pteg[i+1]; 301 r = pteg[i+1];
258 pp = (r & HPTE_R_PP) | key; 302 pp = (r & HPTE_R_PP) | key;
259 eaddr_mask = 0xFFF; 303 if (r & HPTE_R_PP0)
304 pp |= 8;
260 305
261 gpte->eaddr = eaddr; 306 gpte->eaddr = eaddr;
262 gpte->vpage = kvmppc_mmu_book3s_64_ea_to_vp(vcpu, eaddr, data); 307 gpte->vpage = kvmppc_mmu_book3s_64_ea_to_vp(vcpu, eaddr, data);
263 if (slbe->large) 308
264 eaddr_mask = 0xFFFFFF; 309 eaddr_mask = (1ull << mmu_pagesize(pgsize)) - 1;
265 gpte->raddr = (r & HPTE_R_RPN & ~eaddr_mask) | (eaddr & eaddr_mask); 310 gpte->raddr = (r & HPTE_R_RPN & ~eaddr_mask) | (eaddr & eaddr_mask);
311 gpte->page_size = pgsize;
266 gpte->may_execute = ((r & HPTE_R_N) ? false : true); 312 gpte->may_execute = ((r & HPTE_R_N) ? false : true);
267 gpte->may_read = false; 313 gpte->may_read = false;
268 gpte->may_write = false; 314 gpte->may_write = false;
@@ -277,6 +323,7 @@ do_second:
277 case 3: 323 case 3:
278 case 5: 324 case 5:
279 case 7: 325 case 7:
326 case 10:
280 gpte->may_read = true; 327 gpte->may_read = true;
281 break; 328 break;
282 } 329 }
@@ -287,30 +334,37 @@ do_second:
287 334
288 /* Update PTE R and C bits, so the guest's swapper knows we used the 335 /* Update PTE R and C bits, so the guest's swapper knows we used the
289 * page */ 336 * page */
290 if (gpte->may_read) { 337 if (gpte->may_read && !(r & HPTE_R_R)) {
291 /* Set the accessed flag */ 338 /*
339 * Set the accessed flag.
340 * We have to write this back with a single byte write
341 * because another vcpu may be accessing this on
342 * non-PAPR platforms such as mac99, and this is
343 * what real hardware does.
344 */
345 char __user *addr = (char __user *) &pteg[i+1];
292 r |= HPTE_R_R; 346 r |= HPTE_R_R;
347 put_user(r >> 8, addr + 6);
293 } 348 }
294 if (data && gpte->may_write) { 349 if (iswrite && gpte->may_write && !(r & HPTE_R_C)) {
295 /* Set the dirty flag -- XXX even if not writing */ 350 /* Set the dirty flag */
351 /* Use a single byte write */
352 char __user *addr = (char __user *) &pteg[i+1];
296 r |= HPTE_R_C; 353 r |= HPTE_R_C;
354 put_user(r, addr + 7);
297 } 355 }
298 356
299 /* Write back into the PTEG */ 357 mutex_unlock(&vcpu->kvm->arch.hpt_mutex);
300 if (pteg[i+1] != r) {
301 pteg[i+1] = r;
302 copy_to_user((void __user *)ptegp, pteg, sizeof(pteg));
303 }
304 358
305 if (!gpte->may_read) 359 if (!gpte->may_read || (iswrite && !gpte->may_write))
306 return -EPERM; 360 return -EPERM;
307 return 0; 361 return 0;
308 362
309no_page_found: 363no_page_found:
364 mutex_unlock(&vcpu->kvm->arch.hpt_mutex);
310 return -ENOENT; 365 return -ENOENT;
311 366
312no_seg_found: 367no_seg_found:
313
314 dprintk("KVM MMU: Trigger segment fault\n"); 368 dprintk("KVM MMU: Trigger segment fault\n");
315 return -EINVAL; 369 return -EINVAL;
316} 370}
@@ -345,6 +399,21 @@ static void kvmppc_mmu_book3s_64_slbmte(struct kvm_vcpu *vcpu, u64 rs, u64 rb)
345 slbe->nx = (rs & SLB_VSID_N) ? 1 : 0; 399 slbe->nx = (rs & SLB_VSID_N) ? 1 : 0;
346 slbe->class = (rs & SLB_VSID_C) ? 1 : 0; 400 slbe->class = (rs & SLB_VSID_C) ? 1 : 0;
347 401
402 slbe->base_page_size = MMU_PAGE_4K;
403 if (slbe->large) {
404 if (vcpu->arch.hflags & BOOK3S_HFLAG_MULTI_PGSIZE) {
405 switch (rs & SLB_VSID_LP) {
406 case SLB_VSID_LP_00:
407 slbe->base_page_size = MMU_PAGE_16M;
408 break;
409 case SLB_VSID_LP_01:
410 slbe->base_page_size = MMU_PAGE_64K;
411 break;
412 }
413 } else
414 slbe->base_page_size = MMU_PAGE_16M;
415 }
416
348 slbe->orige = rb & (ESID_MASK | SLB_ESID_V); 417 slbe->orige = rb & (ESID_MASK | SLB_ESID_V);
349 slbe->origv = rs; 418 slbe->origv = rs;
350 419
@@ -460,14 +529,45 @@ static void kvmppc_mmu_book3s_64_tlbie(struct kvm_vcpu *vcpu, ulong va,
460 bool large) 529 bool large)
461{ 530{
462 u64 mask = 0xFFFFFFFFFULL; 531 u64 mask = 0xFFFFFFFFFULL;
532 long i;
533 struct kvm_vcpu *v;
463 534
464 dprintk("KVM MMU: tlbie(0x%lx)\n", va); 535 dprintk("KVM MMU: tlbie(0x%lx)\n", va);
465 536
466 if (large) 537 /*
467 mask = 0xFFFFFF000ULL; 538 * The tlbie instruction changed behaviour starting with
468 kvmppc_mmu_pte_vflush(vcpu, va >> 12, mask); 539 * POWER6. POWER6 and later don't have the large page flag
540 * in the instruction but in the RB value, along with bits
541 * indicating page and segment sizes.
542 */
543 if (vcpu->arch.hflags & BOOK3S_HFLAG_NEW_TLBIE) {
544 /* POWER6 or later */
545 if (va & 1) { /* L bit */
546 if ((va & 0xf000) == 0x1000)
547 mask = 0xFFFFFFFF0ULL; /* 64k page */
548 else
549 mask = 0xFFFFFF000ULL; /* 16M page */
550 }
551 } else {
552 /* older processors, e.g. PPC970 */
553 if (large)
554 mask = 0xFFFFFF000ULL;
555 }
556 /* flush this VA on all vcpus */
557 kvm_for_each_vcpu(i, v, vcpu->kvm)
558 kvmppc_mmu_pte_vflush(v, va >> 12, mask);
469} 559}
470 560
561#ifdef CONFIG_PPC_64K_PAGES
562static int segment_contains_magic_page(struct kvm_vcpu *vcpu, ulong esid)
563{
564 ulong mp_ea = vcpu->arch.magic_page_ea;
565
566 return mp_ea && !(vcpu->arch.shared->msr & MSR_PR) &&
567 (mp_ea >> SID_SHIFT) == esid;
568}
569#endif
570
471static int kvmppc_mmu_book3s_64_esid_to_vsid(struct kvm_vcpu *vcpu, ulong esid, 571static int kvmppc_mmu_book3s_64_esid_to_vsid(struct kvm_vcpu *vcpu, ulong esid,
472 u64 *vsid) 572 u64 *vsid)
473{ 573{
@@ -475,11 +575,13 @@ static int kvmppc_mmu_book3s_64_esid_to_vsid(struct kvm_vcpu *vcpu, ulong esid,
475 struct kvmppc_slb *slb; 575 struct kvmppc_slb *slb;
476 u64 gvsid = esid; 576 u64 gvsid = esid;
477 ulong mp_ea = vcpu->arch.magic_page_ea; 577 ulong mp_ea = vcpu->arch.magic_page_ea;
578 int pagesize = MMU_PAGE_64K;
478 579
479 if (vcpu->arch.shared->msr & (MSR_DR|MSR_IR)) { 580 if (vcpu->arch.shared->msr & (MSR_DR|MSR_IR)) {
480 slb = kvmppc_mmu_book3s_64_find_slbe(vcpu, ea); 581 slb = kvmppc_mmu_book3s_64_find_slbe(vcpu, ea);
481 if (slb) { 582 if (slb) {
482 gvsid = slb->vsid; 583 gvsid = slb->vsid;
584 pagesize = slb->base_page_size;
483 if (slb->tb) { 585 if (slb->tb) {
484 gvsid <<= SID_SHIFT_1T - SID_SHIFT; 586 gvsid <<= SID_SHIFT_1T - SID_SHIFT;
485 gvsid |= esid & ((1ul << (SID_SHIFT_1T - SID_SHIFT)) - 1); 587 gvsid |= esid & ((1ul << (SID_SHIFT_1T - SID_SHIFT)) - 1);
@@ -490,28 +592,41 @@ static int kvmppc_mmu_book3s_64_esid_to_vsid(struct kvm_vcpu *vcpu, ulong esid,
490 592
491 switch (vcpu->arch.shared->msr & (MSR_DR|MSR_IR)) { 593 switch (vcpu->arch.shared->msr & (MSR_DR|MSR_IR)) {
492 case 0: 594 case 0:
493 *vsid = VSID_REAL | esid; 595 gvsid = VSID_REAL | esid;
494 break; 596 break;
495 case MSR_IR: 597 case MSR_IR:
496 *vsid = VSID_REAL_IR | gvsid; 598 gvsid |= VSID_REAL_IR;
497 break; 599 break;
498 case MSR_DR: 600 case MSR_DR:
499 *vsid = VSID_REAL_DR | gvsid; 601 gvsid |= VSID_REAL_DR;
500 break; 602 break;
501 case MSR_DR|MSR_IR: 603 case MSR_DR|MSR_IR:
502 if (!slb) 604 if (!slb)
503 goto no_slb; 605 goto no_slb;
504 606
505 *vsid = gvsid;
506 break; 607 break;
507 default: 608 default:
508 BUG(); 609 BUG();
509 break; 610 break;
510 } 611 }
511 612
613#ifdef CONFIG_PPC_64K_PAGES
614 /*
615 * Mark this as a 64k segment if the host is using
616 * 64k pages, the host MMU supports 64k pages and
617 * the guest segment page size is >= 64k,
618 * but not if this segment contains the magic page.
619 */
620 if (pagesize >= MMU_PAGE_64K &&
621 mmu_psize_defs[MMU_PAGE_64K].shift &&
622 !segment_contains_magic_page(vcpu, esid))
623 gvsid |= VSID_64K;
624#endif
625
512 if (vcpu->arch.shared->msr & MSR_PR) 626 if (vcpu->arch.shared->msr & MSR_PR)
513 *vsid |= VSID_PR; 627 gvsid |= VSID_PR;
514 628
629 *vsid = gvsid;
515 return 0; 630 return 0;
516 631
517no_slb: 632no_slb:
diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c
index e5240524bf6c..0d513af62bba 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_host.c
@@ -27,14 +27,14 @@
27#include <asm/machdep.h> 27#include <asm/machdep.h>
28#include <asm/mmu_context.h> 28#include <asm/mmu_context.h>
29#include <asm/hw_irq.h> 29#include <asm/hw_irq.h>
30#include "trace.h" 30#include "trace_pr.h"
31 31
32#define PTE_SIZE 12 32#define PTE_SIZE 12
33 33
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_PAGE_4K, MMU_SEGSIZE_256M, 37 pte->pagesize, pte->pagesize, MMU_SEGSIZE_256M,
38 false); 38 false);
39} 39}
40 40
@@ -78,7 +78,8 @@ static struct kvmppc_sid_map *find_sid_vsid(struct kvm_vcpu *vcpu, u64 gvsid)
78 return NULL; 78 return NULL;
79} 79}
80 80
81int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte) 81int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte,
82 bool iswrite)
82{ 83{
83 unsigned long vpn; 84 unsigned long vpn;
84 pfn_t hpaddr; 85 pfn_t hpaddr;
@@ -90,16 +91,26 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
90 int attempt = 0; 91 int attempt = 0;
91 struct kvmppc_sid_map *map; 92 struct kvmppc_sid_map *map;
92 int r = 0; 93 int r = 0;
94 int hpsize = MMU_PAGE_4K;
95 bool writable;
96 unsigned long mmu_seq;
97 struct kvm *kvm = vcpu->kvm;
98 struct hpte_cache *cpte;
99 unsigned long gfn = orig_pte->raddr >> PAGE_SHIFT;
100 unsigned long pfn;
101
102 /* used to check for invalidations in progress */
103 mmu_seq = kvm->mmu_notifier_seq;
104 smp_rmb();
93 105
94 /* Get host physical address for gpa */ 106 /* Get host physical address for gpa */
95 hpaddr = kvmppc_gfn_to_pfn(vcpu, orig_pte->raddr >> PAGE_SHIFT); 107 pfn = kvmppc_gfn_to_pfn(vcpu, gfn, iswrite, &writable);
96 if (is_error_noslot_pfn(hpaddr)) { 108 if (is_error_noslot_pfn(pfn)) {
97 printk(KERN_INFO "Couldn't get guest page for gfn %lx!\n", orig_pte->eaddr); 109 printk(KERN_INFO "Couldn't get guest page for gfn %lx!\n", gfn);
98 r = -EINVAL; 110 r = -EINVAL;
99 goto out; 111 goto out;
100 } 112 }
101 hpaddr <<= PAGE_SHIFT; 113 hpaddr = pfn << PAGE_SHIFT;
102 hpaddr |= orig_pte->raddr & (~0xfffULL & ~PAGE_MASK);
103 114
104 /* and write the mapping ea -> hpa into the pt */ 115 /* and write the mapping ea -> hpa into the pt */
105 vcpu->arch.mmu.esid_to_vsid(vcpu, orig_pte->eaddr >> SID_SHIFT, &vsid); 116 vcpu->arch.mmu.esid_to_vsid(vcpu, orig_pte->eaddr >> SID_SHIFT, &vsid);
@@ -117,20 +128,39 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
117 goto out; 128 goto out;
118 } 129 }
119 130
120 vsid = map->host_vsid; 131 vpn = hpt_vpn(orig_pte->eaddr, map->host_vsid, MMU_SEGSIZE_256M);
121 vpn = hpt_vpn(orig_pte->eaddr, vsid, MMU_SEGSIZE_256M);
122 132
123 if (!orig_pte->may_write) 133 kvm_set_pfn_accessed(pfn);
124 rflags |= HPTE_R_PP; 134 if (!orig_pte->may_write || !writable)
125 else 135 rflags |= PP_RXRX;
126 mark_page_dirty(vcpu->kvm, orig_pte->raddr >> PAGE_SHIFT); 136 else {
137 mark_page_dirty(vcpu->kvm, gfn);
138 kvm_set_pfn_dirty(pfn);
139 }
127 140
128 if (!orig_pte->may_execute) 141 if (!orig_pte->may_execute)
129 rflags |= HPTE_R_N; 142 rflags |= HPTE_R_N;
130 else 143 else
131 kvmppc_mmu_flush_icache(hpaddr >> PAGE_SHIFT); 144 kvmppc_mmu_flush_icache(pfn);
145
146 /*
147 * Use 64K pages if possible; otherwise, on 64K page kernels,
148 * we need to transfer 4 more bits from guest real to host real addr.
149 */
150 if (vsid & VSID_64K)
151 hpsize = MMU_PAGE_64K;
152 else
153 hpaddr |= orig_pte->raddr & (~0xfffULL & ~PAGE_MASK);
154
155 hash = hpt_hash(vpn, mmu_psize_defs[hpsize].shift, MMU_SEGSIZE_256M);
132 156
133 hash = hpt_hash(vpn, PTE_SIZE, MMU_SEGSIZE_256M); 157 cpte = kvmppc_mmu_hpte_cache_next(vcpu);
158
159 spin_lock(&kvm->mmu_lock);
160 if (!cpte || mmu_notifier_retry(kvm, mmu_seq)) {
161 r = -EAGAIN;
162 goto out_unlock;
163 }
134 164
135map_again: 165map_again:
136 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); 166 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
@@ -139,11 +169,11 @@ map_again:
139 if (attempt > 1) 169 if (attempt > 1)
140 if (ppc_md.hpte_remove(hpteg) < 0) { 170 if (ppc_md.hpte_remove(hpteg) < 0) {
141 r = -1; 171 r = -1;
142 goto out; 172 goto out_unlock;
143 } 173 }
144 174
145 ret = ppc_md.hpte_insert(hpteg, vpn, hpaddr, rflags, vflags, 175 ret = ppc_md.hpte_insert(hpteg, vpn, hpaddr, rflags, vflags,
146 MMU_PAGE_4K, MMU_PAGE_4K, MMU_SEGSIZE_256M); 176 hpsize, hpsize, MMU_SEGSIZE_256M);
147 177
148 if (ret < 0) { 178 if (ret < 0) {
149 /* If we couldn't map a primary PTE, try a secondary */ 179 /* If we couldn't map a primary PTE, try a secondary */
@@ -152,8 +182,6 @@ map_again:
152 attempt++; 182 attempt++;
153 goto map_again; 183 goto map_again;
154 } else { 184 } else {
155 struct hpte_cache *pte = kvmppc_mmu_hpte_cache_next(vcpu);
156
157 trace_kvm_book3s_64_mmu_map(rflags, hpteg, 185 trace_kvm_book3s_64_mmu_map(rflags, hpteg,
158 vpn, hpaddr, orig_pte); 186 vpn, hpaddr, orig_pte);
159 187
@@ -164,19 +192,37 @@ map_again:
164 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); 192 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
165 } 193 }
166 194
167 pte->slot = hpteg + (ret & 7); 195 cpte->slot = hpteg + (ret & 7);
168 pte->host_vpn = vpn; 196 cpte->host_vpn = vpn;
169 pte->pte = *orig_pte; 197 cpte->pte = *orig_pte;
170 pte->pfn = hpaddr >> PAGE_SHIFT; 198 cpte->pfn = pfn;
199 cpte->pagesize = hpsize;
171 200
172 kvmppc_mmu_hpte_cache_map(vcpu, pte); 201 kvmppc_mmu_hpte_cache_map(vcpu, cpte);
202 cpte = NULL;
173 } 203 }
174 kvm_release_pfn_clean(hpaddr >> PAGE_SHIFT); 204
205out_unlock:
206 spin_unlock(&kvm->mmu_lock);
207 kvm_release_pfn_clean(pfn);
208 if (cpte)
209 kvmppc_mmu_hpte_cache_free(cpte);
175 210
176out: 211out:
177 return r; 212 return r;
178} 213}
179 214
215void kvmppc_mmu_unmap_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte)
216{
217 u64 mask = 0xfffffffffULL;
218 u64 vsid;
219
220 vcpu->arch.mmu.esid_to_vsid(vcpu, pte->eaddr >> SID_SHIFT, &vsid);
221 if (vsid & VSID_64K)
222 mask = 0xffffffff0ULL;
223 kvmppc_mmu_pte_vflush(vcpu, pte->vpage, mask);
224}
225
180static struct kvmppc_sid_map *create_sid_map(struct kvm_vcpu *vcpu, u64 gvsid) 226static struct kvmppc_sid_map *create_sid_map(struct kvm_vcpu *vcpu, u64 gvsid)
181{ 227{
182 struct kvmppc_sid_map *map; 228 struct kvmppc_sid_map *map;
@@ -291,6 +337,12 @@ int kvmppc_mmu_map_segment(struct kvm_vcpu *vcpu, ulong eaddr)
291 slb_vsid &= ~SLB_VSID_KP; 337 slb_vsid &= ~SLB_VSID_KP;
292 slb_esid |= slb_index; 338 slb_esid |= slb_index;
293 339
340#ifdef CONFIG_PPC_64K_PAGES
341 /* Set host segment base page size to 64K if possible */
342 if (gvsid & VSID_64K)
343 slb_vsid |= mmu_psize_defs[MMU_PAGE_64K].sllp;
344#endif
345
294 svcpu->slb[slb_index].esid = slb_esid; 346 svcpu->slb[slb_index].esid = slb_esid;
295 svcpu->slb[slb_index].vsid = slb_vsid; 347 svcpu->slb[slb_index].vsid = slb_vsid;
296 348
@@ -326,7 +378,7 @@ void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu)
326 svcpu_put(svcpu); 378 svcpu_put(svcpu);
327} 379}
328 380
329void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu) 381void kvmppc_mmu_destroy_pr(struct kvm_vcpu *vcpu)
330{ 382{
331 kvmppc_mmu_hpte_destroy(vcpu); 383 kvmppc_mmu_hpte_destroy(vcpu);
332 __destroy_context(to_book3s(vcpu)->context_id[0]); 384 __destroy_context(to_book3s(vcpu)->context_id[0]);
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index 043eec8461e7..f3ff587a8b7d 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -260,10 +260,6 @@ int kvmppc_mmu_hv_init(void)
260 return 0; 260 return 0;
261} 261}
262 262
263void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu)
264{
265}
266
267static void kvmppc_mmu_book3s_64_hv_reset_msr(struct kvm_vcpu *vcpu) 263static void kvmppc_mmu_book3s_64_hv_reset_msr(struct kvm_vcpu *vcpu)
268{ 264{
269 kvmppc_set_msr(vcpu, MSR_SF | MSR_ME); 265 kvmppc_set_msr(vcpu, MSR_SF | MSR_ME);
@@ -451,7 +447,7 @@ static unsigned long kvmppc_mmu_get_real_addr(unsigned long v, unsigned long r,
451} 447}
452 448
453static int kvmppc_mmu_book3s_64_hv_xlate(struct kvm_vcpu *vcpu, gva_t eaddr, 449static int kvmppc_mmu_book3s_64_hv_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
454 struct kvmppc_pte *gpte, bool data) 450 struct kvmppc_pte *gpte, bool data, bool iswrite)
455{ 451{
456 struct kvm *kvm = vcpu->kvm; 452 struct kvm *kvm = vcpu->kvm;
457 struct kvmppc_slb *slbe; 453 struct kvmppc_slb *slbe;
@@ -906,21 +902,22 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
906 return 0; 902 return 0;
907} 903}
908 904
909int kvm_unmap_hva(struct kvm *kvm, unsigned long hva) 905int kvm_unmap_hva_hv(struct kvm *kvm, unsigned long hva)
910{ 906{
911 if (kvm->arch.using_mmu_notifiers) 907 if (kvm->arch.using_mmu_notifiers)
912 kvm_handle_hva(kvm, hva, kvm_unmap_rmapp); 908 kvm_handle_hva(kvm, hva, kvm_unmap_rmapp);
913 return 0; 909 return 0;
914} 910}
915 911
916int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end) 912int kvm_unmap_hva_range_hv(struct kvm *kvm, unsigned long start, unsigned long end)
917{ 913{
918 if (kvm->arch.using_mmu_notifiers) 914 if (kvm->arch.using_mmu_notifiers)
919 kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp); 915 kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp);
920 return 0; 916 return 0;
921} 917}
922 918
923void kvmppc_core_flush_memslot(struct kvm *kvm, struct kvm_memory_slot *memslot) 919void kvmppc_core_flush_memslot_hv(struct kvm *kvm,
920 struct kvm_memory_slot *memslot)
924{ 921{
925 unsigned long *rmapp; 922 unsigned long *rmapp;
926 unsigned long gfn; 923 unsigned long gfn;
@@ -994,7 +991,7 @@ static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
994 return ret; 991 return ret;
995} 992}
996 993
997int kvm_age_hva(struct kvm *kvm, unsigned long hva) 994int kvm_age_hva_hv(struct kvm *kvm, unsigned long hva)
998{ 995{
999 if (!kvm->arch.using_mmu_notifiers) 996 if (!kvm->arch.using_mmu_notifiers)
1000 return 0; 997 return 0;
@@ -1032,14 +1029,14 @@ static int kvm_test_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
1032 return ret; 1029 return ret;
1033} 1030}
1034 1031
1035int kvm_test_age_hva(struct kvm *kvm, unsigned long hva) 1032int kvm_test_age_hva_hv(struct kvm *kvm, unsigned long hva)
1036{ 1033{
1037 if (!kvm->arch.using_mmu_notifiers) 1034 if (!kvm->arch.using_mmu_notifiers)
1038 return 0; 1035 return 0;
1039 return kvm_handle_hva(kvm, hva, kvm_test_age_rmapp); 1036 return kvm_handle_hva(kvm, hva, kvm_test_age_rmapp);
1040} 1037}
1041 1038
1042void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) 1039void kvm_set_spte_hva_hv(struct kvm *kvm, unsigned long hva, pte_t pte)
1043{ 1040{
1044 if (!kvm->arch.using_mmu_notifiers) 1041 if (!kvm->arch.using_mmu_notifiers)
1045 return; 1042 return;
@@ -1512,9 +1509,8 @@ static ssize_t kvm_htab_write(struct file *file, const char __user *buf,
1512 1509
1513 kvm->arch.vrma_slb_v = senc | SLB_VSID_B_1T | 1510 kvm->arch.vrma_slb_v = senc | SLB_VSID_B_1T |
1514 (VRMA_VSID << SLB_VSID_SHIFT_1T); 1511 (VRMA_VSID << SLB_VSID_SHIFT_1T);
1515 lpcr = kvm->arch.lpcr & ~LPCR_VRMASD; 1512 lpcr = senc << (LPCR_VRMASD_SH - 4);
1516 lpcr |= senc << (LPCR_VRMASD_SH - 4); 1513 kvmppc_update_lpcr(kvm, lpcr, LPCR_VRMASD);
1517 kvm->arch.lpcr = lpcr;
1518 rma_setup = 1; 1514 rma_setup = 1;
1519 } 1515 }
1520 ++i; 1516 ++i;
diff --git a/arch/powerpc/kvm/book3s_64_vio_hv.c b/arch/powerpc/kvm/book3s_64_vio_hv.c
index 30c2f3b134c6..2c25f5412bdb 100644
--- a/arch/powerpc/kvm/book3s_64_vio_hv.c
+++ b/arch/powerpc/kvm/book3s_64_vio_hv.c
@@ -74,3 +74,4 @@ long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn,
74 /* Didn't find the liobn, punt it to userspace */ 74 /* Didn't find the liobn, punt it to userspace */
75 return H_TOO_HARD; 75 return H_TOO_HARD;
76} 76}
77EXPORT_SYMBOL_GPL(kvmppc_h_put_tce);
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index 360ce68c9809..99d40f8977e8 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -86,8 +86,8 @@ static bool spr_allowed(struct kvm_vcpu *vcpu, enum priv_level level)
86 return true; 86 return true;
87} 87}
88 88
89int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, 89int kvmppc_core_emulate_op_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
90 unsigned int inst, int *advance) 90 unsigned int inst, int *advance)
91{ 91{
92 int emulated = EMULATE_DONE; 92 int emulated = EMULATE_DONE;
93 int rt = get_rt(inst); 93 int rt = get_rt(inst);
@@ -172,7 +172,7 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
172 vcpu->arch.mmu.tlbie(vcpu, addr, large); 172 vcpu->arch.mmu.tlbie(vcpu, addr, large);
173 break; 173 break;
174 } 174 }
175#ifdef CONFIG_KVM_BOOK3S_64_PR 175#ifdef CONFIG_PPC_BOOK3S_64
176 case OP_31_XOP_FAKE_SC1: 176 case OP_31_XOP_FAKE_SC1:
177 { 177 {
178 /* SC 1 papr hypercalls */ 178 /* SC 1 papr hypercalls */
@@ -267,12 +267,9 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
267 267
268 r = kvmppc_st(vcpu, &addr, 32, zeros, true); 268 r = kvmppc_st(vcpu, &addr, 32, zeros, true);
269 if ((r == -ENOENT) || (r == -EPERM)) { 269 if ((r == -ENOENT) || (r == -EPERM)) {
270 struct kvmppc_book3s_shadow_vcpu *svcpu;
271
272 svcpu = svcpu_get(vcpu);
273 *advance = 0; 270 *advance = 0;
274 vcpu->arch.shared->dar = vaddr; 271 vcpu->arch.shared->dar = vaddr;
275 svcpu->fault_dar = vaddr; 272 vcpu->arch.fault_dar = vaddr;
276 273
277 dsisr = DSISR_ISSTORE; 274 dsisr = DSISR_ISSTORE;
278 if (r == -ENOENT) 275 if (r == -ENOENT)
@@ -281,8 +278,7 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
281 dsisr |= DSISR_PROTFAULT; 278 dsisr |= DSISR_PROTFAULT;
282 279
283 vcpu->arch.shared->dsisr = dsisr; 280 vcpu->arch.shared->dsisr = dsisr;
284 svcpu->fault_dsisr = dsisr; 281 vcpu->arch.fault_dsisr = dsisr;
285 svcpu_put(svcpu);
286 282
287 kvmppc_book3s_queue_irqprio(vcpu, 283 kvmppc_book3s_queue_irqprio(vcpu,
288 BOOK3S_INTERRUPT_DATA_STORAGE); 284 BOOK3S_INTERRUPT_DATA_STORAGE);
@@ -349,7 +345,7 @@ static struct kvmppc_bat *kvmppc_find_bat(struct kvm_vcpu *vcpu, int sprn)
349 return bat; 345 return bat;
350} 346}
351 347
352int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val) 348int kvmppc_core_emulate_mtspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
353{ 349{
354 int emulated = EMULATE_DONE; 350 int emulated = EMULATE_DONE;
355 351
@@ -472,7 +468,7 @@ unprivileged:
472 return emulated; 468 return emulated;
473} 469}
474 470
475int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val) 471int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
476{ 472{
477 int emulated = EMULATE_DONE; 473 int emulated = EMULATE_DONE;
478 474
diff --git a/arch/powerpc/kvm/book3s_exports.c b/arch/powerpc/kvm/book3s_exports.c
index 7057a02f0906..852989a9bad3 100644
--- a/arch/powerpc/kvm/book3s_exports.c
+++ b/arch/powerpc/kvm/book3s_exports.c
@@ -20,9 +20,10 @@
20#include <linux/export.h> 20#include <linux/export.h>
21#include <asm/kvm_book3s.h> 21#include <asm/kvm_book3s.h>
22 22
23#ifdef CONFIG_KVM_BOOK3S_64_HV 23#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
24EXPORT_SYMBOL_GPL(kvmppc_hv_entry_trampoline); 24EXPORT_SYMBOL_GPL(kvmppc_hv_entry_trampoline);
25#else 25#endif
26#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
26EXPORT_SYMBOL_GPL(kvmppc_entry_trampoline); 27EXPORT_SYMBOL_GPL(kvmppc_entry_trampoline);
27EXPORT_SYMBOL_GPL(kvmppc_load_up_fpu); 28EXPORT_SYMBOL_GPL(kvmppc_load_up_fpu);
28#ifdef CONFIG_ALTIVEC 29#ifdef CONFIG_ALTIVEC
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 62a2b5ab08ed..072287f1c3bc 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -52,6 +52,9 @@
52#include <linux/vmalloc.h> 52#include <linux/vmalloc.h>
53#include <linux/highmem.h> 53#include <linux/highmem.h>
54#include <linux/hugetlb.h> 54#include <linux/hugetlb.h>
55#include <linux/module.h>
56
57#include "book3s.h"
55 58
56/* #define EXIT_DEBUG */ 59/* #define EXIT_DEBUG */
57/* #define EXIT_DEBUG_SIMPLE */ 60/* #define EXIT_DEBUG_SIMPLE */
@@ -66,7 +69,7 @@
66static void kvmppc_end_cede(struct kvm_vcpu *vcpu); 69static void kvmppc_end_cede(struct kvm_vcpu *vcpu);
67static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu); 70static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu);
68 71
69void kvmppc_fast_vcpu_kick(struct kvm_vcpu *vcpu) 72static void kvmppc_fast_vcpu_kick_hv(struct kvm_vcpu *vcpu)
70{ 73{
71 int me; 74 int me;
72 int cpu = vcpu->cpu; 75 int cpu = vcpu->cpu;
@@ -125,7 +128,7 @@ void kvmppc_fast_vcpu_kick(struct kvm_vcpu *vcpu)
125 * purely defensive; they should never fail.) 128 * purely defensive; they should never fail.)
126 */ 129 */
127 130
128void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 131static void kvmppc_core_vcpu_load_hv(struct kvm_vcpu *vcpu, int cpu)
129{ 132{
130 struct kvmppc_vcore *vc = vcpu->arch.vcore; 133 struct kvmppc_vcore *vc = vcpu->arch.vcore;
131 134
@@ -143,7 +146,7 @@ void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
143 spin_unlock(&vcpu->arch.tbacct_lock); 146 spin_unlock(&vcpu->arch.tbacct_lock);
144} 147}
145 148
146void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu) 149static void kvmppc_core_vcpu_put_hv(struct kvm_vcpu *vcpu)
147{ 150{
148 struct kvmppc_vcore *vc = vcpu->arch.vcore; 151 struct kvmppc_vcore *vc = vcpu->arch.vcore;
149 152
@@ -155,17 +158,46 @@ void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu)
155 spin_unlock(&vcpu->arch.tbacct_lock); 158 spin_unlock(&vcpu->arch.tbacct_lock);
156} 159}
157 160
158void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 msr) 161static void kvmppc_set_msr_hv(struct kvm_vcpu *vcpu, u64 msr)
159{ 162{
160 vcpu->arch.shregs.msr = msr; 163 vcpu->arch.shregs.msr = msr;
161 kvmppc_end_cede(vcpu); 164 kvmppc_end_cede(vcpu);
162} 165}
163 166
164void kvmppc_set_pvr(struct kvm_vcpu *vcpu, u32 pvr) 167void kvmppc_set_pvr_hv(struct kvm_vcpu *vcpu, u32 pvr)
165{ 168{
166 vcpu->arch.pvr = pvr; 169 vcpu->arch.pvr = pvr;
167} 170}
168 171
172int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat)
173{
174 unsigned long pcr = 0;
175 struct kvmppc_vcore *vc = vcpu->arch.vcore;
176
177 if (arch_compat) {
178 if (!cpu_has_feature(CPU_FTR_ARCH_206))
179 return -EINVAL; /* 970 has no compat mode support */
180
181 switch (arch_compat) {
182 case PVR_ARCH_205:
183 pcr = PCR_ARCH_205;
184 break;
185 case PVR_ARCH_206:
186 case PVR_ARCH_206p:
187 break;
188 default:
189 return -EINVAL;
190 }
191 }
192
193 spin_lock(&vc->lock);
194 vc->arch_compat = arch_compat;
195 vc->pcr = pcr;
196 spin_unlock(&vc->lock);
197
198 return 0;
199}
200
169void kvmppc_dump_regs(struct kvm_vcpu *vcpu) 201void kvmppc_dump_regs(struct kvm_vcpu *vcpu)
170{ 202{
171 int r; 203 int r;
@@ -195,7 +227,7 @@ void kvmppc_dump_regs(struct kvm_vcpu *vcpu)
195 pr_err(" ESID = %.16llx VSID = %.16llx\n", 227 pr_err(" ESID = %.16llx VSID = %.16llx\n",
196 vcpu->arch.slb[r].orige, vcpu->arch.slb[r].origv); 228 vcpu->arch.slb[r].orige, vcpu->arch.slb[r].origv);
197 pr_err("lpcr = %.16lx sdr1 = %.16lx last_inst = %.8x\n", 229 pr_err("lpcr = %.16lx sdr1 = %.16lx last_inst = %.8x\n",
198 vcpu->kvm->arch.lpcr, vcpu->kvm->arch.sdr1, 230 vcpu->arch.vcore->lpcr, vcpu->kvm->arch.sdr1,
199 vcpu->arch.last_inst); 231 vcpu->arch.last_inst);
200} 232}
201 233
@@ -489,7 +521,7 @@ static void kvmppc_create_dtl_entry(struct kvm_vcpu *vcpu,
489 memset(dt, 0, sizeof(struct dtl_entry)); 521 memset(dt, 0, sizeof(struct dtl_entry));
490 dt->dispatch_reason = 7; 522 dt->dispatch_reason = 7;
491 dt->processor_id = vc->pcpu + vcpu->arch.ptid; 523 dt->processor_id = vc->pcpu + vcpu->arch.ptid;
492 dt->timebase = now; 524 dt->timebase = now + vc->tb_offset;
493 dt->enqueue_to_dispatch_time = stolen; 525 dt->enqueue_to_dispatch_time = stolen;
494 dt->srr0 = kvmppc_get_pc(vcpu); 526 dt->srr0 = kvmppc_get_pc(vcpu);
495 dt->srr1 = vcpu->arch.shregs.msr; 527 dt->srr1 = vcpu->arch.shregs.msr;
@@ -538,6 +570,15 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
538 } 570 }
539 break; 571 break;
540 case H_CONFER: 572 case H_CONFER:
573 target = kvmppc_get_gpr(vcpu, 4);
574 if (target == -1)
575 break;
576 tvcpu = kvmppc_find_vcpu(vcpu->kvm, target);
577 if (!tvcpu) {
578 ret = H_PARAMETER;
579 break;
580 }
581 kvm_vcpu_yield_to(tvcpu);
541 break; 582 break;
542 case H_REGISTER_VPA: 583 case H_REGISTER_VPA:
543 ret = do_h_register_vpa(vcpu, kvmppc_get_gpr(vcpu, 4), 584 ret = do_h_register_vpa(vcpu, kvmppc_get_gpr(vcpu, 4),
@@ -576,8 +617,8 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
576 return RESUME_GUEST; 617 return RESUME_GUEST;
577} 618}
578 619
579static int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu, 620static int kvmppc_handle_exit_hv(struct kvm_run *run, struct kvm_vcpu *vcpu,
580 struct task_struct *tsk) 621 struct task_struct *tsk)
581{ 622{
582 int r = RESUME_HOST; 623 int r = RESUME_HOST;
583 624
@@ -671,16 +712,16 @@ static int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
671 printk(KERN_EMERG "trap=0x%x | pc=0x%lx | msr=0x%llx\n", 712 printk(KERN_EMERG "trap=0x%x | pc=0x%lx | msr=0x%llx\n",
672 vcpu->arch.trap, kvmppc_get_pc(vcpu), 713 vcpu->arch.trap, kvmppc_get_pc(vcpu),
673 vcpu->arch.shregs.msr); 714 vcpu->arch.shregs.msr);
715 run->hw.hardware_exit_reason = vcpu->arch.trap;
674 r = RESUME_HOST; 716 r = RESUME_HOST;
675 BUG();
676 break; 717 break;
677 } 718 }
678 719
679 return r; 720 return r;
680} 721}
681 722
682int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, 723static int kvm_arch_vcpu_ioctl_get_sregs_hv(struct kvm_vcpu *vcpu,
683 struct kvm_sregs *sregs) 724 struct kvm_sregs *sregs)
684{ 725{
685 int i; 726 int i;
686 727
@@ -694,12 +735,12 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
694 return 0; 735 return 0;
695} 736}
696 737
697int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, 738static int kvm_arch_vcpu_ioctl_set_sregs_hv(struct kvm_vcpu *vcpu,
698 struct kvm_sregs *sregs) 739 struct kvm_sregs *sregs)
699{ 740{
700 int i, j; 741 int i, j;
701 742
702 kvmppc_set_pvr(vcpu, sregs->pvr); 743 kvmppc_set_pvr_hv(vcpu, sregs->pvr);
703 744
704 j = 0; 745 j = 0;
705 for (i = 0; i < vcpu->arch.slb_nr; i++) { 746 for (i = 0; i < vcpu->arch.slb_nr; i++) {
@@ -714,7 +755,23 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
714 return 0; 755 return 0;
715} 756}
716 757
717int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val) 758static void kvmppc_set_lpcr(struct kvm_vcpu *vcpu, u64 new_lpcr)
759{
760 struct kvmppc_vcore *vc = vcpu->arch.vcore;
761 u64 mask;
762
763 spin_lock(&vc->lock);
764 /*
765 * Userspace can only modify DPFD (default prefetch depth),
766 * ILE (interrupt little-endian) and TC (translation control).
767 */
768 mask = LPCR_DPFD | LPCR_ILE | LPCR_TC;
769 vc->lpcr = (vc->lpcr & ~mask) | (new_lpcr & mask);
770 spin_unlock(&vc->lock);
771}
772
773static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
774 union kvmppc_one_reg *val)
718{ 775{
719 int r = 0; 776 int r = 0;
720 long int i; 777 long int i;
@@ -749,6 +806,12 @@ int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val)
749 i = id - KVM_REG_PPC_PMC1; 806 i = id - KVM_REG_PPC_PMC1;
750 *val = get_reg_val(id, vcpu->arch.pmc[i]); 807 *val = get_reg_val(id, vcpu->arch.pmc[i]);
751 break; 808 break;
809 case KVM_REG_PPC_SIAR:
810 *val = get_reg_val(id, vcpu->arch.siar);
811 break;
812 case KVM_REG_PPC_SDAR:
813 *val = get_reg_val(id, vcpu->arch.sdar);
814 break;
752#ifdef CONFIG_VSX 815#ifdef CONFIG_VSX
753 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31: 816 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31:
754 if (cpu_has_feature(CPU_FTR_VSX)) { 817 if (cpu_has_feature(CPU_FTR_VSX)) {
@@ -787,6 +850,18 @@ int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val)
787 val->vpaval.length = vcpu->arch.dtl.len; 850 val->vpaval.length = vcpu->arch.dtl.len;
788 spin_unlock(&vcpu->arch.vpa_update_lock); 851 spin_unlock(&vcpu->arch.vpa_update_lock);
789 break; 852 break;
853 case KVM_REG_PPC_TB_OFFSET:
854 *val = get_reg_val(id, vcpu->arch.vcore->tb_offset);
855 break;
856 case KVM_REG_PPC_LPCR:
857 *val = get_reg_val(id, vcpu->arch.vcore->lpcr);
858 break;
859 case KVM_REG_PPC_PPR:
860 *val = get_reg_val(id, vcpu->arch.ppr);
861 break;
862 case KVM_REG_PPC_ARCH_COMPAT:
863 *val = get_reg_val(id, vcpu->arch.vcore->arch_compat);
864 break;
790 default: 865 default:
791 r = -EINVAL; 866 r = -EINVAL;
792 break; 867 break;
@@ -795,7 +870,8 @@ int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val)
795 return r; 870 return r;
796} 871}
797 872
798int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val) 873static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
874 union kvmppc_one_reg *val)
799{ 875{
800 int r = 0; 876 int r = 0;
801 long int i; 877 long int i;
@@ -833,6 +909,12 @@ int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val)
833 i = id - KVM_REG_PPC_PMC1; 909 i = id - KVM_REG_PPC_PMC1;
834 vcpu->arch.pmc[i] = set_reg_val(id, *val); 910 vcpu->arch.pmc[i] = set_reg_val(id, *val);
835 break; 911 break;
912 case KVM_REG_PPC_SIAR:
913 vcpu->arch.siar = set_reg_val(id, *val);
914 break;
915 case KVM_REG_PPC_SDAR:
916 vcpu->arch.sdar = set_reg_val(id, *val);
917 break;
836#ifdef CONFIG_VSX 918#ifdef CONFIG_VSX
837 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31: 919 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31:
838 if (cpu_has_feature(CPU_FTR_VSX)) { 920 if (cpu_has_feature(CPU_FTR_VSX)) {
@@ -880,6 +962,20 @@ int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val)
880 len -= len % sizeof(struct dtl_entry); 962 len -= len % sizeof(struct dtl_entry);
881 r = set_vpa(vcpu, &vcpu->arch.dtl, addr, len); 963 r = set_vpa(vcpu, &vcpu->arch.dtl, addr, len);
882 break; 964 break;
965 case KVM_REG_PPC_TB_OFFSET:
966 /* round up to multiple of 2^24 */
967 vcpu->arch.vcore->tb_offset =
968 ALIGN(set_reg_val(id, *val), 1UL << 24);
969 break;
970 case KVM_REG_PPC_LPCR:
971 kvmppc_set_lpcr(vcpu, set_reg_val(id, *val));
972 break;
973 case KVM_REG_PPC_PPR:
974 vcpu->arch.ppr = set_reg_val(id, *val);
975 break;
976 case KVM_REG_PPC_ARCH_COMPAT:
977 r = kvmppc_set_arch_compat(vcpu, set_reg_val(id, *val));
978 break;
883 default: 979 default:
884 r = -EINVAL; 980 r = -EINVAL;
885 break; 981 break;
@@ -888,14 +984,8 @@ int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val)
888 return r; 984 return r;
889} 985}
890 986
891int kvmppc_core_check_processor_compat(void) 987static struct kvm_vcpu *kvmppc_core_vcpu_create_hv(struct kvm *kvm,
892{ 988 unsigned int id)
893 if (cpu_has_feature(CPU_FTR_HVMODE))
894 return 0;
895 return -EIO;
896}
897
898struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
899{ 989{
900 struct kvm_vcpu *vcpu; 990 struct kvm_vcpu *vcpu;
901 int err = -EINVAL; 991 int err = -EINVAL;
@@ -919,8 +1009,7 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
919 vcpu->arch.mmcr[0] = MMCR0_FC; 1009 vcpu->arch.mmcr[0] = MMCR0_FC;
920 vcpu->arch.ctrl = CTRL_RUNLATCH; 1010 vcpu->arch.ctrl = CTRL_RUNLATCH;
921 /* default to host PVR, since we can't spoof it */ 1011 /* default to host PVR, since we can't spoof it */
922 vcpu->arch.pvr = mfspr(SPRN_PVR); 1012 kvmppc_set_pvr_hv(vcpu, mfspr(SPRN_PVR));
923 kvmppc_set_pvr(vcpu, vcpu->arch.pvr);
924 spin_lock_init(&vcpu->arch.vpa_update_lock); 1013 spin_lock_init(&vcpu->arch.vpa_update_lock);
925 spin_lock_init(&vcpu->arch.tbacct_lock); 1014 spin_lock_init(&vcpu->arch.tbacct_lock);
926 vcpu->arch.busy_preempt = TB_NIL; 1015 vcpu->arch.busy_preempt = TB_NIL;
@@ -940,6 +1029,7 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
940 spin_lock_init(&vcore->lock); 1029 spin_lock_init(&vcore->lock);
941 init_waitqueue_head(&vcore->wq); 1030 init_waitqueue_head(&vcore->wq);
942 vcore->preempt_tb = TB_NIL; 1031 vcore->preempt_tb = TB_NIL;
1032 vcore->lpcr = kvm->arch.lpcr;
943 } 1033 }
944 kvm->arch.vcores[core] = vcore; 1034 kvm->arch.vcores[core] = vcore;
945 kvm->arch.online_vcores++; 1035 kvm->arch.online_vcores++;
@@ -972,7 +1062,7 @@ static void unpin_vpa(struct kvm *kvm, struct kvmppc_vpa *vpa)
972 vpa->dirty); 1062 vpa->dirty);
973} 1063}
974 1064
975void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu) 1065static void kvmppc_core_vcpu_free_hv(struct kvm_vcpu *vcpu)
976{ 1066{
977 spin_lock(&vcpu->arch.vpa_update_lock); 1067 spin_lock(&vcpu->arch.vpa_update_lock);
978 unpin_vpa(vcpu->kvm, &vcpu->arch.dtl); 1068 unpin_vpa(vcpu->kvm, &vcpu->arch.dtl);
@@ -983,6 +1073,12 @@ void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
983 kmem_cache_free(kvm_vcpu_cache, vcpu); 1073 kmem_cache_free(kvm_vcpu_cache, vcpu);
984} 1074}
985 1075
1076static int kvmppc_core_check_requests_hv(struct kvm_vcpu *vcpu)
1077{
1078 /* Indicate we want to get back into the guest */
1079 return 1;
1080}
1081
986static void kvmppc_set_timer(struct kvm_vcpu *vcpu) 1082static void kvmppc_set_timer(struct kvm_vcpu *vcpu)
987{ 1083{
988 unsigned long dec_nsec, now; 1084 unsigned long dec_nsec, now;
@@ -1264,8 +1360,8 @@ static void kvmppc_run_core(struct kvmppc_vcore *vc)
1264 1360
1265 ret = RESUME_GUEST; 1361 ret = RESUME_GUEST;
1266 if (vcpu->arch.trap) 1362 if (vcpu->arch.trap)
1267 ret = kvmppc_handle_exit(vcpu->arch.kvm_run, vcpu, 1363 ret = kvmppc_handle_exit_hv(vcpu->arch.kvm_run, vcpu,
1268 vcpu->arch.run_task); 1364 vcpu->arch.run_task);
1269 1365
1270 vcpu->arch.ret = ret; 1366 vcpu->arch.ret = ret;
1271 vcpu->arch.trap = 0; 1367 vcpu->arch.trap = 0;
@@ -1424,7 +1520,7 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1424 return vcpu->arch.ret; 1520 return vcpu->arch.ret;
1425} 1521}
1426 1522
1427int kvmppc_vcpu_run(struct kvm_run *run, struct kvm_vcpu *vcpu) 1523static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu)
1428{ 1524{
1429 int r; 1525 int r;
1430 int srcu_idx; 1526 int srcu_idx;
@@ -1546,7 +1642,8 @@ static const struct file_operations kvm_rma_fops = {
1546 .release = kvm_rma_release, 1642 .release = kvm_rma_release,
1547}; 1643};
1548 1644
1549long kvm_vm_ioctl_allocate_rma(struct kvm *kvm, struct kvm_allocate_rma *ret) 1645static long kvm_vm_ioctl_allocate_rma(struct kvm *kvm,
1646 struct kvm_allocate_rma *ret)
1550{ 1647{
1551 long fd; 1648 long fd;
1552 struct kvm_rma_info *ri; 1649 struct kvm_rma_info *ri;
@@ -1592,7 +1689,8 @@ static void kvmppc_add_seg_page_size(struct kvm_ppc_one_seg_page_size **sps,
1592 (*sps)++; 1689 (*sps)++;
1593} 1690}
1594 1691
1595int kvm_vm_ioctl_get_smmu_info(struct kvm *kvm, struct kvm_ppc_smmu_info *info) 1692static int kvm_vm_ioctl_get_smmu_info_hv(struct kvm *kvm,
1693 struct kvm_ppc_smmu_info *info)
1596{ 1694{
1597 struct kvm_ppc_one_seg_page_size *sps; 1695 struct kvm_ppc_one_seg_page_size *sps;
1598 1696
@@ -1613,7 +1711,8 @@ int kvm_vm_ioctl_get_smmu_info(struct kvm *kvm, struct kvm_ppc_smmu_info *info)
1613/* 1711/*
1614 * Get (and clear) the dirty memory log for a memory slot. 1712 * Get (and clear) the dirty memory log for a memory slot.
1615 */ 1713 */
1616int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log) 1714static int kvm_vm_ioctl_get_dirty_log_hv(struct kvm *kvm,
1715 struct kvm_dirty_log *log)
1617{ 1716{
1618 struct kvm_memory_slot *memslot; 1717 struct kvm_memory_slot *memslot;
1619 int r; 1718 int r;
@@ -1667,8 +1766,8 @@ static void unpin_slot(struct kvm_memory_slot *memslot)
1667 } 1766 }
1668} 1767}
1669 1768
1670void kvmppc_core_free_memslot(struct kvm_memory_slot *free, 1769static void kvmppc_core_free_memslot_hv(struct kvm_memory_slot *free,
1671 struct kvm_memory_slot *dont) 1770 struct kvm_memory_slot *dont)
1672{ 1771{
1673 if (!dont || free->arch.rmap != dont->arch.rmap) { 1772 if (!dont || free->arch.rmap != dont->arch.rmap) {
1674 vfree(free->arch.rmap); 1773 vfree(free->arch.rmap);
@@ -1681,8 +1780,8 @@ void kvmppc_core_free_memslot(struct kvm_memory_slot *free,
1681 } 1780 }
1682} 1781}
1683 1782
1684int kvmppc_core_create_memslot(struct kvm_memory_slot *slot, 1783static int kvmppc_core_create_memslot_hv(struct kvm_memory_slot *slot,
1685 unsigned long npages) 1784 unsigned long npages)
1686{ 1785{
1687 slot->arch.rmap = vzalloc(npages * sizeof(*slot->arch.rmap)); 1786 slot->arch.rmap = vzalloc(npages * sizeof(*slot->arch.rmap));
1688 if (!slot->arch.rmap) 1787 if (!slot->arch.rmap)
@@ -1692,9 +1791,9 @@ int kvmppc_core_create_memslot(struct kvm_memory_slot *slot,
1692 return 0; 1791 return 0;
1693} 1792}
1694 1793
1695int kvmppc_core_prepare_memory_region(struct kvm *kvm, 1794static int kvmppc_core_prepare_memory_region_hv(struct kvm *kvm,
1696 struct kvm_memory_slot *memslot, 1795 struct kvm_memory_slot *memslot,
1697 struct kvm_userspace_memory_region *mem) 1796 struct kvm_userspace_memory_region *mem)
1698{ 1797{
1699 unsigned long *phys; 1798 unsigned long *phys;
1700 1799
@@ -1710,9 +1809,9 @@ int kvmppc_core_prepare_memory_region(struct kvm *kvm,
1710 return 0; 1809 return 0;
1711} 1810}
1712 1811
1713void kvmppc_core_commit_memory_region(struct kvm *kvm, 1812static void kvmppc_core_commit_memory_region_hv(struct kvm *kvm,
1714 struct kvm_userspace_memory_region *mem, 1813 struct kvm_userspace_memory_region *mem,
1715 const struct kvm_memory_slot *old) 1814 const struct kvm_memory_slot *old)
1716{ 1815{
1717 unsigned long npages = mem->memory_size >> PAGE_SHIFT; 1816 unsigned long npages = mem->memory_size >> PAGE_SHIFT;
1718 struct kvm_memory_slot *memslot; 1817 struct kvm_memory_slot *memslot;
@@ -1729,6 +1828,37 @@ void kvmppc_core_commit_memory_region(struct kvm *kvm,
1729 } 1828 }
1730} 1829}
1731 1830
1831/*
1832 * Update LPCR values in kvm->arch and in vcores.
1833 * Caller must hold kvm->lock.
1834 */
1835void kvmppc_update_lpcr(struct kvm *kvm, unsigned long lpcr, unsigned long mask)
1836{
1837 long int i;
1838 u32 cores_done = 0;
1839
1840 if ((kvm->arch.lpcr & mask) == lpcr)
1841 return;
1842
1843 kvm->arch.lpcr = (kvm->arch.lpcr & ~mask) | lpcr;
1844
1845 for (i = 0; i < KVM_MAX_VCORES; ++i) {
1846 struct kvmppc_vcore *vc = kvm->arch.vcores[i];
1847 if (!vc)
1848 continue;
1849 spin_lock(&vc->lock);
1850 vc->lpcr = (vc->lpcr & ~mask) | lpcr;
1851 spin_unlock(&vc->lock);
1852 if (++cores_done >= kvm->arch.online_vcores)
1853 break;
1854 }
1855}
1856
1857static void kvmppc_mmu_destroy_hv(struct kvm_vcpu *vcpu)
1858{
1859 return;
1860}
1861
1732static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu) 1862static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
1733{ 1863{
1734 int err = 0; 1864 int err = 0;
@@ -1737,7 +1867,8 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
1737 unsigned long hva; 1867 unsigned long hva;
1738 struct kvm_memory_slot *memslot; 1868 struct kvm_memory_slot *memslot;
1739 struct vm_area_struct *vma; 1869 struct vm_area_struct *vma;
1740 unsigned long lpcr, senc; 1870 unsigned long lpcr = 0, senc;
1871 unsigned long lpcr_mask = 0;
1741 unsigned long psize, porder; 1872 unsigned long psize, porder;
1742 unsigned long rma_size; 1873 unsigned long rma_size;
1743 unsigned long rmls; 1874 unsigned long rmls;
@@ -1802,9 +1933,9 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
1802 senc = slb_pgsize_encoding(psize); 1933 senc = slb_pgsize_encoding(psize);
1803 kvm->arch.vrma_slb_v = senc | SLB_VSID_B_1T | 1934 kvm->arch.vrma_slb_v = senc | SLB_VSID_B_1T |
1804 (VRMA_VSID << SLB_VSID_SHIFT_1T); 1935 (VRMA_VSID << SLB_VSID_SHIFT_1T);
1805 lpcr = kvm->arch.lpcr & ~LPCR_VRMASD; 1936 lpcr_mask = LPCR_VRMASD;
1806 lpcr |= senc << (LPCR_VRMASD_SH - 4); 1937 /* the -4 is to account for senc values starting at 0x10 */
1807 kvm->arch.lpcr = lpcr; 1938 lpcr = senc << (LPCR_VRMASD_SH - 4);
1808 1939
1809 /* Create HPTEs in the hash page table for the VRMA */ 1940 /* Create HPTEs in the hash page table for the VRMA */
1810 kvmppc_map_vrma(vcpu, memslot, porder); 1941 kvmppc_map_vrma(vcpu, memslot, porder);
@@ -1825,23 +1956,21 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
1825 kvm->arch.rma = ri; 1956 kvm->arch.rma = ri;
1826 1957
1827 /* Update LPCR and RMOR */ 1958 /* Update LPCR and RMOR */
1828 lpcr = kvm->arch.lpcr;
1829 if (cpu_has_feature(CPU_FTR_ARCH_201)) { 1959 if (cpu_has_feature(CPU_FTR_ARCH_201)) {
1830 /* PPC970; insert RMLS value (split field) in HID4 */ 1960 /* PPC970; insert RMLS value (split field) in HID4 */
1831 lpcr &= ~((1ul << HID4_RMLS0_SH) | 1961 lpcr_mask = (1ul << HID4_RMLS0_SH) |
1832 (3ul << HID4_RMLS2_SH)); 1962 (3ul << HID4_RMLS2_SH) | HID4_RMOR;
1833 lpcr |= ((rmls >> 2) << HID4_RMLS0_SH) | 1963 lpcr = ((rmls >> 2) << HID4_RMLS0_SH) |
1834 ((rmls & 3) << HID4_RMLS2_SH); 1964 ((rmls & 3) << HID4_RMLS2_SH);
1835 /* RMOR is also in HID4 */ 1965 /* RMOR is also in HID4 */
1836 lpcr |= ((ri->base_pfn >> (26 - PAGE_SHIFT)) & 0xffff) 1966 lpcr |= ((ri->base_pfn >> (26 - PAGE_SHIFT)) & 0xffff)
1837 << HID4_RMOR_SH; 1967 << HID4_RMOR_SH;
1838 } else { 1968 } else {
1839 /* POWER7 */ 1969 /* POWER7 */
1840 lpcr &= ~(LPCR_VPM0 | LPCR_VRMA_L); 1970 lpcr_mask = LPCR_VPM0 | LPCR_VRMA_L | LPCR_RMLS;
1841 lpcr |= rmls << LPCR_RMLS_SH; 1971 lpcr = rmls << LPCR_RMLS_SH;
1842 kvm->arch.rmor = ri->base_pfn << PAGE_SHIFT; 1972 kvm->arch.rmor = ri->base_pfn << PAGE_SHIFT;
1843 } 1973 }
1844 kvm->arch.lpcr = lpcr;
1845 pr_info("KVM: Using RMO at %lx size %lx (LPCR = %lx)\n", 1974 pr_info("KVM: Using RMO at %lx size %lx (LPCR = %lx)\n",
1846 ri->base_pfn << PAGE_SHIFT, rma_size, lpcr); 1975 ri->base_pfn << PAGE_SHIFT, rma_size, lpcr);
1847 1976
@@ -1860,6 +1989,8 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
1860 } 1989 }
1861 } 1990 }
1862 1991
1992 kvmppc_update_lpcr(kvm, lpcr, lpcr_mask);
1993
1863 /* Order updates to kvm->arch.lpcr etc. vs. rma_setup_done */ 1994 /* Order updates to kvm->arch.lpcr etc. vs. rma_setup_done */
1864 smp_wmb(); 1995 smp_wmb();
1865 kvm->arch.rma_setup_done = 1; 1996 kvm->arch.rma_setup_done = 1;
@@ -1875,7 +2006,7 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
1875 goto out_srcu; 2006 goto out_srcu;
1876} 2007}
1877 2008
1878int kvmppc_core_init_vm(struct kvm *kvm) 2009static int kvmppc_core_init_vm_hv(struct kvm *kvm)
1879{ 2010{
1880 unsigned long lpcr, lpid; 2011 unsigned long lpcr, lpid;
1881 2012
@@ -1893,9 +2024,6 @@ int kvmppc_core_init_vm(struct kvm *kvm)
1893 */ 2024 */
1894 cpumask_setall(&kvm->arch.need_tlb_flush); 2025 cpumask_setall(&kvm->arch.need_tlb_flush);
1895 2026
1896 INIT_LIST_HEAD(&kvm->arch.spapr_tce_tables);
1897 INIT_LIST_HEAD(&kvm->arch.rtas_tokens);
1898
1899 kvm->arch.rma = NULL; 2027 kvm->arch.rma = NULL;
1900 2028
1901 kvm->arch.host_sdr1 = mfspr(SPRN_SDR1); 2029 kvm->arch.host_sdr1 = mfspr(SPRN_SDR1);
@@ -1931,61 +2059,162 @@ int kvmppc_core_init_vm(struct kvm *kvm)
1931 return 0; 2059 return 0;
1932} 2060}
1933 2061
1934void kvmppc_core_destroy_vm(struct kvm *kvm) 2062static void kvmppc_free_vcores(struct kvm *kvm)
2063{
2064 long int i;
2065
2066 for (i = 0; i < KVM_MAX_VCORES; ++i)
2067 kfree(kvm->arch.vcores[i]);
2068 kvm->arch.online_vcores = 0;
2069}
2070
2071static void kvmppc_core_destroy_vm_hv(struct kvm *kvm)
1935{ 2072{
1936 uninhibit_secondary_onlining(); 2073 uninhibit_secondary_onlining();
1937 2074
2075 kvmppc_free_vcores(kvm);
1938 if (kvm->arch.rma) { 2076 if (kvm->arch.rma) {
1939 kvm_release_rma(kvm->arch.rma); 2077 kvm_release_rma(kvm->arch.rma);
1940 kvm->arch.rma = NULL; 2078 kvm->arch.rma = NULL;
1941 } 2079 }
1942 2080
1943 kvmppc_rtas_tokens_free(kvm);
1944
1945 kvmppc_free_hpt(kvm); 2081 kvmppc_free_hpt(kvm);
1946 WARN_ON(!list_empty(&kvm->arch.spapr_tce_tables));
1947} 2082}
1948 2083
1949/* These are stubs for now */ 2084/* We don't need to emulate any privileged instructions or dcbz */
1950void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, ulong pa_start, ulong pa_end) 2085static int kvmppc_core_emulate_op_hv(struct kvm_run *run, struct kvm_vcpu *vcpu,
2086 unsigned int inst, int *advance)
1951{ 2087{
2088 return EMULATE_FAIL;
1952} 2089}
1953 2090
1954/* We don't need to emulate any privileged instructions or dcbz */ 2091static int kvmppc_core_emulate_mtspr_hv(struct kvm_vcpu *vcpu, int sprn,
1955int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, 2092 ulong spr_val)
1956 unsigned int inst, int *advance)
1957{ 2093{
1958 return EMULATE_FAIL; 2094 return EMULATE_FAIL;
1959} 2095}
1960 2096
1961int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val) 2097static int kvmppc_core_emulate_mfspr_hv(struct kvm_vcpu *vcpu, int sprn,
2098 ulong *spr_val)
1962{ 2099{
1963 return EMULATE_FAIL; 2100 return EMULATE_FAIL;
1964} 2101}
1965 2102
1966int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val) 2103static int kvmppc_core_check_processor_compat_hv(void)
1967{ 2104{
1968 return EMULATE_FAIL; 2105 if (!cpu_has_feature(CPU_FTR_HVMODE))
2106 return -EIO;
2107 return 0;
1969} 2108}
1970 2109
1971static int kvmppc_book3s_hv_init(void) 2110static long kvm_arch_vm_ioctl_hv(struct file *filp,
2111 unsigned int ioctl, unsigned long arg)
1972{ 2112{
1973 int r; 2113 struct kvm *kvm __maybe_unused = filp->private_data;
2114 void __user *argp = (void __user *)arg;
2115 long r;
1974 2116
1975 r = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE); 2117 switch (ioctl) {
1976 2118
1977 if (r) 2119 case KVM_ALLOCATE_RMA: {
2120 struct kvm_allocate_rma rma;
2121 struct kvm *kvm = filp->private_data;
2122
2123 r = kvm_vm_ioctl_allocate_rma(kvm, &rma);
2124 if (r >= 0 && copy_to_user(argp, &rma, sizeof(rma)))
2125 r = -EFAULT;
2126 break;
2127 }
2128
2129 case KVM_PPC_ALLOCATE_HTAB: {
2130 u32 htab_order;
2131
2132 r = -EFAULT;
2133 if (get_user(htab_order, (u32 __user *)argp))
2134 break;
2135 r = kvmppc_alloc_reset_hpt(kvm, &htab_order);
2136 if (r)
2137 break;
2138 r = -EFAULT;
2139 if (put_user(htab_order, (u32 __user *)argp))
2140 break;
2141 r = 0;
2142 break;
2143 }
2144
2145 case KVM_PPC_GET_HTAB_FD: {
2146 struct kvm_get_htab_fd ghf;
2147
2148 r = -EFAULT;
2149 if (copy_from_user(&ghf, argp, sizeof(ghf)))
2150 break;
2151 r = kvm_vm_ioctl_get_htab_fd(kvm, &ghf);
2152 break;
2153 }
2154
2155 default:
2156 r = -ENOTTY;
2157 }
2158
2159 return r;
2160}
2161
2162static struct kvmppc_ops kvm_ops_hv = {
2163 .get_sregs = kvm_arch_vcpu_ioctl_get_sregs_hv,
2164 .set_sregs = kvm_arch_vcpu_ioctl_set_sregs_hv,
2165 .get_one_reg = kvmppc_get_one_reg_hv,
2166 .set_one_reg = kvmppc_set_one_reg_hv,
2167 .vcpu_load = kvmppc_core_vcpu_load_hv,
2168 .vcpu_put = kvmppc_core_vcpu_put_hv,
2169 .set_msr = kvmppc_set_msr_hv,
2170 .vcpu_run = kvmppc_vcpu_run_hv,
2171 .vcpu_create = kvmppc_core_vcpu_create_hv,
2172 .vcpu_free = kvmppc_core_vcpu_free_hv,
2173 .check_requests = kvmppc_core_check_requests_hv,
2174 .get_dirty_log = kvm_vm_ioctl_get_dirty_log_hv,
2175 .flush_memslot = kvmppc_core_flush_memslot_hv,
2176 .prepare_memory_region = kvmppc_core_prepare_memory_region_hv,
2177 .commit_memory_region = kvmppc_core_commit_memory_region_hv,
2178 .unmap_hva = kvm_unmap_hva_hv,
2179 .unmap_hva_range = kvm_unmap_hva_range_hv,
2180 .age_hva = kvm_age_hva_hv,
2181 .test_age_hva = kvm_test_age_hva_hv,
2182 .set_spte_hva = kvm_set_spte_hva_hv,
2183 .mmu_destroy = kvmppc_mmu_destroy_hv,
2184 .free_memslot = kvmppc_core_free_memslot_hv,
2185 .create_memslot = kvmppc_core_create_memslot_hv,
2186 .init_vm = kvmppc_core_init_vm_hv,
2187 .destroy_vm = kvmppc_core_destroy_vm_hv,
2188 .get_smmu_info = kvm_vm_ioctl_get_smmu_info_hv,
2189 .emulate_op = kvmppc_core_emulate_op_hv,
2190 .emulate_mtspr = kvmppc_core_emulate_mtspr_hv,
2191 .emulate_mfspr = kvmppc_core_emulate_mfspr_hv,
2192 .fast_vcpu_kick = kvmppc_fast_vcpu_kick_hv,
2193 .arch_vm_ioctl = kvm_arch_vm_ioctl_hv,
2194};
2195
2196static int kvmppc_book3s_init_hv(void)
2197{
2198 int r;
2199 /*
2200 * FIXME!! Do we need to check on all cpus ?
2201 */
2202 r = kvmppc_core_check_processor_compat_hv();
2203 if (r < 0)
1978 return r; 2204 return r;
1979 2205
1980 r = kvmppc_mmu_hv_init(); 2206 kvm_ops_hv.owner = THIS_MODULE;
2207 kvmppc_hv_ops = &kvm_ops_hv;
1981 2208
2209 r = kvmppc_mmu_hv_init();
1982 return r; 2210 return r;
1983} 2211}
1984 2212
1985static void kvmppc_book3s_hv_exit(void) 2213static void kvmppc_book3s_exit_hv(void)
1986{ 2214{
1987 kvm_exit(); 2215 kvmppc_hv_ops = NULL;
1988} 2216}
1989 2217
1990module_init(kvmppc_book3s_hv_init); 2218module_init(kvmppc_book3s_init_hv);
1991module_exit(kvmppc_book3s_hv_exit); 2219module_exit(kvmppc_book3s_exit_hv);
2220MODULE_LICENSE("GPL");
diff --git a/arch/powerpc/kvm/book3s_hv_interrupts.S b/arch/powerpc/kvm/book3s_hv_interrupts.S
index 37f1cc417ca0..928142c64cb0 100644
--- a/arch/powerpc/kvm/book3s_hv_interrupts.S
+++ b/arch/powerpc/kvm/book3s_hv_interrupts.S
@@ -158,9 +158,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
158 * Interrupts are enabled again at this point. 158 * Interrupts are enabled again at this point.
159 */ 159 */
160 160
161.global kvmppc_handler_highmem
162kvmppc_handler_highmem:
163
164 /* 161 /*
165 * Register usage at this point: 162 * Register usage at this point:
166 * 163 *
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 294b7af28cdd..bc8de75b1925 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -33,30 +33,6 @@
33#error Need to fix lppaca and SLB shadow accesses in little endian mode 33#error Need to fix lppaca and SLB shadow accesses in little endian mode
34#endif 34#endif
35 35
36/*****************************************************************************
37 * *
38 * Real Mode handlers that need to be in the linear mapping *
39 * *
40 ****************************************************************************/
41
42 .globl kvmppc_skip_interrupt
43kvmppc_skip_interrupt:
44 mfspr r13,SPRN_SRR0
45 addi r13,r13,4
46 mtspr SPRN_SRR0,r13
47 GET_SCRATCH0(r13)
48 rfid
49 b .
50
51 .globl kvmppc_skip_Hinterrupt
52kvmppc_skip_Hinterrupt:
53 mfspr r13,SPRN_HSRR0
54 addi r13,r13,4
55 mtspr SPRN_HSRR0,r13
56 GET_SCRATCH0(r13)
57 hrfid
58 b .
59
60/* 36/*
61 * Call kvmppc_hv_entry in real mode. 37 * Call kvmppc_hv_entry in real mode.
62 * Must be called with interrupts hard-disabled. 38 * Must be called with interrupts hard-disabled.
@@ -66,8 +42,11 @@ kvmppc_skip_Hinterrupt:
66 * LR = return address to continue at after eventually re-enabling MMU 42 * LR = return address to continue at after eventually re-enabling MMU
67 */ 43 */
68_GLOBAL(kvmppc_hv_entry_trampoline) 44_GLOBAL(kvmppc_hv_entry_trampoline)
45 mflr r0
46 std r0, PPC_LR_STKOFF(r1)
47 stdu r1, -112(r1)
69 mfmsr r10 48 mfmsr r10
70 LOAD_REG_ADDR(r5, kvmppc_hv_entry) 49 LOAD_REG_ADDR(r5, kvmppc_call_hv_entry)
71 li r0,MSR_RI 50 li r0,MSR_RI
72 andc r0,r10,r0 51 andc r0,r10,r0
73 li r6,MSR_IR | MSR_DR 52 li r6,MSR_IR | MSR_DR
@@ -77,11 +56,103 @@ _GLOBAL(kvmppc_hv_entry_trampoline)
77 mtsrr1 r6 56 mtsrr1 r6
78 RFI 57 RFI
79 58
80/****************************************************************************** 59kvmppc_call_hv_entry:
81 * * 60 bl kvmppc_hv_entry
82 * Entry code * 61
83 * * 62 /* Back from guest - restore host state and return to caller */
84 *****************************************************************************/ 63
64 /* Restore host DABR and DABRX */
65 ld r5,HSTATE_DABR(r13)
66 li r6,7
67 mtspr SPRN_DABR,r5
68 mtspr SPRN_DABRX,r6
69
70 /* Restore SPRG3 */
71 ld r3,PACA_SPRG3(r13)
72 mtspr SPRN_SPRG3,r3
73
74 /*
75 * Reload DEC. HDEC interrupts were disabled when
76 * we reloaded the host's LPCR value.
77 */
78 ld r3, HSTATE_DECEXP(r13)
79 mftb r4
80 subf r4, r4, r3
81 mtspr SPRN_DEC, r4
82
83 /* Reload the host's PMU registers */
84 ld r3, PACALPPACAPTR(r13) /* is the host using the PMU? */
85 lbz r4, LPPACA_PMCINUSE(r3)
86 cmpwi r4, 0
87 beq 23f /* skip if not */
88 lwz r3, HSTATE_PMC(r13)
89 lwz r4, HSTATE_PMC + 4(r13)
90 lwz r5, HSTATE_PMC + 8(r13)
91 lwz r6, HSTATE_PMC + 12(r13)
92 lwz r8, HSTATE_PMC + 16(r13)
93 lwz r9, HSTATE_PMC + 20(r13)
94BEGIN_FTR_SECTION
95 lwz r10, HSTATE_PMC + 24(r13)
96 lwz r11, HSTATE_PMC + 28(r13)
97END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
98 mtspr SPRN_PMC1, r3
99 mtspr SPRN_PMC2, r4
100 mtspr SPRN_PMC3, r5
101 mtspr SPRN_PMC4, r6
102 mtspr SPRN_PMC5, r8
103 mtspr SPRN_PMC6, r9
104BEGIN_FTR_SECTION
105 mtspr SPRN_PMC7, r10
106 mtspr SPRN_PMC8, r11
107END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
108 ld r3, HSTATE_MMCR(r13)
109 ld r4, HSTATE_MMCR + 8(r13)
110 ld r5, HSTATE_MMCR + 16(r13)
111 mtspr SPRN_MMCR1, r4
112 mtspr SPRN_MMCRA, r5
113 mtspr SPRN_MMCR0, r3
114 isync
11523:
116
117 /*
118 * For external and machine check interrupts, we need
119 * to call the Linux handler to process the interrupt.
120 * We do that by jumping to absolute address 0x500 for
121 * external interrupts, or the machine_check_fwnmi label
122 * for machine checks (since firmware might have patched
123 * the vector area at 0x200). The [h]rfid at the end of the
124 * handler will return to the book3s_hv_interrupts.S code.
125 * For other interrupts we do the rfid to get back
126 * to the book3s_hv_interrupts.S code here.
127 */
128 ld r8, 112+PPC_LR_STKOFF(r1)
129 addi r1, r1, 112
130 ld r7, HSTATE_HOST_MSR(r13)
131
132 cmpwi cr1, r12, BOOK3S_INTERRUPT_MACHINE_CHECK
133 cmpwi r12, BOOK3S_INTERRUPT_EXTERNAL
134BEGIN_FTR_SECTION
135 beq 11f
136END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
137
138 /* RFI into the highmem handler, or branch to interrupt handler */
139 mfmsr r6
140 li r0, MSR_RI
141 andc r6, r6, r0
142 mtmsrd r6, 1 /* Clear RI in MSR */
143 mtsrr0 r8
144 mtsrr1 r7
145 beqa 0x500 /* external interrupt (PPC970) */
146 beq cr1, 13f /* machine check */
147 RFI
148
149 /* On POWER7, we have external interrupts set to use HSRR0/1 */
15011: mtspr SPRN_HSRR0, r8
151 mtspr SPRN_HSRR1, r7
152 ba 0x500
153
15413: b machine_check_fwnmi
155
85 156
86/* 157/*
87 * We come in here when wakened from nap mode on a secondary hw thread. 158 * We come in here when wakened from nap mode on a secondary hw thread.
@@ -137,7 +208,7 @@ kvm_start_guest:
137 cmpdi r4,0 208 cmpdi r4,0
138 /* if we have no vcpu to run, go back to sleep */ 209 /* if we have no vcpu to run, go back to sleep */
139 beq kvm_no_guest 210 beq kvm_no_guest
140 b kvmppc_hv_entry 211 b 30f
141 212
14227: /* XXX should handle hypervisor maintenance interrupts etc. here */ 21327: /* XXX should handle hypervisor maintenance interrupts etc. here */
143 b kvm_no_guest 214 b kvm_no_guest
@@ -147,6 +218,57 @@ kvm_start_guest:
147 stw r8,HSTATE_SAVED_XIRR(r13) 218 stw r8,HSTATE_SAVED_XIRR(r13)
148 b kvm_no_guest 219 b kvm_no_guest
149 220
22130: bl kvmppc_hv_entry
222
223 /* Back from the guest, go back to nap */
224 /* Clear our vcpu pointer so we don't come back in early */
225 li r0, 0
226 std r0, HSTATE_KVM_VCPU(r13)
227 lwsync
228 /* Clear any pending IPI - we're an offline thread */
229 ld r5, HSTATE_XICS_PHYS(r13)
230 li r7, XICS_XIRR
231 lwzcix r3, r5, r7 /* ack any pending interrupt */
232 rlwinm. r0, r3, 0, 0xffffff /* any pending? */
233 beq 37f
234 sync
235 li r0, 0xff
236 li r6, XICS_MFRR
237 stbcix r0, r5, r6 /* clear the IPI */
238 stwcix r3, r5, r7 /* EOI it */
23937: sync
240
241 /* increment the nap count and then go to nap mode */
242 ld r4, HSTATE_KVM_VCORE(r13)
243 addi r4, r4, VCORE_NAP_COUNT
244 lwsync /* make previous updates visible */
24551: lwarx r3, 0, r4
246 addi r3, r3, 1
247 stwcx. r3, 0, r4
248 bne 51b
249
250kvm_no_guest:
251 li r0, KVM_HWTHREAD_IN_NAP
252 stb r0, HSTATE_HWTHREAD_STATE(r13)
253 li r3, LPCR_PECE0
254 mfspr r4, SPRN_LPCR
255 rlwimi r4, r3, 0, LPCR_PECE0 | LPCR_PECE1
256 mtspr SPRN_LPCR, r4
257 isync
258 std r0, HSTATE_SCRATCH0(r13)
259 ptesync
260 ld r0, HSTATE_SCRATCH0(r13)
2611: cmpd r0, r0
262 bne 1b
263 nap
264 b .
265
266/******************************************************************************
267 * *
268 * Entry code *
269 * *
270 *****************************************************************************/
271
150.global kvmppc_hv_entry 272.global kvmppc_hv_entry
151kvmppc_hv_entry: 273kvmppc_hv_entry:
152 274
@@ -159,7 +281,8 @@ kvmppc_hv_entry:
159 * all other volatile GPRS = free 281 * all other volatile GPRS = free
160 */ 282 */
161 mflr r0 283 mflr r0
162 std r0, HSTATE_VMHANDLER(r13) 284 std r0, PPC_LR_STKOFF(r1)
285 stdu r1, -112(r1)
163 286
164 /* Set partition DABR */ 287 /* Set partition DABR */
165 /* Do this before re-enabling PMU to avoid P7 DABR corruption bug */ 288 /* Do this before re-enabling PMU to avoid P7 DABR corruption bug */
@@ -200,8 +323,12 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
200 ld r3, VCPU_MMCR(r4) 323 ld r3, VCPU_MMCR(r4)
201 ld r5, VCPU_MMCR + 8(r4) 324 ld r5, VCPU_MMCR + 8(r4)
202 ld r6, VCPU_MMCR + 16(r4) 325 ld r6, VCPU_MMCR + 16(r4)
326 ld r7, VCPU_SIAR(r4)
327 ld r8, VCPU_SDAR(r4)
203 mtspr SPRN_MMCR1, r5 328 mtspr SPRN_MMCR1, r5
204 mtspr SPRN_MMCRA, r6 329 mtspr SPRN_MMCRA, r6
330 mtspr SPRN_SIAR, r7
331 mtspr SPRN_SDAR, r8
205 mtspr SPRN_MMCR0, r3 332 mtspr SPRN_MMCR0, r3
206 isync 333 isync
207 334
@@ -254,22 +381,15 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
254 /* Save R1 in the PACA */ 381 /* Save R1 in the PACA */
255 std r1, HSTATE_HOST_R1(r13) 382 std r1, HSTATE_HOST_R1(r13)
256 383
257 /* Increment yield count if they have a VPA */
258 ld r3, VCPU_VPA(r4)
259 cmpdi r3, 0
260 beq 25f
261 lwz r5, LPPACA_YIELDCOUNT(r3)
262 addi r5, r5, 1
263 stw r5, LPPACA_YIELDCOUNT(r3)
264 li r6, 1
265 stb r6, VCPU_VPA_DIRTY(r4)
26625:
267 /* Load up DAR and DSISR */ 384 /* Load up DAR and DSISR */
268 ld r5, VCPU_DAR(r4) 385 ld r5, VCPU_DAR(r4)
269 lwz r6, VCPU_DSISR(r4) 386 lwz r6, VCPU_DSISR(r4)
270 mtspr SPRN_DAR, r5 387 mtspr SPRN_DAR, r5
271 mtspr SPRN_DSISR, r6 388 mtspr SPRN_DSISR, r6
272 389
390 li r6, KVM_GUEST_MODE_HOST_HV
391 stb r6, HSTATE_IN_GUEST(r13)
392
273BEGIN_FTR_SECTION 393BEGIN_FTR_SECTION
274 /* Restore AMR and UAMOR, set AMOR to all 1s */ 394 /* Restore AMR and UAMOR, set AMOR to all 1s */
275 ld r5,VCPU_AMR(r4) 395 ld r5,VCPU_AMR(r4)
@@ -343,7 +463,28 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
343 bdnz 28b 463 bdnz 28b
344 ptesync 464 ptesync
345 465
34622: li r0,1 466 /* Add timebase offset onto timebase */
46722: ld r8,VCORE_TB_OFFSET(r5)
468 cmpdi r8,0
469 beq 37f
470 mftb r6 /* current host timebase */
471 add r8,r8,r6
472 mtspr SPRN_TBU40,r8 /* update upper 40 bits */
473 mftb r7 /* check if lower 24 bits overflowed */
474 clrldi r6,r6,40
475 clrldi r7,r7,40
476 cmpld r7,r6
477 bge 37f
478 addis r8,r8,0x100 /* if so, increment upper 40 bits */
479 mtspr SPRN_TBU40,r8
480
481 /* Load guest PCR value to select appropriate compat mode */
48237: ld r7, VCORE_PCR(r5)
483 cmpdi r7, 0
484 beq 38f
485 mtspr SPRN_PCR, r7
48638:
487 li r0,1
347 stb r0,VCORE_IN_GUEST(r5) /* signal secondaries to continue */ 488 stb r0,VCORE_IN_GUEST(r5) /* signal secondaries to continue */
348 b 10f 489 b 10f
349 490
@@ -353,12 +494,22 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
353 beq 20b 494 beq 20b
354 495
355 /* Set LPCR and RMOR. */ 496 /* Set LPCR and RMOR. */
35610: ld r8,KVM_LPCR(r9) 49710: ld r8,VCORE_LPCR(r5)
357 mtspr SPRN_LPCR,r8 498 mtspr SPRN_LPCR,r8
358 ld r8,KVM_RMOR(r9) 499 ld r8,KVM_RMOR(r9)
359 mtspr SPRN_RMOR,r8 500 mtspr SPRN_RMOR,r8
360 isync 501 isync
361 502
503 /* Increment yield count if they have a VPA */
504 ld r3, VCPU_VPA(r4)
505 cmpdi r3, 0
506 beq 25f
507 lwz r5, LPPACA_YIELDCOUNT(r3)
508 addi r5, r5, 1
509 stw r5, LPPACA_YIELDCOUNT(r3)
510 li r6, 1
511 stb r6, VCPU_VPA_DIRTY(r4)
51225:
362 /* Check if HDEC expires soon */ 513 /* Check if HDEC expires soon */
363 mfspr r3,SPRN_HDEC 514 mfspr r3,SPRN_HDEC
364 cmpwi r3,10 515 cmpwi r3,10
@@ -405,7 +556,8 @@ toc_tlbie_lock:
405 bne 24b 556 bne 24b
406 isync 557 isync
407 558
408 ld r7,KVM_LPCR(r9) /* use kvm->arch.lpcr to store HID4 */ 559 ld r5,HSTATE_KVM_VCORE(r13)
560 ld r7,VCORE_LPCR(r5) /* use vcore->lpcr to store HID4 */
409 li r0,0x18f 561 li r0,0x18f
410 rotldi r0,r0,HID4_LPID5_SH /* all lpid bits in HID4 = 1 */ 562 rotldi r0,r0,HID4_LPID5_SH /* all lpid bits in HID4 = 1 */
411 or r0,r7,r0 563 or r0,r7,r0
@@ -541,7 +693,7 @@ fast_guest_return:
541 mtspr SPRN_HSRR1,r11 693 mtspr SPRN_HSRR1,r11
542 694
543 /* Activate guest mode, so faults get handled by KVM */ 695 /* Activate guest mode, so faults get handled by KVM */
544 li r9, KVM_GUEST_MODE_GUEST 696 li r9, KVM_GUEST_MODE_GUEST_HV
545 stb r9, HSTATE_IN_GUEST(r13) 697 stb r9, HSTATE_IN_GUEST(r13)
546 698
547 /* Enter guest */ 699 /* Enter guest */
@@ -550,13 +702,15 @@ BEGIN_FTR_SECTION
550 ld r5, VCPU_CFAR(r4) 702 ld r5, VCPU_CFAR(r4)
551 mtspr SPRN_CFAR, r5 703 mtspr SPRN_CFAR, r5
552END_FTR_SECTION_IFSET(CPU_FTR_CFAR) 704END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
705BEGIN_FTR_SECTION
706 ld r0, VCPU_PPR(r4)
707END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
553 708
554 ld r5, VCPU_LR(r4) 709 ld r5, VCPU_LR(r4)
555 lwz r6, VCPU_CR(r4) 710 lwz r6, VCPU_CR(r4)
556 mtlr r5 711 mtlr r5
557 mtcr r6 712 mtcr r6
558 713
559 ld r0, VCPU_GPR(R0)(r4)
560 ld r1, VCPU_GPR(R1)(r4) 714 ld r1, VCPU_GPR(R1)(r4)
561 ld r2, VCPU_GPR(R2)(r4) 715 ld r2, VCPU_GPR(R2)(r4)
562 ld r3, VCPU_GPR(R3)(r4) 716 ld r3, VCPU_GPR(R3)(r4)
@@ -570,6 +724,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
570 ld r12, VCPU_GPR(R12)(r4) 724 ld r12, VCPU_GPR(R12)(r4)
571 ld r13, VCPU_GPR(R13)(r4) 725 ld r13, VCPU_GPR(R13)(r4)
572 726
727BEGIN_FTR_SECTION
728 mtspr SPRN_PPR, r0
729END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
730 ld r0, VCPU_GPR(R0)(r4)
573 ld r4, VCPU_GPR(R4)(r4) 731 ld r4, VCPU_GPR(R4)(r4)
574 732
575 hrfid 733 hrfid
@@ -584,8 +742,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
584/* 742/*
585 * We come here from the first-level interrupt handlers. 743 * We come here from the first-level interrupt handlers.
586 */ 744 */
587 .globl kvmppc_interrupt 745 .globl kvmppc_interrupt_hv
588kvmppc_interrupt: 746kvmppc_interrupt_hv:
589 /* 747 /*
590 * Register contents: 748 * Register contents:
591 * R12 = interrupt vector 749 * R12 = interrupt vector
@@ -595,6 +753,19 @@ kvmppc_interrupt:
595 */ 753 */
596 /* abuse host_r2 as third scratch area; we get r2 from PACATOC(r13) */ 754 /* abuse host_r2 as third scratch area; we get r2 from PACATOC(r13) */
597 std r9, HSTATE_HOST_R2(r13) 755 std r9, HSTATE_HOST_R2(r13)
756
757 lbz r9, HSTATE_IN_GUEST(r13)
758 cmpwi r9, KVM_GUEST_MODE_HOST_HV
759 beq kvmppc_bad_host_intr
760#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
761 cmpwi r9, KVM_GUEST_MODE_GUEST
762 ld r9, HSTATE_HOST_R2(r13)
763 beq kvmppc_interrupt_pr
764#endif
765 /* We're now back in the host but in guest MMU context */
766 li r9, KVM_GUEST_MODE_HOST_HV
767 stb r9, HSTATE_IN_GUEST(r13)
768
598 ld r9, HSTATE_KVM_VCPU(r13) 769 ld r9, HSTATE_KVM_VCPU(r13)
599 770
600 /* Save registers */ 771 /* Save registers */
@@ -620,6 +791,10 @@ BEGIN_FTR_SECTION
620 ld r3, HSTATE_CFAR(r13) 791 ld r3, HSTATE_CFAR(r13)
621 std r3, VCPU_CFAR(r9) 792 std r3, VCPU_CFAR(r9)
622END_FTR_SECTION_IFSET(CPU_FTR_CFAR) 793END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
794BEGIN_FTR_SECTION
795 ld r4, HSTATE_PPR(r13)
796 std r4, VCPU_PPR(r9)
797END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
623 798
624 /* Restore R1/R2 so we can handle faults */ 799 /* Restore R1/R2 so we can handle faults */
625 ld r1, HSTATE_HOST_R1(r13) 800 ld r1, HSTATE_HOST_R1(r13)
@@ -642,10 +817,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
642 std r3, VCPU_GPR(R13)(r9) 817 std r3, VCPU_GPR(R13)(r9)
643 std r4, VCPU_LR(r9) 818 std r4, VCPU_LR(r9)
644 819
645 /* Unset guest mode */
646 li r0, KVM_GUEST_MODE_NONE
647 stb r0, HSTATE_IN_GUEST(r13)
648
649 stw r12,VCPU_TRAP(r9) 820 stw r12,VCPU_TRAP(r9)
650 821
651 /* Save HEIR (HV emulation assist reg) in last_inst 822 /* Save HEIR (HV emulation assist reg) in last_inst
@@ -696,46 +867,11 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)
696 * set, we know the host wants us out so let's do it now 867 * set, we know the host wants us out so let's do it now
697 */ 868 */
698do_ext_interrupt: 869do_ext_interrupt:
699 lbz r0, HSTATE_HOST_IPI(r13) 870 bl kvmppc_read_intr
700 cmpwi r0, 0 871 cmpdi r3, 0
701 bne ext_interrupt_to_host 872 bgt ext_interrupt_to_host
702
703 /* Now read the interrupt from the ICP */
704 ld r5, HSTATE_XICS_PHYS(r13)
705 li r7, XICS_XIRR
706 cmpdi r5, 0
707 beq- ext_interrupt_to_host
708 lwzcix r3, r5, r7
709 rlwinm. r0, r3, 0, 0xffffff
710 sync
711 beq 3f /* if nothing pending in the ICP */
712
713 /* We found something in the ICP...
714 *
715 * If it's not an IPI, stash it in the PACA and return to
716 * the host, we don't (yet) handle directing real external
717 * interrupts directly to the guest
718 */
719 cmpwi r0, XICS_IPI
720 bne ext_stash_for_host
721
722 /* It's an IPI, clear the MFRR and EOI it */
723 li r0, 0xff
724 li r6, XICS_MFRR
725 stbcix r0, r5, r6 /* clear the IPI */
726 stwcix r3, r5, r7 /* EOI it */
727 sync
728
729 /* We need to re-check host IPI now in case it got set in the
730 * meantime. If it's clear, we bounce the interrupt to the
731 * guest
732 */
733 lbz r0, HSTATE_HOST_IPI(r13)
734 cmpwi r0, 0
735 bne- 1f
736 873
737 /* Allright, looks like an IPI for the guest, we need to set MER */ 874 /* Allright, looks like an IPI for the guest, we need to set MER */
7383:
739 /* Check if any CPU is heading out to the host, if so head out too */ 875 /* Check if any CPU is heading out to the host, if so head out too */
740 ld r5, HSTATE_KVM_VCORE(r13) 876 ld r5, HSTATE_KVM_VCORE(r13)
741 lwz r0, VCORE_ENTRY_EXIT(r5) 877 lwz r0, VCORE_ENTRY_EXIT(r5)
@@ -764,27 +900,9 @@ do_ext_interrupt:
764 mtspr SPRN_LPCR, r8 900 mtspr SPRN_LPCR, r8
765 b fast_guest_return 901 b fast_guest_return
766 902
767 /* We raced with the host, we need to resend that IPI, bummer */
7681: li r0, IPI_PRIORITY
769 stbcix r0, r5, r6 /* set the IPI */
770 sync
771 b ext_interrupt_to_host
772
773ext_stash_for_host:
774 /* It's not an IPI and it's for the host, stash it in the PACA
775 * before exit, it will be picked up by the host ICP driver
776 */
777 stw r3, HSTATE_SAVED_XIRR(r13)
778ext_interrupt_to_host: 903ext_interrupt_to_host:
779 904
780guest_exit_cont: /* r9 = vcpu, r12 = trap, r13 = paca */ 905guest_exit_cont: /* r9 = vcpu, r12 = trap, r13 = paca */
781 /* Save DEC */
782 mfspr r5,SPRN_DEC
783 mftb r6
784 extsw r5,r5
785 add r5,r5,r6
786 std r5,VCPU_DEC_EXPIRES(r9)
787
788 /* Save more register state */ 906 /* Save more register state */
789 mfdar r6 907 mfdar r6
790 mfdsisr r7 908 mfdsisr r7
@@ -954,7 +1072,30 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
954 mtspr SPRN_SDR1,r6 /* switch to partition page table */ 1072 mtspr SPRN_SDR1,r6 /* switch to partition page table */
955 mtspr SPRN_LPID,r7 1073 mtspr SPRN_LPID,r7
956 isync 1074 isync
957 li r0,0 1075
1076 /* Subtract timebase offset from timebase */
1077 ld r8,VCORE_TB_OFFSET(r5)
1078 cmpdi r8,0
1079 beq 17f
1080 mftb r6 /* current host timebase */
1081 subf r8,r8,r6
1082 mtspr SPRN_TBU40,r8 /* update upper 40 bits */
1083 mftb r7 /* check if lower 24 bits overflowed */
1084 clrldi r6,r6,40
1085 clrldi r7,r7,40
1086 cmpld r7,r6
1087 bge 17f
1088 addis r8,r8,0x100 /* if so, increment upper 40 bits */
1089 mtspr SPRN_TBU40,r8
1090
1091 /* Reset PCR */
109217: ld r0, VCORE_PCR(r5)
1093 cmpdi r0, 0
1094 beq 18f
1095 li r0, 0
1096 mtspr SPRN_PCR, r0
109718:
1098 /* Signal secondary CPUs to continue */
958 stb r0,VCORE_IN_GUEST(r5) 1099 stb r0,VCORE_IN_GUEST(r5)
959 lis r8,0x7fff /* MAX_INT@h */ 1100 lis r8,0x7fff /* MAX_INT@h */
960 mtspr SPRN_HDEC,r8 1101 mtspr SPRN_HDEC,r8
@@ -1052,6 +1193,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
10521: addi r8,r8,16 11931: addi r8,r8,16
1053 .endr 1194 .endr
1054 1195
1196 /* Save DEC */
1197 mfspr r5,SPRN_DEC
1198 mftb r6
1199 extsw r5,r5
1200 add r5,r5,r6
1201 std r5,VCPU_DEC_EXPIRES(r9)
1202
1055 /* Save and reset AMR and UAMOR before turning on the MMU */ 1203 /* Save and reset AMR and UAMOR before turning on the MMU */
1056BEGIN_FTR_SECTION 1204BEGIN_FTR_SECTION
1057 mfspr r5,SPRN_AMR 1205 mfspr r5,SPRN_AMR
@@ -1062,11 +1210,15 @@ BEGIN_FTR_SECTION
1062 mtspr SPRN_AMR,r6 1210 mtspr SPRN_AMR,r6
1063END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) 1211END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1064 1212
1213 /* Unset guest mode */
1214 li r0, KVM_GUEST_MODE_NONE
1215 stb r0, HSTATE_IN_GUEST(r13)
1216
1065 /* Switch DSCR back to host value */ 1217 /* Switch DSCR back to host value */
1066BEGIN_FTR_SECTION 1218BEGIN_FTR_SECTION
1067 mfspr r8, SPRN_DSCR 1219 mfspr r8, SPRN_DSCR
1068 ld r7, HSTATE_DSCR(r13) 1220 ld r7, HSTATE_DSCR(r13)
1069 std r8, VCPU_DSCR(r7) 1221 std r8, VCPU_DSCR(r9)
1070 mtspr SPRN_DSCR, r7 1222 mtspr SPRN_DSCR, r7
1071END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) 1223END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1072 1224
@@ -1134,9 +1286,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1134 std r3, VCPU_MMCR(r9) /* if not, set saved MMCR0 to FC */ 1286 std r3, VCPU_MMCR(r9) /* if not, set saved MMCR0 to FC */
1135 b 22f 1287 b 22f
113621: mfspr r5, SPRN_MMCR1 128821: mfspr r5, SPRN_MMCR1
1289 mfspr r7, SPRN_SIAR
1290 mfspr r8, SPRN_SDAR
1137 std r4, VCPU_MMCR(r9) 1291 std r4, VCPU_MMCR(r9)
1138 std r5, VCPU_MMCR + 8(r9) 1292 std r5, VCPU_MMCR + 8(r9)
1139 std r6, VCPU_MMCR + 16(r9) 1293 std r6, VCPU_MMCR + 16(r9)
1294 std r7, VCPU_SIAR(r9)
1295 std r8, VCPU_SDAR(r9)
1140 mfspr r3, SPRN_PMC1 1296 mfspr r3, SPRN_PMC1
1141 mfspr r4, SPRN_PMC2 1297 mfspr r4, SPRN_PMC2
1142 mfspr r5, SPRN_PMC3 1298 mfspr r5, SPRN_PMC3
@@ -1158,103 +1314,30 @@ BEGIN_FTR_SECTION
1158 stw r11, VCPU_PMC + 28(r9) 1314 stw r11, VCPU_PMC + 28(r9)
1159END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) 1315END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
116022: 131622:
1317 ld r0, 112+PPC_LR_STKOFF(r1)
1318 addi r1, r1, 112
1319 mtlr r0
1320 blr
1321secondary_too_late:
1322 ld r5,HSTATE_KVM_VCORE(r13)
1323 HMT_LOW
132413: lbz r3,VCORE_IN_GUEST(r5)
1325 cmpwi r3,0
1326 bne 13b
1327 HMT_MEDIUM
1328 li r0, KVM_GUEST_MODE_NONE
1329 stb r0, HSTATE_IN_GUEST(r13)
1330 ld r11,PACA_SLBSHADOWPTR(r13)
1161 1331
1162 /* Secondary threads go off to take a nap on POWER7 */ 1332 .rept SLB_NUM_BOLTED
1163BEGIN_FTR_SECTION 1333 ld r5,SLBSHADOW_SAVEAREA(r11)
1164 lwz r0,VCPU_PTID(r9) 1334 ld r6,SLBSHADOW_SAVEAREA+8(r11)
1165 cmpwi r0,0 1335 andis. r7,r5,SLB_ESID_V@h
1166 bne secondary_nap 1336 beq 1f
1167END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) 1337 slbmte r6,r5
1168 13381: addi r11,r11,16
1169 /* Restore host DABR and DABRX */ 1339 .endr
1170 ld r5,HSTATE_DABR(r13) 1340 b 22b
1171 li r6,7
1172 mtspr SPRN_DABR,r5
1173 mtspr SPRN_DABRX,r6
1174
1175 /* Restore SPRG3 */
1176 ld r3,PACA_SPRG3(r13)
1177 mtspr SPRN_SPRG3,r3
1178
1179 /*
1180 * Reload DEC. HDEC interrupts were disabled when
1181 * we reloaded the host's LPCR value.
1182 */
1183 ld r3, HSTATE_DECEXP(r13)
1184 mftb r4
1185 subf r4, r4, r3
1186 mtspr SPRN_DEC, r4
1187
1188 /* Reload the host's PMU registers */
1189 ld r3, PACALPPACAPTR(r13) /* is the host using the PMU? */
1190 lbz r4, LPPACA_PMCINUSE(r3)
1191 cmpwi r4, 0
1192 beq 23f /* skip if not */
1193 lwz r3, HSTATE_PMC(r13)
1194 lwz r4, HSTATE_PMC + 4(r13)
1195 lwz r5, HSTATE_PMC + 8(r13)
1196 lwz r6, HSTATE_PMC + 12(r13)
1197 lwz r8, HSTATE_PMC + 16(r13)
1198 lwz r9, HSTATE_PMC + 20(r13)
1199BEGIN_FTR_SECTION
1200 lwz r10, HSTATE_PMC + 24(r13)
1201 lwz r11, HSTATE_PMC + 28(r13)
1202END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
1203 mtspr SPRN_PMC1, r3
1204 mtspr SPRN_PMC2, r4
1205 mtspr SPRN_PMC3, r5
1206 mtspr SPRN_PMC4, r6
1207 mtspr SPRN_PMC5, r8
1208 mtspr SPRN_PMC6, r9
1209BEGIN_FTR_SECTION
1210 mtspr SPRN_PMC7, r10
1211 mtspr SPRN_PMC8, r11
1212END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
1213 ld r3, HSTATE_MMCR(r13)
1214 ld r4, HSTATE_MMCR + 8(r13)
1215 ld r5, HSTATE_MMCR + 16(r13)
1216 mtspr SPRN_MMCR1, r4
1217 mtspr SPRN_MMCRA, r5
1218 mtspr SPRN_MMCR0, r3
1219 isync
122023:
1221 /*
1222 * For external and machine check interrupts, we need
1223 * to call the Linux handler to process the interrupt.
1224 * We do that by jumping to absolute address 0x500 for
1225 * external interrupts, or the machine_check_fwnmi label
1226 * for machine checks (since firmware might have patched
1227 * the vector area at 0x200). The [h]rfid at the end of the
1228 * handler will return to the book3s_hv_interrupts.S code.
1229 * For other interrupts we do the rfid to get back
1230 * to the book3s_hv_interrupts.S code here.
1231 */
1232 ld r8, HSTATE_VMHANDLER(r13)
1233 ld r7, HSTATE_HOST_MSR(r13)
1234
1235 cmpwi cr1, r12, BOOK3S_INTERRUPT_MACHINE_CHECK
1236 cmpwi r12, BOOK3S_INTERRUPT_EXTERNAL
1237BEGIN_FTR_SECTION
1238 beq 11f
1239END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1240
1241 /* RFI into the highmem handler, or branch to interrupt handler */
1242 mfmsr r6
1243 li r0, MSR_RI
1244 andc r6, r6, r0
1245 mtmsrd r6, 1 /* Clear RI in MSR */
1246 mtsrr0 r8
1247 mtsrr1 r7
1248 beqa 0x500 /* external interrupt (PPC970) */
1249 beq cr1, 13f /* machine check */
1250 RFI
1251
1252 /* On POWER7, we have external interrupts set to use HSRR0/1 */
125311: mtspr SPRN_HSRR0, r8
1254 mtspr SPRN_HSRR1, r7
1255 ba 0x500
1256
125713: b machine_check_fwnmi
1258 1341
1259/* 1342/*
1260 * Check whether an HDSI is an HPTE not found fault or something else. 1343 * Check whether an HDSI is an HPTE not found fault or something else.
@@ -1333,7 +1416,7 @@ fast_interrupt_c_return:
1333 stw r8, VCPU_LAST_INST(r9) 1416 stw r8, VCPU_LAST_INST(r9)
1334 1417
1335 /* Unset guest mode. */ 1418 /* Unset guest mode. */
1336 li r0, KVM_GUEST_MODE_NONE 1419 li r0, KVM_GUEST_MODE_HOST_HV
1337 stb r0, HSTATE_IN_GUEST(r13) 1420 stb r0, HSTATE_IN_GUEST(r13)
1338 b guest_exit_cont 1421 b guest_exit_cont
1339 1422
@@ -1701,67 +1784,70 @@ machine_check_realmode:
1701 rotldi r11, r11, 63 1784 rotldi r11, r11, 63
1702 b fast_interrupt_c_return 1785 b fast_interrupt_c_return
1703 1786
1704secondary_too_late: 1787/*
1705 ld r5,HSTATE_KVM_VCORE(r13) 1788 * Determine what sort of external interrupt is pending (if any).
1706 HMT_LOW 1789 * Returns:
170713: lbz r3,VCORE_IN_GUEST(r5) 1790 * 0 if no interrupt is pending
1708 cmpwi r3,0 1791 * 1 if an interrupt is pending that needs to be handled by the host
1709 bne 13b 1792 * -1 if there was a guest wakeup IPI (which has now been cleared)
1710 HMT_MEDIUM 1793 */
1711 ld r11,PACA_SLBSHADOWPTR(r13) 1794kvmppc_read_intr:
1712 1795 /* see if a host IPI is pending */
1713 .rept SLB_NUM_BOLTED 1796 li r3, 1
1714 ld r5,SLBSHADOW_SAVEAREA(r11) 1797 lbz r0, HSTATE_HOST_IPI(r13)
1715 ld r6,SLBSHADOW_SAVEAREA+8(r11) 1798 cmpwi r0, 0
1716 andis. r7,r5,SLB_ESID_V@h 1799 bne 1f
1717 beq 1f
1718 slbmte r6,r5
17191: addi r11,r11,16
1720 .endr
1721 1800
1722secondary_nap: 1801 /* Now read the interrupt from the ICP */
1723 /* Clear our vcpu pointer so we don't come back in early */ 1802 ld r6, HSTATE_XICS_PHYS(r13)
1724 li r0, 0
1725 std r0, HSTATE_KVM_VCPU(r13)
1726 lwsync
1727 /* Clear any pending IPI - assume we're a secondary thread */
1728 ld r5, HSTATE_XICS_PHYS(r13)
1729 li r7, XICS_XIRR 1803 li r7, XICS_XIRR
1730 lwzcix r3, r5, r7 /* ack any pending interrupt */ 1804 cmpdi r6, 0
1731 rlwinm. r0, r3, 0, 0xffffff /* any pending? */ 1805 beq- 1f
1732 beq 37f 1806 lwzcix r0, r6, r7
1807 rlwinm. r3, r0, 0, 0xffffff
1733 sync 1808 sync
1734 li r0, 0xff 1809 beq 1f /* if nothing pending in the ICP */
1735 li r6, XICS_MFRR
1736 stbcix r0, r5, r6 /* clear the IPI */
1737 stwcix r3, r5, r7 /* EOI it */
173837: sync
1739 1810
1740 /* increment the nap count and then go to nap mode */ 1811 /* We found something in the ICP...
1741 ld r4, HSTATE_KVM_VCORE(r13) 1812 *
1742 addi r4, r4, VCORE_NAP_COUNT 1813 * If it's not an IPI, stash it in the PACA and return to
1743 lwsync /* make previous updates visible */ 1814 * the host, we don't (yet) handle directing real external
174451: lwarx r3, 0, r4 1815 * interrupts directly to the guest
1745 addi r3, r3, 1 1816 */
1746 stwcx. r3, 0, r4 1817 cmpwi r3, XICS_IPI /* if there is, is it an IPI? */
1747 bne 51b 1818 li r3, 1
1819 bne 42f
1748 1820
1749kvm_no_guest: 1821 /* It's an IPI, clear the MFRR and EOI it */
1750 li r0, KVM_HWTHREAD_IN_NAP 1822 li r3, 0xff
1751 stb r0, HSTATE_HWTHREAD_STATE(r13) 1823 li r8, XICS_MFRR
1824 stbcix r3, r6, r8 /* clear the IPI */
1825 stwcix r0, r6, r7 /* EOI it */
1826 sync
1752 1827
1753 li r3, LPCR_PECE0 1828 /* We need to re-check host IPI now in case it got set in the
1754 mfspr r4, SPRN_LPCR 1829 * meantime. If it's clear, we bounce the interrupt to the
1755 rlwimi r4, r3, 0, LPCR_PECE0 | LPCR_PECE1 1830 * guest
1756 mtspr SPRN_LPCR, r4 1831 */
1757 isync 1832 lbz r0, HSTATE_HOST_IPI(r13)
1758 std r0, HSTATE_SCRATCH0(r13) 1833 cmpwi r0, 0
1759 ptesync 1834 bne- 43f
1760 ld r0, HSTATE_SCRATCH0(r13) 1835
17611: cmpd r0, r0 1836 /* OK, it's an IPI for us */
1762 bne 1b 1837 li r3, -1
1763 nap 18381: blr
1764 b . 1839
184042: /* It's not an IPI and it's for the host, stash it in the PACA
1841 * before exit, it will be picked up by the host ICP driver
1842 */
1843 stw r0, HSTATE_SAVED_XIRR(r13)
1844 b 1b
1845
184643: /* We raced with the host, we need to resend that IPI, bummer */
1847 li r0, IPI_PRIORITY
1848 stbcix r0, r6, r8 /* set the IPI */
1849 sync
1850 b 1b
1765 1851
1766/* 1852/*
1767 * Save away FP, VMX and VSX registers. 1853 * Save away FP, VMX and VSX registers.
@@ -1879,3 +1965,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
1879 lwz r7,VCPU_VRSAVE(r4) 1965 lwz r7,VCPU_VRSAVE(r4)
1880 mtspr SPRN_VRSAVE,r7 1966 mtspr SPRN_VRSAVE,r7
1881 blr 1967 blr
1968
1969/*
1970 * We come here if we get any exception or interrupt while we are
1971 * executing host real mode code while in guest MMU context.
1972 * For now just spin, but we should do something better.
1973 */
1974kvmppc_bad_host_intr:
1975 b .
diff --git a/arch/powerpc/kvm/book3s_interrupts.S b/arch/powerpc/kvm/book3s_interrupts.S
index 17cfae5497a3..f4dd041c14ea 100644
--- a/arch/powerpc/kvm/book3s_interrupts.S
+++ b/arch/powerpc/kvm/book3s_interrupts.S
@@ -26,8 +26,12 @@
26 26
27#if defined(CONFIG_PPC_BOOK3S_64) 27#if defined(CONFIG_PPC_BOOK3S_64)
28#define FUNC(name) GLUE(.,name) 28#define FUNC(name) GLUE(.,name)
29#define GET_SHADOW_VCPU(reg) addi reg, r13, PACA_SVCPU
30
29#elif defined(CONFIG_PPC_BOOK3S_32) 31#elif defined(CONFIG_PPC_BOOK3S_32)
30#define FUNC(name) name 32#define FUNC(name) name
33#define GET_SHADOW_VCPU(reg) lwz reg, (THREAD + THREAD_KVM_SVCPU)(r2)
34
31#endif /* CONFIG_PPC_BOOK3S_XX */ 35#endif /* CONFIG_PPC_BOOK3S_XX */
32 36
33#define VCPU_LOAD_NVGPRS(vcpu) \ 37#define VCPU_LOAD_NVGPRS(vcpu) \
@@ -87,8 +91,14 @@ kvm_start_entry:
87 VCPU_LOAD_NVGPRS(r4) 91 VCPU_LOAD_NVGPRS(r4)
88 92
89kvm_start_lightweight: 93kvm_start_lightweight:
94 /* Copy registers into shadow vcpu so we can access them in real mode */
95 GET_SHADOW_VCPU(r3)
96 bl FUNC(kvmppc_copy_to_svcpu)
97 nop
98 REST_GPR(4, r1)
90 99
91#ifdef CONFIG_PPC_BOOK3S_64 100#ifdef CONFIG_PPC_BOOK3S_64
101 /* Get the dcbz32 flag */
92 PPC_LL r3, VCPU_HFLAGS(r4) 102 PPC_LL r3, VCPU_HFLAGS(r4)
93 rldicl r3, r3, 0, 63 /* r3 &= 1 */ 103 rldicl r3, r3, 0, 63 /* r3 &= 1 */
94 stb r3, HSTATE_RESTORE_HID5(r13) 104 stb r3, HSTATE_RESTORE_HID5(r13)
@@ -111,9 +121,6 @@ kvm_start_lightweight:
111 * 121 *
112 */ 122 */
113 123
114.global kvmppc_handler_highmem
115kvmppc_handler_highmem:
116
117 /* 124 /*
118 * Register usage at this point: 125 * Register usage at this point:
119 * 126 *
@@ -125,18 +132,31 @@ kvmppc_handler_highmem:
125 * 132 *
126 */ 133 */
127 134
128 /* R7 = vcpu */ 135 /* Transfer reg values from shadow vcpu back to vcpu struct */
129 PPC_LL r7, GPR4(r1) 136 /* On 64-bit, interrupts are still off at this point */
137 PPC_LL r3, GPR4(r1) /* vcpu pointer */
138 GET_SHADOW_VCPU(r4)
139 bl FUNC(kvmppc_copy_from_svcpu)
140 nop
130 141
131#ifdef CONFIG_PPC_BOOK3S_64 142#ifdef CONFIG_PPC_BOOK3S_64
143 /* Re-enable interrupts */
144 ld r3, HSTATE_HOST_MSR(r13)
145 ori r3, r3, MSR_EE
146 MTMSR_EERI(r3)
147
132 /* 148 /*
133 * Reload kernel SPRG3 value. 149 * Reload kernel SPRG3 value.
134 * No need to save guest value as usermode can't modify SPRG3. 150 * No need to save guest value as usermode can't modify SPRG3.
135 */ 151 */
136 ld r3, PACA_SPRG3(r13) 152 ld r3, PACA_SPRG3(r13)
137 mtspr SPRN_SPRG3, r3 153 mtspr SPRN_SPRG3, r3
154
138#endif /* CONFIG_PPC_BOOK3S_64 */ 155#endif /* CONFIG_PPC_BOOK3S_64 */
139 156
157 /* R7 = vcpu */
158 PPC_LL r7, GPR4(r1)
159
140 PPC_STL r14, VCPU_GPR(R14)(r7) 160 PPC_STL r14, VCPU_GPR(R14)(r7)
141 PPC_STL r15, VCPU_GPR(R15)(r7) 161 PPC_STL r15, VCPU_GPR(R15)(r7)
142 PPC_STL r16, VCPU_GPR(R16)(r7) 162 PPC_STL r16, VCPU_GPR(R16)(r7)
@@ -161,7 +181,7 @@ kvmppc_handler_highmem:
161 181
162 /* Restore r3 (kvm_run) and r4 (vcpu) */ 182 /* Restore r3 (kvm_run) and r4 (vcpu) */
163 REST_2GPRS(3, r1) 183 REST_2GPRS(3, r1)
164 bl FUNC(kvmppc_handle_exit) 184 bl FUNC(kvmppc_handle_exit_pr)
165 185
166 /* If RESUME_GUEST, get back in the loop */ 186 /* If RESUME_GUEST, get back in the loop */
167 cmpwi r3, RESUME_GUEST 187 cmpwi r3, RESUME_GUEST
diff --git a/arch/powerpc/kvm/book3s_mmu_hpte.c b/arch/powerpc/kvm/book3s_mmu_hpte.c
index da8b13c4b776..5a1ab1250a05 100644
--- a/arch/powerpc/kvm/book3s_mmu_hpte.c
+++ b/arch/powerpc/kvm/book3s_mmu_hpte.c
@@ -28,7 +28,7 @@
28#include <asm/mmu_context.h> 28#include <asm/mmu_context.h>
29#include <asm/hw_irq.h> 29#include <asm/hw_irq.h>
30 30
31#include "trace.h" 31#include "trace_pr.h"
32 32
33#define PTE_SIZE 12 33#define PTE_SIZE 12
34 34
@@ -56,6 +56,14 @@ static inline u64 kvmppc_mmu_hash_vpte_long(u64 vpage)
56 HPTEG_HASH_BITS_VPTE_LONG); 56 HPTEG_HASH_BITS_VPTE_LONG);
57} 57}
58 58
59#ifdef CONFIG_PPC_BOOK3S_64
60static inline u64 kvmppc_mmu_hash_vpte_64k(u64 vpage)
61{
62 return hash_64((vpage & 0xffffffff0ULL) >> 4,
63 HPTEG_HASH_BITS_VPTE_64K);
64}
65#endif
66
59void kvmppc_mmu_hpte_cache_map(struct kvm_vcpu *vcpu, struct hpte_cache *pte) 67void kvmppc_mmu_hpte_cache_map(struct kvm_vcpu *vcpu, struct hpte_cache *pte)
60{ 68{
61 u64 index; 69 u64 index;
@@ -83,6 +91,15 @@ void kvmppc_mmu_hpte_cache_map(struct kvm_vcpu *vcpu, struct hpte_cache *pte)
83 hlist_add_head_rcu(&pte->list_vpte_long, 91 hlist_add_head_rcu(&pte->list_vpte_long,
84 &vcpu3s->hpte_hash_vpte_long[index]); 92 &vcpu3s->hpte_hash_vpte_long[index]);
85 93
94#ifdef CONFIG_PPC_BOOK3S_64
95 /* Add to vPTE_64k list */
96 index = kvmppc_mmu_hash_vpte_64k(pte->pte.vpage);
97 hlist_add_head_rcu(&pte->list_vpte_64k,
98 &vcpu3s->hpte_hash_vpte_64k[index]);
99#endif
100
101 vcpu3s->hpte_cache_count++;
102
86 spin_unlock(&vcpu3s->mmu_lock); 103 spin_unlock(&vcpu3s->mmu_lock);
87} 104}
88 105
@@ -113,10 +130,13 @@ static void invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte)
113 hlist_del_init_rcu(&pte->list_pte_long); 130 hlist_del_init_rcu(&pte->list_pte_long);
114 hlist_del_init_rcu(&pte->list_vpte); 131 hlist_del_init_rcu(&pte->list_vpte);
115 hlist_del_init_rcu(&pte->list_vpte_long); 132 hlist_del_init_rcu(&pte->list_vpte_long);
133#ifdef CONFIG_PPC_BOOK3S_64
134 hlist_del_init_rcu(&pte->list_vpte_64k);
135#endif
136 vcpu3s->hpte_cache_count--;
116 137
117 spin_unlock(&vcpu3s->mmu_lock); 138 spin_unlock(&vcpu3s->mmu_lock);
118 139
119 vcpu3s->hpte_cache_count--;
120 call_rcu(&pte->rcu_head, free_pte_rcu); 140 call_rcu(&pte->rcu_head, free_pte_rcu);
121} 141}
122 142
@@ -219,6 +239,29 @@ static void kvmppc_mmu_pte_vflush_short(struct kvm_vcpu *vcpu, u64 guest_vp)
219 rcu_read_unlock(); 239 rcu_read_unlock();
220} 240}
221 241
242#ifdef CONFIG_PPC_BOOK3S_64
243/* Flush with mask 0xffffffff0 */
244static void kvmppc_mmu_pte_vflush_64k(struct kvm_vcpu *vcpu, u64 guest_vp)
245{
246 struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
247 struct hlist_head *list;
248 struct hpte_cache *pte;
249 u64 vp_mask = 0xffffffff0ULL;
250
251 list = &vcpu3s->hpte_hash_vpte_64k[
252 kvmppc_mmu_hash_vpte_64k(guest_vp)];
253
254 rcu_read_lock();
255
256 /* Check the list for matching entries and invalidate */
257 hlist_for_each_entry_rcu(pte, list, list_vpte_64k)
258 if ((pte->pte.vpage & vp_mask) == guest_vp)
259 invalidate_pte(vcpu, pte);
260
261 rcu_read_unlock();
262}
263#endif
264
222/* Flush with mask 0xffffff000 */ 265/* Flush with mask 0xffffff000 */
223static void kvmppc_mmu_pte_vflush_long(struct kvm_vcpu *vcpu, u64 guest_vp) 266static void kvmppc_mmu_pte_vflush_long(struct kvm_vcpu *vcpu, u64 guest_vp)
224{ 267{
@@ -249,6 +292,11 @@ void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 guest_vp, u64 vp_mask)
249 case 0xfffffffffULL: 292 case 0xfffffffffULL:
250 kvmppc_mmu_pte_vflush_short(vcpu, guest_vp); 293 kvmppc_mmu_pte_vflush_short(vcpu, guest_vp);
251 break; 294 break;
295#ifdef CONFIG_PPC_BOOK3S_64
296 case 0xffffffff0ULL:
297 kvmppc_mmu_pte_vflush_64k(vcpu, guest_vp);
298 break;
299#endif
252 case 0xffffff000ULL: 300 case 0xffffff000ULL:
253 kvmppc_mmu_pte_vflush_long(vcpu, guest_vp); 301 kvmppc_mmu_pte_vflush_long(vcpu, guest_vp);
254 break; 302 break;
@@ -285,15 +333,19 @@ struct hpte_cache *kvmppc_mmu_hpte_cache_next(struct kvm_vcpu *vcpu)
285 struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu); 333 struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
286 struct hpte_cache *pte; 334 struct hpte_cache *pte;
287 335
288 pte = kmem_cache_zalloc(hpte_cache, GFP_KERNEL);
289 vcpu3s->hpte_cache_count++;
290
291 if (vcpu3s->hpte_cache_count == HPTEG_CACHE_NUM) 336 if (vcpu3s->hpte_cache_count == HPTEG_CACHE_NUM)
292 kvmppc_mmu_pte_flush_all(vcpu); 337 kvmppc_mmu_pte_flush_all(vcpu);
293 338
339 pte = kmem_cache_zalloc(hpte_cache, GFP_KERNEL);
340
294 return pte; 341 return pte;
295} 342}
296 343
344void kvmppc_mmu_hpte_cache_free(struct hpte_cache *pte)
345{
346 kmem_cache_free(hpte_cache, pte);
347}
348
297void kvmppc_mmu_hpte_destroy(struct kvm_vcpu *vcpu) 349void kvmppc_mmu_hpte_destroy(struct kvm_vcpu *vcpu)
298{ 350{
299 kvmppc_mmu_pte_flush(vcpu, 0, 0); 351 kvmppc_mmu_pte_flush(vcpu, 0, 0);
@@ -320,6 +372,10 @@ int kvmppc_mmu_hpte_init(struct kvm_vcpu *vcpu)
320 ARRAY_SIZE(vcpu3s->hpte_hash_vpte)); 372 ARRAY_SIZE(vcpu3s->hpte_hash_vpte));
321 kvmppc_mmu_hpte_init_hash(vcpu3s->hpte_hash_vpte_long, 373 kvmppc_mmu_hpte_init_hash(vcpu3s->hpte_hash_vpte_long,
322 ARRAY_SIZE(vcpu3s->hpte_hash_vpte_long)); 374 ARRAY_SIZE(vcpu3s->hpte_hash_vpte_long));
375#ifdef CONFIG_PPC_BOOK3S_64
376 kvmppc_mmu_hpte_init_hash(vcpu3s->hpte_hash_vpte_64k,
377 ARRAY_SIZE(vcpu3s->hpte_hash_vpte_64k));
378#endif
323 379
324 spin_lock_init(&vcpu3s->mmu_lock); 380 spin_lock_init(&vcpu3s->mmu_lock);
325 381
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 27db1e665959..fe14ca3dd171 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -40,8 +40,12 @@
40#include <linux/sched.h> 40#include <linux/sched.h>
41#include <linux/vmalloc.h> 41#include <linux/vmalloc.h>
42#include <linux/highmem.h> 42#include <linux/highmem.h>
43#include <linux/module.h>
43 44
44#include "trace.h" 45#include "book3s.h"
46
47#define CREATE_TRACE_POINTS
48#include "trace_pr.h"
45 49
46/* #define EXIT_DEBUG */ 50/* #define EXIT_DEBUG */
47/* #define DEBUG_EXT */ 51/* #define DEBUG_EXT */
@@ -56,29 +60,25 @@ static int kvmppc_handle_ext(struct kvm_vcpu *vcpu, unsigned int exit_nr,
56#define HW_PAGE_SIZE PAGE_SIZE 60#define HW_PAGE_SIZE PAGE_SIZE
57#endif 61#endif
58 62
59void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 63static void kvmppc_core_vcpu_load_pr(struct kvm_vcpu *vcpu, int cpu)
60{ 64{
61#ifdef CONFIG_PPC_BOOK3S_64 65#ifdef CONFIG_PPC_BOOK3S_64
62 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu); 66 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
63 memcpy(svcpu->slb, to_book3s(vcpu)->slb_shadow, sizeof(svcpu->slb)); 67 memcpy(svcpu->slb, to_book3s(vcpu)->slb_shadow, sizeof(svcpu->slb));
64 memcpy(&get_paca()->shadow_vcpu, to_book3s(vcpu)->shadow_vcpu,
65 sizeof(get_paca()->shadow_vcpu));
66 svcpu->slb_max = to_book3s(vcpu)->slb_shadow_max; 68 svcpu->slb_max = to_book3s(vcpu)->slb_shadow_max;
67 svcpu_put(svcpu); 69 svcpu_put(svcpu);
68#endif 70#endif
69 vcpu->cpu = smp_processor_id(); 71 vcpu->cpu = smp_processor_id();
70#ifdef CONFIG_PPC_BOOK3S_32 72#ifdef CONFIG_PPC_BOOK3S_32
71 current->thread.kvm_shadow_vcpu = to_book3s(vcpu)->shadow_vcpu; 73 current->thread.kvm_shadow_vcpu = vcpu->arch.shadow_vcpu;
72#endif 74#endif
73} 75}
74 76
75void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu) 77static void kvmppc_core_vcpu_put_pr(struct kvm_vcpu *vcpu)
76{ 78{
77#ifdef CONFIG_PPC_BOOK3S_64 79#ifdef CONFIG_PPC_BOOK3S_64
78 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu); 80 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
79 memcpy(to_book3s(vcpu)->slb_shadow, svcpu->slb, sizeof(svcpu->slb)); 81 memcpy(to_book3s(vcpu)->slb_shadow, svcpu->slb, sizeof(svcpu->slb));
80 memcpy(to_book3s(vcpu)->shadow_vcpu, &get_paca()->shadow_vcpu,
81 sizeof(get_paca()->shadow_vcpu));
82 to_book3s(vcpu)->slb_shadow_max = svcpu->slb_max; 82 to_book3s(vcpu)->slb_shadow_max = svcpu->slb_max;
83 svcpu_put(svcpu); 83 svcpu_put(svcpu);
84#endif 84#endif
@@ -87,7 +87,61 @@ void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu)
87 vcpu->cpu = -1; 87 vcpu->cpu = -1;
88} 88}
89 89
90int kvmppc_core_check_requests(struct kvm_vcpu *vcpu) 90/* Copy data needed by real-mode code from vcpu to shadow vcpu */
91void kvmppc_copy_to_svcpu(struct kvmppc_book3s_shadow_vcpu *svcpu,
92 struct kvm_vcpu *vcpu)
93{
94 svcpu->gpr[0] = vcpu->arch.gpr[0];
95 svcpu->gpr[1] = vcpu->arch.gpr[1];
96 svcpu->gpr[2] = vcpu->arch.gpr[2];
97 svcpu->gpr[3] = vcpu->arch.gpr[3];
98 svcpu->gpr[4] = vcpu->arch.gpr[4];
99 svcpu->gpr[5] = vcpu->arch.gpr[5];
100 svcpu->gpr[6] = vcpu->arch.gpr[6];
101 svcpu->gpr[7] = vcpu->arch.gpr[7];
102 svcpu->gpr[8] = vcpu->arch.gpr[8];
103 svcpu->gpr[9] = vcpu->arch.gpr[9];
104 svcpu->gpr[10] = vcpu->arch.gpr[10];
105 svcpu->gpr[11] = vcpu->arch.gpr[11];
106 svcpu->gpr[12] = vcpu->arch.gpr[12];
107 svcpu->gpr[13] = vcpu->arch.gpr[13];
108 svcpu->cr = vcpu->arch.cr;
109 svcpu->xer = vcpu->arch.xer;
110 svcpu->ctr = vcpu->arch.ctr;
111 svcpu->lr = vcpu->arch.lr;
112 svcpu->pc = vcpu->arch.pc;
113}
114
115/* Copy data touched by real-mode code from shadow vcpu back to vcpu */
116void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu,
117 struct kvmppc_book3s_shadow_vcpu *svcpu)
118{
119 vcpu->arch.gpr[0] = svcpu->gpr[0];
120 vcpu->arch.gpr[1] = svcpu->gpr[1];
121 vcpu->arch.gpr[2] = svcpu->gpr[2];
122 vcpu->arch.gpr[3] = svcpu->gpr[3];
123 vcpu->arch.gpr[4] = svcpu->gpr[4];
124 vcpu->arch.gpr[5] = svcpu->gpr[5];
125 vcpu->arch.gpr[6] = svcpu->gpr[6];
126 vcpu->arch.gpr[7] = svcpu->gpr[7];
127 vcpu->arch.gpr[8] = svcpu->gpr[8];
128 vcpu->arch.gpr[9] = svcpu->gpr[9];
129 vcpu->arch.gpr[10] = svcpu->gpr[10];
130 vcpu->arch.gpr[11] = svcpu->gpr[11];
131 vcpu->arch.gpr[12] = svcpu->gpr[12];
132 vcpu->arch.gpr[13] = svcpu->gpr[13];
133 vcpu->arch.cr = svcpu->cr;
134 vcpu->arch.xer = svcpu->xer;
135 vcpu->arch.ctr = svcpu->ctr;
136 vcpu->arch.lr = svcpu->lr;
137 vcpu->arch.pc = svcpu->pc;
138 vcpu->arch.shadow_srr1 = svcpu->shadow_srr1;
139 vcpu->arch.fault_dar = svcpu->fault_dar;
140 vcpu->arch.fault_dsisr = svcpu->fault_dsisr;
141 vcpu->arch.last_inst = svcpu->last_inst;
142}
143
144static int kvmppc_core_check_requests_pr(struct kvm_vcpu *vcpu)
91{ 145{
92 int r = 1; /* Indicate we want to get back into the guest */ 146 int r = 1; /* Indicate we want to get back into the guest */
93 147
@@ -100,44 +154,69 @@ int kvmppc_core_check_requests(struct kvm_vcpu *vcpu)
100} 154}
101 155
102/************* MMU Notifiers *************/ 156/************* MMU Notifiers *************/
157static void do_kvm_unmap_hva(struct kvm *kvm, unsigned long start,
158 unsigned long end)
159{
160 long i;
161 struct kvm_vcpu *vcpu;
162 struct kvm_memslots *slots;
163 struct kvm_memory_slot *memslot;
164
165 slots = kvm_memslots(kvm);
166 kvm_for_each_memslot(memslot, slots) {
167 unsigned long hva_start, hva_end;
168 gfn_t gfn, gfn_end;
169
170 hva_start = max(start, memslot->userspace_addr);
171 hva_end = min(end, memslot->userspace_addr +
172 (memslot->npages << PAGE_SHIFT));
173 if (hva_start >= hva_end)
174 continue;
175 /*
176 * {gfn(page) | page intersects with [hva_start, hva_end)} =
177 * {gfn, gfn+1, ..., gfn_end-1}.
178 */
179 gfn = hva_to_gfn_memslot(hva_start, memslot);
180 gfn_end = hva_to_gfn_memslot(hva_end + PAGE_SIZE - 1, memslot);
181 kvm_for_each_vcpu(i, vcpu, kvm)
182 kvmppc_mmu_pte_pflush(vcpu, gfn << PAGE_SHIFT,
183 gfn_end << PAGE_SHIFT);
184 }
185}
103 186
104int kvm_unmap_hva(struct kvm *kvm, unsigned long hva) 187static int kvm_unmap_hva_pr(struct kvm *kvm, unsigned long hva)
105{ 188{
106 trace_kvm_unmap_hva(hva); 189 trace_kvm_unmap_hva(hva);
107 190
108 /* 191 do_kvm_unmap_hva(kvm, hva, hva + PAGE_SIZE);
109 * Flush all shadow tlb entries everywhere. This is slow, but
110 * we are 100% sure that we catch the to be unmapped page
111 */
112 kvm_flush_remote_tlbs(kvm);
113 192
114 return 0; 193 return 0;
115} 194}
116 195
117int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end) 196static int kvm_unmap_hva_range_pr(struct kvm *kvm, unsigned long start,
197 unsigned long end)
118{ 198{
119 /* kvm_unmap_hva flushes everything anyways */ 199 do_kvm_unmap_hva(kvm, start, end);
120 kvm_unmap_hva(kvm, start);
121 200
122 return 0; 201 return 0;
123} 202}
124 203
125int kvm_age_hva(struct kvm *kvm, unsigned long hva) 204static int kvm_age_hva_pr(struct kvm *kvm, unsigned long hva)
126{ 205{
127 /* XXX could be more clever ;) */ 206 /* XXX could be more clever ;) */
128 return 0; 207 return 0;
129} 208}
130 209
131int kvm_test_age_hva(struct kvm *kvm, unsigned long hva) 210static int kvm_test_age_hva_pr(struct kvm *kvm, unsigned long hva)
132{ 211{
133 /* XXX could be more clever ;) */ 212 /* XXX could be more clever ;) */
134 return 0; 213 return 0;
135} 214}
136 215
137void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) 216static void kvm_set_spte_hva_pr(struct kvm *kvm, unsigned long hva, pte_t pte)
138{ 217{
139 /* The page will get remapped properly on its next fault */ 218 /* The page will get remapped properly on its next fault */
140 kvm_unmap_hva(kvm, hva); 219 do_kvm_unmap_hva(kvm, hva, hva + PAGE_SIZE);
141} 220}
142 221
143/*****************************************/ 222/*****************************************/
@@ -159,7 +238,7 @@ static void kvmppc_recalc_shadow_msr(struct kvm_vcpu *vcpu)
159 vcpu->arch.shadow_msr = smsr; 238 vcpu->arch.shadow_msr = smsr;
160} 239}
161 240
162void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 msr) 241static void kvmppc_set_msr_pr(struct kvm_vcpu *vcpu, u64 msr)
163{ 242{
164 ulong old_msr = vcpu->arch.shared->msr; 243 ulong old_msr = vcpu->arch.shared->msr;
165 244
@@ -219,7 +298,7 @@ void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 msr)
219 kvmppc_handle_ext(vcpu, BOOK3S_INTERRUPT_FP_UNAVAIL, MSR_FP); 298 kvmppc_handle_ext(vcpu, BOOK3S_INTERRUPT_FP_UNAVAIL, MSR_FP);
220} 299}
221 300
222void kvmppc_set_pvr(struct kvm_vcpu *vcpu, u32 pvr) 301void kvmppc_set_pvr_pr(struct kvm_vcpu *vcpu, u32 pvr)
223{ 302{
224 u32 host_pvr; 303 u32 host_pvr;
225 304
@@ -256,6 +335,23 @@ void kvmppc_set_pvr(struct kvm_vcpu *vcpu, u32 pvr)
256 if (!strcmp(cur_cpu_spec->platform, "ppc-cell-be")) 335 if (!strcmp(cur_cpu_spec->platform, "ppc-cell-be"))
257 to_book3s(vcpu)->msr_mask &= ~(MSR_FE0 | MSR_FE1); 336 to_book3s(vcpu)->msr_mask &= ~(MSR_FE0 | MSR_FE1);
258 337
338 /*
339 * If they're asking for POWER6 or later, set the flag
340 * indicating that we can do multiple large page sizes
341 * and 1TB segments.
342 * Also set the flag that indicates that tlbie has the large
343 * page bit in the RB operand instead of the instruction.
344 */
345 switch (PVR_VER(pvr)) {
346 case PVR_POWER6:
347 case PVR_POWER7:
348 case PVR_POWER7p:
349 case PVR_POWER8:
350 vcpu->arch.hflags |= BOOK3S_HFLAG_MULTI_PGSIZE |
351 BOOK3S_HFLAG_NEW_TLBIE;
352 break;
353 }
354
259#ifdef CONFIG_PPC_BOOK3S_32 355#ifdef CONFIG_PPC_BOOK3S_32
260 /* 32 bit Book3S always has 32 byte dcbz */ 356 /* 32 bit Book3S always has 32 byte dcbz */
261 vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32; 357 vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32;
@@ -334,6 +430,7 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
334 ulong eaddr, int vec) 430 ulong eaddr, int vec)
335{ 431{
336 bool data = (vec == BOOK3S_INTERRUPT_DATA_STORAGE); 432 bool data = (vec == BOOK3S_INTERRUPT_DATA_STORAGE);
433 bool iswrite = false;
337 int r = RESUME_GUEST; 434 int r = RESUME_GUEST;
338 int relocated; 435 int relocated;
339 int page_found = 0; 436 int page_found = 0;
@@ -344,10 +441,12 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
344 u64 vsid; 441 u64 vsid;
345 442
346 relocated = data ? dr : ir; 443 relocated = data ? dr : ir;
444 if (data && (vcpu->arch.fault_dsisr & DSISR_ISSTORE))
445 iswrite = true;
347 446
348 /* Resolve real address if translation turned on */ 447 /* Resolve real address if translation turned on */
349 if (relocated) { 448 if (relocated) {
350 page_found = vcpu->arch.mmu.xlate(vcpu, eaddr, &pte, data); 449 page_found = vcpu->arch.mmu.xlate(vcpu, eaddr, &pte, data, iswrite);
351 } else { 450 } else {
352 pte.may_execute = true; 451 pte.may_execute = true;
353 pte.may_read = true; 452 pte.may_read = true;
@@ -355,6 +454,7 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
355 pte.raddr = eaddr & KVM_PAM; 454 pte.raddr = eaddr & KVM_PAM;
356 pte.eaddr = eaddr; 455 pte.eaddr = eaddr;
357 pte.vpage = eaddr >> 12; 456 pte.vpage = eaddr >> 12;
457 pte.page_size = MMU_PAGE_64K;
358 } 458 }
359 459
360 switch (vcpu->arch.shared->msr & (MSR_DR|MSR_IR)) { 460 switch (vcpu->arch.shared->msr & (MSR_DR|MSR_IR)) {
@@ -388,22 +488,18 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
388 488
389 if (page_found == -ENOENT) { 489 if (page_found == -ENOENT) {
390 /* Page not found in guest PTE entries */ 490 /* Page not found in guest PTE entries */
391 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
392 vcpu->arch.shared->dar = kvmppc_get_fault_dar(vcpu); 491 vcpu->arch.shared->dar = kvmppc_get_fault_dar(vcpu);
393 vcpu->arch.shared->dsisr = svcpu->fault_dsisr; 492 vcpu->arch.shared->dsisr = vcpu->arch.fault_dsisr;
394 vcpu->arch.shared->msr |= 493 vcpu->arch.shared->msr |=
395 (svcpu->shadow_srr1 & 0x00000000f8000000ULL); 494 vcpu->arch.shadow_srr1 & 0x00000000f8000000ULL;
396 svcpu_put(svcpu);
397 kvmppc_book3s_queue_irqprio(vcpu, vec); 495 kvmppc_book3s_queue_irqprio(vcpu, vec);
398 } else if (page_found == -EPERM) { 496 } else if (page_found == -EPERM) {
399 /* Storage protection */ 497 /* Storage protection */
400 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
401 vcpu->arch.shared->dar = kvmppc_get_fault_dar(vcpu); 498 vcpu->arch.shared->dar = kvmppc_get_fault_dar(vcpu);
402 vcpu->arch.shared->dsisr = svcpu->fault_dsisr & ~DSISR_NOHPTE; 499 vcpu->arch.shared->dsisr = vcpu->arch.fault_dsisr & ~DSISR_NOHPTE;
403 vcpu->arch.shared->dsisr |= DSISR_PROTFAULT; 500 vcpu->arch.shared->dsisr |= DSISR_PROTFAULT;
404 vcpu->arch.shared->msr |= 501 vcpu->arch.shared->msr |=
405 svcpu->shadow_srr1 & 0x00000000f8000000ULL; 502 vcpu->arch.shadow_srr1 & 0x00000000f8000000ULL;
406 svcpu_put(svcpu);
407 kvmppc_book3s_queue_irqprio(vcpu, vec); 503 kvmppc_book3s_queue_irqprio(vcpu, vec);
408 } else if (page_found == -EINVAL) { 504 } else if (page_found == -EINVAL) {
409 /* Page not found in guest SLB */ 505 /* Page not found in guest SLB */
@@ -411,12 +507,20 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
411 kvmppc_book3s_queue_irqprio(vcpu, vec + 0x80); 507 kvmppc_book3s_queue_irqprio(vcpu, vec + 0x80);
412 } else if (!is_mmio && 508 } else if (!is_mmio &&
413 kvmppc_visible_gfn(vcpu, pte.raddr >> PAGE_SHIFT)) { 509 kvmppc_visible_gfn(vcpu, pte.raddr >> PAGE_SHIFT)) {
510 if (data && !(vcpu->arch.fault_dsisr & DSISR_NOHPTE)) {
511 /*
512 * There is already a host HPTE there, presumably
513 * a read-only one for a page the guest thinks
514 * is writable, so get rid of it first.
515 */
516 kvmppc_mmu_unmap_page(vcpu, &pte);
517 }
414 /* The guest's PTE is not mapped yet. Map on the host */ 518 /* The guest's PTE is not mapped yet. Map on the host */
415 kvmppc_mmu_map_page(vcpu, &pte); 519 kvmppc_mmu_map_page(vcpu, &pte, iswrite);
416 if (data) 520 if (data)
417 vcpu->stat.sp_storage++; 521 vcpu->stat.sp_storage++;
418 else if (vcpu->arch.mmu.is_dcbz32(vcpu) && 522 else if (vcpu->arch.mmu.is_dcbz32(vcpu) &&
419 (!(vcpu->arch.hflags & BOOK3S_HFLAG_DCBZ32))) 523 (!(vcpu->arch.hflags & BOOK3S_HFLAG_DCBZ32)))
420 kvmppc_patch_dcbz(vcpu, &pte); 524 kvmppc_patch_dcbz(vcpu, &pte);
421 } else { 525 } else {
422 /* MMIO */ 526 /* MMIO */
@@ -444,7 +548,7 @@ void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr)
444#ifdef CONFIG_VSX 548#ifdef CONFIG_VSX
445 u64 *vcpu_vsx = vcpu->arch.vsr; 549 u64 *vcpu_vsx = vcpu->arch.vsr;
446#endif 550#endif
447 u64 *thread_fpr = (u64*)t->fpr; 551 u64 *thread_fpr = &t->fp_state.fpr[0][0];
448 int i; 552 int i;
449 553
450 /* 554 /*
@@ -466,14 +570,14 @@ void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr)
466 /* 570 /*
467 * Note that on CPUs with VSX, giveup_fpu stores 571 * Note that on CPUs with VSX, giveup_fpu stores
468 * both the traditional FP registers and the added VSX 572 * both the traditional FP registers and the added VSX
469 * registers into thread.fpr[]. 573 * registers into thread.fp_state.fpr[].
470 */ 574 */
471 if (current->thread.regs->msr & MSR_FP) 575 if (current->thread.regs->msr & MSR_FP)
472 giveup_fpu(current); 576 giveup_fpu(current);
473 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++) 577 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++)
474 vcpu_fpr[i] = thread_fpr[get_fpr_index(i)]; 578 vcpu_fpr[i] = thread_fpr[get_fpr_index(i)];
475 579
476 vcpu->arch.fpscr = t->fpscr.val; 580 vcpu->arch.fpscr = t->fp_state.fpscr;
477 581
478#ifdef CONFIG_VSX 582#ifdef CONFIG_VSX
479 if (cpu_has_feature(CPU_FTR_VSX)) 583 if (cpu_has_feature(CPU_FTR_VSX))
@@ -486,8 +590,8 @@ void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr)
486 if (msr & MSR_VEC) { 590 if (msr & MSR_VEC) {
487 if (current->thread.regs->msr & MSR_VEC) 591 if (current->thread.regs->msr & MSR_VEC)
488 giveup_altivec(current); 592 giveup_altivec(current);
489 memcpy(vcpu->arch.vr, t->vr, sizeof(vcpu->arch.vr)); 593 memcpy(vcpu->arch.vr, t->vr_state.vr, sizeof(vcpu->arch.vr));
490 vcpu->arch.vscr = t->vscr; 594 vcpu->arch.vscr = t->vr_state.vscr;
491 } 595 }
492#endif 596#endif
493 597
@@ -539,7 +643,7 @@ static int kvmppc_handle_ext(struct kvm_vcpu *vcpu, unsigned int exit_nr,
539#ifdef CONFIG_VSX 643#ifdef CONFIG_VSX
540 u64 *vcpu_vsx = vcpu->arch.vsr; 644 u64 *vcpu_vsx = vcpu->arch.vsr;
541#endif 645#endif
542 u64 *thread_fpr = (u64*)t->fpr; 646 u64 *thread_fpr = &t->fp_state.fpr[0][0];
543 int i; 647 int i;
544 648
545 /* When we have paired singles, we emulate in software */ 649 /* When we have paired singles, we emulate in software */
@@ -584,15 +688,15 @@ static int kvmppc_handle_ext(struct kvm_vcpu *vcpu, unsigned int exit_nr,
584 for (i = 0; i < ARRAY_SIZE(vcpu->arch.vsr) / 2; i++) 688 for (i = 0; i < ARRAY_SIZE(vcpu->arch.vsr) / 2; i++)
585 thread_fpr[get_fpr_index(i) + 1] = vcpu_vsx[i]; 689 thread_fpr[get_fpr_index(i) + 1] = vcpu_vsx[i];
586#endif 690#endif
587 t->fpscr.val = vcpu->arch.fpscr; 691 t->fp_state.fpscr = vcpu->arch.fpscr;
588 t->fpexc_mode = 0; 692 t->fpexc_mode = 0;
589 kvmppc_load_up_fpu(); 693 kvmppc_load_up_fpu();
590 } 694 }
591 695
592 if (msr & MSR_VEC) { 696 if (msr & MSR_VEC) {
593#ifdef CONFIG_ALTIVEC 697#ifdef CONFIG_ALTIVEC
594 memcpy(t->vr, vcpu->arch.vr, sizeof(vcpu->arch.vr)); 698 memcpy(t->vr_state.vr, vcpu->arch.vr, sizeof(vcpu->arch.vr));
595 t->vscr = vcpu->arch.vscr; 699 t->vr_state.vscr = vcpu->arch.vscr;
596 t->vrsave = -1; 700 t->vrsave = -1;
597 kvmppc_load_up_altivec(); 701 kvmppc_load_up_altivec();
598#endif 702#endif
@@ -619,13 +723,15 @@ static void kvmppc_handle_lost_ext(struct kvm_vcpu *vcpu)
619 723
620 if (lost_ext & MSR_FP) 724 if (lost_ext & MSR_FP)
621 kvmppc_load_up_fpu(); 725 kvmppc_load_up_fpu();
726#ifdef CONFIG_ALTIVEC
622 if (lost_ext & MSR_VEC) 727 if (lost_ext & MSR_VEC)
623 kvmppc_load_up_altivec(); 728 kvmppc_load_up_altivec();
729#endif
624 current->thread.regs->msr |= lost_ext; 730 current->thread.regs->msr |= lost_ext;
625} 731}
626 732
627int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu, 733int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
628 unsigned int exit_nr) 734 unsigned int exit_nr)
629{ 735{
630 int r = RESUME_HOST; 736 int r = RESUME_HOST;
631 int s; 737 int s;
@@ -643,25 +749,32 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
643 switch (exit_nr) { 749 switch (exit_nr) {
644 case BOOK3S_INTERRUPT_INST_STORAGE: 750 case BOOK3S_INTERRUPT_INST_STORAGE:
645 { 751 {
646 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu); 752 ulong shadow_srr1 = vcpu->arch.shadow_srr1;
647 ulong shadow_srr1 = svcpu->shadow_srr1;
648 vcpu->stat.pf_instruc++; 753 vcpu->stat.pf_instruc++;
649 754
650#ifdef CONFIG_PPC_BOOK3S_32 755#ifdef CONFIG_PPC_BOOK3S_32
651 /* We set segments as unused segments when invalidating them. So 756 /* We set segments as unused segments when invalidating them. So
652 * treat the respective fault as segment fault. */ 757 * treat the respective fault as segment fault. */
653 if (svcpu->sr[kvmppc_get_pc(vcpu) >> SID_SHIFT] == SR_INVALID) { 758 {
654 kvmppc_mmu_map_segment(vcpu, kvmppc_get_pc(vcpu)); 759 struct kvmppc_book3s_shadow_vcpu *svcpu;
655 r = RESUME_GUEST; 760 u32 sr;
761
762 svcpu = svcpu_get(vcpu);
763 sr = svcpu->sr[kvmppc_get_pc(vcpu) >> SID_SHIFT];
656 svcpu_put(svcpu); 764 svcpu_put(svcpu);
657 break; 765 if (sr == SR_INVALID) {
766 kvmppc_mmu_map_segment(vcpu, kvmppc_get_pc(vcpu));
767 r = RESUME_GUEST;
768 break;
769 }
658 } 770 }
659#endif 771#endif
660 svcpu_put(svcpu);
661 772
662 /* only care about PTEG not found errors, but leave NX alone */ 773 /* only care about PTEG not found errors, but leave NX alone */
663 if (shadow_srr1 & 0x40000000) { 774 if (shadow_srr1 & 0x40000000) {
775 int idx = srcu_read_lock(&vcpu->kvm->srcu);
664 r = kvmppc_handle_pagefault(run, vcpu, kvmppc_get_pc(vcpu), exit_nr); 776 r = kvmppc_handle_pagefault(run, vcpu, kvmppc_get_pc(vcpu), exit_nr);
777 srcu_read_unlock(&vcpu->kvm->srcu, idx);
665 vcpu->stat.sp_instruc++; 778 vcpu->stat.sp_instruc++;
666 } else if (vcpu->arch.mmu.is_dcbz32(vcpu) && 779 } else if (vcpu->arch.mmu.is_dcbz32(vcpu) &&
667 (!(vcpu->arch.hflags & BOOK3S_HFLAG_DCBZ32))) { 780 (!(vcpu->arch.hflags & BOOK3S_HFLAG_DCBZ32))) {
@@ -682,25 +795,36 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
682 case BOOK3S_INTERRUPT_DATA_STORAGE: 795 case BOOK3S_INTERRUPT_DATA_STORAGE:
683 { 796 {
684 ulong dar = kvmppc_get_fault_dar(vcpu); 797 ulong dar = kvmppc_get_fault_dar(vcpu);
685 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu); 798 u32 fault_dsisr = vcpu->arch.fault_dsisr;
686 u32 fault_dsisr = svcpu->fault_dsisr;
687 vcpu->stat.pf_storage++; 799 vcpu->stat.pf_storage++;
688 800
689#ifdef CONFIG_PPC_BOOK3S_32 801#ifdef CONFIG_PPC_BOOK3S_32
690 /* We set segments as unused segments when invalidating them. So 802 /* We set segments as unused segments when invalidating them. So
691 * treat the respective fault as segment fault. */ 803 * treat the respective fault as segment fault. */
692 if ((svcpu->sr[dar >> SID_SHIFT]) == SR_INVALID) { 804 {
693 kvmppc_mmu_map_segment(vcpu, dar); 805 struct kvmppc_book3s_shadow_vcpu *svcpu;
694 r = RESUME_GUEST; 806 u32 sr;
807
808 svcpu = svcpu_get(vcpu);
809 sr = svcpu->sr[dar >> SID_SHIFT];
695 svcpu_put(svcpu); 810 svcpu_put(svcpu);
696 break; 811 if (sr == SR_INVALID) {
812 kvmppc_mmu_map_segment(vcpu, dar);
813 r = RESUME_GUEST;
814 break;
815 }
697 } 816 }
698#endif 817#endif
699 svcpu_put(svcpu);
700 818
701 /* The only case we need to handle is missing shadow PTEs */ 819 /*
702 if (fault_dsisr & DSISR_NOHPTE) { 820 * We need to handle missing shadow PTEs, and
821 * protection faults due to us mapping a page read-only
822 * when the guest thinks it is writable.
823 */
824 if (fault_dsisr & (DSISR_NOHPTE | DSISR_PROTFAULT)) {
825 int idx = srcu_read_lock(&vcpu->kvm->srcu);
703 r = kvmppc_handle_pagefault(run, vcpu, dar, exit_nr); 826 r = kvmppc_handle_pagefault(run, vcpu, dar, exit_nr);
827 srcu_read_unlock(&vcpu->kvm->srcu, idx);
704 } else { 828 } else {
705 vcpu->arch.shared->dar = dar; 829 vcpu->arch.shared->dar = dar;
706 vcpu->arch.shared->dsisr = fault_dsisr; 830 vcpu->arch.shared->dsisr = fault_dsisr;
@@ -743,13 +867,10 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
743 case BOOK3S_INTERRUPT_H_EMUL_ASSIST: 867 case BOOK3S_INTERRUPT_H_EMUL_ASSIST:
744 { 868 {
745 enum emulation_result er; 869 enum emulation_result er;
746 struct kvmppc_book3s_shadow_vcpu *svcpu;
747 ulong flags; 870 ulong flags;
748 871
749program_interrupt: 872program_interrupt:
750 svcpu = svcpu_get(vcpu); 873 flags = vcpu->arch.shadow_srr1 & 0x1f0000ull;
751 flags = svcpu->shadow_srr1 & 0x1f0000ull;
752 svcpu_put(svcpu);
753 874
754 if (vcpu->arch.shared->msr & MSR_PR) { 875 if (vcpu->arch.shared->msr & MSR_PR) {
755#ifdef EXIT_DEBUG 876#ifdef EXIT_DEBUG
@@ -798,7 +919,7 @@ program_interrupt:
798 ulong cmd = kvmppc_get_gpr(vcpu, 3); 919 ulong cmd = kvmppc_get_gpr(vcpu, 3);
799 int i; 920 int i;
800 921
801#ifdef CONFIG_KVM_BOOK3S_64_PR 922#ifdef CONFIG_PPC_BOOK3S_64
802 if (kvmppc_h_pr(vcpu, cmd) == EMULATE_DONE) { 923 if (kvmppc_h_pr(vcpu, cmd) == EMULATE_DONE) {
803 r = RESUME_GUEST; 924 r = RESUME_GUEST;
804 break; 925 break;
@@ -881,9 +1002,7 @@ program_interrupt:
881 break; 1002 break;
882 default: 1003 default:
883 { 1004 {
884 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu); 1005 ulong shadow_srr1 = vcpu->arch.shadow_srr1;
885 ulong shadow_srr1 = svcpu->shadow_srr1;
886 svcpu_put(svcpu);
887 /* Ugh - bork here! What did we get? */ 1006 /* Ugh - bork here! What did we get? */
888 printk(KERN_EMERG "exit_nr=0x%x | pc=0x%lx | msr=0x%lx\n", 1007 printk(KERN_EMERG "exit_nr=0x%x | pc=0x%lx | msr=0x%lx\n",
889 exit_nr, kvmppc_get_pc(vcpu), shadow_srr1); 1008 exit_nr, kvmppc_get_pc(vcpu), shadow_srr1);
@@ -920,8 +1039,8 @@ program_interrupt:
920 return r; 1039 return r;
921} 1040}
922 1041
923int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, 1042static int kvm_arch_vcpu_ioctl_get_sregs_pr(struct kvm_vcpu *vcpu,
924 struct kvm_sregs *sregs) 1043 struct kvm_sregs *sregs)
925{ 1044{
926 struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu); 1045 struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
927 int i; 1046 int i;
@@ -947,13 +1066,13 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
947 return 0; 1066 return 0;
948} 1067}
949 1068
950int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, 1069static int kvm_arch_vcpu_ioctl_set_sregs_pr(struct kvm_vcpu *vcpu,
951 struct kvm_sregs *sregs) 1070 struct kvm_sregs *sregs)
952{ 1071{
953 struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu); 1072 struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
954 int i; 1073 int i;
955 1074
956 kvmppc_set_pvr(vcpu, sregs->pvr); 1075 kvmppc_set_pvr_pr(vcpu, sregs->pvr);
957 1076
958 vcpu3s->sdr1 = sregs->u.s.sdr1; 1077 vcpu3s->sdr1 = sregs->u.s.sdr1;
959 if (vcpu->arch.hflags & BOOK3S_HFLAG_SLB) { 1078 if (vcpu->arch.hflags & BOOK3S_HFLAG_SLB) {
@@ -983,7 +1102,8 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
983 return 0; 1102 return 0;
984} 1103}
985 1104
986int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val) 1105static int kvmppc_get_one_reg_pr(struct kvm_vcpu *vcpu, u64 id,
1106 union kvmppc_one_reg *val)
987{ 1107{
988 int r = 0; 1108 int r = 0;
989 1109
@@ -1012,7 +1132,8 @@ int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val)
1012 return r; 1132 return r;
1013} 1133}
1014 1134
1015int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val) 1135static int kvmppc_set_one_reg_pr(struct kvm_vcpu *vcpu, u64 id,
1136 union kvmppc_one_reg *val)
1016{ 1137{
1017 int r = 0; 1138 int r = 0;
1018 1139
@@ -1042,28 +1163,30 @@ int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val)
1042 return r; 1163 return r;
1043} 1164}
1044 1165
1045int kvmppc_core_check_processor_compat(void) 1166static struct kvm_vcpu *kvmppc_core_vcpu_create_pr(struct kvm *kvm,
1046{ 1167 unsigned int id)
1047 return 0;
1048}
1049
1050struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
1051{ 1168{
1052 struct kvmppc_vcpu_book3s *vcpu_book3s; 1169 struct kvmppc_vcpu_book3s *vcpu_book3s;
1053 struct kvm_vcpu *vcpu; 1170 struct kvm_vcpu *vcpu;
1054 int err = -ENOMEM; 1171 int err = -ENOMEM;
1055 unsigned long p; 1172 unsigned long p;
1056 1173
1057 vcpu_book3s = vzalloc(sizeof(struct kvmppc_vcpu_book3s)); 1174 vcpu = kmem_cache_zalloc(kvm_vcpu_cache, GFP_KERNEL);
1058 if (!vcpu_book3s) 1175 if (!vcpu)
1059 goto out; 1176 goto out;
1060 1177
1061 vcpu_book3s->shadow_vcpu = 1178 vcpu_book3s = vzalloc(sizeof(struct kvmppc_vcpu_book3s));
1062 kzalloc(sizeof(*vcpu_book3s->shadow_vcpu), GFP_KERNEL); 1179 if (!vcpu_book3s)
1063 if (!vcpu_book3s->shadow_vcpu)
1064 goto free_vcpu; 1180 goto free_vcpu;
1181 vcpu->arch.book3s = vcpu_book3s;
1182
1183#ifdef CONFIG_KVM_BOOK3S_32
1184 vcpu->arch.shadow_vcpu =
1185 kzalloc(sizeof(*vcpu->arch.shadow_vcpu), GFP_KERNEL);
1186 if (!vcpu->arch.shadow_vcpu)
1187 goto free_vcpu3s;
1188#endif
1065 1189
1066 vcpu = &vcpu_book3s->vcpu;
1067 err = kvm_vcpu_init(vcpu, kvm, id); 1190 err = kvm_vcpu_init(vcpu, kvm, id);
1068 if (err) 1191 if (err)
1069 goto free_shadow_vcpu; 1192 goto free_shadow_vcpu;
@@ -1076,13 +1199,19 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
1076 vcpu->arch.shared = (void *)(p + PAGE_SIZE - 4096); 1199 vcpu->arch.shared = (void *)(p + PAGE_SIZE - 4096);
1077 1200
1078#ifdef CONFIG_PPC_BOOK3S_64 1201#ifdef CONFIG_PPC_BOOK3S_64
1079 /* default to book3s_64 (970fx) */ 1202 /*
1203 * Default to the same as the host if we're on sufficiently
1204 * recent machine that we have 1TB segments;
1205 * otherwise default to PPC970FX.
1206 */
1080 vcpu->arch.pvr = 0x3C0301; 1207 vcpu->arch.pvr = 0x3C0301;
1208 if (mmu_has_feature(MMU_FTR_1T_SEGMENT))
1209 vcpu->arch.pvr = mfspr(SPRN_PVR);
1081#else 1210#else
1082 /* default to book3s_32 (750) */ 1211 /* default to book3s_32 (750) */
1083 vcpu->arch.pvr = 0x84202; 1212 vcpu->arch.pvr = 0x84202;
1084#endif 1213#endif
1085 kvmppc_set_pvr(vcpu, vcpu->arch.pvr); 1214 kvmppc_set_pvr_pr(vcpu, vcpu->arch.pvr);
1086 vcpu->arch.slb_nr = 64; 1215 vcpu->arch.slb_nr = 64;
1087 1216
1088 vcpu->arch.shadow_msr = MSR_USER64; 1217 vcpu->arch.shadow_msr = MSR_USER64;
@@ -1096,32 +1225,37 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
1096uninit_vcpu: 1225uninit_vcpu:
1097 kvm_vcpu_uninit(vcpu); 1226 kvm_vcpu_uninit(vcpu);
1098free_shadow_vcpu: 1227free_shadow_vcpu:
1099 kfree(vcpu_book3s->shadow_vcpu); 1228#ifdef CONFIG_KVM_BOOK3S_32
1100free_vcpu: 1229 kfree(vcpu->arch.shadow_vcpu);
1230free_vcpu3s:
1231#endif
1101 vfree(vcpu_book3s); 1232 vfree(vcpu_book3s);
1233free_vcpu:
1234 kmem_cache_free(kvm_vcpu_cache, vcpu);
1102out: 1235out:
1103 return ERR_PTR(err); 1236 return ERR_PTR(err);
1104} 1237}
1105 1238
1106void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu) 1239static void kvmppc_core_vcpu_free_pr(struct kvm_vcpu *vcpu)
1107{ 1240{
1108 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu); 1241 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
1109 1242
1110 free_page((unsigned long)vcpu->arch.shared & PAGE_MASK); 1243 free_page((unsigned long)vcpu->arch.shared & PAGE_MASK);
1111 kvm_vcpu_uninit(vcpu); 1244 kvm_vcpu_uninit(vcpu);
1112 kfree(vcpu_book3s->shadow_vcpu); 1245#ifdef CONFIG_KVM_BOOK3S_32
1246 kfree(vcpu->arch.shadow_vcpu);
1247#endif
1113 vfree(vcpu_book3s); 1248 vfree(vcpu_book3s);
1249 kmem_cache_free(kvm_vcpu_cache, vcpu);
1114} 1250}
1115 1251
1116int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) 1252static int kvmppc_vcpu_run_pr(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1117{ 1253{
1118 int ret; 1254 int ret;
1119 double fpr[32][TS_FPRWIDTH]; 1255 struct thread_fp_state fp;
1120 unsigned int fpscr;
1121 int fpexc_mode; 1256 int fpexc_mode;
1122#ifdef CONFIG_ALTIVEC 1257#ifdef CONFIG_ALTIVEC
1123 vector128 vr[32]; 1258 struct thread_vr_state vr;
1124 vector128 vscr;
1125 unsigned long uninitialized_var(vrsave); 1259 unsigned long uninitialized_var(vrsave);
1126 int used_vr; 1260 int used_vr;
1127#endif 1261#endif
@@ -1153,8 +1287,7 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1153 /* Save FPU state in stack */ 1287 /* Save FPU state in stack */
1154 if (current->thread.regs->msr & MSR_FP) 1288 if (current->thread.regs->msr & MSR_FP)
1155 giveup_fpu(current); 1289 giveup_fpu(current);
1156 memcpy(fpr, current->thread.fpr, sizeof(current->thread.fpr)); 1290 fp = current->thread.fp_state;
1157 fpscr = current->thread.fpscr.val;
1158 fpexc_mode = current->thread.fpexc_mode; 1291 fpexc_mode = current->thread.fpexc_mode;
1159 1292
1160#ifdef CONFIG_ALTIVEC 1293#ifdef CONFIG_ALTIVEC
@@ -1163,8 +1296,7 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1163 if (used_vr) { 1296 if (used_vr) {
1164 if (current->thread.regs->msr & MSR_VEC) 1297 if (current->thread.regs->msr & MSR_VEC)
1165 giveup_altivec(current); 1298 giveup_altivec(current);
1166 memcpy(vr, current->thread.vr, sizeof(current->thread.vr)); 1299 vr = current->thread.vr_state;
1167 vscr = current->thread.vscr;
1168 vrsave = current->thread.vrsave; 1300 vrsave = current->thread.vrsave;
1169 } 1301 }
1170#endif 1302#endif
@@ -1196,15 +1328,13 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1196 current->thread.regs->msr = ext_msr; 1328 current->thread.regs->msr = ext_msr;
1197 1329
1198 /* Restore FPU/VSX state from stack */ 1330 /* Restore FPU/VSX state from stack */
1199 memcpy(current->thread.fpr, fpr, sizeof(current->thread.fpr)); 1331 current->thread.fp_state = fp;
1200 current->thread.fpscr.val = fpscr;
1201 current->thread.fpexc_mode = fpexc_mode; 1332 current->thread.fpexc_mode = fpexc_mode;
1202 1333
1203#ifdef CONFIG_ALTIVEC 1334#ifdef CONFIG_ALTIVEC
1204 /* Restore Altivec state from stack */ 1335 /* Restore Altivec state from stack */
1205 if (used_vr && current->thread.used_vr) { 1336 if (used_vr && current->thread.used_vr) {
1206 memcpy(current->thread.vr, vr, sizeof(current->thread.vr)); 1337 current->thread.vr_state = vr;
1207 current->thread.vscr = vscr;
1208 current->thread.vrsave = vrsave; 1338 current->thread.vrsave = vrsave;
1209 } 1339 }
1210 current->thread.used_vr = used_vr; 1340 current->thread.used_vr = used_vr;
@@ -1222,8 +1352,8 @@ out:
1222/* 1352/*
1223 * Get (and clear) the dirty memory log for a memory slot. 1353 * Get (and clear) the dirty memory log for a memory slot.
1224 */ 1354 */
1225int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, 1355static int kvm_vm_ioctl_get_dirty_log_pr(struct kvm *kvm,
1226 struct kvm_dirty_log *log) 1356 struct kvm_dirty_log *log)
1227{ 1357{
1228 struct kvm_memory_slot *memslot; 1358 struct kvm_memory_slot *memslot;
1229 struct kvm_vcpu *vcpu; 1359 struct kvm_vcpu *vcpu;
@@ -1258,67 +1388,100 @@ out:
1258 return r; 1388 return r;
1259} 1389}
1260 1390
1261#ifdef CONFIG_PPC64 1391static void kvmppc_core_flush_memslot_pr(struct kvm *kvm,
1262int kvm_vm_ioctl_get_smmu_info(struct kvm *kvm, struct kvm_ppc_smmu_info *info) 1392 struct kvm_memory_slot *memslot)
1263{ 1393{
1264 info->flags = KVM_PPC_1T_SEGMENTS; 1394 return;
1265 1395}
1266 /* SLB is always 64 entries */
1267 info->slb_size = 64;
1268
1269 /* Standard 4k base page size segment */
1270 info->sps[0].page_shift = 12;
1271 info->sps[0].slb_enc = 0;
1272 info->sps[0].enc[0].page_shift = 12;
1273 info->sps[0].enc[0].pte_enc = 0;
1274
1275 /* Standard 16M large page size segment */
1276 info->sps[1].page_shift = 24;
1277 info->sps[1].slb_enc = SLB_VSID_L;
1278 info->sps[1].enc[0].page_shift = 24;
1279 info->sps[1].enc[0].pte_enc = 0;
1280 1396
1397static int kvmppc_core_prepare_memory_region_pr(struct kvm *kvm,
1398 struct kvm_memory_slot *memslot,
1399 struct kvm_userspace_memory_region *mem)
1400{
1281 return 0; 1401 return 0;
1282} 1402}
1283#endif /* CONFIG_PPC64 */
1284 1403
1285void kvmppc_core_free_memslot(struct kvm_memory_slot *free, 1404static void kvmppc_core_commit_memory_region_pr(struct kvm *kvm,
1286 struct kvm_memory_slot *dont) 1405 struct kvm_userspace_memory_region *mem,
1406 const struct kvm_memory_slot *old)
1287{ 1407{
1408 return;
1288} 1409}
1289 1410
1290int kvmppc_core_create_memslot(struct kvm_memory_slot *slot, 1411static void kvmppc_core_free_memslot_pr(struct kvm_memory_slot *free,
1291 unsigned long npages) 1412 struct kvm_memory_slot *dont)
1292{ 1413{
1293 return 0; 1414 return;
1294} 1415}
1295 1416
1296int kvmppc_core_prepare_memory_region(struct kvm *kvm, 1417static int kvmppc_core_create_memslot_pr(struct kvm_memory_slot *slot,
1297 struct kvm_memory_slot *memslot, 1418 unsigned long npages)
1298 struct kvm_userspace_memory_region *mem)
1299{ 1419{
1300 return 0; 1420 return 0;
1301} 1421}
1302 1422
1303void kvmppc_core_commit_memory_region(struct kvm *kvm, 1423
1304 struct kvm_userspace_memory_region *mem, 1424#ifdef CONFIG_PPC64
1305 const struct kvm_memory_slot *old) 1425static int kvm_vm_ioctl_get_smmu_info_pr(struct kvm *kvm,
1426 struct kvm_ppc_smmu_info *info)
1306{ 1427{
1307} 1428 long int i;
1429 struct kvm_vcpu *vcpu;
1430
1431 info->flags = 0;
1432
1433 /* SLB is always 64 entries */
1434 info->slb_size = 64;
1435
1436 /* Standard 4k base page size segment */
1437 info->sps[0].page_shift = 12;
1438 info->sps[0].slb_enc = 0;
1439 info->sps[0].enc[0].page_shift = 12;
1440 info->sps[0].enc[0].pte_enc = 0;
1441
1442 /*
1443 * 64k large page size.
1444 * We only want to put this in if the CPUs we're emulating
1445 * support it, but unfortunately we don't have a vcpu easily
1446 * to hand here to test. Just pick the first vcpu, and if
1447 * that doesn't exist yet, report the minimum capability,
1448 * i.e., no 64k pages.
1449 * 1T segment support goes along with 64k pages.
1450 */
1451 i = 1;
1452 vcpu = kvm_get_vcpu(kvm, 0);
1453 if (vcpu && (vcpu->arch.hflags & BOOK3S_HFLAG_MULTI_PGSIZE)) {
1454 info->flags = KVM_PPC_1T_SEGMENTS;
1455 info->sps[i].page_shift = 16;
1456 info->sps[i].slb_enc = SLB_VSID_L | SLB_VSID_LP_01;
1457 info->sps[i].enc[0].page_shift = 16;
1458 info->sps[i].enc[0].pte_enc = 1;
1459 ++i;
1460 }
1461
1462 /* Standard 16M large page size segment */
1463 info->sps[i].page_shift = 24;
1464 info->sps[i].slb_enc = SLB_VSID_L;
1465 info->sps[i].enc[0].page_shift = 24;
1466 info->sps[i].enc[0].pte_enc = 0;
1308 1467
1309void kvmppc_core_flush_memslot(struct kvm *kvm, struct kvm_memory_slot *memslot) 1468 return 0;
1469}
1470#else
1471static int kvm_vm_ioctl_get_smmu_info_pr(struct kvm *kvm,
1472 struct kvm_ppc_smmu_info *info)
1310{ 1473{
1474 /* We should not get called */
1475 BUG();
1311} 1476}
1477#endif /* CONFIG_PPC64 */
1312 1478
1313static unsigned int kvm_global_user_count = 0; 1479static unsigned int kvm_global_user_count = 0;
1314static DEFINE_SPINLOCK(kvm_global_user_count_lock); 1480static DEFINE_SPINLOCK(kvm_global_user_count_lock);
1315 1481
1316int kvmppc_core_init_vm(struct kvm *kvm) 1482static int kvmppc_core_init_vm_pr(struct kvm *kvm)
1317{ 1483{
1318#ifdef CONFIG_PPC64 1484 mutex_init(&kvm->arch.hpt_mutex);
1319 INIT_LIST_HEAD(&kvm->arch.spapr_tce_tables);
1320 INIT_LIST_HEAD(&kvm->arch.rtas_tokens);
1321#endif
1322 1485
1323 if (firmware_has_feature(FW_FEATURE_SET_MODE)) { 1486 if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
1324 spin_lock(&kvm_global_user_count_lock); 1487 spin_lock(&kvm_global_user_count_lock);
@@ -1329,7 +1492,7 @@ int kvmppc_core_init_vm(struct kvm *kvm)
1329 return 0; 1492 return 0;
1330} 1493}
1331 1494
1332void kvmppc_core_destroy_vm(struct kvm *kvm) 1495static void kvmppc_core_destroy_vm_pr(struct kvm *kvm)
1333{ 1496{
1334#ifdef CONFIG_PPC64 1497#ifdef CONFIG_PPC64
1335 WARN_ON(!list_empty(&kvm->arch.spapr_tce_tables)); 1498 WARN_ON(!list_empty(&kvm->arch.spapr_tce_tables));
@@ -1344,26 +1507,81 @@ void kvmppc_core_destroy_vm(struct kvm *kvm)
1344 } 1507 }
1345} 1508}
1346 1509
1347static int kvmppc_book3s_init(void) 1510static int kvmppc_core_check_processor_compat_pr(void)
1348{ 1511{
1349 int r; 1512 /* we are always compatible */
1513 return 0;
1514}
1350 1515
1351 r = kvm_init(NULL, sizeof(struct kvmppc_vcpu_book3s), 0, 1516static long kvm_arch_vm_ioctl_pr(struct file *filp,
1352 THIS_MODULE); 1517 unsigned int ioctl, unsigned long arg)
1518{
1519 return -ENOTTY;
1520}
1353 1521
1354 if (r) 1522static struct kvmppc_ops kvm_ops_pr = {
1523 .get_sregs = kvm_arch_vcpu_ioctl_get_sregs_pr,
1524 .set_sregs = kvm_arch_vcpu_ioctl_set_sregs_pr,
1525 .get_one_reg = kvmppc_get_one_reg_pr,
1526 .set_one_reg = kvmppc_set_one_reg_pr,
1527 .vcpu_load = kvmppc_core_vcpu_load_pr,
1528 .vcpu_put = kvmppc_core_vcpu_put_pr,
1529 .set_msr = kvmppc_set_msr_pr,
1530 .vcpu_run = kvmppc_vcpu_run_pr,
1531 .vcpu_create = kvmppc_core_vcpu_create_pr,
1532 .vcpu_free = kvmppc_core_vcpu_free_pr,
1533 .check_requests = kvmppc_core_check_requests_pr,
1534 .get_dirty_log = kvm_vm_ioctl_get_dirty_log_pr,
1535 .flush_memslot = kvmppc_core_flush_memslot_pr,
1536 .prepare_memory_region = kvmppc_core_prepare_memory_region_pr,
1537 .commit_memory_region = kvmppc_core_commit_memory_region_pr,
1538 .unmap_hva = kvm_unmap_hva_pr,
1539 .unmap_hva_range = kvm_unmap_hva_range_pr,
1540 .age_hva = kvm_age_hva_pr,
1541 .test_age_hva = kvm_test_age_hva_pr,
1542 .set_spte_hva = kvm_set_spte_hva_pr,
1543 .mmu_destroy = kvmppc_mmu_destroy_pr,
1544 .free_memslot = kvmppc_core_free_memslot_pr,
1545 .create_memslot = kvmppc_core_create_memslot_pr,
1546 .init_vm = kvmppc_core_init_vm_pr,
1547 .destroy_vm = kvmppc_core_destroy_vm_pr,
1548 .get_smmu_info = kvm_vm_ioctl_get_smmu_info_pr,
1549 .emulate_op = kvmppc_core_emulate_op_pr,
1550 .emulate_mtspr = kvmppc_core_emulate_mtspr_pr,
1551 .emulate_mfspr = kvmppc_core_emulate_mfspr_pr,
1552 .fast_vcpu_kick = kvm_vcpu_kick,
1553 .arch_vm_ioctl = kvm_arch_vm_ioctl_pr,
1554};
1555
1556
1557int kvmppc_book3s_init_pr(void)
1558{
1559 int r;
1560
1561 r = kvmppc_core_check_processor_compat_pr();
1562 if (r < 0)
1355 return r; 1563 return r;
1356 1564
1357 r = kvmppc_mmu_hpte_sysinit(); 1565 kvm_ops_pr.owner = THIS_MODULE;
1566 kvmppc_pr_ops = &kvm_ops_pr;
1358 1567
1568 r = kvmppc_mmu_hpte_sysinit();
1359 return r; 1569 return r;
1360} 1570}
1361 1571
1362static void kvmppc_book3s_exit(void) 1572void kvmppc_book3s_exit_pr(void)
1363{ 1573{
1574 kvmppc_pr_ops = NULL;
1364 kvmppc_mmu_hpte_sysexit(); 1575 kvmppc_mmu_hpte_sysexit();
1365 kvm_exit();
1366} 1576}
1367 1577
1368module_init(kvmppc_book3s_init); 1578/*
1369module_exit(kvmppc_book3s_exit); 1579 * We only support separate modules for book3s 64
1580 */
1581#ifdef CONFIG_PPC_BOOK3S_64
1582
1583module_init(kvmppc_book3s_init_pr);
1584module_exit(kvmppc_book3s_exit_pr);
1585
1586MODULE_LICENSE("GPL");
1587#endif
diff --git a/arch/powerpc/kvm/book3s_pr_papr.c b/arch/powerpc/kvm/book3s_pr_papr.c
index da0e0bc268bd..5efa97b993d8 100644
--- a/arch/powerpc/kvm/book3s_pr_papr.c
+++ b/arch/powerpc/kvm/book3s_pr_papr.c
@@ -21,6 +21,8 @@
21#include <asm/kvm_ppc.h> 21#include <asm/kvm_ppc.h>
22#include <asm/kvm_book3s.h> 22#include <asm/kvm_book3s.h>
23 23
24#define HPTE_SIZE 16 /* bytes per HPT entry */
25
24static unsigned long get_pteg_addr(struct kvm_vcpu *vcpu, long pte_index) 26static unsigned long get_pteg_addr(struct kvm_vcpu *vcpu, long pte_index)
25{ 27{
26 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu); 28 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
@@ -40,32 +42,41 @@ static int kvmppc_h_pr_enter(struct kvm_vcpu *vcpu)
40 long pte_index = kvmppc_get_gpr(vcpu, 5); 42 long pte_index = kvmppc_get_gpr(vcpu, 5);
41 unsigned long pteg[2 * 8]; 43 unsigned long pteg[2 * 8];
42 unsigned long pteg_addr, i, *hpte; 44 unsigned long pteg_addr, i, *hpte;
45 long int ret;
43 46
47 i = pte_index & 7;
44 pte_index &= ~7UL; 48 pte_index &= ~7UL;
45 pteg_addr = get_pteg_addr(vcpu, pte_index); 49 pteg_addr = get_pteg_addr(vcpu, pte_index);
46 50
51 mutex_lock(&vcpu->kvm->arch.hpt_mutex);
47 copy_from_user(pteg, (void __user *)pteg_addr, sizeof(pteg)); 52 copy_from_user(pteg, (void __user *)pteg_addr, sizeof(pteg));
48 hpte = pteg; 53 hpte = pteg;
49 54
55 ret = H_PTEG_FULL;
50 if (likely((flags & H_EXACT) == 0)) { 56 if (likely((flags & H_EXACT) == 0)) {
51 pte_index &= ~7UL;
52 for (i = 0; ; ++i) { 57 for (i = 0; ; ++i) {
53 if (i == 8) 58 if (i == 8)
54 return H_PTEG_FULL; 59 goto done;
55 if ((*hpte & HPTE_V_VALID) == 0) 60 if ((*hpte & HPTE_V_VALID) == 0)
56 break; 61 break;
57 hpte += 2; 62 hpte += 2;
58 } 63 }
59 } else { 64 } else {
60 i = kvmppc_get_gpr(vcpu, 5) & 7UL;
61 hpte += i * 2; 65 hpte += i * 2;
66 if (*hpte & HPTE_V_VALID)
67 goto done;
62 } 68 }
63 69
64 hpte[0] = kvmppc_get_gpr(vcpu, 6); 70 hpte[0] = kvmppc_get_gpr(vcpu, 6);
65 hpte[1] = kvmppc_get_gpr(vcpu, 7); 71 hpte[1] = kvmppc_get_gpr(vcpu, 7);
66 copy_to_user((void __user *)pteg_addr, pteg, sizeof(pteg)); 72 pteg_addr += i * HPTE_SIZE;
67 kvmppc_set_gpr(vcpu, 3, H_SUCCESS); 73 copy_to_user((void __user *)pteg_addr, hpte, HPTE_SIZE);
68 kvmppc_set_gpr(vcpu, 4, pte_index | i); 74 kvmppc_set_gpr(vcpu, 4, pte_index | i);
75 ret = H_SUCCESS;
76
77 done:
78 mutex_unlock(&vcpu->kvm->arch.hpt_mutex);
79 kvmppc_set_gpr(vcpu, 3, ret);
69 80
70 return EMULATE_DONE; 81 return EMULATE_DONE;
71} 82}
@@ -77,26 +88,31 @@ static int kvmppc_h_pr_remove(struct kvm_vcpu *vcpu)
77 unsigned long avpn = kvmppc_get_gpr(vcpu, 6); 88 unsigned long avpn = kvmppc_get_gpr(vcpu, 6);
78 unsigned long v = 0, pteg, rb; 89 unsigned long v = 0, pteg, rb;
79 unsigned long pte[2]; 90 unsigned long pte[2];
91 long int ret;
80 92
81 pteg = get_pteg_addr(vcpu, pte_index); 93 pteg = get_pteg_addr(vcpu, pte_index);
94 mutex_lock(&vcpu->kvm->arch.hpt_mutex);
82 copy_from_user(pte, (void __user *)pteg, sizeof(pte)); 95 copy_from_user(pte, (void __user *)pteg, sizeof(pte));
83 96
97 ret = H_NOT_FOUND;
84 if ((pte[0] & HPTE_V_VALID) == 0 || 98 if ((pte[0] & HPTE_V_VALID) == 0 ||
85 ((flags & H_AVPN) && (pte[0] & ~0x7fUL) != avpn) || 99 ((flags & H_AVPN) && (pte[0] & ~0x7fUL) != avpn) ||
86 ((flags & H_ANDCOND) && (pte[0] & avpn) != 0)) { 100 ((flags & H_ANDCOND) && (pte[0] & avpn) != 0))
87 kvmppc_set_gpr(vcpu, 3, H_NOT_FOUND); 101 goto done;
88 return EMULATE_DONE;
89 }
90 102
91 copy_to_user((void __user *)pteg, &v, sizeof(v)); 103 copy_to_user((void __user *)pteg, &v, sizeof(v));
92 104
93 rb = compute_tlbie_rb(pte[0], pte[1], pte_index); 105 rb = compute_tlbie_rb(pte[0], pte[1], pte_index);
94 vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false); 106 vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false);
95 107
96 kvmppc_set_gpr(vcpu, 3, H_SUCCESS); 108 ret = H_SUCCESS;
97 kvmppc_set_gpr(vcpu, 4, pte[0]); 109 kvmppc_set_gpr(vcpu, 4, pte[0]);
98 kvmppc_set_gpr(vcpu, 5, pte[1]); 110 kvmppc_set_gpr(vcpu, 5, pte[1]);
99 111
112 done:
113 mutex_unlock(&vcpu->kvm->arch.hpt_mutex);
114 kvmppc_set_gpr(vcpu, 3, ret);
115
100 return EMULATE_DONE; 116 return EMULATE_DONE;
101} 117}
102 118
@@ -124,6 +140,7 @@ static int kvmppc_h_pr_bulk_remove(struct kvm_vcpu *vcpu)
124 int paramnr = 4; 140 int paramnr = 4;
125 int ret = H_SUCCESS; 141 int ret = H_SUCCESS;
126 142
143 mutex_lock(&vcpu->kvm->arch.hpt_mutex);
127 for (i = 0; i < H_BULK_REMOVE_MAX_BATCH; i++) { 144 for (i = 0; i < H_BULK_REMOVE_MAX_BATCH; i++) {
128 unsigned long tsh = kvmppc_get_gpr(vcpu, paramnr+(2*i)); 145 unsigned long tsh = kvmppc_get_gpr(vcpu, paramnr+(2*i));
129 unsigned long tsl = kvmppc_get_gpr(vcpu, paramnr+(2*i)+1); 146 unsigned long tsl = kvmppc_get_gpr(vcpu, paramnr+(2*i)+1);
@@ -172,6 +189,7 @@ static int kvmppc_h_pr_bulk_remove(struct kvm_vcpu *vcpu)
172 } 189 }
173 kvmppc_set_gpr(vcpu, paramnr+(2*i), tsh); 190 kvmppc_set_gpr(vcpu, paramnr+(2*i), tsh);
174 } 191 }
192 mutex_unlock(&vcpu->kvm->arch.hpt_mutex);
175 kvmppc_set_gpr(vcpu, 3, ret); 193 kvmppc_set_gpr(vcpu, 3, ret);
176 194
177 return EMULATE_DONE; 195 return EMULATE_DONE;
@@ -184,15 +202,16 @@ static int kvmppc_h_pr_protect(struct kvm_vcpu *vcpu)
184 unsigned long avpn = kvmppc_get_gpr(vcpu, 6); 202 unsigned long avpn = kvmppc_get_gpr(vcpu, 6);
185 unsigned long rb, pteg, r, v; 203 unsigned long rb, pteg, r, v;
186 unsigned long pte[2]; 204 unsigned long pte[2];
205 long int ret;
187 206
188 pteg = get_pteg_addr(vcpu, pte_index); 207 pteg = get_pteg_addr(vcpu, pte_index);
208 mutex_lock(&vcpu->kvm->arch.hpt_mutex);
189 copy_from_user(pte, (void __user *)pteg, sizeof(pte)); 209 copy_from_user(pte, (void __user *)pteg, sizeof(pte));
190 210
211 ret = H_NOT_FOUND;
191 if ((pte[0] & HPTE_V_VALID) == 0 || 212 if ((pte[0] & HPTE_V_VALID) == 0 ||
192 ((flags & H_AVPN) && (pte[0] & ~0x7fUL) != avpn)) { 213 ((flags & H_AVPN) && (pte[0] & ~0x7fUL) != avpn))
193 kvmppc_set_gpr(vcpu, 3, H_NOT_FOUND); 214 goto done;
194 return EMULATE_DONE;
195 }
196 215
197 v = pte[0]; 216 v = pte[0];
198 r = pte[1]; 217 r = pte[1];
@@ -207,8 +226,11 @@ static int kvmppc_h_pr_protect(struct kvm_vcpu *vcpu)
207 rb = compute_tlbie_rb(v, r, pte_index); 226 rb = compute_tlbie_rb(v, r, pte_index);
208 vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false); 227 vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false);
209 copy_to_user((void __user *)pteg, pte, sizeof(pte)); 228 copy_to_user((void __user *)pteg, pte, sizeof(pte));
229 ret = H_SUCCESS;
210 230
211 kvmppc_set_gpr(vcpu, 3, H_SUCCESS); 231 done:
232 mutex_unlock(&vcpu->kvm->arch.hpt_mutex);
233 kvmppc_set_gpr(vcpu, 3, ret);
212 234
213 return EMULATE_DONE; 235 return EMULATE_DONE;
214} 236}
diff --git a/arch/powerpc/kvm/book3s_rmhandlers.S b/arch/powerpc/kvm/book3s_rmhandlers.S
index 8f7633e3afb8..a38c4c9edab8 100644
--- a/arch/powerpc/kvm/book3s_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_rmhandlers.S
@@ -38,32 +38,6 @@
38 38
39#define FUNC(name) GLUE(.,name) 39#define FUNC(name) GLUE(.,name)
40 40
41 .globl kvmppc_skip_interrupt
42kvmppc_skip_interrupt:
43 /*
44 * Here all GPRs are unchanged from when the interrupt happened
45 * except for r13, which is saved in SPRG_SCRATCH0.
46 */
47 mfspr r13, SPRN_SRR0
48 addi r13, r13, 4
49 mtspr SPRN_SRR0, r13
50 GET_SCRATCH0(r13)
51 rfid
52 b .
53
54 .globl kvmppc_skip_Hinterrupt
55kvmppc_skip_Hinterrupt:
56 /*
57 * Here all GPRs are unchanged from when the interrupt happened
58 * except for r13, which is saved in SPRG_SCRATCH0.
59 */
60 mfspr r13, SPRN_HSRR0
61 addi r13, r13, 4
62 mtspr SPRN_HSRR0, r13
63 GET_SCRATCH0(r13)
64 hrfid
65 b .
66
67#elif defined(CONFIG_PPC_BOOK3S_32) 41#elif defined(CONFIG_PPC_BOOK3S_32)
68 42
69#define FUNC(name) name 43#define FUNC(name) name
@@ -179,11 +153,15 @@ _GLOBAL(kvmppc_entry_trampoline)
179 153
180 li r6, MSR_IR | MSR_DR 154 li r6, MSR_IR | MSR_DR
181 andc r6, r5, r6 /* Clear DR and IR in MSR value */ 155 andc r6, r5, r6 /* Clear DR and IR in MSR value */
156#ifdef CONFIG_PPC_BOOK3S_32
182 /* 157 /*
183 * Set EE in HOST_MSR so that it's enabled when we get into our 158 * Set EE in HOST_MSR so that it's enabled when we get into our
184 * C exit handler function 159 * C exit handler function. On 64-bit we delay enabling
160 * interrupts until we have finished transferring stuff
161 * to or from the PACA.
185 */ 162 */
186 ori r5, r5, MSR_EE 163 ori r5, r5, MSR_EE
164#endif
187 mtsrr0 r7 165 mtsrr0 r7
188 mtsrr1 r6 166 mtsrr1 r6
189 RFI 167 RFI
diff --git a/arch/powerpc/kvm/book3s_rtas.c b/arch/powerpc/kvm/book3s_rtas.c
index 3219ba895246..cf95cdef73c9 100644
--- a/arch/powerpc/kvm/book3s_rtas.c
+++ b/arch/powerpc/kvm/book3s_rtas.c
@@ -260,6 +260,7 @@ fail:
260 */ 260 */
261 return rc; 261 return rc;
262} 262}
263EXPORT_SYMBOL_GPL(kvmppc_rtas_hcall);
263 264
264void kvmppc_rtas_tokens_free(struct kvm *kvm) 265void kvmppc_rtas_tokens_free(struct kvm *kvm)
265{ 266{
diff --git a/arch/powerpc/kvm/book3s_segment.S b/arch/powerpc/kvm/book3s_segment.S
index 1abe4788191a..bc50c97751d3 100644
--- a/arch/powerpc/kvm/book3s_segment.S
+++ b/arch/powerpc/kvm/book3s_segment.S
@@ -161,8 +161,8 @@ kvmppc_handler_trampoline_enter_end:
161.global kvmppc_handler_trampoline_exit 161.global kvmppc_handler_trampoline_exit
162kvmppc_handler_trampoline_exit: 162kvmppc_handler_trampoline_exit:
163 163
164.global kvmppc_interrupt 164.global kvmppc_interrupt_pr
165kvmppc_interrupt: 165kvmppc_interrupt_pr:
166 166
167 /* Register usage at this point: 167 /* Register usage at this point:
168 * 168 *
diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c
index a3a5cb8ee7ea..02a17dcf1610 100644
--- a/arch/powerpc/kvm/book3s_xics.c
+++ b/arch/powerpc/kvm/book3s_xics.c
@@ -818,7 +818,7 @@ int kvmppc_xics_hcall(struct kvm_vcpu *vcpu, u32 req)
818 } 818 }
819 819
820 /* Check for real mode returning too hard */ 820 /* Check for real mode returning too hard */
821 if (xics->real_mode) 821 if (xics->real_mode && is_kvmppc_hv_enabled(vcpu->kvm))
822 return kvmppc_xics_rm_complete(vcpu, req); 822 return kvmppc_xics_rm_complete(vcpu, req);
823 823
824 switch (req) { 824 switch (req) {
@@ -840,6 +840,7 @@ int kvmppc_xics_hcall(struct kvm_vcpu *vcpu, u32 req)
840 840
841 return rc; 841 return rc;
842} 842}
843EXPORT_SYMBOL_GPL(kvmppc_xics_hcall);
843 844
844 845
845/* -- Initialisation code etc. -- */ 846/* -- Initialisation code etc. -- */
@@ -1250,13 +1251,13 @@ static int kvmppc_xics_create(struct kvm_device *dev, u32 type)
1250 1251
1251 xics_debugfs_init(xics); 1252 xics_debugfs_init(xics);
1252 1253
1253#ifdef CONFIG_KVM_BOOK3S_64_HV 1254#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
1254 if (cpu_has_feature(CPU_FTR_ARCH_206)) { 1255 if (cpu_has_feature(CPU_FTR_ARCH_206)) {
1255 /* Enable real mode support */ 1256 /* Enable real mode support */
1256 xics->real_mode = ENABLE_REALMODE; 1257 xics->real_mode = ENABLE_REALMODE;
1257 xics->real_mode_dbg = DEBUG_REALMODE; 1258 xics->real_mode_dbg = DEBUG_REALMODE;
1258 } 1259 }
1259#endif /* CONFIG_KVM_BOOK3S_64_HV */ 1260#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */
1260 1261
1261 return 0; 1262 return 0;
1262} 1263}
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 17722d82f1d1..53e65a210b9a 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -40,7 +40,9 @@
40 40
41#include "timing.h" 41#include "timing.h"
42#include "booke.h" 42#include "booke.h"
43#include "trace.h" 43
44#define CREATE_TRACE_POINTS
45#include "trace_booke.h"
44 46
45unsigned long kvmppc_booke_handlers; 47unsigned long kvmppc_booke_handlers;
46 48
@@ -133,6 +135,29 @@ static void kvmppc_vcpu_sync_fpu(struct kvm_vcpu *vcpu)
133#endif 135#endif
134} 136}
135 137
138static void kvmppc_vcpu_sync_debug(struct kvm_vcpu *vcpu)
139{
140 /* Synchronize guest's desire to get debug interrupts into shadow MSR */
141#ifndef CONFIG_KVM_BOOKE_HV
142 vcpu->arch.shadow_msr &= ~MSR_DE;
143 vcpu->arch.shadow_msr |= vcpu->arch.shared->msr & MSR_DE;
144#endif
145
146 /* Force enable debug interrupts when user space wants to debug */
147 if (vcpu->guest_debug) {
148#ifdef CONFIG_KVM_BOOKE_HV
149 /*
150 * Since there is no shadow MSR, sync MSR_DE into the guest
151 * visible MSR.
152 */
153 vcpu->arch.shared->msr |= MSR_DE;
154#else
155 vcpu->arch.shadow_msr |= MSR_DE;
156 vcpu->arch.shared->msr &= ~MSR_DE;
157#endif
158 }
159}
160
136/* 161/*
137 * Helper function for "full" MSR writes. No need to call this if only 162 * Helper function for "full" MSR writes. No need to call this if only
138 * EE/CE/ME/DE/RI are changing. 163 * EE/CE/ME/DE/RI are changing.
@@ -150,6 +175,7 @@ void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr)
150 kvmppc_mmu_msr_notify(vcpu, old_msr); 175 kvmppc_mmu_msr_notify(vcpu, old_msr);
151 kvmppc_vcpu_sync_spe(vcpu); 176 kvmppc_vcpu_sync_spe(vcpu);
152 kvmppc_vcpu_sync_fpu(vcpu); 177 kvmppc_vcpu_sync_fpu(vcpu);
178 kvmppc_vcpu_sync_debug(vcpu);
153} 179}
154 180
155static void kvmppc_booke_queue_irqprio(struct kvm_vcpu *vcpu, 181static void kvmppc_booke_queue_irqprio(struct kvm_vcpu *vcpu,
@@ -655,10 +681,10 @@ int kvmppc_core_check_requests(struct kvm_vcpu *vcpu)
655int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) 681int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
656{ 682{
657 int ret, s; 683 int ret, s;
684 struct thread_struct thread;
658#ifdef CONFIG_PPC_FPU 685#ifdef CONFIG_PPC_FPU
659 unsigned int fpscr; 686 struct thread_fp_state fp;
660 int fpexc_mode; 687 int fpexc_mode;
661 u64 fpr[32];
662#endif 688#endif
663 689
664 if (!vcpu->arch.sane) { 690 if (!vcpu->arch.sane) {
@@ -677,13 +703,13 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
677#ifdef CONFIG_PPC_FPU 703#ifdef CONFIG_PPC_FPU
678 /* Save userspace FPU state in stack */ 704 /* Save userspace FPU state in stack */
679 enable_kernel_fp(); 705 enable_kernel_fp();
680 memcpy(fpr, current->thread.fpr, sizeof(current->thread.fpr)); 706 fp = current->thread.fp_state;
681 fpscr = current->thread.fpscr.val;
682 fpexc_mode = current->thread.fpexc_mode; 707 fpexc_mode = current->thread.fpexc_mode;
683 708
684 /* Restore guest FPU state to thread */ 709 /* Restore guest FPU state to thread */
685 memcpy(current->thread.fpr, vcpu->arch.fpr, sizeof(vcpu->arch.fpr)); 710 memcpy(current->thread.fp_state.fpr, vcpu->arch.fpr,
686 current->thread.fpscr.val = vcpu->arch.fpscr; 711 sizeof(vcpu->arch.fpr));
712 current->thread.fp_state.fpscr = vcpu->arch.fpscr;
687 713
688 /* 714 /*
689 * Since we can't trap on MSR_FP in GS-mode, we consider the guest 715 * Since we can't trap on MSR_FP in GS-mode, we consider the guest
@@ -696,6 +722,12 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
696 kvmppc_load_guest_fp(vcpu); 722 kvmppc_load_guest_fp(vcpu);
697#endif 723#endif
698 724
725 /* Switch to guest debug context */
726 thread.debug = vcpu->arch.shadow_dbg_reg;
727 switch_booke_debug_regs(&thread);
728 thread.debug = current->thread.debug;
729 current->thread.debug = vcpu->arch.shadow_dbg_reg;
730
699 kvmppc_fix_ee_before_entry(); 731 kvmppc_fix_ee_before_entry();
700 732
701 ret = __kvmppc_vcpu_run(kvm_run, vcpu); 733 ret = __kvmppc_vcpu_run(kvm_run, vcpu);
@@ -703,18 +735,22 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
703 /* No need for kvm_guest_exit. It's done in handle_exit. 735 /* No need for kvm_guest_exit. It's done in handle_exit.
704 We also get here with interrupts enabled. */ 736 We also get here with interrupts enabled. */
705 737
738 /* Switch back to user space debug context */
739 switch_booke_debug_regs(&thread);
740 current->thread.debug = thread.debug;
741
706#ifdef CONFIG_PPC_FPU 742#ifdef CONFIG_PPC_FPU
707 kvmppc_save_guest_fp(vcpu); 743 kvmppc_save_guest_fp(vcpu);
708 744
709 vcpu->fpu_active = 0; 745 vcpu->fpu_active = 0;
710 746
711 /* Save guest FPU state from thread */ 747 /* Save guest FPU state from thread */
712 memcpy(vcpu->arch.fpr, current->thread.fpr, sizeof(vcpu->arch.fpr)); 748 memcpy(vcpu->arch.fpr, current->thread.fp_state.fpr,
713 vcpu->arch.fpscr = current->thread.fpscr.val; 749 sizeof(vcpu->arch.fpr));
750 vcpu->arch.fpscr = current->thread.fp_state.fpscr;
714 751
715 /* Restore userspace FPU state from stack */ 752 /* Restore userspace FPU state from stack */
716 memcpy(current->thread.fpr, fpr, sizeof(current->thread.fpr)); 753 current->thread.fp_state = fp;
717 current->thread.fpscr.val = fpscr;
718 current->thread.fpexc_mode = fpexc_mode; 754 current->thread.fpexc_mode = fpexc_mode;
719#endif 755#endif
720 756
@@ -758,6 +794,30 @@ static int emulation_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
758 } 794 }
759} 795}
760 796
797static int kvmppc_handle_debug(struct kvm_run *run, struct kvm_vcpu *vcpu)
798{
799 struct debug_reg *dbg_reg = &(vcpu->arch.shadow_dbg_reg);
800 u32 dbsr = vcpu->arch.dbsr;
801
802 run->debug.arch.status = 0;
803 run->debug.arch.address = vcpu->arch.pc;
804
805 if (dbsr & (DBSR_IAC1 | DBSR_IAC2 | DBSR_IAC3 | DBSR_IAC4)) {
806 run->debug.arch.status |= KVMPPC_DEBUG_BREAKPOINT;
807 } else {
808 if (dbsr & (DBSR_DAC1W | DBSR_DAC2W))
809 run->debug.arch.status |= KVMPPC_DEBUG_WATCH_WRITE;
810 else if (dbsr & (DBSR_DAC1R | DBSR_DAC2R))
811 run->debug.arch.status |= KVMPPC_DEBUG_WATCH_READ;
812 if (dbsr & (DBSR_DAC1R | DBSR_DAC1W))
813 run->debug.arch.address = dbg_reg->dac1;
814 else if (dbsr & (DBSR_DAC2R | DBSR_DAC2W))
815 run->debug.arch.address = dbg_reg->dac2;
816 }
817
818 return RESUME_HOST;
819}
820
761static void kvmppc_fill_pt_regs(struct pt_regs *regs) 821static void kvmppc_fill_pt_regs(struct pt_regs *regs)
762{ 822{
763 ulong r1, ip, msr, lr; 823 ulong r1, ip, msr, lr;
@@ -818,6 +878,11 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
818 case BOOKE_INTERRUPT_CRITICAL: 878 case BOOKE_INTERRUPT_CRITICAL:
819 unknown_exception(&regs); 879 unknown_exception(&regs);
820 break; 880 break;
881 case BOOKE_INTERRUPT_DEBUG:
882 /* Save DBSR before preemption is enabled */
883 vcpu->arch.dbsr = mfspr(SPRN_DBSR);
884 kvmppc_clear_dbsr();
885 break;
821 } 886 }
822} 887}
823 888
@@ -1135,18 +1200,10 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
1135 } 1200 }
1136 1201
1137 case BOOKE_INTERRUPT_DEBUG: { 1202 case BOOKE_INTERRUPT_DEBUG: {
1138 u32 dbsr; 1203 r = kvmppc_handle_debug(run, vcpu);
1139 1204 if (r == RESUME_HOST)
1140 vcpu->arch.pc = mfspr(SPRN_CSRR0); 1205 run->exit_reason = KVM_EXIT_DEBUG;
1141
1142 /* clear IAC events in DBSR register */
1143 dbsr = mfspr(SPRN_DBSR);
1144 dbsr &= DBSR_IAC1 | DBSR_IAC2 | DBSR_IAC3 | DBSR_IAC4;
1145 mtspr(SPRN_DBSR, dbsr);
1146
1147 run->exit_reason = KVM_EXIT_DEBUG;
1148 kvmppc_account_exit(vcpu, DEBUG_EXITS); 1206 kvmppc_account_exit(vcpu, DEBUG_EXITS);
1149 r = RESUME_HOST;
1150 break; 1207 break;
1151 } 1208 }
1152 1209
@@ -1197,7 +1254,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
1197 kvmppc_set_msr(vcpu, 0); 1254 kvmppc_set_msr(vcpu, 0);
1198 1255
1199#ifndef CONFIG_KVM_BOOKE_HV 1256#ifndef CONFIG_KVM_BOOKE_HV
1200 vcpu->arch.shadow_msr = MSR_USER | MSR_DE | MSR_IS | MSR_DS; 1257 vcpu->arch.shadow_msr = MSR_USER | MSR_IS | MSR_DS;
1201 vcpu->arch.shadow_pid = 1; 1258 vcpu->arch.shadow_pid = 1;
1202 vcpu->arch.shared->msr = 0; 1259 vcpu->arch.shared->msr = 0;
1203#endif 1260#endif
@@ -1359,7 +1416,7 @@ static int set_sregs_arch206(struct kvm_vcpu *vcpu,
1359 return 0; 1416 return 0;
1360} 1417}
1361 1418
1362void kvmppc_get_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) 1419int kvmppc_get_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
1363{ 1420{
1364 sregs->u.e.features |= KVM_SREGS_E_IVOR; 1421 sregs->u.e.features |= KVM_SREGS_E_IVOR;
1365 1422
@@ -1379,6 +1436,7 @@ void kvmppc_get_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
1379 sregs->u.e.ivor_low[13] = vcpu->arch.ivor[BOOKE_IRQPRIO_DTLB_MISS]; 1436 sregs->u.e.ivor_low[13] = vcpu->arch.ivor[BOOKE_IRQPRIO_DTLB_MISS];
1380 sregs->u.e.ivor_low[14] = vcpu->arch.ivor[BOOKE_IRQPRIO_ITLB_MISS]; 1437 sregs->u.e.ivor_low[14] = vcpu->arch.ivor[BOOKE_IRQPRIO_ITLB_MISS];
1381 sregs->u.e.ivor_low[15] = vcpu->arch.ivor[BOOKE_IRQPRIO_DEBUG]; 1438 sregs->u.e.ivor_low[15] = vcpu->arch.ivor[BOOKE_IRQPRIO_DEBUG];
1439 return 0;
1382} 1440}
1383 1441
1384int kvmppc_set_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) 1442int kvmppc_set_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
@@ -1413,8 +1471,7 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
1413 1471
1414 get_sregs_base(vcpu, sregs); 1472 get_sregs_base(vcpu, sregs);
1415 get_sregs_arch206(vcpu, sregs); 1473 get_sregs_arch206(vcpu, sregs);
1416 kvmppc_core_get_sregs(vcpu, sregs); 1474 return vcpu->kvm->arch.kvm_ops->get_sregs(vcpu, sregs);
1417 return 0;
1418} 1475}
1419 1476
1420int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, 1477int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
@@ -1433,7 +1490,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
1433 if (ret < 0) 1490 if (ret < 0)
1434 return ret; 1491 return ret;
1435 1492
1436 return kvmppc_core_set_sregs(vcpu, sregs); 1493 return vcpu->kvm->arch.kvm_ops->set_sregs(vcpu, sregs);
1437} 1494}
1438 1495
1439int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) 1496int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
@@ -1441,7 +1498,6 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
1441 int r = 0; 1498 int r = 0;
1442 union kvmppc_one_reg val; 1499 union kvmppc_one_reg val;
1443 int size; 1500 int size;
1444 long int i;
1445 1501
1446 size = one_reg_size(reg->id); 1502 size = one_reg_size(reg->id);
1447 if (size > sizeof(val)) 1503 if (size > sizeof(val))
@@ -1449,16 +1505,24 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
1449 1505
1450 switch (reg->id) { 1506 switch (reg->id) {
1451 case KVM_REG_PPC_IAC1: 1507 case KVM_REG_PPC_IAC1:
1508 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.iac1);
1509 break;
1452 case KVM_REG_PPC_IAC2: 1510 case KVM_REG_PPC_IAC2:
1511 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.iac2);
1512 break;
1513#if CONFIG_PPC_ADV_DEBUG_IACS > 2
1453 case KVM_REG_PPC_IAC3: 1514 case KVM_REG_PPC_IAC3:
1515 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.iac3);
1516 break;
1454 case KVM_REG_PPC_IAC4: 1517 case KVM_REG_PPC_IAC4:
1455 i = reg->id - KVM_REG_PPC_IAC1; 1518 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.iac4);
1456 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.iac[i]);
1457 break; 1519 break;
1520#endif
1458 case KVM_REG_PPC_DAC1: 1521 case KVM_REG_PPC_DAC1:
1522 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.dac1);
1523 break;
1459 case KVM_REG_PPC_DAC2: 1524 case KVM_REG_PPC_DAC2:
1460 i = reg->id - KVM_REG_PPC_DAC1; 1525 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.dac2);
1461 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.dac[i]);
1462 break; 1526 break;
1463 case KVM_REG_PPC_EPR: { 1527 case KVM_REG_PPC_EPR: {
1464 u32 epr = get_guest_epr(vcpu); 1528 u32 epr = get_guest_epr(vcpu);
@@ -1477,10 +1541,13 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
1477 val = get_reg_val(reg->id, vcpu->arch.tsr); 1541 val = get_reg_val(reg->id, vcpu->arch.tsr);
1478 break; 1542 break;
1479 case KVM_REG_PPC_DEBUG_INST: 1543 case KVM_REG_PPC_DEBUG_INST:
1480 val = get_reg_val(reg->id, KVMPPC_INST_EHPRIV); 1544 val = get_reg_val(reg->id, KVMPPC_INST_EHPRIV_DEBUG);
1545 break;
1546 case KVM_REG_PPC_VRSAVE:
1547 val = get_reg_val(reg->id, vcpu->arch.vrsave);
1481 break; 1548 break;
1482 default: 1549 default:
1483 r = kvmppc_get_one_reg(vcpu, reg->id, &val); 1550 r = vcpu->kvm->arch.kvm_ops->get_one_reg(vcpu, reg->id, &val);
1484 break; 1551 break;
1485 } 1552 }
1486 1553
@@ -1498,7 +1565,6 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
1498 int r = 0; 1565 int r = 0;
1499 union kvmppc_one_reg val; 1566 union kvmppc_one_reg val;
1500 int size; 1567 int size;
1501 long int i;
1502 1568
1503 size = one_reg_size(reg->id); 1569 size = one_reg_size(reg->id);
1504 if (size > sizeof(val)) 1570 if (size > sizeof(val))
@@ -1509,16 +1575,24 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
1509 1575
1510 switch (reg->id) { 1576 switch (reg->id) {
1511 case KVM_REG_PPC_IAC1: 1577 case KVM_REG_PPC_IAC1:
1578 vcpu->arch.dbg_reg.iac1 = set_reg_val(reg->id, val);
1579 break;
1512 case KVM_REG_PPC_IAC2: 1580 case KVM_REG_PPC_IAC2:
1581 vcpu->arch.dbg_reg.iac2 = set_reg_val(reg->id, val);
1582 break;
1583#if CONFIG_PPC_ADV_DEBUG_IACS > 2
1513 case KVM_REG_PPC_IAC3: 1584 case KVM_REG_PPC_IAC3:
1585 vcpu->arch.dbg_reg.iac3 = set_reg_val(reg->id, val);
1586 break;
1514 case KVM_REG_PPC_IAC4: 1587 case KVM_REG_PPC_IAC4:
1515 i = reg->id - KVM_REG_PPC_IAC1; 1588 vcpu->arch.dbg_reg.iac4 = set_reg_val(reg->id, val);
1516 vcpu->arch.dbg_reg.iac[i] = set_reg_val(reg->id, val);
1517 break; 1589 break;
1590#endif
1518 case KVM_REG_PPC_DAC1: 1591 case KVM_REG_PPC_DAC1:
1592 vcpu->arch.dbg_reg.dac1 = set_reg_val(reg->id, val);
1593 break;
1519 case KVM_REG_PPC_DAC2: 1594 case KVM_REG_PPC_DAC2:
1520 i = reg->id - KVM_REG_PPC_DAC1; 1595 vcpu->arch.dbg_reg.dac2 = set_reg_val(reg->id, val);
1521 vcpu->arch.dbg_reg.dac[i] = set_reg_val(reg->id, val);
1522 break; 1596 break;
1523 case KVM_REG_PPC_EPR: { 1597 case KVM_REG_PPC_EPR: {
1524 u32 new_epr = set_reg_val(reg->id, val); 1598 u32 new_epr = set_reg_val(reg->id, val);
@@ -1552,20 +1626,17 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
1552 kvmppc_set_tcr(vcpu, tcr); 1626 kvmppc_set_tcr(vcpu, tcr);
1553 break; 1627 break;
1554 } 1628 }
1629 case KVM_REG_PPC_VRSAVE:
1630 vcpu->arch.vrsave = set_reg_val(reg->id, val);
1631 break;
1555 default: 1632 default:
1556 r = kvmppc_set_one_reg(vcpu, reg->id, &val); 1633 r = vcpu->kvm->arch.kvm_ops->set_one_reg(vcpu, reg->id, &val);
1557 break; 1634 break;
1558 } 1635 }
1559 1636
1560 return r; 1637 return r;
1561} 1638}
1562 1639
1563int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
1564 struct kvm_guest_debug *dbg)
1565{
1566 return -EINVAL;
1567}
1568
1569int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) 1640int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
1570{ 1641{
1571 return -ENOTSUPP; 1642 return -ENOTSUPP;
@@ -1590,12 +1661,12 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log)
1590 return -ENOTSUPP; 1661 return -ENOTSUPP;
1591} 1662}
1592 1663
1593void kvmppc_core_free_memslot(struct kvm_memory_slot *free, 1664void kvmppc_core_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
1594 struct kvm_memory_slot *dont) 1665 struct kvm_memory_slot *dont)
1595{ 1666{
1596} 1667}
1597 1668
1598int kvmppc_core_create_memslot(struct kvm_memory_slot *slot, 1669int kvmppc_core_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
1599 unsigned long npages) 1670 unsigned long npages)
1600{ 1671{
1601 return 0; 1672 return 0;
@@ -1671,6 +1742,157 @@ void kvmppc_decrementer_func(unsigned long data)
1671 kvmppc_set_tsr_bits(vcpu, TSR_DIS); 1742 kvmppc_set_tsr_bits(vcpu, TSR_DIS);
1672} 1743}
1673 1744
1745static int kvmppc_booke_add_breakpoint(struct debug_reg *dbg_reg,
1746 uint64_t addr, int index)
1747{
1748 switch (index) {
1749 case 0:
1750 dbg_reg->dbcr0 |= DBCR0_IAC1;
1751 dbg_reg->iac1 = addr;
1752 break;
1753 case 1:
1754 dbg_reg->dbcr0 |= DBCR0_IAC2;
1755 dbg_reg->iac2 = addr;
1756 break;
1757#if CONFIG_PPC_ADV_DEBUG_IACS > 2
1758 case 2:
1759 dbg_reg->dbcr0 |= DBCR0_IAC3;
1760 dbg_reg->iac3 = addr;
1761 break;
1762 case 3:
1763 dbg_reg->dbcr0 |= DBCR0_IAC4;
1764 dbg_reg->iac4 = addr;
1765 break;
1766#endif
1767 default:
1768 return -EINVAL;
1769 }
1770
1771 dbg_reg->dbcr0 |= DBCR0_IDM;
1772 return 0;
1773}
1774
1775static int kvmppc_booke_add_watchpoint(struct debug_reg *dbg_reg, uint64_t addr,
1776 int type, int index)
1777{
1778 switch (index) {
1779 case 0:
1780 if (type & KVMPPC_DEBUG_WATCH_READ)
1781 dbg_reg->dbcr0 |= DBCR0_DAC1R;
1782 if (type & KVMPPC_DEBUG_WATCH_WRITE)
1783 dbg_reg->dbcr0 |= DBCR0_DAC1W;
1784 dbg_reg->dac1 = addr;
1785 break;
1786 case 1:
1787 if (type & KVMPPC_DEBUG_WATCH_READ)
1788 dbg_reg->dbcr0 |= DBCR0_DAC2R;
1789 if (type & KVMPPC_DEBUG_WATCH_WRITE)
1790 dbg_reg->dbcr0 |= DBCR0_DAC2W;
1791 dbg_reg->dac2 = addr;
1792 break;
1793 default:
1794 return -EINVAL;
1795 }
1796
1797 dbg_reg->dbcr0 |= DBCR0_IDM;
1798 return 0;
1799}
1800void kvm_guest_protect_msr(struct kvm_vcpu *vcpu, ulong prot_bitmap, bool set)
1801{
1802 /* XXX: Add similar MSR protection for BookE-PR */
1803#ifdef CONFIG_KVM_BOOKE_HV
1804 BUG_ON(prot_bitmap & ~(MSRP_UCLEP | MSRP_DEP | MSRP_PMMP));
1805 if (set) {
1806 if (prot_bitmap & MSR_UCLE)
1807 vcpu->arch.shadow_msrp |= MSRP_UCLEP;
1808 if (prot_bitmap & MSR_DE)
1809 vcpu->arch.shadow_msrp |= MSRP_DEP;
1810 if (prot_bitmap & MSR_PMM)
1811 vcpu->arch.shadow_msrp |= MSRP_PMMP;
1812 } else {
1813 if (prot_bitmap & MSR_UCLE)
1814 vcpu->arch.shadow_msrp &= ~MSRP_UCLEP;
1815 if (prot_bitmap & MSR_DE)
1816 vcpu->arch.shadow_msrp &= ~MSRP_DEP;
1817 if (prot_bitmap & MSR_PMM)
1818 vcpu->arch.shadow_msrp &= ~MSRP_PMMP;
1819 }
1820#endif
1821}
1822
1823int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
1824 struct kvm_guest_debug *dbg)
1825{
1826 struct debug_reg *dbg_reg;
1827 int n, b = 0, w = 0;
1828
1829 if (!(dbg->control & KVM_GUESTDBG_ENABLE)) {
1830 vcpu->arch.shadow_dbg_reg.dbcr0 = 0;
1831 vcpu->guest_debug = 0;
1832 kvm_guest_protect_msr(vcpu, MSR_DE, false);
1833 return 0;
1834 }
1835
1836 kvm_guest_protect_msr(vcpu, MSR_DE, true);
1837 vcpu->guest_debug = dbg->control;
1838 vcpu->arch.shadow_dbg_reg.dbcr0 = 0;
1839 /* Set DBCR0_EDM in guest visible DBCR0 register. */
1840 vcpu->arch.dbg_reg.dbcr0 = DBCR0_EDM;
1841
1842 if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP)
1843 vcpu->arch.shadow_dbg_reg.dbcr0 |= DBCR0_IDM | DBCR0_IC;
1844
1845 /* Code below handles only HW breakpoints */
1846 dbg_reg = &(vcpu->arch.shadow_dbg_reg);
1847
1848#ifdef CONFIG_KVM_BOOKE_HV
1849 /*
1850 * On BookE-HV (e500mc) the guest is always executed with MSR.GS=1
1851 * DBCR1 and DBCR2 are set to trigger debug events when MSR.PR is 0
1852 */
1853 dbg_reg->dbcr1 = 0;
1854 dbg_reg->dbcr2 = 0;
1855#else
1856 /*
1857 * On BookE-PR (e500v2) the guest is always executed with MSR.PR=1
1858 * We set DBCR1 and DBCR2 to only trigger debug events when MSR.PR
1859 * is set.
1860 */
1861 dbg_reg->dbcr1 = DBCR1_IAC1US | DBCR1_IAC2US | DBCR1_IAC3US |
1862 DBCR1_IAC4US;
1863 dbg_reg->dbcr2 = DBCR2_DAC1US | DBCR2_DAC2US;
1864#endif
1865
1866 if (!(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP))
1867 return 0;
1868
1869 for (n = 0; n < (KVMPPC_BOOKE_IAC_NUM + KVMPPC_BOOKE_DAC_NUM); n++) {
1870 uint64_t addr = dbg->arch.bp[n].addr;
1871 uint32_t type = dbg->arch.bp[n].type;
1872
1873 if (type == KVMPPC_DEBUG_NONE)
1874 continue;
1875
1876 if (type & !(KVMPPC_DEBUG_WATCH_READ |
1877 KVMPPC_DEBUG_WATCH_WRITE |
1878 KVMPPC_DEBUG_BREAKPOINT))
1879 return -EINVAL;
1880
1881 if (type & KVMPPC_DEBUG_BREAKPOINT) {
1882 /* Setting H/W breakpoint */
1883 if (kvmppc_booke_add_breakpoint(dbg_reg, addr, b++))
1884 return -EINVAL;
1885 } else {
1886 /* Setting H/W watchpoint */
1887 if (kvmppc_booke_add_watchpoint(dbg_reg, addr,
1888 type, w++))
1889 return -EINVAL;
1890 }
1891 }
1892
1893 return 0;
1894}
1895
1674void kvmppc_booke_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 1896void kvmppc_booke_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
1675{ 1897{
1676 vcpu->cpu = smp_processor_id(); 1898 vcpu->cpu = smp_processor_id();
@@ -1681,6 +1903,44 @@ void kvmppc_booke_vcpu_put(struct kvm_vcpu *vcpu)
1681{ 1903{
1682 current->thread.kvm_vcpu = NULL; 1904 current->thread.kvm_vcpu = NULL;
1683 vcpu->cpu = -1; 1905 vcpu->cpu = -1;
1906
1907 /* Clear pending debug event in DBSR */
1908 kvmppc_clear_dbsr();
1909}
1910
1911void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu)
1912{
1913 vcpu->kvm->arch.kvm_ops->mmu_destroy(vcpu);
1914}
1915
1916int kvmppc_core_init_vm(struct kvm *kvm)
1917{
1918 return kvm->arch.kvm_ops->init_vm(kvm);
1919}
1920
1921struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
1922{
1923 return kvm->arch.kvm_ops->vcpu_create(kvm, id);
1924}
1925
1926void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
1927{
1928 vcpu->kvm->arch.kvm_ops->vcpu_free(vcpu);
1929}
1930
1931void kvmppc_core_destroy_vm(struct kvm *kvm)
1932{
1933 kvm->arch.kvm_ops->destroy_vm(kvm);
1934}
1935
1936void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
1937{
1938 vcpu->kvm->arch.kvm_ops->vcpu_load(vcpu, cpu);
1939}
1940
1941void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu)
1942{
1943 vcpu->kvm->arch.kvm_ops->vcpu_put(vcpu);
1684} 1944}
1685 1945
1686int __init kvmppc_booke_init(void) 1946int __init kvmppc_booke_init(void)
diff --git a/arch/powerpc/kvm/booke.h b/arch/powerpc/kvm/booke.h
index 5fd1ba693579..09bfd9bc7cf8 100644
--- a/arch/powerpc/kvm/booke.h
+++ b/arch/powerpc/kvm/booke.h
@@ -99,6 +99,30 @@ enum int_class {
99 99
100void kvmppc_set_pending_interrupt(struct kvm_vcpu *vcpu, enum int_class type); 100void kvmppc_set_pending_interrupt(struct kvm_vcpu *vcpu, enum int_class type);
101 101
102extern void kvmppc_mmu_destroy_44x(struct kvm_vcpu *vcpu);
103extern int kvmppc_core_emulate_op_44x(struct kvm_run *run, struct kvm_vcpu *vcpu,
104 unsigned int inst, int *advance);
105extern int kvmppc_core_emulate_mtspr_44x(struct kvm_vcpu *vcpu, int sprn,
106 ulong spr_val);
107extern int kvmppc_core_emulate_mfspr_44x(struct kvm_vcpu *vcpu, int sprn,
108 ulong *spr_val);
109extern void kvmppc_mmu_destroy_e500(struct kvm_vcpu *vcpu);
110extern int kvmppc_core_emulate_op_e500(struct kvm_run *run,
111 struct kvm_vcpu *vcpu,
112 unsigned int inst, int *advance);
113extern int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn,
114 ulong spr_val);
115extern int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn,
116 ulong *spr_val);
117extern void kvmppc_mmu_destroy_e500(struct kvm_vcpu *vcpu);
118extern int kvmppc_core_emulate_op_e500(struct kvm_run *run,
119 struct kvm_vcpu *vcpu,
120 unsigned int inst, int *advance);
121extern int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn,
122 ulong spr_val);
123extern int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn,
124 ulong *spr_val);
125
102/* 126/*
103 * Load up guest vcpu FP state if it's needed. 127 * Load up guest vcpu FP state if it's needed.
104 * It also set the MSR_FP in thread so that host know 128 * It also set the MSR_FP in thread so that host know
@@ -129,4 +153,9 @@ static inline void kvmppc_save_guest_fp(struct kvm_vcpu *vcpu)
129 giveup_fpu(current); 153 giveup_fpu(current);
130#endif 154#endif
131} 155}
156
157static inline void kvmppc_clear_dbsr(void)
158{
159 mtspr(SPRN_DBSR, mfspr(SPRN_DBSR));
160}
132#endif /* __KVM_BOOKE_H__ */ 161#endif /* __KVM_BOOKE_H__ */
diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c
index ce6b73c29612..497b142f651c 100644
--- a/arch/powerpc/kvm/e500.c
+++ b/arch/powerpc/kvm/e500.c
@@ -305,7 +305,7 @@ void kvmppc_core_load_guest_debugstate(struct kvm_vcpu *vcpu)
305{ 305{
306} 306}
307 307
308void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 308static void kvmppc_core_vcpu_load_e500(struct kvm_vcpu *vcpu, int cpu)
309{ 309{
310 kvmppc_booke_vcpu_load(vcpu, cpu); 310 kvmppc_booke_vcpu_load(vcpu, cpu);
311 311
@@ -313,7 +313,7 @@ void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
313 kvmppc_e500_recalc_shadow_pid(to_e500(vcpu)); 313 kvmppc_e500_recalc_shadow_pid(to_e500(vcpu));
314} 314}
315 315
316void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu) 316static void kvmppc_core_vcpu_put_e500(struct kvm_vcpu *vcpu)
317{ 317{
318#ifdef CONFIG_SPE 318#ifdef CONFIG_SPE
319 if (vcpu->arch.shadow_msr & MSR_SPE) 319 if (vcpu->arch.shadow_msr & MSR_SPE)
@@ -367,7 +367,8 @@ int kvmppc_core_vcpu_setup(struct kvm_vcpu *vcpu)
367 return 0; 367 return 0;
368} 368}
369 369
370void kvmppc_core_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) 370static int kvmppc_core_get_sregs_e500(struct kvm_vcpu *vcpu,
371 struct kvm_sregs *sregs)
371{ 372{
372 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); 373 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
373 374
@@ -388,9 +389,11 @@ void kvmppc_core_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
388 389
389 kvmppc_get_sregs_ivor(vcpu, sregs); 390 kvmppc_get_sregs_ivor(vcpu, sregs);
390 kvmppc_get_sregs_e500_tlb(vcpu, sregs); 391 kvmppc_get_sregs_e500_tlb(vcpu, sregs);
392 return 0;
391} 393}
392 394
393int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) 395static int kvmppc_core_set_sregs_e500(struct kvm_vcpu *vcpu,
396 struct kvm_sregs *sregs)
394{ 397{
395 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); 398 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
396 int ret; 399 int ret;
@@ -425,21 +428,22 @@ int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
425 return kvmppc_set_sregs_ivor(vcpu, sregs); 428 return kvmppc_set_sregs_ivor(vcpu, sregs);
426} 429}
427 430
428int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id, 431static int kvmppc_get_one_reg_e500(struct kvm_vcpu *vcpu, u64 id,
429 union kvmppc_one_reg *val) 432 union kvmppc_one_reg *val)
430{ 433{
431 int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val); 434 int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val);
432 return r; 435 return r;
433} 436}
434 437
435int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, 438static int kvmppc_set_one_reg_e500(struct kvm_vcpu *vcpu, u64 id,
436 union kvmppc_one_reg *val) 439 union kvmppc_one_reg *val)
437{ 440{
438 int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val); 441 int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val);
439 return r; 442 return r;
440} 443}
441 444
442struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) 445static struct kvm_vcpu *kvmppc_core_vcpu_create_e500(struct kvm *kvm,
446 unsigned int id)
443{ 447{
444 struct kvmppc_vcpu_e500 *vcpu_e500; 448 struct kvmppc_vcpu_e500 *vcpu_e500;
445 struct kvm_vcpu *vcpu; 449 struct kvm_vcpu *vcpu;
@@ -481,7 +485,7 @@ out:
481 return ERR_PTR(err); 485 return ERR_PTR(err);
482} 486}
483 487
484void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu) 488static void kvmppc_core_vcpu_free_e500(struct kvm_vcpu *vcpu)
485{ 489{
486 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); 490 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
487 491
@@ -492,15 +496,32 @@ void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
492 kmem_cache_free(kvm_vcpu_cache, vcpu_e500); 496 kmem_cache_free(kvm_vcpu_cache, vcpu_e500);
493} 497}
494 498
495int kvmppc_core_init_vm(struct kvm *kvm) 499static int kvmppc_core_init_vm_e500(struct kvm *kvm)
496{ 500{
497 return 0; 501 return 0;
498} 502}
499 503
500void kvmppc_core_destroy_vm(struct kvm *kvm) 504static void kvmppc_core_destroy_vm_e500(struct kvm *kvm)
501{ 505{
502} 506}
503 507
508static struct kvmppc_ops kvm_ops_e500 = {
509 .get_sregs = kvmppc_core_get_sregs_e500,
510 .set_sregs = kvmppc_core_set_sregs_e500,
511 .get_one_reg = kvmppc_get_one_reg_e500,
512 .set_one_reg = kvmppc_set_one_reg_e500,
513 .vcpu_load = kvmppc_core_vcpu_load_e500,
514 .vcpu_put = kvmppc_core_vcpu_put_e500,
515 .vcpu_create = kvmppc_core_vcpu_create_e500,
516 .vcpu_free = kvmppc_core_vcpu_free_e500,
517 .mmu_destroy = kvmppc_mmu_destroy_e500,
518 .init_vm = kvmppc_core_init_vm_e500,
519 .destroy_vm = kvmppc_core_destroy_vm_e500,
520 .emulate_op = kvmppc_core_emulate_op_e500,
521 .emulate_mtspr = kvmppc_core_emulate_mtspr_e500,
522 .emulate_mfspr = kvmppc_core_emulate_mfspr_e500,
523};
524
504static int __init kvmppc_e500_init(void) 525static int __init kvmppc_e500_init(void)
505{ 526{
506 int r, i; 527 int r, i;
@@ -512,11 +533,11 @@ static int __init kvmppc_e500_init(void)
512 533
513 r = kvmppc_core_check_processor_compat(); 534 r = kvmppc_core_check_processor_compat();
514 if (r) 535 if (r)
515 return r; 536 goto err_out;
516 537
517 r = kvmppc_booke_init(); 538 r = kvmppc_booke_init();
518 if (r) 539 if (r)
519 return r; 540 goto err_out;
520 541
521 /* copy extra E500 exception handlers */ 542 /* copy extra E500 exception handlers */
522 ivor[0] = mfspr(SPRN_IVOR32); 543 ivor[0] = mfspr(SPRN_IVOR32);
@@ -534,11 +555,19 @@ static int __init kvmppc_e500_init(void)
534 flush_icache_range(kvmppc_booke_handlers, kvmppc_booke_handlers + 555 flush_icache_range(kvmppc_booke_handlers, kvmppc_booke_handlers +
535 ivor[max_ivor] + handler_len); 556 ivor[max_ivor] + handler_len);
536 557
537 return kvm_init(NULL, sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE); 558 r = kvm_init(NULL, sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE);
559 if (r)
560 goto err_out;
561 kvm_ops_e500.owner = THIS_MODULE;
562 kvmppc_pr_ops = &kvm_ops_e500;
563
564err_out:
565 return r;
538} 566}
539 567
540static void __exit kvmppc_e500_exit(void) 568static void __exit kvmppc_e500_exit(void)
541{ 569{
570 kvmppc_pr_ops = NULL;
542 kvmppc_booke_exit(); 571 kvmppc_booke_exit();
543} 572}
544 573
diff --git a/arch/powerpc/kvm/e500.h b/arch/powerpc/kvm/e500.h
index c2e5e98453a6..4fd9650eb018 100644
--- a/arch/powerpc/kvm/e500.h
+++ b/arch/powerpc/kvm/e500.h
@@ -117,7 +117,7 @@ static inline struct kvmppc_vcpu_e500 *to_e500(struct kvm_vcpu *vcpu)
117#define E500_TLB_USER_PERM_MASK (MAS3_UX|MAS3_UR|MAS3_UW) 117#define E500_TLB_USER_PERM_MASK (MAS3_UX|MAS3_UR|MAS3_UW)
118#define E500_TLB_SUPER_PERM_MASK (MAS3_SX|MAS3_SR|MAS3_SW) 118#define E500_TLB_SUPER_PERM_MASK (MAS3_SX|MAS3_SR|MAS3_SW)
119#define MAS2_ATTRIB_MASK \ 119#define MAS2_ATTRIB_MASK \
120 (MAS2_X0 | MAS2_X1) 120 (MAS2_X0 | MAS2_X1 | MAS2_E | MAS2_G)
121#define MAS3_ATTRIB_MASK \ 121#define MAS3_ATTRIB_MASK \
122 (MAS3_U0 | MAS3_U1 | MAS3_U2 | MAS3_U3 \ 122 (MAS3_U0 | MAS3_U1 | MAS3_U2 | MAS3_U3 \
123 | E500_TLB_USER_PERM_MASK | E500_TLB_SUPER_PERM_MASK) 123 | E500_TLB_USER_PERM_MASK | E500_TLB_SUPER_PERM_MASK)
diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
index b10a01243abd..89b7f821f6c4 100644
--- a/arch/powerpc/kvm/e500_emulate.c
+++ b/arch/powerpc/kvm/e500_emulate.c
@@ -26,6 +26,7 @@
26#define XOP_TLBRE 946 26#define XOP_TLBRE 946
27#define XOP_TLBWE 978 27#define XOP_TLBWE 978
28#define XOP_TLBILX 18 28#define XOP_TLBILX 18
29#define XOP_EHPRIV 270
29 30
30#ifdef CONFIG_KVM_E500MC 31#ifdef CONFIG_KVM_E500MC
31static int dbell2prio(ulong param) 32static int dbell2prio(ulong param)
@@ -82,8 +83,28 @@ static int kvmppc_e500_emul_msgsnd(struct kvm_vcpu *vcpu, int rb)
82} 83}
83#endif 84#endif
84 85
85int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, 86static int kvmppc_e500_emul_ehpriv(struct kvm_run *run, struct kvm_vcpu *vcpu,
86 unsigned int inst, int *advance) 87 unsigned int inst, int *advance)
88{
89 int emulated = EMULATE_DONE;
90
91 switch (get_oc(inst)) {
92 case EHPRIV_OC_DEBUG:
93 run->exit_reason = KVM_EXIT_DEBUG;
94 run->debug.arch.address = vcpu->arch.pc;
95 run->debug.arch.status = 0;
96 kvmppc_account_exit(vcpu, DEBUG_EXITS);
97 emulated = EMULATE_EXIT_USER;
98 *advance = 0;
99 break;
100 default:
101 emulated = EMULATE_FAIL;
102 }
103 return emulated;
104}
105
106int kvmppc_core_emulate_op_e500(struct kvm_run *run, struct kvm_vcpu *vcpu,
107 unsigned int inst, int *advance)
87{ 108{
88 int emulated = EMULATE_DONE; 109 int emulated = EMULATE_DONE;
89 int ra = get_ra(inst); 110 int ra = get_ra(inst);
@@ -130,6 +151,11 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
130 emulated = kvmppc_e500_emul_tlbivax(vcpu, ea); 151 emulated = kvmppc_e500_emul_tlbivax(vcpu, ea);
131 break; 152 break;
132 153
154 case XOP_EHPRIV:
155 emulated = kvmppc_e500_emul_ehpriv(run, vcpu, inst,
156 advance);
157 break;
158
133 default: 159 default:
134 emulated = EMULATE_FAIL; 160 emulated = EMULATE_FAIL;
135 } 161 }
@@ -146,7 +172,7 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
146 return emulated; 172 return emulated;
147} 173}
148 174
149int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val) 175int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
150{ 176{
151 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); 177 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
152 int emulated = EMULATE_DONE; 178 int emulated = EMULATE_DONE;
@@ -237,7 +263,7 @@ int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
237 return emulated; 263 return emulated;
238} 264}
239 265
240int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val) 266int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
241{ 267{
242 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); 268 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
243 int emulated = EMULATE_DONE; 269 int emulated = EMULATE_DONE;
diff --git a/arch/powerpc/kvm/e500_mmu.c b/arch/powerpc/kvm/e500_mmu.c
index 6d6f153b6c1d..ebca6b88ea5e 100644
--- a/arch/powerpc/kvm/e500_mmu.c
+++ b/arch/powerpc/kvm/e500_mmu.c
@@ -32,7 +32,7 @@
32#include <asm/kvm_ppc.h> 32#include <asm/kvm_ppc.h>
33 33
34#include "e500.h" 34#include "e500.h"
35#include "trace.h" 35#include "trace_booke.h"
36#include "timing.h" 36#include "timing.h"
37#include "e500_mmu_host.h" 37#include "e500_mmu_host.h"
38 38
@@ -536,7 +536,7 @@ gpa_t kvmppc_mmu_xlate(struct kvm_vcpu *vcpu, unsigned int index,
536 return get_tlb_raddr(gtlbe) | (eaddr & pgmask); 536 return get_tlb_raddr(gtlbe) | (eaddr & pgmask);
537} 537}
538 538
539void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu) 539void kvmppc_mmu_destroy_e500(struct kvm_vcpu *vcpu)
540{ 540{
541} 541}
542 542
diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c
index 1c6a9d729df4..ecf2247b13be 100644
--- a/arch/powerpc/kvm/e500_mmu_host.c
+++ b/arch/powerpc/kvm/e500_mmu_host.c
@@ -32,10 +32,11 @@
32#include <asm/kvm_ppc.h> 32#include <asm/kvm_ppc.h>
33 33
34#include "e500.h" 34#include "e500.h"
35#include "trace.h"
36#include "timing.h" 35#include "timing.h"
37#include "e500_mmu_host.h" 36#include "e500_mmu_host.h"
38 37
38#include "trace_booke.h"
39
39#define to_htlb1_esel(esel) (host_tlb_params[1].entries - (esel) - 1) 40#define to_htlb1_esel(esel) (host_tlb_params[1].entries - (esel) - 1)
40 41
41static struct kvmppc_e500_tlb_params host_tlb_params[E500_TLB_NUM]; 42static struct kvmppc_e500_tlb_params host_tlb_params[E500_TLB_NUM];
@@ -253,6 +254,9 @@ static inline void kvmppc_e500_ref_setup(struct tlbe_ref *ref,
253 ref->pfn = pfn; 254 ref->pfn = pfn;
254 ref->flags |= E500_TLB_VALID; 255 ref->flags |= E500_TLB_VALID;
255 256
257 /* Mark the page accessed */
258 kvm_set_pfn_accessed(pfn);
259
256 if (tlbe_is_writable(gtlbe)) 260 if (tlbe_is_writable(gtlbe))
257 kvm_set_pfn_dirty(pfn); 261 kvm_set_pfn_dirty(pfn);
258} 262}
@@ -332,6 +336,13 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
332 unsigned long hva; 336 unsigned long hva;
333 int pfnmap = 0; 337 int pfnmap = 0;
334 int tsize = BOOK3E_PAGESZ_4K; 338 int tsize = BOOK3E_PAGESZ_4K;
339 int ret = 0;
340 unsigned long mmu_seq;
341 struct kvm *kvm = vcpu_e500->vcpu.kvm;
342
343 /* used to check for invalidations in progress */
344 mmu_seq = kvm->mmu_notifier_seq;
345 smp_rmb();
335 346
336 /* 347 /*
337 * Translate guest physical to true physical, acquiring 348 * Translate guest physical to true physical, acquiring
@@ -449,6 +460,12 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
449 gvaddr &= ~((tsize_pages << PAGE_SHIFT) - 1); 460 gvaddr &= ~((tsize_pages << PAGE_SHIFT) - 1);
450 } 461 }
451 462
463 spin_lock(&kvm->mmu_lock);
464 if (mmu_notifier_retry(kvm, mmu_seq)) {
465 ret = -EAGAIN;
466 goto out;
467 }
468
452 kvmppc_e500_ref_setup(ref, gtlbe, pfn); 469 kvmppc_e500_ref_setup(ref, gtlbe, pfn);
453 470
454 kvmppc_e500_setup_stlbe(&vcpu_e500->vcpu, gtlbe, tsize, 471 kvmppc_e500_setup_stlbe(&vcpu_e500->vcpu, gtlbe, tsize,
@@ -457,10 +474,13 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
457 /* Clear i-cache for new pages */ 474 /* Clear i-cache for new pages */
458 kvmppc_mmu_flush_icache(pfn); 475 kvmppc_mmu_flush_icache(pfn);
459 476
477out:
478 spin_unlock(&kvm->mmu_lock);
479
460 /* Drop refcount on page, so that mmu notifiers can clear it */ 480 /* Drop refcount on page, so that mmu notifiers can clear it */
461 kvm_release_pfn_clean(pfn); 481 kvm_release_pfn_clean(pfn);
462 482
463 return 0; 483 return ret;
464} 484}
465 485
466/* XXX only map the one-one case, for now use TLB0 */ 486/* XXX only map the one-one case, for now use TLB0 */
diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index 19c8379575f7..4132cd2fc171 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -110,7 +110,7 @@ void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr)
110 110
111static DEFINE_PER_CPU(struct kvm_vcpu *, last_vcpu_on_cpu); 111static DEFINE_PER_CPU(struct kvm_vcpu *, last_vcpu_on_cpu);
112 112
113void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 113static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
114{ 114{
115 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); 115 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
116 116
@@ -147,7 +147,7 @@ void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
147 kvmppc_load_guest_fp(vcpu); 147 kvmppc_load_guest_fp(vcpu);
148} 148}
149 149
150void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu) 150static void kvmppc_core_vcpu_put_e500mc(struct kvm_vcpu *vcpu)
151{ 151{
152 vcpu->arch.eplc = mfspr(SPRN_EPLC); 152 vcpu->arch.eplc = mfspr(SPRN_EPLC);
153 vcpu->arch.epsc = mfspr(SPRN_EPSC); 153 vcpu->arch.epsc = mfspr(SPRN_EPSC);
@@ -204,7 +204,8 @@ int kvmppc_core_vcpu_setup(struct kvm_vcpu *vcpu)
204 return 0; 204 return 0;
205} 205}
206 206
207void kvmppc_core_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) 207static int kvmppc_core_get_sregs_e500mc(struct kvm_vcpu *vcpu,
208 struct kvm_sregs *sregs)
208{ 209{
209 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); 210 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
210 211
@@ -224,10 +225,11 @@ void kvmppc_core_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
224 sregs->u.e.ivor_high[4] = vcpu->arch.ivor[BOOKE_IRQPRIO_DBELL]; 225 sregs->u.e.ivor_high[4] = vcpu->arch.ivor[BOOKE_IRQPRIO_DBELL];
225 sregs->u.e.ivor_high[5] = vcpu->arch.ivor[BOOKE_IRQPRIO_DBELL_CRIT]; 226 sregs->u.e.ivor_high[5] = vcpu->arch.ivor[BOOKE_IRQPRIO_DBELL_CRIT];
226 227
227 kvmppc_get_sregs_ivor(vcpu, sregs); 228 return kvmppc_get_sregs_ivor(vcpu, sregs);
228} 229}
229 230
230int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) 231static int kvmppc_core_set_sregs_e500mc(struct kvm_vcpu *vcpu,
232 struct kvm_sregs *sregs)
231{ 233{
232 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); 234 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
233 int ret; 235 int ret;
@@ -260,21 +262,22 @@ int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
260 return kvmppc_set_sregs_ivor(vcpu, sregs); 262 return kvmppc_set_sregs_ivor(vcpu, sregs);
261} 263}
262 264
263int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id, 265static int kvmppc_get_one_reg_e500mc(struct kvm_vcpu *vcpu, u64 id,
264 union kvmppc_one_reg *val) 266 union kvmppc_one_reg *val)
265{ 267{
266 int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val); 268 int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val);
267 return r; 269 return r;
268} 270}
269 271
270int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, 272static int kvmppc_set_one_reg_e500mc(struct kvm_vcpu *vcpu, u64 id,
271 union kvmppc_one_reg *val) 273 union kvmppc_one_reg *val)
272{ 274{
273 int r = kvmppc_set_one_reg_e500_tlb(vcpu, id, val); 275 int r = kvmppc_set_one_reg_e500_tlb(vcpu, id, val);
274 return r; 276 return r;
275} 277}
276 278
277struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) 279static struct kvm_vcpu *kvmppc_core_vcpu_create_e500mc(struct kvm *kvm,
280 unsigned int id)
278{ 281{
279 struct kvmppc_vcpu_e500 *vcpu_e500; 282 struct kvmppc_vcpu_e500 *vcpu_e500;
280 struct kvm_vcpu *vcpu; 283 struct kvm_vcpu *vcpu;
@@ -315,7 +318,7 @@ out:
315 return ERR_PTR(err); 318 return ERR_PTR(err);
316} 319}
317 320
318void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu) 321static void kvmppc_core_vcpu_free_e500mc(struct kvm_vcpu *vcpu)
319{ 322{
320 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); 323 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
321 324
@@ -325,7 +328,7 @@ void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
325 kmem_cache_free(kvm_vcpu_cache, vcpu_e500); 328 kmem_cache_free(kvm_vcpu_cache, vcpu_e500);
326} 329}
327 330
328int kvmppc_core_init_vm(struct kvm *kvm) 331static int kvmppc_core_init_vm_e500mc(struct kvm *kvm)
329{ 332{
330 int lpid; 333 int lpid;
331 334
@@ -337,27 +340,52 @@ int kvmppc_core_init_vm(struct kvm *kvm)
337 return 0; 340 return 0;
338} 341}
339 342
340void kvmppc_core_destroy_vm(struct kvm *kvm) 343static void kvmppc_core_destroy_vm_e500mc(struct kvm *kvm)
341{ 344{
342 kvmppc_free_lpid(kvm->arch.lpid); 345 kvmppc_free_lpid(kvm->arch.lpid);
343} 346}
344 347
348static struct kvmppc_ops kvm_ops_e500mc = {
349 .get_sregs = kvmppc_core_get_sregs_e500mc,
350 .set_sregs = kvmppc_core_set_sregs_e500mc,
351 .get_one_reg = kvmppc_get_one_reg_e500mc,
352 .set_one_reg = kvmppc_set_one_reg_e500mc,
353 .vcpu_load = kvmppc_core_vcpu_load_e500mc,
354 .vcpu_put = kvmppc_core_vcpu_put_e500mc,
355 .vcpu_create = kvmppc_core_vcpu_create_e500mc,
356 .vcpu_free = kvmppc_core_vcpu_free_e500mc,
357 .mmu_destroy = kvmppc_mmu_destroy_e500,
358 .init_vm = kvmppc_core_init_vm_e500mc,
359 .destroy_vm = kvmppc_core_destroy_vm_e500mc,
360 .emulate_op = kvmppc_core_emulate_op_e500,
361 .emulate_mtspr = kvmppc_core_emulate_mtspr_e500,
362 .emulate_mfspr = kvmppc_core_emulate_mfspr_e500,
363};
364
345static int __init kvmppc_e500mc_init(void) 365static int __init kvmppc_e500mc_init(void)
346{ 366{
347 int r; 367 int r;
348 368
349 r = kvmppc_booke_init(); 369 r = kvmppc_booke_init();
350 if (r) 370 if (r)
351 return r; 371 goto err_out;
352 372
353 kvmppc_init_lpid(64); 373 kvmppc_init_lpid(64);
354 kvmppc_claim_lpid(0); /* host */ 374 kvmppc_claim_lpid(0); /* host */
355 375
356 return kvm_init(NULL, sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE); 376 r = kvm_init(NULL, sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE);
377 if (r)
378 goto err_out;
379 kvm_ops_e500mc.owner = THIS_MODULE;
380 kvmppc_pr_ops = &kvm_ops_e500mc;
381
382err_out:
383 return r;
357} 384}
358 385
359static void __exit kvmppc_e500mc_exit(void) 386static void __exit kvmppc_e500mc_exit(void)
360{ 387{
388 kvmppc_pr_ops = NULL;
361 kvmppc_booke_exit(); 389 kvmppc_booke_exit();
362} 390}
363 391
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index 751cd45f65a0..2f9a0873b44f 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -130,8 +130,8 @@ static int kvmppc_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs)
130 case SPRN_PIR: break; 130 case SPRN_PIR: break;
131 131
132 default: 132 default:
133 emulated = kvmppc_core_emulate_mtspr(vcpu, sprn, 133 emulated = vcpu->kvm->arch.kvm_ops->emulate_mtspr(vcpu, sprn,
134 spr_val); 134 spr_val);
135 if (emulated == EMULATE_FAIL) 135 if (emulated == EMULATE_FAIL)
136 printk(KERN_INFO "mtspr: unknown spr " 136 printk(KERN_INFO "mtspr: unknown spr "
137 "0x%x\n", sprn); 137 "0x%x\n", sprn);
@@ -191,8 +191,8 @@ static int kvmppc_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt)
191 spr_val = kvmppc_get_dec(vcpu, get_tb()); 191 spr_val = kvmppc_get_dec(vcpu, get_tb());
192 break; 192 break;
193 default: 193 default:
194 emulated = kvmppc_core_emulate_mfspr(vcpu, sprn, 194 emulated = vcpu->kvm->arch.kvm_ops->emulate_mfspr(vcpu, sprn,
195 &spr_val); 195 &spr_val);
196 if (unlikely(emulated == EMULATE_FAIL)) { 196 if (unlikely(emulated == EMULATE_FAIL)) {
197 printk(KERN_INFO "mfspr: unknown spr " 197 printk(KERN_INFO "mfspr: unknown spr "
198 "0x%x\n", sprn); 198 "0x%x\n", sprn);
@@ -464,7 +464,8 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
464 } 464 }
465 465
466 if (emulated == EMULATE_FAIL) { 466 if (emulated == EMULATE_FAIL) {
467 emulated = kvmppc_core_emulate_op(run, vcpu, inst, &advance); 467 emulated = vcpu->kvm->arch.kvm_ops->emulate_op(run, vcpu, inst,
468 &advance);
468 if (emulated == EMULATE_AGAIN) { 469 if (emulated == EMULATE_AGAIN) {
469 advance = 0; 470 advance = 0;
470 } else if (emulated == EMULATE_FAIL) { 471 } else if (emulated == EMULATE_FAIL) {
@@ -483,3 +484,4 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
483 484
484 return emulated; 485 return emulated;
485} 486}
487EXPORT_SYMBOL_GPL(kvmppc_emulate_instruction);
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 07c0106fab76..9ae97686e9f4 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -26,6 +26,7 @@
26#include <linux/fs.h> 26#include <linux/fs.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/file.h> 28#include <linux/file.h>
29#include <linux/module.h>
29#include <asm/cputable.h> 30#include <asm/cputable.h>
30#include <asm/uaccess.h> 31#include <asm/uaccess.h>
31#include <asm/kvm_ppc.h> 32#include <asm/kvm_ppc.h>
@@ -39,6 +40,12 @@
39#define CREATE_TRACE_POINTS 40#define CREATE_TRACE_POINTS
40#include "trace.h" 41#include "trace.h"
41 42
43struct kvmppc_ops *kvmppc_hv_ops;
44EXPORT_SYMBOL_GPL(kvmppc_hv_ops);
45struct kvmppc_ops *kvmppc_pr_ops;
46EXPORT_SYMBOL_GPL(kvmppc_pr_ops);
47
48
42int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) 49int kvm_arch_vcpu_runnable(struct kvm_vcpu *v)
43{ 50{
44 return !!(v->arch.pending_exceptions) || 51 return !!(v->arch.pending_exceptions) ||
@@ -50,7 +57,6 @@ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
50 return 1; 57 return 1;
51} 58}
52 59
53#ifndef CONFIG_KVM_BOOK3S_64_HV
54/* 60/*
55 * Common checks before entering the guest world. Call with interrupts 61 * Common checks before entering the guest world. Call with interrupts
56 * disabled. 62 * disabled.
@@ -125,7 +131,7 @@ int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
125 131
126 return r; 132 return r;
127} 133}
128#endif /* CONFIG_KVM_BOOK3S_64_HV */ 134EXPORT_SYMBOL_GPL(kvmppc_prepare_to_enter);
129 135
130int kvmppc_kvm_pv(struct kvm_vcpu *vcpu) 136int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
131{ 137{
@@ -179,6 +185,7 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
179 185
180 return r; 186 return r;
181} 187}
188EXPORT_SYMBOL_GPL(kvmppc_kvm_pv);
182 189
183int kvmppc_sanity_check(struct kvm_vcpu *vcpu) 190int kvmppc_sanity_check(struct kvm_vcpu *vcpu)
184{ 191{
@@ -192,11 +199,9 @@ int kvmppc_sanity_check(struct kvm_vcpu *vcpu)
192 if ((vcpu->arch.cpu_type != KVM_CPU_3S_64) && vcpu->arch.papr_enabled) 199 if ((vcpu->arch.cpu_type != KVM_CPU_3S_64) && vcpu->arch.papr_enabled)
193 goto out; 200 goto out;
194 201
195#ifdef CONFIG_KVM_BOOK3S_64_HV
196 /* HV KVM can only do PAPR mode for now */ 202 /* HV KVM can only do PAPR mode for now */
197 if (!vcpu->arch.papr_enabled) 203 if (!vcpu->arch.papr_enabled && is_kvmppc_hv_enabled(vcpu->kvm))
198 goto out; 204 goto out;
199#endif
200 205
201#ifdef CONFIG_KVM_BOOKE_HV 206#ifdef CONFIG_KVM_BOOKE_HV
202 if (!cpu_has_feature(CPU_FTR_EMB_HV)) 207 if (!cpu_has_feature(CPU_FTR_EMB_HV))
@@ -209,6 +214,7 @@ out:
209 vcpu->arch.sane = r; 214 vcpu->arch.sane = r;
210 return r ? 0 : -EINVAL; 215 return r ? 0 : -EINVAL;
211} 216}
217EXPORT_SYMBOL_GPL(kvmppc_sanity_check);
212 218
213int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu) 219int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu)
214{ 220{
@@ -243,6 +249,7 @@ int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu)
243 249
244 return r; 250 return r;
245} 251}
252EXPORT_SYMBOL_GPL(kvmppc_emulate_mmio);
246 253
247int kvm_arch_hardware_enable(void *garbage) 254int kvm_arch_hardware_enable(void *garbage)
248{ 255{
@@ -269,10 +276,35 @@ void kvm_arch_check_processor_compat(void *rtn)
269 276
270int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) 277int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
271{ 278{
272 if (type) 279 struct kvmppc_ops *kvm_ops = NULL;
273 return -EINVAL; 280 /*
274 281 * if we have both HV and PR enabled, default is HV
282 */
283 if (type == 0) {
284 if (kvmppc_hv_ops)
285 kvm_ops = kvmppc_hv_ops;
286 else
287 kvm_ops = kvmppc_pr_ops;
288 if (!kvm_ops)
289 goto err_out;
290 } else if (type == KVM_VM_PPC_HV) {
291 if (!kvmppc_hv_ops)
292 goto err_out;
293 kvm_ops = kvmppc_hv_ops;
294 } else if (type == KVM_VM_PPC_PR) {
295 if (!kvmppc_pr_ops)
296 goto err_out;
297 kvm_ops = kvmppc_pr_ops;
298 } else
299 goto err_out;
300
301 if (kvm_ops->owner && !try_module_get(kvm_ops->owner))
302 return -ENOENT;
303
304 kvm->arch.kvm_ops = kvm_ops;
275 return kvmppc_core_init_vm(kvm); 305 return kvmppc_core_init_vm(kvm);
306err_out:
307 return -EINVAL;
276} 308}
277 309
278void kvm_arch_destroy_vm(struct kvm *kvm) 310void kvm_arch_destroy_vm(struct kvm *kvm)
@@ -292,6 +324,9 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
292 kvmppc_core_destroy_vm(kvm); 324 kvmppc_core_destroy_vm(kvm);
293 325
294 mutex_unlock(&kvm->lock); 326 mutex_unlock(&kvm->lock);
327
328 /* drop the module reference */
329 module_put(kvm->arch.kvm_ops->owner);
295} 330}
296 331
297void kvm_arch_sync_events(struct kvm *kvm) 332void kvm_arch_sync_events(struct kvm *kvm)
@@ -301,6 +336,10 @@ void kvm_arch_sync_events(struct kvm *kvm)
301int kvm_dev_ioctl_check_extension(long ext) 336int kvm_dev_ioctl_check_extension(long ext)
302{ 337{
303 int r; 338 int r;
339 /* FIXME!!
340 * Should some of this be vm ioctl ? is it possible now ?
341 */
342 int hv_enabled = kvmppc_hv_ops ? 1 : 0;
304 343
305 switch (ext) { 344 switch (ext) {
306#ifdef CONFIG_BOOKE 345#ifdef CONFIG_BOOKE
@@ -320,22 +359,26 @@ int kvm_dev_ioctl_check_extension(long ext)
320 case KVM_CAP_DEVICE_CTRL: 359 case KVM_CAP_DEVICE_CTRL:
321 r = 1; 360 r = 1;
322 break; 361 break;
323#ifndef CONFIG_KVM_BOOK3S_64_HV
324 case KVM_CAP_PPC_PAIRED_SINGLES: 362 case KVM_CAP_PPC_PAIRED_SINGLES:
325 case KVM_CAP_PPC_OSI: 363 case KVM_CAP_PPC_OSI:
326 case KVM_CAP_PPC_GET_PVINFO: 364 case KVM_CAP_PPC_GET_PVINFO:
327#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC) 365#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC)
328 case KVM_CAP_SW_TLB: 366 case KVM_CAP_SW_TLB:
329#endif 367#endif
330#ifdef CONFIG_KVM_MPIC 368 /* We support this only for PR */
331 case KVM_CAP_IRQ_MPIC: 369 r = !hv_enabled;
332#endif
333 r = 1;
334 break; 370 break;
371#ifdef CONFIG_KVM_MMIO
335 case KVM_CAP_COALESCED_MMIO: 372 case KVM_CAP_COALESCED_MMIO:
336 r = KVM_COALESCED_MMIO_PAGE_OFFSET; 373 r = KVM_COALESCED_MMIO_PAGE_OFFSET;
337 break; 374 break;
338#endif 375#endif
376#ifdef CONFIG_KVM_MPIC
377 case KVM_CAP_IRQ_MPIC:
378 r = 1;
379 break;
380#endif
381
339#ifdef CONFIG_PPC_BOOK3S_64 382#ifdef CONFIG_PPC_BOOK3S_64
340 case KVM_CAP_SPAPR_TCE: 383 case KVM_CAP_SPAPR_TCE:
341 case KVM_CAP_PPC_ALLOC_HTAB: 384 case KVM_CAP_PPC_ALLOC_HTAB:
@@ -346,32 +389,37 @@ int kvm_dev_ioctl_check_extension(long ext)
346 r = 1; 389 r = 1;
347 break; 390 break;
348#endif /* CONFIG_PPC_BOOK3S_64 */ 391#endif /* CONFIG_PPC_BOOK3S_64 */
349#ifdef CONFIG_KVM_BOOK3S_64_HV 392#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
350 case KVM_CAP_PPC_SMT: 393 case KVM_CAP_PPC_SMT:
351 r = threads_per_core; 394 if (hv_enabled)
395 r = threads_per_core;
396 else
397 r = 0;
352 break; 398 break;
353 case KVM_CAP_PPC_RMA: 399 case KVM_CAP_PPC_RMA:
354 r = 1; 400 r = hv_enabled;
355 /* PPC970 requires an RMA */ 401 /* PPC970 requires an RMA */
356 if (cpu_has_feature(CPU_FTR_ARCH_201)) 402 if (r && cpu_has_feature(CPU_FTR_ARCH_201))
357 r = 2; 403 r = 2;
358 break; 404 break;
359#endif 405#endif
360 case KVM_CAP_SYNC_MMU: 406 case KVM_CAP_SYNC_MMU:
361#ifdef CONFIG_KVM_BOOK3S_64_HV 407#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
362 r = cpu_has_feature(CPU_FTR_ARCH_206) ? 1 : 0; 408 if (hv_enabled)
409 r = cpu_has_feature(CPU_FTR_ARCH_206) ? 1 : 0;
410 else
411 r = 0;
363#elif defined(KVM_ARCH_WANT_MMU_NOTIFIER) 412#elif defined(KVM_ARCH_WANT_MMU_NOTIFIER)
364 r = 1; 413 r = 1;
365#else 414#else
366 r = 0; 415 r = 0;
367 break;
368#endif 416#endif
369#ifdef CONFIG_KVM_BOOK3S_64_HV 417 break;
418#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
370 case KVM_CAP_PPC_HTAB_FD: 419 case KVM_CAP_PPC_HTAB_FD:
371 r = 1; 420 r = hv_enabled;
372 break; 421 break;
373#endif 422#endif
374 break;
375 case KVM_CAP_NR_VCPUS: 423 case KVM_CAP_NR_VCPUS:
376 /* 424 /*
377 * Recommending a number of CPUs is somewhat arbitrary; we 425 * Recommending a number of CPUs is somewhat arbitrary; we
@@ -379,11 +427,10 @@ int kvm_dev_ioctl_check_extension(long ext)
379 * will have secondary threads "offline"), and for other KVM 427 * will have secondary threads "offline"), and for other KVM
380 * implementations just count online CPUs. 428 * implementations just count online CPUs.
381 */ 429 */
382#ifdef CONFIG_KVM_BOOK3S_64_HV 430 if (hv_enabled)
383 r = num_present_cpus(); 431 r = num_present_cpus();
384#else 432 else
385 r = num_online_cpus(); 433 r = num_online_cpus();
386#endif
387 break; 434 break;
388 case KVM_CAP_MAX_VCPUS: 435 case KVM_CAP_MAX_VCPUS:
389 r = KVM_MAX_VCPUS; 436 r = KVM_MAX_VCPUS;
@@ -407,15 +454,16 @@ long kvm_arch_dev_ioctl(struct file *filp,
407 return -EINVAL; 454 return -EINVAL;
408} 455}
409 456
410void kvm_arch_free_memslot(struct kvm_memory_slot *free, 457void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
411 struct kvm_memory_slot *dont) 458 struct kvm_memory_slot *dont)
412{ 459{
413 kvmppc_core_free_memslot(free, dont); 460 kvmppc_core_free_memslot(kvm, free, dont);
414} 461}
415 462
416int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) 463int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
464 unsigned long npages)
417{ 465{
418 return kvmppc_core_create_memslot(slot, npages); 466 return kvmppc_core_create_memslot(kvm, slot, npages);
419} 467}
420 468
421void kvm_arch_memslots_updated(struct kvm *kvm) 469void kvm_arch_memslots_updated(struct kvm *kvm)
@@ -659,6 +707,7 @@ int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
659 707
660 return EMULATE_DO_MMIO; 708 return EMULATE_DO_MMIO;
661} 709}
710EXPORT_SYMBOL_GPL(kvmppc_handle_load);
662 711
663/* Same as above, but sign extends */ 712/* Same as above, but sign extends */
664int kvmppc_handle_loads(struct kvm_run *run, struct kvm_vcpu *vcpu, 713int kvmppc_handle_loads(struct kvm_run *run, struct kvm_vcpu *vcpu,
@@ -720,6 +769,7 @@ int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
720 769
721 return EMULATE_DO_MMIO; 770 return EMULATE_DO_MMIO;
722} 771}
772EXPORT_SYMBOL_GPL(kvmppc_handle_store);
723 773
724int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) 774int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
725{ 775{
@@ -1024,52 +1074,12 @@ long kvm_arch_vm_ioctl(struct file *filp,
1024 r = kvm_vm_ioctl_create_spapr_tce(kvm, &create_tce); 1074 r = kvm_vm_ioctl_create_spapr_tce(kvm, &create_tce);
1025 goto out; 1075 goto out;
1026 } 1076 }
1027#endif /* CONFIG_PPC_BOOK3S_64 */
1028
1029#ifdef CONFIG_KVM_BOOK3S_64_HV
1030 case KVM_ALLOCATE_RMA: {
1031 struct kvm_allocate_rma rma;
1032 struct kvm *kvm = filp->private_data;
1033
1034 r = kvm_vm_ioctl_allocate_rma(kvm, &rma);
1035 if (r >= 0 && copy_to_user(argp, &rma, sizeof(rma)))
1036 r = -EFAULT;
1037 break;
1038 }
1039
1040 case KVM_PPC_ALLOCATE_HTAB: {
1041 u32 htab_order;
1042
1043 r = -EFAULT;
1044 if (get_user(htab_order, (u32 __user *)argp))
1045 break;
1046 r = kvmppc_alloc_reset_hpt(kvm, &htab_order);
1047 if (r)
1048 break;
1049 r = -EFAULT;
1050 if (put_user(htab_order, (u32 __user *)argp))
1051 break;
1052 r = 0;
1053 break;
1054 }
1055
1056 case KVM_PPC_GET_HTAB_FD: {
1057 struct kvm_get_htab_fd ghf;
1058
1059 r = -EFAULT;
1060 if (copy_from_user(&ghf, argp, sizeof(ghf)))
1061 break;
1062 r = kvm_vm_ioctl_get_htab_fd(kvm, &ghf);
1063 break;
1064 }
1065#endif /* CONFIG_KVM_BOOK3S_64_HV */
1066
1067#ifdef CONFIG_PPC_BOOK3S_64
1068 case KVM_PPC_GET_SMMU_INFO: { 1077 case KVM_PPC_GET_SMMU_INFO: {
1069 struct kvm_ppc_smmu_info info; 1078 struct kvm_ppc_smmu_info info;
1079 struct kvm *kvm = filp->private_data;
1070 1080
1071 memset(&info, 0, sizeof(info)); 1081 memset(&info, 0, sizeof(info));
1072 r = kvm_vm_ioctl_get_smmu_info(kvm, &info); 1082 r = kvm->arch.kvm_ops->get_smmu_info(kvm, &info);
1073 if (r >= 0 && copy_to_user(argp, &info, sizeof(info))) 1083 if (r >= 0 && copy_to_user(argp, &info, sizeof(info)))
1074 r = -EFAULT; 1084 r = -EFAULT;
1075 break; 1085 break;
@@ -1080,11 +1090,15 @@ long kvm_arch_vm_ioctl(struct file *filp,
1080 r = kvm_vm_ioctl_rtas_define_token(kvm, argp); 1090 r = kvm_vm_ioctl_rtas_define_token(kvm, argp);
1081 break; 1091 break;
1082 } 1092 }
1083#endif /* CONFIG_PPC_BOOK3S_64 */ 1093 default: {
1094 struct kvm *kvm = filp->private_data;
1095 r = kvm->arch.kvm_ops->arch_vm_ioctl(filp, ioctl, arg);
1096 }
1097#else /* CONFIG_PPC_BOOK3S_64 */
1084 default: 1098 default:
1085 r = -ENOTTY; 1099 r = -ENOTTY;
1100#endif
1086 } 1101 }
1087
1088out: 1102out:
1089 return r; 1103 return r;
1090} 1104}
@@ -1106,22 +1120,26 @@ long kvmppc_alloc_lpid(void)
1106 1120
1107 return lpid; 1121 return lpid;
1108} 1122}
1123EXPORT_SYMBOL_GPL(kvmppc_alloc_lpid);
1109 1124
1110void kvmppc_claim_lpid(long lpid) 1125void kvmppc_claim_lpid(long lpid)
1111{ 1126{
1112 set_bit(lpid, lpid_inuse); 1127 set_bit(lpid, lpid_inuse);
1113} 1128}
1129EXPORT_SYMBOL_GPL(kvmppc_claim_lpid);
1114 1130
1115void kvmppc_free_lpid(long lpid) 1131void kvmppc_free_lpid(long lpid)
1116{ 1132{
1117 clear_bit(lpid, lpid_inuse); 1133 clear_bit(lpid, lpid_inuse);
1118} 1134}
1135EXPORT_SYMBOL_GPL(kvmppc_free_lpid);
1119 1136
1120void kvmppc_init_lpid(unsigned long nr_lpids_param) 1137void kvmppc_init_lpid(unsigned long nr_lpids_param)
1121{ 1138{
1122 nr_lpids = min_t(unsigned long, KVMPPC_NR_LPIDS, nr_lpids_param); 1139 nr_lpids = min_t(unsigned long, KVMPPC_NR_LPIDS, nr_lpids_param);
1123 memset(lpid_inuse, 0, sizeof(lpid_inuse)); 1140 memset(lpid_inuse, 0, sizeof(lpid_inuse));
1124} 1141}
1142EXPORT_SYMBOL_GPL(kvmppc_init_lpid);
1125 1143
1126int kvm_arch_init(void *opaque) 1144int kvm_arch_init(void *opaque)
1127{ 1145{
@@ -1130,4 +1148,5 @@ int kvm_arch_init(void *opaque)
1130 1148
1131void kvm_arch_exit(void) 1149void kvm_arch_exit(void)
1132{ 1150{
1151
1133} 1152}
diff --git a/arch/powerpc/kvm/trace.h b/arch/powerpc/kvm/trace.h
index e326489a5420..2e0e67ef3544 100644
--- a/arch/powerpc/kvm/trace.h
+++ b/arch/powerpc/kvm/trace.h
@@ -31,126 +31,6 @@ TRACE_EVENT(kvm_ppc_instr,
31 __entry->inst, __entry->pc, __entry->emulate) 31 __entry->inst, __entry->pc, __entry->emulate)
32); 32);
33 33
34#ifdef CONFIG_PPC_BOOK3S
35#define kvm_trace_symbol_exit \
36 {0x100, "SYSTEM_RESET"}, \
37 {0x200, "MACHINE_CHECK"}, \
38 {0x300, "DATA_STORAGE"}, \
39 {0x380, "DATA_SEGMENT"}, \
40 {0x400, "INST_STORAGE"}, \
41 {0x480, "INST_SEGMENT"}, \
42 {0x500, "EXTERNAL"}, \
43 {0x501, "EXTERNAL_LEVEL"}, \
44 {0x502, "EXTERNAL_HV"}, \
45 {0x600, "ALIGNMENT"}, \
46 {0x700, "PROGRAM"}, \
47 {0x800, "FP_UNAVAIL"}, \
48 {0x900, "DECREMENTER"}, \
49 {0x980, "HV_DECREMENTER"}, \
50 {0xc00, "SYSCALL"}, \
51 {0xd00, "TRACE"}, \
52 {0xe00, "H_DATA_STORAGE"}, \
53 {0xe20, "H_INST_STORAGE"}, \
54 {0xe40, "H_EMUL_ASSIST"}, \
55 {0xf00, "PERFMON"}, \
56 {0xf20, "ALTIVEC"}, \
57 {0xf40, "VSX"}
58#else
59#define kvm_trace_symbol_exit \
60 {0, "CRITICAL"}, \
61 {1, "MACHINE_CHECK"}, \
62 {2, "DATA_STORAGE"}, \
63 {3, "INST_STORAGE"}, \
64 {4, "EXTERNAL"}, \
65 {5, "ALIGNMENT"}, \
66 {6, "PROGRAM"}, \
67 {7, "FP_UNAVAIL"}, \
68 {8, "SYSCALL"}, \
69 {9, "AP_UNAVAIL"}, \
70 {10, "DECREMENTER"}, \
71 {11, "FIT"}, \
72 {12, "WATCHDOG"}, \
73 {13, "DTLB_MISS"}, \
74 {14, "ITLB_MISS"}, \
75 {15, "DEBUG"}, \
76 {32, "SPE_UNAVAIL"}, \
77 {33, "SPE_FP_DATA"}, \
78 {34, "SPE_FP_ROUND"}, \
79 {35, "PERFORMANCE_MONITOR"}, \
80 {36, "DOORBELL"}, \
81 {37, "DOORBELL_CRITICAL"}, \
82 {38, "GUEST_DBELL"}, \
83 {39, "GUEST_DBELL_CRIT"}, \
84 {40, "HV_SYSCALL"}, \
85 {41, "HV_PRIV"}
86#endif
87
88TRACE_EVENT(kvm_exit,
89 TP_PROTO(unsigned int exit_nr, struct kvm_vcpu *vcpu),
90 TP_ARGS(exit_nr, vcpu),
91
92 TP_STRUCT__entry(
93 __field( unsigned int, exit_nr )
94 __field( unsigned long, pc )
95 __field( unsigned long, msr )
96 __field( unsigned long, dar )
97#ifdef CONFIG_KVM_BOOK3S_PR
98 __field( unsigned long, srr1 )
99#endif
100 __field( unsigned long, last_inst )
101 ),
102
103 TP_fast_assign(
104#ifdef CONFIG_KVM_BOOK3S_PR
105 struct kvmppc_book3s_shadow_vcpu *svcpu;
106#endif
107 __entry->exit_nr = exit_nr;
108 __entry->pc = kvmppc_get_pc(vcpu);
109 __entry->dar = kvmppc_get_fault_dar(vcpu);
110 __entry->msr = vcpu->arch.shared->msr;
111#ifdef CONFIG_KVM_BOOK3S_PR
112 svcpu = svcpu_get(vcpu);
113 __entry->srr1 = svcpu->shadow_srr1;
114 svcpu_put(svcpu);
115#endif
116 __entry->last_inst = vcpu->arch.last_inst;
117 ),
118
119 TP_printk("exit=%s"
120 " | pc=0x%lx"
121 " | msr=0x%lx"
122 " | dar=0x%lx"
123#ifdef CONFIG_KVM_BOOK3S_PR
124 " | srr1=0x%lx"
125#endif
126 " | last_inst=0x%lx"
127 ,
128 __print_symbolic(__entry->exit_nr, kvm_trace_symbol_exit),
129 __entry->pc,
130 __entry->msr,
131 __entry->dar,
132#ifdef CONFIG_KVM_BOOK3S_PR
133 __entry->srr1,
134#endif
135 __entry->last_inst
136 )
137);
138
139TRACE_EVENT(kvm_unmap_hva,
140 TP_PROTO(unsigned long hva),
141 TP_ARGS(hva),
142
143 TP_STRUCT__entry(
144 __field( unsigned long, hva )
145 ),
146
147 TP_fast_assign(
148 __entry->hva = hva;
149 ),
150
151 TP_printk("unmap hva 0x%lx\n", __entry->hva)
152);
153
154TRACE_EVENT(kvm_stlb_inval, 34TRACE_EVENT(kvm_stlb_inval,
155 TP_PROTO(unsigned int stlb_index), 35 TP_PROTO(unsigned int stlb_index),
156 TP_ARGS(stlb_index), 36 TP_ARGS(stlb_index),
@@ -236,315 +116,6 @@ TRACE_EVENT(kvm_check_requests,
236 __entry->cpu_nr, __entry->requests) 116 __entry->cpu_nr, __entry->requests)
237); 117);
238 118
239
240/*************************************************************************
241 * Book3S trace points *
242 *************************************************************************/
243
244#ifdef CONFIG_KVM_BOOK3S_PR
245
246TRACE_EVENT(kvm_book3s_reenter,
247 TP_PROTO(int r, struct kvm_vcpu *vcpu),
248 TP_ARGS(r, vcpu),
249
250 TP_STRUCT__entry(
251 __field( unsigned int, r )
252 __field( unsigned long, pc )
253 ),
254
255 TP_fast_assign(
256 __entry->r = r;
257 __entry->pc = kvmppc_get_pc(vcpu);
258 ),
259
260 TP_printk("reentry r=%d | pc=0x%lx", __entry->r, __entry->pc)
261);
262
263#ifdef CONFIG_PPC_BOOK3S_64
264
265TRACE_EVENT(kvm_book3s_64_mmu_map,
266 TP_PROTO(int rflags, ulong hpteg, ulong va, pfn_t hpaddr,
267 struct kvmppc_pte *orig_pte),
268 TP_ARGS(rflags, hpteg, va, hpaddr, orig_pte),
269
270 TP_STRUCT__entry(
271 __field( unsigned char, flag_w )
272 __field( unsigned char, flag_x )
273 __field( unsigned long, eaddr )
274 __field( unsigned long, hpteg )
275 __field( unsigned long, va )
276 __field( unsigned long long, vpage )
277 __field( unsigned long, hpaddr )
278 ),
279
280 TP_fast_assign(
281 __entry->flag_w = ((rflags & HPTE_R_PP) == 3) ? '-' : 'w';
282 __entry->flag_x = (rflags & HPTE_R_N) ? '-' : 'x';
283 __entry->eaddr = orig_pte->eaddr;
284 __entry->hpteg = hpteg;
285 __entry->va = va;
286 __entry->vpage = orig_pte->vpage;
287 __entry->hpaddr = hpaddr;
288 ),
289
290 TP_printk("KVM: %c%c Map 0x%lx: [%lx] 0x%lx (0x%llx) -> %lx",
291 __entry->flag_w, __entry->flag_x, __entry->eaddr,
292 __entry->hpteg, __entry->va, __entry->vpage, __entry->hpaddr)
293);
294
295#endif /* CONFIG_PPC_BOOK3S_64 */
296
297TRACE_EVENT(kvm_book3s_mmu_map,
298 TP_PROTO(struct hpte_cache *pte),
299 TP_ARGS(pte),
300
301 TP_STRUCT__entry(
302 __field( u64, host_vpn )
303 __field( u64, pfn )
304 __field( ulong, eaddr )
305 __field( u64, vpage )
306 __field( ulong, raddr )
307 __field( int, flags )
308 ),
309
310 TP_fast_assign(
311 __entry->host_vpn = pte->host_vpn;
312 __entry->pfn = pte->pfn;
313 __entry->eaddr = pte->pte.eaddr;
314 __entry->vpage = pte->pte.vpage;
315 __entry->raddr = pte->pte.raddr;
316 __entry->flags = (pte->pte.may_read ? 0x4 : 0) |
317 (pte->pte.may_write ? 0x2 : 0) |
318 (pte->pte.may_execute ? 0x1 : 0);
319 ),
320
321 TP_printk("Map: hvpn=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
322 __entry->host_vpn, __entry->pfn, __entry->eaddr,
323 __entry->vpage, __entry->raddr, __entry->flags)
324);
325
326TRACE_EVENT(kvm_book3s_mmu_invalidate,
327 TP_PROTO(struct hpte_cache *pte),
328 TP_ARGS(pte),
329
330 TP_STRUCT__entry(
331 __field( u64, host_vpn )
332 __field( u64, pfn )
333 __field( ulong, eaddr )
334 __field( u64, vpage )
335 __field( ulong, raddr )
336 __field( int, flags )
337 ),
338
339 TP_fast_assign(
340 __entry->host_vpn = pte->host_vpn;
341 __entry->pfn = pte->pfn;
342 __entry->eaddr = pte->pte.eaddr;
343 __entry->vpage = pte->pte.vpage;
344 __entry->raddr = pte->pte.raddr;
345 __entry->flags = (pte->pte.may_read ? 0x4 : 0) |
346 (pte->pte.may_write ? 0x2 : 0) |
347 (pte->pte.may_execute ? 0x1 : 0);
348 ),
349
350 TP_printk("Flush: hva=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
351 __entry->host_vpn, __entry->pfn, __entry->eaddr,
352 __entry->vpage, __entry->raddr, __entry->flags)
353);
354
355TRACE_EVENT(kvm_book3s_mmu_flush,
356 TP_PROTO(const char *type, struct kvm_vcpu *vcpu, unsigned long long p1,
357 unsigned long long p2),
358 TP_ARGS(type, vcpu, p1, p2),
359
360 TP_STRUCT__entry(
361 __field( int, count )
362 __field( unsigned long long, p1 )
363 __field( unsigned long long, p2 )
364 __field( const char *, type )
365 ),
366
367 TP_fast_assign(
368 __entry->count = to_book3s(vcpu)->hpte_cache_count;
369 __entry->p1 = p1;
370 __entry->p2 = p2;
371 __entry->type = type;
372 ),
373
374 TP_printk("Flush %d %sPTEs: %llx - %llx",
375 __entry->count, __entry->type, __entry->p1, __entry->p2)
376);
377
378TRACE_EVENT(kvm_book3s_slb_found,
379 TP_PROTO(unsigned long long gvsid, unsigned long long hvsid),
380 TP_ARGS(gvsid, hvsid),
381
382 TP_STRUCT__entry(
383 __field( unsigned long long, gvsid )
384 __field( unsigned long long, hvsid )
385 ),
386
387 TP_fast_assign(
388 __entry->gvsid = gvsid;
389 __entry->hvsid = hvsid;
390 ),
391
392 TP_printk("%llx -> %llx", __entry->gvsid, __entry->hvsid)
393);
394
395TRACE_EVENT(kvm_book3s_slb_fail,
396 TP_PROTO(u16 sid_map_mask, unsigned long long gvsid),
397 TP_ARGS(sid_map_mask, gvsid),
398
399 TP_STRUCT__entry(
400 __field( unsigned short, sid_map_mask )
401 __field( unsigned long long, gvsid )
402 ),
403
404 TP_fast_assign(
405 __entry->sid_map_mask = sid_map_mask;
406 __entry->gvsid = gvsid;
407 ),
408
409 TP_printk("%x/%x: %llx", __entry->sid_map_mask,
410 SID_MAP_MASK - __entry->sid_map_mask, __entry->gvsid)
411);
412
413TRACE_EVENT(kvm_book3s_slb_map,
414 TP_PROTO(u16 sid_map_mask, unsigned long long gvsid,
415 unsigned long long hvsid),
416 TP_ARGS(sid_map_mask, gvsid, hvsid),
417
418 TP_STRUCT__entry(
419 __field( unsigned short, sid_map_mask )
420 __field( unsigned long long, guest_vsid )
421 __field( unsigned long long, host_vsid )
422 ),
423
424 TP_fast_assign(
425 __entry->sid_map_mask = sid_map_mask;
426 __entry->guest_vsid = gvsid;
427 __entry->host_vsid = hvsid;
428 ),
429
430 TP_printk("%x: %llx -> %llx", __entry->sid_map_mask,
431 __entry->guest_vsid, __entry->host_vsid)
432);
433
434TRACE_EVENT(kvm_book3s_slbmte,
435 TP_PROTO(u64 slb_vsid, u64 slb_esid),
436 TP_ARGS(slb_vsid, slb_esid),
437
438 TP_STRUCT__entry(
439 __field( u64, slb_vsid )
440 __field( u64, slb_esid )
441 ),
442
443 TP_fast_assign(
444 __entry->slb_vsid = slb_vsid;
445 __entry->slb_esid = slb_esid;
446 ),
447
448 TP_printk("%llx, %llx", __entry->slb_vsid, __entry->slb_esid)
449);
450
451#endif /* CONFIG_PPC_BOOK3S */
452
453
454/*************************************************************************
455 * Book3E trace points *
456 *************************************************************************/
457
458#ifdef CONFIG_BOOKE
459
460TRACE_EVENT(kvm_booke206_stlb_write,
461 TP_PROTO(__u32 mas0, __u32 mas8, __u32 mas1, __u64 mas2, __u64 mas7_3),
462 TP_ARGS(mas0, mas8, mas1, mas2, mas7_3),
463
464 TP_STRUCT__entry(
465 __field( __u32, mas0 )
466 __field( __u32, mas8 )
467 __field( __u32, mas1 )
468 __field( __u64, mas2 )
469 __field( __u64, mas7_3 )
470 ),
471
472 TP_fast_assign(
473 __entry->mas0 = mas0;
474 __entry->mas8 = mas8;
475 __entry->mas1 = mas1;
476 __entry->mas2 = mas2;
477 __entry->mas7_3 = mas7_3;
478 ),
479
480 TP_printk("mas0=%x mas8=%x mas1=%x mas2=%llx mas7_3=%llx",
481 __entry->mas0, __entry->mas8, __entry->mas1,
482 __entry->mas2, __entry->mas7_3)
483);
484
485TRACE_EVENT(kvm_booke206_gtlb_write,
486 TP_PROTO(__u32 mas0, __u32 mas1, __u64 mas2, __u64 mas7_3),
487 TP_ARGS(mas0, mas1, mas2, mas7_3),
488
489 TP_STRUCT__entry(
490 __field( __u32, mas0 )
491 __field( __u32, mas1 )
492 __field( __u64, mas2 )
493 __field( __u64, mas7_3 )
494 ),
495
496 TP_fast_assign(
497 __entry->mas0 = mas0;
498 __entry->mas1 = mas1;
499 __entry->mas2 = mas2;
500 __entry->mas7_3 = mas7_3;
501 ),
502
503 TP_printk("mas0=%x mas1=%x mas2=%llx mas7_3=%llx",
504 __entry->mas0, __entry->mas1,
505 __entry->mas2, __entry->mas7_3)
506);
507
508TRACE_EVENT(kvm_booke206_ref_release,
509 TP_PROTO(__u64 pfn, __u32 flags),
510 TP_ARGS(pfn, flags),
511
512 TP_STRUCT__entry(
513 __field( __u64, pfn )
514 __field( __u32, flags )
515 ),
516
517 TP_fast_assign(
518 __entry->pfn = pfn;
519 __entry->flags = flags;
520 ),
521
522 TP_printk("pfn=%llx flags=%x",
523 __entry->pfn, __entry->flags)
524);
525
526TRACE_EVENT(kvm_booke_queue_irqprio,
527 TP_PROTO(struct kvm_vcpu *vcpu, unsigned int priority),
528 TP_ARGS(vcpu, priority),
529
530 TP_STRUCT__entry(
531 __field( __u32, cpu_nr )
532 __field( __u32, priority )
533 __field( unsigned long, pending )
534 ),
535
536 TP_fast_assign(
537 __entry->cpu_nr = vcpu->vcpu_id;
538 __entry->priority = priority;
539 __entry->pending = vcpu->arch.pending_exceptions;
540 ),
541
542 TP_printk("vcpu=%x prio=%x pending=%lx",
543 __entry->cpu_nr, __entry->priority, __entry->pending)
544);
545
546#endif
547
548#endif /* _TRACE_KVM_H */ 119#endif /* _TRACE_KVM_H */
549 120
550/* This part must be outside protection */ 121/* This part must be outside protection */
diff --git a/arch/powerpc/kvm/trace_booke.h b/arch/powerpc/kvm/trace_booke.h
new file mode 100644
index 000000000000..f7537cf26ce7
--- /dev/null
+++ b/arch/powerpc/kvm/trace_booke.h
@@ -0,0 +1,177 @@
1#if !defined(_TRACE_KVM_BOOKE_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_KVM_BOOKE_H
3
4#include <linux/tracepoint.h>
5
6#undef TRACE_SYSTEM
7#define TRACE_SYSTEM kvm_booke
8#define TRACE_INCLUDE_PATH .
9#define TRACE_INCLUDE_FILE trace_booke
10
11#define kvm_trace_symbol_exit \
12 {0, "CRITICAL"}, \
13 {1, "MACHINE_CHECK"}, \
14 {2, "DATA_STORAGE"}, \
15 {3, "INST_STORAGE"}, \
16 {4, "EXTERNAL"}, \
17 {5, "ALIGNMENT"}, \
18 {6, "PROGRAM"}, \
19 {7, "FP_UNAVAIL"}, \
20 {8, "SYSCALL"}, \
21 {9, "AP_UNAVAIL"}, \
22 {10, "DECREMENTER"}, \
23 {11, "FIT"}, \
24 {12, "WATCHDOG"}, \
25 {13, "DTLB_MISS"}, \
26 {14, "ITLB_MISS"}, \
27 {15, "DEBUG"}, \
28 {32, "SPE_UNAVAIL"}, \
29 {33, "SPE_FP_DATA"}, \
30 {34, "SPE_FP_ROUND"}, \
31 {35, "PERFORMANCE_MONITOR"}, \
32 {36, "DOORBELL"}, \
33 {37, "DOORBELL_CRITICAL"}, \
34 {38, "GUEST_DBELL"}, \
35 {39, "GUEST_DBELL_CRIT"}, \
36 {40, "HV_SYSCALL"}, \
37 {41, "HV_PRIV"}
38
39TRACE_EVENT(kvm_exit,
40 TP_PROTO(unsigned int exit_nr, struct kvm_vcpu *vcpu),
41 TP_ARGS(exit_nr, vcpu),
42
43 TP_STRUCT__entry(
44 __field( unsigned int, exit_nr )
45 __field( unsigned long, pc )
46 __field( unsigned long, msr )
47 __field( unsigned long, dar )
48 __field( unsigned long, last_inst )
49 ),
50
51 TP_fast_assign(
52 __entry->exit_nr = exit_nr;
53 __entry->pc = kvmppc_get_pc(vcpu);
54 __entry->dar = kvmppc_get_fault_dar(vcpu);
55 __entry->msr = vcpu->arch.shared->msr;
56 __entry->last_inst = vcpu->arch.last_inst;
57 ),
58
59 TP_printk("exit=%s"
60 " | pc=0x%lx"
61 " | msr=0x%lx"
62 " | dar=0x%lx"
63 " | last_inst=0x%lx"
64 ,
65 __print_symbolic(__entry->exit_nr, kvm_trace_symbol_exit),
66 __entry->pc,
67 __entry->msr,
68 __entry->dar,
69 __entry->last_inst
70 )
71);
72
73TRACE_EVENT(kvm_unmap_hva,
74 TP_PROTO(unsigned long hva),
75 TP_ARGS(hva),
76
77 TP_STRUCT__entry(
78 __field( unsigned long, hva )
79 ),
80
81 TP_fast_assign(
82 __entry->hva = hva;
83 ),
84
85 TP_printk("unmap hva 0x%lx\n", __entry->hva)
86);
87
88TRACE_EVENT(kvm_booke206_stlb_write,
89 TP_PROTO(__u32 mas0, __u32 mas8, __u32 mas1, __u64 mas2, __u64 mas7_3),
90 TP_ARGS(mas0, mas8, mas1, mas2, mas7_3),
91
92 TP_STRUCT__entry(
93 __field( __u32, mas0 )
94 __field( __u32, mas8 )
95 __field( __u32, mas1 )
96 __field( __u64, mas2 )
97 __field( __u64, mas7_3 )
98 ),
99
100 TP_fast_assign(
101 __entry->mas0 = mas0;
102 __entry->mas8 = mas8;
103 __entry->mas1 = mas1;
104 __entry->mas2 = mas2;
105 __entry->mas7_3 = mas7_3;
106 ),
107
108 TP_printk("mas0=%x mas8=%x mas1=%x mas2=%llx mas7_3=%llx",
109 __entry->mas0, __entry->mas8, __entry->mas1,
110 __entry->mas2, __entry->mas7_3)
111);
112
113TRACE_EVENT(kvm_booke206_gtlb_write,
114 TP_PROTO(__u32 mas0, __u32 mas1, __u64 mas2, __u64 mas7_3),
115 TP_ARGS(mas0, mas1, mas2, mas7_3),
116
117 TP_STRUCT__entry(
118 __field( __u32, mas0 )
119 __field( __u32, mas1 )
120 __field( __u64, mas2 )
121 __field( __u64, mas7_3 )
122 ),
123
124 TP_fast_assign(
125 __entry->mas0 = mas0;
126 __entry->mas1 = mas1;
127 __entry->mas2 = mas2;
128 __entry->mas7_3 = mas7_3;
129 ),
130
131 TP_printk("mas0=%x mas1=%x mas2=%llx mas7_3=%llx",
132 __entry->mas0, __entry->mas1,
133 __entry->mas2, __entry->mas7_3)
134);
135
136TRACE_EVENT(kvm_booke206_ref_release,
137 TP_PROTO(__u64 pfn, __u32 flags),
138 TP_ARGS(pfn, flags),
139
140 TP_STRUCT__entry(
141 __field( __u64, pfn )
142 __field( __u32, flags )
143 ),
144
145 TP_fast_assign(
146 __entry->pfn = pfn;
147 __entry->flags = flags;
148 ),
149
150 TP_printk("pfn=%llx flags=%x",
151 __entry->pfn, __entry->flags)
152);
153
154TRACE_EVENT(kvm_booke_queue_irqprio,
155 TP_PROTO(struct kvm_vcpu *vcpu, unsigned int priority),
156 TP_ARGS(vcpu, priority),
157
158 TP_STRUCT__entry(
159 __field( __u32, cpu_nr )
160 __field( __u32, priority )
161 __field( unsigned long, pending )
162 ),
163
164 TP_fast_assign(
165 __entry->cpu_nr = vcpu->vcpu_id;
166 __entry->priority = priority;
167 __entry->pending = vcpu->arch.pending_exceptions;
168 ),
169
170 TP_printk("vcpu=%x prio=%x pending=%lx",
171 __entry->cpu_nr, __entry->priority, __entry->pending)
172);
173
174#endif
175
176/* This part must be outside protection */
177#include <trace/define_trace.h>
diff --git a/arch/powerpc/kvm/trace_pr.h b/arch/powerpc/kvm/trace_pr.h
new file mode 100644
index 000000000000..8b22e4748344
--- /dev/null
+++ b/arch/powerpc/kvm/trace_pr.h
@@ -0,0 +1,297 @@
1
2#if !defined(_TRACE_KVM_PR_H) || defined(TRACE_HEADER_MULTI_READ)
3#define _TRACE_KVM_PR_H
4
5#include <linux/tracepoint.h>
6
7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM kvm_pr
9#define TRACE_INCLUDE_PATH .
10#define TRACE_INCLUDE_FILE trace_pr
11
12#define kvm_trace_symbol_exit \
13 {0x100, "SYSTEM_RESET"}, \
14 {0x200, "MACHINE_CHECK"}, \
15 {0x300, "DATA_STORAGE"}, \
16 {0x380, "DATA_SEGMENT"}, \
17 {0x400, "INST_STORAGE"}, \
18 {0x480, "INST_SEGMENT"}, \
19 {0x500, "EXTERNAL"}, \
20 {0x501, "EXTERNAL_LEVEL"}, \
21 {0x502, "EXTERNAL_HV"}, \
22 {0x600, "ALIGNMENT"}, \
23 {0x700, "PROGRAM"}, \
24 {0x800, "FP_UNAVAIL"}, \
25 {0x900, "DECREMENTER"}, \
26 {0x980, "HV_DECREMENTER"}, \
27 {0xc00, "SYSCALL"}, \
28 {0xd00, "TRACE"}, \
29 {0xe00, "H_DATA_STORAGE"}, \
30 {0xe20, "H_INST_STORAGE"}, \
31 {0xe40, "H_EMUL_ASSIST"}, \
32 {0xf00, "PERFMON"}, \
33 {0xf20, "ALTIVEC"}, \
34 {0xf40, "VSX"}
35
36TRACE_EVENT(kvm_book3s_reenter,
37 TP_PROTO(int r, struct kvm_vcpu *vcpu),
38 TP_ARGS(r, vcpu),
39
40 TP_STRUCT__entry(
41 __field( unsigned int, r )
42 __field( unsigned long, pc )
43 ),
44
45 TP_fast_assign(
46 __entry->r = r;
47 __entry->pc = kvmppc_get_pc(vcpu);
48 ),
49
50 TP_printk("reentry r=%d | pc=0x%lx", __entry->r, __entry->pc)
51);
52
53#ifdef CONFIG_PPC_BOOK3S_64
54
55TRACE_EVENT(kvm_book3s_64_mmu_map,
56 TP_PROTO(int rflags, ulong hpteg, ulong va, pfn_t hpaddr,
57 struct kvmppc_pte *orig_pte),
58 TP_ARGS(rflags, hpteg, va, hpaddr, orig_pte),
59
60 TP_STRUCT__entry(
61 __field( unsigned char, flag_w )
62 __field( unsigned char, flag_x )
63 __field( unsigned long, eaddr )
64 __field( unsigned long, hpteg )
65 __field( unsigned long, va )
66 __field( unsigned long long, vpage )
67 __field( unsigned long, hpaddr )
68 ),
69
70 TP_fast_assign(
71 __entry->flag_w = ((rflags & HPTE_R_PP) == 3) ? '-' : 'w';
72 __entry->flag_x = (rflags & HPTE_R_N) ? '-' : 'x';
73 __entry->eaddr = orig_pte->eaddr;
74 __entry->hpteg = hpteg;
75 __entry->va = va;
76 __entry->vpage = orig_pte->vpage;
77 __entry->hpaddr = hpaddr;
78 ),
79
80 TP_printk("KVM: %c%c Map 0x%lx: [%lx] 0x%lx (0x%llx) -> %lx",
81 __entry->flag_w, __entry->flag_x, __entry->eaddr,
82 __entry->hpteg, __entry->va, __entry->vpage, __entry->hpaddr)
83);
84
85#endif /* CONFIG_PPC_BOOK3S_64 */
86
87TRACE_EVENT(kvm_book3s_mmu_map,
88 TP_PROTO(struct hpte_cache *pte),
89 TP_ARGS(pte),
90
91 TP_STRUCT__entry(
92 __field( u64, host_vpn )
93 __field( u64, pfn )
94 __field( ulong, eaddr )
95 __field( u64, vpage )
96 __field( ulong, raddr )
97 __field( int, flags )
98 ),
99
100 TP_fast_assign(
101 __entry->host_vpn = pte->host_vpn;
102 __entry->pfn = pte->pfn;
103 __entry->eaddr = pte->pte.eaddr;
104 __entry->vpage = pte->pte.vpage;
105 __entry->raddr = pte->pte.raddr;
106 __entry->flags = (pte->pte.may_read ? 0x4 : 0) |
107 (pte->pte.may_write ? 0x2 : 0) |
108 (pte->pte.may_execute ? 0x1 : 0);
109 ),
110
111 TP_printk("Map: hvpn=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
112 __entry->host_vpn, __entry->pfn, __entry->eaddr,
113 __entry->vpage, __entry->raddr, __entry->flags)
114);
115
116TRACE_EVENT(kvm_book3s_mmu_invalidate,
117 TP_PROTO(struct hpte_cache *pte),
118 TP_ARGS(pte),
119
120 TP_STRUCT__entry(
121 __field( u64, host_vpn )
122 __field( u64, pfn )
123 __field( ulong, eaddr )
124 __field( u64, vpage )
125 __field( ulong, raddr )
126 __field( int, flags )
127 ),
128
129 TP_fast_assign(
130 __entry->host_vpn = pte->host_vpn;
131 __entry->pfn = pte->pfn;
132 __entry->eaddr = pte->pte.eaddr;
133 __entry->vpage = pte->pte.vpage;
134 __entry->raddr = pte->pte.raddr;
135 __entry->flags = (pte->pte.may_read ? 0x4 : 0) |
136 (pte->pte.may_write ? 0x2 : 0) |
137 (pte->pte.may_execute ? 0x1 : 0);
138 ),
139
140 TP_printk("Flush: hva=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
141 __entry->host_vpn, __entry->pfn, __entry->eaddr,
142 __entry->vpage, __entry->raddr, __entry->flags)
143);
144
145TRACE_EVENT(kvm_book3s_mmu_flush,
146 TP_PROTO(const char *type, struct kvm_vcpu *vcpu, unsigned long long p1,
147 unsigned long long p2),
148 TP_ARGS(type, vcpu, p1, p2),
149
150 TP_STRUCT__entry(
151 __field( int, count )
152 __field( unsigned long long, p1 )
153 __field( unsigned long long, p2 )
154 __field( const char *, type )
155 ),
156
157 TP_fast_assign(
158 __entry->count = to_book3s(vcpu)->hpte_cache_count;
159 __entry->p1 = p1;
160 __entry->p2 = p2;
161 __entry->type = type;
162 ),
163
164 TP_printk("Flush %d %sPTEs: %llx - %llx",
165 __entry->count, __entry->type, __entry->p1, __entry->p2)
166);
167
168TRACE_EVENT(kvm_book3s_slb_found,
169 TP_PROTO(unsigned long long gvsid, unsigned long long hvsid),
170 TP_ARGS(gvsid, hvsid),
171
172 TP_STRUCT__entry(
173 __field( unsigned long long, gvsid )
174 __field( unsigned long long, hvsid )
175 ),
176
177 TP_fast_assign(
178 __entry->gvsid = gvsid;
179 __entry->hvsid = hvsid;
180 ),
181
182 TP_printk("%llx -> %llx", __entry->gvsid, __entry->hvsid)
183);
184
185TRACE_EVENT(kvm_book3s_slb_fail,
186 TP_PROTO(u16 sid_map_mask, unsigned long long gvsid),
187 TP_ARGS(sid_map_mask, gvsid),
188
189 TP_STRUCT__entry(
190 __field( unsigned short, sid_map_mask )
191 __field( unsigned long long, gvsid )
192 ),
193
194 TP_fast_assign(
195 __entry->sid_map_mask = sid_map_mask;
196 __entry->gvsid = gvsid;
197 ),
198
199 TP_printk("%x/%x: %llx", __entry->sid_map_mask,
200 SID_MAP_MASK - __entry->sid_map_mask, __entry->gvsid)
201);
202
203TRACE_EVENT(kvm_book3s_slb_map,
204 TP_PROTO(u16 sid_map_mask, unsigned long long gvsid,
205 unsigned long long hvsid),
206 TP_ARGS(sid_map_mask, gvsid, hvsid),
207
208 TP_STRUCT__entry(
209 __field( unsigned short, sid_map_mask )
210 __field( unsigned long long, guest_vsid )
211 __field( unsigned long long, host_vsid )
212 ),
213
214 TP_fast_assign(
215 __entry->sid_map_mask = sid_map_mask;
216 __entry->guest_vsid = gvsid;
217 __entry->host_vsid = hvsid;
218 ),
219
220 TP_printk("%x: %llx -> %llx", __entry->sid_map_mask,
221 __entry->guest_vsid, __entry->host_vsid)
222);
223
224TRACE_EVENT(kvm_book3s_slbmte,
225 TP_PROTO(u64 slb_vsid, u64 slb_esid),
226 TP_ARGS(slb_vsid, slb_esid),
227
228 TP_STRUCT__entry(
229 __field( u64, slb_vsid )
230 __field( u64, slb_esid )
231 ),
232
233 TP_fast_assign(
234 __entry->slb_vsid = slb_vsid;
235 __entry->slb_esid = slb_esid;
236 ),
237
238 TP_printk("%llx, %llx", __entry->slb_vsid, __entry->slb_esid)
239);
240
241TRACE_EVENT(kvm_exit,
242 TP_PROTO(unsigned int exit_nr, struct kvm_vcpu *vcpu),
243 TP_ARGS(exit_nr, vcpu),
244
245 TP_STRUCT__entry(
246 __field( unsigned int, exit_nr )
247 __field( unsigned long, pc )
248 __field( unsigned long, msr )
249 __field( unsigned long, dar )
250 __field( unsigned long, srr1 )
251 __field( unsigned long, last_inst )
252 ),
253
254 TP_fast_assign(
255 __entry->exit_nr = exit_nr;
256 __entry->pc = kvmppc_get_pc(vcpu);
257 __entry->dar = kvmppc_get_fault_dar(vcpu);
258 __entry->msr = vcpu->arch.shared->msr;
259 __entry->srr1 = vcpu->arch.shadow_srr1;
260 __entry->last_inst = vcpu->arch.last_inst;
261 ),
262
263 TP_printk("exit=%s"
264 " | pc=0x%lx"
265 " | msr=0x%lx"
266 " | dar=0x%lx"
267 " | srr1=0x%lx"
268 " | last_inst=0x%lx"
269 ,
270 __print_symbolic(__entry->exit_nr, kvm_trace_symbol_exit),
271 __entry->pc,
272 __entry->msr,
273 __entry->dar,
274 __entry->srr1,
275 __entry->last_inst
276 )
277);
278
279TRACE_EVENT(kvm_unmap_hva,
280 TP_PROTO(unsigned long hva),
281 TP_ARGS(hva),
282
283 TP_STRUCT__entry(
284 __field( unsigned long, hva )
285 ),
286
287 TP_fast_assign(
288 __entry->hva = hva;
289 ),
290
291 TP_printk("unmap hva 0x%lx\n", __entry->hva)
292);
293
294#endif /* _TRACE_KVM_H */
295
296/* This part must be outside protection */
297#include <trace/define_trace.h>
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 450433276699..95a20e17dbff 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -10,15 +10,23 @@ CFLAGS_REMOVE_code-patching.o = -pg
10CFLAGS_REMOVE_feature-fixups.o = -pg 10CFLAGS_REMOVE_feature-fixups.o = -pg
11 11
12obj-y := string.o alloc.o \ 12obj-y := string.o alloc.o \
13 checksum_$(CONFIG_WORD_SIZE).o crtsavres.o 13 crtsavres.o
14obj-$(CONFIG_PPC32) += div64.o copy_32.o 14obj-$(CONFIG_PPC32) += div64.o copy_32.o
15obj-$(CONFIG_HAS_IOMEM) += devres.o 15obj-$(CONFIG_HAS_IOMEM) += devres.o
16 16
17obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \ 17obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \
18 memcpy_64.o usercopy_64.o mem_64.o string.o \ 18 usercopy_64.o mem_64.o string.o \
19 checksum_wrappers_64.o hweight_64.o \ 19 hweight_64.o \
20 copyuser_power7.o string_64.o copypage_power7.o \ 20 copyuser_power7.o string_64.o copypage_power7.o
21 memcpy_power7.o 21ifeq ($(CONFIG_GENERIC_CSUM),)
22obj-y += checksum_$(CONFIG_WORD_SIZE).o
23obj-$(CONFIG_PPC64) += checksum_wrappers_64.o
24endif
25
26ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),)
27obj-$(CONFIG_PPC64) += memcpy_power7.o memcpy_64.o
28endif
29
22obj-$(CONFIG_PPC_EMULATE_SSTEP) += sstep.o ldstfp.o 30obj-$(CONFIG_PPC_EMULATE_SSTEP) += sstep.o ldstfp.o
23 31
24ifeq ($(CONFIG_PPC64),y) 32ifeq ($(CONFIG_PPC64),y)
@@ -31,3 +39,6 @@ obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
31obj-y += code-patching.o 39obj-y += code-patching.o
32obj-y += feature-fixups.o 40obj-y += feature-fixups.o
33obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o 41obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o
42
43obj-$(CONFIG_ALTIVEC) += xor_vmx.o
44CFLAGS_xor_vmx.o += -maltivec -mabi=altivec
diff --git a/arch/powerpc/lib/checksum_64.S b/arch/powerpc/lib/checksum_64.S
index 167f72555d60..57a072065057 100644
--- a/arch/powerpc/lib/checksum_64.S
+++ b/arch/powerpc/lib/checksum_64.S
@@ -226,19 +226,35 @@ _GLOBAL(csum_partial)
226 blr 226 blr
227 227
228 228
229 .macro source 229 .macro srcnr
230100: 230100:
231 .section __ex_table,"a" 231 .section __ex_table,"a"
232 .align 3 232 .align 3
233 .llong 100b,.Lsrc_error 233 .llong 100b,.Lsrc_error_nr
234 .previous 234 .previous
235 .endm 235 .endm
236 236
237 .macro dest 237 .macro source
238150:
239 .section __ex_table,"a"
240 .align 3
241 .llong 150b,.Lsrc_error
242 .previous
243 .endm
244
245 .macro dstnr
238200: 246200:
239 .section __ex_table,"a" 247 .section __ex_table,"a"
240 .align 3 248 .align 3
241 .llong 200b,.Ldest_error 249 .llong 200b,.Ldest_error_nr
250 .previous
251 .endm
252
253 .macro dest
254250:
255 .section __ex_table,"a"
256 .align 3
257 .llong 250b,.Ldest_error
242 .previous 258 .previous
243 .endm 259 .endm
244 260
@@ -269,16 +285,16 @@ _GLOBAL(csum_partial_copy_generic)
269 rldicl. r6,r3,64-1,64-2 /* r6 = (r3 & 0x3) >> 1 */ 285 rldicl. r6,r3,64-1,64-2 /* r6 = (r3 & 0x3) >> 1 */
270 beq .Lcopy_aligned 286 beq .Lcopy_aligned
271 287
272 li r7,4 288 li r9,4
273 sub r6,r7,r6 289 sub r6,r9,r6
274 mtctr r6 290 mtctr r6
275 291
2761: 2921:
277source; lhz r6,0(r3) /* align to doubleword */ 293srcnr; lhz r6,0(r3) /* align to doubleword */
278 subi r5,r5,2 294 subi r5,r5,2
279 addi r3,r3,2 295 addi r3,r3,2
280 adde r0,r0,r6 296 adde r0,r0,r6
281dest; sth r6,0(r4) 297dstnr; sth r6,0(r4)
282 addi r4,r4,2 298 addi r4,r4,2
283 bdnz 1b 299 bdnz 1b
284 300
@@ -392,10 +408,10 @@ dest; std r16,56(r4)
392 408
393 mtctr r6 409 mtctr r6
3943: 4103:
395source; ld r6,0(r3) 411srcnr; ld r6,0(r3)
396 addi r3,r3,8 412 addi r3,r3,8
397 adde r0,r0,r6 413 adde r0,r0,r6
398dest; std r6,0(r4) 414dstnr; std r6,0(r4)
399 addi r4,r4,8 415 addi r4,r4,8
400 bdnz 3b 416 bdnz 3b
401 417
@@ -405,10 +421,10 @@ dest; std r6,0(r4)
405 srdi. r6,r5,2 421 srdi. r6,r5,2
406 beq .Lcopy_tail_halfword 422 beq .Lcopy_tail_halfword
407 423
408source; lwz r6,0(r3) 424srcnr; lwz r6,0(r3)
409 addi r3,r3,4 425 addi r3,r3,4
410 adde r0,r0,r6 426 adde r0,r0,r6
411dest; stw r6,0(r4) 427dstnr; stw r6,0(r4)
412 addi r4,r4,4 428 addi r4,r4,4
413 subi r5,r5,4 429 subi r5,r5,4
414 430
@@ -416,10 +432,10 @@ dest; stw r6,0(r4)
416 srdi. r6,r5,1 432 srdi. r6,r5,1
417 beq .Lcopy_tail_byte 433 beq .Lcopy_tail_byte
418 434
419source; lhz r6,0(r3) 435srcnr; lhz r6,0(r3)
420 addi r3,r3,2 436 addi r3,r3,2
421 adde r0,r0,r6 437 adde r0,r0,r6
422dest; sth r6,0(r4) 438dstnr; sth r6,0(r4)
423 addi r4,r4,2 439 addi r4,r4,2
424 subi r5,r5,2 440 subi r5,r5,2
425 441
@@ -427,10 +443,10 @@ dest; sth r6,0(r4)
427 andi. r6,r5,1 443 andi. r6,r5,1
428 beq .Lcopy_finish 444 beq .Lcopy_finish
429 445
430source; lbz r6,0(r3) 446srcnr; lbz r6,0(r3)
431 sldi r9,r6,8 /* Pad the byte out to 16 bits */ 447 sldi r9,r6,8 /* Pad the byte out to 16 bits */
432 adde r0,r0,r9 448 adde r0,r0,r9
433dest; stb r6,0(r4) 449dstnr; stb r6,0(r4)
434 450
435.Lcopy_finish: 451.Lcopy_finish:
436 addze r0,r0 /* add in final carry */ 452 addze r0,r0 /* add in final carry */
@@ -440,6 +456,11 @@ dest; stb r6,0(r4)
440 blr 456 blr
441 457
442.Lsrc_error: 458.Lsrc_error:
459 ld r14,STK_REG(R14)(r1)
460 ld r15,STK_REG(R15)(r1)
461 ld r16,STK_REG(R16)(r1)
462 addi r1,r1,STACKFRAMESIZE
463.Lsrc_error_nr:
443 cmpdi 0,r7,0 464 cmpdi 0,r7,0
444 beqlr 465 beqlr
445 li r6,-EFAULT 466 li r6,-EFAULT
@@ -447,6 +468,11 @@ dest; stb r6,0(r4)
447 blr 468 blr
448 469
449.Ldest_error: 470.Ldest_error:
471 ld r14,STK_REG(R14)(r1)
472 ld r15,STK_REG(R15)(r1)
473 ld r16,STK_REG(R16)(r1)
474 addi r1,r1,STACKFRAMESIZE
475.Ldest_error_nr:
450 cmpdi 0,r8,0 476 cmpdi 0,r8,0
451 beqlr 477 beqlr
452 li r6,-EFAULT 478 li r6,-EFAULT
diff --git a/arch/powerpc/lib/copyuser_power7.S b/arch/powerpc/lib/copyuser_power7.S
index d1f11795a7ad..e8e9c36dc784 100644
--- a/arch/powerpc/lib/copyuser_power7.S
+++ b/arch/powerpc/lib/copyuser_power7.S
@@ -19,6 +19,14 @@
19 */ 19 */
20#include <asm/ppc_asm.h> 20#include <asm/ppc_asm.h>
21 21
22#ifdef __BIG_ENDIAN__
23#define LVS(VRT,RA,RB) lvsl VRT,RA,RB
24#define VPERM(VRT,VRA,VRB,VRC) vperm VRT,VRA,VRB,VRC
25#else
26#define LVS(VRT,RA,RB) lvsr VRT,RA,RB
27#define VPERM(VRT,VRA,VRB,VRC) vperm VRT,VRB,VRA,VRC
28#endif
29
22 .macro err1 30 .macro err1
23100: 31100:
24 .section __ex_table,"a" 32 .section __ex_table,"a"
@@ -552,13 +560,13 @@ err3; stw r7,4(r3)
552 li r10,32 560 li r10,32
553 li r11,48 561 li r11,48
554 562
555 lvsl vr16,0,r4 /* Setup permute control vector */ 563 LVS(vr16,0,r4) /* Setup permute control vector */
556err3; lvx vr0,0,r4 564err3; lvx vr0,0,r4
557 addi r4,r4,16 565 addi r4,r4,16
558 566
559 bf cr7*4+3,5f 567 bf cr7*4+3,5f
560err3; lvx vr1,r0,r4 568err3; lvx vr1,r0,r4
561 vperm vr8,vr0,vr1,vr16 569 VPERM(vr8,vr0,vr1,vr16)
562 addi r4,r4,16 570 addi r4,r4,16
563err3; stvx vr8,r0,r3 571err3; stvx vr8,r0,r3
564 addi r3,r3,16 572 addi r3,r3,16
@@ -566,9 +574,9 @@ err3; stvx vr8,r0,r3
566 574
5675: bf cr7*4+2,6f 5755: bf cr7*4+2,6f
568err3; lvx vr1,r0,r4 576err3; lvx vr1,r0,r4
569 vperm vr8,vr0,vr1,vr16 577 VPERM(vr8,vr0,vr1,vr16)
570err3; lvx vr0,r4,r9 578err3; lvx vr0,r4,r9
571 vperm vr9,vr1,vr0,vr16 579 VPERM(vr9,vr1,vr0,vr16)
572 addi r4,r4,32 580 addi r4,r4,32
573err3; stvx vr8,r0,r3 581err3; stvx vr8,r0,r3
574err3; stvx vr9,r3,r9 582err3; stvx vr9,r3,r9
@@ -576,13 +584,13 @@ err3; stvx vr9,r3,r9
576 584
5776: bf cr7*4+1,7f 5856: bf cr7*4+1,7f
578err3; lvx vr3,r0,r4 586err3; lvx vr3,r0,r4
579 vperm vr8,vr0,vr3,vr16 587 VPERM(vr8,vr0,vr3,vr16)
580err3; lvx vr2,r4,r9 588err3; lvx vr2,r4,r9
581 vperm vr9,vr3,vr2,vr16 589 VPERM(vr9,vr3,vr2,vr16)
582err3; lvx vr1,r4,r10 590err3; lvx vr1,r4,r10
583 vperm vr10,vr2,vr1,vr16 591 VPERM(vr10,vr2,vr1,vr16)
584err3; lvx vr0,r4,r11 592err3; lvx vr0,r4,r11
585 vperm vr11,vr1,vr0,vr16 593 VPERM(vr11,vr1,vr0,vr16)
586 addi r4,r4,64 594 addi r4,r4,64
587err3; stvx vr8,r0,r3 595err3; stvx vr8,r0,r3
588err3; stvx vr9,r3,r9 596err3; stvx vr9,r3,r9
@@ -611,21 +619,21 @@ err3; stvx vr11,r3,r11
611 .align 5 619 .align 5
6128: 6208:
613err4; lvx vr7,r0,r4 621err4; lvx vr7,r0,r4
614 vperm vr8,vr0,vr7,vr16 622 VPERM(vr8,vr0,vr7,vr16)
615err4; lvx vr6,r4,r9 623err4; lvx vr6,r4,r9
616 vperm vr9,vr7,vr6,vr16 624 VPERM(vr9,vr7,vr6,vr16)
617err4; lvx vr5,r4,r10 625err4; lvx vr5,r4,r10
618 vperm vr10,vr6,vr5,vr16 626 VPERM(vr10,vr6,vr5,vr16)
619err4; lvx vr4,r4,r11 627err4; lvx vr4,r4,r11
620 vperm vr11,vr5,vr4,vr16 628 VPERM(vr11,vr5,vr4,vr16)
621err4; lvx vr3,r4,r12 629err4; lvx vr3,r4,r12
622 vperm vr12,vr4,vr3,vr16 630 VPERM(vr12,vr4,vr3,vr16)
623err4; lvx vr2,r4,r14 631err4; lvx vr2,r4,r14
624 vperm vr13,vr3,vr2,vr16 632 VPERM(vr13,vr3,vr2,vr16)
625err4; lvx vr1,r4,r15 633err4; lvx vr1,r4,r15
626 vperm vr14,vr2,vr1,vr16 634 VPERM(vr14,vr2,vr1,vr16)
627err4; lvx vr0,r4,r16 635err4; lvx vr0,r4,r16
628 vperm vr15,vr1,vr0,vr16 636 VPERM(vr15,vr1,vr0,vr16)
629 addi r4,r4,128 637 addi r4,r4,128
630err4; stvx vr8,r0,r3 638err4; stvx vr8,r0,r3
631err4; stvx vr9,r3,r9 639err4; stvx vr9,r3,r9
@@ -649,13 +657,13 @@ err4; stvx vr15,r3,r16
649 657
650 bf cr7*4+1,9f 658 bf cr7*4+1,9f
651err3; lvx vr3,r0,r4 659err3; lvx vr3,r0,r4
652 vperm vr8,vr0,vr3,vr16 660 VPERM(vr8,vr0,vr3,vr16)
653err3; lvx vr2,r4,r9 661err3; lvx vr2,r4,r9
654 vperm vr9,vr3,vr2,vr16 662 VPERM(vr9,vr3,vr2,vr16)
655err3; lvx vr1,r4,r10 663err3; lvx vr1,r4,r10
656 vperm vr10,vr2,vr1,vr16 664 VPERM(vr10,vr2,vr1,vr16)
657err3; lvx vr0,r4,r11 665err3; lvx vr0,r4,r11
658 vperm vr11,vr1,vr0,vr16 666 VPERM(vr11,vr1,vr0,vr16)
659 addi r4,r4,64 667 addi r4,r4,64
660err3; stvx vr8,r0,r3 668err3; stvx vr8,r0,r3
661err3; stvx vr9,r3,r9 669err3; stvx vr9,r3,r9
@@ -665,9 +673,9 @@ err3; stvx vr11,r3,r11
665 673
6669: bf cr7*4+2,10f 6749: bf cr7*4+2,10f
667err3; lvx vr1,r0,r4 675err3; lvx vr1,r0,r4
668 vperm vr8,vr0,vr1,vr16 676 VPERM(vr8,vr0,vr1,vr16)
669err3; lvx vr0,r4,r9 677err3; lvx vr0,r4,r9
670 vperm vr9,vr1,vr0,vr16 678 VPERM(vr9,vr1,vr0,vr16)
671 addi r4,r4,32 679 addi r4,r4,32
672err3; stvx vr8,r0,r3 680err3; stvx vr8,r0,r3
673err3; stvx vr9,r3,r9 681err3; stvx vr9,r3,r9
@@ -675,7 +683,7 @@ err3; stvx vr9,r3,r9
675 683
67610: bf cr7*4+3,11f 68410: bf cr7*4+3,11f
677err3; lvx vr1,r0,r4 685err3; lvx vr1,r0,r4
678 vperm vr8,vr0,vr1,vr16 686 VPERM(vr8,vr0,vr1,vr16)
679 addi r4,r4,16 687 addi r4,r4,16
680err3; stvx vr8,r0,r3 688err3; stvx vr8,r0,r3
681 addi r3,r3,16 689 addi r3,r3,16
diff --git a/arch/powerpc/lib/memcpy_power7.S b/arch/powerpc/lib/memcpy_power7.S
index 0663630baf3b..e4177dbea6bd 100644
--- a/arch/powerpc/lib/memcpy_power7.S
+++ b/arch/powerpc/lib/memcpy_power7.S
@@ -20,6 +20,15 @@
20#include <asm/ppc_asm.h> 20#include <asm/ppc_asm.h>
21 21
22_GLOBAL(memcpy_power7) 22_GLOBAL(memcpy_power7)
23
24#ifdef __BIG_ENDIAN__
25#define LVS(VRT,RA,RB) lvsl VRT,RA,RB
26#define VPERM(VRT,VRA,VRB,VRC) vperm VRT,VRA,VRB,VRC
27#else
28#define LVS(VRT,RA,RB) lvsr VRT,RA,RB
29#define VPERM(VRT,VRA,VRB,VRC) vperm VRT,VRB,VRA,VRC
30#endif
31
23#ifdef CONFIG_ALTIVEC 32#ifdef CONFIG_ALTIVEC
24 cmpldi r5,16 33 cmpldi r5,16
25 cmpldi cr1,r5,4096 34 cmpldi cr1,r5,4096
@@ -485,13 +494,13 @@ _GLOBAL(memcpy_power7)
485 li r10,32 494 li r10,32
486 li r11,48 495 li r11,48
487 496
488 lvsl vr16,0,r4 /* Setup permute control vector */ 497 LVS(vr16,0,r4) /* Setup permute control vector */
489 lvx vr0,0,r4 498 lvx vr0,0,r4
490 addi r4,r4,16 499 addi r4,r4,16
491 500
492 bf cr7*4+3,5f 501 bf cr7*4+3,5f
493 lvx vr1,r0,r4 502 lvx vr1,r0,r4
494 vperm vr8,vr0,vr1,vr16 503 VPERM(vr8,vr0,vr1,vr16)
495 addi r4,r4,16 504 addi r4,r4,16
496 stvx vr8,r0,r3 505 stvx vr8,r0,r3
497 addi r3,r3,16 506 addi r3,r3,16
@@ -499,9 +508,9 @@ _GLOBAL(memcpy_power7)
499 508
5005: bf cr7*4+2,6f 5095: bf cr7*4+2,6f
501 lvx vr1,r0,r4 510 lvx vr1,r0,r4
502 vperm vr8,vr0,vr1,vr16 511 VPERM(vr8,vr0,vr1,vr16)
503 lvx vr0,r4,r9 512 lvx vr0,r4,r9
504 vperm vr9,vr1,vr0,vr16 513 VPERM(vr9,vr1,vr0,vr16)
505 addi r4,r4,32 514 addi r4,r4,32
506 stvx vr8,r0,r3 515 stvx vr8,r0,r3
507 stvx vr9,r3,r9 516 stvx vr9,r3,r9
@@ -509,13 +518,13 @@ _GLOBAL(memcpy_power7)
509 518
5106: bf cr7*4+1,7f 5196: bf cr7*4+1,7f
511 lvx vr3,r0,r4 520 lvx vr3,r0,r4
512 vperm vr8,vr0,vr3,vr16 521 VPERM(vr8,vr0,vr3,vr16)
513 lvx vr2,r4,r9 522 lvx vr2,r4,r9
514 vperm vr9,vr3,vr2,vr16 523 VPERM(vr9,vr3,vr2,vr16)
515 lvx vr1,r4,r10 524 lvx vr1,r4,r10
516 vperm vr10,vr2,vr1,vr16 525 VPERM(vr10,vr2,vr1,vr16)
517 lvx vr0,r4,r11 526 lvx vr0,r4,r11
518 vperm vr11,vr1,vr0,vr16 527 VPERM(vr11,vr1,vr0,vr16)
519 addi r4,r4,64 528 addi r4,r4,64
520 stvx vr8,r0,r3 529 stvx vr8,r0,r3
521 stvx vr9,r3,r9 530 stvx vr9,r3,r9
@@ -544,21 +553,21 @@ _GLOBAL(memcpy_power7)
544 .align 5 553 .align 5
5458: 5548:
546 lvx vr7,r0,r4 555 lvx vr7,r0,r4
547 vperm vr8,vr0,vr7,vr16 556 VPERM(vr8,vr0,vr7,vr16)
548 lvx vr6,r4,r9 557 lvx vr6,r4,r9
549 vperm vr9,vr7,vr6,vr16 558 VPERM(vr9,vr7,vr6,vr16)
550 lvx vr5,r4,r10 559 lvx vr5,r4,r10
551 vperm vr10,vr6,vr5,vr16 560 VPERM(vr10,vr6,vr5,vr16)
552 lvx vr4,r4,r11 561 lvx vr4,r4,r11
553 vperm vr11,vr5,vr4,vr16 562 VPERM(vr11,vr5,vr4,vr16)
554 lvx vr3,r4,r12 563 lvx vr3,r4,r12
555 vperm vr12,vr4,vr3,vr16 564 VPERM(vr12,vr4,vr3,vr16)
556 lvx vr2,r4,r14 565 lvx vr2,r4,r14
557 vperm vr13,vr3,vr2,vr16 566 VPERM(vr13,vr3,vr2,vr16)
558 lvx vr1,r4,r15 567 lvx vr1,r4,r15
559 vperm vr14,vr2,vr1,vr16 568 VPERM(vr14,vr2,vr1,vr16)
560 lvx vr0,r4,r16 569 lvx vr0,r4,r16
561 vperm vr15,vr1,vr0,vr16 570 VPERM(vr15,vr1,vr0,vr16)
562 addi r4,r4,128 571 addi r4,r4,128
563 stvx vr8,r0,r3 572 stvx vr8,r0,r3
564 stvx vr9,r3,r9 573 stvx vr9,r3,r9
@@ -582,13 +591,13 @@ _GLOBAL(memcpy_power7)
582 591
583 bf cr7*4+1,9f 592 bf cr7*4+1,9f
584 lvx vr3,r0,r4 593 lvx vr3,r0,r4
585 vperm vr8,vr0,vr3,vr16 594 VPERM(vr8,vr0,vr3,vr16)
586 lvx vr2,r4,r9 595 lvx vr2,r4,r9
587 vperm vr9,vr3,vr2,vr16 596 VPERM(vr9,vr3,vr2,vr16)
588 lvx vr1,r4,r10 597 lvx vr1,r4,r10
589 vperm vr10,vr2,vr1,vr16 598 VPERM(vr10,vr2,vr1,vr16)
590 lvx vr0,r4,r11 599 lvx vr0,r4,r11
591 vperm vr11,vr1,vr0,vr16 600 VPERM(vr11,vr1,vr0,vr16)
592 addi r4,r4,64 601 addi r4,r4,64
593 stvx vr8,r0,r3 602 stvx vr8,r0,r3
594 stvx vr9,r3,r9 603 stvx vr9,r3,r9
@@ -598,9 +607,9 @@ _GLOBAL(memcpy_power7)
598 607
5999: bf cr7*4+2,10f 6089: bf cr7*4+2,10f
600 lvx vr1,r0,r4 609 lvx vr1,r0,r4
601 vperm vr8,vr0,vr1,vr16 610 VPERM(vr8,vr0,vr1,vr16)
602 lvx vr0,r4,r9 611 lvx vr0,r4,r9
603 vperm vr9,vr1,vr0,vr16 612 VPERM(vr9,vr1,vr0,vr16)
604 addi r4,r4,32 613 addi r4,r4,32
605 stvx vr8,r0,r3 614 stvx vr8,r0,r3
606 stvx vr9,r3,r9 615 stvx vr9,r3,r9
@@ -608,7 +617,7 @@ _GLOBAL(memcpy_power7)
608 617
60910: bf cr7*4+3,11f 61810: bf cr7*4+3,11f
610 lvx vr1,r0,r4 619 lvx vr1,r0,r4
611 vperm vr8,vr0,vr1,vr16 620 VPERM(vr8,vr0,vr1,vr16)
612 addi r4,r4,16 621 addi r4,r4,16
613 stvx vr8,r0,r3 622 stvx vr8,r0,r3
614 addi r3,r3,16 623 addi r3,r3,16
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index a7ee978fb860..c0511c27a733 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -212,11 +212,19 @@ static int __kprobes read_mem_unaligned(unsigned long *dest, unsigned long ea,
212{ 212{
213 int err; 213 int err;
214 unsigned long x, b, c; 214 unsigned long x, b, c;
215#ifdef __LITTLE_ENDIAN__
216 int len = nb; /* save a copy of the length for byte reversal */
217#endif
215 218
216 /* unaligned, do this in pieces */ 219 /* unaligned, do this in pieces */
217 x = 0; 220 x = 0;
218 for (; nb > 0; nb -= c) { 221 for (; nb > 0; nb -= c) {
222#ifdef __LITTLE_ENDIAN__
223 c = 1;
224#endif
225#ifdef __BIG_ENDIAN__
219 c = max_align(ea); 226 c = max_align(ea);
227#endif
220 if (c > nb) 228 if (c > nb)
221 c = max_align(nb); 229 c = max_align(nb);
222 err = read_mem_aligned(&b, ea, c); 230 err = read_mem_aligned(&b, ea, c);
@@ -225,7 +233,24 @@ static int __kprobes read_mem_unaligned(unsigned long *dest, unsigned long ea,
225 x = (x << (8 * c)) + b; 233 x = (x << (8 * c)) + b;
226 ea += c; 234 ea += c;
227 } 235 }
236#ifdef __LITTLE_ENDIAN__
237 switch (len) {
238 case 2:
239 *dest = byterev_2(x);
240 break;
241 case 4:
242 *dest = byterev_4(x);
243 break;
244#ifdef __powerpc64__
245 case 8:
246 *dest = byterev_8(x);
247 break;
248#endif
249 }
250#endif
251#ifdef __BIG_ENDIAN__
228 *dest = x; 252 *dest = x;
253#endif
229 return 0; 254 return 0;
230} 255}
231 256
@@ -273,9 +298,29 @@ static int __kprobes write_mem_unaligned(unsigned long val, unsigned long ea,
273 int err; 298 int err;
274 unsigned long c; 299 unsigned long c;
275 300
301#ifdef __LITTLE_ENDIAN__
302 switch (nb) {
303 case 2:
304 val = byterev_2(val);
305 break;
306 case 4:
307 val = byterev_4(val);
308 break;
309#ifdef __powerpc64__
310 case 8:
311 val = byterev_8(val);
312 break;
313#endif
314 }
315#endif
276 /* unaligned or little-endian, do this in pieces */ 316 /* unaligned or little-endian, do this in pieces */
277 for (; nb > 0; nb -= c) { 317 for (; nb > 0; nb -= c) {
318#ifdef __LITTLE_ENDIAN__
319 c = 1;
320#endif
321#ifdef __BIG_ENDIAN__
278 c = max_align(ea); 322 c = max_align(ea);
323#endif
279 if (c > nb) 324 if (c > nb)
280 c = max_align(nb); 325 c = max_align(nb);
281 err = write_mem_aligned(val >> (nb - c) * 8, ea, c); 326 err = write_mem_aligned(val >> (nb - c) * 8, ea, c);
@@ -310,22 +355,36 @@ static int __kprobes do_fp_load(int rn, int (*func)(int, unsigned long),
310 struct pt_regs *regs) 355 struct pt_regs *regs)
311{ 356{
312 int err; 357 int err;
313 unsigned long val[sizeof(double) / sizeof(long)]; 358 union {
359 double dbl;
360 unsigned long ul[2];
361 struct {
362#ifdef __BIG_ENDIAN__
363 unsigned _pad_;
364 unsigned word;
365#endif
366#ifdef __LITTLE_ENDIAN__
367 unsigned word;
368 unsigned _pad_;
369#endif
370 } single;
371 } data;
314 unsigned long ptr; 372 unsigned long ptr;
315 373
316 if (!address_ok(regs, ea, nb)) 374 if (!address_ok(regs, ea, nb))
317 return -EFAULT; 375 return -EFAULT;
318 if ((ea & 3) == 0) 376 if ((ea & 3) == 0)
319 return (*func)(rn, ea); 377 return (*func)(rn, ea);
320 ptr = (unsigned long) &val[0]; 378 ptr = (unsigned long) &data.ul;
321 if (sizeof(unsigned long) == 8 || nb == 4) { 379 if (sizeof(unsigned long) == 8 || nb == 4) {
322 err = read_mem_unaligned(&val[0], ea, nb, regs); 380 err = read_mem_unaligned(&data.ul[0], ea, nb, regs);
323 ptr += sizeof(unsigned long) - nb; 381 if (nb == 4)
382 ptr = (unsigned long)&(data.single.word);
324 } else { 383 } else {
325 /* reading a double on 32-bit */ 384 /* reading a double on 32-bit */
326 err = read_mem_unaligned(&val[0], ea, 4, regs); 385 err = read_mem_unaligned(&data.ul[0], ea, 4, regs);
327 if (!err) 386 if (!err)
328 err = read_mem_unaligned(&val[1], ea + 4, 4, regs); 387 err = read_mem_unaligned(&data.ul[1], ea + 4, 4, regs);
329 } 388 }
330 if (err) 389 if (err)
331 return err; 390 return err;
@@ -337,28 +396,42 @@ static int __kprobes do_fp_store(int rn, int (*func)(int, unsigned long),
337 struct pt_regs *regs) 396 struct pt_regs *regs)
338{ 397{
339 int err; 398 int err;
340 unsigned long val[sizeof(double) / sizeof(long)]; 399 union {
400 double dbl;
401 unsigned long ul[2];
402 struct {
403#ifdef __BIG_ENDIAN__
404 unsigned _pad_;
405 unsigned word;
406#endif
407#ifdef __LITTLE_ENDIAN__
408 unsigned word;
409 unsigned _pad_;
410#endif
411 } single;
412 } data;
341 unsigned long ptr; 413 unsigned long ptr;
342 414
343 if (!address_ok(regs, ea, nb)) 415 if (!address_ok(regs, ea, nb))
344 return -EFAULT; 416 return -EFAULT;
345 if ((ea & 3) == 0) 417 if ((ea & 3) == 0)
346 return (*func)(rn, ea); 418 return (*func)(rn, ea);
347 ptr = (unsigned long) &val[0]; 419 ptr = (unsigned long) &data.ul[0];
348 if (sizeof(unsigned long) == 8 || nb == 4) { 420 if (sizeof(unsigned long) == 8 || nb == 4) {
349 ptr += sizeof(unsigned long) - nb; 421 if (nb == 4)
422 ptr = (unsigned long)&(data.single.word);
350 err = (*func)(rn, ptr); 423 err = (*func)(rn, ptr);
351 if (err) 424 if (err)
352 return err; 425 return err;
353 err = write_mem_unaligned(val[0], ea, nb, regs); 426 err = write_mem_unaligned(data.ul[0], ea, nb, regs);
354 } else { 427 } else {
355 /* writing a double on 32-bit */ 428 /* writing a double on 32-bit */
356 err = (*func)(rn, ptr); 429 err = (*func)(rn, ptr);
357 if (err) 430 if (err)
358 return err; 431 return err;
359 err = write_mem_unaligned(val[0], ea, 4, regs); 432 err = write_mem_unaligned(data.ul[0], ea, 4, regs);
360 if (!err) 433 if (!err)
361 err = write_mem_unaligned(val[1], ea + 4, 4, regs); 434 err = write_mem_unaligned(data.ul[1], ea + 4, 4, regs);
362 } 435 }
363 return err; 436 return err;
364} 437}
@@ -1505,6 +1578,7 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
1505 */ 1578 */
1506 if ((ra == 1) && !(regs->msr & MSR_PR) \ 1579 if ((ra == 1) && !(regs->msr & MSR_PR) \
1507 && (val3 >= (regs->gpr[1] - STACK_INT_FRAME_SIZE))) { 1580 && (val3 >= (regs->gpr[1] - STACK_INT_FRAME_SIZE))) {
1581#ifdef CONFIG_PPC32
1508 /* 1582 /*
1509 * Check if we will touch kernel sack overflow 1583 * Check if we will touch kernel sack overflow
1510 */ 1584 */
@@ -1513,7 +1587,7 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
1513 err = -EINVAL; 1587 err = -EINVAL;
1514 break; 1588 break;
1515 } 1589 }
1516 1590#endif /* CONFIG_PPC32 */
1517 /* 1591 /*
1518 * Check if we already set since that means we'll 1592 * Check if we already set since that means we'll
1519 * lose the previous value. 1593 * lose the previous value.
diff --git a/arch/powerpc/lib/xor_vmx.c b/arch/powerpc/lib/xor_vmx.c
new file mode 100644
index 000000000000..e905f7c2ea7b
--- /dev/null
+++ b/arch/powerpc/lib/xor_vmx.c
@@ -0,0 +1,177 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 *
16 * Copyright (C) IBM Corporation, 2012
17 *
18 * Author: Anton Blanchard <anton@au.ibm.com>
19 */
20#include <altivec.h>
21
22#include <linux/preempt.h>
23#include <linux/export.h>
24#include <linux/sched.h>
25#include <asm/switch_to.h>
26
27typedef vector signed char unative_t;
28
29#define DEFINE(V) \
30 unative_t *V = (unative_t *)V##_in; \
31 unative_t V##_0, V##_1, V##_2, V##_3
32
33#define LOAD(V) \
34 do { \
35 V##_0 = V[0]; \
36 V##_1 = V[1]; \
37 V##_2 = V[2]; \
38 V##_3 = V[3]; \
39 } while (0)
40
41#define STORE(V) \
42 do { \
43 V[0] = V##_0; \
44 V[1] = V##_1; \
45 V[2] = V##_2; \
46 V[3] = V##_3; \
47 } while (0)
48
49#define XOR(V1, V2) \
50 do { \
51 V1##_0 = vec_xor(V1##_0, V2##_0); \
52 V1##_1 = vec_xor(V1##_1, V2##_1); \
53 V1##_2 = vec_xor(V1##_2, V2##_2); \
54 V1##_3 = vec_xor(V1##_3, V2##_3); \
55 } while (0)
56
57void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
58 unsigned long *v2_in)
59{
60 DEFINE(v1);
61 DEFINE(v2);
62 unsigned long lines = bytes / (sizeof(unative_t)) / 4;
63
64 preempt_disable();
65 enable_kernel_altivec();
66
67 do {
68 LOAD(v1);
69 LOAD(v2);
70 XOR(v1, v2);
71 STORE(v1);
72
73 v1 += 4;
74 v2 += 4;
75 } while (--lines > 0);
76
77 preempt_enable();
78}
79EXPORT_SYMBOL(xor_altivec_2);
80
81void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
82 unsigned long *v2_in, unsigned long *v3_in)
83{
84 DEFINE(v1);
85 DEFINE(v2);
86 DEFINE(v3);
87 unsigned long lines = bytes / (sizeof(unative_t)) / 4;
88
89 preempt_disable();
90 enable_kernel_altivec();
91
92 do {
93 LOAD(v1);
94 LOAD(v2);
95 LOAD(v3);
96 XOR(v1, v2);
97 XOR(v1, v3);
98 STORE(v1);
99
100 v1 += 4;
101 v2 += 4;
102 v3 += 4;
103 } while (--lines > 0);
104
105 preempt_enable();
106}
107EXPORT_SYMBOL(xor_altivec_3);
108
109void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
110 unsigned long *v2_in, unsigned long *v3_in,
111 unsigned long *v4_in)
112{
113 DEFINE(v1);
114 DEFINE(v2);
115 DEFINE(v3);
116 DEFINE(v4);
117 unsigned long lines = bytes / (sizeof(unative_t)) / 4;
118
119 preempt_disable();
120 enable_kernel_altivec();
121
122 do {
123 LOAD(v1);
124 LOAD(v2);
125 LOAD(v3);
126 LOAD(v4);
127 XOR(v1, v2);
128 XOR(v3, v4);
129 XOR(v1, v3);
130 STORE(v1);
131
132 v1 += 4;
133 v2 += 4;
134 v3 += 4;
135 v4 += 4;
136 } while (--lines > 0);
137
138 preempt_enable();
139}
140EXPORT_SYMBOL(xor_altivec_4);
141
142void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
143 unsigned long *v2_in, unsigned long *v3_in,
144 unsigned long *v4_in, unsigned long *v5_in)
145{
146 DEFINE(v1);
147 DEFINE(v2);
148 DEFINE(v3);
149 DEFINE(v4);
150 DEFINE(v5);
151 unsigned long lines = bytes / (sizeof(unative_t)) / 4;
152
153 preempt_disable();
154 enable_kernel_altivec();
155
156 do {
157 LOAD(v1);
158 LOAD(v2);
159 LOAD(v3);
160 LOAD(v4);
161 LOAD(v5);
162 XOR(v1, v2);
163 XOR(v3, v4);
164 XOR(v1, v5);
165 XOR(v1, v3);
166 STORE(v1);
167
168 v1 += 4;
169 v2 += 4;
170 v3 += 4;
171 v4 += 4;
172 v5 += 4;
173 } while (--lines > 0);
174
175 preempt_enable();
176}
177EXPORT_SYMBOL(xor_altivec_5);
diff --git a/arch/powerpc/mm/dma-noncoherent.c b/arch/powerpc/mm/dma-noncoherent.c
index 6747eece84af..7b6c10750179 100644
--- a/arch/powerpc/mm/dma-noncoherent.c
+++ b/arch/powerpc/mm/dma-noncoherent.c
@@ -287,9 +287,7 @@ void __dma_free_coherent(size_t size, void *vaddr)
287 pte_clear(&init_mm, addr, ptep); 287 pte_clear(&init_mm, addr, ptep);
288 if (pfn_valid(pfn)) { 288 if (pfn_valid(pfn)) {
289 struct page *page = pfn_to_page(pfn); 289 struct page *page = pfn_to_page(pfn);
290 290 __free_reserved_page(page);
291 ClearPageReserved(page);
292 __free_page(page);
293 } 291 }
294 } 292 }
295 addr += PAGE_SIZE; 293 addr += PAGE_SIZE;
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index c33d939120c9..3ea26c25590b 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -35,7 +35,11 @@
35#define DBG_LOW(fmt...) 35#define DBG_LOW(fmt...)
36#endif 36#endif
37 37
38#ifdef __BIG_ENDIAN__
38#define HPTE_LOCK_BIT 3 39#define HPTE_LOCK_BIT 3
40#else
41#define HPTE_LOCK_BIT (56+3)
42#endif
39 43
40DEFINE_RAW_SPINLOCK(native_tlbie_lock); 44DEFINE_RAW_SPINLOCK(native_tlbie_lock);
41 45
@@ -172,7 +176,7 @@ static inline void tlbie(unsigned long vpn, int psize, int apsize,
172 176
173static inline void native_lock_hpte(struct hash_pte *hptep) 177static inline void native_lock_hpte(struct hash_pte *hptep)
174{ 178{
175 unsigned long *word = &hptep->v; 179 unsigned long *word = (unsigned long *)&hptep->v;
176 180
177 while (1) { 181 while (1) {
178 if (!test_and_set_bit_lock(HPTE_LOCK_BIT, word)) 182 if (!test_and_set_bit_lock(HPTE_LOCK_BIT, word))
@@ -184,7 +188,7 @@ static inline void native_lock_hpte(struct hash_pte *hptep)
184 188
185static inline void native_unlock_hpte(struct hash_pte *hptep) 189static inline void native_unlock_hpte(struct hash_pte *hptep)
186{ 190{
187 unsigned long *word = &hptep->v; 191 unsigned long *word = (unsigned long *)&hptep->v;
188 192
189 clear_bit_unlock(HPTE_LOCK_BIT, word); 193 clear_bit_unlock(HPTE_LOCK_BIT, word);
190} 194}
@@ -204,10 +208,10 @@ static long native_hpte_insert(unsigned long hpte_group, unsigned long vpn,
204 } 208 }
205 209
206 for (i = 0; i < HPTES_PER_GROUP; i++) { 210 for (i = 0; i < HPTES_PER_GROUP; i++) {
207 if (! (hptep->v & HPTE_V_VALID)) { 211 if (! (be64_to_cpu(hptep->v) & HPTE_V_VALID)) {
208 /* retry with lock held */ 212 /* retry with lock held */
209 native_lock_hpte(hptep); 213 native_lock_hpte(hptep);
210 if (! (hptep->v & HPTE_V_VALID)) 214 if (! (be64_to_cpu(hptep->v) & HPTE_V_VALID))
211 break; 215 break;
212 native_unlock_hpte(hptep); 216 native_unlock_hpte(hptep);
213 } 217 }
@@ -226,14 +230,14 @@ static long native_hpte_insert(unsigned long hpte_group, unsigned long vpn,
226 i, hpte_v, hpte_r); 230 i, hpte_v, hpte_r);
227 } 231 }
228 232
229 hptep->r = hpte_r; 233 hptep->r = cpu_to_be64(hpte_r);
230 /* Guarantee the second dword is visible before the valid bit */ 234 /* Guarantee the second dword is visible before the valid bit */
231 eieio(); 235 eieio();
232 /* 236 /*
233 * Now set the first dword including the valid bit 237 * Now set the first dword including the valid bit
234 * NOTE: this also unlocks the hpte 238 * NOTE: this also unlocks the hpte
235 */ 239 */
236 hptep->v = hpte_v; 240 hptep->v = cpu_to_be64(hpte_v);
237 241
238 __asm__ __volatile__ ("ptesync" : : : "memory"); 242 __asm__ __volatile__ ("ptesync" : : : "memory");
239 243
@@ -254,12 +258,12 @@ static long native_hpte_remove(unsigned long hpte_group)
254 258
255 for (i = 0; i < HPTES_PER_GROUP; i++) { 259 for (i = 0; i < HPTES_PER_GROUP; i++) {
256 hptep = htab_address + hpte_group + slot_offset; 260 hptep = htab_address + hpte_group + slot_offset;
257 hpte_v = hptep->v; 261 hpte_v = be64_to_cpu(hptep->v);
258 262
259 if ((hpte_v & HPTE_V_VALID) && !(hpte_v & HPTE_V_BOLTED)) { 263 if ((hpte_v & HPTE_V_VALID) && !(hpte_v & HPTE_V_BOLTED)) {
260 /* retry with lock held */ 264 /* retry with lock held */
261 native_lock_hpte(hptep); 265 native_lock_hpte(hptep);
262 hpte_v = hptep->v; 266 hpte_v = be64_to_cpu(hptep->v);
263 if ((hpte_v & HPTE_V_VALID) 267 if ((hpte_v & HPTE_V_VALID)
264 && !(hpte_v & HPTE_V_BOLTED)) 268 && !(hpte_v & HPTE_V_BOLTED))
265 break; 269 break;
@@ -294,7 +298,7 @@ static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
294 298
295 native_lock_hpte(hptep); 299 native_lock_hpte(hptep);
296 300
297 hpte_v = hptep->v; 301 hpte_v = be64_to_cpu(hptep->v);
298 /* 302 /*
299 * We need to invalidate the TLB always because hpte_remove doesn't do 303 * We need to invalidate the TLB always because hpte_remove doesn't do
300 * a tlb invalidate. If a hash bucket gets full, we "evict" a more/less 304 * a tlb invalidate. If a hash bucket gets full, we "evict" a more/less
@@ -308,8 +312,8 @@ static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
308 } else { 312 } else {
309 DBG_LOW(" -> hit\n"); 313 DBG_LOW(" -> hit\n");
310 /* Update the HPTE */ 314 /* Update the HPTE */
311 hptep->r = (hptep->r & ~(HPTE_R_PP | HPTE_R_N)) | 315 hptep->r = cpu_to_be64((be64_to_cpu(hptep->r) & ~(HPTE_R_PP | HPTE_R_N)) |
312 (newpp & (HPTE_R_PP | HPTE_R_N | HPTE_R_C)); 316 (newpp & (HPTE_R_PP | HPTE_R_N | HPTE_R_C)));
313 } 317 }
314 native_unlock_hpte(hptep); 318 native_unlock_hpte(hptep);
315 319
@@ -334,7 +338,7 @@ static long native_hpte_find(unsigned long vpn, int psize, int ssize)
334 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 338 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
335 for (i = 0; i < HPTES_PER_GROUP; i++) { 339 for (i = 0; i < HPTES_PER_GROUP; i++) {
336 hptep = htab_address + slot; 340 hptep = htab_address + slot;
337 hpte_v = hptep->v; 341 hpte_v = be64_to_cpu(hptep->v);
338 342
339 if (HPTE_V_COMPARE(hpte_v, want_v) && (hpte_v & HPTE_V_VALID)) 343 if (HPTE_V_COMPARE(hpte_v, want_v) && (hpte_v & HPTE_V_VALID))
340 /* HPTE matches */ 344 /* HPTE matches */
@@ -369,8 +373,9 @@ static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea,
369 hptep = htab_address + slot; 373 hptep = htab_address + slot;
370 374
371 /* Update the HPTE */ 375 /* Update the HPTE */
372 hptep->r = (hptep->r & ~(HPTE_R_PP | HPTE_R_N)) | 376 hptep->r = cpu_to_be64((be64_to_cpu(hptep->r) &
373 (newpp & (HPTE_R_PP | HPTE_R_N)); 377 ~(HPTE_R_PP | HPTE_R_N)) |
378 (newpp & (HPTE_R_PP | HPTE_R_N)));
374 /* 379 /*
375 * Ensure it is out of the tlb too. Bolted entries base and 380 * Ensure it is out of the tlb too. Bolted entries base and
376 * actual page size will be same. 381 * actual page size will be same.
@@ -392,7 +397,7 @@ static void native_hpte_invalidate(unsigned long slot, unsigned long vpn,
392 397
393 want_v = hpte_encode_avpn(vpn, bpsize, ssize); 398 want_v = hpte_encode_avpn(vpn, bpsize, ssize);
394 native_lock_hpte(hptep); 399 native_lock_hpte(hptep);
395 hpte_v = hptep->v; 400 hpte_v = be64_to_cpu(hptep->v);
396 401
397 /* 402 /*
398 * We need to invalidate the TLB always because hpte_remove doesn't do 403 * We need to invalidate the TLB always because hpte_remove doesn't do
@@ -458,7 +463,7 @@ static void native_hugepage_invalidate(struct mm_struct *mm,
458 hptep = htab_address + slot; 463 hptep = htab_address + slot;
459 want_v = hpte_encode_avpn(vpn, psize, ssize); 464 want_v = hpte_encode_avpn(vpn, psize, ssize);
460 native_lock_hpte(hptep); 465 native_lock_hpte(hptep);
461 hpte_v = hptep->v; 466 hpte_v = be64_to_cpu(hptep->v);
462 467
463 /* Even if we miss, we need to invalidate the TLB */ 468 /* Even if we miss, we need to invalidate the TLB */
464 if (!HPTE_V_COMPARE(hpte_v, want_v) || !(hpte_v & HPTE_V_VALID)) 469 if (!HPTE_V_COMPARE(hpte_v, want_v) || !(hpte_v & HPTE_V_VALID))
@@ -519,11 +524,12 @@ static void hpte_decode(struct hash_pte *hpte, unsigned long slot,
519 int *psize, int *apsize, int *ssize, unsigned long *vpn) 524 int *psize, int *apsize, int *ssize, unsigned long *vpn)
520{ 525{
521 unsigned long avpn, pteg, vpi; 526 unsigned long avpn, pteg, vpi;
522 unsigned long hpte_v = hpte->v; 527 unsigned long hpte_v = be64_to_cpu(hpte->v);
528 unsigned long hpte_r = be64_to_cpu(hpte->r);
523 unsigned long vsid, seg_off; 529 unsigned long vsid, seg_off;
524 int size, a_size, shift; 530 int size, a_size, shift;
525 /* Look at the 8 bit LP value */ 531 /* Look at the 8 bit LP value */
526 unsigned int lp = (hpte->r >> LP_SHIFT) & ((1 << LP_BITS) - 1); 532 unsigned int lp = (hpte_r >> LP_SHIFT) & ((1 << LP_BITS) - 1);
527 533
528 if (!(hpte_v & HPTE_V_LARGE)) { 534 if (!(hpte_v & HPTE_V_LARGE)) {
529 size = MMU_PAGE_4K; 535 size = MMU_PAGE_4K;
@@ -612,7 +618,7 @@ static void native_hpte_clear(void)
612 * running, right? and for crash dump, we probably 618 * running, right? and for crash dump, we probably
613 * don't want to wait for a maybe bad cpu. 619 * don't want to wait for a maybe bad cpu.
614 */ 620 */
615 hpte_v = hptep->v; 621 hpte_v = be64_to_cpu(hptep->v);
616 622
617 /* 623 /*
618 * Call __tlbie() here rather than tlbie() since we 624 * Call __tlbie() here rather than tlbie() since we
@@ -664,7 +670,7 @@ static void native_flush_hash_range(unsigned long number, int local)
664 hptep = htab_address + slot; 670 hptep = htab_address + slot;
665 want_v = hpte_encode_avpn(vpn, psize, ssize); 671 want_v = hpte_encode_avpn(vpn, psize, ssize);
666 native_lock_hpte(hptep); 672 native_lock_hpte(hptep);
667 hpte_v = hptep->v; 673 hpte_v = be64_to_cpu(hptep->v);
668 if (!HPTE_V_COMPARE(hpte_v, want_v) || 674 if (!HPTE_V_COMPARE(hpte_v, want_v) ||
669 !(hpte_v & HPTE_V_VALID)) 675 !(hpte_v & HPTE_V_VALID))
670 native_unlock_hpte(hptep); 676 native_unlock_hpte(hptep);
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index bde8b5589755..6176b3cdf579 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -251,19 +251,18 @@ static int __init htab_dt_scan_seg_sizes(unsigned long node,
251 void *data) 251 void *data)
252{ 252{
253 char *type = of_get_flat_dt_prop(node, "device_type", NULL); 253 char *type = of_get_flat_dt_prop(node, "device_type", NULL);
254 u32 *prop; 254 __be32 *prop;
255 unsigned long size = 0; 255 unsigned long size = 0;
256 256
257 /* We are scanning "cpu" nodes only */ 257 /* We are scanning "cpu" nodes only */
258 if (type == NULL || strcmp(type, "cpu") != 0) 258 if (type == NULL || strcmp(type, "cpu") != 0)
259 return 0; 259 return 0;
260 260
261 prop = (u32 *)of_get_flat_dt_prop(node, "ibm,processor-segment-sizes", 261 prop = of_get_flat_dt_prop(node, "ibm,processor-segment-sizes", &size);
262 &size);
263 if (prop == NULL) 262 if (prop == NULL)
264 return 0; 263 return 0;
265 for (; size >= 4; size -= 4, ++prop) { 264 for (; size >= 4; size -= 4, ++prop) {
266 if (prop[0] == 40) { 265 if (be32_to_cpu(prop[0]) == 40) {
267 DBG("1T segment support detected\n"); 266 DBG("1T segment support detected\n");
268 cur_cpu_spec->mmu_features |= MMU_FTR_1T_SEGMENT; 267 cur_cpu_spec->mmu_features |= MMU_FTR_1T_SEGMENT;
269 return 1; 268 return 1;
@@ -307,23 +306,22 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,
307 void *data) 306 void *data)
308{ 307{
309 char *type = of_get_flat_dt_prop(node, "device_type", NULL); 308 char *type = of_get_flat_dt_prop(node, "device_type", NULL);
310 u32 *prop; 309 __be32 *prop;
311 unsigned long size = 0; 310 unsigned long size = 0;
312 311
313 /* We are scanning "cpu" nodes only */ 312 /* We are scanning "cpu" nodes only */
314 if (type == NULL || strcmp(type, "cpu") != 0) 313 if (type == NULL || strcmp(type, "cpu") != 0)
315 return 0; 314 return 0;
316 315
317 prop = (u32 *)of_get_flat_dt_prop(node, 316 prop = of_get_flat_dt_prop(node, "ibm,segment-page-sizes", &size);
318 "ibm,segment-page-sizes", &size);
319 if (prop != NULL) { 317 if (prop != NULL) {
320 pr_info("Page sizes from device-tree:\n"); 318 pr_info("Page sizes from device-tree:\n");
321 size /= 4; 319 size /= 4;
322 cur_cpu_spec->mmu_features &= ~(MMU_FTR_16M_PAGE); 320 cur_cpu_spec->mmu_features &= ~(MMU_FTR_16M_PAGE);
323 while(size > 0) { 321 while(size > 0) {
324 unsigned int base_shift = prop[0]; 322 unsigned int base_shift = be32_to_cpu(prop[0]);
325 unsigned int slbenc = prop[1]; 323 unsigned int slbenc = be32_to_cpu(prop[1]);
326 unsigned int lpnum = prop[2]; 324 unsigned int lpnum = be32_to_cpu(prop[2]);
327 struct mmu_psize_def *def; 325 struct mmu_psize_def *def;
328 int idx, base_idx; 326 int idx, base_idx;
329 327
@@ -356,8 +354,8 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,
356 def->tlbiel = 0; 354 def->tlbiel = 0;
357 355
358 while (size > 0 && lpnum) { 356 while (size > 0 && lpnum) {
359 unsigned int shift = prop[0]; 357 unsigned int shift = be32_to_cpu(prop[0]);
360 int penc = prop[1]; 358 int penc = be32_to_cpu(prop[1]);
361 359
362 prop += 2; size -= 2; 360 prop += 2; size -= 2;
363 lpnum--; 361 lpnum--;
@@ -390,8 +388,8 @@ static int __init htab_dt_scan_hugepage_blocks(unsigned long node,
390 const char *uname, int depth, 388 const char *uname, int depth,
391 void *data) { 389 void *data) {
392 char *type = of_get_flat_dt_prop(node, "device_type", NULL); 390 char *type = of_get_flat_dt_prop(node, "device_type", NULL);
393 unsigned long *addr_prop; 391 __be64 *addr_prop;
394 u32 *page_count_prop; 392 __be32 *page_count_prop;
395 unsigned int expected_pages; 393 unsigned int expected_pages;
396 long unsigned int phys_addr; 394 long unsigned int phys_addr;
397 long unsigned int block_size; 395 long unsigned int block_size;
@@ -405,12 +403,12 @@ static int __init htab_dt_scan_hugepage_blocks(unsigned long node,
405 page_count_prop = of_get_flat_dt_prop(node, "ibm,expected#pages", NULL); 403 page_count_prop = of_get_flat_dt_prop(node, "ibm,expected#pages", NULL);
406 if (page_count_prop == NULL) 404 if (page_count_prop == NULL)
407 return 0; 405 return 0;
408 expected_pages = (1 << page_count_prop[0]); 406 expected_pages = (1 << be32_to_cpu(page_count_prop[0]));
409 addr_prop = of_get_flat_dt_prop(node, "reg", NULL); 407 addr_prop = of_get_flat_dt_prop(node, "reg", NULL);
410 if (addr_prop == NULL) 408 if (addr_prop == NULL)
411 return 0; 409 return 0;
412 phys_addr = addr_prop[0]; 410 phys_addr = be64_to_cpu(addr_prop[0]);
413 block_size = addr_prop[1]; 411 block_size = be64_to_cpu(addr_prop[1]);
414 if (block_size != (16 * GB)) 412 if (block_size != (16 * GB))
415 return 0; 413 return 0;
416 printk(KERN_INFO "Huge page(16GB) memory: " 414 printk(KERN_INFO "Huge page(16GB) memory: "
@@ -534,16 +532,16 @@ static int __init htab_dt_scan_pftsize(unsigned long node,
534 void *data) 532 void *data)
535{ 533{
536 char *type = of_get_flat_dt_prop(node, "device_type", NULL); 534 char *type = of_get_flat_dt_prop(node, "device_type", NULL);
537 u32 *prop; 535 __be32 *prop;
538 536
539 /* We are scanning "cpu" nodes only */ 537 /* We are scanning "cpu" nodes only */
540 if (type == NULL || strcmp(type, "cpu") != 0) 538 if (type == NULL || strcmp(type, "cpu") != 0)
541 return 0; 539 return 0;
542 540
543 prop = (u32 *)of_get_flat_dt_prop(node, "ibm,pft-size", NULL); 541 prop = of_get_flat_dt_prop(node, "ibm,pft-size", NULL);
544 if (prop != NULL) { 542 if (prop != NULL) {
545 /* pft_size[0] is the NUMA CEC cookie */ 543 /* pft_size[0] is the NUMA CEC cookie */
546 ppc64_pft_size = prop[1]; 544 ppc64_pft_size = be32_to_cpu(prop[1]);
547 return 1; 545 return 1;
548 } 546 }
549 return 0; 547 return 0;
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index d67db4bd672d..90bb6d9409bf 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -633,8 +633,6 @@ static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
633 633
634/* 634/*
635 * This function frees user-level page tables of a process. 635 * This function frees user-level page tables of a process.
636 *
637 * Must be called with pagetable lock held.
638 */ 636 */
639void hugetlb_free_pgd_range(struct mmu_gather *tlb, 637void hugetlb_free_pgd_range(struct mmu_gather *tlb,
640 unsigned long addr, unsigned long end, 638 unsigned long addr, unsigned long end,
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index d47d3dab4870..cff59f1bec23 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -213,7 +213,12 @@ void setup_initial_memory_limit(phys_addr_t first_memblock_base,
213 */ 213 */
214 BUG_ON(first_memblock_base != 0); 214 BUG_ON(first_memblock_base != 0);
215 215
216#ifdef CONFIG_PIN_TLB
217 /* 8xx can only access 24MB at the moment */
218 memblock_set_current_limit(min_t(u64, first_memblock_size, 0x01800000));
219#else
216 /* 8xx can only access 8MB at the moment */ 220 /* 8xx can only access 8MB at the moment */
217 memblock_set_current_limit(min_t(u64, first_memblock_size, 0x00800000)); 221 memblock_set_current_limit(min_t(u64, first_memblock_size, 0x00800000));
222#endif
218} 223}
219#endif /* CONFIG_8xx */ 224#endif /* CONFIG_8xx */
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index d0cd9e4c6837..e3734edffa69 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -300,5 +300,58 @@ void vmemmap_free(unsigned long start, unsigned long end)
300{ 300{
301} 301}
302 302
303#endif /* CONFIG_SPARSEMEM_VMEMMAP */ 303void register_page_bootmem_memmap(unsigned long section_nr,
304 struct page *start_page, unsigned long size)
305{
306}
307
308/*
309 * We do not have access to the sparsemem vmemmap, so we fallback to
310 * walking the list of sparsemem blocks which we already maintain for
311 * the sake of crashdump. In the long run, we might want to maintain
312 * a tree if performance of that linear walk becomes a problem.
313 *
314 * realmode_pfn_to_page functions can fail due to:
315 * 1) As real sparsemem blocks do not lay in RAM continously (they
316 * are in virtual address space which is not available in the real mode),
317 * the requested page struct can be split between blocks so get_page/put_page
318 * may fail.
319 * 2) When huge pages are used, the get_page/put_page API will fail
320 * in real mode as the linked addresses in the page struct are virtual
321 * too.
322 */
323struct page *realmode_pfn_to_page(unsigned long pfn)
324{
325 struct vmemmap_backing *vmem_back;
326 struct page *page;
327 unsigned long page_size = 1 << mmu_psize_defs[mmu_vmemmap_psize].shift;
328 unsigned long pg_va = (unsigned long) pfn_to_page(pfn);
329
330 for (vmem_back = vmemmap_list; vmem_back; vmem_back = vmem_back->list) {
331 if (pg_va < vmem_back->virt_addr)
332 continue;
333
334 /* Check that page struct is not split between real pages */
335 if ((pg_va + sizeof(struct page)) >
336 (vmem_back->virt_addr + page_size))
337 return NULL;
338
339 page = (struct page *) (vmem_back->phys + pg_va -
340 vmem_back->virt_addr);
341 return page;
342 }
343
344 return NULL;
345}
346EXPORT_SYMBOL_GPL(realmode_pfn_to_page);
347
348#elif defined(CONFIG_FLATMEM)
349
350struct page *realmode_pfn_to_page(unsigned long pfn)
351{
352 struct page *page = pfn_to_page(pfn);
353 return page;
354}
355EXPORT_SYMBOL_GPL(realmode_pfn_to_page);
304 356
357#endif /* CONFIG_SPARSEMEM_VMEMMAP/CONFIG_FLATMEM */
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 1cf9c5b67f24..3fa93dc7fe75 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -297,12 +297,21 @@ void __init paging_init(void)
297} 297}
298#endif /* ! CONFIG_NEED_MULTIPLE_NODES */ 298#endif /* ! CONFIG_NEED_MULTIPLE_NODES */
299 299
300static void __init register_page_bootmem_info(void)
301{
302 int i;
303
304 for_each_online_node(i)
305 register_page_bootmem_info_node(NODE_DATA(i));
306}
307
300void __init mem_init(void) 308void __init mem_init(void)
301{ 309{
302#ifdef CONFIG_SWIOTLB 310#ifdef CONFIG_SWIOTLB
303 swiotlb_init(0); 311 swiotlb_init(0);
304#endif 312#endif
305 313
314 register_page_bootmem_info();
306 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); 315 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
307 set_max_mapnr(max_pfn); 316 set_max_mapnr(max_pfn);
308 free_all_bootmem(); 317 free_all_bootmem();
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index c916127f10c3..078d3e00a616 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -195,7 +195,7 @@ static const __be32 *of_get_usable_memory(struct device_node *memory)
195 u32 len; 195 u32 len;
196 prop = of_get_property(memory, "linux,drconf-usable-memory", &len); 196 prop = of_get_property(memory, "linux,drconf-usable-memory", &len);
197 if (!prop || len < sizeof(unsigned int)) 197 if (!prop || len < sizeof(unsigned int))
198 return 0; 198 return NULL;
199 return prop; 199 return prop;
200} 200}
201 201
@@ -938,8 +938,7 @@ static void __init mark_reserved_regions_for_nid(int nid)
938 unsigned long start_pfn = physbase >> PAGE_SHIFT; 938 unsigned long start_pfn = physbase >> PAGE_SHIFT;
939 unsigned long end_pfn = PFN_UP(physbase + size); 939 unsigned long end_pfn = PFN_UP(physbase + size);
940 struct node_active_region node_ar; 940 struct node_active_region node_ar;
941 unsigned long node_end_pfn = node->node_start_pfn + 941 unsigned long node_end_pfn = pgdat_end_pfn(node);
942 node->node_spanned_pages;
943 942
944 /* 943 /*
945 * Check to make sure that this memblock.reserved area is 944 * Check to make sure that this memblock.reserved area is
@@ -1154,7 +1153,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
1154 * represented in the device tree as a node (i.e. memory@XXXX) for 1153 * represented in the device tree as a node (i.e. memory@XXXX) for
1155 * each memblock. 1154 * each memblock.
1156 */ 1155 */
1157int hot_add_node_scn_to_nid(unsigned long scn_addr) 1156static int hot_add_node_scn_to_nid(unsigned long scn_addr)
1158{ 1157{
1159 struct device_node *memory; 1158 struct device_node *memory;
1160 int nid = -1; 1159 int nid = -1;
@@ -1235,7 +1234,7 @@ static u64 hot_add_drconf_memory_max(void)
1235 struct device_node *memory = NULL; 1234 struct device_node *memory = NULL;
1236 unsigned int drconf_cell_cnt = 0; 1235 unsigned int drconf_cell_cnt = 0;
1237 u64 lmb_size = 0; 1236 u64 lmb_size = 0;
1238 const __be32 *dm = 0; 1237 const __be32 *dm = NULL;
1239 1238
1240 memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); 1239 memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
1241 if (memory) { 1240 if (memory) {
@@ -1535,7 +1534,7 @@ static void topology_work_fn(struct work_struct *work)
1535} 1534}
1536static DECLARE_WORK(topology_work, topology_work_fn); 1535static DECLARE_WORK(topology_work, topology_work_fn);
1537 1536
1538void topology_schedule_update(void) 1537static void topology_schedule_update(void)
1539{ 1538{
1540 schedule_work(&topology_work); 1539 schedule_work(&topology_work);
1541} 1540}
diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
index edda589795c3..841e0d00863c 100644
--- a/arch/powerpc/mm/pgtable.c
+++ b/arch/powerpc/mm/pgtable.c
@@ -32,8 +32,6 @@
32#include <asm/tlbflush.h> 32#include <asm/tlbflush.h>
33#include <asm/tlb.h> 33#include <asm/tlb.h>
34 34
35#include "mmu_decl.h"
36
37static inline int is_exec_fault(void) 35static inline int is_exec_fault(void)
38{ 36{
39 return current->thread.regs && TRAP(current->thread.regs) == 0x400; 37 return current->thread.regs && TRAP(current->thread.regs) == 0x400;
@@ -72,7 +70,7 @@ struct page * maybe_pte_to_page(pte_t pte)
72 * support falls into the same category. 70 * support falls into the same category.
73 */ 71 */
74 72
75static pte_t set_pte_filter(pte_t pte, unsigned long addr) 73static pte_t set_pte_filter(pte_t pte)
76{ 74{
77 pte = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS); 75 pte = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS);
78 if (pte_looks_normal(pte) && !(cpu_has_feature(CPU_FTR_COHERENT_ICACHE) || 76 if (pte_looks_normal(pte) && !(cpu_has_feature(CPU_FTR_COHERENT_ICACHE) ||
@@ -81,17 +79,6 @@ static pte_t set_pte_filter(pte_t pte, unsigned long addr)
81 if (!pg) 79 if (!pg)
82 return pte; 80 return pte;
83 if (!test_bit(PG_arch_1, &pg->flags)) { 81 if (!test_bit(PG_arch_1, &pg->flags)) {
84#ifdef CONFIG_8xx
85 /* On 8xx, cache control instructions (particularly
86 * "dcbst" from flush_dcache_icache) fault as write
87 * operation if there is an unpopulated TLB entry
88 * for the address in question. To workaround that,
89 * we invalidate the TLB here, thus avoiding dcbst
90 * misbehaviour.
91 */
92 /* 8xx doesn't care about PID, size or ind args */
93 _tlbil_va(addr, 0, 0, 0);
94#endif /* CONFIG_8xx */
95 flush_dcache_icache_page(pg); 82 flush_dcache_icache_page(pg);
96 set_bit(PG_arch_1, &pg->flags); 83 set_bit(PG_arch_1, &pg->flags);
97 } 84 }
@@ -111,7 +98,7 @@ static pte_t set_access_flags_filter(pte_t pte, struct vm_area_struct *vma,
111 * as we don't have two bits to spare for _PAGE_EXEC and _PAGE_HWEXEC so 98 * as we don't have two bits to spare for _PAGE_EXEC and _PAGE_HWEXEC so
112 * instead we "filter out" the exec permission for non clean pages. 99 * instead we "filter out" the exec permission for non clean pages.
113 */ 100 */
114static pte_t set_pte_filter(pte_t pte, unsigned long addr) 101static pte_t set_pte_filter(pte_t pte)
115{ 102{
116 struct page *pg; 103 struct page *pg;
117 104
@@ -193,7 +180,7 @@ void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
193 * this context might not have been activated yet when this 180 * this context might not have been activated yet when this
194 * is called. 181 * is called.
195 */ 182 */
196 pte = set_pte_filter(pte, addr); 183 pte = set_pte_filter(pte);
197 184
198 /* Perform the setting of the PTE */ 185 /* Perform the setting of the PTE */
199 __set_pte_at(mm, addr, ptep, pte, 0); 186 __set_pte_at(mm, addr, ptep, pte, 0);
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 6c856fb8c15b..5b9601715289 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -121,7 +121,10 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
121 ptepage = alloc_pages(flags, 0); 121 ptepage = alloc_pages(flags, 0);
122 if (!ptepage) 122 if (!ptepage)
123 return NULL; 123 return NULL;
124 pgtable_page_ctor(ptepage); 124 if (!pgtable_page_ctor(ptepage)) {
125 __free_page(ptepage);
126 return NULL;
127 }
125 return ptepage; 128 return ptepage;
126} 129}
127 130
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index 536eec72c0f7..9d95786aa80f 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -378,6 +378,10 @@ static pte_t *__alloc_for_cache(struct mm_struct *mm, int kernel)
378 __GFP_REPEAT | __GFP_ZERO); 378 __GFP_REPEAT | __GFP_ZERO);
379 if (!page) 379 if (!page)
380 return NULL; 380 return NULL;
381 if (!kernel && !pgtable_page_ctor(page)) {
382 __free_page(page);
383 return NULL;
384 }
381 385
382 ret = page_address(page); 386 ret = page_address(page);
383 spin_lock(&mm->page_table_lock); 387 spin_lock(&mm->page_table_lock);
@@ -392,9 +396,6 @@ static pte_t *__alloc_for_cache(struct mm_struct *mm, int kernel)
392 } 396 }
393 spin_unlock(&mm->page_table_lock); 397 spin_unlock(&mm->page_table_lock);
394 398
395 if (!kernel)
396 pgtable_page_ctor(page);
397
398 return (pte_t *)ret; 399 return (pte_t *)ret;
399} 400}
400 401
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index 8a5dfaf5c6b7..9aee27c582dc 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -39,6 +39,7 @@
39#define r_X 5 39#define r_X 5
40#define r_addr 6 40#define r_addr 6
41#define r_scratch1 7 41#define r_scratch1 7
42#define r_scratch2 8
42#define r_D 14 43#define r_D 14
43#define r_HL 15 44#define r_HL 15
44#define r_M 16 45#define r_M 16
@@ -92,6 +93,8 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
92 ___PPC_RA(base) | IMM_L(i)) 93 ___PPC_RA(base) | IMM_L(i))
93#define PPC_LHZ(r, base, i) EMIT(PPC_INST_LHZ | ___PPC_RT(r) | \ 94#define PPC_LHZ(r, base, i) EMIT(PPC_INST_LHZ | ___PPC_RT(r) | \
94 ___PPC_RA(base) | IMM_L(i)) 95 ___PPC_RA(base) | IMM_L(i))
96#define PPC_LHBRX(r, base, b) EMIT(PPC_INST_LHBRX | ___PPC_RT(r) | \
97 ___PPC_RA(base) | ___PPC_RB(b))
95/* Convenience helpers for the above with 'far' offsets: */ 98/* Convenience helpers for the above with 'far' offsets: */
96#define PPC_LD_OFFS(r, base, i) do { if ((i) < 32768) PPC_LD(r, base, i); \ 99#define PPC_LD_OFFS(r, base, i) do { if ((i) < 32768) PPC_LD(r, base, i); \
97 else { PPC_ADDIS(r, base, IMM_HA(i)); \ 100 else { PPC_ADDIS(r, base, IMM_HA(i)); \
@@ -186,6 +189,14 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
186 PPC_ORI(d, d, (uintptr_t)(i) & 0xffff); \ 189 PPC_ORI(d, d, (uintptr_t)(i) & 0xffff); \
187 } } while (0); 190 } } while (0);
188 191
192#define PPC_LHBRX_OFFS(r, base, i) \
193 do { PPC_LI32(r, i); PPC_LHBRX(r, r, base); } while(0)
194#ifdef __LITTLE_ENDIAN__
195#define PPC_NTOHS_OFFS(r, base, i) PPC_LHBRX_OFFS(r, base, i)
196#else
197#define PPC_NTOHS_OFFS(r, base, i) PPC_LHZ_OFFS(r, base, i)
198#endif
199
189static inline bool is_nearbranch(int offset) 200static inline bool is_nearbranch(int offset)
190{ 201{
191 return (offset < 32768) && (offset >= -32768); 202 return (offset < 32768) && (offset >= -32768);
diff --git a/arch/powerpc/net/bpf_jit_64.S b/arch/powerpc/net/bpf_jit_64.S
index 7d3a3b5619a2..e76eba74d9da 100644
--- a/arch/powerpc/net/bpf_jit_64.S
+++ b/arch/powerpc/net/bpf_jit_64.S
@@ -43,8 +43,11 @@ sk_load_word_positive_offset:
43 cmpd r_scratch1, r_addr 43 cmpd r_scratch1, r_addr
44 blt bpf_slow_path_word 44 blt bpf_slow_path_word
45 /* Nope, just hitting the header. cr0 here is eq or gt! */ 45 /* Nope, just hitting the header. cr0 here is eq or gt! */
46#ifdef __LITTLE_ENDIAN__
47 lwbrx r_A, r_D, r_addr
48#else
46 lwzx r_A, r_D, r_addr 49 lwzx r_A, r_D, r_addr
47 /* When big endian we don't need to byteswap. */ 50#endif
48 blr /* Return success, cr0 != LT */ 51 blr /* Return success, cr0 != LT */
49 52
50 .globl sk_load_half 53 .globl sk_load_half
@@ -56,7 +59,11 @@ sk_load_half_positive_offset:
56 subi r_scratch1, r_HL, 2 59 subi r_scratch1, r_HL, 2
57 cmpd r_scratch1, r_addr 60 cmpd r_scratch1, r_addr
58 blt bpf_slow_path_half 61 blt bpf_slow_path_half
62#ifdef __LITTLE_ENDIAN__
63 lhbrx r_A, r_D, r_addr
64#else
59 lhzx r_A, r_D, r_addr 65 lhzx r_A, r_D, r_addr
66#endif
60 blr 67 blr
61 68
62 .globl sk_load_byte 69 .globl sk_load_byte
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index bf56e33f8257..ac3c2a10dafd 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -17,14 +17,8 @@
17 17
18#include "bpf_jit.h" 18#include "bpf_jit.h"
19 19
20#ifndef __BIG_ENDIAN
21/* There are endianness assumptions herein. */
22#error "Little-endian PPC not supported in BPF compiler"
23#endif
24
25int bpf_jit_enable __read_mostly; 20int bpf_jit_enable __read_mostly;
26 21
27
28static inline void bpf_flush_icache(void *start, void *end) 22static inline void bpf_flush_icache(void *start, void *end)
29{ 23{
30 smp_wmb(); 24 smp_wmb();
@@ -193,6 +187,26 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
193 PPC_MUL(r_A, r_A, r_scratch1); 187 PPC_MUL(r_A, r_A, r_scratch1);
194 } 188 }
195 break; 189 break;
190 case BPF_S_ALU_MOD_X: /* A %= X; */
191 ctx->seen |= SEEN_XREG;
192 PPC_CMPWI(r_X, 0);
193 if (ctx->pc_ret0 != -1) {
194 PPC_BCC(COND_EQ, addrs[ctx->pc_ret0]);
195 } else {
196 PPC_BCC_SHORT(COND_NE, (ctx->idx*4)+12);
197 PPC_LI(r_ret, 0);
198 PPC_JMP(exit_addr);
199 }
200 PPC_DIVWU(r_scratch1, r_A, r_X);
201 PPC_MUL(r_scratch1, r_X, r_scratch1);
202 PPC_SUB(r_A, r_A, r_scratch1);
203 break;
204 case BPF_S_ALU_MOD_K: /* A %= K; */
205 PPC_LI32(r_scratch2, K);
206 PPC_DIVWU(r_scratch1, r_A, r_scratch2);
207 PPC_MUL(r_scratch1, r_scratch2, r_scratch1);
208 PPC_SUB(r_A, r_A, r_scratch1);
209 break;
196 case BPF_S_ALU_DIV_X: /* A /= X; */ 210 case BPF_S_ALU_DIV_X: /* A /= X; */
197 ctx->seen |= SEEN_XREG; 211 ctx->seen |= SEEN_XREG;
198 PPC_CMPWI(r_X, 0); 212 PPC_CMPWI(r_X, 0);
@@ -346,18 +360,11 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
346 break; 360 break;
347 361
348 /*** Ancillary info loads ***/ 362 /*** Ancillary info loads ***/
349
350 /* None of the BPF_S_ANC* codes appear to be passed by
351 * sk_chk_filter(). The interpreter and the x86 BPF
352 * compiler implement them so we do too -- they may be
353 * planted in future.
354 */
355 case BPF_S_ANC_PROTOCOL: /* A = ntohs(skb->protocol); */ 363 case BPF_S_ANC_PROTOCOL: /* A = ntohs(skb->protocol); */
356 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, 364 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
357 protocol) != 2); 365 protocol) != 2);
358 PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, 366 PPC_NTOHS_OFFS(r_A, r_skb, offsetof(struct sk_buff,
359 protocol)); 367 protocol));
360 /* ntohs is a NOP with BE loads. */
361 break; 368 break;
362 case BPF_S_ANC_IFINDEX: 369 case BPF_S_ANC_IFINDEX:
363 PPC_LD_OFFS(r_scratch1, r_skb, offsetof(struct sk_buff, 370 PPC_LD_OFFS(r_scratch1, r_skb, offsetof(struct sk_buff,
@@ -691,4 +698,5 @@ void bpf_jit_free(struct sk_filter *fp)
691{ 698{
692 if (fp->bpf_func != sk_run_filter) 699 if (fp->bpf_func != sk_run_filter)
693 module_free(NULL, fp->bpf_func); 700 module_free(NULL, fp->bpf_func);
701 kfree(fp);
694} 702}
diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c
index 2ee4a707f0df..a3f7abd2f13f 100644
--- a/arch/powerpc/perf/power8-pmu.c
+++ b/arch/powerpc/perf/power8-pmu.c
@@ -199,6 +199,7 @@
199#define MMCR1_UNIT_SHIFT(pmc) (60 - (4 * ((pmc) - 1))) 199#define MMCR1_UNIT_SHIFT(pmc) (60 - (4 * ((pmc) - 1)))
200#define MMCR1_COMBINE_SHIFT(pmc) (35 - ((pmc) - 1)) 200#define MMCR1_COMBINE_SHIFT(pmc) (35 - ((pmc) - 1))
201#define MMCR1_PMCSEL_SHIFT(pmc) (24 - (((pmc) - 1)) * 8) 201#define MMCR1_PMCSEL_SHIFT(pmc) (24 - (((pmc) - 1)) * 8)
202#define MMCR1_FAB_SHIFT 36
202#define MMCR1_DC_QUAL_SHIFT 47 203#define MMCR1_DC_QUAL_SHIFT 47
203#define MMCR1_IC_QUAL_SHIFT 46 204#define MMCR1_IC_QUAL_SHIFT 46
204 205
@@ -388,8 +389,8 @@ static int power8_compute_mmcr(u64 event[], int n_ev,
388 * the threshold bits are used for the match value. 389 * the threshold bits are used for the match value.
389 */ 390 */
390 if (event_is_fab_match(event[i])) { 391 if (event_is_fab_match(event[i])) {
391 mmcr1 |= (event[i] >> EVENT_THR_CTL_SHIFT) & 392 mmcr1 |= ((event[i] >> EVENT_THR_CTL_SHIFT) &
392 EVENT_THR_CTL_MASK; 393 EVENT_THR_CTL_MASK) << MMCR1_FAB_SHIFT;
393 } else { 394 } else {
394 val = (event[i] >> EVENT_THR_CTL_SHIFT) & EVENT_THR_CTL_MASK; 395 val = (event[i] >> EVENT_THR_CTL_SHIFT) & EVENT_THR_CTL_MASK;
395 mmcra |= val << MMCRA_THR_CTL_SHIFT; 396 mmcra |= val << MMCRA_THR_CTL_SHIFT;
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
index e504166e089a..fd8a37653417 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -24,6 +24,7 @@
24#include <linux/mutex.h> 24#include <linux/mutex.h>
25#include <linux/io.h> 25#include <linux/io.h>
26 26
27#include <linux/of_address.h>
27#include <linux/of_platform.h> 28#include <linux/of_platform.h>
28#include <asm/mpc5xxx.h> 29#include <asm/mpc5xxx.h>
29#include <asm/mpc5121.h> 30#include <asm/mpc5121.h>
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c
index a82a41b4fd91..36b5652aada2 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -60,8 +60,6 @@ void mpc512x_restart(char *cmd)
60 ; 60 ;
61} 61}
62 62
63#if IS_ENABLED(CONFIG_FB_FSL_DIU)
64
65struct fsl_diu_shared_fb { 63struct fsl_diu_shared_fb {
66 u8 gamma[0x300]; /* 32-bit aligned! */ 64 u8 gamma[0x300]; /* 32-bit aligned! */
67 struct diu_ad ad0; /* 32-bit aligned! */ 65 struct diu_ad ad0; /* 32-bit aligned! */
@@ -71,7 +69,7 @@ struct fsl_diu_shared_fb {
71}; 69};
72 70
73#define DIU_DIV_MASK 0x000000ff 71#define DIU_DIV_MASK 0x000000ff
74void mpc512x_set_pixel_clock(unsigned int pixclock) 72static void mpc512x_set_pixel_clock(unsigned int pixclock)
75{ 73{
76 unsigned long bestval, bestfreq, speed, busfreq; 74 unsigned long bestval, bestfreq, speed, busfreq;
77 unsigned long minpixclock, maxpixclock, pixval; 75 unsigned long minpixclock, maxpixclock, pixval;
@@ -164,7 +162,7 @@ void mpc512x_set_pixel_clock(unsigned int pixclock)
164 iounmap(ccm); 162 iounmap(ccm);
165} 163}
166 164
167enum fsl_diu_monitor_port 165static enum fsl_diu_monitor_port
168mpc512x_valid_monitor_port(enum fsl_diu_monitor_port port) 166mpc512x_valid_monitor_port(enum fsl_diu_monitor_port port)
169{ 167{
170 return FSL_DIU_PORT_DVI; 168 return FSL_DIU_PORT_DVI;
@@ -179,7 +177,7 @@ static inline void mpc512x_free_bootmem(struct page *page)
179 free_reserved_page(page); 177 free_reserved_page(page);
180} 178}
181 179
182void mpc512x_release_bootmem(void) 180static void mpc512x_release_bootmem(void)
183{ 181{
184 unsigned long addr = diu_shared_fb.fb_phys & PAGE_MASK; 182 unsigned long addr = diu_shared_fb.fb_phys & PAGE_MASK;
185 unsigned long size = diu_shared_fb.fb_len; 183 unsigned long size = diu_shared_fb.fb_len;
@@ -205,7 +203,7 @@ void mpc512x_release_bootmem(void)
205 * address range will be reserved in setup_arch() after bootmem 203 * address range will be reserved in setup_arch() after bootmem
206 * allocator is up. 204 * allocator is up.
207 */ 205 */
208void __init mpc512x_init_diu(void) 206static void __init mpc512x_init_diu(void)
209{ 207{
210 struct device_node *np; 208 struct device_node *np;
211 struct diu __iomem *diu_reg; 209 struct diu __iomem *diu_reg;
@@ -274,7 +272,7 @@ out:
274 iounmap(diu_reg); 272 iounmap(diu_reg);
275} 273}
276 274
277void __init mpc512x_setup_diu(void) 275static void __init mpc512x_setup_diu(void)
278{ 276{
279 int ret; 277 int ret;
280 278
@@ -303,8 +301,6 @@ void __init mpc512x_setup_diu(void)
303 diu_ops.release_bootmem = mpc512x_release_bootmem; 301 diu_ops.release_bootmem = mpc512x_release_bootmem;
304} 302}
305 303
306#endif
307
308void __init mpc512x_init_IRQ(void) 304void __init mpc512x_init_IRQ(void)
309{ 305{
310 struct device_node *np; 306 struct device_node *np;
@@ -337,7 +333,7 @@ static struct of_device_id __initdata of_bus_ids[] = {
337 {}, 333 {},
338}; 334};
339 335
340void __init mpc512x_declare_of_platform_devices(void) 336static void __init mpc512x_declare_of_platform_devices(void)
341{ 337{
342 if (of_platform_bus_probe(NULL, of_bus_ids, NULL)) 338 if (of_platform_bus_probe(NULL, of_bus_ids, NULL))
343 printk(KERN_ERR __FILE__ ": " 339 printk(KERN_ERR __FILE__ ": "
@@ -387,7 +383,7 @@ static unsigned int __init get_fifo_size(struct device_node *np,
387 ((u32)(_base) + sizeof(struct mpc52xx_psc))) 383 ((u32)(_base) + sizeof(struct mpc52xx_psc)))
388 384
389/* Init PSC FIFO space for TX and RX slices */ 385/* Init PSC FIFO space for TX and RX slices */
390void __init mpc512x_psc_fifo_init(void) 386static void __init mpc512x_psc_fifo_init(void)
391{ 387{
392 struct device_node *np; 388 struct device_node *np;
393 void __iomem *psc; 389 void __iomem *psc;
diff --git a/arch/powerpc/platforms/512x/pdm360ng.c b/arch/powerpc/platforms/512x/pdm360ng.c
index 24b314d7bd5f..116f2325b20b 100644
--- a/arch/powerpc/platforms/512x/pdm360ng.c
+++ b/arch/powerpc/platforms/512x/pdm360ng.c
@@ -14,6 +14,8 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/of_address.h>
18#include <linux/of_fdt.h>
17#include <linux/of_platform.h> 19#include <linux/of_platform.h>
18 20
19#include <asm/machdep.h> 21#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/52xx/Kconfig b/arch/powerpc/platforms/52xx/Kconfig
index 90f4496017e4..af54174801f7 100644
--- a/arch/powerpc/platforms/52xx/Kconfig
+++ b/arch/powerpc/platforms/52xx/Kconfig
@@ -57,5 +57,5 @@ config PPC_MPC5200_BUGFIX
57 57
58config PPC_MPC5200_LPBFIFO 58config PPC_MPC5200_LPBFIFO
59 tristate "MPC5200 LocalPlus bus FIFO driver" 59 tristate "MPC5200 LocalPlus bus FIFO driver"
60 depends on PPC_MPC52xx 60 depends on PPC_MPC52xx && PPC_BESTCOMM
61 select PPC_BESTCOMM_GEN_BD 61 select PPC_BESTCOMM_GEN_BD
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index b69221ba07fd..2898b737deb7 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -340,7 +340,7 @@ static int mpc52xx_irqhost_map(struct irq_domain *h, unsigned int virq,
340{ 340{
341 int l1irq; 341 int l1irq;
342 int l2irq; 342 int l2irq;
343 struct irq_chip *irqchip; 343 struct irq_chip *uninitialized_var(irqchip);
344 void *hndlr; 344 void *hndlr;
345 int type; 345 int type;
346 u32 reg; 346 u32 reg;
@@ -373,9 +373,8 @@ static int mpc52xx_irqhost_map(struct irq_domain *h, unsigned int virq,
373 case MPC52xx_IRQ_L1_PERP: irqchip = &mpc52xx_periph_irqchip; break; 373 case MPC52xx_IRQ_L1_PERP: irqchip = &mpc52xx_periph_irqchip; break;
374 case MPC52xx_IRQ_L1_SDMA: irqchip = &mpc52xx_sdma_irqchip; break; 374 case MPC52xx_IRQ_L1_SDMA: irqchip = &mpc52xx_sdma_irqchip; break;
375 case MPC52xx_IRQ_L1_CRIT: 375 case MPC52xx_IRQ_L1_CRIT:
376 default:
377 pr_warn("%s: Critical IRQ #%d is unsupported! Nopping it.\n", 376 pr_warn("%s: Critical IRQ #%d is unsupported! Nopping it.\n",
378 __func__, l1irq); 377 __func__, l2irq);
379 irq_set_chip(virq, &no_irq_chip); 378 irq_set_chip(virq, &no_irq_chip);
380 return 0; 379 return 0;
381 } 380 }
diff --git a/arch/powerpc/platforms/82xx/mpc8272_ads.c b/arch/powerpc/platforms/82xx/mpc8272_ads.c
index 30394b409b3f..6a14cf50f4a2 100644
--- a/arch/powerpc/platforms/82xx/mpc8272_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc8272_ads.c
@@ -16,6 +16,8 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/fsl_devices.h> 18#include <linux/fsl_devices.h>
19#include <linux/of_address.h>
20#include <linux/of_fdt.h>
19#include <linux/of_platform.h> 21#include <linux/of_platform.h>
20#include <linux/io.h> 22#include <linux/io.h>
21 23
diff --git a/arch/powerpc/platforms/82xx/pq2fads.c b/arch/powerpc/platforms/82xx/pq2fads.c
index e1dceeec4994..e5f82ec8df17 100644
--- a/arch/powerpc/platforms/82xx/pq2fads.c
+++ b/arch/powerpc/platforms/82xx/pq2fads.c
@@ -15,6 +15,8 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/fsl_devices.h> 17#include <linux/fsl_devices.h>
18#include <linux/of_address.h>
19#include <linux/of_fdt.h>
18#include <linux/of_platform.h> 20#include <linux/of_platform.h>
19 21
20#include <asm/io.h> 22#include <asm/io.h>
diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
index 7bc315822935..fd71cfdf2380 100644
--- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
+++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
@@ -204,7 +204,6 @@ static int mcu_remove(struct i2c_client *client)
204 ret = mcu_gpiochip_remove(mcu); 204 ret = mcu_gpiochip_remove(mcu);
205 if (ret) 205 if (ret)
206 return ret; 206 return ret;
207 i2c_set_clientdata(client, NULL);
208 kfree(mcu); 207 kfree(mcu);
209 return 0; 208 return 0;
210} 209}
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 1d769a29249f..3d9716ccd327 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -20,6 +20,8 @@
20#include <linux/freezer.h> 20#include <linux/freezer.h>
21#include <linux/suspend.h> 21#include <linux/suspend.h>
22#include <linux/fsl_devices.h> 22#include <linux/fsl_devices.h>
23#include <linux/of_address.h>
24#include <linux/of_irq.h>
23#include <linux/of_platform.h> 25#include <linux/of_platform.h>
24#include <linux/export.h> 26#include <linux/export.h>
25 27
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index de2eb9320993..4d4634958cfb 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -218,83 +218,16 @@ config GE_IMP3A
218 This board is a 3U CompactPCI Single Board Computer with a Freescale 218 This board is a 3U CompactPCI Single Board Computer with a Freescale
219 P2020 processor. 219 P2020 processor.
220 220
221config P2041_RDB
222 bool "Freescale P2041 RDB"
223 select DEFAULT_UIMAGE
224 select PPC_E500MC
225 select PHYS_64BIT
226 select SWIOTLB
227 select ARCH_REQUIRE_GPIOLIB
228 select GPIO_MPC8XXX
229 select HAS_RAPIDIO
230 select PPC_EPAPR_HV_PIC
231 help
232 This option enables support for the P2041 RDB board
233
234config P3041_DS
235 bool "Freescale P3041 DS"
236 select DEFAULT_UIMAGE
237 select PPC_E500MC
238 select PHYS_64BIT
239 select SWIOTLB
240 select ARCH_REQUIRE_GPIOLIB
241 select GPIO_MPC8XXX
242 select HAS_RAPIDIO
243 select PPC_EPAPR_HV_PIC
244 help
245 This option enables support for the P3041 DS board
246
247config P4080_DS
248 bool "Freescale P4080 DS"
249 select DEFAULT_UIMAGE
250 select PPC_E500MC
251 select PHYS_64BIT
252 select SWIOTLB
253 select ARCH_REQUIRE_GPIOLIB
254 select GPIO_MPC8XXX
255 select HAS_RAPIDIO
256 select PPC_EPAPR_HV_PIC
257 help
258 This option enables support for the P4080 DS board
259
260config SGY_CTS1000 221config SGY_CTS1000
261 tristate "Servergy CTS-1000 support" 222 tristate "Servergy CTS-1000 support"
262 select GPIOLIB 223 select GPIOLIB
263 select OF_GPIO 224 select OF_GPIO
264 depends on P4080_DS 225 depends on CORENET_GENERIC
265 help 226 help
266 Enable this to support functionality in Servergy's CTS-1000 systems. 227 Enable this to support functionality in Servergy's CTS-1000 systems.
267 228
268endif # PPC32 229endif # PPC32
269 230
270config P5020_DS
271 bool "Freescale P5020 DS"
272 select DEFAULT_UIMAGE
273 select E500
274 select PPC_E500MC
275 select PHYS_64BIT
276 select SWIOTLB
277 select ARCH_REQUIRE_GPIOLIB
278 select GPIO_MPC8XXX
279 select HAS_RAPIDIO
280 select PPC_EPAPR_HV_PIC
281 help
282 This option enables support for the P5020 DS board
283
284config P5040_DS
285 bool "Freescale P5040 DS"
286 select DEFAULT_UIMAGE
287 select E500
288 select PPC_E500MC
289 select PHYS_64BIT
290 select SWIOTLB
291 select ARCH_REQUIRE_GPIOLIB
292 select GPIO_MPC8XXX
293 select HAS_RAPIDIO
294 select PPC_EPAPR_HV_PIC
295 help
296 This option enables support for the P5040 DS board
297
298config PPC_QEMU_E500 231config PPC_QEMU_E500
299 bool "QEMU generic e500 platform" 232 bool "QEMU generic e500 platform"
300 select DEFAULT_UIMAGE 233 select DEFAULT_UIMAGE
@@ -310,10 +243,8 @@ config PPC_QEMU_E500
310 unset based on the emulated CPU (or actual host CPU in the case 243 unset based on the emulated CPU (or actual host CPU in the case
311 of KVM). 244 of KVM).
312 245
313if PPC64 246config CORENET_GENERIC
314 247 bool "Freescale CoreNet Generic"
315config T4240_QDS
316 bool "Freescale T4240 QDS"
317 select DEFAULT_UIMAGE 248 select DEFAULT_UIMAGE
318 select E500 249 select E500
319 select PPC_E500MC 250 select PPC_E500MC
@@ -324,26 +255,14 @@ config T4240_QDS
324 select HAS_RAPIDIO 255 select HAS_RAPIDIO
325 select PPC_EPAPR_HV_PIC 256 select PPC_EPAPR_HV_PIC
326 help 257 help
327 This option enables support for the T4240 QDS board 258 This option enables support for the FSL CoreNet based boards.
328 259 For 32bit kernel, the following boards are supported:
329config B4_QDS 260 P2041 RDB, P3041 DS and P4080 DS
330 bool "Freescale B4 QDS" 261 For 64bit kernel, the following boards are supported:
331 select DEFAULT_UIMAGE 262 T4240 QDS and B4 QDS
332 select E500 263 The following boards are supported for both 32bit and 64bit kernel:
333 select PPC_E500MC 264 P5020 DS and P5040 DS
334 select PHYS_64BIT
335 select SWIOTLB
336 select GPIOLIB
337 select ARCH_REQUIRE_GPIOLIB
338 select HAS_RAPIDIO
339 select PPC_EPAPR_HV_PIC
340 help
341 This option enables support for the B4 QDS board
342 The B4 application development system B4 QDS is a complete
343 debugging environment intended for engineers developing
344 applications for the B4.
345 265
346endif
347endif # FSL_SOC_BOOKE 266endif # FSL_SOC_BOOKE
348 267
349config TQM85xx 268config TQM85xx
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index 53c9f75a6907..dd4c0b59577b 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -18,13 +18,7 @@ obj-$(CONFIG_P1010_RDB) += p1010rdb.o
18obj-$(CONFIG_P1022_DS) += p1022_ds.o 18obj-$(CONFIG_P1022_DS) += p1022_ds.o
19obj-$(CONFIG_P1022_RDK) += p1022_rdk.o 19obj-$(CONFIG_P1022_RDK) += p1022_rdk.o
20obj-$(CONFIG_P1023_RDS) += p1023_rds.o 20obj-$(CONFIG_P1023_RDS) += p1023_rds.o
21obj-$(CONFIG_P2041_RDB) += p2041_rdb.o corenet_ds.o 21obj-$(CONFIG_CORENET_GENERIC) += corenet_generic.o
22obj-$(CONFIG_P3041_DS) += p3041_ds.o corenet_ds.o
23obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o
24obj-$(CONFIG_P5020_DS) += p5020_ds.o corenet_ds.o
25obj-$(CONFIG_P5040_DS) += p5040_ds.o corenet_ds.o
26obj-$(CONFIG_T4240_QDS) += t4240_qds.o corenet_ds.o
27obj-$(CONFIG_B4_QDS) += b4_qds.o corenet_ds.o
28obj-$(CONFIG_STX_GP3) += stx_gp3.o 22obj-$(CONFIG_STX_GP3) += stx_gp3.o
29obj-$(CONFIG_TQM85xx) += tqm85xx.o 23obj-$(CONFIG_TQM85xx) += tqm85xx.o
30obj-$(CONFIG_SBC8548) += sbc8548.o 24obj-$(CONFIG_SBC8548) += sbc8548.o
diff --git a/arch/powerpc/platforms/85xx/b4_qds.c b/arch/powerpc/platforms/85xx/b4_qds.c
deleted file mode 100644
index 0c6702f8b88e..000000000000
--- a/arch/powerpc/platforms/85xx/b4_qds.c
+++ /dev/null
@@ -1,102 +0,0 @@
1/*
2 * B4 QDS Setup
3 * Should apply for QDS platform of B4860 and it's personalities.
4 * viz B4860/B4420/B4220QDS
5 *
6 * Copyright 2012 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/pci.h>
16#include <linux/kdev_t.h>
17#include <linux/delay.h>
18#include <linux/interrupt.h>
19#include <linux/phy.h>
20
21#include <asm/time.h>
22#include <asm/machdep.h>
23#include <asm/pci-bridge.h>
24#include <mm/mmu_decl.h>
25#include <asm/prom.h>
26#include <asm/udbg.h>
27#include <asm/mpic.h>
28
29#include <linux/of_platform.h>
30#include <sysdev/fsl_soc.h>
31#include <sysdev/fsl_pci.h>
32#include <asm/ehv_pic.h>
33
34#include "corenet_ds.h"
35
36/*
37 * Called very early, device-tree isn't unflattened
38 */
39static int __init b4_qds_probe(void)
40{
41 unsigned long root = of_get_flat_dt_root();
42#ifdef CONFIG_SMP
43 extern struct smp_ops_t smp_85xx_ops;
44#endif
45
46 if ((of_flat_dt_is_compatible(root, "fsl,B4860QDS")) ||
47 (of_flat_dt_is_compatible(root, "fsl,B4420QDS")) ||
48 (of_flat_dt_is_compatible(root, "fsl,B4220QDS")))
49 return 1;
50
51 /* Check if we're running under the Freescale hypervisor */
52 if ((of_flat_dt_is_compatible(root, "fsl,B4860QDS-hv")) ||
53 (of_flat_dt_is_compatible(root, "fsl,B4420QDS-hv")) ||
54 (of_flat_dt_is_compatible(root, "fsl,B4220QDS-hv"))) {
55 ppc_md.init_IRQ = ehv_pic_init;
56 ppc_md.get_irq = ehv_pic_get_irq;
57 ppc_md.restart = fsl_hv_restart;
58 ppc_md.power_off = fsl_hv_halt;
59 ppc_md.halt = fsl_hv_halt;
60#ifdef CONFIG_SMP
61 /*
62 * Disable the timebase sync operations because we can't write
63 * to the timebase registers under the hypervisor.
64 */
65 smp_85xx_ops.give_timebase = NULL;
66 smp_85xx_ops.take_timebase = NULL;
67#endif
68 return 1;
69 }
70
71 return 0;
72}
73
74define_machine(b4_qds) {
75 .name = "B4 QDS",
76 .probe = b4_qds_probe,
77 .setup_arch = corenet_ds_setup_arch,
78 .init_IRQ = corenet_ds_pic_init,
79#ifdef CONFIG_PCI
80 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
81#endif
82/* coreint doesn't play nice with lazy EE, use legacy mpic for now */
83#ifdef CONFIG_PPC64
84 .get_irq = mpic_get_irq,
85#else
86 .get_irq = mpic_get_coreint_irq,
87#endif
88 .restart = fsl_rstcr_restart,
89 .calibrate_decr = generic_calibrate_decr,
90 .progress = udbg_progress,
91#ifdef CONFIG_PPC64
92 .power_save = book3e_idle,
93#else
94 .power_save = e500_idle,
95#endif
96};
97
98machine_arch_initcall(b4_qds, corenet_ds_publish_devices);
99
100#ifdef CONFIG_SWIOTLB
101machine_arch_initcall(b4_qds, swiotlb_setup_bus_notifier);
102#endif
diff --git a/arch/powerpc/platforms/85xx/c293pcie.c b/arch/powerpc/platforms/85xx/c293pcie.c
index 6208e49142bf..213d5b815827 100644
--- a/arch/powerpc/platforms/85xx/c293pcie.c
+++ b/arch/powerpc/platforms/85xx/c293pcie.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/stddef.h> 12#include <linux/stddef.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/of_fdt.h>
14#include <linux/of_platform.h> 15#include <linux/of_platform.h>
15 16
16#include <asm/machdep.h> 17#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c
index d0861a0d8360..eba78c85303f 100644
--- a/arch/powerpc/platforms/85xx/common.c
+++ b/arch/powerpc/platforms/85xx/common.c
@@ -5,6 +5,8 @@
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
9#include <linux/of_irq.h>
8#include <linux/of_platform.h> 10#include <linux/of_platform.h>
9 11
10#include <sysdev/cpm2_pic.h> 12#include <sysdev/cpm2_pic.h>
diff --git a/arch/powerpc/platforms/85xx/corenet_ds.c b/arch/powerpc/platforms/85xx/corenet_ds.c
deleted file mode 100644
index aa3690bae415..000000000000
--- a/arch/powerpc/platforms/85xx/corenet_ds.c
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2 * Corenet based SoC DS Setup
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2009-2011 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/pci.h>
16#include <linux/kdev_t.h>
17#include <linux/delay.h>
18#include <linux/interrupt.h>
19
20#include <asm/time.h>
21#include <asm/machdep.h>
22#include <asm/pci-bridge.h>
23#include <asm/ppc-pci.h>
24#include <mm/mmu_decl.h>
25#include <asm/prom.h>
26#include <asm/udbg.h>
27#include <asm/mpic.h>
28
29#include <linux/of_platform.h>
30#include <sysdev/fsl_soc.h>
31#include <sysdev/fsl_pci.h>
32#include "smp.h"
33
34void __init corenet_ds_pic_init(void)
35{
36 struct mpic *mpic;
37 unsigned int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU |
38 MPIC_NO_RESET;
39
40 if (ppc_md.get_irq == mpic_get_coreint_irq)
41 flags |= MPIC_ENABLE_COREINT;
42
43 mpic = mpic_alloc(NULL, 0, flags, 0, 512, " OpenPIC ");
44 BUG_ON(mpic == NULL);
45
46 mpic_init(mpic);
47}
48
49/*
50 * Setup the architecture
51 */
52void __init corenet_ds_setup_arch(void)
53{
54 mpc85xx_smp_init();
55
56 swiotlb_detect_4g();
57
58 pr_info("%s board from Freescale Semiconductor\n", ppc_md.name);
59}
60
61static const struct of_device_id of_device_ids[] = {
62 {
63 .compatible = "simple-bus"
64 },
65 {
66 .compatible = "fsl,srio",
67 },
68 {
69 .compatible = "fsl,p4080-pcie",
70 },
71 {
72 .compatible = "fsl,qoriq-pcie-v2.2",
73 },
74 {
75 .compatible = "fsl,qoriq-pcie-v2.3",
76 },
77 {
78 .compatible = "fsl,qoriq-pcie-v2.4",
79 },
80 {
81 .compatible = "fsl,qoriq-pcie-v3.0",
82 },
83 /* The following two are for the Freescale hypervisor */
84 {
85 .name = "hypervisor",
86 },
87 {
88 .name = "handles",
89 },
90 {}
91};
92
93int __init corenet_ds_publish_devices(void)
94{
95 return of_platform_bus_probe(NULL, of_device_ids, NULL);
96}
diff --git a/arch/powerpc/platforms/85xx/corenet_ds.h b/arch/powerpc/platforms/85xx/corenet_ds.h
deleted file mode 100644
index ddd700b23031..000000000000
--- a/arch/powerpc/platforms/85xx/corenet_ds.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * Corenet based SoC DS Setup
3 *
4 * Copyright 2009 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#ifndef CORENET_DS_H
13#define CORENET_DS_H
14
15extern void __init corenet_ds_pic_init(void);
16extern void __init corenet_ds_setup_arch(void);
17extern int __init corenet_ds_publish_devices(void);
18
19#endif
diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
new file mode 100644
index 000000000000..fbd871e69754
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c
@@ -0,0 +1,182 @@
1/*
2 * Corenet based SoC DS Setup
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2009-2011 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/pci.h>
16#include <linux/kdev_t.h>
17#include <linux/delay.h>
18#include <linux/interrupt.h>
19
20#include <asm/time.h>
21#include <asm/machdep.h>
22#include <asm/pci-bridge.h>
23#include <asm/ppc-pci.h>
24#include <mm/mmu_decl.h>
25#include <asm/prom.h>
26#include <asm/udbg.h>
27#include <asm/mpic.h>
28#include <asm/ehv_pic.h>
29
30#include <linux/of_platform.h>
31#include <sysdev/fsl_soc.h>
32#include <sysdev/fsl_pci.h>
33#include "smp.h"
34
35void __init corenet_gen_pic_init(void)
36{
37 struct mpic *mpic;
38 unsigned int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU |
39 MPIC_NO_RESET;
40
41 if (ppc_md.get_irq == mpic_get_coreint_irq)
42 flags |= MPIC_ENABLE_COREINT;
43
44 mpic = mpic_alloc(NULL, 0, flags, 0, 512, " OpenPIC ");
45 BUG_ON(mpic == NULL);
46
47 mpic_init(mpic);
48}
49
50/*
51 * Setup the architecture
52 */
53void __init corenet_gen_setup_arch(void)
54{
55 mpc85xx_smp_init();
56
57 swiotlb_detect_4g();
58
59 pr_info("%s board from Freescale Semiconductor\n", ppc_md.name);
60}
61
62static const struct of_device_id of_device_ids[] = {
63 {
64 .compatible = "simple-bus"
65 },
66 {
67 .compatible = "fsl,srio",
68 },
69 {
70 .compatible = "fsl,p4080-pcie",
71 },
72 {
73 .compatible = "fsl,qoriq-pcie-v2.2",
74 },
75 {
76 .compatible = "fsl,qoriq-pcie-v2.3",
77 },
78 {
79 .compatible = "fsl,qoriq-pcie-v2.4",
80 },
81 {
82 .compatible = "fsl,qoriq-pcie-v3.0",
83 },
84 /* The following two are for the Freescale hypervisor */
85 {
86 .name = "hypervisor",
87 },
88 {
89 .name = "handles",
90 },
91 {}
92};
93
94int __init corenet_gen_publish_devices(void)
95{
96 return of_platform_bus_probe(NULL, of_device_ids, NULL);
97}
98
99static const char * const boards[] __initconst = {
100 "fsl,P2041RDB",
101 "fsl,P3041DS",
102 "fsl,P4080DS",
103 "fsl,P5020DS",
104 "fsl,P5040DS",
105 "fsl,T4240QDS",
106 "fsl,B4860QDS",
107 "fsl,B4420QDS",
108 "fsl,B4220QDS",
109 NULL
110};
111
112static const char * const hv_boards[] __initconst = {
113 "fsl,P2041RDB-hv",
114 "fsl,P3041DS-hv",
115 "fsl,P4080DS-hv",
116 "fsl,P5020DS-hv",
117 "fsl,P5040DS-hv",
118 "fsl,T4240QDS-hv",
119 "fsl,B4860QDS-hv",
120 "fsl,B4420QDS-hv",
121 "fsl,B4220QDS-hv",
122 NULL
123};
124
125/*
126 * Called very early, device-tree isn't unflattened
127 */
128static int __init corenet_generic_probe(void)
129{
130 unsigned long root = of_get_flat_dt_root();
131#ifdef CONFIG_SMP
132 extern struct smp_ops_t smp_85xx_ops;
133#endif
134
135 if (of_flat_dt_match(root, boards))
136 return 1;
137
138 /* Check if we're running under the Freescale hypervisor */
139 if (of_flat_dt_match(root, hv_boards)) {
140 ppc_md.init_IRQ = ehv_pic_init;
141 ppc_md.get_irq = ehv_pic_get_irq;
142 ppc_md.restart = fsl_hv_restart;
143 ppc_md.power_off = fsl_hv_halt;
144 ppc_md.halt = fsl_hv_halt;
145#ifdef CONFIG_SMP
146 /*
147 * Disable the timebase sync operations because we can't write
148 * to the timebase registers under the hypervisor.
149 */
150 smp_85xx_ops.give_timebase = NULL;
151 smp_85xx_ops.take_timebase = NULL;
152#endif
153 return 1;
154 }
155
156 return 0;
157}
158
159define_machine(corenet_generic) {
160 .name = "CoreNet Generic",
161 .probe = corenet_generic_probe,
162 .setup_arch = corenet_gen_setup_arch,
163 .init_IRQ = corenet_gen_pic_init,
164#ifdef CONFIG_PCI
165 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
166#endif
167 .get_irq = mpic_get_coreint_irq,
168 .restart = fsl_rstcr_restart,
169 .calibrate_decr = generic_calibrate_decr,
170 .progress = udbg_progress,
171#ifdef CONFIG_PPC64
172 .power_save = book3e_idle,
173#else
174 .power_save = e500_idle,
175#endif
176};
177
178machine_arch_initcall(corenet_generic, corenet_gen_publish_devices);
179
180#ifdef CONFIG_SWIOTLB
181machine_arch_initcall(corenet_generic, swiotlb_setup_bus_notifier);
182#endif
diff --git a/arch/powerpc/platforms/85xx/p1010rdb.c b/arch/powerpc/platforms/85xx/p1010rdb.c
index 0252961392d5..d6a3dd311494 100644
--- a/arch/powerpc/platforms/85xx/p1010rdb.c
+++ b/arch/powerpc/platforms/85xx/p1010rdb.c
@@ -66,6 +66,8 @@ static int __init p1010_rdb_probe(void)
66 66
67 if (of_flat_dt_is_compatible(root, "fsl,P1010RDB")) 67 if (of_flat_dt_is_compatible(root, "fsl,P1010RDB"))
68 return 1; 68 return 1;
69 if (of_flat_dt_is_compatible(root, "fsl,P1010RDB-PB"))
70 return 1;
69 return 0; 71 return 0;
70} 72}
71 73
diff --git a/arch/powerpc/platforms/85xx/p2041_rdb.c b/arch/powerpc/platforms/85xx/p2041_rdb.c
deleted file mode 100644
index 000c0892fc40..000000000000
--- a/arch/powerpc/platforms/85xx/p2041_rdb.c
+++ /dev/null
@@ -1,87 +0,0 @@
1/*
2 * P2041 RDB Setup
3 *
4 * Copyright 2011 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/pci.h>
14#include <linux/kdev_t.h>
15#include <linux/delay.h>
16#include <linux/interrupt.h>
17#include <linux/phy.h>
18
19#include <asm/time.h>
20#include <asm/machdep.h>
21#include <asm/pci-bridge.h>
22#include <mm/mmu_decl.h>
23#include <asm/prom.h>
24#include <asm/udbg.h>
25#include <asm/mpic.h>
26
27#include <linux/of_platform.h>
28#include <sysdev/fsl_soc.h>
29#include <sysdev/fsl_pci.h>
30#include <asm/ehv_pic.h>
31
32#include "corenet_ds.h"
33
34/*
35 * Called very early, device-tree isn't unflattened
36 */
37static int __init p2041_rdb_probe(void)
38{
39 unsigned long root = of_get_flat_dt_root();
40#ifdef CONFIG_SMP
41 extern struct smp_ops_t smp_85xx_ops;
42#endif
43
44 if (of_flat_dt_is_compatible(root, "fsl,P2041RDB"))
45 return 1;
46
47 /* Check if we're running under the Freescale hypervisor */
48 if (of_flat_dt_is_compatible(root, "fsl,P2041RDB-hv")) {
49 ppc_md.init_IRQ = ehv_pic_init;
50 ppc_md.get_irq = ehv_pic_get_irq;
51 ppc_md.restart = fsl_hv_restart;
52 ppc_md.power_off = fsl_hv_halt;
53 ppc_md.halt = fsl_hv_halt;
54#ifdef CONFIG_SMP
55 /*
56 * Disable the timebase sync operations because we can't write
57 * to the timebase registers under the hypervisor.
58 */
59 smp_85xx_ops.give_timebase = NULL;
60 smp_85xx_ops.take_timebase = NULL;
61#endif
62 return 1;
63 }
64
65 return 0;
66}
67
68define_machine(p2041_rdb) {
69 .name = "P2041 RDB",
70 .probe = p2041_rdb_probe,
71 .setup_arch = corenet_ds_setup_arch,
72 .init_IRQ = corenet_ds_pic_init,
73#ifdef CONFIG_PCI
74 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
75#endif
76 .get_irq = mpic_get_coreint_irq,
77 .restart = fsl_rstcr_restart,
78 .calibrate_decr = generic_calibrate_decr,
79 .progress = udbg_progress,
80 .power_save = e500_idle,
81};
82
83machine_arch_initcall(p2041_rdb, corenet_ds_publish_devices);
84
85#ifdef CONFIG_SWIOTLB
86machine_arch_initcall(p2041_rdb, swiotlb_setup_bus_notifier);
87#endif
diff --git a/arch/powerpc/platforms/85xx/p3041_ds.c b/arch/powerpc/platforms/85xx/p3041_ds.c
deleted file mode 100644
index b3edc205daa9..000000000000
--- a/arch/powerpc/platforms/85xx/p3041_ds.c
+++ /dev/null
@@ -1,89 +0,0 @@
1/*
2 * P3041 DS Setup
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2009-2010 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/pci.h>
16#include <linux/kdev_t.h>
17#include <linux/delay.h>
18#include <linux/interrupt.h>
19#include <linux/phy.h>
20
21#include <asm/time.h>
22#include <asm/machdep.h>
23#include <asm/pci-bridge.h>
24#include <mm/mmu_decl.h>
25#include <asm/prom.h>
26#include <asm/udbg.h>
27#include <asm/mpic.h>
28
29#include <linux/of_platform.h>
30#include <sysdev/fsl_soc.h>
31#include <sysdev/fsl_pci.h>
32#include <asm/ehv_pic.h>
33
34#include "corenet_ds.h"
35
36/*
37 * Called very early, device-tree isn't unflattened
38 */
39static int __init p3041_ds_probe(void)
40{
41 unsigned long root = of_get_flat_dt_root();
42#ifdef CONFIG_SMP
43 extern struct smp_ops_t smp_85xx_ops;
44#endif
45
46 if (of_flat_dt_is_compatible(root, "fsl,P3041DS"))
47 return 1;
48
49 /* Check if we're running under the Freescale hypervisor */
50 if (of_flat_dt_is_compatible(root, "fsl,P3041DS-hv")) {
51 ppc_md.init_IRQ = ehv_pic_init;
52 ppc_md.get_irq = ehv_pic_get_irq;
53 ppc_md.restart = fsl_hv_restart;
54 ppc_md.power_off = fsl_hv_halt;
55 ppc_md.halt = fsl_hv_halt;
56#ifdef CONFIG_SMP
57 /*
58 * Disable the timebase sync operations because we can't write
59 * to the timebase registers under the hypervisor.
60 */
61 smp_85xx_ops.give_timebase = NULL;
62 smp_85xx_ops.take_timebase = NULL;
63#endif
64 return 1;
65 }
66
67 return 0;
68}
69
70define_machine(p3041_ds) {
71 .name = "P3041 DS",
72 .probe = p3041_ds_probe,
73 .setup_arch = corenet_ds_setup_arch,
74 .init_IRQ = corenet_ds_pic_init,
75#ifdef CONFIG_PCI
76 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
77#endif
78 .get_irq = mpic_get_coreint_irq,
79 .restart = fsl_rstcr_restart,
80 .calibrate_decr = generic_calibrate_decr,
81 .progress = udbg_progress,
82 .power_save = e500_idle,
83};
84
85machine_arch_initcall(p3041_ds, corenet_ds_publish_devices);
86
87#ifdef CONFIG_SWIOTLB
88machine_arch_initcall(p3041_ds, swiotlb_setup_bus_notifier);
89#endif
diff --git a/arch/powerpc/platforms/85xx/p4080_ds.c b/arch/powerpc/platforms/85xx/p4080_ds.c
deleted file mode 100644
index 54df10632aea..000000000000
--- a/arch/powerpc/platforms/85xx/p4080_ds.c
+++ /dev/null
@@ -1,87 +0,0 @@
1/*
2 * P4080 DS Setup
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2009 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/pci.h>
16#include <linux/kdev_t.h>
17#include <linux/delay.h>
18#include <linux/interrupt.h>
19
20#include <asm/time.h>
21#include <asm/machdep.h>
22#include <asm/pci-bridge.h>
23#include <mm/mmu_decl.h>
24#include <asm/prom.h>
25#include <asm/udbg.h>
26#include <asm/mpic.h>
27
28#include <linux/of_platform.h>
29#include <sysdev/fsl_soc.h>
30#include <sysdev/fsl_pci.h>
31#include <asm/ehv_pic.h>
32
33#include "corenet_ds.h"
34
35/*
36 * Called very early, device-tree isn't unflattened
37 */
38static int __init p4080_ds_probe(void)
39{
40 unsigned long root = of_get_flat_dt_root();
41#ifdef CONFIG_SMP
42 extern struct smp_ops_t smp_85xx_ops;
43#endif
44
45 if (of_flat_dt_is_compatible(root, "fsl,P4080DS"))
46 return 1;
47
48 /* Check if we're running under the Freescale hypervisor */
49 if (of_flat_dt_is_compatible(root, "fsl,P4080DS-hv")) {
50 ppc_md.init_IRQ = ehv_pic_init;
51 ppc_md.get_irq = ehv_pic_get_irq;
52 ppc_md.restart = fsl_hv_restart;
53 ppc_md.power_off = fsl_hv_halt;
54 ppc_md.halt = fsl_hv_halt;
55#ifdef CONFIG_SMP
56 /*
57 * Disable the timebase sync operations because we can't write
58 * to the timebase registers under the hypervisor.
59 */
60 smp_85xx_ops.give_timebase = NULL;
61 smp_85xx_ops.take_timebase = NULL;
62#endif
63 return 1;
64 }
65
66 return 0;
67}
68
69define_machine(p4080_ds) {
70 .name = "P4080 DS",
71 .probe = p4080_ds_probe,
72 .setup_arch = corenet_ds_setup_arch,
73 .init_IRQ = corenet_ds_pic_init,
74#ifdef CONFIG_PCI
75 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
76#endif
77 .get_irq = mpic_get_coreint_irq,
78 .restart = fsl_rstcr_restart,
79 .calibrate_decr = generic_calibrate_decr,
80 .progress = udbg_progress,
81 .power_save = e500_idle,
82};
83
84machine_arch_initcall(p4080_ds, corenet_ds_publish_devices);
85#ifdef CONFIG_SWIOTLB
86machine_arch_initcall(p4080_ds, swiotlb_setup_bus_notifier);
87#endif
diff --git a/arch/powerpc/platforms/85xx/p5020_ds.c b/arch/powerpc/platforms/85xx/p5020_ds.c
deleted file mode 100644
index 39cfa4044e6c..000000000000
--- a/arch/powerpc/platforms/85xx/p5020_ds.c
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * P5020 DS Setup
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2009-2010 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/pci.h>
16#include <linux/kdev_t.h>
17#include <linux/delay.h>
18#include <linux/interrupt.h>
19#include <linux/phy.h>
20
21#include <asm/time.h>
22#include <asm/machdep.h>
23#include <asm/pci-bridge.h>
24#include <mm/mmu_decl.h>
25#include <asm/prom.h>
26#include <asm/udbg.h>
27#include <asm/mpic.h>
28
29#include <linux/of_platform.h>
30#include <sysdev/fsl_soc.h>
31#include <sysdev/fsl_pci.h>
32#include <asm/ehv_pic.h>
33
34#include "corenet_ds.h"
35
36/*
37 * Called very early, device-tree isn't unflattened
38 */
39static int __init p5020_ds_probe(void)
40{
41 unsigned long root = of_get_flat_dt_root();
42#ifdef CONFIG_SMP
43 extern struct smp_ops_t smp_85xx_ops;
44#endif
45
46 if (of_flat_dt_is_compatible(root, "fsl,P5020DS"))
47 return 1;
48
49 /* Check if we're running under the Freescale hypervisor */
50 if (of_flat_dt_is_compatible(root, "fsl,P5020DS-hv")) {
51 ppc_md.init_IRQ = ehv_pic_init;
52 ppc_md.get_irq = ehv_pic_get_irq;
53 ppc_md.restart = fsl_hv_restart;
54 ppc_md.power_off = fsl_hv_halt;
55 ppc_md.halt = fsl_hv_halt;
56#ifdef CONFIG_SMP
57 /*
58 * Disable the timebase sync operations because we can't write
59 * to the timebase registers under the hypervisor.
60 */
61 smp_85xx_ops.give_timebase = NULL;
62 smp_85xx_ops.take_timebase = NULL;
63#endif
64 return 1;
65 }
66
67 return 0;
68}
69
70define_machine(p5020_ds) {
71 .name = "P5020 DS",
72 .probe = p5020_ds_probe,
73 .setup_arch = corenet_ds_setup_arch,
74 .init_IRQ = corenet_ds_pic_init,
75#ifdef CONFIG_PCI
76 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
77#endif
78 .get_irq = mpic_get_coreint_irq,
79 .restart = fsl_rstcr_restart,
80 .calibrate_decr = generic_calibrate_decr,
81 .progress = udbg_progress,
82#ifdef CONFIG_PPC64
83 .power_save = book3e_idle,
84#else
85 .power_save = e500_idle,
86#endif
87};
88
89machine_arch_initcall(p5020_ds, corenet_ds_publish_devices);
90
91#ifdef CONFIG_SWIOTLB
92machine_arch_initcall(p5020_ds, swiotlb_setup_bus_notifier);
93#endif
diff --git a/arch/powerpc/platforms/85xx/p5040_ds.c b/arch/powerpc/platforms/85xx/p5040_ds.c
deleted file mode 100644
index f70e74cddf97..000000000000
--- a/arch/powerpc/platforms/85xx/p5040_ds.c
+++ /dev/null
@@ -1,84 +0,0 @@
1/*
2 * P5040 DS Setup
3 *
4 * Copyright 2009-2010 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/pci.h>
14
15#include <asm/machdep.h>
16#include <asm/udbg.h>
17#include <asm/mpic.h>
18
19#include <linux/of_fdt.h>
20
21#include <sysdev/fsl_soc.h>
22#include <sysdev/fsl_pci.h>
23#include <asm/ehv_pic.h>
24
25#include "corenet_ds.h"
26
27/*
28 * Called very early, device-tree isn't unflattened
29 */
30static int __init p5040_ds_probe(void)
31{
32 unsigned long root = of_get_flat_dt_root();
33#ifdef CONFIG_SMP
34 extern struct smp_ops_t smp_85xx_ops;
35#endif
36
37 if (of_flat_dt_is_compatible(root, "fsl,P5040DS"))
38 return 1;
39
40 /* Check if we're running under the Freescale hypervisor */
41 if (of_flat_dt_is_compatible(root, "fsl,P5040DS-hv")) {
42 ppc_md.init_IRQ = ehv_pic_init;
43 ppc_md.get_irq = ehv_pic_get_irq;
44 ppc_md.restart = fsl_hv_restart;
45 ppc_md.power_off = fsl_hv_halt;
46 ppc_md.halt = fsl_hv_halt;
47#ifdef CONFIG_SMP
48 /*
49 * Disable the timebase sync operations because we can't write
50 * to the timebase registers under the hypervisor.
51 */
52 smp_85xx_ops.give_timebase = NULL;
53 smp_85xx_ops.take_timebase = NULL;
54#endif
55 return 1;
56 }
57
58 return 0;
59}
60
61define_machine(p5040_ds) {
62 .name = "P5040 DS",
63 .probe = p5040_ds_probe,
64 .setup_arch = corenet_ds_setup_arch,
65 .init_IRQ = corenet_ds_pic_init,
66#ifdef CONFIG_PCI
67 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
68#endif
69 .get_irq = mpic_get_coreint_irq,
70 .restart = fsl_rstcr_restart,
71 .calibrate_decr = generic_calibrate_decr,
72 .progress = udbg_progress,
73#ifdef CONFIG_PPC64
74 .power_save = book3e_idle,
75#else
76 .power_save = e500_idle,
77#endif
78};
79
80machine_arch_initcall(p5040_ds, corenet_ds_publish_devices);
81
82#ifdef CONFIG_SWIOTLB
83machine_arch_initcall(p5040_ds, swiotlb_setup_bus_notifier);
84#endif
diff --git a/arch/powerpc/platforms/85xx/ppa8548.c b/arch/powerpc/platforms/85xx/ppa8548.c
index 6a7704b92c3b..3daff7c63569 100644
--- a/arch/powerpc/platforms/85xx/ppa8548.c
+++ b/arch/powerpc/platforms/85xx/ppa8548.c
@@ -19,6 +19,7 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/reboot.h> 20#include <linux/reboot.h>
21#include <linux/seq_file.h> 21#include <linux/seq_file.h>
22#include <linux/of_fdt.h>
22#include <linux/of_platform.h> 23#include <linux/of_platform.h>
23 24
24#include <asm/machdep.h> 25#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/85xx/sgy_cts1000.c b/arch/powerpc/platforms/85xx/sgy_cts1000.c
index 7179726ba5c5..b9197cea1854 100644
--- a/arch/powerpc/platforms/85xx/sgy_cts1000.c
+++ b/arch/powerpc/platforms/85xx/sgy_cts1000.c
@@ -16,6 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/of_gpio.h> 18#include <linux/of_gpio.h>
19#include <linux/of_irq.h>
19#include <linux/workqueue.h> 20#include <linux/workqueue.h>
20#include <linux/reboot.h> 21#include <linux/reboot.h>
21#include <linux/interrupt.h> 22#include <linux/interrupt.h>
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index 281b7f01df63..393f975ab397 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/of.h> 17#include <linux/of.h>
18#include <linux/of_address.h>
18#include <linux/kexec.h> 19#include <linux/kexec.h>
19#include <linux/highmem.h> 20#include <linux/highmem.h>
20#include <linux/cpu.h> 21#include <linux/cpu.h>
diff --git a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
index 3bbbf7489487..55a9682b9529 100644
--- a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
+++ b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
@@ -9,6 +9,8 @@
9 */ 9 */
10 10
11#include <linux/irq.h> 11#include <linux/irq.h>
12#include <linux/of_address.h>
13#include <linux/of_irq.h>
12#include <linux/of_platform.h> 14#include <linux/of_platform.h>
13#include <linux/io.h> 15#include <linux/io.h>
14 16
diff --git a/arch/powerpc/platforms/85xx/t4240_qds.c b/arch/powerpc/platforms/85xx/t4240_qds.c
deleted file mode 100644
index 91ead6b1b8af..000000000000
--- a/arch/powerpc/platforms/85xx/t4240_qds.c
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * T4240 QDS Setup
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2012 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/pci.h>
16#include <linux/kdev_t.h>
17#include <linux/delay.h>
18#include <linux/interrupt.h>
19#include <linux/phy.h>
20
21#include <asm/time.h>
22#include <asm/machdep.h>
23#include <asm/pci-bridge.h>
24#include <mm/mmu_decl.h>
25#include <asm/prom.h>
26#include <asm/udbg.h>
27#include <asm/mpic.h>
28
29#include <linux/of_platform.h>
30#include <sysdev/fsl_soc.h>
31#include <sysdev/fsl_pci.h>
32#include <asm/ehv_pic.h>
33
34#include "corenet_ds.h"
35
36/*
37 * Called very early, device-tree isn't unflattened
38 */
39static int __init t4240_qds_probe(void)
40{
41 unsigned long root = of_get_flat_dt_root();
42#ifdef CONFIG_SMP
43 extern struct smp_ops_t smp_85xx_ops;
44#endif
45
46 if (of_flat_dt_is_compatible(root, "fsl,T4240QDS"))
47 return 1;
48
49 /* Check if we're running under the Freescale hypervisor */
50 if (of_flat_dt_is_compatible(root, "fsl,T4240QDS-hv")) {
51 ppc_md.init_IRQ = ehv_pic_init;
52 ppc_md.get_irq = ehv_pic_get_irq;
53 ppc_md.restart = fsl_hv_restart;
54 ppc_md.power_off = fsl_hv_halt;
55 ppc_md.halt = fsl_hv_halt;
56#ifdef CONFIG_SMP
57 /*
58 * Disable the timebase sync operations because we can't write
59 * to the timebase registers under the hypervisor.
60 */
61 smp_85xx_ops.give_timebase = NULL;
62 smp_85xx_ops.take_timebase = NULL;
63#endif
64 return 1;
65 }
66
67 return 0;
68}
69
70define_machine(t4240_qds) {
71 .name = "T4240 QDS",
72 .probe = t4240_qds_probe,
73 .setup_arch = corenet_ds_setup_arch,
74 .init_IRQ = corenet_ds_pic_init,
75#ifdef CONFIG_PCI
76 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
77#endif
78 .get_irq = mpic_get_coreint_irq,
79 .restart = fsl_rstcr_restart,
80 .calibrate_decr = generic_calibrate_decr,
81 .progress = udbg_progress,
82#ifdef CONFIG_PPC64
83 .power_save = book3e_idle,
84#else
85 .power_save = e500_idle,
86#endif
87};
88
89machine_arch_initcall(t4240_qds, corenet_ds_publish_devices);
90
91#ifdef CONFIG_SWIOTLB
92machine_arch_initcall(t4240_qds, swiotlb_setup_bus_notifier);
93#endif
diff --git a/arch/powerpc/platforms/86xx/pic.c b/arch/powerpc/platforms/86xx/pic.c
index 9982f57c98b9..d5b98c0f958a 100644
--- a/arch/powerpc/platforms/86xx/pic.c
+++ b/arch/powerpc/platforms/86xx/pic.c
@@ -10,6 +10,7 @@
10#include <linux/stddef.h> 10#include <linux/stddef.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/of_irq.h>
13#include <linux/of_platform.h> 14#include <linux/of_platform.h>
14 15
15#include <asm/mpic.h> 16#include <asm/mpic.h>
diff --git a/arch/powerpc/platforms/8xx/ep88xc.c b/arch/powerpc/platforms/8xx/ep88xc.c
index 7d9ac6040d63..e62166681d08 100644
--- a/arch/powerpc/platforms/8xx/ep88xc.c
+++ b/arch/powerpc/platforms/8xx/ep88xc.c
@@ -10,6 +10,8 @@
10 */ 10 */
11 11
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/of_address.h>
14#include <linux/of_fdt.h>
13#include <linux/of_platform.h> 15#include <linux/of_platform.h>
14 16
15#include <asm/machdep.h> 17#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/8xx/mpc86xads_setup.c b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
index 866feff83c91..63084640c5c5 100644
--- a/arch/powerpc/platforms/8xx/mpc86xads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
@@ -15,6 +15,8 @@
15 */ 15 */
16 16
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/of_address.h>
19#include <linux/of_fdt.h>
18#include <linux/of_platform.h> 20#include <linux/of_platform.h>
19 21
20#include <asm/io.h> 22#include <asm/io.h>
diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
index 5d98398c2f5e..c1262581b63c 100644
--- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
@@ -25,6 +25,8 @@
25#include <linux/fs_uart_pd.h> 25#include <linux/fs_uart_pd.h>
26#include <linux/fsl_devices.h> 26#include <linux/fsl_devices.h>
27#include <linux/mii.h> 27#include <linux/mii.h>
28#include <linux/of_address.h>
29#include <linux/of_fdt.h>
28#include <linux/of_platform.h> 30#include <linux/of_platform.h>
29 31
30#include <asm/delay.h> 32#include <asm/delay.h>
diff --git a/arch/powerpc/platforms/8xx/tqm8xx_setup.c b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
index 8d21ab70e06c..251aba8759e4 100644
--- a/arch/powerpc/platforms/8xx/tqm8xx_setup.c
+++ b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
@@ -28,6 +28,7 @@
28#include <linux/fs_uart_pd.h> 28#include <linux/fs_uart_pd.h>
29#include <linux/fsl_devices.h> 29#include <linux/fsl_devices.h>
30#include <linux/mii.h> 30#include <linux/mii.h>
31#include <linux/of_fdt.h>
31#include <linux/of_platform.h> 32#include <linux/of_platform.h>
32 33
33#include <asm/delay.h> 34#include <asm/delay.h>
@@ -48,7 +49,7 @@ struct cpm_pin {
48 int port, pin, flags; 49 int port, pin, flags;
49}; 50};
50 51
51static struct __initdata cpm_pin tqm8xx_pins[] = { 52static struct cpm_pin tqm8xx_pins[] __initdata = {
52 /* SMC1 */ 53 /* SMC1 */
53 {CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */ 54 {CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */
54 {CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */ 55 {CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */
@@ -63,7 +64,7 @@ static struct __initdata cpm_pin tqm8xx_pins[] = {
63 {CPM_PORTC, 11, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO}, 64 {CPM_PORTC, 11, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO},
64}; 65};
65 66
66static struct __initdata cpm_pin tqm8xx_fec_pins[] = { 67static struct cpm_pin tqm8xx_fec_pins[] __initdata = {
67 /* MII */ 68 /* MII */
68 {CPM_PORTD, 3, CPM_PIN_OUTPUT}, 69 {CPM_PORTD, 3, CPM_PIN_OUTPUT},
69 {CPM_PORTD, 4, CPM_PIN_OUTPUT}, 70 {CPM_PORTD, 4, CPM_PIN_OUTPUT},
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 6704e2e20e6b..c2a566fb8bb8 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -93,22 +93,23 @@ choice
93 93
94config GENERIC_CPU 94config GENERIC_CPU
95 bool "Generic" 95 bool "Generic"
96 depends on !CPU_LITTLE_ENDIAN
96 97
97config CELL_CPU 98config CELL_CPU
98 bool "Cell Broadband Engine" 99 bool "Cell Broadband Engine"
99 depends on PPC_BOOK3S_64 100 depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
100 101
101config POWER4_CPU 102config POWER4_CPU
102 bool "POWER4" 103 bool "POWER4"
103 depends on PPC_BOOK3S_64 104 depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
104 105
105config POWER5_CPU 106config POWER5_CPU
106 bool "POWER5" 107 bool "POWER5"
107 depends on PPC_BOOK3S_64 108 depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
108 109
109config POWER6_CPU 110config POWER6_CPU
110 bool "POWER6" 111 bool "POWER6"
111 depends on PPC_BOOK3S_64 112 depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
112 113
113config POWER7_CPU 114config POWER7_CPU
114 bool "POWER7" 115 bool "POWER7"
diff --git a/arch/powerpc/platforms/cell/celleb_scc_pciex.c b/arch/powerpc/platforms/cell/celleb_scc_pciex.c
index 14be2bd358b8..4278acfa2ede 100644
--- a/arch/powerpc/platforms/cell/celleb_scc_pciex.c
+++ b/arch/powerpc/platforms/cell/celleb_scc_pciex.c
@@ -486,7 +486,6 @@ static __init int celleb_setup_pciex(struct device_node *node,
486 struct pci_controller *phb) 486 struct pci_controller *phb)
487{ 487{
488 struct resource r; 488 struct resource r;
489 struct of_irq oirq;
490 int virq; 489 int virq;
491 490
492 /* SMMIO registers; used inside this file */ 491 /* SMMIO registers; used inside this file */
@@ -507,12 +506,11 @@ static __init int celleb_setup_pciex(struct device_node *node,
507 phb->ops = &scc_pciex_pci_ops; 506 phb->ops = &scc_pciex_pci_ops;
508 507
509 /* internal interrupt handler */ 508 /* internal interrupt handler */
510 if (of_irq_map_one(node, 1, &oirq)) { 509 virq = irq_of_parse_and_map(node, 1);
510 if (!virq) {
511 pr_err("PCIEXC:Failed to map irq\n"); 511 pr_err("PCIEXC:Failed to map irq\n");
512 goto error; 512 goto error;
513 } 513 }
514 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
515 oirq.size);
516 if (request_irq(virq, pciex_handle_internal_irq, 514 if (request_irq(virq, pciex_handle_internal_irq,
517 0, "pciex", (void *)phb)) { 515 0, "pciex", (void *)phb)) {
518 pr_err("PCIEXC:Failed to request irq\n"); 516 pr_err("PCIEXC:Failed to request irq\n");
diff --git a/arch/powerpc/platforms/cell/celleb_scc_sio.c b/arch/powerpc/platforms/cell/celleb_scc_sio.c
index 9c339ec646f5..c8eb57193826 100644
--- a/arch/powerpc/platforms/cell/celleb_scc_sio.c
+++ b/arch/powerpc/platforms/cell/celleb_scc_sio.c
@@ -45,7 +45,7 @@ static int __init txx9_serial_init(void)
45 struct device_node *node; 45 struct device_node *node;
46 int i; 46 int i;
47 struct uart_port req; 47 struct uart_port req;
48 struct of_irq irq; 48 struct of_phandle_args irq;
49 struct resource res; 49 struct resource res;
50 50
51 for_each_compatible_node(node, "serial", "toshiba,sio-scc") { 51 for_each_compatible_node(node, "serial", "toshiba,sio-scc") {
@@ -53,7 +53,7 @@ static int __init txx9_serial_init(void)
53 if (!(txx9_serial_bitmap & (1<<i))) 53 if (!(txx9_serial_bitmap & (1<<i)))
54 continue; 54 continue;
55 55
56 if (of_irq_map_one(node, i, &irq)) 56 if (of_irq_parse_one(node, i, &irq))
57 continue; 57 continue;
58 if (of_address_to_resource(node, 58 if (of_address_to_resource(node,
59 txx9_scc_tab[i].index, &res)) 59 txx9_scc_tab[i].index, &res))
@@ -66,8 +66,7 @@ static int __init txx9_serial_init(void)
66#ifdef CONFIG_SERIAL_TXX9_CONSOLE 66#ifdef CONFIG_SERIAL_TXX9_CONSOLE
67 req.membase = ioremap(req.mapbase, 0x24); 67 req.membase = ioremap(req.mapbase, 0x24);
68#endif 68#endif
69 req.irq = irq_create_of_mapping(irq.controller, 69 req.irq = irq_create_of_mapping(&irq);
70 irq.specifier, irq.size);
71 req.flags |= UPF_IOREMAP | UPF_BUGGY_UART 70 req.flags |= UPF_IOREMAP | UPF_BUGGY_UART
72 /*HAVE_CTS_LINE*/; 71 /*HAVE_CTS_LINE*/;
73 req.uartclk = 83300000; 72 req.uartclk = 83300000;
diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c
index 8e299447127e..1f72f4ab6353 100644
--- a/arch/powerpc/platforms/cell/spider-pic.c
+++ b/arch/powerpc/platforms/cell/spider-pic.c
@@ -235,12 +235,9 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic)
235 /* First, we check whether we have a real "interrupts" in the device 235 /* First, we check whether we have a real "interrupts" in the device
236 * tree in case the device-tree is ever fixed 236 * tree in case the device-tree is ever fixed
237 */ 237 */
238 struct of_irq oirq; 238 virq = irq_of_parse_and_map(pic->host->of_node, 0);
239 if (of_irq_map_one(pic->host->of_node, 0, &oirq) == 0) { 239 if (virq)
240 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
241 oirq.size);
242 return virq; 240 return virq;
243 }
244 241
245 /* Now do the horrible hacks */ 242 /* Now do the horrible hacks */
246 tmp = of_get_property(pic->host->of_node, "#interrupt-cells", NULL); 243 tmp = of_get_property(pic->host->of_node, "#interrupt-cells", NULL);
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c
index 2bb6977c0a5a..c3327f3d8cf7 100644
--- a/arch/powerpc/platforms/cell/spu_manage.c
+++ b/arch/powerpc/platforms/cell/spu_manage.c
@@ -177,21 +177,20 @@ out:
177 177
178static int __init spu_map_interrupts(struct spu *spu, struct device_node *np) 178static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
179{ 179{
180 struct of_irq oirq; 180 struct of_phandle_args oirq;
181 int ret; 181 int ret;
182 int i; 182 int i;
183 183
184 for (i=0; i < 3; i++) { 184 for (i=0; i < 3; i++) {
185 ret = of_irq_map_one(np, i, &oirq); 185 ret = of_irq_parse_one(np, i, &oirq);
186 if (ret) { 186 if (ret) {
187 pr_debug("spu_new: failed to get irq %d\n", i); 187 pr_debug("spu_new: failed to get irq %d\n", i);
188 goto err; 188 goto err;
189 } 189 }
190 ret = -EINVAL; 190 ret = -EINVAL;
191 pr_debug(" irq %d no 0x%x on %s\n", i, oirq.specifier[0], 191 pr_debug(" irq %d no 0x%x on %s\n", i, oirq.args[0],
192 oirq.controller->full_name); 192 oirq.np->full_name);
193 spu->irqs[i] = irq_create_of_mapping(oirq.controller, 193 spu->irqs[i] = irq_create_of_mapping(&oirq);
194 oirq.specifier, oirq.size);
195 if (spu->irqs[i] == NO_IRQ) { 194 if (spu->irqs[i] == NO_IRQ) {
196 pr_debug("spu_new: failed to map it !\n"); 195 pr_debug("spu_new: failed to map it !\n");
197 goto err; 196 goto err;
@@ -200,7 +199,7 @@ static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
200 return 0; 199 return 0;
201 200
202err: 201err:
203 pr_debug("failed to map irq %x for spu %s\n", *oirq.specifier, 202 pr_debug("failed to map irq %x for spu %s\n", *oirq.args,
204 spu->name); 203 spu->name);
205 for (; i >= 0; i--) { 204 for (; i >= 0; i--) {
206 if (spu->irqs[i] != NO_IRQ) 205 if (spu->irqs[i] != NO_IRQ)
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c
index db4e638cf408..3844f1397fc3 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -25,6 +25,7 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/syscalls.h> 26#include <linux/syscalls.h>
27#include <linux/rcupdate.h> 27#include <linux/rcupdate.h>
28#include <linux/binfmts.h>
28 29
29#include <asm/spu.h> 30#include <asm/spu.h>
30 31
@@ -126,7 +127,7 @@ int elf_coredump_extra_notes_size(void)
126 return ret; 127 return ret;
127} 128}
128 129
129int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset) 130int elf_coredump_extra_notes_write(struct coredump_params *cprm)
130{ 131{
131 struct spufs_calls *calls; 132 struct spufs_calls *calls;
132 int ret; 133 int ret;
@@ -135,7 +136,7 @@ int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset)
135 if (!calls) 136 if (!calls)
136 return 0; 137 return 0;
137 138
138 ret = calls->coredump_extra_notes_write(file, foffset); 139 ret = calls->coredump_extra_notes_write(cprm);
139 140
140 spufs_calls_put(calls); 141 spufs_calls_put(calls);
141 142
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index c9500ea7be2f..be6212ddbf06 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -27,6 +27,8 @@
27#include <linux/gfp.h> 27#include <linux/gfp.h>
28#include <linux/list.h> 28#include <linux/list.h>
29#include <linux/syscalls.h> 29#include <linux/syscalls.h>
30#include <linux/coredump.h>
31#include <linux/binfmts.h>
30 32
31#include <asm/uaccess.h> 33#include <asm/uaccess.h>
32 34
@@ -48,44 +50,6 @@ static ssize_t do_coredump_read(int num, struct spu_context *ctx, void *buffer,
48 return ++ret; /* count trailing NULL */ 50 return ++ret; /* count trailing NULL */
49} 51}
50 52
51/*
52 * These are the only things you should do on a core-file: use only these
53 * functions to write out all the necessary info.
54 */
55static int spufs_dump_write(struct file *file, const void *addr, int nr, loff_t *foffset)
56{
57 unsigned long limit = rlimit(RLIMIT_CORE);
58 ssize_t written;
59
60 if (*foffset + nr > limit)
61 return -EIO;
62
63 written = file->f_op->write(file, addr, nr, &file->f_pos);
64 *foffset += written;
65
66 if (written != nr)
67 return -EIO;
68
69 return 0;
70}
71
72static int spufs_dump_align(struct file *file, char *buf, loff_t new_off,
73 loff_t *foffset)
74{
75 int rc, size;
76
77 size = min((loff_t)PAGE_SIZE, new_off - *foffset);
78 memset(buf, 0, size);
79
80 rc = 0;
81 while (rc == 0 && new_off > *foffset) {
82 size = min((loff_t)PAGE_SIZE, new_off - *foffset);
83 rc = spufs_dump_write(file, buf, size, foffset);
84 }
85
86 return rc;
87}
88
89static int spufs_ctx_note_size(struct spu_context *ctx, int dfd) 53static int spufs_ctx_note_size(struct spu_context *ctx, int dfd)
90{ 54{
91 int i, sz, total = 0; 55 int i, sz, total = 0;
@@ -165,10 +129,10 @@ int spufs_coredump_extra_notes_size(void)
165} 129}
166 130
167static int spufs_arch_write_note(struct spu_context *ctx, int i, 131static int spufs_arch_write_note(struct spu_context *ctx, int i,
168 struct file *file, int dfd, loff_t *foffset) 132 struct coredump_params *cprm, int dfd)
169{ 133{
170 loff_t pos = 0; 134 loff_t pos = 0;
171 int sz, rc, nread, total = 0; 135 int sz, rc, total = 0;
172 const int bufsz = PAGE_SIZE; 136 const int bufsz = PAGE_SIZE;
173 char *name; 137 char *name;
174 char fullname[80], *buf; 138 char fullname[80], *buf;
@@ -186,42 +150,39 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i,
186 en.n_descsz = sz; 150 en.n_descsz = sz;
187 en.n_type = NT_SPU; 151 en.n_type = NT_SPU;
188 152
189 rc = spufs_dump_write(file, &en, sizeof(en), foffset); 153 if (!dump_emit(cprm, &en, sizeof(en)))
190 if (rc) 154 goto Eio;
191 goto out;
192 155
193 rc = spufs_dump_write(file, fullname, en.n_namesz, foffset); 156 if (!dump_emit(cprm, fullname, en.n_namesz))
194 if (rc) 157 goto Eio;
195 goto out;
196 158
197 rc = spufs_dump_align(file, buf, roundup(*foffset, 4), foffset); 159 if (!dump_align(cprm, 4))
198 if (rc) 160 goto Eio;
199 goto out;
200 161
201 do { 162 do {
202 nread = do_coredump_read(i, ctx, buf, bufsz, &pos); 163 rc = do_coredump_read(i, ctx, buf, bufsz, &pos);
203 if (nread > 0) { 164 if (rc > 0) {
204 rc = spufs_dump_write(file, buf, nread, foffset); 165 if (!dump_emit(cprm, buf, rc))
205 if (rc) 166 goto Eio;
206 goto out; 167 total += rc;
207 total += nread;
208 } 168 }
209 } while (nread == bufsz && total < sz); 169 } while (rc == bufsz && total < sz);
210 170
211 if (nread < 0) { 171 if (rc < 0)
212 rc = nread;
213 goto out; 172 goto out;
214 }
215
216 rc = spufs_dump_align(file, buf, roundup(*foffset - total + sz, 4),
217 foffset);
218 173
174 if (!dump_skip(cprm,
175 roundup(cprm->written - total + sz, 4) - cprm->written))
176 goto Eio;
219out: 177out:
220 free_page((unsigned long)buf); 178 free_page((unsigned long)buf);
221 return rc; 179 return rc;
180Eio:
181 free_page((unsigned long)buf);
182 return -EIO;
222} 183}
223 184
224int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset) 185int spufs_coredump_extra_notes_write(struct coredump_params *cprm)
225{ 186{
226 struct spu_context *ctx; 187 struct spu_context *ctx;
227 int fd, j, rc; 188 int fd, j, rc;
@@ -233,7 +194,7 @@ int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset)
233 return rc; 194 return rc;
234 195
235 for (j = 0; spufs_coredump_read[j].name != NULL; j++) { 196 for (j = 0; spufs_coredump_read[j].name != NULL; j++) {
236 rc = spufs_arch_write_note(ctx, j, file, fd, foffset); 197 rc = spufs_arch_write_note(ctx, j, cprm, fd);
237 if (rc) { 198 if (rc) {
238 spu_release_saved(ctx); 199 spu_release_saved(ctx);
239 return rc; 200 return rc;
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index 67852ade4c01..0ba3c9598358 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -247,12 +247,13 @@ extern const struct spufs_tree_descr spufs_dir_debug_contents[];
247 247
248/* system call implementation */ 248/* system call implementation */
249extern struct spufs_calls spufs_calls; 249extern struct spufs_calls spufs_calls;
250struct coredump_params;
250long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status); 251long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status);
251long spufs_create(struct path *nd, struct dentry *dentry, unsigned int flags, 252long spufs_create(struct path *nd, struct dentry *dentry, unsigned int flags,
252 umode_t mode, struct file *filp); 253 umode_t mode, struct file *filp);
253/* ELF coredump callbacks for writing SPU ELF notes */ 254/* ELF coredump callbacks for writing SPU ELF notes */
254extern int spufs_coredump_extra_notes_size(void); 255extern int spufs_coredump_extra_notes_size(void);
255extern int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset); 256extern int spufs_coredump_extra_notes_write(struct coredump_params *cprm);
256 257
257extern const struct file_operations spufs_context_fops; 258extern const struct file_operations spufs_context_fops;
258 259
diff --git a/arch/powerpc/platforms/chrp/nvram.c b/arch/powerpc/platforms/chrp/nvram.c
index d3ceff04ffc7..9ef8cc3378d0 100644
--- a/arch/powerpc/platforms/chrp/nvram.c
+++ b/arch/powerpc/platforms/chrp/nvram.c
@@ -66,7 +66,7 @@ static void chrp_nvram_write(int addr, unsigned char val)
66void __init chrp_nvram_init(void) 66void __init chrp_nvram_init(void)
67{ 67{
68 struct device_node *nvram; 68 struct device_node *nvram;
69 const unsigned int *nbytes_p; 69 const __be32 *nbytes_p;
70 unsigned int proplen; 70 unsigned int proplen;
71 71
72 nvram = of_find_node_by_type(NULL, "nvram"); 72 nvram = of_find_node_by_type(NULL, "nvram");
@@ -79,7 +79,7 @@ void __init chrp_nvram_init(void)
79 return; 79 return;
80 } 80 }
81 81
82 nvram_size = *nbytes_p; 82 nvram_size = be32_to_cpup(nbytes_p);
83 83
84 printk(KERN_INFO "CHRP nvram contains %u bytes\n", nvram_size); 84 printk(KERN_INFO "CHRP nvram contains %u bytes\n", nvram_size);
85 of_node_put(nvram); 85 of_node_put(nvram);
diff --git a/arch/powerpc/platforms/embedded6xx/flipper-pic.c b/arch/powerpc/platforms/embedded6xx/flipper-pic.c
index 53d6eee01963..4cde8e7da4b8 100644
--- a/arch/powerpc/platforms/embedded6xx/flipper-pic.c
+++ b/arch/powerpc/platforms/embedded6xx/flipper-pic.c
@@ -18,6 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/of.h> 20#include <linux/of.h>
21#include <linux/of_address.h>
21#include <asm/io.h> 22#include <asm/io.h>
22 23
23#include "flipper-pic.h" 24#include "flipper-pic.h"
diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
index 3006b5117ec6..6c03034dbbd3 100644
--- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
+++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
@@ -18,6 +18,8 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/of.h> 20#include <linux/of.h>
21#include <linux/of_address.h>
22#include <linux/of_irq.h>
21#include <asm/io.h> 23#include <asm/io.h>
22 24
23#include "hlwd-pic.h" 25#include "hlwd-pic.h"
@@ -181,6 +183,7 @@ struct irq_domain *hlwd_pic_init(struct device_node *np)
181 &hlwd_irq_domain_ops, io_base); 183 &hlwd_irq_domain_ops, io_base);
182 if (!irq_domain) { 184 if (!irq_domain) {
183 pr_err("failed to allocate irq_domain\n"); 185 pr_err("failed to allocate irq_domain\n");
186 iounmap(io_base);
184 return NULL; 187 return NULL;
185 } 188 }
186 189
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
index 92ac9b52b32d..b97f6f3d3c5b 100644
--- a/arch/powerpc/platforms/fsl_uli1575.c
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -321,8 +321,7 @@ static void hpcd_final_uli5288(struct pci_dev *dev)
321{ 321{
322 struct pci_controller *hose = pci_bus_to_host(dev->bus); 322 struct pci_controller *hose = pci_bus_to_host(dev->bus);
323 struct device_node *hosenode = hose ? hose->dn : NULL; 323 struct device_node *hosenode = hose ? hose->dn : NULL;
324 struct of_irq oirq; 324 struct of_phandle_args oirq;
325 int virq, pin = 2;
326 u32 laddr[3]; 325 u32 laddr[3];
327 326
328 if (!machine_is(mpc86xx_hpcd)) 327 if (!machine_is(mpc86xx_hpcd))
@@ -331,12 +330,13 @@ static void hpcd_final_uli5288(struct pci_dev *dev)
331 if (!hosenode) 330 if (!hosenode)
332 return; 331 return;
333 332
333 oirq.np = hosenode;
334 oirq.args[0] = 2;
335 oirq.args_count = 1;
334 laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8); 336 laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8);
335 laddr[1] = laddr[2] = 0; 337 laddr[1] = laddr[2] = 0;
336 of_irq_map_raw(hosenode, &pin, 1, laddr, &oirq); 338 of_irq_parse_raw(laddr, &oirq);
337 virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 339 dev->irq = irq_create_of_mapping(&oirq);
338 oirq.size);
339 dev->irq = virq;
340} 340}
341 341
342DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, hpcd_quirk_uli1575); 342DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, hpcd_quirk_uli1575);
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index 0237ab782fb8..15adee544638 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -30,6 +30,7 @@
30#include <linux/ioport.h> 30#include <linux/ioport.h>
31#include <linux/interrupt.h> 31#include <linux/interrupt.h>
32#include <linux/phy.h> 32#include <linux/phy.h>
33#include <linux/of_address.h>
33#include <linux/of_mdio.h> 34#include <linux/of_mdio.h>
34#include <linux/of_platform.h> 35#include <linux/of_platform.h>
35 36
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index fc536f2971c0..7553b6a77c64 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -452,7 +452,7 @@ static int kw_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize,
452 */ 452 */
453 if (use_irq) { 453 if (use_irq) {
454 /* Clear completion */ 454 /* Clear completion */
455 INIT_COMPLETION(host->complete); 455 reinit_completion(&host->complete);
456 /* Ack stale interrupts */ 456 /* Ack stale interrupts */
457 kw_write_reg(reg_isr, kw_read_reg(reg_isr)); 457 kw_write_reg(reg_isr, kw_read_reg(reg_isr));
458 /* Arm timeout */ 458 /* Arm timeout */
@@ -717,7 +717,7 @@ static int pmu_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize,
717 return -EINVAL; 717 return -EINVAL;
718 } 718 }
719 719
720 INIT_COMPLETION(comp); 720 reinit_completion(&comp);
721 req->data[0] = PMU_I2C_CMD; 721 req->data[0] = PMU_I2C_CMD;
722 req->reply[0] = 0xff; 722 req->reply[0] = 0xff;
723 req->nbytes = sizeof(struct pmu_i2c_hdr) + 1; 723 req->nbytes = sizeof(struct pmu_i2c_hdr) + 1;
@@ -748,7 +748,7 @@ static int pmu_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize,
748 748
749 hdr->bus = PMU_I2C_BUS_STATUS; 749 hdr->bus = PMU_I2C_BUS_STATUS;
750 750
751 INIT_COMPLETION(comp); 751 reinit_completion(&comp);
752 req->data[0] = PMU_I2C_CMD; 752 req->data[0] = PMU_I2C_CMD;
753 req->reply[0] = 0xff; 753 req->reply[0] = 0xff;
754 req->nbytes = 2; 754 req->nbytes = 2;
diff --git a/arch/powerpc/platforms/powermac/pfunc_base.c b/arch/powerpc/platforms/powermac/pfunc_base.c
index f5e3cda6660e..e49d07f3d542 100644
--- a/arch/powerpc/platforms/powermac/pfunc_base.c
+++ b/arch/powerpc/platforms/powermac/pfunc_base.c
@@ -4,6 +4,7 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/interrupt.h> 5#include <linux/interrupt.h>
6#include <linux/spinlock.h> 6#include <linux/spinlock.h>
7#include <linux/of_irq.h>
7 8
8#include <asm/pmac_feature.h> 9#include <asm/pmac_feature.h>
9#include <asm/pmac_pfunc.h> 10#include <asm/pmac_pfunc.h>
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 31036b56670e..4c24bf60d39d 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -393,8 +393,8 @@ static void __init pmac_pic_probe_oldstyle(void)
393#endif 393#endif
394} 394}
395 395
396int of_irq_map_oldworld(struct device_node *device, int index, 396int of_irq_parse_oldworld(struct device_node *device, int index,
397 struct of_irq *out_irq) 397 struct of_phandle_args *out_irq)
398{ 398{
399 const u32 *ints = NULL; 399 const u32 *ints = NULL;
400 int intlen; 400 int intlen;
@@ -422,9 +422,9 @@ int of_irq_map_oldworld(struct device_node *device, int index,
422 if (index >= intlen) 422 if (index >= intlen)
423 return -EINVAL; 423 return -EINVAL;
424 424
425 out_irq->controller = NULL; 425 out_irq->np = NULL;
426 out_irq->specifier[0] = ints[index]; 426 out_irq->args[0] = ints[index];
427 out_irq->size = 1; 427 out_irq->args_count = 1;
428 428
429 return 0; 429 return 0;
430} 430}
diff --git a/arch/powerpc/platforms/powernv/Kconfig b/arch/powerpc/platforms/powernv/Kconfig
index 6fae5eb99ea6..9fced3f6d2dc 100644
--- a/arch/powerpc/platforms/powernv/Kconfig
+++ b/arch/powerpc/platforms/powernv/Kconfig
@@ -9,6 +9,8 @@ config PPC_POWERNV
9 select EPAPR_BOOT 9 select EPAPR_BOOT
10 select PPC_INDIRECT_PIO 10 select PPC_INDIRECT_PIO
11 select PPC_UDBG_16550 11 select PPC_UDBG_16550
12 select PPC_SCOM
13 select ARCH_RANDOM
12 default y 14 default y
13 15
14config POWERNV_MSI 16config POWERNV_MSI
diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile
index 300c437d713c..873fa1370dc4 100644
--- a/arch/powerpc/platforms/powernv/Makefile
+++ b/arch/powerpc/platforms/powernv/Makefile
@@ -1,6 +1,8 @@
1obj-y += setup.o opal-takeover.o opal-wrappers.o opal.o 1obj-y += setup.o opal-takeover.o opal-wrappers.o opal.o
2obj-y += opal-rtc.o opal-nvram.o opal-lpc.o 2obj-y += opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o
3obj-y += rng.o
3 4
4obj-$(CONFIG_SMP) += smp.o 5obj-$(CONFIG_SMP) += smp.o
5obj-$(CONFIG_PCI) += pci.o pci-p5ioc2.o pci-ioda.o 6obj-$(CONFIG_PCI) += pci.o pci-p5ioc2.o pci-ioda.o
6obj-$(CONFIG_EEH) += eeh-ioda.o eeh-powernv.o 7obj-$(CONFIG_EEH) += eeh-ioda.o eeh-powernv.o
8obj-$(CONFIG_PPC_SCOM) += opal-xscom.o
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
index cf42e74514fa..02245cee7818 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -59,26 +59,60 @@ static struct notifier_block ioda_eeh_nb = {
59}; 59};
60 60
61#ifdef CONFIG_DEBUG_FS 61#ifdef CONFIG_DEBUG_FS
62static int ioda_eeh_dbgfs_set(void *data, u64 val) 62static int ioda_eeh_dbgfs_set(void *data, int offset, u64 val)
63{ 63{
64 struct pci_controller *hose = data; 64 struct pci_controller *hose = data;
65 struct pnv_phb *phb = hose->private_data; 65 struct pnv_phb *phb = hose->private_data;
66 66
67 out_be64(phb->regs + 0xD10, val); 67 out_be64(phb->regs + offset, val);
68 return 0; 68 return 0;
69} 69}
70 70
71static int ioda_eeh_dbgfs_get(void *data, u64 *val) 71static int ioda_eeh_dbgfs_get(void *data, int offset, u64 *val)
72{ 72{
73 struct pci_controller *hose = data; 73 struct pci_controller *hose = data;
74 struct pnv_phb *phb = hose->private_data; 74 struct pnv_phb *phb = hose->private_data;
75 75
76 *val = in_be64(phb->regs + 0xD10); 76 *val = in_be64(phb->regs + offset);
77 return 0; 77 return 0;
78} 78}
79 79
80DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_dbgfs_ops, ioda_eeh_dbgfs_get, 80static int ioda_eeh_outb_dbgfs_set(void *data, u64 val)
81 ioda_eeh_dbgfs_set, "0x%llx\n"); 81{
82 return ioda_eeh_dbgfs_set(data, 0xD10, val);
83}
84
85static int ioda_eeh_outb_dbgfs_get(void *data, u64 *val)
86{
87 return ioda_eeh_dbgfs_get(data, 0xD10, val);
88}
89
90static int ioda_eeh_inbA_dbgfs_set(void *data, u64 val)
91{
92 return ioda_eeh_dbgfs_set(data, 0xD90, val);
93}
94
95static int ioda_eeh_inbA_dbgfs_get(void *data, u64 *val)
96{
97 return ioda_eeh_dbgfs_get(data, 0xD90, val);
98}
99
100static int ioda_eeh_inbB_dbgfs_set(void *data, u64 val)
101{
102 return ioda_eeh_dbgfs_set(data, 0xE10, val);
103}
104
105static int ioda_eeh_inbB_dbgfs_get(void *data, u64 *val)
106{
107 return ioda_eeh_dbgfs_get(data, 0xE10, val);
108}
109
110DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_outb_dbgfs_ops, ioda_eeh_outb_dbgfs_get,
111 ioda_eeh_outb_dbgfs_set, "0x%llx\n");
112DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_inbA_dbgfs_ops, ioda_eeh_inbA_dbgfs_get,
113 ioda_eeh_inbA_dbgfs_set, "0x%llx\n");
114DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_inbB_dbgfs_ops, ioda_eeh_inbB_dbgfs_get,
115 ioda_eeh_inbB_dbgfs_set, "0x%llx\n");
82#endif /* CONFIG_DEBUG_FS */ 116#endif /* CONFIG_DEBUG_FS */
83 117
84/** 118/**
@@ -106,27 +140,30 @@ static int ioda_eeh_post_init(struct pci_controller *hose)
106 ioda_eeh_nb_init = 1; 140 ioda_eeh_nb_init = 1;
107 } 141 }
108 142
109 /* FIXME: Enable it for PHB3 later */ 143 /* We needn't HUB diag-data on PHB3 */
110 if (phb->type == PNV_PHB_IODA1) { 144 if (phb->type == PNV_PHB_IODA1 && !hub_diag) {
145 hub_diag = (char *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
111 if (!hub_diag) { 146 if (!hub_diag) {
112 hub_diag = (char *)__get_free_page(GFP_KERNEL | 147 pr_err("%s: Out of memory !\n", __func__);
113 __GFP_ZERO); 148 return -ENOMEM;
114 if (!hub_diag) {
115 pr_err("%s: Out of memory !\n",
116 __func__);
117 return -ENOMEM;
118 }
119 } 149 }
150 }
120 151
121#ifdef CONFIG_DEBUG_FS 152#ifdef CONFIG_DEBUG_FS
122 if (phb->dbgfs) 153 if (phb->dbgfs) {
123 debugfs_create_file("err_injct", 0600, 154 debugfs_create_file("err_injct_outbound", 0600,
124 phb->dbgfs, hose, 155 phb->dbgfs, hose,
125 &ioda_eeh_dbgfs_ops); 156 &ioda_eeh_outb_dbgfs_ops);
157 debugfs_create_file("err_injct_inboundA", 0600,
158 phb->dbgfs, hose,
159 &ioda_eeh_inbA_dbgfs_ops);
160 debugfs_create_file("err_injct_inboundB", 0600,
161 phb->dbgfs, hose,
162 &ioda_eeh_inbB_dbgfs_ops);
163 }
126#endif 164#endif
127 165
128 phb->eeh_state |= PNV_EEH_STATE_ENABLED; 166 phb->eeh_state |= PNV_EEH_STATE_ENABLED;
129 }
130 167
131 return 0; 168 return 0;
132} 169}
@@ -546,8 +583,8 @@ static int ioda_eeh_get_log(struct eeh_pe *pe, int severity,
546 phb->diag.blob, PNV_PCI_DIAG_BUF_SIZE); 583 phb->diag.blob, PNV_PCI_DIAG_BUF_SIZE);
547 if (ret) { 584 if (ret) {
548 spin_unlock_irqrestore(&phb->lock, flags); 585 spin_unlock_irqrestore(&phb->lock, flags);
549 pr_warning("%s: Failed to get log for PHB#%x-PE#%x\n", 586 pr_warning("%s: Can't get log for PHB#%x-PE#%x (%lld)\n",
550 __func__, hose->global_number, pe->addr); 587 __func__, hose->global_number, pe->addr, ret);
551 return -EIO; 588 return -EIO;
552 } 589 }
553 590
@@ -710,6 +747,73 @@ static void ioda_eeh_p7ioc_phb_diag(struct pci_controller *hose,
710 } 747 }
711} 748}
712 749
750static void ioda_eeh_phb3_phb_diag(struct pci_controller *hose,
751 struct OpalIoPhbErrorCommon *common)
752{
753 struct OpalIoPhb3ErrorData *data;
754 int i;
755
756 data = (struct OpalIoPhb3ErrorData*)common;
757 pr_info("PHB3 PHB#%x Diag-data (Version: %d)\n\n",
758 hose->global_number, common->version);
759
760 pr_info(" brdgCtl: %08x\n", data->brdgCtl);
761
762 pr_info(" portStatusReg: %08x\n", data->portStatusReg);
763 pr_info(" rootCmplxStatus: %08x\n", data->rootCmplxStatus);
764 pr_info(" busAgentStatus: %08x\n", data->busAgentStatus);
765
766 pr_info(" deviceStatus: %08x\n", data->deviceStatus);
767 pr_info(" slotStatus: %08x\n", data->slotStatus);
768 pr_info(" linkStatus: %08x\n", data->linkStatus);
769 pr_info(" devCmdStatus: %08x\n", data->devCmdStatus);
770 pr_info(" devSecStatus: %08x\n", data->devSecStatus);
771
772 pr_info(" rootErrorStatus: %08x\n", data->rootErrorStatus);
773 pr_info(" uncorrErrorStatus: %08x\n", data->uncorrErrorStatus);
774 pr_info(" corrErrorStatus: %08x\n", data->corrErrorStatus);
775 pr_info(" tlpHdr1: %08x\n", data->tlpHdr1);
776 pr_info(" tlpHdr2: %08x\n", data->tlpHdr2);
777 pr_info(" tlpHdr3: %08x\n", data->tlpHdr3);
778 pr_info(" tlpHdr4: %08x\n", data->tlpHdr4);
779 pr_info(" sourceId: %08x\n", data->sourceId);
780 pr_info(" errorClass: %016llx\n", data->errorClass);
781 pr_info(" correlator: %016llx\n", data->correlator);
782 pr_info(" nFir: %016llx\n", data->nFir);
783 pr_info(" nFirMask: %016llx\n", data->nFirMask);
784 pr_info(" nFirWOF: %016llx\n", data->nFirWOF);
785 pr_info(" PhbPlssr: %016llx\n", data->phbPlssr);
786 pr_info(" PhbCsr: %016llx\n", data->phbCsr);
787 pr_info(" lemFir: %016llx\n", data->lemFir);
788 pr_info(" lemErrorMask: %016llx\n", data->lemErrorMask);
789 pr_info(" lemWOF: %016llx\n", data->lemWOF);
790 pr_info(" phbErrorStatus: %016llx\n", data->phbErrorStatus);
791 pr_info(" phbFirstErrorStatus: %016llx\n", data->phbFirstErrorStatus);
792 pr_info(" phbErrorLog0: %016llx\n", data->phbErrorLog0);
793 pr_info(" phbErrorLog1: %016llx\n", data->phbErrorLog1);
794 pr_info(" mmioErrorStatus: %016llx\n", data->mmioErrorStatus);
795 pr_info(" mmioFirstErrorStatus: %016llx\n", data->mmioFirstErrorStatus);
796 pr_info(" mmioErrorLog0: %016llx\n", data->mmioErrorLog0);
797 pr_info(" mmioErrorLog1: %016llx\n", data->mmioErrorLog1);
798 pr_info(" dma0ErrorStatus: %016llx\n", data->dma0ErrorStatus);
799 pr_info(" dma0FirstErrorStatus: %016llx\n", data->dma0FirstErrorStatus);
800 pr_info(" dma0ErrorLog0: %016llx\n", data->dma0ErrorLog0);
801 pr_info(" dma0ErrorLog1: %016llx\n", data->dma0ErrorLog1);
802 pr_info(" dma1ErrorStatus: %016llx\n", data->dma1ErrorStatus);
803 pr_info(" dma1FirstErrorStatus: %016llx\n", data->dma1FirstErrorStatus);
804 pr_info(" dma1ErrorLog0: %016llx\n", data->dma1ErrorLog0);
805 pr_info(" dma1ErrorLog1: %016llx\n", data->dma1ErrorLog1);
806
807 for (i = 0; i < OPAL_PHB3_NUM_PEST_REGS; i++) {
808 if ((data->pestA[i] >> 63) == 0 &&
809 (data->pestB[i] >> 63) == 0)
810 continue;
811
812 pr_info(" PE[%3d] PESTA: %016llx\n", i, data->pestA[i]);
813 pr_info(" PESTB: %016llx\n", data->pestB[i]);
814 }
815}
816
713static void ioda_eeh_phb_diag(struct pci_controller *hose) 817static void ioda_eeh_phb_diag(struct pci_controller *hose)
714{ 818{
715 struct pnv_phb *phb = hose->private_data; 819 struct pnv_phb *phb = hose->private_data;
@@ -728,6 +832,9 @@ static void ioda_eeh_phb_diag(struct pci_controller *hose)
728 case OPAL_PHB_ERROR_DATA_TYPE_P7IOC: 832 case OPAL_PHB_ERROR_DATA_TYPE_P7IOC:
729 ioda_eeh_p7ioc_phb_diag(hose, common); 833 ioda_eeh_p7ioc_phb_diag(hose, common);
730 break; 834 break;
835 case OPAL_PHB_ERROR_DATA_TYPE_PHB3:
836 ioda_eeh_phb3_phb_diag(hose, common);
837 break;
731 default: 838 default:
732 pr_warning("%s: Unrecognized I/O chip %d\n", 839 pr_warning("%s: Unrecognized I/O chip %d\n",
733 __func__, common->ioType); 840 __func__, common->ioType);
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
index 79663d26e6ea..73b981438cc5 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -144,11 +144,8 @@ static int powernv_eeh_dev_probe(struct pci_dev *dev, void *flag)
144 /* 144 /*
145 * Enable EEH explicitly so that we will do EEH check 145 * Enable EEH explicitly so that we will do EEH check
146 * while accessing I/O stuff 146 * while accessing I/O stuff
147 *
148 * FIXME: Enable that for PHB3 later
149 */ 147 */
150 if (phb->type == PNV_PHB_IODA1) 148 eeh_subsystem_enabled = 1;
151 eeh_subsystem_enabled = 1;
152 149
153 /* Save memory bars */ 150 /* Save memory bars */
154 eeh_save_bars(edev); 151 eeh_save_bars(edev);
diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c
new file mode 100644
index 000000000000..6ffa6b1ec5b7
--- /dev/null
+++ b/arch/powerpc/platforms/powernv/opal-flash.c
@@ -0,0 +1,667 @@
1/*
2 * PowerNV OPAL Firmware Update Interface
3 *
4 * Copyright 2013 IBM Corp.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#define DEBUG
13
14#include <linux/kernel.h>
15#include <linux/reboot.h>
16#include <linux/init.h>
17#include <linux/kobject.h>
18#include <linux/sysfs.h>
19#include <linux/slab.h>
20#include <linux/mm.h>
21#include <linux/vmalloc.h>
22#include <linux/pagemap.h>
23
24#include <asm/opal.h>
25
26/* FLASH status codes */
27#define FLASH_NO_OP -1099 /* No operation initiated by user */
28#define FLASH_NO_AUTH -9002 /* Not a service authority partition */
29
30/* Validate image status values */
31#define VALIDATE_IMG_READY -1001 /* Image ready for validation */
32#define VALIDATE_IMG_INCOMPLETE -1002 /* User copied < VALIDATE_BUF_SIZE */
33
34/* Manage image status values */
35#define MANAGE_ACTIVE_ERR -9001 /* Cannot overwrite active img */
36
37/* Flash image status values */
38#define FLASH_IMG_READY 0 /* Img ready for flash on reboot */
39#define FLASH_INVALID_IMG -1003 /* Flash image shorter than expected */
40#define FLASH_IMG_NULL_DATA -1004 /* Bad data in sg list entry */
41#define FLASH_IMG_BAD_LEN -1005 /* Bad length in sg list entry */
42
43/* Manage operation tokens */
44#define FLASH_REJECT_TMP_SIDE 0 /* Reject temporary fw image */
45#define FLASH_COMMIT_TMP_SIDE 1 /* Commit temporary fw image */
46
47/* Update tokens */
48#define FLASH_UPDATE_CANCEL 0 /* Cancel update request */
49#define FLASH_UPDATE_INIT 1 /* Initiate update */
50
51/* Validate image update result tokens */
52#define VALIDATE_TMP_UPDATE 0 /* T side will be updated */
53#define VALIDATE_FLASH_AUTH 1 /* Partition does not have authority */
54#define VALIDATE_INVALID_IMG 2 /* Candidate image is not valid */
55#define VALIDATE_CUR_UNKNOWN 3 /* Current fixpack level is unknown */
56/*
57 * Current T side will be committed to P side before being replace with new
58 * image, and the new image is downlevel from current image
59 */
60#define VALIDATE_TMP_COMMIT_DL 4
61/*
62 * Current T side will be committed to P side before being replaced with new
63 * image
64 */
65#define VALIDATE_TMP_COMMIT 5
66/*
67 * T side will be updated with a downlevel image
68 */
69#define VALIDATE_TMP_UPDATE_DL 6
70/*
71 * The candidate image's release date is later than the system's firmware
72 * service entitlement date - service warranty period has expired
73 */
74#define VALIDATE_OUT_OF_WRNTY 7
75
76/* Validate buffer size */
77#define VALIDATE_BUF_SIZE 4096
78
79/* XXX: Assume candidate image size is <= 256MB */
80#define MAX_IMAGE_SIZE 0x10000000
81
82/* Flash sg list version */
83#define SG_LIST_VERSION (1UL)
84
85/* Image status */
86enum {
87 IMAGE_INVALID,
88 IMAGE_LOADING,
89 IMAGE_READY,
90};
91
92/* Candidate image data */
93struct image_data_t {
94 int status;
95 void *data;
96 uint32_t size;
97};
98
99/* Candidate image header */
100struct image_header_t {
101 uint16_t magic;
102 uint16_t version;
103 uint32_t size;
104};
105
106/* Scatter/gather entry */
107struct opal_sg_entry {
108 void *data;
109 long length;
110};
111
112/* We calculate number of entries based on PAGE_SIZE */
113#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
114
115/*
116 * This struct is very similar but not identical to that
117 * needed by the opal flash update. All we need to do for
118 * opal is rewrite num_entries into a version/length and
119 * translate the pointers to absolute.
120 */
121struct opal_sg_list {
122 unsigned long num_entries;
123 struct opal_sg_list *next;
124 struct opal_sg_entry entry[SG_ENTRIES_PER_NODE];
125};
126
127struct validate_flash_t {
128 int status; /* Return status */
129 void *buf; /* Candiate image buffer */
130 uint32_t buf_size; /* Image size */
131 uint32_t result; /* Update results token */
132};
133
134struct manage_flash_t {
135 int status; /* Return status */
136};
137
138struct update_flash_t {
139 int status; /* Return status */
140};
141
142static struct image_header_t image_header;
143static struct image_data_t image_data;
144static struct validate_flash_t validate_flash_data;
145static struct manage_flash_t manage_flash_data;
146static struct update_flash_t update_flash_data;
147
148static DEFINE_MUTEX(image_data_mutex);
149
150/*
151 * Validate candidate image
152 */
153static inline void opal_flash_validate(void)
154{
155 struct validate_flash_t *args_buf = &validate_flash_data;
156
157 args_buf->status = opal_validate_flash(__pa(args_buf->buf),
158 &(args_buf->buf_size),
159 &(args_buf->result));
160}
161
162/*
163 * Validate output format:
164 * validate result token
165 * current image version details
166 * new image version details
167 */
168static ssize_t validate_show(struct kobject *kobj,
169 struct kobj_attribute *attr, char *buf)
170{
171 struct validate_flash_t *args_buf = &validate_flash_data;
172 int len;
173
174 /* Candidate image is not validated */
175 if (args_buf->status < VALIDATE_TMP_UPDATE) {
176 len = sprintf(buf, "%d\n", args_buf->status);
177 goto out;
178 }
179
180 /* Result token */
181 len = sprintf(buf, "%d\n", args_buf->result);
182
183 /* Current and candidate image version details */
184 if ((args_buf->result != VALIDATE_TMP_UPDATE) &&
185 (args_buf->result < VALIDATE_CUR_UNKNOWN))
186 goto out;
187
188 if (args_buf->buf_size > (VALIDATE_BUF_SIZE - len)) {
189 memcpy(buf + len, args_buf->buf, VALIDATE_BUF_SIZE - len);
190 len = VALIDATE_BUF_SIZE;
191 } else {
192 memcpy(buf + len, args_buf->buf, args_buf->buf_size);
193 len += args_buf->buf_size;
194 }
195out:
196 /* Set status to default */
197 args_buf->status = FLASH_NO_OP;
198 return len;
199}
200
201/*
202 * Validate candidate firmware image
203 *
204 * Note:
205 * We are only interested in first 4K bytes of the
206 * candidate image.
207 */
208static ssize_t validate_store(struct kobject *kobj,
209 struct kobj_attribute *attr,
210 const char *buf, size_t count)
211{
212 struct validate_flash_t *args_buf = &validate_flash_data;
213
214 if (buf[0] != '1')
215 return -EINVAL;
216
217 mutex_lock(&image_data_mutex);
218
219 if (image_data.status != IMAGE_READY ||
220 image_data.size < VALIDATE_BUF_SIZE) {
221 args_buf->result = VALIDATE_INVALID_IMG;
222 args_buf->status = VALIDATE_IMG_INCOMPLETE;
223 goto out;
224 }
225
226 /* Copy first 4k bytes of candidate image */
227 memcpy(args_buf->buf, image_data.data, VALIDATE_BUF_SIZE);
228
229 args_buf->status = VALIDATE_IMG_READY;
230 args_buf->buf_size = VALIDATE_BUF_SIZE;
231
232 /* Validate candidate image */
233 opal_flash_validate();
234
235out:
236 mutex_unlock(&image_data_mutex);
237 return count;
238}
239
240/*
241 * Manage flash routine
242 */
243static inline void opal_flash_manage(uint8_t op)
244{
245 struct manage_flash_t *const args_buf = &manage_flash_data;
246
247 args_buf->status = opal_manage_flash(op);
248}
249
250/*
251 * Show manage flash status
252 */
253static ssize_t manage_show(struct kobject *kobj,
254 struct kobj_attribute *attr, char *buf)
255{
256 struct manage_flash_t *const args_buf = &manage_flash_data;
257 int rc;
258
259 rc = sprintf(buf, "%d\n", args_buf->status);
260 /* Set status to default*/
261 args_buf->status = FLASH_NO_OP;
262 return rc;
263}
264
265/*
266 * Manage operations:
267 * 0 - Reject
268 * 1 - Commit
269 */
270static ssize_t manage_store(struct kobject *kobj,
271 struct kobj_attribute *attr,
272 const char *buf, size_t count)
273{
274 uint8_t op;
275 switch (buf[0]) {
276 case '0':
277 op = FLASH_REJECT_TMP_SIDE;
278 break;
279 case '1':
280 op = FLASH_COMMIT_TMP_SIDE;
281 break;
282 default:
283 return -EINVAL;
284 }
285
286 /* commit/reject temporary image */
287 opal_flash_manage(op);
288 return count;
289}
290
291/*
292 * Free sg list
293 */
294static void free_sg_list(struct opal_sg_list *list)
295{
296 struct opal_sg_list *sg1;
297 while (list) {
298 sg1 = list->next;
299 kfree(list);
300 list = sg1;
301 }
302 list = NULL;
303}
304
305/*
306 * Build candidate image scatter gather list
307 *
308 * list format:
309 * -----------------------------------
310 * | VER (8) | Entry length in bytes |
311 * -----------------------------------
312 * | Pointer to next entry |
313 * -----------------------------------
314 * | Address of memory area 1 |
315 * -----------------------------------
316 * | Length of memory area 1 |
317 * -----------------------------------
318 * | ......... |
319 * -----------------------------------
320 * | ......... |
321 * -----------------------------------
322 * | Address of memory area N |
323 * -----------------------------------
324 * | Length of memory area N |
325 * -----------------------------------
326 */
327static struct opal_sg_list *image_data_to_sglist(void)
328{
329 struct opal_sg_list *sg1, *list = NULL;
330 void *addr;
331 int size;
332
333 addr = image_data.data;
334 size = image_data.size;
335
336 sg1 = kzalloc((sizeof(struct opal_sg_list)), GFP_KERNEL);
337 if (!sg1)
338 return NULL;
339
340 list = sg1;
341 sg1->num_entries = 0;
342 while (size > 0) {
343 /* Translate virtual address to physical address */
344 sg1->entry[sg1->num_entries].data =
345 (void *)(vmalloc_to_pfn(addr) << PAGE_SHIFT);
346
347 if (size > PAGE_SIZE)
348 sg1->entry[sg1->num_entries].length = PAGE_SIZE;
349 else
350 sg1->entry[sg1->num_entries].length = size;
351
352 sg1->num_entries++;
353 if (sg1->num_entries >= SG_ENTRIES_PER_NODE) {
354 sg1->next = kzalloc((sizeof(struct opal_sg_list)),
355 GFP_KERNEL);
356 if (!sg1->next) {
357 pr_err("%s : Failed to allocate memory\n",
358 __func__);
359 goto nomem;
360 }
361
362 sg1 = sg1->next;
363 sg1->num_entries = 0;
364 }
365 addr += PAGE_SIZE;
366 size -= PAGE_SIZE;
367 }
368 return list;
369nomem:
370 free_sg_list(list);
371 return NULL;
372}
373
374/*
375 * OPAL update flash
376 */
377static int opal_flash_update(int op)
378{
379 struct opal_sg_list *sg, *list, *next;
380 unsigned long addr;
381 int64_t rc = OPAL_PARAMETER;
382
383 if (op == FLASH_UPDATE_CANCEL) {
384 pr_alert("FLASH: Image update cancelled\n");
385 addr = '\0';
386 goto flash;
387 }
388
389 list = image_data_to_sglist();
390 if (!list)
391 goto invalid_img;
392
393 /* First entry address */
394 addr = __pa(list);
395
396 /* Translate sg list address to absolute */
397 for (sg = list; sg; sg = next) {
398 next = sg->next;
399 /* Don't translate NULL pointer for last entry */
400 if (sg->next)
401 sg->next = (struct opal_sg_list *)__pa(sg->next);
402 else
403 sg->next = NULL;
404
405 /* Make num_entries into the version/length field */
406 sg->num_entries = (SG_LIST_VERSION << 56) |
407 (sg->num_entries * sizeof(struct opal_sg_entry) + 16);
408 }
409
410 pr_alert("FLASH: Image is %u bytes\n", image_data.size);
411 pr_alert("FLASH: Image update requested\n");
412 pr_alert("FLASH: Image will be updated during system reboot\n");
413 pr_alert("FLASH: This will take several minutes. Do not power off!\n");
414
415flash:
416 rc = opal_update_flash(addr);
417
418invalid_img:
419 return rc;
420}
421
422/*
423 * Show candidate image status
424 */
425static ssize_t update_show(struct kobject *kobj,
426 struct kobj_attribute *attr, char *buf)
427{
428 struct update_flash_t *const args_buf = &update_flash_data;
429 return sprintf(buf, "%d\n", args_buf->status);
430}
431
432/*
433 * Set update image flag
434 * 1 - Flash new image
435 * 0 - Cancel flash request
436 */
437static ssize_t update_store(struct kobject *kobj,
438 struct kobj_attribute *attr,
439 const char *buf, size_t count)
440{
441 struct update_flash_t *const args_buf = &update_flash_data;
442 int rc = count;
443
444 mutex_lock(&image_data_mutex);
445
446 switch (buf[0]) {
447 case '0':
448 if (args_buf->status == FLASH_IMG_READY)
449 opal_flash_update(FLASH_UPDATE_CANCEL);
450 args_buf->status = FLASH_NO_OP;
451 break;
452 case '1':
453 /* Image is loaded? */
454 if (image_data.status == IMAGE_READY)
455 args_buf->status =
456 opal_flash_update(FLASH_UPDATE_INIT);
457 else
458 args_buf->status = FLASH_INVALID_IMG;
459 break;
460 default:
461 rc = -EINVAL;
462 }
463
464 mutex_unlock(&image_data_mutex);
465 return rc;
466}
467
468/*
469 * Free image buffer
470 */
471static void free_image_buf(void)
472{
473 void *addr;
474 int size;
475
476 addr = image_data.data;
477 size = PAGE_ALIGN(image_data.size);
478 while (size > 0) {
479 ClearPageReserved(vmalloc_to_page(addr));
480 addr += PAGE_SIZE;
481 size -= PAGE_SIZE;
482 }
483 vfree(image_data.data);
484 image_data.data = NULL;
485 image_data.status = IMAGE_INVALID;
486}
487
488/*
489 * Allocate image buffer.
490 */
491static int alloc_image_buf(char *buffer, size_t count)
492{
493 void *addr;
494 int size;
495
496 if (count < sizeof(struct image_header_t)) {
497 pr_warn("FLASH: Invalid candidate image\n");
498 return -EINVAL;
499 }
500
501 memcpy(&image_header, (void *)buffer, sizeof(struct image_header_t));
502 image_data.size = be32_to_cpu(image_header.size);
503 pr_debug("FLASH: Candiate image size = %u\n", image_data.size);
504
505 if (image_data.size > MAX_IMAGE_SIZE) {
506 pr_warn("FLASH: Too large image\n");
507 return -EINVAL;
508 }
509 if (image_data.size < VALIDATE_BUF_SIZE) {
510 pr_warn("FLASH: Image is shorter than expected\n");
511 return -EINVAL;
512 }
513
514 image_data.data = vzalloc(PAGE_ALIGN(image_data.size));
515 if (!image_data.data) {
516 pr_err("%s : Failed to allocate memory\n", __func__);
517 return -ENOMEM;
518 }
519
520 /* Pin memory */
521 addr = image_data.data;
522 size = PAGE_ALIGN(image_data.size);
523 while (size > 0) {
524 SetPageReserved(vmalloc_to_page(addr));
525 addr += PAGE_SIZE;
526 size -= PAGE_SIZE;
527 }
528
529 image_data.status = IMAGE_LOADING;
530 return 0;
531}
532
533/*
534 * Copy candidate image
535 *
536 * Parse candidate image header to get total image size
537 * and pre-allocate required memory.
538 */
539static ssize_t image_data_write(struct file *filp, struct kobject *kobj,
540 struct bin_attribute *bin_attr,
541 char *buffer, loff_t pos, size_t count)
542{
543 int rc;
544
545 mutex_lock(&image_data_mutex);
546
547 /* New image ? */
548 if (pos == 0) {
549 /* Free memory, if already allocated */
550 if (image_data.data)
551 free_image_buf();
552
553 /* Cancel outstanding image update request */
554 if (update_flash_data.status == FLASH_IMG_READY)
555 opal_flash_update(FLASH_UPDATE_CANCEL);
556
557 /* Allocate memory */
558 rc = alloc_image_buf(buffer, count);
559 if (rc)
560 goto out;
561 }
562
563 if (image_data.status != IMAGE_LOADING) {
564 rc = -ENOMEM;
565 goto out;
566 }
567
568 if ((pos + count) > image_data.size) {
569 rc = -EINVAL;
570 goto out;
571 }
572
573 memcpy(image_data.data + pos, (void *)buffer, count);
574 rc = count;
575
576 /* Set image status */
577 if ((pos + count) == image_data.size) {
578 pr_debug("FLASH: Candidate image loaded....\n");
579 image_data.status = IMAGE_READY;
580 }
581
582out:
583 mutex_unlock(&image_data_mutex);
584 return rc;
585}
586
587/*
588 * sysfs interface :
589 * OPAL uses below sysfs files for code update.
590 * We create these files under /sys/firmware/opal.
591 *
592 * image : Interface to load candidate firmware image
593 * validate_flash : Validate firmware image
594 * manage_flash : Commit/Reject firmware image
595 * update_flash : Flash new firmware image
596 *
597 */
598static struct bin_attribute image_data_attr = {
599 .attr = {.name = "image", .mode = 0200},
600 .size = MAX_IMAGE_SIZE, /* Limit image size */
601 .write = image_data_write,
602};
603
604static struct kobj_attribute validate_attribute =
605 __ATTR(validate_flash, 0600, validate_show, validate_store);
606
607static struct kobj_attribute manage_attribute =
608 __ATTR(manage_flash, 0600, manage_show, manage_store);
609
610static struct kobj_attribute update_attribute =
611 __ATTR(update_flash, 0600, update_show, update_store);
612
613static struct attribute *image_op_attrs[] = {
614 &validate_attribute.attr,
615 &manage_attribute.attr,
616 &update_attribute.attr,
617 NULL /* need to NULL terminate the list of attributes */
618};
619
620static struct attribute_group image_op_attr_group = {
621 .attrs = image_op_attrs,
622};
623
624void __init opal_flash_init(void)
625{
626 int ret;
627
628 /* Allocate validate image buffer */
629 validate_flash_data.buf = kzalloc(VALIDATE_BUF_SIZE, GFP_KERNEL);
630 if (!validate_flash_data.buf) {
631 pr_err("%s : Failed to allocate memory\n", __func__);
632 return;
633 }
634
635 /* Make sure /sys/firmware/opal directory is created */
636 if (!opal_kobj) {
637 pr_warn("FLASH: opal kobject is not available\n");
638 goto nokobj;
639 }
640
641 /* Create the sysfs files */
642 ret = sysfs_create_group(opal_kobj, &image_op_attr_group);
643 if (ret) {
644 pr_warn("FLASH: Failed to create sysfs files\n");
645 goto nokobj;
646 }
647
648 ret = sysfs_create_bin_file(opal_kobj, &image_data_attr);
649 if (ret) {
650 pr_warn("FLASH: Failed to create sysfs files\n");
651 goto nosysfs_file;
652 }
653
654 /* Set default status */
655 validate_flash_data.status = FLASH_NO_OP;
656 manage_flash_data.status = FLASH_NO_OP;
657 update_flash_data.status = FLASH_NO_OP;
658 image_data.status = IMAGE_INVALID;
659 return;
660
661nosysfs_file:
662 sysfs_remove_group(opal_kobj, &image_op_attr_group);
663
664nokobj:
665 kfree(validate_flash_data.buf);
666 return;
667}
diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c
index a7614bb14e17..e7e59e4f9892 100644
--- a/arch/powerpc/platforms/powernv/opal-lpc.c
+++ b/arch/powerpc/platforms/powernv/opal-lpc.c
@@ -17,6 +17,7 @@
17#include <asm/firmware.h> 17#include <asm/firmware.h>
18#include <asm/xics.h> 18#include <asm/xics.h>
19#include <asm/opal.h> 19#include <asm/opal.h>
20#include <asm/prom.h>
20 21
21static int opal_lpc_chip_id = -1; 22static int opal_lpc_chip_id = -1;
22 23
diff --git a/arch/powerpc/platforms/powernv/opal-nvram.c b/arch/powerpc/platforms/powernv/opal-nvram.c
index 3f83e1ae26ac..acd9f7e96678 100644
--- a/arch/powerpc/platforms/powernv/opal-nvram.c
+++ b/arch/powerpc/platforms/powernv/opal-nvram.c
@@ -65,7 +65,7 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index)
65void __init opal_nvram_init(void) 65void __init opal_nvram_init(void)
66{ 66{
67 struct device_node *np; 67 struct device_node *np;
68 const u32 *nbytes_p; 68 const __be32 *nbytes_p;
69 69
70 np = of_find_compatible_node(NULL, NULL, "ibm,opal-nvram"); 70 np = of_find_compatible_node(NULL, NULL, "ibm,opal-nvram");
71 if (np == NULL) 71 if (np == NULL)
@@ -76,7 +76,7 @@ void __init opal_nvram_init(void)
76 of_node_put(np); 76 of_node_put(np);
77 return; 77 return;
78 } 78 }
79 nvram_size = *nbytes_p; 79 nvram_size = be32_to_cpup(nbytes_p);
80 80
81 printk(KERN_INFO "OPAL nvram setup, %u bytes\n", nvram_size); 81 printk(KERN_INFO "OPAL nvram setup, %u bytes\n", nvram_size);
82 of_node_put(np); 82 of_node_put(np);
diff --git a/arch/powerpc/platforms/powernv/opal-rtc.c b/arch/powerpc/platforms/powernv/opal-rtc.c
index 2aa7641aac9b..7d07c7e80ec0 100644
--- a/arch/powerpc/platforms/powernv/opal-rtc.c
+++ b/arch/powerpc/platforms/powernv/opal-rtc.c
@@ -37,10 +37,12 @@ unsigned long __init opal_get_boot_time(void)
37 struct rtc_time tm; 37 struct rtc_time tm;
38 u32 y_m_d; 38 u32 y_m_d;
39 u64 h_m_s_ms; 39 u64 h_m_s_ms;
40 __be32 __y_m_d;
41 __be64 __h_m_s_ms;
40 long rc = OPAL_BUSY; 42 long rc = OPAL_BUSY;
41 43
42 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { 44 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
43 rc = opal_rtc_read(&y_m_d, &h_m_s_ms); 45 rc = opal_rtc_read(&__y_m_d, &__h_m_s_ms);
44 if (rc == OPAL_BUSY_EVENT) 46 if (rc == OPAL_BUSY_EVENT)
45 opal_poll_events(NULL); 47 opal_poll_events(NULL);
46 else 48 else
@@ -48,6 +50,8 @@ unsigned long __init opal_get_boot_time(void)
48 } 50 }
49 if (rc != OPAL_SUCCESS) 51 if (rc != OPAL_SUCCESS)
50 return 0; 52 return 0;
53 y_m_d = be32_to_cpu(__y_m_d);
54 h_m_s_ms = be64_to_cpu(__h_m_s_ms);
51 opal_to_tm(y_m_d, h_m_s_ms, &tm); 55 opal_to_tm(y_m_d, h_m_s_ms, &tm);
52 return mktime(tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 56 return mktime(tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
53 tm.tm_hour, tm.tm_min, tm.tm_sec); 57 tm.tm_hour, tm.tm_min, tm.tm_sec);
@@ -58,9 +62,11 @@ void opal_get_rtc_time(struct rtc_time *tm)
58 long rc = OPAL_BUSY; 62 long rc = OPAL_BUSY;
59 u32 y_m_d; 63 u32 y_m_d;
60 u64 h_m_s_ms; 64 u64 h_m_s_ms;
65 __be32 __y_m_d;
66 __be64 __h_m_s_ms;
61 67
62 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { 68 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
63 rc = opal_rtc_read(&y_m_d, &h_m_s_ms); 69 rc = opal_rtc_read(&__y_m_d, &__h_m_s_ms);
64 if (rc == OPAL_BUSY_EVENT) 70 if (rc == OPAL_BUSY_EVENT)
65 opal_poll_events(NULL); 71 opal_poll_events(NULL);
66 else 72 else
@@ -68,6 +74,8 @@ void opal_get_rtc_time(struct rtc_time *tm)
68 } 74 }
69 if (rc != OPAL_SUCCESS) 75 if (rc != OPAL_SUCCESS)
70 return; 76 return;
77 y_m_d = be32_to_cpu(__y_m_d);
78 h_m_s_ms = be64_to_cpu(__h_m_s_ms);
71 opal_to_tm(y_m_d, h_m_s_ms, tm); 79 opal_to_tm(y_m_d, h_m_s_ms, tm);
72} 80}
73 81
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index 8f3844535fbb..e7806504e976 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -24,7 +24,7 @@
24 mflr r0; \ 24 mflr r0; \
25 mfcr r12; \ 25 mfcr r12; \
26 std r0,16(r1); \ 26 std r0,16(r1); \
27 std r12,8(r1); \ 27 stw r12,8(r1); \
28 std r1,PACAR1(r13); \ 28 std r1,PACAR1(r13); \
29 li r0,0; \ 29 li r0,0; \
30 mfmsr r12; \ 30 mfmsr r12; \
@@ -34,7 +34,7 @@
34 mtmsrd r12,1; \ 34 mtmsrd r12,1; \
35 LOAD_REG_ADDR(r0,.opal_return); \ 35 LOAD_REG_ADDR(r0,.opal_return); \
36 mtlr r0; \ 36 mtlr r0; \
37 li r0,MSR_DR|MSR_IR; \ 37 li r0,MSR_DR|MSR_IR|MSR_LE;\
38 andc r12,r12,r0; \ 38 andc r12,r12,r0; \
39 li r0,token; \ 39 li r0,token; \
40 mtspr SPRN_HSRR1,r12; \ 40 mtspr SPRN_HSRR1,r12; \
@@ -45,8 +45,15 @@
45 hrfid 45 hrfid
46 46
47_STATIC(opal_return) 47_STATIC(opal_return)
48 /*
49 * Fixup endian on OPAL return... we should be able to simplify
50 * this by instead converting the below trampoline to a set of
51 * bytes (always BE) since MSR:LE will end up fixed up as a side
52 * effect of the rfid.
53 */
54 FIXUP_ENDIAN
48 ld r2,PACATOC(r13); 55 ld r2,PACATOC(r13);
49 ld r4,8(r1); 56 lwz r4,8(r1);
50 ld r5,16(r1); 57 ld r5,16(r1);
51 ld r6,PACASAVEDMSR(r13); 58 ld r6,PACASAVEDMSR(r13);
52 mtspr SPRN_SRR0,r5; 59 mtspr SPRN_SRR0,r5;
@@ -116,3 +123,6 @@ OPAL_CALL(opal_xscom_write, OPAL_XSCOM_WRITE);
116OPAL_CALL(opal_lpc_read, OPAL_LPC_READ); 123OPAL_CALL(opal_lpc_read, OPAL_LPC_READ);
117OPAL_CALL(opal_lpc_write, OPAL_LPC_WRITE); 124OPAL_CALL(opal_lpc_write, OPAL_LPC_WRITE);
118OPAL_CALL(opal_return_cpu, OPAL_RETURN_CPU); 125OPAL_CALL(opal_return_cpu, OPAL_RETURN_CPU);
126OPAL_CALL(opal_validate_flash, OPAL_FLASH_VALIDATE);
127OPAL_CALL(opal_manage_flash, OPAL_FLASH_MANAGE);
128OPAL_CALL(opal_update_flash, OPAL_FLASH_UPDATE);
diff --git a/arch/powerpc/platforms/powernv/opal-xscom.c b/arch/powerpc/platforms/powernv/opal-xscom.c
new file mode 100644
index 000000000000..4d99a8fd55ac
--- /dev/null
+++ b/arch/powerpc/platforms/powernv/opal-xscom.c
@@ -0,0 +1,128 @@
1/*
2 * PowerNV LPC bus handling.
3 *
4 * Copyright 2013 IBM Corp.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/of.h>
14#include <linux/bug.h>
15#include <linux/gfp.h>
16#include <linux/slab.h>
17
18#include <asm/machdep.h>
19#include <asm/firmware.h>
20#include <asm/opal.h>
21#include <asm/scom.h>
22
23/*
24 * We could probably fit that inside the scom_map_t
25 * which is a void* after all but it's really too ugly
26 * so let's kmalloc it for now
27 */
28struct opal_scom_map {
29 uint32_t chip;
30 uint64_t addr;
31};
32
33static scom_map_t opal_scom_map(struct device_node *dev, u64 reg, u64 count)
34{
35 struct opal_scom_map *m;
36 const __be32 *gcid;
37
38 if (!of_get_property(dev, "scom-controller", NULL)) {
39 pr_err("%s: device %s is not a SCOM controller\n",
40 __func__, dev->full_name);
41 return SCOM_MAP_INVALID;
42 }
43 gcid = of_get_property(dev, "ibm,chip-id", NULL);
44 if (!gcid) {
45 pr_err("%s: device %s has no ibm,chip-id\n",
46 __func__, dev->full_name);
47 return SCOM_MAP_INVALID;
48 }
49 m = kmalloc(sizeof(struct opal_scom_map), GFP_KERNEL);
50 if (!m)
51 return NULL;
52 m->chip = be32_to_cpup(gcid);
53 m->addr = reg;
54
55 return (scom_map_t)m;
56}
57
58static void opal_scom_unmap(scom_map_t map)
59{
60 kfree(map);
61}
62
63static int opal_xscom_err_xlate(int64_t rc)
64{
65 switch(rc) {
66 case 0:
67 return 0;
68 /* Add more translations if necessary */
69 default:
70 return -EIO;
71 }
72}
73
74static u64 opal_scom_unmangle(u64 reg)
75{
76 /*
77 * XSCOM indirect addresses have the top bit set. Additionally
78 * the reset of the top 3 nibbles is always 0.
79 *
80 * Because the debugfs interface uses signed offsets and shifts
81 * the address left by 3, we basically cannot use the top 4 bits
82 * of the 64-bit address, and thus cannot use the indirect bit.
83 *
84 * To deal with that, we support the indirect bit being in bit
85 * 4 (IBM notation) instead of bit 0 in this API, we do the
86 * conversion here. To leave room for further xscom address
87 * expansion, we only clear out the top byte
88 *
89 */
90 if (reg & (1ull << 59))
91 reg = (reg & ~(0xffull << 56)) | (1ull << 63);
92 return reg;
93}
94
95static int opal_scom_read(scom_map_t map, u64 reg, u64 *value)
96{
97 struct opal_scom_map *m = map;
98 int64_t rc;
99
100 reg = opal_scom_unmangle(reg);
101 rc = opal_xscom_read(m->chip, m->addr + reg, (uint64_t *)__pa(value));
102 return opal_xscom_err_xlate(rc);
103}
104
105static int opal_scom_write(scom_map_t map, u64 reg, u64 value)
106{
107 struct opal_scom_map *m = map;
108 int64_t rc;
109
110 reg = opal_scom_unmangle(reg);
111 rc = opal_xscom_write(m->chip, m->addr + reg, value);
112 return opal_xscom_err_xlate(rc);
113}
114
115static const struct scom_controller opal_scom_controller = {
116 .map = opal_scom_map,
117 .unmap = opal_scom_unmap,
118 .read = opal_scom_read,
119 .write = opal_scom_write
120};
121
122static int opal_xscom_init(void)
123{
124 if (firmware_has_feature(FW_FEATURE_OPALv3))
125 scom_init(&opal_scom_controller);
126 return 0;
127}
128arch_initcall(opal_xscom_init);
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 2911abe550f1..1c798cd55372 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -13,15 +13,20 @@
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_fdt.h>
16#include <linux/of_platform.h> 17#include <linux/of_platform.h>
17#include <linux/interrupt.h> 18#include <linux/interrupt.h>
18#include <linux/notifier.h> 19#include <linux/notifier.h>
19#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/kobject.h>
20#include <asm/opal.h> 22#include <asm/opal.h>
21#include <asm/firmware.h> 23#include <asm/firmware.h>
22 24
23#include "powernv.h" 25#include "powernv.h"
24 26
27/* /sys/firmware/opal */
28struct kobject *opal_kobj;
29
25struct opal { 30struct opal {
26 u64 base; 31 u64 base;
27 u64 entry; 32 u64 entry;
@@ -77,6 +82,7 @@ int __init early_init_dt_scan_opal(unsigned long node,
77 82
78static int __init opal_register_exception_handlers(void) 83static int __init opal_register_exception_handlers(void)
79{ 84{
85#ifdef __BIG_ENDIAN__
80 u64 glue; 86 u64 glue;
81 87
82 if (!(powerpc_firmware_features & FW_FEATURE_OPAL)) 88 if (!(powerpc_firmware_features & FW_FEATURE_OPAL))
@@ -94,6 +100,7 @@ static int __init opal_register_exception_handlers(void)
94 0, glue); 100 0, glue);
95 glue += 128; 101 glue += 128;
96 opal_register_exception_handler(OPAL_SOFTPATCH_HANDLER, 0, glue); 102 opal_register_exception_handler(OPAL_SOFTPATCH_HANDLER, 0, glue);
103#endif
97 104
98 return 0; 105 return 0;
99} 106}
@@ -164,27 +171,28 @@ void opal_notifier_disable(void)
164 171
165int opal_get_chars(uint32_t vtermno, char *buf, int count) 172int opal_get_chars(uint32_t vtermno, char *buf, int count)
166{ 173{
167 s64 len, rc; 174 s64 rc;
168 u64 evt; 175 __be64 evt, len;
169 176
170 if (!opal.entry) 177 if (!opal.entry)
171 return -ENODEV; 178 return -ENODEV;
172 opal_poll_events(&evt); 179 opal_poll_events(&evt);
173 if ((evt & OPAL_EVENT_CONSOLE_INPUT) == 0) 180 if ((be64_to_cpu(evt) & OPAL_EVENT_CONSOLE_INPUT) == 0)
174 return 0; 181 return 0;
175 len = count; 182 len = cpu_to_be64(count);
176 rc = opal_console_read(vtermno, &len, buf); 183 rc = opal_console_read(vtermno, &len, buf);
177 if (rc == OPAL_SUCCESS) 184 if (rc == OPAL_SUCCESS)
178 return len; 185 return be64_to_cpu(len);
179 return 0; 186 return 0;
180} 187}
181 188
182int opal_put_chars(uint32_t vtermno, const char *data, int total_len) 189int opal_put_chars(uint32_t vtermno, const char *data, int total_len)
183{ 190{
184 int written = 0; 191 int written = 0;
192 __be64 olen;
185 s64 len, rc; 193 s64 len, rc;
186 unsigned long flags; 194 unsigned long flags;
187 u64 evt; 195 __be64 evt;
188 196
189 if (!opal.entry) 197 if (!opal.entry)
190 return -ENODEV; 198 return -ENODEV;
@@ -199,13 +207,14 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len)
199 */ 207 */
200 spin_lock_irqsave(&opal_write_lock, flags); 208 spin_lock_irqsave(&opal_write_lock, flags);
201 if (firmware_has_feature(FW_FEATURE_OPALv2)) { 209 if (firmware_has_feature(FW_FEATURE_OPALv2)) {
202 rc = opal_console_write_buffer_space(vtermno, &len); 210 rc = opal_console_write_buffer_space(vtermno, &olen);
211 len = be64_to_cpu(olen);
203 if (rc || len < total_len) { 212 if (rc || len < total_len) {
204 spin_unlock_irqrestore(&opal_write_lock, flags); 213 spin_unlock_irqrestore(&opal_write_lock, flags);
205 /* Closed -> drop characters */ 214 /* Closed -> drop characters */
206 if (rc) 215 if (rc)
207 return total_len; 216 return total_len;
208 opal_poll_events(&evt); 217 opal_poll_events(NULL);
209 return -EAGAIN; 218 return -EAGAIN;
210 } 219 }
211 } 220 }
@@ -216,8 +225,9 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len)
216 rc = OPAL_BUSY; 225 rc = OPAL_BUSY;
217 while(total_len > 0 && (rc == OPAL_BUSY || 226 while(total_len > 0 && (rc == OPAL_BUSY ||
218 rc == OPAL_BUSY_EVENT || rc == OPAL_SUCCESS)) { 227 rc == OPAL_BUSY_EVENT || rc == OPAL_SUCCESS)) {
219 len = total_len; 228 olen = cpu_to_be64(total_len);
220 rc = opal_console_write(vtermno, &len, data); 229 rc = opal_console_write(vtermno, &olen, data);
230 len = be64_to_cpu(olen);
221 231
222 /* Closed or other error drop */ 232 /* Closed or other error drop */
223 if (rc != OPAL_SUCCESS && rc != OPAL_BUSY && 233 if (rc != OPAL_SUCCESS && rc != OPAL_BUSY &&
@@ -237,7 +247,8 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len)
237 */ 247 */
238 do 248 do
239 opal_poll_events(&evt); 249 opal_poll_events(&evt);
240 while(rc == OPAL_SUCCESS && (evt & OPAL_EVENT_CONSOLE_OUTPUT)); 250 while(rc == OPAL_SUCCESS &&
251 (be64_to_cpu(evt) & OPAL_EVENT_CONSOLE_OUTPUT));
241 } 252 }
242 spin_unlock_irqrestore(&opal_write_lock, flags); 253 spin_unlock_irqrestore(&opal_write_lock, flags);
243 return written; 254 return written;
@@ -360,7 +371,7 @@ int opal_machine_check(struct pt_regs *regs)
360 371
361static irqreturn_t opal_interrupt(int irq, void *data) 372static irqreturn_t opal_interrupt(int irq, void *data)
362{ 373{
363 uint64_t events; 374 __be64 events;
364 375
365 opal_handle_interrupt(virq_to_hw(irq), &events); 376 opal_handle_interrupt(virq_to_hw(irq), &events);
366 377
@@ -369,10 +380,21 @@ static irqreturn_t opal_interrupt(int irq, void *data)
369 return IRQ_HANDLED; 380 return IRQ_HANDLED;
370} 381}
371 382
383static int opal_sysfs_init(void)
384{
385 opal_kobj = kobject_create_and_add("opal", firmware_kobj);
386 if (!opal_kobj) {
387 pr_warn("kobject_create_and_add opal failed\n");
388 return -ENOMEM;
389 }
390
391 return 0;
392}
393
372static int __init opal_init(void) 394static int __init opal_init(void)
373{ 395{
374 struct device_node *np, *consoles; 396 struct device_node *np, *consoles;
375 const u32 *irqs; 397 const __be32 *irqs;
376 int rc, i, irqlen; 398 int rc, i, irqlen;
377 399
378 opal_node = of_find_node_by_path("/ibm,opal"); 400 opal_node = of_find_node_by_path("/ibm,opal");
@@ -414,6 +436,14 @@ static int __init opal_init(void)
414 " (0x%x)\n", rc, irq, hwirq); 436 " (0x%x)\n", rc, irq, hwirq);
415 opal_irqs[i] = irq; 437 opal_irqs[i] = irq;
416 } 438 }
439
440 /* Create "opal" kobject under /sys/firmware */
441 rc = opal_sysfs_init();
442 if (rc == 0) {
443 /* Setup code update interface */
444 opal_flash_init();
445 }
446
417 return 0; 447 return 0;
418} 448}
419subsys_initcall(opal_init); 449subsys_initcall(opal_init);
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 74a5a5773b1f..084cdfa40682 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -70,6 +70,16 @@ define_pe_printk_level(pe_err, KERN_ERR);
70define_pe_printk_level(pe_warn, KERN_WARNING); 70define_pe_printk_level(pe_warn, KERN_WARNING);
71define_pe_printk_level(pe_info, KERN_INFO); 71define_pe_printk_level(pe_info, KERN_INFO);
72 72
73/*
74 * stdcix is only supposed to be used in hypervisor real mode as per
75 * the architecture spec
76 */
77static inline void __raw_rm_writeq(u64 val, volatile void __iomem *paddr)
78{
79 __asm__ __volatile__("stdcix %0,0,%1"
80 : : "r" (val), "r" (paddr) : "memory");
81}
82
73static int pnv_ioda_alloc_pe(struct pnv_phb *phb) 83static int pnv_ioda_alloc_pe(struct pnv_phb *phb)
74{ 84{
75 unsigned long pe; 85 unsigned long pe;
@@ -153,13 +163,23 @@ static int pnv_ioda_configure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe)
153 rid_end = pe->rid + 1; 163 rid_end = pe->rid + 1;
154 } 164 }
155 165
156 /* Associate PE in PELT */ 166 /*
167 * Associate PE in PELT. We need add the PE into the
168 * corresponding PELT-V as well. Otherwise, the error
169 * originated from the PE might contribute to other
170 * PEs.
171 */
157 rc = opal_pci_set_pe(phb->opal_id, pe->pe_number, pe->rid, 172 rc = opal_pci_set_pe(phb->opal_id, pe->pe_number, pe->rid,
158 bcomp, dcomp, fcomp, OPAL_MAP_PE); 173 bcomp, dcomp, fcomp, OPAL_MAP_PE);
159 if (rc) { 174 if (rc) {
160 pe_err(pe, "OPAL error %ld trying to setup PELT table\n", rc); 175 pe_err(pe, "OPAL error %ld trying to setup PELT table\n", rc);
161 return -ENXIO; 176 return -ENXIO;
162 } 177 }
178
179 rc = opal_pci_set_peltv(phb->opal_id, pe->pe_number,
180 pe->pe_number, OPAL_ADD_PE_TO_DOMAIN);
181 if (rc)
182 pe_warn(pe, "OPAL error %d adding self to PELTV\n", rc);
163 opal_pci_eeh_freeze_clear(phb->opal_id, pe->pe_number, 183 opal_pci_eeh_freeze_clear(phb->opal_id, pe->pe_number,
164 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL); 184 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
165 185
@@ -454,10 +474,13 @@ static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus)
454 } 474 }
455} 475}
456 476
457static void pnv_pci_ioda1_tce_invalidate(struct iommu_table *tbl, 477static void pnv_pci_ioda1_tce_invalidate(struct pnv_ioda_pe *pe,
458 u64 *startp, u64 *endp) 478 struct iommu_table *tbl,
479 __be64 *startp, __be64 *endp, bool rm)
459{ 480{
460 u64 __iomem *invalidate = (u64 __iomem *)tbl->it_index; 481 __be64 __iomem *invalidate = rm ?
482 (__be64 __iomem *)pe->tce_inval_reg_phys :
483 (__be64 __iomem *)tbl->it_index;
461 unsigned long start, end, inc; 484 unsigned long start, end, inc;
462 485
463 start = __pa(startp); 486 start = __pa(startp);
@@ -484,7 +507,10 @@ static void pnv_pci_ioda1_tce_invalidate(struct iommu_table *tbl,
484 507
485 mb(); /* Ensure above stores are visible */ 508 mb(); /* Ensure above stores are visible */
486 while (start <= end) { 509 while (start <= end) {
487 __raw_writeq(start, invalidate); 510 if (rm)
511 __raw_rm_writeq(cpu_to_be64(start), invalidate);
512 else
513 __raw_writeq(cpu_to_be64(start), invalidate);
488 start += inc; 514 start += inc;
489 } 515 }
490 516
@@ -496,10 +522,12 @@ static void pnv_pci_ioda1_tce_invalidate(struct iommu_table *tbl,
496 522
497static void pnv_pci_ioda2_tce_invalidate(struct pnv_ioda_pe *pe, 523static void pnv_pci_ioda2_tce_invalidate(struct pnv_ioda_pe *pe,
498 struct iommu_table *tbl, 524 struct iommu_table *tbl,
499 u64 *startp, u64 *endp) 525 __be64 *startp, __be64 *endp, bool rm)
500{ 526{
501 unsigned long start, end, inc; 527 unsigned long start, end, inc;
502 u64 __iomem *invalidate = (u64 __iomem *)tbl->it_index; 528 __be64 __iomem *invalidate = rm ?
529 (__be64 __iomem *)pe->tce_inval_reg_phys :
530 (__be64 __iomem *)tbl->it_index;
503 531
504 /* We'll invalidate DMA address in PE scope */ 532 /* We'll invalidate DMA address in PE scope */
505 start = 0x2ul << 60; 533 start = 0x2ul << 60;
@@ -515,22 +543,25 @@ static void pnv_pci_ioda2_tce_invalidate(struct pnv_ioda_pe *pe,
515 mb(); 543 mb();
516 544
517 while (start <= end) { 545 while (start <= end) {
518 __raw_writeq(start, invalidate); 546 if (rm)
547 __raw_rm_writeq(cpu_to_be64(start), invalidate);
548 else
549 __raw_writeq(cpu_to_be64(start), invalidate);
519 start += inc; 550 start += inc;
520 } 551 }
521} 552}
522 553
523void pnv_pci_ioda_tce_invalidate(struct iommu_table *tbl, 554void pnv_pci_ioda_tce_invalidate(struct iommu_table *tbl,
524 u64 *startp, u64 *endp) 555 __be64 *startp, __be64 *endp, bool rm)
525{ 556{
526 struct pnv_ioda_pe *pe = container_of(tbl, struct pnv_ioda_pe, 557 struct pnv_ioda_pe *pe = container_of(tbl, struct pnv_ioda_pe,
527 tce32_table); 558 tce32_table);
528 struct pnv_phb *phb = pe->phb; 559 struct pnv_phb *phb = pe->phb;
529 560
530 if (phb->type == PNV_PHB_IODA1) 561 if (phb->type == PNV_PHB_IODA1)
531 pnv_pci_ioda1_tce_invalidate(tbl, startp, endp); 562 pnv_pci_ioda1_tce_invalidate(pe, tbl, startp, endp, rm);
532 else 563 else
533 pnv_pci_ioda2_tce_invalidate(pe, tbl, startp, endp); 564 pnv_pci_ioda2_tce_invalidate(pe, tbl, startp, endp, rm);
534} 565}
535 566
536static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, 567static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
@@ -603,7 +634,9 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
603 * bus number, print that out instead. 634 * bus number, print that out instead.
604 */ 635 */
605 tbl->it_busno = 0; 636 tbl->it_busno = 0;
606 tbl->it_index = (unsigned long)ioremap(be64_to_cpup(swinvp), 8); 637 pe->tce_inval_reg_phys = be64_to_cpup(swinvp);
638 tbl->it_index = (unsigned long)ioremap(pe->tce_inval_reg_phys,
639 8);
607 tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE | 640 tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE |
608 TCE_PCI_SWINV_PAIR; 641 TCE_PCI_SWINV_PAIR;
609 } 642 }
@@ -681,7 +714,9 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
681 * bus number, print that out instead. 714 * bus number, print that out instead.
682 */ 715 */
683 tbl->it_busno = 0; 716 tbl->it_busno = 0;
684 tbl->it_index = (unsigned long)ioremap(be64_to_cpup(swinvp), 8); 717 pe->tce_inval_reg_phys = be64_to_cpup(swinvp);
718 tbl->it_index = (unsigned long)ioremap(pe->tce_inval_reg_phys,
719 8);
685 tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE; 720 tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE;
686 } 721 }
687 iommu_init_table(tbl, phb->hose->node); 722 iommu_init_table(tbl, phb->hose->node);
@@ -786,8 +821,7 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
786 struct irq_data *idata; 821 struct irq_data *idata;
787 struct irq_chip *ichip; 822 struct irq_chip *ichip;
788 unsigned int xive_num = hwirq - phb->msi_base; 823 unsigned int xive_num = hwirq - phb->msi_base;
789 uint64_t addr64; 824 __be32 data;
790 uint32_t addr32, data;
791 int rc; 825 int rc;
792 826
793 /* No PE assigned ? bail out ... no MSI for you ! */ 827 /* No PE assigned ? bail out ... no MSI for you ! */
@@ -811,6 +845,8 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
811 } 845 }
812 846
813 if (is_64) { 847 if (is_64) {
848 __be64 addr64;
849
814 rc = opal_get_msi_64(phb->opal_id, pe->mve_number, xive_num, 1, 850 rc = opal_get_msi_64(phb->opal_id, pe->mve_number, xive_num, 1,
815 &addr64, &data); 851 &addr64, &data);
816 if (rc) { 852 if (rc) {
@@ -818,9 +854,11 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
818 pci_name(dev), rc); 854 pci_name(dev), rc);
819 return -EIO; 855 return -EIO;
820 } 856 }
821 msg->address_hi = addr64 >> 32; 857 msg->address_hi = be64_to_cpu(addr64) >> 32;
822 msg->address_lo = addr64 & 0xfffffffful; 858 msg->address_lo = be64_to_cpu(addr64) & 0xfffffffful;
823 } else { 859 } else {
860 __be32 addr32;
861
824 rc = opal_get_msi_32(phb->opal_id, pe->mve_number, xive_num, 1, 862 rc = opal_get_msi_32(phb->opal_id, pe->mve_number, xive_num, 1,
825 &addr32, &data); 863 &addr32, &data);
826 if (rc) { 864 if (rc) {
@@ -829,9 +867,9 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
829 return -EIO; 867 return -EIO;
830 } 868 }
831 msg->address_hi = 0; 869 msg->address_hi = 0;
832 msg->address_lo = addr32; 870 msg->address_lo = be32_to_cpu(addr32);
833 } 871 }
834 msg->data = data; 872 msg->data = be32_to_cpu(data);
835 873
836 /* 874 /*
837 * Change the IRQ chip for the MSI interrupts on PHB3. 875 * Change the IRQ chip for the MSI interrupts on PHB3.
@@ -1106,8 +1144,8 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
1106 struct pci_controller *hose; 1144 struct pci_controller *hose;
1107 struct pnv_phb *phb; 1145 struct pnv_phb *phb;
1108 unsigned long size, m32map_off, iomap_off, pemap_off; 1146 unsigned long size, m32map_off, iomap_off, pemap_off;
1109 const u64 *prop64; 1147 const __be64 *prop64;
1110 const u32 *prop32; 1148 const __be32 *prop32;
1111 int len; 1149 int len;
1112 u64 phb_id; 1150 u64 phb_id;
1113 void *aux; 1151 void *aux;
@@ -1142,8 +1180,8 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
1142 spin_lock_init(&phb->lock); 1180 spin_lock_init(&phb->lock);
1143 prop32 = of_get_property(np, "bus-range", &len); 1181 prop32 = of_get_property(np, "bus-range", &len);
1144 if (prop32 && len == 8) { 1182 if (prop32 && len == 8) {
1145 hose->first_busno = prop32[0]; 1183 hose->first_busno = be32_to_cpu(prop32[0]);
1146 hose->last_busno = prop32[1]; 1184 hose->last_busno = be32_to_cpu(prop32[1]);
1147 } else { 1185 } else {
1148 pr_warn(" Broken <bus-range> on %s\n", np->full_name); 1186 pr_warn(" Broken <bus-range> on %s\n", np->full_name);
1149 hose->first_busno = 0; 1187 hose->first_busno = 0;
@@ -1171,12 +1209,13 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
1171 pr_err(" Failed to map registers !\n"); 1209 pr_err(" Failed to map registers !\n");
1172 1210
1173 /* Initialize more IODA stuff */ 1211 /* Initialize more IODA stuff */
1212 phb->ioda.total_pe = 1;
1174 prop32 = of_get_property(np, "ibm,opal-num-pes", NULL); 1213 prop32 = of_get_property(np, "ibm,opal-num-pes", NULL);
1175 if (!prop32) 1214 if (prop32)
1176 phb->ioda.total_pe = 1; 1215 phb->ioda.total_pe = be32_to_cpup(prop32);
1177 else 1216 prop32 = of_get_property(np, "ibm,opal-reserved-pe", NULL);
1178 phb->ioda.total_pe = *prop32; 1217 if (prop32)
1179 1218 phb->ioda.reserved_pe = be32_to_cpup(prop32);
1180 phb->ioda.m32_size = resource_size(&hose->mem_resources[0]); 1219 phb->ioda.m32_size = resource_size(&hose->mem_resources[0]);
1181 /* FW Has already off top 64k of M32 space (MSI space) */ 1220 /* FW Has already off top 64k of M32 space (MSI space) */
1182 phb->ioda.m32_size += 0x10000; 1221 phb->ioda.m32_size += 0x10000;
@@ -1205,7 +1244,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
1205 if (phb->type == PNV_PHB_IODA1) 1244 if (phb->type == PNV_PHB_IODA1)
1206 phb->ioda.io_segmap = aux + iomap_off; 1245 phb->ioda.io_segmap = aux + iomap_off;
1207 phb->ioda.pe_array = aux + pemap_off; 1246 phb->ioda.pe_array = aux + pemap_off;
1208 set_bit(0, phb->ioda.pe_alloc); 1247 set_bit(phb->ioda.reserved_pe, phb->ioda.pe_alloc);
1209 1248
1210 INIT_LIST_HEAD(&phb->ioda.pe_dma_list); 1249 INIT_LIST_HEAD(&phb->ioda.pe_dma_list);
1211 INIT_LIST_HEAD(&phb->ioda.pe_list); 1250 INIT_LIST_HEAD(&phb->ioda.pe_list);
@@ -1230,8 +1269,10 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
1230 segment_size); 1269 segment_size);
1231#endif 1270#endif
1232 1271
1233 pr_info(" %d PE's M32: 0x%x [segment=0x%x] IO: 0x%x [segment=0x%x]\n", 1272 pr_info(" %d (%d) PE's M32: 0x%x [segment=0x%x]"
1273 " IO: 0x%x [segment=0x%x]\n",
1234 phb->ioda.total_pe, 1274 phb->ioda.total_pe,
1275 phb->ioda.reserved_pe,
1235 phb->ioda.m32_size, phb->ioda.m32_segsize, 1276 phb->ioda.m32_size, phb->ioda.m32_segsize,
1236 phb->ioda.io_size, phb->ioda.io_segsize); 1277 phb->ioda.io_size, phb->ioda.io_segsize);
1237 1278
@@ -1268,13 +1309,6 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
1268 rc = opal_pci_reset(phb_id, OPAL_PCI_IODA_TABLE_RESET, OPAL_ASSERT_RESET); 1309 rc = opal_pci_reset(phb_id, OPAL_PCI_IODA_TABLE_RESET, OPAL_ASSERT_RESET);
1269 if (rc) 1310 if (rc)
1270 pr_warning(" OPAL Error %ld performing IODA table reset !\n", rc); 1311 pr_warning(" OPAL Error %ld performing IODA table reset !\n", rc);
1271
1272 /*
1273 * On IODA1 map everything to PE#0, on IODA2 we assume the IODA reset
1274 * has cleared the RTT which has the same effect
1275 */
1276 if (ioda_type == PNV_PHB_IODA1)
1277 opal_pci_set_pe(phb_id, 0, 0, 7, 1, 1 , OPAL_MAP_PE);
1278} 1312}
1279 1313
1280void __init pnv_pci_init_ioda2_phb(struct device_node *np) 1314void __init pnv_pci_init_ioda2_phb(struct device_node *np)
@@ -1285,7 +1319,7 @@ void __init pnv_pci_init_ioda2_phb(struct device_node *np)
1285void __init pnv_pci_init_ioda_hub(struct device_node *np) 1319void __init pnv_pci_init_ioda_hub(struct device_node *np)
1286{ 1320{
1287 struct device_node *phbn; 1321 struct device_node *phbn;
1288 const u64 *prop64; 1322 const __be64 *prop64;
1289 u64 hub_id; 1323 u64 hub_id;
1290 1324
1291 pr_info("Probing IODA IO-Hub %s\n", np->full_name); 1325 pr_info("Probing IODA IO-Hub %s\n", np->full_name);
diff --git a/arch/powerpc/platforms/powernv/pci-p5ioc2.c b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
index b68db6325c1b..f8b4bd8afb2e 100644
--- a/arch/powerpc/platforms/powernv/pci-p5ioc2.c
+++ b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
@@ -99,7 +99,7 @@ static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, u64 hub_id,
99 void *tce_mem, u64 tce_size) 99 void *tce_mem, u64 tce_size)
100{ 100{
101 struct pnv_phb *phb; 101 struct pnv_phb *phb;
102 const u64 *prop64; 102 const __be64 *prop64;
103 u64 phb_id; 103 u64 phb_id;
104 int64_t rc; 104 int64_t rc;
105 static int primary = 1; 105 static int primary = 1;
@@ -178,7 +178,7 @@ static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, u64 hub_id,
178void __init pnv_pci_init_p5ioc2_hub(struct device_node *np) 178void __init pnv_pci_init_p5ioc2_hub(struct device_node *np)
179{ 179{
180 struct device_node *phbn; 180 struct device_node *phbn;
181 const u64 *prop64; 181 const __be64 *prop64;
182 u64 hub_id; 182 u64 hub_id;
183 void *tce_mem; 183 void *tce_mem;
184 uint64_t tce_per_phb; 184 uint64_t tce_per_phb;
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index a28d3b5e6393..4eb33a9ed532 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -236,17 +236,21 @@ static void pnv_pci_config_check_eeh(struct pnv_phb *phb,
236{ 236{
237 s64 rc; 237 s64 rc;
238 u8 fstate; 238 u8 fstate;
239 u16 pcierr; 239 __be16 pcierr;
240 u32 pe_no; 240 u32 pe_no;
241 241
242 /* 242 /*
243 * Get the PE#. During the PCI probe stage, we might not 243 * Get the PE#. During the PCI probe stage, we might not
244 * setup that yet. So all ER errors should be mapped to 244 * setup that yet. So all ER errors should be mapped to
245 * PE#0 245 * reserved PE.
246 */ 246 */
247 pe_no = PCI_DN(dn)->pe_number; 247 pe_no = PCI_DN(dn)->pe_number;
248 if (pe_no == IODA_INVALID_PE) 248 if (pe_no == IODA_INVALID_PE) {
249 pe_no = 0; 249 if (phb->type == PNV_PHB_P5IOC2)
250 pe_no = 0;
251 else
252 pe_no = phb->ioda.reserved_pe;
253 }
250 254
251 /* Read freeze status */ 255 /* Read freeze status */
252 rc = opal_pci_eeh_freeze_status(phb->opal_id, pe_no, &fstate, &pcierr, 256 rc = opal_pci_eeh_freeze_status(phb->opal_id, pe_no, &fstate, &pcierr,
@@ -283,16 +287,16 @@ int pnv_pci_cfg_read(struct device_node *dn,
283 break; 287 break;
284 } 288 }
285 case 2: { 289 case 2: {
286 u16 v16; 290 __be16 v16;
287 rc = opal_pci_config_read_half_word(phb->opal_id, bdfn, where, 291 rc = opal_pci_config_read_half_word(phb->opal_id, bdfn, where,
288 &v16); 292 &v16);
289 *val = (rc == OPAL_SUCCESS) ? v16 : 0xffff; 293 *val = (rc == OPAL_SUCCESS) ? be16_to_cpu(v16) : 0xffff;
290 break; 294 break;
291 } 295 }
292 case 4: { 296 case 4: {
293 u32 v32; 297 __be32 v32;
294 rc = opal_pci_config_read_word(phb->opal_id, bdfn, where, &v32); 298 rc = opal_pci_config_read_word(phb->opal_id, bdfn, where, &v32);
295 *val = (rc == OPAL_SUCCESS) ? v32 : 0xffffffff; 299 *val = (rc == OPAL_SUCCESS) ? be32_to_cpu(v32) : 0xffffffff;
296 break; 300 break;
297 } 301 }
298 default: 302 default:
@@ -401,10 +405,10 @@ struct pci_ops pnv_pci_ops = {
401 405
402static int pnv_tce_build(struct iommu_table *tbl, long index, long npages, 406static int pnv_tce_build(struct iommu_table *tbl, long index, long npages,
403 unsigned long uaddr, enum dma_data_direction direction, 407 unsigned long uaddr, enum dma_data_direction direction,
404 struct dma_attrs *attrs) 408 struct dma_attrs *attrs, bool rm)
405{ 409{
406 u64 proto_tce; 410 u64 proto_tce;
407 u64 *tcep, *tces; 411 __be64 *tcep, *tces;
408 u64 rpn; 412 u64 rpn;
409 413
410 proto_tce = TCE_PCI_READ; // Read allowed 414 proto_tce = TCE_PCI_READ; // Read allowed
@@ -412,33 +416,48 @@ static int pnv_tce_build(struct iommu_table *tbl, long index, long npages,
412 if (direction != DMA_TO_DEVICE) 416 if (direction != DMA_TO_DEVICE)
413 proto_tce |= TCE_PCI_WRITE; 417 proto_tce |= TCE_PCI_WRITE;
414 418
415 tces = tcep = ((u64 *)tbl->it_base) + index - tbl->it_offset; 419 tces = tcep = ((__be64 *)tbl->it_base) + index - tbl->it_offset;
416 rpn = __pa(uaddr) >> TCE_SHIFT; 420 rpn = __pa(uaddr) >> TCE_SHIFT;
417 421
418 while (npages--) 422 while (npages--)
419 *(tcep++) = proto_tce | (rpn++ << TCE_RPN_SHIFT); 423 *(tcep++) = cpu_to_be64(proto_tce | (rpn++ << TCE_RPN_SHIFT));
420 424
421 /* Some implementations won't cache invalid TCEs and thus may not 425 /* Some implementations won't cache invalid TCEs and thus may not
422 * need that flush. We'll probably turn it_type into a bit mask 426 * need that flush. We'll probably turn it_type into a bit mask
423 * of flags if that becomes the case 427 * of flags if that becomes the case
424 */ 428 */
425 if (tbl->it_type & TCE_PCI_SWINV_CREATE) 429 if (tbl->it_type & TCE_PCI_SWINV_CREATE)
426 pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1); 430 pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1, rm);
427 431
428 return 0; 432 return 0;
429} 433}
430 434
431static void pnv_tce_free(struct iommu_table *tbl, long index, long npages) 435static int pnv_tce_build_vm(struct iommu_table *tbl, long index, long npages,
436 unsigned long uaddr,
437 enum dma_data_direction direction,
438 struct dma_attrs *attrs)
432{ 439{
433 u64 *tcep, *tces; 440 return pnv_tce_build(tbl, index, npages, uaddr, direction, attrs,
441 false);
442}
434 443
435 tces = tcep = ((u64 *)tbl->it_base) + index - tbl->it_offset; 444static void pnv_tce_free(struct iommu_table *tbl, long index, long npages,
445 bool rm)
446{
447 __be64 *tcep, *tces;
448
449 tces = tcep = ((__be64 *)tbl->it_base) + index - tbl->it_offset;
436 450
437 while (npages--) 451 while (npages--)
438 *(tcep++) = 0; 452 *(tcep++) = cpu_to_be64(0);
439 453
440 if (tbl->it_type & TCE_PCI_SWINV_FREE) 454 if (tbl->it_type & TCE_PCI_SWINV_FREE)
441 pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1); 455 pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1, rm);
456}
457
458static void pnv_tce_free_vm(struct iommu_table *tbl, long index, long npages)
459{
460 pnv_tce_free(tbl, index, npages, false);
442} 461}
443 462
444static unsigned long pnv_tce_get(struct iommu_table *tbl, long index) 463static unsigned long pnv_tce_get(struct iommu_table *tbl, long index)
@@ -446,6 +465,19 @@ static unsigned long pnv_tce_get(struct iommu_table *tbl, long index)
446 return ((u64 *)tbl->it_base)[index - tbl->it_offset]; 465 return ((u64 *)tbl->it_base)[index - tbl->it_offset];
447} 466}
448 467
468static int pnv_tce_build_rm(struct iommu_table *tbl, long index, long npages,
469 unsigned long uaddr,
470 enum dma_data_direction direction,
471 struct dma_attrs *attrs)
472{
473 return pnv_tce_build(tbl, index, npages, uaddr, direction, attrs, true);
474}
475
476static void pnv_tce_free_rm(struct iommu_table *tbl, long index, long npages)
477{
478 pnv_tce_free(tbl, index, npages, true);
479}
480
449void pnv_pci_setup_iommu_table(struct iommu_table *tbl, 481void pnv_pci_setup_iommu_table(struct iommu_table *tbl,
450 void *tce_mem, u64 tce_size, 482 void *tce_mem, u64 tce_size,
451 u64 dma_offset) 483 u64 dma_offset)
@@ -484,8 +516,8 @@ static struct iommu_table *pnv_pci_setup_bml_iommu(struct pci_controller *hose)
484 swinvp = of_get_property(hose->dn, "linux,tce-sw-invalidate-info", 516 swinvp = of_get_property(hose->dn, "linux,tce-sw-invalidate-info",
485 NULL); 517 NULL);
486 if (swinvp) { 518 if (swinvp) {
487 tbl->it_busno = swinvp[1]; 519 tbl->it_busno = be64_to_cpu(swinvp[1]);
488 tbl->it_index = (unsigned long)ioremap(swinvp[0], 8); 520 tbl->it_index = (unsigned long)ioremap(be64_to_cpup(swinvp), 8);
489 tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE; 521 tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE;
490 } 522 }
491 return tbl; 523 return tbl;
@@ -610,8 +642,10 @@ void __init pnv_pci_init(void)
610 642
611 /* Configure IOMMU DMA hooks */ 643 /* Configure IOMMU DMA hooks */
612 ppc_md.pci_dma_dev_setup = pnv_pci_dma_dev_setup; 644 ppc_md.pci_dma_dev_setup = pnv_pci_dma_dev_setup;
613 ppc_md.tce_build = pnv_tce_build; 645 ppc_md.tce_build = pnv_tce_build_vm;
614 ppc_md.tce_free = pnv_tce_free; 646 ppc_md.tce_free = pnv_tce_free_vm;
647 ppc_md.tce_build_rm = pnv_tce_build_rm;
648 ppc_md.tce_free_rm = pnv_tce_free_rm;
615 ppc_md.tce_get = pnv_tce_get; 649 ppc_md.tce_get = pnv_tce_get;
616 ppc_md.pci_probe_mode = pnv_pci_probe_mode; 650 ppc_md.pci_probe_mode = pnv_pci_probe_mode;
617 set_pci_dma_ops(&dma_iommu_ops); 651 set_pci_dma_ops(&dma_iommu_ops);
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index d633c64e05a1..911c24ef033e 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -17,7 +17,7 @@ enum pnv_phb_model {
17 PNV_PHB_MODEL_PHB3, 17 PNV_PHB_MODEL_PHB3,
18}; 18};
19 19
20#define PNV_PCI_DIAG_BUF_SIZE 4096 20#define PNV_PCI_DIAG_BUF_SIZE 8192
21#define PNV_IODA_PE_DEV (1 << 0) /* PE has single PCI device */ 21#define PNV_IODA_PE_DEV (1 << 0) /* PE has single PCI device */
22#define PNV_IODA_PE_BUS (1 << 1) /* PE has primary PCI bus */ 22#define PNV_IODA_PE_BUS (1 << 1) /* PE has primary PCI bus */
23#define PNV_IODA_PE_BUS_ALL (1 << 2) /* PE has subordinate buses */ 23#define PNV_IODA_PE_BUS_ALL (1 << 2) /* PE has subordinate buses */
@@ -52,6 +52,7 @@ struct pnv_ioda_pe {
52 int tce32_seg; 52 int tce32_seg;
53 int tce32_segcount; 53 int tce32_segcount;
54 struct iommu_table tce32_table; 54 struct iommu_table tce32_table;
55 phys_addr_t tce_inval_reg_phys;
55 56
56 /* XXX TODO: Add support for additional 64-bit iommus */ 57 /* XXX TODO: Add support for additional 64-bit iommus */
57 58
@@ -124,6 +125,7 @@ struct pnv_phb {
124 struct { 125 struct {
125 /* Global bridge info */ 126 /* Global bridge info */
126 unsigned int total_pe; 127 unsigned int total_pe;
128 unsigned int reserved_pe;
127 unsigned int m32_size; 129 unsigned int m32_size;
128 unsigned int m32_segsize; 130 unsigned int m32_segsize;
129 unsigned int m32_pci_base; 131 unsigned int m32_pci_base;
@@ -193,6 +195,6 @@ extern void pnv_pci_init_p5ioc2_hub(struct device_node *np);
193extern void pnv_pci_init_ioda_hub(struct device_node *np); 195extern void pnv_pci_init_ioda_hub(struct device_node *np);
194extern void pnv_pci_init_ioda2_phb(struct device_node *np); 196extern void pnv_pci_init_ioda2_phb(struct device_node *np);
195extern void pnv_pci_ioda_tce_invalidate(struct iommu_table *tbl, 197extern void pnv_pci_ioda_tce_invalidate(struct iommu_table *tbl,
196 u64 *startp, u64 *endp); 198 __be64 *startp, __be64 *endp, bool rm);
197 199
198#endif /* __POWERNV_PCI_H */ 200#endif /* __POWERNV_PCI_H */
diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/powernv/rng.c
new file mode 100644
index 000000000000..8844628915dc
--- /dev/null
+++ b/arch/powerpc/platforms/powernv/rng.c
@@ -0,0 +1,125 @@
1/*
2 * Copyright 2013, Michael Ellerman, IBM Corporation.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#define pr_fmt(fmt) "powernv-rng: " fmt
11
12#include <linux/kernel.h>
13#include <linux/of.h>
14#include <linux/of_address.h>
15#include <linux/of_platform.h>
16#include <linux/slab.h>
17#include <linux/smp.h>
18#include <asm/archrandom.h>
19#include <asm/io.h>
20#include <asm/prom.h>
21#include <asm/machdep.h>
22
23
24struct powernv_rng {
25 void __iomem *regs;
26 unsigned long mask;
27};
28
29static DEFINE_PER_CPU(struct powernv_rng *, powernv_rng);
30
31
32static unsigned long rng_whiten(struct powernv_rng *rng, unsigned long val)
33{
34 unsigned long parity;
35
36 /* Calculate the parity of the value */
37 asm ("popcntd %0,%1" : "=r" (parity) : "r" (val));
38
39 /* xor our value with the previous mask */
40 val ^= rng->mask;
41
42 /* update the mask based on the parity of this value */
43 rng->mask = (rng->mask << 1) | (parity & 1);
44
45 return val;
46}
47
48int powernv_get_random_long(unsigned long *v)
49{
50 struct powernv_rng *rng;
51
52 rng = get_cpu_var(powernv_rng);
53
54 *v = rng_whiten(rng, in_be64(rng->regs));
55
56 put_cpu_var(rng);
57
58 return 1;
59}
60EXPORT_SYMBOL_GPL(powernv_get_random_long);
61
62static __init void rng_init_per_cpu(struct powernv_rng *rng,
63 struct device_node *dn)
64{
65 int chip_id, cpu;
66
67 chip_id = of_get_ibm_chip_id(dn);
68 if (chip_id == -1)
69 pr_warn("No ibm,chip-id found for %s.\n", dn->full_name);
70
71 for_each_possible_cpu(cpu) {
72 if (per_cpu(powernv_rng, cpu) == NULL ||
73 cpu_to_chip_id(cpu) == chip_id) {
74 per_cpu(powernv_rng, cpu) = rng;
75 }
76 }
77}
78
79static __init int rng_create(struct device_node *dn)
80{
81 struct powernv_rng *rng;
82 unsigned long val;
83
84 rng = kzalloc(sizeof(*rng), GFP_KERNEL);
85 if (!rng)
86 return -ENOMEM;
87
88 rng->regs = of_iomap(dn, 0);
89 if (!rng->regs) {
90 kfree(rng);
91 return -ENXIO;
92 }
93
94 val = in_be64(rng->regs);
95 rng->mask = val;
96
97 rng_init_per_cpu(rng, dn);
98
99 pr_info_once("Registering arch random hook.\n");
100
101 ppc_md.get_random_long = powernv_get_random_long;
102
103 return 0;
104}
105
106static __init int rng_init(void)
107{
108 struct device_node *dn;
109 int rc;
110
111 for_each_compatible_node(dn, NULL, "ibm,power-rng") {
112 rc = rng_create(dn);
113 if (rc) {
114 pr_err("Failed creating rng for %s (%d).\n",
115 dn->full_name, rc);
116 continue;
117 }
118
119 /* Create devices for hwrng driver */
120 of_platform_device_create(dn, NULL, NULL);
121 }
122
123 return 0;
124}
125subsys_initcall(rng_init);
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index e239dcfa224c..19884b2a51b4 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -23,6 +23,7 @@
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/seq_file.h> 24#include <linux/seq_file.h>
25#include <linux/of.h> 25#include <linux/of.h>
26#include <linux/of_fdt.h>
26#include <linux/interrupt.h> 27#include <linux/interrupt.h>
27#include <linux/bug.h> 28#include <linux/bug.h>
28 29
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index 6c61ec5ee914..fbccac9cd2dc 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -3,7 +3,7 @@ ccflags-$(CONFIG_PPC_PSERIES_DEBUG) += -DDEBUG
3 3
4obj-y := lpar.o hvCall.o nvram.o reconfig.o \ 4obj-y := lpar.o hvCall.o nvram.o reconfig.o \
5 setup.o iommu.o event_sources.o ras.o \ 5 setup.o iommu.o event_sources.o ras.o \
6 firmware.o power.o dlpar.o mobility.o 6 firmware.o power.o dlpar.o mobility.o rng.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_pseries.o 9obj-$(CONFIG_EEH) += eeh_pseries.o
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 7cfdaae1721a..a8fe5aa3d34f 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -404,46 +404,38 @@ static ssize_t dlpar_cpu_probe(const char *buf, size_t count)
404 unsigned long drc_index; 404 unsigned long drc_index;
405 int rc; 405 int rc;
406 406
407 cpu_hotplug_driver_lock();
408 rc = strict_strtoul(buf, 0, &drc_index); 407 rc = strict_strtoul(buf, 0, &drc_index);
409 if (rc) { 408 if (rc)
410 rc = -EINVAL; 409 return -EINVAL;
411 goto out;
412 }
413 410
414 parent = of_find_node_by_path("/cpus"); 411 parent = of_find_node_by_path("/cpus");
415 if (!parent) { 412 if (!parent)
416 rc = -ENODEV; 413 return -ENODEV;
417 goto out;
418 }
419 414
420 dn = dlpar_configure_connector(drc_index, parent); 415 dn = dlpar_configure_connector(drc_index, parent);
421 if (!dn) { 416 if (!dn)
422 rc = -EINVAL; 417 return -EINVAL;
423 goto out;
424 }
425 418
426 of_node_put(parent); 419 of_node_put(parent);
427 420
428 rc = dlpar_acquire_drc(drc_index); 421 rc = dlpar_acquire_drc(drc_index);
429 if (rc) { 422 if (rc) {
430 dlpar_free_cc_nodes(dn); 423 dlpar_free_cc_nodes(dn);
431 rc = -EINVAL; 424 return -EINVAL;
432 goto out;
433 } 425 }
434 426
435 rc = dlpar_attach_node(dn); 427 rc = dlpar_attach_node(dn);
436 if (rc) { 428 if (rc) {
437 dlpar_release_drc(drc_index); 429 dlpar_release_drc(drc_index);
438 dlpar_free_cc_nodes(dn); 430 dlpar_free_cc_nodes(dn);
439 goto out; 431 return rc;
440 } 432 }
441 433
442 rc = dlpar_online_cpu(dn); 434 rc = dlpar_online_cpu(dn);
443out: 435 if (rc)
444 cpu_hotplug_driver_unlock(); 436 return rc;
445 437
446 return rc ? rc : count; 438 return count;
447} 439}
448 440
449static int dlpar_offline_cpu(struct device_node *dn) 441static int dlpar_offline_cpu(struct device_node *dn)
@@ -516,30 +508,27 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count)
516 return -EINVAL; 508 return -EINVAL;
517 } 509 }
518 510
519 cpu_hotplug_driver_lock();
520 rc = dlpar_offline_cpu(dn); 511 rc = dlpar_offline_cpu(dn);
521 if (rc) { 512 if (rc) {
522 of_node_put(dn); 513 of_node_put(dn);
523 rc = -EINVAL; 514 return -EINVAL;
524 goto out;
525 } 515 }
526 516
527 rc = dlpar_release_drc(*drc_index); 517 rc = dlpar_release_drc(*drc_index);
528 if (rc) { 518 if (rc) {
529 of_node_put(dn); 519 of_node_put(dn);
530 goto out; 520 return rc;
531 } 521 }
532 522
533 rc = dlpar_detach_node(dn); 523 rc = dlpar_detach_node(dn);
534 if (rc) { 524 if (rc) {
535 dlpar_acquire_drc(*drc_index); 525 dlpar_acquire_drc(*drc_index);
536 goto out; 526 return rc;
537 } 527 }
538 528
539 of_node_put(dn); 529 of_node_put(dn);
540out: 530
541 cpu_hotplug_driver_unlock(); 531 return count;
542 return rc ? rc : count;
543} 532}
544 533
545static int __init pseries_dlpar_init(void) 534static int __init pseries_dlpar_init(void)
diff --git a/arch/powerpc/platforms/pseries/event_sources.c b/arch/powerpc/platforms/pseries/event_sources.c
index 2605c310166a..18380e8f6dfe 100644
--- a/arch/powerpc/platforms/pseries/event_sources.c
+++ b/arch/powerpc/platforms/pseries/event_sources.c
@@ -25,7 +25,7 @@ void request_event_sources_irqs(struct device_node *np,
25 const char *name) 25 const char *name)
26{ 26{
27 int i, index, count = 0; 27 int i, index, count = 0;
28 struct of_irq oirq; 28 struct of_phandle_args oirq;
29 const u32 *opicprop; 29 const u32 *opicprop;
30 unsigned int opicplen; 30 unsigned int opicplen;
31 unsigned int virqs[16]; 31 unsigned int virqs[16];
@@ -55,13 +55,11 @@ void request_event_sources_irqs(struct device_node *np,
55 /* Else use normal interrupt tree parsing */ 55 /* Else use normal interrupt tree parsing */
56 else { 56 else {
57 /* First try to do a proper OF tree parsing */ 57 /* First try to do a proper OF tree parsing */
58 for (index = 0; of_irq_map_one(np, index, &oirq) == 0; 58 for (index = 0; of_irq_parse_one(np, index, &oirq) == 0;
59 index++) { 59 index++) {
60 if (count > 15) 60 if (count > 15)
61 break; 61 break;
62 virqs[count] = irq_create_of_mapping(oirq.controller, 62 virqs[count] = irq_create_of_mapping(&oirq);
63 oirq.specifier,
64 oirq.size);
65 if (virqs[count] == NO_IRQ) { 63 if (virqs[count] == NO_IRQ) {
66 pr_err("event-sources: Unable to allocate " 64 pr_err("event-sources: Unable to allocate "
67 "interrupt number for %s\n", 65 "interrupt number for %s\n",
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 9a432de363b8..9590dbb756f2 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -10,12 +10,14 @@
10 */ 10 */
11 11
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/of_address.h>
13#include <linux/memblock.h> 14#include <linux/memblock.h>
14#include <linux/vmalloc.h> 15#include <linux/vmalloc.h>
15#include <linux/memory.h> 16#include <linux/memory.h>
16 17
17#include <asm/firmware.h> 18#include <asm/firmware.h>
18#include <asm/machdep.h> 19#include <asm/machdep.h>
20#include <asm/prom.h>
19#include <asm/sparsemem.h> 21#include <asm/sparsemem.h>
20 22
21static unsigned long get_memblock_size(void) 23static unsigned long get_memblock_size(void)
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 0307901e4132..f253361552ae 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -52,7 +52,7 @@
52 52
53 53
54static void tce_invalidate_pSeries_sw(struct iommu_table *tbl, 54static void tce_invalidate_pSeries_sw(struct iommu_table *tbl,
55 u64 *startp, u64 *endp) 55 __be64 *startp, __be64 *endp)
56{ 56{
57 u64 __iomem *invalidate = (u64 __iomem *)tbl->it_index; 57 u64 __iomem *invalidate = (u64 __iomem *)tbl->it_index;
58 unsigned long start, end, inc; 58 unsigned long start, end, inc;
@@ -86,7 +86,7 @@ static int tce_build_pSeries(struct iommu_table *tbl, long index,
86 struct dma_attrs *attrs) 86 struct dma_attrs *attrs)
87{ 87{
88 u64 proto_tce; 88 u64 proto_tce;
89 u64 *tcep, *tces; 89 __be64 *tcep, *tces;
90 u64 rpn; 90 u64 rpn;
91 91
92 proto_tce = TCE_PCI_READ; // Read allowed 92 proto_tce = TCE_PCI_READ; // Read allowed
@@ -94,12 +94,12 @@ static int tce_build_pSeries(struct iommu_table *tbl, long index,
94 if (direction != DMA_TO_DEVICE) 94 if (direction != DMA_TO_DEVICE)
95 proto_tce |= TCE_PCI_WRITE; 95 proto_tce |= TCE_PCI_WRITE;
96 96
97 tces = tcep = ((u64 *)tbl->it_base) + index; 97 tces = tcep = ((__be64 *)tbl->it_base) + index;
98 98
99 while (npages--) { 99 while (npages--) {
100 /* can't move this out since we might cross MEMBLOCK boundary */ 100 /* can't move this out since we might cross MEMBLOCK boundary */
101 rpn = __pa(uaddr) >> TCE_SHIFT; 101 rpn = __pa(uaddr) >> TCE_SHIFT;
102 *tcep = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT; 102 *tcep = cpu_to_be64(proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT);
103 103
104 uaddr += TCE_PAGE_SIZE; 104 uaddr += TCE_PAGE_SIZE;
105 tcep++; 105 tcep++;
@@ -113,9 +113,9 @@ static int tce_build_pSeries(struct iommu_table *tbl, long index,
113 113
114static void tce_free_pSeries(struct iommu_table *tbl, long index, long npages) 114static void tce_free_pSeries(struct iommu_table *tbl, long index, long npages)
115{ 115{
116 u64 *tcep, *tces; 116 __be64 *tcep, *tces;
117 117
118 tces = tcep = ((u64 *)tbl->it_base) + index; 118 tces = tcep = ((__be64 *)tbl->it_base) + index;
119 119
120 while (npages--) 120 while (npages--)
121 *(tcep++) = 0; 121 *(tcep++) = 0;
@@ -126,11 +126,11 @@ static void tce_free_pSeries(struct iommu_table *tbl, long index, long npages)
126 126
127static unsigned long tce_get_pseries(struct iommu_table *tbl, long index) 127static unsigned long tce_get_pseries(struct iommu_table *tbl, long index)
128{ 128{
129 u64 *tcep; 129 __be64 *tcep;
130 130
131 tcep = ((u64 *)tbl->it_base) + index; 131 tcep = ((__be64 *)tbl->it_base) + index;
132 132
133 return *tcep; 133 return be64_to_cpu(*tcep);
134} 134}
135 135
136static void tce_free_pSeriesLP(struct iommu_table*, long, long); 136static void tce_free_pSeriesLP(struct iommu_table*, long, long);
@@ -177,7 +177,7 @@ static int tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
177 return ret; 177 return ret;
178} 178}
179 179
180static DEFINE_PER_CPU(u64 *, tce_page); 180static DEFINE_PER_CPU(__be64 *, tce_page);
181 181
182static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, 182static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
183 long npages, unsigned long uaddr, 183 long npages, unsigned long uaddr,
@@ -186,7 +186,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
186{ 186{
187 u64 rc = 0; 187 u64 rc = 0;
188 u64 proto_tce; 188 u64 proto_tce;
189 u64 *tcep; 189 __be64 *tcep;
190 u64 rpn; 190 u64 rpn;
191 long l, limit; 191 long l, limit;
192 long tcenum_start = tcenum, npages_start = npages; 192 long tcenum_start = tcenum, npages_start = npages;
@@ -206,7 +206,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
206 * from iommu_alloc{,_sg}() 206 * from iommu_alloc{,_sg}()
207 */ 207 */
208 if (!tcep) { 208 if (!tcep) {
209 tcep = (u64 *)__get_free_page(GFP_ATOMIC); 209 tcep = (__be64 *)__get_free_page(GFP_ATOMIC);
210 /* If allocation fails, fall back to the loop implementation */ 210 /* If allocation fails, fall back to the loop implementation */
211 if (!tcep) { 211 if (!tcep) {
212 local_irq_restore(flags); 212 local_irq_restore(flags);
@@ -230,7 +230,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
230 limit = min_t(long, npages, 4096/TCE_ENTRY_SIZE); 230 limit = min_t(long, npages, 4096/TCE_ENTRY_SIZE);
231 231
232 for (l = 0; l < limit; l++) { 232 for (l = 0; l < limit; l++) {
233 tcep[l] = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT; 233 tcep[l] = cpu_to_be64(proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT);
234 rpn++; 234 rpn++;
235 } 235 }
236 236
@@ -329,16 +329,16 @@ struct direct_window {
329 329
330/* Dynamic DMA Window support */ 330/* Dynamic DMA Window support */
331struct ddw_query_response { 331struct ddw_query_response {
332 u32 windows_available; 332 __be32 windows_available;
333 u32 largest_available_block; 333 __be32 largest_available_block;
334 u32 page_size; 334 __be32 page_size;
335 u32 migration_capable; 335 __be32 migration_capable;
336}; 336};
337 337
338struct ddw_create_response { 338struct ddw_create_response {
339 u32 liobn; 339 __be32 liobn;
340 u32 addr_hi; 340 __be32 addr_hi;
341 u32 addr_lo; 341 __be32 addr_lo;
342}; 342};
343 343
344static LIST_HEAD(direct_window_list); 344static LIST_HEAD(direct_window_list);
@@ -392,7 +392,8 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn,
392 unsigned long num_pfn, const void *arg) 392 unsigned long num_pfn, const void *arg)
393{ 393{
394 const struct dynamic_dma_window_prop *maprange = arg; 394 const struct dynamic_dma_window_prop *maprange = arg;
395 u64 *tcep, tce_size, num_tce, dma_offset, next, proto_tce, liobn; 395 u64 tce_size, num_tce, dma_offset, next, proto_tce, liobn;
396 __be64 *tcep;
396 u32 tce_shift; 397 u32 tce_shift;
397 u64 rc = 0; 398 u64 rc = 0;
398 long l, limit; 399 long l, limit;
@@ -401,7 +402,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn,
401 tcep = __get_cpu_var(tce_page); 402 tcep = __get_cpu_var(tce_page);
402 403
403 if (!tcep) { 404 if (!tcep) {
404 tcep = (u64 *)__get_free_page(GFP_ATOMIC); 405 tcep = (__be64 *)__get_free_page(GFP_ATOMIC);
405 if (!tcep) { 406 if (!tcep) {
406 local_irq_enable(); 407 local_irq_enable();
407 return -ENOMEM; 408 return -ENOMEM;
@@ -435,7 +436,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn,
435 dma_offset = next + be64_to_cpu(maprange->dma_base); 436 dma_offset = next + be64_to_cpu(maprange->dma_base);
436 437
437 for (l = 0; l < limit; l++) { 438 for (l = 0; l < limit; l++) {
438 tcep[l] = proto_tce | next; 439 tcep[l] = cpu_to_be64(proto_tce | next);
439 next += tce_size; 440 next += tce_size;
440 } 441 }
441 442
@@ -780,7 +781,7 @@ static u64 find_existing_ddw(struct device_node *pdn)
780 list_for_each_entry(window, &direct_window_list, list) { 781 list_for_each_entry(window, &direct_window_list, list) {
781 if (window->device == pdn) { 782 if (window->device == pdn) {
782 direct64 = window->prop; 783 direct64 = window->prop;
783 dma_addr = direct64->dma_base; 784 dma_addr = be64_to_cpu(direct64->dma_base);
784 break; 785 break;
785 } 786 }
786 } 787 }
@@ -1045,11 +1046,11 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
1045 dev_dbg(&dev->dev, "no free dynamic windows"); 1046 dev_dbg(&dev->dev, "no free dynamic windows");
1046 goto out_restore_window; 1047 goto out_restore_window;
1047 } 1048 }
1048 if (query.page_size & 4) { 1049 if (be32_to_cpu(query.page_size) & 4) {
1049 page_shift = 24; /* 16MB */ 1050 page_shift = 24; /* 16MB */
1050 } else if (query.page_size & 2) { 1051 } else if (be32_to_cpu(query.page_size) & 2) {
1051 page_shift = 16; /* 64kB */ 1052 page_shift = 16; /* 64kB */
1052 } else if (query.page_size & 1) { 1053 } else if (be32_to_cpu(query.page_size) & 1) {
1053 page_shift = 12; /* 4kB */ 1054 page_shift = 12; /* 4kB */
1054 } else { 1055 } else {
1055 dev_dbg(&dev->dev, "no supported direct page size in mask %x", 1056 dev_dbg(&dev->dev, "no supported direct page size in mask %x",
@@ -1059,7 +1060,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
1059 /* verify the window * number of ptes will map the partition */ 1060 /* verify the window * number of ptes will map the partition */
1060 /* check largest block * page size > max memory hotplug addr */ 1061 /* check largest block * page size > max memory hotplug addr */
1061 max_addr = memory_hotplug_max(); 1062 max_addr = memory_hotplug_max();
1062 if (query.largest_available_block < (max_addr >> page_shift)) { 1063 if (be32_to_cpu(query.largest_available_block) < (max_addr >> page_shift)) {
1063 dev_dbg(&dev->dev, "can't map partiton max 0x%llx with %u " 1064 dev_dbg(&dev->dev, "can't map partiton max 0x%llx with %u "
1064 "%llu-sized pages\n", max_addr, query.largest_available_block, 1065 "%llu-sized pages\n", max_addr, query.largest_available_block,
1065 1ULL << page_shift); 1066 1ULL << page_shift);
@@ -1085,7 +1086,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
1085 if (ret != 0) 1086 if (ret != 0)
1086 goto out_free_prop; 1087 goto out_free_prop;
1087 1088
1088 ddwprop->liobn = cpu_to_be32(create.liobn); 1089 ddwprop->liobn = create.liobn;
1089 ddwprop->dma_base = cpu_to_be64(of_read_number(&create.addr_hi, 2)); 1090 ddwprop->dma_base = cpu_to_be64(of_read_number(&create.addr_hi, 2));
1090 ddwprop->tce_shift = cpu_to_be32(page_shift); 1091 ddwprop->tce_shift = cpu_to_be32(page_shift);
1091 ddwprop->window_shift = cpu_to_be32(len); 1092 ddwprop->window_shift = cpu_to_be32(len);
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index d276cd3edd8f..057fc894be51 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -429,9 +429,6 @@ static int __init pseries_nvram_init_os_partition(struct nvram_os_partition
429 loff_t p; 429 loff_t p;
430 int size; 430 int size;
431 431
432 /* Scan nvram for partitions */
433 nvram_scan_partitions();
434
435 /* Look for ours */ 432 /* Look for ours */
436 p = nvram_find_partition(part->name, NVRAM_SIG_OS, &size); 433 p = nvram_find_partition(part->name, NVRAM_SIG_OS, &size);
437 434
@@ -795,6 +792,9 @@ static int __init pseries_nvram_init_log_partitions(void)
795{ 792{
796 int rc; 793 int rc;
797 794
795 /* Scan nvram for partitions */
796 nvram_scan_partitions();
797
798 rc = pseries_nvram_init_os_partition(&rtas_log_partition); 798 rc = pseries_nvram_init_os_partition(&rtas_log_partition);
799 nvram_init_oops_partition(rc == 0); 799 nvram_init_oops_partition(rc == 0);
800 return 0; 800 return 0;
@@ -804,7 +804,7 @@ machine_arch_initcall(pseries, pseries_nvram_init_log_partitions);
804int __init pSeries_nvram_init(void) 804int __init pSeries_nvram_init(void)
805{ 805{
806 struct device_node *nvram; 806 struct device_node *nvram;
807 const unsigned int *nbytes_p; 807 const __be32 *nbytes_p;
808 unsigned int proplen; 808 unsigned int proplen;
809 809
810 nvram = of_find_node_by_type(NULL, "nvram"); 810 nvram = of_find_node_by_type(NULL, "nvram");
@@ -817,7 +817,7 @@ int __init pSeries_nvram_init(void)
817 return -EIO; 817 return -EIO;
818 } 818 }
819 819
820 nvram_size = *nbytes_p; 820 nvram_size = be32_to_cpup(nbytes_p);
821 821
822 nvram_fetch = rtas_token("nvram-fetch"); 822 nvram_fetch = rtas_token("nvram-fetch");
823 nvram_store = rtas_token("nvram-store"); 823 nvram_store = rtas_token("nvram-store");
diff --git a/arch/powerpc/platforms/pseries/rng.c b/arch/powerpc/platforms/pseries/rng.c
new file mode 100644
index 000000000000..a702f1c08242
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/rng.c
@@ -0,0 +1,44 @@
1/*
2 * Copyright 2013, Michael Ellerman, IBM Corporation.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#define pr_fmt(fmt) "pseries-rng: " fmt
11
12#include <linux/kernel.h>
13#include <linux/of.h>
14#include <asm/archrandom.h>
15#include <asm/machdep.h>
16
17
18static int pseries_get_random_long(unsigned long *v)
19{
20 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
21
22 if (plpar_hcall(H_RANDOM, retbuf) == H_SUCCESS) {
23 *v = retbuf[0];
24 return 1;
25 }
26
27 return 0;
28}
29
30static __init int rng_init(void)
31{
32 struct device_node *dn;
33
34 dn = of_find_compatible_node(NULL, NULL, "ibm,random");
35 if (!dn)
36 return -ENODEV;
37
38 pr_info("Registering arch random hook.\n");
39
40 ppc_md.get_random_long = pseries_get_random_long;
41
42 return 0;
43}
44subsys_initcall(rng_init);
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 1c1771a40250..24f58cb0a543 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -233,18 +233,24 @@ static void __init smp_init_pseries(void)
233 233
234 alloc_bootmem_cpumask_var(&of_spin_mask); 234 alloc_bootmem_cpumask_var(&of_spin_mask);
235 235
236 /* Mark threads which are still spinning in hold loops. */ 236 /*
237 if (cpu_has_feature(CPU_FTR_SMT)) { 237 * Mark threads which are still spinning in hold loops
238 for_each_present_cpu(i) { 238 *
239 if (cpu_thread_in_core(i) == 0) 239 * We know prom_init will not have started them if RTAS supports
240 cpumask_set_cpu(i, of_spin_mask); 240 * query-cpu-stopped-state.
241 } 241 */
242 } else { 242 if (rtas_token("query-cpu-stopped-state") == RTAS_UNKNOWN_SERVICE) {
243 cpumask_copy(of_spin_mask, cpu_present_mask); 243 if (cpu_has_feature(CPU_FTR_SMT)) {
244 for_each_present_cpu(i) {
245 if (cpu_thread_in_core(i) == 0)
246 cpumask_set_cpu(i, of_spin_mask);
247 }
248 } else
249 cpumask_copy(of_spin_mask, cpu_present_mask);
250
251 cpumask_clear_cpu(boot_cpuid, of_spin_mask);
244 } 252 }
245 253
246 cpumask_clear_cpu(boot_cpuid, of_spin_mask);
247
248 /* Non-lpar has additional take/give timebase */ 254 /* Non-lpar has additional take/give timebase */
249 if (rtas_token("freeze-time-base") != RTAS_UNKNOWN_SERVICE) { 255 if (rtas_token("freeze-time-base") != RTAS_UNKNOWN_SERVICE) {
250 smp_ops->give_timebase = rtas_give_timebase; 256 smp_ops->give_timebase = rtas_give_timebase;
diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
index 5f997e79d570..16a255255d30 100644
--- a/arch/powerpc/platforms/pseries/suspend.c
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -106,7 +106,7 @@ static int pseries_prepare_late(void)
106 atomic_set(&suspend_data.done, 0); 106 atomic_set(&suspend_data.done, 0);
107 atomic_set(&suspend_data.error, 0); 107 atomic_set(&suspend_data.error, 0);
108 suspend_data.complete = &suspend_work; 108 suspend_data.complete = &suspend_work;
109 INIT_COMPLETION(suspend_work); 109 reinit_completion(&suspend_work);
110 return 0; 110 return 0;
111} 111}
112 112
diff --git a/arch/powerpc/platforms/wsp/scom_smp.c b/arch/powerpc/platforms/wsp/scom_smp.c
index b56b70aeb497..268bc899c1f7 100644
--- a/arch/powerpc/platforms/wsp/scom_smp.c
+++ b/arch/powerpc/platforms/wsp/scom_smp.c
@@ -116,7 +116,14 @@ static int a2_scom_ram(scom_map_t scom, int thread, u32 insn, int extmask)
116 116
117 scom_write(scom, SCOM_RAMIC, cmd); 117 scom_write(scom, SCOM_RAMIC, cmd);
118 118
119 while (!((val = scom_read(scom, SCOM_RAMC)) & mask)) { 119 for (;;) {
120 if (scom_read(scom, SCOM_RAMC, &val) != 0) {
121 pr_err("SCOM error on instruction 0x%08x, thread %d\n",
122 insn, thread);
123 return -1;
124 }
125 if (val & mask)
126 break;
120 pr_devel("Waiting on RAMC = 0x%llx\n", val); 127 pr_devel("Waiting on RAMC = 0x%llx\n", val);
121 if (++n == 3) { 128 if (++n == 3) {
122 pr_err("RAMC timeout on instruction 0x%08x, thread %d\n", 129 pr_err("RAMC timeout on instruction 0x%08x, thread %d\n",
@@ -151,9 +158,7 @@ static int a2_scom_getgpr(scom_map_t scom, int thread, int gpr, int alt,
151 if (rc) 158 if (rc)
152 return rc; 159 return rc;
153 160
154 *out_gpr = scom_read(scom, SCOM_RAMD); 161 return scom_read(scom, SCOM_RAMD, out_gpr);
155
156 return 0;
157} 162}
158 163
159static int a2_scom_getspr(scom_map_t scom, int thread, int spr, u64 *out_spr) 164static int a2_scom_getspr(scom_map_t scom, int thread, int spr, u64 *out_spr)
@@ -353,7 +358,10 @@ int a2_scom_startup_cpu(unsigned int lcpu, int thr_idx, struct device_node *np)
353 358
354 pr_devel("Bringing up CPU%d using SCOM...\n", lcpu); 359 pr_devel("Bringing up CPU%d using SCOM...\n", lcpu);
355 360
356 pccr0 = scom_read(scom, SCOM_PCCR0); 361 if (scom_read(scom, SCOM_PCCR0, &pccr0) != 0) {
362 printk(KERN_ERR "XSCOM failure readng PCCR0 on CPU%d\n", lcpu);
363 return -1;
364 }
357 scom_write(scom, SCOM_PCCR0, pccr0 | SCOM_PCCR0_ENABLE_DEBUG | 365 scom_write(scom, SCOM_PCCR0, pccr0 | SCOM_PCCR0_ENABLE_DEBUG |
358 SCOM_PCCR0_ENABLE_RAM); 366 SCOM_PCCR0_ENABLE_RAM);
359 367
diff --git a/arch/powerpc/platforms/wsp/scom_wsp.c b/arch/powerpc/platforms/wsp/scom_wsp.c
index 4052e2259f30..8928507affea 100644
--- a/arch/powerpc/platforms/wsp/scom_wsp.c
+++ b/arch/powerpc/platforms/wsp/scom_wsp.c
@@ -50,18 +50,22 @@ static void wsp_scom_unmap(scom_map_t map)
50 iounmap((void *)map); 50 iounmap((void *)map);
51} 51}
52 52
53static u64 wsp_scom_read(scom_map_t map, u32 reg) 53static int wsp_scom_read(scom_map_t map, u64 reg, u64 *value)
54{ 54{
55 u64 __iomem *addr = (u64 __iomem *)map; 55 u64 __iomem *addr = (u64 __iomem *)map;
56 56
57 return in_be64(addr + reg); 57 *value = in_be64(addr + reg);
58
59 return 0;
58} 60}
59 61
60static void wsp_scom_write(scom_map_t map, u32 reg, u64 value) 62static int wsp_scom_write(scom_map_t map, u64 reg, u64 value)
61{ 63{
62 u64 __iomem *addr = (u64 __iomem *)map; 64 u64 __iomem *addr = (u64 __iomem *)map;
63 65
64 return out_be64(addr + reg, value); 66 out_be64(addr + reg, value);
67
68 return 0;
65} 69}
66 70
67static const struct scom_controller wsp_scom_controller = { 71static const struct scom_controller wsp_scom_controller = {
diff --git a/arch/powerpc/platforms/wsp/wsp.c b/arch/powerpc/platforms/wsp/wsp.c
index d25cc96c21b8..ddb6efe88914 100644
--- a/arch/powerpc/platforms/wsp/wsp.c
+++ b/arch/powerpc/platforms/wsp/wsp.c
@@ -89,6 +89,7 @@ void wsp_halt(void)
89 struct device_node *dn; 89 struct device_node *dn;
90 struct device_node *mine; 90 struct device_node *mine;
91 struct device_node *me; 91 struct device_node *me;
92 int rc;
92 93
93 me = of_get_cpu_node(smp_processor_id(), NULL); 94 me = of_get_cpu_node(smp_processor_id(), NULL);
94 mine = scom_find_parent(me); 95 mine = scom_find_parent(me);
@@ -101,15 +102,15 @@ void wsp_halt(void)
101 102
102 /* read-modify-write it so the HW probe does not get 103 /* read-modify-write it so the HW probe does not get
103 * confused */ 104 * confused */
104 val = scom_read(m, 0); 105 rc = scom_read(m, 0, &val);
105 val |= 1; 106 if (rc == 0)
106 scom_write(m, 0, val); 107 scom_write(m, 0, val | 1);
107 scom_unmap(m); 108 scom_unmap(m);
108 } 109 }
109 m = scom_map(mine, 0, 1); 110 m = scom_map(mine, 0, 1);
110 val = scom_read(m, 0); 111 rc = scom_read(m, 0, &val);
111 val |= 1; 112 if (rc == 0)
112 scom_write(m, 0, val); 113 scom_write(m, 0, val | 1);
113 /* should never return */ 114 /* should never return */
114 scom_unmap(m); 115 scom_unmap(m);
115} 116}
diff --git a/arch/powerpc/sysdev/Kconfig b/arch/powerpc/sysdev/Kconfig
index ab4cb5476472..13ec968be4c7 100644
--- a/arch/powerpc/sysdev/Kconfig
+++ b/arch/powerpc/sysdev/Kconfig
@@ -28,7 +28,7 @@ config PPC_SCOM
28 28
29config SCOM_DEBUGFS 29config SCOM_DEBUGFS
30 bool "Expose SCOM controllers via debugfs" 30 bool "Expose SCOM controllers via debugfs"
31 depends on PPC_SCOM 31 depends on PPC_SCOM && DEBUG_FS
32 default n 32 default n
33 33
34config GE_FPGA 34config GE_FPGA
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
index 4dd534194ae8..4f7869571290 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -22,6 +22,7 @@
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/export.h> 23#include <linux/export.h>
24#include <linux/of.h> 24#include <linux/of.h>
25#include <linux/of_address.h>
25#include <linux/slab.h> 26#include <linux/slab.h>
26 27
27#include <asm/udbg.h> 28#include <asm/udbg.h>
diff --git a/arch/powerpc/sysdev/ehv_pic.c b/arch/powerpc/sysdev/ehv_pic.c
index 9cd0e60716fe..b74085cea1af 100644
--- a/arch/powerpc/sysdev/ehv_pic.c
+++ b/arch/powerpc/sysdev/ehv_pic.c
@@ -19,6 +19,7 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/of_address.h>
22 23
23#include <asm/io.h> 24#include <asm/io.h>
24#include <asm/irq.h> 25#include <asm/irq.h>
diff --git a/arch/powerpc/sysdev/fsl_gtm.c b/arch/powerpc/sysdev/fsl_gtm.c
index 0eb871cc3437..06ac3c61b3d0 100644
--- a/arch/powerpc/sysdev/fsl_gtm.c
+++ b/arch/powerpc/sysdev/fsl_gtm.c
@@ -19,6 +19,8 @@
19#include <linux/list.h> 19#include <linux/list.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/of_address.h>
23#include <linux/of_irq.h>
22#include <linux/spinlock.h> 24#include <linux/spinlock.h>
23#include <linux/bitops.h> 25#include <linux/bitops.h>
24#include <linux/slab.h> 26#include <linux/slab.h>
@@ -401,16 +403,15 @@ static int __init fsl_gtm_init(void)
401 gtm->clock = *clock; 403 gtm->clock = *clock;
402 404
403 for (i = 0; i < ARRAY_SIZE(gtm->timers); i++) { 405 for (i = 0; i < ARRAY_SIZE(gtm->timers); i++) {
404 int ret; 406 unsigned int irq;
405 struct resource irq;
406 407
407 ret = of_irq_to_resource(np, i, &irq); 408 irq = irq_of_parse_and_map(np, i);
408 if (ret == NO_IRQ) { 409 if (irq == NO_IRQ) {
409 pr_err("%s: not enough interrupts specified\n", 410 pr_err("%s: not enough interrupts specified\n",
410 np->full_name); 411 np->full_name);
411 goto err; 412 goto err;
412 } 413 }
413 gtm->timers[i].irq = irq.start; 414 gtm->timers[i].irq = irq;
414 gtm->timers[i].gtm = gtm; 415 gtm->timers[i].gtm = gtm;
415 } 416 }
416 417
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index ccfb50ddfe38..4dfd61df8aba 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -40,12 +40,12 @@
40 40
41static int fsl_pcie_bus_fixup, is_mpc83xx_pci; 41static int fsl_pcie_bus_fixup, is_mpc83xx_pci;
42 42
43static void quirk_fsl_pcie_header(struct pci_dev *dev) 43static void quirk_fsl_pcie_early(struct pci_dev *dev)
44{ 44{
45 u8 hdr_type; 45 u8 hdr_type;
46 46
47 /* if we aren't a PCIe don't bother */ 47 /* if we aren't a PCIe don't bother */
48 if (!pci_find_capability(dev, PCI_CAP_ID_EXP)) 48 if (!pci_is_pcie(dev))
49 return; 49 return;
50 50
51 /* if we aren't in host mode don't bother */ 51 /* if we aren't in host mode don't bother */
@@ -562,7 +562,8 @@ no_bridge:
562} 562}
563#endif /* CONFIG_FSL_SOC_BOOKE || CONFIG_PPC_86xx */ 563#endif /* CONFIG_FSL_SOC_BOOKE || CONFIG_PPC_86xx */
564 564
565DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, quirk_fsl_pcie_header); 565DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID,
566 quirk_fsl_pcie_early);
566 567
567#if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x) 568#if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x)
568struct mpc83xx_pcie_priv { 569struct mpc83xx_pcie_priv {
diff --git a/arch/powerpc/sysdev/fsl_pmc.c b/arch/powerpc/sysdev/fsl_pmc.c
index 592a0f8d527a..8cf4aa0e3a25 100644
--- a/arch/powerpc/sysdev/fsl_pmc.c
+++ b/arch/powerpc/sysdev/fsl_pmc.c
@@ -18,6 +18,7 @@
18#include <linux/suspend.h> 18#include <linux/suspend.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/device.h> 20#include <linux/device.h>
21#include <linux/of_address.h>
21#include <linux/of_platform.h> 22#include <linux/of_platform.h>
22 23
23struct pmc_regs { 24struct pmc_regs {
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index e2fb3171f41b..95dd892e9904 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -28,6 +28,8 @@
28#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/of_address.h>
32#include <linux/of_irq.h>
31#include <linux/of_platform.h> 33#include <linux/of_platform.h>
32#include <linux/delay.h> 34#include <linux/delay.h>
33#include <linux/slab.h> 35#include <linux/slab.h>
diff --git a/arch/powerpc/sysdev/fsl_rmu.c b/arch/powerpc/sysdev/fsl_rmu.c
index 14bd5221f28a..00e224a1048c 100644
--- a/arch/powerpc/sysdev/fsl_rmu.c
+++ b/arch/powerpc/sysdev/fsl_rmu.c
@@ -27,6 +27,7 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/of_irq.h>
30#include <linux/of_platform.h> 31#include <linux/of_platform.h>
31#include <linux/slab.h> 32#include <linux/slab.h>
32 33
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h
index c6d00736f07f..4c5a19ef4f0b 100644
--- a/arch/powerpc/sysdev/fsl_soc.h
+++ b/arch/powerpc/sysdev/fsl_soc.h
@@ -21,8 +21,6 @@ struct device_node;
21 21
22extern void fsl_rstcr_restart(char *cmd); 22extern void fsl_rstcr_restart(char *cmd);
23 23
24#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
25
26/* The different ports that the DIU can be connected to */ 24/* The different ports that the DIU can be connected to */
27enum fsl_diu_monitor_port { 25enum fsl_diu_monitor_port {
28 FSL_DIU_PORT_DVI, /* DVI */ 26 FSL_DIU_PORT_DVI, /* DVI */
@@ -43,7 +41,6 @@ struct platform_diu_data_ops {
43}; 41};
44 42
45extern struct platform_diu_data_ops diu_ops; 43extern struct platform_diu_data_ops diu_ops;
46#endif
47 44
48void fsl_hv_restart(char *cmd); 45void fsl_hv_restart(char *cmd);
49void fsl_hv_halt(void); 46void fsl_hv_halt(void);
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 1be54faf60dd..0e166ed4cd16 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -535,7 +535,7 @@ static void __init mpic_scan_ht_pic(struct mpic *mpic, u8 __iomem *devbase,
535 mpic->fixups[irq].data = readl(base + 4) | 0x80000000; 535 mpic->fixups[irq].data = readl(base + 4) | 0x80000000;
536 } 536 }
537} 537}
538 538
539 539
540static void __init mpic_scan_ht_pics(struct mpic *mpic) 540static void __init mpic_scan_ht_pics(struct mpic *mpic)
541{ 541{
@@ -1088,8 +1088,14 @@ static int mpic_host_map(struct irq_domain *h, unsigned int virq,
1088 * is done here. 1088 * is done here.
1089 */ 1089 */
1090 if (!mpic_is_ipi(mpic, hw) && (mpic->flags & MPIC_NO_RESET)) { 1090 if (!mpic_is_ipi(mpic, hw) && (mpic->flags & MPIC_NO_RESET)) {
1091 int cpu;
1092
1093 preempt_disable();
1094 cpu = mpic_processor_id(mpic);
1095 preempt_enable();
1096
1091 mpic_set_vector(virq, hw); 1097 mpic_set_vector(virq, hw);
1092 mpic_set_destination(virq, mpic_processor_id(mpic)); 1098 mpic_set_destination(virq, cpu);
1093 mpic_irq_set_priority(virq, 8); 1099 mpic_irq_set_priority(virq, 8);
1094 } 1100 }
1095 1101
@@ -1475,7 +1481,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1475 * as a default instead of the value read from the HW. 1481 * as a default instead of the value read from the HW.
1476 */ 1482 */
1477 last_irq = (greg_feature & MPIC_GREG_FEATURE_LAST_SRC_MASK) 1483 last_irq = (greg_feature & MPIC_GREG_FEATURE_LAST_SRC_MASK)
1478 >> MPIC_GREG_FEATURE_LAST_SRC_SHIFT; 1484 >> MPIC_GREG_FEATURE_LAST_SRC_SHIFT;
1479 if (isu_size) 1485 if (isu_size)
1480 last_irq = isu_size * MPIC_MAX_ISU - 1; 1486 last_irq = isu_size * MPIC_MAX_ISU - 1;
1481 of_property_read_u32(mpic->node, "last-interrupt-source", &last_irq); 1487 of_property_read_u32(mpic->node, "last-interrupt-source", &last_irq);
@@ -1625,7 +1631,7 @@ void __init mpic_init(struct mpic *mpic)
1625 /* start with vector = source number, and masked */ 1631 /* start with vector = source number, and masked */
1626 u32 vecpri = MPIC_VECPRI_MASK | i | 1632 u32 vecpri = MPIC_VECPRI_MASK | i |
1627 (8 << MPIC_VECPRI_PRIORITY_SHIFT); 1633 (8 << MPIC_VECPRI_PRIORITY_SHIFT);
1628 1634
1629 /* check if protected */ 1635 /* check if protected */
1630 if (mpic->protected && test_bit(i, mpic->protected)) 1636 if (mpic->protected && test_bit(i, mpic->protected))
1631 continue; 1637 continue;
@@ -1634,7 +1640,7 @@ void __init mpic_init(struct mpic *mpic)
1634 mpic_irq_write(i, MPIC_INFO(IRQ_DESTINATION), 1 << cpu); 1640 mpic_irq_write(i, MPIC_INFO(IRQ_DESTINATION), 1 << cpu);
1635 } 1641 }
1636 } 1642 }
1637 1643
1638 /* Init spurious vector */ 1644 /* Init spurious vector */
1639 mpic_write(mpic->gregs, MPIC_INFO(GREG_SPURIOUS), mpic->spurious_vec); 1645 mpic_write(mpic->gregs, MPIC_INFO(GREG_SPURIOUS), mpic->spurious_vec);
1640 1646
diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
index c75325865a85..2c9b52aa266c 100644
--- a/arch/powerpc/sysdev/mpic_msgr.c
+++ b/arch/powerpc/sysdev/mpic_msgr.c
@@ -237,15 +237,13 @@ static int mpic_msgr_probe(struct platform_device *dev)
237 raw_spin_lock_init(&msgr->lock); 237 raw_spin_lock_init(&msgr->lock);
238 238
239 if (receive_mask & (1 << i)) { 239 if (receive_mask & (1 << i)) {
240 struct resource irq; 240 msgr->irq = irq_of_parse_and_map(np, irq_index);
241 241 if (msgr->irq == NO_IRQ) {
242 if (of_irq_to_resource(np, irq_index, &irq) == NO_IRQ) {
243 dev_err(&dev->dev, 242 dev_err(&dev->dev,
244 "Missing interrupt specifier"); 243 "Missing interrupt specifier");
245 kfree(msgr); 244 kfree(msgr);
246 return -EFAULT; 245 return -EFAULT;
247 } 246 }
248 msgr->irq = irq.start;
249 irq_index += 1; 247 irq_index += 1;
250 } else { 248 } else {
251 msgr->irq = NO_IRQ; 249 msgr->irq = NO_IRQ;
diff --git a/arch/powerpc/sysdev/mpic_msi.c b/arch/powerpc/sysdev/mpic_msi.c
index bbf342c88314..7dc39f35a4cc 100644
--- a/arch/powerpc/sysdev/mpic_msi.c
+++ b/arch/powerpc/sysdev/mpic_msi.c
@@ -35,7 +35,7 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
35 const struct irq_domain_ops *ops = mpic->irqhost->ops; 35 const struct irq_domain_ops *ops = mpic->irqhost->ops;
36 struct device_node *np; 36 struct device_node *np;
37 int flags, index, i; 37 int flags, index, i;
38 struct of_irq oirq; 38 struct of_phandle_args oirq;
39 39
40 pr_debug("mpic: found U3, guessing msi allocator setup\n"); 40 pr_debug("mpic: found U3, guessing msi allocator setup\n");
41 41
@@ -63,9 +63,9 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
63 pr_debug("mpic: mapping hwirqs for %s\n", np->full_name); 63 pr_debug("mpic: mapping hwirqs for %s\n", np->full_name);
64 64
65 index = 0; 65 index = 0;
66 while (of_irq_map_one(np, index++, &oirq) == 0) { 66 while (of_irq_parse_one(np, index++, &oirq) == 0) {
67 ops->xlate(mpic->irqhost, NULL, oirq.specifier, 67 ops->xlate(mpic->irqhost, NULL, oirq.args,
68 oirq.size, &hwirq, &flags); 68 oirq.args_count, &hwirq, &flags);
69 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, hwirq); 69 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, hwirq);
70 } 70 }
71 } 71 }
diff --git a/arch/powerpc/sysdev/mpic_timer.c b/arch/powerpc/sysdev/mpic_timer.c
index c06db92a4fb1..22d7d57eead9 100644
--- a/arch/powerpc/sysdev/mpic_timer.c
+++ b/arch/powerpc/sysdev/mpic_timer.c
@@ -19,7 +19,9 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/of_address.h>
22#include <linux/of_device.h> 23#include <linux/of_device.h>
24#include <linux/of_irq.h>
23#include <linux/syscore_ops.h> 25#include <linux/syscore_ops.h>
24#include <sysdev/fsl_soc.h> 26#include <sysdev/fsl_soc.h>
25#include <asm/io.h> 27#include <asm/io.h>
diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c
index 4a25c26f0bf4..a3a8fad8537d 100644
--- a/arch/powerpc/sysdev/mv64x60_dev.c
+++ b/arch/powerpc/sysdev/mv64x60_dev.c
@@ -228,7 +228,7 @@ static struct platform_device * __init mv64x60_eth_register_shared_pdev(
228 228
229 if (id == 0) { 229 if (id == 0) {
230 pdev = platform_device_register_simple("orion-mdio", -1, &r[1], 1); 230 pdev = platform_device_register_simple("orion-mdio", -1, &r[1], 1);
231 if (!pdev) 231 if (IS_ERR(pdev))
232 return pdev; 232 return pdev;
233 } 233 }
234 234
diff --git a/arch/powerpc/sysdev/of_rtc.c b/arch/powerpc/sysdev/of_rtc.c
index c9e803f3e267..6f54b54b1328 100644
--- a/arch/powerpc/sysdev/of_rtc.c
+++ b/arch/powerpc/sysdev/of_rtc.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/of_address.h>
14#include <linux/of_platform.h> 15#include <linux/of_platform.h>
15#include <linux/slab.h> 16#include <linux/slab.h>
16 17
diff --git a/arch/powerpc/sysdev/ppc4xx_ocm.c b/arch/powerpc/sysdev/ppc4xx_ocm.c
index 1b15f93479c3..b7c43453236d 100644
--- a/arch/powerpc/sysdev/ppc4xx_ocm.c
+++ b/arch/powerpc/sysdev/ppc4xx_ocm.c
@@ -26,6 +26,7 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
28#include <linux/of.h> 28#include <linux/of.h>
29#include <linux/of_address.h>
29#include <asm/rheap.h> 30#include <asm/rheap.h>
30#include <asm/ppc4xx_ocm.h> 31#include <asm/ppc4xx_ocm.h>
31#include <linux/slab.h> 32#include <linux/slab.h>
diff --git a/arch/powerpc/sysdev/ppc4xx_soc.c b/arch/powerpc/sysdev/ppc4xx_soc.c
index 0debcc31ad70..5c77c9ba33aa 100644
--- a/arch/powerpc/sysdev/ppc4xx_soc.c
+++ b/arch/powerpc/sysdev/ppc4xx_soc.c
@@ -19,6 +19,7 @@
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/of_irq.h>
22#include <linux/of_platform.h> 23#include <linux/of_platform.h>
23 24
24#include <asm/dcr.h> 25#include <asm/dcr.h>
diff --git a/arch/powerpc/sysdev/scom.c b/arch/powerpc/sysdev/scom.c
index 9193e12df695..6f5a8d177c42 100644
--- a/arch/powerpc/sysdev/scom.c
+++ b/arch/powerpc/sysdev/scom.c
@@ -25,6 +25,7 @@
25#include <asm/debug.h> 25#include <asm/debug.h>
26#include <asm/prom.h> 26#include <asm/prom.h>
27#include <asm/scom.h> 27#include <asm/scom.h>
28#include <asm/uaccess.h>
28 29
29const struct scom_controller *scom_controller; 30const struct scom_controller *scom_controller;
30EXPORT_SYMBOL_GPL(scom_controller); 31EXPORT_SYMBOL_GPL(scom_controller);
@@ -53,7 +54,7 @@ scom_map_t scom_map_device(struct device_node *dev, int index)
53{ 54{
54 struct device_node *parent; 55 struct device_node *parent;
55 unsigned int cells, size; 56 unsigned int cells, size;
56 const u32 *prop; 57 const __be32 *prop, *sprop;
57 u64 reg, cnt; 58 u64 reg, cnt;
58 scom_map_t ret; 59 scom_map_t ret;
59 60
@@ -62,12 +63,24 @@ scom_map_t scom_map_device(struct device_node *dev, int index)
62 if (parent == NULL) 63 if (parent == NULL)
63 return 0; 64 return 0;
64 65
65 prop = of_get_property(parent, "#scom-cells", NULL); 66 /*
66 cells = prop ? *prop : 1; 67 * We support "scom-reg" properties for adding scom registers
67 68 * to a random device-tree node with an explicit scom-parent
69 *
70 * We also support the simple "reg" property if the device is
71 * a direct child of a scom controller.
72 *
73 * In case both exist, "scom-reg" takes precedence.
74 */
68 prop = of_get_property(dev, "scom-reg", &size); 75 prop = of_get_property(dev, "scom-reg", &size);
76 sprop = of_get_property(parent, "#scom-cells", NULL);
77 if (!prop && parent == dev->parent) {
78 prop = of_get_property(dev, "reg", &size);
79 sprop = of_get_property(parent, "#address-cells", NULL);
80 }
69 if (!prop) 81 if (!prop)
70 return 0; 82 return NULL;
83 cells = sprop ? be32_to_cpup(sprop) : 1;
71 size >>= 2; 84 size >>= 2;
72 85
73 if (index >= (size / (2*cells))) 86 if (index >= (size / (2*cells)))
@@ -86,62 +99,89 @@ EXPORT_SYMBOL_GPL(scom_map_device);
86#ifdef CONFIG_SCOM_DEBUGFS 99#ifdef CONFIG_SCOM_DEBUGFS
87struct scom_debug_entry { 100struct scom_debug_entry {
88 struct device_node *dn; 101 struct device_node *dn;
89 unsigned long addr; 102 struct debugfs_blob_wrapper path;
90 scom_map_t map; 103 char name[16];
91 spinlock_t lock;
92 char name[8];
93 struct debugfs_blob_wrapper blob;
94}; 104};
95 105
96static int scom_addr_set(void *data, u64 val) 106static ssize_t scom_debug_read(struct file *filp, char __user *ubuf,
107 size_t count, loff_t *ppos)
97{ 108{
98 struct scom_debug_entry *ent = data; 109 struct scom_debug_entry *ent = filp->private_data;
99 110 u64 __user *ubuf64 = (u64 __user *)ubuf;
100 ent->addr = 0; 111 loff_t off = *ppos;
101 scom_unmap(ent->map); 112 ssize_t done = 0;
102 113 u64 reg, reg_cnt, val;
103 ent->map = scom_map(ent->dn, val, 1); 114 scom_map_t map;
104 if (scom_map_ok(ent->map)) 115 int rc;
105 ent->addr = val; 116
106 else 117 if (off < 0 || (off & 7) || (count & 7))
107 return -EFAULT; 118 return -EINVAL;
108 119 reg = off >> 3;
109 return 0; 120 reg_cnt = count >> 3;
110} 121
111 122 map = scom_map(ent->dn, reg, reg_cnt);
112static int scom_addr_get(void *data, u64 *val) 123 if (!scom_map_ok(map))
113{ 124 return -ENXIO;
114 struct scom_debug_entry *ent = data; 125
115 *val = ent->addr; 126 for (reg = 0; reg < reg_cnt; reg++) {
116 return 0; 127 rc = scom_read(map, reg, &val);
128 if (!rc)
129 rc = put_user(val, ubuf64);
130 if (rc) {
131 if (!done)
132 done = rc;
133 break;
134 }
135 ubuf64++;
136 *ppos += 8;
137 done += 8;
138 }
139 scom_unmap(map);
140 return done;
117} 141}
118DEFINE_SIMPLE_ATTRIBUTE(scom_addr_fops, scom_addr_get, scom_addr_set,
119 "0x%llx\n");
120 142
121static int scom_val_set(void *data, u64 val) 143static ssize_t scom_debug_write(struct file* filp, const char __user *ubuf,
144 size_t count, loff_t *ppos)
122{ 145{
123 struct scom_debug_entry *ent = data; 146 struct scom_debug_entry *ent = filp->private_data;
124 147 u64 __user *ubuf64 = (u64 __user *)ubuf;
125 if (!scom_map_ok(ent->map)) 148 loff_t off = *ppos;
126 return -EFAULT; 149 ssize_t done = 0;
127 150 u64 reg, reg_cnt, val;
128 scom_write(ent->map, 0, val); 151 scom_map_t map;
129 152 int rc;
130 return 0; 153
154 if (off < 0 || (off & 7) || (count & 7))
155 return -EINVAL;
156 reg = off >> 3;
157 reg_cnt = count >> 3;
158
159 map = scom_map(ent->dn, reg, reg_cnt);
160 if (!scom_map_ok(map))
161 return -ENXIO;
162
163 for (reg = 0; reg < reg_cnt; reg++) {
164 rc = get_user(val, ubuf64);
165 if (!rc)
166 rc = scom_write(map, reg, val);
167 if (rc) {
168 if (!done)
169 done = rc;
170 break;
171 }
172 ubuf64++;
173 done += 8;
174 }
175 scom_unmap(map);
176 return done;
131} 177}
132 178
133static int scom_val_get(void *data, u64 *val) 179static const struct file_operations scom_debug_fops = {
134{ 180 .read = scom_debug_read,
135 struct scom_debug_entry *ent = data; 181 .write = scom_debug_write,
136 182 .open = simple_open,
137 if (!scom_map_ok(ent->map)) 183 .llseek = default_llseek,
138 return -EFAULT; 184};
139
140 *val = scom_read(ent->map, 0);
141 return 0;
142}
143DEFINE_SIMPLE_ATTRIBUTE(scom_val_fops, scom_val_get, scom_val_set,
144 "0x%llx\n");
145 185
146static int scom_debug_init_one(struct dentry *root, struct device_node *dn, 186static int scom_debug_init_one(struct dentry *root, struct device_node *dn,
147 int i) 187 int i)
@@ -154,11 +194,9 @@ static int scom_debug_init_one(struct dentry *root, struct device_node *dn,
154 return -ENOMEM; 194 return -ENOMEM;
155 195
156 ent->dn = of_node_get(dn); 196 ent->dn = of_node_get(dn);
157 ent->map = SCOM_MAP_INVALID; 197 snprintf(ent->name, 16, "%08x", i);
158 spin_lock_init(&ent->lock); 198 ent->path.data = (void*) dn->full_name;
159 snprintf(ent->name, 8, "scom%d", i); 199 ent->path.size = strlen(dn->full_name);
160 ent->blob.data = (void*) dn->full_name;
161 ent->blob.size = strlen(dn->full_name);
162 200
163 dir = debugfs_create_dir(ent->name, root); 201 dir = debugfs_create_dir(ent->name, root);
164 if (!dir) { 202 if (!dir) {
@@ -167,9 +205,8 @@ static int scom_debug_init_one(struct dentry *root, struct device_node *dn,
167 return -1; 205 return -1;
168 } 206 }
169 207
170 debugfs_create_file("addr", 0600, dir, ent, &scom_addr_fops); 208 debugfs_create_blob("devspec", 0400, dir, &ent->path);
171 debugfs_create_file("value", 0600, dir, ent, &scom_val_fops); 209 debugfs_create_file("access", 0600, dir, ent, &scom_debug_fops);
172 debugfs_create_blob("path", 0400, dir, &ent->blob);
173 210
174 return 0; 211 return 0;
175} 212}
@@ -185,8 +222,13 @@ static int scom_debug_init(void)
185 return -1; 222 return -1;
186 223
187 i = rc = 0; 224 i = rc = 0;
188 for_each_node_with_property(dn, "scom-controller") 225 for_each_node_with_property(dn, "scom-controller") {
189 rc |= scom_debug_init_one(root, dn, i++); 226 int id = of_get_ibm_chip_id(dn);
227 if (id == -1)
228 id = i;
229 rc |= scom_debug_init_one(root, dn, id);
230 i++;
231 }
190 232
191 return rc; 233 return rc;
192} 234}
diff --git a/arch/powerpc/sysdev/xics/ics-opal.c b/arch/powerpc/sysdev/xics/ics-opal.c
index 39d72212655e..3c6ee1b64e5d 100644
--- a/arch/powerpc/sysdev/xics/ics-opal.c
+++ b/arch/powerpc/sysdev/xics/ics-opal.c
@@ -112,6 +112,7 @@ static int ics_opal_set_affinity(struct irq_data *d,
112 bool force) 112 bool force)
113{ 113{
114 unsigned int hw_irq = (unsigned int)irqd_to_hwirq(d); 114 unsigned int hw_irq = (unsigned int)irqd_to_hwirq(d);
115 __be16 oserver;
115 int16_t server; 116 int16_t server;
116 int8_t priority; 117 int8_t priority;
117 int64_t rc; 118 int64_t rc;
@@ -120,13 +121,13 @@ static int ics_opal_set_affinity(struct irq_data *d,
120 if (hw_irq == XICS_IPI || hw_irq == XICS_IRQ_SPURIOUS) 121 if (hw_irq == XICS_IPI || hw_irq == XICS_IRQ_SPURIOUS)
121 return -1; 122 return -1;
122 123
123 rc = opal_get_xive(hw_irq, &server, &priority); 124 rc = opal_get_xive(hw_irq, &oserver, &priority);
124 if (rc != OPAL_SUCCESS) { 125 if (rc != OPAL_SUCCESS) {
125 pr_err("%s: opal_set_xive(irq=%d [hw 0x%x] server=%x)" 126 pr_err("%s: opal_get_xive(irq=%d [hw 0x%x]) error %lld\n",
126 " error %lld\n", 127 __func__, d->irq, hw_irq, rc);
127 __func__, d->irq, hw_irq, server, rc);
128 return -1; 128 return -1;
129 } 129 }
130 server = be16_to_cpu(oserver);
130 131
131 wanted_server = xics_get_irq_server(d->irq, cpumask, 1); 132 wanted_server = xics_get_irq_server(d->irq, cpumask, 1);
132 if (wanted_server < 0) { 133 if (wanted_server < 0) {
@@ -181,7 +182,7 @@ static int ics_opal_map(struct ics *ics, unsigned int virq)
181{ 182{
182 unsigned int hw_irq = (unsigned int)virq_to_hw(virq); 183 unsigned int hw_irq = (unsigned int)virq_to_hw(virq);
183 int64_t rc; 184 int64_t rc;
184 int16_t server; 185 __be16 server;
185 int8_t priority; 186 int8_t priority;
186 187
187 if (WARN_ON(hw_irq == XICS_IPI || hw_irq == XICS_IRQ_SPURIOUS)) 188 if (WARN_ON(hw_irq == XICS_IPI || hw_irq == XICS_IRQ_SPURIOUS))
@@ -201,7 +202,7 @@ static int ics_opal_map(struct ics *ics, unsigned int virq)
201static void ics_opal_mask_unknown(struct ics *ics, unsigned long vec) 202static void ics_opal_mask_unknown(struct ics *ics, unsigned long vec)
202{ 203{
203 int64_t rc; 204 int64_t rc;
204 int16_t server; 205 __be16 server;
205 int8_t priority; 206 int8_t priority;
206 207
207 /* Check if HAL knows about this interrupt */ 208 /* Check if HAL knows about this interrupt */
@@ -215,14 +216,14 @@ static void ics_opal_mask_unknown(struct ics *ics, unsigned long vec)
215static long ics_opal_get_server(struct ics *ics, unsigned long vec) 216static long ics_opal_get_server(struct ics *ics, unsigned long vec)
216{ 217{
217 int64_t rc; 218 int64_t rc;
218 int16_t server; 219 __be16 server;
219 int8_t priority; 220 int8_t priority;
220 221
221 /* Check if HAL knows about this interrupt */ 222 /* Check if HAL knows about this interrupt */
222 rc = opal_get_xive(vec, &server, &priority); 223 rc = opal_get_xive(vec, &server, &priority);
223 if (rc != OPAL_SUCCESS) 224 if (rc != OPAL_SUCCESS)
224 return -1; 225 return -1;
225 return ics_opal_unmangle_server(server); 226 return ics_opal_unmangle_server(be16_to_cpu(server));
226} 227}
227 228
228int __init ics_opal_init(void) 229int __init ics_opal_init(void)
diff --git a/arch/powerpc/sysdev/xilinx_intc.c b/arch/powerpc/sysdev/xilinx_intc.c
index 8d73c3c0bee6..83f943a8e0db 100644
--- a/arch/powerpc/sysdev/xilinx_intc.c
+++ b/arch/powerpc/sysdev/xilinx_intc.c
@@ -23,6 +23,8 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/of.h> 25#include <linux/of.h>
26#include <linux/of_address.h>
27#include <linux/of_irq.h>
26#include <asm/io.h> 28#include <asm/io.h>
27#include <asm/processor.h> 29#include <asm/processor.h>
28#include <asm/i8259.h> 30#include <asm/i8259.h>
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index dcc6ac2d8026..314fced4fc14 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -93,16 +93,17 @@ config S390
93 select ARCH_INLINE_WRITE_UNLOCK_IRQ 93 select ARCH_INLINE_WRITE_UNLOCK_IRQ
94 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE 94 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
95 select ARCH_SAVE_PAGE_KEYS if HIBERNATION 95 select ARCH_SAVE_PAGE_KEYS if HIBERNATION
96 select ARCH_USE_CMPXCHG_LOCKREF
96 select ARCH_WANT_IPC_PARSE_VERSION 97 select ARCH_WANT_IPC_PARSE_VERSION
97 select BUILDTIME_EXTABLE_SORT 98 select BUILDTIME_EXTABLE_SORT
98 select CLONE_BACKWARDS2 99 select CLONE_BACKWARDS2
99 select GENERIC_CLOCKEVENTS 100 select GENERIC_CLOCKEVENTS
100 select GENERIC_CPU_DEVICES if !SMP 101 select GENERIC_CPU_DEVICES if !SMP
102 select GENERIC_FIND_FIRST_BIT
101 select GENERIC_SMP_IDLE_THREAD 103 select GENERIC_SMP_IDLE_THREAD
102 select GENERIC_TIME_VSYSCALL_OLD 104 select GENERIC_TIME_VSYSCALL_OLD
103 select HAVE_ALIGNED_STRUCT_PAGE if SLUB 105 select HAVE_ALIGNED_STRUCT_PAGE if SLUB
104 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 106 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
105 select HAVE_ARCH_MUTEX_CPU_RELAX
106 select HAVE_ARCH_SECCOMP_FILTER 107 select HAVE_ARCH_SECCOMP_FILTER
107 select HAVE_ARCH_TRACEHOOK 108 select HAVE_ARCH_TRACEHOOK
108 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT 109 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT
@@ -140,7 +141,6 @@ config S390
140 select OLD_SIGACTION 141 select OLD_SIGACTION
141 select OLD_SIGSUSPEND3 142 select OLD_SIGSUSPEND3
142 select SYSCTL_EXCEPTION_TRACE 143 select SYSCTL_EXCEPTION_TRACE
143 select USE_GENERIC_SMP_HELPERS if SMP
144 select VIRT_CPU_ACCOUNTING 144 select VIRT_CPU_ACCOUNTING
145 select VIRT_TO_BUS 145 select VIRT_TO_BUS
146 146
@@ -237,6 +237,67 @@ config MARCH_ZEC12
237 237
238endchoice 238endchoice
239 239
240config MARCH_G5_TUNE
241 def_bool TUNE_G5 || MARCH_G5 && TUNE_DEFAULT
242
243config MARCH_Z900_TUNE
244 def_bool TUNE_Z900 || MARCH_Z900 && TUNE_DEFAULT
245
246config MARCH_Z990_TUNE
247 def_bool TUNE_Z990 || MARCH_Z990 && TUNE_DEFAULT
248
249config MARCH_Z9_109_TUNE
250 def_bool TUNE_Z9_109 || MARCH_Z9_109 && TUNE_DEFAULT
251
252config MARCH_Z10_TUNE
253 def_bool TUNE_Z10 || MARCH_Z10 && TUNE_DEFAULT
254
255config MARCH_Z196_TUNE
256 def_bool TUNE_Z196 || MARCH_Z196 && TUNE_DEFAULT
257
258config MARCH_ZEC12_TUNE
259 def_bool TUNE_ZEC12 || MARCH_ZEC12 && TUNE_DEFAULT
260
261choice
262 prompt "Tune code generation"
263 default TUNE_DEFAULT
264 help
265 Cause the compiler to tune (-mtune) the generated code for a machine.
266 This will make the code run faster on the selected machine but
267 somewhat slower on other machines.
268 This option only changes how the compiler emits instructions, not the
269 selection of instructions itself, so the resulting kernel will run on
270 all other machines.
271
272config TUNE_DEFAULT
273 bool "Default"
274 help
275 Tune the generated code for the target processor for which the kernel
276 will be compiled.
277
278config TUNE_G5
279 bool "System/390 model G5 and G6"
280
281config TUNE_Z900
282 bool "IBM zSeries model z800 and z900"
283
284config TUNE_Z990
285 bool "IBM zSeries model z890 and z990"
286
287config TUNE_Z9_109
288 bool "IBM System z9"
289
290config TUNE_Z10
291 bool "IBM System z10"
292
293config TUNE_Z196
294 bool "IBM zEnterprise 114 and 196"
295
296config TUNE_ZEC12
297 bool "IBM zBC12 and zEC12"
298
299endchoice
300
240config 64BIT 301config 64BIT
241 def_bool y 302 def_bool y
242 prompt "64 bit kernel" 303 prompt "64 bit kernel"
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index a7d68a467ce8..874e6d6e9c5f 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -35,13 +35,21 @@ endif
35 35
36export LD_BFD 36export LD_BFD
37 37
38cflags-$(CONFIG_MARCH_G5) += $(call cc-option,-march=g5) 38cflags-$(CONFIG_MARCH_G5) += -march=g5
39cflags-$(CONFIG_MARCH_Z900) += $(call cc-option,-march=z900) 39cflags-$(CONFIG_MARCH_Z900) += -march=z900
40cflags-$(CONFIG_MARCH_Z990) += $(call cc-option,-march=z990) 40cflags-$(CONFIG_MARCH_Z990) += -march=z990
41cflags-$(CONFIG_MARCH_Z9_109) += $(call cc-option,-march=z9-109) 41cflags-$(CONFIG_MARCH_Z9_109) += -march=z9-109
42cflags-$(CONFIG_MARCH_Z10) += $(call cc-option,-march=z10) 42cflags-$(CONFIG_MARCH_Z10) += -march=z10
43cflags-$(CONFIG_MARCH_Z196) += $(call cc-option,-march=z196) 43cflags-$(CONFIG_MARCH_Z196) += -march=z196
44cflags-$(CONFIG_MARCH_ZEC12) += $(call cc-option,-march=zEC12) 44cflags-$(CONFIG_MARCH_ZEC12) += -march=zEC12
45
46cflags-$(CONFIG_MARCH_G5_TUNE) += -mtune=g5
47cflags-$(CONFIG_MARCH_Z900_TUNE) += -mtune=z900
48cflags-$(CONFIG_MARCH_Z990_TUNE) += -mtune=z990
49cflags-$(CONFIG_MARCH_Z9_109_TUNE) += -mtune=z9-109
50cflags-$(CONFIG_MARCH_Z10_TUNE) += -mtune=z10
51cflags-$(CONFIG_MARCH_Z196_TUNE) += -mtune=z196
52cflags-$(CONFIG_MARCH_ZEC12_TUNE) += -mtune=zEC12
45 53
46#KBUILD_IMAGE is necessary for make rpm 54#KBUILD_IMAGE is necessary for make rpm
47KBUILD_IMAGE :=arch/s390/boot/image 55KBUILD_IMAGE :=arch/s390/boot/image
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index 87a22092b68f..4c4a1cef5208 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -48,9 +48,9 @@ static struct platform_device *appldata_pdev;
48 * /proc entries (sysctl) 48 * /proc entries (sysctl)
49 */ 49 */
50static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH] = "appldata"; 50static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH] = "appldata";
51static int appldata_timer_handler(ctl_table *ctl, int write, 51static int appldata_timer_handler(struct ctl_table *ctl, int write,
52 void __user *buffer, size_t *lenp, loff_t *ppos); 52 void __user *buffer, size_t *lenp, loff_t *ppos);
53static int appldata_interval_handler(ctl_table *ctl, int write, 53static int appldata_interval_handler(struct ctl_table *ctl, int write,
54 void __user *buffer, 54 void __user *buffer,
55 size_t *lenp, loff_t *ppos); 55 size_t *lenp, loff_t *ppos);
56 56
@@ -201,10 +201,10 @@ static void __appldata_vtimer_setup(int cmd)
201 * Start/Stop timer, show status of timer (0 = not active, 1 = active) 201 * Start/Stop timer, show status of timer (0 = not active, 1 = active)
202 */ 202 */
203static int 203static int
204appldata_timer_handler(ctl_table *ctl, int write, 204appldata_timer_handler(struct ctl_table *ctl, int write,
205 void __user *buffer, size_t *lenp, loff_t *ppos) 205 void __user *buffer, size_t *lenp, loff_t *ppos)
206{ 206{
207 int len; 207 unsigned int len;
208 char buf[2]; 208 char buf[2];
209 209
210 if (!*lenp || *ppos) { 210 if (!*lenp || *ppos) {
@@ -243,10 +243,11 @@ out:
243 * current timer interval. 243 * current timer interval.
244 */ 244 */
245static int 245static int
246appldata_interval_handler(ctl_table *ctl, int write, 246appldata_interval_handler(struct ctl_table *ctl, int write,
247 void __user *buffer, size_t *lenp, loff_t *ppos) 247 void __user *buffer, size_t *lenp, loff_t *ppos)
248{ 248{
249 int len, interval; 249 unsigned int len;
250 int interval;
250 char buf[16]; 251 char buf[16];
251 252
252 if (!*lenp || *ppos) { 253 if (!*lenp || *ppos) {
@@ -286,11 +287,12 @@ out:
286 * monitoring (0 = not in process, 1 = in process) 287 * monitoring (0 = not in process, 1 = in process)
287 */ 288 */
288static int 289static int
289appldata_generic_handler(ctl_table *ctl, int write, 290appldata_generic_handler(struct ctl_table *ctl, int write,
290 void __user *buffer, size_t *lenp, loff_t *ppos) 291 void __user *buffer, size_t *lenp, loff_t *ppos)
291{ 292{
292 struct appldata_ops *ops = NULL, *tmp_ops; 293 struct appldata_ops *ops = NULL, *tmp_ops;
293 int rc, len, found; 294 unsigned int len;
295 int rc, found;
294 char buf[2]; 296 char buf[2];
295 struct list_head *lh; 297 struct list_head *lh;
296 298
diff --git a/arch/s390/configs/default_defconfig b/arch/s390/configs/default_defconfig
new file mode 100644
index 000000000000..e0af2ee58751
--- /dev/null
+++ b/arch/s390/configs/default_defconfig
@@ -0,0 +1,655 @@
1CONFIG_SYSVIPC=y
2CONFIG_POSIX_MQUEUE=y
3CONFIG_FHANDLE=y
4CONFIG_AUDIT=y
5CONFIG_NO_HZ=y
6CONFIG_HIGH_RES_TIMERS=y
7CONFIG_BSD_PROCESS_ACCT=y
8CONFIG_BSD_PROCESS_ACCT_V3=y
9CONFIG_TASKSTATS=y
10CONFIG_TASK_DELAY_ACCT=y
11CONFIG_TASK_XACCT=y
12CONFIG_TASK_IO_ACCOUNTING=y
13CONFIG_RCU_FAST_NO_HZ=y
14CONFIG_IKCONFIG=y
15CONFIG_IKCONFIG_PROC=y
16CONFIG_CGROUP_FREEZER=y
17CONFIG_CGROUP_DEVICE=y
18CONFIG_CPUSETS=y
19CONFIG_CGROUP_CPUACCT=y
20CONFIG_RESOURCE_COUNTERS=y
21CONFIG_CGROUP_PERF=y
22CONFIG_CFS_BANDWIDTH=y
23CONFIG_RT_GROUP_SCHED=y
24CONFIG_BLK_CGROUP=y
25CONFIG_SCHED_AUTOGROUP=y
26CONFIG_BLK_DEV_INITRD=y
27# CONFIG_COMPAT_BRK is not set
28CONFIG_PROFILING=y
29CONFIG_OPROFILE=m
30CONFIG_KPROBES=y
31CONFIG_JUMP_LABEL=y
32CONFIG_MODULES=y
33CONFIG_MODULE_FORCE_LOAD=y
34CONFIG_MODULE_UNLOAD=y
35CONFIG_MODULE_FORCE_UNLOAD=y
36CONFIG_MODVERSIONS=y
37CONFIG_MODULE_SRCVERSION_ALL=y
38CONFIG_BLK_DEV_INTEGRITY=y
39CONFIG_BLK_DEV_THROTTLING=y
40CONFIG_PARTITION_ADVANCED=y
41CONFIG_IBM_PARTITION=y
42CONFIG_BSD_DISKLABEL=y
43CONFIG_MINIX_SUBPARTITION=y
44CONFIG_SOLARIS_X86_PARTITION=y
45CONFIG_UNIXWARE_DISKLABEL=y
46CONFIG_CFQ_GROUP_IOSCHED=y
47CONFIG_DEFAULT_DEADLINE=y
48CONFIG_MARCH_Z9_109=y
49CONFIG_PREEMPT=y
50CONFIG_HZ_100=y
51CONFIG_MEMORY_HOTPLUG=y
52CONFIG_MEMORY_HOTREMOVE=y
53CONFIG_KSM=y
54CONFIG_TRANSPARENT_HUGEPAGE=y
55CONFIG_PCI=y
56CONFIG_PCI_DEBUG=y
57CONFIG_HOTPLUG_PCI=y
58CONFIG_HOTPLUG_PCI_S390=y
59CONFIG_CHSC_SCH=y
60CONFIG_CRASH_DUMP=y
61CONFIG_ZFCPDUMP=y
62# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
63CONFIG_BINFMT_MISC=m
64CONFIG_HIBERNATION=y
65CONFIG_PACKET=y
66CONFIG_PACKET_DIAG=m
67CONFIG_UNIX=y
68CONFIG_UNIX_DIAG=m
69CONFIG_XFRM_USER=m
70CONFIG_NET_KEY=m
71CONFIG_INET=y
72CONFIG_IP_MULTICAST=y
73CONFIG_IP_ADVANCED_ROUTER=y
74CONFIG_IP_MULTIPLE_TABLES=y
75CONFIG_IP_ROUTE_MULTIPATH=y
76CONFIG_IP_ROUTE_VERBOSE=y
77CONFIG_NET_IPIP=m
78CONFIG_NET_IPGRE_DEMUX=m
79CONFIG_NET_IPGRE=m
80CONFIG_NET_IPGRE_BROADCAST=y
81CONFIG_IP_MROUTE=y
82CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
83CONFIG_IP_PIMSM_V1=y
84CONFIG_IP_PIMSM_V2=y
85CONFIG_SYN_COOKIES=y
86CONFIG_NET_IPVTI=m
87CONFIG_INET_AH=m
88CONFIG_INET_ESP=m
89CONFIG_INET_IPCOMP=m
90CONFIG_INET_XFRM_MODE_TRANSPORT=m
91CONFIG_INET_XFRM_MODE_TUNNEL=m
92CONFIG_INET_XFRM_MODE_BEET=m
93CONFIG_INET_DIAG=m
94CONFIG_INET_UDP_DIAG=m
95CONFIG_TCP_CONG_ADVANCED=y
96CONFIG_TCP_CONG_HSTCP=m
97CONFIG_TCP_CONG_HYBLA=m
98CONFIG_TCP_CONG_SCALABLE=m
99CONFIG_TCP_CONG_LP=m
100CONFIG_TCP_CONG_VENO=m
101CONFIG_TCP_CONG_YEAH=m
102CONFIG_TCP_CONG_ILLINOIS=m
103CONFIG_IPV6=y
104CONFIG_IPV6_PRIVACY=y
105CONFIG_IPV6_ROUTER_PREF=y
106CONFIG_INET6_AH=m
107CONFIG_INET6_ESP=m
108CONFIG_INET6_IPCOMP=m
109CONFIG_IPV6_MIP6=m
110CONFIG_INET6_XFRM_MODE_TRANSPORT=m
111CONFIG_INET6_XFRM_MODE_TUNNEL=m
112CONFIG_INET6_XFRM_MODE_BEET=m
113CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
114CONFIG_IPV6_SIT=m
115CONFIG_IPV6_GRE=m
116CONFIG_IPV6_MULTIPLE_TABLES=y
117CONFIG_IPV6_SUBTREES=y
118CONFIG_NETFILTER=y
119CONFIG_NF_CONNTRACK=m
120CONFIG_NF_CONNTRACK_SECMARK=y
121CONFIG_NF_CONNTRACK_EVENTS=y
122CONFIG_NF_CONNTRACK_TIMEOUT=y
123CONFIG_NF_CONNTRACK_TIMESTAMP=y
124CONFIG_NF_CT_PROTO_DCCP=m
125CONFIG_NF_CT_PROTO_UDPLITE=m
126CONFIG_NF_CONNTRACK_AMANDA=m
127CONFIG_NF_CONNTRACK_FTP=m
128CONFIG_NF_CONNTRACK_H323=m
129CONFIG_NF_CONNTRACK_IRC=m
130CONFIG_NF_CONNTRACK_NETBIOS_NS=m
131CONFIG_NF_CONNTRACK_SNMP=m
132CONFIG_NF_CONNTRACK_PPTP=m
133CONFIG_NF_CONNTRACK_SANE=m
134CONFIG_NF_CONNTRACK_SIP=m
135CONFIG_NF_CONNTRACK_TFTP=m
136CONFIG_NF_CT_NETLINK=m
137CONFIG_NF_CT_NETLINK_TIMEOUT=m
138CONFIG_NETFILTER_TPROXY=m
139CONFIG_NETFILTER_XT_SET=m
140CONFIG_NETFILTER_XT_TARGET_AUDIT=m
141CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
142CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
143CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
144CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
145CONFIG_NETFILTER_XT_TARGET_CT=m
146CONFIG_NETFILTER_XT_TARGET_DSCP=m
147CONFIG_NETFILTER_XT_TARGET_HMARK=m
148CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m
149CONFIG_NETFILTER_XT_TARGET_LOG=m
150CONFIG_NETFILTER_XT_TARGET_MARK=m
151CONFIG_NETFILTER_XT_TARGET_NFLOG=m
152CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
153CONFIG_NETFILTER_XT_TARGET_TEE=m
154CONFIG_NETFILTER_XT_TARGET_TPROXY=m
155CONFIG_NETFILTER_XT_TARGET_TRACE=m
156CONFIG_NETFILTER_XT_TARGET_SECMARK=m
157CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
158CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
159CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m
160CONFIG_NETFILTER_XT_MATCH_BPF=m
161CONFIG_NETFILTER_XT_MATCH_CLUSTER=m
162CONFIG_NETFILTER_XT_MATCH_COMMENT=m
163CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
164CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m
165CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m
166CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
167CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
168CONFIG_NETFILTER_XT_MATCH_CPU=m
169CONFIG_NETFILTER_XT_MATCH_DCCP=m
170CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m
171CONFIG_NETFILTER_XT_MATCH_DSCP=m
172CONFIG_NETFILTER_XT_MATCH_ESP=m
173CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
174CONFIG_NETFILTER_XT_MATCH_HELPER=m
175CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
176CONFIG_NETFILTER_XT_MATCH_IPVS=m
177CONFIG_NETFILTER_XT_MATCH_LENGTH=m
178CONFIG_NETFILTER_XT_MATCH_LIMIT=m
179CONFIG_NETFILTER_XT_MATCH_MAC=m
180CONFIG_NETFILTER_XT_MATCH_MARK=m
181CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
182CONFIG_NETFILTER_XT_MATCH_NFACCT=m
183CONFIG_NETFILTER_XT_MATCH_OSF=m
184CONFIG_NETFILTER_XT_MATCH_OWNER=m
185CONFIG_NETFILTER_XT_MATCH_POLICY=m
186CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m
187CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
188CONFIG_NETFILTER_XT_MATCH_QUOTA=m
189CONFIG_NETFILTER_XT_MATCH_RATEEST=m
190CONFIG_NETFILTER_XT_MATCH_REALM=m
191CONFIG_NETFILTER_XT_MATCH_RECENT=m
192CONFIG_NETFILTER_XT_MATCH_SOCKET=m
193CONFIG_NETFILTER_XT_MATCH_STATE=m
194CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
195CONFIG_NETFILTER_XT_MATCH_STRING=m
196CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
197CONFIG_NETFILTER_XT_MATCH_TIME=m
198CONFIG_NETFILTER_XT_MATCH_U32=m
199CONFIG_IP_SET=m
200CONFIG_IP_SET_BITMAP_IP=m
201CONFIG_IP_SET_BITMAP_IPMAC=m
202CONFIG_IP_SET_BITMAP_PORT=m
203CONFIG_IP_SET_HASH_IP=m
204CONFIG_IP_SET_HASH_IPPORT=m
205CONFIG_IP_SET_HASH_IPPORTIP=m
206CONFIG_IP_SET_HASH_IPPORTNET=m
207CONFIG_IP_SET_HASH_NET=m
208CONFIG_IP_SET_HASH_NETPORT=m
209CONFIG_IP_SET_HASH_NETIFACE=m
210CONFIG_IP_SET_LIST_SET=m
211CONFIG_IP_VS=m
212CONFIG_IP_VS_PROTO_TCP=y
213CONFIG_IP_VS_PROTO_UDP=y
214CONFIG_IP_VS_PROTO_ESP=y
215CONFIG_IP_VS_PROTO_AH=y
216CONFIG_IP_VS_RR=m
217CONFIG_IP_VS_WRR=m
218CONFIG_IP_VS_LC=m
219CONFIG_IP_VS_WLC=m
220CONFIG_IP_VS_LBLC=m
221CONFIG_IP_VS_LBLCR=m
222CONFIG_IP_VS_DH=m
223CONFIG_IP_VS_SH=m
224CONFIG_IP_VS_SED=m
225CONFIG_IP_VS_NQ=m
226CONFIG_IP_VS_FTP=m
227CONFIG_IP_VS_PE_SIP=m
228CONFIG_NF_CONNTRACK_IPV4=m
229# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set
230CONFIG_IP_NF_IPTABLES=m
231CONFIG_IP_NF_MATCH_AH=m
232CONFIG_IP_NF_MATCH_ECN=m
233CONFIG_IP_NF_MATCH_RPFILTER=m
234CONFIG_IP_NF_MATCH_TTL=m
235CONFIG_IP_NF_FILTER=m
236CONFIG_IP_NF_TARGET_REJECT=m
237CONFIG_IP_NF_TARGET_ULOG=m
238CONFIG_NF_NAT_IPV4=m
239CONFIG_IP_NF_TARGET_MASQUERADE=m
240CONFIG_IP_NF_TARGET_NETMAP=m
241CONFIG_IP_NF_TARGET_REDIRECT=m
242CONFIG_IP_NF_MANGLE=m
243CONFIG_IP_NF_TARGET_CLUSTERIP=m
244CONFIG_IP_NF_TARGET_ECN=m
245CONFIG_IP_NF_TARGET_TTL=m
246CONFIG_IP_NF_RAW=m
247CONFIG_IP_NF_SECURITY=m
248CONFIG_IP_NF_ARPTABLES=m
249CONFIG_IP_NF_ARPFILTER=m
250CONFIG_IP_NF_ARP_MANGLE=m
251CONFIG_NF_CONNTRACK_IPV6=m
252CONFIG_IP6_NF_IPTABLES=m
253CONFIG_IP6_NF_MATCH_AH=m
254CONFIG_IP6_NF_MATCH_EUI64=m
255CONFIG_IP6_NF_MATCH_FRAG=m
256CONFIG_IP6_NF_MATCH_OPTS=m
257CONFIG_IP6_NF_MATCH_HL=m
258CONFIG_IP6_NF_MATCH_IPV6HEADER=m
259CONFIG_IP6_NF_MATCH_MH=m
260CONFIG_IP6_NF_MATCH_RPFILTER=m
261CONFIG_IP6_NF_MATCH_RT=m
262CONFIG_IP6_NF_TARGET_HL=m
263CONFIG_IP6_NF_FILTER=m
264CONFIG_IP6_NF_TARGET_REJECT=m
265CONFIG_IP6_NF_MANGLE=m
266CONFIG_IP6_NF_RAW=m
267CONFIG_IP6_NF_SECURITY=m
268CONFIG_NF_NAT_IPV6=m
269CONFIG_IP6_NF_TARGET_MASQUERADE=m
270CONFIG_IP6_NF_TARGET_NPT=m
271CONFIG_NET_SCTPPROBE=m
272CONFIG_RDS=m
273CONFIG_RDS_RDMA=m
274CONFIG_RDS_TCP=m
275CONFIG_RDS_DEBUG=y
276CONFIG_L2TP=m
277CONFIG_L2TP_DEBUGFS=m
278CONFIG_L2TP_V3=y
279CONFIG_L2TP_IP=m
280CONFIG_L2TP_ETH=m
281CONFIG_BRIDGE=m
282CONFIG_VLAN_8021Q=m
283CONFIG_VLAN_8021Q_GVRP=y
284CONFIG_NET_SCHED=y
285CONFIG_NET_SCH_CBQ=m
286CONFIG_NET_SCH_HTB=m
287CONFIG_NET_SCH_HFSC=m
288CONFIG_NET_SCH_PRIO=m
289CONFIG_NET_SCH_MULTIQ=m
290CONFIG_NET_SCH_RED=m
291CONFIG_NET_SCH_SFB=m
292CONFIG_NET_SCH_SFQ=m
293CONFIG_NET_SCH_TEQL=m
294CONFIG_NET_SCH_TBF=m
295CONFIG_NET_SCH_GRED=m
296CONFIG_NET_SCH_DSMARK=m
297CONFIG_NET_SCH_NETEM=m
298CONFIG_NET_SCH_DRR=m
299CONFIG_NET_SCH_MQPRIO=m
300CONFIG_NET_SCH_CHOKE=m
301CONFIG_NET_SCH_QFQ=m
302CONFIG_NET_SCH_CODEL=m
303CONFIG_NET_SCH_FQ_CODEL=m
304CONFIG_NET_SCH_INGRESS=m
305CONFIG_NET_SCH_PLUG=m
306CONFIG_NET_CLS_BASIC=m
307CONFIG_NET_CLS_TCINDEX=m
308CONFIG_NET_CLS_ROUTE4=m
309CONFIG_NET_CLS_FW=m
310CONFIG_NET_CLS_U32=m
311CONFIG_CLS_U32_PERF=y
312CONFIG_CLS_U32_MARK=y
313CONFIG_NET_CLS_RSVP=m
314CONFIG_NET_CLS_RSVP6=m
315CONFIG_NET_CLS_FLOW=m
316CONFIG_NET_CLS_CGROUP=y
317CONFIG_NET_CLS_ACT=y
318CONFIG_NET_ACT_POLICE=m
319CONFIG_NET_ACT_GACT=m
320CONFIG_GACT_PROB=y
321CONFIG_NET_ACT_MIRRED=m
322CONFIG_NET_ACT_IPT=m
323CONFIG_NET_ACT_NAT=m
324CONFIG_NET_ACT_PEDIT=m
325CONFIG_NET_ACT_SIMP=m
326CONFIG_NET_ACT_SKBEDIT=m
327CONFIG_NET_ACT_CSUM=m
328CONFIG_DNS_RESOLVER=y
329CONFIG_BPF_JIT=y
330CONFIG_NET_PKTGEN=m
331CONFIG_NET_TCPPROBE=m
332CONFIG_DEVTMPFS=y
333CONFIG_CONNECTOR=y
334CONFIG_BLK_DEV_LOOP=m
335CONFIG_BLK_DEV_CRYPTOLOOP=m
336CONFIG_BLK_DEV_NBD=m
337CONFIG_BLK_DEV_OSD=m
338CONFIG_BLK_DEV_RAM=y
339CONFIG_BLK_DEV_RAM_SIZE=32768
340CONFIG_BLK_DEV_XIP=y
341CONFIG_CDROM_PKTCDVD=m
342CONFIG_ATA_OVER_ETH=m
343CONFIG_VIRTIO_BLK=y
344CONFIG_ENCLOSURE_SERVICES=m
345CONFIG_RAID_ATTRS=m
346CONFIG_SCSI=y
347CONFIG_SCSI_TGT=m
348CONFIG_BLK_DEV_SD=y
349CONFIG_CHR_DEV_ST=m
350CONFIG_CHR_DEV_OSST=m
351CONFIG_BLK_DEV_SR=m
352CONFIG_CHR_DEV_SG=y
353CONFIG_CHR_DEV_SCH=m
354CONFIG_SCSI_ENCLOSURE=m
355CONFIG_SCSI_MULTI_LUN=y
356CONFIG_SCSI_CONSTANTS=y
357CONFIG_SCSI_LOGGING=y
358CONFIG_SCSI_SPI_ATTRS=m
359CONFIG_SCSI_SAS_LIBSAS=m
360CONFIG_SCSI_SRP_ATTRS=m
361CONFIG_SCSI_SRP_TGT_ATTRS=y
362CONFIG_ISCSI_TCP=m
363CONFIG_LIBFCOE=m
364CONFIG_SCSI_DEBUG=m
365CONFIG_ZFCP=y
366CONFIG_SCSI_VIRTIO=m
367CONFIG_SCSI_DH=m
368CONFIG_SCSI_DH_RDAC=m
369CONFIG_SCSI_DH_HP_SW=m
370CONFIG_SCSI_DH_EMC=m
371CONFIG_SCSI_DH_ALUA=m
372CONFIG_SCSI_OSD_INITIATOR=m
373CONFIG_SCSI_OSD_ULD=m
374CONFIG_MD=y
375CONFIG_BLK_DEV_MD=y
376CONFIG_MD_LINEAR=m
377CONFIG_MD_RAID0=m
378CONFIG_MD_MULTIPATH=m
379CONFIG_MD_FAULTY=m
380CONFIG_BLK_DEV_DM=m
381CONFIG_DM_CRYPT=m
382CONFIG_DM_SNAPSHOT=m
383CONFIG_DM_MIRROR=m
384CONFIG_DM_RAID=m
385CONFIG_DM_LOG_USERSPACE=m
386CONFIG_DM_ZERO=m
387CONFIG_DM_MULTIPATH=m
388CONFIG_DM_MULTIPATH_QL=m
389CONFIG_DM_MULTIPATH_ST=m
390CONFIG_DM_DELAY=m
391CONFIG_DM_UEVENT=y
392CONFIG_DM_FLAKEY=m
393CONFIG_DM_VERITY=m
394CONFIG_DM_SWITCH=m
395CONFIG_NETDEVICES=y
396CONFIG_BONDING=m
397CONFIG_DUMMY=m
398CONFIG_EQUALIZER=m
399CONFIG_IFB=m
400CONFIG_MACVLAN=m
401CONFIG_MACVTAP=m
402CONFIG_VXLAN=m
403CONFIG_TUN=m
404CONFIG_VETH=m
405CONFIG_VIRTIO_NET=m
406CONFIG_NLMON=m
407CONFIG_VHOST_NET=m
408# CONFIG_NET_VENDOR_ARC is not set
409# CONFIG_NET_CADENCE is not set
410# CONFIG_NET_VENDOR_CHELSIO is not set
411# CONFIG_NET_VENDOR_INTEL is not set
412# CONFIG_NET_VENDOR_MARVELL is not set
413CONFIG_MLX4_EN=m
414# CONFIG_NET_VENDOR_NATSEMI is not set
415CONFIG_PPP=m
416CONFIG_PPP_BSDCOMP=m
417CONFIG_PPP_DEFLATE=m
418CONFIG_PPP_MPPE=m
419CONFIG_PPPOE=m
420CONFIG_PPTP=m
421CONFIG_PPPOL2TP=m
422CONFIG_PPP_ASYNC=m
423CONFIG_PPP_SYNC_TTY=m
424# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
425# CONFIG_INPUT_KEYBOARD is not set
426# CONFIG_INPUT_MOUSE is not set
427# CONFIG_SERIO is not set
428CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
429CONFIG_LEGACY_PTY_COUNT=0
430CONFIG_HW_RANDOM_VIRTIO=m
431CONFIG_RAW_DRIVER=m
432CONFIG_HANGCHECK_TIMER=m
433CONFIG_TN3270_FS=y
434CONFIG_WATCHDOG=y
435CONFIG_WATCHDOG_NOWAYOUT=y
436CONFIG_SOFT_WATCHDOG=m
437CONFIG_ZVM_WATCHDOG=m
438# CONFIG_HID is not set
439# CONFIG_USB_SUPPORT is not set
440CONFIG_INFINIBAND=m
441CONFIG_INFINIBAND_USER_ACCESS=m
442CONFIG_MLX4_INFINIBAND=m
443CONFIG_VIRTIO_BALLOON=m
444# CONFIG_IOMMU_SUPPORT is not set
445CONFIG_EXT2_FS=y
446CONFIG_EXT2_FS_XATTR=y
447CONFIG_EXT2_FS_POSIX_ACL=y
448CONFIG_EXT2_FS_SECURITY=y
449CONFIG_EXT2_FS_XIP=y
450CONFIG_EXT3_FS=y
451# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
452CONFIG_EXT3_FS_POSIX_ACL=y
453CONFIG_EXT3_FS_SECURITY=y
454CONFIG_EXT4_FS=y
455CONFIG_EXT4_FS_POSIX_ACL=y
456CONFIG_EXT4_FS_SECURITY=y
457CONFIG_JBD_DEBUG=y
458CONFIG_JBD2_DEBUG=y
459CONFIG_JFS_FS=m
460CONFIG_JFS_POSIX_ACL=y
461CONFIG_JFS_SECURITY=y
462CONFIG_JFS_STATISTICS=y
463CONFIG_XFS_FS=m
464CONFIG_XFS_QUOTA=y
465CONFIG_XFS_POSIX_ACL=y
466CONFIG_XFS_RT=y
467CONFIG_XFS_DEBUG=y
468CONFIG_GFS2_FS=m
469CONFIG_OCFS2_FS=m
470CONFIG_BTRFS_FS=m
471CONFIG_BTRFS_FS_POSIX_ACL=y
472CONFIG_NILFS2_FS=m
473CONFIG_FANOTIFY=y
474CONFIG_QUOTA_NETLINK_INTERFACE=y
475CONFIG_QFMT_V1=m
476CONFIG_QFMT_V2=m
477CONFIG_AUTOFS4_FS=m
478CONFIG_FUSE_FS=m
479CONFIG_CUSE=m
480CONFIG_FSCACHE=m
481CONFIG_CACHEFILES=m
482CONFIG_ISO9660_FS=y
483CONFIG_JOLIET=y
484CONFIG_ZISOFS=y
485CONFIG_UDF_FS=m
486CONFIG_MSDOS_FS=m
487CONFIG_VFAT_FS=m
488CONFIG_NTFS_FS=m
489CONFIG_NTFS_RW=y
490CONFIG_PROC_KCORE=y
491CONFIG_TMPFS=y
492CONFIG_TMPFS_POSIX_ACL=y
493CONFIG_HUGETLBFS=y
494CONFIG_CONFIGFS_FS=m
495CONFIG_ECRYPT_FS=m
496CONFIG_CRAMFS=m
497CONFIG_SQUASHFS=m
498CONFIG_SQUASHFS_XATTR=y
499CONFIG_SQUASHFS_LZO=y
500CONFIG_SQUASHFS_XZ=y
501CONFIG_ROMFS_FS=m
502CONFIG_NFS_FS=m
503CONFIG_NFS_V3_ACL=y
504CONFIG_NFS_V4=m
505CONFIG_NFS_SWAP=y
506CONFIG_NFSD=m
507CONFIG_NFSD_V3_ACL=y
508CONFIG_NFSD_V4=y
509CONFIG_NFSD_V4_SECURITY_LABEL=y
510CONFIG_CIFS=m
511CONFIG_CIFS_STATS=y
512CONFIG_CIFS_STATS2=y
513CONFIG_CIFS_WEAK_PW_HASH=y
514CONFIG_CIFS_UPCALL=y
515CONFIG_CIFS_XATTR=y
516CONFIG_CIFS_POSIX=y
517# CONFIG_CIFS_DEBUG is not set
518CONFIG_CIFS_DFS_UPCALL=y
519CONFIG_NLS_DEFAULT="utf8"
520CONFIG_NLS_CODEPAGE_437=m
521CONFIG_NLS_CODEPAGE_850=m
522CONFIG_NLS_ASCII=m
523CONFIG_NLS_ISO8859_1=m
524CONFIG_NLS_ISO8859_15=m
525CONFIG_NLS_UTF8=m
526CONFIG_DLM=m
527CONFIG_PRINTK_TIME=y
528CONFIG_DYNAMIC_DEBUG=y
529CONFIG_DEBUG_INFO=y
530# CONFIG_ENABLE_MUST_CHECK is not set
531CONFIG_FRAME_WARN=1024
532CONFIG_READABLE_ASM=y
533CONFIG_UNUSED_SYMBOLS=y
534CONFIG_MAGIC_SYSRQ=y
535CONFIG_DEBUG_KERNEL=y
536CONFIG_DEBUG_PAGEALLOC=y
537CONFIG_SLUB_DEBUG_ON=y
538CONFIG_SLUB_STATS=y
539CONFIG_DEBUG_STACK_USAGE=y
540CONFIG_DEBUG_VM=y
541CONFIG_DEBUG_VM_RB=y
542CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m
543CONFIG_DEBUG_PER_CPU_MAPS=y
544CONFIG_TIMER_STATS=y
545CONFIG_DEBUG_RT_MUTEXES=y
546CONFIG_RT_MUTEX_TESTER=y
547CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y
548CONFIG_PROVE_LOCKING=y
549CONFIG_LOCK_STAT=y
550CONFIG_DEBUG_LOCKDEP=y
551CONFIG_DEBUG_ATOMIC_SLEEP=y
552CONFIG_DEBUG_LOCKING_API_SELFTESTS=y
553CONFIG_DEBUG_WRITECOUNT=y
554CONFIG_DEBUG_LIST=y
555CONFIG_DEBUG_SG=y
556CONFIG_DEBUG_NOTIFIERS=y
557CONFIG_DEBUG_CREDENTIALS=y
558CONFIG_PROVE_RCU=y
559CONFIG_RCU_TORTURE_TEST=m
560CONFIG_RCU_CPU_STALL_TIMEOUT=300
561CONFIG_NOTIFIER_ERROR_INJECTION=m
562CONFIG_CPU_NOTIFIER_ERROR_INJECT=m
563CONFIG_PM_NOTIFIER_ERROR_INJECT=m
564CONFIG_FAULT_INJECTION=y
565CONFIG_FAILSLAB=y
566CONFIG_FAIL_PAGE_ALLOC=y
567CONFIG_FAIL_MAKE_REQUEST=y
568CONFIG_FAIL_IO_TIMEOUT=y
569CONFIG_FAULT_INJECTION_DEBUG_FS=y
570CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y
571CONFIG_LATENCYTOP=y
572CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y
573CONFIG_BLK_DEV_IO_TRACE=y
574# CONFIG_KPROBE_EVENT is not set
575CONFIG_LKDTM=m
576CONFIG_KPROBES_SANITY_TEST=y
577CONFIG_RBTREE_TEST=m
578CONFIG_INTERVAL_TREE_TEST=m
579CONFIG_ATOMIC64_SELFTEST=y
580CONFIG_DMA_API_DEBUG=y
581# CONFIG_STRICT_DEVMEM is not set
582CONFIG_S390_PTDUMP=y
583CONFIG_ENCRYPTED_KEYS=m
584CONFIG_KEYS_DEBUG_PROC_KEYS=y
585CONFIG_SECURITY=y
586CONFIG_SECURITY_NETWORK=y
587CONFIG_SECURITY_SELINUX=y
588CONFIG_SECURITY_SELINUX_BOOTPARAM=y
589CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0
590CONFIG_SECURITY_SELINUX_DISABLE=y
591CONFIG_IMA=y
592CONFIG_IMA_APPRAISE=y
593CONFIG_CRYPTO_USER=m
594# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
595CONFIG_CRYPTO_CRYPTD=m
596CONFIG_CRYPTO_TEST=m
597CONFIG_CRYPTO_CCM=m
598CONFIG_CRYPTO_GCM=m
599CONFIG_CRYPTO_CTS=m
600CONFIG_CRYPTO_LRW=m
601CONFIG_CRYPTO_PCBC=m
602CONFIG_CRYPTO_XTS=m
603CONFIG_CRYPTO_XCBC=m
604CONFIG_CRYPTO_VMAC=m
605CONFIG_CRYPTO_CRC32=m
606CONFIG_CRYPTO_MICHAEL_MIC=m
607CONFIG_CRYPTO_RMD128=m
608CONFIG_CRYPTO_RMD160=m
609CONFIG_CRYPTO_RMD256=m
610CONFIG_CRYPTO_RMD320=m
611CONFIG_CRYPTO_SHA512=m
612CONFIG_CRYPTO_TGR192=m
613CONFIG_CRYPTO_WP512=m
614CONFIG_CRYPTO_ANUBIS=m
615CONFIG_CRYPTO_BLOWFISH=m
616CONFIG_CRYPTO_CAMELLIA=m
617CONFIG_CRYPTO_CAST5=m
618CONFIG_CRYPTO_CAST6=m
619CONFIG_CRYPTO_FCRYPT=m
620CONFIG_CRYPTO_KHAZAD=m
621CONFIG_CRYPTO_SALSA20=m
622CONFIG_CRYPTO_SEED=m
623CONFIG_CRYPTO_SERPENT=m
624CONFIG_CRYPTO_TEA=m
625CONFIG_CRYPTO_TWOFISH=m
626CONFIG_CRYPTO_ZLIB=y
627CONFIG_CRYPTO_LZO=m
628CONFIG_CRYPTO_LZ4=m
629CONFIG_CRYPTO_LZ4HC=m
630CONFIG_CRYPTO_USER_API_HASH=m
631CONFIG_CRYPTO_USER_API_SKCIPHER=m
632CONFIG_ZCRYPT=m
633CONFIG_CRYPTO_SHA1_S390=m
634CONFIG_CRYPTO_SHA256_S390=m
635CONFIG_CRYPTO_SHA512_S390=m
636CONFIG_CRYPTO_DES_S390=m
637CONFIG_CRYPTO_AES_S390=m
638CONFIG_CRYPTO_GHASH_S390=m
639CONFIG_ASYMMETRIC_KEY_TYPE=m
640CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m
641CONFIG_PUBLIC_KEY_ALGO_RSA=m
642CONFIG_X509_CERTIFICATE_PARSER=m
643CONFIG_CRC7=m
644CONFIG_CRC8=m
645CONFIG_XZ_DEC_X86=y
646CONFIG_XZ_DEC_POWERPC=y
647CONFIG_XZ_DEC_IA64=y
648CONFIG_XZ_DEC_ARM=y
649CONFIG_XZ_DEC_ARMTHUMB=y
650CONFIG_XZ_DEC_SPARC=y
651CONFIG_CORDIC=m
652CONFIG_CMM=m
653CONFIG_APPLDATA_BASE=y
654CONFIG_KVM=m
655CONFIG_KVM_S390_UCONTROL=y
diff --git a/arch/s390/configs/gcov_defconfig b/arch/s390/configs/gcov_defconfig
new file mode 100644
index 000000000000..b9f6b4cab927
--- /dev/null
+++ b/arch/s390/configs/gcov_defconfig
@@ -0,0 +1,618 @@
1CONFIG_SYSVIPC=y
2CONFIG_POSIX_MQUEUE=y
3CONFIG_FHANDLE=y
4CONFIG_AUDIT=y
5CONFIG_NO_HZ=y
6CONFIG_HIGH_RES_TIMERS=y
7CONFIG_BSD_PROCESS_ACCT=y
8CONFIG_BSD_PROCESS_ACCT_V3=y
9CONFIG_TASKSTATS=y
10CONFIG_TASK_DELAY_ACCT=y
11CONFIG_TASK_XACCT=y
12CONFIG_TASK_IO_ACCOUNTING=y
13CONFIG_RCU_FAST_NO_HZ=y
14CONFIG_IKCONFIG=y
15CONFIG_IKCONFIG_PROC=y
16CONFIG_CGROUP_FREEZER=y
17CONFIG_CGROUP_DEVICE=y
18CONFIG_CPUSETS=y
19CONFIG_CGROUP_CPUACCT=y
20CONFIG_RESOURCE_COUNTERS=y
21CONFIG_CGROUP_PERF=y
22CONFIG_BLK_CGROUP=y
23CONFIG_SCHED_AUTOGROUP=y
24CONFIG_BLK_DEV_INITRD=y
25# CONFIG_COMPAT_BRK is not set
26CONFIG_PROFILING=y
27CONFIG_OPROFILE=m
28CONFIG_KPROBES=y
29CONFIG_JUMP_LABEL=y
30CONFIG_GCOV_KERNEL=y
31CONFIG_GCOV_PROFILE_ALL=y
32CONFIG_MODULES=y
33CONFIG_MODULE_FORCE_LOAD=y
34CONFIG_MODULE_UNLOAD=y
35CONFIG_MODULE_FORCE_UNLOAD=y
36CONFIG_MODVERSIONS=y
37CONFIG_MODULE_SRCVERSION_ALL=y
38CONFIG_BLK_DEV_INTEGRITY=y
39CONFIG_BLK_DEV_THROTTLING=y
40CONFIG_PARTITION_ADVANCED=y
41CONFIG_IBM_PARTITION=y
42CONFIG_BSD_DISKLABEL=y
43CONFIG_MINIX_SUBPARTITION=y
44CONFIG_SOLARIS_X86_PARTITION=y
45CONFIG_UNIXWARE_DISKLABEL=y
46CONFIG_CFQ_GROUP_IOSCHED=y
47CONFIG_DEFAULT_DEADLINE=y
48CONFIG_MARCH_Z9_109=y
49CONFIG_HZ_100=y
50CONFIG_MEMORY_HOTPLUG=y
51CONFIG_MEMORY_HOTREMOVE=y
52CONFIG_KSM=y
53CONFIG_TRANSPARENT_HUGEPAGE=y
54CONFIG_PCI=y
55CONFIG_HOTPLUG_PCI=y
56CONFIG_HOTPLUG_PCI_S390=y
57CONFIG_CHSC_SCH=y
58CONFIG_CRASH_DUMP=y
59CONFIG_ZFCPDUMP=y
60# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
61CONFIG_BINFMT_MISC=m
62CONFIG_HIBERNATION=y
63CONFIG_PACKET=y
64CONFIG_PACKET_DIAG=m
65CONFIG_UNIX=y
66CONFIG_UNIX_DIAG=m
67CONFIG_XFRM_USER=m
68CONFIG_NET_KEY=m
69CONFIG_INET=y
70CONFIG_IP_MULTICAST=y
71CONFIG_IP_ADVANCED_ROUTER=y
72CONFIG_IP_MULTIPLE_TABLES=y
73CONFIG_IP_ROUTE_MULTIPATH=y
74CONFIG_IP_ROUTE_VERBOSE=y
75CONFIG_NET_IPIP=m
76CONFIG_NET_IPGRE_DEMUX=m
77CONFIG_NET_IPGRE=m
78CONFIG_NET_IPGRE_BROADCAST=y
79CONFIG_IP_MROUTE=y
80CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
81CONFIG_IP_PIMSM_V1=y
82CONFIG_IP_PIMSM_V2=y
83CONFIG_SYN_COOKIES=y
84CONFIG_NET_IPVTI=m
85CONFIG_INET_AH=m
86CONFIG_INET_ESP=m
87CONFIG_INET_IPCOMP=m
88CONFIG_INET_XFRM_MODE_TRANSPORT=m
89CONFIG_INET_XFRM_MODE_TUNNEL=m
90CONFIG_INET_XFRM_MODE_BEET=m
91CONFIG_INET_DIAG=m
92CONFIG_INET_UDP_DIAG=m
93CONFIG_TCP_CONG_ADVANCED=y
94CONFIG_TCP_CONG_HSTCP=m
95CONFIG_TCP_CONG_HYBLA=m
96CONFIG_TCP_CONG_SCALABLE=m
97CONFIG_TCP_CONG_LP=m
98CONFIG_TCP_CONG_VENO=m
99CONFIG_TCP_CONG_YEAH=m
100CONFIG_TCP_CONG_ILLINOIS=m
101CONFIG_IPV6=y
102CONFIG_IPV6_PRIVACY=y
103CONFIG_IPV6_ROUTER_PREF=y
104CONFIG_INET6_AH=m
105CONFIG_INET6_ESP=m
106CONFIG_INET6_IPCOMP=m
107CONFIG_IPV6_MIP6=m
108CONFIG_INET6_XFRM_MODE_TRANSPORT=m
109CONFIG_INET6_XFRM_MODE_TUNNEL=m
110CONFIG_INET6_XFRM_MODE_BEET=m
111CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
112CONFIG_IPV6_SIT=m
113CONFIG_IPV6_GRE=m
114CONFIG_IPV6_MULTIPLE_TABLES=y
115CONFIG_IPV6_SUBTREES=y
116CONFIG_NETFILTER=y
117CONFIG_NF_CONNTRACK=m
118CONFIG_NF_CONNTRACK_SECMARK=y
119CONFIG_NF_CONNTRACK_EVENTS=y
120CONFIG_NF_CONNTRACK_TIMEOUT=y
121CONFIG_NF_CONNTRACK_TIMESTAMP=y
122CONFIG_NF_CT_PROTO_DCCP=m
123CONFIG_NF_CT_PROTO_UDPLITE=m
124CONFIG_NF_CONNTRACK_AMANDA=m
125CONFIG_NF_CONNTRACK_FTP=m
126CONFIG_NF_CONNTRACK_H323=m
127CONFIG_NF_CONNTRACK_IRC=m
128CONFIG_NF_CONNTRACK_NETBIOS_NS=m
129CONFIG_NF_CONNTRACK_SNMP=m
130CONFIG_NF_CONNTRACK_PPTP=m
131CONFIG_NF_CONNTRACK_SANE=m
132CONFIG_NF_CONNTRACK_SIP=m
133CONFIG_NF_CONNTRACK_TFTP=m
134CONFIG_NF_CT_NETLINK=m
135CONFIG_NF_CT_NETLINK_TIMEOUT=m
136CONFIG_NETFILTER_TPROXY=m
137CONFIG_NETFILTER_XT_SET=m
138CONFIG_NETFILTER_XT_TARGET_AUDIT=m
139CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
140CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
141CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
142CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
143CONFIG_NETFILTER_XT_TARGET_CT=m
144CONFIG_NETFILTER_XT_TARGET_DSCP=m
145CONFIG_NETFILTER_XT_TARGET_HMARK=m
146CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m
147CONFIG_NETFILTER_XT_TARGET_LOG=m
148CONFIG_NETFILTER_XT_TARGET_MARK=m
149CONFIG_NETFILTER_XT_TARGET_NFLOG=m
150CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
151CONFIG_NETFILTER_XT_TARGET_TEE=m
152CONFIG_NETFILTER_XT_TARGET_TPROXY=m
153CONFIG_NETFILTER_XT_TARGET_TRACE=m
154CONFIG_NETFILTER_XT_TARGET_SECMARK=m
155CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
156CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
157CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m
158CONFIG_NETFILTER_XT_MATCH_BPF=m
159CONFIG_NETFILTER_XT_MATCH_CLUSTER=m
160CONFIG_NETFILTER_XT_MATCH_COMMENT=m
161CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
162CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m
163CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m
164CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
165CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
166CONFIG_NETFILTER_XT_MATCH_CPU=m
167CONFIG_NETFILTER_XT_MATCH_DCCP=m
168CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m
169CONFIG_NETFILTER_XT_MATCH_DSCP=m
170CONFIG_NETFILTER_XT_MATCH_ESP=m
171CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
172CONFIG_NETFILTER_XT_MATCH_HELPER=m
173CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
174CONFIG_NETFILTER_XT_MATCH_IPVS=m
175CONFIG_NETFILTER_XT_MATCH_LENGTH=m
176CONFIG_NETFILTER_XT_MATCH_LIMIT=m
177CONFIG_NETFILTER_XT_MATCH_MAC=m
178CONFIG_NETFILTER_XT_MATCH_MARK=m
179CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
180CONFIG_NETFILTER_XT_MATCH_NFACCT=m
181CONFIG_NETFILTER_XT_MATCH_OSF=m
182CONFIG_NETFILTER_XT_MATCH_OWNER=m
183CONFIG_NETFILTER_XT_MATCH_POLICY=m
184CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m
185CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
186CONFIG_NETFILTER_XT_MATCH_QUOTA=m
187CONFIG_NETFILTER_XT_MATCH_RATEEST=m
188CONFIG_NETFILTER_XT_MATCH_REALM=m
189CONFIG_NETFILTER_XT_MATCH_RECENT=m
190CONFIG_NETFILTER_XT_MATCH_SOCKET=m
191CONFIG_NETFILTER_XT_MATCH_STATE=m
192CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
193CONFIG_NETFILTER_XT_MATCH_STRING=m
194CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
195CONFIG_NETFILTER_XT_MATCH_TIME=m
196CONFIG_NETFILTER_XT_MATCH_U32=m
197CONFIG_IP_SET=m
198CONFIG_IP_SET_BITMAP_IP=m
199CONFIG_IP_SET_BITMAP_IPMAC=m
200CONFIG_IP_SET_BITMAP_PORT=m
201CONFIG_IP_SET_HASH_IP=m
202CONFIG_IP_SET_HASH_IPPORT=m
203CONFIG_IP_SET_HASH_IPPORTIP=m
204CONFIG_IP_SET_HASH_IPPORTNET=m
205CONFIG_IP_SET_HASH_NET=m
206CONFIG_IP_SET_HASH_NETPORT=m
207CONFIG_IP_SET_HASH_NETIFACE=m
208CONFIG_IP_SET_LIST_SET=m
209CONFIG_IP_VS=m
210CONFIG_IP_VS_PROTO_TCP=y
211CONFIG_IP_VS_PROTO_UDP=y
212CONFIG_IP_VS_PROTO_ESP=y
213CONFIG_IP_VS_PROTO_AH=y
214CONFIG_IP_VS_RR=m
215CONFIG_IP_VS_WRR=m
216CONFIG_IP_VS_LC=m
217CONFIG_IP_VS_WLC=m
218CONFIG_IP_VS_LBLC=m
219CONFIG_IP_VS_LBLCR=m
220CONFIG_IP_VS_DH=m
221CONFIG_IP_VS_SH=m
222CONFIG_IP_VS_SED=m
223CONFIG_IP_VS_NQ=m
224CONFIG_IP_VS_FTP=m
225CONFIG_IP_VS_PE_SIP=m
226CONFIG_NF_CONNTRACK_IPV4=m
227# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set
228CONFIG_IP_NF_IPTABLES=m
229CONFIG_IP_NF_MATCH_AH=m
230CONFIG_IP_NF_MATCH_ECN=m
231CONFIG_IP_NF_MATCH_RPFILTER=m
232CONFIG_IP_NF_MATCH_TTL=m
233CONFIG_IP_NF_FILTER=m
234CONFIG_IP_NF_TARGET_REJECT=m
235CONFIG_IP_NF_TARGET_ULOG=m
236CONFIG_NF_NAT_IPV4=m
237CONFIG_IP_NF_TARGET_MASQUERADE=m
238CONFIG_IP_NF_TARGET_NETMAP=m
239CONFIG_IP_NF_TARGET_REDIRECT=m
240CONFIG_IP_NF_MANGLE=m
241CONFIG_IP_NF_TARGET_CLUSTERIP=m
242CONFIG_IP_NF_TARGET_ECN=m
243CONFIG_IP_NF_TARGET_TTL=m
244CONFIG_IP_NF_RAW=m
245CONFIG_IP_NF_SECURITY=m
246CONFIG_IP_NF_ARPTABLES=m
247CONFIG_IP_NF_ARPFILTER=m
248CONFIG_IP_NF_ARP_MANGLE=m
249CONFIG_NF_CONNTRACK_IPV6=m
250CONFIG_IP6_NF_IPTABLES=m
251CONFIG_IP6_NF_MATCH_AH=m
252CONFIG_IP6_NF_MATCH_EUI64=m
253CONFIG_IP6_NF_MATCH_FRAG=m
254CONFIG_IP6_NF_MATCH_OPTS=m
255CONFIG_IP6_NF_MATCH_HL=m
256CONFIG_IP6_NF_MATCH_IPV6HEADER=m
257CONFIG_IP6_NF_MATCH_MH=m
258CONFIG_IP6_NF_MATCH_RPFILTER=m
259CONFIG_IP6_NF_MATCH_RT=m
260CONFIG_IP6_NF_TARGET_HL=m
261CONFIG_IP6_NF_FILTER=m
262CONFIG_IP6_NF_TARGET_REJECT=m
263CONFIG_IP6_NF_MANGLE=m
264CONFIG_IP6_NF_RAW=m
265CONFIG_IP6_NF_SECURITY=m
266CONFIG_NF_NAT_IPV6=m
267CONFIG_IP6_NF_TARGET_MASQUERADE=m
268CONFIG_IP6_NF_TARGET_NPT=m
269CONFIG_NET_SCTPPROBE=m
270CONFIG_RDS=m
271CONFIG_RDS_RDMA=m
272CONFIG_RDS_TCP=m
273CONFIG_L2TP=m
274CONFIG_L2TP_DEBUGFS=m
275CONFIG_L2TP_V3=y
276CONFIG_L2TP_IP=m
277CONFIG_L2TP_ETH=m
278CONFIG_BRIDGE=m
279CONFIG_VLAN_8021Q=m
280CONFIG_VLAN_8021Q_GVRP=y
281CONFIG_NET_SCHED=y
282CONFIG_NET_SCH_CBQ=m
283CONFIG_NET_SCH_HTB=m
284CONFIG_NET_SCH_HFSC=m
285CONFIG_NET_SCH_PRIO=m
286CONFIG_NET_SCH_MULTIQ=m
287CONFIG_NET_SCH_RED=m
288CONFIG_NET_SCH_SFB=m
289CONFIG_NET_SCH_SFQ=m
290CONFIG_NET_SCH_TEQL=m
291CONFIG_NET_SCH_TBF=m
292CONFIG_NET_SCH_GRED=m
293CONFIG_NET_SCH_DSMARK=m
294CONFIG_NET_SCH_NETEM=m
295CONFIG_NET_SCH_DRR=m
296CONFIG_NET_SCH_MQPRIO=m
297CONFIG_NET_SCH_CHOKE=m
298CONFIG_NET_SCH_QFQ=m
299CONFIG_NET_SCH_CODEL=m
300CONFIG_NET_SCH_FQ_CODEL=m
301CONFIG_NET_SCH_INGRESS=m
302CONFIG_NET_SCH_PLUG=m
303CONFIG_NET_CLS_BASIC=m
304CONFIG_NET_CLS_TCINDEX=m
305CONFIG_NET_CLS_ROUTE4=m
306CONFIG_NET_CLS_FW=m
307CONFIG_NET_CLS_U32=m
308CONFIG_CLS_U32_PERF=y
309CONFIG_CLS_U32_MARK=y
310CONFIG_NET_CLS_RSVP=m
311CONFIG_NET_CLS_RSVP6=m
312CONFIG_NET_CLS_FLOW=m
313CONFIG_NET_CLS_CGROUP=y
314CONFIG_NET_CLS_ACT=y
315CONFIG_NET_ACT_POLICE=m
316CONFIG_NET_ACT_GACT=m
317CONFIG_GACT_PROB=y
318CONFIG_NET_ACT_MIRRED=m
319CONFIG_NET_ACT_IPT=m
320CONFIG_NET_ACT_NAT=m
321CONFIG_NET_ACT_PEDIT=m
322CONFIG_NET_ACT_SIMP=m
323CONFIG_NET_ACT_SKBEDIT=m
324CONFIG_NET_ACT_CSUM=m
325CONFIG_DNS_RESOLVER=y
326CONFIG_BPF_JIT=y
327CONFIG_NET_PKTGEN=m
328CONFIG_NET_TCPPROBE=m
329CONFIG_DEVTMPFS=y
330CONFIG_CONNECTOR=y
331CONFIG_BLK_DEV_LOOP=m
332CONFIG_BLK_DEV_CRYPTOLOOP=m
333CONFIG_BLK_DEV_NBD=m
334CONFIG_BLK_DEV_OSD=m
335CONFIG_BLK_DEV_RAM=y
336CONFIG_BLK_DEV_RAM_SIZE=32768
337CONFIG_BLK_DEV_XIP=y
338CONFIG_CDROM_PKTCDVD=m
339CONFIG_ATA_OVER_ETH=m
340CONFIG_VIRTIO_BLK=y
341CONFIG_ENCLOSURE_SERVICES=m
342CONFIG_RAID_ATTRS=m
343CONFIG_SCSI=y
344CONFIG_SCSI_TGT=m
345CONFIG_BLK_DEV_SD=y
346CONFIG_CHR_DEV_ST=m
347CONFIG_CHR_DEV_OSST=m
348CONFIG_BLK_DEV_SR=m
349CONFIG_CHR_DEV_SG=y
350CONFIG_CHR_DEV_SCH=m
351CONFIG_SCSI_ENCLOSURE=m
352CONFIG_SCSI_MULTI_LUN=y
353CONFIG_SCSI_CONSTANTS=y
354CONFIG_SCSI_LOGGING=y
355CONFIG_SCSI_SPI_ATTRS=m
356CONFIG_SCSI_SAS_LIBSAS=m
357CONFIG_SCSI_SRP_ATTRS=m
358CONFIG_SCSI_SRP_TGT_ATTRS=y
359CONFIG_ISCSI_TCP=m
360CONFIG_LIBFCOE=m
361CONFIG_SCSI_DEBUG=m
362CONFIG_ZFCP=y
363CONFIG_SCSI_VIRTIO=m
364CONFIG_SCSI_DH=m
365CONFIG_SCSI_DH_RDAC=m
366CONFIG_SCSI_DH_HP_SW=m
367CONFIG_SCSI_DH_EMC=m
368CONFIG_SCSI_DH_ALUA=m
369CONFIG_SCSI_OSD_INITIATOR=m
370CONFIG_SCSI_OSD_ULD=m
371CONFIG_MD=y
372CONFIG_BLK_DEV_MD=y
373CONFIG_MD_LINEAR=m
374CONFIG_MD_RAID0=m
375CONFIG_MD_MULTIPATH=m
376CONFIG_MD_FAULTY=m
377CONFIG_BLK_DEV_DM=m
378CONFIG_DM_CRYPT=m
379CONFIG_DM_SNAPSHOT=m
380CONFIG_DM_MIRROR=m
381CONFIG_DM_RAID=m
382CONFIG_DM_LOG_USERSPACE=m
383CONFIG_DM_ZERO=m
384CONFIG_DM_MULTIPATH=m
385CONFIG_DM_MULTIPATH_QL=m
386CONFIG_DM_MULTIPATH_ST=m
387CONFIG_DM_DELAY=m
388CONFIG_DM_UEVENT=y
389CONFIG_DM_FLAKEY=m
390CONFIG_DM_VERITY=m
391CONFIG_DM_SWITCH=m
392CONFIG_NETDEVICES=y
393CONFIG_BONDING=m
394CONFIG_DUMMY=m
395CONFIG_EQUALIZER=m
396CONFIG_IFB=m
397CONFIG_MACVLAN=m
398CONFIG_MACVTAP=m
399CONFIG_VXLAN=m
400CONFIG_TUN=m
401CONFIG_VETH=m
402CONFIG_VIRTIO_NET=m
403CONFIG_NLMON=m
404CONFIG_VHOST_NET=m
405# CONFIG_NET_VENDOR_ARC is not set
406# CONFIG_NET_CADENCE is not set
407# CONFIG_NET_VENDOR_CHELSIO is not set
408# CONFIG_NET_VENDOR_INTEL is not set
409# CONFIG_NET_VENDOR_MARVELL is not set
410CONFIG_MLX4_EN=m
411# CONFIG_NET_VENDOR_NATSEMI is not set
412CONFIG_PPP=m
413CONFIG_PPP_BSDCOMP=m
414CONFIG_PPP_DEFLATE=m
415CONFIG_PPP_MPPE=m
416CONFIG_PPPOE=m
417CONFIG_PPTP=m
418CONFIG_PPPOL2TP=m
419CONFIG_PPP_ASYNC=m
420CONFIG_PPP_SYNC_TTY=m
421# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
422# CONFIG_INPUT_KEYBOARD is not set
423# CONFIG_INPUT_MOUSE is not set
424# CONFIG_SERIO is not set
425CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
426CONFIG_LEGACY_PTY_COUNT=0
427CONFIG_HW_RANDOM_VIRTIO=m
428CONFIG_RAW_DRIVER=m
429CONFIG_HANGCHECK_TIMER=m
430CONFIG_TN3270_FS=y
431CONFIG_WATCHDOG=y
432CONFIG_WATCHDOG_NOWAYOUT=y
433CONFIG_SOFT_WATCHDOG=m
434CONFIG_ZVM_WATCHDOG=m
435# CONFIG_HID is not set
436# CONFIG_USB_SUPPORT is not set
437CONFIG_INFINIBAND=m
438CONFIG_INFINIBAND_USER_ACCESS=m
439CONFIG_MLX4_INFINIBAND=m
440CONFIG_VIRTIO_BALLOON=m
441# CONFIG_IOMMU_SUPPORT is not set
442CONFIG_EXT2_FS=y
443CONFIG_EXT2_FS_XATTR=y
444CONFIG_EXT2_FS_POSIX_ACL=y
445CONFIG_EXT2_FS_SECURITY=y
446CONFIG_EXT2_FS_XIP=y
447CONFIG_EXT3_FS=y
448# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
449CONFIG_EXT3_FS_POSIX_ACL=y
450CONFIG_EXT3_FS_SECURITY=y
451CONFIG_EXT4_FS=y
452CONFIG_EXT4_FS_POSIX_ACL=y
453CONFIG_EXT4_FS_SECURITY=y
454CONFIG_JBD_DEBUG=y
455CONFIG_JBD2_DEBUG=y
456CONFIG_JFS_FS=m
457CONFIG_JFS_POSIX_ACL=y
458CONFIG_JFS_SECURITY=y
459CONFIG_JFS_STATISTICS=y
460CONFIG_XFS_FS=m
461CONFIG_XFS_QUOTA=y
462CONFIG_XFS_POSIX_ACL=y
463CONFIG_XFS_RT=y
464CONFIG_GFS2_FS=m
465CONFIG_OCFS2_FS=m
466CONFIG_BTRFS_FS=m
467CONFIG_BTRFS_FS_POSIX_ACL=y
468CONFIG_NILFS2_FS=m
469CONFIG_FANOTIFY=y
470CONFIG_QUOTA_NETLINK_INTERFACE=y
471CONFIG_QFMT_V1=m
472CONFIG_QFMT_V2=m
473CONFIG_AUTOFS4_FS=m
474CONFIG_FUSE_FS=m
475CONFIG_CUSE=m
476CONFIG_FSCACHE=m
477CONFIG_CACHEFILES=m
478CONFIG_ISO9660_FS=y
479CONFIG_JOLIET=y
480CONFIG_ZISOFS=y
481CONFIG_UDF_FS=m
482CONFIG_MSDOS_FS=m
483CONFIG_VFAT_FS=m
484CONFIG_NTFS_FS=m
485CONFIG_NTFS_RW=y
486CONFIG_PROC_KCORE=y
487CONFIG_TMPFS=y
488CONFIG_TMPFS_POSIX_ACL=y
489CONFIG_HUGETLBFS=y
490CONFIG_CONFIGFS_FS=m
491CONFIG_ECRYPT_FS=m
492CONFIG_CRAMFS=m
493CONFIG_SQUASHFS=m
494CONFIG_SQUASHFS_XATTR=y
495CONFIG_SQUASHFS_LZO=y
496CONFIG_SQUASHFS_XZ=y
497CONFIG_ROMFS_FS=m
498CONFIG_NFS_FS=m
499CONFIG_NFS_V3_ACL=y
500CONFIG_NFS_V4=m
501CONFIG_NFS_SWAP=y
502CONFIG_NFSD=m
503CONFIG_NFSD_V3_ACL=y
504CONFIG_NFSD_V4=y
505CONFIG_NFSD_V4_SECURITY_LABEL=y
506CONFIG_CIFS=m
507CONFIG_CIFS_STATS=y
508CONFIG_CIFS_STATS2=y
509CONFIG_CIFS_WEAK_PW_HASH=y
510CONFIG_CIFS_UPCALL=y
511CONFIG_CIFS_XATTR=y
512CONFIG_CIFS_POSIX=y
513# CONFIG_CIFS_DEBUG is not set
514CONFIG_CIFS_DFS_UPCALL=y
515CONFIG_NLS_DEFAULT="utf8"
516CONFIG_NLS_CODEPAGE_437=m
517CONFIG_NLS_CODEPAGE_850=m
518CONFIG_NLS_ASCII=m
519CONFIG_NLS_ISO8859_1=m
520CONFIG_NLS_ISO8859_15=m
521CONFIG_NLS_UTF8=m
522CONFIG_DLM=m
523CONFIG_PRINTK_TIME=y
524CONFIG_DEBUG_INFO=y
525# CONFIG_ENABLE_MUST_CHECK is not set
526CONFIG_FRAME_WARN=1024
527CONFIG_UNUSED_SYMBOLS=y
528CONFIG_MAGIC_SYSRQ=y
529CONFIG_DEBUG_KERNEL=y
530CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m
531CONFIG_TIMER_STATS=y
532CONFIG_RCU_TORTURE_TEST=m
533CONFIG_RCU_CPU_STALL_TIMEOUT=60
534CONFIG_NOTIFIER_ERROR_INJECTION=m
535CONFIG_CPU_NOTIFIER_ERROR_INJECT=m
536CONFIG_PM_NOTIFIER_ERROR_INJECT=m
537CONFIG_LATENCYTOP=y
538CONFIG_BLK_DEV_IO_TRACE=y
539# CONFIG_KPROBE_EVENT is not set
540CONFIG_LKDTM=m
541CONFIG_RBTREE_TEST=m
542CONFIG_INTERVAL_TREE_TEST=m
543CONFIG_ATOMIC64_SELFTEST=y
544# CONFIG_STRICT_DEVMEM is not set
545CONFIG_S390_PTDUMP=y
546CONFIG_ENCRYPTED_KEYS=m
547CONFIG_KEYS_DEBUG_PROC_KEYS=y
548CONFIG_SECURITY=y
549CONFIG_SECURITY_NETWORK=y
550CONFIG_SECURITY_SELINUX=y
551CONFIG_SECURITY_SELINUX_BOOTPARAM=y
552CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0
553CONFIG_SECURITY_SELINUX_DISABLE=y
554CONFIG_IMA=y
555CONFIG_IMA_APPRAISE=y
556CONFIG_CRYPTO_USER=m
557# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
558CONFIG_CRYPTO_CRYPTD=m
559CONFIG_CRYPTO_TEST=m
560CONFIG_CRYPTO_CCM=m
561CONFIG_CRYPTO_GCM=m
562CONFIG_CRYPTO_CTS=m
563CONFIG_CRYPTO_LRW=m
564CONFIG_CRYPTO_PCBC=m
565CONFIG_CRYPTO_XTS=m
566CONFIG_CRYPTO_XCBC=m
567CONFIG_CRYPTO_VMAC=m
568CONFIG_CRYPTO_CRC32=m
569CONFIG_CRYPTO_MICHAEL_MIC=m
570CONFIG_CRYPTO_RMD128=m
571CONFIG_CRYPTO_RMD160=m
572CONFIG_CRYPTO_RMD256=m
573CONFIG_CRYPTO_RMD320=m
574CONFIG_CRYPTO_SHA512=m
575CONFIG_CRYPTO_TGR192=m
576CONFIG_CRYPTO_WP512=m
577CONFIG_CRYPTO_ANUBIS=m
578CONFIG_CRYPTO_BLOWFISH=m
579CONFIG_CRYPTO_CAMELLIA=m
580CONFIG_CRYPTO_CAST5=m
581CONFIG_CRYPTO_CAST6=m
582CONFIG_CRYPTO_FCRYPT=m
583CONFIG_CRYPTO_KHAZAD=m
584CONFIG_CRYPTO_SALSA20=m
585CONFIG_CRYPTO_SEED=m
586CONFIG_CRYPTO_SERPENT=m
587CONFIG_CRYPTO_TEA=m
588CONFIG_CRYPTO_TWOFISH=m
589CONFIG_CRYPTO_ZLIB=y
590CONFIG_CRYPTO_LZO=m
591CONFIG_CRYPTO_LZ4=m
592CONFIG_CRYPTO_LZ4HC=m
593CONFIG_CRYPTO_USER_API_HASH=m
594CONFIG_CRYPTO_USER_API_SKCIPHER=m
595CONFIG_ZCRYPT=m
596CONFIG_CRYPTO_SHA1_S390=m
597CONFIG_CRYPTO_SHA256_S390=m
598CONFIG_CRYPTO_SHA512_S390=m
599CONFIG_CRYPTO_DES_S390=m
600CONFIG_CRYPTO_AES_S390=m
601CONFIG_CRYPTO_GHASH_S390=m
602CONFIG_ASYMMETRIC_KEY_TYPE=m
603CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m
604CONFIG_PUBLIC_KEY_ALGO_RSA=m
605CONFIG_X509_CERTIFICATE_PARSER=m
606CONFIG_CRC7=m
607CONFIG_CRC8=m
608CONFIG_XZ_DEC_X86=y
609CONFIG_XZ_DEC_POWERPC=y
610CONFIG_XZ_DEC_IA64=y
611CONFIG_XZ_DEC_ARM=y
612CONFIG_XZ_DEC_ARMTHUMB=y
613CONFIG_XZ_DEC_SPARC=y
614CONFIG_CORDIC=m
615CONFIG_CMM=m
616CONFIG_APPLDATA_BASE=y
617CONFIG_KVM=m
618CONFIG_KVM_S390_UCONTROL=y
diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig
new file mode 100644
index 000000000000..91087b43e8fa
--- /dev/null
+++ b/arch/s390/configs/performance_defconfig
@@ -0,0 +1,610 @@
1CONFIG_SYSVIPC=y
2CONFIG_POSIX_MQUEUE=y
3CONFIG_FHANDLE=y
4CONFIG_AUDIT=y
5CONFIG_NO_HZ=y
6CONFIG_HIGH_RES_TIMERS=y
7CONFIG_BSD_PROCESS_ACCT=y
8CONFIG_BSD_PROCESS_ACCT_V3=y
9CONFIG_TASKSTATS=y
10CONFIG_TASK_DELAY_ACCT=y
11CONFIG_TASK_XACCT=y
12CONFIG_TASK_IO_ACCOUNTING=y
13CONFIG_RCU_FAST_NO_HZ=y
14CONFIG_IKCONFIG=y
15CONFIG_IKCONFIG_PROC=y
16CONFIG_CGROUP_FREEZER=y
17CONFIG_CGROUP_DEVICE=y
18CONFIG_CPUSETS=y
19CONFIG_CGROUP_CPUACCT=y
20CONFIG_RESOURCE_COUNTERS=y
21CONFIG_CGROUP_PERF=y
22CONFIG_BLK_CGROUP=y
23CONFIG_SCHED_AUTOGROUP=y
24CONFIG_BLK_DEV_INITRD=y
25# CONFIG_COMPAT_BRK is not set
26CONFIG_PROFILING=y
27CONFIG_OPROFILE=m
28CONFIG_KPROBES=y
29CONFIG_JUMP_LABEL=y
30CONFIG_MODULES=y
31CONFIG_MODULE_FORCE_LOAD=y
32CONFIG_MODULE_UNLOAD=y
33CONFIG_MODULE_FORCE_UNLOAD=y
34CONFIG_MODVERSIONS=y
35CONFIG_MODULE_SRCVERSION_ALL=y
36CONFIG_BLK_DEV_INTEGRITY=y
37CONFIG_BLK_DEV_THROTTLING=y
38CONFIG_PARTITION_ADVANCED=y
39CONFIG_IBM_PARTITION=y
40CONFIG_BSD_DISKLABEL=y
41CONFIG_MINIX_SUBPARTITION=y
42CONFIG_SOLARIS_X86_PARTITION=y
43CONFIG_UNIXWARE_DISKLABEL=y
44CONFIG_CFQ_GROUP_IOSCHED=y
45CONFIG_DEFAULT_DEADLINE=y
46CONFIG_MARCH_Z9_109=y
47CONFIG_HZ_100=y
48CONFIG_MEMORY_HOTPLUG=y
49CONFIG_MEMORY_HOTREMOVE=y
50CONFIG_KSM=y
51CONFIG_TRANSPARENT_HUGEPAGE=y
52CONFIG_PCI=y
53CONFIG_HOTPLUG_PCI=y
54CONFIG_HOTPLUG_PCI_S390=y
55CONFIG_CHSC_SCH=y
56CONFIG_CRASH_DUMP=y
57CONFIG_ZFCPDUMP=y
58# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
59CONFIG_BINFMT_MISC=m
60CONFIG_HIBERNATION=y
61CONFIG_PACKET=y
62CONFIG_PACKET_DIAG=m
63CONFIG_UNIX=y
64CONFIG_UNIX_DIAG=m
65CONFIG_XFRM_USER=m
66CONFIG_NET_KEY=m
67CONFIG_INET=y
68CONFIG_IP_MULTICAST=y
69CONFIG_IP_ADVANCED_ROUTER=y
70CONFIG_IP_MULTIPLE_TABLES=y
71CONFIG_IP_ROUTE_MULTIPATH=y
72CONFIG_IP_ROUTE_VERBOSE=y
73CONFIG_NET_IPIP=m
74CONFIG_NET_IPGRE_DEMUX=m
75CONFIG_NET_IPGRE=m
76CONFIG_NET_IPGRE_BROADCAST=y
77CONFIG_IP_MROUTE=y
78CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
79CONFIG_IP_PIMSM_V1=y
80CONFIG_IP_PIMSM_V2=y
81CONFIG_SYN_COOKIES=y
82CONFIG_NET_IPVTI=m
83CONFIG_INET_AH=m
84CONFIG_INET_ESP=m
85CONFIG_INET_IPCOMP=m
86CONFIG_INET_XFRM_MODE_TRANSPORT=m
87CONFIG_INET_XFRM_MODE_TUNNEL=m
88CONFIG_INET_XFRM_MODE_BEET=m
89CONFIG_INET_DIAG=m
90CONFIG_INET_UDP_DIAG=m
91CONFIG_TCP_CONG_ADVANCED=y
92CONFIG_TCP_CONG_HSTCP=m
93CONFIG_TCP_CONG_HYBLA=m
94CONFIG_TCP_CONG_SCALABLE=m
95CONFIG_TCP_CONG_LP=m
96CONFIG_TCP_CONG_VENO=m
97CONFIG_TCP_CONG_YEAH=m
98CONFIG_TCP_CONG_ILLINOIS=m
99CONFIG_IPV6=y
100CONFIG_IPV6_PRIVACY=y
101CONFIG_IPV6_ROUTER_PREF=y
102CONFIG_INET6_AH=m
103CONFIG_INET6_ESP=m
104CONFIG_INET6_IPCOMP=m
105CONFIG_IPV6_MIP6=m
106CONFIG_INET6_XFRM_MODE_TRANSPORT=m
107CONFIG_INET6_XFRM_MODE_TUNNEL=m
108CONFIG_INET6_XFRM_MODE_BEET=m
109CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
110CONFIG_IPV6_SIT=m
111CONFIG_IPV6_GRE=m
112CONFIG_IPV6_MULTIPLE_TABLES=y
113CONFIG_IPV6_SUBTREES=y
114CONFIG_NETFILTER=y
115CONFIG_NF_CONNTRACK=m
116CONFIG_NF_CONNTRACK_SECMARK=y
117CONFIG_NF_CONNTRACK_EVENTS=y
118CONFIG_NF_CONNTRACK_TIMEOUT=y
119CONFIG_NF_CONNTRACK_TIMESTAMP=y
120CONFIG_NF_CT_PROTO_DCCP=m
121CONFIG_NF_CT_PROTO_UDPLITE=m
122CONFIG_NF_CONNTRACK_AMANDA=m
123CONFIG_NF_CONNTRACK_FTP=m
124CONFIG_NF_CONNTRACK_H323=m
125CONFIG_NF_CONNTRACK_IRC=m
126CONFIG_NF_CONNTRACK_NETBIOS_NS=m
127CONFIG_NF_CONNTRACK_SNMP=m
128CONFIG_NF_CONNTRACK_PPTP=m
129CONFIG_NF_CONNTRACK_SANE=m
130CONFIG_NF_CONNTRACK_SIP=m
131CONFIG_NF_CONNTRACK_TFTP=m
132CONFIG_NF_CT_NETLINK=m
133CONFIG_NF_CT_NETLINK_TIMEOUT=m
134CONFIG_NETFILTER_TPROXY=m
135CONFIG_NETFILTER_XT_SET=m
136CONFIG_NETFILTER_XT_TARGET_AUDIT=m
137CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
138CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
139CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
140CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
141CONFIG_NETFILTER_XT_TARGET_CT=m
142CONFIG_NETFILTER_XT_TARGET_DSCP=m
143CONFIG_NETFILTER_XT_TARGET_HMARK=m
144CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m
145CONFIG_NETFILTER_XT_TARGET_LOG=m
146CONFIG_NETFILTER_XT_TARGET_MARK=m
147CONFIG_NETFILTER_XT_TARGET_NFLOG=m
148CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
149CONFIG_NETFILTER_XT_TARGET_TEE=m
150CONFIG_NETFILTER_XT_TARGET_TPROXY=m
151CONFIG_NETFILTER_XT_TARGET_TRACE=m
152CONFIG_NETFILTER_XT_TARGET_SECMARK=m
153CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
154CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
155CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m
156CONFIG_NETFILTER_XT_MATCH_BPF=m
157CONFIG_NETFILTER_XT_MATCH_CLUSTER=m
158CONFIG_NETFILTER_XT_MATCH_COMMENT=m
159CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
160CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m
161CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m
162CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
163CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
164CONFIG_NETFILTER_XT_MATCH_CPU=m
165CONFIG_NETFILTER_XT_MATCH_DCCP=m
166CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m
167CONFIG_NETFILTER_XT_MATCH_DSCP=m
168CONFIG_NETFILTER_XT_MATCH_ESP=m
169CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
170CONFIG_NETFILTER_XT_MATCH_HELPER=m
171CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
172CONFIG_NETFILTER_XT_MATCH_IPVS=m
173CONFIG_NETFILTER_XT_MATCH_LENGTH=m
174CONFIG_NETFILTER_XT_MATCH_LIMIT=m
175CONFIG_NETFILTER_XT_MATCH_MAC=m
176CONFIG_NETFILTER_XT_MATCH_MARK=m
177CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
178CONFIG_NETFILTER_XT_MATCH_NFACCT=m
179CONFIG_NETFILTER_XT_MATCH_OSF=m
180CONFIG_NETFILTER_XT_MATCH_OWNER=m
181CONFIG_NETFILTER_XT_MATCH_POLICY=m
182CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m
183CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
184CONFIG_NETFILTER_XT_MATCH_QUOTA=m
185CONFIG_NETFILTER_XT_MATCH_RATEEST=m
186CONFIG_NETFILTER_XT_MATCH_REALM=m
187CONFIG_NETFILTER_XT_MATCH_RECENT=m
188CONFIG_NETFILTER_XT_MATCH_SOCKET=m
189CONFIG_NETFILTER_XT_MATCH_STATE=m
190CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
191CONFIG_NETFILTER_XT_MATCH_STRING=m
192CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
193CONFIG_NETFILTER_XT_MATCH_TIME=m
194CONFIG_NETFILTER_XT_MATCH_U32=m
195CONFIG_IP_SET=m
196CONFIG_IP_SET_BITMAP_IP=m
197CONFIG_IP_SET_BITMAP_IPMAC=m
198CONFIG_IP_SET_BITMAP_PORT=m
199CONFIG_IP_SET_HASH_IP=m
200CONFIG_IP_SET_HASH_IPPORT=m
201CONFIG_IP_SET_HASH_IPPORTIP=m
202CONFIG_IP_SET_HASH_IPPORTNET=m
203CONFIG_IP_SET_HASH_NET=m
204CONFIG_IP_SET_HASH_NETPORT=m
205CONFIG_IP_SET_HASH_NETIFACE=m
206CONFIG_IP_SET_LIST_SET=m
207CONFIG_IP_VS=m
208CONFIG_IP_VS_PROTO_TCP=y
209CONFIG_IP_VS_PROTO_UDP=y
210CONFIG_IP_VS_PROTO_ESP=y
211CONFIG_IP_VS_PROTO_AH=y
212CONFIG_IP_VS_RR=m
213CONFIG_IP_VS_WRR=m
214CONFIG_IP_VS_LC=m
215CONFIG_IP_VS_WLC=m
216CONFIG_IP_VS_LBLC=m
217CONFIG_IP_VS_LBLCR=m
218CONFIG_IP_VS_DH=m
219CONFIG_IP_VS_SH=m
220CONFIG_IP_VS_SED=m
221CONFIG_IP_VS_NQ=m
222CONFIG_IP_VS_FTP=m
223CONFIG_IP_VS_PE_SIP=m
224CONFIG_NF_CONNTRACK_IPV4=m
225# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set
226CONFIG_IP_NF_IPTABLES=m
227CONFIG_IP_NF_MATCH_AH=m
228CONFIG_IP_NF_MATCH_ECN=m
229CONFIG_IP_NF_MATCH_RPFILTER=m
230CONFIG_IP_NF_MATCH_TTL=m
231CONFIG_IP_NF_FILTER=m
232CONFIG_IP_NF_TARGET_REJECT=m
233CONFIG_IP_NF_TARGET_ULOG=m
234CONFIG_NF_NAT_IPV4=m
235CONFIG_IP_NF_TARGET_MASQUERADE=m
236CONFIG_IP_NF_TARGET_NETMAP=m
237CONFIG_IP_NF_TARGET_REDIRECT=m
238CONFIG_IP_NF_MANGLE=m
239CONFIG_IP_NF_TARGET_CLUSTERIP=m
240CONFIG_IP_NF_TARGET_ECN=m
241CONFIG_IP_NF_TARGET_TTL=m
242CONFIG_IP_NF_RAW=m
243CONFIG_IP_NF_SECURITY=m
244CONFIG_IP_NF_ARPTABLES=m
245CONFIG_IP_NF_ARPFILTER=m
246CONFIG_IP_NF_ARP_MANGLE=m
247CONFIG_NF_CONNTRACK_IPV6=m
248CONFIG_IP6_NF_IPTABLES=m
249CONFIG_IP6_NF_MATCH_AH=m
250CONFIG_IP6_NF_MATCH_EUI64=m
251CONFIG_IP6_NF_MATCH_FRAG=m
252CONFIG_IP6_NF_MATCH_OPTS=m
253CONFIG_IP6_NF_MATCH_HL=m
254CONFIG_IP6_NF_MATCH_IPV6HEADER=m
255CONFIG_IP6_NF_MATCH_MH=m
256CONFIG_IP6_NF_MATCH_RPFILTER=m
257CONFIG_IP6_NF_MATCH_RT=m
258CONFIG_IP6_NF_TARGET_HL=m
259CONFIG_IP6_NF_FILTER=m
260CONFIG_IP6_NF_TARGET_REJECT=m
261CONFIG_IP6_NF_MANGLE=m
262CONFIG_IP6_NF_RAW=m
263CONFIG_IP6_NF_SECURITY=m
264CONFIG_NF_NAT_IPV6=m
265CONFIG_IP6_NF_TARGET_MASQUERADE=m
266CONFIG_IP6_NF_TARGET_NPT=m
267CONFIG_NET_SCTPPROBE=m
268CONFIG_RDS=m
269CONFIG_RDS_RDMA=m
270CONFIG_RDS_TCP=m
271CONFIG_L2TP=m
272CONFIG_L2TP_DEBUGFS=m
273CONFIG_L2TP_V3=y
274CONFIG_L2TP_IP=m
275CONFIG_L2TP_ETH=m
276CONFIG_BRIDGE=m
277CONFIG_VLAN_8021Q=m
278CONFIG_VLAN_8021Q_GVRP=y
279CONFIG_NET_SCHED=y
280CONFIG_NET_SCH_CBQ=m
281CONFIG_NET_SCH_HTB=m
282CONFIG_NET_SCH_HFSC=m
283CONFIG_NET_SCH_PRIO=m
284CONFIG_NET_SCH_MULTIQ=m
285CONFIG_NET_SCH_RED=m
286CONFIG_NET_SCH_SFB=m
287CONFIG_NET_SCH_SFQ=m
288CONFIG_NET_SCH_TEQL=m
289CONFIG_NET_SCH_TBF=m
290CONFIG_NET_SCH_GRED=m
291CONFIG_NET_SCH_DSMARK=m
292CONFIG_NET_SCH_NETEM=m
293CONFIG_NET_SCH_DRR=m
294CONFIG_NET_SCH_MQPRIO=m
295CONFIG_NET_SCH_CHOKE=m
296CONFIG_NET_SCH_QFQ=m
297CONFIG_NET_SCH_CODEL=m
298CONFIG_NET_SCH_FQ_CODEL=m
299CONFIG_NET_SCH_INGRESS=m
300CONFIG_NET_SCH_PLUG=m
301CONFIG_NET_CLS_BASIC=m
302CONFIG_NET_CLS_TCINDEX=m
303CONFIG_NET_CLS_ROUTE4=m
304CONFIG_NET_CLS_FW=m
305CONFIG_NET_CLS_U32=m
306CONFIG_CLS_U32_PERF=y
307CONFIG_CLS_U32_MARK=y
308CONFIG_NET_CLS_RSVP=m
309CONFIG_NET_CLS_RSVP6=m
310CONFIG_NET_CLS_FLOW=m
311CONFIG_NET_CLS_CGROUP=y
312CONFIG_NET_CLS_ACT=y
313CONFIG_NET_ACT_POLICE=m
314CONFIG_NET_ACT_GACT=m
315CONFIG_GACT_PROB=y
316CONFIG_NET_ACT_MIRRED=m
317CONFIG_NET_ACT_IPT=m
318CONFIG_NET_ACT_NAT=m
319CONFIG_NET_ACT_PEDIT=m
320CONFIG_NET_ACT_SIMP=m
321CONFIG_NET_ACT_SKBEDIT=m
322CONFIG_NET_ACT_CSUM=m
323CONFIG_DNS_RESOLVER=y
324CONFIG_BPF_JIT=y
325CONFIG_NET_PKTGEN=m
326CONFIG_NET_TCPPROBE=m
327CONFIG_DEVTMPFS=y
328CONFIG_CONNECTOR=y
329CONFIG_BLK_DEV_LOOP=m
330CONFIG_BLK_DEV_CRYPTOLOOP=m
331CONFIG_BLK_DEV_NBD=m
332CONFIG_BLK_DEV_OSD=m
333CONFIG_BLK_DEV_RAM=y
334CONFIG_BLK_DEV_RAM_SIZE=32768
335CONFIG_BLK_DEV_XIP=y
336CONFIG_CDROM_PKTCDVD=m
337CONFIG_ATA_OVER_ETH=m
338CONFIG_VIRTIO_BLK=y
339CONFIG_ENCLOSURE_SERVICES=m
340CONFIG_RAID_ATTRS=m
341CONFIG_SCSI=y
342CONFIG_SCSI_TGT=m
343CONFIG_BLK_DEV_SD=y
344CONFIG_CHR_DEV_ST=m
345CONFIG_CHR_DEV_OSST=m
346CONFIG_BLK_DEV_SR=m
347CONFIG_CHR_DEV_SG=y
348CONFIG_CHR_DEV_SCH=m
349CONFIG_SCSI_ENCLOSURE=m
350CONFIG_SCSI_MULTI_LUN=y
351CONFIG_SCSI_CONSTANTS=y
352CONFIG_SCSI_LOGGING=y
353CONFIG_SCSI_SPI_ATTRS=m
354CONFIG_SCSI_SAS_LIBSAS=m
355CONFIG_SCSI_SRP_ATTRS=m
356CONFIG_SCSI_SRP_TGT_ATTRS=y
357CONFIG_ISCSI_TCP=m
358CONFIG_LIBFCOE=m
359CONFIG_SCSI_DEBUG=m
360CONFIG_ZFCP=y
361CONFIG_SCSI_VIRTIO=m
362CONFIG_SCSI_DH=m
363CONFIG_SCSI_DH_RDAC=m
364CONFIG_SCSI_DH_HP_SW=m
365CONFIG_SCSI_DH_EMC=m
366CONFIG_SCSI_DH_ALUA=m
367CONFIG_SCSI_OSD_INITIATOR=m
368CONFIG_SCSI_OSD_ULD=m
369CONFIG_MD=y
370CONFIG_BLK_DEV_MD=y
371CONFIG_MD_LINEAR=m
372CONFIG_MD_RAID0=m
373CONFIG_MD_MULTIPATH=m
374CONFIG_MD_FAULTY=m
375CONFIG_BLK_DEV_DM=m
376CONFIG_DM_CRYPT=m
377CONFIG_DM_SNAPSHOT=m
378CONFIG_DM_MIRROR=m
379CONFIG_DM_RAID=m
380CONFIG_DM_LOG_USERSPACE=m
381CONFIG_DM_ZERO=m
382CONFIG_DM_MULTIPATH=m
383CONFIG_DM_MULTIPATH_QL=m
384CONFIG_DM_MULTIPATH_ST=m
385CONFIG_DM_DELAY=m
386CONFIG_DM_UEVENT=y
387CONFIG_DM_FLAKEY=m
388CONFIG_DM_VERITY=m
389CONFIG_DM_SWITCH=m
390CONFIG_NETDEVICES=y
391CONFIG_BONDING=m
392CONFIG_DUMMY=m
393CONFIG_EQUALIZER=m
394CONFIG_IFB=m
395CONFIG_MACVLAN=m
396CONFIG_MACVTAP=m
397CONFIG_VXLAN=m
398CONFIG_TUN=m
399CONFIG_VETH=m
400CONFIG_VIRTIO_NET=m
401CONFIG_NLMON=m
402CONFIG_VHOST_NET=m
403# CONFIG_NET_VENDOR_ARC is not set
404# CONFIG_NET_CADENCE is not set
405# CONFIG_NET_VENDOR_CHELSIO is not set
406# CONFIG_NET_VENDOR_INTEL is not set
407# CONFIG_NET_VENDOR_MARVELL is not set
408CONFIG_MLX4_EN=m
409# CONFIG_NET_VENDOR_NATSEMI is not set
410CONFIG_PPP=m
411CONFIG_PPP_BSDCOMP=m
412CONFIG_PPP_DEFLATE=m
413CONFIG_PPP_MPPE=m
414CONFIG_PPPOE=m
415CONFIG_PPTP=m
416CONFIG_PPPOL2TP=m
417CONFIG_PPP_ASYNC=m
418CONFIG_PPP_SYNC_TTY=m
419# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
420# CONFIG_INPUT_KEYBOARD is not set
421# CONFIG_INPUT_MOUSE is not set
422# CONFIG_SERIO is not set
423CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
424CONFIG_LEGACY_PTY_COUNT=0
425CONFIG_HW_RANDOM_VIRTIO=m
426CONFIG_RAW_DRIVER=m
427CONFIG_HANGCHECK_TIMER=m
428CONFIG_TN3270_FS=y
429CONFIG_WATCHDOG=y
430CONFIG_WATCHDOG_NOWAYOUT=y
431CONFIG_SOFT_WATCHDOG=m
432CONFIG_ZVM_WATCHDOG=m
433# CONFIG_HID is not set
434# CONFIG_USB_SUPPORT is not set
435CONFIG_INFINIBAND=m
436CONFIG_INFINIBAND_USER_ACCESS=m
437CONFIG_MLX4_INFINIBAND=m
438CONFIG_VIRTIO_BALLOON=m
439# CONFIG_IOMMU_SUPPORT is not set
440CONFIG_EXT2_FS=y
441CONFIG_EXT2_FS_XATTR=y
442CONFIG_EXT2_FS_POSIX_ACL=y
443CONFIG_EXT2_FS_SECURITY=y
444CONFIG_EXT2_FS_XIP=y
445CONFIG_EXT3_FS=y
446# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
447CONFIG_EXT3_FS_POSIX_ACL=y
448CONFIG_EXT3_FS_SECURITY=y
449CONFIG_EXT4_FS=y
450CONFIG_EXT4_FS_POSIX_ACL=y
451CONFIG_EXT4_FS_SECURITY=y
452CONFIG_JBD_DEBUG=y
453CONFIG_JBD2_DEBUG=y
454CONFIG_JFS_FS=m
455CONFIG_JFS_POSIX_ACL=y
456CONFIG_JFS_SECURITY=y
457CONFIG_JFS_STATISTICS=y
458CONFIG_XFS_FS=m
459CONFIG_XFS_QUOTA=y
460CONFIG_XFS_POSIX_ACL=y
461CONFIG_XFS_RT=y
462CONFIG_GFS2_FS=m
463CONFIG_OCFS2_FS=m
464CONFIG_BTRFS_FS=m
465CONFIG_BTRFS_FS_POSIX_ACL=y
466CONFIG_NILFS2_FS=m
467CONFIG_FANOTIFY=y
468CONFIG_QUOTA_NETLINK_INTERFACE=y
469CONFIG_QFMT_V1=m
470CONFIG_QFMT_V2=m
471CONFIG_AUTOFS4_FS=m
472CONFIG_FUSE_FS=m
473CONFIG_CUSE=m
474CONFIG_FSCACHE=m
475CONFIG_CACHEFILES=m
476CONFIG_ISO9660_FS=y
477CONFIG_JOLIET=y
478CONFIG_ZISOFS=y
479CONFIG_UDF_FS=m
480CONFIG_MSDOS_FS=m
481CONFIG_VFAT_FS=m
482CONFIG_NTFS_FS=m
483CONFIG_NTFS_RW=y
484CONFIG_PROC_KCORE=y
485CONFIG_TMPFS=y
486CONFIG_TMPFS_POSIX_ACL=y
487CONFIG_HUGETLBFS=y
488CONFIG_CONFIGFS_FS=m
489CONFIG_ECRYPT_FS=m
490CONFIG_CRAMFS=m
491CONFIG_SQUASHFS=m
492CONFIG_SQUASHFS_XATTR=y
493CONFIG_SQUASHFS_LZO=y
494CONFIG_SQUASHFS_XZ=y
495CONFIG_ROMFS_FS=m
496CONFIG_NFS_FS=m
497CONFIG_NFS_V3_ACL=y
498CONFIG_NFS_V4=m
499CONFIG_NFS_SWAP=y
500CONFIG_NFSD=m
501CONFIG_NFSD_V3_ACL=y
502CONFIG_NFSD_V4=y
503CONFIG_NFSD_V4_SECURITY_LABEL=y
504CONFIG_CIFS=m
505CONFIG_CIFS_STATS=y
506CONFIG_CIFS_STATS2=y
507CONFIG_CIFS_WEAK_PW_HASH=y
508CONFIG_CIFS_UPCALL=y
509CONFIG_CIFS_XATTR=y
510CONFIG_CIFS_POSIX=y
511# CONFIG_CIFS_DEBUG is not set
512CONFIG_CIFS_DFS_UPCALL=y
513CONFIG_NLS_DEFAULT="utf8"
514CONFIG_NLS_CODEPAGE_437=m
515CONFIG_NLS_CODEPAGE_850=m
516CONFIG_NLS_ASCII=m
517CONFIG_NLS_ISO8859_1=m
518CONFIG_NLS_ISO8859_15=m
519CONFIG_NLS_UTF8=m
520CONFIG_DLM=m
521CONFIG_PRINTK_TIME=y
522CONFIG_DEBUG_INFO=y
523# CONFIG_ENABLE_MUST_CHECK is not set
524CONFIG_FRAME_WARN=1024
525CONFIG_UNUSED_SYMBOLS=y
526CONFIG_MAGIC_SYSRQ=y
527CONFIG_DEBUG_KERNEL=y
528CONFIG_TIMER_STATS=y
529CONFIG_RCU_TORTURE_TEST=m
530CONFIG_RCU_CPU_STALL_TIMEOUT=60
531CONFIG_LATENCYTOP=y
532CONFIG_BLK_DEV_IO_TRACE=y
533# CONFIG_KPROBE_EVENT is not set
534CONFIG_LKDTM=m
535CONFIG_ATOMIC64_SELFTEST=y
536# CONFIG_STRICT_DEVMEM is not set
537CONFIG_S390_PTDUMP=y
538CONFIG_ENCRYPTED_KEYS=m
539CONFIG_KEYS_DEBUG_PROC_KEYS=y
540CONFIG_SECURITY=y
541CONFIG_SECURITY_NETWORK=y
542CONFIG_SECURITY_SELINUX=y
543CONFIG_SECURITY_SELINUX_BOOTPARAM=y
544CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0
545CONFIG_SECURITY_SELINUX_DISABLE=y
546CONFIG_IMA=y
547CONFIG_IMA_APPRAISE=y
548CONFIG_CRYPTO_USER=m
549# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
550CONFIG_CRYPTO_CRYPTD=m
551CONFIG_CRYPTO_TEST=m
552CONFIG_CRYPTO_CCM=m
553CONFIG_CRYPTO_GCM=m
554CONFIG_CRYPTO_CTS=m
555CONFIG_CRYPTO_LRW=m
556CONFIG_CRYPTO_PCBC=m
557CONFIG_CRYPTO_XTS=m
558CONFIG_CRYPTO_XCBC=m
559CONFIG_CRYPTO_VMAC=m
560CONFIG_CRYPTO_CRC32=m
561CONFIG_CRYPTO_MICHAEL_MIC=m
562CONFIG_CRYPTO_RMD128=m
563CONFIG_CRYPTO_RMD160=m
564CONFIG_CRYPTO_RMD256=m
565CONFIG_CRYPTO_RMD320=m
566CONFIG_CRYPTO_SHA512=m
567CONFIG_CRYPTO_TGR192=m
568CONFIG_CRYPTO_WP512=m
569CONFIG_CRYPTO_ANUBIS=m
570CONFIG_CRYPTO_BLOWFISH=m
571CONFIG_CRYPTO_CAMELLIA=m
572CONFIG_CRYPTO_CAST5=m
573CONFIG_CRYPTO_CAST6=m
574CONFIG_CRYPTO_FCRYPT=m
575CONFIG_CRYPTO_KHAZAD=m
576CONFIG_CRYPTO_SALSA20=m
577CONFIG_CRYPTO_SEED=m
578CONFIG_CRYPTO_SERPENT=m
579CONFIG_CRYPTO_TEA=m
580CONFIG_CRYPTO_TWOFISH=m
581CONFIG_CRYPTO_ZLIB=y
582CONFIG_CRYPTO_LZO=m
583CONFIG_CRYPTO_LZ4=m
584CONFIG_CRYPTO_LZ4HC=m
585CONFIG_CRYPTO_USER_API_HASH=m
586CONFIG_CRYPTO_USER_API_SKCIPHER=m
587CONFIG_ZCRYPT=m
588CONFIG_CRYPTO_SHA1_S390=m
589CONFIG_CRYPTO_SHA256_S390=m
590CONFIG_CRYPTO_SHA512_S390=m
591CONFIG_CRYPTO_DES_S390=m
592CONFIG_CRYPTO_AES_S390=m
593CONFIG_CRYPTO_GHASH_S390=m
594CONFIG_ASYMMETRIC_KEY_TYPE=m
595CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m
596CONFIG_PUBLIC_KEY_ALGO_RSA=m
597CONFIG_X509_CERTIFICATE_PARSER=m
598CONFIG_CRC7=m
599CONFIG_CRC8=m
600CONFIG_XZ_DEC_X86=y
601CONFIG_XZ_DEC_POWERPC=y
602CONFIG_XZ_DEC_IA64=y
603CONFIG_XZ_DEC_ARM=y
604CONFIG_XZ_DEC_ARMTHUMB=y
605CONFIG_XZ_DEC_SPARC=y
606CONFIG_CORDIC=m
607CONFIG_CMM=m
608CONFIG_APPLDATA_BASE=y
609CONFIG_KVM=m
610CONFIG_KVM_S390_UCONTROL=y
diff --git a/arch/s390/configs/zfcpdump_defconfig b/arch/s390/configs/zfcpdump_defconfig
new file mode 100644
index 000000000000..d725c4d956e4
--- /dev/null
+++ b/arch/s390/configs/zfcpdump_defconfig
@@ -0,0 +1,86 @@
1# CONFIG_SWAP is not set
2CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y
4CONFIG_RCU_FAST_NO_HZ=y
5CONFIG_BLK_DEV_INITRD=y
6CONFIG_CC_OPTIMIZE_FOR_SIZE=y
7# CONFIG_COMPAT_BRK is not set
8CONFIG_PARTITION_ADVANCED=y
9CONFIG_IBM_PARTITION=y
10CONFIG_DEFAULT_DEADLINE=y
11CONFIG_MARCH_Z9_109=y
12# CONFIG_COMPAT is not set
13CONFIG_NR_CPUS=2
14# CONFIG_HOTPLUG_CPU is not set
15CONFIG_HZ_100=y
16# CONFIG_COMPACTION is not set
17# CONFIG_MIGRATION is not set
18# CONFIG_CHECK_STACK is not set
19# CONFIG_CHSC_SCH is not set
20# CONFIG_SCM_BUS is not set
21CONFIG_CRASH_DUMP=y
22CONFIG_ZFCPDUMP=y
23# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
24# CONFIG_SECCOMP is not set
25# CONFIG_IUCV is not set
26CONFIG_ATM=y
27CONFIG_ATM_LANE=y
28CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
29CONFIG_DEVTMPFS=y
30# CONFIG_FIRMWARE_IN_KERNEL is not set
31# CONFIG_BLK_DEV_XPRAM is not set
32# CONFIG_DCSSBLK is not set
33# CONFIG_DASD is not set
34CONFIG_ENCLOSURE_SERVICES=y
35CONFIG_SCSI=y
36CONFIG_BLK_DEV_SD=y
37CONFIG_SCSI_ENCLOSURE=y
38CONFIG_SCSI_MULTI_LUN=y
39CONFIG_SCSI_CONSTANTS=y
40CONFIG_SCSI_LOGGING=y
41CONFIG_SCSI_SRP_ATTRS=y
42CONFIG_ZFCP=y
43# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
44# CONFIG_INPUT_KEYBOARD is not set
45# CONFIG_INPUT_MOUSE is not set
46# CONFIG_SERIO is not set
47# CONFIG_HVC_IUCV is not set
48CONFIG_RAW_DRIVER=y
49# CONFIG_SCLP_ASYNC is not set
50# CONFIG_HMC_DRV is not set
51# CONFIG_S390_TAPE is not set
52# CONFIG_VMCP is not set
53# CONFIG_MONWRITER is not set
54# CONFIG_S390_VMUR is not set
55# CONFIG_HID is not set
56CONFIG_MEMSTICK=y
57CONFIG_MEMSTICK_DEBUG=y
58CONFIG_MEMSTICK_UNSAFE_RESUME=y
59CONFIG_MSPRO_BLOCK=y
60# CONFIG_IOMMU_SUPPORT is not set
61CONFIG_EXT2_FS=y
62CONFIG_EXT3_FS=y
63# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
64CONFIG_EXT4_FS=y
65CONFIG_EXT4_FS_POSIX_ACL=y
66CONFIG_EXT4_FS_SECURITY=y
67# CONFIG_INOTIFY_USER is not set
68CONFIG_CONFIGFS_FS=y
69CONFIG_PRINTK_TIME=y
70CONFIG_DEBUG_INFO=y
71CONFIG_DEBUG_FS=y
72CONFIG_DEBUG_KERNEL=y
73# CONFIG_SCHED_DEBUG is not set
74CONFIG_RCU_CPU_STALL_TIMEOUT=60
75# CONFIG_FTRACE is not set
76# CONFIG_STRICT_DEVMEM is not set
77CONFIG_XZ_DEC_X86=y
78CONFIG_XZ_DEC_POWERPC=y
79CONFIG_XZ_DEC_IA64=y
80CONFIG_XZ_DEC_ARM=y
81CONFIG_XZ_DEC_ARMTHUMB=y
82CONFIG_XZ_DEC_SPARC=y
83# CONFIG_PFAULT is not set
84# CONFIG_S390_HYPFS_FS is not set
85# CONFIG_VIRTUALIZATION is not set
86# CONFIG_S390_GUEST is not set
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index b4dbade8ca24..46cae138ece2 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -725,6 +725,8 @@ static struct crypto_alg xts_aes_alg = {
725 } 725 }
726}; 726};
727 727
728static int xts_aes_alg_reg;
729
728static int ctr_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, 730static int ctr_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
729 unsigned int key_len) 731 unsigned int key_len)
730{ 732{
@@ -846,6 +848,8 @@ static struct crypto_alg ctr_aes_alg = {
846 } 848 }
847}; 849};
848 850
851static int ctr_aes_alg_reg;
852
849static int __init aes_s390_init(void) 853static int __init aes_s390_init(void)
850{ 854{
851 int ret; 855 int ret;
@@ -884,6 +888,7 @@ static int __init aes_s390_init(void)
884 ret = crypto_register_alg(&xts_aes_alg); 888 ret = crypto_register_alg(&xts_aes_alg);
885 if (ret) 889 if (ret)
886 goto xts_aes_err; 890 goto xts_aes_err;
891 xts_aes_alg_reg = 1;
887 } 892 }
888 893
889 if (crypt_s390_func_available(KMCTR_AES_128_ENCRYPT, 894 if (crypt_s390_func_available(KMCTR_AES_128_ENCRYPT,
@@ -902,6 +907,7 @@ static int __init aes_s390_init(void)
902 free_page((unsigned long) ctrblk); 907 free_page((unsigned long) ctrblk);
903 goto ctr_aes_err; 908 goto ctr_aes_err;
904 } 909 }
910 ctr_aes_alg_reg = 1;
905 } 911 }
906 912
907out: 913out:
@@ -921,9 +927,12 @@ aes_err:
921 927
922static void __exit aes_s390_fini(void) 928static void __exit aes_s390_fini(void)
923{ 929{
924 crypto_unregister_alg(&ctr_aes_alg); 930 if (ctr_aes_alg_reg) {
925 free_page((unsigned long) ctrblk); 931 crypto_unregister_alg(&ctr_aes_alg);
926 crypto_unregister_alg(&xts_aes_alg); 932 free_page((unsigned long) ctrblk);
933 }
934 if (xts_aes_alg_reg)
935 crypto_unregister_alg(&xts_aes_alg);
927 crypto_unregister_alg(&cbc_aes_alg); 936 crypto_unregister_alg(&cbc_aes_alg);
928 crypto_unregister_alg(&ecb_aes_alg); 937 crypto_unregister_alg(&ecb_aes_alg);
929 crypto_unregister_alg(&aes_alg); 938 crypto_unregister_alg(&aes_alg);
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index d204c65bf722..33f57514f424 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -38,13 +38,14 @@ CONFIG_MODULE_UNLOAD=y
38CONFIG_MODVERSIONS=y 38CONFIG_MODVERSIONS=y
39CONFIG_PARTITION_ADVANCED=y 39CONFIG_PARTITION_ADVANCED=y
40CONFIG_IBM_PARTITION=y 40CONFIG_IBM_PARTITION=y
41# CONFIG_EFI_PARTITION is not set
42CONFIG_DEFAULT_DEADLINE=y 41CONFIG_DEFAULT_DEADLINE=y
42CONFIG_MARCH_Z196=y
43CONFIG_HZ_100=y 43CONFIG_HZ_100=y
44CONFIG_MEMORY_HOTPLUG=y 44CONFIG_MEMORY_HOTPLUG=y
45CONFIG_MEMORY_HOTREMOVE=y 45CONFIG_MEMORY_HOTREMOVE=y
46CONFIG_KSM=y 46CONFIG_KSM=y
47CONFIG_TRANSPARENT_HUGEPAGE=y 47CONFIG_TRANSPARENT_HUGEPAGE=y
48CONFIG_CMA=y
48CONFIG_CRASH_DUMP=y 49CONFIG_CRASH_DUMP=y
49CONFIG_BINFMT_MISC=m 50CONFIG_BINFMT_MISC=m
50CONFIG_HIBERNATION=y 51CONFIG_HIBERNATION=y
@@ -152,6 +153,7 @@ CONFIG_CRYPTO_CMAC=m
152CONFIG_CRYPTO_XCBC=m 153CONFIG_CRYPTO_XCBC=m
153CONFIG_CRYPTO_VMAC=m 154CONFIG_CRYPTO_VMAC=m
154CONFIG_CRYPTO_CRC32=m 155CONFIG_CRYPTO_CRC32=m
156CONFIG_CRYPTO_CRCT10DIF=m
155CONFIG_CRYPTO_MD4=m 157CONFIG_CRYPTO_MD4=m
156CONFIG_CRYPTO_MICHAEL_MIC=m 158CONFIG_CRYPTO_MICHAEL_MIC=m
157CONFIG_CRYPTO_RMD128=m 159CONFIG_CRYPTO_RMD128=m
diff --git a/arch/s390/include/asm/Kbuild b/arch/s390/include/asm/Kbuild
index f313f9cbcf44..7a5288f3479a 100644
--- a/arch/s390/include/asm/Kbuild
+++ b/arch/s390/include/asm/Kbuild
@@ -2,3 +2,4 @@
2 2
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += trace_clock.h 4generic-y += trace_clock.h
5generic-y += preempt.h
diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h
index c797832daa5f..fa9aaf7144b7 100644
--- a/arch/s390/include/asm/atomic.h
+++ b/arch/s390/include/asm/atomic.h
@@ -19,21 +19,50 @@
19 19
20#define ATOMIC_INIT(i) { (i) } 20#define ATOMIC_INIT(i) { (i) }
21 21
22#define __CS_LOOP(ptr, op_val, op_string) ({ \ 22#ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
23
24#define __ATOMIC_OR "lao"
25#define __ATOMIC_AND "lan"
26#define __ATOMIC_ADD "laa"
27
28#define __ATOMIC_LOOP(ptr, op_val, op_string) \
29({ \
30 int old_val; \
31 \
32 typecheck(atomic_t *, ptr); \
33 asm volatile( \
34 op_string " %0,%2,%1\n" \
35 : "=d" (old_val), "+Q" ((ptr)->counter) \
36 : "d" (op_val) \
37 : "cc", "memory"); \
38 old_val; \
39})
40
41#else /* CONFIG_HAVE_MARCH_Z196_FEATURES */
42
43#define __ATOMIC_OR "or"
44#define __ATOMIC_AND "nr"
45#define __ATOMIC_ADD "ar"
46
47#define __ATOMIC_LOOP(ptr, op_val, op_string) \
48({ \
23 int old_val, new_val; \ 49 int old_val, new_val; \
50 \
51 typecheck(atomic_t *, ptr); \
24 asm volatile( \ 52 asm volatile( \
25 " l %0,%2\n" \ 53 " l %0,%2\n" \
26 "0: lr %1,%0\n" \ 54 "0: lr %1,%0\n" \
27 op_string " %1,%3\n" \ 55 op_string " %1,%3\n" \
28 " cs %0,%1,%2\n" \ 56 " cs %0,%1,%2\n" \
29 " jl 0b" \ 57 " jl 0b" \
30 : "=&d" (old_val), "=&d" (new_val), \ 58 : "=&d" (old_val), "=&d" (new_val), "+Q" ((ptr)->counter)\
31 "=Q" (((atomic_t *)(ptr))->counter) \ 59 : "d" (op_val) \
32 : "d" (op_val), "Q" (((atomic_t *)(ptr))->counter) \
33 : "cc", "memory"); \ 60 : "cc", "memory"); \
34 new_val; \ 61 old_val; \
35}) 62})
36 63
64#endif /* CONFIG_HAVE_MARCH_Z196_FEATURES */
65
37static inline int atomic_read(const atomic_t *v) 66static inline int atomic_read(const atomic_t *v)
38{ 67{
39 int c; 68 int c;
@@ -53,32 +82,45 @@ static inline void atomic_set(atomic_t *v, int i)
53 82
54static inline int atomic_add_return(int i, atomic_t *v) 83static inline int atomic_add_return(int i, atomic_t *v)
55{ 84{
56 return __CS_LOOP(v, i, "ar"); 85 return __ATOMIC_LOOP(v, i, __ATOMIC_ADD) + i;
57} 86}
58#define atomic_add(_i, _v) atomic_add_return(_i, _v)
59#define atomic_add_negative(_i, _v) (atomic_add_return(_i, _v) < 0)
60#define atomic_inc(_v) atomic_add_return(1, _v)
61#define atomic_inc_return(_v) atomic_add_return(1, _v)
62#define atomic_inc_and_test(_v) (atomic_add_return(1, _v) == 0)
63 87
64static inline int atomic_sub_return(int i, atomic_t *v) 88static inline void atomic_add(int i, atomic_t *v)
65{ 89{
66 return __CS_LOOP(v, i, "sr"); 90#ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
91 if (__builtin_constant_p(i) && (i > -129) && (i < 128)) {
92 asm volatile(
93 "asi %0,%1\n"
94 : "+Q" (v->counter)
95 : "i" (i)
96 : "cc", "memory");
97 } else {
98 atomic_add_return(i, v);
99 }
100#else
101 atomic_add_return(i, v);
102#endif
67} 103}
68#define atomic_sub(_i, _v) atomic_sub_return(_i, _v) 104
105#define atomic_add_negative(_i, _v) (atomic_add_return(_i, _v) < 0)
106#define atomic_inc(_v) atomic_add(1, _v)
107#define atomic_inc_return(_v) atomic_add_return(1, _v)
108#define atomic_inc_and_test(_v) (atomic_add_return(1, _v) == 0)
109#define atomic_sub(_i, _v) atomic_add(-(int)(_i), _v)
110#define atomic_sub_return(_i, _v) atomic_add_return(-(int)(_i), _v)
69#define atomic_sub_and_test(_i, _v) (atomic_sub_return(_i, _v) == 0) 111#define atomic_sub_and_test(_i, _v) (atomic_sub_return(_i, _v) == 0)
70#define atomic_dec(_v) atomic_sub_return(1, _v) 112#define atomic_dec(_v) atomic_sub(1, _v)
71#define atomic_dec_return(_v) atomic_sub_return(1, _v) 113#define atomic_dec_return(_v) atomic_sub_return(1, _v)
72#define atomic_dec_and_test(_v) (atomic_sub_return(1, _v) == 0) 114#define atomic_dec_and_test(_v) (atomic_sub_return(1, _v) == 0)
73 115
74static inline void atomic_clear_mask(unsigned long mask, atomic_t *v) 116static inline void atomic_clear_mask(unsigned int mask, atomic_t *v)
75{ 117{
76 __CS_LOOP(v, ~mask, "nr"); 118 __ATOMIC_LOOP(v, ~mask, __ATOMIC_AND);
77} 119}
78 120
79static inline void atomic_set_mask(unsigned long mask, atomic_t *v) 121static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
80{ 122{
81 __CS_LOOP(v, mask, "or"); 123 __ATOMIC_LOOP(v, mask, __ATOMIC_OR);
82} 124}
83 125
84#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 126#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
@@ -87,8 +129,8 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
87{ 129{
88 asm volatile( 130 asm volatile(
89 " cs %0,%2,%1" 131 " cs %0,%2,%1"
90 : "+d" (old), "=Q" (v->counter) 132 : "+d" (old), "+Q" (v->counter)
91 : "d" (new), "Q" (v->counter) 133 : "d" (new)
92 : "cc", "memory"); 134 : "cc", "memory");
93 return old; 135 return old;
94} 136}
@@ -109,27 +151,56 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u)
109} 151}
110 152
111 153
112#undef __CS_LOOP 154#undef __ATOMIC_LOOP
113 155
114#define ATOMIC64_INIT(i) { (i) } 156#define ATOMIC64_INIT(i) { (i) }
115 157
116#ifdef CONFIG_64BIT 158#ifdef CONFIG_64BIT
117 159
118#define __CSG_LOOP(ptr, op_val, op_string) ({ \ 160#ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
161
162#define __ATOMIC64_OR "laog"
163#define __ATOMIC64_AND "lang"
164#define __ATOMIC64_ADD "laag"
165
166#define __ATOMIC64_LOOP(ptr, op_val, op_string) \
167({ \
168 long long old_val; \
169 \
170 typecheck(atomic64_t *, ptr); \
171 asm volatile( \
172 op_string " %0,%2,%1\n" \
173 : "=d" (old_val), "+Q" ((ptr)->counter) \
174 : "d" (op_val) \
175 : "cc", "memory"); \
176 old_val; \
177})
178
179#else /* CONFIG_HAVE_MARCH_Z196_FEATURES */
180
181#define __ATOMIC64_OR "ogr"
182#define __ATOMIC64_AND "ngr"
183#define __ATOMIC64_ADD "agr"
184
185#define __ATOMIC64_LOOP(ptr, op_val, op_string) \
186({ \
119 long long old_val, new_val; \ 187 long long old_val, new_val; \
188 \
189 typecheck(atomic64_t *, ptr); \
120 asm volatile( \ 190 asm volatile( \
121 " lg %0,%2\n" \ 191 " lg %0,%2\n" \
122 "0: lgr %1,%0\n" \ 192 "0: lgr %1,%0\n" \
123 op_string " %1,%3\n" \ 193 op_string " %1,%3\n" \
124 " csg %0,%1,%2\n" \ 194 " csg %0,%1,%2\n" \
125 " jl 0b" \ 195 " jl 0b" \
126 : "=&d" (old_val), "=&d" (new_val), \ 196 : "=&d" (old_val), "=&d" (new_val), "+Q" ((ptr)->counter)\
127 "=Q" (((atomic_t *)(ptr))->counter) \ 197 : "d" (op_val) \
128 : "d" (op_val), "Q" (((atomic_t *)(ptr))->counter) \
129 : "cc", "memory"); \ 198 : "cc", "memory"); \
130 new_val; \ 199 old_val; \
131}) 200})
132 201
202#endif /* CONFIG_HAVE_MARCH_Z196_FEATURES */
203
133static inline long long atomic64_read(const atomic64_t *v) 204static inline long long atomic64_read(const atomic64_t *v)
134{ 205{
135 long long c; 206 long long c;
@@ -149,22 +220,17 @@ static inline void atomic64_set(atomic64_t *v, long long i)
149 220
150static inline long long atomic64_add_return(long long i, atomic64_t *v) 221static inline long long atomic64_add_return(long long i, atomic64_t *v)
151{ 222{
152 return __CSG_LOOP(v, i, "agr"); 223 return __ATOMIC64_LOOP(v, i, __ATOMIC64_ADD) + i;
153}
154
155static inline long long atomic64_sub_return(long long i, atomic64_t *v)
156{
157 return __CSG_LOOP(v, i, "sgr");
158} 224}
159 225
160static inline void atomic64_clear_mask(unsigned long mask, atomic64_t *v) 226static inline void atomic64_clear_mask(unsigned long mask, atomic64_t *v)
161{ 227{
162 __CSG_LOOP(v, ~mask, "ngr"); 228 __ATOMIC64_LOOP(v, ~mask, __ATOMIC64_AND);
163} 229}
164 230
165static inline void atomic64_set_mask(unsigned long mask, atomic64_t *v) 231static inline void atomic64_set_mask(unsigned long mask, atomic64_t *v)
166{ 232{
167 __CSG_LOOP(v, mask, "ogr"); 233 __ATOMIC64_LOOP(v, mask, __ATOMIC64_OR);
168} 234}
169 235
170#define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) 236#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
@@ -174,13 +240,13 @@ static inline long long atomic64_cmpxchg(atomic64_t *v,
174{ 240{
175 asm volatile( 241 asm volatile(
176 " csg %0,%2,%1" 242 " csg %0,%2,%1"
177 : "+d" (old), "=Q" (v->counter) 243 : "+d" (old), "+Q" (v->counter)
178 : "d" (new), "Q" (v->counter) 244 : "d" (new)
179 : "cc", "memory"); 245 : "cc", "memory");
180 return old; 246 return old;
181} 247}
182 248
183#undef __CSG_LOOP 249#undef __ATOMIC64_LOOP
184 250
185#else /* CONFIG_64BIT */ 251#else /* CONFIG_64BIT */
186 252
@@ -216,8 +282,8 @@ static inline long long atomic64_xchg(atomic64_t *v, long long new)
216 " lm %0,%N0,%1\n" 282 " lm %0,%N0,%1\n"
217 "0: cds %0,%2,%1\n" 283 "0: cds %0,%2,%1\n"
218 " jl 0b\n" 284 " jl 0b\n"
219 : "=&d" (rp_old), "=Q" (v->counter) 285 : "=&d" (rp_old), "+Q" (v->counter)
220 : "d" (rp_new), "Q" (v->counter) 286 : "d" (rp_new)
221 : "cc"); 287 : "cc");
222 return rp_old.pair; 288 return rp_old.pair;
223} 289}
@@ -230,8 +296,8 @@ static inline long long atomic64_cmpxchg(atomic64_t *v,
230 296
231 asm volatile( 297 asm volatile(
232 " cds %0,%2,%1" 298 " cds %0,%2,%1"
233 : "+&d" (rp_old), "=Q" (v->counter) 299 : "+&d" (rp_old), "+Q" (v->counter)
234 : "d" (rp_new), "Q" (v->counter) 300 : "d" (rp_new)
235 : "cc"); 301 : "cc");
236 return rp_old.pair; 302 return rp_old.pair;
237} 303}
@@ -248,17 +314,6 @@ static inline long long atomic64_add_return(long long i, atomic64_t *v)
248 return new; 314 return new;
249} 315}
250 316
251static inline long long atomic64_sub_return(long long i, atomic64_t *v)
252{
253 long long old, new;
254
255 do {
256 old = atomic64_read(v);
257 new = old - i;
258 } while (atomic64_cmpxchg(v, old, new) != old);
259 return new;
260}
261
262static inline void atomic64_set_mask(unsigned long long mask, atomic64_t *v) 317static inline void atomic64_set_mask(unsigned long long mask, atomic64_t *v)
263{ 318{
264 long long old, new; 319 long long old, new;
@@ -281,7 +336,24 @@ static inline void atomic64_clear_mask(unsigned long long mask, atomic64_t *v)
281 336
282#endif /* CONFIG_64BIT */ 337#endif /* CONFIG_64BIT */
283 338
284static inline int atomic64_add_unless(atomic64_t *v, long long a, long long u) 339static inline void atomic64_add(long long i, atomic64_t *v)
340{
341#ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
342 if (__builtin_constant_p(i) && (i > -129) && (i < 128)) {
343 asm volatile(
344 "agsi %0,%1\n"
345 : "+Q" (v->counter)
346 : "i" (i)
347 : "cc", "memory");
348 } else {
349 atomic64_add_return(i, v);
350 }
351#else
352 atomic64_add_return(i, v);
353#endif
354}
355
356static inline int atomic64_add_unless(atomic64_t *v, long long i, long long u)
285{ 357{
286 long long c, old; 358 long long c, old;
287 359
@@ -289,7 +361,7 @@ static inline int atomic64_add_unless(atomic64_t *v, long long a, long long u)
289 for (;;) { 361 for (;;) {
290 if (unlikely(c == u)) 362 if (unlikely(c == u))
291 break; 363 break;
292 old = atomic64_cmpxchg(v, c, c + a); 364 old = atomic64_cmpxchg(v, c, c + i);
293 if (likely(old == c)) 365 if (likely(old == c))
294 break; 366 break;
295 c = old; 367 c = old;
@@ -314,14 +386,14 @@ static inline long long atomic64_dec_if_positive(atomic64_t *v)
314 return dec; 386 return dec;
315} 387}
316 388
317#define atomic64_add(_i, _v) atomic64_add_return(_i, _v)
318#define atomic64_add_negative(_i, _v) (atomic64_add_return(_i, _v) < 0) 389#define atomic64_add_negative(_i, _v) (atomic64_add_return(_i, _v) < 0)
319#define atomic64_inc(_v) atomic64_add_return(1, _v) 390#define atomic64_inc(_v) atomic64_add(1, _v)
320#define atomic64_inc_return(_v) atomic64_add_return(1, _v) 391#define atomic64_inc_return(_v) atomic64_add_return(1, _v)
321#define atomic64_inc_and_test(_v) (atomic64_add_return(1, _v) == 0) 392#define atomic64_inc_and_test(_v) (atomic64_add_return(1, _v) == 0)
322#define atomic64_sub(_i, _v) atomic64_sub_return(_i, _v) 393#define atomic64_sub_return(_i, _v) atomic64_add_return(-(long long)(_i), _v)
394#define atomic64_sub(_i, _v) atomic64_add(-(long long)(_i), _v)
323#define atomic64_sub_and_test(_i, _v) (atomic64_sub_return(_i, _v) == 0) 395#define atomic64_sub_and_test(_i, _v) (atomic64_sub_return(_i, _v) == 0)
324#define atomic64_dec(_v) atomic64_sub_return(1, _v) 396#define atomic64_dec(_v) atomic64_sub(1, _v)
325#define atomic64_dec_return(_v) atomic64_sub_return(1, _v) 397#define atomic64_dec_return(_v) atomic64_sub_return(1, _v)
326#define atomic64_dec_and_test(_v) (atomic64_sub_return(1, _v) == 0) 398#define atomic64_dec_and_test(_v) (atomic64_sub_return(1, _v) == 0)
327#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) 399#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index 10135a38673c..6e6ad0680829 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -1,10 +1,40 @@
1/* 1/*
2 * S390 version 2 * Copyright IBM Corp. 1999,2013
3 * Copyright IBM Corp. 1999
4 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
5 * 3 *
6 * Derived from "include/asm-i386/bitops.h" 4 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>,
7 * Copyright (C) 1992, Linus Torvalds 5 *
6 * The description below was taken in large parts from the powerpc
7 * bitops header file:
8 * Within a word, bits are numbered LSB first. Lot's of places make
9 * this assumption by directly testing bits with (val & (1<<nr)).
10 * This can cause confusion for large (> 1 word) bitmaps on a
11 * big-endian system because, unlike little endian, the number of each
12 * bit depends on the word size.
13 *
14 * The bitop functions are defined to work on unsigned longs, so for an
15 * s390x system the bits end up numbered:
16 * |63..............0|127............64|191...........128|255...........196|
17 * and on s390:
18 * |31.....0|63....31|95....64|127...96|159..128|191..160|223..192|255..224|
19 *
20 * There are a few little-endian macros used mostly for filesystem
21 * bitmaps, these work on similar bit arrays layouts, but
22 * byte-oriented:
23 * |7...0|15...8|23...16|31...24|39...32|47...40|55...48|63...56|
24 *
25 * The main difference is that bit 3-5 (64b) or 3-4 (32b) in the bit
26 * number field needs to be reversed compared to the big-endian bit
27 * fields. This can be achieved by XOR with 0x38 (64b) or 0x18 (32b).
28 *
29 * We also have special functions which work with an MSB0 encoding:
30 * on an s390x system the bits are numbered:
31 * |0..............63|64............127|128...........191|192...........255|
32 * and on s390:
33 * |0.....31|31....63|64....95|96...127|128..159|160..191|192..223|224..255|
34 *
35 * The main difference is that bit 0-63 (64b) or 0-31 (32b) in the bit
36 * number field needs to be reversed compared to the LSB0 encoded bit
37 * fields. This can be achieved by XOR with 0x3f (64b) or 0x1f (32b).
8 * 38 *
9 */ 39 */
10 40
@@ -15,556 +45,348 @@
15#error only <linux/bitops.h> can be included directly 45#error only <linux/bitops.h> can be included directly
16#endif 46#endif
17 47
48#include <linux/typecheck.h>
18#include <linux/compiler.h> 49#include <linux/compiler.h>
19 50
20/*
21 * 32 bit bitops format:
22 * bit 0 is the LSB of *addr; bit 31 is the MSB of *addr;
23 * bit 32 is the LSB of *(addr+4). That combined with the
24 * big endian byte order on S390 give the following bit
25 * order in memory:
26 * 1f 1e 1d 1c 1b 1a 19 18 17 16 15 14 13 12 11 10 \
27 * 0f 0e 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
28 * after that follows the next long with bit numbers
29 * 3f 3e 3d 3c 3b 3a 39 38 37 36 35 34 33 32 31 30
30 * 2f 2e 2d 2c 2b 2a 29 28 27 26 25 24 23 22 21 20
31 * The reason for this bit ordering is the fact that
32 * in the architecture independent code bits operations
33 * of the form "flags |= (1 << bitnr)" are used INTERMIXED
34 * with operation of the form "set_bit(bitnr, flags)".
35 *
36 * 64 bit bitops format:
37 * bit 0 is the LSB of *addr; bit 63 is the MSB of *addr;
38 * bit 64 is the LSB of *(addr+8). That combined with the
39 * big endian byte order on S390 give the following bit
40 * order in memory:
41 * 3f 3e 3d 3c 3b 3a 39 38 37 36 35 34 33 32 31 30
42 * 2f 2e 2d 2c 2b 2a 29 28 27 26 25 24 23 22 21 20
43 * 1f 1e 1d 1c 1b 1a 19 18 17 16 15 14 13 12 11 10
44 * 0f 0e 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
45 * after that follows the next long with bit numbers
46 * 7f 7e 7d 7c 7b 7a 79 78 77 76 75 74 73 72 71 70
47 * 6f 6e 6d 6c 6b 6a 69 68 67 66 65 64 63 62 61 60
48 * 5f 5e 5d 5c 5b 5a 59 58 57 56 55 54 53 52 51 50
49 * 4f 4e 4d 4c 4b 4a 49 48 47 46 45 44 43 42 41 40
50 * The reason for this bit ordering is the fact that
51 * in the architecture independent code bits operations
52 * of the form "flags |= (1 << bitnr)" are used INTERMIXED
53 * with operation of the form "set_bit(bitnr, flags)".
54 */
55
56/* bitmap tables from arch/s390/kernel/bitmap.c */
57extern const char _oi_bitmap[];
58extern const char _ni_bitmap[];
59extern const char _zb_findmap[];
60extern const char _sb_findmap[];
61
62#ifndef CONFIG_64BIT 51#ifndef CONFIG_64BIT
63 52
64#define __BITOPS_OR "or" 53#define __BITOPS_OR "or"
65#define __BITOPS_AND "nr" 54#define __BITOPS_AND "nr"
66#define __BITOPS_XOR "xr" 55#define __BITOPS_XOR "xr"
67 56
68#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \ 57#define __BITOPS_LOOP(__addr, __val, __op_string) \
58({ \
59 unsigned long __old, __new; \
60 \
61 typecheck(unsigned long *, (__addr)); \
69 asm volatile( \ 62 asm volatile( \
70 " l %0,%2\n" \ 63 " l %0,%2\n" \
71 "0: lr %1,%0\n" \ 64 "0: lr %1,%0\n" \
72 __op_string " %1,%3\n" \ 65 __op_string " %1,%3\n" \
73 " cs %0,%1,%2\n" \ 66 " cs %0,%1,%2\n" \
74 " jl 0b" \ 67 " jl 0b" \
75 : "=&d" (__old), "=&d" (__new), \ 68 : "=&d" (__old), "=&d" (__new), "+Q" (*(__addr))\
76 "=Q" (*(unsigned long *) __addr) \ 69 : "d" (__val) \
77 : "d" (__val), "Q" (*(unsigned long *) __addr) \ 70 : "cc"); \
78 : "cc"); 71 __old; \
72})
79 73
80#else /* CONFIG_64BIT */ 74#else /* CONFIG_64BIT */
81 75
76#ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
77
78#define __BITOPS_OR "laog"
79#define __BITOPS_AND "lang"
80#define __BITOPS_XOR "laxg"
81
82#define __BITOPS_LOOP(__addr, __val, __op_string) \
83({ \
84 unsigned long __old; \
85 \
86 typecheck(unsigned long *, (__addr)); \
87 asm volatile( \
88 __op_string " %0,%2,%1\n" \
89 : "=d" (__old), "+Q" (*(__addr)) \
90 : "d" (__val) \
91 : "cc"); \
92 __old; \
93})
94
95#else /* CONFIG_HAVE_MARCH_Z196_FEATURES */
96
82#define __BITOPS_OR "ogr" 97#define __BITOPS_OR "ogr"
83#define __BITOPS_AND "ngr" 98#define __BITOPS_AND "ngr"
84#define __BITOPS_XOR "xgr" 99#define __BITOPS_XOR "xgr"
85 100
86#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \ 101#define __BITOPS_LOOP(__addr, __val, __op_string) \
102({ \
103 unsigned long __old, __new; \
104 \
105 typecheck(unsigned long *, (__addr)); \
87 asm volatile( \ 106 asm volatile( \
88 " lg %0,%2\n" \ 107 " lg %0,%2\n" \
89 "0: lgr %1,%0\n" \ 108 "0: lgr %1,%0\n" \
90 __op_string " %1,%3\n" \ 109 __op_string " %1,%3\n" \
91 " csg %0,%1,%2\n" \ 110 " csg %0,%1,%2\n" \
92 " jl 0b" \ 111 " jl 0b" \
93 : "=&d" (__old), "=&d" (__new), \ 112 : "=&d" (__old), "=&d" (__new), "+Q" (*(__addr))\
94 "=Q" (*(unsigned long *) __addr) \ 113 : "d" (__val) \
95 : "d" (__val), "Q" (*(unsigned long *) __addr) \ 114 : "cc"); \
96 : "cc"); 115 __old; \
116})
117
118#endif /* CONFIG_HAVE_MARCH_Z196_FEATURES */
97 119
98#endif /* CONFIG_64BIT */ 120#endif /* CONFIG_64BIT */
99 121
100#define __BITOPS_WORDS(bits) (((bits) + BITS_PER_LONG - 1) / BITS_PER_LONG) 122#define __BITOPS_WORDS(bits) (((bits) + BITS_PER_LONG - 1) / BITS_PER_LONG)
101 123
102#ifdef CONFIG_SMP 124static inline unsigned long *
103/* 125__bitops_word(unsigned long nr, volatile unsigned long *ptr)
104 * SMP safe set_bit routine based on compare and swap (CS) 126{
105 */ 127 unsigned long addr;
106static inline void set_bit_cs(unsigned long nr, volatile unsigned long *ptr) 128
129 addr = (unsigned long)ptr + ((nr ^ (nr & (BITS_PER_LONG - 1))) >> 3);
130 return (unsigned long *)addr;
131}
132
133static inline unsigned char *
134__bitops_byte(unsigned long nr, volatile unsigned long *ptr)
107{ 135{
108 unsigned long addr, old, new, mask; 136 return ((unsigned char *)ptr) + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
137}
138
139static inline void set_bit(unsigned long nr, volatile unsigned long *ptr)
140{
141 unsigned long *addr = __bitops_word(nr, ptr);
142 unsigned long mask;
109 143
110 addr = (unsigned long) ptr; 144#ifdef CONFIG_HAVE_MARCH_ZEC12_FEATURES
111 /* calculate address for CS */ 145 if (__builtin_constant_p(nr)) {
112 addr += (nr ^ (nr & (BITS_PER_LONG - 1))) >> 3; 146 unsigned char *caddr = __bitops_byte(nr, ptr);
113 /* make OR mask */ 147
148 asm volatile(
149 "oi %0,%b1\n"
150 : "+Q" (*caddr)
151 : "i" (1 << (nr & 7))
152 : "cc");
153 return;
154 }
155#endif
114 mask = 1UL << (nr & (BITS_PER_LONG - 1)); 156 mask = 1UL << (nr & (BITS_PER_LONG - 1));
115 /* Do the atomic update. */ 157 __BITOPS_LOOP(addr, mask, __BITOPS_OR);
116 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_OR);
117} 158}
118 159
119/* 160static inline void clear_bit(unsigned long nr, volatile unsigned long *ptr)
120 * SMP safe clear_bit routine based on compare and swap (CS)
121 */
122static inline void clear_bit_cs(unsigned long nr, volatile unsigned long *ptr)
123{ 161{
124 unsigned long addr, old, new, mask; 162 unsigned long *addr = __bitops_word(nr, ptr);
163 unsigned long mask;
164
165#ifdef CONFIG_HAVE_MARCH_ZEC12_FEATURES
166 if (__builtin_constant_p(nr)) {
167 unsigned char *caddr = __bitops_byte(nr, ptr);
125 168
126 addr = (unsigned long) ptr; 169 asm volatile(
127 /* calculate address for CS */ 170 "ni %0,%b1\n"
128 addr += (nr ^ (nr & (BITS_PER_LONG - 1))) >> 3; 171 : "+Q" (*caddr)
129 /* make AND mask */ 172 : "i" (~(1 << (nr & 7)))
173 : "cc");
174 return;
175 }
176#endif
130 mask = ~(1UL << (nr & (BITS_PER_LONG - 1))); 177 mask = ~(1UL << (nr & (BITS_PER_LONG - 1)));
131 /* Do the atomic update. */ 178 __BITOPS_LOOP(addr, mask, __BITOPS_AND);
132 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_AND);
133} 179}
134 180
135/* 181static inline void change_bit(unsigned long nr, volatile unsigned long *ptr)
136 * SMP safe change_bit routine based on compare and swap (CS)
137 */
138static inline void change_bit_cs(unsigned long nr, volatile unsigned long *ptr)
139{ 182{
140 unsigned long addr, old, new, mask; 183 unsigned long *addr = __bitops_word(nr, ptr);
184 unsigned long mask;
185
186#ifdef CONFIG_HAVE_MARCH_ZEC12_FEATURES
187 if (__builtin_constant_p(nr)) {
188 unsigned char *caddr = __bitops_byte(nr, ptr);
141 189
142 addr = (unsigned long) ptr; 190 asm volatile(
143 /* calculate address for CS */ 191 "xi %0,%b1\n"
144 addr += (nr ^ (nr & (BITS_PER_LONG - 1))) >> 3; 192 : "+Q" (*caddr)
145 /* make XOR mask */ 193 : "i" (1 << (nr & 7))
194 : "cc");
195 return;
196 }
197#endif
146 mask = 1UL << (nr & (BITS_PER_LONG - 1)); 198 mask = 1UL << (nr & (BITS_PER_LONG - 1));
147 /* Do the atomic update. */ 199 __BITOPS_LOOP(addr, mask, __BITOPS_XOR);
148 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_XOR);
149} 200}
150 201
151/*
152 * SMP safe test_and_set_bit routine based on compare and swap (CS)
153 */
154static inline int 202static inline int
155test_and_set_bit_cs(unsigned long nr, volatile unsigned long *ptr) 203test_and_set_bit(unsigned long nr, volatile unsigned long *ptr)
156{ 204{
157 unsigned long addr, old, new, mask; 205 unsigned long *addr = __bitops_word(nr, ptr);
206 unsigned long old, mask;
158 207
159 addr = (unsigned long) ptr;
160 /* calculate address for CS */
161 addr += (nr ^ (nr & (BITS_PER_LONG - 1))) >> 3;
162 /* make OR/test mask */
163 mask = 1UL << (nr & (BITS_PER_LONG - 1)); 208 mask = 1UL << (nr & (BITS_PER_LONG - 1));
164 /* Do the atomic update. */ 209 old = __BITOPS_LOOP(addr, mask, __BITOPS_OR);
165 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_OR);
166 barrier(); 210 barrier();
167 return (old & mask) != 0; 211 return (old & mask) != 0;
168} 212}
169 213
170/*
171 * SMP safe test_and_clear_bit routine based on compare and swap (CS)
172 */
173static inline int 214static inline int
174test_and_clear_bit_cs(unsigned long nr, volatile unsigned long *ptr) 215test_and_clear_bit(unsigned long nr, volatile unsigned long *ptr)
175{ 216{
176 unsigned long addr, old, new, mask; 217 unsigned long *addr = __bitops_word(nr, ptr);
218 unsigned long old, mask;
177 219
178 addr = (unsigned long) ptr;
179 /* calculate address for CS */
180 addr += (nr ^ (nr & (BITS_PER_LONG - 1))) >> 3;
181 /* make AND/test mask */
182 mask = ~(1UL << (nr & (BITS_PER_LONG - 1))); 220 mask = ~(1UL << (nr & (BITS_PER_LONG - 1)));
183 /* Do the atomic update. */ 221 old = __BITOPS_LOOP(addr, mask, __BITOPS_AND);
184 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_AND);
185 barrier(); 222 barrier();
186 return (old ^ new) != 0; 223 return (old & ~mask) != 0;
187} 224}
188 225
189/*
190 * SMP safe test_and_change_bit routine based on compare and swap (CS)
191 */
192static inline int 226static inline int
193test_and_change_bit_cs(unsigned long nr, volatile unsigned long *ptr) 227test_and_change_bit(unsigned long nr, volatile unsigned long *ptr)
194{ 228{
195 unsigned long addr, old, new, mask; 229 unsigned long *addr = __bitops_word(nr, ptr);
230 unsigned long old, mask;
196 231
197 addr = (unsigned long) ptr;
198 /* calculate address for CS */
199 addr += (nr ^ (nr & (BITS_PER_LONG - 1))) >> 3;
200 /* make XOR/test mask */
201 mask = 1UL << (nr & (BITS_PER_LONG - 1)); 232 mask = 1UL << (nr & (BITS_PER_LONG - 1));
202 /* Do the atomic update. */ 233 old = __BITOPS_LOOP(addr, mask, __BITOPS_XOR);
203 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_XOR);
204 barrier(); 234 barrier();
205 return (old & mask) != 0; 235 return (old & mask) != 0;
206} 236}
207#endif /* CONFIG_SMP */
208 237
209/*
210 * fast, non-SMP set_bit routine
211 */
212static inline void __set_bit(unsigned long nr, volatile unsigned long *ptr) 238static inline void __set_bit(unsigned long nr, volatile unsigned long *ptr)
213{ 239{
214 unsigned long addr; 240 unsigned char *addr = __bitops_byte(nr, ptr);
215
216 addr = (unsigned long) ptr + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
217 asm volatile(
218 " oc %O0(1,%R0),%1"
219 : "+Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7]) : "cc");
220}
221
222static inline void
223__constant_set_bit(const unsigned long nr, volatile unsigned long *ptr)
224{
225 unsigned long addr;
226 241
227 addr = ((unsigned long) ptr) + ((nr ^ (BITS_PER_LONG - 8)) >> 3); 242 *addr |= 1 << (nr & 7);
228 *(unsigned char *) addr |= 1 << (nr & 7);
229} 243}
230 244
231#define set_bit_simple(nr,addr) \
232(__builtin_constant_p((nr)) ? \
233 __constant_set_bit((nr),(addr)) : \
234 __set_bit((nr),(addr)) )
235
236/*
237 * fast, non-SMP clear_bit routine
238 */
239static inline void 245static inline void
240__clear_bit(unsigned long nr, volatile unsigned long *ptr) 246__clear_bit(unsigned long nr, volatile unsigned long *ptr)
241{ 247{
242 unsigned long addr; 248 unsigned char *addr = __bitops_byte(nr, ptr);
243
244 addr = (unsigned long) ptr + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
245 asm volatile(
246 " nc %O0(1,%R0),%1"
247 : "+Q" (*(char *) addr) : "Q" (_ni_bitmap[nr & 7]) : "cc");
248}
249
250static inline void
251__constant_clear_bit(const unsigned long nr, volatile unsigned long *ptr)
252{
253 unsigned long addr;
254 249
255 addr = ((unsigned long) ptr) + ((nr ^ (BITS_PER_LONG - 8)) >> 3); 250 *addr &= ~(1 << (nr & 7));
256 *(unsigned char *) addr &= ~(1 << (nr & 7));
257} 251}
258 252
259#define clear_bit_simple(nr,addr) \
260(__builtin_constant_p((nr)) ? \
261 __constant_clear_bit((nr),(addr)) : \
262 __clear_bit((nr),(addr)) )
263
264/*
265 * fast, non-SMP change_bit routine
266 */
267static inline void __change_bit(unsigned long nr, volatile unsigned long *ptr) 253static inline void __change_bit(unsigned long nr, volatile unsigned long *ptr)
268{ 254{
269 unsigned long addr; 255 unsigned char *addr = __bitops_byte(nr, ptr);
270
271 addr = (unsigned long) ptr + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
272 asm volatile(
273 " xc %O0(1,%R0),%1"
274 : "+Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7]) : "cc");
275}
276
277static inline void
278__constant_change_bit(const unsigned long nr, volatile unsigned long *ptr)
279{
280 unsigned long addr;
281 256
282 addr = ((unsigned long) ptr) + ((nr ^ (BITS_PER_LONG - 8)) >> 3); 257 *addr ^= 1 << (nr & 7);
283 *(unsigned char *) addr ^= 1 << (nr & 7);
284} 258}
285 259
286#define change_bit_simple(nr,addr) \
287(__builtin_constant_p((nr)) ? \
288 __constant_change_bit((nr),(addr)) : \
289 __change_bit((nr),(addr)) )
290
291/*
292 * fast, non-SMP test_and_set_bit routine
293 */
294static inline int 260static inline int
295test_and_set_bit_simple(unsigned long nr, volatile unsigned long *ptr) 261__test_and_set_bit(unsigned long nr, volatile unsigned long *ptr)
296{ 262{
297 unsigned long addr; 263 unsigned char *addr = __bitops_byte(nr, ptr);
298 unsigned char ch; 264 unsigned char ch;
299 265
300 addr = (unsigned long) ptr + ((nr ^ (BITS_PER_LONG - 8)) >> 3); 266 ch = *addr;
301 ch = *(unsigned char *) addr; 267 *addr |= 1 << (nr & 7);
302 asm volatile(
303 " oc %O0(1,%R0),%1"
304 : "+Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7])
305 : "cc", "memory");
306 return (ch >> (nr & 7)) & 1; 268 return (ch >> (nr & 7)) & 1;
307} 269}
308#define __test_and_set_bit(X,Y) test_and_set_bit_simple(X,Y)
309 270
310/*
311 * fast, non-SMP test_and_clear_bit routine
312 */
313static inline int 271static inline int
314test_and_clear_bit_simple(unsigned long nr, volatile unsigned long *ptr) 272__test_and_clear_bit(unsigned long nr, volatile unsigned long *ptr)
315{ 273{
316 unsigned long addr; 274 unsigned char *addr = __bitops_byte(nr, ptr);
317 unsigned char ch; 275 unsigned char ch;
318 276
319 addr = (unsigned long) ptr + ((nr ^ (BITS_PER_LONG - 8)) >> 3); 277 ch = *addr;
320 ch = *(unsigned char *) addr; 278 *addr &= ~(1 << (nr & 7));
321 asm volatile(
322 " nc %O0(1,%R0),%1"
323 : "+Q" (*(char *) addr) : "Q" (_ni_bitmap[nr & 7])
324 : "cc", "memory");
325 return (ch >> (nr & 7)) & 1; 279 return (ch >> (nr & 7)) & 1;
326} 280}
327#define __test_and_clear_bit(X,Y) test_and_clear_bit_simple(X,Y)
328 281
329/*
330 * fast, non-SMP test_and_change_bit routine
331 */
332static inline int 282static inline int
333test_and_change_bit_simple(unsigned long nr, volatile unsigned long *ptr) 283__test_and_change_bit(unsigned long nr, volatile unsigned long *ptr)
334{ 284{
335 unsigned long addr; 285 unsigned char *addr = __bitops_byte(nr, ptr);
336 unsigned char ch; 286 unsigned char ch;
337 287
338 addr = (unsigned long) ptr + ((nr ^ (BITS_PER_LONG - 8)) >> 3); 288 ch = *addr;
339 ch = *(unsigned char *) addr; 289 *addr ^= 1 << (nr & 7);
340 asm volatile(
341 " xc %O0(1,%R0),%1"
342 : "+Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7])
343 : "cc", "memory");
344 return (ch >> (nr & 7)) & 1; 290 return (ch >> (nr & 7)) & 1;
345} 291}
346#define __test_and_change_bit(X,Y) test_and_change_bit_simple(X,Y)
347
348#ifdef CONFIG_SMP
349#define set_bit set_bit_cs
350#define clear_bit clear_bit_cs
351#define change_bit change_bit_cs
352#define test_and_set_bit test_and_set_bit_cs
353#define test_and_clear_bit test_and_clear_bit_cs
354#define test_and_change_bit test_and_change_bit_cs
355#else
356#define set_bit set_bit_simple
357#define clear_bit clear_bit_simple
358#define change_bit change_bit_simple
359#define test_and_set_bit test_and_set_bit_simple
360#define test_and_clear_bit test_and_clear_bit_simple
361#define test_and_change_bit test_and_change_bit_simple
362#endif
363
364
365/*
366 * This routine doesn't need to be atomic.
367 */
368 292
369static inline int __test_bit(unsigned long nr, const volatile unsigned long *ptr) 293static inline int test_bit(unsigned long nr, const volatile unsigned long *ptr)
370{ 294{
371 unsigned long addr; 295 const volatile unsigned char *addr;
372 unsigned char ch;
373
374 addr = (unsigned long) ptr + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
375 ch = *(volatile unsigned char *) addr;
376 return (ch >> (nr & 7)) & 1;
377}
378 296
379static inline int 297 addr = ((const volatile unsigned char *)ptr);
380__constant_test_bit(unsigned long nr, const volatile unsigned long *addr) { 298 addr += (nr ^ (BITS_PER_LONG - 8)) >> 3;
381 return (((volatile char *) addr) 299 return (*addr >> (nr & 7)) & 1;
382 [(nr^(BITS_PER_LONG-8))>>3] & (1<<(nr&7))) != 0;
383} 300}
384 301
385#define test_bit(nr,addr) \
386(__builtin_constant_p((nr)) ? \
387 __constant_test_bit((nr),(addr)) : \
388 __test_bit((nr),(addr)) )
389
390/* 302/*
391 * Optimized find bit helper functions. 303 * Functions which use MSB0 bit numbering.
392 */ 304 * On an s390x system the bits are numbered:
393 305 * |0..............63|64............127|128...........191|192...........255|
394/** 306 * and on s390:
395 * __ffz_word_loop - find byte offset of first long != -1UL 307 * |0.....31|31....63|64....95|96...127|128..159|160..191|192..223|224..255|
396 * @addr: pointer to array of unsigned long
397 * @size: size of the array in bits
398 */ 308 */
399static inline unsigned long __ffz_word_loop(const unsigned long *addr, 309unsigned long find_first_bit_inv(const unsigned long *addr, unsigned long size);
400 unsigned long size) 310unsigned long find_next_bit_inv(const unsigned long *addr, unsigned long size,
401{ 311 unsigned long offset);
402 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
403 unsigned long bytes = 0;
404
405 asm volatile(
406#ifndef CONFIG_64BIT
407 " ahi %1,-1\n"
408 " sra %1,5\n"
409 " jz 1f\n"
410 "0: c %2,0(%0,%3)\n"
411 " jne 1f\n"
412 " la %0,4(%0)\n"
413 " brct %1,0b\n"
414 "1:\n"
415#else
416 " aghi %1,-1\n"
417 " srag %1,%1,6\n"
418 " jz 1f\n"
419 "0: cg %2,0(%0,%3)\n"
420 " jne 1f\n"
421 " la %0,8(%0)\n"
422 " brct %1,0b\n"
423 "1:\n"
424#endif
425 : "+&a" (bytes), "+&d" (size)
426 : "d" (-1UL), "a" (addr), "m" (*(addrtype *) addr)
427 : "cc" );
428 return bytes;
429}
430 312
431/** 313static inline void set_bit_inv(unsigned long nr, volatile unsigned long *ptr)
432 * __ffs_word_loop - find byte offset of first long != 0UL
433 * @addr: pointer to array of unsigned long
434 * @size: size of the array in bits
435 */
436static inline unsigned long __ffs_word_loop(const unsigned long *addr,
437 unsigned long size)
438{ 314{
439 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype; 315 return set_bit(nr ^ (BITS_PER_LONG - 1), ptr);
440 unsigned long bytes = 0;
441
442 asm volatile(
443#ifndef CONFIG_64BIT
444 " ahi %1,-1\n"
445 " sra %1,5\n"
446 " jz 1f\n"
447 "0: c %2,0(%0,%3)\n"
448 " jne 1f\n"
449 " la %0,4(%0)\n"
450 " brct %1,0b\n"
451 "1:\n"
452#else
453 " aghi %1,-1\n"
454 " srag %1,%1,6\n"
455 " jz 1f\n"
456 "0: cg %2,0(%0,%3)\n"
457 " jne 1f\n"
458 " la %0,8(%0)\n"
459 " brct %1,0b\n"
460 "1:\n"
461#endif
462 : "+&a" (bytes), "+&a" (size)
463 : "d" (0UL), "a" (addr), "m" (*(addrtype *) addr)
464 : "cc" );
465 return bytes;
466} 316}
467 317
468/** 318static inline void clear_bit_inv(unsigned long nr, volatile unsigned long *ptr)
469 * __ffz_word - add number of the first unset bit
470 * @nr: base value the bit number is added to
471 * @word: the word that is searched for unset bits
472 */
473static inline unsigned long __ffz_word(unsigned long nr, unsigned long word)
474{ 319{
475#ifdef CONFIG_64BIT 320 return clear_bit(nr ^ (BITS_PER_LONG - 1), ptr);
476 if ((word & 0xffffffff) == 0xffffffff) {
477 word >>= 32;
478 nr += 32;
479 }
480#endif
481 if ((word & 0xffff) == 0xffff) {
482 word >>= 16;
483 nr += 16;
484 }
485 if ((word & 0xff) == 0xff) {
486 word >>= 8;
487 nr += 8;
488 }
489 return nr + _zb_findmap[(unsigned char) word];
490} 321}
491 322
492/** 323static inline void __set_bit_inv(unsigned long nr, volatile unsigned long *ptr)
493 * __ffs_word - add number of the first set bit
494 * @nr: base value the bit number is added to
495 * @word: the word that is searched for set bits
496 */
497static inline unsigned long __ffs_word(unsigned long nr, unsigned long word)
498{ 324{
499#ifdef CONFIG_64BIT 325 return __set_bit(nr ^ (BITS_PER_LONG - 1), ptr);
500 if ((word & 0xffffffff) == 0) {
501 word >>= 32;
502 nr += 32;
503 }
504#endif
505 if ((word & 0xffff) == 0) {
506 word >>= 16;
507 nr += 16;
508 }
509 if ((word & 0xff) == 0) {
510 word >>= 8;
511 nr += 8;
512 }
513 return nr + _sb_findmap[(unsigned char) word];
514} 326}
515 327
516 328static inline void __clear_bit_inv(unsigned long nr, volatile unsigned long *ptr)
517/**
518 * __load_ulong_be - load big endian unsigned long
519 * @p: pointer to array of unsigned long
520 * @offset: byte offset of source value in the array
521 */
522static inline unsigned long __load_ulong_be(const unsigned long *p,
523 unsigned long offset)
524{ 329{
525 p = (unsigned long *)((unsigned long) p + offset); 330 return __clear_bit(nr ^ (BITS_PER_LONG - 1), ptr);
526 return *p;
527} 331}
528 332
529/** 333static inline int test_bit_inv(unsigned long nr,
530 * __load_ulong_le - load little endian unsigned long 334 const volatile unsigned long *ptr)
531 * @p: pointer to array of unsigned long
532 * @offset: byte offset of source value in the array
533 */
534static inline unsigned long __load_ulong_le(const unsigned long *p,
535 unsigned long offset)
536{ 335{
537 unsigned long word; 336 return test_bit(nr ^ (BITS_PER_LONG - 1), ptr);
538
539 p = (unsigned long *)((unsigned long) p + offset);
540#ifndef CONFIG_64BIT
541 asm volatile(
542 " ic %0,%O1(%R1)\n"
543 " icm %0,2,%O1+1(%R1)\n"
544 " icm %0,4,%O1+2(%R1)\n"
545 " icm %0,8,%O1+3(%R1)"
546 : "=&d" (word) : "Q" (*p) : "cc");
547#else
548 asm volatile(
549 " lrvg %0,%1"
550 : "=d" (word) : "m" (*p) );
551#endif
552 return word;
553} 337}
554 338
555/* 339#ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES
556 * The various find bit functions.
557 */
558 340
559/* 341/**
560 * ffz - find first zero in word. 342 * __flogr - find leftmost one
561 * @word: The word to search 343 * @word - The word to search
562 * 344 *
563 * Undefined if no zero exists, so code should check against ~0UL first. 345 * Returns the bit number of the most significant bit set,
564 */ 346 * where the most significant bit has bit number 0.
565static inline unsigned long ffz(unsigned long word) 347 * If no bit is set this function returns 64.
566{ 348 */
567 return __ffz_word(0, word); 349static inline unsigned char __flogr(unsigned long word)
350{
351 if (__builtin_constant_p(word)) {
352 unsigned long bit = 0;
353
354 if (!word)
355 return 64;
356 if (!(word & 0xffffffff00000000UL)) {
357 word <<= 32;
358 bit += 32;
359 }
360 if (!(word & 0xffff000000000000UL)) {
361 word <<= 16;
362 bit += 16;
363 }
364 if (!(word & 0xff00000000000000UL)) {
365 word <<= 8;
366 bit += 8;
367 }
368 if (!(word & 0xf000000000000000UL)) {
369 word <<= 4;
370 bit += 4;
371 }
372 if (!(word & 0xc000000000000000UL)) {
373 word <<= 2;
374 bit += 2;
375 }
376 if (!(word & 0x8000000000000000UL)) {
377 word <<= 1;
378 bit += 1;
379 }
380 return bit;
381 } else {
382 register unsigned long bit asm("4") = word;
383 register unsigned long out asm("5");
384
385 asm volatile(
386 " flogr %[bit],%[bit]\n"
387 : [bit] "+d" (bit), [out] "=d" (out) : : "cc");
388 return bit;
389 }
568} 390}
569 391
570/** 392/**
@@ -573,337 +395,83 @@ static inline unsigned long ffz(unsigned long word)
573 * 395 *
574 * Undefined if no bit exists, so code should check against 0 first. 396 * Undefined if no bit exists, so code should check against 0 first.
575 */ 397 */
576static inline unsigned long __ffs (unsigned long word) 398static inline unsigned long __ffs(unsigned long word)
577{ 399{
578 return __ffs_word(0, word); 400 return __flogr(-word & word) ^ (BITS_PER_LONG - 1);
579} 401}
580 402
581/** 403/**
582 * ffs - find first bit set 404 * ffs - find first bit set
583 * @x: the word to search 405 * @word: the word to search
584 * 406 *
585 * This is defined the same way as 407 * This is defined the same way as the libc and
586 * the libc and compiler builtin ffs routines, therefore 408 * compiler builtin ffs routines (man ffs).
587 * differs in spirit from the above ffz (man ffs).
588 */ 409 */
589static inline int ffs(int x) 410static inline int ffs(int word)
590{ 411{
591 if (!x) 412 unsigned long mask = 2 * BITS_PER_LONG - 1;
592 return 0; 413 unsigned int val = (unsigned int)word;
593 return __ffs_word(1, x); 414
415 return (1 + (__flogr(-val & val) ^ (BITS_PER_LONG - 1))) & mask;
594} 416}
595 417
596/** 418/**
597 * find_first_zero_bit - find the first zero bit in a memory region 419 * __fls - find last (most-significant) set bit in a long word
598 * @addr: The address to start the search at 420 * @word: the word to search
599 * @size: The maximum size to search
600 * 421 *
601 * Returns the bit-number of the first zero bit, not the number of the byte 422 * Undefined if no set bit exists, so code should check against 0 first.
602 * containing a bit.
603 */ 423 */
604static inline unsigned long find_first_zero_bit(const unsigned long *addr, 424static inline unsigned long __fls(unsigned long word)
605 unsigned long size)
606{ 425{
607 unsigned long bytes, bits; 426 return __flogr(word) ^ (BITS_PER_LONG - 1);
608
609 if (!size)
610 return 0;
611 bytes = __ffz_word_loop(addr, size);
612 bits = __ffz_word(bytes*8, __load_ulong_be(addr, bytes));
613 return (bits < size) ? bits : size;
614} 427}
615#define find_first_zero_bit find_first_zero_bit
616 428
617/** 429/**
618 * find_first_bit - find the first set bit in a memory region 430 * fls64 - find last set bit in a 64-bit word
619 * @addr: The address to start the search at 431 * @word: the word to search
620 * @size: The maximum size to search
621 * 432 *
622 * Returns the bit-number of the first set bit, not the number of the byte 433 * This is defined in a similar way as the libc and compiler builtin
623 * containing a bit. 434 * ffsll, but returns the position of the most significant set bit.
624 */ 435 *
625static inline unsigned long find_first_bit(const unsigned long * addr, 436 * fls64(value) returns 0 if value is 0 or the position of the last
626 unsigned long size) 437 * set bit if value is nonzero. The last (most significant) bit is
627{ 438 * at position 64.
628 unsigned long bytes, bits;
629
630 if (!size)
631 return 0;
632 bytes = __ffs_word_loop(addr, size);
633 bits = __ffs_word(bytes*8, __load_ulong_be(addr, bytes));
634 return (bits < size) ? bits : size;
635}
636#define find_first_bit find_first_bit
637
638/*
639 * Big endian variant whichs starts bit counting from left using
640 * the flogr (find leftmost one) instruction.
641 */
642static inline unsigned long __flo_word(unsigned long nr, unsigned long val)
643{
644 register unsigned long bit asm("2") = val;
645 register unsigned long out asm("3");
646
647 asm volatile (
648 " .insn rre,0xb9830000,%[bit],%[bit]\n"
649 : [bit] "+d" (bit), [out] "=d" (out) : : "cc");
650 return nr + bit;
651}
652
653/*
654 * 64 bit special left bitops format:
655 * order in memory:
656 * 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
657 * 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
658 * 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
659 * 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
660 * after that follows the next long with bit numbers
661 * 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
662 * 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
663 * 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
664 * 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f
665 * The reason for this bit ordering is the fact that
666 * the hardware sets bits in a bitmap starting at bit 0
667 * and we don't want to scan the bitmap from the 'wrong
668 * end'.
669 */ 439 */
670static inline unsigned long find_first_bit_left(const unsigned long *addr, 440static inline int fls64(unsigned long word)
671 unsigned long size)
672{
673 unsigned long bytes, bits;
674
675 if (!size)
676 return 0;
677 bytes = __ffs_word_loop(addr, size);
678 bits = __flo_word(bytes * 8, __load_ulong_be(addr, bytes));
679 return (bits < size) ? bits : size;
680}
681
682static inline int find_next_bit_left(const unsigned long *addr,
683 unsigned long size,
684 unsigned long offset)
685{ 441{
686 const unsigned long *p; 442 unsigned long mask = 2 * BITS_PER_LONG - 1;
687 unsigned long bit, set;
688
689 if (offset >= size)
690 return size;
691 bit = offset & (BITS_PER_LONG - 1);
692 offset -= bit;
693 size -= offset;
694 p = addr + offset / BITS_PER_LONG;
695 if (bit) {
696 set = __flo_word(0, *p & (~0UL >> bit));
697 if (set >= size)
698 return size + offset;
699 if (set < BITS_PER_LONG)
700 return set + offset;
701 offset += BITS_PER_LONG;
702 size -= BITS_PER_LONG;
703 p++;
704 }
705 return offset + find_first_bit_left(p, size);
706}
707
708#define for_each_set_bit_left(bit, addr, size) \
709 for ((bit) = find_first_bit_left((addr), (size)); \
710 (bit) < (size); \
711 (bit) = find_next_bit_left((addr), (size), (bit) + 1))
712
713/* same as for_each_set_bit() but use bit as value to start with */
714#define for_each_set_bit_left_cont(bit, addr, size) \
715 for ((bit) = find_next_bit_left((addr), (size), (bit)); \
716 (bit) < (size); \
717 (bit) = find_next_bit_left((addr), (size), (bit) + 1))
718 443
719/** 444 return (1 + (__flogr(word) ^ (BITS_PER_LONG - 1))) & mask;
720 * find_next_zero_bit - find the first zero bit in a memory region
721 * @addr: The address to base the search on
722 * @offset: The bitnumber to start searching at
723 * @size: The maximum size to search
724 */
725static inline int find_next_zero_bit (const unsigned long * addr,
726 unsigned long size,
727 unsigned long offset)
728{
729 const unsigned long *p;
730 unsigned long bit, set;
731
732 if (offset >= size)
733 return size;
734 bit = offset & (BITS_PER_LONG - 1);
735 offset -= bit;
736 size -= offset;
737 p = addr + offset / BITS_PER_LONG;
738 if (bit) {
739 /*
740 * __ffz_word returns BITS_PER_LONG
741 * if no zero bit is present in the word.
742 */
743 set = __ffz_word(bit, *p >> bit);
744 if (set >= size)
745 return size + offset;
746 if (set < BITS_PER_LONG)
747 return set + offset;
748 offset += BITS_PER_LONG;
749 size -= BITS_PER_LONG;
750 p++;
751 }
752 return offset + find_first_zero_bit(p, size);
753} 445}
754#define find_next_zero_bit find_next_zero_bit
755 446
756/** 447/**
757 * find_next_bit - find the first set bit in a memory region 448 * fls - find last (most-significant) bit set
758 * @addr: The address to base the search on 449 * @word: the word to search
759 * @offset: The bitnumber to start searching at 450 *
760 * @size: The maximum size to search 451 * This is defined the same way as ffs.
452 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
761 */ 453 */
762static inline int find_next_bit (const unsigned long * addr, 454static inline int fls(int word)
763 unsigned long size,
764 unsigned long offset)
765{ 455{
766 const unsigned long *p; 456 return fls64((unsigned int)word);
767 unsigned long bit, set;
768
769 if (offset >= size)
770 return size;
771 bit = offset & (BITS_PER_LONG - 1);
772 offset -= bit;
773 size -= offset;
774 p = addr + offset / BITS_PER_LONG;
775 if (bit) {
776 /*
777 * __ffs_word returns BITS_PER_LONG
778 * if no one bit is present in the word.
779 */
780 set = __ffs_word(0, *p & (~0UL << bit));
781 if (set >= size)
782 return size + offset;
783 if (set < BITS_PER_LONG)
784 return set + offset;
785 offset += BITS_PER_LONG;
786 size -= BITS_PER_LONG;
787 p++;
788 }
789 return offset + find_first_bit(p, size);
790} 457}
791#define find_next_bit find_next_bit
792 458
793/* 459#else /* CONFIG_HAVE_MARCH_Z9_109_FEATURES */
794 * Every architecture must define this function. It's the fastest
795 * way of searching a 140-bit bitmap where the first 100 bits are
796 * unlikely to be set. It's guaranteed that at least one of the 140
797 * bits is cleared.
798 */
799static inline int sched_find_first_bit(unsigned long *b)
800{
801 return find_first_bit(b, 140);
802}
803 460
804#include <asm-generic/bitops/fls.h> 461#include <asm-generic/bitops/__ffs.h>
462#include <asm-generic/bitops/ffs.h>
805#include <asm-generic/bitops/__fls.h> 463#include <asm-generic/bitops/__fls.h>
464#include <asm-generic/bitops/fls.h>
806#include <asm-generic/bitops/fls64.h> 465#include <asm-generic/bitops/fls64.h>
807 466
467#endif /* CONFIG_HAVE_MARCH_Z9_109_FEATURES */
468
469#include <asm-generic/bitops/ffz.h>
470#include <asm-generic/bitops/find.h>
808#include <asm-generic/bitops/hweight.h> 471#include <asm-generic/bitops/hweight.h>
809#include <asm-generic/bitops/lock.h> 472#include <asm-generic/bitops/lock.h>
810 473#include <asm-generic/bitops/sched.h>
811/*
812 * ATTENTION: intel byte ordering convention for ext2 and minix !!
813 * bit 0 is the LSB of addr; bit 31 is the MSB of addr;
814 * bit 32 is the LSB of (addr+4).
815 * That combined with the little endian byte order of Intel gives the
816 * following bit order in memory:
817 * 07 06 05 04 03 02 01 00 15 14 13 12 11 10 09 08 \
818 * 23 22 21 20 19 18 17 16 31 30 29 28 27 26 25 24
819 */
820
821static inline int find_first_zero_bit_le(void *vaddr, unsigned int size)
822{
823 unsigned long bytes, bits;
824
825 if (!size)
826 return 0;
827 bytes = __ffz_word_loop(vaddr, size);
828 bits = __ffz_word(bytes*8, __load_ulong_le(vaddr, bytes));
829 return (bits < size) ? bits : size;
830}
831#define find_first_zero_bit_le find_first_zero_bit_le
832
833static inline int find_next_zero_bit_le(void *vaddr, unsigned long size,
834 unsigned long offset)
835{
836 unsigned long *addr = vaddr, *p;
837 unsigned long bit, set;
838
839 if (offset >= size)
840 return size;
841 bit = offset & (BITS_PER_LONG - 1);
842 offset -= bit;
843 size -= offset;
844 p = addr + offset / BITS_PER_LONG;
845 if (bit) {
846 /*
847 * s390 version of ffz returns BITS_PER_LONG
848 * if no zero bit is present in the word.
849 */
850 set = __ffz_word(bit, __load_ulong_le(p, 0) >> bit);
851 if (set >= size)
852 return size + offset;
853 if (set < BITS_PER_LONG)
854 return set + offset;
855 offset += BITS_PER_LONG;
856 size -= BITS_PER_LONG;
857 p++;
858 }
859 return offset + find_first_zero_bit_le(p, size);
860}
861#define find_next_zero_bit_le find_next_zero_bit_le
862
863static inline unsigned long find_first_bit_le(void *vaddr, unsigned long size)
864{
865 unsigned long bytes, bits;
866
867 if (!size)
868 return 0;
869 bytes = __ffs_word_loop(vaddr, size);
870 bits = __ffs_word(bytes*8, __load_ulong_le(vaddr, bytes));
871 return (bits < size) ? bits : size;
872}
873#define find_first_bit_le find_first_bit_le
874
875static inline int find_next_bit_le(void *vaddr, unsigned long size,
876 unsigned long offset)
877{
878 unsigned long *addr = vaddr, *p;
879 unsigned long bit, set;
880
881 if (offset >= size)
882 return size;
883 bit = offset & (BITS_PER_LONG - 1);
884 offset -= bit;
885 size -= offset;
886 p = addr + offset / BITS_PER_LONG;
887 if (bit) {
888 /*
889 * s390 version of ffz returns BITS_PER_LONG
890 * if no zero bit is present in the word.
891 */
892 set = __ffs_word(0, __load_ulong_le(p, 0) & (~0UL << bit));
893 if (set >= size)
894 return size + offset;
895 if (set < BITS_PER_LONG)
896 return set + offset;
897 offset += BITS_PER_LONG;
898 size -= BITS_PER_LONG;
899 p++;
900 }
901 return offset + find_first_bit_le(p, size);
902}
903#define find_next_bit_le find_next_bit_le
904
905#include <asm-generic/bitops/le.h> 474#include <asm-generic/bitops/le.h>
906
907#include <asm-generic/bitops/ext2-atomic-setbit.h> 475#include <asm-generic/bitops/ext2-atomic-setbit.h>
908 476
909#endif /* _S390_BITOPS_H */ 477#endif /* _S390_BITOPS_H */
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
index c1e7c646727c..4bf9da03591e 100644
--- a/arch/s390/include/asm/compat.h
+++ b/arch/s390/include/asm/compat.h
@@ -22,6 +22,7 @@
22#define PSW32_MASK_ASC 0x0000C000UL 22#define PSW32_MASK_ASC 0x0000C000UL
23#define PSW32_MASK_CC 0x00003000UL 23#define PSW32_MASK_CC 0x00003000UL
24#define PSW32_MASK_PM 0x00000f00UL 24#define PSW32_MASK_PM 0x00000f00UL
25#define PSW32_MASK_RI 0x00000080UL
25 26
26#define PSW32_MASK_USER 0x0000FF00UL 27#define PSW32_MASK_USER 0x0000FF00UL
27 28
@@ -35,7 +36,9 @@
35#define PSW32_ASC_SECONDARY 0x00008000UL 36#define PSW32_ASC_SECONDARY 0x00008000UL
36#define PSW32_ASC_HOME 0x0000C000UL 37#define PSW32_ASC_HOME 0x0000C000UL
37 38
38extern u32 psw32_user_bits; 39#define PSW32_USER_BITS (PSW32_MASK_DAT | PSW32_MASK_IO | PSW32_MASK_EXT | \
40 PSW32_DEFAULT_KEY | PSW32_MASK_BASE | \
41 PSW32_MASK_MCHECK | PSW32_MASK_PSTATE | PSW32_ASC_HOME)
39 42
40#define COMPAT_USER_HZ 100 43#define COMPAT_USER_HZ 100
41#define COMPAT_UTS_MACHINE "s390\0\0\0\0" 44#define COMPAT_UTS_MACHINE "s390\0\0\0\0"
diff --git a/arch/s390/include/asm/ctl_reg.h b/arch/s390/include/asm/ctl_reg.h
index debfda33d1f8..9b69c0befdca 100644
--- a/arch/s390/include/asm/ctl_reg.h
+++ b/arch/s390/include/asm/ctl_reg.h
@@ -8,69 +8,59 @@
8#define __ASM_CTL_REG_H 8#define __ASM_CTL_REG_H
9 9
10#ifdef CONFIG_64BIT 10#ifdef CONFIG_64BIT
11 11# define __CTL_LOAD "lctlg"
12#define __ctl_load(array, low, high) ({ \ 12# define __CTL_STORE "stctg"
13 typedef struct { char _[sizeof(array)]; } addrtype; \ 13#else
14 asm volatile( \ 14# define __CTL_LOAD "lctl"
15 " lctlg %1,%2,%0\n" \ 15# define __CTL_STORE "stctl"
16 : : "Q" (*(addrtype *)(&array)), \ 16#endif
17 "i" (low), "i" (high)); \ 17
18 }) 18#define __ctl_load(array, low, high) { \
19 19 typedef struct { char _[sizeof(array)]; } addrtype; \
20#define __ctl_store(array, low, high) ({ \ 20 \
21 typedef struct { char _[sizeof(array)]; } addrtype; \ 21 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
22 asm volatile( \ 22 asm volatile( \
23 " stctg %1,%2,%0\n" \ 23 __CTL_LOAD " %1,%2,%0\n" \
24 : "=Q" (*(addrtype *)(&array)) \ 24 : : "Q" (*(addrtype *)(&array)), "i" (low), "i" (high));\
25 : "i" (low), "i" (high)); \ 25}
26 }) 26
27 27#define __ctl_store(array, low, high) { \
28#else /* CONFIG_64BIT */ 28 typedef struct { char _[sizeof(array)]; } addrtype; \
29 29 \
30#define __ctl_load(array, low, high) ({ \ 30 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
31 typedef struct { char _[sizeof(array)]; } addrtype; \ 31 asm volatile( \
32 asm volatile( \ 32 __CTL_STORE " %1,%2,%0\n" \
33 " lctl %1,%2,%0\n" \ 33 : "=Q" (*(addrtype *)(&array)) \
34 : : "Q" (*(addrtype *)(&array)), \ 34 : "i" (low), "i" (high)); \
35 "i" (low), "i" (high)); \ 35}
36}) 36
37 37static inline void __ctl_set_bit(unsigned int cr, unsigned int bit)
38#define __ctl_store(array, low, high) ({ \ 38{
39 typedef struct { char _[sizeof(array)]; } addrtype; \ 39 unsigned long reg;
40 asm volatile( \ 40
41 " stctl %1,%2,%0\n" \ 41 __ctl_store(reg, cr, cr);
42 : "=Q" (*(addrtype *)(&array)) \ 42 reg |= 1UL << bit;
43 : "i" (low), "i" (high)); \ 43 __ctl_load(reg, cr, cr);
44 }) 44}
45 45
46#endif /* CONFIG_64BIT */ 46static inline void __ctl_clear_bit(unsigned int cr, unsigned int bit)
47 47{
48#define __ctl_set_bit(cr, bit) ({ \ 48 unsigned long reg;
49 unsigned long __dummy; \ 49
50 __ctl_store(__dummy, cr, cr); \ 50 __ctl_store(reg, cr, cr);
51 __dummy |= 1UL << (bit); \ 51 reg &= ~(1UL << bit);
52 __ctl_load(__dummy, cr, cr); \ 52 __ctl_load(reg, cr, cr);
53}) 53}
54 54
55#define __ctl_clear_bit(cr, bit) ({ \ 55void smp_ctl_set_bit(int cr, int bit);
56 unsigned long __dummy; \ 56void smp_ctl_clear_bit(int cr, int bit);
57 __ctl_store(__dummy, cr, cr); \
58 __dummy &= ~(1UL << (bit)); \
59 __ctl_load(__dummy, cr, cr); \
60})
61 57
62#ifdef CONFIG_SMP 58#ifdef CONFIG_SMP
63 59# define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit)
64extern void smp_ctl_set_bit(int cr, int bit); 60# define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit)
65extern void smp_ctl_clear_bit(int cr, int bit);
66#define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit)
67#define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit)
68
69#else 61#else
70 62# define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit)
71#define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit) 63# define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit)
72#define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit) 64#endif
73
74#endif /* CONFIG_SMP */
75 65
76#endif /* __ASM_CTL_REG_H */ 66#endif /* __ASM_CTL_REG_H */
diff --git a/arch/s390/include/asm/debug.h b/arch/s390/include/asm/debug.h
index 188c5052a20a..530c15eb01e9 100644
--- a/arch/s390/include/asm/debug.h
+++ b/arch/s390/include/asm/debug.h
@@ -107,6 +107,11 @@ void debug_set_level(debug_info_t* id, int new_level);
107void debug_set_critical(void); 107void debug_set_critical(void);
108void debug_stop_all(void); 108void debug_stop_all(void);
109 109
110static inline bool debug_level_enabled(debug_info_t* id, int level)
111{
112 return level <= id->level;
113}
114
110static inline debug_entry_t* 115static inline debug_entry_t*
111debug_event(debug_info_t* id, int level, void* data, int length) 116debug_event(debug_info_t* id, int level, void* data, int length)
112{ 117{
diff --git a/arch/s390/include/asm/dis.h b/arch/s390/include/asm/dis.h
new file mode 100644
index 000000000000..04a83f5773cd
--- /dev/null
+++ b/arch/s390/include/asm/dis.h
@@ -0,0 +1,52 @@
1/*
2 * Disassemble s390 instructions.
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
6 */
7
8#ifndef __ASM_S390_DIS_H__
9#define __ASM_S390_DIS_H__
10
11/* Type of operand */
12#define OPERAND_GPR 0x1 /* Operand printed as %rx */
13#define OPERAND_FPR 0x2 /* Operand printed as %fx */
14#define OPERAND_AR 0x4 /* Operand printed as %ax */
15#define OPERAND_CR 0x8 /* Operand printed as %cx */
16#define OPERAND_DISP 0x10 /* Operand printed as displacement */
17#define OPERAND_BASE 0x20 /* Operand printed as base register */
18#define OPERAND_INDEX 0x40 /* Operand printed as index register */
19#define OPERAND_PCREL 0x80 /* Operand printed as pc-relative symbol */
20#define OPERAND_SIGNED 0x100 /* Operand printed as signed value */
21#define OPERAND_LENGTH 0x200 /* Operand printed as length (+1) */
22
23
24struct s390_operand {
25 int bits; /* The number of bits in the operand. */
26 int shift; /* The number of bits to shift. */
27 int flags; /* One bit syntax flags. */
28};
29
30struct s390_insn {
31 const char name[5];
32 unsigned char opfrag;
33 unsigned char format;
34};
35
36
37static inline int insn_length(unsigned char code)
38{
39 return ((((int) code + 64) >> 7) + 1) << 1;
40}
41
42void show_code(struct pt_regs *regs);
43void print_fn_code(unsigned char *code, unsigned long len);
44int insn_to_mnemonic(unsigned char *instruction, char *buf, unsigned int len);
45struct s390_insn *find_insn(unsigned char *code);
46
47static inline int is_known_insn(unsigned char *code)
48{
49 return !!find_insn(code);
50}
51
52#endif /* __ASM_S390_DIS_H__ */
diff --git a/arch/s390/include/asm/fcx.h b/arch/s390/include/asm/fcx.h
index ef6170995076..7ecb92b469b6 100644
--- a/arch/s390/include/asm/fcx.h
+++ b/arch/s390/include/asm/fcx.h
@@ -12,9 +12,9 @@
12 12
13#define TCW_FORMAT_DEFAULT 0 13#define TCW_FORMAT_DEFAULT 0
14#define TCW_TIDAW_FORMAT_DEFAULT 0 14#define TCW_TIDAW_FORMAT_DEFAULT 0
15#define TCW_FLAGS_INPUT_TIDA 1 << (23 - 5) 15#define TCW_FLAGS_INPUT_TIDA (1 << (23 - 5))
16#define TCW_FLAGS_TCCB_TIDA 1 << (23 - 6) 16#define TCW_FLAGS_TCCB_TIDA (1 << (23 - 6))
17#define TCW_FLAGS_OUTPUT_TIDA 1 << (23 - 7) 17#define TCW_FLAGS_OUTPUT_TIDA (1 << (23 - 7))
18#define TCW_FLAGS_TIDAW_FORMAT(x) ((x) & 3) << (23 - 9) 18#define TCW_FLAGS_TIDAW_FORMAT(x) ((x) & 3) << (23 - 9)
19#define TCW_FLAGS_GET_TIDAW_FORMAT(x) (((x) >> (23 - 9)) & 3) 19#define TCW_FLAGS_GET_TIDAW_FORMAT(x) (((x) >> (23 - 9)) & 3)
20 20
@@ -54,11 +54,11 @@ struct tcw {
54 u32 intrg; 54 u32 intrg;
55} __attribute__ ((packed, aligned(64))); 55} __attribute__ ((packed, aligned(64)));
56 56
57#define TIDAW_FLAGS_LAST 1 << (7 - 0) 57#define TIDAW_FLAGS_LAST (1 << (7 - 0))
58#define TIDAW_FLAGS_SKIP 1 << (7 - 1) 58#define TIDAW_FLAGS_SKIP (1 << (7 - 1))
59#define TIDAW_FLAGS_DATA_INT 1 << (7 - 2) 59#define TIDAW_FLAGS_DATA_INT (1 << (7 - 2))
60#define TIDAW_FLAGS_TTIC 1 << (7 - 3) 60#define TIDAW_FLAGS_TTIC (1 << (7 - 3))
61#define TIDAW_FLAGS_INSERT_CBC 1 << (7 - 4) 61#define TIDAW_FLAGS_INSERT_CBC (1 << (7 - 4))
62 62
63/** 63/**
64 * struct tidaw - Transport-Indirect-Addressing Word (TIDAW) 64 * struct tidaw - Transport-Indirect-Addressing Word (TIDAW)
@@ -106,9 +106,9 @@ struct tsa_ddpc {
106 u8 sense[32]; 106 u8 sense[32];
107} __attribute__ ((packed)); 107} __attribute__ ((packed));
108 108
109#define TSA_INTRG_FLAGS_CU_STATE_VALID 1 << (7 - 0) 109#define TSA_INTRG_FLAGS_CU_STATE_VALID (1 << (7 - 0))
110#define TSA_INTRG_FLAGS_DEV_STATE_VALID 1 << (7 - 1) 110#define TSA_INTRG_FLAGS_DEV_STATE_VALID (1 << (7 - 1))
111#define TSA_INTRG_FLAGS_OP_STATE_VALID 1 << (7 - 2) 111#define TSA_INTRG_FLAGS_OP_STATE_VALID (1 << (7 - 2))
112 112
113/** 113/**
114 * struct tsa_intrg - Interrogate Transport-Status Area (Intrg. TSA) 114 * struct tsa_intrg - Interrogate Transport-Status Area (Intrg. TSA)
@@ -140,10 +140,10 @@ struct tsa_intrg {
140#define TSB_FORMAT_DDPC 2 140#define TSB_FORMAT_DDPC 2
141#define TSB_FORMAT_INTRG 3 141#define TSB_FORMAT_INTRG 3
142 142
143#define TSB_FLAGS_DCW_OFFSET_VALID 1 << (7 - 0) 143#define TSB_FLAGS_DCW_OFFSET_VALID (1 << (7 - 0))
144#define TSB_FLAGS_COUNT_VALID 1 << (7 - 1) 144#define TSB_FLAGS_COUNT_VALID (1 << (7 - 1))
145#define TSB_FLAGS_CACHE_MISS 1 << (7 - 2) 145#define TSB_FLAGS_CACHE_MISS (1 << (7 - 2))
146#define TSB_FLAGS_TIME_VALID 1 << (7 - 3) 146#define TSB_FLAGS_TIME_VALID (1 << (7 - 3))
147#define TSB_FLAGS_FORMAT(x) ((x) & 7) 147#define TSB_FLAGS_FORMAT(x) ((x) & 7)
148#define TSB_FORMAT(t) ((t)->flags & 7) 148#define TSB_FORMAT(t) ((t)->flags & 7)
149 149
@@ -179,9 +179,9 @@ struct tsb {
179#define DCW_INTRG_RCQ_PRIMARY 1 179#define DCW_INTRG_RCQ_PRIMARY 1
180#define DCW_INTRG_RCQ_SECONDARY 2 180#define DCW_INTRG_RCQ_SECONDARY 2
181 181
182#define DCW_INTRG_FLAGS_MPM 1 < (7 - 0) 182#define DCW_INTRG_FLAGS_MPM (1 << (7 - 0))
183#define DCW_INTRG_FLAGS_PPR 1 < (7 - 1) 183#define DCW_INTRG_FLAGS_PPR (1 << (7 - 1))
184#define DCW_INTRG_FLAGS_CRIT 1 < (7 - 2) 184#define DCW_INTRG_FLAGS_CRIT (1 << (7 - 2))
185 185
186/** 186/**
187 * struct dcw_intrg_data - Interrogate DCW data 187 * struct dcw_intrg_data - Interrogate DCW data
@@ -216,7 +216,7 @@ struct dcw_intrg_data {
216 u8 prog_data[0]; 216 u8 prog_data[0];
217} __attribute__ ((packed)); 217} __attribute__ ((packed));
218 218
219#define DCW_FLAGS_CC 1 << (7 - 1) 219#define DCW_FLAGS_CC (1 << (7 - 1))
220 220
221#define DCW_CMD_WRITE 0x01 221#define DCW_CMD_WRITE 0x01
222#define DCW_CMD_READ 0x02 222#define DCW_CMD_READ 0x02
diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h
index 2bd6cb897b90..2fcccc0c997c 100644
--- a/arch/s390/include/asm/ipl.h
+++ b/arch/s390/include/asm/ipl.h
@@ -7,6 +7,7 @@
7#ifndef _ASM_S390_IPL_H 7#ifndef _ASM_S390_IPL_H
8#define _ASM_S390_IPL_H 8#define _ASM_S390_IPL_H
9 9
10#include <asm/lowcore.h>
10#include <asm/types.h> 11#include <asm/types.h>
11#include <asm/cio.h> 12#include <asm/cio.h>
12#include <asm/setup.h> 13#include <asm/setup.h>
@@ -86,7 +87,14 @@ struct ipl_parameter_block {
86 */ 87 */
87extern u32 ipl_flags; 88extern u32 ipl_flags;
88extern u32 dump_prefix_page; 89extern u32 dump_prefix_page;
89extern unsigned int zfcpdump_prefix_array[]; 90
91struct dump_save_areas {
92 struct save_area **areas;
93 int count;
94};
95
96extern struct dump_save_areas dump_save_areas;
97struct save_area *dump_save_area_create(int cpu);
90 98
91extern void do_reipl(void); 99extern void do_reipl(void);
92extern void do_halt(void); 100extern void do_halt(void);
diff --git a/arch/s390/include/asm/jump_label.h b/arch/s390/include/asm/jump_label.h
index 6c32190dc73e..346b1c85ffb4 100644
--- a/arch/s390/include/asm/jump_label.h
+++ b/arch/s390/include/asm/jump_label.h
@@ -15,7 +15,7 @@
15 15
16static __always_inline bool arch_static_branch(struct static_key *key) 16static __always_inline bool arch_static_branch(struct static_key *key)
17{ 17{
18 asm goto("0: brcl 0,0\n" 18 asm_volatile_goto("0: brcl 0,0\n"
19 ".pushsection __jump_table, \"aw\"\n" 19 ".pushsection __jump_table, \"aw\"\n"
20 ASM_ALIGN "\n" 20 ASM_ALIGN "\n"
21 ASM_PTR " 0b, %l[label], %0\n" 21 ASM_PTR " 0b, %l[label], %0\n"
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index e87ecaa2c569..d5bc3750616e 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -38,13 +38,6 @@ struct sca_block {
38 struct sca_entry cpu[64]; 38 struct sca_entry cpu[64];
39} __attribute__((packed)); 39} __attribute__((packed));
40 40
41#define KVM_NR_PAGE_SIZES 2
42#define KVM_HPAGE_GFN_SHIFT(x) (((x) - 1) * 8)
43#define KVM_HPAGE_SHIFT(x) (PAGE_SHIFT + KVM_HPAGE_GFN_SHIFT(x))
44#define KVM_HPAGE_SIZE(x) (1UL << KVM_HPAGE_SHIFT(x))
45#define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1))
46#define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE)
47
48#define CPUSTAT_STOPPED 0x80000000 41#define CPUSTAT_STOPPED 0x80000000
49#define CPUSTAT_WAIT 0x10000000 42#define CPUSTAT_WAIT 0x10000000
50#define CPUSTAT_ECALL_PEND 0x08000000 43#define CPUSTAT_ECALL_PEND 0x08000000
@@ -220,7 +213,6 @@ struct kvm_s390_interrupt_info {
220/* for local_interrupt.action_flags */ 213/* for local_interrupt.action_flags */
221#define ACTION_STORE_ON_STOP (1<<0) 214#define ACTION_STORE_ON_STOP (1<<0)
222#define ACTION_STOP_ON_STOP (1<<1) 215#define ACTION_STOP_ON_STOP (1<<1)
223#define ACTION_RELOADVCPU_ON_STOP (1<<2)
224 216
225struct kvm_s390_local_interrupt { 217struct kvm_s390_local_interrupt {
226 spinlock_t lock; 218 spinlock_t lock;
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
index 9f973d8de90e..5d1f950704dc 100644
--- a/arch/s390/include/asm/mmu_context.h
+++ b/arch/s390/include/asm/mmu_context.h
@@ -40,14 +40,8 @@ static inline void update_mm(struct mm_struct *mm, struct task_struct *tsk)
40 pgd_t *pgd = mm->pgd; 40 pgd_t *pgd = mm->pgd;
41 41
42 S390_lowcore.user_asce = mm->context.asce_bits | __pa(pgd); 42 S390_lowcore.user_asce = mm->context.asce_bits | __pa(pgd);
43 if (s390_user_mode != HOME_SPACE_MODE) { 43 /* Load primary space page table origin. */
44 /* Load primary space page table origin. */ 44 asm volatile(LCTL_OPCODE" 1,1,%0\n" : : "m" (S390_lowcore.user_asce));
45 asm volatile(LCTL_OPCODE" 1,1,%0\n"
46 : : "m" (S390_lowcore.user_asce) );
47 } else
48 /* Load home space page table origin. */
49 asm volatile(LCTL_OPCODE" 13,13,%0"
50 : : "m" (S390_lowcore.user_asce) );
51 set_fs(current->thread.mm_segment); 45 set_fs(current->thread.mm_segment);
52} 46}
53 47
diff --git a/arch/s390/include/asm/mutex.h b/arch/s390/include/asm/mutex.h
index 688271f5f2e4..458c1f7fbc18 100644
--- a/arch/s390/include/asm/mutex.h
+++ b/arch/s390/include/asm/mutex.h
@@ -7,5 +7,3 @@
7 */ 7 */
8 8
9#include <asm-generic/mutex-dec.h> 9#include <asm-generic/mutex-dec.h>
10
11#define arch_mutex_cpu_relax() barrier()
diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h
index 1e51f2915b2e..316c8503a3b4 100644
--- a/arch/s390/include/asm/page.h
+++ b/arch/s390/include/asm/page.h
@@ -30,7 +30,12 @@
30#include <asm/setup.h> 30#include <asm/setup.h>
31#ifndef __ASSEMBLY__ 31#ifndef __ASSEMBLY__
32 32
33void storage_key_init_range(unsigned long start, unsigned long end); 33static inline void storage_key_init_range(unsigned long start, unsigned long end)
34{
35#if PAGE_DEFAULT_KEY
36 __storage_key_init_range(start, end);
37#endif
38}
34 39
35static inline void clear_page(void *page) 40static inline void clear_page(void *page)
36{ 41{
diff --git a/arch/s390/include/asm/pci_debug.h b/arch/s390/include/asm/pci_debug.h
index 1ca5d1047c71..ac24b26fc065 100644
--- a/arch/s390/include/asm/pci_debug.h
+++ b/arch/s390/include/asm/pci_debug.h
@@ -6,14 +6,9 @@
6extern debug_info_t *pci_debug_msg_id; 6extern debug_info_t *pci_debug_msg_id;
7extern debug_info_t *pci_debug_err_id; 7extern debug_info_t *pci_debug_err_id;
8 8
9#ifdef CONFIG_PCI_DEBUG
10#define zpci_dbg(imp, fmt, args...) \ 9#define zpci_dbg(imp, fmt, args...) \
11 debug_sprintf_event(pci_debug_msg_id, imp, fmt, ##args) 10 debug_sprintf_event(pci_debug_msg_id, imp, fmt, ##args)
12 11
13#else /* !CONFIG_PCI_DEBUG */
14#define zpci_dbg(imp, fmt, args...) do { } while (0)
15#endif
16
17#define zpci_err(text...) \ 12#define zpci_err(text...) \
18 do { \ 13 do { \
19 char debug_buffer[16]; \ 14 char debug_buffer[16]; \
diff --git a/arch/s390/include/asm/pci_insn.h b/arch/s390/include/asm/pci_insn.h
index df6eac9f0cb4..649eb62c52b3 100644
--- a/arch/s390/include/asm/pci_insn.h
+++ b/arch/s390/include/asm/pci_insn.h
@@ -54,11 +54,9 @@
54struct zpci_fib { 54struct zpci_fib {
55 u32 fmt : 8; /* format */ 55 u32 fmt : 8; /* format */
56 u32 : 24; 56 u32 : 24;
57 u32 reserved1; 57 u32 : 32;
58 u8 fc; /* function controls */ 58 u8 fc; /* function controls */
59 u8 reserved2; 59 u64 : 56;
60 u16 reserved3;
61 u32 reserved4;
62 u64 pba; /* PCI base address */ 60 u64 pba; /* PCI base address */
63 u64 pal; /* PCI address limit */ 61 u64 pal; /* PCI address limit */
64 u64 iota; /* I/O Translation Anchor */ 62 u64 iota; /* I/O Translation Anchor */
@@ -70,14 +68,13 @@ struct zpci_fib {
70 u32 sum : 1; /* Adapter int summary bit enabled */ 68 u32 sum : 1; /* Adapter int summary bit enabled */
71 u32 : 1; 69 u32 : 1;
72 u32 aisbo : 6; /* Adapter int summary bit offset */ 70 u32 aisbo : 6; /* Adapter int summary bit offset */
73 u32 reserved5; 71 u32 : 32;
74 u64 aibv; /* Adapter int bit vector address */ 72 u64 aibv; /* Adapter int bit vector address */
75 u64 aisb; /* Adapter int summary bit address */ 73 u64 aisb; /* Adapter int summary bit address */
76 u64 fmb_addr; /* Function measurement block address and key */ 74 u64 fmb_addr; /* Function measurement block address and key */
77 u64 reserved6; 75 u32 : 32;
78 u64 reserved7; 76 u32 gd;
79} __packed; 77} __packed __aligned(8);
80
81 78
82int zpci_mod_fc(u64 req, struct zpci_fib *fib); 79int zpci_mod_fc(u64 req, struct zpci_fib *fib);
83int zpci_refresh_trans(u64 fn, u64 addr, u64 range); 80int zpci_refresh_trans(u64 fn, u64 addr, u64 range);
diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h
index 86fe0ee2cee5..fa91e0097458 100644
--- a/arch/s390/include/asm/percpu.h
+++ b/arch/s390/include/asm/percpu.h
@@ -10,16 +10,22 @@
10 */ 10 */
11#define __my_cpu_offset S390_lowcore.percpu_offset 11#define __my_cpu_offset S390_lowcore.percpu_offset
12 12
13#ifdef CONFIG_64BIT
14
13/* 15/*
14 * For 64 bit module code, the module may be more than 4G above the 16 * For 64 bit module code, the module may be more than 4G above the
15 * per cpu area, use weak definitions to force the compiler to 17 * per cpu area, use weak definitions to force the compiler to
16 * generate external references. 18 * generate external references.
17 */ 19 */
18#if defined(CONFIG_SMP) && defined(CONFIG_64BIT) && defined(MODULE) 20#if defined(CONFIG_SMP) && defined(MODULE)
19#define ARCH_NEEDS_WEAK_PER_CPU 21#define ARCH_NEEDS_WEAK_PER_CPU
20#endif 22#endif
21 23
22#define arch_this_cpu_to_op(pcp, val, op) \ 24/*
25 * We use a compare-and-swap loop since that uses less cpu cycles than
26 * disabling and enabling interrupts like the generic variant would do.
27 */
28#define arch_this_cpu_to_op_simple(pcp, val, op) \
23({ \ 29({ \
24 typedef typeof(pcp) pcp_op_T__; \ 30 typedef typeof(pcp) pcp_op_T__; \
25 pcp_op_T__ old__, new__, prev__; \ 31 pcp_op_T__ old__, new__, prev__; \
@@ -30,42 +36,101 @@
30 do { \ 36 do { \
31 old__ = prev__; \ 37 old__ = prev__; \
32 new__ = old__ op (val); \ 38 new__ = old__ op (val); \
33 switch (sizeof(*ptr__)) { \ 39 prev__ = cmpxchg(ptr__, old__, new__); \
34 case 8: \
35 prev__ = cmpxchg64(ptr__, old__, new__); \
36 break; \
37 default: \
38 prev__ = cmpxchg(ptr__, old__, new__); \
39 } \
40 } while (prev__ != old__); \ 40 } while (prev__ != old__); \
41 preempt_enable(); \ 41 preempt_enable(); \
42 new__; \ 42 new__; \
43}) 43})
44 44
45#define this_cpu_add_1(pcp, val) arch_this_cpu_to_op(pcp, val, +) 45#define this_cpu_add_1(pcp, val) arch_this_cpu_to_op_simple(pcp, val, +)
46#define this_cpu_add_2(pcp, val) arch_this_cpu_to_op(pcp, val, +) 46#define this_cpu_add_2(pcp, val) arch_this_cpu_to_op_simple(pcp, val, +)
47#define this_cpu_add_4(pcp, val) arch_this_cpu_to_op(pcp, val, +) 47#define this_cpu_add_return_1(pcp, val) arch_this_cpu_to_op_simple(pcp, val, +)
48#define this_cpu_add_8(pcp, val) arch_this_cpu_to_op(pcp, val, +) 48#define this_cpu_add_return_2(pcp, val) arch_this_cpu_to_op_simple(pcp, val, +)
49#define this_cpu_and_1(pcp, val) arch_this_cpu_to_op_simple(pcp, val, &)
50#define this_cpu_and_2(pcp, val) arch_this_cpu_to_op_simple(pcp, val, &)
51#define this_cpu_or_1(pcp, val) arch_this_cpu_to_op_simple(pcp, val, |)
52#define this_cpu_or_2(pcp, val) arch_this_cpu_to_op_simple(pcp, val, |)
53
54#ifndef CONFIG_HAVE_MARCH_Z196_FEATURES
55
56#define this_cpu_add_4(pcp, val) arch_this_cpu_to_op_simple(pcp, val, +)
57#define this_cpu_add_8(pcp, val) arch_this_cpu_to_op_simple(pcp, val, +)
58#define this_cpu_add_return_4(pcp, val) arch_this_cpu_to_op_simple(pcp, val, +)
59#define this_cpu_add_return_8(pcp, val) arch_this_cpu_to_op_simple(pcp, val, +)
60#define this_cpu_and_4(pcp, val) arch_this_cpu_to_op_simple(pcp, val, &)
61#define this_cpu_and_8(pcp, val) arch_this_cpu_to_op_simple(pcp, val, &)
62#define this_cpu_or_4(pcp, val) arch_this_cpu_to_op_simple(pcp, val, |)
63#define this_cpu_or_8(pcp, val) arch_this_cpu_to_op_simple(pcp, val, |)
64
65#else /* CONFIG_HAVE_MARCH_Z196_FEATURES */
66
67#define arch_this_cpu_add(pcp, val, op1, op2, szcast) \
68{ \
69 typedef typeof(pcp) pcp_op_T__; \
70 pcp_op_T__ val__ = (val); \
71 pcp_op_T__ old__, *ptr__; \
72 preempt_disable(); \
73 ptr__ = __this_cpu_ptr(&(pcp)); \
74 if (__builtin_constant_p(val__) && \
75 ((szcast)val__ > -129) && ((szcast)val__ < 128)) { \
76 asm volatile( \
77 op2 " %[ptr__],%[val__]\n" \
78 : [ptr__] "+Q" (*ptr__) \
79 : [val__] "i" ((szcast)val__) \
80 : "cc"); \
81 } else { \
82 asm volatile( \
83 op1 " %[old__],%[val__],%[ptr__]\n" \
84 : [old__] "=d" (old__), [ptr__] "+Q" (*ptr__) \
85 : [val__] "d" (val__) \
86 : "cc"); \
87 } \
88 preempt_enable(); \
89}
49 90
50#define this_cpu_add_return_1(pcp, val) arch_this_cpu_to_op(pcp, val, +) 91#define this_cpu_add_4(pcp, val) arch_this_cpu_add(pcp, val, "laa", "asi", int)
51#define this_cpu_add_return_2(pcp, val) arch_this_cpu_to_op(pcp, val, +) 92#define this_cpu_add_8(pcp, val) arch_this_cpu_add(pcp, val, "laag", "agsi", long)
52#define this_cpu_add_return_4(pcp, val) arch_this_cpu_to_op(pcp, val, +)
53#define this_cpu_add_return_8(pcp, val) arch_this_cpu_to_op(pcp, val, +)
54 93
55#define this_cpu_and_1(pcp, val) arch_this_cpu_to_op(pcp, val, &) 94#define arch_this_cpu_add_return(pcp, val, op) \
56#define this_cpu_and_2(pcp, val) arch_this_cpu_to_op(pcp, val, &) 95({ \
57#define this_cpu_and_4(pcp, val) arch_this_cpu_to_op(pcp, val, &) 96 typedef typeof(pcp) pcp_op_T__; \
58#define this_cpu_and_8(pcp, val) arch_this_cpu_to_op(pcp, val, &) 97 pcp_op_T__ val__ = (val); \
98 pcp_op_T__ old__, *ptr__; \
99 preempt_disable(); \
100 ptr__ = __this_cpu_ptr(&(pcp)); \
101 asm volatile( \
102 op " %[old__],%[val__],%[ptr__]\n" \
103 : [old__] "=d" (old__), [ptr__] "+Q" (*ptr__) \
104 : [val__] "d" (val__) \
105 : "cc"); \
106 preempt_enable(); \
107 old__ + val__; \
108})
59 109
60#define this_cpu_or_1(pcp, val) arch_this_cpu_to_op(pcp, val, |) 110#define this_cpu_add_return_4(pcp, val) arch_this_cpu_add_return(pcp, val, "laa")
61#define this_cpu_or_2(pcp, val) arch_this_cpu_to_op(pcp, val, |) 111#define this_cpu_add_return_8(pcp, val) arch_this_cpu_add_return(pcp, val, "laag")
62#define this_cpu_or_4(pcp, val) arch_this_cpu_to_op(pcp, val, |)
63#define this_cpu_or_8(pcp, val) arch_this_cpu_to_op(pcp, val, |)
64 112
65#define this_cpu_xor_1(pcp, val) arch_this_cpu_to_op(pcp, val, ^) 113#define arch_this_cpu_to_op(pcp, val, op) \
66#define this_cpu_xor_2(pcp, val) arch_this_cpu_to_op(pcp, val, ^) 114{ \
67#define this_cpu_xor_4(pcp, val) arch_this_cpu_to_op(pcp, val, ^) 115 typedef typeof(pcp) pcp_op_T__; \
68#define this_cpu_xor_8(pcp, val) arch_this_cpu_to_op(pcp, val, ^) 116 pcp_op_T__ val__ = (val); \
117 pcp_op_T__ old__, *ptr__; \
118 preempt_disable(); \
119 ptr__ = __this_cpu_ptr(&(pcp)); \
120 asm volatile( \
121 op " %[old__],%[val__],%[ptr__]\n" \
122 : [old__] "=d" (old__), [ptr__] "+Q" (*ptr__) \
123 : [val__] "d" (val__) \
124 : "cc"); \
125 preempt_enable(); \
126}
127
128#define this_cpu_and_4(pcp, val) arch_this_cpu_to_op(pcp, val, "lan")
129#define this_cpu_and_8(pcp, val) arch_this_cpu_to_op(pcp, val, "lang")
130#define this_cpu_or_4(pcp, val) arch_this_cpu_to_op(pcp, val, "lao")
131#define this_cpu_or_8(pcp, val) arch_this_cpu_to_op(pcp, val, "laog")
132
133#endif /* CONFIG_HAVE_MARCH_Z196_FEATURES */
69 134
70#define arch_this_cpu_cmpxchg(pcp, oval, nval) \ 135#define arch_this_cpu_cmpxchg(pcp, oval, nval) \
71({ \ 136({ \
@@ -74,13 +139,7 @@
74 pcp_op_T__ *ptr__; \ 139 pcp_op_T__ *ptr__; \
75 preempt_disable(); \ 140 preempt_disable(); \
76 ptr__ = __this_cpu_ptr(&(pcp)); \ 141 ptr__ = __this_cpu_ptr(&(pcp)); \
77 switch (sizeof(*ptr__)) { \ 142 ret__ = cmpxchg(ptr__, oval, nval); \
78 case 8: \
79 ret__ = cmpxchg64(ptr__, oval, nval); \
80 break; \
81 default: \
82 ret__ = cmpxchg(ptr__, oval, nval); \
83 } \
84 preempt_enable(); \ 143 preempt_enable(); \
85 ret__; \ 144 ret__; \
86}) 145})
@@ -104,9 +163,7 @@
104#define this_cpu_xchg_1(pcp, nval) arch_this_cpu_xchg(pcp, nval) 163#define this_cpu_xchg_1(pcp, nval) arch_this_cpu_xchg(pcp, nval)
105#define this_cpu_xchg_2(pcp, nval) arch_this_cpu_xchg(pcp, nval) 164#define this_cpu_xchg_2(pcp, nval) arch_this_cpu_xchg(pcp, nval)
106#define this_cpu_xchg_4(pcp, nval) arch_this_cpu_xchg(pcp, nval) 165#define this_cpu_xchg_4(pcp, nval) arch_this_cpu_xchg(pcp, nval)
107#ifdef CONFIG_64BIT
108#define this_cpu_xchg_8(pcp, nval) arch_this_cpu_xchg(pcp, nval) 166#define this_cpu_xchg_8(pcp, nval) arch_this_cpu_xchg(pcp, nval)
109#endif
110 167
111#define arch_this_cpu_cmpxchg_double(pcp1, pcp2, o1, o2, n1, n2) \ 168#define arch_this_cpu_cmpxchg_double(pcp1, pcp2, o1, o2, n1, n2) \
112({ \ 169({ \
@@ -124,9 +181,9 @@
124}) 181})
125 182
126#define this_cpu_cmpxchg_double_4 arch_this_cpu_cmpxchg_double 183#define this_cpu_cmpxchg_double_4 arch_this_cpu_cmpxchg_double
127#ifdef CONFIG_64BIT
128#define this_cpu_cmpxchg_double_8 arch_this_cpu_cmpxchg_double 184#define this_cpu_cmpxchg_double_8 arch_this_cpu_cmpxchg_double
129#endif 185
186#endif /* CONFIG_64BIT */
130 187
131#include <asm-generic/percpu.h> 188#include <asm-generic/percpu.h>
132 189
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 9b60a36c348d..2204400d0bd5 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -748,7 +748,9 @@ static inline void pgste_set_key(pte_t *ptep, pgste_t pgste, pte_t entry)
748 748
749static inline void pgste_set_pte(pte_t *ptep, pte_t entry) 749static inline void pgste_set_pte(pte_t *ptep, pte_t entry)
750{ 750{
751 if (!MACHINE_HAS_ESOP && (pte_val(entry) & _PAGE_WRITE)) { 751 if (!MACHINE_HAS_ESOP &&
752 (pte_val(entry) & _PAGE_PRESENT) &&
753 (pte_val(entry) & _PAGE_WRITE)) {
752 /* 754 /*
753 * Without enhanced suppression-on-protection force 755 * Without enhanced suppression-on-protection force
754 * the dirty bit on for all writable ptes. 756 * the dirty bit on for all writable ptes.
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index 0eb37505cab1..0a876bc543d3 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -134,19 +134,17 @@ struct stack_frame {
134 * Do necessary setup to start up a new thread. 134 * Do necessary setup to start up a new thread.
135 */ 135 */
136#define start_thread(regs, new_psw, new_stackp) do { \ 136#define start_thread(regs, new_psw, new_stackp) do { \
137 regs->psw.mask = psw_user_bits | PSW_MASK_EA | PSW_MASK_BA; \ 137 regs->psw.mask = PSW_USER_BITS | PSW_MASK_EA | PSW_MASK_BA; \
138 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ 138 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \
139 regs->gprs[15] = new_stackp; \ 139 regs->gprs[15] = new_stackp; \
140 execve_tail(); \ 140 execve_tail(); \
141} while (0) 141} while (0)
142 142
143#define start_thread31(regs, new_psw, new_stackp) do { \ 143#define start_thread31(regs, new_psw, new_stackp) do { \
144 regs->psw.mask = psw_user_bits | PSW_MASK_BA; \ 144 regs->psw.mask = PSW_USER_BITS | PSW_MASK_BA; \
145 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ 145 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \
146 regs->gprs[15] = new_stackp; \ 146 regs->gprs[15] = new_stackp; \
147 __tlb_flush_mm(current->mm); \
148 crst_table_downgrade(current->mm, 1UL << 31); \ 147 crst_table_downgrade(current->mm, 1UL << 31); \
149 update_mm(current->mm, current); \
150 execve_tail(); \ 148 execve_tail(); \
151} while (0) 149} while (0)
152 150
@@ -169,17 +167,15 @@ extern void release_thread(struct task_struct *);
169 */ 167 */
170extern unsigned long thread_saved_pc(struct task_struct *t); 168extern unsigned long thread_saved_pc(struct task_struct *t);
171 169
172extern void show_code(struct pt_regs *regs);
173extern void print_fn_code(unsigned char *code, unsigned long len);
174extern int insn_to_mnemonic(unsigned char *instruction, char *buf,
175 unsigned int len);
176
177unsigned long get_wchan(struct task_struct *p); 170unsigned long get_wchan(struct task_struct *p);
178#define task_pt_regs(tsk) ((struct pt_regs *) \ 171#define task_pt_regs(tsk) ((struct pt_regs *) \
179 (task_stack_page(tsk) + THREAD_SIZE) - 1) 172 (task_stack_page(tsk) + THREAD_SIZE) - 1)
180#define KSTK_EIP(tsk) (task_pt_regs(tsk)->psw.addr) 173#define KSTK_EIP(tsk) (task_pt_regs(tsk)->psw.addr)
181#define KSTK_ESP(tsk) (task_pt_regs(tsk)->gprs[15]) 174#define KSTK_ESP(tsk) (task_pt_regs(tsk)->gprs[15])
182 175
176/* Has task runtime instrumentation enabled ? */
177#define is_ri_task(tsk) (!!(tsk)->thread.ri_cb)
178
183static inline unsigned short stap(void) 179static inline unsigned short stap(void)
184{ 180{
185 unsigned short cpu_address; 181 unsigned short cpu_address;
@@ -198,6 +194,8 @@ static inline void cpu_relax(void)
198 barrier(); 194 barrier();
199} 195}
200 196
197#define arch_mutex_cpu_relax() barrier()
198
201static inline void psw_set_key(unsigned int key) 199static inline void psw_set_key(unsigned int key)
202{ 200{
203 asm volatile("spka 0(%0)" : : "d" (key)); 201 asm volatile("spka 0(%0)" : : "d" (key));
@@ -346,9 +344,9 @@ __set_psw_mask(unsigned long mask)
346} 344}
347 345
348#define local_mcck_enable() \ 346#define local_mcck_enable() \
349 __set_psw_mask(psw_kernel_bits | PSW_MASK_DAT | PSW_MASK_MCHECK) 347 __set_psw_mask(PSW_KERNEL_BITS | PSW_MASK_DAT | PSW_MASK_MCHECK)
350#define local_mcck_disable() \ 348#define local_mcck_disable() \
351 __set_psw_mask(psw_kernel_bits | PSW_MASK_DAT) 349 __set_psw_mask(PSW_KERNEL_BITS | PSW_MASK_DAT)
352 350
353/* 351/*
354 * Basic Machine Check/Program Check Handler. 352 * Basic Machine Check/Program Check Handler.
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h
index 52b56533c57c..9c82cebddabd 100644
--- a/arch/s390/include/asm/ptrace.h
+++ b/arch/s390/include/asm/ptrace.h
@@ -10,8 +10,11 @@
10 10
11#ifndef __ASSEMBLY__ 11#ifndef __ASSEMBLY__
12 12
13extern long psw_kernel_bits; 13#define PSW_KERNEL_BITS (PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_ASC_HOME | \
14extern long psw_user_bits; 14 PSW_MASK_EA | PSW_MASK_BA)
15#define PSW_USER_BITS (PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT | \
16 PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_MASK_MCHECK | \
17 PSW_MASK_PSTATE | PSW_ASC_PRIMARY)
15 18
16/* 19/*
17 * The pt_regs struct defines the way the registers are stored on 20 * The pt_regs struct defines the way the registers are stored on
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index 59880dbaf360..df802ee14af6 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -48,13 +48,6 @@ void detect_memory_layout(struct mem_chunk chunk[], unsigned long maxsize);
48void create_mem_hole(struct mem_chunk mem_chunk[], unsigned long addr, 48void create_mem_hole(struct mem_chunk mem_chunk[], unsigned long addr,
49 unsigned long size); 49 unsigned long size);
50 50
51#define PRIMARY_SPACE_MODE 0
52#define ACCESS_REGISTER_MODE 1
53#define SECONDARY_SPACE_MODE 2
54#define HOME_SPACE_MODE 3
55
56extern unsigned int s390_user_mode;
57
58/* 51/*
59 * Machine features detected in head.S 52 * Machine features detected in head.S
60 */ 53 */
diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h
index b64f15c3b4cc..ac9bed8e103f 100644
--- a/arch/s390/include/asm/smp.h
+++ b/arch/s390/include/asm/smp.h
@@ -14,7 +14,6 @@
14#define raw_smp_processor_id() (S390_lowcore.cpu_nr) 14#define raw_smp_processor_id() (S390_lowcore.cpu_nr)
15 15
16extern struct mutex smp_cpu_state_mutex; 16extern struct mutex smp_cpu_state_mutex;
17extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1];
18 17
19extern int __cpu_up(unsigned int cpu, struct task_struct *tidle); 18extern int __cpu_up(unsigned int cpu, struct task_struct *tidle);
20 19
diff --git a/arch/s390/include/asm/spinlock.h b/arch/s390/include/asm/spinlock.h
index 701fe8c59e1f..83e5d216105e 100644
--- a/arch/s390/include/asm/spinlock.h
+++ b/arch/s390/include/asm/spinlock.h
@@ -44,6 +44,11 @@ extern void arch_spin_lock_wait_flags(arch_spinlock_t *, unsigned long flags);
44extern int arch_spin_trylock_retry(arch_spinlock_t *); 44extern int arch_spin_trylock_retry(arch_spinlock_t *);
45extern void arch_spin_relax(arch_spinlock_t *lock); 45extern void arch_spin_relax(arch_spinlock_t *lock);
46 46
47static inline int arch_spin_value_unlocked(arch_spinlock_t lock)
48{
49 return lock.owner_cpu == 0;
50}
51
47static inline void arch_spin_lock(arch_spinlock_t *lp) 52static inline void arch_spin_lock(arch_spinlock_t *lp)
48{ 53{
49 int old; 54 int old;
diff --git a/arch/s390/include/asm/switch_to.h b/arch/s390/include/asm/switch_to.h
index 6dbd559763c9..29c81f82705e 100644
--- a/arch/s390/include/asm/switch_to.h
+++ b/arch/s390/include/asm/switch_to.h
@@ -13,58 +13,94 @@
13extern struct task_struct *__switch_to(void *, void *); 13extern struct task_struct *__switch_to(void *, void *);
14extern void update_cr_regs(struct task_struct *task); 14extern void update_cr_regs(struct task_struct *task);
15 15
16static inline void save_fp_regs(s390_fp_regs *fpregs) 16static inline int test_fp_ctl(u32 fpc)
17{ 17{
18 u32 orig_fpc;
19 int rc;
20
21 if (!MACHINE_HAS_IEEE)
22 return 0;
23
18 asm volatile( 24 asm volatile(
19 " std 0,%O0+8(%R0)\n" 25 " efpc %1\n"
20 " std 2,%O0+24(%R0)\n" 26 " sfpc %2\n"
21 " std 4,%O0+40(%R0)\n" 27 "0: sfpc %1\n"
22 " std 6,%O0+56(%R0)" 28 " la %0,0\n"
23 : "=Q" (*fpregs) : "Q" (*fpregs)); 29 "1:\n"
30 EX_TABLE(0b,1b)
31 : "=d" (rc), "=d" (orig_fpc)
32 : "d" (fpc), "0" (-EINVAL));
33 return rc;
34}
35
36static inline void save_fp_ctl(u32 *fpc)
37{
24 if (!MACHINE_HAS_IEEE) 38 if (!MACHINE_HAS_IEEE)
25 return; 39 return;
40
26 asm volatile( 41 asm volatile(
27 " stfpc %0\n" 42 " stfpc %0\n"
28 " std 1,%O0+16(%R0)\n" 43 : "+Q" (*fpc));
29 " std 3,%O0+32(%R0)\n"
30 " std 5,%O0+48(%R0)\n"
31 " std 7,%O0+64(%R0)\n"
32 " std 8,%O0+72(%R0)\n"
33 " std 9,%O0+80(%R0)\n"
34 " std 10,%O0+88(%R0)\n"
35 " std 11,%O0+96(%R0)\n"
36 " std 12,%O0+104(%R0)\n"
37 " std 13,%O0+112(%R0)\n"
38 " std 14,%O0+120(%R0)\n"
39 " std 15,%O0+128(%R0)\n"
40 : "=Q" (*fpregs) : "Q" (*fpregs));
41} 44}
42 45
43static inline void restore_fp_regs(s390_fp_regs *fpregs) 46static inline int restore_fp_ctl(u32 *fpc)
44{ 47{
48 int rc;
49
50 if (!MACHINE_HAS_IEEE)
51 return 0;
52
45 asm volatile( 53 asm volatile(
46 " ld 0,%O0+8(%R0)\n" 54 "0: lfpc %1\n"
47 " ld 2,%O0+24(%R0)\n" 55 " la %0,0\n"
48 " ld 4,%O0+40(%R0)\n" 56 "1:\n"
49 " ld 6,%O0+56(%R0)" 57 EX_TABLE(0b,1b)
50 : : "Q" (*fpregs)); 58 : "=d" (rc) : "Q" (*fpc), "0" (-EINVAL));
59 return rc;
60}
61
62static inline void save_fp_regs(freg_t *fprs)
63{
64 asm volatile("std 0,%0" : "=Q" (fprs[0]));
65 asm volatile("std 2,%0" : "=Q" (fprs[2]));
66 asm volatile("std 4,%0" : "=Q" (fprs[4]));
67 asm volatile("std 6,%0" : "=Q" (fprs[6]));
51 if (!MACHINE_HAS_IEEE) 68 if (!MACHINE_HAS_IEEE)
52 return; 69 return;
53 asm volatile( 70 asm volatile("std 1,%0" : "=Q" (fprs[1]));
54 " lfpc %0\n" 71 asm volatile("std 3,%0" : "=Q" (fprs[3]));
55 " ld 1,%O0+16(%R0)\n" 72 asm volatile("std 5,%0" : "=Q" (fprs[5]));
56 " ld 3,%O0+32(%R0)\n" 73 asm volatile("std 7,%0" : "=Q" (fprs[7]));
57 " ld 5,%O0+48(%R0)\n" 74 asm volatile("std 8,%0" : "=Q" (fprs[8]));
58 " ld 7,%O0+64(%R0)\n" 75 asm volatile("std 9,%0" : "=Q" (fprs[9]));
59 " ld 8,%O0+72(%R0)\n" 76 asm volatile("std 10,%0" : "=Q" (fprs[10]));
60 " ld 9,%O0+80(%R0)\n" 77 asm volatile("std 11,%0" : "=Q" (fprs[11]));
61 " ld 10,%O0+88(%R0)\n" 78 asm volatile("std 12,%0" : "=Q" (fprs[12]));
62 " ld 11,%O0+96(%R0)\n" 79 asm volatile("std 13,%0" : "=Q" (fprs[13]));
63 " ld 12,%O0+104(%R0)\n" 80 asm volatile("std 14,%0" : "=Q" (fprs[14]));
64 " ld 13,%O0+112(%R0)\n" 81 asm volatile("std 15,%0" : "=Q" (fprs[15]));
65 " ld 14,%O0+120(%R0)\n" 82}
66 " ld 15,%O0+128(%R0)\n" 83
67 : : "Q" (*fpregs)); 84static inline void restore_fp_regs(freg_t *fprs)
85{
86 asm volatile("ld 0,%0" : : "Q" (fprs[0]));
87 asm volatile("ld 2,%0" : : "Q" (fprs[2]));
88 asm volatile("ld 4,%0" : : "Q" (fprs[4]));
89 asm volatile("ld 6,%0" : : "Q" (fprs[6]));
90 if (!MACHINE_HAS_IEEE)
91 return;
92 asm volatile("ld 1,%0" : : "Q" (fprs[1]));
93 asm volatile("ld 3,%0" : : "Q" (fprs[3]));
94 asm volatile("ld 5,%0" : : "Q" (fprs[5]));
95 asm volatile("ld 7,%0" : : "Q" (fprs[7]));
96 asm volatile("ld 8,%0" : : "Q" (fprs[8]));
97 asm volatile("ld 9,%0" : : "Q" (fprs[9]));
98 asm volatile("ld 10,%0" : : "Q" (fprs[10]));
99 asm volatile("ld 11,%0" : : "Q" (fprs[11]));
100 asm volatile("ld 12,%0" : : "Q" (fprs[12]));
101 asm volatile("ld 13,%0" : : "Q" (fprs[13]));
102 asm volatile("ld 14,%0" : : "Q" (fprs[14]));
103 asm volatile("ld 15,%0" : : "Q" (fprs[15]));
68} 104}
69 105
70static inline void save_access_regs(unsigned int *acrs) 106static inline void save_access_regs(unsigned int *acrs)
@@ -83,12 +119,14 @@ static inline void restore_access_regs(unsigned int *acrs)
83 119
84#define switch_to(prev,next,last) do { \ 120#define switch_to(prev,next,last) do { \
85 if (prev->mm) { \ 121 if (prev->mm) { \
86 save_fp_regs(&prev->thread.fp_regs); \ 122 save_fp_ctl(&prev->thread.fp_regs.fpc); \
123 save_fp_regs(prev->thread.fp_regs.fprs); \
87 save_access_regs(&prev->thread.acrs[0]); \ 124 save_access_regs(&prev->thread.acrs[0]); \
88 save_ri_cb(prev->thread.ri_cb); \ 125 save_ri_cb(prev->thread.ri_cb); \
89 } \ 126 } \
90 if (next->mm) { \ 127 if (next->mm) { \
91 restore_fp_regs(&next->thread.fp_regs); \ 128 restore_fp_ctl(&next->thread.fp_regs.fpc); \
129 restore_fp_regs(next->thread.fp_regs.fprs); \
92 restore_access_regs(&next->thread.acrs[0]); \ 130 restore_access_regs(&next->thread.acrs[0]); \
93 restore_ri_cb(next->thread.ri_cb, prev->thread.ri_cb); \ 131 restore_ri_cb(next->thread.ri_cb, prev->thread.ri_cb); \
94 update_cr_regs(next); \ 132 update_cr_regs(next); \
diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
index 8ad8af915032..8beee1cceba4 100644
--- a/arch/s390/include/asm/timex.h
+++ b/arch/s390/include/asm/timex.h
@@ -71,30 +71,32 @@ static inline void local_tick_enable(unsigned long long comp)
71 71
72typedef unsigned long long cycles_t; 72typedef unsigned long long cycles_t;
73 73
74static inline unsigned long long get_tod_clock(void) 74static inline void get_tod_clock_ext(char clk[16])
75{ 75{
76 unsigned long long clk; 76 typedef struct { char _[sizeof(clk)]; } addrtype;
77
78#ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES
79 asm volatile(".insn s,0xb27c0000,%0" : "=Q" (clk) : : "cc");
80#else
81 asm volatile("stck %0" : "=Q" (clk) : : "cc");
82#endif
83 return clk;
84}
85 77
86static inline void get_tod_clock_ext(char *clk) 78 asm volatile("stcke %0" : "=Q" (*(addrtype *) clk) : : "cc");
87{
88 asm volatile("stcke %0" : "=Q" (*clk) : : "cc");
89} 79}
90 80
91static inline unsigned long long get_tod_clock_xt(void) 81static inline unsigned long long get_tod_clock(void)
92{ 82{
93 unsigned char clk[16]; 83 unsigned char clk[16];
94 get_tod_clock_ext(clk); 84 get_tod_clock_ext(clk);
95 return *((unsigned long long *)&clk[1]); 85 return *((unsigned long long *)&clk[1]);
96} 86}
97 87
88static inline unsigned long long get_tod_clock_fast(void)
89{
90#ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES
91 unsigned long long clk;
92
93 asm volatile("stckf %0" : "=Q" (clk) : : "cc");
94 return clk;
95#else
96 return get_tod_clock();
97#endif
98}
99
98static inline cycles_t get_cycles(void) 100static inline cycles_t get_cycles(void)
99{ 101{
100 return (cycles_t) get_tod_clock() >> 2; 102 return (cycles_t) get_tod_clock() >> 2;
@@ -125,7 +127,7 @@ extern u64 sched_clock_base_cc;
125 */ 127 */
126static inline unsigned long long get_tod_clock_monotonic(void) 128static inline unsigned long long get_tod_clock_monotonic(void)
127{ 129{
128 return get_tod_clock_xt() - sched_clock_base_cc; 130 return get_tod_clock() - sched_clock_base_cc;
129} 131}
130 132
131/** 133/**
diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h
index 9c33ed4e666f..79330af9a5f8 100644
--- a/arch/s390/include/asm/uaccess.h
+++ b/arch/s390/include/asm/uaccess.h
@@ -94,9 +94,7 @@ static inline unsigned long extable_fixup(const struct exception_table_entry *x)
94 94
95struct uaccess_ops { 95struct uaccess_ops {
96 size_t (*copy_from_user)(size_t, const void __user *, void *); 96 size_t (*copy_from_user)(size_t, const void __user *, void *);
97 size_t (*copy_from_user_small)(size_t, const void __user *, void *);
98 size_t (*copy_to_user)(size_t, void __user *, const void *); 97 size_t (*copy_to_user)(size_t, void __user *, const void *);
99 size_t (*copy_to_user_small)(size_t, void __user *, const void *);
100 size_t (*copy_in_user)(size_t, void __user *, const void __user *); 98 size_t (*copy_in_user)(size_t, void __user *, const void __user *);
101 size_t (*clear_user)(size_t, void __user *); 99 size_t (*clear_user)(size_t, void __user *);
102 size_t (*strnlen_user)(size_t, const char __user *); 100 size_t (*strnlen_user)(size_t, const char __user *);
@@ -106,22 +104,20 @@ struct uaccess_ops {
106}; 104};
107 105
108extern struct uaccess_ops uaccess; 106extern struct uaccess_ops uaccess;
109extern struct uaccess_ops uaccess_std;
110extern struct uaccess_ops uaccess_mvcos; 107extern struct uaccess_ops uaccess_mvcos;
111extern struct uaccess_ops uaccess_mvcos_switch;
112extern struct uaccess_ops uaccess_pt; 108extern struct uaccess_ops uaccess_pt;
113 109
114extern int __handle_fault(unsigned long, unsigned long, int); 110extern int __handle_fault(unsigned long, unsigned long, int);
115 111
116static inline int __put_user_fn(size_t size, void __user *ptr, void *x) 112static inline int __put_user_fn(size_t size, void __user *ptr, void *x)
117{ 113{
118 size = uaccess.copy_to_user_small(size, ptr, x); 114 size = uaccess.copy_to_user(size, ptr, x);
119 return size ? -EFAULT : size; 115 return size ? -EFAULT : size;
120} 116}
121 117
122static inline int __get_user_fn(size_t size, const void __user *ptr, void *x) 118static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
123{ 119{
124 size = uaccess.copy_from_user_small(size, ptr, x); 120 size = uaccess.copy_from_user(size, ptr, x);
125 return size ? -EFAULT : size; 121 return size ? -EFAULT : size;
126} 122}
127 123
@@ -226,10 +222,7 @@ extern int __get_user_bad(void) __attribute__((noreturn));
226static inline unsigned long __must_check 222static inline unsigned long __must_check
227__copy_to_user(void __user *to, const void *from, unsigned long n) 223__copy_to_user(void __user *to, const void *from, unsigned long n)
228{ 224{
229 if (__builtin_constant_p(n) && (n <= 256)) 225 return uaccess.copy_to_user(n, to, from);
230 return uaccess.copy_to_user_small(n, to, from);
231 else
232 return uaccess.copy_to_user(n, to, from);
233} 226}
234 227
235#define __copy_to_user_inatomic __copy_to_user 228#define __copy_to_user_inatomic __copy_to_user
@@ -275,10 +268,7 @@ copy_to_user(void __user *to, const void *from, unsigned long n)
275static inline unsigned long __must_check 268static inline unsigned long __must_check
276__copy_from_user(void *to, const void __user *from, unsigned long n) 269__copy_from_user(void *to, const void __user *from, unsigned long n)
277{ 270{
278 if (__builtin_constant_p(n) && (n <= 256)) 271 return uaccess.copy_from_user(n, from, to);
279 return uaccess.copy_from_user_small(n, from, to);
280 else
281 return uaccess.copy_from_user(n, from, to);
282} 272}
283 273
284extern void copy_from_user_overflow(void) 274extern void copy_from_user_overflow(void)
diff --git a/arch/s390/include/uapi/asm/ptrace.h b/arch/s390/include/uapi/asm/ptrace.h
index 7a84619e315e..7e0b498a2c2b 100644
--- a/arch/s390/include/uapi/asm/ptrace.h
+++ b/arch/s390/include/uapi/asm/ptrace.h
@@ -199,6 +199,7 @@ typedef union
199typedef struct 199typedef struct
200{ 200{
201 __u32 fpc; 201 __u32 fpc;
202 __u32 pad;
202 freg_t fprs[NUM_FPRS]; 203 freg_t fprs[NUM_FPRS];
203} s390_fp_regs; 204} s390_fp_regs;
204 205
@@ -206,7 +207,6 @@ typedef struct
206#define FPC_FLAGS_MASK 0x00F80000 207#define FPC_FLAGS_MASK 0x00F80000
207#define FPC_DXC_MASK 0x0000FF00 208#define FPC_DXC_MASK 0x0000FF00
208#define FPC_RM_MASK 0x00000003 209#define FPC_RM_MASK 0x00000003
209#define FPC_VALID_MASK 0xF8F8FF03
210 210
211/* this typedef defines how a Program Status Word looks like */ 211/* this typedef defines how a Program Status Word looks like */
212typedef struct 212typedef struct
@@ -263,7 +263,7 @@ typedef struct
263#define PSW_MASK_EA 0x0000000100000000UL 263#define PSW_MASK_EA 0x0000000100000000UL
264#define PSW_MASK_BA 0x0000000080000000UL 264#define PSW_MASK_BA 0x0000000080000000UL
265 265
266#define PSW_MASK_USER 0x0000FF8180000000UL 266#define PSW_MASK_USER 0x0000FF0180000000UL
267 267
268#define PSW_ADDR_AMODE 0x0000000000000000UL 268#define PSW_ADDR_AMODE 0x0000000000000000UL
269#define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL 269#define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL
diff --git a/arch/s390/include/uapi/asm/sigcontext.h b/arch/s390/include/uapi/asm/sigcontext.h
index 584787f6ce44..b30de9c01bbe 100644
--- a/arch/s390/include/uapi/asm/sigcontext.h
+++ b/arch/s390/include/uapi/asm/sigcontext.h
@@ -49,6 +49,7 @@ typedef struct
49typedef struct 49typedef struct
50{ 50{
51 unsigned int fpc; 51 unsigned int fpc;
52 unsigned int pad;
52 double fprs[__NUM_FPRS]; 53 double fprs[__NUM_FPRS];
53} _s390_fp_regs; 54} _s390_fp_regs;
54 55
diff --git a/arch/s390/include/uapi/asm/socket.h b/arch/s390/include/uapi/asm/socket.h
index 92494494692e..c286c2e868f0 100644
--- a/arch/s390/include/uapi/asm/socket.h
+++ b/arch/s390/include/uapi/asm/socket.h
@@ -82,4 +82,6 @@
82 82
83#define SO_BUSY_POLL 46 83#define SO_BUSY_POLL 46
84 84
85#define SO_MAX_PACING_RATE 47
86
85#endif /* _ASM_SOCKET_H */ 87#endif /* _ASM_SOCKET_H */
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 4bb2a4656163..2403303cfed7 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -28,7 +28,7 @@ CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'
28 28
29CFLAGS_sysinfo.o += -Iinclude/math-emu -Iarch/s390/math-emu -w 29CFLAGS_sysinfo.o += -Iinclude/math-emu -Iarch/s390/math-emu -w
30 30
31obj-y := bitmap.o traps.o time.o process.o base.o early.o setup.o vtime.o 31obj-y := traps.o time.o process.o base.o early.o setup.o vtime.o
32obj-y += processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o nmi.o 32obj-y += processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o nmi.o
33obj-y += debug.o irq.o ipl.o dis.o diag.o sclp.o vdso.o 33obj-y += debug.o irq.o ipl.o dis.o diag.o sclp.o vdso.o
34obj-y += sysinfo.o jump_label.o lgr.o os_info.o machine_kexec.o pgm_check.o 34obj-y += sysinfo.o jump_label.o lgr.o os_info.o machine_kexec.o pgm_check.o
diff --git a/arch/s390/kernel/bitmap.c b/arch/s390/kernel/bitmap.c
deleted file mode 100644
index 102da5e23037..000000000000
--- a/arch/s390/kernel/bitmap.c
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * Bitmaps for set_bit, clear_bit, test_and_set_bit, ...
3 * See include/asm/{bitops.h|posix_types.h} for details
4 *
5 * Copyright IBM Corp. 1999, 2009
6 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>,
7 */
8
9#include <linux/bitops.h>
10#include <linux/module.h>
11
12const char _oi_bitmap[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
13EXPORT_SYMBOL(_oi_bitmap);
14
15const char _ni_bitmap[] = { 0xfe, 0xfd, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, 0x7f };
16EXPORT_SYMBOL(_ni_bitmap);
17
18const char _zb_findmap[] = {
19 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
20 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,
21 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
22 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,
23 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
24 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,
25 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
26 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,
27 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
28 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,
29 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
30 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,
31 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
32 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,
33 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
34 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,8 };
35EXPORT_SYMBOL(_zb_findmap);
36
37const char _sb_findmap[] = {
38 8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
39 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
40 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
41 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
42 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
43 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
44 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
45 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
46 7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
47 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
48 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
49 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
50 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
51 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
52 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
53 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 };
54EXPORT_SYMBOL(_sb_findmap);
diff --git a/arch/s390/kernel/cache.c b/arch/s390/kernel/cache.c
index dd62071624be..3a414c0f93ed 100644
--- a/arch/s390/kernel/cache.c
+++ b/arch/s390/kernel/cache.c
@@ -146,15 +146,14 @@ static void __init cache_build_info(void)
146 ct.raw = ecag(EXTRACT_TOPOLOGY, 0, 0); 146 ct.raw = ecag(EXTRACT_TOPOLOGY, 0, 0);
147 for (level = 0; level < CACHE_MAX_LEVEL; level++) { 147 for (level = 0; level < CACHE_MAX_LEVEL; level++) {
148 switch (ct.ci[level].scope) { 148 switch (ct.ci[level].scope) {
149 case CACHE_SCOPE_NOTEXISTS:
150 case CACHE_SCOPE_RESERVED:
151 return;
152 case CACHE_SCOPE_SHARED: 149 case CACHE_SCOPE_SHARED:
153 private = 0; 150 private = 0;
154 break; 151 break;
155 case CACHE_SCOPE_PRIVATE: 152 case CACHE_SCOPE_PRIVATE:
156 private = 1; 153 private = 1;
157 break; 154 break;
155 default:
156 return;
158 } 157 }
159 if (ct.ci[level].type == CACHE_TYPE_SEPARATE) { 158 if (ct.ci[level].type == CACHE_TYPE_SEPARATE) {
160 rc = cache_add(level, private, CACHE_TYPE_DATA); 159 rc = cache_add(level, private, CACHE_TYPE_DATA);
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 1f1b8c70ab97..e030d2bdec1b 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -58,10 +58,6 @@
58 58
59#include "compat_linux.h" 59#include "compat_linux.h"
60 60
61u32 psw32_user_bits = PSW32_MASK_DAT | PSW32_MASK_IO | PSW32_MASK_EXT |
62 PSW32_DEFAULT_KEY | PSW32_MASK_BASE | PSW32_MASK_MCHECK |
63 PSW32_MASK_PSTATE | PSW32_ASC_HOME;
64
65/* For this source file, we want overflow handling. */ 61/* For this source file, we want overflow handling. */
66 62
67#undef high2lowuid 63#undef high2lowuid
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index 976518c0592a..1bfda3eca379 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -27,6 +27,7 @@ typedef union
27typedef struct 27typedef struct
28{ 28{
29 unsigned int fpc; 29 unsigned int fpc;
30 unsigned int pad;
30 freg_t32 fprs[__NUM_FPRS]; 31 freg_t32 fprs[__NUM_FPRS];
31} _s390_fp_regs32; 32} _s390_fp_regs32;
32 33
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index 1389b637dae5..6e2442978409 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -49,7 +49,7 @@ typedef struct
49 __u32 gprs_high[NUM_GPRS]; 49 __u32 gprs_high[NUM_GPRS];
50} rt_sigframe32; 50} rt_sigframe32;
51 51
52int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) 52int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
53{ 53{
54 int err; 54 int err;
55 55
@@ -99,7 +99,7 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
99 break; 99 break;
100 } 100 }
101 } 101 }
102 return err; 102 return err ? -EFAULT : 0;
103} 103}
104 104
105int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) 105int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
@@ -148,62 +148,71 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
148 break; 148 break;
149 } 149 }
150 } 150 }
151 return err; 151 return err ? -EFAULT : 0;
152} 152}
153 153
154static int save_sigregs32(struct pt_regs *regs, _sigregs32 __user *sregs) 154static int save_sigregs32(struct pt_regs *regs, _sigregs32 __user *sregs)
155{ 155{
156 _s390_regs_common32 regs32; 156 _sigregs32 user_sregs;
157 int err, i; 157 int i;
158 158
159 regs32.psw.mask = psw32_user_bits | 159 user_sregs.regs.psw.mask = (__u32)(regs->psw.mask >> 32);
160 ((__u32)(regs->psw.mask >> 32) & PSW32_MASK_USER); 160 user_sregs.regs.psw.mask &= PSW32_MASK_USER | PSW32_MASK_RI;
161 regs32.psw.addr = (__u32) regs->psw.addr | 161 user_sregs.regs.psw.mask |= PSW32_USER_BITS;
162 user_sregs.regs.psw.addr = (__u32) regs->psw.addr |
162 (__u32)(regs->psw.mask & PSW_MASK_BA); 163 (__u32)(regs->psw.mask & PSW_MASK_BA);
163 for (i = 0; i < NUM_GPRS; i++) 164 for (i = 0; i < NUM_GPRS; i++)
164 regs32.gprs[i] = (__u32) regs->gprs[i]; 165 user_sregs.regs.gprs[i] = (__u32) regs->gprs[i];
165 save_access_regs(current->thread.acrs); 166 save_access_regs(current->thread.acrs);
166 memcpy(regs32.acrs, current->thread.acrs, sizeof(regs32.acrs)); 167 memcpy(&user_sregs.regs.acrs, current->thread.acrs,
167 err = __copy_to_user(&sregs->regs, &regs32, sizeof(regs32)); 168 sizeof(user_sregs.regs.acrs));
168 if (err) 169 save_fp_ctl(&current->thread.fp_regs.fpc);
169 return err; 170 save_fp_regs(current->thread.fp_regs.fprs);
170 save_fp_regs(&current->thread.fp_regs); 171 memcpy(&user_sregs.fpregs, &current->thread.fp_regs,
171 /* s390_fp_regs and _s390_fp_regs32 are the same ! */ 172 sizeof(user_sregs.fpregs));
172 return __copy_to_user(&sregs->fpregs, &current->thread.fp_regs, 173 if (__copy_to_user(sregs, &user_sregs, sizeof(_sigregs32)))
173 sizeof(_s390_fp_regs32)); 174 return -EFAULT;
175 return 0;
174} 176}
175 177
176static int restore_sigregs32(struct pt_regs *regs,_sigregs32 __user *sregs) 178static int restore_sigregs32(struct pt_regs *regs,_sigregs32 __user *sregs)
177{ 179{
178 _s390_regs_common32 regs32; 180 _sigregs32 user_sregs;
179 int err, i; 181 int i;
180 182
181 /* Alwys make any pending restarted system call return -EINTR */ 183 /* Alwys make any pending restarted system call return -EINTR */
182 current_thread_info()->restart_block.fn = do_no_restart_syscall; 184 current_thread_info()->restart_block.fn = do_no_restart_syscall;
183 185
184 err = __copy_from_user(&regs32, &sregs->regs, sizeof(regs32)); 186 if (__copy_from_user(&user_sregs, &sregs->regs, sizeof(user_sregs)))
185 if (err) 187 return -EFAULT;
186 return err; 188
189 if (!is_ri_task(current) && (user_sregs.regs.psw.mask & PSW32_MASK_RI))
190 return -EINVAL;
191
192 /* Loading the floating-point-control word can fail. Do that first. */
193 if (restore_fp_ctl(&user_sregs.fpregs.fpc))
194 return -EINVAL;
195
196 /* Use regs->psw.mask instead of PSW_USER_BITS to preserve PER bit. */
187 regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) | 197 regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) |
188 (__u64)(regs32.psw.mask & PSW32_MASK_USER) << 32 | 198 (__u64)(user_sregs.regs.psw.mask & PSW32_MASK_USER) << 32 |
189 (__u64)(regs32.psw.addr & PSW32_ADDR_AMODE); 199 (__u64)(user_sregs.regs.psw.mask & PSW32_MASK_RI) << 32 |
200 (__u64)(user_sregs.regs.psw.addr & PSW32_ADDR_AMODE);
190 /* Check for invalid user address space control. */ 201 /* Check for invalid user address space control. */
191 if ((regs->psw.mask & PSW_MASK_ASC) >= (psw_kernel_bits & PSW_MASK_ASC)) 202 if ((regs->psw.mask & PSW_MASK_ASC) == PSW_ASC_HOME)
192 regs->psw.mask = (psw_user_bits & PSW_MASK_ASC) | 203 regs->psw.mask = PSW_ASC_PRIMARY |
193 (regs->psw.mask & ~PSW_MASK_ASC); 204 (regs->psw.mask & ~PSW_MASK_ASC);
194 regs->psw.addr = (__u64)(regs32.psw.addr & PSW32_ADDR_INSN); 205 regs->psw.addr = (__u64)(user_sregs.regs.psw.addr & PSW32_ADDR_INSN);
195 for (i = 0; i < NUM_GPRS; i++) 206 for (i = 0; i < NUM_GPRS; i++)
196 regs->gprs[i] = (__u64) regs32.gprs[i]; 207 regs->gprs[i] = (__u64) user_sregs.regs.gprs[i];
197 memcpy(current->thread.acrs, regs32.acrs, sizeof(current->thread.acrs)); 208 memcpy(&current->thread.acrs, &user_sregs.regs.acrs,
209 sizeof(current->thread.acrs));
198 restore_access_regs(current->thread.acrs); 210 restore_access_regs(current->thread.acrs);
199 211
200 err = __copy_from_user(&current->thread.fp_regs, &sregs->fpregs, 212 memcpy(&current->thread.fp_regs, &user_sregs.fpregs,
201 sizeof(_s390_fp_regs32)); 213 sizeof(current->thread.fp_regs));
202 current->thread.fp_regs.fpc &= FPC_VALID_MASK;
203 if (err)
204 return err;
205 214
206 restore_fp_regs(&current->thread.fp_regs); 215 restore_fp_regs(current->thread.fp_regs.fprs);
207 clear_thread_flag(TIF_SYSCALL); /* No longer in a system call */ 216 clear_thread_flag(TIF_SYSCALL); /* No longer in a system call */
208 return 0; 217 return 0;
209} 218}
@@ -215,18 +224,18 @@ static int save_sigregs_gprs_high(struct pt_regs *regs, __u32 __user *uregs)
215 224
216 for (i = 0; i < NUM_GPRS; i++) 225 for (i = 0; i < NUM_GPRS; i++)
217 gprs_high[i] = regs->gprs[i] >> 32; 226 gprs_high[i] = regs->gprs[i] >> 32;
218 227 if (__copy_to_user(uregs, &gprs_high, sizeof(gprs_high)))
219 return __copy_to_user(uregs, &gprs_high, sizeof(gprs_high)); 228 return -EFAULT;
229 return 0;
220} 230}
221 231
222static int restore_sigregs_gprs_high(struct pt_regs *regs, __u32 __user *uregs) 232static int restore_sigregs_gprs_high(struct pt_regs *regs, __u32 __user *uregs)
223{ 233{
224 __u32 gprs_high[NUM_GPRS]; 234 __u32 gprs_high[NUM_GPRS];
225 int err, i; 235 int i;
226 236
227 err = __copy_from_user(&gprs_high, uregs, sizeof(gprs_high)); 237 if (__copy_from_user(&gprs_high, uregs, sizeof(gprs_high)))
228 if (err) 238 return -EFAULT;
229 return err;
230 for (i = 0; i < NUM_GPRS; i++) 239 for (i = 0; i < NUM_GPRS; i++)
231 *(__u32 *)&regs->gprs[i] = gprs_high[i]; 240 *(__u32 *)&regs->gprs[i] = gprs_high[i];
232 return 0; 241 return 0;
@@ -348,7 +357,7 @@ static int setup_frame32(int sig, struct k_sigaction *ka,
348 regs->gprs[15] = (__force __u64) frame; 357 regs->gprs[15] = (__force __u64) frame;
349 /* Force 31 bit amode and default user address space control. */ 358 /* Force 31 bit amode and default user address space control. */
350 regs->psw.mask = PSW_MASK_BA | 359 regs->psw.mask = PSW_MASK_BA |
351 (psw_user_bits & PSW_MASK_ASC) | 360 (PSW_USER_BITS & PSW_MASK_ASC) |
352 (regs->psw.mask & ~PSW_MASK_ASC); 361 (regs->psw.mask & ~PSW_MASK_ASC);
353 regs->psw.addr = (__force __u64) ka->sa.sa_handler; 362 regs->psw.addr = (__force __u64) ka->sa.sa_handler;
354 363
@@ -415,7 +424,7 @@ static int setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info,
415 regs->gprs[15] = (__force __u64) frame; 424 regs->gprs[15] = (__force __u64) frame;
416 /* Force 31 bit amode and default user address space control. */ 425 /* Force 31 bit amode and default user address space control. */
417 regs->psw.mask = PSW_MASK_BA | 426 regs->psw.mask = PSW_MASK_BA |
418 (psw_user_bits & PSW_MASK_ASC) | 427 (PSW_USER_BITS & PSW_MASK_ASC) |
419 (regs->psw.mask & ~PSW_MASK_ASC); 428 (regs->psw.mask & ~PSW_MASK_ASC);
420 regs->psw.addr = (__u64 __force) ka->sa.sa_handler; 429 regs->psw.addr = (__u64 __force) ka->sa.sa_handler;
421 430
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
index c84f33d51f7b..f45b2ab0cb81 100644
--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -22,6 +22,32 @@
22#define PTR_SUB(x, y) (((char *) (x)) - ((unsigned long) (y))) 22#define PTR_SUB(x, y) (((char *) (x)) - ((unsigned long) (y)))
23#define PTR_DIFF(x, y) ((unsigned long)(((char *) (x)) - ((unsigned long) (y)))) 23#define PTR_DIFF(x, y) ((unsigned long)(((char *) (x)) - ((unsigned long) (y))))
24 24
25struct dump_save_areas dump_save_areas;
26
27/*
28 * Allocate and add a save area for a CPU
29 */
30struct save_area *dump_save_area_create(int cpu)
31{
32 struct save_area **save_areas, *save_area;
33
34 save_area = kmalloc(sizeof(*save_area), GFP_KERNEL);
35 if (!save_area)
36 return NULL;
37 if (cpu + 1 > dump_save_areas.count) {
38 dump_save_areas.count = cpu + 1;
39 save_areas = krealloc(dump_save_areas.areas,
40 dump_save_areas.count * sizeof(void *),
41 GFP_KERNEL | __GFP_ZERO);
42 if (!save_areas) {
43 kfree(save_area);
44 return NULL;
45 }
46 dump_save_areas.areas = save_areas;
47 }
48 dump_save_areas.areas[cpu] = save_area;
49 return save_area;
50}
25 51
26/* 52/*
27 * Return physical address for virtual address 53 * Return physical address for virtual address
@@ -40,28 +66,25 @@ static inline void *load_real_addr(void *addr)
40} 66}
41 67
42/* 68/*
43 * Copy up to one page to vmalloc or real memory 69 * Copy real to virtual or real memory
44 */ 70 */
45static ssize_t copy_page_real(void *buf, void *src, size_t csize) 71static int copy_from_realmem(void *dest, void *src, size_t count)
46{ 72{
47 size_t size; 73 unsigned long size;
48 74
49 if (is_vmalloc_addr(buf)) { 75 if (!count)
50 BUG_ON(csize >= PAGE_SIZE); 76 return 0;
51 /* If buf is not page aligned, copy first part */ 77 if (!is_vmalloc_or_module_addr(dest))
52 size = min(roundup(__pa(buf), PAGE_SIZE) - __pa(buf), csize); 78 return memcpy_real(dest, src, count);
53 if (size) { 79 do {
54 if (memcpy_real(load_real_addr(buf), src, size)) 80 size = min(count, PAGE_SIZE - (__pa(dest) & ~PAGE_MASK));
55 return -EFAULT; 81 if (memcpy_real(load_real_addr(dest), src, size))
56 buf += size; 82 return -EFAULT;
57 src += size; 83 count -= size;
58 } 84 dest += size;
59 /* Copy second part */ 85 src += size;
60 size = csize - size; 86 } while (count);
61 return (size) ? memcpy_real(load_real_addr(buf), src, size) : 0; 87 return 0;
62 } else {
63 return memcpy_real(buf, src, csize);
64 }
65} 88}
66 89
67/* 90/*
@@ -114,7 +137,7 @@ static ssize_t copy_oldmem_page_kdump(char *buf, size_t csize,
114 rc = copy_to_user_real((void __force __user *) buf, 137 rc = copy_to_user_real((void __force __user *) buf,
115 (void *) src, csize); 138 (void *) src, csize);
116 else 139 else
117 rc = copy_page_real(buf, (void *) src, csize); 140 rc = copy_from_realmem(buf, (void *) src, csize);
118 return (rc == 0) ? rc : csize; 141 return (rc == 0) ? rc : csize;
119} 142}
120 143
@@ -210,7 +233,7 @@ int copy_from_oldmem(void *dest, void *src, size_t count)
210 if (OLDMEM_BASE) { 233 if (OLDMEM_BASE) {
211 if ((unsigned long) src < OLDMEM_SIZE) { 234 if ((unsigned long) src < OLDMEM_SIZE) {
212 copied = min(count, OLDMEM_SIZE - (unsigned long) src); 235 copied = min(count, OLDMEM_SIZE - (unsigned long) src);
213 rc = memcpy_real(dest, src + OLDMEM_BASE, copied); 236 rc = copy_from_realmem(dest, src + OLDMEM_BASE, copied);
214 if (rc) 237 if (rc)
215 return rc; 238 return rc;
216 } 239 }
@@ -223,7 +246,7 @@ int copy_from_oldmem(void *dest, void *src, size_t count)
223 return rc; 246 return rc;
224 } 247 }
225 } 248 }
226 return memcpy_real(dest + copied, src + copied, count - copied); 249 return copy_from_realmem(dest + copied, src + copied, count - copied);
227} 250}
228 251
229/* 252/*
@@ -453,8 +476,8 @@ static int get_cpu_cnt(void)
453{ 476{
454 int i, cpus = 0; 477 int i, cpus = 0;
455 478
456 for (i = 0; zfcpdump_save_areas[i]; i++) { 479 for (i = 0; i < dump_save_areas.count; i++) {
457 if (zfcpdump_save_areas[i]->pref_reg == 0) 480 if (dump_save_areas.areas[i]->pref_reg == 0)
458 continue; 481 continue;
459 cpus++; 482 cpus++;
460 } 483 }
@@ -525,8 +548,8 @@ static void *notes_init(Elf64_Phdr *phdr, void *ptr, u64 notes_offset)
525 548
526 ptr = nt_prpsinfo(ptr); 549 ptr = nt_prpsinfo(ptr);
527 550
528 for (i = 0; zfcpdump_save_areas[i]; i++) { 551 for (i = 0; i < dump_save_areas.count; i++) {
529 sa = zfcpdump_save_areas[i]; 552 sa = dump_save_areas.areas[i];
530 if (sa->pref_reg == 0) 553 if (sa->pref_reg == 0)
531 continue; 554 continue;
532 ptr = fill_cpu_elf_notes(ptr, sa); 555 ptr = fill_cpu_elf_notes(ptr, sa);
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index f1279dc2e1bc..ee8390da6ea7 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -867,7 +867,7 @@ static inline void
867debug_finish_entry(debug_info_t * id, debug_entry_t* active, int level, 867debug_finish_entry(debug_info_t * id, debug_entry_t* active, int level,
868 int exception) 868 int exception)
869{ 869{
870 active->id.stck = get_tod_clock(); 870 active->id.stck = get_tod_clock_fast();
871 active->id.fields.cpuid = smp_processor_id(); 871 active->id.fields.cpuid = smp_processor_id();
872 active->caller = __builtin_return_address(0); 872 active->caller = __builtin_return_address(0);
873 active->id.fields.exception = exception; 873 active->id.fields.exception = exception;
@@ -889,7 +889,7 @@ static int debug_active=1;
889 * if debug_active is already off 889 * if debug_active is already off
890 */ 890 */
891static int 891static int
892s390dbf_procactive(ctl_table *table, int write, 892s390dbf_procactive(struct ctl_table *table, int write,
893 void __user *buffer, size_t *lenp, loff_t *ppos) 893 void __user *buffer, size_t *lenp, loff_t *ppos)
894{ 894{
895 if (!write || debug_stoppable || !debug_active) 895 if (!write || debug_stoppable || !debug_active)
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
index be87d3e05a5b..993efe6a887c 100644
--- a/arch/s390/kernel/dis.c
+++ b/arch/s390/kernel/dis.c
@@ -23,6 +23,7 @@
23#include <linux/kdebug.h> 23#include <linux/kdebug.h>
24 24
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/dis.h>
26#include <asm/io.h> 27#include <asm/io.h>
27#include <linux/atomic.h> 28#include <linux/atomic.h>
28#include <asm/mathemu.h> 29#include <asm/mathemu.h>
@@ -37,17 +38,6 @@
37#define ONELONG "%016lx: " 38#define ONELONG "%016lx: "
38#endif /* CONFIG_64BIT */ 39#endif /* CONFIG_64BIT */
39 40
40#define OPERAND_GPR 0x1 /* Operand printed as %rx */
41#define OPERAND_FPR 0x2 /* Operand printed as %fx */
42#define OPERAND_AR 0x4 /* Operand printed as %ax */
43#define OPERAND_CR 0x8 /* Operand printed as %cx */
44#define OPERAND_DISP 0x10 /* Operand printed as displacement */
45#define OPERAND_BASE 0x20 /* Operand printed as base register */
46#define OPERAND_INDEX 0x40 /* Operand printed as index register */
47#define OPERAND_PCREL 0x80 /* Operand printed as pc-relative symbol */
48#define OPERAND_SIGNED 0x100 /* Operand printed as signed value */
49#define OPERAND_LENGTH 0x200 /* Operand printed as length (+1) */
50
51enum { 41enum {
52 UNUSED, /* Indicates the end of the operand list */ 42 UNUSED, /* Indicates the end of the operand list */
53 R_8, /* GPR starting at position 8 */ 43 R_8, /* GPR starting at position 8 */
@@ -155,19 +145,7 @@ enum {
155 INSTR_S_00, INSTR_S_RD, 145 INSTR_S_00, INSTR_S_RD,
156}; 146};
157 147
158struct operand { 148static const struct s390_operand operands[] =
159 int bits; /* The number of bits in the operand. */
160 int shift; /* The number of bits to shift. */
161 int flags; /* One bit syntax flags. */
162};
163
164struct insn {
165 const char name[5];
166 unsigned char opfrag;
167 unsigned char format;
168};
169
170static const struct operand operands[] =
171{ 149{
172 [UNUSED] = { 0, 0, 0 }, 150 [UNUSED] = { 0, 0, 0 },
173 [R_8] = { 4, 8, OPERAND_GPR }, 151 [R_8] = { 4, 8, OPERAND_GPR },
@@ -479,7 +457,7 @@ static char *long_insn_name[] = {
479 [LONG_INSN_PCISTB] = "pcistb", 457 [LONG_INSN_PCISTB] = "pcistb",
480}; 458};
481 459
482static struct insn opcode[] = { 460static struct s390_insn opcode[] = {
483#ifdef CONFIG_64BIT 461#ifdef CONFIG_64BIT
484 { "bprp", 0xc5, INSTR_MII_UPI }, 462 { "bprp", 0xc5, INSTR_MII_UPI },
485 { "bpp", 0xc7, INSTR_SMI_U0RDP }, 463 { "bpp", 0xc7, INSTR_SMI_U0RDP },
@@ -668,7 +646,7 @@ static struct insn opcode[] = {
668 { "", 0, INSTR_INVALID } 646 { "", 0, INSTR_INVALID }
669}; 647};
670 648
671static struct insn opcode_01[] = { 649static struct s390_insn opcode_01[] = {
672#ifdef CONFIG_64BIT 650#ifdef CONFIG_64BIT
673 { "ptff", 0x04, INSTR_E }, 651 { "ptff", 0x04, INSTR_E },
674 { "pfpo", 0x0a, INSTR_E }, 652 { "pfpo", 0x0a, INSTR_E },
@@ -684,7 +662,7 @@ static struct insn opcode_01[] = {
684 { "", 0, INSTR_INVALID } 662 { "", 0, INSTR_INVALID }
685}; 663};
686 664
687static struct insn opcode_a5[] = { 665static struct s390_insn opcode_a5[] = {
688#ifdef CONFIG_64BIT 666#ifdef CONFIG_64BIT
689 { "iihh", 0x00, INSTR_RI_RU }, 667 { "iihh", 0x00, INSTR_RI_RU },
690 { "iihl", 0x01, INSTR_RI_RU }, 668 { "iihl", 0x01, INSTR_RI_RU },
@@ -706,7 +684,7 @@ static struct insn opcode_a5[] = {
706 { "", 0, INSTR_INVALID } 684 { "", 0, INSTR_INVALID }
707}; 685};
708 686
709static struct insn opcode_a7[] = { 687static struct s390_insn opcode_a7[] = {
710#ifdef CONFIG_64BIT 688#ifdef CONFIG_64BIT
711 { "tmhh", 0x02, INSTR_RI_RU }, 689 { "tmhh", 0x02, INSTR_RI_RU },
712 { "tmhl", 0x03, INSTR_RI_RU }, 690 { "tmhl", 0x03, INSTR_RI_RU },
@@ -728,7 +706,7 @@ static struct insn opcode_a7[] = {
728 { "", 0, INSTR_INVALID } 706 { "", 0, INSTR_INVALID }
729}; 707};
730 708
731static struct insn opcode_aa[] = { 709static struct s390_insn opcode_aa[] = {
732#ifdef CONFIG_64BIT 710#ifdef CONFIG_64BIT
733 { { 0, LONG_INSN_RINEXT }, 0x00, INSTR_RI_RI }, 711 { { 0, LONG_INSN_RINEXT }, 0x00, INSTR_RI_RI },
734 { "rion", 0x01, INSTR_RI_RI }, 712 { "rion", 0x01, INSTR_RI_RI },
@@ -739,7 +717,7 @@ static struct insn opcode_aa[] = {
739 { "", 0, INSTR_INVALID } 717 { "", 0, INSTR_INVALID }
740}; 718};
741 719
742static struct insn opcode_b2[] = { 720static struct s390_insn opcode_b2[] = {
743#ifdef CONFIG_64BIT 721#ifdef CONFIG_64BIT
744 { "stckf", 0x7c, INSTR_S_RD }, 722 { "stckf", 0x7c, INSTR_S_RD },
745 { "lpp", 0x80, INSTR_S_RD }, 723 { "lpp", 0x80, INSTR_S_RD },
@@ -851,7 +829,7 @@ static struct insn opcode_b2[] = {
851 { "", 0, INSTR_INVALID } 829 { "", 0, INSTR_INVALID }
852}; 830};
853 831
854static struct insn opcode_b3[] = { 832static struct s390_insn opcode_b3[] = {
855#ifdef CONFIG_64BIT 833#ifdef CONFIG_64BIT
856 { "maylr", 0x38, INSTR_RRF_F0FF }, 834 { "maylr", 0x38, INSTR_RRF_F0FF },
857 { "mylr", 0x39, INSTR_RRF_F0FF }, 835 { "mylr", 0x39, INSTR_RRF_F0FF },
@@ -1034,7 +1012,7 @@ static struct insn opcode_b3[] = {
1034 { "", 0, INSTR_INVALID } 1012 { "", 0, INSTR_INVALID }
1035}; 1013};
1036 1014
1037static struct insn opcode_b9[] = { 1015static struct s390_insn opcode_b9[] = {
1038#ifdef CONFIG_64BIT 1016#ifdef CONFIG_64BIT
1039 { "lpgr", 0x00, INSTR_RRE_RR }, 1017 { "lpgr", 0x00, INSTR_RRE_RR },
1040 { "lngr", 0x01, INSTR_RRE_RR }, 1018 { "lngr", 0x01, INSTR_RRE_RR },
@@ -1167,7 +1145,7 @@ static struct insn opcode_b9[] = {
1167 { "", 0, INSTR_INVALID } 1145 { "", 0, INSTR_INVALID }
1168}; 1146};
1169 1147
1170static struct insn opcode_c0[] = { 1148static struct s390_insn opcode_c0[] = {
1171#ifdef CONFIG_64BIT 1149#ifdef CONFIG_64BIT
1172 { "lgfi", 0x01, INSTR_RIL_RI }, 1150 { "lgfi", 0x01, INSTR_RIL_RI },
1173 { "xihf", 0x06, INSTR_RIL_RU }, 1151 { "xihf", 0x06, INSTR_RIL_RU },
@@ -1187,7 +1165,7 @@ static struct insn opcode_c0[] = {
1187 { "", 0, INSTR_INVALID } 1165 { "", 0, INSTR_INVALID }
1188}; 1166};
1189 1167
1190static struct insn opcode_c2[] = { 1168static struct s390_insn opcode_c2[] = {
1191#ifdef CONFIG_64BIT 1169#ifdef CONFIG_64BIT
1192 { "msgfi", 0x00, INSTR_RIL_RI }, 1170 { "msgfi", 0x00, INSTR_RIL_RI },
1193 { "msfi", 0x01, INSTR_RIL_RI }, 1171 { "msfi", 0x01, INSTR_RIL_RI },
@@ -1205,7 +1183,7 @@ static struct insn opcode_c2[] = {
1205 { "", 0, INSTR_INVALID } 1183 { "", 0, INSTR_INVALID }
1206}; 1184};
1207 1185
1208static struct insn opcode_c4[] = { 1186static struct s390_insn opcode_c4[] = {
1209#ifdef CONFIG_64BIT 1187#ifdef CONFIG_64BIT
1210 { "llhrl", 0x02, INSTR_RIL_RP }, 1188 { "llhrl", 0x02, INSTR_RIL_RP },
1211 { "lghrl", 0x04, INSTR_RIL_RP }, 1189 { "lghrl", 0x04, INSTR_RIL_RP },
@@ -1222,7 +1200,7 @@ static struct insn opcode_c4[] = {
1222 { "", 0, INSTR_INVALID } 1200 { "", 0, INSTR_INVALID }
1223}; 1201};
1224 1202
1225static struct insn opcode_c6[] = { 1203static struct s390_insn opcode_c6[] = {
1226#ifdef CONFIG_64BIT 1204#ifdef CONFIG_64BIT
1227 { "exrl", 0x00, INSTR_RIL_RP }, 1205 { "exrl", 0x00, INSTR_RIL_RP },
1228 { "pfdrl", 0x02, INSTR_RIL_UP }, 1206 { "pfdrl", 0x02, INSTR_RIL_UP },
@@ -1240,7 +1218,7 @@ static struct insn opcode_c6[] = {
1240 { "", 0, INSTR_INVALID } 1218 { "", 0, INSTR_INVALID }
1241}; 1219};
1242 1220
1243static struct insn opcode_c8[] = { 1221static struct s390_insn opcode_c8[] = {
1244#ifdef CONFIG_64BIT 1222#ifdef CONFIG_64BIT
1245 { "mvcos", 0x00, INSTR_SSF_RRDRD }, 1223 { "mvcos", 0x00, INSTR_SSF_RRDRD },
1246 { "ectg", 0x01, INSTR_SSF_RRDRD }, 1224 { "ectg", 0x01, INSTR_SSF_RRDRD },
@@ -1251,7 +1229,7 @@ static struct insn opcode_c8[] = {
1251 { "", 0, INSTR_INVALID } 1229 { "", 0, INSTR_INVALID }
1252}; 1230};
1253 1231
1254static struct insn opcode_cc[] = { 1232static struct s390_insn opcode_cc[] = {
1255#ifdef CONFIG_64BIT 1233#ifdef CONFIG_64BIT
1256 { "brcth", 0x06, INSTR_RIL_RP }, 1234 { "brcth", 0x06, INSTR_RIL_RP },
1257 { "aih", 0x08, INSTR_RIL_RI }, 1235 { "aih", 0x08, INSTR_RIL_RI },
@@ -1263,7 +1241,7 @@ static struct insn opcode_cc[] = {
1263 { "", 0, INSTR_INVALID } 1241 { "", 0, INSTR_INVALID }
1264}; 1242};
1265 1243
1266static struct insn opcode_e3[] = { 1244static struct s390_insn opcode_e3[] = {
1267#ifdef CONFIG_64BIT 1245#ifdef CONFIG_64BIT
1268 { "ltg", 0x02, INSTR_RXY_RRRD }, 1246 { "ltg", 0x02, INSTR_RXY_RRRD },
1269 { "lrag", 0x03, INSTR_RXY_RRRD }, 1247 { "lrag", 0x03, INSTR_RXY_RRRD },
@@ -1369,7 +1347,7 @@ static struct insn opcode_e3[] = {
1369 { "", 0, INSTR_INVALID } 1347 { "", 0, INSTR_INVALID }
1370}; 1348};
1371 1349
1372static struct insn opcode_e5[] = { 1350static struct s390_insn opcode_e5[] = {
1373#ifdef CONFIG_64BIT 1351#ifdef CONFIG_64BIT
1374 { "strag", 0x02, INSTR_SSE_RDRD }, 1352 { "strag", 0x02, INSTR_SSE_RDRD },
1375 { "mvhhi", 0x44, INSTR_SIL_RDI }, 1353 { "mvhhi", 0x44, INSTR_SIL_RDI },
@@ -1391,7 +1369,7 @@ static struct insn opcode_e5[] = {
1391 { "", 0, INSTR_INVALID } 1369 { "", 0, INSTR_INVALID }
1392}; 1370};
1393 1371
1394static struct insn opcode_eb[] = { 1372static struct s390_insn opcode_eb[] = {
1395#ifdef CONFIG_64BIT 1373#ifdef CONFIG_64BIT
1396 { "lmg", 0x04, INSTR_RSY_RRRD }, 1374 { "lmg", 0x04, INSTR_RSY_RRRD },
1397 { "srag", 0x0a, INSTR_RSY_RRRD }, 1375 { "srag", 0x0a, INSTR_RSY_RRRD },
@@ -1465,7 +1443,7 @@ static struct insn opcode_eb[] = {
1465 { "", 0, INSTR_INVALID } 1443 { "", 0, INSTR_INVALID }
1466}; 1444};
1467 1445
1468static struct insn opcode_ec[] = { 1446static struct s390_insn opcode_ec[] = {
1469#ifdef CONFIG_64BIT 1447#ifdef CONFIG_64BIT
1470 { "brxhg", 0x44, INSTR_RIE_RRP }, 1448 { "brxhg", 0x44, INSTR_RIE_RRP },
1471 { "brxlg", 0x45, INSTR_RIE_RRP }, 1449 { "brxlg", 0x45, INSTR_RIE_RRP },
@@ -1504,7 +1482,7 @@ static struct insn opcode_ec[] = {
1504 { "", 0, INSTR_INVALID } 1482 { "", 0, INSTR_INVALID }
1505}; 1483};
1506 1484
1507static struct insn opcode_ed[] = { 1485static struct s390_insn opcode_ed[] = {
1508#ifdef CONFIG_64BIT 1486#ifdef CONFIG_64BIT
1509 { "mayl", 0x38, INSTR_RXF_FRRDF }, 1487 { "mayl", 0x38, INSTR_RXF_FRRDF },
1510 { "myl", 0x39, INSTR_RXF_FRRDF }, 1488 { "myl", 0x39, INSTR_RXF_FRRDF },
@@ -1572,7 +1550,7 @@ static struct insn opcode_ed[] = {
1572 1550
1573/* Extracts an operand value from an instruction. */ 1551/* Extracts an operand value from an instruction. */
1574static unsigned int extract_operand(unsigned char *code, 1552static unsigned int extract_operand(unsigned char *code,
1575 const struct operand *operand) 1553 const struct s390_operand *operand)
1576{ 1554{
1577 unsigned int val; 1555 unsigned int val;
1578 int bits; 1556 int bits;
@@ -1608,16 +1586,11 @@ static unsigned int extract_operand(unsigned char *code,
1608 return val; 1586 return val;
1609} 1587}
1610 1588
1611static inline int insn_length(unsigned char code) 1589struct s390_insn *find_insn(unsigned char *code)
1612{
1613 return ((((int) code + 64) >> 7) + 1) << 1;
1614}
1615
1616static struct insn *find_insn(unsigned char *code)
1617{ 1590{
1618 unsigned char opfrag = code[1]; 1591 unsigned char opfrag = code[1];
1619 unsigned char opmask; 1592 unsigned char opmask;
1620 struct insn *table; 1593 struct s390_insn *table;
1621 1594
1622 switch (code[0]) { 1595 switch (code[0]) {
1623 case 0x01: 1596 case 0x01:
@@ -1706,7 +1679,7 @@ static struct insn *find_insn(unsigned char *code)
1706 */ 1679 */
1707int insn_to_mnemonic(unsigned char *instruction, char *buf, unsigned int len) 1680int insn_to_mnemonic(unsigned char *instruction, char *buf, unsigned int len)
1708{ 1681{
1709 struct insn *insn; 1682 struct s390_insn *insn;
1710 1683
1711 insn = find_insn(instruction); 1684 insn = find_insn(instruction);
1712 if (!insn) 1685 if (!insn)
@@ -1722,9 +1695,9 @@ EXPORT_SYMBOL_GPL(insn_to_mnemonic);
1722 1695
1723static int print_insn(char *buffer, unsigned char *code, unsigned long addr) 1696static int print_insn(char *buffer, unsigned char *code, unsigned long addr)
1724{ 1697{
1725 struct insn *insn; 1698 struct s390_insn *insn;
1726 const unsigned char *ops; 1699 const unsigned char *ops;
1727 const struct operand *operand; 1700 const struct s390_operand *operand;
1728 unsigned int value; 1701 unsigned int value;
1729 char separator; 1702 char separator;
1730 char *ptr; 1703 char *ptr;
diff --git a/arch/s390/kernel/dumpstack.c b/arch/s390/kernel/dumpstack.c
index 99e7f6035895..e6af9406987c 100644
--- a/arch/s390/kernel/dumpstack.c
+++ b/arch/s390/kernel/dumpstack.c
@@ -15,6 +15,7 @@
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <asm/processor.h> 16#include <asm/processor.h>
17#include <asm/debug.h> 17#include <asm/debug.h>
18#include <asm/dis.h>
18#include <asm/ipl.h> 19#include <asm/ipl.h>
19 20
20#ifndef CONFIG_64BIT 21#ifndef CONFIG_64BIT
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index dc8770d7173c..96543ac400a7 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -206,6 +206,7 @@ static noinline __init void clear_bss_section(void)
206 */ 206 */
207static noinline __init void init_kernel_storage_key(void) 207static noinline __init void init_kernel_storage_key(void)
208{ 208{
209#if PAGE_DEFAULT_KEY
209 unsigned long end_pfn, init_pfn; 210 unsigned long end_pfn, init_pfn;
210 211
211 end_pfn = PFN_UP(__pa(&_end)); 212 end_pfn = PFN_UP(__pa(&_end));
@@ -213,6 +214,7 @@ static noinline __init void init_kernel_storage_key(void)
213 for (init_pfn = 0 ; init_pfn < end_pfn; init_pfn++) 214 for (init_pfn = 0 ; init_pfn < end_pfn; init_pfn++)
214 page_set_storage_key(init_pfn << PAGE_SHIFT, 215 page_set_storage_key(init_pfn << PAGE_SHIFT,
215 PAGE_DEFAULT_KEY, 0); 216 PAGE_DEFAULT_KEY, 0);
217#endif
216} 218}
217 219
218static __initdata char sysinfo_page[PAGE_SIZE] __aligned(PAGE_SIZE); 220static __initdata char sysinfo_page[PAGE_SIZE] __aligned(PAGE_SIZE);
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index cc30d1fb000c..0dc2b6d0a1ec 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -266,6 +266,7 @@ sysc_sigpending:
266 tm __TI_flags+3(%r12),_TIF_SYSCALL 266 tm __TI_flags+3(%r12),_TIF_SYSCALL
267 jno sysc_return 267 jno sysc_return
268 lm %r2,%r7,__PT_R2(%r11) # load svc arguments 268 lm %r2,%r7,__PT_R2(%r11) # load svc arguments
269 l %r10,__TI_sysc_table(%r12) # 31 bit system call table
269 xr %r8,%r8 # svc 0 returns -ENOSYS 270 xr %r8,%r8 # svc 0 returns -ENOSYS
270 clc __PT_INT_CODE+2(2,%r11),BASED(.Lnr_syscalls+2) 271 clc __PT_INT_CODE+2(2,%r11),BASED(.Lnr_syscalls+2)
271 jnl sysc_nr_ok # invalid svc number -> do svc 0 272 jnl sysc_nr_ok # invalid svc number -> do svc 0
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index e9b04c33d383..cb533f78c09e 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -23,7 +23,6 @@ asmlinkage void do_syscall_trace_exit(struct pt_regs *regs);
23 23
24void do_protection_exception(struct pt_regs *regs); 24void do_protection_exception(struct pt_regs *regs);
25void do_dat_exception(struct pt_regs *regs); 25void do_dat_exception(struct pt_regs *regs);
26void do_asce_exception(struct pt_regs *regs);
27 26
28void addressing_exception(struct pt_regs *regs); 27void addressing_exception(struct pt_regs *regs);
29void data_exception(struct pt_regs *regs); 28void data_exception(struct pt_regs *regs);
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 2b2188b97c6a..e5b43c97a834 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -297,6 +297,7 @@ sysc_sigpending:
297 tm __TI_flags+7(%r12),_TIF_SYSCALL 297 tm __TI_flags+7(%r12),_TIF_SYSCALL
298 jno sysc_return 298 jno sysc_return
299 lmg %r2,%r7,__PT_R2(%r11) # load svc arguments 299 lmg %r2,%r7,__PT_R2(%r11) # load svc arguments
300 lg %r10,__TI_sysc_table(%r12) # address of system call table
300 lghi %r8,0 # svc 0 returns -ENOSYS 301 lghi %r8,0 # svc 0 returns -ENOSYS
301 llgh %r1,__PT_INT_CODE+2(%r11) # load new svc number 302 llgh %r1,__PT_INT_CODE+2(%r11) # load new svc number
302 cghi %r1,NR_syscalls 303 cghi %r1,NR_syscalls
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c
index 1014ad5f7693..224db03e9518 100644
--- a/arch/s390/kernel/ftrace.c
+++ b/arch/s390/kernel/ftrace.c
@@ -151,14 +151,13 @@ unsigned long __kprobes prepare_ftrace_return(unsigned long parent,
151 if (unlikely(atomic_read(&current->tracing_graph_pause))) 151 if (unlikely(atomic_read(&current->tracing_graph_pause)))
152 goto out; 152 goto out;
153 ip = (ip & PSW_ADDR_INSN) - MCOUNT_INSN_SIZE; 153 ip = (ip & PSW_ADDR_INSN) - MCOUNT_INSN_SIZE;
154 if (ftrace_push_return_trace(parent, ip, &trace.depth, 0) == -EBUSY)
155 goto out;
156 trace.func = ip; 154 trace.func = ip;
155 trace.depth = current->curr_ret_stack + 1;
157 /* Only trace if the calling function expects to. */ 156 /* Only trace if the calling function expects to. */
158 if (!ftrace_graph_entry(&trace)) { 157 if (!ftrace_graph_entry(&trace))
159 current->curr_ret_stack--; 158 goto out;
159 if (ftrace_push_return_trace(parent, ip, &trace.depth, 0) == -EBUSY)
160 goto out; 160 goto out;
161 }
162 parent = (unsigned long) return_to_handler; 161 parent = (unsigned long) return_to_handler;
163out: 162out:
164 return parent; 163 return parent;
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index fd8db63dfc94..429afcc480cb 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -437,7 +437,7 @@ ENTRY(startup_kdump)
437 437
438#if defined(CONFIG_64BIT) 438#if defined(CONFIG_64BIT)
439#if defined(CONFIG_MARCH_ZEC12) 439#if defined(CONFIG_MARCH_ZEC12)
440 .long 3, 0xc100efe3, 0xf46ce000, 0x00400000 440 .long 3, 0xc100efe3, 0xf46ce800, 0x00400000
441#elif defined(CONFIG_MARCH_Z196) 441#elif defined(CONFIG_MARCH_Z196)
442 .long 2, 0xc100efe3, 0xf46c0000 442 .long 2, 0xc100efe3, 0xf46c0000
443#elif defined(CONFIG_MARCH_Z10) 443#elif defined(CONFIG_MARCH_Z10)
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index feb719d3c851..633ca7504536 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -2051,12 +2051,12 @@ void s390_reset_system(void (*func)(void *), void *data)
2051 __ctl_clear_bit(0,28); 2051 __ctl_clear_bit(0,28);
2052 2052
2053 /* Set new machine check handler */ 2053 /* Set new machine check handler */
2054 S390_lowcore.mcck_new_psw.mask = psw_kernel_bits | PSW_MASK_DAT; 2054 S390_lowcore.mcck_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_DAT;
2055 S390_lowcore.mcck_new_psw.addr = 2055 S390_lowcore.mcck_new_psw.addr =
2056 PSW_ADDR_AMODE | (unsigned long) s390_base_mcck_handler; 2056 PSW_ADDR_AMODE | (unsigned long) s390_base_mcck_handler;
2057 2057
2058 /* Set new program check handler */ 2058 /* Set new program check handler */
2059 S390_lowcore.program_new_psw.mask = psw_kernel_bits | PSW_MASK_DAT; 2059 S390_lowcore.program_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_DAT;
2060 S390_lowcore.program_new_psw.addr = 2060 S390_lowcore.program_new_psw.addr =
2061 PSW_ADDR_AMODE | (unsigned long) s390_base_pgm_handler; 2061 PSW_ADDR_AMODE | (unsigned long) s390_base_pgm_handler;
2062 2062
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index 8ac2097f13d4..bb27a262c44a 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -157,39 +157,29 @@ int arch_show_interrupts(struct seq_file *p, int prec)
157/* 157/*
158 * Switch to the asynchronous interrupt stack for softirq execution. 158 * Switch to the asynchronous interrupt stack for softirq execution.
159 */ 159 */
160asmlinkage void do_softirq(void) 160void do_softirq_own_stack(void)
161{ 161{
162 unsigned long flags, old, new; 162 unsigned long old, new;
163 163
164 if (in_interrupt()) 164 /* Get current stack pointer. */
165 return; 165 asm volatile("la %0,0(15)" : "=a" (old));
166 166 /* Check against async. stack address range. */
167 local_irq_save(flags); 167 new = S390_lowcore.async_stack;
168 168 if (((new - old) >> (PAGE_SHIFT + THREAD_ORDER)) != 0) {
169 if (local_softirq_pending()) { 169 /* Need to switch to the async. stack. */
170 /* Get current stack pointer. */ 170 new -= STACK_FRAME_OVERHEAD;
171 asm volatile("la %0,0(15)" : "=a" (old)); 171 ((struct stack_frame *) new)->back_chain = old;
172 /* Check against async. stack address range. */ 172 asm volatile(" la 15,0(%0)\n"
173 new = S390_lowcore.async_stack; 173 " basr 14,%2\n"
174 if (((new - old) >> (PAGE_SHIFT + THREAD_ORDER)) != 0) { 174 " la 15,0(%1)\n"
175 /* Need to switch to the async. stack. */ 175 : : "a" (new), "a" (old),
176 new -= STACK_FRAME_OVERHEAD; 176 "a" (__do_softirq)
177 ((struct stack_frame *) new)->back_chain = old; 177 : "0", "1", "2", "3", "4", "5", "14",
178 178 "cc", "memory" );
179 asm volatile(" la 15,0(%0)\n" 179 } else {
180 " basr 14,%2\n" 180 /* We are already on the async stack. */
181 " la 15,0(%1)\n" 181 __do_softirq();
182 : : "a" (new), "a" (old),
183 "a" (__do_softirq)
184 : "0", "1", "2", "3", "4", "5", "14",
185 "cc", "memory" );
186 } else {
187 /* We are already on the async stack. */
188 __do_softirq();
189 }
190 } 182 }
191
192 local_irq_restore(flags);
193} 183}
194 184
195/* 185/*
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 0ce9fb245034..59a9c35c4598 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -26,11 +26,12 @@
26#include <linux/stop_machine.h> 26#include <linux/stop_machine.h>
27#include <linux/kdebug.h> 27#include <linux/kdebug.h>
28#include <linux/uaccess.h> 28#include <linux/uaccess.h>
29#include <asm/cacheflush.h>
30#include <asm/sections.h>
31#include <linux/module.h> 29#include <linux/module.h>
32#include <linux/slab.h> 30#include <linux/slab.h>
33#include <linux/hardirq.h> 31#include <linux/hardirq.h>
32#include <asm/cacheflush.h>
33#include <asm/sections.h>
34#include <asm/dis.h>
34 35
35DEFINE_PER_CPU(struct kprobe *, current_kprobe); 36DEFINE_PER_CPU(struct kprobe *, current_kprobe);
36DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 37DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
@@ -59,6 +60,8 @@ struct kprobe_insn_cache kprobe_dmainsn_slots = {
59 60
60static int __kprobes is_prohibited_opcode(kprobe_opcode_t *insn) 61static int __kprobes is_prohibited_opcode(kprobe_opcode_t *insn)
61{ 62{
63 if (!is_known_insn((unsigned char *)insn))
64 return -EINVAL;
62 switch (insn[0] >> 8) { 65 switch (insn[0] >> 8) {
63 case 0x0c: /* bassm */ 66 case 0x0c: /* bassm */
64 case 0x0b: /* bsm */ 67 case 0x0b: /* bsm */
@@ -67,6 +70,11 @@ static int __kprobes is_prohibited_opcode(kprobe_opcode_t *insn)
67 case 0xac: /* stnsm */ 70 case 0xac: /* stnsm */
68 case 0xad: /* stosm */ 71 case 0xad: /* stosm */
69 return -EINVAL; 72 return -EINVAL;
73 case 0xc6:
74 switch (insn[0] & 0x0f) {
75 case 0x00: /* exrl */
76 return -EINVAL;
77 }
70 } 78 }
71 switch (insn[0]) { 79 switch (insn[0]) {
72 case 0x0101: /* pr */ 80 case 0x0101: /* pr */
@@ -180,7 +188,6 @@ static int __kprobes is_insn_relative_long(kprobe_opcode_t *insn)
180 break; 188 break;
181 case 0xc6: 189 case 0xc6:
182 switch (insn[0] & 0x0f) { 190 switch (insn[0] & 0x0f) {
183 case 0x00: /* exrl */
184 case 0x02: /* pfdrl */ 191 case 0x02: /* pfdrl */
185 case 0x04: /* cghrl */ 192 case 0x04: /* cghrl */
186 case 0x05: /* chrl */ 193 case 0x05: /* chrl */
@@ -204,7 +211,7 @@ static void __kprobes copy_instruction(struct kprobe *p)
204 s64 disp, new_disp; 211 s64 disp, new_disp;
205 u64 addr, new_addr; 212 u64 addr, new_addr;
206 213
207 memcpy(p->ainsn.insn, p->addr, ((p->opcode >> 14) + 3) & -2); 214 memcpy(p->ainsn.insn, p->addr, insn_length(p->opcode >> 8));
208 if (!is_insn_relative_long(p->ainsn.insn)) 215 if (!is_insn_relative_long(p->ainsn.insn))
209 return; 216 return;
210 /* 217 /*
@@ -248,7 +255,7 @@ static int __kprobes s390_get_insn_slot(struct kprobe *p)
248 p->ainsn.insn = NULL; 255 p->ainsn.insn = NULL;
249 if (is_kernel_addr(p->addr)) 256 if (is_kernel_addr(p->addr))
250 p->ainsn.insn = get_dmainsn_slot(); 257 p->ainsn.insn = get_dmainsn_slot();
251 if (is_module_addr(p->addr)) 258 else if (is_module_addr(p->addr))
252 p->ainsn.insn = get_insn_slot(); 259 p->ainsn.insn = get_insn_slot();
253 return p->ainsn.insn ? 0 : -ENOMEM; 260 return p->ainsn.insn ? 0 : -ENOMEM;
254} 261}
@@ -604,7 +611,7 @@ static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
604 ip += (unsigned long) p->addr - (unsigned long) p->ainsn.insn; 611 ip += (unsigned long) p->addr - (unsigned long) p->ainsn.insn;
605 612
606 if (fixup & FIXUP_BRANCH_NOT_TAKEN) { 613 if (fixup & FIXUP_BRANCH_NOT_TAKEN) {
607 int ilen = ((p->ainsn.insn[0] >> 14) + 3) & -2; 614 int ilen = insn_length(p->ainsn.insn[0] >> 8);
608 if (ip - (unsigned long) p->ainsn.insn == ilen) 615 if (ip - (unsigned long) p->ainsn.insn == ilen)
609 ip = (unsigned long) p->addr + ilen; 616 ip = (unsigned long) p->addr + ilen;
610 } 617 }
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
index 7845e15a17df..b89b59158b95 100644
--- a/arch/s390/kernel/module.c
+++ b/arch/s390/kernel/module.c
@@ -50,7 +50,7 @@ void *module_alloc(unsigned long size)
50 if (PAGE_ALIGN(size) > MODULES_LEN) 50 if (PAGE_ALIGN(size) > MODULES_LEN)
51 return NULL; 51 return NULL;
52 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, 52 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
53 GFP_KERNEL, PAGE_KERNEL, -1, 53 GFP_KERNEL, PAGE_KERNEL, NUMA_NO_NODE,
54 __builtin_return_address(0)); 54 __builtin_return_address(0));
55} 55}
56#endif 56#endif
diff --git a/arch/s390/kernel/pgm_check.S b/arch/s390/kernel/pgm_check.S
index 14bdecb61923..4a460c44e17e 100644
--- a/arch/s390/kernel/pgm_check.S
+++ b/arch/s390/kernel/pgm_check.S
@@ -78,7 +78,7 @@ PGM_CHECK_DEFAULT /* 34 */
78PGM_CHECK_DEFAULT /* 35 */ 78PGM_CHECK_DEFAULT /* 35 */
79PGM_CHECK_DEFAULT /* 36 */ 79PGM_CHECK_DEFAULT /* 36 */
80PGM_CHECK_DEFAULT /* 37 */ 80PGM_CHECK_DEFAULT /* 37 */
81PGM_CHECK_64BIT(do_asce_exception) /* 38 */ 81PGM_CHECK_DEFAULT /* 38 */
82PGM_CHECK_64BIT(do_dat_exception) /* 39 */ 82PGM_CHECK_64BIT(do_dat_exception) /* 39 */
83PGM_CHECK_64BIT(do_dat_exception) /* 3a */ 83PGM_CHECK_64BIT(do_dat_exception) /* 3a */
84PGM_CHECK_64BIT(do_dat_exception) /* 3b */ 84PGM_CHECK_64BIT(do_dat_exception) /* 3b */
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index c5dbb335716d..7ed0d4e2a435 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -139,7 +139,7 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
139 if (unlikely(p->flags & PF_KTHREAD)) { 139 if (unlikely(p->flags & PF_KTHREAD)) {
140 /* kernel thread */ 140 /* kernel thread */
141 memset(&frame->childregs, 0, sizeof(struct pt_regs)); 141 memset(&frame->childregs, 0, sizeof(struct pt_regs));
142 frame->childregs.psw.mask = psw_kernel_bits | PSW_MASK_DAT | 142 frame->childregs.psw.mask = PSW_KERNEL_BITS | PSW_MASK_DAT |
143 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK; 143 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
144 frame->childregs.psw.addr = PSW_ADDR_AMODE | 144 frame->childregs.psw.addr = PSW_ADDR_AMODE |
145 (unsigned long) kernel_thread_starter; 145 (unsigned long) kernel_thread_starter;
@@ -165,7 +165,8 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
165 * save fprs to current->thread.fp_regs to merge them with 165 * save fprs to current->thread.fp_regs to merge them with
166 * the emulated registers and then copy the result to the child. 166 * the emulated registers and then copy the result to the child.
167 */ 167 */
168 save_fp_regs(&current->thread.fp_regs); 168 save_fp_ctl(&current->thread.fp_regs.fpc);
169 save_fp_regs(current->thread.fp_regs.fprs);
169 memcpy(&p->thread.fp_regs, &current->thread.fp_regs, 170 memcpy(&p->thread.fp_regs, &current->thread.fp_regs,
170 sizeof(s390_fp_regs)); 171 sizeof(s390_fp_regs));
171 /* Set a new TLS ? */ 172 /* Set a new TLS ? */
@@ -173,7 +174,9 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
173 p->thread.acrs[0] = frame->childregs.gprs[6]; 174 p->thread.acrs[0] = frame->childregs.gprs[6];
174#else /* CONFIG_64BIT */ 175#else /* CONFIG_64BIT */
175 /* Save the fpu registers to new thread structure. */ 176 /* Save the fpu registers to new thread structure. */
176 save_fp_regs(&p->thread.fp_regs); 177 save_fp_ctl(&p->thread.fp_regs.fpc);
178 save_fp_regs(p->thread.fp_regs.fprs);
179 p->thread.fp_regs.pad = 0;
177 /* Set a new TLS ? */ 180 /* Set a new TLS ? */
178 if (clone_flags & CLONE_SETTLS) { 181 if (clone_flags & CLONE_SETTLS) {
179 unsigned long tls = frame->childregs.gprs[6]; 182 unsigned long tls = frame->childregs.gprs[6];
@@ -205,10 +208,12 @@ int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs)
205 * save fprs to current->thread.fp_regs to merge them with 208 * save fprs to current->thread.fp_regs to merge them with
206 * the emulated registers and then copy the result to the dump. 209 * the emulated registers and then copy the result to the dump.
207 */ 210 */
208 save_fp_regs(&current->thread.fp_regs); 211 save_fp_ctl(&current->thread.fp_regs.fpc);
212 save_fp_regs(current->thread.fp_regs.fprs);
209 memcpy(fpregs, &current->thread.fp_regs, sizeof(s390_fp_regs)); 213 memcpy(fpregs, &current->thread.fp_regs, sizeof(s390_fp_regs));
210#else /* CONFIG_64BIT */ 214#else /* CONFIG_64BIT */
211 save_fp_regs(fpregs); 215 save_fp_ctl(&fpregs->fpc);
216 save_fp_regs(fpregs->fprs);
212#endif /* CONFIG_64BIT */ 217#endif /* CONFIG_64BIT */
213 return 1; 218 return 1;
214} 219}
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 9556905bd3ce..e65c91c591e8 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -198,9 +198,11 @@ static unsigned long __peek_user(struct task_struct *child, addr_t addr)
198 * psw and gprs are stored on the stack 198 * psw and gprs are stored on the stack
199 */ 199 */
200 tmp = *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr); 200 tmp = *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr);
201 if (addr == (addr_t) &dummy->regs.psw.mask) 201 if (addr == (addr_t) &dummy->regs.psw.mask) {
202 /* Return a clean psw mask. */ 202 /* Return a clean psw mask. */
203 tmp = psw_user_bits | (tmp & PSW_MASK_USER); 203 tmp &= PSW_MASK_USER | PSW_MASK_RI;
204 tmp |= PSW_USER_BITS;
205 }
204 206
205 } else if (addr < (addr_t) &dummy->regs.orig_gpr2) { 207 } else if (addr < (addr_t) &dummy->regs.orig_gpr2) {
206 /* 208 /*
@@ -239,8 +241,7 @@ static unsigned long __peek_user(struct task_struct *child, addr_t addr)
239 offset = addr - (addr_t) &dummy->regs.fp_regs; 241 offset = addr - (addr_t) &dummy->regs.fp_regs;
240 tmp = *(addr_t *)((addr_t) &child->thread.fp_regs + offset); 242 tmp = *(addr_t *)((addr_t) &child->thread.fp_regs + offset);
241 if (addr == (addr_t) &dummy->regs.fp_regs.fpc) 243 if (addr == (addr_t) &dummy->regs.fp_regs.fpc)
242 tmp &= (unsigned long) FPC_VALID_MASK 244 tmp <<= BITS_PER_LONG - 32;
243 << (BITS_PER_LONG - 32);
244 245
245 } else if (addr < (addr_t) (&dummy->regs.per_info + 1)) { 246 } else if (addr < (addr_t) (&dummy->regs.per_info + 1)) {
246 /* 247 /*
@@ -321,11 +322,15 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data)
321 /* 322 /*
322 * psw and gprs are stored on the stack 323 * psw and gprs are stored on the stack
323 */ 324 */
324 if (addr == (addr_t) &dummy->regs.psw.mask && 325 if (addr == (addr_t) &dummy->regs.psw.mask) {
325 ((data & ~PSW_MASK_USER) != psw_user_bits || 326 unsigned long mask = PSW_MASK_USER;
326 ((data & PSW_MASK_EA) && !(data & PSW_MASK_BA)))) 327
327 /* Invalid psw mask. */ 328 mask |= is_ri_task(child) ? PSW_MASK_RI : 0;
328 return -EINVAL; 329 if ((data & ~mask) != PSW_USER_BITS)
330 return -EINVAL;
331 if ((data & PSW_MASK_EA) && !(data & PSW_MASK_BA))
332 return -EINVAL;
333 }
329 *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data; 334 *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data;
330 335
331 } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) { 336 } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) {
@@ -363,10 +368,10 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data)
363 /* 368 /*
364 * floating point regs. are stored in the thread structure 369 * floating point regs. are stored in the thread structure
365 */ 370 */
366 if (addr == (addr_t) &dummy->regs.fp_regs.fpc && 371 if (addr == (addr_t) &dummy->regs.fp_regs.fpc)
367 (data & ~((unsigned long) FPC_VALID_MASK 372 if ((unsigned int) data != 0 ||
368 << (BITS_PER_LONG - 32))) != 0) 373 test_fp_ctl(data >> (BITS_PER_LONG - 32)))
369 return -EINVAL; 374 return -EINVAL;
370 offset = addr - (addr_t) &dummy->regs.fp_regs; 375 offset = addr - (addr_t) &dummy->regs.fp_regs;
371 *(addr_t *)((addr_t) &child->thread.fp_regs + offset) = data; 376 *(addr_t *)((addr_t) &child->thread.fp_regs + offset) = data;
372 377
@@ -557,7 +562,8 @@ static u32 __peek_user_compat(struct task_struct *child, addr_t addr)
557 if (addr == (addr_t) &dummy32->regs.psw.mask) { 562 if (addr == (addr_t) &dummy32->regs.psw.mask) {
558 /* Fake a 31 bit psw mask. */ 563 /* Fake a 31 bit psw mask. */
559 tmp = (__u32)(regs->psw.mask >> 32); 564 tmp = (__u32)(regs->psw.mask >> 32);
560 tmp = psw32_user_bits | (tmp & PSW32_MASK_USER); 565 tmp &= PSW32_MASK_USER | PSW32_MASK_RI;
566 tmp |= PSW32_USER_BITS;
561 } else if (addr == (addr_t) &dummy32->regs.psw.addr) { 567 } else if (addr == (addr_t) &dummy32->regs.psw.addr) {
562 /* Fake a 31 bit psw address. */ 568 /* Fake a 31 bit psw address. */
563 tmp = (__u32) regs->psw.addr | 569 tmp = (__u32) regs->psw.addr |
@@ -654,13 +660,16 @@ static int __poke_user_compat(struct task_struct *child,
654 * psw, gprs, acrs and orig_gpr2 are stored on the stack 660 * psw, gprs, acrs and orig_gpr2 are stored on the stack
655 */ 661 */
656 if (addr == (addr_t) &dummy32->regs.psw.mask) { 662 if (addr == (addr_t) &dummy32->regs.psw.mask) {
663 __u32 mask = PSW32_MASK_USER;
664
665 mask |= is_ri_task(child) ? PSW32_MASK_RI : 0;
657 /* Build a 64 bit psw mask from 31 bit mask. */ 666 /* Build a 64 bit psw mask from 31 bit mask. */
658 if ((tmp & ~PSW32_MASK_USER) != psw32_user_bits) 667 if ((tmp & ~mask) != PSW32_USER_BITS)
659 /* Invalid psw mask. */ 668 /* Invalid psw mask. */
660 return -EINVAL; 669 return -EINVAL;
661 regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) | 670 regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) |
662 (regs->psw.mask & PSW_MASK_BA) | 671 (regs->psw.mask & PSW_MASK_BA) |
663 (__u64)(tmp & PSW32_MASK_USER) << 32; 672 (__u64)(tmp & mask) << 32;
664 } else if (addr == (addr_t) &dummy32->regs.psw.addr) { 673 } else if (addr == (addr_t) &dummy32->regs.psw.addr) {
665 /* Build a 64 bit psw address from 31 bit address. */ 674 /* Build a 64 bit psw address from 31 bit address. */
666 regs->psw.addr = (__u64) tmp & PSW32_ADDR_INSN; 675 regs->psw.addr = (__u64) tmp & PSW32_ADDR_INSN;
@@ -696,8 +705,7 @@ static int __poke_user_compat(struct task_struct *child,
696 * floating point regs. are stored in the thread structure 705 * floating point regs. are stored in the thread structure
697 */ 706 */
698 if (addr == (addr_t) &dummy32->regs.fp_regs.fpc && 707 if (addr == (addr_t) &dummy32->regs.fp_regs.fpc &&
699 (tmp & ~FPC_VALID_MASK) != 0) 708 test_fp_ctl(tmp))
700 /* Invalid floating point control. */
701 return -EINVAL; 709 return -EINVAL;
702 offset = addr - (addr_t) &dummy32->regs.fp_regs; 710 offset = addr - (addr_t) &dummy32->regs.fp_regs;
703 *(__u32 *)((addr_t) &child->thread.fp_regs + offset) = tmp; 711 *(__u32 *)((addr_t) &child->thread.fp_regs + offset) = tmp;
@@ -895,8 +903,10 @@ static int s390_fpregs_get(struct task_struct *target,
895 const struct user_regset *regset, unsigned int pos, 903 const struct user_regset *regset, unsigned int pos,
896 unsigned int count, void *kbuf, void __user *ubuf) 904 unsigned int count, void *kbuf, void __user *ubuf)
897{ 905{
898 if (target == current) 906 if (target == current) {
899 save_fp_regs(&target->thread.fp_regs); 907 save_fp_ctl(&target->thread.fp_regs.fpc);
908 save_fp_regs(target->thread.fp_regs.fprs);
909 }
900 910
901 return user_regset_copyout(&pos, &count, &kbuf, &ubuf, 911 return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
902 &target->thread.fp_regs, 0, -1); 912 &target->thread.fp_regs, 0, -1);
@@ -909,19 +919,21 @@ static int s390_fpregs_set(struct task_struct *target,
909{ 919{
910 int rc = 0; 920 int rc = 0;
911 921
912 if (target == current) 922 if (target == current) {
913 save_fp_regs(&target->thread.fp_regs); 923 save_fp_ctl(&target->thread.fp_regs.fpc);
924 save_fp_regs(target->thread.fp_regs.fprs);
925 }
914 926
915 /* If setting FPC, must validate it first. */ 927 /* If setting FPC, must validate it first. */
916 if (count > 0 && pos < offsetof(s390_fp_regs, fprs)) { 928 if (count > 0 && pos < offsetof(s390_fp_regs, fprs)) {
917 u32 fpc[2] = { target->thread.fp_regs.fpc, 0 }; 929 u32 ufpc[2] = { target->thread.fp_regs.fpc, 0 };
918 rc = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &fpc, 930 rc = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &ufpc,
919 0, offsetof(s390_fp_regs, fprs)); 931 0, offsetof(s390_fp_regs, fprs));
920 if (rc) 932 if (rc)
921 return rc; 933 return rc;
922 if ((fpc[0] & ~FPC_VALID_MASK) != 0 || fpc[1] != 0) 934 if (ufpc[1] != 0 || test_fp_ctl(ufpc[0]))
923 return -EINVAL; 935 return -EINVAL;
924 target->thread.fp_regs.fpc = fpc[0]; 936 target->thread.fp_regs.fpc = ufpc[0];
925 } 937 }
926 938
927 if (rc == 0 && count > 0) 939 if (rc == 0 && count > 0)
@@ -929,8 +941,10 @@ static int s390_fpregs_set(struct task_struct *target,
929 target->thread.fp_regs.fprs, 941 target->thread.fp_regs.fprs,
930 offsetof(s390_fp_regs, fprs), -1); 942 offsetof(s390_fp_regs, fprs), -1);
931 943
932 if (rc == 0 && target == current) 944 if (rc == 0 && target == current) {
933 restore_fp_regs(&target->thread.fp_regs); 945 restore_fp_ctl(&target->thread.fp_regs.fpc);
946 restore_fp_regs(target->thread.fp_regs.fprs);
947 }
934 948
935 return rc; 949 return rc;
936} 950}
diff --git a/arch/s390/kernel/runtime_instr.c b/arch/s390/kernel/runtime_instr.c
index e1c9d1c292fa..d817cce7e72d 100644
--- a/arch/s390/kernel/runtime_instr.c
+++ b/arch/s390/kernel/runtime_instr.c
@@ -40,8 +40,6 @@ static void disable_runtime_instr(void)
40static void init_runtime_instr_cb(struct runtime_instr_cb *cb) 40static void init_runtime_instr_cb(struct runtime_instr_cb *cb)
41{ 41{
42 cb->buf_limit = 0xfff; 42 cb->buf_limit = 0xfff;
43 if (s390_user_mode == HOME_SPACE_MODE)
44 cb->home_space = 1;
45 cb->int_requested = 1; 43 cb->int_requested = 1;
46 cb->pstate = 1; 44 cb->pstate = 1;
47 cb->pstate_set_buf = 1; 45 cb->pstate_set_buf = 1;
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index aeed8a61fa0d..ffe1c53264a7 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -64,12 +64,6 @@
64#include <asm/sclp.h> 64#include <asm/sclp.h>
65#include "entry.h" 65#include "entry.h"
66 66
67long psw_kernel_bits = PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_ASC_PRIMARY |
68 PSW_MASK_EA | PSW_MASK_BA;
69long psw_user_bits = PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT |
70 PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_MASK_MCHECK |
71 PSW_MASK_PSTATE | PSW_ASC_HOME;
72
73/* 67/*
74 * User copy operations. 68 * User copy operations.
75 */ 69 */
@@ -300,43 +294,14 @@ static int __init parse_vmalloc(char *arg)
300} 294}
301early_param("vmalloc", parse_vmalloc); 295early_param("vmalloc", parse_vmalloc);
302 296
303unsigned int s390_user_mode = PRIMARY_SPACE_MODE;
304EXPORT_SYMBOL_GPL(s390_user_mode);
305
306static void __init set_user_mode_primary(void)
307{
308 psw_kernel_bits = (psw_kernel_bits & ~PSW_MASK_ASC) | PSW_ASC_HOME;
309 psw_user_bits = (psw_user_bits & ~PSW_MASK_ASC) | PSW_ASC_PRIMARY;
310#ifdef CONFIG_COMPAT
311 psw32_user_bits =
312 (psw32_user_bits & ~PSW32_MASK_ASC) | PSW32_ASC_PRIMARY;
313#endif
314 uaccess = MACHINE_HAS_MVCOS ? uaccess_mvcos_switch : uaccess_pt;
315}
316
317static int __init early_parse_user_mode(char *p) 297static int __init early_parse_user_mode(char *p)
318{ 298{
319 if (p && strcmp(p, "primary") == 0) 299 if (!p || strcmp(p, "primary") == 0)
320 s390_user_mode = PRIMARY_SPACE_MODE; 300 return 0;
321 else if (!p || strcmp(p, "home") == 0) 301 return 1;
322 s390_user_mode = HOME_SPACE_MODE;
323 else
324 return 1;
325 return 0;
326} 302}
327early_param("user_mode", early_parse_user_mode); 303early_param("user_mode", early_parse_user_mode);
328 304
329static void __init setup_addressing_mode(void)
330{
331 if (s390_user_mode != PRIMARY_SPACE_MODE)
332 return;
333 set_user_mode_primary();
334 if (MACHINE_HAS_MVCOS)
335 pr_info("Address spaces switched, mvcos available\n");
336 else
337 pr_info("Address spaces switched, mvcos not available\n");
338}
339
340void *restart_stack __attribute__((__section__(".data"))); 305void *restart_stack __attribute__((__section__(".data")));
341 306
342static void __init setup_lowcore(void) 307static void __init setup_lowcore(void)
@@ -348,24 +313,24 @@ static void __init setup_lowcore(void)
348 */ 313 */
349 BUILD_BUG_ON(sizeof(struct _lowcore) != LC_PAGES * 4096); 314 BUILD_BUG_ON(sizeof(struct _lowcore) != LC_PAGES * 4096);
350 lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0); 315 lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0);
351 lc->restart_psw.mask = psw_kernel_bits; 316 lc->restart_psw.mask = PSW_KERNEL_BITS;
352 lc->restart_psw.addr = 317 lc->restart_psw.addr =
353 PSW_ADDR_AMODE | (unsigned long) restart_int_handler; 318 PSW_ADDR_AMODE | (unsigned long) restart_int_handler;
354 lc->external_new_psw.mask = psw_kernel_bits | 319 lc->external_new_psw.mask = PSW_KERNEL_BITS |
355 PSW_MASK_DAT | PSW_MASK_MCHECK; 320 PSW_MASK_DAT | PSW_MASK_MCHECK;
356 lc->external_new_psw.addr = 321 lc->external_new_psw.addr =
357 PSW_ADDR_AMODE | (unsigned long) ext_int_handler; 322 PSW_ADDR_AMODE | (unsigned long) ext_int_handler;
358 lc->svc_new_psw.mask = psw_kernel_bits | 323 lc->svc_new_psw.mask = PSW_KERNEL_BITS |
359 PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK; 324 PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
360 lc->svc_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) system_call; 325 lc->svc_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) system_call;
361 lc->program_new_psw.mask = psw_kernel_bits | 326 lc->program_new_psw.mask = PSW_KERNEL_BITS |
362 PSW_MASK_DAT | PSW_MASK_MCHECK; 327 PSW_MASK_DAT | PSW_MASK_MCHECK;
363 lc->program_new_psw.addr = 328 lc->program_new_psw.addr =
364 PSW_ADDR_AMODE | (unsigned long) pgm_check_handler; 329 PSW_ADDR_AMODE | (unsigned long) pgm_check_handler;
365 lc->mcck_new_psw.mask = psw_kernel_bits; 330 lc->mcck_new_psw.mask = PSW_KERNEL_BITS;
366 lc->mcck_new_psw.addr = 331 lc->mcck_new_psw.addr =
367 PSW_ADDR_AMODE | (unsigned long) mcck_int_handler; 332 PSW_ADDR_AMODE | (unsigned long) mcck_int_handler;
368 lc->io_new_psw.mask = psw_kernel_bits | 333 lc->io_new_psw.mask = PSW_KERNEL_BITS |
369 PSW_MASK_DAT | PSW_MASK_MCHECK; 334 PSW_MASK_DAT | PSW_MASK_MCHECK;
370 lc->io_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) io_int_handler; 335 lc->io_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) io_int_handler;
371 lc->clock_comparator = -1ULL; 336 lc->clock_comparator = -1ULL;
@@ -1043,10 +1008,7 @@ void __init setup_arch(char **cmdline_p)
1043 init_mm.end_data = (unsigned long) &_edata; 1008 init_mm.end_data = (unsigned long) &_edata;
1044 init_mm.brk = (unsigned long) &_end; 1009 init_mm.brk = (unsigned long) &_end;
1045 1010
1046 if (MACHINE_HAS_MVCOS) 1011 uaccess = MACHINE_HAS_MVCOS ? uaccess_mvcos : uaccess_pt;
1047 memcpy(&uaccess, &uaccess_mvcos, sizeof(uaccess));
1048 else
1049 memcpy(&uaccess, &uaccess_std, sizeof(uaccess));
1050 1012
1051 parse_early_param(); 1013 parse_early_param();
1052 detect_memory_layout(memory_chunk, memory_end); 1014 detect_memory_layout(memory_chunk, memory_end);
@@ -1054,7 +1016,6 @@ void __init setup_arch(char **cmdline_p)
1054 setup_ipl(); 1016 setup_ipl();
1055 reserve_oldmem(); 1017 reserve_oldmem();
1056 setup_memory_end(); 1018 setup_memory_end();
1057 setup_addressing_mode();
1058 reserve_crashkernel(); 1019 reserve_crashkernel();
1059 setup_memory(); 1020 setup_memory();
1060 setup_resources(); 1021 setup_resources();
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index c45becf82e01..fb535874a246 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -57,40 +57,48 @@ static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
57 57
58 /* Copy a 'clean' PSW mask to the user to avoid leaking 58 /* Copy a 'clean' PSW mask to the user to avoid leaking
59 information about whether PER is currently on. */ 59 information about whether PER is currently on. */
60 user_sregs.regs.psw.mask = psw_user_bits | 60 user_sregs.regs.psw.mask = PSW_USER_BITS |
61 (regs->psw.mask & PSW_MASK_USER); 61 (regs->psw.mask & (PSW_MASK_USER | PSW_MASK_RI));
62 user_sregs.regs.psw.addr = regs->psw.addr; 62 user_sregs.regs.psw.addr = regs->psw.addr;
63 memcpy(&user_sregs.regs.gprs, &regs->gprs, sizeof(sregs->regs.gprs)); 63 memcpy(&user_sregs.regs.gprs, &regs->gprs, sizeof(sregs->regs.gprs));
64 memcpy(&user_sregs.regs.acrs, current->thread.acrs, 64 memcpy(&user_sregs.regs.acrs, current->thread.acrs,
65 sizeof(sregs->regs.acrs)); 65 sizeof(user_sregs.regs.acrs));
66 /* 66 /*
67 * We have to store the fp registers to current->thread.fp_regs 67 * We have to store the fp registers to current->thread.fp_regs
68 * to merge them with the emulated registers. 68 * to merge them with the emulated registers.
69 */ 69 */
70 save_fp_regs(&current->thread.fp_regs); 70 save_fp_ctl(&current->thread.fp_regs.fpc);
71 save_fp_regs(current->thread.fp_regs.fprs);
71 memcpy(&user_sregs.fpregs, &current->thread.fp_regs, 72 memcpy(&user_sregs.fpregs, &current->thread.fp_regs,
72 sizeof(s390_fp_regs)); 73 sizeof(user_sregs.fpregs));
73 return __copy_to_user(sregs, &user_sregs, sizeof(_sigregs)); 74 if (__copy_to_user(sregs, &user_sregs, sizeof(_sigregs)))
75 return -EFAULT;
76 return 0;
74} 77}
75 78
76/* Returns positive number on error */
77static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs) 79static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
78{ 80{
79 int err;
80 _sigregs user_sregs; 81 _sigregs user_sregs;
81 82
82 /* Alwys make any pending restarted system call return -EINTR */ 83 /* Alwys make any pending restarted system call return -EINTR */
83 current_thread_info()->restart_block.fn = do_no_restart_syscall; 84 current_thread_info()->restart_block.fn = do_no_restart_syscall;
84 85
85 err = __copy_from_user(&user_sregs, sregs, sizeof(_sigregs)); 86 if (__copy_from_user(&user_sregs, sregs, sizeof(user_sregs)))
86 if (err) 87 return -EFAULT;
87 return err; 88
88 /* Use regs->psw.mask instead of psw_user_bits to preserve PER bit. */ 89 if (!is_ri_task(current) && (user_sregs.regs.psw.mask & PSW_MASK_RI))
90 return -EINVAL;
91
92 /* Loading the floating-point-control word can fail. Do that first. */
93 if (restore_fp_ctl(&user_sregs.fpregs.fpc))
94 return -EINVAL;
95
96 /* Use regs->psw.mask instead of PSW_USER_BITS to preserve PER bit. */
89 regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) | 97 regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) |
90 (user_sregs.regs.psw.mask & PSW_MASK_USER); 98 (user_sregs.regs.psw.mask & (PSW_MASK_USER | PSW_MASK_RI));
91 /* Check for invalid user address space control. */ 99 /* Check for invalid user address space control. */
92 if ((regs->psw.mask & PSW_MASK_ASC) >= (psw_kernel_bits & PSW_MASK_ASC)) 100 if ((regs->psw.mask & PSW_MASK_ASC) == PSW_ASC_HOME)
93 regs->psw.mask = (psw_user_bits & PSW_MASK_ASC) | 101 regs->psw.mask = PSW_ASC_PRIMARY |
94 (regs->psw.mask & ~PSW_MASK_ASC); 102 (regs->psw.mask & ~PSW_MASK_ASC);
95 /* Check for invalid amode */ 103 /* Check for invalid amode */
96 if (regs->psw.mask & PSW_MASK_EA) 104 if (regs->psw.mask & PSW_MASK_EA)
@@ -98,14 +106,13 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
98 regs->psw.addr = user_sregs.regs.psw.addr; 106 regs->psw.addr = user_sregs.regs.psw.addr;
99 memcpy(&regs->gprs, &user_sregs.regs.gprs, sizeof(sregs->regs.gprs)); 107 memcpy(&regs->gprs, &user_sregs.regs.gprs, sizeof(sregs->regs.gprs));
100 memcpy(&current->thread.acrs, &user_sregs.regs.acrs, 108 memcpy(&current->thread.acrs, &user_sregs.regs.acrs,
101 sizeof(sregs->regs.acrs)); 109 sizeof(current->thread.acrs));
102 restore_access_regs(current->thread.acrs); 110 restore_access_regs(current->thread.acrs);
103 111
104 memcpy(&current->thread.fp_regs, &user_sregs.fpregs, 112 memcpy(&current->thread.fp_regs, &user_sregs.fpregs,
105 sizeof(s390_fp_regs)); 113 sizeof(current->thread.fp_regs));
106 current->thread.fp_regs.fpc &= FPC_VALID_MASK;
107 114
108 restore_fp_regs(&current->thread.fp_regs); 115 restore_fp_regs(current->thread.fp_regs.fprs);
109 clear_thread_flag(TIF_SYSCALL); /* No longer in a system call */ 116 clear_thread_flag(TIF_SYSCALL); /* No longer in a system call */
110 return 0; 117 return 0;
111} 118}
@@ -224,7 +231,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
224 regs->gprs[15] = (unsigned long) frame; 231 regs->gprs[15] = (unsigned long) frame;
225 /* Force default amode and default user address space control. */ 232 /* Force default amode and default user address space control. */
226 regs->psw.mask = PSW_MASK_EA | PSW_MASK_BA | 233 regs->psw.mask = PSW_MASK_EA | PSW_MASK_BA |
227 (psw_user_bits & PSW_MASK_ASC) | 234 (PSW_USER_BITS & PSW_MASK_ASC) |
228 (regs->psw.mask & ~PSW_MASK_ASC); 235 (regs->psw.mask & ~PSW_MASK_ASC);
229 regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE; 236 regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE;
230 237
@@ -295,7 +302,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
295 regs->gprs[15] = (unsigned long) frame; 302 regs->gprs[15] = (unsigned long) frame;
296 /* Force default amode and default user address space control. */ 303 /* Force default amode and default user address space control. */
297 regs->psw.mask = PSW_MASK_EA | PSW_MASK_BA | 304 regs->psw.mask = PSW_MASK_EA | PSW_MASK_BA |
298 (psw_user_bits & PSW_MASK_ASC) | 305 (PSW_USER_BITS & PSW_MASK_ASC) |
299 (regs->psw.mask & ~PSW_MASK_ASC); 306 (regs->psw.mask & ~PSW_MASK_ASC);
300 regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE; 307 regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE;
301 308
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 1a4313a1b60f..dc4a53465060 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -283,7 +283,7 @@ static void pcpu_delegate(struct pcpu *pcpu, void (*func)(void *),
283 struct _lowcore *lc = lowcore_ptr[pcpu - pcpu_devices]; 283 struct _lowcore *lc = lowcore_ptr[pcpu - pcpu_devices];
284 unsigned long source_cpu = stap(); 284 unsigned long source_cpu = stap();
285 285
286 __load_psw_mask(psw_kernel_bits); 286 __load_psw_mask(PSW_KERNEL_BITS);
287 if (pcpu->address == source_cpu) 287 if (pcpu->address == source_cpu)
288 func(data); /* should not return */ 288 func(data); /* should not return */
289 /* Stop target cpu (if func returns this stops the current cpu). */ 289 /* Stop target cpu (if func returns this stops the current cpu). */
@@ -395,7 +395,7 @@ void smp_send_stop(void)
395 int cpu; 395 int cpu;
396 396
397 /* Disable all interrupts/machine checks */ 397 /* Disable all interrupts/machine checks */
398 __load_psw_mask(psw_kernel_bits | PSW_MASK_DAT); 398 __load_psw_mask(PSW_KERNEL_BITS | PSW_MASK_DAT);
399 trace_hardirqs_off(); 399 trace_hardirqs_off();
400 400
401 debug_set_critical(); 401 debug_set_critical();
@@ -533,9 +533,6 @@ EXPORT_SYMBOL(smp_ctl_clear_bit);
533 533
534#if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_CRASH_DUMP) 534#if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_CRASH_DUMP)
535 535
536struct save_area *zfcpdump_save_areas[NR_CPUS + 1];
537EXPORT_SYMBOL_GPL(zfcpdump_save_areas);
538
539static void __init smp_get_save_area(int cpu, u16 address) 536static void __init smp_get_save_area(int cpu, u16 address)
540{ 537{
541 void *lc = pcpu_devices[0].lowcore; 538 void *lc = pcpu_devices[0].lowcore;
@@ -546,15 +543,9 @@ static void __init smp_get_save_area(int cpu, u16 address)
546 if (!OLDMEM_BASE && (address == boot_cpu_address || 543 if (!OLDMEM_BASE && (address == boot_cpu_address ||
547 ipl_info.type != IPL_TYPE_FCP_DUMP)) 544 ipl_info.type != IPL_TYPE_FCP_DUMP))
548 return; 545 return;
549 if (cpu >= NR_CPUS) { 546 save_area = dump_save_area_create(cpu);
550 pr_warning("CPU %i exceeds the maximum %i and is excluded "
551 "from the dump\n", cpu, NR_CPUS - 1);
552 return;
553 }
554 save_area = kmalloc(sizeof(struct save_area), GFP_KERNEL);
555 if (!save_area) 547 if (!save_area)
556 panic("could not allocate memory for save area\n"); 548 panic("could not allocate memory for save area\n");
557 zfcpdump_save_areas[cpu] = save_area;
558#ifdef CONFIG_CRASH_DUMP 549#ifdef CONFIG_CRASH_DUMP
559 if (address == boot_cpu_address) { 550 if (address == boot_cpu_address) {
560 /* Copy the registers of the boot cpu. */ 551 /* Copy the registers of the boot cpu. */
@@ -693,7 +684,7 @@ static void smp_start_secondary(void *cpuvoid)
693 S390_lowcore.restart_source = -1UL; 684 S390_lowcore.restart_source = -1UL;
694 restore_access_regs(S390_lowcore.access_regs_save_area); 685 restore_access_regs(S390_lowcore.access_regs_save_area);
695 __ctl_load(S390_lowcore.cregs_save_area, 0, 15); 686 __ctl_load(S390_lowcore.cregs_save_area, 0, 15);
696 __load_psw_mask(psw_kernel_bits | PSW_MASK_DAT); 687 __load_psw_mask(PSW_KERNEL_BITS | PSW_MASK_DAT);
697 cpu_init(); 688 cpu_init();
698 preempt_disable(); 689 preempt_disable();
699 init_cpu_timer(); 690 init_cpu_timer();
@@ -929,7 +920,7 @@ static ssize_t show_idle_count(struct device *dev,
929 idle_count = ACCESS_ONCE(idle->idle_count); 920 idle_count = ACCESS_ONCE(idle->idle_count);
930 if (ACCESS_ONCE(idle->clock_idle_enter)) 921 if (ACCESS_ONCE(idle->clock_idle_enter))
931 idle_count++; 922 idle_count++;
932 } while ((sequence & 1) || (idle->sequence != sequence)); 923 } while ((sequence & 1) || (ACCESS_ONCE(idle->sequence) != sequence));
933 return sprintf(buf, "%llu\n", idle_count); 924 return sprintf(buf, "%llu\n", idle_count);
934} 925}
935static DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL); 926static DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL);
@@ -947,7 +938,7 @@ static ssize_t show_idle_time(struct device *dev,
947 idle_time = ACCESS_ONCE(idle->idle_time); 938 idle_time = ACCESS_ONCE(idle->idle_time);
948 idle_enter = ACCESS_ONCE(idle->clock_idle_enter); 939 idle_enter = ACCESS_ONCE(idle->clock_idle_enter);
949 idle_exit = ACCESS_ONCE(idle->clock_idle_exit); 940 idle_exit = ACCESS_ONCE(idle->clock_idle_exit);
950 } while ((sequence & 1) || (idle->sequence != sequence)); 941 } while ((sequence & 1) || (ACCESS_ONCE(idle->sequence) != sequence));
951 idle_time += idle_enter ? ((idle_exit ? : now) - idle_enter) : 0; 942 idle_time += idle_enter ? ((idle_exit ? : now) - idle_enter) : 0;
952 return sprintf(buf, "%llu\n", idle_time >> 12); 943 return sprintf(buf, "%llu\n", idle_time >> 12);
953} 944}
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c
index 05d75c413137..a84476f2a9bb 100644
--- a/arch/s390/kernel/vdso.c
+++ b/arch/s390/kernel/vdso.c
@@ -84,8 +84,7 @@ struct vdso_data *vdso_data = &vdso_data_store.data;
84 */ 84 */
85static void vdso_init_data(struct vdso_data *vd) 85static void vdso_init_data(struct vdso_data *vd)
86{ 86{
87 vd->ectg_available = 87 vd->ectg_available = test_facility(31);
88 s390_user_mode != HOME_SPACE_MODE && test_facility(31);
89} 88}
90 89
91#ifdef CONFIG_64BIT 90#ifdef CONFIG_64BIT
@@ -102,7 +101,7 @@ int vdso_alloc_per_cpu(struct _lowcore *lowcore)
102 101
103 lowcore->vdso_per_cpu_data = __LC_PASTE; 102 lowcore->vdso_per_cpu_data = __LC_PASTE;
104 103
105 if (s390_user_mode == HOME_SPACE_MODE || !vdso_enabled) 104 if (!vdso_enabled)
106 return 0; 105 return 0;
107 106
108 segment_table = __get_free_pages(GFP_KERNEL, SEGMENT_ORDER); 107 segment_table = __get_free_pages(GFP_KERNEL, SEGMENT_ORDER);
@@ -147,7 +146,7 @@ void vdso_free_per_cpu(struct _lowcore *lowcore)
147 unsigned long segment_table, page_table, page_frame; 146 unsigned long segment_table, page_table, page_frame;
148 u32 *psal, *aste; 147 u32 *psal, *aste;
149 148
150 if (s390_user_mode == HOME_SPACE_MODE || !vdso_enabled) 149 if (!vdso_enabled)
151 return; 150 return;
152 151
153 psal = (u32 *)(addr_t) lowcore->paste[4]; 152 psal = (u32 *)(addr_t) lowcore->paste[4];
@@ -165,7 +164,7 @@ static void vdso_init_cr5(void)
165{ 164{
166 unsigned long cr5; 165 unsigned long cr5;
167 166
168 if (s390_user_mode == HOME_SPACE_MODE || !vdso_enabled) 167 if (!vdso_enabled)
169 return; 168 return;
170 cr5 = offsetof(struct _lowcore, paste); 169 cr5 = offsetof(struct _lowcore, paste);
171 __ctl_load(cr5, 5, 5); 170 __ctl_load(cr5, 5, 5);
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index abcfab55f99b..8c34363d6f1e 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -161,7 +161,7 @@ void __kprobes vtime_stop_cpu(void)
161 trace_hardirqs_on(); 161 trace_hardirqs_on();
162 162
163 /* Wait for external, I/O or machine check interrupt. */ 163 /* Wait for external, I/O or machine check interrupt. */
164 psw_mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_DAT | 164 psw_mask = PSW_KERNEL_BITS | PSW_MASK_WAIT | PSW_MASK_DAT |
165 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK; 165 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
166 idle->nohz_delay = 0; 166 idle->nohz_delay = 0;
167 167
@@ -191,7 +191,7 @@ cputime64_t s390_get_idle_time(int cpu)
191 sequence = ACCESS_ONCE(idle->sequence); 191 sequence = ACCESS_ONCE(idle->sequence);
192 idle_enter = ACCESS_ONCE(idle->clock_idle_enter); 192 idle_enter = ACCESS_ONCE(idle->clock_idle_enter);
193 idle_exit = ACCESS_ONCE(idle->clock_idle_exit); 193 idle_exit = ACCESS_ONCE(idle->clock_idle_exit);
194 } while ((sequence & 1) || (idle->sequence != sequence)); 194 } while ((sequence & 1) || (ACCESS_ONCE(idle->sequence) != sequence));
195 return idle_enter ? ((idle_exit ?: now) - idle_enter) : 0; 195 return idle_enter ? ((idle_exit ?: now) - idle_enter) : 0;
196} 196}
197 197
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
index 3a74d8af0d69..78d967f180f4 100644
--- a/arch/s390/kvm/diag.c
+++ b/arch/s390/kvm/diag.c
@@ -107,14 +107,13 @@ static int __diag_ipl_functions(struct kvm_vcpu *vcpu)
107 107
108static int __diag_virtio_hypercall(struct kvm_vcpu *vcpu) 108static int __diag_virtio_hypercall(struct kvm_vcpu *vcpu)
109{ 109{
110 int ret, idx; 110 int ret;
111 111
112 /* No virtio-ccw notification? Get out quickly. */ 112 /* No virtio-ccw notification? Get out quickly. */
113 if (!vcpu->kvm->arch.css_support || 113 if (!vcpu->kvm->arch.css_support ||
114 (vcpu->run->s.regs.gprs[1] != KVM_S390_VIRTIO_CCW_NOTIFY)) 114 (vcpu->run->s.regs.gprs[1] != KVM_S390_VIRTIO_CCW_NOTIFY))
115 return -EOPNOTSUPP; 115 return -EOPNOTSUPP;
116 116
117 idx = srcu_read_lock(&vcpu->kvm->srcu);
118 /* 117 /*
119 * The layout is as follows: 118 * The layout is as follows:
120 * - gpr 2 contains the subchannel id (passed as addr) 119 * - gpr 2 contains the subchannel id (passed as addr)
@@ -125,7 +124,6 @@ static int __diag_virtio_hypercall(struct kvm_vcpu *vcpu)
125 vcpu->run->s.regs.gprs[2], 124 vcpu->run->s.regs.gprs[2],
126 8, &vcpu->run->s.regs.gprs[3], 125 8, &vcpu->run->s.regs.gprs[3],
127 vcpu->run->s.regs.gprs[4]); 126 vcpu->run->s.regs.gprs[4]);
128 srcu_read_unlock(&vcpu->kvm->srcu, idx);
129 127
130 /* 128 /*
131 * Return cookie in gpr 2, but don't overwrite the register if the 129 * Return cookie in gpr 2, but don't overwrite the register if the
diff --git a/arch/s390/kvm/gaccess.h b/arch/s390/kvm/gaccess.h
index 99d789e8a018..374a439ccc60 100644
--- a/arch/s390/kvm/gaccess.h
+++ b/arch/s390/kvm/gaccess.h
@@ -18,20 +18,27 @@
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
19#include "kvm-s390.h" 19#include "kvm-s390.h"
20 20
21/* Convert real to absolute address by applying the prefix of the CPU */
22static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu,
23 unsigned long gaddr)
24{
25 unsigned long prefix = vcpu->arch.sie_block->prefix;
26 if (gaddr < 2 * PAGE_SIZE)
27 gaddr += prefix;
28 else if (gaddr >= prefix && gaddr < prefix + 2 * PAGE_SIZE)
29 gaddr -= prefix;
30 return gaddr;
31}
32
21static inline void __user *__gptr_to_uptr(struct kvm_vcpu *vcpu, 33static inline void __user *__gptr_to_uptr(struct kvm_vcpu *vcpu,
22 void __user *gptr, 34 void __user *gptr,
23 int prefixing) 35 int prefixing)
24{ 36{
25 unsigned long prefix = vcpu->arch.sie_block->prefix;
26 unsigned long gaddr = (unsigned long) gptr; 37 unsigned long gaddr = (unsigned long) gptr;
27 unsigned long uaddr; 38 unsigned long uaddr;
28 39
29 if (prefixing) { 40 if (prefixing)
30 if (gaddr < 2 * PAGE_SIZE) 41 gaddr = kvm_s390_real_to_abs(vcpu, gaddr);
31 gaddr += prefix;
32 else if ((gaddr >= prefix) && (gaddr < prefix + 2 * PAGE_SIZE))
33 gaddr -= prefix;
34 }
35 uaddr = gmap_fault(gaddr, vcpu->arch.gmap); 42 uaddr = gmap_fault(gaddr, vcpu->arch.gmap);
36 if (IS_ERR_VALUE(uaddr)) 43 if (IS_ERR_VALUE(uaddr))
37 uaddr = -EFAULT; 44 uaddr = -EFAULT;
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index 5ee56e5acc23..5ddbbde6f65c 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -62,12 +62,6 @@ static int handle_stop(struct kvm_vcpu *vcpu)
62 62
63 trace_kvm_s390_stop_request(vcpu->arch.local_int.action_bits); 63 trace_kvm_s390_stop_request(vcpu->arch.local_int.action_bits);
64 64
65 if (vcpu->arch.local_int.action_bits & ACTION_RELOADVCPU_ON_STOP) {
66 vcpu->arch.local_int.action_bits &= ~ACTION_RELOADVCPU_ON_STOP;
67 rc = SIE_INTERCEPT_RERUNVCPU;
68 vcpu->run->exit_reason = KVM_EXIT_INTR;
69 }
70
71 if (vcpu->arch.local_int.action_bits & ACTION_STOP_ON_STOP) { 65 if (vcpu->arch.local_int.action_bits & ACTION_STOP_ON_STOP) {
72 atomic_set_mask(CPUSTAT_STOPPED, 66 atomic_set_mask(CPUSTAT_STOPPED,
73 &vcpu->arch.sie_block->cpuflags); 67 &vcpu->arch.sie_block->cpuflags);
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 7f35cb33e510..5f79d2d79ca7 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -385,7 +385,7 @@ static int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu)
385 } 385 }
386 386
387 if ((!rc) && (vcpu->arch.sie_block->ckc < 387 if ((!rc) && (vcpu->arch.sie_block->ckc <
388 get_tod_clock() + vcpu->arch.sie_block->epoch)) { 388 get_tod_clock_fast() + vcpu->arch.sie_block->epoch)) {
389 if ((!psw_extint_disabled(vcpu)) && 389 if ((!psw_extint_disabled(vcpu)) &&
390 (vcpu->arch.sie_block->gcr[0] & 0x800ul)) 390 (vcpu->arch.sie_block->gcr[0] & 0x800ul))
391 rc = 1; 391 rc = 1;
@@ -425,7 +425,7 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
425 goto no_timer; 425 goto no_timer;
426 } 426 }
427 427
428 now = get_tod_clock() + vcpu->arch.sie_block->epoch; 428 now = get_tod_clock_fast() + vcpu->arch.sie_block->epoch;
429 if (vcpu->arch.sie_block->ckc < now) { 429 if (vcpu->arch.sie_block->ckc < now) {
430 __unset_cpu_idle(vcpu); 430 __unset_cpu_idle(vcpu);
431 return 0; 431 return 0;
@@ -436,6 +436,7 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
436 hrtimer_start(&vcpu->arch.ckc_timer, ktime_set (0, sltime) , HRTIMER_MODE_REL); 436 hrtimer_start(&vcpu->arch.ckc_timer, ktime_set (0, sltime) , HRTIMER_MODE_REL);
437 VCPU_EVENT(vcpu, 5, "enabled wait via clock comparator: %llx ns", sltime); 437 VCPU_EVENT(vcpu, 5, "enabled wait via clock comparator: %llx ns", sltime);
438no_timer: 438no_timer:
439 srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
439 spin_lock(&vcpu->arch.local_int.float_int->lock); 440 spin_lock(&vcpu->arch.local_int.float_int->lock);
440 spin_lock_bh(&vcpu->arch.local_int.lock); 441 spin_lock_bh(&vcpu->arch.local_int.lock);
441 add_wait_queue(&vcpu->wq, &wait); 442 add_wait_queue(&vcpu->wq, &wait);
@@ -455,6 +456,8 @@ no_timer:
455 remove_wait_queue(&vcpu->wq, &wait); 456 remove_wait_queue(&vcpu->wq, &wait);
456 spin_unlock_bh(&vcpu->arch.local_int.lock); 457 spin_unlock_bh(&vcpu->arch.local_int.lock);
457 spin_unlock(&vcpu->arch.local_int.float_int->lock); 458 spin_unlock(&vcpu->arch.local_int.float_int->lock);
459 vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
460
458 hrtimer_try_to_cancel(&vcpu->arch.ckc_timer); 461 hrtimer_try_to_cancel(&vcpu->arch.ckc_timer);
459 return 0; 462 return 0;
460} 463}
@@ -515,7 +518,7 @@ void kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu)
515 } 518 }
516 519
517 if ((vcpu->arch.sie_block->ckc < 520 if ((vcpu->arch.sie_block->ckc <
518 get_tod_clock() + vcpu->arch.sie_block->epoch)) 521 get_tod_clock_fast() + vcpu->arch.sie_block->epoch))
519 __try_deliver_ckc_interrupt(vcpu); 522 __try_deliver_ckc_interrupt(vcpu);
520 523
521 if (atomic_read(&fi->active)) { 524 if (atomic_read(&fi->active)) {
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 776dafe918db..569494e01ec6 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -343,10 +343,11 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
343 343
344void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 344void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
345{ 345{
346 save_fp_regs(&vcpu->arch.host_fpregs); 346 save_fp_ctl(&vcpu->arch.host_fpregs.fpc);
347 save_fp_regs(vcpu->arch.host_fpregs.fprs);
347 save_access_regs(vcpu->arch.host_acrs); 348 save_access_regs(vcpu->arch.host_acrs);
348 vcpu->arch.guest_fpregs.fpc &= FPC_VALID_MASK; 349 restore_fp_ctl(&vcpu->arch.guest_fpregs.fpc);
349 restore_fp_regs(&vcpu->arch.guest_fpregs); 350 restore_fp_regs(vcpu->arch.guest_fpregs.fprs);
350 restore_access_regs(vcpu->run->s.regs.acrs); 351 restore_access_regs(vcpu->run->s.regs.acrs);
351 gmap_enable(vcpu->arch.gmap); 352 gmap_enable(vcpu->arch.gmap);
352 atomic_set_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags); 353 atomic_set_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
@@ -356,9 +357,11 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
356{ 357{
357 atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags); 358 atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
358 gmap_disable(vcpu->arch.gmap); 359 gmap_disable(vcpu->arch.gmap);
359 save_fp_regs(&vcpu->arch.guest_fpregs); 360 save_fp_ctl(&vcpu->arch.guest_fpregs.fpc);
361 save_fp_regs(vcpu->arch.guest_fpregs.fprs);
360 save_access_regs(vcpu->run->s.regs.acrs); 362 save_access_regs(vcpu->run->s.regs.acrs);
361 restore_fp_regs(&vcpu->arch.host_fpregs); 363 restore_fp_ctl(&vcpu->arch.host_fpregs.fpc);
364 restore_fp_regs(vcpu->arch.host_fpregs.fprs);
362 restore_access_regs(vcpu->arch.host_acrs); 365 restore_access_regs(vcpu->arch.host_acrs);
363} 366}
364 367
@@ -618,9 +621,12 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
618 621
619int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) 622int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
620{ 623{
624 if (test_fp_ctl(fpu->fpc))
625 return -EINVAL;
621 memcpy(&vcpu->arch.guest_fpregs.fprs, &fpu->fprs, sizeof(fpu->fprs)); 626 memcpy(&vcpu->arch.guest_fpregs.fprs, &fpu->fprs, sizeof(fpu->fprs));
622 vcpu->arch.guest_fpregs.fpc = fpu->fpc & FPC_VALID_MASK; 627 vcpu->arch.guest_fpregs.fpc = fpu->fpc;
623 restore_fp_regs(&vcpu->arch.guest_fpregs); 628 restore_fp_ctl(&vcpu->arch.guest_fpregs.fpc);
629 restore_fp_regs(vcpu->arch.guest_fpregs.fprs);
624 return 0; 630 return 0;
625} 631}
626 632
@@ -689,9 +695,9 @@ static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu)
689 return 0; 695 return 0;
690} 696}
691 697
692static int __vcpu_run(struct kvm_vcpu *vcpu) 698static int vcpu_pre_run(struct kvm_vcpu *vcpu)
693{ 699{
694 int rc; 700 int rc, cpuflags;
695 701
696 memcpy(&vcpu->arch.sie_block->gg14, &vcpu->run->s.regs.gprs[14], 16); 702 memcpy(&vcpu->arch.sie_block->gg14, &vcpu->run->s.regs.gprs[14], 16);
697 703
@@ -709,28 +715,24 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
709 return rc; 715 return rc;
710 716
711 vcpu->arch.sie_block->icptcode = 0; 717 vcpu->arch.sie_block->icptcode = 0;
712 VCPU_EVENT(vcpu, 6, "entering sie flags %x", 718 cpuflags = atomic_read(&vcpu->arch.sie_block->cpuflags);
713 atomic_read(&vcpu->arch.sie_block->cpuflags)); 719 VCPU_EVENT(vcpu, 6, "entering sie flags %x", cpuflags);
714 trace_kvm_s390_sie_enter(vcpu, 720 trace_kvm_s390_sie_enter(vcpu, cpuflags);
715 atomic_read(&vcpu->arch.sie_block->cpuflags));
716 721
717 /* 722 return 0;
718 * As PF_VCPU will be used in fault handler, between guest_enter 723}
719 * and guest_exit should be no uaccess. 724
720 */ 725static int vcpu_post_run(struct kvm_vcpu *vcpu, int exit_reason)
721 preempt_disable(); 726{
722 kvm_guest_enter(); 727 int rc;
723 preempt_enable();
724 rc = sie64a(vcpu->arch.sie_block, vcpu->run->s.regs.gprs);
725 kvm_guest_exit();
726 728
727 VCPU_EVENT(vcpu, 6, "exit sie icptcode %d", 729 VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",
728 vcpu->arch.sie_block->icptcode); 730 vcpu->arch.sie_block->icptcode);
729 trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode); 731 trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode);
730 732
731 if (rc > 0) 733 if (exit_reason >= 0) {
732 rc = 0; 734 rc = 0;
733 if (rc < 0) { 735 } else {
734 if (kvm_is_ucontrol(vcpu->kvm)) { 736 if (kvm_is_ucontrol(vcpu->kvm)) {
735 rc = SIE_INTERCEPT_UCONTROL; 737 rc = SIE_INTERCEPT_UCONTROL;
736 } else { 738 } else {
@@ -741,6 +743,49 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
741 } 743 }
742 744
743 memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16); 745 memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16);
746
747 if (rc == 0) {
748 if (kvm_is_ucontrol(vcpu->kvm))
749 rc = -EOPNOTSUPP;
750 else
751 rc = kvm_handle_sie_intercept(vcpu);
752 }
753
754 return rc;
755}
756
757static int __vcpu_run(struct kvm_vcpu *vcpu)
758{
759 int rc, exit_reason;
760
761 /*
762 * We try to hold kvm->srcu during most of vcpu_run (except when run-
763 * ning the guest), so that memslots (and other stuff) are protected
764 */
765 vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
766
767 do {
768 rc = vcpu_pre_run(vcpu);
769 if (rc)
770 break;
771
772 srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
773 /*
774 * As PF_VCPU will be used in fault handler, between
775 * guest_enter and guest_exit should be no uaccess.
776 */
777 preempt_disable();
778 kvm_guest_enter();
779 preempt_enable();
780 exit_reason = sie64a(vcpu->arch.sie_block,
781 vcpu->run->s.regs.gprs);
782 kvm_guest_exit();
783 vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
784
785 rc = vcpu_post_run(vcpu, exit_reason);
786 } while (!signal_pending(current) && !rc);
787
788 srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
744 return rc; 789 return rc;
745} 790}
746 791
@@ -749,7 +794,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
749 int rc; 794 int rc;
750 sigset_t sigsaved; 795 sigset_t sigsaved;
751 796
752rerun_vcpu:
753 if (vcpu->sigset_active) 797 if (vcpu->sigset_active)
754 sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); 798 sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);
755 799
@@ -782,19 +826,7 @@ rerun_vcpu:
782 } 826 }
783 827
784 might_fault(); 828 might_fault();
785 829 rc = __vcpu_run(vcpu);
786 do {
787 rc = __vcpu_run(vcpu);
788 if (rc)
789 break;
790 if (kvm_is_ucontrol(vcpu->kvm))
791 rc = -EOPNOTSUPP;
792 else
793 rc = kvm_handle_sie_intercept(vcpu);
794 } while (!signal_pending(current) && !rc);
795
796 if (rc == SIE_INTERCEPT_RERUNVCPU)
797 goto rerun_vcpu;
798 830
799 if (signal_pending(current) && !rc) { 831 if (signal_pending(current) && !rc) {
800 kvm_run->exit_reason = KVM_EXIT_INTR; 832 kvm_run->exit_reason = KVM_EXIT_INTR;
@@ -876,7 +908,8 @@ int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
876 * copying in vcpu load/put. Lets update our copies before we save 908 * copying in vcpu load/put. Lets update our copies before we save
877 * it into the save area 909 * it into the save area
878 */ 910 */
879 save_fp_regs(&vcpu->arch.guest_fpregs); 911 save_fp_ctl(&vcpu->arch.guest_fpregs.fpc);
912 save_fp_regs(vcpu->arch.guest_fpregs.fprs);
880 save_access_regs(vcpu->run->s.regs.acrs); 913 save_access_regs(vcpu->run->s.regs.acrs);
881 914
882 if (__guestcopy(vcpu, addr + offsetof(struct save_area, fp_regs), 915 if (__guestcopy(vcpu, addr + offsetof(struct save_area, fp_regs),
@@ -951,6 +984,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
951{ 984{
952 struct kvm_vcpu *vcpu = filp->private_data; 985 struct kvm_vcpu *vcpu = filp->private_data;
953 void __user *argp = (void __user *)arg; 986 void __user *argp = (void __user *)arg;
987 int idx;
954 long r; 988 long r;
955 989
956 switch (ioctl) { 990 switch (ioctl) {
@@ -964,7 +998,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
964 break; 998 break;
965 } 999 }
966 case KVM_S390_STORE_STATUS: 1000 case KVM_S390_STORE_STATUS:
1001 idx = srcu_read_lock(&vcpu->kvm->srcu);
967 r = kvm_s390_vcpu_store_status(vcpu, arg); 1002 r = kvm_s390_vcpu_store_status(vcpu, arg);
1003 srcu_read_unlock(&vcpu->kvm->srcu, idx);
968 break; 1004 break;
969 case KVM_S390_SET_INITIAL_PSW: { 1005 case KVM_S390_SET_INITIAL_PSW: {
970 psw_t psw; 1006 psw_t psw;
@@ -1060,12 +1096,13 @@ int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
1060 return VM_FAULT_SIGBUS; 1096 return VM_FAULT_SIGBUS;
1061} 1097}
1062 1098
1063void kvm_arch_free_memslot(struct kvm_memory_slot *free, 1099void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
1064 struct kvm_memory_slot *dont) 1100 struct kvm_memory_slot *dont)
1065{ 1101{
1066} 1102}
1067 1103
1068int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) 1104int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
1105 unsigned long npages)
1069{ 1106{
1070 return 0; 1107 return 0;
1071} 1108}
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index dc99f1ca4267..b44912a32949 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -28,8 +28,7 @@ typedef int (*intercept_handler_t)(struct kvm_vcpu *vcpu);
28extern unsigned long *vfacilities; 28extern unsigned long *vfacilities;
29 29
30/* negativ values are error codes, positive values for internal conditions */ 30/* negativ values are error codes, positive values for internal conditions */
31#define SIE_INTERCEPT_RERUNVCPU (1<<0) 31#define SIE_INTERCEPT_UCONTROL (1<<0)
32#define SIE_INTERCEPT_UCONTROL (1<<1)
33int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu); 32int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu);
34 33
35#define VM_EVENT(d_kvm, d_loglevel, d_string, d_args...)\ 34#define VM_EVENT(d_kvm, d_loglevel, d_string, d_args...)\
@@ -91,8 +90,10 @@ static inline void kvm_s390_get_base_disp_sse(struct kvm_vcpu *vcpu,
91 90
92static inline void kvm_s390_get_regs_rre(struct kvm_vcpu *vcpu, int *r1, int *r2) 91static inline void kvm_s390_get_regs_rre(struct kvm_vcpu *vcpu, int *r1, int *r2)
93{ 92{
94 *r1 = (vcpu->arch.sie_block->ipb & 0x00f00000) >> 20; 93 if (r1)
95 *r2 = (vcpu->arch.sie_block->ipb & 0x000f0000) >> 16; 94 *r1 = (vcpu->arch.sie_block->ipb & 0x00f00000) >> 20;
95 if (r2)
96 *r2 = (vcpu->arch.sie_block->ipb & 0x000f0000) >> 16;
96} 97}
97 98
98static inline u64 kvm_s390_get_base_disp_rsy(struct kvm_vcpu *vcpu) 99static inline u64 kvm_s390_get_base_disp_rsy(struct kvm_vcpu *vcpu)
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 59200ee275e5..2440602e6df1 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -30,6 +30,38 @@
30#include "kvm-s390.h" 30#include "kvm-s390.h"
31#include "trace.h" 31#include "trace.h"
32 32
33/* Handle SCK (SET CLOCK) interception */
34static int handle_set_clock(struct kvm_vcpu *vcpu)
35{
36 struct kvm_vcpu *cpup;
37 s64 hostclk, val;
38 u64 op2;
39 int i;
40
41 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
42 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
43
44 op2 = kvm_s390_get_base_disp_s(vcpu);
45 if (op2 & 7) /* Operand must be on a doubleword boundary */
46 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
47 if (get_guest(vcpu, val, (u64 __user *) op2))
48 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
49
50 if (store_tod_clock(&hostclk)) {
51 kvm_s390_set_psw_cc(vcpu, 3);
52 return 0;
53 }
54 val = (val - hostclk) & ~0x3fUL;
55
56 mutex_lock(&vcpu->kvm->lock);
57 kvm_for_each_vcpu(i, cpup, vcpu->kvm)
58 cpup->arch.sie_block->epoch = val;
59 mutex_unlock(&vcpu->kvm->lock);
60
61 kvm_s390_set_psw_cc(vcpu, 0);
62 return 0;
63}
64
33static int handle_set_prefix(struct kvm_vcpu *vcpu) 65static int handle_set_prefix(struct kvm_vcpu *vcpu)
34{ 66{
35 u64 operand2; 67 u64 operand2;
@@ -128,6 +160,33 @@ static int handle_skey(struct kvm_vcpu *vcpu)
128 return 0; 160 return 0;
129} 161}
130 162
163static int handle_test_block(struct kvm_vcpu *vcpu)
164{
165 unsigned long hva;
166 gpa_t addr;
167 int reg2;
168
169 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
170 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
171
172 kvm_s390_get_regs_rre(vcpu, NULL, &reg2);
173 addr = vcpu->run->s.regs.gprs[reg2] & PAGE_MASK;
174 addr = kvm_s390_real_to_abs(vcpu, addr);
175
176 hva = gfn_to_hva(vcpu->kvm, gpa_to_gfn(addr));
177 if (kvm_is_error_hva(hva))
178 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
179 /*
180 * We don't expect errors on modern systems, and do not care
181 * about storage keys (yet), so let's just clear the page.
182 */
183 if (clear_user((void __user *)hva, PAGE_SIZE) != 0)
184 return -EFAULT;
185 kvm_s390_set_psw_cc(vcpu, 0);
186 vcpu->run->s.regs.gprs[0] = 0;
187 return 0;
188}
189
131static int handle_tpi(struct kvm_vcpu *vcpu) 190static int handle_tpi(struct kvm_vcpu *vcpu)
132{ 191{
133 struct kvm_s390_interrupt_info *inti; 192 struct kvm_s390_interrupt_info *inti;
@@ -438,12 +497,14 @@ out_exception:
438 497
439static const intercept_handler_t b2_handlers[256] = { 498static const intercept_handler_t b2_handlers[256] = {
440 [0x02] = handle_stidp, 499 [0x02] = handle_stidp,
500 [0x04] = handle_set_clock,
441 [0x10] = handle_set_prefix, 501 [0x10] = handle_set_prefix,
442 [0x11] = handle_store_prefix, 502 [0x11] = handle_store_prefix,
443 [0x12] = handle_store_cpu_address, 503 [0x12] = handle_store_cpu_address,
444 [0x29] = handle_skey, 504 [0x29] = handle_skey,
445 [0x2a] = handle_skey, 505 [0x2a] = handle_skey,
446 [0x2b] = handle_skey, 506 [0x2b] = handle_skey,
507 [0x2c] = handle_test_block,
447 [0x30] = handle_io_inst, 508 [0x30] = handle_io_inst,
448 [0x31] = handle_io_inst, 509 [0x31] = handle_io_inst,
449 [0x32] = handle_io_inst, 510 [0x32] = handle_io_inst,
diff --git a/arch/s390/kvm/trace.h b/arch/s390/kvm/trace.h
index c2f582bb1cb2..0c991c6748ab 100644
--- a/arch/s390/kvm/trace.h
+++ b/arch/s390/kvm/trace.h
@@ -4,6 +4,7 @@
4#include <linux/tracepoint.h> 4#include <linux/tracepoint.h>
5#include <asm/sigp.h> 5#include <asm/sigp.h>
6#include <asm/debug.h> 6#include <asm/debug.h>
7#include <asm/dis.h>
7 8
8#undef TRACE_SYSTEM 9#undef TRACE_SYSTEM
9#define TRACE_SYSTEM kvm 10#define TRACE_SYSTEM kvm
diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile
index 20b0e97a7df2..b068729e50ac 100644
--- a/arch/s390/lib/Makefile
+++ b/arch/s390/lib/Makefile
@@ -2,7 +2,7 @@
2# Makefile for s390-specific library files.. 2# Makefile for s390-specific library files..
3# 3#
4 4
5lib-y += delay.o string.o uaccess_std.o uaccess_pt.o 5lib-y += delay.o string.o uaccess_pt.o find.o
6obj-$(CONFIG_32BIT) += div64.o qrnnd.o ucmpdi2.o mem32.o 6obj-$(CONFIG_32BIT) += div64.o qrnnd.o ucmpdi2.o mem32.o
7obj-$(CONFIG_64BIT) += mem64.o 7obj-$(CONFIG_64BIT) += mem64.o
8lib-$(CONFIG_64BIT) += uaccess_mvcos.o 8lib-$(CONFIG_64BIT) += uaccess_mvcos.o
diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c
index 57c87d7d7ede..a9f3d0042d58 100644
--- a/arch/s390/lib/delay.c
+++ b/arch/s390/lib/delay.c
@@ -44,7 +44,7 @@ static void __udelay_disabled(unsigned long long usecs)
44 do { 44 do {
45 set_clock_comparator(end); 45 set_clock_comparator(end);
46 vtime_stop_cpu(); 46 vtime_stop_cpu();
47 } while (get_tod_clock() < end); 47 } while (get_tod_clock_fast() < end);
48 lockdep_on(); 48 lockdep_on();
49 __ctl_load(cr0, 0, 0); 49 __ctl_load(cr0, 0, 0);
50 __ctl_load(cr6, 6, 6); 50 __ctl_load(cr6, 6, 6);
@@ -55,7 +55,7 @@ static void __udelay_enabled(unsigned long long usecs)
55{ 55{
56 u64 clock_saved, end; 56 u64 clock_saved, end;
57 57
58 end = get_tod_clock() + (usecs << 12); 58 end = get_tod_clock_fast() + (usecs << 12);
59 do { 59 do {
60 clock_saved = 0; 60 clock_saved = 0;
61 if (end < S390_lowcore.clock_comparator) { 61 if (end < S390_lowcore.clock_comparator) {
@@ -65,7 +65,7 @@ static void __udelay_enabled(unsigned long long usecs)
65 vtime_stop_cpu(); 65 vtime_stop_cpu();
66 if (clock_saved) 66 if (clock_saved)
67 local_tick_enable(clock_saved); 67 local_tick_enable(clock_saved);
68 } while (get_tod_clock() < end); 68 } while (get_tod_clock_fast() < end);
69} 69}
70 70
71/* 71/*
@@ -109,8 +109,8 @@ void udelay_simple(unsigned long long usecs)
109{ 109{
110 u64 end; 110 u64 end;
111 111
112 end = get_tod_clock() + (usecs << 12); 112 end = get_tod_clock_fast() + (usecs << 12);
113 while (get_tod_clock() < end) 113 while (get_tod_clock_fast() < end)
114 cpu_relax(); 114 cpu_relax();
115} 115}
116 116
@@ -120,10 +120,10 @@ void __ndelay(unsigned long long nsecs)
120 120
121 nsecs <<= 9; 121 nsecs <<= 9;
122 do_div(nsecs, 125); 122 do_div(nsecs, 125);
123 end = get_tod_clock() + nsecs; 123 end = get_tod_clock_fast() + nsecs;
124 if (nsecs & ~0xfffUL) 124 if (nsecs & ~0xfffUL)
125 __udelay(nsecs >> 12); 125 __udelay(nsecs >> 12);
126 while (get_tod_clock() < end) 126 while (get_tod_clock_fast() < end)
127 barrier(); 127 barrier();
128} 128}
129EXPORT_SYMBOL(__ndelay); 129EXPORT_SYMBOL(__ndelay);
diff --git a/arch/s390/lib/find.c b/arch/s390/lib/find.c
new file mode 100644
index 000000000000..620d34d6487e
--- /dev/null
+++ b/arch/s390/lib/find.c
@@ -0,0 +1,77 @@
1/*
2 * MSB0 numbered special bitops handling.
3 *
4 * On s390x the bits are numbered:
5 * |0..............63|64............127|128...........191|192...........255|
6 * and on s390:
7 * |0.....31|31....63|64....95|96...127|128..159|160..191|192..223|224..255|
8 *
9 * The reason for this bit numbering is the fact that the hardware sets bits
10 * in a bitmap starting at bit 0 (MSB) and we don't want to scan the bitmap
11 * from the 'wrong end'.
12 */
13
14#include <linux/compiler.h>
15#include <linux/bitops.h>
16#include <linux/export.h>
17
18unsigned long find_first_bit_inv(const unsigned long *addr, unsigned long size)
19{
20 const unsigned long *p = addr;
21 unsigned long result = 0;
22 unsigned long tmp;
23
24 while (size & ~(BITS_PER_LONG - 1)) {
25 if ((tmp = *(p++)))
26 goto found;
27 result += BITS_PER_LONG;
28 size -= BITS_PER_LONG;
29 }
30 if (!size)
31 return result;
32 tmp = (*p) & (~0UL << (BITS_PER_LONG - size));
33 if (!tmp) /* Are any bits set? */
34 return result + size; /* Nope. */
35found:
36 return result + (__fls(tmp) ^ (BITS_PER_LONG - 1));
37}
38EXPORT_SYMBOL(find_first_bit_inv);
39
40unsigned long find_next_bit_inv(const unsigned long *addr, unsigned long size,
41 unsigned long offset)
42{
43 const unsigned long *p = addr + (offset / BITS_PER_LONG);
44 unsigned long result = offset & ~(BITS_PER_LONG - 1);
45 unsigned long tmp;
46
47 if (offset >= size)
48 return size;
49 size -= result;
50 offset %= BITS_PER_LONG;
51 if (offset) {
52 tmp = *(p++);
53 tmp &= (~0UL >> offset);
54 if (size < BITS_PER_LONG)
55 goto found_first;
56 if (tmp)
57 goto found_middle;
58 size -= BITS_PER_LONG;
59 result += BITS_PER_LONG;
60 }
61 while (size & ~(BITS_PER_LONG-1)) {
62 if ((tmp = *(p++)))
63 goto found_middle;
64 result += BITS_PER_LONG;
65 size -= BITS_PER_LONG;
66 }
67 if (!size)
68 return result;
69 tmp = *p;
70found_first:
71 tmp &= (~0UL << (BITS_PER_LONG - size));
72 if (!tmp) /* Are any bits set? */
73 return result + size; /* Nope. */
74found_middle:
75 return result + (__fls(tmp) ^ (BITS_PER_LONG - 1));
76}
77EXPORT_SYMBOL(find_next_bit_inv);
diff --git a/arch/s390/lib/uaccess_mvcos.c b/arch/s390/lib/uaccess_mvcos.c
index 1829742bf479..4b7993bf69b9 100644
--- a/arch/s390/lib/uaccess_mvcos.c
+++ b/arch/s390/lib/uaccess_mvcos.c
@@ -65,13 +65,6 @@ static size_t copy_from_user_mvcos(size_t size, const void __user *ptr, void *x)
65 return size; 65 return size;
66} 66}
67 67
68static size_t copy_from_user_mvcos_check(size_t size, const void __user *ptr, void *x)
69{
70 if (size <= 256)
71 return copy_from_user_std(size, ptr, x);
72 return copy_from_user_mvcos(size, ptr, x);
73}
74
75static size_t copy_to_user_mvcos(size_t size, void __user *ptr, const void *x) 68static size_t copy_to_user_mvcos(size_t size, void __user *ptr, const void *x)
76{ 69{
77 register unsigned long reg0 asm("0") = 0x810000UL; 70 register unsigned long reg0 asm("0") = 0x810000UL;
@@ -101,14 +94,6 @@ static size_t copy_to_user_mvcos(size_t size, void __user *ptr, const void *x)
101 return size; 94 return size;
102} 95}
103 96
104static size_t copy_to_user_mvcos_check(size_t size, void __user *ptr,
105 const void *x)
106{
107 if (size <= 256)
108 return copy_to_user_std(size, ptr, x);
109 return copy_to_user_mvcos(size, ptr, x);
110}
111
112static size_t copy_in_user_mvcos(size_t size, void __user *to, 97static size_t copy_in_user_mvcos(size_t size, void __user *to,
113 const void __user *from) 98 const void __user *from)
114{ 99{
@@ -201,23 +186,8 @@ static size_t strncpy_from_user_mvcos(size_t count, const char __user *src,
201} 186}
202 187
203struct uaccess_ops uaccess_mvcos = { 188struct uaccess_ops uaccess_mvcos = {
204 .copy_from_user = copy_from_user_mvcos_check,
205 .copy_from_user_small = copy_from_user_std,
206 .copy_to_user = copy_to_user_mvcos_check,
207 .copy_to_user_small = copy_to_user_std,
208 .copy_in_user = copy_in_user_mvcos,
209 .clear_user = clear_user_mvcos,
210 .strnlen_user = strnlen_user_std,
211 .strncpy_from_user = strncpy_from_user_std,
212 .futex_atomic_op = futex_atomic_op_std,
213 .futex_atomic_cmpxchg = futex_atomic_cmpxchg_std,
214};
215
216struct uaccess_ops uaccess_mvcos_switch = {
217 .copy_from_user = copy_from_user_mvcos, 189 .copy_from_user = copy_from_user_mvcos,
218 .copy_from_user_small = copy_from_user_mvcos,
219 .copy_to_user = copy_to_user_mvcos, 190 .copy_to_user = copy_to_user_mvcos,
220 .copy_to_user_small = copy_to_user_mvcos,
221 .copy_in_user = copy_in_user_mvcos, 191 .copy_in_user = copy_in_user_mvcos,
222 .clear_user = clear_user_mvcos, 192 .clear_user = clear_user_mvcos,
223 .strnlen_user = strnlen_user_mvcos, 193 .strnlen_user = strnlen_user_mvcos,
diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c
index 1694d738b175..97e03caf7825 100644
--- a/arch/s390/lib/uaccess_pt.c
+++ b/arch/s390/lib/uaccess_pt.c
@@ -461,9 +461,7 @@ int futex_atomic_cmpxchg_pt(u32 *uval, u32 __user *uaddr,
461 461
462struct uaccess_ops uaccess_pt = { 462struct uaccess_ops uaccess_pt = {
463 .copy_from_user = copy_from_user_pt, 463 .copy_from_user = copy_from_user_pt,
464 .copy_from_user_small = copy_from_user_pt,
465 .copy_to_user = copy_to_user_pt, 464 .copy_to_user = copy_to_user_pt,
466 .copy_to_user_small = copy_to_user_pt,
467 .copy_in_user = copy_in_user_pt, 465 .copy_in_user = copy_in_user_pt,
468 .clear_user = clear_user_pt, 466 .clear_user = clear_user_pt,
469 .strnlen_user = strnlen_user_pt, 467 .strnlen_user = strnlen_user_pt,
diff --git a/arch/s390/lib/uaccess_std.c b/arch/s390/lib/uaccess_std.c
deleted file mode 100644
index 4a75d475b06a..000000000000
--- a/arch/s390/lib/uaccess_std.c
+++ /dev/null
@@ -1,305 +0,0 @@
1/*
2 * Standard user space access functions based on mvcp/mvcs and doing
3 * interesting things in the secondary space mode.
4 *
5 * Copyright IBM Corp. 2006
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 * Gerald Schaefer (gerald.schaefer@de.ibm.com)
8 */
9
10#include <linux/errno.h>
11#include <linux/mm.h>
12#include <linux/uaccess.h>
13#include <asm/futex.h>
14#include "uaccess.h"
15
16#ifndef CONFIG_64BIT
17#define AHI "ahi"
18#define ALR "alr"
19#define CLR "clr"
20#define LHI "lhi"
21#define SLR "slr"
22#else
23#define AHI "aghi"
24#define ALR "algr"
25#define CLR "clgr"
26#define LHI "lghi"
27#define SLR "slgr"
28#endif
29
30size_t copy_from_user_std(size_t size, const void __user *ptr, void *x)
31{
32 unsigned long tmp1, tmp2;
33
34 tmp1 = -256UL;
35 asm volatile(
36 "0: mvcp 0(%0,%2),0(%1),%3\n"
37 "10:jz 8f\n"
38 "1:"ALR" %0,%3\n"
39 " la %1,256(%1)\n"
40 " la %2,256(%2)\n"
41 "2: mvcp 0(%0,%2),0(%1),%3\n"
42 "11:jnz 1b\n"
43 " j 8f\n"
44 "3: la %4,255(%1)\n" /* %4 = ptr + 255 */
45 " "LHI" %3,-4096\n"
46 " nr %4,%3\n" /* %4 = (ptr + 255) & -4096 */
47 " "SLR" %4,%1\n"
48 " "CLR" %0,%4\n" /* copy crosses next page boundary? */
49 " jnh 5f\n"
50 "4: mvcp 0(%4,%2),0(%1),%3\n"
51 "12:"SLR" %0,%4\n"
52 " "ALR" %2,%4\n"
53 "5:"LHI" %4,-1\n"
54 " "ALR" %4,%0\n" /* copy remaining size, subtract 1 */
55 " bras %3,7f\n" /* memset loop */
56 " xc 0(1,%2),0(%2)\n"
57 "6: xc 0(256,%2),0(%2)\n"
58 " la %2,256(%2)\n"
59 "7:"AHI" %4,-256\n"
60 " jnm 6b\n"
61 " ex %4,0(%3)\n"
62 " j 9f\n"
63 "8:"SLR" %0,%0\n"
64 "9: \n"
65 EX_TABLE(0b,3b) EX_TABLE(2b,3b) EX_TABLE(4b,5b)
66 EX_TABLE(10b,3b) EX_TABLE(11b,3b) EX_TABLE(12b,5b)
67 : "+a" (size), "+a" (ptr), "+a" (x), "+a" (tmp1), "=a" (tmp2)
68 : : "cc", "memory");
69 return size;
70}
71
72static size_t copy_from_user_std_check(size_t size, const void __user *ptr,
73 void *x)
74{
75 if (size <= 1024)
76 return copy_from_user_std(size, ptr, x);
77 return copy_from_user_pt(size, ptr, x);
78}
79
80size_t copy_to_user_std(size_t size, void __user *ptr, const void *x)
81{
82 unsigned long tmp1, tmp2;
83
84 tmp1 = -256UL;
85 asm volatile(
86 "0: mvcs 0(%0,%1),0(%2),%3\n"
87 "7: jz 5f\n"
88 "1:"ALR" %0,%3\n"
89 " la %1,256(%1)\n"
90 " la %2,256(%2)\n"
91 "2: mvcs 0(%0,%1),0(%2),%3\n"
92 "8: jnz 1b\n"
93 " j 5f\n"
94 "3: la %4,255(%1)\n" /* %4 = ptr + 255 */
95 " "LHI" %3,-4096\n"
96 " nr %4,%3\n" /* %4 = (ptr + 255) & -4096 */
97 " "SLR" %4,%1\n"
98 " "CLR" %0,%4\n" /* copy crosses next page boundary? */
99 " jnh 6f\n"
100 "4: mvcs 0(%4,%1),0(%2),%3\n"
101 "9:"SLR" %0,%4\n"
102 " j 6f\n"
103 "5:"SLR" %0,%0\n"
104 "6: \n"
105 EX_TABLE(0b,3b) EX_TABLE(2b,3b) EX_TABLE(4b,6b)
106 EX_TABLE(7b,3b) EX_TABLE(8b,3b) EX_TABLE(9b,6b)
107 : "+a" (size), "+a" (ptr), "+a" (x), "+a" (tmp1), "=a" (tmp2)
108 : : "cc", "memory");
109 return size;
110}
111
112static size_t copy_to_user_std_check(size_t size, void __user *ptr,
113 const void *x)
114{
115 if (size <= 1024)
116 return copy_to_user_std(size, ptr, x);
117 return copy_to_user_pt(size, ptr, x);
118}
119
120static size_t copy_in_user_std(size_t size, void __user *to,
121 const void __user *from)
122{
123 unsigned long tmp1;
124
125 asm volatile(
126 " sacf 256\n"
127 " "AHI" %0,-1\n"
128 " jo 5f\n"
129 " bras %3,3f\n"
130 "0:"AHI" %0,257\n"
131 "1: mvc 0(1,%1),0(%2)\n"
132 " la %1,1(%1)\n"
133 " la %2,1(%2)\n"
134 " "AHI" %0,-1\n"
135 " jnz 1b\n"
136 " j 5f\n"
137 "2: mvc 0(256,%1),0(%2)\n"
138 " la %1,256(%1)\n"
139 " la %2,256(%2)\n"
140 "3:"AHI" %0,-256\n"
141 " jnm 2b\n"
142 "4: ex %0,1b-0b(%3)\n"
143 "5: "SLR" %0,%0\n"
144 "6: sacf 0\n"
145 EX_TABLE(1b,6b) EX_TABLE(2b,0b) EX_TABLE(4b,0b)
146 : "+a" (size), "+a" (to), "+a" (from), "=a" (tmp1)
147 : : "cc", "memory");
148 return size;
149}
150
151static size_t clear_user_std(size_t size, void __user *to)
152{
153 unsigned long tmp1, tmp2;
154
155 asm volatile(
156 " sacf 256\n"
157 " "AHI" %0,-1\n"
158 " jo 5f\n"
159 " bras %3,3f\n"
160 " xc 0(1,%1),0(%1)\n"
161 "0:"AHI" %0,257\n"
162 " la %2,255(%1)\n" /* %2 = ptr + 255 */
163 " srl %2,12\n"
164 " sll %2,12\n" /* %2 = (ptr + 255) & -4096 */
165 " "SLR" %2,%1\n"
166 " "CLR" %0,%2\n" /* clear crosses next page boundary? */
167 " jnh 5f\n"
168 " "AHI" %2,-1\n"
169 "1: ex %2,0(%3)\n"
170 " "AHI" %2,1\n"
171 " "SLR" %0,%2\n"
172 " j 5f\n"
173 "2: xc 0(256,%1),0(%1)\n"
174 " la %1,256(%1)\n"
175 "3:"AHI" %0,-256\n"
176 " jnm 2b\n"
177 "4: ex %0,0(%3)\n"
178 "5: "SLR" %0,%0\n"
179 "6: sacf 0\n"
180 EX_TABLE(1b,6b) EX_TABLE(2b,0b) EX_TABLE(4b,0b)
181 : "+a" (size), "+a" (to), "=a" (tmp1), "=a" (tmp2)
182 : : "cc", "memory");
183 return size;
184}
185
186size_t strnlen_user_std(size_t size, const char __user *src)
187{
188 register unsigned long reg0 asm("0") = 0UL;
189 unsigned long tmp1, tmp2;
190
191 if (unlikely(!size))
192 return 0;
193 asm volatile(
194 " la %2,0(%1)\n"
195 " la %3,0(%0,%1)\n"
196 " "SLR" %0,%0\n"
197 " sacf 256\n"
198 "0: srst %3,%2\n"
199 " jo 0b\n"
200 " la %0,1(%3)\n" /* strnlen_user results includes \0 */
201 " "SLR" %0,%1\n"
202 "1: sacf 0\n"
203 EX_TABLE(0b,1b)
204 : "+a" (size), "+a" (src), "=a" (tmp1), "=a" (tmp2)
205 : "d" (reg0) : "cc", "memory");
206 return size;
207}
208
209size_t strncpy_from_user_std(size_t count, const char __user *src, char *dst)
210{
211 size_t done, len, offset, len_str;
212
213 if (unlikely(!count))
214 return 0;
215 done = 0;
216 do {
217 offset = (size_t)src & ~PAGE_MASK;
218 len = min(count - done, PAGE_SIZE - offset);
219 if (copy_from_user_std(len, src, dst))
220 return -EFAULT;
221 len_str = strnlen(dst, len);
222 done += len_str;
223 src += len_str;
224 dst += len_str;
225 } while ((len_str == len) && (done < count));
226 return done;
227}
228
229#define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \
230 asm volatile( \
231 " sacf 256\n" \
232 "0: l %1,0(%6)\n" \
233 "1:"insn \
234 "2: cs %1,%2,0(%6)\n" \
235 "3: jl 1b\n" \
236 " lhi %0,0\n" \
237 "4: sacf 0\n" \
238 EX_TABLE(0b,4b) EX_TABLE(2b,4b) EX_TABLE(3b,4b) \
239 : "=d" (ret), "=&d" (oldval), "=&d" (newval), \
240 "=m" (*uaddr) \
241 : "0" (-EFAULT), "d" (oparg), "a" (uaddr), \
242 "m" (*uaddr) : "cc");
243
244int futex_atomic_op_std(int op, u32 __user *uaddr, int oparg, int *old)
245{
246 int oldval = 0, newval, ret;
247
248 switch (op) {
249 case FUTEX_OP_SET:
250 __futex_atomic_op("lr %2,%5\n",
251 ret, oldval, newval, uaddr, oparg);
252 break;
253 case FUTEX_OP_ADD:
254 __futex_atomic_op("lr %2,%1\nar %2,%5\n",
255 ret, oldval, newval, uaddr, oparg);
256 break;
257 case FUTEX_OP_OR:
258 __futex_atomic_op("lr %2,%1\nor %2,%5\n",
259 ret, oldval, newval, uaddr, oparg);
260 break;
261 case FUTEX_OP_ANDN:
262 __futex_atomic_op("lr %2,%1\nnr %2,%5\n",
263 ret, oldval, newval, uaddr, oparg);
264 break;
265 case FUTEX_OP_XOR:
266 __futex_atomic_op("lr %2,%1\nxr %2,%5\n",
267 ret, oldval, newval, uaddr, oparg);
268 break;
269 default:
270 ret = -ENOSYS;
271 }
272 *old = oldval;
273 return ret;
274}
275
276int futex_atomic_cmpxchg_std(u32 *uval, u32 __user *uaddr,
277 u32 oldval, u32 newval)
278{
279 int ret;
280
281 asm volatile(
282 " sacf 256\n"
283 "0: cs %1,%4,0(%5)\n"
284 "1: la %0,0\n"
285 "2: sacf 0\n"
286 EX_TABLE(0b,2b) EX_TABLE(1b,2b)
287 : "=d" (ret), "+d" (oldval), "=m" (*uaddr)
288 : "0" (-EFAULT), "d" (newval), "a" (uaddr), "m" (*uaddr)
289 : "cc", "memory" );
290 *uval = oldval;
291 return ret;
292}
293
294struct uaccess_ops uaccess_std = {
295 .copy_from_user = copy_from_user_std_check,
296 .copy_from_user_small = copy_from_user_std,
297 .copy_to_user = copy_to_user_std_check,
298 .copy_to_user_small = copy_to_user_std,
299 .copy_in_user = copy_in_user_std,
300 .clear_user = clear_user_std,
301 .strnlen_user = strnlen_user_std,
302 .strncpy_from_user = strncpy_from_user_std,
303 .futex_atomic_op = futex_atomic_op_std,
304 .futex_atomic_cmpxchg = futex_atomic_cmpxchg_std,
305};
diff --git a/arch/s390/math-emu/math.c b/arch/s390/math-emu/math.c
index 58bff541fde9..a6ba0d724335 100644
--- a/arch/s390/math-emu/math.c
+++ b/arch/s390/math-emu/math.c
@@ -19,6 +19,8 @@
19#include <math-emu/double.h> 19#include <math-emu/double.h>
20#include <math-emu/quad.h> 20#include <math-emu/quad.h>
21 21
22#define FPC_VALID_MASK 0xF8F8FF03
23
22/* 24/*
23 * I miss a macro to round a floating point number to the 25 * I miss a macro to round a floating point number to the
24 * nearest integer in the same floating point format. 26 * nearest integer in the same floating point format.
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index 9d84a1feefef..79ddd580d605 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -253,12 +253,12 @@ static int cmm_skip_blanks(char *cp, char **endp)
253 253
254static struct ctl_table cmm_table[]; 254static struct ctl_table cmm_table[];
255 255
256static int cmm_pages_handler(ctl_table *ctl, int write, void __user *buffer, 256static int cmm_pages_handler(struct ctl_table *ctl, int write,
257 size_t *lenp, loff_t *ppos) 257 void __user *buffer, size_t *lenp, loff_t *ppos)
258{ 258{
259 char buf[16], *p; 259 char buf[16], *p;
260 unsigned int len;
260 long nr; 261 long nr;
261 int len;
262 262
263 if (!*lenp || (*ppos && !write)) { 263 if (!*lenp || (*ppos && !write)) {
264 *lenp = 0; 264 *lenp = 0;
@@ -293,12 +293,12 @@ static int cmm_pages_handler(ctl_table *ctl, int write, void __user *buffer,
293 return 0; 293 return 0;
294} 294}
295 295
296static int cmm_timeout_handler(ctl_table *ctl, int write, void __user *buffer, 296static int cmm_timeout_handler(struct ctl_table *ctl, int write,
297 size_t *lenp, loff_t *ppos) 297 void __user *buffer, size_t *lenp, loff_t *ppos)
298{ 298{
299 char buf[64], *p; 299 char buf[64], *p;
300 long nr, seconds; 300 long nr, seconds;
301 int len; 301 unsigned int len;
302 302
303 if (!*lenp || (*ppos && !write)) { 303 if (!*lenp || (*ppos && !write)) {
304 *lenp = 0; 304 *lenp = 0;
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index fc6679210d83..d95265b2719f 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -115,13 +115,8 @@ static inline int user_space_fault(unsigned long trans_exc_code)
115 if (trans_exc_code == 2) 115 if (trans_exc_code == 2)
116 /* Access via secondary space, set_fs setting decides */ 116 /* Access via secondary space, set_fs setting decides */
117 return current->thread.mm_segment.ar4; 117 return current->thread.mm_segment.ar4;
118 if (s390_user_mode == HOME_SPACE_MODE)
119 /* User space if the access has been done via home space. */
120 return trans_exc_code == 3;
121 /* 118 /*
122 * If the user space is not the home space the kernel runs in home 119 * Access via primary space or access register is from user space
123 * space. Access via secondary space has already been covered,
124 * access via primary space or access register is from user space
125 * and access via home space is from the kernel. 120 * and access via home space is from the kernel.
126 */ 121 */
127 return trans_exc_code != 3; 122 return trans_exc_code != 3;
@@ -428,50 +423,13 @@ void __kprobes do_dat_exception(struct pt_regs *regs)
428 do_fault_error(regs, fault); 423 do_fault_error(regs, fault);
429} 424}
430 425
431#ifdef CONFIG_64BIT
432void __kprobes do_asce_exception(struct pt_regs *regs)
433{
434 struct mm_struct *mm = current->mm;
435 struct vm_area_struct *vma;
436 unsigned long trans_exc_code;
437
438 /*
439 * The instruction that caused the program check has
440 * been nullified. Don't signal single step via SIGTRAP.
441 */
442 clear_tsk_thread_flag(current, TIF_PER_TRAP);
443
444 trans_exc_code = regs->int_parm_long;
445 if (unlikely(!user_space_fault(trans_exc_code) || in_atomic() || !mm))
446 goto no_context;
447
448 down_read(&mm->mmap_sem);
449 vma = find_vma(mm, trans_exc_code & __FAIL_ADDR_MASK);
450 up_read(&mm->mmap_sem);
451
452 if (vma) {
453 update_mm(mm, current);
454 return;
455 }
456
457 /* User mode accesses just cause a SIGSEGV */
458 if (user_mode(regs)) {
459 do_sigsegv(regs, SEGV_MAPERR);
460 return;
461 }
462
463no_context:
464 do_no_context(regs);
465}
466#endif
467
468int __handle_fault(unsigned long uaddr, unsigned long pgm_int_code, int write) 426int __handle_fault(unsigned long uaddr, unsigned long pgm_int_code, int write)
469{ 427{
470 struct pt_regs regs; 428 struct pt_regs regs;
471 int access, fault; 429 int access, fault;
472 430
473 /* Emulate a uaccess fault from kernel mode. */ 431 /* Emulate a uaccess fault from kernel mode. */
474 regs.psw.mask = psw_kernel_bits | PSW_MASK_DAT | PSW_MASK_MCHECK; 432 regs.psw.mask = PSW_KERNEL_BITS | PSW_MASK_DAT | PSW_MASK_MCHECK;
475 if (!irqs_disabled()) 433 if (!irqs_disabled())
476 regs.psw.mask |= PSW_MASK_IO | PSW_MASK_EXT; 434 regs.psw.mask |= PSW_MASK_IO | PSW_MASK_EXT;
477 regs.psw.addr = (unsigned long) __builtin_return_address(0); 435 regs.psw.addr = (unsigned long) __builtin_return_address(0);
diff --git a/arch/s390/mm/gup.c b/arch/s390/mm/gup.c
index 5d758db27bdc..639fce464008 100644
--- a/arch/s390/mm/gup.c
+++ b/arch/s390/mm/gup.c
@@ -180,9 +180,15 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
180 addr = start; 180 addr = start;
181 len = (unsigned long) nr_pages << PAGE_SHIFT; 181 len = (unsigned long) nr_pages << PAGE_SHIFT;
182 end = start + len; 182 end = start + len;
183 if ((end < start) || (end > TASK_SIZE)) 183 if ((end <= start) || (end > TASK_SIZE))
184 return 0; 184 return 0;
185 185 /*
186 * local_irq_save() doesn't prevent pagetable teardown, but does
187 * prevent the pagetables from being freed on s390.
188 *
189 * So long as we atomically load page table pointers versus teardown,
190 * we can follow the address down to the the page and take a ref on it.
191 */
186 local_irq_save(flags); 192 local_irq_save(flags);
187 pgdp = pgd_offset(mm, addr); 193 pgdp = pgd_offset(mm, addr);
188 do { 194 do {
@@ -219,63 +225,22 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
219 struct page **pages) 225 struct page **pages)
220{ 226{
221 struct mm_struct *mm = current->mm; 227 struct mm_struct *mm = current->mm;
222 unsigned long addr, len, end; 228 int nr, ret;
223 unsigned long next;
224 pgd_t *pgdp, pgd;
225 int nr = 0;
226 229
227 start &= PAGE_MASK; 230 start &= PAGE_MASK;
228 addr = start; 231 nr = __get_user_pages_fast(start, nr_pages, write, pages);
229 len = (unsigned long) nr_pages << PAGE_SHIFT; 232 if (nr == nr_pages)
230 end = start + len; 233 return nr;
231 if ((end < start) || (end > TASK_SIZE)) 234
232 goto slow_irqon; 235 /* Try to get the remaining pages with get_user_pages */
233 236 start += nr << PAGE_SHIFT;
234 /* 237 pages += nr;
235 * local_irq_disable() doesn't prevent pagetable teardown, but does 238 down_read(&mm->mmap_sem);
236 * prevent the pagetables from being freed on s390. 239 ret = get_user_pages(current, mm, start,
237 * 240 nr_pages - nr, write, 0, pages, NULL);
238 * So long as we atomically load page table pointers versus teardown, 241 up_read(&mm->mmap_sem);
239 * we can follow the address down to the the page and take a ref on it. 242 /* Have to be a bit careful with return values */
240 */ 243 if (nr > 0)
241 local_irq_disable(); 244 ret = (ret < 0) ? nr : ret + nr;
242 pgdp = pgd_offset(mm, addr); 245 return ret;
243 do {
244 pgd = *pgdp;
245 barrier();
246 next = pgd_addr_end(addr, end);
247 if (pgd_none(pgd))
248 goto slow;
249 if (!gup_pud_range(pgdp, pgd, addr, next, write, pages, &nr))
250 goto slow;
251 } while (pgdp++, addr = next, addr != end);
252 local_irq_enable();
253
254 VM_BUG_ON(nr != (end - start) >> PAGE_SHIFT);
255 return nr;
256
257 {
258 int ret;
259slow:
260 local_irq_enable();
261slow_irqon:
262 /* Try to get the remaining pages with get_user_pages */
263 start += nr << PAGE_SHIFT;
264 pages += nr;
265
266 down_read(&mm->mmap_sem);
267 ret = get_user_pages(current, mm, start,
268 (end - start) >> PAGE_SHIFT, write, 0, pages, NULL);
269 up_read(&mm->mmap_sem);
270
271 /* Have to be a bit careful with return values */
272 if (nr > 0) {
273 if (ret < 0)
274 ret = nr;
275 else
276 ret += nr;
277 }
278
279 return ret;
280 }
281} 246}
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
index 40023290ee5b..9b436c21195e 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -64,6 +64,11 @@ static unsigned long mmap_rnd(void)
64 return (get_random_int() & 0x7ffUL) << PAGE_SHIFT; 64 return (get_random_int() & 0x7ffUL) << PAGE_SHIFT;
65} 65}
66 66
67static unsigned long mmap_base_legacy(void)
68{
69 return TASK_UNMAPPED_BASE + mmap_rnd();
70}
71
67static inline unsigned long mmap_base(void) 72static inline unsigned long mmap_base(void)
68{ 73{
69 unsigned long gap = rlimit(RLIMIT_STACK); 74 unsigned long gap = rlimit(RLIMIT_STACK);
@@ -89,7 +94,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
89 * bit is set, or if the expected stack growth is unlimited: 94 * bit is set, or if the expected stack growth is unlimited:
90 */ 95 */
91 if (mmap_is_legacy()) { 96 if (mmap_is_legacy()) {
92 mm->mmap_base = TASK_UNMAPPED_BASE; 97 mm->mmap_base = mmap_base_legacy();
93 mm->get_unmapped_area = arch_get_unmapped_area; 98 mm->get_unmapped_area = arch_get_unmapped_area;
94 } else { 99 } else {
95 mm->mmap_base = mmap_base(); 100 mm->mmap_base = mmap_base();
@@ -101,18 +106,12 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
101 106
102int s390_mmap_check(unsigned long addr, unsigned long len, unsigned long flags) 107int s390_mmap_check(unsigned long addr, unsigned long len, unsigned long flags)
103{ 108{
104 int rc;
105
106 if (is_compat_task() || (TASK_SIZE >= (1UL << 53))) 109 if (is_compat_task() || (TASK_SIZE >= (1UL << 53)))
107 return 0; 110 return 0;
108 if (!(flags & MAP_FIXED)) 111 if (!(flags & MAP_FIXED))
109 addr = 0; 112 addr = 0;
110 if ((addr + len) >= TASK_SIZE) { 113 if ((addr + len) >= TASK_SIZE)
111 rc = crst_table_upgrade(current->mm, 1UL << 53); 114 return crst_table_upgrade(current->mm, 1UL << 53);
112 if (rc)
113 return rc;
114 update_mm(current->mm, current);
115 }
116 return 0; 115 return 0;
117} 116}
118 117
@@ -132,7 +131,6 @@ s390_get_unmapped_area(struct file *filp, unsigned long addr,
132 rc = crst_table_upgrade(mm, 1UL << 53); 131 rc = crst_table_upgrade(mm, 1UL << 53);
133 if (rc) 132 if (rc)
134 return (unsigned long) rc; 133 return (unsigned long) rc;
135 update_mm(mm, current);
136 area = arch_get_unmapped_area(filp, addr, len, pgoff, flags); 134 area = arch_get_unmapped_area(filp, addr, len, pgoff, flags);
137 } 135 }
138 return area; 136 return area;
@@ -155,7 +153,6 @@ s390_get_unmapped_area_topdown(struct file *filp, const unsigned long addr,
155 rc = crst_table_upgrade(mm, 1UL << 53); 153 rc = crst_table_upgrade(mm, 1UL << 53);
156 if (rc) 154 if (rc)
157 return (unsigned long) rc; 155 return (unsigned long) rc;
158 update_mm(mm, current);
159 area = arch_get_unmapped_area_topdown(filp, addr, len, 156 area = arch_get_unmapped_area_topdown(filp, addr, len,
160 pgoff, flags); 157 pgoff, flags);
161 } 158 }
@@ -172,7 +169,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
172 * bit is set, or if the expected stack growth is unlimited: 169 * bit is set, or if the expected stack growth is unlimited:
173 */ 170 */
174 if (mmap_is_legacy()) { 171 if (mmap_is_legacy()) {
175 mm->mmap_base = TASK_UNMAPPED_BASE; 172 mm->mmap_base = mmap_base_legacy();
176 mm->get_unmapped_area = s390_get_unmapped_area; 173 mm->get_unmapped_area = s390_get_unmapped_area;
177 } else { 174 } else {
178 mm->mmap_base = mmap_base(); 175 mm->mmap_base = mmap_base();
diff --git a/arch/s390/mm/pageattr.c b/arch/s390/mm/pageattr.c
index 990397420e6b..8400f494623f 100644
--- a/arch/s390/mm/pageattr.c
+++ b/arch/s390/mm/pageattr.c
@@ -9,6 +9,7 @@
9#include <asm/pgtable.h> 9#include <asm/pgtable.h>
10#include <asm/page.h> 10#include <asm/page.h>
11 11
12#if PAGE_DEFAULT_KEY
12static inline unsigned long sske_frame(unsigned long addr, unsigned char skey) 13static inline unsigned long sske_frame(unsigned long addr, unsigned char skey)
13{ 14{
14 asm volatile(".insn rrf,0xb22b0000,%[skey],%[addr],9,0" 15 asm volatile(".insn rrf,0xb22b0000,%[skey],%[addr],9,0"
@@ -16,7 +17,7 @@ static inline unsigned long sske_frame(unsigned long addr, unsigned char skey)
16 return addr; 17 return addr;
17} 18}
18 19
19void storage_key_init_range(unsigned long start, unsigned long end) 20void __storage_key_init_range(unsigned long start, unsigned long end)
20{ 21{
21 unsigned long boundary, size; 22 unsigned long boundary, size;
22 23
@@ -36,6 +37,7 @@ void storage_key_init_range(unsigned long start, unsigned long end)
36 start += PAGE_SIZE; 37 start += PAGE_SIZE;
37 } 38 }
38} 39}
40#endif
39 41
40static pte_t *walk_page_table(unsigned long addr) 42static pte_t *walk_page_table(unsigned long addr)
41{ 43{
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index de8cbc30dcd1..e794c88f699a 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -48,12 +48,23 @@ void crst_table_free(struct mm_struct *mm, unsigned long *table)
48} 48}
49 49
50#ifdef CONFIG_64BIT 50#ifdef CONFIG_64BIT
51static void __crst_table_upgrade(void *arg)
52{
53 struct mm_struct *mm = arg;
54
55 if (current->active_mm == mm)
56 update_mm(mm, current);
57 __tlb_flush_local();
58}
59
51int crst_table_upgrade(struct mm_struct *mm, unsigned long limit) 60int crst_table_upgrade(struct mm_struct *mm, unsigned long limit)
52{ 61{
53 unsigned long *table, *pgd; 62 unsigned long *table, *pgd;
54 unsigned long entry; 63 unsigned long entry;
64 int flush;
55 65
56 BUG_ON(limit > (1UL << 53)); 66 BUG_ON(limit > (1UL << 53));
67 flush = 0;
57repeat: 68repeat:
58 table = crst_table_alloc(mm); 69 table = crst_table_alloc(mm);
59 if (!table) 70 if (!table)
@@ -79,12 +90,15 @@ repeat:
79 mm->pgd = (pgd_t *) table; 90 mm->pgd = (pgd_t *) table;
80 mm->task_size = mm->context.asce_limit; 91 mm->task_size = mm->context.asce_limit;
81 table = NULL; 92 table = NULL;
93 flush = 1;
82 } 94 }
83 spin_unlock_bh(&mm->page_table_lock); 95 spin_unlock_bh(&mm->page_table_lock);
84 if (table) 96 if (table)
85 crst_table_free(mm, table); 97 crst_table_free(mm, table);
86 if (mm->context.asce_limit < limit) 98 if (mm->context.asce_limit < limit)
87 goto repeat; 99 goto repeat;
100 if (flush)
101 on_each_cpu(__crst_table_upgrade, mm, 0);
88 return 0; 102 return 0;
89} 103}
90 104
@@ -92,6 +106,8 @@ void crst_table_downgrade(struct mm_struct *mm, unsigned long limit)
92{ 106{
93 pgd_t *pgd; 107 pgd_t *pgd;
94 108
109 if (current->active_mm == mm)
110 __tlb_flush_mm(mm);
95 while (mm->context.asce_limit > limit) { 111 while (mm->context.asce_limit > limit) {
96 pgd = mm->pgd; 112 pgd = mm->pgd;
97 switch (pgd_val(*pgd) & _REGION_ENTRY_TYPE_MASK) { 113 switch (pgd_val(*pgd) & _REGION_ENTRY_TYPE_MASK) {
@@ -114,6 +130,8 @@ void crst_table_downgrade(struct mm_struct *mm, unsigned long limit)
114 mm->task_size = mm->context.asce_limit; 130 mm->task_size = mm->context.asce_limit;
115 crst_table_free(mm, (unsigned long *) pgd); 131 crst_table_free(mm, (unsigned long *) pgd);
116 } 132 }
133 if (current->active_mm == mm)
134 update_mm(mm, current);
117} 135}
118#endif 136#endif
119 137
@@ -754,7 +772,11 @@ static inline unsigned long *page_table_alloc_pgste(struct mm_struct *mm,
754 __free_page(page); 772 __free_page(page);
755 return NULL; 773 return NULL;
756 } 774 }
757 pgtable_page_ctor(page); 775 if (!pgtable_page_ctor(page)) {
776 kfree(mp);
777 __free_page(page);
778 return NULL;
779 }
758 mp->vmaddr = vmaddr & PMD_MASK; 780 mp->vmaddr = vmaddr & PMD_MASK;
759 INIT_LIST_HEAD(&mp->mapper); 781 INIT_LIST_HEAD(&mp->mapper);
760 page->index = (unsigned long) mp; 782 page->index = (unsigned long) mp;
@@ -884,7 +906,10 @@ unsigned long *page_table_alloc(struct mm_struct *mm, unsigned long vmaddr)
884 page = alloc_page(GFP_KERNEL|__GFP_REPEAT); 906 page = alloc_page(GFP_KERNEL|__GFP_REPEAT);
885 if (!page) 907 if (!page)
886 return NULL; 908 return NULL;
887 pgtable_page_ctor(page); 909 if (!pgtable_page_ctor(page)) {
910 __free_page(page);
911 return NULL;
912 }
888 atomic_set(&page->_mapcount, 1); 913 atomic_set(&page->_mapcount, 1);
889 table = (unsigned long *) page_to_phys(page); 914 table = (unsigned long *) page_to_phys(page);
890 clear_table(table, _PAGE_INVALID, PAGE_SIZE); 915 clear_table(table, _PAGE_INVALID, PAGE_SIZE);
@@ -1087,10 +1112,9 @@ again:
1087 continue; 1112 continue;
1088 /* Allocate new page table with pgstes */ 1113 /* Allocate new page table with pgstes */
1089 new = page_table_alloc_pgste(mm, addr); 1114 new = page_table_alloc_pgste(mm, addr);
1090 if (!new) { 1115 if (!new)
1091 mm->context.has_pgste = 0; 1116 return -ENOMEM;
1092 continue; 1117
1093 }
1094 spin_lock(&mm->page_table_lock); 1118 spin_lock(&mm->page_table_lock);
1095 if (likely((unsigned long *) pmd_deref(*pmd) == table)) { 1119 if (likely((unsigned long *) pmd_deref(*pmd) == table)) {
1096 /* Nuke pmd entry pointing to the "short" page table */ 1120 /* Nuke pmd entry pointing to the "short" page table */
@@ -1128,13 +1152,15 @@ static unsigned long page_table_realloc_pud(struct mmu_gather *tlb,
1128 if (pud_none_or_clear_bad(pud)) 1152 if (pud_none_or_clear_bad(pud))
1129 continue; 1153 continue;
1130 next = page_table_realloc_pmd(tlb, mm, pud, addr, next); 1154 next = page_table_realloc_pmd(tlb, mm, pud, addr, next);
1155 if (unlikely(IS_ERR_VALUE(next)))
1156 return next;
1131 } while (pud++, addr = next, addr != end); 1157 } while (pud++, addr = next, addr != end);
1132 1158
1133 return addr; 1159 return addr;
1134} 1160}
1135 1161
1136static void page_table_realloc(struct mmu_gather *tlb, struct mm_struct *mm, 1162static unsigned long page_table_realloc(struct mmu_gather *tlb, struct mm_struct *mm,
1137 unsigned long addr, unsigned long end) 1163 unsigned long addr, unsigned long end)
1138{ 1164{
1139 unsigned long next; 1165 unsigned long next;
1140 pgd_t *pgd; 1166 pgd_t *pgd;
@@ -1145,7 +1171,11 @@ static void page_table_realloc(struct mmu_gather *tlb, struct mm_struct *mm,
1145 if (pgd_none_or_clear_bad(pgd)) 1171 if (pgd_none_or_clear_bad(pgd))
1146 continue; 1172 continue;
1147 next = page_table_realloc_pud(tlb, mm, pgd, addr, next); 1173 next = page_table_realloc_pud(tlb, mm, pgd, addr, next);
1174 if (unlikely(IS_ERR_VALUE(next)))
1175 return next;
1148 } while (pgd++, addr = next, addr != end); 1176 } while (pgd++, addr = next, addr != end);
1177
1178 return 0;
1149} 1179}
1150 1180
1151/* 1181/*
@@ -1157,10 +1187,6 @@ int s390_enable_sie(void)
1157 struct mm_struct *mm = tsk->mm; 1187 struct mm_struct *mm = tsk->mm;
1158 struct mmu_gather tlb; 1188 struct mmu_gather tlb;
1159 1189
1160 /* Do we have switched amode? If no, we cannot do sie */
1161 if (s390_user_mode == HOME_SPACE_MODE)
1162 return -EINVAL;
1163
1164 /* Do we have pgstes? if yes, we are done */ 1190 /* Do we have pgstes? if yes, we are done */
1165 if (mm_has_pgste(tsk->mm)) 1191 if (mm_has_pgste(tsk->mm))
1166 return 0; 1192 return 0;
@@ -1169,9 +1195,9 @@ int s390_enable_sie(void)
1169 /* split thp mappings and disable thp for future mappings */ 1195 /* split thp mappings and disable thp for future mappings */
1170 thp_split_mm(mm); 1196 thp_split_mm(mm);
1171 /* Reallocate the page tables with pgstes */ 1197 /* Reallocate the page tables with pgstes */
1172 mm->context.has_pgste = 1;
1173 tlb_gather_mmu(&tlb, mm, 0, TASK_SIZE); 1198 tlb_gather_mmu(&tlb, mm, 0, TASK_SIZE);
1174 page_table_realloc(&tlb, mm, 0, TASK_SIZE); 1199 if (!page_table_realloc(&tlb, mm, 0, TASK_SIZE))
1200 mm->context.has_pgste = 1;
1175 tlb_finish_mmu(&tlb, 0, TASK_SIZE); 1201 tlb_finish_mmu(&tlb, 0, TASK_SIZE);
1176 up_write(&mm->mmap_sem); 1202 up_write(&mm->mmap_sem);
1177 return mm->context.has_pgste ? 0 : -ENOMEM; 1203 return mm->context.has_pgste ? 0 : -ENOMEM;
@@ -1225,11 +1251,11 @@ void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
1225 assert_spin_locked(&mm->page_table_lock); 1251 assert_spin_locked(&mm->page_table_lock);
1226 1252
1227 /* FIFO */ 1253 /* FIFO */
1228 if (!mm->pmd_huge_pte) 1254 if (!pmd_huge_pte(mm, pmdp))
1229 INIT_LIST_HEAD(lh); 1255 INIT_LIST_HEAD(lh);
1230 else 1256 else
1231 list_add(lh, (struct list_head *) mm->pmd_huge_pte); 1257 list_add(lh, (struct list_head *) pmd_huge_pte(mm, pmdp));
1232 mm->pmd_huge_pte = pgtable; 1258 pmd_huge_pte(mm, pmdp) = pgtable;
1233} 1259}
1234 1260
1235pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp) 1261pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp)
@@ -1241,12 +1267,12 @@ pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp)
1241 assert_spin_locked(&mm->page_table_lock); 1267 assert_spin_locked(&mm->page_table_lock);
1242 1268
1243 /* FIFO */ 1269 /* FIFO */
1244 pgtable = mm->pmd_huge_pte; 1270 pgtable = pmd_huge_pte(mm, pmdp);
1245 lh = (struct list_head *) pgtable; 1271 lh = (struct list_head *) pgtable;
1246 if (list_empty(lh)) 1272 if (list_empty(lh))
1247 mm->pmd_huge_pte = NULL; 1273 pmd_huge_pte(mm, pmdp) = NULL;
1248 else { 1274 else {
1249 mm->pmd_huge_pte = (pgtable_t) lh->next; 1275 pmd_huge_pte(mm, pmdp) = (pgtable_t) lh->next;
1250 list_del(lh); 1276 list_del(lh);
1251 } 1277 }
1252 ptep = (pte_t *) pgtable; 1278 ptep = (pte_t *) pgtable;
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index 709239285869..16871da37371 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -12,8 +12,8 @@
12#include <linux/random.h> 12#include <linux/random.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <asm/cacheflush.h> 14#include <asm/cacheflush.h>
15#include <asm/processor.h>
16#include <asm/facility.h> 15#include <asm/facility.h>
16#include <asm/dis.h>
17 17
18/* 18/*
19 * Conventions: 19 * Conventions:
@@ -156,8 +156,8 @@ static void bpf_jit_prologue(struct bpf_jit *jit)
156 EMIT6(0xeb8ff058, 0x0024); 156 EMIT6(0xeb8ff058, 0x0024);
157 /* lgr %r14,%r15 */ 157 /* lgr %r14,%r15 */
158 EMIT4(0xb90400ef); 158 EMIT4(0xb90400ef);
159 /* ahi %r15,<offset> */ 159 /* aghi %r15,<offset> */
160 EMIT4_IMM(0xa7fa0000, (jit->seen & SEEN_MEM) ? -112 : -80); 160 EMIT4_IMM(0xa7fb0000, (jit->seen & SEEN_MEM) ? -112 : -80);
161 /* stg %r14,152(%r15) */ 161 /* stg %r14,152(%r15) */
162 EMIT6(0xe3e0f098, 0x0024); 162 EMIT6(0xe3e0f098, 0x0024);
163 } else if ((jit->seen & SEEN_XREG) && (jit->seen & SEEN_LITERAL)) 163 } else if ((jit->seen & SEEN_XREG) && (jit->seen & SEEN_LITERAL))
@@ -881,7 +881,9 @@ void bpf_jit_free(struct sk_filter *fp)
881 struct bpf_binary_header *header = (void *)addr; 881 struct bpf_binary_header *header = (void *)addr;
882 882
883 if (fp->bpf_func == sk_run_filter) 883 if (fp->bpf_func == sk_run_filter)
884 return; 884 goto free_filter;
885 set_memory_rw(addr, header->pages); 885 set_memory_rw(addr, header->pages);
886 module_free(NULL, header); 886 module_free(NULL, header);
887free_filter:
888 kfree(fp);
887} 889}
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index f17a8343e360..0c9a17780e4b 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -120,26 +120,17 @@ EXPORT_SYMBOL_GPL(pci_proc_domain);
120static int zpci_set_airq(struct zpci_dev *zdev) 120static int zpci_set_airq(struct zpci_dev *zdev)
121{ 121{
122 u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, ZPCI_MOD_FC_REG_INT); 122 u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, ZPCI_MOD_FC_REG_INT);
123 struct zpci_fib *fib; 123 struct zpci_fib fib = {0};
124 int rc;
125
126 fib = (void *) get_zeroed_page(GFP_KERNEL);
127 if (!fib)
128 return -ENOMEM;
129 124
130 fib->isc = PCI_ISC; 125 fib.isc = PCI_ISC;
131 fib->sum = 1; /* enable summary notifications */ 126 fib.sum = 1; /* enable summary notifications */
132 fib->noi = airq_iv_end(zdev->aibv); 127 fib.noi = airq_iv_end(zdev->aibv);
133 fib->aibv = (unsigned long) zdev->aibv->vector; 128 fib.aibv = (unsigned long) zdev->aibv->vector;
134 fib->aibvo = 0; /* each zdev has its own interrupt vector */ 129 fib.aibvo = 0; /* each zdev has its own interrupt vector */
135 fib->aisb = (unsigned long) zpci_aisb_iv->vector + (zdev->aisb/64)*8; 130 fib.aisb = (unsigned long) zpci_aisb_iv->vector + (zdev->aisb/64)*8;
136 fib->aisbo = zdev->aisb & 63; 131 fib.aisbo = zdev->aisb & 63;
137 132
138 rc = zpci_mod_fc(req, fib); 133 return zpci_mod_fc(req, &fib);
139 pr_debug("%s mpcifc returned noi: %d\n", __func__, fib->noi);
140
141 free_page((unsigned long) fib);
142 return rc;
143} 134}
144 135
145struct mod_pci_args { 136struct mod_pci_args {
@@ -152,22 +143,14 @@ struct mod_pci_args {
152static int mod_pci(struct zpci_dev *zdev, int fn, u8 dmaas, struct mod_pci_args *args) 143static int mod_pci(struct zpci_dev *zdev, int fn, u8 dmaas, struct mod_pci_args *args)
153{ 144{
154 u64 req = ZPCI_CREATE_REQ(zdev->fh, dmaas, fn); 145 u64 req = ZPCI_CREATE_REQ(zdev->fh, dmaas, fn);
155 struct zpci_fib *fib; 146 struct zpci_fib fib = {0};
156 int rc;
157
158 /* The FIB must be available even if it's not used */
159 fib = (void *) get_zeroed_page(GFP_KERNEL);
160 if (!fib)
161 return -ENOMEM;
162 147
163 fib->pba = args->base; 148 fib.pba = args->base;
164 fib->pal = args->limit; 149 fib.pal = args->limit;
165 fib->iota = args->iota; 150 fib.iota = args->iota;
166 fib->fmb_addr = args->fmb_addr; 151 fib.fmb_addr = args->fmb_addr;
167 152
168 rc = zpci_mod_fc(req, fib); 153 return zpci_mod_fc(req, &fib);
169 free_page((unsigned long) fib);
170 return rc;
171} 154}
172 155
173/* Modify PCI: Register I/O address translation parameters */ 156/* Modify PCI: Register I/O address translation parameters */
@@ -424,7 +407,6 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
424 struct msi_msg msg; 407 struct msi_msg msg;
425 int rc; 408 int rc;
426 409
427 pr_debug("%s: requesting %d MSI-X interrupts...", __func__, nvec);
428 if (type != PCI_CAP_ID_MSIX && type != PCI_CAP_ID_MSI) 410 if (type != PCI_CAP_ID_MSIX && type != PCI_CAP_ID_MSI)
429 return -EINVAL; 411 return -EINVAL;
430 msi_vecs = min(nvec, ZPCI_MSI_VEC_MAX); 412 msi_vecs = min(nvec, ZPCI_MSI_VEC_MAX);
@@ -489,7 +471,6 @@ out_msi:
489out_si: 471out_si:
490 airq_iv_free_bit(zpci_aisb_iv, aisb); 472 airq_iv_free_bit(zpci_aisb_iv, aisb);
491out: 473out:
492 dev_err(&pdev->dev, "register MSI failed with: %d\n", rc);
493 return rc; 474 return rc;
494} 475}
495 476
@@ -499,14 +480,10 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev)
499 struct msi_desc *msi; 480 struct msi_desc *msi;
500 int rc; 481 int rc;
501 482
502 pr_info("%s: on pdev: %p\n", __func__, pdev);
503
504 /* Disable adapter interrupts */ 483 /* Disable adapter interrupts */
505 rc = zpci_clear_airq(zdev); 484 rc = zpci_clear_airq(zdev);
506 if (rc) { 485 if (rc)
507 dev_err(&pdev->dev, "deregister MSI failed with: %d\n", rc);
508 return; 486 return;
509 }
510 487
511 /* Release MSI interrupts */ 488 /* Release MSI interrupts */
512 list_for_each_entry(msi, &pdev->msi_list, list) { 489 list_for_each_entry(msi, &pdev->msi_list, list) {
@@ -625,8 +602,11 @@ static struct resource *zpci_alloc_bus_resource(unsigned long start, unsigned lo
625 r->name = name; 602 r->name = name;
626 603
627 rc = request_resource(&iomem_resource, r); 604 rc = request_resource(&iomem_resource, r);
628 if (rc) 605 if (rc) {
629 pr_debug("request resource %pR failed\n", r); 606 kfree(r->name);
607 kfree(r);
608 return ERR_PTR(-ENOMEM);
609 }
630 return r; 610 return r;
631} 611}
632 612
@@ -708,6 +688,47 @@ void pcibios_disable_device(struct pci_dev *pdev)
708 zdev->pdev = NULL; 688 zdev->pdev = NULL;
709} 689}
710 690
691#ifdef CONFIG_HIBERNATE_CALLBACKS
692static int zpci_restore(struct device *dev)
693{
694 struct zpci_dev *zdev = get_zdev(to_pci_dev(dev));
695 int ret = 0;
696
697 if (zdev->state != ZPCI_FN_STATE_ONLINE)
698 goto out;
699
700 ret = clp_enable_fh(zdev, ZPCI_NR_DMA_SPACES);
701 if (ret)
702 goto out;
703
704 zpci_map_resources(zdev);
705 zpci_register_ioat(zdev, 0, zdev->start_dma + PAGE_OFFSET,
706 zdev->start_dma + zdev->iommu_size - 1,
707 (u64) zdev->dma_table);
708
709out:
710 return ret;
711}
712
713static int zpci_freeze(struct device *dev)
714{
715 struct zpci_dev *zdev = get_zdev(to_pci_dev(dev));
716
717 if (zdev->state != ZPCI_FN_STATE_ONLINE)
718 return 0;
719
720 zpci_unregister_ioat(zdev, 0);
721 return clp_disable_fh(zdev);
722}
723
724struct dev_pm_ops pcibios_pm_ops = {
725 .thaw_noirq = zpci_restore,
726 .freeze_noirq = zpci_freeze,
727 .restore_noirq = zpci_restore,
728 .poweroff_noirq = zpci_freeze,
729};
730#endif /* CONFIG_HIBERNATE_CALLBACKS */
731
711static int zpci_scan_bus(struct zpci_dev *zdev) 732static int zpci_scan_bus(struct zpci_dev *zdev)
712{ 733{
713 struct resource *res; 734 struct resource *res;
@@ -781,7 +802,6 @@ int zpci_enable_device(struct zpci_dev *zdev)
781 rc = clp_enable_fh(zdev, ZPCI_NR_DMA_SPACES); 802 rc = clp_enable_fh(zdev, ZPCI_NR_DMA_SPACES);
782 if (rc) 803 if (rc)
783 goto out; 804 goto out;
784 pr_info("Enabled fh: 0x%x fid: 0x%x\n", zdev->fh, zdev->fid);
785 805
786 rc = zpci_dma_init_device(zdev); 806 rc = zpci_dma_init_device(zdev);
787 if (rc) 807 if (rc)
@@ -901,10 +921,6 @@ static int __init pci_base_init(void)
901 || !test_facility(71) || !test_facility(72)) 921 || !test_facility(71) || !test_facility(72))
902 return 0; 922 return 0;
903 923
904 pr_info("Probing PCI hardware: PCI:%d SID:%d AEN:%d\n",
905 test_facility(69), test_facility(70),
906 test_facility(71));
907
908 rc = zpci_debug_init(); 924 rc = zpci_debug_init();
909 if (rc) 925 if (rc)
910 goto out; 926 goto out;
diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c
index 475563c3d1e4..84147984224a 100644
--- a/arch/s390/pci/pci_clp.c
+++ b/arch/s390/pci/pci_clp.c
@@ -16,6 +16,16 @@
16#include <asm/pci_debug.h> 16#include <asm/pci_debug.h>
17#include <asm/pci_clp.h> 17#include <asm/pci_clp.h>
18 18
19static inline void zpci_err_clp(unsigned int rsp, int rc)
20{
21 struct {
22 unsigned int rsp;
23 int rc;
24 } __packed data = {rsp, rc};
25
26 zpci_err_hex(&data, sizeof(data));
27}
28
19/* 29/*
20 * Call Logical Processor 30 * Call Logical Processor
21 * Retry logic is handled by the caller. 31 * Retry logic is handled by the caller.
@@ -54,7 +64,6 @@ static void clp_store_query_pci_fngrp(struct zpci_dev *zdev,
54 zdev->msi_addr = response->msia; 64 zdev->msi_addr = response->msia;
55 zdev->fmb_update = response->mui; 65 zdev->fmb_update = response->mui;
56 66
57 pr_debug("Supported number of MSI vectors: %u\n", response->noi);
58 switch (response->version) { 67 switch (response->version) {
59 case 1: 68 case 1:
60 zdev->max_bus_speed = PCIE_SPEED_5_0GT; 69 zdev->max_bus_speed = PCIE_SPEED_5_0GT;
@@ -84,8 +93,8 @@ static int clp_query_pci_fngrp(struct zpci_dev *zdev, u8 pfgid)
84 if (!rc && rrb->response.hdr.rsp == CLP_RC_OK) 93 if (!rc && rrb->response.hdr.rsp == CLP_RC_OK)
85 clp_store_query_pci_fngrp(zdev, &rrb->response); 94 clp_store_query_pci_fngrp(zdev, &rrb->response);
86 else { 95 else {
87 pr_err("Query PCI FNGRP failed with response: %x cc: %d\n", 96 zpci_err("Q PCI FGRP:\n");
88 rrb->response.hdr.rsp, rc); 97 zpci_err_clp(rrb->response.hdr.rsp, rc);
89 rc = -EIO; 98 rc = -EIO;
90 } 99 }
91 clp_free_block(rrb); 100 clp_free_block(rrb);
@@ -131,8 +140,8 @@ static int clp_query_pci_fn(struct zpci_dev *zdev, u32 fh)
131 if (rrb->response.pfgid) 140 if (rrb->response.pfgid)
132 rc = clp_query_pci_fngrp(zdev, rrb->response.pfgid); 141 rc = clp_query_pci_fngrp(zdev, rrb->response.pfgid);
133 } else { 142 } else {
134 pr_err("Query PCI failed with response: %x cc: %d\n", 143 zpci_err("Q PCI FN:\n");
135 rrb->response.hdr.rsp, rc); 144 zpci_err_clp(rrb->response.hdr.rsp, rc);
136 rc = -EIO; 145 rc = -EIO;
137 } 146 }
138out: 147out:
@@ -206,8 +215,8 @@ static int clp_set_pci_fn(u32 *fh, u8 nr_dma_as, u8 command)
206 if (!rc && rrb->response.hdr.rsp == CLP_RC_OK) 215 if (!rc && rrb->response.hdr.rsp == CLP_RC_OK)
207 *fh = rrb->response.fh; 216 *fh = rrb->response.fh;
208 else { 217 else {
209 zpci_dbg(0, "SPF fh:%x, cc:%d, resp:%x\n", *fh, rc, 218 zpci_err("Set PCI FN:\n");
210 rrb->response.hdr.rsp); 219 zpci_err_clp(rrb->response.hdr.rsp, rc);
211 rc = -EIO; 220 rc = -EIO;
212 } 221 }
213 clp_free_block(rrb); 222 clp_free_block(rrb);
@@ -262,8 +271,8 @@ static int clp_list_pci(struct clp_req_rsp_list_pci *rrb,
262 /* Get PCI function handle list */ 271 /* Get PCI function handle list */
263 rc = clp_instr(rrb); 272 rc = clp_instr(rrb);
264 if (rc || rrb->response.hdr.rsp != CLP_RC_OK) { 273 if (rc || rrb->response.hdr.rsp != CLP_RC_OK) {
265 pr_err("List PCI failed with response: 0x%x cc: %d\n", 274 zpci_err("List PCI FN:\n");
266 rrb->response.hdr.rsp, rc); 275 zpci_err_clp(rrb->response.hdr.rsp, rc);
267 rc = -EIO; 276 rc = -EIO;
268 goto out; 277 goto out;
269 } 278 }
@@ -273,17 +282,11 @@ static int clp_list_pci(struct clp_req_rsp_list_pci *rrb,
273 282
274 entries = (rrb->response.hdr.len - LIST_PCI_HDR_LEN) / 283 entries = (rrb->response.hdr.len - LIST_PCI_HDR_LEN) /
275 rrb->response.entry_size; 284 rrb->response.entry_size;
276 pr_info("Detected number of PCI functions: %u\n", entries);
277 285
278 /* Store the returned resume token as input for the next call */
279 resume_token = rrb->response.resume_token; 286 resume_token = rrb->response.resume_token;
280
281 for (i = 0; i < entries; i++) 287 for (i = 0; i < entries; i++)
282 cb(&rrb->response.fh_list[i]); 288 cb(&rrb->response.fh_list[i]);
283 } while (resume_token); 289 } while (resume_token);
284
285 pr_debug("Maximum number of supported PCI functions: %u\n",
286 rrb->response.max_fn);
287out: 290out:
288 return rc; 291 return rc;
289} 292}
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index 7e5573acb063..9b83d080902d 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -145,10 +145,8 @@ static int dma_update_trans(struct zpci_dev *zdev, unsigned long pa,
145 return -EINVAL; 145 return -EINVAL;
146 146
147 spin_lock_irqsave(&zdev->dma_table_lock, irq_flags); 147 spin_lock_irqsave(&zdev->dma_table_lock, irq_flags);
148 if (!zdev->dma_table) { 148 if (!zdev->dma_table)
149 dev_err(&zdev->pdev->dev, "Missing DMA table\n");
150 goto no_refresh; 149 goto no_refresh;
151 }
152 150
153 for (i = 0; i < nr_pages; i++) { 151 for (i = 0; i < nr_pages; i++) {
154 dma_update_cpu_trans(zdev, page_addr, dma_addr, flags); 152 dma_update_cpu_trans(zdev, page_addr, dma_addr, flags);
@@ -280,11 +278,8 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,
280 size = nr_pages * PAGE_SIZE; 278 size = nr_pages * PAGE_SIZE;
281 279
282 dma_addr = zdev->start_dma + iommu_page_index * PAGE_SIZE; 280 dma_addr = zdev->start_dma + iommu_page_index * PAGE_SIZE;
283 if (dma_addr + size > zdev->end_dma) { 281 if (dma_addr + size > zdev->end_dma)
284 dev_err(dev, "(dma_addr: 0x%16.16LX + size: 0x%16.16lx) > end_dma: 0x%16.16Lx\n",
285 dma_addr, size, zdev->end_dma);
286 goto out_free; 282 goto out_free;
287 }
288 283
289 if (direction == DMA_NONE || direction == DMA_TO_DEVICE) 284 if (direction == DMA_NONE || direction == DMA_TO_DEVICE)
290 flags |= ZPCI_TABLE_PROTECTED; 285 flags |= ZPCI_TABLE_PROTECTED;
@@ -297,7 +292,8 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,
297out_free: 292out_free:
298 dma_free_iommu(zdev, iommu_page_index, nr_pages); 293 dma_free_iommu(zdev, iommu_page_index, nr_pages);
299out_err: 294out_err:
300 dev_err(dev, "Failed to map addr: %lx\n", pa); 295 zpci_err("map error:\n");
296 zpci_err_hex(&pa, sizeof(pa));
301 return DMA_ERROR_CODE; 297 return DMA_ERROR_CODE;
302} 298}
303 299
@@ -312,8 +308,10 @@ static void s390_dma_unmap_pages(struct device *dev, dma_addr_t dma_addr,
312 npages = iommu_num_pages(dma_addr, size, PAGE_SIZE); 308 npages = iommu_num_pages(dma_addr, size, PAGE_SIZE);
313 dma_addr = dma_addr & PAGE_MASK; 309 dma_addr = dma_addr & PAGE_MASK;
314 if (dma_update_trans(zdev, 0, dma_addr, npages * PAGE_SIZE, 310 if (dma_update_trans(zdev, 0, dma_addr, npages * PAGE_SIZE,
315 ZPCI_TABLE_PROTECTED | ZPCI_PTE_INVALID)) 311 ZPCI_TABLE_PROTECTED | ZPCI_PTE_INVALID)) {
316 dev_err(dev, "Failed to unmap addr: %Lx\n", dma_addr); 312 zpci_err("unmap error:\n");
313 zpci_err_hex(&dma_addr, sizeof(dma_addr));
314 }
317 315
318 atomic64_add(npages, (atomic64_t *) &zdev->fmb->unmapped_pages); 316 atomic64_add(npages, (atomic64_t *) &zdev->fmb->unmapped_pages);
319 iommu_page_index = (dma_addr - zdev->start_dma) >> PAGE_SHIFT; 317 iommu_page_index = (dma_addr - zdev->start_dma) >> PAGE_SHIFT;
diff --git a/arch/s390/pci/pci_event.c b/arch/s390/pci/pci_event.c
index 0aecaf954845..278e671ec9ac 100644
--- a/arch/s390/pci/pci_event.c
+++ b/arch/s390/pci/pci_event.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <asm/pci_debug.h>
13 14
14/* Content Code Description for PCI Function Error */ 15/* Content Code Description for PCI Function Error */
15struct zpci_ccdf_err { 16struct zpci_ccdf_err {
@@ -41,25 +42,15 @@ struct zpci_ccdf_avail {
41 u16 pec; /* PCI event code */ 42 u16 pec; /* PCI event code */
42} __packed; 43} __packed;
43 44
44static void zpci_event_log_err(struct zpci_ccdf_err *ccdf)
45{
46 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
47
48 zpci_err("SEI error CCD:\n");
49 zpci_err_hex(ccdf, sizeof(*ccdf));
50 dev_err(&zdev->pdev->dev, "event code: 0x%x\n", ccdf->pec);
51}
52
53static void zpci_event_log_avail(struct zpci_ccdf_avail *ccdf) 45static void zpci_event_log_avail(struct zpci_ccdf_avail *ccdf)
54{ 46{
55 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); 47 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
48 struct pci_dev *pdev = zdev ? zdev->pdev : NULL;
56 49
57 pr_err("%s%s: availability event: fh: 0x%x fid: 0x%x event code: 0x%x reason:", 50 pr_info("%s: Event 0x%x reconfigured PCI function 0x%x\n",
58 (zdev) ? dev_driver_string(&zdev->pdev->dev) : "?", 51 pdev ? pci_name(pdev) : "n/a", ccdf->pec, ccdf->fid);
59 (zdev) ? dev_name(&zdev->pdev->dev) : "?", 52 zpci_err("avail CCDF:\n");
60 ccdf->fh, ccdf->fid, ccdf->pec); 53 zpci_err_hex(ccdf, sizeof(*ccdf));
61 print_hex_dump(KERN_CONT, "ccdf", DUMP_PREFIX_OFFSET,
62 16, 1, ccdf, sizeof(*ccdf), false);
63 54
64 switch (ccdf->pec) { 55 switch (ccdf->pec) {
65 case 0x0301: 56 case 0x0301:
@@ -79,14 +70,16 @@ static void zpci_event_log_avail(struct zpci_ccdf_avail *ccdf)
79void zpci_event_error(void *data) 70void zpci_event_error(void *data)
80{ 71{
81 struct zpci_ccdf_err *ccdf = data; 72 struct zpci_ccdf_err *ccdf = data;
82 struct zpci_dev *zdev; 73 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
74
75 zpci_err("error CCDF:\n");
76 zpci_err_hex(ccdf, sizeof(*ccdf));
83 77
84 zpci_event_log_err(ccdf); 78 if (!zdev)
85 zdev = get_zdev_by_fid(ccdf->fid);
86 if (!zdev) {
87 pr_err("Error event for unknown fid: %x", ccdf->fid);
88 return; 79 return;
89 } 80
81 pr_err("%s: Event 0x%x reports an error for PCI function 0x%x\n",
82 pci_name(zdev->pdev), ccdf->pec, ccdf->fid);
90} 83}
91 84
92void zpci_event_availability(void *data) 85void zpci_event_availability(void *data)
diff --git a/arch/score/Kconfig b/arch/score/Kconfig
index a1be70db75fe..305f7ee1f382 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -2,6 +2,7 @@ menu "Machine selection"
2 2
3config SCORE 3config SCORE
4 def_bool y 4 def_bool y
5 select HAVE_GENERIC_HARDIRQS
5 select GENERIC_IRQ_SHOW 6 select GENERIC_IRQ_SHOW
6 select GENERIC_IOMAP 7 select GENERIC_IOMAP
7 select GENERIC_ATOMIC64 8 select GENERIC_ATOMIC64
@@ -110,3 +111,6 @@ source "security/Kconfig"
110source "crypto/Kconfig" 111source "crypto/Kconfig"
111 112
112source "lib/Kconfig" 113source "lib/Kconfig"
114
115config NO_IOMEM
116 def_bool y
diff --git a/arch/score/Makefile b/arch/score/Makefile
index 974aefe86123..9e3e060290e0 100644
--- a/arch/score/Makefile
+++ b/arch/score/Makefile
@@ -20,8 +20,8 @@ cflags-y += -G0 -pipe -mel -mnhwloop -D__SCOREEL__ \
20# 20#
21KBUILD_AFLAGS += $(cflags-y) 21KBUILD_AFLAGS += $(cflags-y)
22KBUILD_CFLAGS += $(cflags-y) 22KBUILD_CFLAGS += $(cflags-y)
23KBUILD_AFLAGS_MODULE += -mlong-calls 23KBUILD_AFLAGS_MODULE +=
24KBUILD_CFLAGS_MODULE += -mlong-calls 24KBUILD_CFLAGS_MODULE +=
25LDFLAGS += --oformat elf32-littlescore 25LDFLAGS += --oformat elf32-littlescore
26LDFLAGS_vmlinux += -G0 -static -nostdlib 26LDFLAGS_vmlinux += -G0 -static -nostdlib
27 27
diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild
index e1c7bb999b06..f3414ade77a3 100644
--- a/arch/score/include/asm/Kbuild
+++ b/arch/score/include/asm/Kbuild
@@ -4,3 +4,4 @@ header-y +=
4generic-y += clkdev.h 4generic-y += clkdev.h
5generic-y += trace_clock.h 5generic-y += trace_clock.h
6generic-y += xor.h 6generic-y += xor.h
7generic-y += preempt.h
diff --git a/arch/score/include/asm/checksum.h b/arch/score/include/asm/checksum.h
index f909ac3144a4..961bd64015a8 100644
--- a/arch/score/include/asm/checksum.h
+++ b/arch/score/include/asm/checksum.h
@@ -184,48 +184,57 @@ static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
184 __wsum sum) 184 __wsum sum)
185{ 185{
186 __asm__ __volatile__( 186 __asm__ __volatile__(
187 ".set\tnoreorder\t\t\t# csum_ipv6_magic\n\t" 187 ".set\tvolatile\t\t\t# csum_ipv6_magic\n\t"
188 ".set\tnoat\n\t" 188 "add\t%0, %0, %5\t\t\t# proto (long in network byte order)\n\t"
189 "addu\t%0, %5\t\t\t# proto (long in network byte order)\n\t" 189 "cmp.c\t%5, %0\n\t"
190 "sltu\t$1, %0, %5\n\t" 190 "bleu 1f\n\t"
191 "addu\t%0, $1\n\t" 191 "addi\t%0, 0x1\n\t"
192 "addu\t%0, %6\t\t\t# csum\n\t" 192 "1:add\t%0, %0, %6\t\t\t# csum\n\t"
193 "sltu\t$1, %0, %6\n\t" 193 "cmp.c\t%6, %0\n\t"
194 "lw\t%1, 0(%2)\t\t\t# four words source address\n\t" 194 "lw\t%1, [%2, 0]\t\t\t# four words source address\n\t"
195 "addu\t%0, $1\n\t" 195 "bleu 1f\n\t"
196 "addu\t%0, %1\n\t" 196 "addi\t%0, 0x1\n\t"
197 "sltu\t$1, %0, %1\n\t" 197 "1:add\t%0, %0, %1\n\t"
198 "lw\t%1, 4(%2)\n\t" 198 "cmp.c\t%1, %0\n\t"
199 "addu\t%0, $1\n\t" 199 "1:lw\t%1, [%2, 4]\n\t"
200 "addu\t%0, %1\n\t" 200 "bleu 1f\n\t"
201 "sltu\t$1, %0, %1\n\t" 201 "addi\t%0, 0x1\n\t"
202 "lw\t%1, 8(%2)\n\t" 202 "1:add\t%0, %0, %1\n\t"
203 "addu\t%0, $1\n\t" 203 "cmp.c\t%1, %0\n\t"
204 "addu\t%0, %1\n\t" 204 "lw\t%1, [%2,8]\n\t"
205 "sltu\t$1, %0, %1\n\t" 205 "bleu 1f\n\t"
206 "lw\t%1, 12(%2)\n\t" 206 "addi\t%0, 0x1\n\t"
207 "addu\t%0, $1\n\t" 207 "1:add\t%0, %0, %1\n\t"
208 "addu\t%0, %1\n\t" 208 "cmp.c\t%1, %0\n\t"
209 "sltu\t$1, %0, %1\n\t" 209 "lw\t%1, [%2, 12]\n\t"
210 "lw\t%1, 0(%3)\n\t" 210 "bleu 1f\n\t"
211 "addu\t%0, $1\n\t" 211 "addi\t%0, 0x1\n\t"
212 "addu\t%0, %1\n\t" 212 "1:add\t%0, %0,%1\n\t"
213 "sltu\t$1, %0, %1\n\t" 213 "cmp.c\t%1, %0\n\t"
214 "lw\t%1, 4(%3)\n\t" 214 "lw\t%1, [%3, 0]\n\t"
215 "addu\t%0, $1\n\t" 215 "bleu 1f\n\t"
216 "addu\t%0, %1\n\t" 216 "addi\t%0, 0x1\n\t"
217 "sltu\t$1, %0, %1\n\t" 217 "1:add\t%0, %0, %1\n\t"
218 "lw\t%1, 8(%3)\n\t" 218 "cmp.c\t%1, %0\n\t"
219 "addu\t%0, $1\n\t" 219 "lw\t%1, [%3, 4]\n\t"
220 "addu\t%0, %1\n\t" 220 "bleu 1f\n\t"
221 "sltu\t$1, %0, %1\n\t" 221 "addi\t%0, 0x1\n\t"
222 "lw\t%1, 12(%3)\n\t" 222 "1:add\t%0, %0, %1\n\t"
223 "addu\t%0, $1\n\t" 223 "cmp.c\t%1, %0\n\t"
224 "addu\t%0, %1\n\t" 224 "lw\t%1, [%3, 8]\n\t"
225 "sltu\t$1, %0, %1\n\t" 225 "bleu 1f\n\t"
226 "addu\t%0, $1\t\t\t# Add final carry\n\t" 226 "addi\t%0, 0x1\n\t"
227 ".set\tnoat\n\t" 227 "1:add\t%0, %0, %1\n\t"
228 ".set\tnoreorder" 228 "cmp.c\t%1, %0\n\t"
229 "lw\t%1, [%3, 12]\n\t"
230 "bleu 1f\n\t"
231 "addi\t%0, 0x1\n\t"
232 "1:add\t%0, %0, %1\n\t"
233 "cmp.c\t%1, %0\n\t"
234 "bleu 1f\n\t"
235 "addi\t%0, 0x1\n\t"
236 "1:\n\t"
237 ".set\toptimize"
229 : "=r" (sum), "=r" (proto) 238 : "=r" (sum), "=r" (proto)
230 : "r" (saddr), "r" (daddr), 239 : "r" (saddr), "r" (daddr),
231 "0" (htonl(len)), "1" (htonl(proto)), "r" (sum)); 240 "0" (htonl(len)), "1" (htonl(proto)), "r" (sum));
diff --git a/arch/score/include/asm/io.h b/arch/score/include/asm/io.h
index fbbfd7132e3b..574c8827abe2 100644
--- a/arch/score/include/asm/io.h
+++ b/arch/score/include/asm/io.h
@@ -5,5 +5,4 @@
5 5
6#define virt_to_bus virt_to_phys 6#define virt_to_bus virt_to_phys
7#define bus_to_virt phys_to_virt 7#define bus_to_virt phys_to_virt
8
9#endif /* _ASM_SCORE_IO_H */ 8#endif /* _ASM_SCORE_IO_H */
diff --git a/arch/score/include/asm/pgalloc.h b/arch/score/include/asm/pgalloc.h
index 059a61b7071b..2e067657db98 100644
--- a/arch/score/include/asm/pgalloc.h
+++ b/arch/score/include/asm/pgalloc.h
@@ -2,7 +2,7 @@
2#define _ASM_SCORE_PGALLOC_H 2#define _ASM_SCORE_PGALLOC_H
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5 5#include <linux/highmem.h>
6static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, 6static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
7 pte_t *pte) 7 pte_t *pte)
8{ 8{
@@ -54,9 +54,12 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
54 struct page *pte; 54 struct page *pte;
55 55
56 pte = alloc_pages(GFP_KERNEL | __GFP_REPEAT, PTE_ORDER); 56 pte = alloc_pages(GFP_KERNEL | __GFP_REPEAT, PTE_ORDER);
57 if (pte) { 57 if (!pte)
58 clear_highpage(pte); 58 return NULL;
59 pgtable_page_ctor(pte); 59 clear_highpage(pte);
60 if (!pgtable_page_ctor(pte)) {
61 __free_page(pte);
62 return NULL;
60 } 63 }
61 return pte; 64 return pte;
62} 65}
diff --git a/arch/score/kernel/entry.S b/arch/score/kernel/entry.S
index 7234ed09b7b7..befb87d30a89 100644
--- a/arch/score/kernel/entry.S
+++ b/arch/score/kernel/entry.S
@@ -264,7 +264,7 @@ resume_kernel:
264 disable_irq 264 disable_irq
265 lw r8, [r28, TI_PRE_COUNT] 265 lw r8, [r28, TI_PRE_COUNT]
266 cmpz.c r8 266 cmpz.c r8
267 bne r8, restore_all 267 bne restore_all
268need_resched: 268need_resched:
269 lw r8, [r28, TI_FLAGS] 269 lw r8, [r28, TI_FLAGS]
270 andri.c r9, r8, _TIF_NEED_RESCHED 270 andri.c r9, r8, _TIF_NEED_RESCHED
@@ -415,7 +415,7 @@ ENTRY(handle_sys)
415 sw r9, [r0, PT_EPC] 415 sw r9, [r0, PT_EPC]
416 416
417 cmpi.c r27, __NR_syscalls # check syscall number 417 cmpi.c r27, __NR_syscalls # check syscall number
418 bgeu illegal_syscall 418 bcs illegal_syscall
419 419
420 slli r8, r27, 2 # get syscall routine 420 slli r8, r27, 2 # get syscall routine
421 la r11, sys_call_table 421 la r11, sys_call_table
diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c
index f4c6d02421d3..a1519ad3d49d 100644
--- a/arch/score/kernel/process.c
+++ b/arch/score/kernel/process.c
@@ -78,8 +78,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
78 p->thread.reg0 = (unsigned long) childregs; 78 p->thread.reg0 = (unsigned long) childregs;
79 if (unlikely(p->flags & PF_KTHREAD)) { 79 if (unlikely(p->flags & PF_KTHREAD)) {
80 memset(childregs, 0, sizeof(struct pt_regs)); 80 memset(childregs, 0, sizeof(struct pt_regs));
81 p->thread->reg12 = usp; 81 p->thread.reg12 = usp;
82 p->thread->reg13 = arg; 82 p->thread.reg13 = arg;
83 p->thread.reg3 = (unsigned long) ret_from_kernel_thread; 83 p->thread.reg3 = (unsigned long) ret_from_kernel_thread;
84 } else { 84 } else {
85 *childregs = *current_pt_regs(); 85 *childregs = *current_pt_regs();
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index f56d7f8b6f64..9b0979f4df7a 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -712,7 +712,6 @@ config CC_STACKPROTECTOR
712config SMP 712config SMP
713 bool "Symmetric multi-processing support" 713 bool "Symmetric multi-processing support"
714 depends on SYS_SUPPORTS_SMP 714 depends on SYS_SUPPORTS_SMP
715 select USE_GENERIC_SMP_HELPERS
716 ---help--- 715 ---help---
717 This enables support for systems with more than one CPU. If you have 716 This enables support for systems with more than one CPU. If you have
718 a system with only one CPU, like most personal computers, say N. If 717 a system with only one CPU, like most personal computers, say N. If
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 280bea9e5e2b..231efbb68108 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -34,3 +34,4 @@ generic-y += termios.h
34generic-y += trace_clock.h 34generic-y += trace_clock.h
35generic-y += ucontext.h 35generic-y += ucontext.h
36generic-y += xor.h 36generic-y += xor.h
37generic-y += preempt.h
diff --git a/arch/sh/include/asm/fpu.h b/arch/sh/include/asm/fpu.h
index 06c4281aab65..09fc2bc8a790 100644
--- a/arch/sh/include/asm/fpu.h
+++ b/arch/sh/include/asm/fpu.h
@@ -46,7 +46,7 @@ static inline void __unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs)
46 save_fpu(tsk); 46 save_fpu(tsk);
47 release_fpu(regs); 47 release_fpu(regs);
48 } else 48 } else
49 tsk->fpu_counter = 0; 49 tsk->thread.fpu_counter = 0;
50} 50}
51 51
52static inline void unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs) 52static inline void unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs)
diff --git a/arch/sh/include/asm/pgalloc.h b/arch/sh/include/asm/pgalloc.h
index 8c00785c60d5..a33673b3687d 100644
--- a/arch/sh/include/asm/pgalloc.h
+++ b/arch/sh/include/asm/pgalloc.h
@@ -47,7 +47,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
47 if (!pg) 47 if (!pg)
48 return NULL; 48 return NULL;
49 page = virt_to_page(pg); 49 page = virt_to_page(pg);
50 pgtable_page_ctor(page); 50 if (!pgtable_page_ctor(page)) {
51 quicklist_free(QUICK_PT, NULL, pg);
52 return NULL;
53 }
51 return page; 54 return page;
52} 55}
53 56
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
index e699a12cdcca..18e0377f72bb 100644
--- a/arch/sh/include/asm/processor_32.h
+++ b/arch/sh/include/asm/processor_32.h
@@ -111,6 +111,16 @@ struct thread_struct {
111 111
112 /* Extended processor state */ 112 /* Extended processor state */
113 union thread_xstate *xstate; 113 union thread_xstate *xstate;
114
115 /*
116 * fpu_counter contains the number of consecutive context switches
117 * that the FPU is used. If this is over a threshold, the lazy fpu
118 * saving becomes unlazy to save the trap. This is an unsigned char
119 * so that after 256 times the counter wraps and the behavior turns
120 * lazy again; this to deal with bursty apps that only use FPU for
121 * a short time
122 */
123 unsigned char fpu_counter;
114}; 124};
115 125
116#define INIT_THREAD { \ 126#define INIT_THREAD { \
diff --git a/arch/sh/include/asm/processor_64.h b/arch/sh/include/asm/processor_64.h
index 1cc7d3197143..eedd4f625d07 100644
--- a/arch/sh/include/asm/processor_64.h
+++ b/arch/sh/include/asm/processor_64.h
@@ -126,6 +126,16 @@ struct thread_struct {
126 126
127 /* floating point info */ 127 /* floating point info */
128 union thread_xstate *xstate; 128 union thread_xstate *xstate;
129
130 /*
131 * fpu_counter contains the number of consecutive context switches
132 * that the FPU is used. If this is over a threshold, the lazy fpu
133 * saving becomes unlazy to save the trap. This is an unsigned char
134 * so that after 256 times the counter wraps and the behavior turns
135 * lazy again; this to deal with bursty apps that only use FPU for
136 * a short time
137 */
138 unsigned char fpu_counter;
129}; 139};
130 140
131#define INIT_MMAP \ 141#define INIT_MMAP \
diff --git a/arch/sh/kernel/cpu/fpu.c b/arch/sh/kernel/cpu/fpu.c
index f8f7af51c128..4e332244ea75 100644
--- a/arch/sh/kernel/cpu/fpu.c
+++ b/arch/sh/kernel/cpu/fpu.c
@@ -44,7 +44,7 @@ void __fpu_state_restore(void)
44 restore_fpu(tsk); 44 restore_fpu(tsk);
45 45
46 task_thread_info(tsk)->status |= TS_USEDFPU; 46 task_thread_info(tsk)->status |= TS_USEDFPU;
47 tsk->fpu_counter++; 47 tsk->thread.fpu_counter++;
48} 48}
49 49
50void fpu_state_restore(struct pt_regs *regs) 50void fpu_state_restore(struct pt_regs *regs)
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 063af10ff3c1..0833736afa32 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -149,47 +149,32 @@ void irq_ctx_exit(int cpu)
149 hardirq_ctx[cpu] = NULL; 149 hardirq_ctx[cpu] = NULL;
150} 150}
151 151
152asmlinkage void do_softirq(void) 152void do_softirq_own_stack(void)
153{ 153{
154 unsigned long flags;
155 struct thread_info *curctx; 154 struct thread_info *curctx;
156 union irq_ctx *irqctx; 155 union irq_ctx *irqctx;
157 u32 *isp; 156 u32 *isp;
158 157
159 if (in_interrupt()) 158 curctx = current_thread_info();
160 return; 159 irqctx = softirq_ctx[smp_processor_id()];
161 160 irqctx->tinfo.task = curctx->task;
162 local_irq_save(flags); 161 irqctx->tinfo.previous_sp = current_stack_pointer;
163 162
164 if (local_softirq_pending()) { 163 /* build the stack frame on the softirq stack */
165 curctx = current_thread_info(); 164 isp = (u32 *)((char *)irqctx + sizeof(*irqctx));
166 irqctx = softirq_ctx[smp_processor_id()]; 165
167 irqctx->tinfo.task = curctx->task; 166 __asm__ __volatile__ (
168 irqctx->tinfo.previous_sp = current_stack_pointer; 167 "mov r15, r9 \n"
169 168 "jsr @%0 \n"
170 /* build the stack frame on the softirq stack */ 169 /* switch to the softirq stack */
171 isp = (u32 *)((char *)irqctx + sizeof(*irqctx)); 170 " mov %1, r15 \n"
172 171 /* restore the thread stack */
173 __asm__ __volatile__ ( 172 "mov r9, r15 \n"
174 "mov r15, r9 \n" 173 : /* no outputs */
175 "jsr @%0 \n" 174 : "r" (__do_softirq), "r" (isp)
176 /* switch to the softirq stack */ 175 : "memory", "r0", "r1", "r2", "r3", "r4",
177 " mov %1, r15 \n" 176 "r5", "r6", "r7", "r8", "r9", "r15", "t", "pr"
178 /* restore the thread stack */ 177 );
179 "mov r9, r15 \n"
180 : /* no outputs */
181 : "r" (__do_softirq), "r" (isp)
182 : "memory", "r0", "r1", "r2", "r3", "r4",
183 "r5", "r6", "r7", "r8", "r9", "r15", "t", "pr"
184 );
185
186 /*
187 * Shouldn't happen, we returned above if in_interrupt():
188 */
189 WARN_ON_ONCE(softirq_count());
190 }
191
192 local_irq_restore(flags);
193} 178}
194#else 179#else
195static inline void handle_one_irq(unsigned int irq) 180static inline void handle_one_irq(unsigned int irq)
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
index ebd3933005b4..2885fc9d9dcd 100644
--- a/arch/sh/kernel/process_32.c
+++ b/arch/sh/kernel/process_32.c
@@ -156,7 +156,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
156#endif 156#endif
157 ti->addr_limit = KERNEL_DS; 157 ti->addr_limit = KERNEL_DS;
158 ti->status &= ~TS_USEDFPU; 158 ti->status &= ~TS_USEDFPU;
159 p->fpu_counter = 0; 159 p->thread.fpu_counter = 0;
160 return 0; 160 return 0;
161 } 161 }
162 *childregs = *current_pt_regs(); 162 *childregs = *current_pt_regs();
@@ -189,7 +189,7 @@ __switch_to(struct task_struct *prev, struct task_struct *next)
189 unlazy_fpu(prev, task_pt_regs(prev)); 189 unlazy_fpu(prev, task_pt_regs(prev));
190 190
191 /* we're going to use this soon, after a few expensive things */ 191 /* we're going to use this soon, after a few expensive things */
192 if (next->fpu_counter > 5) 192 if (next->thread.fpu_counter > 5)
193 prefetch(next_t->xstate); 193 prefetch(next_t->xstate);
194 194
195#ifdef CONFIG_MMU 195#ifdef CONFIG_MMU
@@ -207,7 +207,7 @@ __switch_to(struct task_struct *prev, struct task_struct *next)
207 * restore of the math state immediately to avoid the trap; the 207 * restore of the math state immediately to avoid the trap; the
208 * chances of needing FPU soon are obviously high now 208 * chances of needing FPU soon are obviously high now
209 */ 209 */
210 if (next->fpu_counter > 5) 210 if (next->thread.fpu_counter > 5)
211 __fpu_state_restore(); 211 __fpu_state_restore();
212 212
213 return prev; 213 return prev;
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c
index 174d124b419e..e2062e643341 100644
--- a/arch/sh/kernel/process_64.c
+++ b/arch/sh/kernel/process_64.c
@@ -374,7 +374,7 @@ asmlinkage void ret_from_kernel_thread(void);
374int copy_thread(unsigned long clone_flags, unsigned long usp, 374int copy_thread(unsigned long clone_flags, unsigned long usp,
375 unsigned long arg, struct task_struct *p) 375 unsigned long arg, struct task_struct *p)
376{ 376{
377 struct pt_regs *childregs, *regs = current_pt_regs(); 377 struct pt_regs *childregs;
378 378
379#ifdef CONFIG_SH_FPU 379#ifdef CONFIG_SH_FPU
380 /* can't happen for a kernel thread */ 380 /* can't happen for a kernel thread */
@@ -393,7 +393,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
393 if (unlikely(p->flags & PF_KTHREAD)) { 393 if (unlikely(p->flags & PF_KTHREAD)) {
394 memset(childregs, 0, sizeof(struct pt_regs)); 394 memset(childregs, 0, sizeof(struct pt_regs));
395 childregs->regs[2] = (unsigned long)arg; 395 childregs->regs[2] = (unsigned long)arg;
396 childregs->regs[3] = (unsigned long)fn; 396 childregs->regs[3] = (unsigned long)usp;
397 childregs->sr = (1 << 30); /* not user_mode */ 397 childregs->sr = (1 << 30); /* not user_mode */
398 childregs->sr |= SR_FD; /* Invalidate FPU flag */ 398 childregs->sr |= SR_FD; /* Invalidate FPU flag */
399 p->thread.pc = (unsigned long) ret_from_kernel_thread; 399 p->thread.pc = (unsigned long) ret_from_kernel_thread;
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 33890fd267cb..2d089fe2cba9 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -231,7 +231,7 @@ static void __init bootmem_init_one_node(unsigned int nid)
231 if (!p->node_spanned_pages) 231 if (!p->node_spanned_pages)
232 return; 232 return;
233 233
234 end_pfn = p->node_start_pfn + p->node_spanned_pages; 234 end_pfn = pgdat_end_pfn(p);
235 235
236 total_pages = bootmem_bootmap_pages(p->node_spanned_pages); 236 total_pages = bootmem_bootmap_pages(p->node_spanned_pages);
237 237
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 242200fbbbcf..d4f7a6a163dc 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -29,7 +29,6 @@ config SPARC
29 select HAVE_ARCH_JUMP_LABEL 29 select HAVE_ARCH_JUMP_LABEL
30 select GENERIC_IRQ_SHOW 30 select GENERIC_IRQ_SHOW
31 select ARCH_WANT_IPC_PARSE_VERSION 31 select ARCH_WANT_IPC_PARSE_VERSION
32 select USE_GENERIC_SMP_HELPERS if SMP
33 select GENERIC_PCI_IOMAP 32 select GENERIC_PCI_IOMAP
34 select HAVE_NMI_WATCHDOG if SPARC64 33 select HAVE_NMI_WATCHDOG if SPARC64
35 select HAVE_BPF_JIT 34 select HAVE_BPF_JIT
@@ -65,6 +64,7 @@ config SPARC64
65 select HAVE_DYNAMIC_FTRACE 64 select HAVE_DYNAMIC_FTRACE
66 select HAVE_FTRACE_MCOUNT_RECORD 65 select HAVE_FTRACE_MCOUNT_RECORD
67 select HAVE_SYSCALL_TRACEPOINTS 66 select HAVE_SYSCALL_TRACEPOINTS
67 select HAVE_CONTEXT_TRACKING
68 select HAVE_DEBUG_KMEMLEAK 68 select HAVE_DEBUG_KMEMLEAK
69 select RTC_DRV_CMOS 69 select RTC_DRV_CMOS
70 select RTC_DRV_BQ4802 70 select RTC_DRV_BQ4802
@@ -507,12 +507,17 @@ config SUN_OPENPROMFS
507 Only choose N if you know in advance that you will not need to modify 507 Only choose N if you know in advance that you will not need to modify
508 OpenPROM settings on the running system. 508 OpenPROM settings on the running system.
509 509
510# Makefile helper 510# Makefile helpers
511config SPARC64_PCI 511config SPARC64_PCI
512 bool 512 bool
513 default y 513 default y
514 depends on SPARC64 && PCI 514 depends on SPARC64 && PCI
515 515
516config SPARC64_PCI_MSI
517 bool
518 default y
519 depends on SPARC64_PCI && PCI_MSI
520
516endmenu 521endmenu
517 522
518menu "Executable file formats" 523menu "Executable file formats"
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 7e4a97fbded4..bf390667657a 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -16,3 +16,4 @@ generic-y += serial.h
16generic-y += trace_clock.h 16generic-y += trace_clock.h
17generic-y += types.h 17generic-y += types.h
18generic-y += word-at-a-time.h 18generic-y += word-at-a-time.h
19generic-y += preempt.h
diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h
index e204f902e6c9..7c90c50c200d 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -254,7 +254,7 @@ static int sun_fd_request_irq(void)
254 once = 1; 254 once = 1;
255 255
256 error = request_irq(FLOPPY_IRQ, sparc_floppy_irq, 256 error = request_irq(FLOPPY_IRQ, sparc_floppy_irq,
257 IRQF_DISABLED, "floppy", NULL); 257 0, "floppy", NULL);
258 258
259 return ((error == 0) ? 0 : -1); 259 return ((error == 0) ? 0 : -1);
260 } 260 }
diff --git a/arch/sparc/include/asm/jump_label.h b/arch/sparc/include/asm/jump_label.h
index 5080d16a832f..ec2e2e2aba7d 100644
--- a/arch/sparc/include/asm/jump_label.h
+++ b/arch/sparc/include/asm/jump_label.h
@@ -9,7 +9,7 @@
9 9
10static __always_inline bool arch_static_branch(struct static_key *key) 10static __always_inline bool arch_static_branch(struct static_key *key)
11{ 11{
12 asm goto("1:\n\t" 12 asm_volatile_goto("1:\n\t"
13 "nop\n\t" 13 "nop\n\t"
14 "nop\n\t" 14 "nop\n\t"
15 ".pushsection __jump_table, \"aw\"\n\t" 15 ".pushsection __jump_table, \"aw\"\n\t"
diff --git a/arch/sparc/include/asm/mmu_64.h b/arch/sparc/include/asm/mmu_64.h
index 76092c4dd277..f668797ae234 100644
--- a/arch/sparc/include/asm/mmu_64.h
+++ b/arch/sparc/include/asm/mmu_64.h
@@ -93,7 +93,6 @@ typedef struct {
93 spinlock_t lock; 93 spinlock_t lock;
94 unsigned long sparc64_ctx_val; 94 unsigned long sparc64_ctx_val;
95 unsigned long huge_pte_count; 95 unsigned long huge_pte_count;
96 struct page *pgtable_page;
97 struct tsb_config tsb_block[MM_NUM_TSBS]; 96 struct tsb_config tsb_block[MM_NUM_TSBS];
98 struct hv_tsb_descr tsb_descr[MM_NUM_TSBS]; 97 struct hv_tsb_descr tsb_descr[MM_NUM_TSBS];
99} mm_context_t; 98} mm_context_t;
diff --git a/arch/sparc/include/asm/page_64.h b/arch/sparc/include/asm/page_64.h
index e15538899f3d..aac53fcea807 100644
--- a/arch/sparc/include/asm/page_64.h
+++ b/arch/sparc/include/asm/page_64.h
@@ -15,7 +15,10 @@
15#define DCACHE_ALIASING_POSSIBLE 15#define DCACHE_ALIASING_POSSIBLE
16#endif 16#endif
17 17
18#define HPAGE_SHIFT 22 18#define HPAGE_SHIFT 23
19#define REAL_HPAGE_SHIFT 22
20
21#define REAL_HPAGE_SIZE (_AC(1,UL) << REAL_HPAGE_SHIFT)
19 22
20#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) 23#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
21#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) 24#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
@@ -53,8 +56,8 @@ extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct pag
53/* These are used to make use of C type-checking.. */ 56/* These are used to make use of C type-checking.. */
54typedef struct { unsigned long pte; } pte_t; 57typedef struct { unsigned long pte; } pte_t;
55typedef struct { unsigned long iopte; } iopte_t; 58typedef struct { unsigned long iopte; } iopte_t;
56typedef struct { unsigned int pmd; } pmd_t; 59typedef struct { unsigned long pmd; } pmd_t;
57typedef struct { unsigned int pgd; } pgd_t; 60typedef struct { unsigned long pgd; } pgd_t;
58typedef struct { unsigned long pgprot; } pgprot_t; 61typedef struct { unsigned long pgprot; } pgprot_t;
59 62
60#define pte_val(x) ((x).pte) 63#define pte_val(x) ((x).pte)
@@ -73,8 +76,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;
73/* .. while these make it easier on the compiler */ 76/* .. while these make it easier on the compiler */
74typedef unsigned long pte_t; 77typedef unsigned long pte_t;
75typedef unsigned long iopte_t; 78typedef unsigned long iopte_t;
76typedef unsigned int pmd_t; 79typedef unsigned long pmd_t;
77typedef unsigned int pgd_t; 80typedef unsigned long pgd_t;
78typedef unsigned long pgprot_t; 81typedef unsigned long pgprot_t;
79 82
80#define pte_val(x) (x) 83#define pte_val(x) (x)
@@ -93,18 +96,44 @@ typedef unsigned long pgprot_t;
93 96
94typedef pte_t *pgtable_t; 97typedef pte_t *pgtable_t;
95 98
99/* These two values define the virtual address space range in which we
100 * must forbid 64-bit user processes from making mappings. It used to
101 * represent precisely the virtual address space hole present in most
102 * early sparc64 chips including UltraSPARC-I. But now it also is
103 * further constrained by the limits of our page tables, which is
104 * 43-bits of virtual address.
105 */
106#define SPARC64_VA_HOLE_TOP _AC(0xfffffc0000000000,UL)
107#define SPARC64_VA_HOLE_BOTTOM _AC(0x0000040000000000,UL)
108
109/* The next two defines specify the actual exclusion region we
110 * enforce, wherein we use a 4GB red zone on each side of the VA hole.
111 */
112#define VA_EXCLUDE_START (SPARC64_VA_HOLE_BOTTOM - (1UL << 32UL))
113#define VA_EXCLUDE_END (SPARC64_VA_HOLE_TOP + (1UL << 32UL))
114
96#define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \ 115#define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \
97 (_AC(0x0000000070000000,UL)) : \ 116 _AC(0x0000000070000000,UL) : \
98 (_AC(0xfffff80000000000,UL) + (1UL << 32UL))) 117 VA_EXCLUDE_END)
99 118
100#include <asm-generic/memory_model.h> 119#include <asm-generic/memory_model.h>
101 120
121#define PAGE_OFFSET_BY_BITS(X) (-(_AC(1,UL) << (X)))
122extern unsigned long PAGE_OFFSET;
123
102#endif /* !(__ASSEMBLY__) */ 124#endif /* !(__ASSEMBLY__) */
103 125
104/* We used to stick this into a hard-coded global register (%g4) 126/* The maximum number of physical memory address bits we support, this
105 * but that does not make sense anymore. 127 * is used to size various tables used to manage kernel TLB misses and
128 * also the sparsemem code.
129 */
130#define MAX_PHYS_ADDRESS_BITS 47
131
132/* These two shift counts are used when indexing sparc64_valid_addr_bitmap
133 * and kpte_linear_bitmap.
106 */ 134 */
107#define PAGE_OFFSET _AC(0xFFFFF80000000000,UL) 135#define ILOG2_4MB 22
136#define ILOG2_256MB 28
108 137
109#ifndef __ASSEMBLY__ 138#ifndef __ASSEMBLY__
110 139
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index 36760317814f..8358dc144959 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -48,18 +48,18 @@
48/* PMD_SHIFT determines the size of the area a second-level page 48/* PMD_SHIFT determines the size of the area a second-level page
49 * table can map 49 * table can map
50 */ 50 */
51#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-4)) 51#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3))
52#define PMD_SIZE (_AC(1,UL) << PMD_SHIFT) 52#define PMD_SIZE (_AC(1,UL) << PMD_SHIFT)
53#define PMD_MASK (~(PMD_SIZE-1)) 53#define PMD_MASK (~(PMD_SIZE-1))
54#define PMD_BITS (PAGE_SHIFT - 2) 54#define PMD_BITS (PAGE_SHIFT - 3)
55 55
56/* PGDIR_SHIFT determines what a third-level page table entry can map */ 56/* PGDIR_SHIFT determines what a third-level page table entry can map */
57#define PGDIR_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-4) + PMD_BITS) 57#define PGDIR_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3) + PMD_BITS)
58#define PGDIR_SIZE (_AC(1,UL) << PGDIR_SHIFT) 58#define PGDIR_SIZE (_AC(1,UL) << PGDIR_SHIFT)
59#define PGDIR_MASK (~(PGDIR_SIZE-1)) 59#define PGDIR_MASK (~(PGDIR_SIZE-1))
60#define PGDIR_BITS (PAGE_SHIFT - 2) 60#define PGDIR_BITS (PAGE_SHIFT - 3)
61 61
62#if (PGDIR_SHIFT + PGDIR_BITS) != 44 62#if (PGDIR_SHIFT + PGDIR_BITS) != 43
63#error Page table parameters do not cover virtual address space properly. 63#error Page table parameters do not cover virtual address space properly.
64#endif 64#endif
65 65
@@ -67,35 +67,12 @@
67#error PMD_SHIFT must equal HPAGE_SHIFT for transparent huge pages. 67#error PMD_SHIFT must equal HPAGE_SHIFT for transparent huge pages.
68#endif 68#endif
69 69
70/* PMDs point to PTE tables which are 4K aligned. */
71#define PMD_PADDR _AC(0xfffffffe,UL)
72#define PMD_PADDR_SHIFT _AC(11,UL)
73
74#define PMD_ISHUGE _AC(0x00000001,UL)
75
76/* This is the PMD layout when PMD_ISHUGE is set. With 4MB huge
77 * pages, this frees up a bunch of bits in the layout that we can
78 * use for the protection settings and software metadata.
79 */
80#define PMD_HUGE_PADDR _AC(0xfffff800,UL)
81#define PMD_HUGE_PROTBITS _AC(0x000007ff,UL)
82#define PMD_HUGE_PRESENT _AC(0x00000400,UL)
83#define PMD_HUGE_WRITE _AC(0x00000200,UL)
84#define PMD_HUGE_DIRTY _AC(0x00000100,UL)
85#define PMD_HUGE_ACCESSED _AC(0x00000080,UL)
86#define PMD_HUGE_EXEC _AC(0x00000040,UL)
87#define PMD_HUGE_SPLITTING _AC(0x00000020,UL)
88
89/* PGDs point to PMD tables which are 8K aligned. */
90#define PGD_PADDR _AC(0xfffffffc,UL)
91#define PGD_PADDR_SHIFT _AC(11,UL)
92
93#ifndef __ASSEMBLY__ 70#ifndef __ASSEMBLY__
94 71
95#include <linux/sched.h> 72#include <linux/sched.h>
96 73
97/* Entries per page directory level. */ 74/* Entries per page directory level. */
98#define PTRS_PER_PTE (1UL << (PAGE_SHIFT-4)) 75#define PTRS_PER_PTE (1UL << (PAGE_SHIFT-3))
99#define PTRS_PER_PMD (1UL << PMD_BITS) 76#define PTRS_PER_PMD (1UL << PMD_BITS)
100#define PTRS_PER_PGD (1UL << PGDIR_BITS) 77#define PTRS_PER_PGD (1UL << PGDIR_BITS)
101 78
@@ -112,6 +89,7 @@
112#define _PAGE_VALID _AC(0x8000000000000000,UL) /* Valid TTE */ 89#define _PAGE_VALID _AC(0x8000000000000000,UL) /* Valid TTE */
113#define _PAGE_R _AC(0x8000000000000000,UL) /* Keep ref bit uptodate*/ 90#define _PAGE_R _AC(0x8000000000000000,UL) /* Keep ref bit uptodate*/
114#define _PAGE_SPECIAL _AC(0x0200000000000000,UL) /* Special page */ 91#define _PAGE_SPECIAL _AC(0x0200000000000000,UL) /* Special page */
92#define _PAGE_PMD_HUGE _AC(0x0100000000000000,UL) /* Huge page */
115 93
116/* Advertise support for _PAGE_SPECIAL */ 94/* Advertise support for _PAGE_SPECIAL */
117#define __HAVE_ARCH_PTE_SPECIAL 95#define __HAVE_ARCH_PTE_SPECIAL
@@ -125,6 +103,7 @@
125#define _PAGE_IE_4U _AC(0x0800000000000000,UL) /* Invert Endianness */ 103#define _PAGE_IE_4U _AC(0x0800000000000000,UL) /* Invert Endianness */
126#define _PAGE_SOFT2_4U _AC(0x07FC000000000000,UL) /* Software bits, set 2 */ 104#define _PAGE_SOFT2_4U _AC(0x07FC000000000000,UL) /* Software bits, set 2 */
127#define _PAGE_SPECIAL_4U _AC(0x0200000000000000,UL) /* Special page */ 105#define _PAGE_SPECIAL_4U _AC(0x0200000000000000,UL) /* Special page */
106#define _PAGE_PMD_HUGE_4U _AC(0x0100000000000000,UL) /* Huge page */
128#define _PAGE_RES1_4U _AC(0x0002000000000000,UL) /* Reserved */ 107#define _PAGE_RES1_4U _AC(0x0002000000000000,UL) /* Reserved */
129#define _PAGE_SZ32MB_4U _AC(0x0001000000000000,UL) /* (Panther) 32MB page */ 108#define _PAGE_SZ32MB_4U _AC(0x0001000000000000,UL) /* (Panther) 32MB page */
130#define _PAGE_SZ256MB_4U _AC(0x2001000000000000,UL) /* (Panther) 256MB page */ 109#define _PAGE_SZ256MB_4U _AC(0x2001000000000000,UL) /* (Panther) 256MB page */
@@ -155,6 +134,7 @@
155#define _PAGE_READ_4V _AC(0x0800000000000000,UL) /* Readable SW Bit */ 134#define _PAGE_READ_4V _AC(0x0800000000000000,UL) /* Readable SW Bit */
156#define _PAGE_WRITE_4V _AC(0x0400000000000000,UL) /* Writable SW Bit */ 135#define _PAGE_WRITE_4V _AC(0x0400000000000000,UL) /* Writable SW Bit */
157#define _PAGE_SPECIAL_4V _AC(0x0200000000000000,UL) /* Special page */ 136#define _PAGE_SPECIAL_4V _AC(0x0200000000000000,UL) /* Special page */
137#define _PAGE_PMD_HUGE_4V _AC(0x0100000000000000,UL) /* Huge page */
158#define _PAGE_PADDR_4V _AC(0x00FFFFFFFFFFE000,UL) /* paddr[55:13] */ 138#define _PAGE_PADDR_4V _AC(0x00FFFFFFFFFFE000,UL) /* paddr[55:13] */
159#define _PAGE_IE_4V _AC(0x0000000000001000,UL) /* Invert Endianness */ 139#define _PAGE_IE_4V _AC(0x0000000000001000,UL) /* Invert Endianness */
160#define _PAGE_E_4V _AC(0x0000000000000800,UL) /* side-Effect */ 140#define _PAGE_E_4V _AC(0x0000000000000800,UL) /* side-Effect */
@@ -180,6 +160,10 @@
180#define _PAGE_SZBITS_4U _PAGE_SZ8K_4U 160#define _PAGE_SZBITS_4U _PAGE_SZ8K_4U
181#define _PAGE_SZBITS_4V _PAGE_SZ8K_4V 161#define _PAGE_SZBITS_4V _PAGE_SZ8K_4V
182 162
163#if REAL_HPAGE_SHIFT != 22
164#error REAL_HPAGE_SHIFT and _PAGE_SZHUGE_foo must match up
165#endif
166
183#define _PAGE_SZHUGE_4U _PAGE_SZ4MB_4U 167#define _PAGE_SZHUGE_4U _PAGE_SZ4MB_4U
184#define _PAGE_SZHUGE_4V _PAGE_SZ4MB_4V 168#define _PAGE_SZHUGE_4V _PAGE_SZ4MB_4V
185 169
@@ -239,16 +223,13 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot)
239#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) 223#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
240 224
241#ifdef CONFIG_TRANSPARENT_HUGEPAGE 225#ifdef CONFIG_TRANSPARENT_HUGEPAGE
242extern pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot); 226static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot)
243#define mk_pmd(page, pgprot) pfn_pmd(page_to_pfn(page), (pgprot))
244
245extern pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot);
246
247static inline pmd_t pmd_mkhuge(pmd_t pmd)
248{ 227{
249 /* Do nothing, mk_pmd() does this part. */ 228 pte_t pte = pfn_pte(page_nr, pgprot);
250 return pmd; 229
230 return __pmd(pte_val(pte));
251} 231}
232#define mk_pmd(page, pgprot) pfn_pmd(page_to_pfn(page), (pgprot))
252#endif 233#endif
253 234
254/* This one can be done with two shifts. */ 235/* This one can be done with two shifts. */
@@ -309,14 +290,25 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t prot)
309 : "=r" (mask), "=r" (tmp) 290 : "=r" (mask), "=r" (tmp)
310 : "i" (_PAGE_PADDR_4U | _PAGE_MODIFIED_4U | _PAGE_ACCESSED_4U | 291 : "i" (_PAGE_PADDR_4U | _PAGE_MODIFIED_4U | _PAGE_ACCESSED_4U |
311 _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U | _PAGE_PRESENT_4U | 292 _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U | _PAGE_PRESENT_4U |
312 _PAGE_SPECIAL), 293 _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4U),
313 "i" (_PAGE_PADDR_4V | _PAGE_MODIFIED_4V | _PAGE_ACCESSED_4V | 294 "i" (_PAGE_PADDR_4V | _PAGE_MODIFIED_4V | _PAGE_ACCESSED_4V |
314 _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V | _PAGE_PRESENT_4V | 295 _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V | _PAGE_PRESENT_4V |
315 _PAGE_SPECIAL)); 296 _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4V));
316 297
317 return __pte((pte_val(pte) & mask) | (pgprot_val(prot) & ~mask)); 298 return __pte((pte_val(pte) & mask) | (pgprot_val(prot) & ~mask));
318} 299}
319 300
301#ifdef CONFIG_TRANSPARENT_HUGEPAGE
302static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
303{
304 pte_t pte = __pte(pmd_val(pmd));
305
306 pte = pte_modify(pte, newprot);
307
308 return __pmd(pte_val(pte));
309}
310#endif
311
320static inline pte_t pgoff_to_pte(unsigned long off) 312static inline pte_t pgoff_to_pte(unsigned long off)
321{ 313{
322 off <<= PAGE_SHIFT; 314 off <<= PAGE_SHIFT;
@@ -357,7 +349,7 @@ static inline pgprot_t pgprot_noncached(pgprot_t prot)
357 */ 349 */
358#define pgprot_noncached pgprot_noncached 350#define pgprot_noncached pgprot_noncached
359 351
360#ifdef CONFIG_HUGETLB_PAGE 352#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
361static inline pte_t pte_mkhuge(pte_t pte) 353static inline pte_t pte_mkhuge(pte_t pte)
362{ 354{
363 unsigned long mask; 355 unsigned long mask;
@@ -375,6 +367,17 @@ static inline pte_t pte_mkhuge(pte_t pte)
375 367
376 return __pte(pte_val(pte) | mask); 368 return __pte(pte_val(pte) | mask);
377} 369}
370#ifdef CONFIG_TRANSPARENT_HUGEPAGE
371static inline pmd_t pmd_mkhuge(pmd_t pmd)
372{
373 pte_t pte = __pte(pmd_val(pmd));
374
375 pte = pte_mkhuge(pte);
376 pte_val(pte) |= _PAGE_PMD_HUGE;
377
378 return __pmd(pte_val(pte));
379}
380#endif
378#endif 381#endif
379 382
380static inline pte_t pte_mkdirty(pte_t pte) 383static inline pte_t pte_mkdirty(pte_t pte)
@@ -626,91 +629,130 @@ static inline unsigned long pte_special(pte_t pte)
626 return pte_val(pte) & _PAGE_SPECIAL; 629 return pte_val(pte) & _PAGE_SPECIAL;
627} 630}
628 631
629static inline int pmd_large(pmd_t pmd) 632static inline unsigned long pmd_large(pmd_t pmd)
630{ 633{
631 return (pmd_val(pmd) & (PMD_ISHUGE | PMD_HUGE_PRESENT)) == 634 pte_t pte = __pte(pmd_val(pmd));
632 (PMD_ISHUGE | PMD_HUGE_PRESENT); 635
636 return (pte_val(pte) & _PAGE_PMD_HUGE) && pte_present(pte);
633} 637}
634 638
635#ifdef CONFIG_TRANSPARENT_HUGEPAGE 639#ifdef CONFIG_TRANSPARENT_HUGEPAGE
636static inline int pmd_young(pmd_t pmd) 640static inline unsigned long pmd_young(pmd_t pmd)
637{ 641{
638 return pmd_val(pmd) & PMD_HUGE_ACCESSED; 642 pte_t pte = __pte(pmd_val(pmd));
643
644 return pte_young(pte);
639} 645}
640 646
641static inline int pmd_write(pmd_t pmd) 647static inline unsigned long pmd_write(pmd_t pmd)
642{ 648{
643 return pmd_val(pmd) & PMD_HUGE_WRITE; 649 pte_t pte = __pte(pmd_val(pmd));
650
651 return pte_write(pte);
644} 652}
645 653
646static inline unsigned long pmd_pfn(pmd_t pmd) 654static inline unsigned long pmd_pfn(pmd_t pmd)
647{ 655{
648 unsigned long val = pmd_val(pmd) & PMD_HUGE_PADDR; 656 pte_t pte = __pte(pmd_val(pmd));
649 657
650 return val >> (PAGE_SHIFT - PMD_PADDR_SHIFT); 658 return pte_pfn(pte);
651} 659}
652 660
653static inline int pmd_trans_splitting(pmd_t pmd) 661static inline unsigned long pmd_trans_huge(pmd_t pmd)
654{ 662{
655 return (pmd_val(pmd) & (PMD_ISHUGE|PMD_HUGE_SPLITTING)) == 663 pte_t pte = __pte(pmd_val(pmd));
656 (PMD_ISHUGE|PMD_HUGE_SPLITTING); 664
665 return pte_val(pte) & _PAGE_PMD_HUGE;
657} 666}
658 667
659static inline int pmd_trans_huge(pmd_t pmd) 668static inline unsigned long pmd_trans_splitting(pmd_t pmd)
660{ 669{
661 return pmd_val(pmd) & PMD_ISHUGE; 670 pte_t pte = __pte(pmd_val(pmd));
671
672 return pmd_trans_huge(pmd) && pte_special(pte);
662} 673}
663 674
664#define has_transparent_hugepage() 1 675#define has_transparent_hugepage() 1
665 676
666static inline pmd_t pmd_mkold(pmd_t pmd) 677static inline pmd_t pmd_mkold(pmd_t pmd)
667{ 678{
668 pmd_val(pmd) &= ~PMD_HUGE_ACCESSED; 679 pte_t pte = __pte(pmd_val(pmd));
669 return pmd; 680
681 pte = pte_mkold(pte);
682
683 return __pmd(pte_val(pte));
670} 684}
671 685
672static inline pmd_t pmd_wrprotect(pmd_t pmd) 686static inline pmd_t pmd_wrprotect(pmd_t pmd)
673{ 687{
674 pmd_val(pmd) &= ~PMD_HUGE_WRITE; 688 pte_t pte = __pte(pmd_val(pmd));
675 return pmd; 689
690 pte = pte_wrprotect(pte);
691
692 return __pmd(pte_val(pte));
676} 693}
677 694
678static inline pmd_t pmd_mkdirty(pmd_t pmd) 695static inline pmd_t pmd_mkdirty(pmd_t pmd)
679{ 696{
680 pmd_val(pmd) |= PMD_HUGE_DIRTY; 697 pte_t pte = __pte(pmd_val(pmd));
681 return pmd; 698
699 pte = pte_mkdirty(pte);
700
701 return __pmd(pte_val(pte));
682} 702}
683 703
684static inline pmd_t pmd_mkyoung(pmd_t pmd) 704static inline pmd_t pmd_mkyoung(pmd_t pmd)
685{ 705{
686 pmd_val(pmd) |= PMD_HUGE_ACCESSED; 706 pte_t pte = __pte(pmd_val(pmd));
687 return pmd; 707
708 pte = pte_mkyoung(pte);
709
710 return __pmd(pte_val(pte));
688} 711}
689 712
690static inline pmd_t pmd_mkwrite(pmd_t pmd) 713static inline pmd_t pmd_mkwrite(pmd_t pmd)
691{ 714{
692 pmd_val(pmd) |= PMD_HUGE_WRITE; 715 pte_t pte = __pte(pmd_val(pmd));
693 return pmd; 716
717 pte = pte_mkwrite(pte);
718
719 return __pmd(pte_val(pte));
694} 720}
695 721
696static inline pmd_t pmd_mknotpresent(pmd_t pmd) 722static inline pmd_t pmd_mknotpresent(pmd_t pmd)
697{ 723{
698 pmd_val(pmd) &= ~PMD_HUGE_PRESENT; 724 unsigned long mask;
725
726 if (tlb_type == hypervisor)
727 mask = _PAGE_PRESENT_4V;
728 else
729 mask = _PAGE_PRESENT_4U;
730
731 pmd_val(pmd) &= ~mask;
732
699 return pmd; 733 return pmd;
700} 734}
701 735
702static inline pmd_t pmd_mksplitting(pmd_t pmd) 736static inline pmd_t pmd_mksplitting(pmd_t pmd)
703{ 737{
704 pmd_val(pmd) |= PMD_HUGE_SPLITTING; 738 pte_t pte = __pte(pmd_val(pmd));
705 return pmd; 739
740 pte = pte_mkspecial(pte);
741
742 return __pmd(pte_val(pte));
706} 743}
707 744
708extern pgprot_t pmd_pgprot(pmd_t entry); 745static inline pgprot_t pmd_pgprot(pmd_t entry)
746{
747 unsigned long val = pmd_val(entry);
748
749 return __pgprot(val);
750}
709#endif 751#endif
710 752
711static inline int pmd_present(pmd_t pmd) 753static inline int pmd_present(pmd_t pmd)
712{ 754{
713 return pmd_val(pmd) != 0U; 755 return pmd_val(pmd) != 0UL;
714} 756}
715 757
716#define pmd_none(pmd) (!pmd_val(pmd)) 758#define pmd_none(pmd) (!pmd_val(pmd))
@@ -728,33 +770,32 @@ static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
728 770
729static inline void pmd_set(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep) 771static inline void pmd_set(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep)
730{ 772{
731 unsigned long val = __pa((unsigned long) (ptep)) >> PMD_PADDR_SHIFT; 773 unsigned long val = __pa((unsigned long) (ptep));
732 774
733 pmd_val(*pmdp) = val; 775 pmd_val(*pmdp) = val;
734} 776}
735 777
736#define pud_set(pudp, pmdp) \ 778#define pud_set(pudp, pmdp) \
737 (pud_val(*(pudp)) = (__pa((unsigned long) (pmdp)) >> PGD_PADDR_SHIFT)) 779 (pud_val(*(pudp)) = (__pa((unsigned long) (pmdp))))
738static inline unsigned long __pmd_page(pmd_t pmd) 780static inline unsigned long __pmd_page(pmd_t pmd)
739{ 781{
740 unsigned long paddr = (unsigned long) pmd_val(pmd); 782 pte_t pte = __pte(pmd_val(pmd));
741#ifdef CONFIG_TRANSPARENT_HUGEPAGE 783 unsigned long pfn;
742 if (pmd_val(pmd) & PMD_ISHUGE) 784
743 paddr &= PMD_HUGE_PADDR; 785 pfn = pte_pfn(pte);
744#endif 786
745 paddr <<= PMD_PADDR_SHIFT; 787 return ((unsigned long) __va(pfn << PAGE_SHIFT));
746 return ((unsigned long) __va(paddr));
747} 788}
748#define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd)) 789#define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd))
749#define pud_page_vaddr(pud) \ 790#define pud_page_vaddr(pud) \
750 ((unsigned long) __va((((unsigned long)pud_val(pud))<<PGD_PADDR_SHIFT))) 791 ((unsigned long) __va(pud_val(pud)))
751#define pud_page(pud) virt_to_page((void *)pud_page_vaddr(pud)) 792#define pud_page(pud) virt_to_page((void *)pud_page_vaddr(pud))
752#define pmd_bad(pmd) (0) 793#define pmd_bad(pmd) (0)
753#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0U) 794#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL)
754#define pud_none(pud) (!pud_val(pud)) 795#define pud_none(pud) (!pud_val(pud))
755#define pud_bad(pud) (0) 796#define pud_bad(pud) (0)
756#define pud_present(pud) (pud_val(pud) != 0U) 797#define pud_present(pud) (pud_val(pud) != 0U)
757#define pud_clear(pudp) (pud_val(*(pudp)) = 0U) 798#define pud_clear(pudp) (pud_val(*(pudp)) = 0UL)
758 799
759/* Same in both SUN4V and SUN4U. */ 800/* Same in both SUN4V and SUN4U. */
760#define pte_none(pte) (!pte_val(pte)) 801#define pte_none(pte) (!pte_val(pte))
@@ -789,7 +830,7 @@ static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
789 pmd_t *pmdp) 830 pmd_t *pmdp)
790{ 831{
791 pmd_t pmd = *pmdp; 832 pmd_t pmd = *pmdp;
792 set_pmd_at(mm, addr, pmdp, __pmd(0U)); 833 set_pmd_at(mm, addr, pmdp, __pmd(0UL));
793 return pmd; 834 return pmd;
794} 835}
795 836
@@ -837,8 +878,8 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
837}) 878})
838#endif 879#endif
839 880
840extern pgd_t swapper_pg_dir[2048]; 881extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
841extern pmd_t swapper_low_pmd_dir[2048]; 882extern pmd_t swapper_low_pmd_dir[PTRS_PER_PMD];
842 883
843extern void paging_init(void); 884extern void paging_init(void);
844extern unsigned long find_ecache_flush_span(unsigned long size); 885extern unsigned long find_ecache_flush_span(unsigned long size);
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index 67c62578d170..11ebd659e7b6 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -43,10 +43,6 @@ extern int of_getintprop_default(struct device_node *np,
43 const char *name, 43 const char *name,
44 int def); 44 int def);
45extern int of_find_in_proplist(const char *list, const char *match, int len); 45extern int of_find_in_proplist(const char *list, const char *match, int len);
46#ifdef CONFIG_NUMA
47extern int of_node_to_nid(struct device_node *dp);
48#define of_node_to_nid of_node_to_nid
49#endif
50 46
51extern void prom_build_devicetree(void); 47extern void prom_build_devicetree(void);
52extern void of_populate_present_mask(void); 48extern void of_populate_present_mask(void);
@@ -63,13 +59,5 @@ extern char *of_console_options;
63extern void irq_trans_init(struct device_node *dp); 59extern void irq_trans_init(struct device_node *dp);
64extern char *build_path_component(struct device_node *dp); 60extern char *build_path_component(struct device_node *dp);
65 61
66/* SPARC has local implementations */
67extern int of_address_to_resource(struct device_node *dev, int index,
68 struct resource *r);
69#define of_address_to_resource of_address_to_resource
70
71void __iomem *of_iomap(struct device_node *node, int index);
72#define of_iomap of_iomap
73
74#endif /* __KERNEL__ */ 62#endif /* __KERNEL__ */
75#endif /* _SPARC_PROM_H */ 63#endif /* _SPARC_PROM_H */
diff --git a/arch/sparc/include/asm/sparsemem.h b/arch/sparc/include/asm/sparsemem.h
index b99d4e4b6d28..e5e1752d5d78 100644
--- a/arch/sparc/include/asm/sparsemem.h
+++ b/arch/sparc/include/asm/sparsemem.h
@@ -3,9 +3,11 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <asm/page.h>
7
6#define SECTION_SIZE_BITS 30 8#define SECTION_SIZE_BITS 30
7#define MAX_PHYSADDR_BITS 42 9#define MAX_PHYSADDR_BITS MAX_PHYS_ADDRESS_BITS
8#define MAX_PHYSMEM_BITS 42 10#define MAX_PHYSMEM_BITS MAX_PHYS_ADDRESS_BITS
9 11
10#endif /* !(__KERNEL__) */ 12#endif /* !(__KERNEL__) */
11 13
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
index d5e504251079..5d9292ab1077 100644
--- a/arch/sparc/include/asm/thread_info_64.h
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -192,7 +192,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
192#define TIF_UNALIGNED 5 /* allowed to do unaligned accesses */ 192#define TIF_UNALIGNED 5 /* allowed to do unaligned accesses */
193/* flag bit 6 is available */ 193/* flag bit 6 is available */
194#define TIF_32BIT 7 /* 32-bit binary */ 194#define TIF_32BIT 7 /* 32-bit binary */
195/* flag bit 8 is available */ 195#define TIF_NOHZ 8 /* in adaptive nohz mode */
196#define TIF_SECCOMP 9 /* secure computing */ 196#define TIF_SECCOMP 9 /* secure computing */
197#define TIF_SYSCALL_AUDIT 10 /* syscall auditing active */ 197#define TIF_SYSCALL_AUDIT 10 /* syscall auditing active */
198#define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */ 198#define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */
@@ -210,6 +210,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
210#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 210#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
211#define _TIF_UNALIGNED (1<<TIF_UNALIGNED) 211#define _TIF_UNALIGNED (1<<TIF_UNALIGNED)
212#define _TIF_32BIT (1<<TIF_32BIT) 212#define _TIF_32BIT (1<<TIF_32BIT)
213#define _TIF_NOHZ (1<<TIF_NOHZ)
213#define _TIF_SECCOMP (1<<TIF_SECCOMP) 214#define _TIF_SECCOMP (1<<TIF_SECCOMP)
214#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 215#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
215#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) 216#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h
index e696432b950d..2230f80d9fe3 100644
--- a/arch/sparc/include/asm/tsb.h
+++ b/arch/sparc/include/asm/tsb.h
@@ -142,98 +142,39 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
142 or REG1, %lo(swapper_pg_dir), REG1; \ 142 or REG1, %lo(swapper_pg_dir), REG1; \
143 sllx VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \ 143 sllx VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \
144 srlx REG2, 64 - PAGE_SHIFT, REG2; \ 144 srlx REG2, 64 - PAGE_SHIFT, REG2; \
145 andn REG2, 0x3, REG2; \ 145 andn REG2, 0x7, REG2; \
146 lduw [REG1 + REG2], REG1; \ 146 ldx [REG1 + REG2], REG1; \
147 brz,pn REG1, FAIL_LABEL; \ 147 brz,pn REG1, FAIL_LABEL; \
148 sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \ 148 sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \
149 srlx REG2, 64 - PAGE_SHIFT, REG2; \ 149 srlx REG2, 64 - PAGE_SHIFT, REG2; \
150 sllx REG1, PGD_PADDR_SHIFT, REG1; \ 150 andn REG2, 0x7, REG2; \
151 andn REG2, 0x3, REG2; \ 151 ldxa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
152 lduwa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
153 brz,pn REG1, FAIL_LABEL; \ 152 brz,pn REG1, FAIL_LABEL; \
154 sllx VADDR, 64 - PMD_SHIFT, REG2; \ 153 sllx VADDR, 64 - PMD_SHIFT, REG2; \
155 srlx REG2, 64 - (PAGE_SHIFT - 1), REG2; \ 154 srlx REG2, 64 - PAGE_SHIFT, REG2; \
156 sllx REG1, PMD_PADDR_SHIFT, REG1; \
157 andn REG2, 0x7, REG2; \ 155 andn REG2, 0x7, REG2; \
158 add REG1, REG2, REG1; 156 add REG1, REG2, REG1;
159 157
160 /* These macros exists only to make the PMD translator below
161 * easier to read. It hides the ELF section switch for the
162 * sun4v code patching.
163 */
164#define OR_PTE_BIT_1INSN(REG, NAME) \
165661: or REG, _PAGE_##NAME##_4U, REG; \
166 .section .sun4v_1insn_patch, "ax"; \
167 .word 661b; \
168 or REG, _PAGE_##NAME##_4V, REG; \
169 .previous;
170
171#define OR_PTE_BIT_2INSN(REG, TMP, NAME) \
172661: sethi %hi(_PAGE_##NAME##_4U), TMP; \
173 or REG, TMP, REG; \
174 .section .sun4v_2insn_patch, "ax"; \
175 .word 661b; \
176 mov -1, TMP; \
177 or REG, _PAGE_##NAME##_4V, REG; \
178 .previous;
179
180 /* Load into REG the PTE value for VALID, CACHE, and SZHUGE. */
181#define BUILD_PTE_VALID_SZHUGE_CACHE(REG) \
182661: sethi %uhi(_PAGE_VALID|_PAGE_SZHUGE_4U), REG; \
183 .section .sun4v_1insn_patch, "ax"; \
184 .word 661b; \
185 sethi %uhi(_PAGE_VALID), REG; \
186 .previous; \
187 sllx REG, 32, REG; \
188661: or REG, _PAGE_CP_4U|_PAGE_CV_4U, REG; \
189 .section .sun4v_1insn_patch, "ax"; \
190 .word 661b; \
191 or REG, _PAGE_CP_4V|_PAGE_CV_4V|_PAGE_SZHUGE_4V, REG; \
192 .previous;
193
194 /* PMD has been loaded into REG1, interpret the value, seeing 158 /* PMD has been loaded into REG1, interpret the value, seeing
195 * if it is a HUGE PMD or a normal one. If it is not valid 159 * if it is a HUGE PMD or a normal one. If it is not valid
196 * then jump to FAIL_LABEL. If it is a HUGE PMD, and it 160 * then jump to FAIL_LABEL. If it is a HUGE PMD, and it
197 * translates to a valid PTE, branch to PTE_LABEL. 161 * translates to a valid PTE, branch to PTE_LABEL.
198 * 162 *
199 * We translate the PMD by hand, one bit at a time, 163 * We have to propagate the 4MB bit of the virtual address
200 * constructing the huge PTE. 164 * because we are fabricating 8MB pages using 4MB hw pages.
201 *
202 * So we construct the PTE in REG2 as follows:
203 *
204 * 1) Extract the PMD PFN from REG1 and place it into REG2.
205 *
206 * 2) Translate PMD protection bits in REG1 into REG2, one bit
207 * at a time using andcc tests on REG1 and OR's into REG2.
208 *
209 * Only two bits to be concerned with here, EXEC and WRITE.
210 * Now REG1 is freed up and we can use it as a temporary.
211 *
212 * 3) Construct the VALID, CACHE, and page size PTE bits in
213 * REG1, OR with REG2 to form final PTE.
214 */ 165 */
215#ifdef CONFIG_TRANSPARENT_HUGEPAGE 166#ifdef CONFIG_TRANSPARENT_HUGEPAGE
216#define USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, PTE_LABEL) \ 167#define USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, PTE_LABEL) \
217 brz,pn REG1, FAIL_LABEL; \ 168 brz,pn REG1, FAIL_LABEL; \
218 andcc REG1, PMD_ISHUGE, %g0; \ 169 sethi %uhi(_PAGE_PMD_HUGE), REG2; \
219 be,pt %xcc, 700f; \ 170 sllx REG2, 32, REG2; \
220 and REG1, PMD_HUGE_PRESENT|PMD_HUGE_ACCESSED, REG2; \ 171 andcc REG1, REG2, %g0; \
221 cmp REG2, PMD_HUGE_PRESENT|PMD_HUGE_ACCESSED; \ 172 be,pt %xcc, 700f; \
222 bne,pn %xcc, FAIL_LABEL; \ 173 sethi %hi(4 * 1024 * 1024), REG2; \
223 andn REG1, PMD_HUGE_PROTBITS, REG2; \ 174 andn REG1, REG2, REG1; \
224 sllx REG2, PMD_PADDR_SHIFT, REG2; \ 175 and VADDR, REG2, REG2; \
225 /* REG2 now holds PFN << PAGE_SHIFT */ \ 176 brlz,pt REG1, PTE_LABEL; \
226 andcc REG1, PMD_HUGE_WRITE, %g0; \ 177 or REG1, REG2, REG1; \
227 bne,a,pt %xcc, 1f; \
228 OR_PTE_BIT_1INSN(REG2, W); \
2291: andcc REG1, PMD_HUGE_EXEC, %g0; \
230 be,pt %xcc, 1f; \
231 nop; \
232 OR_PTE_BIT_2INSN(REG2, REG1, EXEC); \
233 /* REG1 can now be clobbered, build final PTE */ \
2341: BUILD_PTE_VALID_SZHUGE_CACHE(REG1); \
235 ba,pt %xcc, PTE_LABEL; \
236 or REG1, REG2, REG1; \
237700: 178700:
238#else 179#else
239#define USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, PTE_LABEL) \ 180#define USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, PTE_LABEL) \
@@ -253,18 +194,16 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
253#define USER_PGTABLE_WALK_TL1(VADDR, PHYS_PGD, REG1, REG2, FAIL_LABEL) \ 194#define USER_PGTABLE_WALK_TL1(VADDR, PHYS_PGD, REG1, REG2, FAIL_LABEL) \
254 sllx VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \ 195 sllx VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \
255 srlx REG2, 64 - PAGE_SHIFT, REG2; \ 196 srlx REG2, 64 - PAGE_SHIFT, REG2; \
256 andn REG2, 0x3, REG2; \ 197 andn REG2, 0x7, REG2; \
257 lduwa [PHYS_PGD + REG2] ASI_PHYS_USE_EC, REG1; \ 198 ldxa [PHYS_PGD + REG2] ASI_PHYS_USE_EC, REG1; \
258 brz,pn REG1, FAIL_LABEL; \ 199 brz,pn REG1, FAIL_LABEL; \
259 sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \ 200 sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \
260 srlx REG2, 64 - PAGE_SHIFT, REG2; \ 201 srlx REG2, 64 - PAGE_SHIFT, REG2; \
261 sllx REG1, PGD_PADDR_SHIFT, REG1; \ 202 andn REG2, 0x7, REG2; \
262 andn REG2, 0x3, REG2; \ 203 ldxa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
263 lduwa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
264 USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, 800f) \ 204 USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, 800f) \
265 sllx VADDR, 64 - PMD_SHIFT, REG2; \ 205 sllx VADDR, 64 - PMD_SHIFT, REG2; \
266 srlx REG2, 64 - (PAGE_SHIFT - 1), REG2; \ 206 srlx REG2, 64 - PAGE_SHIFT, REG2; \
267 sllx REG1, PMD_PADDR_SHIFT, REG1; \
268 andn REG2, 0x7, REG2; \ 207 andn REG2, 0x7, REG2; \
269 add REG1, REG2, REG1; \ 208 add REG1, REG2, REG1; \
270 ldxa [REG1] ASI_PHYS_USE_EC, REG1; \ 209 ldxa [REG1] ASI_PHYS_USE_EC, REG1; \
diff --git a/arch/sparc/include/uapi/asm/errno.h b/arch/sparc/include/uapi/asm/errno.h
index c351aba997b7..20423e172853 100644
--- a/arch/sparc/include/uapi/asm/errno.h
+++ b/arch/sparc/include/uapi/asm/errno.h
@@ -40,7 +40,7 @@
40#define EPROCLIM 67 /* SUNOS: Too many processes */ 40#define EPROCLIM 67 /* SUNOS: Too many processes */
41#define EUSERS 68 /* Too many users */ 41#define EUSERS 68 /* Too many users */
42#define EDQUOT 69 /* Quota exceeded */ 42#define EDQUOT 69 /* Quota exceeded */
43#define ESTALE 70 /* Stale NFS file handle */ 43#define ESTALE 70 /* Stale file handle */
44#define EREMOTE 71 /* Object is remote */ 44#define EREMOTE 71 /* Object is remote */
45#define ENOSTR 72 /* Device not a stream */ 45#define ENOSTR 72 /* Device not a stream */
46#define ETIME 73 /* Timer expired */ 46#define ETIME 73 /* Timer expired */
diff --git a/arch/sparc/include/uapi/asm/socket.h b/arch/sparc/include/uapi/asm/socket.h
index 4e1d66c3ce71..0f21e9a5ca18 100644
--- a/arch/sparc/include/uapi/asm/socket.h
+++ b/arch/sparc/include/uapi/asm/socket.h
@@ -72,6 +72,8 @@
72 72
73#define SO_BUSY_POLL 0x0030 73#define SO_BUSY_POLL 0x0030
74 74
75#define SO_MAX_PACING_RATE 0x0031
76
75/* Security levels - as per NRL IPv6 - don't actually do anything */ 77/* Security levels - as per NRL IPv6 - don't actually do anything */
76#define SO_SECURITY_AUTHENTICATION 0x5001 78#define SO_SECURITY_AUTHENTICATION 0x5001
77#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 79#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index d432fb20358e..d15cc1794b0e 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -1,3 +1,4 @@
1
1# 2#
2# Makefile for the linux kernel. 3# Makefile for the linux kernel.
3# 4#
@@ -99,7 +100,7 @@ obj-$(CONFIG_STACKTRACE) += stacktrace.o
99obj-$(CONFIG_SPARC64_PCI) += pci.o pci_common.o psycho_common.o 100obj-$(CONFIG_SPARC64_PCI) += pci.o pci_common.o psycho_common.o
100obj-$(CONFIG_SPARC64_PCI) += pci_psycho.o pci_sabre.o pci_schizo.o 101obj-$(CONFIG_SPARC64_PCI) += pci_psycho.o pci_sabre.o pci_schizo.o
101obj-$(CONFIG_SPARC64_PCI) += pci_sun4v.o pci_sun4v_asm.o pci_fire.o 102obj-$(CONFIG_SPARC64_PCI) += pci_sun4v.o pci_sun4v_asm.o pci_fire.o
102obj-$(CONFIG_PCI_MSI) += pci_msi.o 103obj-$(CONFIG_SPARC64_PCI_MSI) += pci_msi.o
103 104
104obj-$(CONFIG_COMPAT) += sys32.o sys_sparc32.o signal32.o 105obj-$(CONFIG_COMPAT) += sys32.o sys_sparc32.o signal32.o
105 106
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index 62d6b153ffa2..dff60abbea01 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -849,9 +849,8 @@ void ldom_reboot(const char *boot_command)
849 if (boot_command && strlen(boot_command)) { 849 if (boot_command && strlen(boot_command)) {
850 unsigned long len; 850 unsigned long len;
851 851
852 strcpy(full_boot_str, "boot "); 852 snprintf(full_boot_str, sizeof(full_boot_str), "boot %s",
853 strlcpy(full_boot_str + strlen("boot "), boot_command, 853 boot_command);
854 sizeof(full_boot_str + strlen("boot ")));
855 len = strlen(full_boot_str); 854 len = strlen(full_boot_str);
856 855
857 if (reboot_data_supported) { 856 if (reboot_data_supported) {
diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h
index 9c179fbfb219..140966fbd303 100644
--- a/arch/sparc/kernel/entry.h
+++ b/arch/sparc/kernel/entry.h
@@ -88,7 +88,6 @@ extern asmlinkage void syscall_trace_leave(struct pt_regs *regs);
88 88
89extern void bad_trap_tl1(struct pt_regs *regs, long lvl); 89extern void bad_trap_tl1(struct pt_regs *regs, long lvl);
90 90
91extern void do_fpe_common(struct pt_regs *regs);
92extern void do_fpieee(struct pt_regs *regs); 91extern void do_fpieee(struct pt_regs *regs);
93extern void do_fpother(struct pt_regs *regs); 92extern void do_fpother(struct pt_regs *regs);
94extern void do_tof(struct pt_regs *regs); 93extern void do_tof(struct pt_regs *regs);
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c
index d4840cec2c55..666193f4e8bb 100644
--- a/arch/sparc/kernel/irq_64.c
+++ b/arch/sparc/kernel/irq_64.c
@@ -698,30 +698,19 @@ void __irq_entry handler_irq(int pil, struct pt_regs *regs)
698 set_irq_regs(old_regs); 698 set_irq_regs(old_regs);
699} 699}
700 700
701void do_softirq(void) 701void do_softirq_own_stack(void)
702{ 702{
703 unsigned long flags; 703 void *orig_sp, *sp = softirq_stack[smp_processor_id()];
704
705 if (in_interrupt())
706 return;
707
708 local_irq_save(flags);
709 704
710 if (local_softirq_pending()) { 705 sp += THREAD_SIZE - 192 - STACK_BIAS;
711 void *orig_sp, *sp = softirq_stack[smp_processor_id()];
712
713 sp += THREAD_SIZE - 192 - STACK_BIAS;
714
715 __asm__ __volatile__("mov %%sp, %0\n\t"
716 "mov %1, %%sp"
717 : "=&r" (orig_sp)
718 : "r" (sp));
719 __do_softirq();
720 __asm__ __volatile__("mov %0, %%sp"
721 : : "r" (orig_sp));
722 }
723 706
724 local_irq_restore(flags); 707 __asm__ __volatile__("mov %%sp, %0\n\t"
708 "mov %1, %%sp"
709 : "=&r" (orig_sp)
710 : "r" (sp));
711 __do_softirq();
712 __asm__ __volatile__("mov %0, %%sp"
713 : : "r" (orig_sp));
725} 714}
726 715
727#ifdef CONFIG_HOTPLUG_CPU 716#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/sparc/kernel/kgdb_64.c b/arch/sparc/kernel/kgdb_64.c
index 53c0a82e6030..60b19f50c80a 100644
--- a/arch/sparc/kernel/kgdb_64.c
+++ b/arch/sparc/kernel/kgdb_64.c
@@ -159,11 +159,12 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
159 159
160asmlinkage void kgdb_trap(unsigned long trap_level, struct pt_regs *regs) 160asmlinkage void kgdb_trap(unsigned long trap_level, struct pt_regs *regs)
161{ 161{
162 enum ctx_state prev_state = exception_enter();
162 unsigned long flags; 163 unsigned long flags;
163 164
164 if (user_mode(regs)) { 165 if (user_mode(regs)) {
165 bad_trap(regs, trap_level); 166 bad_trap(regs, trap_level);
166 return; 167 goto out;
167 } 168 }
168 169
169 flushw_all(); 170 flushw_all();
@@ -171,6 +172,8 @@ asmlinkage void kgdb_trap(unsigned long trap_level, struct pt_regs *regs)
171 local_irq_save(flags); 172 local_irq_save(flags);
172 kgdb_handle_exception(0x172, SIGTRAP, 0, regs); 173 kgdb_handle_exception(0x172, SIGTRAP, 0, regs);
173 local_irq_restore(flags); 174 local_irq_restore(flags);
175out:
176 exception_exit(prev_state);
174} 177}
175 178
176int kgdb_arch_init(void) 179int kgdb_arch_init(void)
diff --git a/arch/sparc/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c
index e72212148d2a..5a09fd315e5f 100644
--- a/arch/sparc/kernel/kprobes.c
+++ b/arch/sparc/kernel/kprobes.c
@@ -8,6 +8,7 @@
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/kdebug.h> 9#include <linux/kdebug.h>
10#include <linux/slab.h> 10#include <linux/slab.h>
11#include <linux/context_tracking.h>
11#include <asm/signal.h> 12#include <asm/signal.h>
12#include <asm/cacheflush.h> 13#include <asm/cacheflush.h>
13#include <asm/uaccess.h> 14#include <asm/uaccess.h>
@@ -418,12 +419,14 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
418asmlinkage void __kprobes kprobe_trap(unsigned long trap_level, 419asmlinkage void __kprobes kprobe_trap(unsigned long trap_level,
419 struct pt_regs *regs) 420 struct pt_regs *regs)
420{ 421{
422 enum ctx_state prev_state = exception_enter();
423
421 BUG_ON(trap_level != 0x170 && trap_level != 0x171); 424 BUG_ON(trap_level != 0x170 && trap_level != 0x171);
422 425
423 if (user_mode(regs)) { 426 if (user_mode(regs)) {
424 local_irq_enable(); 427 local_irq_enable();
425 bad_trap(regs, trap_level); 428 bad_trap(regs, trap_level);
426 return; 429 goto out;
427 } 430 }
428 431
429 /* trap_level == 0x170 --> ta 0x70 432 /* trap_level == 0x170 --> ta 0x70
@@ -433,6 +436,8 @@ asmlinkage void __kprobes kprobe_trap(unsigned long trap_level,
433 (trap_level == 0x170) ? "debug" : "debug_2", 436 (trap_level == 0x170) ? "debug" : "debug_2",
434 regs, 0, trap_level, SIGTRAP) != NOTIFY_STOP) 437 regs, 0, trap_level, SIGTRAP) != NOTIFY_STOP)
435 bad_trap(regs, trap_level); 438 bad_trap(regs, trap_level);
439out:
440 exception_exit(prev_state);
436} 441}
437 442
438/* Jprobes support. */ 443/* Jprobes support. */
diff --git a/arch/sparc/kernel/ktlb.S b/arch/sparc/kernel/ktlb.S
index fde5a419cf27..542e96ac4d39 100644
--- a/arch/sparc/kernel/ktlb.S
+++ b/arch/sparc/kernel/ktlb.S
@@ -153,12 +153,19 @@ kvmap_dtlb_tsb4m_miss:
153 /* Clear the PAGE_OFFSET top virtual bits, shift 153 /* Clear the PAGE_OFFSET top virtual bits, shift
154 * down to get PFN, and make sure PFN is in range. 154 * down to get PFN, and make sure PFN is in range.
155 */ 155 */
156 sllx %g4, 21, %g5 156661: sllx %g4, 0, %g5
157 .section .page_offset_shift_patch, "ax"
158 .word 661b
159 .previous
157 160
158 /* Check to see if we know about valid memory at the 4MB 161 /* Check to see if we know about valid memory at the 4MB
159 * chunk this physical address will reside within. 162 * chunk this physical address will reside within.
160 */ 163 */
161 srlx %g5, 21 + 41, %g2 164661: srlx %g5, MAX_PHYS_ADDRESS_BITS, %g2
165 .section .page_offset_shift_patch, "ax"
166 .word 661b
167 .previous
168
162 brnz,pn %g2, kvmap_dtlb_longpath 169 brnz,pn %g2, kvmap_dtlb_longpath
163 nop 170 nop
164 171
@@ -176,7 +183,11 @@ valid_addr_bitmap_patch:
176 or %g7, %lo(sparc64_valid_addr_bitmap), %g7 183 or %g7, %lo(sparc64_valid_addr_bitmap), %g7
177 .previous 184 .previous
178 185
179 srlx %g5, 21 + 22, %g2 186661: srlx %g5, ILOG2_4MB, %g2
187 .section .page_offset_shift_patch, "ax"
188 .word 661b
189 .previous
190
180 srlx %g2, 6, %g5 191 srlx %g2, 6, %g5
181 and %g2, 63, %g2 192 and %g2, 63, %g2
182 sllx %g5, 3, %g5 193 sllx %g5, 3, %g5
@@ -189,9 +200,18 @@ valid_addr_bitmap_patch:
1892: sethi %hi(kpte_linear_bitmap), %g2 2002: sethi %hi(kpte_linear_bitmap), %g2
190 201
191 /* Get the 256MB physical address index. */ 202 /* Get the 256MB physical address index. */
192 sllx %g4, 21, %g5 203661: sllx %g4, 0, %g5
204 .section .page_offset_shift_patch, "ax"
205 .word 661b
206 .previous
207
193 or %g2, %lo(kpte_linear_bitmap), %g2 208 or %g2, %lo(kpte_linear_bitmap), %g2
194 srlx %g5, 21 + 28, %g5 209
210661: srlx %g5, ILOG2_256MB, %g5
211 .section .page_offset_shift_patch, "ax"
212 .word 661b
213 .previous
214
195 and %g5, (32 - 1), %g7 215 and %g5, (32 - 1), %g7
196 216
197 /* Divide by 32 to get the offset into the bitmask. */ 217 /* Divide by 32 to get the offset into the bitmask. */
diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c
index 54df554b82d9..e01d75d40329 100644
--- a/arch/sparc/kernel/ldc.c
+++ b/arch/sparc/kernel/ldc.c
@@ -1249,12 +1249,12 @@ int ldc_bind(struct ldc_channel *lp, const char *name)
1249 snprintf(lp->rx_irq_name, LDC_IRQ_NAME_MAX, "%s RX", name); 1249 snprintf(lp->rx_irq_name, LDC_IRQ_NAME_MAX, "%s RX", name);
1250 snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name); 1250 snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name);
1251 1251
1252 err = request_irq(lp->cfg.rx_irq, ldc_rx, IRQF_DISABLED, 1252 err = request_irq(lp->cfg.rx_irq, ldc_rx, 0,
1253 lp->rx_irq_name, lp); 1253 lp->rx_irq_name, lp);
1254 if (err) 1254 if (err)
1255 return err; 1255 return err;
1256 1256
1257 err = request_irq(lp->cfg.tx_irq, ldc_tx, IRQF_DISABLED, 1257 err = request_irq(lp->cfg.tx_irq, ldc_tx, 0,
1258 lp->tx_irq_name, lp); 1258 lp->tx_irq_name, lp);
1259 if (err) { 1259 if (err) {
1260 free_irq(lp->cfg.rx_irq, lp); 1260 free_irq(lp->cfg.rx_irq, lp);
diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
index 4435488ebe25..97655e0fd243 100644
--- a/arch/sparc/kernel/module.c
+++ b/arch/sparc/kernel/module.c
@@ -29,7 +29,7 @@ static void *module_map(unsigned long size)
29 if (PAGE_ALIGN(size) > MODULES_LEN) 29 if (PAGE_ALIGN(size) > MODULES_LEN)
30 return NULL; 30 return NULL;
31 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, 31 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
32 GFP_KERNEL, PAGE_KERNEL, -1, 32 GFP_KERNEL, PAGE_KERNEL, NUMA_NO_NODE,
33 __builtin_return_address(0)); 33 __builtin_return_address(0));
34} 34}
35#else 35#else
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index bc4d3f5d2e5d..cb021453de2a 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -398,8 +398,8 @@ static void apb_fake_ranges(struct pci_dev *dev,
398 apb_calc_first_last(map, &first, &last); 398 apb_calc_first_last(map, &first, &last);
399 res = bus->resource[1]; 399 res = bus->resource[1];
400 res->flags = IORESOURCE_MEM; 400 res->flags = IORESOURCE_MEM;
401 region.start = (first << 21); 401 region.start = (first << 29);
402 region.end = (last << 21) + ((1 << 21) - 1); 402 region.end = (last << 29) + ((1 << 29) - 1);
403 pcibios_bus_to_resource(dev, res, &region); 403 pcibios_bus_to_resource(dev, res, &region);
404} 404}
405 405
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index baebab215492..32a280ec38c1 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -31,6 +31,7 @@
31#include <linux/elfcore.h> 31#include <linux/elfcore.h>
32#include <linux/sysrq.h> 32#include <linux/sysrq.h>
33#include <linux/nmi.h> 33#include <linux/nmi.h>
34#include <linux/context_tracking.h>
34 35
35#include <asm/uaccess.h> 36#include <asm/uaccess.h>
36#include <asm/page.h> 37#include <asm/page.h>
@@ -557,6 +558,7 @@ void fault_in_user_windows(void)
557 558
558barf: 559barf:
559 set_thread_wsaved(window + 1); 560 set_thread_wsaved(window + 1);
561 user_exit();
560 do_exit(SIGILL); 562 do_exit(SIGILL);
561} 563}
562 564
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index d397d7fc5c28..6b39125eb927 100644
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -373,6 +373,59 @@ static const char *get_mid_prop(void)
373 return (tlb_type == spitfire ? "upa-portid" : "portid"); 373 return (tlb_type == spitfire ? "upa-portid" : "portid");
374} 374}
375 375
376bool arch_find_n_match_cpu_physical_id(struct device_node *cpun,
377 int cpu, unsigned int *thread)
378{
379 const char *mid_prop = get_mid_prop();
380 int this_cpu_id;
381
382 /* On hypervisor based platforms we interrogate the 'reg'
383 * property. On everything else we look for a 'upa-portis',
384 * 'portid', or 'cpuid' property.
385 */
386
387 if (tlb_type == hypervisor) {
388 struct property *prop = of_find_property(cpun, "reg", NULL);
389 u32 *regs;
390
391 if (!prop) {
392 pr_warn("CPU node missing reg property\n");
393 return false;
394 }
395 regs = prop->value;
396 this_cpu_id = regs[0] & 0x0fffffff;
397 } else {
398 this_cpu_id = of_getintprop_default(cpun, mid_prop, -1);
399
400 if (this_cpu_id < 0) {
401 mid_prop = "cpuid";
402 this_cpu_id = of_getintprop_default(cpun, mid_prop, -1);
403 }
404 if (this_cpu_id < 0) {
405 pr_warn("CPU node missing cpu ID property\n");
406 return false;
407 }
408 }
409 if (this_cpu_id == cpu) {
410 if (thread) {
411 int proc_id = cpu_data(cpu).proc_id;
412
413 /* On sparc64, the cpu thread information is obtained
414 * either from OBP or the machine description. We've
415 * actually probed this information already long before
416 * this interface gets called so instead of interrogating
417 * both the OF node and the MDESC again, just use what
418 * we discovered already.
419 */
420 if (proc_id < 0)
421 proc_id = 0;
422 *thread = proc_id;
423 }
424 return true;
425 }
426 return false;
427}
428
376static void *of_iterate_over_cpus(void *(*func)(struct device_node *, int, int), int arg) 429static void *of_iterate_over_cpus(void *(*func)(struct device_node *, int, int), int arg)
377{ 430{
378 struct device_node *dp; 431 struct device_node *dp;
diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
index 773c1f2983ce..c13c9f25d83a 100644
--- a/arch/sparc/kernel/ptrace_64.c
+++ b/arch/sparc/kernel/ptrace_64.c
@@ -27,6 +27,7 @@
27#include <trace/syscall.h> 27#include <trace/syscall.h>
28#include <linux/compat.h> 28#include <linux/compat.h>
29#include <linux/elf.h> 29#include <linux/elf.h>
30#include <linux/context_tracking.h>
30 31
31#include <asm/asi.h> 32#include <asm/asi.h>
32#include <asm/pgtable.h> 33#include <asm/pgtable.h>
@@ -1066,6 +1067,9 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
1066 /* do the secure computing check first */ 1067 /* do the secure computing check first */
1067 secure_computing_strict(regs->u_regs[UREG_G1]); 1068 secure_computing_strict(regs->u_regs[UREG_G1]);
1068 1069
1070 if (test_thread_flag(TIF_NOHZ))
1071 user_exit();
1072
1069 if (test_thread_flag(TIF_SYSCALL_TRACE)) 1073 if (test_thread_flag(TIF_SYSCALL_TRACE))
1070 ret = tracehook_report_syscall_entry(regs); 1074 ret = tracehook_report_syscall_entry(regs);
1071 1075
@@ -1086,6 +1090,9 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
1086 1090
1087asmlinkage void syscall_trace_leave(struct pt_regs *regs) 1091asmlinkage void syscall_trace_leave(struct pt_regs *regs)
1088{ 1092{
1093 if (test_thread_flag(TIF_NOHZ))
1094 user_exit();
1095
1089 audit_syscall_exit(regs); 1096 audit_syscall_exit(regs);
1090 1097
1091 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 1098 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
@@ -1093,4 +1100,7 @@ asmlinkage void syscall_trace_leave(struct pt_regs *regs)
1093 1100
1094 if (test_thread_flag(TIF_SYSCALL_TRACE)) 1101 if (test_thread_flag(TIF_SYSCALL_TRACE))
1095 tracehook_report_syscall_exit(regs, 0); 1102 tracehook_report_syscall_exit(regs, 0);
1103
1104 if (test_thread_flag(TIF_NOHZ))
1105 user_enter();
1096} 1106}
diff --git a/arch/sparc/kernel/rtrap_64.S b/arch/sparc/kernel/rtrap_64.S
index afa2a9e3d0a0..a954eb81881b 100644
--- a/arch/sparc/kernel/rtrap_64.S
+++ b/arch/sparc/kernel/rtrap_64.S
@@ -18,10 +18,16 @@
18#define RTRAP_PSTATE_IRQOFF (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV) 18#define RTRAP_PSTATE_IRQOFF (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV)
19#define RTRAP_PSTATE_AG_IRQOFF (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV|PSTATE_AG) 19#define RTRAP_PSTATE_AG_IRQOFF (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV|PSTATE_AG)
20 20
21#ifdef CONFIG_CONTEXT_TRACKING
22# define SCHEDULE_USER schedule_user
23#else
24# define SCHEDULE_USER schedule
25#endif
26
21 .text 27 .text
22 .align 32 28 .align 32
23__handle_preemption: 29__handle_preemption:
24 call schedule 30 call SCHEDULE_USER
25 wrpr %g0, RTRAP_PSTATE, %pstate 31 wrpr %g0, RTRAP_PSTATE, %pstate
26 ba,pt %xcc, __handle_preemption_continue 32 ba,pt %xcc, __handle_preemption_continue
27 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate 33 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index b524f91dd0e5..ee789d2ef05d 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -68,7 +68,7 @@ struct rt_signal_frame32 {
68 /* __siginfo_rwin_t * */u32 rwin_save; 68 /* __siginfo_rwin_t * */u32 rwin_save;
69} __attribute__((aligned(8))); 69} __attribute__((aligned(8)));
70 70
71int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) 71int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
72{ 72{
73 int err; 73 int err;
74 74
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index 35923e8abd82..cd91d010e6d3 100644
--- a/arch/sparc/kernel/signal_64.c
+++ b/arch/sparc/kernel/signal_64.c
@@ -23,6 +23,7 @@
23#include <linux/tty.h> 23#include <linux/tty.h>
24#include <linux/binfmts.h> 24#include <linux/binfmts.h>
25#include <linux/bitops.h> 25#include <linux/bitops.h>
26#include <linux/context_tracking.h>
26 27
27#include <asm/uaccess.h> 28#include <asm/uaccess.h>
28#include <asm/ptrace.h> 29#include <asm/ptrace.h>
@@ -43,6 +44,7 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs)
43{ 44{
44 struct ucontext __user *ucp = (struct ucontext __user *) 45 struct ucontext __user *ucp = (struct ucontext __user *)
45 regs->u_regs[UREG_I0]; 46 regs->u_regs[UREG_I0];
47 enum ctx_state prev_state = exception_enter();
46 mc_gregset_t __user *grp; 48 mc_gregset_t __user *grp;
47 unsigned long pc, npc, tstate; 49 unsigned long pc, npc, tstate;
48 unsigned long fp, i7; 50 unsigned long fp, i7;
@@ -129,16 +131,19 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs)
129 } 131 }
130 if (err) 132 if (err)
131 goto do_sigsegv; 133 goto do_sigsegv;
132 134out:
135 exception_exit(prev_state);
133 return; 136 return;
134do_sigsegv: 137do_sigsegv:
135 force_sig(SIGSEGV, current); 138 force_sig(SIGSEGV, current);
139 goto out;
136} 140}
137 141
138asmlinkage void sparc64_get_context(struct pt_regs *regs) 142asmlinkage void sparc64_get_context(struct pt_regs *regs)
139{ 143{
140 struct ucontext __user *ucp = (struct ucontext __user *) 144 struct ucontext __user *ucp = (struct ucontext __user *)
141 regs->u_regs[UREG_I0]; 145 regs->u_regs[UREG_I0];
146 enum ctx_state prev_state = exception_enter();
142 mc_gregset_t __user *grp; 147 mc_gregset_t __user *grp;
143 mcontext_t __user *mcp; 148 mcontext_t __user *mcp;
144 unsigned long fp, i7; 149 unsigned long fp, i7;
@@ -220,10 +225,12 @@ asmlinkage void sparc64_get_context(struct pt_regs *regs)
220 } 225 }
221 if (err) 226 if (err)
222 goto do_sigsegv; 227 goto do_sigsegv;
223 228out:
229 exception_exit(prev_state);
224 return; 230 return;
225do_sigsegv: 231do_sigsegv:
226 force_sig(SIGSEGV, current); 232 force_sig(SIGSEGV, current);
233 goto out;
227} 234}
228 235
229struct rt_signal_frame { 236struct rt_signal_frame {
@@ -528,11 +535,13 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
528 535
529void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long thread_info_flags) 536void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long thread_info_flags)
530{ 537{
538 user_exit();
531 if (thread_info_flags & _TIF_SIGPENDING) 539 if (thread_info_flags & _TIF_SIGPENDING)
532 do_signal(regs, orig_i0); 540 do_signal(regs, orig_i0);
533 if (thread_info_flags & _TIF_NOTIFY_RESUME) { 541 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
534 clear_thread_flag(TIF_NOTIFY_RESUME); 542 clear_thread_flag(TIF_NOTIFY_RESUME);
535 tracehook_notify_resume(regs); 543 tracehook_notify_resume(regs);
536 } 544 }
545 user_enter();
537} 546}
538 547
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index e142545244f2..b66a5338231e 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -1399,8 +1399,13 @@ void __init smp_cpus_done(unsigned int max_cpus)
1399 1399
1400void smp_send_reschedule(int cpu) 1400void smp_send_reschedule(int cpu)
1401{ 1401{
1402 xcall_deliver((u64) &xcall_receive_signal, 0, 0, 1402 if (cpu == smp_processor_id()) {
1403 cpumask_of(cpu)); 1403 WARN_ON_ONCE(preemptible());
1404 set_softint(1 << PIL_SMP_RECEIVE_SIGNAL);
1405 } else {
1406 xcall_deliver((u64) &xcall_receive_signal,
1407 0, 0, cpumask_of(cpu));
1408 }
1404} 1409}
1405 1410
1406void __irq_entry smp_receive_signal_client(int irq, struct pt_regs *regs) 1411void __irq_entry smp_receive_signal_client(int irq, struct pt_regs *regs)
diff --git a/arch/sparc/kernel/sun4v_tlb_miss.S b/arch/sparc/kernel/sun4v_tlb_miss.S
index bde867fd71e8..e0c09bf85610 100644
--- a/arch/sparc/kernel/sun4v_tlb_miss.S
+++ b/arch/sparc/kernel/sun4v_tlb_miss.S
@@ -182,7 +182,7 @@ sun4v_tsb_miss_common:
182 cmp %g5, -1 182 cmp %g5, -1
183 be,pt %xcc, 80f 183 be,pt %xcc, 80f
184 nop 184 nop
185 COMPUTE_TSB_PTR(%g5, %g4, HPAGE_SHIFT, %g2, %g7) 185 COMPUTE_TSB_PTR(%g5, %g4, REAL_HPAGE_SHIFT, %g2, %g7)
186 186
187 /* That clobbered %g2, reload it. */ 187 /* That clobbered %g2, reload it. */
188 ldxa [%g0] ASI_SCRATCHPAD, %g2 188 ldxa [%g0] ASI_SCRATCHPAD, %g2
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index 51561b8b15ba..beb0b5a5f21f 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -24,6 +24,7 @@
24#include <linux/personality.h> 24#include <linux/personality.h>
25#include <linux/random.h> 25#include <linux/random.h>
26#include <linux/export.h> 26#include <linux/export.h>
27#include <linux/context_tracking.h>
27 28
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29#include <asm/utrap.h> 30#include <asm/utrap.h>
@@ -39,9 +40,6 @@ asmlinkage unsigned long sys_getpagesize(void)
39 return PAGE_SIZE; 40 return PAGE_SIZE;
40} 41}
41 42
42#define VA_EXCLUDE_START (0x0000080000000000UL - (1UL << 32UL))
43#define VA_EXCLUDE_END (0xfffff80000000000UL + (1UL << 32UL))
44
45/* Does addr --> addr+len fall within 4GB of the VA-space hole or 43/* Does addr --> addr+len fall within 4GB of the VA-space hole or
46 * overflow past the end of the 64-bit address space? 44 * overflow past the end of the 64-bit address space?
47 */ 45 */
@@ -499,6 +497,7 @@ asmlinkage unsigned long c_sys_nis_syscall(struct pt_regs *regs)
499 497
500asmlinkage void sparc_breakpoint(struct pt_regs *regs) 498asmlinkage void sparc_breakpoint(struct pt_regs *regs)
501{ 499{
500 enum ctx_state prev_state = exception_enter();
502 siginfo_t info; 501 siginfo_t info;
503 502
504 if (test_thread_flag(TIF_32BIT)) { 503 if (test_thread_flag(TIF_32BIT)) {
@@ -517,6 +516,7 @@ asmlinkage void sparc_breakpoint(struct pt_regs *regs)
517#ifdef DEBUG_SPARC_BREAKPOINT 516#ifdef DEBUG_SPARC_BREAKPOINT
518 printk ("TRAP: Returning to space: PC=%lx nPC=%lx\n", regs->tpc, regs->tnpc); 517 printk ("TRAP: Returning to space: PC=%lx nPC=%lx\n", regs->tpc, regs->tnpc);
519#endif 518#endif
519 exception_exit(prev_state);
520} 520}
521 521
522extern void check_pending(int signum); 522extern void check_pending(int signum);
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
index d950197a17e1..87729fff13b9 100644
--- a/arch/sparc/kernel/syscalls.S
+++ b/arch/sparc/kernel/syscalls.S
@@ -52,7 +52,7 @@ sys32_rt_sigreturn:
52#endif 52#endif
53 .align 32 53 .align 32
541: ldx [%g6 + TI_FLAGS], %l5 541: ldx [%g6 + TI_FLAGS], %l5
55 andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0 55 andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT|_TIF_NOHZ), %g0
56 be,pt %icc, rtrap 56 be,pt %icc, rtrap
57 nop 57 nop
58 call syscall_trace_leave 58 call syscall_trace_leave
@@ -184,7 +184,7 @@ linux_sparc_syscall32:
184 184
185 srl %i3, 0, %o3 ! IEU0 185 srl %i3, 0, %o3 ! IEU0
186 srl %i2, 0, %o2 ! IEU0 Group 186 srl %i2, 0, %o2 ! IEU0 Group
187 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0 187 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT|_TIF_NOHZ), %g0
188 bne,pn %icc, linux_syscall_trace32 ! CTI 188 bne,pn %icc, linux_syscall_trace32 ! CTI
189 mov %i0, %l5 ! IEU1 189 mov %i0, %l5 ! IEU1
1905: call %l7 ! CTI Group brk forced 1905: call %l7 ! CTI Group brk forced
@@ -207,7 +207,7 @@ linux_sparc_syscall:
207 207
208 mov %i3, %o3 ! IEU1 208 mov %i3, %o3 ! IEU1
209 mov %i4, %o4 ! IEU0 Group 209 mov %i4, %o4 ! IEU0 Group
210 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0 210 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT|_TIF_NOHZ), %g0
211 bne,pn %icc, linux_syscall_trace ! CTI Group 211 bne,pn %icc, linux_syscall_trace ! CTI Group
212 mov %i0, %l5 ! IEU0 212 mov %i0, %l5 ! IEU0
2132: call %l7 ! CTI Group brk forced 2132: call %l7 ! CTI Group brk forced
@@ -223,7 +223,7 @@ ret_sys_call:
223 223
224 cmp %o0, -ERESTART_RESTARTBLOCK 224 cmp %o0, -ERESTART_RESTARTBLOCK
225 bgeu,pn %xcc, 1f 225 bgeu,pn %xcc, 1f
226 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0 226 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT|_TIF_NOHZ), %g0
227 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc 227 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
228 228
2292: 2292:
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index b3f833ab90eb..4ced92f05358 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -20,6 +20,7 @@
20#include <linux/ftrace.h> 20#include <linux/ftrace.h>
21#include <linux/reboot.h> 21#include <linux/reboot.h>
22#include <linux/gfp.h> 22#include <linux/gfp.h>
23#include <linux/context_tracking.h>
23 24
24#include <asm/smp.h> 25#include <asm/smp.h>
25#include <asm/delay.h> 26#include <asm/delay.h>
@@ -186,11 +187,12 @@ EXPORT_SYMBOL_GPL(unregister_dimm_printer);
186 187
187void spitfire_insn_access_exception(struct pt_regs *regs, unsigned long sfsr, unsigned long sfar) 188void spitfire_insn_access_exception(struct pt_regs *regs, unsigned long sfsr, unsigned long sfar)
188{ 189{
190 enum ctx_state prev_state = exception_enter();
189 siginfo_t info; 191 siginfo_t info;
190 192
191 if (notify_die(DIE_TRAP, "instruction access exception", regs, 193 if (notify_die(DIE_TRAP, "instruction access exception", regs,
192 0, 0x8, SIGTRAP) == NOTIFY_STOP) 194 0, 0x8, SIGTRAP) == NOTIFY_STOP)
193 return; 195 goto out;
194 196
195 if (regs->tstate & TSTATE_PRIV) { 197 if (regs->tstate & TSTATE_PRIV) {
196 printk("spitfire_insn_access_exception: SFSR[%016lx] " 198 printk("spitfire_insn_access_exception: SFSR[%016lx] "
@@ -207,6 +209,8 @@ void spitfire_insn_access_exception(struct pt_regs *regs, unsigned long sfsr, un
207 info.si_addr = (void __user *)regs->tpc; 209 info.si_addr = (void __user *)regs->tpc;
208 info.si_trapno = 0; 210 info.si_trapno = 0;
209 force_sig_info(SIGSEGV, &info, current); 211 force_sig_info(SIGSEGV, &info, current);
212out:
213 exception_exit(prev_state);
210} 214}
211 215
212void spitfire_insn_access_exception_tl1(struct pt_regs *regs, unsigned long sfsr, unsigned long sfar) 216void spitfire_insn_access_exception_tl1(struct pt_regs *regs, unsigned long sfsr, unsigned long sfar)
@@ -260,11 +264,12 @@ void sun4v_insn_access_exception_tl1(struct pt_regs *regs, unsigned long addr, u
260 264
261void spitfire_data_access_exception(struct pt_regs *regs, unsigned long sfsr, unsigned long sfar) 265void spitfire_data_access_exception(struct pt_regs *regs, unsigned long sfsr, unsigned long sfar)
262{ 266{
267 enum ctx_state prev_state = exception_enter();
263 siginfo_t info; 268 siginfo_t info;
264 269
265 if (notify_die(DIE_TRAP, "data access exception", regs, 270 if (notify_die(DIE_TRAP, "data access exception", regs,
266 0, 0x30, SIGTRAP) == NOTIFY_STOP) 271 0, 0x30, SIGTRAP) == NOTIFY_STOP)
267 return; 272 goto out;
268 273
269 if (regs->tstate & TSTATE_PRIV) { 274 if (regs->tstate & TSTATE_PRIV) {
270 /* Test if this comes from uaccess places. */ 275 /* Test if this comes from uaccess places. */
@@ -280,7 +285,7 @@ void spitfire_data_access_exception(struct pt_regs *regs, unsigned long sfsr, un
280#endif 285#endif
281 regs->tpc = entry->fixup; 286 regs->tpc = entry->fixup;
282 regs->tnpc = regs->tpc + 4; 287 regs->tnpc = regs->tpc + 4;
283 return; 288 goto out;
284 } 289 }
285 /* Shit... */ 290 /* Shit... */
286 printk("spitfire_data_access_exception: SFSR[%016lx] " 291 printk("spitfire_data_access_exception: SFSR[%016lx] "
@@ -294,6 +299,8 @@ void spitfire_data_access_exception(struct pt_regs *regs, unsigned long sfsr, un
294 info.si_addr = (void __user *)sfar; 299 info.si_addr = (void __user *)sfar;
295 info.si_trapno = 0; 300 info.si_trapno = 0;
296 force_sig_info(SIGSEGV, &info, current); 301 force_sig_info(SIGSEGV, &info, current);
302out:
303 exception_exit(prev_state);
297} 304}
298 305
299void spitfire_data_access_exception_tl1(struct pt_regs *regs, unsigned long sfsr, unsigned long sfar) 306void spitfire_data_access_exception_tl1(struct pt_regs *regs, unsigned long sfsr, unsigned long sfar)
@@ -1994,6 +2001,7 @@ static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent,
1994 */ 2001 */
1995void sun4v_resum_error(struct pt_regs *regs, unsigned long offset) 2002void sun4v_resum_error(struct pt_regs *regs, unsigned long offset)
1996{ 2003{
2004 enum ctx_state prev_state = exception_enter();
1997 struct sun4v_error_entry *ent, local_copy; 2005 struct sun4v_error_entry *ent, local_copy;
1998 struct trap_per_cpu *tb; 2006 struct trap_per_cpu *tb;
1999 unsigned long paddr; 2007 unsigned long paddr;
@@ -2022,12 +2030,14 @@ void sun4v_resum_error(struct pt_regs *regs, unsigned long offset)
2022 pr_info("Shutdown request, %u seconds...\n", 2030 pr_info("Shutdown request, %u seconds...\n",
2023 local_copy.err_secs); 2031 local_copy.err_secs);
2024 orderly_poweroff(true); 2032 orderly_poweroff(true);
2025 return; 2033 goto out;
2026 } 2034 }
2027 2035
2028 sun4v_log_error(regs, &local_copy, cpu, 2036 sun4v_log_error(regs, &local_copy, cpu,
2029 KERN_ERR "RESUMABLE ERROR", 2037 KERN_ERR "RESUMABLE ERROR",
2030 &sun4v_resum_oflow_cnt); 2038 &sun4v_resum_oflow_cnt);
2039out:
2040 exception_exit(prev_state);
2031} 2041}
2032 2042
2033/* If we try to printk() we'll probably make matters worse, by trying 2043/* If we try to printk() we'll probably make matters worse, by trying
@@ -2152,7 +2162,7 @@ void hypervisor_tlbop_error_xcall(unsigned long err, unsigned long op)
2152 err, op); 2162 err, op);
2153} 2163}
2154 2164
2155void do_fpe_common(struct pt_regs *regs) 2165static void do_fpe_common(struct pt_regs *regs)
2156{ 2166{
2157 if (regs->tstate & TSTATE_PRIV) { 2167 if (regs->tstate & TSTATE_PRIV) {
2158 regs->tpc = regs->tnpc; 2168 regs->tpc = regs->tnpc;
@@ -2188,23 +2198,28 @@ void do_fpe_common(struct pt_regs *regs)
2188 2198
2189void do_fpieee(struct pt_regs *regs) 2199void do_fpieee(struct pt_regs *regs)
2190{ 2200{
2201 enum ctx_state prev_state = exception_enter();
2202
2191 if (notify_die(DIE_TRAP, "fpu exception ieee", regs, 2203 if (notify_die(DIE_TRAP, "fpu exception ieee", regs,
2192 0, 0x24, SIGFPE) == NOTIFY_STOP) 2204 0, 0x24, SIGFPE) == NOTIFY_STOP)
2193 return; 2205 goto out;
2194 2206
2195 do_fpe_common(regs); 2207 do_fpe_common(regs);
2208out:
2209 exception_exit(prev_state);
2196} 2210}
2197 2211
2198extern int do_mathemu(struct pt_regs *, struct fpustate *, bool); 2212extern int do_mathemu(struct pt_regs *, struct fpustate *, bool);
2199 2213
2200void do_fpother(struct pt_regs *regs) 2214void do_fpother(struct pt_regs *regs)
2201{ 2215{
2216 enum ctx_state prev_state = exception_enter();
2202 struct fpustate *f = FPUSTATE; 2217 struct fpustate *f = FPUSTATE;
2203 int ret = 0; 2218 int ret = 0;
2204 2219
2205 if (notify_die(DIE_TRAP, "fpu exception other", regs, 2220 if (notify_die(DIE_TRAP, "fpu exception other", regs,
2206 0, 0x25, SIGFPE) == NOTIFY_STOP) 2221 0, 0x25, SIGFPE) == NOTIFY_STOP)
2207 return; 2222 goto out;
2208 2223
2209 switch ((current_thread_info()->xfsr[0] & 0x1c000)) { 2224 switch ((current_thread_info()->xfsr[0] & 0x1c000)) {
2210 case (2 << 14): /* unfinished_FPop */ 2225 case (2 << 14): /* unfinished_FPop */
@@ -2213,17 +2228,20 @@ void do_fpother(struct pt_regs *regs)
2213 break; 2228 break;
2214 } 2229 }
2215 if (ret) 2230 if (ret)
2216 return; 2231 goto out;
2217 do_fpe_common(regs); 2232 do_fpe_common(regs);
2233out:
2234 exception_exit(prev_state);
2218} 2235}
2219 2236
2220void do_tof(struct pt_regs *regs) 2237void do_tof(struct pt_regs *regs)
2221{ 2238{
2239 enum ctx_state prev_state = exception_enter();
2222 siginfo_t info; 2240 siginfo_t info;
2223 2241
2224 if (notify_die(DIE_TRAP, "tagged arithmetic overflow", regs, 2242 if (notify_die(DIE_TRAP, "tagged arithmetic overflow", regs,
2225 0, 0x26, SIGEMT) == NOTIFY_STOP) 2243 0, 0x26, SIGEMT) == NOTIFY_STOP)
2226 return; 2244 goto out;
2227 2245
2228 if (regs->tstate & TSTATE_PRIV) 2246 if (regs->tstate & TSTATE_PRIV)
2229 die_if_kernel("Penguin overflow trap from kernel mode", regs); 2247 die_if_kernel("Penguin overflow trap from kernel mode", regs);
@@ -2237,15 +2255,18 @@ void do_tof(struct pt_regs *regs)
2237 info.si_addr = (void __user *)regs->tpc; 2255 info.si_addr = (void __user *)regs->tpc;
2238 info.si_trapno = 0; 2256 info.si_trapno = 0;
2239 force_sig_info(SIGEMT, &info, current); 2257 force_sig_info(SIGEMT, &info, current);
2258out:
2259 exception_exit(prev_state);
2240} 2260}
2241 2261
2242void do_div0(struct pt_regs *regs) 2262void do_div0(struct pt_regs *regs)
2243{ 2263{
2264 enum ctx_state prev_state = exception_enter();
2244 siginfo_t info; 2265 siginfo_t info;
2245 2266
2246 if (notify_die(DIE_TRAP, "integer division by zero", regs, 2267 if (notify_die(DIE_TRAP, "integer division by zero", regs,
2247 0, 0x28, SIGFPE) == NOTIFY_STOP) 2268 0, 0x28, SIGFPE) == NOTIFY_STOP)
2248 return; 2269 goto out;
2249 2270
2250 if (regs->tstate & TSTATE_PRIV) 2271 if (regs->tstate & TSTATE_PRIV)
2251 die_if_kernel("TL0: Kernel divide by zero.", regs); 2272 die_if_kernel("TL0: Kernel divide by zero.", regs);
@@ -2259,6 +2280,8 @@ void do_div0(struct pt_regs *regs)
2259 info.si_addr = (void __user *)regs->tpc; 2280 info.si_addr = (void __user *)regs->tpc;
2260 info.si_trapno = 0; 2281 info.si_trapno = 0;
2261 force_sig_info(SIGFPE, &info, current); 2282 force_sig_info(SIGFPE, &info, current);
2283out:
2284 exception_exit(prev_state);
2262} 2285}
2263 2286
2264static void instruction_dump(unsigned int *pc) 2287static void instruction_dump(unsigned int *pc)
@@ -2415,6 +2438,7 @@ extern int handle_ldf_stq(u32 insn, struct pt_regs *regs);
2415 2438
2416void do_illegal_instruction(struct pt_regs *regs) 2439void do_illegal_instruction(struct pt_regs *regs)
2417{ 2440{
2441 enum ctx_state prev_state = exception_enter();
2418 unsigned long pc = regs->tpc; 2442 unsigned long pc = regs->tpc;
2419 unsigned long tstate = regs->tstate; 2443 unsigned long tstate = regs->tstate;
2420 u32 insn; 2444 u32 insn;
@@ -2422,7 +2446,7 @@ void do_illegal_instruction(struct pt_regs *regs)
2422 2446
2423 if (notify_die(DIE_TRAP, "illegal instruction", regs, 2447 if (notify_die(DIE_TRAP, "illegal instruction", regs,
2424 0, 0x10, SIGILL) == NOTIFY_STOP) 2448 0, 0x10, SIGILL) == NOTIFY_STOP)
2425 return; 2449 goto out;
2426 2450
2427 if (tstate & TSTATE_PRIV) 2451 if (tstate & TSTATE_PRIV)
2428 die_if_kernel("Kernel illegal instruction", regs); 2452 die_if_kernel("Kernel illegal instruction", regs);
@@ -2431,14 +2455,14 @@ void do_illegal_instruction(struct pt_regs *regs)
2431 if (get_user(insn, (u32 __user *) pc) != -EFAULT) { 2455 if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
2432 if ((insn & 0xc1ffc000) == 0x81700000) /* POPC */ { 2456 if ((insn & 0xc1ffc000) == 0x81700000) /* POPC */ {
2433 if (handle_popc(insn, regs)) 2457 if (handle_popc(insn, regs))
2434 return; 2458 goto out;
2435 } else if ((insn & 0xc1580000) == 0xc1100000) /* LDQ/STQ */ { 2459 } else if ((insn & 0xc1580000) == 0xc1100000) /* LDQ/STQ */ {
2436 if (handle_ldf_stq(insn, regs)) 2460 if (handle_ldf_stq(insn, regs))
2437 return; 2461 goto out;
2438 } else if (tlb_type == hypervisor) { 2462 } else if (tlb_type == hypervisor) {
2439 if ((insn & VIS_OPCODE_MASK) == VIS_OPCODE_VAL) { 2463 if ((insn & VIS_OPCODE_MASK) == VIS_OPCODE_VAL) {
2440 if (!vis_emul(regs, insn)) 2464 if (!vis_emul(regs, insn))
2441 return; 2465 goto out;
2442 } else { 2466 } else {
2443 struct fpustate *f = FPUSTATE; 2467 struct fpustate *f = FPUSTATE;
2444 2468
@@ -2448,7 +2472,7 @@ void do_illegal_instruction(struct pt_regs *regs)
2448 * Trap in the %fsr to unimplemented_FPop. 2472 * Trap in the %fsr to unimplemented_FPop.
2449 */ 2473 */
2450 if (do_mathemu(regs, f, true)) 2474 if (do_mathemu(regs, f, true))
2451 return; 2475 goto out;
2452 } 2476 }
2453 } 2477 }
2454 } 2478 }
@@ -2458,21 +2482,24 @@ void do_illegal_instruction(struct pt_regs *regs)
2458 info.si_addr = (void __user *)pc; 2482 info.si_addr = (void __user *)pc;
2459 info.si_trapno = 0; 2483 info.si_trapno = 0;
2460 force_sig_info(SIGILL, &info, current); 2484 force_sig_info(SIGILL, &info, current);
2485out:
2486 exception_exit(prev_state);
2461} 2487}
2462 2488
2463extern void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn); 2489extern void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn);
2464 2490
2465void mem_address_unaligned(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr) 2491void mem_address_unaligned(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr)
2466{ 2492{
2493 enum ctx_state prev_state = exception_enter();
2467 siginfo_t info; 2494 siginfo_t info;
2468 2495
2469 if (notify_die(DIE_TRAP, "memory address unaligned", regs, 2496 if (notify_die(DIE_TRAP, "memory address unaligned", regs,
2470 0, 0x34, SIGSEGV) == NOTIFY_STOP) 2497 0, 0x34, SIGSEGV) == NOTIFY_STOP)
2471 return; 2498 goto out;
2472 2499
2473 if (regs->tstate & TSTATE_PRIV) { 2500 if (regs->tstate & TSTATE_PRIV) {
2474 kernel_unaligned_trap(regs, *((unsigned int *)regs->tpc)); 2501 kernel_unaligned_trap(regs, *((unsigned int *)regs->tpc));
2475 return; 2502 goto out;
2476 } 2503 }
2477 info.si_signo = SIGBUS; 2504 info.si_signo = SIGBUS;
2478 info.si_errno = 0; 2505 info.si_errno = 0;
@@ -2480,6 +2507,8 @@ void mem_address_unaligned(struct pt_regs *regs, unsigned long sfar, unsigned lo
2480 info.si_addr = (void __user *)sfar; 2507 info.si_addr = (void __user *)sfar;
2481 info.si_trapno = 0; 2508 info.si_trapno = 0;
2482 force_sig_info(SIGBUS, &info, current); 2509 force_sig_info(SIGBUS, &info, current);
2510out:
2511 exception_exit(prev_state);
2483} 2512}
2484 2513
2485void sun4v_do_mna(struct pt_regs *regs, unsigned long addr, unsigned long type_ctx) 2514void sun4v_do_mna(struct pt_regs *regs, unsigned long addr, unsigned long type_ctx)
@@ -2504,11 +2533,12 @@ void sun4v_do_mna(struct pt_regs *regs, unsigned long addr, unsigned long type_c
2504 2533
2505void do_privop(struct pt_regs *regs) 2534void do_privop(struct pt_regs *regs)
2506{ 2535{
2536 enum ctx_state prev_state = exception_enter();
2507 siginfo_t info; 2537 siginfo_t info;
2508 2538
2509 if (notify_die(DIE_TRAP, "privileged operation", regs, 2539 if (notify_die(DIE_TRAP, "privileged operation", regs,
2510 0, 0x11, SIGILL) == NOTIFY_STOP) 2540 0, 0x11, SIGILL) == NOTIFY_STOP)
2511 return; 2541 goto out;
2512 2542
2513 if (test_thread_flag(TIF_32BIT)) { 2543 if (test_thread_flag(TIF_32BIT)) {
2514 regs->tpc &= 0xffffffff; 2544 regs->tpc &= 0xffffffff;
@@ -2520,6 +2550,8 @@ void do_privop(struct pt_regs *regs)
2520 info.si_addr = (void __user *)regs->tpc; 2550 info.si_addr = (void __user *)regs->tpc;
2521 info.si_trapno = 0; 2551 info.si_trapno = 0;
2522 force_sig_info(SIGILL, &info, current); 2552 force_sig_info(SIGILL, &info, current);
2553out:
2554 exception_exit(prev_state);
2523} 2555}
2524 2556
2525void do_privact(struct pt_regs *regs) 2557void do_privact(struct pt_regs *regs)
@@ -2530,99 +2562,116 @@ void do_privact(struct pt_regs *regs)
2530/* Trap level 1 stuff or other traps we should never see... */ 2562/* Trap level 1 stuff or other traps we should never see... */
2531void do_cee(struct pt_regs *regs) 2563void do_cee(struct pt_regs *regs)
2532{ 2564{
2565 exception_enter();
2533 die_if_kernel("TL0: Cache Error Exception", regs); 2566 die_if_kernel("TL0: Cache Error Exception", regs);
2534} 2567}
2535 2568
2536void do_cee_tl1(struct pt_regs *regs) 2569void do_cee_tl1(struct pt_regs *regs)
2537{ 2570{
2571 exception_enter();
2538 dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); 2572 dump_tl1_traplog((struct tl1_traplog *)(regs + 1));
2539 die_if_kernel("TL1: Cache Error Exception", regs); 2573 die_if_kernel("TL1: Cache Error Exception", regs);
2540} 2574}
2541 2575
2542void do_dae_tl1(struct pt_regs *regs) 2576void do_dae_tl1(struct pt_regs *regs)
2543{ 2577{
2578 exception_enter();
2544 dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); 2579 dump_tl1_traplog((struct tl1_traplog *)(regs + 1));
2545 die_if_kernel("TL1: Data Access Exception", regs); 2580 die_if_kernel("TL1: Data Access Exception", regs);
2546} 2581}
2547 2582
2548void do_iae_tl1(struct pt_regs *regs) 2583void do_iae_tl1(struct pt_regs *regs)
2549{ 2584{
2585 exception_enter();
2550 dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); 2586 dump_tl1_traplog((struct tl1_traplog *)(regs + 1));
2551 die_if_kernel("TL1: Instruction Access Exception", regs); 2587 die_if_kernel("TL1: Instruction Access Exception", regs);
2552} 2588}
2553 2589
2554void do_div0_tl1(struct pt_regs *regs) 2590void do_div0_tl1(struct pt_regs *regs)
2555{ 2591{
2592 exception_enter();
2556 dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); 2593 dump_tl1_traplog((struct tl1_traplog *)(regs + 1));
2557 die_if_kernel("TL1: DIV0 Exception", regs); 2594 die_if_kernel("TL1: DIV0 Exception", regs);
2558} 2595}
2559 2596
2560void do_fpdis_tl1(struct pt_regs *regs) 2597void do_fpdis_tl1(struct pt_regs *regs)
2561{ 2598{
2599 exception_enter();
2562 dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); 2600 dump_tl1_traplog((struct tl1_traplog *)(regs + 1));
2563 die_if_kernel("TL1: FPU Disabled", regs); 2601 die_if_kernel("TL1: FPU Disabled", regs);
2564} 2602}
2565 2603
2566void do_fpieee_tl1(struct pt_regs *regs) 2604void do_fpieee_tl1(struct pt_regs *regs)
2567{ 2605{
2606 exception_enter();
2568 dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); 2607 dump_tl1_traplog((struct tl1_traplog *)(regs + 1));
2569 die_if_kernel("TL1: FPU IEEE Exception", regs); 2608 die_if_kernel("TL1: FPU IEEE Exception", regs);
2570} 2609}
2571 2610
2572void do_fpother_tl1(struct pt_regs *regs) 2611void do_fpother_tl1(struct pt_regs *regs)
2573{ 2612{
2613 exception_enter();
2574 dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); 2614 dump_tl1_traplog((struct tl1_traplog *)(regs + 1));
2575 die_if_kernel("TL1: FPU Other Exception", regs); 2615 die_if_kernel("TL1: FPU Other Exception", regs);
2576} 2616}
2577 2617
2578void do_ill_tl1(struct pt_regs *regs) 2618void do_ill_tl1(struct pt_regs *regs)
2579{ 2619{
2620 exception_enter();
2580 dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); 2621 dump_tl1_traplog((struct tl1_traplog *)(regs + 1));
2581 die_if_kernel("TL1: Illegal Instruction Exception", regs); 2622 die_if_kernel("TL1: Illegal Instruction Exception", regs);
2582} 2623}
2583 2624
2584void do_irq_tl1(struct pt_regs *regs) 2625void do_irq_tl1(struct pt_regs *regs)
2585{ 2626{
2627 exception_enter();
2586 dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); 2628 dump_tl1_traplog((struct tl1_traplog *)(regs + 1));
2587 die_if_kernel("TL1: IRQ Exception", regs); 2629 die_if_kernel("TL1: IRQ Exception", regs);
2588} 2630}
2589 2631
2590void do_lddfmna_tl1(struct pt_regs *regs) 2632void do_lddfmna_tl1(struct pt_regs *regs)
2591{ 2633{
2634 exception_enter();
2592 dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); 2635 dump_tl1_traplog((struct tl1_traplog *)(regs + 1));
2593 die_if_kernel("TL1: LDDF Exception", regs); 2636 die_if_kernel("TL1: LDDF Exception", regs);
2594} 2637}
2595 2638
2596void do_stdfmna_tl1(struct pt_regs *regs) 2639void do_stdfmna_tl1(struct pt_regs *regs)
2597{ 2640{
2641 exception_enter();
2598 dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); 2642 dump_tl1_traplog((struct tl1_traplog *)(regs + 1));
2599 die_if_kernel("TL1: STDF Exception", regs); 2643 die_if_kernel("TL1: STDF Exception", regs);
2600} 2644}
2601 2645
2602void do_paw(struct pt_regs *regs) 2646void do_paw(struct pt_regs *regs)
2603{ 2647{
2648 exception_enter();
2604 die_if_kernel("TL0: Phys Watchpoint Exception", regs); 2649 die_if_kernel("TL0: Phys Watchpoint Exception", regs);
2605} 2650}
2606 2651
2607void do_paw_tl1(struct pt_regs *regs) 2652void do_paw_tl1(struct pt_regs *regs)
2608{ 2653{
2654 exception_enter();
2609 dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); 2655 dump_tl1_traplog((struct tl1_traplog *)(regs + 1));
2610 die_if_kernel("TL1: Phys Watchpoint Exception", regs); 2656 die_if_kernel("TL1: Phys Watchpoint Exception", regs);
2611} 2657}
2612 2658
2613void do_vaw(struct pt_regs *regs) 2659void do_vaw(struct pt_regs *regs)
2614{ 2660{
2661 exception_enter();
2615 die_if_kernel("TL0: Virt Watchpoint Exception", regs); 2662 die_if_kernel("TL0: Virt Watchpoint Exception", regs);
2616} 2663}
2617 2664
2618void do_vaw_tl1(struct pt_regs *regs) 2665void do_vaw_tl1(struct pt_regs *regs)
2619{ 2666{
2667 exception_enter();
2620 dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); 2668 dump_tl1_traplog((struct tl1_traplog *)(regs + 1));
2621 die_if_kernel("TL1: Virt Watchpoint Exception", regs); 2669 die_if_kernel("TL1: Virt Watchpoint Exception", regs);
2622} 2670}
2623 2671
2624void do_tof_tl1(struct pt_regs *regs) 2672void do_tof_tl1(struct pt_regs *regs)
2625{ 2673{
2674 exception_enter();
2626 dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); 2675 dump_tl1_traplog((struct tl1_traplog *)(regs + 1));
2627 die_if_kernel("TL1: Tag Overflow Exception", regs); 2676 die_if_kernel("TL1: Tag Overflow Exception", regs);
2628} 2677}
diff --git a/arch/sparc/kernel/tsb.S b/arch/sparc/kernel/tsb.S
index a313e4a9399b..14158d40ba76 100644
--- a/arch/sparc/kernel/tsb.S
+++ b/arch/sparc/kernel/tsb.S
@@ -75,7 +75,7 @@ tsb_miss_page_table_walk:
75 mov 512, %g7 75 mov 512, %g7
76 andn %g5, 0x7, %g5 76 andn %g5, 0x7, %g5
77 sllx %g7, %g6, %g7 77 sllx %g7, %g6, %g7
78 srlx %g4, HPAGE_SHIFT, %g6 78 srlx %g4, REAL_HPAGE_SHIFT, %g6
79 sub %g7, 1, %g7 79 sub %g7, 1, %g7
80 and %g6, %g7, %g6 80 and %g6, %g7, %g6
81 sllx %g6, 4, %g6 81 sllx %g6, 4, %g6
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c
index 8201c25e7669..3c1a7cb31579 100644
--- a/arch/sparc/kernel/unaligned_64.c
+++ b/arch/sparc/kernel/unaligned_64.c
@@ -21,9 +21,12 @@
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22#include <linux/perf_event.h> 22#include <linux/perf_event.h>
23#include <linux/ratelimit.h> 23#include <linux/ratelimit.h>
24#include <linux/context_tracking.h>
24#include <asm/fpumacro.h> 25#include <asm/fpumacro.h>
25#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
26 27
28#include "entry.h"
29
27enum direction { 30enum direction {
28 load, /* ld, ldd, ldh, ldsh */ 31 load, /* ld, ldd, ldh, ldsh */
29 store, /* st, std, sth, stsh */ 32 store, /* st, std, sth, stsh */
@@ -418,9 +421,6 @@ int handle_popc(u32 insn, struct pt_regs *regs)
418 421
419extern void do_fpother(struct pt_regs *regs); 422extern void do_fpother(struct pt_regs *regs);
420extern void do_privact(struct pt_regs *regs); 423extern void do_privact(struct pt_regs *regs);
421extern void spitfire_data_access_exception(struct pt_regs *regs,
422 unsigned long sfsr,
423 unsigned long sfar);
424extern void sun4v_data_access_exception(struct pt_regs *regs, 424extern void sun4v_data_access_exception(struct pt_regs *regs,
425 unsigned long addr, 425 unsigned long addr,
426 unsigned long type_ctx); 426 unsigned long type_ctx);
@@ -578,6 +578,7 @@ void handle_ld_nf(u32 insn, struct pt_regs *regs)
578 578
579void handle_lddfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr) 579void handle_lddfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr)
580{ 580{
581 enum ctx_state prev_state = exception_enter();
581 unsigned long pc = regs->tpc; 582 unsigned long pc = regs->tpc;
582 unsigned long tstate = regs->tstate; 583 unsigned long tstate = regs->tstate;
583 u32 insn; 584 u32 insn;
@@ -632,13 +633,16 @@ daex:
632 sun4v_data_access_exception(regs, sfar, sfsr); 633 sun4v_data_access_exception(regs, sfar, sfsr);
633 else 634 else
634 spitfire_data_access_exception(regs, sfsr, sfar); 635 spitfire_data_access_exception(regs, sfsr, sfar);
635 return; 636 goto out;
636 } 637 }
637 advance(regs); 638 advance(regs);
639out:
640 exception_exit(prev_state);
638} 641}
639 642
640void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr) 643void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr)
641{ 644{
645 enum ctx_state prev_state = exception_enter();
642 unsigned long pc = regs->tpc; 646 unsigned long pc = regs->tpc;
643 unsigned long tstate = regs->tstate; 647 unsigned long tstate = regs->tstate;
644 u32 insn; 648 u32 insn;
@@ -680,7 +684,9 @@ daex:
680 sun4v_data_access_exception(regs, sfar, sfsr); 684 sun4v_data_access_exception(regs, sfar, sfsr);
681 else 685 else
682 spitfire_data_access_exception(regs, sfsr, sfar); 686 spitfire_data_access_exception(regs, sfsr, sfar);
683 return; 687 goto out;
684 } 688 }
685 advance(regs); 689 advance(regs);
690out:
691 exception_exit(prev_state);
686} 692}
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index 0bacceb19150..932ff90fd760 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -122,6 +122,11 @@ SECTIONS
122 *(.swapper_4m_tsb_phys_patch) 122 *(.swapper_4m_tsb_phys_patch)
123 __swapper_4m_tsb_phys_patch_end = .; 123 __swapper_4m_tsb_phys_patch_end = .;
124 } 124 }
125 .page_offset_shift_patch : {
126 __page_offset_shift_patch = .;
127 *(.page_offset_shift_patch)
128 __page_offset_shift_patch_end = .;
129 }
125 .popc_3insn_patch : { 130 .popc_3insn_patch : {
126 __popc_3insn_patch = .; 131 __popc_3insn_patch = .;
127 *(.popc_3insn_patch) 132 *(.popc_3insn_patch)
diff --git a/arch/sparc/lib/clear_page.S b/arch/sparc/lib/clear_page.S
index 77e531f6c2a7..46272dfc26e8 100644
--- a/arch/sparc/lib/clear_page.S
+++ b/arch/sparc/lib/clear_page.S
@@ -37,10 +37,10 @@ _clear_page: /* %o0=dest */
37 .globl clear_user_page 37 .globl clear_user_page
38clear_user_page: /* %o0=dest, %o1=vaddr */ 38clear_user_page: /* %o0=dest, %o1=vaddr */
39 lduw [%g6 + TI_PRE_COUNT], %o2 39 lduw [%g6 + TI_PRE_COUNT], %o2
40 sethi %uhi(PAGE_OFFSET), %g2 40 sethi %hi(PAGE_OFFSET), %g2
41 sethi %hi(PAGE_SIZE), %o4 41 sethi %hi(PAGE_SIZE), %o4
42 42
43 sllx %g2, 32, %g2 43 ldx [%g2 + %lo(PAGE_OFFSET)], %g2
44 sethi %hi(PAGE_KERNEL_LOCKED), %g3 44 sethi %hi(PAGE_KERNEL_LOCKED), %g3
45 45
46 ldx [%g3 + %lo(PAGE_KERNEL_LOCKED)], %g3 46 ldx [%g3 + %lo(PAGE_KERNEL_LOCKED)], %g3
diff --git a/arch/sparc/lib/copy_page.S b/arch/sparc/lib/copy_page.S
index 4d2df328e514..dd16c61f3263 100644
--- a/arch/sparc/lib/copy_page.S
+++ b/arch/sparc/lib/copy_page.S
@@ -46,10 +46,10 @@
46 .type copy_user_page,#function 46 .type copy_user_page,#function
47copy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */ 47copy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */
48 lduw [%g6 + TI_PRE_COUNT], %o4 48 lduw [%g6 + TI_PRE_COUNT], %o4
49 sethi %uhi(PAGE_OFFSET), %g2 49 sethi %hi(PAGE_OFFSET), %g2
50 sethi %hi(PAGE_SIZE), %o3 50 sethi %hi(PAGE_SIZE), %o3
51 51
52 sllx %g2, 32, %g2 52 ldx [%g2 + %lo(PAGE_OFFSET)], %g2
53 sethi %hi(PAGE_KERNEL_LOCKED), %g3 53 sethi %hi(PAGE_KERNEL_LOCKED), %g3
54 54
55 ldx [%g3 + %lo(PAGE_KERNEL_LOCKED)], %g3 55 ldx [%g3 + %lo(PAGE_KERNEL_LOCKED)], %g3
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
index 2ebec263d685..69bb818fdd79 100644
--- a/arch/sparc/mm/fault_64.c
+++ b/arch/sparc/mm/fault_64.c
@@ -21,6 +21,7 @@
21#include <linux/kprobes.h> 21#include <linux/kprobes.h>
22#include <linux/kdebug.h> 22#include <linux/kdebug.h>
23#include <linux/percpu.h> 23#include <linux/percpu.h>
24#include <linux/context_tracking.h>
24 25
25#include <asm/page.h> 26#include <asm/page.h>
26#include <asm/pgtable.h> 27#include <asm/pgtable.h>
@@ -272,6 +273,7 @@ static void noinline __kprobes bogus_32bit_fault_address(struct pt_regs *regs,
272 273
273asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) 274asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
274{ 275{
276 enum ctx_state prev_state = exception_enter();
275 struct mm_struct *mm = current->mm; 277 struct mm_struct *mm = current->mm;
276 struct vm_area_struct *vma; 278 struct vm_area_struct *vma;
277 unsigned int insn = 0; 279 unsigned int insn = 0;
@@ -282,7 +284,7 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
282 fault_code = get_thread_fault_code(); 284 fault_code = get_thread_fault_code();
283 285
284 if (notify_page_fault(regs)) 286 if (notify_page_fault(regs))
285 return; 287 goto exit_exception;
286 288
287 si_code = SEGV_MAPERR; 289 si_code = SEGV_MAPERR;
288 address = current_thread_info()->fault_address; 290 address = current_thread_info()->fault_address;
@@ -313,7 +315,7 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
313 /* Valid, no problems... */ 315 /* Valid, no problems... */
314 } else { 316 } else {
315 bad_kernel_pc(regs, address); 317 bad_kernel_pc(regs, address);
316 return; 318 goto exit_exception;
317 } 319 }
318 } else 320 } else
319 flags |= FAULT_FLAG_USER; 321 flags |= FAULT_FLAG_USER;
@@ -430,7 +432,7 @@ good_area:
430 fault = handle_mm_fault(mm, vma, address, flags); 432 fault = handle_mm_fault(mm, vma, address, flags);
431 433
432 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) 434 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
433 return; 435 goto exit_exception;
434 436
435 if (unlikely(fault & VM_FAULT_ERROR)) { 437 if (unlikely(fault & VM_FAULT_ERROR)) {
436 if (fault & VM_FAULT_OOM) 438 if (fault & VM_FAULT_OOM)
@@ -482,6 +484,8 @@ good_area:
482 484
483 } 485 }
484#endif 486#endif
487exit_exception:
488 exception_exit(prev_state);
485 return; 489 return;
486 490
487 /* 491 /*
@@ -494,7 +498,7 @@ bad_area:
494 498
495handle_kernel_fault: 499handle_kernel_fault:
496 do_kernel_fault(regs, si_code, fault_code, insn, address); 500 do_kernel_fault(regs, si_code, fault_code, insn, address);
497 return; 501 goto exit_exception;
498 502
499/* 503/*
500 * We ran out of memory, or some other thing happened to us that made 504 * We ran out of memory, or some other thing happened to us that made
@@ -505,7 +509,7 @@ out_of_memory:
505 up_read(&mm->mmap_sem); 509 up_read(&mm->mmap_sem);
506 if (!(regs->tstate & TSTATE_PRIV)) { 510 if (!(regs->tstate & TSTATE_PRIV)) {
507 pagefault_out_of_memory(); 511 pagefault_out_of_memory();
508 return; 512 goto exit_exception;
509 } 513 }
510 goto handle_kernel_fault; 514 goto handle_kernel_fault;
511 515
diff --git a/arch/sparc/mm/gup.c b/arch/sparc/mm/gup.c
index 01ee23dd724d..c4d3da68b800 100644
--- a/arch/sparc/mm/gup.c
+++ b/arch/sparc/mm/gup.c
@@ -71,13 +71,12 @@ static int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
71 int *nr) 71 int *nr)
72{ 72{
73 struct page *head, *page, *tail; 73 struct page *head, *page, *tail;
74 u32 mask;
75 int refs; 74 int refs;
76 75
77 mask = PMD_HUGE_PRESENT; 76 if (!pmd_large(pmd))
78 if (write) 77 return 0;
79 mask |= PMD_HUGE_WRITE; 78
80 if ((pmd_val(pmd) & mask) != mask) 79 if (write && !pmd_write(pmd))
81 return 0; 80 return 0;
82 81
83 refs = 0; 82 refs = 0;
diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
index 96399646570a..30963178d7e9 100644
--- a/arch/sparc/mm/hugetlbpage.c
+++ b/arch/sparc/mm/hugetlbpage.c
@@ -21,8 +21,6 @@
21/* Slightly simplified from the non-hugepage variant because by 21/* Slightly simplified from the non-hugepage variant because by
22 * definition we don't have to worry about any page coloring stuff 22 * definition we don't have to worry about any page coloring stuff
23 */ 23 */
24#define VA_EXCLUDE_START (0x0000080000000000UL - (1UL << 32UL))
25#define VA_EXCLUDE_END (0xfffff80000000000UL + (1UL << 32UL))
26 24
27static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *filp, 25static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *filp,
28 unsigned long addr, 26 unsigned long addr,
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index ed82edad1a39..6b643790e4fe 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -354,7 +354,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *
354 354
355#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) 355#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
356 if (mm->context.huge_pte_count && is_hugetlb_pte(pte)) 356 if (mm->context.huge_pte_count && is_hugetlb_pte(pte))
357 __update_mmu_tsb_insert(mm, MM_TSB_HUGE, HPAGE_SHIFT, 357 __update_mmu_tsb_insert(mm, MM_TSB_HUGE, REAL_HPAGE_SHIFT,
358 address, pte_val(pte)); 358 address, pte_val(pte));
359 else 359 else
360#endif 360#endif
@@ -1557,6 +1557,96 @@ unsigned long __init find_ecache_flush_span(unsigned long size)
1557 return ~0UL; 1557 return ~0UL;
1558} 1558}
1559 1559
1560unsigned long PAGE_OFFSET;
1561EXPORT_SYMBOL(PAGE_OFFSET);
1562
1563static void __init page_offset_shift_patch_one(unsigned int *insn, unsigned long phys_bits)
1564{
1565 unsigned long final_shift;
1566 unsigned int val = *insn;
1567 unsigned int cnt;
1568
1569 /* We are patching in ilog2(max_supported_phys_address), and
1570 * we are doing so in a manner similar to a relocation addend.
1571 * That is, we are adding the shift value to whatever value
1572 * is in the shift instruction count field already.
1573 */
1574 cnt = (val & 0x3f);
1575 val &= ~0x3f;
1576
1577 /* If we are trying to shift >= 64 bits, clear the destination
1578 * register. This can happen when phys_bits ends up being equal
1579 * to MAX_PHYS_ADDRESS_BITS.
1580 */
1581 final_shift = (cnt + (64 - phys_bits));
1582 if (final_shift >= 64) {
1583 unsigned int rd = (val >> 25) & 0x1f;
1584
1585 val = 0x80100000 | (rd << 25);
1586 } else {
1587 val |= final_shift;
1588 }
1589 *insn = val;
1590
1591 __asm__ __volatile__("flush %0"
1592 : /* no outputs */
1593 : "r" (insn));
1594}
1595
1596static void __init page_offset_shift_patch(unsigned long phys_bits)
1597{
1598 extern unsigned int __page_offset_shift_patch;
1599 extern unsigned int __page_offset_shift_patch_end;
1600 unsigned int *p;
1601
1602 p = &__page_offset_shift_patch;
1603 while (p < &__page_offset_shift_patch_end) {
1604 unsigned int *insn = (unsigned int *)(unsigned long)*p;
1605
1606 page_offset_shift_patch_one(insn, phys_bits);
1607
1608 p++;
1609 }
1610}
1611
1612static void __init setup_page_offset(void)
1613{
1614 unsigned long max_phys_bits = 40;
1615
1616 if (tlb_type == cheetah || tlb_type == cheetah_plus) {
1617 max_phys_bits = 42;
1618 } else if (tlb_type == hypervisor) {
1619 switch (sun4v_chip_type) {
1620 case SUN4V_CHIP_NIAGARA1:
1621 case SUN4V_CHIP_NIAGARA2:
1622 max_phys_bits = 39;
1623 break;
1624 case SUN4V_CHIP_NIAGARA3:
1625 max_phys_bits = 43;
1626 break;
1627 case SUN4V_CHIP_NIAGARA4:
1628 case SUN4V_CHIP_NIAGARA5:
1629 case SUN4V_CHIP_SPARC64X:
1630 default:
1631 max_phys_bits = 47;
1632 break;
1633 }
1634 }
1635
1636 if (max_phys_bits > MAX_PHYS_ADDRESS_BITS) {
1637 prom_printf("MAX_PHYS_ADDRESS_BITS is too small, need %lu\n",
1638 max_phys_bits);
1639 prom_halt();
1640 }
1641
1642 PAGE_OFFSET = PAGE_OFFSET_BY_BITS(max_phys_bits);
1643
1644 pr_info("PAGE_OFFSET is 0x%016lx (max_phys_bits == %lu)\n",
1645 PAGE_OFFSET, max_phys_bits);
1646
1647 page_offset_shift_patch(max_phys_bits);
1648}
1649
1560static void __init tsb_phys_patch(void) 1650static void __init tsb_phys_patch(void)
1561{ 1651{
1562 struct tsb_ldquad_phys_patch_entry *pquad; 1652 struct tsb_ldquad_phys_patch_entry *pquad;
@@ -1722,7 +1812,7 @@ static void __init sun4v_linear_pte_xor_finalize(void)
1722#ifndef CONFIG_DEBUG_PAGEALLOC 1812#ifndef CONFIG_DEBUG_PAGEALLOC
1723 if (cpu_pgsz_mask & HV_PGSZ_MASK_256MB) { 1813 if (cpu_pgsz_mask & HV_PGSZ_MASK_256MB) {
1724 kern_linear_pte_xor[1] = (_PAGE_VALID | _PAGE_SZ256MB_4V) ^ 1814 kern_linear_pte_xor[1] = (_PAGE_VALID | _PAGE_SZ256MB_4V) ^
1725 0xfffff80000000000UL; 1815 PAGE_OFFSET;
1726 kern_linear_pte_xor[1] |= (_PAGE_CP_4V | _PAGE_CV_4V | 1816 kern_linear_pte_xor[1] |= (_PAGE_CP_4V | _PAGE_CV_4V |
1727 _PAGE_P_4V | _PAGE_W_4V); 1817 _PAGE_P_4V | _PAGE_W_4V);
1728 } else { 1818 } else {
@@ -1731,7 +1821,7 @@ static void __init sun4v_linear_pte_xor_finalize(void)
1731 1821
1732 if (cpu_pgsz_mask & HV_PGSZ_MASK_2GB) { 1822 if (cpu_pgsz_mask & HV_PGSZ_MASK_2GB) {
1733 kern_linear_pte_xor[2] = (_PAGE_VALID | _PAGE_SZ2GB_4V) ^ 1823 kern_linear_pte_xor[2] = (_PAGE_VALID | _PAGE_SZ2GB_4V) ^
1734 0xfffff80000000000UL; 1824 PAGE_OFFSET;
1735 kern_linear_pte_xor[2] |= (_PAGE_CP_4V | _PAGE_CV_4V | 1825 kern_linear_pte_xor[2] |= (_PAGE_CP_4V | _PAGE_CV_4V |
1736 _PAGE_P_4V | _PAGE_W_4V); 1826 _PAGE_P_4V | _PAGE_W_4V);
1737 } else { 1827 } else {
@@ -1740,7 +1830,7 @@ static void __init sun4v_linear_pte_xor_finalize(void)
1740 1830
1741 if (cpu_pgsz_mask & HV_PGSZ_MASK_16GB) { 1831 if (cpu_pgsz_mask & HV_PGSZ_MASK_16GB) {
1742 kern_linear_pte_xor[3] = (_PAGE_VALID | _PAGE_SZ16GB_4V) ^ 1832 kern_linear_pte_xor[3] = (_PAGE_VALID | _PAGE_SZ16GB_4V) ^
1743 0xfffff80000000000UL; 1833 PAGE_OFFSET;
1744 kern_linear_pte_xor[3] |= (_PAGE_CP_4V | _PAGE_CV_4V | 1834 kern_linear_pte_xor[3] |= (_PAGE_CP_4V | _PAGE_CV_4V |
1745 _PAGE_P_4V | _PAGE_W_4V); 1835 _PAGE_P_4V | _PAGE_W_4V);
1746 } else { 1836 } else {
@@ -1752,7 +1842,7 @@ static void __init sun4v_linear_pte_xor_finalize(void)
1752/* paging_init() sets up the page tables */ 1842/* paging_init() sets up the page tables */
1753 1843
1754static unsigned long last_valid_pfn; 1844static unsigned long last_valid_pfn;
1755pgd_t swapper_pg_dir[2048]; 1845pgd_t swapper_pg_dir[PTRS_PER_PGD];
1756 1846
1757static void sun4u_pgprot_init(void); 1847static void sun4u_pgprot_init(void);
1758static void sun4v_pgprot_init(void); 1848static void sun4v_pgprot_init(void);
@@ -1763,6 +1853,8 @@ void __init paging_init(void)
1763 unsigned long real_end, i; 1853 unsigned long real_end, i;
1764 int node; 1854 int node;
1765 1855
1856 setup_page_offset();
1857
1766 /* These build time checkes make sure that the dcache_dirty_cpu() 1858 /* These build time checkes make sure that the dcache_dirty_cpu()
1767 * page->flags usage will work. 1859 * page->flags usage will work.
1768 * 1860 *
@@ -2261,10 +2353,10 @@ static void __init sun4u_pgprot_init(void)
2261 __ACCESS_BITS_4U | _PAGE_E_4U); 2353 __ACCESS_BITS_4U | _PAGE_E_4U);
2262 2354
2263#ifdef CONFIG_DEBUG_PAGEALLOC 2355#ifdef CONFIG_DEBUG_PAGEALLOC
2264 kern_linear_pte_xor[0] = _PAGE_VALID ^ 0xfffff80000000000UL; 2356 kern_linear_pte_xor[0] = _PAGE_VALID ^ PAGE_OFFSET;
2265#else 2357#else
2266 kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZ4MB_4U) ^ 2358 kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZ4MB_4U) ^
2267 0xfffff80000000000UL; 2359 PAGE_OFFSET;
2268#endif 2360#endif
2269 kern_linear_pte_xor[0] |= (_PAGE_CP_4U | _PAGE_CV_4U | 2361 kern_linear_pte_xor[0] |= (_PAGE_CP_4U | _PAGE_CV_4U |
2270 _PAGE_P_4U | _PAGE_W_4U); 2362 _PAGE_P_4U | _PAGE_W_4U);
@@ -2308,10 +2400,10 @@ static void __init sun4v_pgprot_init(void)
2308 _PAGE_CACHE = _PAGE_CACHE_4V; 2400 _PAGE_CACHE = _PAGE_CACHE_4V;
2309 2401
2310#ifdef CONFIG_DEBUG_PAGEALLOC 2402#ifdef CONFIG_DEBUG_PAGEALLOC
2311 kern_linear_pte_xor[0] = _PAGE_VALID ^ 0xfffff80000000000UL; 2403 kern_linear_pte_xor[0] = _PAGE_VALID ^ PAGE_OFFSET;
2312#else 2404#else
2313 kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZ4MB_4V) ^ 2405 kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZ4MB_4V) ^
2314 0xfffff80000000000UL; 2406 PAGE_OFFSET;
2315#endif 2407#endif
2316 kern_linear_pte_xor[0] |= (_PAGE_CP_4V | _PAGE_CV_4V | 2408 kern_linear_pte_xor[0] |= (_PAGE_CP_4V | _PAGE_CV_4V |
2317 _PAGE_P_4V | _PAGE_W_4V); 2409 _PAGE_P_4V | _PAGE_W_4V);
@@ -2455,53 +2547,13 @@ void __flush_tlb_all(void)
2455 : : "r" (pstate)); 2547 : : "r" (pstate));
2456} 2548}
2457 2549
2458static pte_t *get_from_cache(struct mm_struct *mm)
2459{
2460 struct page *page;
2461 pte_t *ret;
2462
2463 spin_lock(&mm->page_table_lock);
2464 page = mm->context.pgtable_page;
2465 ret = NULL;
2466 if (page) {
2467 void *p = page_address(page);
2468
2469 mm->context.pgtable_page = NULL;
2470
2471 ret = (pte_t *) (p + (PAGE_SIZE / 2));
2472 }
2473 spin_unlock(&mm->page_table_lock);
2474
2475 return ret;
2476}
2477
2478static struct page *__alloc_for_cache(struct mm_struct *mm)
2479{
2480 struct page *page = alloc_page(GFP_KERNEL | __GFP_NOTRACK |
2481 __GFP_REPEAT | __GFP_ZERO);
2482
2483 if (page) {
2484 spin_lock(&mm->page_table_lock);
2485 if (!mm->context.pgtable_page) {
2486 atomic_set(&page->_count, 2);
2487 mm->context.pgtable_page = page;
2488 }
2489 spin_unlock(&mm->page_table_lock);
2490 }
2491 return page;
2492}
2493
2494pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 2550pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
2495 unsigned long address) 2551 unsigned long address)
2496{ 2552{
2497 struct page *page; 2553 struct page *page = alloc_page(GFP_KERNEL | __GFP_NOTRACK |
2498 pte_t *pte; 2554 __GFP_REPEAT | __GFP_ZERO);
2499 2555 pte_t *pte = NULL;
2500 pte = get_from_cache(mm);
2501 if (pte)
2502 return pte;
2503 2556
2504 page = __alloc_for_cache(mm);
2505 if (page) 2557 if (page)
2506 pte = (pte_t *) page_address(page); 2558 pte = (pte_t *) page_address(page);
2507 2559
@@ -2511,36 +2563,30 @@ pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
2511pgtable_t pte_alloc_one(struct mm_struct *mm, 2563pgtable_t pte_alloc_one(struct mm_struct *mm,
2512 unsigned long address) 2564 unsigned long address)
2513{ 2565{
2514 struct page *page; 2566 struct page *page = alloc_page(GFP_KERNEL | __GFP_NOTRACK |
2515 pte_t *pte; 2567 __GFP_REPEAT | __GFP_ZERO);
2516 2568 pte_t *pte = NULL;
2517 pte = get_from_cache(mm);
2518 if (pte)
2519 return pte;
2520 2569
2521 page = __alloc_for_cache(mm); 2570 if (!page)
2522 if (page) { 2571 return NULL;
2523 pgtable_page_ctor(page); 2572 if (!pgtable_page_ctor(page)) {
2524 pte = (pte_t *) page_address(page); 2573 free_hot_cold_page(page, 0);
2574 return NULL;
2525 } 2575 }
2526 2576 return (pte_t *) page_address(page);
2527 return pte;
2528} 2577}
2529 2578
2530void pte_free_kernel(struct mm_struct *mm, pte_t *pte) 2579void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
2531{ 2580{
2532 struct page *page = virt_to_page(pte); 2581 free_page((unsigned long)pte);
2533 if (put_page_testzero(page))
2534 free_hot_cold_page(page, 0);
2535} 2582}
2536 2583
2537static void __pte_free(pgtable_t pte) 2584static void __pte_free(pgtable_t pte)
2538{ 2585{
2539 struct page *page = virt_to_page(pte); 2586 struct page *page = virt_to_page(pte);
2540 if (put_page_testzero(page)) { 2587
2541 pgtable_page_dtor(page); 2588 pgtable_page_dtor(page);
2542 free_hot_cold_page(page, 0); 2589 __free_page(page);
2543 }
2544} 2590}
2545 2591
2546void pte_free(struct mm_struct *mm, pgtable_t pte) 2592void pte_free(struct mm_struct *mm, pgtable_t pte)
@@ -2557,124 +2603,27 @@ void pgtable_free(void *table, bool is_page)
2557} 2603}
2558 2604
2559#ifdef CONFIG_TRANSPARENT_HUGEPAGE 2605#ifdef CONFIG_TRANSPARENT_HUGEPAGE
2560static pmd_t pmd_set_protbits(pmd_t pmd, pgprot_t pgprot, bool for_modify)
2561{
2562 if (pgprot_val(pgprot) & _PAGE_VALID)
2563 pmd_val(pmd) |= PMD_HUGE_PRESENT;
2564 if (tlb_type == hypervisor) {
2565 if (pgprot_val(pgprot) & _PAGE_WRITE_4V)
2566 pmd_val(pmd) |= PMD_HUGE_WRITE;
2567 if (pgprot_val(pgprot) & _PAGE_EXEC_4V)
2568 pmd_val(pmd) |= PMD_HUGE_EXEC;
2569
2570 if (!for_modify) {
2571 if (pgprot_val(pgprot) & _PAGE_ACCESSED_4V)
2572 pmd_val(pmd) |= PMD_HUGE_ACCESSED;
2573 if (pgprot_val(pgprot) & _PAGE_MODIFIED_4V)
2574 pmd_val(pmd) |= PMD_HUGE_DIRTY;
2575 }
2576 } else {
2577 if (pgprot_val(pgprot) & _PAGE_WRITE_4U)
2578 pmd_val(pmd) |= PMD_HUGE_WRITE;
2579 if (pgprot_val(pgprot) & _PAGE_EXEC_4U)
2580 pmd_val(pmd) |= PMD_HUGE_EXEC;
2581
2582 if (!for_modify) {
2583 if (pgprot_val(pgprot) & _PAGE_ACCESSED_4U)
2584 pmd_val(pmd) |= PMD_HUGE_ACCESSED;
2585 if (pgprot_val(pgprot) & _PAGE_MODIFIED_4U)
2586 pmd_val(pmd) |= PMD_HUGE_DIRTY;
2587 }
2588 }
2589
2590 return pmd;
2591}
2592
2593pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot)
2594{
2595 pmd_t pmd;
2596
2597 pmd_val(pmd) = (page_nr << ((PAGE_SHIFT - PMD_PADDR_SHIFT)));
2598 pmd_val(pmd) |= PMD_ISHUGE;
2599 pmd = pmd_set_protbits(pmd, pgprot, false);
2600 return pmd;
2601}
2602
2603pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
2604{
2605 pmd_val(pmd) &= ~(PMD_HUGE_PRESENT |
2606 PMD_HUGE_WRITE |
2607 PMD_HUGE_EXEC);
2608 pmd = pmd_set_protbits(pmd, newprot, true);
2609 return pmd;
2610}
2611
2612pgprot_t pmd_pgprot(pmd_t entry)
2613{
2614 unsigned long pte = 0;
2615
2616 if (pmd_val(entry) & PMD_HUGE_PRESENT)
2617 pte |= _PAGE_VALID;
2618
2619 if (tlb_type == hypervisor) {
2620 if (pmd_val(entry) & PMD_HUGE_PRESENT)
2621 pte |= _PAGE_PRESENT_4V;
2622 if (pmd_val(entry) & PMD_HUGE_EXEC)
2623 pte |= _PAGE_EXEC_4V;
2624 if (pmd_val(entry) & PMD_HUGE_WRITE)
2625 pte |= _PAGE_W_4V;
2626 if (pmd_val(entry) & PMD_HUGE_ACCESSED)
2627 pte |= _PAGE_ACCESSED_4V;
2628 if (pmd_val(entry) & PMD_HUGE_DIRTY)
2629 pte |= _PAGE_MODIFIED_4V;
2630 pte |= _PAGE_CP_4V|_PAGE_CV_4V;
2631 } else {
2632 if (pmd_val(entry) & PMD_HUGE_PRESENT)
2633 pte |= _PAGE_PRESENT_4U;
2634 if (pmd_val(entry) & PMD_HUGE_EXEC)
2635 pte |= _PAGE_EXEC_4U;
2636 if (pmd_val(entry) & PMD_HUGE_WRITE)
2637 pte |= _PAGE_W_4U;
2638 if (pmd_val(entry) & PMD_HUGE_ACCESSED)
2639 pte |= _PAGE_ACCESSED_4U;
2640 if (pmd_val(entry) & PMD_HUGE_DIRTY)
2641 pte |= _PAGE_MODIFIED_4U;
2642 pte |= _PAGE_CP_4U|_PAGE_CV_4U;
2643 }
2644
2645 return __pgprot(pte);
2646}
2647
2648void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr, 2606void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
2649 pmd_t *pmd) 2607 pmd_t *pmd)
2650{ 2608{
2651 unsigned long pte, flags; 2609 unsigned long pte, flags;
2652 struct mm_struct *mm; 2610 struct mm_struct *mm;
2653 pmd_t entry = *pmd; 2611 pmd_t entry = *pmd;
2654 pgprot_t prot;
2655 2612
2656 if (!pmd_large(entry) || !pmd_young(entry)) 2613 if (!pmd_large(entry) || !pmd_young(entry))
2657 return; 2614 return;
2658 2615
2659 pte = (pmd_val(entry) & ~PMD_HUGE_PROTBITS); 2616 pte = pmd_val(entry);
2660 pte <<= PMD_PADDR_SHIFT;
2661 pte |= _PAGE_VALID;
2662
2663 prot = pmd_pgprot(entry);
2664
2665 if (tlb_type == hypervisor)
2666 pgprot_val(prot) |= _PAGE_SZHUGE_4V;
2667 else
2668 pgprot_val(prot) |= _PAGE_SZHUGE_4U;
2669 2617
2670 pte |= pgprot_val(prot); 2618 /* We are fabricating 8MB pages using 4MB real hw pages. */
2619 pte |= (addr & (1UL << REAL_HPAGE_SHIFT));
2671 2620
2672 mm = vma->vm_mm; 2621 mm = vma->vm_mm;
2673 2622
2674 spin_lock_irqsave(&mm->context.lock, flags); 2623 spin_lock_irqsave(&mm->context.lock, flags);
2675 2624
2676 if (mm->context.tsb_block[MM_TSB_HUGE].tsb != NULL) 2625 if (mm->context.tsb_block[MM_TSB_HUGE].tsb != NULL)
2677 __update_mmu_tsb_insert(mm, MM_TSB_HUGE, HPAGE_SHIFT, 2626 __update_mmu_tsb_insert(mm, MM_TSB_HUGE, REAL_HPAGE_SHIFT,
2678 addr, pte); 2627 addr, pte);
2679 2628
2680 spin_unlock_irqrestore(&mm->context.lock, flags); 2629 spin_unlock_irqrestore(&mm->context.lock, flags);
diff --git a/arch/sparc/mm/init_64.h b/arch/sparc/mm/init_64.h
index 0661aa606dec..5d3782deb403 100644
--- a/arch/sparc/mm/init_64.h
+++ b/arch/sparc/mm/init_64.h
@@ -1,11 +1,13 @@
1#ifndef _SPARC64_MM_INIT_H 1#ifndef _SPARC64_MM_INIT_H
2#define _SPARC64_MM_INIT_H 2#define _SPARC64_MM_INIT_H
3 3
4#include <asm/page.h>
5
4/* Most of the symbols in this file are defined in init.c and 6/* Most of the symbols in this file are defined in init.c and
5 * marked non-static so that assembler code can get at them. 7 * marked non-static so that assembler code can get at them.
6 */ 8 */
7 9
8#define MAX_PHYS_ADDRESS (1UL << 41UL) 10#define MAX_PHYS_ADDRESS (1UL << MAX_PHYS_ADDRESS_BITS)
9#define KPTE_BITMAP_CHUNK_SZ (256UL * 1024UL * 1024UL) 11#define KPTE_BITMAP_CHUNK_SZ (256UL * 1024UL * 1024UL)
10#define KPTE_BITMAP_BYTES \ 12#define KPTE_BITMAP_BYTES \
11 ((MAX_PHYS_ADDRESS / KPTE_BITMAP_CHUNK_SZ) / 4) 13 ((MAX_PHYS_ADDRESS / KPTE_BITMAP_CHUNK_SZ) / 4)
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 5d721df48a72..869023abe5a4 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -345,7 +345,10 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
345 if ((pte = (unsigned long)pte_alloc_one_kernel(mm, address)) == 0) 345 if ((pte = (unsigned long)pte_alloc_one_kernel(mm, address)) == 0)
346 return NULL; 346 return NULL;
347 page = pfn_to_page(__nocache_pa(pte) >> PAGE_SHIFT); 347 page = pfn_to_page(__nocache_pa(pte) >> PAGE_SHIFT);
348 pgtable_page_ctor(page); 348 if (!pgtable_page_ctor(page)) {
349 __free_page(page);
350 return NULL;
351 }
349 return page; 352 return page;
350} 353}
351 354
diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
index 7a91f288c708..ad3bf4b4324d 100644
--- a/arch/sparc/mm/tlb.c
+++ b/arch/sparc/mm/tlb.c
@@ -161,8 +161,8 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
161 if (mm == &init_mm) 161 if (mm == &init_mm)
162 return; 162 return;
163 163
164 if ((pmd_val(pmd) ^ pmd_val(orig)) & PMD_ISHUGE) { 164 if ((pmd_val(pmd) ^ pmd_val(orig)) & _PAGE_PMD_HUGE) {
165 if (pmd_val(pmd) & PMD_ISHUGE) 165 if (pmd_val(pmd) & _PAGE_PMD_HUGE)
166 mm->context.huge_pte_count++; 166 mm->context.huge_pte_count++;
167 else 167 else
168 mm->context.huge_pte_count--; 168 mm->context.huge_pte_count--;
@@ -178,13 +178,16 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
178 } 178 }
179 179
180 if (!pmd_none(orig)) { 180 if (!pmd_none(orig)) {
181 bool exec = ((pmd_val(orig) & PMD_HUGE_EXEC) != 0); 181 pte_t orig_pte = __pte(pmd_val(orig));
182 bool exec = pte_exec(orig_pte);
182 183
183 addr &= HPAGE_MASK; 184 addr &= HPAGE_MASK;
184 if (pmd_val(orig) & PMD_ISHUGE) 185 if (pmd_trans_huge(orig)) {
185 tlb_batch_add_one(mm, addr, exec); 186 tlb_batch_add_one(mm, addr, exec);
186 else 187 tlb_batch_add_one(mm, addr + REAL_HPAGE_SIZE, exec);
188 } else {
187 tlb_batch_pmd_scan(mm, addr, orig, exec); 189 tlb_batch_pmd_scan(mm, addr, orig, exec);
190 }
188 } 191 }
189} 192}
190 193
@@ -196,11 +199,11 @@ void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
196 assert_spin_locked(&mm->page_table_lock); 199 assert_spin_locked(&mm->page_table_lock);
197 200
198 /* FIFO */ 201 /* FIFO */
199 if (!mm->pmd_huge_pte) 202 if (!pmd_huge_pte(mm, pmdp))
200 INIT_LIST_HEAD(lh); 203 INIT_LIST_HEAD(lh);
201 else 204 else
202 list_add(lh, (struct list_head *) mm->pmd_huge_pte); 205 list_add(lh, (struct list_head *) pmd_huge_pte(mm, pmdp));
203 mm->pmd_huge_pte = pgtable; 206 pmd_huge_pte(mm, pmdp) = pgtable;
204} 207}
205 208
206pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp) 209pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp)
@@ -211,12 +214,12 @@ pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp)
211 assert_spin_locked(&mm->page_table_lock); 214 assert_spin_locked(&mm->page_table_lock);
212 215
213 /* FIFO */ 216 /* FIFO */
214 pgtable = mm->pmd_huge_pte; 217 pgtable = pmd_huge_pte(mm, pmdp);
215 lh = (struct list_head *) pgtable; 218 lh = (struct list_head *) pgtable;
216 if (list_empty(lh)) 219 if (list_empty(lh))
217 mm->pmd_huge_pte = NULL; 220 pmd_huge_pte(mm, pmdp) = NULL;
218 else { 221 else {
219 mm->pmd_huge_pte = (pgtable_t) lh->next; 222 pmd_huge_pte(mm, pmdp) = (pgtable_t) lh->next;
220 list_del(lh); 223 list_del(lh);
221 } 224 }
222 pte_val(pgtable[0]) = 0; 225 pte_val(pgtable[0]) = 0;
diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
index 2cc3bce5ee91..3b3a360b429a 100644
--- a/arch/sparc/mm/tsb.c
+++ b/arch/sparc/mm/tsb.c
@@ -87,7 +87,7 @@ void flush_tsb_user(struct tlb_batch *tb)
87 nentries = mm->context.tsb_block[MM_TSB_HUGE].tsb_nentries; 87 nentries = mm->context.tsb_block[MM_TSB_HUGE].tsb_nentries;
88 if (tlb_type == cheetah_plus || tlb_type == hypervisor) 88 if (tlb_type == cheetah_plus || tlb_type == hypervisor)
89 base = __pa(base); 89 base = __pa(base);
90 __flush_tsb_one(tb, HPAGE_SHIFT, base, nentries); 90 __flush_tsb_one(tb, REAL_HPAGE_SHIFT, base, nentries);
91 } 91 }
92#endif 92#endif
93 spin_unlock_irqrestore(&mm->context.lock, flags); 93 spin_unlock_irqrestore(&mm->context.lock, flags);
@@ -111,7 +111,7 @@ void flush_tsb_user_page(struct mm_struct *mm, unsigned long vaddr)
111 nentries = mm->context.tsb_block[MM_TSB_HUGE].tsb_nentries; 111 nentries = mm->context.tsb_block[MM_TSB_HUGE].tsb_nentries;
112 if (tlb_type == cheetah_plus || tlb_type == hypervisor) 112 if (tlb_type == cheetah_plus || tlb_type == hypervisor)
113 base = __pa(base); 113 base = __pa(base);
114 __flush_tsb_one_entry(base, vaddr, HPAGE_SHIFT, nentries); 114 __flush_tsb_one_entry(base, vaddr, REAL_HPAGE_SHIFT, nentries);
115 } 115 }
116#endif 116#endif
117 spin_unlock_irqrestore(&mm->context.lock, flags); 117 spin_unlock_irqrestore(&mm->context.lock, flags);
@@ -472,8 +472,6 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
472 mm->context.huge_pte_count = 0; 472 mm->context.huge_pte_count = 0;
473#endif 473#endif
474 474
475 mm->context.pgtable_page = NULL;
476
477 /* copy_mm() copies over the parent's mm_struct before calling 475 /* copy_mm() copies over the parent's mm_struct before calling
478 * us, so we need to zero out the TSB pointer or else tsb_grow() 476 * us, so we need to zero out the TSB pointer or else tsb_grow()
479 * will be confused and think there is an older TSB to free up. 477 * will be confused and think there is an older TSB to free up.
@@ -512,17 +510,10 @@ static void tsb_destroy_one(struct tsb_config *tp)
512void destroy_context(struct mm_struct *mm) 510void destroy_context(struct mm_struct *mm)
513{ 511{
514 unsigned long flags, i; 512 unsigned long flags, i;
515 struct page *page;
516 513
517 for (i = 0; i < MM_NUM_TSBS; i++) 514 for (i = 0; i < MM_NUM_TSBS; i++)
518 tsb_destroy_one(&mm->context.tsb_block[i]); 515 tsb_destroy_one(&mm->context.tsb_block[i]);
519 516
520 page = mm->context.pgtable_page;
521 if (page && put_page_testzero(page)) {
522 pgtable_page_dtor(page);
523 free_hot_cold_page(page, 0);
524 }
525
526 spin_lock_irqsave(&ctx_alloc_lock, flags); 517 spin_lock_irqsave(&ctx_alloc_lock, flags);
527 518
528 if (CTX_VALID(mm->context)) { 519 if (CTX_VALID(mm->context)) {
diff --git a/arch/sparc/mm/ultra.S b/arch/sparc/mm/ultra.S
index 432aa0cb1b38..b4f4733abc6e 100644
--- a/arch/sparc/mm/ultra.S
+++ b/arch/sparc/mm/ultra.S
@@ -153,10 +153,10 @@ __spitfire_flush_tlb_mm_slow:
153 .globl __flush_icache_page 153 .globl __flush_icache_page
154__flush_icache_page: /* %o0 = phys_page */ 154__flush_icache_page: /* %o0 = phys_page */
155 srlx %o0, PAGE_SHIFT, %o0 155 srlx %o0, PAGE_SHIFT, %o0
156 sethi %uhi(PAGE_OFFSET), %g1 156 sethi %hi(PAGE_OFFSET), %g1
157 sllx %o0, PAGE_SHIFT, %o0 157 sllx %o0, PAGE_SHIFT, %o0
158 sethi %hi(PAGE_SIZE), %g2 158 sethi %hi(PAGE_SIZE), %g2
159 sllx %g1, 32, %g1 159 ldx [%g1 + %lo(PAGE_OFFSET)], %g1
160 add %o0, %g1, %o0 160 add %o0, %g1, %o0
1611: subcc %g2, 32, %g2 1611: subcc %g2, 32, %g2
162 bne,pt %icc, 1b 162 bne,pt %icc, 1b
@@ -178,8 +178,8 @@ __flush_icache_page: /* %o0 = phys_page */
178 .align 64 178 .align 64
179 .globl __flush_dcache_page 179 .globl __flush_dcache_page
180__flush_dcache_page: /* %o0=kaddr, %o1=flush_icache */ 180__flush_dcache_page: /* %o0=kaddr, %o1=flush_icache */
181 sethi %uhi(PAGE_OFFSET), %g1 181 sethi %hi(PAGE_OFFSET), %g1
182 sllx %g1, 32, %g1 182 ldx [%g1 + %lo(PAGE_OFFSET)], %g1
183 sub %o0, %g1, %o0 ! physical address 183 sub %o0, %g1, %o0 ! physical address
184 srlx %o0, 11, %o0 ! make D-cache TAG 184 srlx %o0, 11, %o0 ! make D-cache TAG
185 sethi %hi(1 << 14), %o2 ! D-cache size 185 sethi %hi(1 << 14), %o2 ! D-cache size
@@ -287,8 +287,8 @@ __cheetah_flush_tlb_pending: /* 27 insns */
287 287
288#ifdef DCACHE_ALIASING_POSSIBLE 288#ifdef DCACHE_ALIASING_POSSIBLE
289__cheetah_flush_dcache_page: /* 11 insns */ 289__cheetah_flush_dcache_page: /* 11 insns */
290 sethi %uhi(PAGE_OFFSET), %g1 290 sethi %hi(PAGE_OFFSET), %g1
291 sllx %g1, 32, %g1 291 ldx [%g1 + %lo(PAGE_OFFSET)], %g1
292 sub %o0, %g1, %o0 292 sub %o0, %g1, %o0
293 sethi %hi(PAGE_SIZE), %o4 293 sethi %hi(PAGE_SIZE), %o4
2941: subcc %o4, (1 << 5), %o4 2941: subcc %o4, (1 << 5), %o4
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c
index 9c7be59e6f5a..218b6b23c378 100644
--- a/arch/sparc/net/bpf_jit_comp.c
+++ b/arch/sparc/net/bpf_jit_comp.c
@@ -808,4 +808,5 @@ void bpf_jit_free(struct sk_filter *fp)
808{ 808{
809 if (fp->bpf_func != sk_run_filter) 809 if (fp->bpf_func != sk_run_filter)
810 module_free(NULL, fp->bpf_func); 810 module_free(NULL, fp->bpf_func);
811 kfree(fp);
811} 812}
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 8a7cc663b3f8..b3692ce78f90 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -8,7 +8,6 @@ config TILE
8 select HAVE_KVM if !TILEGX 8 select HAVE_KVM if !TILEGX
9 select GENERIC_FIND_FIRST_BIT 9 select GENERIC_FIND_FIRST_BIT
10 select SYSCTL_EXCEPTION_TRACE 10 select SYSCTL_EXCEPTION_TRACE
11 select USE_GENERIC_SMP_HELPERS
12 select CC_OPTIMIZE_FOR_SIZE 11 select CC_OPTIMIZE_FOR_SIZE
13 select HAVE_DEBUG_KMEMLEAK 12 select HAVE_DEBUG_KMEMLEAK
14 select GENERIC_IRQ_PROBE 13 select GENERIC_IRQ_PROBE
@@ -361,7 +360,7 @@ config CMDLINE_OVERRIDE
361 360
362config VMALLOC_RESERVE 361config VMALLOC_RESERVE
363 hex 362 hex
364 default 0x1000000 363 default 0x2000000
365 364
366config HARDWALL 365config HARDWALL
367 bool "Hardwall support to allow access to user dynamic network" 366 bool "Hardwall support to allow access to user dynamic network"
diff --git a/arch/tile/gxio/iorpc_mpipe.c b/arch/tile/gxio/iorpc_mpipe.c
index 4f8f3d619c4a..e19325c4c431 100644
--- a/arch/tile/gxio/iorpc_mpipe.c
+++ b/arch/tile/gxio/iorpc_mpipe.c
@@ -21,7 +21,7 @@ struct alloc_buffer_stacks_param {
21 unsigned int flags; 21 unsigned int flags;
22}; 22};
23 23
24int gxio_mpipe_alloc_buffer_stacks(gxio_mpipe_context_t * context, 24int gxio_mpipe_alloc_buffer_stacks(gxio_mpipe_context_t *context,
25 unsigned int count, unsigned int first, 25 unsigned int count, unsigned int first,
26 unsigned int flags) 26 unsigned int flags)
27{ 27{
@@ -45,7 +45,7 @@ struct init_buffer_stack_aux_param {
45 unsigned int buffer_size_enum; 45 unsigned int buffer_size_enum;
46}; 46};
47 47
48int gxio_mpipe_init_buffer_stack_aux(gxio_mpipe_context_t * context, 48int gxio_mpipe_init_buffer_stack_aux(gxio_mpipe_context_t *context,
49 void *mem_va, size_t mem_size, 49 void *mem_va, size_t mem_size,
50 unsigned int mem_flags, unsigned int stack, 50 unsigned int mem_flags, unsigned int stack,
51 unsigned int buffer_size_enum) 51 unsigned int buffer_size_enum)
@@ -80,7 +80,7 @@ struct alloc_notif_rings_param {
80 unsigned int flags; 80 unsigned int flags;
81}; 81};
82 82
83int gxio_mpipe_alloc_notif_rings(gxio_mpipe_context_t * context, 83int gxio_mpipe_alloc_notif_rings(gxio_mpipe_context_t *context,
84 unsigned int count, unsigned int first, 84 unsigned int count, unsigned int first,
85 unsigned int flags) 85 unsigned int flags)
86{ 86{
@@ -102,7 +102,7 @@ struct init_notif_ring_aux_param {
102 unsigned int ring; 102 unsigned int ring;
103}; 103};
104 104
105int gxio_mpipe_init_notif_ring_aux(gxio_mpipe_context_t * context, void *mem_va, 105int gxio_mpipe_init_notif_ring_aux(gxio_mpipe_context_t *context, void *mem_va,
106 size_t mem_size, unsigned int mem_flags, 106 size_t mem_size, unsigned int mem_flags,
107 unsigned int ring) 107 unsigned int ring)
108{ 108{
@@ -133,7 +133,7 @@ struct request_notif_ring_interrupt_param {
133 unsigned int ring; 133 unsigned int ring;
134}; 134};
135 135
136int gxio_mpipe_request_notif_ring_interrupt(gxio_mpipe_context_t * context, 136int gxio_mpipe_request_notif_ring_interrupt(gxio_mpipe_context_t *context,
137 int inter_x, int inter_y, 137 int inter_x, int inter_y,
138 int inter_ipi, int inter_event, 138 int inter_ipi, int inter_event,
139 unsigned int ring) 139 unsigned int ring)
@@ -158,7 +158,7 @@ struct enable_notif_ring_interrupt_param {
158 unsigned int ring; 158 unsigned int ring;
159}; 159};
160 160
161int gxio_mpipe_enable_notif_ring_interrupt(gxio_mpipe_context_t * context, 161int gxio_mpipe_enable_notif_ring_interrupt(gxio_mpipe_context_t *context,
162 unsigned int ring) 162 unsigned int ring)
163{ 163{
164 struct enable_notif_ring_interrupt_param temp; 164 struct enable_notif_ring_interrupt_param temp;
@@ -179,7 +179,7 @@ struct alloc_notif_groups_param {
179 unsigned int flags; 179 unsigned int flags;
180}; 180};
181 181
182int gxio_mpipe_alloc_notif_groups(gxio_mpipe_context_t * context, 182int gxio_mpipe_alloc_notif_groups(gxio_mpipe_context_t *context,
183 unsigned int count, unsigned int first, 183 unsigned int count, unsigned int first,
184 unsigned int flags) 184 unsigned int flags)
185{ 185{
@@ -201,7 +201,7 @@ struct init_notif_group_param {
201 gxio_mpipe_notif_group_bits_t bits; 201 gxio_mpipe_notif_group_bits_t bits;
202}; 202};
203 203
204int gxio_mpipe_init_notif_group(gxio_mpipe_context_t * context, 204int gxio_mpipe_init_notif_group(gxio_mpipe_context_t *context,
205 unsigned int group, 205 unsigned int group,
206 gxio_mpipe_notif_group_bits_t bits) 206 gxio_mpipe_notif_group_bits_t bits)
207{ 207{
@@ -223,7 +223,7 @@ struct alloc_buckets_param {
223 unsigned int flags; 223 unsigned int flags;
224}; 224};
225 225
226int gxio_mpipe_alloc_buckets(gxio_mpipe_context_t * context, unsigned int count, 226int gxio_mpipe_alloc_buckets(gxio_mpipe_context_t *context, unsigned int count,
227 unsigned int first, unsigned int flags) 227 unsigned int first, unsigned int flags)
228{ 228{
229 struct alloc_buckets_param temp; 229 struct alloc_buckets_param temp;
@@ -244,7 +244,7 @@ struct init_bucket_param {
244 MPIPE_LBL_INIT_DAT_BSTS_TBL_t bucket_info; 244 MPIPE_LBL_INIT_DAT_BSTS_TBL_t bucket_info;
245}; 245};
246 246
247int gxio_mpipe_init_bucket(gxio_mpipe_context_t * context, unsigned int bucket, 247int gxio_mpipe_init_bucket(gxio_mpipe_context_t *context, unsigned int bucket,
248 MPIPE_LBL_INIT_DAT_BSTS_TBL_t bucket_info) 248 MPIPE_LBL_INIT_DAT_BSTS_TBL_t bucket_info)
249{ 249{
250 struct init_bucket_param temp; 250 struct init_bucket_param temp;
@@ -265,7 +265,7 @@ struct alloc_edma_rings_param {
265 unsigned int flags; 265 unsigned int flags;
266}; 266};
267 267
268int gxio_mpipe_alloc_edma_rings(gxio_mpipe_context_t * context, 268int gxio_mpipe_alloc_edma_rings(gxio_mpipe_context_t *context,
269 unsigned int count, unsigned int first, 269 unsigned int count, unsigned int first,
270 unsigned int flags) 270 unsigned int flags)
271{ 271{
@@ -288,7 +288,7 @@ struct init_edma_ring_aux_param {
288 unsigned int channel; 288 unsigned int channel;
289}; 289};
290 290
291int gxio_mpipe_init_edma_ring_aux(gxio_mpipe_context_t * context, void *mem_va, 291int gxio_mpipe_init_edma_ring_aux(gxio_mpipe_context_t *context, void *mem_va,
292 size_t mem_size, unsigned int mem_flags, 292 size_t mem_size, unsigned int mem_flags,
293 unsigned int ring, unsigned int channel) 293 unsigned int ring, unsigned int channel)
294{ 294{
@@ -315,7 +315,7 @@ int gxio_mpipe_init_edma_ring_aux(gxio_mpipe_context_t * context, void *mem_va,
315EXPORT_SYMBOL(gxio_mpipe_init_edma_ring_aux); 315EXPORT_SYMBOL(gxio_mpipe_init_edma_ring_aux);
316 316
317 317
318int gxio_mpipe_commit_rules(gxio_mpipe_context_t * context, const void *blob, 318int gxio_mpipe_commit_rules(gxio_mpipe_context_t *context, const void *blob,
319 size_t blob_size) 319 size_t blob_size)
320{ 320{
321 const void *params = blob; 321 const void *params = blob;
@@ -332,7 +332,7 @@ struct register_client_memory_param {
332 unsigned int flags; 332 unsigned int flags;
333}; 333};
334 334
335int gxio_mpipe_register_client_memory(gxio_mpipe_context_t * context, 335int gxio_mpipe_register_client_memory(gxio_mpipe_context_t *context,
336 unsigned int iotlb, HV_PTE pte, 336 unsigned int iotlb, HV_PTE pte,
337 unsigned int flags) 337 unsigned int flags)
338{ 338{
@@ -355,7 +355,7 @@ struct link_open_aux_param {
355 unsigned int flags; 355 unsigned int flags;
356}; 356};
357 357
358int gxio_mpipe_link_open_aux(gxio_mpipe_context_t * context, 358int gxio_mpipe_link_open_aux(gxio_mpipe_context_t *context,
359 _gxio_mpipe_link_name_t name, unsigned int flags) 359 _gxio_mpipe_link_name_t name, unsigned int flags)
360{ 360{
361 struct link_open_aux_param temp; 361 struct link_open_aux_param temp;
@@ -374,7 +374,7 @@ struct link_close_aux_param {
374 int mac; 374 int mac;
375}; 375};
376 376
377int gxio_mpipe_link_close_aux(gxio_mpipe_context_t * context, int mac) 377int gxio_mpipe_link_close_aux(gxio_mpipe_context_t *context, int mac)
378{ 378{
379 struct link_close_aux_param temp; 379 struct link_close_aux_param temp;
380 struct link_close_aux_param *params = &temp; 380 struct link_close_aux_param *params = &temp;
@@ -393,7 +393,7 @@ struct link_set_attr_aux_param {
393 int64_t val; 393 int64_t val;
394}; 394};
395 395
396int gxio_mpipe_link_set_attr_aux(gxio_mpipe_context_t * context, int mac, 396int gxio_mpipe_link_set_attr_aux(gxio_mpipe_context_t *context, int mac,
397 uint32_t attr, int64_t val) 397 uint32_t attr, int64_t val)
398{ 398{
399 struct link_set_attr_aux_param temp; 399 struct link_set_attr_aux_param temp;
@@ -415,8 +415,8 @@ struct get_timestamp_aux_param {
415 uint64_t cycles; 415 uint64_t cycles;
416}; 416};
417 417
418int gxio_mpipe_get_timestamp_aux(gxio_mpipe_context_t * context, uint64_t * sec, 418int gxio_mpipe_get_timestamp_aux(gxio_mpipe_context_t *context, uint64_t *sec,
419 uint64_t * nsec, uint64_t * cycles) 419 uint64_t *nsec, uint64_t *cycles)
420{ 420{
421 int __result; 421 int __result;
422 struct get_timestamp_aux_param temp; 422 struct get_timestamp_aux_param temp;
@@ -440,7 +440,7 @@ struct set_timestamp_aux_param {
440 uint64_t cycles; 440 uint64_t cycles;
441}; 441};
442 442
443int gxio_mpipe_set_timestamp_aux(gxio_mpipe_context_t * context, uint64_t sec, 443int gxio_mpipe_set_timestamp_aux(gxio_mpipe_context_t *context, uint64_t sec,
444 uint64_t nsec, uint64_t cycles) 444 uint64_t nsec, uint64_t cycles)
445{ 445{
446 struct set_timestamp_aux_param temp; 446 struct set_timestamp_aux_param temp;
@@ -460,8 +460,7 @@ struct adjust_timestamp_aux_param {
460 int64_t nsec; 460 int64_t nsec;
461}; 461};
462 462
463int gxio_mpipe_adjust_timestamp_aux(gxio_mpipe_context_t * context, 463int gxio_mpipe_adjust_timestamp_aux(gxio_mpipe_context_t *context, int64_t nsec)
464 int64_t nsec)
465{ 464{
466 struct adjust_timestamp_aux_param temp; 465 struct adjust_timestamp_aux_param temp;
467 struct adjust_timestamp_aux_param *params = &temp; 466 struct adjust_timestamp_aux_param *params = &temp;
@@ -475,25 +474,6 @@ int gxio_mpipe_adjust_timestamp_aux(gxio_mpipe_context_t * context,
475 474
476EXPORT_SYMBOL(gxio_mpipe_adjust_timestamp_aux); 475EXPORT_SYMBOL(gxio_mpipe_adjust_timestamp_aux);
477 476
478struct adjust_timestamp_freq_param {
479 int32_t ppb;
480};
481
482int gxio_mpipe_adjust_timestamp_freq(gxio_mpipe_context_t * context,
483 int32_t ppb)
484{
485 struct adjust_timestamp_freq_param temp;
486 struct adjust_timestamp_freq_param *params = &temp;
487
488 params->ppb = ppb;
489
490 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
491 sizeof(*params),
492 GXIO_MPIPE_OP_ADJUST_TIMESTAMP_FREQ);
493}
494
495EXPORT_SYMBOL(gxio_mpipe_adjust_timestamp_freq);
496
497struct config_edma_ring_blks_param { 477struct config_edma_ring_blks_param {
498 unsigned int ering; 478 unsigned int ering;
499 unsigned int max_blks; 479 unsigned int max_blks;
@@ -501,7 +481,7 @@ struct config_edma_ring_blks_param {
501 unsigned int db; 481 unsigned int db;
502}; 482};
503 483
504int gxio_mpipe_config_edma_ring_blks(gxio_mpipe_context_t * context, 484int gxio_mpipe_config_edma_ring_blks(gxio_mpipe_context_t *context,
505 unsigned int ering, unsigned int max_blks, 485 unsigned int ering, unsigned int max_blks,
506 unsigned int min_snf_blks, unsigned int db) 486 unsigned int min_snf_blks, unsigned int db)
507{ 487{
@@ -520,11 +500,29 @@ int gxio_mpipe_config_edma_ring_blks(gxio_mpipe_context_t * context,
520 500
521EXPORT_SYMBOL(gxio_mpipe_config_edma_ring_blks); 501EXPORT_SYMBOL(gxio_mpipe_config_edma_ring_blks);
522 502
503struct adjust_timestamp_freq_param {
504 int32_t ppb;
505};
506
507int gxio_mpipe_adjust_timestamp_freq(gxio_mpipe_context_t *context, int32_t ppb)
508{
509 struct adjust_timestamp_freq_param temp;
510 struct adjust_timestamp_freq_param *params = &temp;
511
512 params->ppb = ppb;
513
514 return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
515 sizeof(*params),
516 GXIO_MPIPE_OP_ADJUST_TIMESTAMP_FREQ);
517}
518
519EXPORT_SYMBOL(gxio_mpipe_adjust_timestamp_freq);
520
523struct arm_pollfd_param { 521struct arm_pollfd_param {
524 union iorpc_pollfd pollfd; 522 union iorpc_pollfd pollfd;
525}; 523};
526 524
527int gxio_mpipe_arm_pollfd(gxio_mpipe_context_t * context, int pollfd_cookie) 525int gxio_mpipe_arm_pollfd(gxio_mpipe_context_t *context, int pollfd_cookie)
528{ 526{
529 struct arm_pollfd_param temp; 527 struct arm_pollfd_param temp;
530 struct arm_pollfd_param *params = &temp; 528 struct arm_pollfd_param *params = &temp;
@@ -541,7 +539,7 @@ struct close_pollfd_param {
541 union iorpc_pollfd pollfd; 539 union iorpc_pollfd pollfd;
542}; 540};
543 541
544int gxio_mpipe_close_pollfd(gxio_mpipe_context_t * context, int pollfd_cookie) 542int gxio_mpipe_close_pollfd(gxio_mpipe_context_t *context, int pollfd_cookie)
545{ 543{
546 struct close_pollfd_param temp; 544 struct close_pollfd_param temp;
547 struct close_pollfd_param *params = &temp; 545 struct close_pollfd_param *params = &temp;
@@ -558,7 +556,7 @@ struct get_mmio_base_param {
558 HV_PTE base; 556 HV_PTE base;
559}; 557};
560 558
561int gxio_mpipe_get_mmio_base(gxio_mpipe_context_t * context, HV_PTE *base) 559int gxio_mpipe_get_mmio_base(gxio_mpipe_context_t *context, HV_PTE *base)
562{ 560{
563 int __result; 561 int __result;
564 struct get_mmio_base_param temp; 562 struct get_mmio_base_param temp;
@@ -579,7 +577,7 @@ struct check_mmio_offset_param {
579 unsigned long size; 577 unsigned long size;
580}; 578};
581 579
582int gxio_mpipe_check_mmio_offset(gxio_mpipe_context_t * context, 580int gxio_mpipe_check_mmio_offset(gxio_mpipe_context_t *context,
583 unsigned long offset, unsigned long size) 581 unsigned long offset, unsigned long size)
584{ 582{
585 struct check_mmio_offset_param temp; 583 struct check_mmio_offset_param temp;
diff --git a/arch/tile/gxio/iorpc_mpipe_info.c b/arch/tile/gxio/iorpc_mpipe_info.c
index 64883aabeb9c..77019c6e9b4a 100644
--- a/arch/tile/gxio/iorpc_mpipe_info.c
+++ b/arch/tile/gxio/iorpc_mpipe_info.c
@@ -15,12 +15,11 @@
15/* This file is machine-generated; DO NOT EDIT! */ 15/* This file is machine-generated; DO NOT EDIT! */
16#include "gxio/iorpc_mpipe_info.h" 16#include "gxio/iorpc_mpipe_info.h"
17 17
18
19struct instance_aux_param { 18struct instance_aux_param {
20 _gxio_mpipe_link_name_t name; 19 _gxio_mpipe_link_name_t name;
21}; 20};
22 21
23int gxio_mpipe_info_instance_aux(gxio_mpipe_info_context_t * context, 22int gxio_mpipe_info_instance_aux(gxio_mpipe_info_context_t *context,
24 _gxio_mpipe_link_name_t name) 23 _gxio_mpipe_link_name_t name)
25{ 24{
26 struct instance_aux_param temp; 25 struct instance_aux_param temp;
@@ -39,10 +38,10 @@ struct enumerate_aux_param {
39 _gxio_mpipe_link_mac_t mac; 38 _gxio_mpipe_link_mac_t mac;
40}; 39};
41 40
42int gxio_mpipe_info_enumerate_aux(gxio_mpipe_info_context_t * context, 41int gxio_mpipe_info_enumerate_aux(gxio_mpipe_info_context_t *context,
43 unsigned int idx, 42 unsigned int idx,
44 _gxio_mpipe_link_name_t * name, 43 _gxio_mpipe_link_name_t *name,
45 _gxio_mpipe_link_mac_t * mac) 44 _gxio_mpipe_link_mac_t *mac)
46{ 45{
47 int __result; 46 int __result;
48 struct enumerate_aux_param temp; 47 struct enumerate_aux_param temp;
@@ -50,7 +49,7 @@ int gxio_mpipe_info_enumerate_aux(gxio_mpipe_info_context_t * context,
50 49
51 __result = 50 __result =
52 hv_dev_pread(context->fd, 0, (HV_VirtAddr) params, sizeof(*params), 51 hv_dev_pread(context->fd, 0, (HV_VirtAddr) params, sizeof(*params),
53 (((uint64_t) idx << 32) | 52 (((uint64_t)idx << 32) |
54 GXIO_MPIPE_INFO_OP_ENUMERATE_AUX)); 53 GXIO_MPIPE_INFO_OP_ENUMERATE_AUX));
55 *name = params->name; 54 *name = params->name;
56 *mac = params->mac; 55 *mac = params->mac;
@@ -64,7 +63,7 @@ struct get_mmio_base_param {
64 HV_PTE base; 63 HV_PTE base;
65}; 64};
66 65
67int gxio_mpipe_info_get_mmio_base(gxio_mpipe_info_context_t * context, 66int gxio_mpipe_info_get_mmio_base(gxio_mpipe_info_context_t *context,
68 HV_PTE *base) 67 HV_PTE *base)
69{ 68{
70 int __result; 69 int __result;
@@ -86,7 +85,7 @@ struct check_mmio_offset_param {
86 unsigned long size; 85 unsigned long size;
87}; 86};
88 87
89int gxio_mpipe_info_check_mmio_offset(gxio_mpipe_info_context_t * context, 88int gxio_mpipe_info_check_mmio_offset(gxio_mpipe_info_context_t *context,
90 unsigned long offset, unsigned long size) 89 unsigned long offset, unsigned long size)
91{ 90{
92 struct check_mmio_offset_param temp; 91 struct check_mmio_offset_param temp;
diff --git a/arch/tile/gxio/iorpc_trio.c b/arch/tile/gxio/iorpc_trio.c
index da6e18e049c3..1d3cedb9aeb4 100644
--- a/arch/tile/gxio/iorpc_trio.c
+++ b/arch/tile/gxio/iorpc_trio.c
@@ -21,7 +21,7 @@ struct alloc_asids_param {
21 unsigned int flags; 21 unsigned int flags;
22}; 22};
23 23
24int gxio_trio_alloc_asids(gxio_trio_context_t * context, unsigned int count, 24int gxio_trio_alloc_asids(gxio_trio_context_t *context, unsigned int count,
25 unsigned int first, unsigned int flags) 25 unsigned int first, unsigned int flags)
26{ 26{
27 struct alloc_asids_param temp; 27 struct alloc_asids_param temp;
@@ -44,7 +44,7 @@ struct alloc_memory_maps_param {
44 unsigned int flags; 44 unsigned int flags;
45}; 45};
46 46
47int gxio_trio_alloc_memory_maps(gxio_trio_context_t * context, 47int gxio_trio_alloc_memory_maps(gxio_trio_context_t *context,
48 unsigned int count, unsigned int first, 48 unsigned int count, unsigned int first,
49 unsigned int flags) 49 unsigned int flags)
50{ 50{
@@ -67,7 +67,7 @@ struct alloc_scatter_queues_param {
67 unsigned int flags; 67 unsigned int flags;
68}; 68};
69 69
70int gxio_trio_alloc_scatter_queues(gxio_trio_context_t * context, 70int gxio_trio_alloc_scatter_queues(gxio_trio_context_t *context,
71 unsigned int count, unsigned int first, 71 unsigned int count, unsigned int first,
72 unsigned int flags) 72 unsigned int flags)
73{ 73{
@@ -91,7 +91,7 @@ struct alloc_pio_regions_param {
91 unsigned int flags; 91 unsigned int flags;
92}; 92};
93 93
94int gxio_trio_alloc_pio_regions(gxio_trio_context_t * context, 94int gxio_trio_alloc_pio_regions(gxio_trio_context_t *context,
95 unsigned int count, unsigned int first, 95 unsigned int count, unsigned int first,
96 unsigned int flags) 96 unsigned int flags)
97{ 97{
@@ -115,7 +115,7 @@ struct init_pio_region_aux_param {
115 unsigned int flags; 115 unsigned int flags;
116}; 116};
117 117
118int gxio_trio_init_pio_region_aux(gxio_trio_context_t * context, 118int gxio_trio_init_pio_region_aux(gxio_trio_context_t *context,
119 unsigned int pio_region, unsigned int mac, 119 unsigned int pio_region, unsigned int mac,
120 uint32_t bus_address_hi, unsigned int flags) 120 uint32_t bus_address_hi, unsigned int flags)
121{ 121{
@@ -145,7 +145,7 @@ struct init_memory_map_mmu_aux_param {
145 unsigned int order_mode; 145 unsigned int order_mode;
146}; 146};
147 147
148int gxio_trio_init_memory_map_mmu_aux(gxio_trio_context_t * context, 148int gxio_trio_init_memory_map_mmu_aux(gxio_trio_context_t *context,
149 unsigned int map, unsigned long va, 149 unsigned int map, unsigned long va,
150 uint64_t size, unsigned int asid, 150 uint64_t size, unsigned int asid,
151 unsigned int mac, uint64_t bus_address, 151 unsigned int mac, uint64_t bus_address,
@@ -175,7 +175,7 @@ struct get_port_property_param {
175 struct pcie_trio_ports_property trio_ports; 175 struct pcie_trio_ports_property trio_ports;
176}; 176};
177 177
178int gxio_trio_get_port_property(gxio_trio_context_t * context, 178int gxio_trio_get_port_property(gxio_trio_context_t *context,
179 struct pcie_trio_ports_property *trio_ports) 179 struct pcie_trio_ports_property *trio_ports)
180{ 180{
181 int __result; 181 int __result;
@@ -198,7 +198,7 @@ struct config_legacy_intr_param {
198 unsigned int intx; 198 unsigned int intx;
199}; 199};
200 200
201int gxio_trio_config_legacy_intr(gxio_trio_context_t * context, int inter_x, 201int gxio_trio_config_legacy_intr(gxio_trio_context_t *context, int inter_x,
202 int inter_y, int inter_ipi, int inter_event, 202 int inter_y, int inter_ipi, int inter_event,
203 unsigned int mac, unsigned int intx) 203 unsigned int mac, unsigned int intx)
204{ 204{
@@ -227,7 +227,7 @@ struct config_msi_intr_param {
227 unsigned int asid; 227 unsigned int asid;
228}; 228};
229 229
230int gxio_trio_config_msi_intr(gxio_trio_context_t * context, int inter_x, 230int gxio_trio_config_msi_intr(gxio_trio_context_t *context, int inter_x,
231 int inter_y, int inter_ipi, int inter_event, 231 int inter_y, int inter_ipi, int inter_event,
232 unsigned int mac, unsigned int mem_map, 232 unsigned int mac, unsigned int mem_map,
233 uint64_t mem_map_base, uint64_t mem_map_limit, 233 uint64_t mem_map_base, uint64_t mem_map_limit,
@@ -259,7 +259,7 @@ struct set_mps_mrs_param {
259 unsigned int mac; 259 unsigned int mac;
260}; 260};
261 261
262int gxio_trio_set_mps_mrs(gxio_trio_context_t * context, uint16_t mps, 262int gxio_trio_set_mps_mrs(gxio_trio_context_t *context, uint16_t mps,
263 uint16_t mrs, unsigned int mac) 263 uint16_t mrs, unsigned int mac)
264{ 264{
265 struct set_mps_mrs_param temp; 265 struct set_mps_mrs_param temp;
@@ -279,7 +279,7 @@ struct force_rc_link_up_param {
279 unsigned int mac; 279 unsigned int mac;
280}; 280};
281 281
282int gxio_trio_force_rc_link_up(gxio_trio_context_t * context, unsigned int mac) 282int gxio_trio_force_rc_link_up(gxio_trio_context_t *context, unsigned int mac)
283{ 283{
284 struct force_rc_link_up_param temp; 284 struct force_rc_link_up_param temp;
285 struct force_rc_link_up_param *params = &temp; 285 struct force_rc_link_up_param *params = &temp;
@@ -296,7 +296,7 @@ struct force_ep_link_up_param {
296 unsigned int mac; 296 unsigned int mac;
297}; 297};
298 298
299int gxio_trio_force_ep_link_up(gxio_trio_context_t * context, unsigned int mac) 299int gxio_trio_force_ep_link_up(gxio_trio_context_t *context, unsigned int mac)
300{ 300{
301 struct force_ep_link_up_param temp; 301 struct force_ep_link_up_param temp;
302 struct force_ep_link_up_param *params = &temp; 302 struct force_ep_link_up_param *params = &temp;
@@ -313,7 +313,7 @@ struct get_mmio_base_param {
313 HV_PTE base; 313 HV_PTE base;
314}; 314};
315 315
316int gxio_trio_get_mmio_base(gxio_trio_context_t * context, HV_PTE *base) 316int gxio_trio_get_mmio_base(gxio_trio_context_t *context, HV_PTE *base)
317{ 317{
318 int __result; 318 int __result;
319 struct get_mmio_base_param temp; 319 struct get_mmio_base_param temp;
@@ -334,7 +334,7 @@ struct check_mmio_offset_param {
334 unsigned long size; 334 unsigned long size;
335}; 335};
336 336
337int gxio_trio_check_mmio_offset(gxio_trio_context_t * context, 337int gxio_trio_check_mmio_offset(gxio_trio_context_t *context,
338 unsigned long offset, unsigned long size) 338 unsigned long offset, unsigned long size)
339{ 339{
340 struct check_mmio_offset_param temp; 340 struct check_mmio_offset_param temp;
diff --git a/arch/tile/gxio/iorpc_usb_host.c b/arch/tile/gxio/iorpc_usb_host.c
index cf3c3cc12204..9c820073bfc0 100644
--- a/arch/tile/gxio/iorpc_usb_host.c
+++ b/arch/tile/gxio/iorpc_usb_host.c
@@ -19,7 +19,7 @@ struct cfg_interrupt_param {
19 union iorpc_interrupt interrupt; 19 union iorpc_interrupt interrupt;
20}; 20};
21 21
22int gxio_usb_host_cfg_interrupt(gxio_usb_host_context_t * context, int inter_x, 22int gxio_usb_host_cfg_interrupt(gxio_usb_host_context_t *context, int inter_x,
23 int inter_y, int inter_ipi, int inter_event) 23 int inter_y, int inter_ipi, int inter_event)
24{ 24{
25 struct cfg_interrupt_param temp; 25 struct cfg_interrupt_param temp;
@@ -41,7 +41,7 @@ struct register_client_memory_param {
41 unsigned int flags; 41 unsigned int flags;
42}; 42};
43 43
44int gxio_usb_host_register_client_memory(gxio_usb_host_context_t * context, 44int gxio_usb_host_register_client_memory(gxio_usb_host_context_t *context,
45 HV_PTE pte, unsigned int flags) 45 HV_PTE pte, unsigned int flags)
46{ 46{
47 struct register_client_memory_param temp; 47 struct register_client_memory_param temp;
@@ -61,7 +61,7 @@ struct get_mmio_base_param {
61 HV_PTE base; 61 HV_PTE base;
62}; 62};
63 63
64int gxio_usb_host_get_mmio_base(gxio_usb_host_context_t * context, HV_PTE *base) 64int gxio_usb_host_get_mmio_base(gxio_usb_host_context_t *context, HV_PTE *base)
65{ 65{
66 int __result; 66 int __result;
67 struct get_mmio_base_param temp; 67 struct get_mmio_base_param temp;
@@ -82,7 +82,7 @@ struct check_mmio_offset_param {
82 unsigned long size; 82 unsigned long size;
83}; 83};
84 84
85int gxio_usb_host_check_mmio_offset(gxio_usb_host_context_t * context, 85int gxio_usb_host_check_mmio_offset(gxio_usb_host_context_t *context,
86 unsigned long offset, unsigned long size) 86 unsigned long offset, unsigned long size)
87{ 87{
88 struct check_mmio_offset_param temp; 88 struct check_mmio_offset_param temp;
diff --git a/arch/tile/gxio/usb_host.c b/arch/tile/gxio/usb_host.c
index 66b002f54ecc..785afad7922e 100644
--- a/arch/tile/gxio/usb_host.c
+++ b/arch/tile/gxio/usb_host.c
@@ -26,7 +26,7 @@
26#include <gxio/kiorpc.h> 26#include <gxio/kiorpc.h>
27#include <gxio/usb_host.h> 27#include <gxio/usb_host.h>
28 28
29int gxio_usb_host_init(gxio_usb_host_context_t * context, int usb_index, 29int gxio_usb_host_init(gxio_usb_host_context_t *context, int usb_index,
30 int is_ehci) 30 int is_ehci)
31{ 31{
32 char file[32]; 32 char file[32];
@@ -63,7 +63,7 @@ int gxio_usb_host_init(gxio_usb_host_context_t * context, int usb_index,
63 63
64EXPORT_SYMBOL_GPL(gxio_usb_host_init); 64EXPORT_SYMBOL_GPL(gxio_usb_host_init);
65 65
66int gxio_usb_host_destroy(gxio_usb_host_context_t * context) 66int gxio_usb_host_destroy(gxio_usb_host_context_t *context)
67{ 67{
68 iounmap((void __force __iomem *)(context->mmio_base)); 68 iounmap((void __force __iomem *)(context->mmio_base));
69 hv_dev_close(context->fd); 69 hv_dev_close(context->fd);
@@ -76,14 +76,14 @@ int gxio_usb_host_destroy(gxio_usb_host_context_t * context)
76 76
77EXPORT_SYMBOL_GPL(gxio_usb_host_destroy); 77EXPORT_SYMBOL_GPL(gxio_usb_host_destroy);
78 78
79void *gxio_usb_host_get_reg_start(gxio_usb_host_context_t * context) 79void *gxio_usb_host_get_reg_start(gxio_usb_host_context_t *context)
80{ 80{
81 return context->mmio_base; 81 return context->mmio_base;
82} 82}
83 83
84EXPORT_SYMBOL_GPL(gxio_usb_host_get_reg_start); 84EXPORT_SYMBOL_GPL(gxio_usb_host_get_reg_start);
85 85
86size_t gxio_usb_host_get_reg_len(gxio_usb_host_context_t * context) 86size_t gxio_usb_host_get_reg_len(gxio_usb_host_context_t *context)
87{ 87{
88 return HV_USB_HOST_MMIO_SIZE; 88 return HV_USB_HOST_MMIO_SIZE;
89} 89}
diff --git a/arch/tile/include/arch/mpipe.h b/arch/tile/include/arch/mpipe.h
index 8a33912fd6cc..904538e754d8 100644
--- a/arch/tile/include/arch/mpipe.h
+++ b/arch/tile/include/arch/mpipe.h
@@ -176,7 +176,18 @@ typedef union
176 */ 176 */
177 uint_reg_t stack_idx : 5; 177 uint_reg_t stack_idx : 5;
178 /* Reserved. */ 178 /* Reserved. */
179 uint_reg_t __reserved_2 : 5; 179 uint_reg_t __reserved_2 : 3;
180 /*
181 * Instance ID. For devices that support automatic buffer return between
182 * mPIPE instances, this field indicates the buffer owner. If the INST
183 * field does not match the mPIPE's instance number when a packet is
184 * egressed, buffers with HWB set will be returned to the other mPIPE
185 * instance. Note that not all devices support multi-mPIPE buffer
186 * return. The MPIPE_EDMA_INFO.REMOTE_BUFF_RTN_SUPPORT bit indicates
187 * whether the INST field in the buffer descriptor is populated by iDMA
188 * hardware. This field is ignored on writes.
189 */
190 uint_reg_t inst : 2;
180 /* 191 /*
181 * Reads as one to indicate that this is a hardware managed buffer. 192 * Reads as one to indicate that this is a hardware managed buffer.
182 * Ignored on writes since all buffers on a given stack are the same size. 193 * Ignored on writes since all buffers on a given stack are the same size.
@@ -205,7 +216,8 @@ typedef union
205 uint_reg_t c : 2; 216 uint_reg_t c : 2;
206 uint_reg_t size : 3; 217 uint_reg_t size : 3;
207 uint_reg_t hwb : 1; 218 uint_reg_t hwb : 1;
208 uint_reg_t __reserved_2 : 5; 219 uint_reg_t inst : 2;
220 uint_reg_t __reserved_2 : 3;
209 uint_reg_t stack_idx : 5; 221 uint_reg_t stack_idx : 5;
210 uint_reg_t __reserved_1 : 6; 222 uint_reg_t __reserved_1 : 6;
211 int_reg_t va : 35; 223 int_reg_t va : 35;
@@ -231,9 +243,9 @@ typedef union
231 /* Reserved. */ 243 /* Reserved. */
232 uint_reg_t __reserved_0 : 3; 244 uint_reg_t __reserved_0 : 3;
233 /* eDMA ring being accessed */ 245 /* eDMA ring being accessed */
234 uint_reg_t ring : 5; 246 uint_reg_t ring : 6;
235 /* Reserved. */ 247 /* Reserved. */
236 uint_reg_t __reserved_1 : 18; 248 uint_reg_t __reserved_1 : 17;
237 /* 249 /*
238 * This field of the address selects the region (address space) to be 250 * This field of the address selects the region (address space) to be
239 * accessed. For the egress DMA post region, this field must be 5. 251 * accessed. For the egress DMA post region, this field must be 5.
@@ -250,8 +262,8 @@ typedef union
250 uint_reg_t svc_dom : 5; 262 uint_reg_t svc_dom : 5;
251 uint_reg_t __reserved_2 : 6; 263 uint_reg_t __reserved_2 : 6;
252 uint_reg_t region : 3; 264 uint_reg_t region : 3;
253 uint_reg_t __reserved_1 : 18; 265 uint_reg_t __reserved_1 : 17;
254 uint_reg_t ring : 5; 266 uint_reg_t ring : 6;
255 uint_reg_t __reserved_0 : 3; 267 uint_reg_t __reserved_0 : 3;
256#endif 268#endif
257 }; 269 };
diff --git a/arch/tile/include/arch/mpipe_constants.h b/arch/tile/include/arch/mpipe_constants.h
index 410a0400e055..84022ac5fe82 100644
--- a/arch/tile/include/arch/mpipe_constants.h
+++ b/arch/tile/include/arch/mpipe_constants.h
@@ -16,13 +16,13 @@
16#ifndef __ARCH_MPIPE_CONSTANTS_H__ 16#ifndef __ARCH_MPIPE_CONSTANTS_H__
17#define __ARCH_MPIPE_CONSTANTS_H__ 17#define __ARCH_MPIPE_CONSTANTS_H__
18 18
19#define MPIPE_NUM_CLASSIFIERS 10 19#define MPIPE_NUM_CLASSIFIERS 16
20#define MPIPE_CLS_MHZ 1200 20#define MPIPE_CLS_MHZ 1200
21 21
22#define MPIPE_NUM_EDMA_RINGS 32 22#define MPIPE_NUM_EDMA_RINGS 64
23 23
24#define MPIPE_NUM_SGMII_MACS 16 24#define MPIPE_NUM_SGMII_MACS 16
25#define MPIPE_NUM_XAUI_MACS 4 25#define MPIPE_NUM_XAUI_MACS 16
26#define MPIPE_NUM_LOOPBACK_CHANNELS 4 26#define MPIPE_NUM_LOOPBACK_CHANNELS 4
27#define MPIPE_NUM_NON_LB_CHANNELS 28 27#define MPIPE_NUM_NON_LB_CHANNELS 28
28 28
diff --git a/arch/tile/include/arch/mpipe_shm.h b/arch/tile/include/arch/mpipe_shm.h
index f2e9e122818d..13b3c4300e50 100644
--- a/arch/tile/include/arch/mpipe_shm.h
+++ b/arch/tile/include/arch/mpipe_shm.h
@@ -44,8 +44,14 @@ typedef union
44 * descriptors toggles each time the ring tail pointer wraps. 44 * descriptors toggles each time the ring tail pointer wraps.
45 */ 45 */
46 uint_reg_t gen : 1; 46 uint_reg_t gen : 1;
47 /**
48 * For devices with EDMA reorder support, this field allows the
49 * descriptor to select the egress FIFO. The associated DMA ring must
50 * have ALLOW_EFIFO_SEL enabled.
51 */
52 uint_reg_t efifo_sel : 6;
47 /** Reserved. Must be zero. */ 53 /** Reserved. Must be zero. */
48 uint_reg_t r0 : 7; 54 uint_reg_t r0 : 1;
49 /** Checksum generation enabled for this transfer. */ 55 /** Checksum generation enabled for this transfer. */
50 uint_reg_t csum : 1; 56 uint_reg_t csum : 1;
51 /** 57 /**
@@ -110,7 +116,8 @@ typedef union
110 uint_reg_t notif : 1; 116 uint_reg_t notif : 1;
111 uint_reg_t ns : 1; 117 uint_reg_t ns : 1;
112 uint_reg_t csum : 1; 118 uint_reg_t csum : 1;
113 uint_reg_t r0 : 7; 119 uint_reg_t r0 : 1;
120 uint_reg_t efifo_sel : 6;
114 uint_reg_t gen : 1; 121 uint_reg_t gen : 1;
115#endif 122#endif
116 123
@@ -126,14 +133,16 @@ typedef union
126 /** Reserved. */ 133 /** Reserved. */
127 uint_reg_t __reserved_1 : 3; 134 uint_reg_t __reserved_1 : 3;
128 /** 135 /**
129 * Instance ID. For devices that support more than one mPIPE instance, 136 * Instance ID. For devices that support automatic buffer return between
130 * this field indicates the buffer owner. If the INST field does not 137 * mPIPE instances, this field indicates the buffer owner. If the INST
131 * match the mPIPE's instance number when a packet is egressed, buffers 138 * field does not match the mPIPE's instance number when a packet is
132 * with HWB set will be returned to the other mPIPE instance. 139 * egressed, buffers with HWB set will be returned to the other mPIPE
140 * instance. Note that not all devices support multi-mPIPE buffer
141 * return. The MPIPE_EDMA_INFO.REMOTE_BUFF_RTN_SUPPORT bit indicates
142 * whether the INST field in the buffer descriptor is populated by iDMA
143 * hardware.
133 */ 144 */
134 uint_reg_t inst : 1; 145 uint_reg_t inst : 2;
135 /** Reserved. */
136 uint_reg_t __reserved_2 : 1;
137 /** 146 /**
138 * Always set to one by hardware in iDMA packet descriptors. For eDMA, 147 * Always set to one by hardware in iDMA packet descriptors. For eDMA,
139 * indicates whether the buffer will be released to the buffer stack 148 * indicates whether the buffer will be released to the buffer stack
@@ -166,8 +175,7 @@ typedef union
166 uint_reg_t c : 2; 175 uint_reg_t c : 2;
167 uint_reg_t size : 3; 176 uint_reg_t size : 3;
168 uint_reg_t hwb : 1; 177 uint_reg_t hwb : 1;
169 uint_reg_t __reserved_2 : 1; 178 uint_reg_t inst : 2;
170 uint_reg_t inst : 1;
171 uint_reg_t __reserved_1 : 3; 179 uint_reg_t __reserved_1 : 3;
172 uint_reg_t stack_idx : 5; 180 uint_reg_t stack_idx : 5;
173 uint_reg_t __reserved_0 : 6; 181 uint_reg_t __reserved_0 : 6;
@@ -408,7 +416,10 @@ typedef union
408 /** 416 /**
409 * Sequence number applied when packet is distributed. Classifier 417 * Sequence number applied when packet is distributed. Classifier
410 * selects which sequence number is to be applied by writing the 13-bit 418 * selects which sequence number is to be applied by writing the 13-bit
411 * SQN-selector into this field. 419 * SQN-selector into this field. For devices that support EXT_SQN (as
420 * indicated in IDMA_INFO.EXT_SQN_SUPPORT), the GP_SQN can be extended to
421 * 32-bits via the IDMA_CTL.EXT_SQN register. In this case the
422 * PACKET_SQN will be reduced to 32 bits.
412 */ 423 */
413 uint_reg_t gp_sqn : 16; 424 uint_reg_t gp_sqn : 16;
414 /** 425 /**
@@ -451,14 +462,16 @@ typedef union
451 /** Reserved. */ 462 /** Reserved. */
452 uint_reg_t __reserved_5 : 3; 463 uint_reg_t __reserved_5 : 3;
453 /** 464 /**
454 * Instance ID. For devices that support more than one mPIPE instance, 465 * Instance ID. For devices that support automatic buffer return between
455 * this field indicates the buffer owner. If the INST field does not 466 * mPIPE instances, this field indicates the buffer owner. If the INST
456 * match the mPIPE's instance number when a packet is egressed, buffers 467 * field does not match the mPIPE's instance number when a packet is
457 * with HWB set will be returned to the other mPIPE instance. 468 * egressed, buffers with HWB set will be returned to the other mPIPE
469 * instance. Note that not all devices support multi-mPIPE buffer
470 * return. The MPIPE_EDMA_INFO.REMOTE_BUFF_RTN_SUPPORT bit indicates
471 * whether the INST field in the buffer descriptor is populated by iDMA
472 * hardware.
458 */ 473 */
459 uint_reg_t inst : 1; 474 uint_reg_t inst : 2;
460 /** Reserved. */
461 uint_reg_t __reserved_6 : 1;
462 /** 475 /**
463 * Always set to one by hardware in iDMA packet descriptors. For eDMA, 476 * Always set to one by hardware in iDMA packet descriptors. For eDMA,
464 * indicates whether the buffer will be released to the buffer stack 477 * indicates whether the buffer will be released to the buffer stack
@@ -491,8 +504,7 @@ typedef union
491 uint_reg_t c : 2; 504 uint_reg_t c : 2;
492 uint_reg_t size : 3; 505 uint_reg_t size : 3;
493 uint_reg_t hwb : 1; 506 uint_reg_t hwb : 1;
494 uint_reg_t __reserved_6 : 1; 507 uint_reg_t inst : 2;
495 uint_reg_t inst : 1;
496 uint_reg_t __reserved_5 : 3; 508 uint_reg_t __reserved_5 : 3;
497 uint_reg_t stack_idx : 5; 509 uint_reg_t stack_idx : 5;
498 uint_reg_t __reserved_4 : 6; 510 uint_reg_t __reserved_4 : 6;
diff --git a/arch/tile/include/arch/trio_constants.h b/arch/tile/include/arch/trio_constants.h
index 628b045436b8..85647e91a458 100644
--- a/arch/tile/include/arch/trio_constants.h
+++ b/arch/tile/include/arch/trio_constants.h
@@ -16,21 +16,21 @@
16#ifndef __ARCH_TRIO_CONSTANTS_H__ 16#ifndef __ARCH_TRIO_CONSTANTS_H__
17#define __ARCH_TRIO_CONSTANTS_H__ 17#define __ARCH_TRIO_CONSTANTS_H__
18 18
19#define TRIO_NUM_ASIDS 16 19#define TRIO_NUM_ASIDS 32
20#define TRIO_NUM_TLBS_PER_ASID 16 20#define TRIO_NUM_TLBS_PER_ASID 16
21 21
22#define TRIO_NUM_TPIO_REGIONS 8 22#define TRIO_NUM_TPIO_REGIONS 8
23#define TRIO_LOG2_NUM_TPIO_REGIONS 3 23#define TRIO_LOG2_NUM_TPIO_REGIONS 3
24 24
25#define TRIO_NUM_MAP_MEM_REGIONS 16 25#define TRIO_NUM_MAP_MEM_REGIONS 32
26#define TRIO_LOG2_NUM_MAP_MEM_REGIONS 4 26#define TRIO_LOG2_NUM_MAP_MEM_REGIONS 5
27#define TRIO_NUM_MAP_SQ_REGIONS 8 27#define TRIO_NUM_MAP_SQ_REGIONS 8
28#define TRIO_LOG2_NUM_MAP_SQ_REGIONS 3 28#define TRIO_LOG2_NUM_MAP_SQ_REGIONS 3
29 29
30#define TRIO_LOG2_NUM_SQ_FIFO_ENTRIES 6 30#define TRIO_LOG2_NUM_SQ_FIFO_ENTRIES 6
31 31
32#define TRIO_NUM_PUSH_DMA_RINGS 32 32#define TRIO_NUM_PUSH_DMA_RINGS 64
33 33
34#define TRIO_NUM_PULL_DMA_RINGS 32 34#define TRIO_NUM_PULL_DMA_RINGS 64
35 35
36#endif /* __ARCH_TRIO_CONSTANTS_H__ */ 36#endif /* __ARCH_TRIO_CONSTANTS_H__ */
diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild
index 664d6ad23f80..22f3bd147fa7 100644
--- a/arch/tile/include/asm/Kbuild
+++ b/arch/tile/include/asm/Kbuild
@@ -38,3 +38,4 @@ generic-y += termios.h
38generic-y += trace_clock.h 38generic-y += trace_clock.h
39generic-y += types.h 39generic-y += types.h
40generic-y += xor.h 40generic-y += xor.h
41generic-y += preempt.h
diff --git a/arch/tile/include/asm/atomic.h b/arch/tile/include/asm/atomic.h
index d385eaadece7..709798460763 100644
--- a/arch/tile/include/asm/atomic.h
+++ b/arch/tile/include/asm/atomic.h
@@ -166,7 +166,7 @@ static inline int atomic_cmpxchg(atomic_t *v, int o, int n)
166 * 166 *
167 * Atomically sets @v to @i and returns old @v 167 * Atomically sets @v to @i and returns old @v
168 */ 168 */
169static inline u64 atomic64_xchg(atomic64_t *v, u64 n) 169static inline long long atomic64_xchg(atomic64_t *v, long long n)
170{ 170{
171 return xchg64(&v->counter, n); 171 return xchg64(&v->counter, n);
172} 172}
@@ -180,7 +180,8 @@ static inline u64 atomic64_xchg(atomic64_t *v, u64 n)
180 * Atomically checks if @v holds @o and replaces it with @n if so. 180 * Atomically checks if @v holds @o and replaces it with @n if so.
181 * Returns the old value at @v. 181 * Returns the old value at @v.
182 */ 182 */
183static inline u64 atomic64_cmpxchg(atomic64_t *v, u64 o, u64 n) 183static inline long long atomic64_cmpxchg(atomic64_t *v, long long o,
184 long long n)
184{ 185{
185 return cmpxchg64(&v->counter, o, n); 186 return cmpxchg64(&v->counter, o, n);
186} 187}
diff --git a/arch/tile/include/asm/atomic_32.h b/arch/tile/include/asm/atomic_32.h
index 0d0395b1b152..1ad4a1f7d42b 100644
--- a/arch/tile/include/asm/atomic_32.h
+++ b/arch/tile/include/asm/atomic_32.h
@@ -80,7 +80,7 @@ static inline void atomic_set(atomic_t *v, int n)
80/* A 64bit atomic type */ 80/* A 64bit atomic type */
81 81
82typedef struct { 82typedef struct {
83 u64 __aligned(8) counter; 83 long long counter;
84} atomic64_t; 84} atomic64_t;
85 85
86#define ATOMIC64_INIT(val) { (val) } 86#define ATOMIC64_INIT(val) { (val) }
@@ -91,14 +91,14 @@ typedef struct {
91 * 91 *
92 * Atomically reads the value of @v. 92 * Atomically reads the value of @v.
93 */ 93 */
94static inline u64 atomic64_read(const atomic64_t *v) 94static inline long long atomic64_read(const atomic64_t *v)
95{ 95{
96 /* 96 /*
97 * Requires an atomic op to read both 32-bit parts consistently. 97 * Requires an atomic op to read both 32-bit parts consistently.
98 * Casting away const is safe since the atomic support routines 98 * Casting away const is safe since the atomic support routines
99 * do not write to memory if the value has not been modified. 99 * do not write to memory if the value has not been modified.
100 */ 100 */
101 return _atomic64_xchg_add((u64 *)&v->counter, 0); 101 return _atomic64_xchg_add((long long *)&v->counter, 0);
102} 102}
103 103
104/** 104/**
@@ -108,7 +108,7 @@ static inline u64 atomic64_read(const atomic64_t *v)
108 * 108 *
109 * Atomically adds @i to @v. 109 * Atomically adds @i to @v.
110 */ 110 */
111static inline void atomic64_add(u64 i, atomic64_t *v) 111static inline void atomic64_add(long long i, atomic64_t *v)
112{ 112{
113 _atomic64_xchg_add(&v->counter, i); 113 _atomic64_xchg_add(&v->counter, i);
114} 114}
@@ -120,7 +120,7 @@ static inline void atomic64_add(u64 i, atomic64_t *v)
120 * 120 *
121 * Atomically adds @i to @v and returns @i + @v 121 * Atomically adds @i to @v and returns @i + @v
122 */ 122 */
123static inline u64 atomic64_add_return(u64 i, atomic64_t *v) 123static inline long long atomic64_add_return(long long i, atomic64_t *v)
124{ 124{
125 smp_mb(); /* barrier for proper semantics */ 125 smp_mb(); /* barrier for proper semantics */
126 return _atomic64_xchg_add(&v->counter, i) + i; 126 return _atomic64_xchg_add(&v->counter, i) + i;
@@ -135,7 +135,8 @@ static inline u64 atomic64_add_return(u64 i, atomic64_t *v)
135 * Atomically adds @a to @v, so long as @v was not already @u. 135 * Atomically adds @a to @v, so long as @v was not already @u.
136 * Returns non-zero if @v was not @u, and zero otherwise. 136 * Returns non-zero if @v was not @u, and zero otherwise.
137 */ 137 */
138static inline u64 atomic64_add_unless(atomic64_t *v, u64 a, u64 u) 138static inline long long atomic64_add_unless(atomic64_t *v, long long a,
139 long long u)
139{ 140{
140 smp_mb(); /* barrier for proper semantics */ 141 smp_mb(); /* barrier for proper semantics */
141 return _atomic64_xchg_add_unless(&v->counter, a, u) != u; 142 return _atomic64_xchg_add_unless(&v->counter, a, u) != u;
@@ -151,7 +152,7 @@ static inline u64 atomic64_add_unless(atomic64_t *v, u64 a, u64 u)
151 * atomic64_set() can't be just a raw store, since it would be lost if it 152 * atomic64_set() can't be just a raw store, since it would be lost if it
152 * fell between the load and store of one of the other atomic ops. 153 * fell between the load and store of one of the other atomic ops.
153 */ 154 */
154static inline void atomic64_set(atomic64_t *v, u64 n) 155static inline void atomic64_set(atomic64_t *v, long long n)
155{ 156{
156 _atomic64_xchg(&v->counter, n); 157 _atomic64_xchg(&v->counter, n);
157} 158}
@@ -236,11 +237,13 @@ extern struct __get_user __atomic_xchg_add_unless(volatile int *p,
236extern struct __get_user __atomic_or(volatile int *p, int *lock, int n); 237extern struct __get_user __atomic_or(volatile int *p, int *lock, int n);
237extern struct __get_user __atomic_andn(volatile int *p, int *lock, int n); 238extern struct __get_user __atomic_andn(volatile int *p, int *lock, int n);
238extern struct __get_user __atomic_xor(volatile int *p, int *lock, int n); 239extern struct __get_user __atomic_xor(volatile int *p, int *lock, int n);
239extern u64 __atomic64_cmpxchg(volatile u64 *p, int *lock, u64 o, u64 n); 240extern long long __atomic64_cmpxchg(volatile long long *p, int *lock,
240extern u64 __atomic64_xchg(volatile u64 *p, int *lock, u64 n); 241 long long o, long long n);
241extern u64 __atomic64_xchg_add(volatile u64 *p, int *lock, u64 n); 242extern long long __atomic64_xchg(volatile long long *p, int *lock, long long n);
242extern u64 __atomic64_xchg_add_unless(volatile u64 *p, 243extern long long __atomic64_xchg_add(volatile long long *p, int *lock,
243 int *lock, u64 o, u64 n); 244 long long n);
245extern long long __atomic64_xchg_add_unless(volatile long long *p,
246 int *lock, long long o, long long n);
244 247
245/* Return failure from the atomic wrappers. */ 248/* Return failure from the atomic wrappers. */
246struct __get_user __atomic_bad_address(int __user *addr); 249struct __get_user __atomic_bad_address(int __user *addr);
diff --git a/arch/tile/include/asm/cmpxchg.h b/arch/tile/include/asm/cmpxchg.h
index 4001d5eab4bb..0ccda3c425be 100644
--- a/arch/tile/include/asm/cmpxchg.h
+++ b/arch/tile/include/asm/cmpxchg.h
@@ -35,10 +35,10 @@ int _atomic_xchg(int *ptr, int n);
35int _atomic_xchg_add(int *v, int i); 35int _atomic_xchg_add(int *v, int i);
36int _atomic_xchg_add_unless(int *v, int a, int u); 36int _atomic_xchg_add_unless(int *v, int a, int u);
37int _atomic_cmpxchg(int *ptr, int o, int n); 37int _atomic_cmpxchg(int *ptr, int o, int n);
38u64 _atomic64_xchg(u64 *v, u64 n); 38long long _atomic64_xchg(long long *v, long long n);
39u64 _atomic64_xchg_add(u64 *v, u64 i); 39long long _atomic64_xchg_add(long long *v, long long i);
40u64 _atomic64_xchg_add_unless(u64 *v, u64 a, u64 u); 40long long _atomic64_xchg_add_unless(long long *v, long long a, long long u);
41u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n); 41long long _atomic64_cmpxchg(long long *v, long long o, long long n);
42 42
43#define xchg(ptr, n) \ 43#define xchg(ptr, n) \
44 ({ \ 44 ({ \
@@ -53,7 +53,8 @@ u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n);
53 if (sizeof(*(ptr)) != 4) \ 53 if (sizeof(*(ptr)) != 4) \
54 __cmpxchg_called_with_bad_pointer(); \ 54 __cmpxchg_called_with_bad_pointer(); \
55 smp_mb(); \ 55 smp_mb(); \
56 (typeof(*(ptr)))_atomic_cmpxchg((int *)ptr, (int)o, (int)n); \ 56 (typeof(*(ptr)))_atomic_cmpxchg((int *)ptr, (int)o, \
57 (int)n); \
57 }) 58 })
58 59
59#define xchg64(ptr, n) \ 60#define xchg64(ptr, n) \
@@ -61,7 +62,8 @@ u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n);
61 if (sizeof(*(ptr)) != 8) \ 62 if (sizeof(*(ptr)) != 8) \
62 __xchg_called_with_bad_pointer(); \ 63 __xchg_called_with_bad_pointer(); \
63 smp_mb(); \ 64 smp_mb(); \
64 (typeof(*(ptr)))_atomic64_xchg((u64 *)(ptr), (u64)(n)); \ 65 (typeof(*(ptr)))_atomic64_xchg((long long *)(ptr), \
66 (long long)(n)); \
65 }) 67 })
66 68
67#define cmpxchg64(ptr, o, n) \ 69#define cmpxchg64(ptr, o, n) \
@@ -69,7 +71,8 @@ u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n);
69 if (sizeof(*(ptr)) != 8) \ 71 if (sizeof(*(ptr)) != 8) \
70 __cmpxchg_called_with_bad_pointer(); \ 72 __cmpxchg_called_with_bad_pointer(); \
71 smp_mb(); \ 73 smp_mb(); \
72 (typeof(*(ptr)))_atomic64_cmpxchg((u64 *)ptr, (u64)o, (u64)n); \ 74 (typeof(*(ptr)))_atomic64_cmpxchg((long long *)ptr, \
75 (long long)o, (long long)n); \
73 }) 76 })
74 77
75#else 78#else
@@ -81,10 +84,11 @@ u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n);
81 switch (sizeof(*(ptr))) { \ 84 switch (sizeof(*(ptr))) { \
82 case 4: \ 85 case 4: \
83 __x = (typeof(__x))(unsigned long) \ 86 __x = (typeof(__x))(unsigned long) \
84 __insn_exch4((ptr), (u32)(unsigned long)(n)); \ 87 __insn_exch4((ptr), \
88 (u32)(unsigned long)(n)); \
85 break; \ 89 break; \
86 case 8: \ 90 case 8: \
87 __x = (typeof(__x)) \ 91 __x = (typeof(__x)) \
88 __insn_exch((ptr), (unsigned long)(n)); \ 92 __insn_exch((ptr), (unsigned long)(n)); \
89 break; \ 93 break; \
90 default: \ 94 default: \
@@ -103,10 +107,12 @@ u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n);
103 switch (sizeof(*(ptr))) { \ 107 switch (sizeof(*(ptr))) { \
104 case 4: \ 108 case 4: \
105 __x = (typeof(__x))(unsigned long) \ 109 __x = (typeof(__x))(unsigned long) \
106 __insn_cmpexch4((ptr), (u32)(unsigned long)(n)); \ 110 __insn_cmpexch4((ptr), \
111 (u32)(unsigned long)(n)); \
107 break; \ 112 break; \
108 case 8: \ 113 case 8: \
109 __x = (typeof(__x))__insn_cmpexch((ptr), (u64)(n)); \ 114 __x = (typeof(__x))__insn_cmpexch((ptr), \
115 (long long)(n)); \
110 break; \ 116 break; \
111 default: \ 117 default: \
112 __cmpxchg_called_with_bad_pointer(); \ 118 __cmpxchg_called_with_bad_pointer(); \
diff --git a/arch/tile/include/asm/page.h b/arch/tile/include/asm/page.h
index 6346888f7bdc..672768008618 100644
--- a/arch/tile/include/asm/page.h
+++ b/arch/tile/include/asm/page.h
@@ -182,10 +182,9 @@ static inline __attribute_const__ int get_order(unsigned long size)
182 182
183#define PAGE_OFFSET (-(_AC(1, UL) << (MAX_VA_WIDTH - 1))) 183#define PAGE_OFFSET (-(_AC(1, UL) << (MAX_VA_WIDTH - 1)))
184#define KERNEL_HIGH_VADDR _AC(0xfffffff800000000, UL) /* high 32GB */ 184#define KERNEL_HIGH_VADDR _AC(0xfffffff800000000, UL) /* high 32GB */
185#define FIXADDR_BASE (KERNEL_HIGH_VADDR - 0x400000000) /* 4 GB */ 185#define FIXADDR_BASE (KERNEL_HIGH_VADDR - 0x300000000) /* 4 GB */
186#define FIXADDR_TOP (KERNEL_HIGH_VADDR - 0x300000000) /* 4 GB */ 186#define FIXADDR_TOP (KERNEL_HIGH_VADDR - 0x200000000) /* 4 GB */
187#define _VMALLOC_START FIXADDR_TOP 187#define _VMALLOC_START FIXADDR_TOP
188#define HUGE_VMAP_BASE (KERNEL_HIGH_VADDR - 0x200000000) /* 4 GB */
189#define MEM_SV_START (KERNEL_HIGH_VADDR - 0x100000000) /* 256 MB */ 188#define MEM_SV_START (KERNEL_HIGH_VADDR - 0x100000000) /* 256 MB */
190#define MEM_MODULE_START (MEM_SV_START + (256*1024*1024)) /* 256 MB */ 189#define MEM_MODULE_START (MEM_SV_START + (256*1024*1024)) /* 256 MB */
191#define MEM_MODULE_END (MEM_MODULE_START + (256*1024*1024)) 190#define MEM_MODULE_END (MEM_MODULE_START + (256*1024*1024))
diff --git a/arch/tile/include/asm/percpu.h b/arch/tile/include/asm/percpu.h
index 63294f5a8efb..4f7ae39fa202 100644
--- a/arch/tile/include/asm/percpu.h
+++ b/arch/tile/include/asm/percpu.h
@@ -15,9 +15,37 @@
15#ifndef _ASM_TILE_PERCPU_H 15#ifndef _ASM_TILE_PERCPU_H
16#define _ASM_TILE_PERCPU_H 16#define _ASM_TILE_PERCPU_H
17 17
18register unsigned long __my_cpu_offset __asm__("tp"); 18register unsigned long my_cpu_offset_reg asm("tp");
19#define __my_cpu_offset __my_cpu_offset 19
20#define set_my_cpu_offset(tp) (__my_cpu_offset = (tp)) 20#ifdef CONFIG_PREEMPT
21/*
22 * For full preemption, we can't just use the register variable
23 * directly, since we need barrier() to hazard against it, causing the
24 * compiler to reload anything computed from a previous "tp" value.
25 * But we also don't want to use volatile asm, since we'd like the
26 * compiler to be able to cache the value across multiple percpu reads.
27 * So we use a fake stack read as a hazard against barrier().
28 * The 'U' constraint is like 'm' but disallows postincrement.
29 */
30static inline unsigned long __my_cpu_offset(void)
31{
32 unsigned long tp;
33 register unsigned long *sp asm("sp");
34 asm("move %0, tp" : "=r" (tp) : "U" (*sp));
35 return tp;
36}
37#define __my_cpu_offset __my_cpu_offset()
38#else
39/*
40 * We don't need to hazard against barrier() since "tp" doesn't ever
41 * change with PREEMPT_NONE, and with PREEMPT_VOLUNTARY it only
42 * changes at function call points, at which we are already re-reading
43 * the value of "tp" due to "my_cpu_offset_reg" being a global variable.
44 */
45#define __my_cpu_offset my_cpu_offset_reg
46#endif
47
48#define set_my_cpu_offset(tp) (my_cpu_offset_reg = (tp))
21 49
22#include <asm-generic/percpu.h> 50#include <asm-generic/percpu.h>
23 51
diff --git a/arch/tile/include/asm/pgtable_32.h b/arch/tile/include/asm/pgtable_32.h
index 63142ab3b3dd..d26a42279036 100644
--- a/arch/tile/include/asm/pgtable_32.h
+++ b/arch/tile/include/asm/pgtable_32.h
@@ -55,17 +55,9 @@
55#define PKMAP_BASE ((FIXADDR_BOOT_START - PAGE_SIZE*LAST_PKMAP) & PGDIR_MASK) 55#define PKMAP_BASE ((FIXADDR_BOOT_START - PAGE_SIZE*LAST_PKMAP) & PGDIR_MASK)
56 56
57#ifdef CONFIG_HIGHMEM 57#ifdef CONFIG_HIGHMEM
58# define __VMAPPING_END (PKMAP_BASE & ~(HPAGE_SIZE-1)) 58# define _VMALLOC_END (PKMAP_BASE & ~(HPAGE_SIZE-1))
59#else 59#else
60# define __VMAPPING_END (FIXADDR_START & ~(HPAGE_SIZE-1)) 60# define _VMALLOC_END (FIXADDR_START & ~(HPAGE_SIZE-1))
61#endif
62
63#ifdef CONFIG_HUGEVMAP
64#define HUGE_VMAP_END __VMAPPING_END
65#define HUGE_VMAP_BASE (HUGE_VMAP_END - CONFIG_NR_HUGE_VMAPS * HPAGE_SIZE)
66#define _VMALLOC_END HUGE_VMAP_BASE
67#else
68#define _VMALLOC_END __VMAPPING_END
69#endif 61#endif
70 62
71/* 63/*
diff --git a/arch/tile/include/asm/pgtable_64.h b/arch/tile/include/asm/pgtable_64.h
index 3421177f7370..2c8a9cd102d3 100644
--- a/arch/tile/include/asm/pgtable_64.h
+++ b/arch/tile/include/asm/pgtable_64.h
@@ -52,12 +52,10 @@
52 * memory allocation code). The vmalloc code puts in an internal 52 * memory allocation code). The vmalloc code puts in an internal
53 * guard page between each allocation. 53 * guard page between each allocation.
54 */ 54 */
55#define _VMALLOC_END HUGE_VMAP_BASE 55#define _VMALLOC_END MEM_SV_START
56#define VMALLOC_END _VMALLOC_END 56#define VMALLOC_END _VMALLOC_END
57#define VMALLOC_START _VMALLOC_START 57#define VMALLOC_START _VMALLOC_START
58 58
59#define HUGE_VMAP_END (HUGE_VMAP_BASE + PGDIR_SIZE)
60
61#ifndef __ASSEMBLY__ 59#ifndef __ASSEMBLY__
62 60
63/* We have no pud since we are a three-level page table. */ 61/* We have no pud since we are a three-level page table. */
diff --git a/arch/tile/include/gxio/iorpc_mpipe.h b/arch/tile/include/gxio/iorpc_mpipe.h
index fdd07f88cfd7..4cda03de734f 100644
--- a/arch/tile/include/gxio/iorpc_mpipe.h
+++ b/arch/tile/include/gxio/iorpc_mpipe.h
@@ -56,89 +56,89 @@
56#define GXIO_MPIPE_OP_GET_MMIO_BASE IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8000) 56#define GXIO_MPIPE_OP_GET_MMIO_BASE IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8000)
57#define GXIO_MPIPE_OP_CHECK_MMIO_OFFSET IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8001) 57#define GXIO_MPIPE_OP_CHECK_MMIO_OFFSET IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8001)
58 58
59int gxio_mpipe_alloc_buffer_stacks(gxio_mpipe_context_t * context, 59int gxio_mpipe_alloc_buffer_stacks(gxio_mpipe_context_t *context,
60 unsigned int count, unsigned int first, 60 unsigned int count, unsigned int first,
61 unsigned int flags); 61 unsigned int flags);
62 62
63int gxio_mpipe_init_buffer_stack_aux(gxio_mpipe_context_t * context, 63int gxio_mpipe_init_buffer_stack_aux(gxio_mpipe_context_t *context,
64 void *mem_va, size_t mem_size, 64 void *mem_va, size_t mem_size,
65 unsigned int mem_flags, unsigned int stack, 65 unsigned int mem_flags, unsigned int stack,
66 unsigned int buffer_size_enum); 66 unsigned int buffer_size_enum);
67 67
68 68
69int gxio_mpipe_alloc_notif_rings(gxio_mpipe_context_t * context, 69int gxio_mpipe_alloc_notif_rings(gxio_mpipe_context_t *context,
70 unsigned int count, unsigned int first, 70 unsigned int count, unsigned int first,
71 unsigned int flags); 71 unsigned int flags);
72 72
73int gxio_mpipe_init_notif_ring_aux(gxio_mpipe_context_t * context, void *mem_va, 73int gxio_mpipe_init_notif_ring_aux(gxio_mpipe_context_t *context, void *mem_va,
74 size_t mem_size, unsigned int mem_flags, 74 size_t mem_size, unsigned int mem_flags,
75 unsigned int ring); 75 unsigned int ring);
76 76
77int gxio_mpipe_request_notif_ring_interrupt(gxio_mpipe_context_t * context, 77int gxio_mpipe_request_notif_ring_interrupt(gxio_mpipe_context_t *context,
78 int inter_x, int inter_y, 78 int inter_x, int inter_y,
79 int inter_ipi, int inter_event, 79 int inter_ipi, int inter_event,
80 unsigned int ring); 80 unsigned int ring);
81 81
82int gxio_mpipe_enable_notif_ring_interrupt(gxio_mpipe_context_t * context, 82int gxio_mpipe_enable_notif_ring_interrupt(gxio_mpipe_context_t *context,
83 unsigned int ring); 83 unsigned int ring);
84 84
85int gxio_mpipe_alloc_notif_groups(gxio_mpipe_context_t * context, 85int gxio_mpipe_alloc_notif_groups(gxio_mpipe_context_t *context,
86 unsigned int count, unsigned int first, 86 unsigned int count, unsigned int first,
87 unsigned int flags); 87 unsigned int flags);
88 88
89int gxio_mpipe_init_notif_group(gxio_mpipe_context_t * context, 89int gxio_mpipe_init_notif_group(gxio_mpipe_context_t *context,
90 unsigned int group, 90 unsigned int group,
91 gxio_mpipe_notif_group_bits_t bits); 91 gxio_mpipe_notif_group_bits_t bits);
92 92
93int gxio_mpipe_alloc_buckets(gxio_mpipe_context_t * context, unsigned int count, 93int gxio_mpipe_alloc_buckets(gxio_mpipe_context_t *context, unsigned int count,
94 unsigned int first, unsigned int flags); 94 unsigned int first, unsigned int flags);
95 95
96int gxio_mpipe_init_bucket(gxio_mpipe_context_t * context, unsigned int bucket, 96int gxio_mpipe_init_bucket(gxio_mpipe_context_t *context, unsigned int bucket,
97 MPIPE_LBL_INIT_DAT_BSTS_TBL_t bucket_info); 97 MPIPE_LBL_INIT_DAT_BSTS_TBL_t bucket_info);
98 98
99int gxio_mpipe_alloc_edma_rings(gxio_mpipe_context_t * context, 99int gxio_mpipe_alloc_edma_rings(gxio_mpipe_context_t *context,
100 unsigned int count, unsigned int first, 100 unsigned int count, unsigned int first,
101 unsigned int flags); 101 unsigned int flags);
102 102
103int gxio_mpipe_init_edma_ring_aux(gxio_mpipe_context_t * context, void *mem_va, 103int gxio_mpipe_init_edma_ring_aux(gxio_mpipe_context_t *context, void *mem_va,
104 size_t mem_size, unsigned int mem_flags, 104 size_t mem_size, unsigned int mem_flags,
105 unsigned int ring, unsigned int channel); 105 unsigned int ring, unsigned int channel);
106 106
107 107
108int gxio_mpipe_commit_rules(gxio_mpipe_context_t * context, const void *blob, 108int gxio_mpipe_commit_rules(gxio_mpipe_context_t *context, const void *blob,
109 size_t blob_size); 109 size_t blob_size);
110 110
111int gxio_mpipe_register_client_memory(gxio_mpipe_context_t * context, 111int gxio_mpipe_register_client_memory(gxio_mpipe_context_t *context,
112 unsigned int iotlb, HV_PTE pte, 112 unsigned int iotlb, HV_PTE pte,
113 unsigned int flags); 113 unsigned int flags);
114 114
115int gxio_mpipe_link_open_aux(gxio_mpipe_context_t * context, 115int gxio_mpipe_link_open_aux(gxio_mpipe_context_t *context,
116 _gxio_mpipe_link_name_t name, unsigned int flags); 116 _gxio_mpipe_link_name_t name, unsigned int flags);
117 117
118int gxio_mpipe_link_close_aux(gxio_mpipe_context_t * context, int mac); 118int gxio_mpipe_link_close_aux(gxio_mpipe_context_t *context, int mac);
119 119
120int gxio_mpipe_link_set_attr_aux(gxio_mpipe_context_t * context, int mac, 120int gxio_mpipe_link_set_attr_aux(gxio_mpipe_context_t *context, int mac,
121 uint32_t attr, int64_t val); 121 uint32_t attr, int64_t val);
122 122
123int gxio_mpipe_get_timestamp_aux(gxio_mpipe_context_t * context, uint64_t * sec, 123int gxio_mpipe_get_timestamp_aux(gxio_mpipe_context_t *context, uint64_t *sec,
124 uint64_t * nsec, uint64_t * cycles); 124 uint64_t *nsec, uint64_t *cycles);
125 125
126int gxio_mpipe_set_timestamp_aux(gxio_mpipe_context_t * context, uint64_t sec, 126int gxio_mpipe_set_timestamp_aux(gxio_mpipe_context_t *context, uint64_t sec,
127 uint64_t nsec, uint64_t cycles); 127 uint64_t nsec, uint64_t cycles);
128 128
129int gxio_mpipe_adjust_timestamp_aux(gxio_mpipe_context_t * context, 129int gxio_mpipe_adjust_timestamp_aux(gxio_mpipe_context_t *context,
130 int64_t nsec); 130 int64_t nsec);
131 131
132int gxio_mpipe_adjust_timestamp_freq(gxio_mpipe_context_t * context, 132int gxio_mpipe_adjust_timestamp_freq(gxio_mpipe_context_t *context,
133 int32_t ppb); 133 int32_t ppb);
134 134
135int gxio_mpipe_arm_pollfd(gxio_mpipe_context_t * context, int pollfd_cookie); 135int gxio_mpipe_arm_pollfd(gxio_mpipe_context_t *context, int pollfd_cookie);
136 136
137int gxio_mpipe_close_pollfd(gxio_mpipe_context_t * context, int pollfd_cookie); 137int gxio_mpipe_close_pollfd(gxio_mpipe_context_t *context, int pollfd_cookie);
138 138
139int gxio_mpipe_get_mmio_base(gxio_mpipe_context_t * context, HV_PTE *base); 139int gxio_mpipe_get_mmio_base(gxio_mpipe_context_t *context, HV_PTE *base);
140 140
141int gxio_mpipe_check_mmio_offset(gxio_mpipe_context_t * context, 141int gxio_mpipe_check_mmio_offset(gxio_mpipe_context_t *context,
142 unsigned long offset, unsigned long size); 142 unsigned long offset, unsigned long size);
143 143
144#endif /* !__GXIO_MPIPE_LINUX_RPC_H__ */ 144#endif /* !__GXIO_MPIPE_LINUX_RPC_H__ */
diff --git a/arch/tile/include/gxio/iorpc_mpipe_info.h b/arch/tile/include/gxio/iorpc_mpipe_info.h
index 476c5e5ca22c..f0b04284468b 100644
--- a/arch/tile/include/gxio/iorpc_mpipe_info.h
+++ b/arch/tile/include/gxio/iorpc_mpipe_info.h
@@ -33,18 +33,18 @@
33#define GXIO_MPIPE_INFO_OP_CHECK_MMIO_OFFSET IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8001) 33#define GXIO_MPIPE_INFO_OP_CHECK_MMIO_OFFSET IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8001)
34 34
35 35
36int gxio_mpipe_info_instance_aux(gxio_mpipe_info_context_t * context, 36int gxio_mpipe_info_instance_aux(gxio_mpipe_info_context_t *context,
37 _gxio_mpipe_link_name_t name); 37 _gxio_mpipe_link_name_t name);
38 38
39int gxio_mpipe_info_enumerate_aux(gxio_mpipe_info_context_t * context, 39int gxio_mpipe_info_enumerate_aux(gxio_mpipe_info_context_t *context,
40 unsigned int idx, 40 unsigned int idx,
41 _gxio_mpipe_link_name_t * name, 41 _gxio_mpipe_link_name_t *name,
42 _gxio_mpipe_link_mac_t * mac); 42 _gxio_mpipe_link_mac_t *mac);
43 43
44int gxio_mpipe_info_get_mmio_base(gxio_mpipe_info_context_t * context, 44int gxio_mpipe_info_get_mmio_base(gxio_mpipe_info_context_t *context,
45 HV_PTE *base); 45 HV_PTE *base);
46 46
47int gxio_mpipe_info_check_mmio_offset(gxio_mpipe_info_context_t * context, 47int gxio_mpipe_info_check_mmio_offset(gxio_mpipe_info_context_t *context,
48 unsigned long offset, unsigned long size); 48 unsigned long offset, unsigned long size);
49 49
50#endif /* !__GXIO_MPIPE_INFO_LINUX_RPC_H__ */ 50#endif /* !__GXIO_MPIPE_INFO_LINUX_RPC_H__ */
diff --git a/arch/tile/include/gxio/iorpc_trio.h b/arch/tile/include/gxio/iorpc_trio.h
index d95b96fd6c93..376a4f771167 100644
--- a/arch/tile/include/gxio/iorpc_trio.h
+++ b/arch/tile/include/gxio/iorpc_trio.h
@@ -46,59 +46,59 @@
46#define GXIO_TRIO_OP_GET_MMIO_BASE IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8000) 46#define GXIO_TRIO_OP_GET_MMIO_BASE IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8000)
47#define GXIO_TRIO_OP_CHECK_MMIO_OFFSET IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8001) 47#define GXIO_TRIO_OP_CHECK_MMIO_OFFSET IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8001)
48 48
49int gxio_trio_alloc_asids(gxio_trio_context_t * context, unsigned int count, 49int gxio_trio_alloc_asids(gxio_trio_context_t *context, unsigned int count,
50 unsigned int first, unsigned int flags); 50 unsigned int first, unsigned int flags);
51 51
52 52
53int gxio_trio_alloc_memory_maps(gxio_trio_context_t * context, 53int gxio_trio_alloc_memory_maps(gxio_trio_context_t *context,
54 unsigned int count, unsigned int first, 54 unsigned int count, unsigned int first,
55 unsigned int flags); 55 unsigned int flags);
56 56
57 57
58int gxio_trio_alloc_scatter_queues(gxio_trio_context_t * context, 58int gxio_trio_alloc_scatter_queues(gxio_trio_context_t *context,
59 unsigned int count, unsigned int first, 59 unsigned int count, unsigned int first,
60 unsigned int flags); 60 unsigned int flags);
61 61
62int gxio_trio_alloc_pio_regions(gxio_trio_context_t * context, 62int gxio_trio_alloc_pio_regions(gxio_trio_context_t *context,
63 unsigned int count, unsigned int first, 63 unsigned int count, unsigned int first,
64 unsigned int flags); 64 unsigned int flags);
65 65
66int gxio_trio_init_pio_region_aux(gxio_trio_context_t * context, 66int gxio_trio_init_pio_region_aux(gxio_trio_context_t *context,
67 unsigned int pio_region, unsigned int mac, 67 unsigned int pio_region, unsigned int mac,
68 uint32_t bus_address_hi, unsigned int flags); 68 uint32_t bus_address_hi, unsigned int flags);
69 69
70 70
71int gxio_trio_init_memory_map_mmu_aux(gxio_trio_context_t * context, 71int gxio_trio_init_memory_map_mmu_aux(gxio_trio_context_t *context,
72 unsigned int map, unsigned long va, 72 unsigned int map, unsigned long va,
73 uint64_t size, unsigned int asid, 73 uint64_t size, unsigned int asid,
74 unsigned int mac, uint64_t bus_address, 74 unsigned int mac, uint64_t bus_address,
75 unsigned int node, 75 unsigned int node,
76 unsigned int order_mode); 76 unsigned int order_mode);
77 77
78int gxio_trio_get_port_property(gxio_trio_context_t * context, 78int gxio_trio_get_port_property(gxio_trio_context_t *context,
79 struct pcie_trio_ports_property *trio_ports); 79 struct pcie_trio_ports_property *trio_ports);
80 80
81int gxio_trio_config_legacy_intr(gxio_trio_context_t * context, int inter_x, 81int gxio_trio_config_legacy_intr(gxio_trio_context_t *context, int inter_x,
82 int inter_y, int inter_ipi, int inter_event, 82 int inter_y, int inter_ipi, int inter_event,
83 unsigned int mac, unsigned int intx); 83 unsigned int mac, unsigned int intx);
84 84
85int gxio_trio_config_msi_intr(gxio_trio_context_t * context, int inter_x, 85int gxio_trio_config_msi_intr(gxio_trio_context_t *context, int inter_x,
86 int inter_y, int inter_ipi, int inter_event, 86 int inter_y, int inter_ipi, int inter_event,
87 unsigned int mac, unsigned int mem_map, 87 unsigned int mac, unsigned int mem_map,
88 uint64_t mem_map_base, uint64_t mem_map_limit, 88 uint64_t mem_map_base, uint64_t mem_map_limit,
89 unsigned int asid); 89 unsigned int asid);
90 90
91 91
92int gxio_trio_set_mps_mrs(gxio_trio_context_t * context, uint16_t mps, 92int gxio_trio_set_mps_mrs(gxio_trio_context_t *context, uint16_t mps,
93 uint16_t mrs, unsigned int mac); 93 uint16_t mrs, unsigned int mac);
94 94
95int gxio_trio_force_rc_link_up(gxio_trio_context_t * context, unsigned int mac); 95int gxio_trio_force_rc_link_up(gxio_trio_context_t *context, unsigned int mac);
96 96
97int gxio_trio_force_ep_link_up(gxio_trio_context_t * context, unsigned int mac); 97int gxio_trio_force_ep_link_up(gxio_trio_context_t *context, unsigned int mac);
98 98
99int gxio_trio_get_mmio_base(gxio_trio_context_t * context, HV_PTE *base); 99int gxio_trio_get_mmio_base(gxio_trio_context_t *context, HV_PTE *base);
100 100
101int gxio_trio_check_mmio_offset(gxio_trio_context_t * context, 101int gxio_trio_check_mmio_offset(gxio_trio_context_t *context,
102 unsigned long offset, unsigned long size); 102 unsigned long offset, unsigned long size);
103 103
104#endif /* !__GXIO_TRIO_LINUX_RPC_H__ */ 104#endif /* !__GXIO_TRIO_LINUX_RPC_H__ */
diff --git a/arch/tile/include/gxio/iorpc_usb_host.h b/arch/tile/include/gxio/iorpc_usb_host.h
index 8622e7d126ad..79962a97de8e 100644
--- a/arch/tile/include/gxio/iorpc_usb_host.h
+++ b/arch/tile/include/gxio/iorpc_usb_host.h
@@ -31,16 +31,16 @@
31#define GXIO_USB_HOST_OP_GET_MMIO_BASE IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8000) 31#define GXIO_USB_HOST_OP_GET_MMIO_BASE IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8000)
32#define GXIO_USB_HOST_OP_CHECK_MMIO_OFFSET IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8001) 32#define GXIO_USB_HOST_OP_CHECK_MMIO_OFFSET IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8001)
33 33
34int gxio_usb_host_cfg_interrupt(gxio_usb_host_context_t * context, int inter_x, 34int gxio_usb_host_cfg_interrupt(gxio_usb_host_context_t *context, int inter_x,
35 int inter_y, int inter_ipi, int inter_event); 35 int inter_y, int inter_ipi, int inter_event);
36 36
37int gxio_usb_host_register_client_memory(gxio_usb_host_context_t * context, 37int gxio_usb_host_register_client_memory(gxio_usb_host_context_t *context,
38 HV_PTE pte, unsigned int flags); 38 HV_PTE pte, unsigned int flags);
39 39
40int gxio_usb_host_get_mmio_base(gxio_usb_host_context_t * context, 40int gxio_usb_host_get_mmio_base(gxio_usb_host_context_t *context,
41 HV_PTE *base); 41 HV_PTE *base);
42 42
43int gxio_usb_host_check_mmio_offset(gxio_usb_host_context_t * context, 43int gxio_usb_host_check_mmio_offset(gxio_usb_host_context_t *context,
44 unsigned long offset, unsigned long size); 44 unsigned long offset, unsigned long size);
45 45
46#endif /* !__GXIO_USB_HOST_LINUX_RPC_H__ */ 46#endif /* !__GXIO_USB_HOST_LINUX_RPC_H__ */
diff --git a/arch/tile/include/gxio/usb_host.h b/arch/tile/include/gxio/usb_host.h
index 5eedec0e988e..93c9636d2dd7 100644
--- a/arch/tile/include/gxio/usb_host.h
+++ b/arch/tile/include/gxio/usb_host.h
@@ -53,7 +53,7 @@ typedef struct {
53 * @return Zero if the context was successfully initialized, else a 53 * @return Zero if the context was successfully initialized, else a
54 * GXIO_ERR_xxx error code. 54 * GXIO_ERR_xxx error code.
55 */ 55 */
56extern int gxio_usb_host_init(gxio_usb_host_context_t * context, int usb_index, 56extern int gxio_usb_host_init(gxio_usb_host_context_t *context, int usb_index,
57 int is_ehci); 57 int is_ehci);
58 58
59/* Destroy a USB context. 59/* Destroy a USB context.
@@ -68,20 +68,20 @@ extern int gxio_usb_host_init(gxio_usb_host_context_t * context, int usb_index,
68 * @return Zero if the context was successfully destroyed, else a 68 * @return Zero if the context was successfully destroyed, else a
69 * GXIO_ERR_xxx error code. 69 * GXIO_ERR_xxx error code.
70 */ 70 */
71extern int gxio_usb_host_destroy(gxio_usb_host_context_t * context); 71extern int gxio_usb_host_destroy(gxio_usb_host_context_t *context);
72 72
73/* Retrieve the address of the shim's MMIO registers. 73/* Retrieve the address of the shim's MMIO registers.
74 * 74 *
75 * @param context Pointer to a properly initialized gxio_usb_host_context_t. 75 * @param context Pointer to a properly initialized gxio_usb_host_context_t.
76 * @return The address of the shim's MMIO registers. 76 * @return The address of the shim's MMIO registers.
77 */ 77 */
78extern void *gxio_usb_host_get_reg_start(gxio_usb_host_context_t * context); 78extern void *gxio_usb_host_get_reg_start(gxio_usb_host_context_t *context);
79 79
80/* Retrieve the length of the shim's MMIO registers. 80/* Retrieve the length of the shim's MMIO registers.
81 * 81 *
82 * @param context Pointer to a properly initialized gxio_usb_host_context_t. 82 * @param context Pointer to a properly initialized gxio_usb_host_context_t.
83 * @return The length of the shim's MMIO registers. 83 * @return The length of the shim's MMIO registers.
84 */ 84 */
85extern size_t gxio_usb_host_get_reg_len(gxio_usb_host_context_t * context); 85extern size_t gxio_usb_host_get_reg_len(gxio_usb_host_context_t *context);
86 86
87#endif /* _GXIO_USB_H_ */ 87#endif /* _GXIO_USB_H_ */
diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c
index ed378416b86a..49120843ff96 100644
--- a/arch/tile/kernel/compat.c
+++ b/arch/tile/kernel/compat.c
@@ -84,7 +84,7 @@ COMPAT_SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned int, offset_high,
84{ 84{
85 return sys_llseek(fd, offset_high, offset_low, result, origin); 85 return sys_llseek(fd, offset_high, offset_low, result, origin);
86} 86}
87 87
88/* Provide the compat syscall number to call mapping. */ 88/* Provide the compat syscall number to call mapping. */
89#undef __SYSCALL 89#undef __SYSCALL
90#define __SYSCALL(nr, call) [nr] = (call), 90#define __SYSCALL(nr, call) [nr] = (call),
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c
index 85e00b2f39bf..19c04b5ce408 100644
--- a/arch/tile/kernel/compat_signal.c
+++ b/arch/tile/kernel/compat_signal.c
@@ -49,7 +49,7 @@ struct compat_rt_sigframe {
49 struct compat_ucontext uc; 49 struct compat_ucontext uc;
50}; 50};
51 51
52int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from) 52int copy_siginfo_to_user32(struct compat_siginfo __user *to, const siginfo_t *from)
53{ 53{
54 int err; 54 int err;
55 55
diff --git a/arch/tile/kernel/futex_64.S b/arch/tile/kernel/futex_64.S
deleted file mode 100644
index f465d1eda20f..000000000000
--- a/arch/tile/kernel/futex_64.S
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * Copyright 2011 Tilera Corporation. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11 * NON INFRINGEMENT. See the GNU General Public License for
12 * more details.
13 *
14 * Atomically access user memory, but use MMU to avoid propagating
15 * kernel exceptions.
16 */
17
18#include <linux/linkage.h>
19#include <asm/errno.h>
20#include <asm/futex.h>
21#include <asm/page.h>
22#include <asm/processor.h>
23
24/*
25 * Provide a set of atomic memory operations supporting <asm/futex.h>.
26 *
27 * r0: user address to manipulate
28 * r1: new value to write, or for cmpxchg, old value to compare against
29 * r2: (cmpxchg only) new value to write
30 *
31 * Return __get_user struct, r0 with value, r1 with error.
32 */
33#define FUTEX_OP(name, ...) \
34STD_ENTRY(futex_##name) \
35 __VA_ARGS__; \
36 { \
37 move r1, zero; \
38 jrp lr \
39 }; \
40 STD_ENDPROC(futex_##name); \
41 .pushsection __ex_table,"a"; \
42 .quad 1b, get_user_fault; \
43 .popsection
44
45 .pushsection .fixup,"ax"
46get_user_fault:
47 { movei r1, -EFAULT; jrp lr }
48 ENDPROC(get_user_fault)
49 .popsection
50
51FUTEX_OP(cmpxchg, mtspr CMPEXCH_VALUE, r1; 1: cmpexch4 r0, r0, r2)
52FUTEX_OP(set, 1: exch4 r0, r0, r1)
53FUTEX_OP(add, 1: fetchadd4 r0, r0, r1)
54FUTEX_OP(or, 1: fetchor4 r0, r0, r1)
55FUTEX_OP(andn, nor r1, r1, zero; 1: fetchand4 r0, r0, r1)
diff --git a/arch/tile/kernel/hardwall.c b/arch/tile/kernel/hardwall.c
index df27a1fd94a3..531f4c365351 100644
--- a/arch/tile/kernel/hardwall.c
+++ b/arch/tile/kernel/hardwall.c
@@ -66,7 +66,7 @@ static struct hardwall_type hardwall_types[] = {
66 0, 66 0,
67 "udn", 67 "udn",
68 LIST_HEAD_INIT(hardwall_types[HARDWALL_UDN].list), 68 LIST_HEAD_INIT(hardwall_types[HARDWALL_UDN].list),
69 __SPIN_LOCK_INITIALIZER(hardwall_types[HARDWALL_UDN].lock), 69 __SPIN_LOCK_UNLOCKED(hardwall_types[HARDWALL_UDN].lock),
70 NULL 70 NULL
71 }, 71 },
72#ifndef __tilepro__ 72#ifndef __tilepro__
@@ -77,7 +77,7 @@ static struct hardwall_type hardwall_types[] = {
77 1, /* disabled pending hypervisor support */ 77 1, /* disabled pending hypervisor support */
78 "idn", 78 "idn",
79 LIST_HEAD_INIT(hardwall_types[HARDWALL_IDN].list), 79 LIST_HEAD_INIT(hardwall_types[HARDWALL_IDN].list),
80 __SPIN_LOCK_INITIALIZER(hardwall_types[HARDWALL_IDN].lock), 80 __SPIN_LOCK_UNLOCKED(hardwall_types[HARDWALL_IDN].lock),
81 NULL 81 NULL
82 }, 82 },
83 { /* access to user-space IPI */ 83 { /* access to user-space IPI */
@@ -87,7 +87,7 @@ static struct hardwall_type hardwall_types[] = {
87 0, 87 0,
88 "ipi", 88 "ipi",
89 LIST_HEAD_INIT(hardwall_types[HARDWALL_IPI].list), 89 LIST_HEAD_INIT(hardwall_types[HARDWALL_IPI].list),
90 __SPIN_LOCK_INITIALIZER(hardwall_types[HARDWALL_IPI].lock), 90 __SPIN_LOCK_UNLOCKED(hardwall_types[HARDWALL_IPI].lock),
91 NULL 91 NULL
92 }, 92 },
93#endif 93#endif
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S
index 088d5c141e68..2cbe6d5dd6b0 100644
--- a/arch/tile/kernel/intvec_32.S
+++ b/arch/tile/kernel/intvec_32.S
@@ -815,6 +815,9 @@ STD_ENTRY(interrupt_return)
815 } 815 }
816 bzt r28, 1f 816 bzt r28, 1f
817 bnz r29, 1f 817 bnz r29, 1f
818 /* Disable interrupts explicitly for preemption. */
819 IRQ_DISABLE(r20,r21)
820 TRACE_IRQS_OFF
818 jal preempt_schedule_irq 821 jal preempt_schedule_irq
819 FEEDBACK_REENTER(interrupt_return) 822 FEEDBACK_REENTER(interrupt_return)
8201: 8231:
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S
index ec755d3f3734..b8fc497f2437 100644
--- a/arch/tile/kernel/intvec_64.S
+++ b/arch/tile/kernel/intvec_64.S
@@ -841,6 +841,9 @@ STD_ENTRY(interrupt_return)
841 } 841 }
842 beqzt r28, 1f 842 beqzt r28, 1f
843 bnez r29, 1f 843 bnez r29, 1f
844 /* Disable interrupts explicitly for preemption. */
845 IRQ_DISABLE(r20,r21)
846 TRACE_IRQS_OFF
844 jal preempt_schedule_irq 847 jal preempt_schedule_irq
845 FEEDBACK_REENTER(interrupt_return) 848 FEEDBACK_REENTER(interrupt_return)
8461: 8491:
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index b7180e6e900d..c45593db7718 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -251,15 +251,12 @@ static void fixup_read_and_payload_sizes(void)
251 /* Scan for the smallest maximum payload size. */ 251 /* Scan for the smallest maximum payload size. */
252 for_each_pci_dev(dev) { 252 for_each_pci_dev(dev) {
253 u32 devcap; 253 u32 devcap;
254 int max_payload;
255 254
256 if (!pci_is_pcie(dev)) 255 if (!pci_is_pcie(dev))
257 continue; 256 continue;
258 257
259 pcie_capability_read_dword(dev, PCI_EXP_DEVCAP, &devcap); 258 if (dev->pcie_mpss < smallest_max_payload)
260 max_payload = devcap & PCI_EXP_DEVCAP_PAYLOAD; 259 smallest_max_payload = dev->pcie_mpss;
261 if (max_payload < smallest_max_payload)
262 smallest_max_payload = max_payload;
263 } 260 }
264 261
265 /* Now, set the max_payload_size for all devices to that value. */ 262 /* Now, set the max_payload_size for all devices to that value. */
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c
index 4c34caea9dd3..74c91729a62a 100644
--- a/arch/tile/kernel/setup.c
+++ b/arch/tile/kernel/setup.c
@@ -1268,8 +1268,7 @@ static void __init validate_va(void)
1268 if ((long)VMALLOC_START >= 0) 1268 if ((long)VMALLOC_START >= 0)
1269 early_panic( 1269 early_panic(
1270 "Linux VMALLOC region below the 2GB line (%#lx)!\n" 1270 "Linux VMALLOC region below the 2GB line (%#lx)!\n"
1271 "Reconfigure the kernel with fewer NR_HUGE_VMAPS\n" 1271 "Reconfigure the kernel with smaller VMALLOC_RESERVE.\n",
1272 "or smaller VMALLOC_RESERVE.\n",
1273 VMALLOC_START); 1272 VMALLOC_START);
1274#endif 1273#endif
1275} 1274}
diff --git a/arch/tile/kernel/stack.c b/arch/tile/kernel/stack.c
index 362284af3afd..c93977a62116 100644
--- a/arch/tile/kernel/stack.c
+++ b/arch/tile/kernel/stack.c
@@ -23,6 +23,7 @@
23#include <linux/mmzone.h> 23#include <linux/mmzone.h>
24#include <linux/dcache.h> 24#include <linux/dcache.h>
25#include <linux/fs.h> 25#include <linux/fs.h>
26#include <linux/string.h>
26#include <asm/backtrace.h> 27#include <asm/backtrace.h>
27#include <asm/page.h> 28#include <asm/page.h>
28#include <asm/ucontext.h> 29#include <asm/ucontext.h>
@@ -332,21 +333,18 @@ static void describe_addr(struct KBacktraceIterator *kbt,
332 } 333 }
333 334
334 if (vma->vm_file) { 335 if (vma->vm_file) {
335 char *s;
336 p = d_path(&vma->vm_file->f_path, buf, bufsize); 336 p = d_path(&vma->vm_file->f_path, buf, bufsize);
337 if (IS_ERR(p)) 337 if (IS_ERR(p))
338 p = "?"; 338 p = "?";
339 s = strrchr(p, '/'); 339 name = kbasename(p);
340 if (s)
341 p = s+1;
342 } else { 340 } else {
343 p = "anon"; 341 name = "anon";
344 } 342 }
345 343
346 /* Generate a string description of the vma info. */ 344 /* Generate a string description of the vma info. */
347 namelen = strlen(p); 345 namelen = strlen(name);
348 remaining = (bufsize - 1) - namelen; 346 remaining = (bufsize - 1) - namelen;
349 memmove(buf, p, namelen); 347 memmove(buf, name, namelen);
350 snprintf(buf + namelen, remaining, "[%lx+%lx] ", 348 snprintf(buf + namelen, remaining, "[%lx+%lx] ",
351 vma->vm_start, vma->vm_end - vma->vm_start); 349 vma->vm_start, vma->vm_end - vma->vm_start);
352} 350}
diff --git a/arch/tile/kernel/unaligned.c b/arch/tile/kernel/unaligned.c
index b425fb6a480d..b030b4e78845 100644
--- a/arch/tile/kernel/unaligned.c
+++ b/arch/tile/kernel/unaligned.c
@@ -551,8 +551,8 @@ static tilegx_bundle_bits jit_x1_bnezt(int ra, int broff)
551/* 551/*
552 * This function generates unalign fixup JIT. 552 * This function generates unalign fixup JIT.
553 * 553 *
554 * We fist find unalign load/store instruction's destination, source 554 * We first find unalign load/store instruction's destination, source
555 * reguisters: ra, rb and rd. and 3 scratch registers by calling 555 * registers: ra, rb and rd. and 3 scratch registers by calling
556 * find_regs(...). 3 scratch clobbers should not alias with any register 556 * find_regs(...). 3 scratch clobbers should not alias with any register
557 * used in the fault bundle. Then analyze the fault bundle to determine 557 * used in the fault bundle. Then analyze the fault bundle to determine
558 * if it's a load or store, operand width, branch or address increment etc. 558 * if it's a load or store, operand width, branch or address increment etc.
diff --git a/arch/tile/lib/atomic_32.c b/arch/tile/lib/atomic_32.c
index 759efa337be8..c89b211fd9e7 100644
--- a/arch/tile/lib/atomic_32.c
+++ b/arch/tile/lib/atomic_32.c
@@ -107,19 +107,19 @@ unsigned long _atomic_xor(volatile unsigned long *p, unsigned long mask)
107EXPORT_SYMBOL(_atomic_xor); 107EXPORT_SYMBOL(_atomic_xor);
108 108
109 109
110u64 _atomic64_xchg(u64 *v, u64 n) 110long long _atomic64_xchg(long long *v, long long n)
111{ 111{
112 return __atomic64_xchg(v, __atomic_setup(v), n); 112 return __atomic64_xchg(v, __atomic_setup(v), n);
113} 113}
114EXPORT_SYMBOL(_atomic64_xchg); 114EXPORT_SYMBOL(_atomic64_xchg);
115 115
116u64 _atomic64_xchg_add(u64 *v, u64 i) 116long long _atomic64_xchg_add(long long *v, long long i)
117{ 117{
118 return __atomic64_xchg_add(v, __atomic_setup(v), i); 118 return __atomic64_xchg_add(v, __atomic_setup(v), i);
119} 119}
120EXPORT_SYMBOL(_atomic64_xchg_add); 120EXPORT_SYMBOL(_atomic64_xchg_add);
121 121
122u64 _atomic64_xchg_add_unless(u64 *v, u64 a, u64 u) 122long long _atomic64_xchg_add_unless(long long *v, long long a, long long u)
123{ 123{
124 /* 124 /*
125 * Note: argument order is switched here since it is easier 125 * Note: argument order is switched here since it is easier
@@ -130,7 +130,7 @@ u64 _atomic64_xchg_add_unless(u64 *v, u64 a, u64 u)
130} 130}
131EXPORT_SYMBOL(_atomic64_xchg_add_unless); 131EXPORT_SYMBOL(_atomic64_xchg_add_unless);
132 132
133u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n) 133long long _atomic64_cmpxchg(long long *v, long long o, long long n)
134{ 134{
135 return __atomic64_cmpxchg(v, __atomic_setup(v), o, n); 135 return __atomic64_cmpxchg(v, __atomic_setup(v), o, n);
136} 136}
diff --git a/arch/tile/mm/fault.c b/arch/tile/mm/fault.c
index 4c288f199453..6c0571216a9d 100644
--- a/arch/tile/mm/fault.c
+++ b/arch/tile/mm/fault.c
@@ -149,8 +149,6 @@ static inline int vmalloc_fault(pgd_t *pgd, unsigned long address)
149 pmd_k = vmalloc_sync_one(pgd, address); 149 pmd_k = vmalloc_sync_one(pgd, address);
150 if (!pmd_k) 150 if (!pmd_k)
151 return -1; 151 return -1;
152 if (pmd_huge(*pmd_k))
153 return 0; /* support TILE huge_vmap() API */
154 pte_k = pte_offset_kernel(pmd_k, address); 152 pte_k = pte_offset_kernel(pmd_k, address);
155 if (!pte_present(*pte_k)) 153 if (!pte_present(*pte_k))
156 return -1; 154 return -1;
diff --git a/arch/tile/mm/init.c b/arch/tile/mm/init.c
index 4e316deb92fd..0fa1acfac79a 100644
--- a/arch/tile/mm/init.c
+++ b/arch/tile/mm/init.c
@@ -828,10 +828,6 @@ void __init mem_init(void)
828 printk(KERN_DEBUG " PKMAP %#lx - %#lx\n", 828 printk(KERN_DEBUG " PKMAP %#lx - %#lx\n",
829 PKMAP_BASE, PKMAP_ADDR(LAST_PKMAP) - 1); 829 PKMAP_BASE, PKMAP_ADDR(LAST_PKMAP) - 1);
830#endif 830#endif
831#ifdef CONFIG_HUGEVMAP
832 printk(KERN_DEBUG " HUGEMAP %#lx - %#lx\n",
833 HUGE_VMAP_BASE, HUGE_VMAP_END - 1);
834#endif
835 printk(KERN_DEBUG " VMALLOC %#lx - %#lx\n", 831 printk(KERN_DEBUG " VMALLOC %#lx - %#lx\n",
836 _VMALLOC_START, _VMALLOC_END - 1); 832 _VMALLOC_START, _VMALLOC_END - 1);
837#ifdef __tilegx__ 833#ifdef __tilegx__
diff --git a/arch/tile/mm/pgtable.c b/arch/tile/mm/pgtable.c
index 2deaddf3e01f..5e86eac4bfae 100644
--- a/arch/tile/mm/pgtable.c
+++ b/arch/tile/mm/pgtable.c
@@ -127,8 +127,7 @@ void shatter_huge_page(unsigned long addr)
127 } 127 }
128 128
129 /* Shatter the huge page into the preallocated L2 page table. */ 129 /* Shatter the huge page into the preallocated L2 page table. */
130 pmd_populate_kernel(&init_mm, pmd, 130 pmd_populate_kernel(&init_mm, pmd, get_prealloc_pte(pmd_pfn(*pmd)));
131 get_prealloc_pte(pte_pfn(*(pte_t *)pmd)));
132 131
133#ifdef __PAGETABLE_PMD_FOLDED 132#ifdef __PAGETABLE_PMD_FOLDED
134 /* Walk every pgd on the system and update the pmd there. */ 133 /* Walk every pgd on the system and update the pmd there. */
@@ -242,6 +241,11 @@ struct page *pgtable_alloc_one(struct mm_struct *mm, unsigned long address,
242 if (p == NULL) 241 if (p == NULL)
243 return NULL; 242 return NULL;
244 243
244 if (!pgtable_page_ctor(p)) {
245 __free_pages(p, L2_USER_PGTABLE_ORDER);
246 return NULL;
247 }
248
245 /* 249 /*
246 * Make every page have a page_count() of one, not just the first. 250 * Make every page have a page_count() of one, not just the first.
247 * We don't use __GFP_COMP since it doesn't look like it works 251 * We don't use __GFP_COMP since it doesn't look like it works
@@ -252,7 +256,6 @@ struct page *pgtable_alloc_one(struct mm_struct *mm, unsigned long address,
252 inc_zone_page_state(p+i, NR_PAGETABLE); 256 inc_zone_page_state(p+i, NR_PAGETABLE);
253 } 257 }
254 258
255 pgtable_page_ctor(p);
256 return p; 259 return p;
257} 260}
258 261
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
index b30f34a79882..fdde187e6087 100644
--- a/arch/um/include/asm/Kbuild
+++ b/arch/um/include/asm/Kbuild
@@ -3,3 +3,4 @@ generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h topology.h xor.h
3generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h exec.h 3generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h exec.h
4generic-y += switch_to.h clkdev.h 4generic-y += switch_to.h clkdev.h
5generic-y += trace_clock.h 5generic-y += trace_clock.h
6generic-y += preempt.h
diff --git a/arch/um/kernel/exitcode.c b/arch/um/kernel/exitcode.c
index 829df49dee99..41ebbfebb333 100644
--- a/arch/um/kernel/exitcode.c
+++ b/arch/um/kernel/exitcode.c
@@ -40,9 +40,11 @@ static ssize_t exitcode_proc_write(struct file *file,
40 const char __user *buffer, size_t count, loff_t *pos) 40 const char __user *buffer, size_t count, loff_t *pos)
41{ 41{
42 char *end, buf[sizeof("nnnnn\0")]; 42 char *end, buf[sizeof("nnnnn\0")];
43 size_t size;
43 int tmp; 44 int tmp;
44 45
45 if (copy_from_user(buf, buffer, count)) 46 size = min(count, sizeof(buf));
47 if (copy_from_user(buf, buffer, size))
46 return -EFAULT; 48 return -EFAULT;
47 49
48 tmp = simple_strtol(buf, &end, 0); 50 tmp = simple_strtol(buf, &end, 0);
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 7ddb64baf327..8636e905426f 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -279,8 +279,12 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
279 struct page *pte; 279 struct page *pte;
280 280
281 pte = alloc_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); 281 pte = alloc_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
282 if (pte) 282 if (!pte)
283 pgtable_page_ctor(pte); 283 return NULL;
284 if (!pgtable_page_ctor(pte)) {
285 __free_page(pte);
286 return NULL;
287 }
284 return pte; 288 return pte;
285} 289}
286 290
diff --git a/arch/unicore32/include/asm/Kbuild b/arch/unicore32/include/asm/Kbuild
index 89d8b6c4e39a..00045cbe5c63 100644
--- a/arch/unicore32/include/asm/Kbuild
+++ b/arch/unicore32/include/asm/Kbuild
@@ -60,3 +60,4 @@ generic-y += unaligned.h
60generic-y += user.h 60generic-y += user.h
61generic-y += vga.h 61generic-y += vga.h
62generic-y += xor.h 62generic-y += xor.h
63generic-y += preempt.h
diff --git a/arch/unicore32/include/asm/pgalloc.h b/arch/unicore32/include/asm/pgalloc.h
index 0213e373a895..2e02d1356fdf 100644
--- a/arch/unicore32/include/asm/pgalloc.h
+++ b/arch/unicore32/include/asm/pgalloc.h
@@ -51,12 +51,14 @@ pte_alloc_one(struct mm_struct *mm, unsigned long addr)
51 struct page *pte; 51 struct page *pte;
52 52
53 pte = alloc_pages(PGALLOC_GFP, 0); 53 pte = alloc_pages(PGALLOC_GFP, 0);
54 if (pte) { 54 if (!pte)
55 if (!PageHighMem(pte)) { 55 return NULL;
56 void *page = page_address(pte); 56 if (!PageHighMem(pte)) {
57 clean_dcache_area(page, PTRS_PER_PTE * sizeof(pte_t)); 57 void *page = page_address(pte);
58 } 58 clean_dcache_area(page, PTRS_PER_PTE * sizeof(pte_t));
59 pgtable_page_ctor(pte); 59 }
60 if (!pgtable_page_ctor(pte)) {
61 __free_page(pte);
60 } 62 }
61 63
62 return pte; 64 return pte;
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5ed65706765d..e903c71f7e69 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -91,7 +91,6 @@ config X86
91 select GENERIC_IRQ_SHOW 91 select GENERIC_IRQ_SHOW
92 select GENERIC_CLOCKEVENTS_MIN_ADJUST 92 select GENERIC_CLOCKEVENTS_MIN_ADJUST
93 select IRQ_FORCED_THREADING 93 select IRQ_FORCED_THREADING
94 select USE_GENERIC_SMP_HELPERS if SMP
95 select HAVE_BPF_JIT if X86_64 94 select HAVE_BPF_JIT if X86_64
96 select HAVE_ARCH_TRANSPARENT_HUGEPAGE 95 select HAVE_ARCH_TRANSPARENT_HUGEPAGE
97 select CLKEVT_I8253 96 select CLKEVT_I8253
@@ -124,6 +123,7 @@ config X86
124 select COMPAT_OLD_SIGACTION if IA32_EMULATION 123 select COMPAT_OLD_SIGACTION if IA32_EMULATION
125 select RTC_LIB 124 select RTC_LIB
126 select HAVE_DEBUG_STACKOVERFLOW 125 select HAVE_DEBUG_STACKOVERFLOW
126 select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64
127 127
128config INSTRUCTION_DECODER 128config INSTRUCTION_DECODER
129 def_bool y 129 def_bool y
@@ -255,10 +255,6 @@ config ARCH_HWEIGHT_CFLAGS
255 default "-fcall-saved-ecx -fcall-saved-edx" if X86_32 255 default "-fcall-saved-ecx -fcall-saved-edx" if X86_32
256 default "-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" if X86_64 256 default "-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" if X86_64
257 257
258config ARCH_CPU_PROBE_RELEASE
259 def_bool y
260 depends on HOTPLUG_CPU
261
262config ARCH_SUPPORTS_UPROBES 258config ARCH_SUPPORTS_UPROBES
263 def_bool y 259 def_bool y
264 260
@@ -482,11 +478,12 @@ config X86_INTEL_LPSS
482 bool "Intel Low Power Subsystem Support" 478 bool "Intel Low Power Subsystem Support"
483 depends on ACPI 479 depends on ACPI
484 select COMMON_CLK 480 select COMMON_CLK
481 select PINCTRL
485 ---help--- 482 ---help---
486 Select to build support for Intel Low Power Subsystem such as 483 Select to build support for Intel Low Power Subsystem such as
487 found on Intel Lynxpoint PCH. Selecting this option enables 484 found on Intel Lynxpoint PCH. Selecting this option enables
488 things like clock tree (common clock framework) which are needed 485 things like clock tree (common clock framework) and pincontrol
489 by the LPSS peripheral drivers. 486 which are needed by the LPSS peripheral drivers.
490 487
491config X86_RDC321X 488config X86_RDC321X
492 bool "RDC R-321x SoC" 489 bool "RDC R-321x SoC"
@@ -638,10 +635,10 @@ config PARAVIRT_SPINLOCKS
638 spinlock implementation with something virtualization-friendly 635 spinlock implementation with something virtualization-friendly
639 (for example, block the virtual CPU rather than spinning). 636 (for example, block the virtual CPU rather than spinning).
640 637
641 Unfortunately the downside is an up to 5% performance hit on 638 It has a minimal impact on native kernels and gives a nice performance
642 native kernels, with various workloads. 639 benefit on paravirtualized KVM / Xen kernels.
643 640
644 If you are unsure how to answer this question, answer N. 641 If you are unsure how to answer this question, answer Y.
645 642
646source "arch/x86/xen/Kconfig" 643source "arch/x86/xen/Kconfig"
647 644
@@ -756,20 +753,25 @@ config DMI
756 BIOS code. 753 BIOS code.
757 754
758config GART_IOMMU 755config GART_IOMMU
759 bool "GART IOMMU support" if EXPERT 756 bool "Old AMD GART IOMMU support"
760 default y
761 select SWIOTLB 757 select SWIOTLB
762 depends on X86_64 && PCI && AMD_NB 758 depends on X86_64 && PCI && AMD_NB
763 ---help--- 759 ---help---
764 Support for full DMA access of devices with 32bit memory access only 760 Provides a driver for older AMD Athlon64/Opteron/Turion/Sempron
765 on systems with more than 3GB. This is usually needed for USB, 761 GART based hardware IOMMUs.
766 sound, many IDE/SATA chipsets and some other devices. 762
767 Provides a driver for the AMD Athlon64/Opteron/Turion/Sempron GART 763 The GART supports full DMA access for devices with 32-bit access
768 based hardware IOMMU and a software bounce buffer based IOMMU used 764 limitations, on systems with more than 3 GB. This is usually needed
769 on Intel systems and as fallback. 765 for USB, sound, many IDE/SATA chipsets and some other devices.
770 The code is only active when needed (enough memory and limited 766
771 device) unless CONFIG_IOMMU_DEBUG or iommu=force is specified 767 Newer systems typically have a modern AMD IOMMU, supported via
772 too. 768 the CONFIG_AMD_IOMMU=y config option.
769
770 In normal configurations this driver is only active when needed:
771 there's more than 3 GB of memory and the system contains a
772 32-bit limited device.
773
774 If unsure, say Y.
773 775
774config CALGARY_IOMMU 776config CALGARY_IOMMU
775 bool "IBM Calgary IOMMU support" 777 bool "IBM Calgary IOMMU support"
@@ -825,14 +827,16 @@ config MAXSMP
825config NR_CPUS 827config NR_CPUS
826 int "Maximum number of CPUs" if SMP && !MAXSMP 828 int "Maximum number of CPUs" if SMP && !MAXSMP
827 range 2 8 if SMP && X86_32 && !X86_BIGSMP 829 range 2 8 if SMP && X86_32 && !X86_BIGSMP
828 range 2 512 if SMP && !MAXSMP 830 range 2 512 if SMP && !MAXSMP && !CPUMASK_OFFSTACK
831 range 2 8192 if SMP && !MAXSMP && CPUMASK_OFFSTACK && X86_64
829 default "1" if !SMP 832 default "1" if !SMP
830 default "4096" if MAXSMP 833 default "8192" if MAXSMP
831 default "32" if SMP && (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000) 834 default "32" if SMP && (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000)
832 default "8" if SMP 835 default "8" if SMP
833 ---help--- 836 ---help---
834 This allows you to specify the maximum number of CPUs which this 837 This allows you to specify the maximum number of CPUs which this
835 kernel will support. The maximum supported value is 512 and the 838 kernel will support. If CPUMASK_OFFSTACK is enabled, the maximum
839 supported value is 4096, otherwise the maximum value is 512. The
836 minimum value which makes sense is 2. 840 minimum value which makes sense is 2.
837 841
838 This is purely to save memory - each supported CPU adds 842 This is purely to save memory - each supported CPU adds
@@ -860,7 +864,7 @@ source "kernel/Kconfig.preempt"
860 864
861config X86_UP_APIC 865config X86_UP_APIC
862 bool "Local APIC support on uniprocessors" 866 bool "Local APIC support on uniprocessors"
863 depends on X86_32 && !SMP && !X86_32_NON_STANDARD 867 depends on X86_32 && !SMP && !X86_32_NON_STANDARD && !PCI_MSI
864 ---help--- 868 ---help---
865 A local APIC (Advanced Programmable Interrupt Controller) is an 869 A local APIC (Advanced Programmable Interrupt Controller) is an
866 integrated interrupt controller in the CPU. If you have a single-CPU 870 integrated interrupt controller in the CPU. If you have a single-CPU
@@ -885,11 +889,11 @@ config X86_UP_IOAPIC
885 889
886config X86_LOCAL_APIC 890config X86_LOCAL_APIC
887 def_bool y 891 def_bool y
888 depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC 892 depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC || PCI_MSI
889 893
890config X86_IO_APIC 894config X86_IO_APIC
891 def_bool y 895 def_bool y
892 depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_IOAPIC 896 depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_IOAPIC || PCI_MSI
893 897
894config X86_VISWS_APIC 898config X86_VISWS_APIC
895 def_bool y 899 def_bool y
@@ -1033,6 +1037,7 @@ config X86_REBOOTFIXUPS
1033 1037
1034config MICROCODE 1038config MICROCODE
1035 tristate "CPU microcode loading support" 1039 tristate "CPU microcode loading support"
1040 depends on CPU_SUP_AMD || CPU_SUP_INTEL
1036 select FW_LOADER 1041 select FW_LOADER
1037 ---help--- 1042 ---help---
1038 1043
@@ -1593,7 +1598,7 @@ config EFI_STUB
1593 This kernel feature allows a bzImage to be loaded directly 1598 This kernel feature allows a bzImage to be loaded directly
1594 by EFI firmware without the use of a bootloader. 1599 by EFI firmware without the use of a bootloader.
1595 1600
1596 See Documentation/x86/efi-stub.txt for more information. 1601 See Documentation/efi-stub.txt for more information.
1597 1602
1598config SECCOMP 1603config SECCOMP
1599 def_bool y 1604 def_bool y
@@ -1880,6 +1885,10 @@ config USE_PERCPU_NUMA_NODE_ID
1880 def_bool y 1885 def_bool y
1881 depends on NUMA 1886 depends on NUMA
1882 1887
1888config ARCH_ENABLE_SPLIT_PMD_PTLOCK
1889 def_bool y
1890 depends on X86_64 || X86_PAE
1891
1883menu "Power management and ACPI options" 1892menu "Power management and ACPI options"
1884 1893
1885config ARCH_HIBERNATION_HEADER 1894config ARCH_HIBERNATION_HEADER
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 78d91afb8e50..0f3621ed1db6 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -59,6 +59,16 @@ 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 EARLY_PRINTK_EFI
63 bool "Early printk via the EFI framebuffer"
64 depends on EFI && EARLY_PRINTK
65 select FONT_SUPPORT
66 ---help---
67 Write kernel log output directly into the EFI framebuffer.
68
69 This is useful for kernel debugging when your machine crashes very
70 early before the console code is initialized.
71
62config X86_PTDUMP 72config X86_PTDUMP
63 bool "Export kernel pagetable layout to userspace via debugfs" 73 bool "Export kernel pagetable layout to userspace via debugfs"
64 depends on DEBUG_KERNEL 74 depends on DEBUG_KERNEL
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index 379814bc41e3..dce69a256896 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -71,7 +71,8 @@ GCOV_PROFILE := n
71$(obj)/bzImage: asflags-y := $(SVGA_MODE) 71$(obj)/bzImage: asflags-y := $(SVGA_MODE)
72 72
73quiet_cmd_image = BUILD $@ 73quiet_cmd_image = BUILD $@
74cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/zoffset.h > $@ 74cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \
75 $(obj)/zoffset.h $@
75 76
76$(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE 77$(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE
77 $(call if_changed,image) 78 $(call if_changed,image)
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index b7388a425f09..a7677babf946 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -19,214 +19,10 @@
19 19
20static efi_system_table_t *sys_table; 20static efi_system_table_t *sys_table;
21 21
22static void efi_char16_printk(efi_char16_t *str)
23{
24 struct efi_simple_text_output_protocol *out;
25
26 out = (struct efi_simple_text_output_protocol *)sys_table->con_out;
27 efi_call_phys2(out->output_string, out, str);
28}
29
30static void efi_printk(char *str)
31{
32 char *s8;
33
34 for (s8 = str; *s8; s8++) {
35 efi_char16_t ch[2] = { 0 };
36
37 ch[0] = *s8;
38 if (*s8 == '\n') {
39 efi_char16_t nl[2] = { '\r', 0 };
40 efi_char16_printk(nl);
41 }
42
43 efi_char16_printk(ch);
44 }
45}
46
47static efi_status_t __get_map(efi_memory_desc_t **map, unsigned long *map_size,
48 unsigned long *desc_size)
49{
50 efi_memory_desc_t *m = NULL;
51 efi_status_t status;
52 unsigned long key;
53 u32 desc_version;
54
55 *map_size = sizeof(*m) * 32;
56again:
57 /*
58 * Add an additional efi_memory_desc_t because we're doing an
59 * allocation which may be in a new descriptor region.
60 */
61 *map_size += sizeof(*m);
62 status = efi_call_phys3(sys_table->boottime->allocate_pool,
63 EFI_LOADER_DATA, *map_size, (void **)&m);
64 if (status != EFI_SUCCESS)
65 goto fail;
66
67 status = efi_call_phys5(sys_table->boottime->get_memory_map, map_size,
68 m, &key, desc_size, &desc_version);
69 if (status == EFI_BUFFER_TOO_SMALL) {
70 efi_call_phys1(sys_table->boottime->free_pool, m);
71 goto again;
72 }
73
74 if (status != EFI_SUCCESS)
75 efi_call_phys1(sys_table->boottime->free_pool, m);
76 22
77fail: 23#include "../../../../drivers/firmware/efi/efi-stub-helper.c"
78 *map = m;
79 return status;
80}
81
82/*
83 * Allocate at the highest possible address that is not above 'max'.
84 */
85static efi_status_t high_alloc(unsigned long size, unsigned long align,
86 unsigned long *addr, unsigned long max)
87{
88 unsigned long map_size, desc_size;
89 efi_memory_desc_t *map;
90 efi_status_t status;
91 unsigned long nr_pages;
92 u64 max_addr = 0;
93 int i;
94
95 status = __get_map(&map, &map_size, &desc_size);
96 if (status != EFI_SUCCESS)
97 goto fail;
98
99 nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
100again:
101 for (i = 0; i < map_size / desc_size; i++) {
102 efi_memory_desc_t *desc;
103 unsigned long m = (unsigned long)map;
104 u64 start, end;
105
106 desc = (efi_memory_desc_t *)(m + (i * desc_size));
107 if (desc->type != EFI_CONVENTIONAL_MEMORY)
108 continue;
109
110 if (desc->num_pages < nr_pages)
111 continue;
112 24
113 start = desc->phys_addr;
114 end = start + desc->num_pages * (1UL << EFI_PAGE_SHIFT);
115 25
116 if ((start + size) > end || (start + size) > max)
117 continue;
118
119 if (end - size > max)
120 end = max;
121
122 if (round_down(end - size, align) < start)
123 continue;
124
125 start = round_down(end - size, align);
126
127 /*
128 * Don't allocate at 0x0. It will confuse code that
129 * checks pointers against NULL.
130 */
131 if (start == 0x0)
132 continue;
133
134 if (start > max_addr)
135 max_addr = start;
136 }
137
138 if (!max_addr)
139 status = EFI_NOT_FOUND;
140 else {
141 status = efi_call_phys4(sys_table->boottime->allocate_pages,
142 EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA,
143 nr_pages, &max_addr);
144 if (status != EFI_SUCCESS) {
145 max = max_addr;
146 max_addr = 0;
147 goto again;
148 }
149
150 *addr = max_addr;
151 }
152
153free_pool:
154 efi_call_phys1(sys_table->boottime->free_pool, map);
155
156fail:
157 return status;
158}
159
160/*
161 * Allocate at the lowest possible address.
162 */
163static efi_status_t low_alloc(unsigned long size, unsigned long align,
164 unsigned long *addr)
165{
166 unsigned long map_size, desc_size;
167 efi_memory_desc_t *map;
168 efi_status_t status;
169 unsigned long nr_pages;
170 int i;
171
172 status = __get_map(&map, &map_size, &desc_size);
173 if (status != EFI_SUCCESS)
174 goto fail;
175
176 nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
177 for (i = 0; i < map_size / desc_size; i++) {
178 efi_memory_desc_t *desc;
179 unsigned long m = (unsigned long)map;
180 u64 start, end;
181
182 desc = (efi_memory_desc_t *)(m + (i * desc_size));
183
184 if (desc->type != EFI_CONVENTIONAL_MEMORY)
185 continue;
186
187 if (desc->num_pages < nr_pages)
188 continue;
189
190 start = desc->phys_addr;
191 end = start + desc->num_pages * (1UL << EFI_PAGE_SHIFT);
192
193 /*
194 * Don't allocate at 0x0. It will confuse code that
195 * checks pointers against NULL. Skip the first 8
196 * bytes so we start at a nice even number.
197 */
198 if (start == 0x0)
199 start += 8;
200
201 start = round_up(start, align);
202 if ((start + size) > end)
203 continue;
204
205 status = efi_call_phys4(sys_table->boottime->allocate_pages,
206 EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA,
207 nr_pages, &start);
208 if (status == EFI_SUCCESS) {
209 *addr = start;
210 break;
211 }
212 }
213
214 if (i == map_size / desc_size)
215 status = EFI_NOT_FOUND;
216
217free_pool:
218 efi_call_phys1(sys_table->boottime->free_pool, map);
219fail:
220 return status;
221}
222
223static void low_free(unsigned long size, unsigned long addr)
224{
225 unsigned long nr_pages;
226
227 nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
228 efi_call_phys2(sys_table->boottime->free_pages, addr, nr_pages);
229}
230 26
231static void find_bits(unsigned long mask, u8 *pos, u8 *size) 27static void find_bits(unsigned long mask, u8 *pos, u8 *size)
232{ 28{
@@ -624,242 +420,6 @@ void setup_graphics(struct boot_params *boot_params)
624 } 420 }
625} 421}
626 422
627struct initrd {
628 efi_file_handle_t *handle;
629 u64 size;
630};
631
632/*
633 * Check the cmdline for a LILO-style initrd= arguments.
634 *
635 * We only support loading an initrd from the same filesystem as the
636 * kernel image.
637 */
638static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
639 struct setup_header *hdr)
640{
641 struct initrd *initrds;
642 unsigned long initrd_addr;
643 efi_guid_t fs_proto = EFI_FILE_SYSTEM_GUID;
644 u64 initrd_total;
645 efi_file_io_interface_t *io;
646 efi_file_handle_t *fh;
647 efi_status_t status;
648 int nr_initrds;
649 char *str;
650 int i, j, k;
651
652 initrd_addr = 0;
653 initrd_total = 0;
654
655 str = (char *)(unsigned long)hdr->cmd_line_ptr;
656
657 j = 0; /* See close_handles */
658
659 if (!str || !*str)
660 return EFI_SUCCESS;
661
662 for (nr_initrds = 0; *str; nr_initrds++) {
663 str = strstr(str, "initrd=");
664 if (!str)
665 break;
666
667 str += 7;
668
669 /* Skip any leading slashes */
670 while (*str == '/' || *str == '\\')
671 str++;
672
673 while (*str && *str != ' ' && *str != '\n')
674 str++;
675 }
676
677 if (!nr_initrds)
678 return EFI_SUCCESS;
679
680 status = efi_call_phys3(sys_table->boottime->allocate_pool,
681 EFI_LOADER_DATA,
682 nr_initrds * sizeof(*initrds),
683 &initrds);
684 if (status != EFI_SUCCESS) {
685 efi_printk("Failed to alloc mem for initrds\n");
686 goto fail;
687 }
688
689 str = (char *)(unsigned long)hdr->cmd_line_ptr;
690 for (i = 0; i < nr_initrds; i++) {
691 struct initrd *initrd;
692 efi_file_handle_t *h;
693 efi_file_info_t *info;
694 efi_char16_t filename_16[256];
695 unsigned long info_sz;
696 efi_guid_t info_guid = EFI_FILE_INFO_ID;
697 efi_char16_t *p;
698 u64 file_sz;
699
700 str = strstr(str, "initrd=");
701 if (!str)
702 break;
703
704 str += 7;
705
706 initrd = &initrds[i];
707 p = filename_16;
708
709 /* Skip any leading slashes */
710 while (*str == '/' || *str == '\\')
711 str++;
712
713 while (*str && *str != ' ' && *str != '\n') {
714 if ((u8 *)p >= (u8 *)filename_16 + sizeof(filename_16))
715 break;
716
717 if (*str == '/') {
718 *p++ = '\\';
719 *str++;
720 } else {
721 *p++ = *str++;
722 }
723 }
724
725 *p = '\0';
726
727 /* Only open the volume once. */
728 if (!i) {
729 efi_boot_services_t *boottime;
730
731 boottime = sys_table->boottime;
732
733 status = efi_call_phys3(boottime->handle_protocol,
734 image->device_handle, &fs_proto, &io);
735 if (status != EFI_SUCCESS) {
736 efi_printk("Failed to handle fs_proto\n");
737 goto free_initrds;
738 }
739
740 status = efi_call_phys2(io->open_volume, io, &fh);
741 if (status != EFI_SUCCESS) {
742 efi_printk("Failed to open volume\n");
743 goto free_initrds;
744 }
745 }
746
747 status = efi_call_phys5(fh->open, fh, &h, filename_16,
748 EFI_FILE_MODE_READ, (u64)0);
749 if (status != EFI_SUCCESS) {
750 efi_printk("Failed to open initrd file: ");
751 efi_char16_printk(filename_16);
752 efi_printk("\n");
753 goto close_handles;
754 }
755
756 initrd->handle = h;
757
758 info_sz = 0;
759 status = efi_call_phys4(h->get_info, h, &info_guid,
760 &info_sz, NULL);
761 if (status != EFI_BUFFER_TOO_SMALL) {
762 efi_printk("Failed to get initrd info size\n");
763 goto close_handles;
764 }
765
766grow:
767 status = efi_call_phys3(sys_table->boottime->allocate_pool,
768 EFI_LOADER_DATA, info_sz, &info);
769 if (status != EFI_SUCCESS) {
770 efi_printk("Failed to alloc mem for initrd info\n");
771 goto close_handles;
772 }
773
774 status = efi_call_phys4(h->get_info, h, &info_guid,
775 &info_sz, info);
776 if (status == EFI_BUFFER_TOO_SMALL) {
777 efi_call_phys1(sys_table->boottime->free_pool, info);
778 goto grow;
779 }
780
781 file_sz = info->file_size;
782 efi_call_phys1(sys_table->boottime->free_pool, info);
783
784 if (status != EFI_SUCCESS) {
785 efi_printk("Failed to get initrd info\n");
786 goto close_handles;
787 }
788
789 initrd->size = file_sz;
790 initrd_total += file_sz;
791 }
792
793 if (initrd_total) {
794 unsigned long addr;
795
796 /*
797 * Multiple initrd's need to be at consecutive
798 * addresses in memory, so allocate enough memory for
799 * all the initrd's.
800 */
801 status = high_alloc(initrd_total, 0x1000,
802 &initrd_addr, hdr->initrd_addr_max);
803 if (status != EFI_SUCCESS) {
804 efi_printk("Failed to alloc highmem for initrds\n");
805 goto close_handles;
806 }
807
808 /* We've run out of free low memory. */
809 if (initrd_addr > hdr->initrd_addr_max) {
810 efi_printk("We've run out of free low memory\n");
811 status = EFI_INVALID_PARAMETER;
812 goto free_initrd_total;
813 }
814
815 addr = initrd_addr;
816 for (j = 0; j < nr_initrds; j++) {
817 u64 size;
818
819 size = initrds[j].size;
820 while (size) {
821 u64 chunksize;
822 if (size > EFI_READ_CHUNK_SIZE)
823 chunksize = EFI_READ_CHUNK_SIZE;
824 else
825 chunksize = size;
826 status = efi_call_phys3(fh->read,
827 initrds[j].handle,
828 &chunksize, addr);
829 if (status != EFI_SUCCESS) {
830 efi_printk("Failed to read initrd\n");
831 goto free_initrd_total;
832 }
833 addr += chunksize;
834 size -= chunksize;
835 }
836
837 efi_call_phys1(fh->close, initrds[j].handle);
838 }
839
840 }
841
842 efi_call_phys1(sys_table->boottime->free_pool, initrds);
843
844 hdr->ramdisk_image = initrd_addr;
845 hdr->ramdisk_size = initrd_total;
846
847 return status;
848
849free_initrd_total:
850 low_free(initrd_total, initrd_addr);
851
852close_handles:
853 for (k = j; k < i; k++)
854 efi_call_phys1(fh->close, initrds[k].handle);
855free_initrds:
856 efi_call_phys1(sys_table->boottime->free_pool, initrds);
857fail:
858 hdr->ramdisk_image = 0;
859 hdr->ramdisk_size = 0;
860
861 return status;
862}
863 423
864/* 424/*
865 * Because the x86 boot code expects to be passed a boot_params we 425 * Because the x86 boot code expects to be passed a boot_params we
@@ -875,14 +435,15 @@ struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table)
875 struct efi_info *efi; 435 struct efi_info *efi;
876 efi_loaded_image_t *image; 436 efi_loaded_image_t *image;
877 void *options; 437 void *options;
878 u32 load_options_size;
879 efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID; 438 efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID;
880 int options_size = 0; 439 int options_size = 0;
881 efi_status_t status; 440 efi_status_t status;
882 unsigned long cmdline; 441 char *cmdline_ptr;
883 u16 *s2; 442 u16 *s2;
884 u8 *s1; 443 u8 *s1;
885 int i; 444 int i;
445 unsigned long ramdisk_addr;
446 unsigned long ramdisk_size;
886 447
887 sys_table = _table; 448 sys_table = _table;
888 449
@@ -893,13 +454,14 @@ struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table)
893 status = efi_call_phys3(sys_table->boottime->handle_protocol, 454 status = efi_call_phys3(sys_table->boottime->handle_protocol,
894 handle, &proto, (void *)&image); 455 handle, &proto, (void *)&image);
895 if (status != EFI_SUCCESS) { 456 if (status != EFI_SUCCESS) {
896 efi_printk("Failed to get handle for LOADED_IMAGE_PROTOCOL\n"); 457 efi_printk(sys_table, "Failed to get handle for LOADED_IMAGE_PROTOCOL\n");
897 return NULL; 458 return NULL;
898 } 459 }
899 460
900 status = low_alloc(0x4000, 1, (unsigned long *)&boot_params); 461 status = efi_low_alloc(sys_table, 0x4000, 1,
462 (unsigned long *)&boot_params);
901 if (status != EFI_SUCCESS) { 463 if (status != EFI_SUCCESS) {
902 efi_printk("Failed to alloc lowmem for boot params\n"); 464 efi_printk(sys_table, "Failed to alloc lowmem for boot params\n");
903 return NULL; 465 return NULL;
904 } 466 }
905 467
@@ -926,40 +488,11 @@ struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table)
926 hdr->type_of_loader = 0x21; 488 hdr->type_of_loader = 0x21;
927 489
928 /* Convert unicode cmdline to ascii */ 490 /* Convert unicode cmdline to ascii */
929 options = image->load_options; 491 cmdline_ptr = efi_convert_cmdline_to_ascii(sys_table, image,
930 load_options_size = image->load_options_size / 2; /* ASCII */ 492 &options_size);
931 cmdline = 0; 493 if (!cmdline_ptr)
932 s2 = (u16 *)options; 494 goto fail;
933 495 hdr->cmd_line_ptr = (unsigned long)cmdline_ptr;
934 if (s2) {
935 while (*s2 && *s2 != '\n' && options_size < load_options_size) {
936 s2++;
937 options_size++;
938 }
939
940 if (options_size) {
941 if (options_size > hdr->cmdline_size)
942 options_size = hdr->cmdline_size;
943
944 options_size++; /* NUL termination */
945
946 status = low_alloc(options_size, 1, &cmdline);
947 if (status != EFI_SUCCESS) {
948 efi_printk("Failed to alloc mem for cmdline\n");
949 goto fail;
950 }
951
952 s1 = (u8 *)(unsigned long)cmdline;
953 s2 = (u16 *)options;
954
955 for (i = 0; i < options_size - 1; i++)
956 *s1++ = *s2++;
957
958 *s1 = '\0';
959 }
960 }
961
962 hdr->cmd_line_ptr = cmdline;
963 496
964 hdr->ramdisk_image = 0; 497 hdr->ramdisk_image = 0;
965 hdr->ramdisk_size = 0; 498 hdr->ramdisk_size = 0;
@@ -969,96 +502,64 @@ struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table)
969 502
970 memset(sdt, 0, sizeof(*sdt)); 503 memset(sdt, 0, sizeof(*sdt));
971 504
972 status = handle_ramdisks(image, hdr); 505 status = handle_cmdline_files(sys_table, image,
506 (char *)(unsigned long)hdr->cmd_line_ptr,
507 "initrd=", hdr->initrd_addr_max,
508 &ramdisk_addr, &ramdisk_size);
973 if (status != EFI_SUCCESS) 509 if (status != EFI_SUCCESS)
974 goto fail2; 510 goto fail2;
511 hdr->ramdisk_image = ramdisk_addr;
512 hdr->ramdisk_size = ramdisk_size;
975 513
976 return boot_params; 514 return boot_params;
977fail2: 515fail2:
978 if (options_size) 516 efi_free(sys_table, options_size, hdr->cmd_line_ptr);
979 low_free(options_size, hdr->cmd_line_ptr);
980fail: 517fail:
981 low_free(0x4000, (unsigned long)boot_params); 518 efi_free(sys_table, 0x4000, (unsigned long)boot_params);
982 return NULL; 519 return NULL;
983} 520}
984 521
985static efi_status_t exit_boot(struct boot_params *boot_params, 522static void add_e820ext(struct boot_params *params,
986 void *handle) 523 struct setup_data *e820ext, u32 nr_entries)
987{ 524{
988 struct efi_info *efi = &boot_params->efi_info; 525 struct setup_data *data;
989 struct e820entry *e820_map = &boot_params->e820_map[0];
990 struct e820entry *prev = NULL;
991 unsigned long size, key, desc_size, _size;
992 efi_memory_desc_t *mem_map;
993 efi_status_t status; 526 efi_status_t status;
994 __u32 desc_version; 527 unsigned long size;
995 bool called_exit = false;
996 u8 nr_entries;
997 int i;
998
999 size = sizeof(*mem_map) * 32;
1000
1001again:
1002 size += sizeof(*mem_map) * 2;
1003 _size = size;
1004 status = low_alloc(size, 1, (unsigned long *)&mem_map);
1005 if (status != EFI_SUCCESS)
1006 return status;
1007
1008get_map:
1009 status = efi_call_phys5(sys_table->boottime->get_memory_map, &size,
1010 mem_map, &key, &desc_size, &desc_version);
1011 if (status == EFI_BUFFER_TOO_SMALL) {
1012 low_free(_size, (unsigned long)mem_map);
1013 goto again;
1014 }
1015 528
1016 if (status != EFI_SUCCESS) 529 e820ext->type = SETUP_E820_EXT;
1017 goto free_mem_map; 530 e820ext->len = nr_entries * sizeof(struct e820entry);
531 e820ext->next = 0;
1018 532
1019 memcpy(&efi->efi_loader_signature, EFI_LOADER_SIGNATURE, sizeof(__u32)); 533 data = (struct setup_data *)(unsigned long)params->hdr.setup_data;
1020 efi->efi_systab = (unsigned long)sys_table;
1021 efi->efi_memdesc_size = desc_size;
1022 efi->efi_memdesc_version = desc_version;
1023 efi->efi_memmap = (unsigned long)mem_map;
1024 efi->efi_memmap_size = size;
1025
1026#ifdef CONFIG_X86_64
1027 efi->efi_systab_hi = (unsigned long)sys_table >> 32;
1028 efi->efi_memmap_hi = (unsigned long)mem_map >> 32;
1029#endif
1030 534
1031 /* Might as well exit boot services now */ 535 while (data && data->next)
1032 status = efi_call_phys2(sys_table->boottime->exit_boot_services, 536 data = (struct setup_data *)(unsigned long)data->next;
1033 handle, key);
1034 if (status != EFI_SUCCESS) {
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 537
1045 called_exit = true; 538 if (data)
1046 goto get_map; 539 data->next = (unsigned long)e820ext;
1047 } 540 else
541 params->hdr.setup_data = (unsigned long)e820ext;
542}
1048 543
1049 /* Historic? */ 544static efi_status_t setup_e820(struct boot_params *params,
1050 boot_params->alt_mem_k = 32 * 1024; 545 struct setup_data *e820ext, u32 e820ext_size)
546{
547 struct e820entry *e820_map = &params->e820_map[0];
548 struct efi_info *efi = &params->efi_info;
549 struct e820entry *prev = NULL;
550 u32 nr_entries;
551 u32 nr_desc;
552 int i;
1051 553
1052 /*
1053 * Convert the EFI memory map to E820.
1054 */
1055 nr_entries = 0; 554 nr_entries = 0;
1056 for (i = 0; i < size / desc_size; i++) { 555 nr_desc = efi->efi_memmap_size / efi->efi_memdesc_size;
556
557 for (i = 0; i < nr_desc; i++) {
1057 efi_memory_desc_t *d; 558 efi_memory_desc_t *d;
1058 unsigned int e820_type = 0; 559 unsigned int e820_type = 0;
1059 unsigned long m = (unsigned long)mem_map; 560 unsigned long m = efi->efi_memmap;
1060 561
1061 d = (efi_memory_desc_t *)(m + (i * desc_size)); 562 d = (efi_memory_desc_t *)(m + (i * efi->efi_memdesc_size));
1062 switch (d->type) { 563 switch (d->type) {
1063 case EFI_RESERVED_TYPE: 564 case EFI_RESERVED_TYPE:
1064 case EFI_RUNTIME_SERVICES_CODE: 565 case EFI_RUNTIME_SERVICES_CODE:
@@ -1095,61 +596,151 @@ get_map:
1095 596
1096 /* Merge adjacent mappings */ 597 /* Merge adjacent mappings */
1097 if (prev && prev->type == e820_type && 598 if (prev && prev->type == e820_type &&
1098 (prev->addr + prev->size) == d->phys_addr) 599 (prev->addr + prev->size) == d->phys_addr) {
1099 prev->size += d->num_pages << 12; 600 prev->size += d->num_pages << 12;
1100 else { 601 continue;
1101 e820_map->addr = d->phys_addr; 602 }
1102 e820_map->size = d->num_pages << 12; 603
1103 e820_map->type = e820_type; 604 if (nr_entries == ARRAY_SIZE(params->e820_map)) {
1104 prev = e820_map++; 605 u32 need = (nr_desc - i) * sizeof(struct e820entry) +
1105 nr_entries++; 606 sizeof(struct setup_data);
607
608 if (!e820ext || e820ext_size < need)
609 return EFI_BUFFER_TOO_SMALL;
610
611 /* boot_params map full, switch to e820 extended */
612 e820_map = (struct e820entry *)e820ext->data;
1106 } 613 }
614
615 e820_map->addr = d->phys_addr;
616 e820_map->size = d->num_pages << PAGE_SHIFT;
617 e820_map->type = e820_type;
618 prev = e820_map++;
619 nr_entries++;
1107 } 620 }
1108 621
1109 boot_params->e820_entries = nr_entries; 622 if (nr_entries > ARRAY_SIZE(params->e820_map)) {
623 u32 nr_e820ext = nr_entries - ARRAY_SIZE(params->e820_map);
624
625 add_e820ext(params, e820ext, nr_e820ext);
626 nr_entries -= nr_e820ext;
627 }
628
629 params->e820_entries = (u8)nr_entries;
1110 630
1111 return EFI_SUCCESS; 631 return EFI_SUCCESS;
632}
633
634static efi_status_t alloc_e820ext(u32 nr_desc, struct setup_data **e820ext,
635 u32 *e820ext_size)
636{
637 efi_status_t status;
638 unsigned long size;
639
640 size = sizeof(struct setup_data) +
641 sizeof(struct e820entry) * nr_desc;
642
643 if (*e820ext) {
644 efi_call_phys1(sys_table->boottime->free_pool, *e820ext);
645 *e820ext = NULL;
646 *e820ext_size = 0;
647 }
648
649 status = efi_call_phys3(sys_table->boottime->allocate_pool,
650 EFI_LOADER_DATA, size, e820ext);
651
652 if (status == EFI_SUCCESS)
653 *e820ext_size = size;
1112 654
1113free_mem_map:
1114 low_free(_size, (unsigned long)mem_map);
1115 return status; 655 return status;
1116} 656}
1117 657
1118static efi_status_t relocate_kernel(struct setup_header *hdr) 658static efi_status_t exit_boot(struct boot_params *boot_params,
659 void *handle)
1119{ 660{
1120 unsigned long start, nr_pages; 661 struct efi_info *efi = &boot_params->efi_info;
662 unsigned long map_sz, key, desc_size;
663 efi_memory_desc_t *mem_map;
664 struct setup_data *e820ext;
665 __u32 e820ext_size;
666 __u32 nr_desc, prev_nr_desc;
1121 efi_status_t status; 667 efi_status_t status;
668 __u32 desc_version;
669 bool called_exit = false;
670 u8 nr_entries;
671 int i;
1122 672
1123 /* 673 nr_desc = 0;
1124 * The EFI firmware loader could have placed the kernel image 674 e820ext = NULL;
1125 * anywhere in memory, but the kernel has various restrictions 675 e820ext_size = 0;
1126 * on the max physical address it can run at. Attempt to move
1127 * the kernel to boot_params.pref_address, or as low as
1128 * possible.
1129 */
1130 start = hdr->pref_address;
1131 nr_pages = round_up(hdr->init_size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
1132 676
1133 status = efi_call_phys4(sys_table->boottime->allocate_pages, 677get_map:
1134 EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA, 678 status = efi_get_memory_map(sys_table, &mem_map, &map_sz, &desc_size,
1135 nr_pages, &start); 679 &desc_version, &key);
1136 if (status != EFI_SUCCESS) { 680
1137 status = low_alloc(hdr->init_size, hdr->kernel_alignment, 681 if (status != EFI_SUCCESS)
1138 &start); 682 return status;
683
684 prev_nr_desc = nr_desc;
685 nr_desc = map_sz / desc_size;
686 if (nr_desc > prev_nr_desc &&
687 nr_desc > ARRAY_SIZE(boot_params->e820_map)) {
688 u32 nr_e820ext = nr_desc - ARRAY_SIZE(boot_params->e820_map);
689
690 status = alloc_e820ext(nr_e820ext, &e820ext, &e820ext_size);
1139 if (status != EFI_SUCCESS) 691 if (status != EFI_SUCCESS)
1140 efi_printk("Failed to alloc mem for kernel\n"); 692 goto free_mem_map;
693
694 efi_call_phys1(sys_table->boottime->free_pool, mem_map);
695 goto get_map; /* Allocated memory, get map again */
1141 } 696 }
1142 697
1143 if (status == EFI_SUCCESS) 698 memcpy(&efi->efi_loader_signature, EFI_LOADER_SIGNATURE, sizeof(__u32));
1144 memcpy((void *)start, (void *)(unsigned long)hdr->code32_start, 699 efi->efi_systab = (unsigned long)sys_table;
1145 hdr->init_size); 700 efi->efi_memdesc_size = desc_size;
701 efi->efi_memdesc_version = desc_version;
702 efi->efi_memmap = (unsigned long)mem_map;
703 efi->efi_memmap_size = map_sz;
704
705#ifdef CONFIG_X86_64
706 efi->efi_systab_hi = (unsigned long)sys_table >> 32;
707 efi->efi_memmap_hi = (unsigned long)mem_map >> 32;
708#endif
1146 709
1147 hdr->pref_address = hdr->code32_start; 710 /* Might as well exit boot services now */
1148 hdr->code32_start = (__u32)start; 711 status = efi_call_phys2(sys_table->boottime->exit_boot_services,
712 handle, key);
713 if (status != EFI_SUCCESS) {
714 /*
715 * ExitBootServices() will fail if any of the event
716 * handlers change the memory map. In which case, we
717 * must be prepared to retry, but only once so that
718 * we're guaranteed to exit on repeated failures instead
719 * of spinning forever.
720 */
721 if (called_exit)
722 goto free_mem_map;
1149 723
724 called_exit = true;
725 efi_call_phys1(sys_table->boottime->free_pool, mem_map);
726 goto get_map;
727 }
728
729 /* Historic? */
730 boot_params->alt_mem_k = 32 * 1024;
731
732 status = setup_e820(boot_params, e820ext, e820ext_size);
733 if (status != EFI_SUCCESS)
734 return status;
735
736 return EFI_SUCCESS;
737
738free_mem_map:
739 efi_call_phys1(sys_table->boottime->free_pool, mem_map);
1150 return status; 740 return status;
1151} 741}
1152 742
743
1153/* 744/*
1154 * On success we return a pointer to a boot_params structure, and NULL 745 * On success we return a pointer to a boot_params structure, and NULL
1155 * on failure. 746 * on failure.
@@ -1157,7 +748,7 @@ static efi_status_t relocate_kernel(struct setup_header *hdr)
1157struct boot_params *efi_main(void *handle, efi_system_table_t *_table, 748struct boot_params *efi_main(void *handle, efi_system_table_t *_table,
1158 struct boot_params *boot_params) 749 struct boot_params *boot_params)
1159{ 750{
1160 struct desc_ptr *gdt, *idt; 751 struct desc_ptr *gdt;
1161 efi_loaded_image_t *image; 752 efi_loaded_image_t *image;
1162 struct setup_header *hdr = &boot_params->hdr; 753 struct setup_header *hdr = &boot_params->hdr;
1163 efi_status_t status; 754 efi_status_t status;
@@ -1177,37 +768,33 @@ struct boot_params *efi_main(void *handle, efi_system_table_t *_table,
1177 EFI_LOADER_DATA, sizeof(*gdt), 768 EFI_LOADER_DATA, sizeof(*gdt),
1178 (void **)&gdt); 769 (void **)&gdt);
1179 if (status != EFI_SUCCESS) { 770 if (status != EFI_SUCCESS) {
1180 efi_printk("Failed to alloc mem for gdt structure\n"); 771 efi_printk(sys_table, "Failed to alloc mem for gdt structure\n");
1181 goto fail; 772 goto fail;
1182 } 773 }
1183 774
1184 gdt->size = 0x800; 775 gdt->size = 0x800;
1185 status = low_alloc(gdt->size, 8, (unsigned long *)&gdt->address); 776 status = efi_low_alloc(sys_table, gdt->size, 8,
1186 if (status != EFI_SUCCESS) { 777 (unsigned long *)&gdt->address);
1187 efi_printk("Failed to alloc mem for gdt\n");
1188 goto fail;
1189 }
1190
1191 status = efi_call_phys3(sys_table->boottime->allocate_pool,
1192 EFI_LOADER_DATA, sizeof(*idt),
1193 (void **)&idt);
1194 if (status != EFI_SUCCESS) { 778 if (status != EFI_SUCCESS) {
1195 efi_printk("Failed to alloc mem for idt structure\n"); 779 efi_printk(sys_table, "Failed to alloc mem for gdt\n");
1196 goto fail; 780 goto fail;
1197 } 781 }
1198 782
1199 idt->size = 0;
1200 idt->address = 0;
1201
1202 /* 783 /*
1203 * If the kernel isn't already loaded at the preferred load 784 * If the kernel isn't already loaded at the preferred load
1204 * address, relocate it. 785 * address, relocate it.
1205 */ 786 */
1206 if (hdr->pref_address != hdr->code32_start) { 787 if (hdr->pref_address != hdr->code32_start) {
1207 status = relocate_kernel(hdr); 788 unsigned long bzimage_addr = hdr->code32_start;
1208 789 status = efi_relocate_kernel(sys_table, &bzimage_addr,
790 hdr->init_size, hdr->init_size,
791 hdr->pref_address,
792 hdr->kernel_alignment);
1209 if (status != EFI_SUCCESS) 793 if (status != EFI_SUCCESS)
1210 goto fail; 794 goto fail;
795
796 hdr->pref_address = hdr->code32_start;
797 hdr->code32_start = bzimage_addr;
1211 } 798 }
1212 799
1213 status = exit_boot(boot_params, handle); 800 status = exit_boot(boot_params, handle);
@@ -1267,10 +854,8 @@ struct boot_params *efi_main(void *handle, efi_system_table_t *_table,
1267 desc->base2 = 0x00; 854 desc->base2 = 0x00;
1268#endif /* CONFIG_X86_64 */ 855#endif /* CONFIG_X86_64 */
1269 856
1270 asm volatile ("lidt %0" : : "m" (*idt));
1271 asm volatile ("lgdt %0" : : "m" (*gdt));
1272
1273 asm volatile("cli"); 857 asm volatile("cli");
858 asm volatile ("lgdt %0" : : "m" (*gdt));
1274 859
1275 return boot_params; 860 return boot_params;
1276fail: 861fail:
diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h
index e5b0a8f91c5f..81b6b652b46a 100644
--- a/arch/x86/boot/compressed/eboot.h
+++ b/arch/x86/boot/compressed/eboot.h
@@ -11,9 +11,6 @@
11 11
12#define DESC_TYPE_CODE_DATA (1 << 0) 12#define DESC_TYPE_CODE_DATA (1 << 0)
13 13
14#define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT)
15#define EFI_READ_CHUNK_SIZE (1024 * 1024)
16
17#define EFI_CONSOLE_OUT_DEVICE_GUID \ 14#define EFI_CONSOLE_OUT_DEVICE_GUID \
18 EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, 0x9a, 0x46, 0x0, 0x90, 0x27, \ 15 EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, 0x9a, 0x46, 0x0, 0x90, 0x27, \
19 0x3f, 0xc1, 0x4d) 16 0x3f, 0xc1, 0x4d)
@@ -62,10 +59,4 @@ struct efi_uga_draw_protocol {
62 void *blt; 59 void *blt;
63}; 60};
64 61
65struct efi_simple_text_output_protocol {
66 void *reset;
67 void *output_string;
68 void *test_string;
69};
70
71#endif /* BOOT_COMPRESSED_EBOOT_H */ 62#endif /* BOOT_COMPRESSED_EBOOT_H */
diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c
index 958a641483dd..b669ab65bf6c 100644
--- a/arch/x86/boot/compressed/mkpiggy.c
+++ b/arch/x86/boot/compressed/mkpiggy.c
@@ -36,11 +36,12 @@ int main(int argc, char *argv[])
36 uint32_t olen; 36 uint32_t olen;
37 long ilen; 37 long ilen;
38 unsigned long offs; 38 unsigned long offs;
39 FILE *f; 39 FILE *f = NULL;
40 int retval = 1;
40 41
41 if (argc < 2) { 42 if (argc < 2) {
42 fprintf(stderr, "Usage: %s compressed_file\n", argv[0]); 43 fprintf(stderr, "Usage: %s compressed_file\n", argv[0]);
43 return 1; 44 goto bail;
44 } 45 }
45 46
46 /* Get the information for the compressed kernel image first */ 47 /* Get the information for the compressed kernel image first */
@@ -48,7 +49,7 @@ int main(int argc, char *argv[])
48 f = fopen(argv[1], "r"); 49 f = fopen(argv[1], "r");
49 if (!f) { 50 if (!f) {
50 perror(argv[1]); 51 perror(argv[1]);
51 return 1; 52 goto bail;
52 } 53 }
53 54
54 55
@@ -58,12 +59,11 @@ int main(int argc, char *argv[])
58 59
59 if (fread(&olen, sizeof(olen), 1, f) != 1) { 60 if (fread(&olen, sizeof(olen), 1, f) != 1) {
60 perror(argv[1]); 61 perror(argv[1]);
61 return 1; 62 goto bail;
62 } 63 }
63 64
64 ilen = ftell(f); 65 ilen = ftell(f);
65 olen = get_unaligned_le32(&olen); 66 olen = get_unaligned_le32(&olen);
66 fclose(f);
67 67
68 /* 68 /*
69 * Now we have the input (compressed) and output (uncompressed) 69 * Now we have the input (compressed) and output (uncompressed)
@@ -91,5 +91,9 @@ int main(int argc, char *argv[])
91 printf(".incbin \"%s\"\n", argv[1]); 91 printf(".incbin \"%s\"\n", argv[1]);
92 printf("input_data_end:\n"); 92 printf("input_data_end:\n");
93 93
94 return 0; 94 retval = 0;
95bail:
96 if (f)
97 fclose(f);
98 return retval;
95} 99}
diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c
index c941d6a8887f..8e15b22391fc 100644
--- a/arch/x86/boot/tools/build.c
+++ b/arch/x86/boot/tools/build.c
@@ -5,14 +5,15 @@
5 */ 5 */
6 6
7/* 7/*
8 * This file builds a disk-image from two different files: 8 * This file builds a disk-image from three different files:
9 * 9 *
10 * - setup: 8086 machine code, sets up system parm 10 * - setup: 8086 machine code, sets up system parm
11 * - system: 80386 code for actual system 11 * - system: 80386 code for actual system
12 * - zoffset.h: header with ZO_* defines
12 * 13 *
13 * It does some checking that all files are of the correct type, and 14 * It does some checking that all files are of the correct type, and writes
14 * just writes the result to stdout, removing headers and padding to 15 * the result to the specified destination, removing headers and padding to
15 * the right amount. It also writes some system data to stderr. 16 * the right amount. It also writes some system data to stdout.
16 */ 17 */
17 18
18/* 19/*
@@ -136,7 +137,7 @@ static void die(const char * str, ...)
136 137
137static void usage(void) 138static void usage(void)
138{ 139{
139 die("Usage: build setup system [zoffset.h] [> image]"); 140 die("Usage: build setup system zoffset.h image");
140} 141}
141 142
142#ifdef CONFIG_EFI_STUB 143#ifdef CONFIG_EFI_STUB
@@ -265,7 +266,7 @@ int main(int argc, char ** argv)
265 int c; 266 int c;
266 u32 sys_size; 267 u32 sys_size;
267 struct stat sb; 268 struct stat sb;
268 FILE *file; 269 FILE *file, *dest;
269 int fd; 270 int fd;
270 void *kernel; 271 void *kernel;
271 u32 crc = 0xffffffffUL; 272 u32 crc = 0xffffffffUL;
@@ -280,10 +281,13 @@ int main(int argc, char ** argv)
280 startup_64 = 0x200; 281 startup_64 = 0x200;
281#endif 282#endif
282 283
283 if (argc == 4) 284 if (argc != 5)
284 parse_zoffset(argv[3]);
285 else if (argc != 3)
286 usage(); 285 usage();
286 parse_zoffset(argv[3]);
287
288 dest = fopen(argv[4], "w");
289 if (!dest)
290 die("Unable to write `%s': %m", argv[4]);
287 291
288 /* Copy the setup code */ 292 /* Copy the setup code */
289 file = fopen(argv[1], "r"); 293 file = fopen(argv[1], "r");
@@ -318,7 +322,7 @@ int main(int argc, char ** argv)
318 /* Set the default root device */ 322 /* Set the default root device */
319 put_unaligned_le16(DEFAULT_ROOT_DEV, &buf[508]); 323 put_unaligned_le16(DEFAULT_ROOT_DEV, &buf[508]);
320 324
321 fprintf(stderr, "Setup is %d bytes (padded to %d bytes).\n", c, i); 325 printf("Setup is %d bytes (padded to %d bytes).\n", c, i);
322 326
323 /* Open and stat the kernel file */ 327 /* Open and stat the kernel file */
324 fd = open(argv[2], O_RDONLY); 328 fd = open(argv[2], O_RDONLY);
@@ -327,7 +331,7 @@ int main(int argc, char ** argv)
327 if (fstat(fd, &sb)) 331 if (fstat(fd, &sb))
328 die("Unable to stat `%s': %m", argv[2]); 332 die("Unable to stat `%s': %m", argv[2]);
329 sz = sb.st_size; 333 sz = sb.st_size;
330 fprintf (stderr, "System is %d kB\n", (sz+1023)/1024); 334 printf("System is %d kB\n", (sz+1023)/1024);
331 kernel = mmap(NULL, sz, PROT_READ, MAP_SHARED, fd, 0); 335 kernel = mmap(NULL, sz, PROT_READ, MAP_SHARED, fd, 0);
332 if (kernel == MAP_FAILED) 336 if (kernel == MAP_FAILED)
333 die("Unable to mmap '%s': %m", argv[2]); 337 die("Unable to mmap '%s': %m", argv[2]);
@@ -348,27 +352,31 @@ int main(int argc, char ** argv)
348#endif 352#endif
349 353
350 crc = partial_crc32(buf, i, crc); 354 crc = partial_crc32(buf, i, crc);
351 if (fwrite(buf, 1, i, stdout) != i) 355 if (fwrite(buf, 1, i, dest) != i)
352 die("Writing setup failed"); 356 die("Writing setup failed");
353 357
354 /* Copy the kernel code */ 358 /* Copy the kernel code */
355 crc = partial_crc32(kernel, sz, crc); 359 crc = partial_crc32(kernel, sz, crc);
356 if (fwrite(kernel, 1, sz, stdout) != sz) 360 if (fwrite(kernel, 1, sz, dest) != sz)
357 die("Writing kernel failed"); 361 die("Writing kernel failed");
358 362
359 /* Add padding leaving 4 bytes for the checksum */ 363 /* Add padding leaving 4 bytes for the checksum */
360 while (sz++ < (sys_size*16) - 4) { 364 while (sz++ < (sys_size*16) - 4) {
361 crc = partial_crc32_one('\0', crc); 365 crc = partial_crc32_one('\0', crc);
362 if (fwrite("\0", 1, 1, stdout) != 1) 366 if (fwrite("\0", 1, 1, dest) != 1)
363 die("Writing padding failed"); 367 die("Writing padding failed");
364 } 368 }
365 369
366 /* Write the CRC */ 370 /* Write the CRC */
367 fprintf(stderr, "CRC %x\n", crc); 371 printf("CRC %x\n", crc);
368 put_unaligned_le32(crc, buf); 372 put_unaligned_le32(crc, buf);
369 if (fwrite(buf, 1, 4, stdout) != 4) 373 if (fwrite(buf, 1, 4, dest) != 4)
370 die("Writing CRC failed"); 374 die("Writing CRC failed");
371 375
376 /* Catch any delayed write failures */
377 if (fclose(dest))
378 die("Writing image failed");
379
372 close(fd); 380 close(fd);
373 381
374 /* Everything is OK */ 382 /* Everything is OK */
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index 94447086e551..a7fef2621cc9 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -142,6 +142,8 @@ CONFIG_MAC80211=y
142CONFIG_MAC80211_LEDS=y 142CONFIG_MAC80211_LEDS=y
143CONFIG_RFKILL=y 143CONFIG_RFKILL=y
144CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 144CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
145CONFIG_DEVTMPFS=y
146CONFIG_DEVTMPFS_MOUNT=y
145CONFIG_DEBUG_DEVRES=y 147CONFIG_DEBUG_DEVRES=y
146CONFIG_CONNECTOR=y 148CONFIG_CONNECTOR=y
147CONFIG_BLK_DEV_LOOP=y 149CONFIG_BLK_DEV_LOOP=y
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index 671524d0f6c0..c1119d4c1281 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -141,6 +141,8 @@ CONFIG_MAC80211=y
141CONFIG_MAC80211_LEDS=y 141CONFIG_MAC80211_LEDS=y
142CONFIG_RFKILL=y 142CONFIG_RFKILL=y
143CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 143CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
144CONFIG_DEVTMPFS=y
145CONFIG_DEVTMPFS_MOUNT=y
144CONFIG_DEBUG_DEVRES=y 146CONFIG_DEBUG_DEVRES=y
145CONFIG_CONNECTOR=y 147CONFIG_CONNECTOR=y
146CONFIG_BLK_DEV_LOOP=y 148CONFIG_BLK_DEV_LOOP=y
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index bae3aba95b15..d21ff89207cd 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -25,6 +25,7 @@
25#include <linux/personality.h> 25#include <linux/personality.h>
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/jiffies.h> 27#include <linux/jiffies.h>
28#include <linux/perf_event.h>
28 29
29#include <asm/uaccess.h> 30#include <asm/uaccess.h>
30#include <asm/pgalloc.h> 31#include <asm/pgalloc.h>
@@ -33,14 +34,18 @@
33#include <asm/ia32.h> 34#include <asm/ia32.h>
34 35
35#undef WARN_OLD 36#undef WARN_OLD
36#undef CORE_DUMP /* definitely broken */
37 37
38static int load_aout_binary(struct linux_binprm *); 38static int load_aout_binary(struct linux_binprm *);
39static int load_aout_library(struct file *); 39static int load_aout_library(struct file *);
40 40
41#ifdef CORE_DUMP 41#ifdef CONFIG_COREDUMP
42static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, 42static int aout_core_dump(struct coredump_params *);
43 unsigned long limit); 43
44static unsigned long get_dr(int n)
45{
46 struct perf_event *bp = current->thread.ptrace_bps[n];
47 return bp ? bp->hw.info.address : 0;
48}
44 49
45/* 50/*
46 * fill in the user structure for a core dump.. 51 * fill in the user structure for a core dump..
@@ -48,6 +53,7 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file,
48static void dump_thread32(struct pt_regs *regs, struct user32 *dump) 53static void dump_thread32(struct pt_regs *regs, struct user32 *dump)
49{ 54{
50 u32 fs, gs; 55 u32 fs, gs;
56 memset(dump, 0, sizeof(*dump));
51 57
52/* changed the size calculations - should hopefully work better. lbt */ 58/* changed the size calculations - should hopefully work better. lbt */
53 dump->magic = CMAGIC; 59 dump->magic = CMAGIC;
@@ -57,15 +63,12 @@ static void dump_thread32(struct pt_regs *regs, struct user32 *dump)
57 dump->u_dsize = ((unsigned long) 63 dump->u_dsize = ((unsigned long)
58 (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT; 64 (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT;
59 dump->u_dsize -= dump->u_tsize; 65 dump->u_dsize -= dump->u_tsize;
60 dump->u_ssize = 0; 66 dump->u_debugreg[0] = get_dr(0);
61 dump->u_debugreg[0] = current->thread.debugreg0; 67 dump->u_debugreg[1] = get_dr(1);
62 dump->u_debugreg[1] = current->thread.debugreg1; 68 dump->u_debugreg[2] = get_dr(2);
63 dump->u_debugreg[2] = current->thread.debugreg2; 69 dump->u_debugreg[3] = get_dr(3);
64 dump->u_debugreg[3] = current->thread.debugreg3;
65 dump->u_debugreg[4] = 0;
66 dump->u_debugreg[5] = 0;
67 dump->u_debugreg[6] = current->thread.debugreg6; 70 dump->u_debugreg[6] = current->thread.debugreg6;
68 dump->u_debugreg[7] = current->thread.debugreg7; 71 dump->u_debugreg[7] = current->thread.ptrace_dr7;
69 72
70 if (dump->start_stack < 0xc0000000) { 73 if (dump->start_stack < 0xc0000000) {
71 unsigned long tmp; 74 unsigned long tmp;
@@ -74,24 +77,24 @@ static void dump_thread32(struct pt_regs *regs, struct user32 *dump)
74 dump->u_ssize = tmp >> PAGE_SHIFT; 77 dump->u_ssize = tmp >> PAGE_SHIFT;
75 } 78 }
76 79
77 dump->regs.bx = regs->bx; 80 dump->regs.ebx = regs->bx;
78 dump->regs.cx = regs->cx; 81 dump->regs.ecx = regs->cx;
79 dump->regs.dx = regs->dx; 82 dump->regs.edx = regs->dx;
80 dump->regs.si = regs->si; 83 dump->regs.esi = regs->si;
81 dump->regs.di = regs->di; 84 dump->regs.edi = regs->di;
82 dump->regs.bp = regs->bp; 85 dump->regs.ebp = regs->bp;
83 dump->regs.ax = regs->ax; 86 dump->regs.eax = regs->ax;
84 dump->regs.ds = current->thread.ds; 87 dump->regs.ds = current->thread.ds;
85 dump->regs.es = current->thread.es; 88 dump->regs.es = current->thread.es;
86 savesegment(fs, fs); 89 savesegment(fs, fs);
87 dump->regs.fs = fs; 90 dump->regs.fs = fs;
88 savesegment(gs, gs); 91 savesegment(gs, gs);
89 dump->regs.gs = gs; 92 dump->regs.gs = gs;
90 dump->regs.orig_ax = regs->orig_ax; 93 dump->regs.orig_eax = regs->orig_ax;
91 dump->regs.ip = regs->ip; 94 dump->regs.eip = regs->ip;
92 dump->regs.cs = regs->cs; 95 dump->regs.cs = regs->cs;
93 dump->regs.flags = regs->flags; 96 dump->regs.eflags = regs->flags;
94 dump->regs.sp = regs->sp; 97 dump->regs.esp = regs->sp;
95 dump->regs.ss = regs->ss; 98 dump->regs.ss = regs->ss;
96 99
97#if 1 /* FIXME */ 100#if 1 /* FIXME */
@@ -107,7 +110,7 @@ static struct linux_binfmt aout_format = {
107 .module = THIS_MODULE, 110 .module = THIS_MODULE,
108 .load_binary = load_aout_binary, 111 .load_binary = load_aout_binary,
109 .load_shlib = load_aout_library, 112 .load_shlib = load_aout_library,
110#ifdef CORE_DUMP 113#ifdef CONFIG_COREDUMP
111 .core_dump = aout_core_dump, 114 .core_dump = aout_core_dump,
112#endif 115#endif
113 .min_coredump = PAGE_SIZE 116 .min_coredump = PAGE_SIZE
@@ -122,7 +125,7 @@ static void set_brk(unsigned long start, unsigned long end)
122 vm_brk(start, end - start); 125 vm_brk(start, end - start);
123} 126}
124 127
125#ifdef CORE_DUMP 128#ifdef CONFIG_COREDUMP
126/* 129/*
127 * These are the only things you should do on a core-file: use only these 130 * These are the only things you should do on a core-file: use only these
128 * macros to write out all the necessary info. 131 * macros to write out all the necessary info.
@@ -130,15 +133,7 @@ static void set_brk(unsigned long start, unsigned long end)
130 133
131#include <linux/coredump.h> 134#include <linux/coredump.h>
132 135
133#define DUMP_WRITE(addr, nr) \ 136#define START_DATA(u) (u.u_tsize << PAGE_SHIFT)
134 if (!dump_write(file, (void *)(addr), (nr))) \
135 goto end_coredump;
136
137#define DUMP_SEEK(offset) \
138 if (!dump_seek(file, offset)) \
139 goto end_coredump;
140
141#define START_DATA() (u.u_tsize << PAGE_SHIFT)
142#define START_STACK(u) (u.start_stack) 137#define START_STACK(u) (u.start_stack)
143 138
144/* 139/*
@@ -151,8 +146,7 @@ static void set_brk(unsigned long start, unsigned long end)
151 * dumping of the process results in another error.. 146 * dumping of the process results in another error..
152 */ 147 */
153 148
154static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, 149static int aout_core_dump(struct coredump_params *cprm)
155 unsigned long limit)
156{ 150{
157 mm_segment_t fs; 151 mm_segment_t fs;
158 int has_dumped = 0; 152 int has_dumped = 0;
@@ -164,19 +158,19 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file,
164 has_dumped = 1; 158 has_dumped = 1;
165 strncpy(dump.u_comm, current->comm, sizeof(current->comm)); 159 strncpy(dump.u_comm, current->comm, sizeof(current->comm));
166 dump.u_ar0 = offsetof(struct user32, regs); 160 dump.u_ar0 = offsetof(struct user32, regs);
167 dump.signal = signr; 161 dump.signal = cprm->siginfo->si_signo;
168 dump_thread32(regs, &dump); 162 dump_thread32(cprm->regs, &dump);
169 163
170 /* 164 /*
171 * If the size of the dump file exceeds the rlimit, then see 165 * If the size of the dump file exceeds the rlimit, then see
172 * what would happen if we wrote the stack, but not the data 166 * what would happen if we wrote the stack, but not the data
173 * area. 167 * area.
174 */ 168 */
175 if ((dump.u_dsize + dump.u_ssize + 1) * PAGE_SIZE > limit) 169 if ((dump.u_dsize + dump.u_ssize + 1) * PAGE_SIZE > cprm->limit)
176 dump.u_dsize = 0; 170 dump.u_dsize = 0;
177 171
178 /* Make sure we have enough room to write the stack and data areas. */ 172 /* Make sure we have enough room to write the stack and data areas. */
179 if ((dump.u_ssize + 1) * PAGE_SIZE > limit) 173 if ((dump.u_ssize + 1) * PAGE_SIZE > cprm->limit)
180 dump.u_ssize = 0; 174 dump.u_ssize = 0;
181 175
182 /* make sure we actually have a data and stack area to dump */ 176 /* make sure we actually have a data and stack area to dump */
@@ -190,22 +184,26 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file,
190 184
191 set_fs(KERNEL_DS); 185 set_fs(KERNEL_DS);
192 /* struct user */ 186 /* struct user */
193 DUMP_WRITE(&dump, sizeof(dump)); 187 if (!dump_emit(cprm, &dump, sizeof(dump)))
188 goto end_coredump;
194 /* Now dump all of the user data. Include malloced stuff as well */ 189 /* Now dump all of the user data. Include malloced stuff as well */
195 DUMP_SEEK(PAGE_SIZE - sizeof(dump)); 190 if (!dump_skip(cprm, PAGE_SIZE - sizeof(dump)))
191 goto end_coredump;
196 /* now we start writing out the user space info */ 192 /* now we start writing out the user space info */
197 set_fs(USER_DS); 193 set_fs(USER_DS);
198 /* Dump the data area */ 194 /* Dump the data area */
199 if (dump.u_dsize != 0) { 195 if (dump.u_dsize != 0) {
200 dump_start = START_DATA(dump); 196 dump_start = START_DATA(dump);
201 dump_size = dump.u_dsize << PAGE_SHIFT; 197 dump_size = dump.u_dsize << PAGE_SHIFT;
202 DUMP_WRITE(dump_start, dump_size); 198 if (!dump_emit(cprm, (void *)dump_start, dump_size))
199 goto end_coredump;
203 } 200 }
204 /* Now prepare to dump the stack area */ 201 /* Now prepare to dump the stack area */
205 if (dump.u_ssize != 0) { 202 if (dump.u_ssize != 0) {
206 dump_start = START_STACK(dump); 203 dump_start = START_STACK(dump);
207 dump_size = dump.u_ssize << PAGE_SHIFT; 204 dump_size = dump.u_ssize << PAGE_SHIFT;
208 DUMP_WRITE(dump_start, dump_size); 205 if (!dump_emit(cprm, (void *)dump_start, dump_size))
206 goto end_coredump;
209 } 207 }
210end_coredump: 208end_coredump:
211 set_fs(fs); 209 set_fs(fs);
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 665a730307f2..220675795e08 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -34,7 +34,7 @@
34#include <asm/sys_ia32.h> 34#include <asm/sys_ia32.h>
35#include <asm/smap.h> 35#include <asm/smap.h>
36 36
37int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) 37int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
38{ 38{
39 int err = 0; 39 int err = 0;
40 bool ia32 = test_thread_flag(TIF_IA32); 40 bool ia32 = test_thread_flag(TIF_IA32);
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index b1977bad5435..c8c1e700c26e 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -26,6 +26,7 @@
26#include <acpi/pdc_intel.h> 26#include <acpi/pdc_intel.h>
27 27
28#include <asm/numa.h> 28#include <asm/numa.h>
29#include <asm/fixmap.h>
29#include <asm/processor.h> 30#include <asm/processor.h>
30#include <asm/mmu.h> 31#include <asm/mmu.h>
31#include <asm/mpspec.h> 32#include <asm/mpspec.h>
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index 722aa3b04624..da31c8b8a92d 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -6,6 +6,7 @@
6#include <asm/processor.h> 6#include <asm/processor.h>
7#include <asm/alternative.h> 7#include <asm/alternative.h>
8#include <asm/cmpxchg.h> 8#include <asm/cmpxchg.h>
9#include <asm/rmwcc.h>
9 10
10/* 11/*
11 * Atomic operations that C can't guarantee us. Useful for 12 * Atomic operations that C can't guarantee us. Useful for
@@ -76,12 +77,7 @@ static inline void atomic_sub(int i, atomic_t *v)
76 */ 77 */
77static inline int atomic_sub_and_test(int i, atomic_t *v) 78static inline int atomic_sub_and_test(int i, atomic_t *v)
78{ 79{
79 unsigned char c; 80 GEN_BINARY_RMWcc(LOCK_PREFIX "subl", v->counter, i, "%0", "e");
80
81 asm volatile(LOCK_PREFIX "subl %2,%0; sete %1"
82 : "+m" (v->counter), "=qm" (c)
83 : "ir" (i) : "memory");
84 return c;
85} 81}
86 82
87/** 83/**
@@ -118,12 +114,7 @@ static inline void atomic_dec(atomic_t *v)
118 */ 114 */
119static inline int atomic_dec_and_test(atomic_t *v) 115static inline int atomic_dec_and_test(atomic_t *v)
120{ 116{
121 unsigned char c; 117 GEN_UNARY_RMWcc(LOCK_PREFIX "decl", v->counter, "%0", "e");
122
123 asm volatile(LOCK_PREFIX "decl %0; sete %1"
124 : "+m" (v->counter), "=qm" (c)
125 : : "memory");
126 return c != 0;
127} 118}
128 119
129/** 120/**
@@ -136,12 +127,7 @@ static inline int atomic_dec_and_test(atomic_t *v)
136 */ 127 */
137static inline int atomic_inc_and_test(atomic_t *v) 128static inline int atomic_inc_and_test(atomic_t *v)
138{ 129{
139 unsigned char c; 130 GEN_UNARY_RMWcc(LOCK_PREFIX "incl", v->counter, "%0", "e");
140
141 asm volatile(LOCK_PREFIX "incl %0; sete %1"
142 : "+m" (v->counter), "=qm" (c)
143 : : "memory");
144 return c != 0;
145} 131}
146 132
147/** 133/**
@@ -155,12 +141,7 @@ static inline int atomic_inc_and_test(atomic_t *v)
155 */ 141 */
156static inline int atomic_add_negative(int i, atomic_t *v) 142static inline int atomic_add_negative(int i, atomic_t *v)
157{ 143{
158 unsigned char c; 144 GEN_BINARY_RMWcc(LOCK_PREFIX "addl", v->counter, i, "%0", "s");
159
160 asm volatile(LOCK_PREFIX "addl %2,%0; sets %1"
161 : "+m" (v->counter), "=qm" (c)
162 : "ir" (i) : "memory");
163 return c;
164} 145}
165 146
166/** 147/**
diff --git a/arch/x86/include/asm/atomic64_64.h b/arch/x86/include/asm/atomic64_64.h
index 0e1cbfc8ee06..3f065c985aee 100644
--- a/arch/x86/include/asm/atomic64_64.h
+++ b/arch/x86/include/asm/atomic64_64.h
@@ -72,12 +72,7 @@ static inline void atomic64_sub(long i, atomic64_t *v)
72 */ 72 */
73static inline int atomic64_sub_and_test(long i, atomic64_t *v) 73static inline int atomic64_sub_and_test(long i, atomic64_t *v)
74{ 74{
75 unsigned char c; 75 GEN_BINARY_RMWcc(LOCK_PREFIX "subq", v->counter, i, "%0", "e");
76
77 asm volatile(LOCK_PREFIX "subq %2,%0; sete %1"
78 : "=m" (v->counter), "=qm" (c)
79 : "er" (i), "m" (v->counter) : "memory");
80 return c;
81} 76}
82 77
83/** 78/**
@@ -116,12 +111,7 @@ static inline void atomic64_dec(atomic64_t *v)
116 */ 111 */
117static inline int atomic64_dec_and_test(atomic64_t *v) 112static inline int atomic64_dec_and_test(atomic64_t *v)
118{ 113{
119 unsigned char c; 114 GEN_UNARY_RMWcc(LOCK_PREFIX "decq", v->counter, "%0", "e");
120
121 asm volatile(LOCK_PREFIX "decq %0; sete %1"
122 : "=m" (v->counter), "=qm" (c)
123 : "m" (v->counter) : "memory");
124 return c != 0;
125} 115}
126 116
127/** 117/**
@@ -134,12 +124,7 @@ static inline int atomic64_dec_and_test(atomic64_t *v)
134 */ 124 */
135static inline int atomic64_inc_and_test(atomic64_t *v) 125static inline int atomic64_inc_and_test(atomic64_t *v)
136{ 126{
137 unsigned char c; 127 GEN_UNARY_RMWcc(LOCK_PREFIX "incq", v->counter, "%0", "e");
138
139 asm volatile(LOCK_PREFIX "incq %0; sete %1"
140 : "=m" (v->counter), "=qm" (c)
141 : "m" (v->counter) : "memory");
142 return c != 0;
143} 128}
144 129
145/** 130/**
@@ -153,12 +138,7 @@ static inline int atomic64_inc_and_test(atomic64_t *v)
153 */ 138 */
154static inline int atomic64_add_negative(long i, atomic64_t *v) 139static inline int atomic64_add_negative(long i, atomic64_t *v)
155{ 140{
156 unsigned char c; 141 GEN_BINARY_RMWcc(LOCK_PREFIX "addq", v->counter, i, "%0", "s");
157
158 asm volatile(LOCK_PREFIX "addq %2,%0; sets %1"
159 : "=m" (v->counter), "=qm" (c)
160 : "er" (i), "m" (v->counter) : "memory");
161 return c;
162} 142}
163 143
164/** 144/**
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
index 41639ce8fd63..6d76d0935989 100644
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
@@ -14,6 +14,7 @@
14 14
15#include <linux/compiler.h> 15#include <linux/compiler.h>
16#include <asm/alternative.h> 16#include <asm/alternative.h>
17#include <asm/rmwcc.h>
17 18
18#if BITS_PER_LONG == 32 19#if BITS_PER_LONG == 32
19# define _BITOPS_LONG_SHIFT 5 20# define _BITOPS_LONG_SHIFT 5
@@ -204,12 +205,7 @@ static inline void change_bit(long nr, volatile unsigned long *addr)
204 */ 205 */
205static inline int test_and_set_bit(long nr, volatile unsigned long *addr) 206static inline int test_and_set_bit(long nr, volatile unsigned long *addr)
206{ 207{
207 int oldbit; 208 GEN_BINARY_RMWcc(LOCK_PREFIX "bts", *addr, nr, "%0", "c");
208
209 asm volatile(LOCK_PREFIX "bts %2,%1\n\t"
210 "sbb %0,%0" : "=r" (oldbit), ADDR : "Ir" (nr) : "memory");
211
212 return oldbit;
213} 209}
214 210
215/** 211/**
@@ -255,13 +251,7 @@ static inline int __test_and_set_bit(long nr, volatile unsigned long *addr)
255 */ 251 */
256static inline int test_and_clear_bit(long nr, volatile unsigned long *addr) 252static inline int test_and_clear_bit(long nr, volatile unsigned long *addr)
257{ 253{
258 int oldbit; 254 GEN_BINARY_RMWcc(LOCK_PREFIX "btr", *addr, nr, "%0", "c");
259
260 asm volatile(LOCK_PREFIX "btr %2,%1\n\t"
261 "sbb %0,%0"
262 : "=r" (oldbit), ADDR : "Ir" (nr) : "memory");
263
264 return oldbit;
265} 255}
266 256
267/** 257/**
@@ -314,13 +304,7 @@ static inline int __test_and_change_bit(long nr, volatile unsigned long *addr)
314 */ 304 */
315static inline int test_and_change_bit(long nr, volatile unsigned long *addr) 305static inline int test_and_change_bit(long nr, volatile unsigned long *addr)
316{ 306{
317 int oldbit; 307 GEN_BINARY_RMWcc(LOCK_PREFIX "btc", *addr, nr, "%0", "c");
318
319 asm volatile(LOCK_PREFIX "btc %2,%1\n\t"
320 "sbb %0,%0"
321 : "=r" (oldbit), ADDR : "Ir" (nr) : "memory");
322
323 return oldbit;
324} 308}
325 309
326static __always_inline int constant_test_bit(long nr, const volatile unsigned long *addr) 310static __always_inline int constant_test_bit(long nr, const volatile unsigned long *addr)
diff --git a/arch/x86/include/asm/calling.h b/arch/x86/include/asm/calling.h
index 0fa675033912..cb4c73bfeb48 100644
--- a/arch/x86/include/asm/calling.h
+++ b/arch/x86/include/asm/calling.h
@@ -48,6 +48,8 @@ For 32-bit we have the following conventions - kernel is built with
48 48
49#include <asm/dwarf2.h> 49#include <asm/dwarf2.h>
50 50
51#ifdef CONFIG_X86_64
52
51/* 53/*
52 * 64-bit system call stack frame layout defines and helpers, 54 * 64-bit system call stack frame layout defines and helpers,
53 * for assembly code: 55 * for assembly code:
@@ -192,3 +194,51 @@ For 32-bit we have the following conventions - kernel is built with
192 .macro icebp 194 .macro icebp
193 .byte 0xf1 195 .byte 0xf1
194 .endm 196 .endm
197
198#else /* CONFIG_X86_64 */
199
200/*
201 * For 32bit only simplified versions of SAVE_ALL/RESTORE_ALL. These
202 * are different from the entry_32.S versions in not changing the segment
203 * registers. So only suitable for in kernel use, not when transitioning
204 * from or to user space. The resulting stack frame is not a standard
205 * pt_regs frame. The main use case is calling C code from assembler
206 * when all the registers need to be preserved.
207 */
208
209 .macro SAVE_ALL
210 pushl_cfi %eax
211 CFI_REL_OFFSET eax, 0
212 pushl_cfi %ebp
213 CFI_REL_OFFSET ebp, 0
214 pushl_cfi %edi
215 CFI_REL_OFFSET edi, 0
216 pushl_cfi %esi
217 CFI_REL_OFFSET esi, 0
218 pushl_cfi %edx
219 CFI_REL_OFFSET edx, 0
220 pushl_cfi %ecx
221 CFI_REL_OFFSET ecx, 0
222 pushl_cfi %ebx
223 CFI_REL_OFFSET ebx, 0
224 .endm
225
226 .macro RESTORE_ALL
227 popl_cfi %ebx
228 CFI_RESTORE ebx
229 popl_cfi %ecx
230 CFI_RESTORE ecx
231 popl_cfi %edx
232 CFI_RESTORE edx
233 popl_cfi %esi
234 CFI_RESTORE esi
235 popl_cfi %edi
236 CFI_RESTORE edi
237 popl_cfi %ebp
238 CFI_RESTORE ebp
239 popl_cfi %eax
240 CFI_RESTORE eax
241 .endm
242
243#endif /* CONFIG_X86_64 */
244
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index d3f5c63078d8..89270b4318db 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -374,7 +374,7 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
374 * Catch too early usage of this before alternatives 374 * Catch too early usage of this before alternatives
375 * have run. 375 * have run.
376 */ 376 */
377 asm goto("1: jmp %l[t_warn]\n" 377 asm_volatile_goto("1: jmp %l[t_warn]\n"
378 "2:\n" 378 "2:\n"
379 ".section .altinstructions,\"a\"\n" 379 ".section .altinstructions,\"a\"\n"
380 " .long 1b - .\n" 380 " .long 1b - .\n"
@@ -388,7 +388,7 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
388 388
389#endif 389#endif
390 390
391 asm goto("1: jmp %l[t_no]\n" 391 asm_volatile_goto("1: jmp %l[t_no]\n"
392 "2:\n" 392 "2:\n"
393 ".section .altinstructions,\"a\"\n" 393 ".section .altinstructions,\"a\"\n"
394 " .long 1b - .\n" 394 " .long 1b - .\n"
@@ -453,7 +453,7 @@ static __always_inline __pure bool _static_cpu_has_safe(u16 bit)
453 * have. Thus, we force the jump to the widest, 4-byte, signed relative 453 * have. Thus, we force the jump to the widest, 4-byte, signed relative
454 * offset even though the last would often fit in less bytes. 454 * offset even though the last would often fit in less bytes.
455 */ 455 */
456 asm goto("1: .byte 0xe9\n .long %l[t_dynamic] - 2f\n" 456 asm_volatile_goto("1: .byte 0xe9\n .long %l[t_dynamic] - 2f\n"
457 "2:\n" 457 "2:\n"
458 ".section .altinstructions,\"a\"\n" 458 ".section .altinstructions,\"a\"\n"
459 " .long 1b - .\n" /* src offset */ 459 " .long 1b - .\n" /* src offset */
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
index b90e5dfeee46..50d033a8947d 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -327,10 +327,25 @@ static inline void write_trace_idt_entry(int entry, const gate_desc *gate)
327{ 327{
328 write_idt_entry(trace_idt_table, entry, gate); 328 write_idt_entry(trace_idt_table, entry, gate);
329} 329}
330
331static inline void _trace_set_gate(int gate, unsigned type, void *addr,
332 unsigned dpl, unsigned ist, unsigned seg)
333{
334 gate_desc s;
335
336 pack_gate(&s, type, (unsigned long)addr, dpl, ist, seg);
337 /*
338 * does not need to be atomic because it is only done once at
339 * setup time
340 */
341 write_trace_idt_entry(gate, &s);
342}
330#else 343#else
331static inline void write_trace_idt_entry(int entry, const gate_desc *gate) 344static inline void write_trace_idt_entry(int entry, const gate_desc *gate)
332{ 345{
333} 346}
347
348#define _trace_set_gate(gate, type, addr, dpl, ist, seg)
334#endif 349#endif
335 350
336static inline void _set_gate(int gate, unsigned type, void *addr, 351static inline void _set_gate(int gate, unsigned type, void *addr,
@@ -353,11 +368,14 @@ static inline void _set_gate(int gate, unsigned type, void *addr,
353 * Pentium F0 0F bugfix can have resulted in the mapped 368 * Pentium F0 0F bugfix can have resulted in the mapped
354 * IDT being write-protected. 369 * IDT being write-protected.
355 */ 370 */
356static inline void set_intr_gate(unsigned int n, void *addr) 371#define set_intr_gate(n, addr) \
357{ 372 do { \
358 BUG_ON((unsigned)n > 0xFF); 373 BUG_ON((unsigned)n > 0xFF); \
359 _set_gate(n, GATE_INTERRUPT, addr, 0, 0, __KERNEL_CS); 374 _set_gate(n, GATE_INTERRUPT, (void *)addr, 0, 0, \
360} 375 __KERNEL_CS); \
376 _trace_set_gate(n, GATE_INTERRUPT, (void *)trace_##addr,\
377 0, 0, __KERNEL_CS); \
378 } while (0)
361 379
362extern int first_system_vector; 380extern int first_system_vector;
363/* used_vectors is BITMAP for irq is not managed by percpu vector_irq */ 381/* used_vectors is BITMAP for irq is not managed by percpu vector_irq */
@@ -374,37 +392,10 @@ static inline void alloc_system_vector(int vector)
374 } 392 }
375} 393}
376 394
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)
399{
400 set_intr_gate(n, addr);
401}
402
403#define alloc_intr_gate(n, addr) \ 395#define alloc_intr_gate(n, addr) \
404 do { \ 396 do { \
405 alloc_system_vector(n); \ 397 alloc_system_vector(n); \
406 __alloc_intr_gate(n, addr); \ 398 set_intr_gate(n, addr); \
407 __trace_alloc_intr_gate(n, trace_##addr); \
408 } while (0) 399 } while (0)
409 400
410/* 401/*
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 0062a0125041..65c6e6e3a552 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -109,6 +109,8 @@ static inline bool efi_is_native(void)
109 return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT); 109 return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT);
110} 110}
111 111
112extern struct console early_efi_console;
113
112#else 114#else
113/* 115/*
114 * IF EFI is not configured, have the EFI calls return -ENOSYS. 116 * IF EFI is not configured, have the EFI calls return -ENOSYS.
diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h
index 4d0bda7b11e3..c49a613c6452 100644
--- a/arch/x86/include/asm/fpu-internal.h
+++ b/arch/x86/include/asm/fpu-internal.h
@@ -365,7 +365,7 @@ static inline void drop_fpu(struct task_struct *tsk)
365 * Forget coprocessor state.. 365 * Forget coprocessor state..
366 */ 366 */
367 preempt_disable(); 367 preempt_disable();
368 tsk->fpu_counter = 0; 368 tsk->thread.fpu_counter = 0;
369 __drop_fpu(tsk); 369 __drop_fpu(tsk);
370 clear_used_math(); 370 clear_used_math();
371 preempt_enable(); 371 preempt_enable();
@@ -424,7 +424,7 @@ static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct ta
424 * or if the past 5 consecutive context-switches used math. 424 * or if the past 5 consecutive context-switches used math.
425 */ 425 */
426 fpu.preload = tsk_used_math(new) && (use_eager_fpu() || 426 fpu.preload = tsk_used_math(new) && (use_eager_fpu() ||
427 new->fpu_counter > 5); 427 new->thread.fpu_counter > 5);
428 if (__thread_has_fpu(old)) { 428 if (__thread_has_fpu(old)) {
429 if (!__save_init_fpu(old)) 429 if (!__save_init_fpu(old))
430 cpu = ~0; 430 cpu = ~0;
@@ -433,16 +433,16 @@ static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct ta
433 433
434 /* Don't change CR0.TS if we just switch! */ 434 /* Don't change CR0.TS if we just switch! */
435 if (fpu.preload) { 435 if (fpu.preload) {
436 new->fpu_counter++; 436 new->thread.fpu_counter++;
437 __thread_set_has_fpu(new); 437 __thread_set_has_fpu(new);
438 prefetch(new->thread.fpu.state); 438 prefetch(new->thread.fpu.state);
439 } else if (!use_eager_fpu()) 439 } else if (!use_eager_fpu())
440 stts(); 440 stts();
441 } else { 441 } else {
442 old->fpu_counter = 0; 442 old->thread.fpu_counter = 0;
443 old->thread.fpu.last_cpu = ~0; 443 old->thread.fpu.last_cpu = ~0;
444 if (fpu.preload) { 444 if (fpu.preload) {
445 new->fpu_counter++; 445 new->thread.fpu_counter++;
446 if (!use_eager_fpu() && fpu_lazy_restore(new, cpu)) 446 if (!use_eager_fpu() && fpu_lazy_restore(new, cpu))
447 fpu.preload = 0; 447 fpu.preload = 0;
448 else 448 else
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index 92b3bae08b74..cba45d99ac1a 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -187,6 +187,9 @@ extern __visible void smp_invalidate_interrupt(struct pt_regs *);
187#endif 187#endif
188 188
189extern void (*__initconst interrupt[NR_VECTORS-FIRST_EXTERNAL_VECTOR])(void); 189extern void (*__initconst interrupt[NR_VECTORS-FIRST_EXTERNAL_VECTOR])(void);
190#ifdef CONFIG_TRACING
191#define trace_interrupt interrupt
192#endif
190 193
191typedef int vector_irq_t[NR_VECTORS]; 194typedef int vector_irq_t[NR_VECTORS];
192DECLARE_PER_CPU(vector_irq_t, vector_irq); 195DECLARE_PER_CPU(vector_irq_t, vector_irq);
diff --git a/arch/x86/include/asm/intel-mid.h b/arch/x86/include/asm/intel-mid.h
new file mode 100644
index 000000000000..459769d39263
--- /dev/null
+++ b/arch/x86/include/asm/intel-mid.h
@@ -0,0 +1,113 @@
1/*
2 * intel-mid.h: Intel MID specific setup code
3 *
4 * (C) Copyright 2009 Intel Corporation
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; version 2
9 * of the License.
10 */
11#ifndef _ASM_X86_INTEL_MID_H
12#define _ASM_X86_INTEL_MID_H
13
14#include <linux/sfi.h>
15#include <linux/platform_device.h>
16
17extern int intel_mid_pci_init(void);
18extern int get_gpio_by_name(const char *name);
19extern void intel_scu_device_register(struct platform_device *pdev);
20extern int __init sfi_parse_mrtc(struct sfi_table_header *table);
21extern int __init sfi_parse_mtmr(struct sfi_table_header *table);
22extern int sfi_mrtc_num;
23extern struct sfi_rtc_table_entry sfi_mrtc_array[];
24
25/*
26 * Here defines the array of devices platform data that IAFW would export
27 * through SFI "DEVS" table, we use name and type to match the device and
28 * its platform data.
29 */
30struct devs_id {
31 char name[SFI_NAME_LEN + 1];
32 u8 type;
33 u8 delay;
34 void *(*get_platform_data)(void *info);
35 /* Custom handler for devices */
36 void (*device_handler)(struct sfi_device_table_entry *pentry,
37 struct devs_id *dev);
38};
39
40#define sfi_device(i) \
41 static const struct devs_id *const __intel_mid_sfi_##i##_dev __used \
42 __attribute__((__section__(".x86_intel_mid_dev.init"))) = &i
43
44/*
45 * Medfield is the follow-up of Moorestown, it combines two chip solution into
46 * one. Other than that it also added always-on and constant tsc and lapic
47 * timers. Medfield is the platform name, and the chip name is called Penwell
48 * we treat Medfield/Penwell as a variant of Moorestown. Penwell can be
49 * identified via MSRs.
50 */
51enum intel_mid_cpu_type {
52 /* 1 was Moorestown */
53 INTEL_MID_CPU_CHIP_PENWELL = 2,
54};
55
56extern enum intel_mid_cpu_type __intel_mid_cpu_chip;
57
58#ifdef CONFIG_X86_INTEL_MID
59
60static inline enum intel_mid_cpu_type intel_mid_identify_cpu(void)
61{
62 return __intel_mid_cpu_chip;
63}
64
65static inline bool intel_mid_has_msic(void)
66{
67 return (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_PENWELL);
68}
69
70#else /* !CONFIG_X86_INTEL_MID */
71
72#define intel_mid_identify_cpu() (0)
73#define intel_mid_has_msic() (0)
74
75#endif /* !CONFIG_X86_INTEL_MID */
76
77enum intel_mid_timer_options {
78 INTEL_MID_TIMER_DEFAULT,
79 INTEL_MID_TIMER_APBT_ONLY,
80 INTEL_MID_TIMER_LAPIC_APBT,
81};
82
83extern enum intel_mid_timer_options intel_mid_timer_options;
84
85/*
86 * Penwell uses spread spectrum clock, so the freq number is not exactly
87 * the same as reported by MSR based on SDM.
88 */
89#define PENWELL_FSB_FREQ_83SKU 83200
90#define PENWELL_FSB_FREQ_100SKU 99840
91
92#define SFI_MTMR_MAX_NUM 8
93#define SFI_MRTC_MAX 8
94
95extern struct console early_mrst_console;
96extern void mrst_early_console_init(void);
97
98extern struct console early_hsu_console;
99extern void hsu_early_console_init(const char *);
100
101extern void intel_scu_devices_create(void);
102extern void intel_scu_devices_destroy(void);
103
104/* VRTC timer */
105#define MRST_VRTC_MAP_SZ (1024)
106/*#define MRST_VRTC_PGOFFSET (0xc00) */
107
108extern void intel_mid_rtc_init(void);
109
110/* the offset for the mapping of global gpio pin to irq */
111#define INTEL_MID_IRQ_OFFSET 0x100
112
113#endif /* _ASM_X86_INTEL_MID_H */
diff --git a/arch/x86/include/asm/mrst-vrtc.h b/arch/x86/include/asm/intel_mid_vrtc.h
index 1e69a75412a4..86ff4685c409 100644
--- a/arch/x86/include/asm/mrst-vrtc.h
+++ b/arch/x86/include/asm/intel_mid_vrtc.h
@@ -1,5 +1,5 @@
1#ifndef _MRST_VRTC_H 1#ifndef _INTEL_MID_VRTC_H
2#define _MRST_VRTC_H 2#define _INTEL_MID_VRTC_H
3 3
4extern unsigned char vrtc_cmos_read(unsigned char reg); 4extern unsigned char vrtc_cmos_read(unsigned char reg);
5extern void vrtc_cmos_write(unsigned char val, unsigned char reg); 5extern void vrtc_cmos_write(unsigned char val, unsigned char reg);
diff --git a/arch/x86/include/asm/jump_label.h b/arch/x86/include/asm/jump_label.h
index 64507f35800c..6a2cefb4395a 100644
--- a/arch/x86/include/asm/jump_label.h
+++ b/arch/x86/include/asm/jump_label.h
@@ -18,7 +18,7 @@
18 18
19static __always_inline bool arch_static_branch(struct static_key *key) 19static __always_inline bool arch_static_branch(struct static_key *key)
20{ 20{
21 asm goto("1:" 21 asm_volatile_goto("1:"
22 ".byte " __stringify(STATIC_KEY_INIT_NOP) "\n\t" 22 ".byte " __stringify(STATIC_KEY_INIT_NOP) "\n\t"
23 ".pushsection __jump_table, \"aw\" \n\t" 23 ".pushsection __jump_table, \"aw\" \n\t"
24 _ASM_ALIGN "\n\t" 24 _ASM_ALIGN "\n\t"
diff --git a/arch/x86/include/asm/kdebug.h b/arch/x86/include/asm/kdebug.h
index 2c37aadcbc35..32ce71375b21 100644
--- a/arch/x86/include/asm/kdebug.h
+++ b/arch/x86/include/asm/kdebug.h
@@ -21,7 +21,7 @@ enum die_val {
21 DIE_NMIUNKNOWN, 21 DIE_NMIUNKNOWN,
22}; 22};
23 23
24extern void printk_address(unsigned long address, int reliable); 24extern void printk_address(unsigned long address);
25extern void die(const char *, struct pt_regs *,long); 25extern void die(const char *, struct pt_regs *,long);
26extern int __must_check __die(const char *, struct pt_regs *, long); 26extern int __must_check __die(const char *, struct pt_regs *, long);
27extern void show_trace(struct task_struct *t, struct pt_regs *regs, 27extern void show_trace(struct task_struct *t, struct pt_regs *regs,
diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h
index 15f960c06ff7..24ec1216596e 100644
--- a/arch/x86/include/asm/kvm_emulate.h
+++ b/arch/x86/include/asm/kvm_emulate.h
@@ -274,13 +274,17 @@ struct x86_emulate_ctxt {
274 274
275 bool guest_mode; /* guest running a nested guest */ 275 bool guest_mode; /* guest running a nested guest */
276 bool perm_ok; /* do not check permissions if true */ 276 bool perm_ok; /* do not check permissions if true */
277 bool only_vendor_specific_insn; 277 bool ud; /* inject an #UD if host doesn't support insn */
278 278
279 bool have_exception; 279 bool have_exception;
280 struct x86_exception exception; 280 struct x86_exception exception;
281 281
282 /* decode cache */ 282 /*
283 u8 twobyte; 283 * decode cache
284 */
285
286 /* current opcode length in bytes */
287 u8 opcode_len;
284 u8 b; 288 u8 b;
285 u8 intercept; 289 u8 intercept;
286 u8 lock_prefix; 290 u8 lock_prefix;
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index c76ff74a98f2..ae5d7830855c 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -79,6 +79,13 @@
79#define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1)) 79#define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1))
80#define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE) 80#define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE)
81 81
82static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level)
83{
84 /* KVM_HPAGE_GFN_SHIFT(PT_PAGE_TABLE_LEVEL) must be 0. */
85 return (gfn >> KVM_HPAGE_GFN_SHIFT(level)) -
86 (base_gfn >> KVM_HPAGE_GFN_SHIFT(level));
87}
88
82#define SELECTOR_TI_MASK (1 << 2) 89#define SELECTOR_TI_MASK (1 << 2)
83#define SELECTOR_RPL_MASK 0x03 90#define SELECTOR_RPL_MASK 0x03
84 91
@@ -253,7 +260,6 @@ struct kvm_pio_request {
253 * mode. 260 * mode.
254 */ 261 */
255struct kvm_mmu { 262struct kvm_mmu {
256 void (*new_cr3)(struct kvm_vcpu *vcpu);
257 void (*set_cr3)(struct kvm_vcpu *vcpu, unsigned long root); 263 void (*set_cr3)(struct kvm_vcpu *vcpu, unsigned long root);
258 unsigned long (*get_cr3)(struct kvm_vcpu *vcpu); 264 unsigned long (*get_cr3)(struct kvm_vcpu *vcpu);
259 u64 (*get_pdptr)(struct kvm_vcpu *vcpu, int index); 265 u64 (*get_pdptr)(struct kvm_vcpu *vcpu, int index);
@@ -261,7 +267,6 @@ struct kvm_mmu {
261 bool prefault); 267 bool prefault);
262 void (*inject_page_fault)(struct kvm_vcpu *vcpu, 268 void (*inject_page_fault)(struct kvm_vcpu *vcpu,
263 struct x86_exception *fault); 269 struct x86_exception *fault);
264 void (*free)(struct kvm_vcpu *vcpu);
265 gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva, u32 access, 270 gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva, u32 access,
266 struct x86_exception *exception); 271 struct x86_exception *exception);
267 gpa_t (*translate_gpa)(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access); 272 gpa_t (*translate_gpa)(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access);
@@ -389,6 +394,8 @@ struct kvm_vcpu_arch {
389 394
390 struct fpu guest_fpu; 395 struct fpu guest_fpu;
391 u64 xcr0; 396 u64 xcr0;
397 u64 guest_supported_xcr0;
398 u32 guest_xstate_size;
392 399
393 struct kvm_pio_request pio; 400 struct kvm_pio_request pio;
394 void *pio_data; 401 void *pio_data;
@@ -557,7 +564,9 @@ struct kvm_arch {
557 564
558 struct list_head assigned_dev_head; 565 struct list_head assigned_dev_head;
559 struct iommu_domain *iommu_domain; 566 struct iommu_domain *iommu_domain;
560 int iommu_flags; 567 bool iommu_noncoherent;
568#define __KVM_HAVE_ARCH_NONCOHERENT_DMA
569 atomic_t noncoherent_dma_count;
561 struct kvm_pic *vpic; 570 struct kvm_pic *vpic;
562 struct kvm_ioapic *vioapic; 571 struct kvm_ioapic *vioapic;
563 struct kvm_pit *vpit; 572 struct kvm_pit *vpit;
@@ -780,11 +789,11 @@ void kvm_mmu_module_exit(void);
780 789
781void kvm_mmu_destroy(struct kvm_vcpu *vcpu); 790void kvm_mmu_destroy(struct kvm_vcpu *vcpu);
782int kvm_mmu_create(struct kvm_vcpu *vcpu); 791int kvm_mmu_create(struct kvm_vcpu *vcpu);
783int kvm_mmu_setup(struct kvm_vcpu *vcpu); 792void kvm_mmu_setup(struct kvm_vcpu *vcpu);
784void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask, 793void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask,
785 u64 dirty_mask, u64 nx_mask, u64 x_mask); 794 u64 dirty_mask, u64 nx_mask, u64 x_mask);
786 795
787int kvm_mmu_reset_context(struct kvm_vcpu *vcpu); 796void kvm_mmu_reset_context(struct kvm_vcpu *vcpu);
788void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot); 797void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot);
789void kvm_mmu_write_protect_pt_masked(struct kvm *kvm, 798void kvm_mmu_write_protect_pt_masked(struct kvm *kvm,
790 struct kvm_memory_slot *slot, 799 struct kvm_memory_slot *slot,
@@ -922,13 +931,11 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu);
922int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva, u32 error_code, 931int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva, u32 error_code,
923 void *insn, int insn_len); 932 void *insn, int insn_len);
924void kvm_mmu_invlpg(struct kvm_vcpu *vcpu, gva_t gva); 933void kvm_mmu_invlpg(struct kvm_vcpu *vcpu, gva_t gva);
934void kvm_mmu_new_cr3(struct kvm_vcpu *vcpu);
925 935
926void kvm_enable_tdp(void); 936void kvm_enable_tdp(void);
927void kvm_disable_tdp(void); 937void kvm_disable_tdp(void);
928 938
929int complete_pio(struct kvm_vcpu *vcpu);
930bool kvm_check_iopl(struct kvm_vcpu *vcpu);
931
932static inline gpa_t translate_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access) 939static inline gpa_t translate_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access)
933{ 940{
934 return gpa; 941 return gpa;
diff --git a/arch/x86/include/asm/local.h b/arch/x86/include/asm/local.h
index 2d89e3980cbd..5b23e605e707 100644
--- a/arch/x86/include/asm/local.h
+++ b/arch/x86/include/asm/local.h
@@ -52,12 +52,7 @@ static inline void local_sub(long i, local_t *l)
52 */ 52 */
53static inline int local_sub_and_test(long i, local_t *l) 53static inline int local_sub_and_test(long i, local_t *l)
54{ 54{
55 unsigned char c; 55 GEN_BINARY_RMWcc(_ASM_SUB, l->a.counter, i, "%0", "e");
56
57 asm volatile(_ASM_SUB "%2,%0; sete %1"
58 : "+m" (l->a.counter), "=qm" (c)
59 : "ir" (i) : "memory");
60 return c;
61} 56}
62 57
63/** 58/**
@@ -70,12 +65,7 @@ static inline int local_sub_and_test(long i, local_t *l)
70 */ 65 */
71static inline int local_dec_and_test(local_t *l) 66static inline int local_dec_and_test(local_t *l)
72{ 67{
73 unsigned char c; 68 GEN_UNARY_RMWcc(_ASM_DEC, l->a.counter, "%0", "e");
74
75 asm volatile(_ASM_DEC "%0; sete %1"
76 : "+m" (l->a.counter), "=qm" (c)
77 : : "memory");
78 return c != 0;
79} 69}
80 70
81/** 71/**
@@ -88,12 +78,7 @@ static inline int local_dec_and_test(local_t *l)
88 */ 78 */
89static inline int local_inc_and_test(local_t *l) 79static inline int local_inc_and_test(local_t *l)
90{ 80{
91 unsigned char c; 81 GEN_UNARY_RMWcc(_ASM_INC, l->a.counter, "%0", "e");
92
93 asm volatile(_ASM_INC "%0; sete %1"
94 : "+m" (l->a.counter), "=qm" (c)
95 : : "memory");
96 return c != 0;
97} 82}
98 83
99/** 84/**
@@ -107,12 +92,7 @@ static inline int local_inc_and_test(local_t *l)
107 */ 92 */
108static inline int local_add_negative(long i, local_t *l) 93static inline int local_add_negative(long i, local_t *l)
109{ 94{
110 unsigned char c; 95 GEN_BINARY_RMWcc(_ASM_ADD, l->a.counter, i, "%0", "s");
111
112 asm volatile(_ASM_ADD "%2,%0; sets %1"
113 : "+m" (l->a.counter), "=qm" (c)
114 : "ir" (i) : "memory");
115 return c;
116} 96}
117 97
118/** 98/**
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index cbe6b9e404ce..c696a8687567 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -16,6 +16,7 @@
16#define MCG_EXT_CNT_SHIFT 16 16#define MCG_EXT_CNT_SHIFT 16
17#define MCG_EXT_CNT(c) (((c) & MCG_EXT_CNT_MASK) >> MCG_EXT_CNT_SHIFT) 17#define MCG_EXT_CNT(c) (((c) & MCG_EXT_CNT_MASK) >> MCG_EXT_CNT_SHIFT)
18#define MCG_SER_P (1ULL<<24) /* MCA recovery/new status bits */ 18#define MCG_SER_P (1ULL<<24) /* MCA recovery/new status bits */
19#define MCG_ELOG_P (1ULL<<26) /* Extended error log supported */
19 20
20/* MCG_STATUS register defines */ 21/* MCG_STATUS register defines */
21#define MCG_STATUS_RIPV (1ULL<<0) /* restart ip valid */ 22#define MCG_STATUS_RIPV (1ULL<<0) /* restart ip valid */
diff --git a/arch/x86/include/asm/misc.h b/arch/x86/include/asm/misc.h
new file mode 100644
index 000000000000..475f5bbc7f53
--- /dev/null
+++ b/arch/x86/include/asm/misc.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_X86_MISC_H
2#define _ASM_X86_MISC_H
3
4int num_digits(int val);
5
6#endif /* _ASM_X86_MISC_H */
diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h
index 626cf70082d7..3142a94c7b4b 100644
--- a/arch/x86/include/asm/mpspec.h
+++ b/arch/x86/include/asm/mpspec.h
@@ -94,7 +94,7 @@ static inline void early_reserve_e820_mpc_new(void) { }
94#define default_get_smp_config x86_init_uint_noop 94#define default_get_smp_config x86_init_uint_noop
95#endif 95#endif
96 96
97void generic_processor_info(int apicid, int version); 97int generic_processor_info(int apicid, int version);
98#ifdef CONFIG_ACPI 98#ifdef CONFIG_ACPI
99extern void mp_register_ioapic(int id, u32 address, u32 gsi_base); 99extern void mp_register_ioapic(int id, u32 address, u32 gsi_base);
100extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, 100extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
diff --git a/arch/x86/include/asm/mrst.h b/arch/x86/include/asm/mrst.h
deleted file mode 100644
index fc18bf3ce7c8..000000000000
--- a/arch/x86/include/asm/mrst.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * mrst.h: Intel Moorestown platform specific setup code
3 *
4 * (C) Copyright 2009 Intel Corporation
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; version 2
9 * of the License.
10 */
11#ifndef _ASM_X86_MRST_H
12#define _ASM_X86_MRST_H
13
14#include <linux/sfi.h>
15
16extern int pci_mrst_init(void);
17extern int __init sfi_parse_mrtc(struct sfi_table_header *table);
18extern int sfi_mrtc_num;
19extern struct sfi_rtc_table_entry sfi_mrtc_array[];
20
21/*
22 * Medfield is the follow-up of Moorestown, it combines two chip solution into
23 * one. Other than that it also added always-on and constant tsc and lapic
24 * timers. Medfield is the platform name, and the chip name is called Penwell
25 * we treat Medfield/Penwell as a variant of Moorestown. Penwell can be
26 * identified via MSRs.
27 */
28enum mrst_cpu_type {
29 /* 1 was Moorestown */
30 MRST_CPU_CHIP_PENWELL = 2,
31};
32
33extern enum mrst_cpu_type __mrst_cpu_chip;
34
35#ifdef CONFIG_X86_INTEL_MID
36
37static inline enum mrst_cpu_type mrst_identify_cpu(void)
38{
39 return __mrst_cpu_chip;
40}
41
42#else /* !CONFIG_X86_INTEL_MID */
43
44#define mrst_identify_cpu() (0)
45
46#endif /* !CONFIG_X86_INTEL_MID */
47
48enum mrst_timer_options {
49 MRST_TIMER_DEFAULT,
50 MRST_TIMER_APBT_ONLY,
51 MRST_TIMER_LAPIC_APBT,
52};
53
54extern enum mrst_timer_options mrst_timer_options;
55
56/*
57 * Penwell uses spread spectrum clock, so the freq number is not exactly
58 * the same as reported by MSR based on SDM.
59 */
60#define PENWELL_FSB_FREQ_83SKU 83200
61#define PENWELL_FSB_FREQ_100SKU 99840
62
63#define SFI_MTMR_MAX_NUM 8
64#define SFI_MRTC_MAX 8
65
66extern struct console early_mrst_console;
67extern void mrst_early_console_init(void);
68
69extern struct console early_hsu_console;
70extern void hsu_early_console_init(const char *);
71
72extern void intel_scu_devices_create(void);
73extern void intel_scu_devices_destroy(void);
74
75/* VRTC timer */
76#define MRST_VRTC_MAP_SZ (1024)
77/*#define MRST_VRTC_PGOFFSET (0xc00) */
78
79extern void mrst_rtc_init(void);
80
81#endif /* _ASM_X86_MRST_H */
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index cb7502852acb..e139b13f2a33 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -218,10 +218,14 @@ void msrs_free(struct msr *msrs);
218#ifdef CONFIG_SMP 218#ifdef CONFIG_SMP
219int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); 219int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
220int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); 220int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
221int rdmsrl_on_cpu(unsigned int cpu, u32 msr_no, u64 *q);
222int wrmsrl_on_cpu(unsigned int cpu, u32 msr_no, u64 q);
221void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs); 223void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs);
222void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs); 224void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs);
223int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); 225int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
224int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); 226int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
227int rdmsrl_safe_on_cpu(unsigned int cpu, u32 msr_no, u64 *q);
228int wrmsrl_safe_on_cpu(unsigned int cpu, u32 msr_no, u64 q);
225int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 regs[8]); 229int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 regs[8]);
226int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 regs[8]); 230int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 regs[8]);
227#else /* CONFIG_SMP */ 231#else /* CONFIG_SMP */
@@ -235,6 +239,16 @@ static inline int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
235 wrmsr(msr_no, l, h); 239 wrmsr(msr_no, l, h);
236 return 0; 240 return 0;
237} 241}
242static inline int rdmsrl_on_cpu(unsigned int cpu, u32 msr_no, u64 *q)
243{
244 rdmsrl(msr_no, *q);
245 return 0;
246}
247static inline int wrmsrl_on_cpu(unsigned int cpu, u32 msr_no, u64 q)
248{
249 wrmsrl(msr_no, q);
250 return 0;
251}
238static inline void rdmsr_on_cpus(const struct cpumask *m, u32 msr_no, 252static inline void rdmsr_on_cpus(const struct cpumask *m, u32 msr_no,
239 struct msr *msrs) 253 struct msr *msrs)
240{ 254{
@@ -254,6 +268,14 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
254{ 268{
255 return wrmsr_safe(msr_no, l, h); 269 return wrmsr_safe(msr_no, l, h);
256} 270}
271static inline int rdmsrl_safe_on_cpu(unsigned int cpu, u32 msr_no, u64 *q)
272{
273 return rdmsrl_safe(msr_no, q);
274}
275static inline int wrmsrl_safe_on_cpu(unsigned int cpu, u32 msr_no, u64 q)
276{
277 return wrmsrl_safe(msr_no, q);
278}
257static inline int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 regs[8]) 279static inline int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 regs[8])
258{ 280{
259 return rdmsr_safe_regs(regs); 281 return rdmsr_safe_regs(regs);
diff --git a/arch/x86/include/asm/mutex_64.h b/arch/x86/include/asm/mutex_64.h
index e7e6751648ed..07537a44216e 100644
--- a/arch/x86/include/asm/mutex_64.h
+++ b/arch/x86/include/asm/mutex_64.h
@@ -20,7 +20,7 @@
20static inline void __mutex_fastpath_lock(atomic_t *v, 20static inline void __mutex_fastpath_lock(atomic_t *v,
21 void (*fail_fn)(atomic_t *)) 21 void (*fail_fn)(atomic_t *))
22{ 22{
23 asm volatile goto(LOCK_PREFIX " decl %0\n" 23 asm_volatile_goto(LOCK_PREFIX " decl %0\n"
24 " jns %l[exit]\n" 24 " jns %l[exit]\n"
25 : : "m" (v->counter) 25 : : "m" (v->counter)
26 : "memory", "cc" 26 : "memory", "cc"
@@ -75,7 +75,7 @@ static inline int __mutex_fastpath_lock_retval(atomic_t *count)
75static inline void __mutex_fastpath_unlock(atomic_t *v, 75static inline void __mutex_fastpath_unlock(atomic_t *v,
76 void (*fail_fn)(atomic_t *)) 76 void (*fail_fn)(atomic_t *))
77{ 77{
78 asm volatile goto(LOCK_PREFIX " incl %0\n" 78 asm_volatile_goto(LOCK_PREFIX " incl %0\n"
79 " jg %l[exit]\n" 79 " jg %l[exit]\n"
80 : : "m" (v->counter) 80 : : "m" (v->counter)
81 : "memory", "cc" 81 : "memory", "cc"
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index 0da5200ee79d..94220d14d5cc 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -128,7 +128,8 @@ do { \
128do { \ 128do { \
129 typedef typeof(var) pao_T__; \ 129 typedef typeof(var) pao_T__; \
130 const int pao_ID__ = (__builtin_constant_p(val) && \ 130 const int pao_ID__ = (__builtin_constant_p(val) && \
131 ((val) == 1 || (val) == -1)) ? (val) : 0; \ 131 ((val) == 1 || (val) == -1)) ? \
132 (int)(val) : 0; \
132 if (0) { \ 133 if (0) { \
133 pao_T__ pao_tmp__; \ 134 pao_T__ pao_tmp__; \
134 pao_tmp__ = (val); \ 135 pao_tmp__ = (val); \
@@ -377,9 +378,6 @@ do { \
377#define __this_cpu_or_1(pcp, val) percpu_to_op("or", (pcp), val) 378#define __this_cpu_or_1(pcp, val) percpu_to_op("or", (pcp), val)
378#define __this_cpu_or_2(pcp, val) percpu_to_op("or", (pcp), val) 379#define __this_cpu_or_2(pcp, val) percpu_to_op("or", (pcp), val)
379#define __this_cpu_or_4(pcp, val) percpu_to_op("or", (pcp), val) 380#define __this_cpu_or_4(pcp, val) percpu_to_op("or", (pcp), val)
380#define __this_cpu_xor_1(pcp, val) percpu_to_op("xor", (pcp), val)
381#define __this_cpu_xor_2(pcp, val) percpu_to_op("xor", (pcp), val)
382#define __this_cpu_xor_4(pcp, val) percpu_to_op("xor", (pcp), val)
383#define __this_cpu_xchg_1(pcp, val) percpu_xchg_op(pcp, val) 381#define __this_cpu_xchg_1(pcp, val) percpu_xchg_op(pcp, val)
384#define __this_cpu_xchg_2(pcp, val) percpu_xchg_op(pcp, val) 382#define __this_cpu_xchg_2(pcp, val) percpu_xchg_op(pcp, val)
385#define __this_cpu_xchg_4(pcp, val) percpu_xchg_op(pcp, val) 383#define __this_cpu_xchg_4(pcp, val) percpu_xchg_op(pcp, val)
@@ -399,9 +397,6 @@ do { \
399#define this_cpu_or_1(pcp, val) percpu_to_op("or", (pcp), val) 397#define this_cpu_or_1(pcp, val) percpu_to_op("or", (pcp), val)
400#define this_cpu_or_2(pcp, val) percpu_to_op("or", (pcp), val) 398#define this_cpu_or_2(pcp, val) percpu_to_op("or", (pcp), val)
401#define this_cpu_or_4(pcp, val) percpu_to_op("or", (pcp), val) 399#define this_cpu_or_4(pcp, val) percpu_to_op("or", (pcp), val)
402#define this_cpu_xor_1(pcp, val) percpu_to_op("xor", (pcp), val)
403#define this_cpu_xor_2(pcp, val) percpu_to_op("xor", (pcp), val)
404#define this_cpu_xor_4(pcp, val) percpu_to_op("xor", (pcp), val)
405#define this_cpu_xchg_1(pcp, nval) percpu_xchg_op(pcp, nval) 400#define this_cpu_xchg_1(pcp, nval) percpu_xchg_op(pcp, nval)
406#define this_cpu_xchg_2(pcp, nval) percpu_xchg_op(pcp, nval) 401#define this_cpu_xchg_2(pcp, nval) percpu_xchg_op(pcp, nval)
407#define this_cpu_xchg_4(pcp, nval) percpu_xchg_op(pcp, nval) 402#define this_cpu_xchg_4(pcp, nval) percpu_xchg_op(pcp, nval)
@@ -446,7 +441,6 @@ do { \
446#define __this_cpu_add_8(pcp, val) percpu_add_op((pcp), val) 441#define __this_cpu_add_8(pcp, val) percpu_add_op((pcp), val)
447#define __this_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val) 442#define __this_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val)
448#define __this_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val) 443#define __this_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val)
449#define __this_cpu_xor_8(pcp, val) percpu_to_op("xor", (pcp), val)
450#define __this_cpu_add_return_8(pcp, val) percpu_add_return_op(pcp, val) 444#define __this_cpu_add_return_8(pcp, val) percpu_add_return_op(pcp, val)
451#define __this_cpu_xchg_8(pcp, nval) percpu_xchg_op(pcp, nval) 445#define __this_cpu_xchg_8(pcp, nval) percpu_xchg_op(pcp, nval)
452#define __this_cpu_cmpxchg_8(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval) 446#define __this_cpu_cmpxchg_8(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval)
@@ -456,7 +450,6 @@ do { \
456#define this_cpu_add_8(pcp, val) percpu_add_op((pcp), val) 450#define this_cpu_add_8(pcp, val) percpu_add_op((pcp), val)
457#define this_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val) 451#define this_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val)
458#define this_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val) 452#define this_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val)
459#define this_cpu_xor_8(pcp, val) percpu_to_op("xor", (pcp), val)
460#define this_cpu_add_return_8(pcp, val) percpu_add_return_op(pcp, val) 453#define this_cpu_add_return_8(pcp, val) percpu_add_return_op(pcp, val)
461#define this_cpu_xchg_8(pcp, nval) percpu_xchg_op(pcp, nval) 454#define this_cpu_xchg_8(pcp, nval) percpu_xchg_op(pcp, nval)
462#define this_cpu_cmpxchg_8(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval) 455#define this_cpu_cmpxchg_8(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval)
diff --git a/arch/x86/include/asm/pgalloc.h b/arch/x86/include/asm/pgalloc.h
index b4389a468fb6..c4412e972bbd 100644
--- a/arch/x86/include/asm/pgalloc.h
+++ b/arch/x86/include/asm/pgalloc.h
@@ -80,12 +80,21 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
80#if PAGETABLE_LEVELS > 2 80#if PAGETABLE_LEVELS > 2
81static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) 81static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
82{ 82{
83 return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT); 83 struct page *page;
84 page = alloc_pages(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO, 0);
85 if (!page)
86 return NULL;
87 if (!pgtable_pmd_page_ctor(page)) {
88 __free_pages(page, 0);
89 return NULL;
90 }
91 return (pmd_t *)page_address(page);
84} 92}
85 93
86static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) 94static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
87{ 95{
88 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1)); 96 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
97 pgtable_pmd_page_dtor(virt_to_page(pmd));
89 free_page((unsigned long)pmd); 98 free_page((unsigned long)pmd);
90} 99}
91 100
diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h
new file mode 100644
index 000000000000..8729723636fd
--- /dev/null
+++ b/arch/x86/include/asm/preempt.h
@@ -0,0 +1,100 @@
1#ifndef __ASM_PREEMPT_H
2#define __ASM_PREEMPT_H
3
4#include <asm/rmwcc.h>
5#include <asm/percpu.h>
6#include <linux/thread_info.h>
7
8DECLARE_PER_CPU(int, __preempt_count);
9
10/*
11 * We mask the PREEMPT_NEED_RESCHED bit so as not to confuse all current users
12 * that think a non-zero value indicates we cannot preempt.
13 */
14static __always_inline int preempt_count(void)
15{
16 return __this_cpu_read_4(__preempt_count) & ~PREEMPT_NEED_RESCHED;
17}
18
19static __always_inline void preempt_count_set(int pc)
20{
21 __this_cpu_write_4(__preempt_count, pc);
22}
23
24/*
25 * must be macros to avoid header recursion hell
26 */
27#define task_preempt_count(p) \
28 (task_thread_info(p)->saved_preempt_count & ~PREEMPT_NEED_RESCHED)
29
30#define init_task_preempt_count(p) do { \
31 task_thread_info(p)->saved_preempt_count = PREEMPT_DISABLED; \
32} while (0)
33
34#define init_idle_preempt_count(p, cpu) do { \
35 task_thread_info(p)->saved_preempt_count = PREEMPT_ENABLED; \
36 per_cpu(__preempt_count, (cpu)) = PREEMPT_ENABLED; \
37} while (0)
38
39/*
40 * We fold the NEED_RESCHED bit into the preempt count such that
41 * preempt_enable() can decrement and test for needing to reschedule with a
42 * single instruction.
43 *
44 * We invert the actual bit, so that when the decrement hits 0 we know we both
45 * need to resched (the bit is cleared) and can resched (no preempt count).
46 */
47
48static __always_inline void set_preempt_need_resched(void)
49{
50 __this_cpu_and_4(__preempt_count, ~PREEMPT_NEED_RESCHED);
51}
52
53static __always_inline void clear_preempt_need_resched(void)
54{
55 __this_cpu_or_4(__preempt_count, PREEMPT_NEED_RESCHED);
56}
57
58static __always_inline bool test_preempt_need_resched(void)
59{
60 return !(__this_cpu_read_4(__preempt_count) & PREEMPT_NEED_RESCHED);
61}
62
63/*
64 * The various preempt_count add/sub methods
65 */
66
67static __always_inline void __preempt_count_add(int val)
68{
69 __this_cpu_add_4(__preempt_count, val);
70}
71
72static __always_inline void __preempt_count_sub(int val)
73{
74 __this_cpu_add_4(__preempt_count, -val);
75}
76
77static __always_inline bool __preempt_count_dec_and_test(void)
78{
79 GEN_UNARY_RMWcc("decl", __preempt_count, __percpu_arg(0), "e");
80}
81
82/*
83 * Returns true when we need to resched and can (barring IRQ state).
84 */
85static __always_inline bool should_resched(void)
86{
87 return unlikely(!__this_cpu_read_4(__preempt_count));
88}
89
90#ifdef CONFIG_PREEMPT
91 extern asmlinkage void ___preempt_schedule(void);
92# define __preempt_schedule() asm ("call ___preempt_schedule")
93 extern asmlinkage void preempt_schedule(void);
94# ifdef CONFIG_CONTEXT_TRACKING
95 extern asmlinkage void ___preempt_schedule_context(void);
96# define __preempt_schedule_context() asm ("call ___preempt_schedule_context")
97# endif
98#endif
99
100#endif /* __ASM_PREEMPT_H */
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 987c75ecc334..7b034a4057f9 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -488,6 +488,15 @@ struct thread_struct {
488 unsigned long iopl; 488 unsigned long iopl;
489 /* Max allowed port in the bitmap, in bytes: */ 489 /* Max allowed port in the bitmap, in bytes: */
490 unsigned io_bitmap_max; 490 unsigned io_bitmap_max;
491 /*
492 * fpu_counter contains the number of consecutive context switches
493 * that the FPU is used. If this is over a threshold, the lazy fpu
494 * saving becomes unlazy to save the trap. This is an unsigned char
495 * so that after 256 times the counter wraps and the behavior turns
496 * lazy again; this to deal with bursty apps that only use FPU for
497 * a short time
498 */
499 unsigned char fpu_counter;
491}; 500};
492 501
493/* 502/*
diff --git a/arch/x86/include/asm/prom.h b/arch/x86/include/asm/prom.h
index bade6ac3b14f..fbeb06ed0eaa 100644
--- a/arch/x86/include/asm/prom.h
+++ b/arch/x86/include/asm/prom.h
@@ -39,10 +39,5 @@ static inline void x86_dtb_init(void) { }
39 39
40extern char cmd_line[COMMAND_LINE_SIZE]; 40extern char cmd_line[COMMAND_LINE_SIZE];
41 41
42#define pci_address_to_pio pci_address_to_pio
43unsigned long pci_address_to_pio(phys_addr_t addr);
44
45#define HAVE_ARCH_DEVTREE_FIXUPS
46
47#endif /* __ASSEMBLY__ */ 42#endif /* __ASSEMBLY__ */
48#endif 43#endif
diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
index be8269b00e2a..d6b078e9fa28 100644
--- a/arch/x86/include/asm/pvclock.h
+++ b/arch/x86/include/asm/pvclock.h
@@ -14,6 +14,8 @@ void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
14 struct timespec *ts); 14 struct timespec *ts);
15void pvclock_resume(void); 15void pvclock_resume(void);
16 16
17void pvclock_touch_watchdogs(void);
18
17/* 19/*
18 * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction, 20 * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
19 * yielding a 64-bit result. 21 * yielding a 64-bit result.
diff --git a/arch/x86/include/asm/rmwcc.h b/arch/x86/include/asm/rmwcc.h
new file mode 100644
index 000000000000..1ff990f1de8e
--- /dev/null
+++ b/arch/x86/include/asm/rmwcc.h
@@ -0,0 +1,41 @@
1#ifndef _ASM_X86_RMWcc
2#define _ASM_X86_RMWcc
3
4#ifdef CC_HAVE_ASM_GOTO
5
6#define __GEN_RMWcc(fullop, var, cc, ...) \
7do { \
8 asm_volatile_goto (fullop "; j" cc " %l[cc_label]" \
9 : : "m" (var), ## __VA_ARGS__ \
10 : "memory" : cc_label); \
11 return 0; \
12cc_label: \
13 return 1; \
14} while (0)
15
16#define GEN_UNARY_RMWcc(op, var, arg0, cc) \
17 __GEN_RMWcc(op " " arg0, var, cc)
18
19#define GEN_BINARY_RMWcc(op, var, val, arg0, cc) \
20 __GEN_RMWcc(op " %1, " arg0, var, cc, "er" (val))
21
22#else /* !CC_HAVE_ASM_GOTO */
23
24#define __GEN_RMWcc(fullop, var, cc, ...) \
25do { \
26 char c; \
27 asm volatile (fullop "; set" cc " %1" \
28 : "+m" (var), "=qm" (c) \
29 : __VA_ARGS__ : "memory"); \
30 return c != 0; \
31} while (0)
32
33#define GEN_UNARY_RMWcc(op, var, arg0, cc) \
34 __GEN_RMWcc(op " " arg0, var, cc)
35
36#define GEN_BINARY_RMWcc(op, var, val, arg0, cc) \
37 __GEN_RMWcc(op " %2, " arg0, var, cc, "er" (val))
38
39#endif /* CC_HAVE_ASM_GOTO */
40
41#endif /* _ASM_X86_RMWcc */
diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
index c48a95035a77..6f1c3a8a33ab 100644
--- a/arch/x86/include/asm/segment.h
+++ b/arch/x86/include/asm/segment.h
@@ -214,6 +214,9 @@
214#ifdef __KERNEL__ 214#ifdef __KERNEL__
215#ifndef __ASSEMBLY__ 215#ifndef __ASSEMBLY__
216extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][2+2+5]; 216extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][2+2+5];
217#ifdef CONFIG_TRACING
218#define trace_early_idt_handlers early_idt_handlers
219#endif
217 220
218/* 221/*
219 * Load a segment. Fall back on loading the zero 222 * Load a segment. Fall back on loading the zero
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index 347555492dad..59bcf4e22418 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -51,9 +51,9 @@ extern void i386_reserve_resources(void);
51extern void setup_default_timer_irq(void); 51extern void setup_default_timer_irq(void);
52 52
53#ifdef CONFIG_X86_INTEL_MID 53#ifdef CONFIG_X86_INTEL_MID
54extern void x86_mrst_early_setup(void); 54extern void x86_intel_mid_early_setup(void);
55#else 55#else
56static inline void x86_mrst_early_setup(void) { } 56static inline void x86_intel_mid_early_setup(void) { }
57#endif 57#endif
58 58
59#ifdef CONFIG_X86_INTEL_CE 59#ifdef CONFIG_X86_INTEL_CE
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index 27811190cbd7..c46a46be1ec6 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -28,8 +28,7 @@ struct thread_info {
28 __u32 flags; /* low level flags */ 28 __u32 flags; /* low level flags */
29 __u32 status; /* thread synchronous flags */ 29 __u32 status; /* thread synchronous flags */
30 __u32 cpu; /* current CPU */ 30 __u32 cpu; /* current CPU */
31 int preempt_count; /* 0 => preemptable, 31 int saved_preempt_count;
32 <0 => BUG */
33 mm_segment_t addr_limit; 32 mm_segment_t addr_limit;
34 struct restart_block restart_block; 33 struct restart_block restart_block;
35 void __user *sysenter_return; 34 void __user *sysenter_return;
@@ -49,7 +48,7 @@ struct thread_info {
49 .exec_domain = &default_exec_domain, \ 48 .exec_domain = &default_exec_domain, \
50 .flags = 0, \ 49 .flags = 0, \
51 .cpu = 0, \ 50 .cpu = 0, \
52 .preempt_count = INIT_PREEMPT_COUNT, \ 51 .saved_preempt_count = INIT_PREEMPT_COUNT, \
53 .addr_limit = KERNEL_DS, \ 52 .addr_limit = KERNEL_DS, \
54 .restart_block = { \ 53 .restart_block = { \
55 .fn = do_no_restart_syscall, \ 54 .fn = do_no_restart_syscall, \
diff --git a/arch/x86/include/asm/trace/exceptions.h b/arch/x86/include/asm/trace/exceptions.h
new file mode 100644
index 000000000000..2fbc66c7885b
--- /dev/null
+++ b/arch/x86/include/asm/trace/exceptions.h
@@ -0,0 +1,52 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM exceptions
3
4#if !defined(_TRACE_PAGE_FAULT_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_PAGE_FAULT_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_exceptions,
13
14 TP_PROTO(unsigned long address, struct pt_regs *regs,
15 unsigned long error_code),
16
17 TP_ARGS(address, regs, error_code),
18
19 TP_STRUCT__entry(
20 __field( unsigned long, address )
21 __field( unsigned long, ip )
22 __field( unsigned long, error_code )
23 ),
24
25 TP_fast_assign(
26 __entry->address = address;
27 __entry->ip = regs->ip;
28 __entry->error_code = error_code;
29 ),
30
31 TP_printk("address=%pf ip=%pf error_code=0x%lx",
32 (void *)__entry->address, (void *)__entry->ip,
33 __entry->error_code) );
34
35#define DEFINE_PAGE_FAULT_EVENT(name) \
36DEFINE_EVENT_FN(x86_exceptions, name, \
37 TP_PROTO(unsigned long address, struct pt_regs *regs, \
38 unsigned long error_code), \
39 TP_ARGS(address, regs, error_code), \
40 trace_irq_vector_regfunc, \
41 trace_irq_vector_unregfunc);
42
43DEFINE_PAGE_FAULT_EVENT(page_fault_user);
44DEFINE_PAGE_FAULT_EVENT(page_fault_kernel);
45
46#undef TRACE_INCLUDE_PATH
47#define TRACE_INCLUDE_PATH .
48#define TRACE_INCLUDE_FILE exceptions
49#endif /* _TRACE_PAGE_FAULT_H */
50
51/* This part must be outside protection */
52#include <trace/define_trace.h>
diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
index 7036cb60cd87..58d66fe06b61 100644
--- a/arch/x86/include/asm/traps.h
+++ b/arch/x86/include/asm/traps.h
@@ -37,6 +37,23 @@ asmlinkage void machine_check(void);
37#endif /* CONFIG_X86_MCE */ 37#endif /* CONFIG_X86_MCE */
38asmlinkage void simd_coprocessor_error(void); 38asmlinkage void simd_coprocessor_error(void);
39 39
40#ifdef CONFIG_TRACING
41asmlinkage void trace_page_fault(void);
42#define trace_divide_error divide_error
43#define trace_bounds bounds
44#define trace_invalid_op invalid_op
45#define trace_device_not_available device_not_available
46#define trace_coprocessor_segment_overrun coprocessor_segment_overrun
47#define trace_invalid_TSS invalid_TSS
48#define trace_segment_not_present segment_not_present
49#define trace_general_protection general_protection
50#define trace_spurious_interrupt_bug spurious_interrupt_bug
51#define trace_coprocessor_error coprocessor_error
52#define trace_alignment_check alignment_check
53#define trace_simd_coprocessor_error simd_coprocessor_error
54#define trace_async_page_fault async_page_fault
55#endif
56
40dotraplinkage void do_divide_error(struct pt_regs *, long); 57dotraplinkage void do_divide_error(struct pt_regs *, long);
41dotraplinkage void do_debug(struct pt_regs *, long); 58dotraplinkage void do_debug(struct pt_regs *, long);
42dotraplinkage void do_nmi(struct pt_regs *, long); 59dotraplinkage void do_nmi(struct pt_regs *, long);
@@ -55,6 +72,9 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *);
55#endif 72#endif
56dotraplinkage void do_general_protection(struct pt_regs *, long); 73dotraplinkage void do_general_protection(struct pt_regs *, long);
57dotraplinkage void do_page_fault(struct pt_regs *, unsigned long); 74dotraplinkage void do_page_fault(struct pt_regs *, unsigned long);
75#ifdef CONFIG_TRACING
76dotraplinkage void trace_do_page_fault(struct pt_regs *, unsigned long);
77#endif
58dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *, long); 78dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *, long);
59dotraplinkage void do_coprocessor_error(struct pt_regs *, long); 79dotraplinkage void do_coprocessor_error(struct pt_regs *, long);
60dotraplinkage void do_alignment_check(struct pt_regs *, long); 80dotraplinkage void do_alignment_check(struct pt_regs *, long);
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index 5838fa911aa0..8ec57c07b125 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -542,5 +542,103 @@ extern struct movsl_mask {
542# include <asm/uaccess_64.h> 542# include <asm/uaccess_64.h>
543#endif 543#endif
544 544
545unsigned long __must_check _copy_from_user(void *to, const void __user *from,
546 unsigned n);
547unsigned long __must_check _copy_to_user(void __user *to, const void *from,
548 unsigned n);
549
550#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
551# define copy_user_diag __compiletime_error
552#else
553# define copy_user_diag __compiletime_warning
554#endif
555
556extern void copy_user_diag("copy_from_user() buffer size is too small")
557copy_from_user_overflow(void);
558extern void copy_user_diag("copy_to_user() buffer size is too small")
559copy_to_user_overflow(void) __asm__("copy_from_user_overflow");
560
561#undef copy_user_diag
562
563#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
564
565extern void
566__compiletime_warning("copy_from_user() buffer size is not provably correct")
567__copy_from_user_overflow(void) __asm__("copy_from_user_overflow");
568#define __copy_from_user_overflow(size, count) __copy_from_user_overflow()
569
570extern void
571__compiletime_warning("copy_to_user() buffer size is not provably correct")
572__copy_to_user_overflow(void) __asm__("copy_from_user_overflow");
573#define __copy_to_user_overflow(size, count) __copy_to_user_overflow()
574
575#else
576
577static inline void
578__copy_from_user_overflow(int size, unsigned long count)
579{
580 WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count);
581}
582
583#define __copy_to_user_overflow __copy_from_user_overflow
584
585#endif
586
587static inline unsigned long __must_check
588copy_from_user(void *to, const void __user *from, unsigned long n)
589{
590 int sz = __compiletime_object_size(to);
591
592 might_fault();
593
594 /*
595 * While we would like to have the compiler do the checking for us
596 * even in the non-constant size case, any false positives there are
597 * a problem (especially when DEBUG_STRICT_USER_COPY_CHECKS, but even
598 * without - the [hopefully] dangerous looking nature of the warning
599 * would make people go look at the respecitive call sites over and
600 * over again just to find that there's no problem).
601 *
602 * And there are cases where it's just not realistic for the compiler
603 * to prove the count to be in range. For example when multiple call
604 * sites of a helper function - perhaps in different source files -
605 * all doing proper range checking, yet the helper function not doing
606 * so again.
607 *
608 * Therefore limit the compile time checking to the constant size
609 * case, and do only runtime checking for non-constant sizes.
610 */
611
612 if (likely(sz < 0 || sz >= n))
613 n = _copy_from_user(to, from, n);
614 else if(__builtin_constant_p(n))
615 copy_from_user_overflow();
616 else
617 __copy_from_user_overflow(sz, n);
618
619 return n;
620}
621
622static inline unsigned long __must_check
623copy_to_user(void __user *to, const void *from, unsigned long n)
624{
625 int sz = __compiletime_object_size(from);
626
627 might_fault();
628
629 /* See the comment in copy_from_user() above. */
630 if (likely(sz < 0 || sz >= n))
631 n = _copy_to_user(to, from, n);
632 else if(__builtin_constant_p(n))
633 copy_to_user_overflow();
634 else
635 __copy_to_user_overflow(sz, n);
636
637 return n;
638}
639
640#undef __copy_from_user_overflow
641#undef __copy_to_user_overflow
642
545#endif /* _ASM_X86_UACCESS_H */ 643#endif /* _ASM_X86_UACCESS_H */
546 644
diff --git a/arch/x86/include/asm/uaccess_32.h b/arch/x86/include/asm/uaccess_32.h
index 7f760a9f1f61..3c03a5de64d3 100644
--- a/arch/x86/include/asm/uaccess_32.h
+++ b/arch/x86/include/asm/uaccess_32.h
@@ -184,33 +184,4 @@ __copy_from_user_inatomic_nocache(void *to, const void __user *from,
184 return __copy_from_user_ll_nocache_nozero(to, from, n); 184 return __copy_from_user_ll_nocache_nozero(to, from, n);
185} 185}
186 186
187unsigned long __must_check copy_to_user(void __user *to,
188 const void *from, unsigned long n);
189unsigned long __must_check _copy_from_user(void *to,
190 const void __user *from,
191 unsigned long n);
192
193
194extern void copy_from_user_overflow(void)
195#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
196 __compiletime_error("copy_from_user() buffer size is not provably correct")
197#else
198 __compiletime_warning("copy_from_user() buffer size is not provably correct")
199#endif
200;
201
202static inline unsigned long __must_check copy_from_user(void *to,
203 const void __user *from,
204 unsigned long n)
205{
206 int sz = __compiletime_object_size(to);
207
208 if (likely(sz == -1 || sz >= n))
209 n = _copy_from_user(to, from, n);
210 else
211 copy_from_user_overflow();
212
213 return n;
214}
215
216#endif /* _ASM_X86_UACCESS_32_H */ 187#endif /* _ASM_X86_UACCESS_32_H */
diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
index 4f7923dd0007..190413d0de57 100644
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
@@ -46,42 +46,13 @@ copy_user_generic(void *to, const void *from, unsigned len)
46} 46}
47 47
48__must_check unsigned long 48__must_check unsigned long
49_copy_to_user(void __user *to, const void *from, unsigned len);
50__must_check unsigned long
51_copy_from_user(void *to, const void __user *from, unsigned len);
52__must_check unsigned long
53copy_in_user(void __user *to, const void __user *from, unsigned len); 49copy_in_user(void __user *to, const void __user *from, unsigned len);
54 50
55static inline unsigned long __must_check copy_from_user(void *to,
56 const void __user *from,
57 unsigned long n)
58{
59 int sz = __compiletime_object_size(to);
60
61 might_fault();
62 if (likely(sz == -1 || sz >= n))
63 n = _copy_from_user(to, from, n);
64#ifdef CONFIG_DEBUG_VM
65 else
66 WARN(1, "Buffer overflow detected!\n");
67#endif
68 return n;
69}
70
71static __always_inline __must_check 51static __always_inline __must_check
72int copy_to_user(void __user *dst, const void *src, unsigned size) 52int __copy_from_user_nocheck(void *dst, const void __user *src, unsigned size)
73{
74 might_fault();
75
76 return _copy_to_user(dst, src, size);
77}
78
79static __always_inline __must_check
80int __copy_from_user(void *dst, const void __user *src, unsigned size)
81{ 53{
82 int ret = 0; 54 int ret = 0;
83 55
84 might_fault();
85 if (!__builtin_constant_p(size)) 56 if (!__builtin_constant_p(size))
86 return copy_user_generic(dst, (__force void *)src, size); 57 return copy_user_generic(dst, (__force void *)src, size);
87 switch (size) { 58 switch (size) {
@@ -121,11 +92,17 @@ int __copy_from_user(void *dst, const void __user *src, unsigned size)
121} 92}
122 93
123static __always_inline __must_check 94static __always_inline __must_check
124int __copy_to_user(void __user *dst, const void *src, unsigned size) 95int __copy_from_user(void *dst, const void __user *src, unsigned size)
96{
97 might_fault();
98 return __copy_from_user_nocheck(dst, src, size);
99}
100
101static __always_inline __must_check
102int __copy_to_user_nocheck(void __user *dst, const void *src, unsigned size)
125{ 103{
126 int ret = 0; 104 int ret = 0;
127 105
128 might_fault();
129 if (!__builtin_constant_p(size)) 106 if (!__builtin_constant_p(size))
130 return copy_user_generic((__force void *)dst, src, size); 107 return copy_user_generic((__force void *)dst, src, size);
131 switch (size) { 108 switch (size) {
@@ -165,6 +142,13 @@ int __copy_to_user(void __user *dst, const void *src, unsigned size)
165} 142}
166 143
167static __always_inline __must_check 144static __always_inline __must_check
145int __copy_to_user(void __user *dst, const void *src, unsigned size)
146{
147 might_fault();
148 return __copy_to_user_nocheck(dst, src, size);
149}
150
151static __always_inline __must_check
168int __copy_in_user(void __user *dst, const void __user *src, unsigned size) 152int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
169{ 153{
170 int ret = 0; 154 int ret = 0;
@@ -220,13 +204,13 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
220static __must_check __always_inline int 204static __must_check __always_inline int
221__copy_from_user_inatomic(void *dst, const void __user *src, unsigned size) 205__copy_from_user_inatomic(void *dst, const void __user *src, unsigned size)
222{ 206{
223 return copy_user_generic(dst, (__force const void *)src, size); 207 return __copy_from_user_nocheck(dst, (__force const void *)src, size);
224} 208}
225 209
226static __must_check __always_inline int 210static __must_check __always_inline int
227__copy_to_user_inatomic(void __user *dst, const void *src, unsigned size) 211__copy_to_user_inatomic(void __user *dst, const void *src, unsigned size)
228{ 212{
229 return copy_user_generic((__force void *)dst, src, size); 213 return __copy_to_user_nocheck((__force void *)dst, src, size);
230} 214}
231 215
232extern long __copy_user_nocache(void *dst, const void __user *src, 216extern long __copy_user_nocache(void *dst, const void __user *src,
diff --git a/arch/x86/include/asm/uprobes.h b/arch/x86/include/asm/uprobes.h
index 6e5197910fd8..3087ea9c5f2e 100644
--- a/arch/x86/include/asm/uprobes.h
+++ b/arch/x86/include/asm/uprobes.h
@@ -35,7 +35,10 @@ typedef u8 uprobe_opcode_t;
35 35
36struct arch_uprobe { 36struct arch_uprobe {
37 u16 fixups; 37 u16 fixups;
38 u8 insn[MAX_UINSN_BYTES]; 38 union {
39 u8 insn[MAX_UINSN_BYTES];
40 u8 ixol[MAX_UINSN_BYTES];
41 };
39#ifdef CONFIG_X86_64 42#ifdef CONFIG_X86_64
40 unsigned long rip_rela_target_address; 43 unsigned long rip_rela_target_address;
41#endif 44#endif
@@ -49,11 +52,4 @@ struct arch_uprobe_task {
49 unsigned int saved_tf; 52 unsigned int saved_tf;
50}; 53};
51 54
52extern int arch_uprobe_analyze_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long addr);
53extern int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs);
54extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);
55extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
56extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
57extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
58extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
59#endif /* _ASM_UPROBES_H */ 55#endif /* _ASM_UPROBES_H */
diff --git a/arch/x86/include/asm/uv/uv.h b/arch/x86/include/asm/uv/uv.h
index 062921ef34e9..6b964a0b86d1 100644
--- a/arch/x86/include/asm/uv/uv.h
+++ b/arch/x86/include/asm/uv/uv.h
@@ -12,6 +12,7 @@ extern enum uv_system_type get_uv_system_type(void);
12extern int is_uv_system(void); 12extern int is_uv_system(void);
13extern void uv_cpu_init(void); 13extern void uv_cpu_init(void);
14extern void uv_nmi_init(void); 14extern void uv_nmi_init(void);
15extern void uv_register_nmi_notifier(void);
15extern void uv_system_init(void); 16extern void uv_system_init(void);
16extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, 17extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
17 struct mm_struct *mm, 18 struct mm_struct *mm,
@@ -25,6 +26,7 @@ static inline enum uv_system_type get_uv_system_type(void) { return UV_NONE; }
25static inline int is_uv_system(void) { return 0; } 26static inline int is_uv_system(void) { return 0; }
26static inline void uv_cpu_init(void) { } 27static inline void uv_cpu_init(void) { }
27static inline void uv_system_init(void) { } 28static inline void uv_system_init(void) { }
29static inline void uv_register_nmi_notifier(void) { }
28static inline const struct cpumask * 30static inline const struct cpumask *
29uv_flush_tlb_others(const struct cpumask *cpumask, struct mm_struct *mm, 31uv_flush_tlb_others(const struct cpumask *cpumask, struct mm_struct *mm,
30 unsigned long start, unsigned long end, unsigned int cpu) 32 unsigned long start, unsigned long end, unsigned int cpu)
diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
index 2c32df95bb78..a30836c8ac4d 100644
--- a/arch/x86/include/asm/uv/uv_hub.h
+++ b/arch/x86/include/asm/uv/uv_hub.h
@@ -502,8 +502,8 @@ struct uv_blade_info {
502 unsigned short nr_online_cpus; 502 unsigned short nr_online_cpus;
503 unsigned short pnode; 503 unsigned short pnode;
504 short memory_nid; 504 short memory_nid;
505 spinlock_t nmi_lock; 505 spinlock_t nmi_lock; /* obsolete, see uv_hub_nmi */
506 unsigned long nmi_count; 506 unsigned long nmi_count; /* obsolete, see uv_hub_nmi */
507}; 507};
508extern struct uv_blade_info *uv_blade_info; 508extern struct uv_blade_info *uv_blade_info;
509extern short *uv_node_to_blade; 509extern short *uv_node_to_blade;
@@ -576,6 +576,59 @@ static inline int uv_num_possible_blades(void)
576 return uv_possible_blades; 576 return uv_possible_blades;
577} 577}
578 578
579/* Per Hub NMI support */
580extern void uv_nmi_setup(void);
581
582/* BMC sets a bit this MMR non-zero before sending an NMI */
583#define UVH_NMI_MMR UVH_SCRATCH5
584#define UVH_NMI_MMR_CLEAR UVH_SCRATCH5_ALIAS
585#define UVH_NMI_MMR_SHIFT 63
586#define UVH_NMI_MMR_TYPE "SCRATCH5"
587
588/* Newer SMM NMI handler, not present in all systems */
589#define UVH_NMI_MMRX UVH_EVENT_OCCURRED0
590#define UVH_NMI_MMRX_CLEAR UVH_EVENT_OCCURRED0_ALIAS
591#define UVH_NMI_MMRX_SHIFT (is_uv1_hub() ? \
592 UV1H_EVENT_OCCURRED0_EXTIO_INT0_SHFT :\
593 UVXH_EVENT_OCCURRED0_EXTIO_INT0_SHFT)
594#define UVH_NMI_MMRX_TYPE "EXTIO_INT0"
595
596/* Non-zero indicates newer SMM NMI handler present */
597#define UVH_NMI_MMRX_SUPPORTED UVH_EXTIO_INT0_BROADCAST
598
599/* Indicates to BIOS that we want to use the newer SMM NMI handler */
600#define UVH_NMI_MMRX_REQ UVH_SCRATCH5_ALIAS_2
601#define UVH_NMI_MMRX_REQ_SHIFT 62
602
603struct uv_hub_nmi_s {
604 raw_spinlock_t nmi_lock;
605 atomic_t in_nmi; /* flag this node in UV NMI IRQ */
606 atomic_t cpu_owner; /* last locker of this struct */
607 atomic_t read_mmr_count; /* count of MMR reads */
608 atomic_t nmi_count; /* count of true UV NMIs */
609 unsigned long nmi_value; /* last value read from NMI MMR */
610};
611
612struct uv_cpu_nmi_s {
613 struct uv_hub_nmi_s *hub;
614 atomic_t state;
615 atomic_t pinging;
616 int queries;
617 int pings;
618};
619
620DECLARE_PER_CPU(struct uv_cpu_nmi_s, __uv_cpu_nmi);
621#define uv_cpu_nmi (__get_cpu_var(__uv_cpu_nmi))
622#define uv_hub_nmi (uv_cpu_nmi.hub)
623#define uv_cpu_nmi_per(cpu) (per_cpu(__uv_cpu_nmi, cpu))
624#define uv_hub_nmi_per(cpu) (uv_cpu_nmi_per(cpu).hub)
625
626/* uv_cpu_nmi_states */
627#define UV_NMI_STATE_OUT 0
628#define UV_NMI_STATE_IN 1
629#define UV_NMI_STATE_DUMP 2
630#define UV_NMI_STATE_DUMP_DONE 3
631
579/* Update SCIR state */ 632/* Update SCIR state */
580static inline void uv_set_scir_bits(unsigned char value) 633static inline void uv_set_scir_bits(unsigned char value)
581{ 634{
diff --git a/arch/x86/include/asm/uv/uv_mmrs.h b/arch/x86/include/asm/uv/uv_mmrs.h
index bd5f80e58a23..e42249bcf7e1 100644
--- a/arch/x86/include/asm/uv/uv_mmrs.h
+++ b/arch/x86/include/asm/uv/uv_mmrs.h
@@ -461,6 +461,23 @@ union uvh_event_occurred0_u {
461 461
462 462
463/* ========================================================================= */ 463/* ========================================================================= */
464/* UVH_EXTIO_INT0_BROADCAST */
465/* ========================================================================= */
466#define UVH_EXTIO_INT0_BROADCAST 0x61448UL
467#define UVH_EXTIO_INT0_BROADCAST_32 0x3f0
468
469#define UVH_EXTIO_INT0_BROADCAST_ENABLE_SHFT 0
470#define UVH_EXTIO_INT0_BROADCAST_ENABLE_MASK 0x0000000000000001UL
471
472union uvh_extio_int0_broadcast_u {
473 unsigned long v;
474 struct uvh_extio_int0_broadcast_s {
475 unsigned long enable:1; /* RW */
476 unsigned long rsvd_1_63:63;
477 } s;
478};
479
480/* ========================================================================= */
464/* UVH_GR0_TLB_INT0_CONFIG */ 481/* UVH_GR0_TLB_INT0_CONFIG */
465/* ========================================================================= */ 482/* ========================================================================= */
466#define UVH_GR0_TLB_INT0_CONFIG 0x61b00UL 483#define UVH_GR0_TLB_INT0_CONFIG 0x61b00UL
@@ -2606,6 +2623,20 @@ union uvh_scratch5_u {
2606}; 2623};
2607 2624
2608/* ========================================================================= */ 2625/* ========================================================================= */
2626/* UVH_SCRATCH5_ALIAS */
2627/* ========================================================================= */
2628#define UVH_SCRATCH5_ALIAS 0x2d0208UL
2629#define UVH_SCRATCH5_ALIAS_32 0x780
2630
2631
2632/* ========================================================================= */
2633/* UVH_SCRATCH5_ALIAS_2 */
2634/* ========================================================================= */
2635#define UVH_SCRATCH5_ALIAS_2 0x2d0210UL
2636#define UVH_SCRATCH5_ALIAS_2_32 0x788
2637
2638
2639/* ========================================================================= */
2609/* UVXH_EVENT_OCCURRED2 */ 2640/* UVXH_EVENT_OCCURRED2 */
2610/* ========================================================================= */ 2641/* ========================================================================= */
2611#define UVXH_EVENT_OCCURRED2 0x70100UL 2642#define UVXH_EVENT_OCCURRED2 0x70100UL
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index 828a1565ba57..0f1be11e43d2 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -172,6 +172,7 @@ struct x86_platform_ops {
172 172
173struct pci_dev; 173struct pci_dev;
174struct msi_msg; 174struct msi_msg;
175struct msi_desc;
175 176
176struct x86_msi_ops { 177struct x86_msi_ops {
177 int (*setup_msi_irqs)(struct pci_dev *dev, int nvec, int type); 178 int (*setup_msi_irqs)(struct pci_dev *dev, int nvec, int type);
@@ -182,6 +183,8 @@ struct x86_msi_ops {
182 void (*teardown_msi_irqs)(struct pci_dev *dev); 183 void (*teardown_msi_irqs)(struct pci_dev *dev);
183 void (*restore_msi_irqs)(struct pci_dev *dev, int irq); 184 void (*restore_msi_irqs)(struct pci_dev *dev, int irq);
184 int (*setup_hpet_msi)(unsigned int irq, unsigned int id); 185 int (*setup_hpet_msi)(unsigned int irq, unsigned int id);
186 u32 (*msi_mask_irq)(struct msi_desc *desc, u32 mask, u32 flag);
187 u32 (*msix_mask_irq)(struct msi_desc *desc, u32 flag);
185}; 188};
186 189
187struct IO_APIC_route_entry; 190struct IO_APIC_route_entry;
diff --git a/arch/x86/include/asm/xen/page-coherent.h b/arch/x86/include/asm/xen/page-coherent.h
new file mode 100644
index 000000000000..7f02fe4e2c7b
--- /dev/null
+++ b/arch/x86/include/asm/xen/page-coherent.h
@@ -0,0 +1,38 @@
1#ifndef _ASM_X86_XEN_PAGE_COHERENT_H
2#define _ASM_X86_XEN_PAGE_COHERENT_H
3
4#include <asm/page.h>
5#include <linux/dma-attrs.h>
6#include <linux/dma-mapping.h>
7
8static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size,
9 dma_addr_t *dma_handle, gfp_t flags,
10 struct dma_attrs *attrs)
11{
12 void *vstart = (void*)__get_free_pages(flags, get_order(size));
13 *dma_handle = virt_to_phys(vstart);
14 return vstart;
15}
16
17static inline void xen_free_coherent_pages(struct device *hwdev, size_t size,
18 void *cpu_addr, dma_addr_t dma_handle,
19 struct dma_attrs *attrs)
20{
21 free_pages((unsigned long) cpu_addr, get_order(size));
22}
23
24static inline void xen_dma_map_page(struct device *hwdev, struct page *page,
25 unsigned long offset, size_t size, enum dma_data_direction dir,
26 struct dma_attrs *attrs) { }
27
28static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle,
29 size_t size, enum dma_data_direction dir,
30 struct dma_attrs *attrs) { }
31
32static inline void xen_dma_sync_single_for_cpu(struct device *hwdev,
33 dma_addr_t handle, size_t size, enum dma_data_direction dir) { }
34
35static inline void xen_dma_sync_single_for_device(struct device *hwdev,
36 dma_addr_t handle, size_t size, enum dma_data_direction dir) { }
37
38#endif /* _ASM_X86_XEN_PAGE_COHERENT_H */
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
index 6aef9fbc09b7..b913915e8e63 100644
--- a/arch/x86/include/asm/xen/page.h
+++ b/arch/x86/include/asm/xen/page.h
@@ -79,30 +79,38 @@ static inline int phys_to_machine_mapping_valid(unsigned long pfn)
79 return get_phys_to_machine(pfn) != INVALID_P2M_ENTRY; 79 return get_phys_to_machine(pfn) != INVALID_P2M_ENTRY;
80} 80}
81 81
82static inline unsigned long mfn_to_pfn(unsigned long mfn) 82static inline unsigned long mfn_to_pfn_no_overrides(unsigned long mfn)
83{ 83{
84 unsigned long pfn; 84 unsigned long pfn;
85 int ret = 0; 85 int ret;
86 86
87 if (xen_feature(XENFEAT_auto_translated_physmap)) 87 if (xen_feature(XENFEAT_auto_translated_physmap))
88 return mfn; 88 return mfn;
89 89
90 if (unlikely(mfn >= machine_to_phys_nr)) { 90 if (unlikely(mfn >= machine_to_phys_nr))
91 pfn = ~0; 91 return ~0;
92 goto try_override; 92
93 }
94 pfn = 0;
95 /* 93 /*
96 * The array access can fail (e.g., device space beyond end of RAM). 94 * The array access can fail (e.g., device space beyond end of RAM).
97 * In such cases it doesn't matter what we return (we return garbage), 95 * In such cases it doesn't matter what we return (we return garbage),
98 * but we must handle the fault without crashing! 96 * but we must handle the fault without crashing!
99 */ 97 */
100 ret = __get_user(pfn, &machine_to_phys_mapping[mfn]); 98 ret = __get_user(pfn, &machine_to_phys_mapping[mfn]);
101try_override:
102 /* ret might be < 0 if there are no entries in the m2p for mfn */
103 if (ret < 0) 99 if (ret < 0)
104 pfn = ~0; 100 return ~0;
105 else if (get_phys_to_machine(pfn) != mfn) 101
102 return pfn;
103}
104
105static inline unsigned long mfn_to_pfn(unsigned long mfn)
106{
107 unsigned long pfn;
108
109 if (xen_feature(XENFEAT_auto_translated_physmap))
110 return mfn;
111
112 pfn = mfn_to_pfn_no_overrides(mfn);
113 if (get_phys_to_machine(pfn) != mfn) {
106 /* 114 /*
107 * If this appears to be a foreign mfn (because the pfn 115 * If this appears to be a foreign mfn (because the pfn
108 * doesn't map back to the mfn), then check the local override 116 * doesn't map back to the mfn), then check the local override
@@ -111,6 +119,7 @@ try_override:
111 * m2p_find_override_pfn returns ~0 if it doesn't find anything. 119 * m2p_find_override_pfn returns ~0 if it doesn't find anything.
112 */ 120 */
113 pfn = m2p_find_override_pfn(mfn, ~0); 121 pfn = m2p_find_override_pfn(mfn, ~0);
122 }
114 123
115 /* 124 /*
116 * pfn is ~0 if there are no entries in the m2p for mfn or if the 125 * pfn is ~0 if there are no entries in the m2p for mfn or if the
diff --git a/arch/x86/include/uapi/asm/bootparam.h b/arch/x86/include/uapi/asm/bootparam.h
index c15ddaf90710..9c3733c5f8f7 100644
--- a/arch/x86/include/uapi/asm/bootparam.h
+++ b/arch/x86/include/uapi/asm/bootparam.h
@@ -158,7 +158,7 @@ enum {
158 X86_SUBARCH_PC = 0, 158 X86_SUBARCH_PC = 0,
159 X86_SUBARCH_LGUEST, 159 X86_SUBARCH_LGUEST,
160 X86_SUBARCH_XEN, 160 X86_SUBARCH_XEN,
161 X86_SUBARCH_MRST, 161 X86_SUBARCH_INTEL_MID,
162 X86_SUBARCH_CE4100, 162 X86_SUBARCH_CE4100,
163 X86_NR_SUBARCHS, 163 X86_NR_SUBARCHS,
164}; 164};
diff --git a/arch/x86/include/uapi/asm/hyperv.h b/arch/x86/include/uapi/asm/hyperv.h
index b80420bcd09d..b8f1c0176cbc 100644
--- a/arch/x86/include/uapi/asm/hyperv.h
+++ b/arch/x86/include/uapi/asm/hyperv.h
@@ -27,6 +27,19 @@
27#define HV_X64_MSR_VP_RUNTIME_AVAILABLE (1 << 0) 27#define HV_X64_MSR_VP_RUNTIME_AVAILABLE (1 << 0)
28/* Partition Reference Counter (HV_X64_MSR_TIME_REF_COUNT) available*/ 28/* Partition Reference Counter (HV_X64_MSR_TIME_REF_COUNT) available*/
29#define HV_X64_MSR_TIME_REF_COUNT_AVAILABLE (1 << 1) 29#define HV_X64_MSR_TIME_REF_COUNT_AVAILABLE (1 << 1)
30
31/*
32 * There is a single feature flag that signifies the presence of the MSR
33 * that can be used to retrieve both the local APIC Timer frequency as
34 * well as the TSC frequency.
35 */
36
37/* Local APIC timer frequency MSR (HV_X64_MSR_APIC_FREQUENCY) is available */
38#define HV_X64_MSR_APIC_FREQUENCY_AVAILABLE (1 << 11)
39
40/* TSC frequency MSR (HV_X64_MSR_TSC_FREQUENCY) is available */
41#define HV_X64_MSR_TSC_FREQUENCY_AVAILABLE (1 << 11)
42
30/* 43/*
31 * Basic SynIC MSRs (HV_X64_MSR_SCONTROL through HV_X64_MSR_EOM 44 * Basic SynIC MSRs (HV_X64_MSR_SCONTROL through HV_X64_MSR_EOM
32 * and HV_X64_MSR_SINT0 through HV_X64_MSR_SINT15) available 45 * and HV_X64_MSR_SINT0 through HV_X64_MSR_SINT15) available
@@ -136,6 +149,12 @@
136/* MSR used to read the per-partition time reference counter */ 149/* MSR used to read the per-partition time reference counter */
137#define HV_X64_MSR_TIME_REF_COUNT 0x40000020 150#define HV_X64_MSR_TIME_REF_COUNT 0x40000020
138 151
152/* MSR used to retrieve the TSC frequency */
153#define HV_X64_MSR_TSC_FREQUENCY 0x40000022
154
155/* MSR used to retrieve the local APIC timer frequency */
156#define HV_X64_MSR_APIC_FREQUENCY 0x40000023
157
139/* Define the virtual APIC registers */ 158/* Define the virtual APIC registers */
140#define HV_X64_MSR_EOI 0x40000070 159#define HV_X64_MSR_EOI 0x40000070
141#define HV_X64_MSR_ICR 0x40000071 160#define HV_X64_MSR_ICR 0x40000071
diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h
index 5d9a3033b3d7..d3a87780c70b 100644
--- a/arch/x86/include/uapi/asm/kvm.h
+++ b/arch/x86/include/uapi/asm/kvm.h
@@ -211,9 +211,9 @@ struct kvm_cpuid_entry2 {
211 __u32 padding[3]; 211 __u32 padding[3];
212}; 212};
213 213
214#define KVM_CPUID_FLAG_SIGNIFCANT_INDEX 1 214#define KVM_CPUID_FLAG_SIGNIFCANT_INDEX BIT(0)
215#define KVM_CPUID_FLAG_STATEFUL_FUNC 2 215#define KVM_CPUID_FLAG_STATEFUL_FUNC BIT(1)
216#define KVM_CPUID_FLAG_STATE_READ_NEXT 4 216#define KVM_CPUID_FLAG_STATE_READ_NEXT BIT(2)
217 217
218/* for KVM_SET_CPUID2 */ 218/* for KVM_SET_CPUID2 */
219struct kvm_cpuid2 { 219struct kvm_cpuid2 {
diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h
index bb0465090ae5..b93e09a0fa21 100644
--- a/arch/x86/include/uapi/asm/msr-index.h
+++ b/arch/x86/include/uapi/asm/msr-index.h
@@ -536,6 +536,7 @@
536 536
537/* MSR_IA32_VMX_MISC bits */ 537/* MSR_IA32_VMX_MISC bits */
538#define MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS (1ULL << 29) 538#define MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS (1ULL << 29)
539#define MSR_IA32_VMX_MISC_PREEMPTION_TIMER_SCALE 0x1F
539/* AMD-V MSRs */ 540/* AMD-V MSRs */
540 541
541#define MSR_VM_CR 0xc0010114 542#define MSR_VM_CR 0xc0010114
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index a5408b965c9d..9b0a34e2cd79 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -36,6 +36,8 @@ obj-y += tsc.o io_delay.o rtc.o
36obj-y += pci-iommu_table.o 36obj-y += pci-iommu_table.o
37obj-y += resource.o 37obj-y += resource.o
38 38
39obj-$(CONFIG_PREEMPT) += preempt.o
40
39obj-y += process.o 41obj-y += process.o
40obj-y += i387.o xsave.o 42obj-y += i387.o xsave.o
41obj-y += ptrace.o 43obj-y += ptrace.o
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 40c76604199f..6c0b43bd024b 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -189,24 +189,31 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
189 return 0; 189 return 0;
190} 190}
191 191
192static void acpi_register_lapic(int id, u8 enabled) 192/**
193 * acpi_register_lapic - register a local apic and generates a logic cpu number
194 * @id: local apic id to register
195 * @enabled: this cpu is enabled or not
196 *
197 * Returns the logic cpu number which maps to the local apic
198 */
199static int acpi_register_lapic(int id, u8 enabled)
193{ 200{
194 unsigned int ver = 0; 201 unsigned int ver = 0;
195 202
196 if (id >= MAX_LOCAL_APIC) { 203 if (id >= MAX_LOCAL_APIC) {
197 printk(KERN_INFO PREFIX "skipped apicid that is too big\n"); 204 printk(KERN_INFO PREFIX "skipped apicid that is too big\n");
198 return; 205 return -EINVAL;
199 } 206 }
200 207
201 if (!enabled) { 208 if (!enabled) {
202 ++disabled_cpus; 209 ++disabled_cpus;
203 return; 210 return -EINVAL;
204 } 211 }
205 212
206 if (boot_cpu_physical_apicid != -1U) 213 if (boot_cpu_physical_apicid != -1U)
207 ver = apic_version[boot_cpu_physical_apicid]; 214 ver = apic_version[boot_cpu_physical_apicid];
208 215
209 generic_processor_info(id, ver); 216 return generic_processor_info(id, ver);
210} 217}
211 218
212static int __init 219static int __init
@@ -614,84 +621,27 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
614#endif 621#endif
615} 622}
616 623
617static int _acpi_map_lsapic(acpi_handle handle, int *pcpu) 624static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
618{ 625{
619 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
620 union acpi_object *obj;
621 struct acpi_madt_local_apic *lapic;
622 cpumask_var_t tmp_map, new_map;
623 u8 physid;
624 int cpu; 626 int cpu;
625 int retval = -ENOMEM;
626
627 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
628 return -EINVAL;
629
630 if (!buffer.length || !buffer.pointer)
631 return -EINVAL;
632
633 obj = buffer.pointer;
634 if (obj->type != ACPI_TYPE_BUFFER ||
635 obj->buffer.length < sizeof(*lapic)) {
636 kfree(buffer.pointer);
637 return -EINVAL;
638 }
639 627
640 lapic = (struct acpi_madt_local_apic *)obj->buffer.pointer; 628 cpu = acpi_register_lapic(physid, ACPI_MADT_ENABLED);
641 629 if (cpu < 0) {
642 if (lapic->header.type != ACPI_MADT_TYPE_LOCAL_APIC || 630 pr_info(PREFIX "Unable to map lapic to logical cpu number\n");
643 !(lapic->lapic_flags & ACPI_MADT_ENABLED)) { 631 return cpu;
644 kfree(buffer.pointer);
645 return -EINVAL;
646 }
647
648 physid = lapic->id;
649
650 kfree(buffer.pointer);
651 buffer.length = ACPI_ALLOCATE_BUFFER;
652 buffer.pointer = NULL;
653 lapic = NULL;
654
655 if (!alloc_cpumask_var(&tmp_map, GFP_KERNEL))
656 goto out;
657
658 if (!alloc_cpumask_var(&new_map, GFP_KERNEL))
659 goto free_tmp_map;
660
661 cpumask_copy(tmp_map, cpu_present_mask);
662 acpi_register_lapic(physid, ACPI_MADT_ENABLED);
663
664 /*
665 * If acpi_register_lapic successfully generates a new logical cpu
666 * number, then the following will get us exactly what was mapped
667 */
668 cpumask_andnot(new_map, cpu_present_mask, tmp_map);
669 if (cpumask_empty(new_map)) {
670 printk ("Unable to map lapic to logical cpu number\n");
671 retval = -EINVAL;
672 goto free_new_map;
673 } 632 }
674 633
675 acpi_processor_set_pdc(handle); 634 acpi_processor_set_pdc(handle);
676
677 cpu = cpumask_first(new_map);
678 acpi_map_cpu2node(handle, cpu, physid); 635 acpi_map_cpu2node(handle, cpu, physid);
679 636
680 *pcpu = cpu; 637 *pcpu = cpu;
681 retval = 0; 638 return 0;
682
683free_new_map:
684 free_cpumask_var(new_map);
685free_tmp_map:
686 free_cpumask_var(tmp_map);
687out:
688 return retval;
689} 639}
690 640
691/* wrapper to silence section mismatch warning */ 641/* wrapper to silence section mismatch warning */
692int __ref acpi_map_lsapic(acpi_handle handle, int *pcpu) 642int __ref acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
693{ 643{
694 return _acpi_map_lsapic(handle, pcpu); 644 return _acpi_map_lsapic(handle, physid, pcpu);
695} 645}
696EXPORT_SYMBOL(acpi_map_lsapic); 646EXPORT_SYMBOL(acpi_map_lsapic);
697 647
@@ -745,7 +695,7 @@ static int __init acpi_parse_sbf(struct acpi_table_header *table)
745#ifdef CONFIG_HPET_TIMER 695#ifdef CONFIG_HPET_TIMER
746#include <asm/hpet.h> 696#include <asm/hpet.h>
747 697
748static struct __initdata resource *hpet_res; 698static struct resource *hpet_res __initdata;
749 699
750static int __init acpi_parse_hpet(struct acpi_table_header *table) 700static int __init acpi_parse_hpet(struct acpi_table_header *table)
751{ 701{
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 33120100ff5e..3a2ae4c88948 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -26,6 +26,17 @@ static char temp_stack[4096];
26#endif 26#endif
27 27
28/** 28/**
29 * x86_acpi_enter_sleep_state - enter sleep state
30 * @state: Sleep state to enter.
31 *
32 * Wrapper around acpi_enter_sleep_state() to be called by assmebly.
33 */
34acpi_status asmlinkage x86_acpi_enter_sleep_state(u8 state)
35{
36 return acpi_enter_sleep_state(state);
37}
38
39/**
29 * x86_acpi_suspend_lowlevel - save kernel state 40 * x86_acpi_suspend_lowlevel - save kernel state
30 * 41 *
31 * Create an identity mapped page table and copy the wakeup routine to 42 * Create an identity mapped page table and copy the wakeup routine to
diff --git a/arch/x86/kernel/acpi/sleep.h b/arch/x86/kernel/acpi/sleep.h
index c9c2c982d5e4..65c7b606b606 100644
--- a/arch/x86/kernel/acpi/sleep.h
+++ b/arch/x86/kernel/acpi/sleep.h
@@ -17,3 +17,5 @@ extern void wakeup_long64(void);
17extern void do_suspend_lowlevel(void); 17extern void do_suspend_lowlevel(void);
18 18
19extern int x86_acpi_suspend_lowlevel(void); 19extern int x86_acpi_suspend_lowlevel(void);
20
21acpi_status asmlinkage x86_acpi_enter_sleep_state(u8 state);
diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S
index d1daa66ab162..665c6b7d2ea9 100644
--- a/arch/x86/kernel/acpi/wakeup_32.S
+++ b/arch/x86/kernel/acpi/wakeup_32.S
@@ -73,7 +73,7 @@ ENTRY(do_suspend_lowlevel)
73 call save_processor_state 73 call save_processor_state
74 call save_registers 74 call save_registers
75 pushl $3 75 pushl $3
76 call acpi_enter_sleep_state 76 call x86_acpi_enter_sleep_state
77 addl $4, %esp 77 addl $4, %esp
78 78
79# In case of S3 failure, we'll emerge here. Jump 79# In case of S3 failure, we'll emerge here. Jump
diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S
index 8ea5164cbd04..ae693b51ed8e 100644
--- a/arch/x86/kernel/acpi/wakeup_64.S
+++ b/arch/x86/kernel/acpi/wakeup_64.S
@@ -73,7 +73,7 @@ ENTRY(do_suspend_lowlevel)
73 addq $8, %rsp 73 addq $8, %rsp
74 movl $3, %edi 74 movl $3, %edi
75 xorl %eax, %eax 75 xorl %eax, %eax
76 call acpi_enter_sleep_state 76 call x86_acpi_enter_sleep_state
77 /* in case something went wrong, restore the machine status and go on */ 77 /* in case something went wrong, restore the machine status and go on */
78 jmp resume_point 78 jmp resume_point
79 79
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 15e8563e5c24..df94598ad05a 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -402,17 +402,6 @@ void alternatives_enable_smp(void)
402{ 402{
403 struct smp_alt_module *mod; 403 struct smp_alt_module *mod;
404 404
405#ifdef CONFIG_LOCKDEP
406 /*
407 * Older binutils section handling bug prevented
408 * alternatives-replacement from working reliably.
409 *
410 * If this still occurs then you should see a hang
411 * or crash shortly after this line:
412 */
413 pr_info("lockdep: fixing up alternatives\n");
414#endif
415
416 /* Why bother if there are no other CPUs? */ 405 /* Why bother if there are no other CPUs? */
417 BUG_ON(num_possible_cpus() == 1); 406 BUG_ON(num_possible_cpus() == 1);
418 407
diff --git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c
index c9876efecafb..af5b08ab3b71 100644
--- a/arch/x86/kernel/apb_timer.c
+++ b/arch/x86/kernel/apb_timer.c
@@ -40,7 +40,7 @@
40 40
41#include <asm/fixmap.h> 41#include <asm/fixmap.h>
42#include <asm/apb_timer.h> 42#include <asm/apb_timer.h>
43#include <asm/mrst.h> 43#include <asm/intel-mid.h>
44#include <asm/time.h> 44#include <asm/time.h>
45 45
46#define APBT_CLOCKEVENT_RATING 110 46#define APBT_CLOCKEVENT_RATING 110
@@ -157,13 +157,13 @@ static int __init apbt_clockevent_register(void)
157 157
158 adev->num = smp_processor_id(); 158 adev->num = smp_processor_id();
159 adev->timer = dw_apb_clockevent_init(smp_processor_id(), "apbt0", 159 adev->timer = dw_apb_clockevent_init(smp_processor_id(), "apbt0",
160 mrst_timer_options == MRST_TIMER_LAPIC_APBT ? 160 intel_mid_timer_options == INTEL_MID_TIMER_LAPIC_APBT ?
161 APBT_CLOCKEVENT_RATING - 100 : APBT_CLOCKEVENT_RATING, 161 APBT_CLOCKEVENT_RATING - 100 : APBT_CLOCKEVENT_RATING,
162 adev_virt_addr(adev), 0, apbt_freq); 162 adev_virt_addr(adev), 0, apbt_freq);
163 /* Firmware does EOI handling for us. */ 163 /* Firmware does EOI handling for us. */
164 adev->timer->eoi = NULL; 164 adev->timer->eoi = NULL;
165 165
166 if (mrst_timer_options == MRST_TIMER_LAPIC_APBT) { 166 if (intel_mid_timer_options == INTEL_MID_TIMER_LAPIC_APBT) {
167 global_clock_event = &adev->timer->ced; 167 global_clock_event = &adev->timer->ced;
168 printk(KERN_DEBUG "%s clockevent registered as global\n", 168 printk(KERN_DEBUG "%s clockevent registered as global\n",
169 global_clock_event->name); 169 global_clock_event->name);
@@ -253,7 +253,7 @@ static int apbt_cpuhp_notify(struct notifier_block *n,
253 253
254static __init int apbt_late_init(void) 254static __init int apbt_late_init(void)
255{ 255{
256 if (mrst_timer_options == MRST_TIMER_LAPIC_APBT || 256 if (intel_mid_timer_options == INTEL_MID_TIMER_LAPIC_APBT ||
257 !apb_timer_block_enabled) 257 !apb_timer_block_enabled)
258 return 0; 258 return 0;
259 /* This notifier should be called after workqueue is ready */ 259 /* This notifier should be called after workqueue is ready */
@@ -340,7 +340,7 @@ void __init apbt_time_init(void)
340 } 340 }
341#ifdef CONFIG_SMP 341#ifdef CONFIG_SMP
342 /* kernel cmdline disable apb timer, so we will use lapic timers */ 342 /* kernel cmdline disable apb timer, so we will use lapic timers */
343 if (mrst_timer_options == MRST_TIMER_LAPIC_APBT) { 343 if (intel_mid_timer_options == INTEL_MID_TIMER_LAPIC_APBT) {
344 printk(KERN_INFO "apbt: disabled per cpu timer\n"); 344 printk(KERN_INFO "apbt: disabled per cpu timer\n");
345 return; 345 return;
346 } 346 }
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index a7eb82d9b012..ed165d657380 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2107,7 +2107,7 @@ void disconnect_bsp_APIC(int virt_wire_setup)
2107 apic_write(APIC_LVT1, value); 2107 apic_write(APIC_LVT1, value);
2108} 2108}
2109 2109
2110void generic_processor_info(int apicid, int version) 2110int generic_processor_info(int apicid, int version)
2111{ 2111{
2112 int cpu, max = nr_cpu_ids; 2112 int cpu, max = nr_cpu_ids;
2113 bool boot_cpu_detected = physid_isset(boot_cpu_physical_apicid, 2113 bool boot_cpu_detected = physid_isset(boot_cpu_physical_apicid,
@@ -2127,7 +2127,7 @@ void generic_processor_info(int apicid, int version)
2127 " Processor %d/0x%x ignored.\n", max, thiscpu, apicid); 2127 " Processor %d/0x%x ignored.\n", max, thiscpu, apicid);
2128 2128
2129 disabled_cpus++; 2129 disabled_cpus++;
2130 return; 2130 return -ENODEV;
2131 } 2131 }
2132 2132
2133 if (num_processors >= nr_cpu_ids) { 2133 if (num_processors >= nr_cpu_ids) {
@@ -2138,7 +2138,7 @@ void generic_processor_info(int apicid, int version)
2138 " Processor %d/0x%x ignored.\n", max, thiscpu, apicid); 2138 " Processor %d/0x%x ignored.\n", max, thiscpu, apicid);
2139 2139
2140 disabled_cpus++; 2140 disabled_cpus++;
2141 return; 2141 return -EINVAL;
2142 } 2142 }
2143 2143
2144 num_processors++; 2144 num_processors++;
@@ -2183,6 +2183,8 @@ void generic_processor_info(int apicid, int version)
2183#endif 2183#endif
2184 set_cpu_possible(cpu, true); 2184 set_cpu_possible(cpu, true);
2185 set_cpu_present(cpu, true); 2185 set_cpu_present(cpu, true);
2186
2187 return cpu;
2186} 2188}
2187 2189
2188int hard_smp_processor_id(void) 2190int hard_smp_processor_id(void)
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 1191ac1c9d25..ad0dc0428baf 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -39,12 +39,6 @@
39#include <asm/x86_init.h> 39#include <asm/x86_init.h>
40#include <asm/nmi.h> 40#include <asm/nmi.h>
41 41
42/* BMC sets a bit this MMR non-zero before sending an NMI */
43#define UVH_NMI_MMR UVH_SCRATCH5
44#define UVH_NMI_MMR_CLEAR (UVH_NMI_MMR + 8)
45#define UV_NMI_PENDING_MASK (1UL << 63)
46DEFINE_PER_CPU(unsigned long, cpu_last_nmi_count);
47
48DEFINE_PER_CPU(int, x2apic_extra_bits); 42DEFINE_PER_CPU(int, x2apic_extra_bits);
49 43
50#define PR_DEVEL(fmt, args...) pr_devel("%s: " fmt, __func__, args) 44#define PR_DEVEL(fmt, args...) pr_devel("%s: " fmt, __func__, args)
@@ -58,7 +52,6 @@ int uv_min_hub_revision_id;
58EXPORT_SYMBOL_GPL(uv_min_hub_revision_id); 52EXPORT_SYMBOL_GPL(uv_min_hub_revision_id);
59unsigned int uv_apicid_hibits; 53unsigned int uv_apicid_hibits;
60EXPORT_SYMBOL_GPL(uv_apicid_hibits); 54EXPORT_SYMBOL_GPL(uv_apicid_hibits);
61static DEFINE_SPINLOCK(uv_nmi_lock);
62 55
63static struct apic apic_x2apic_uv_x; 56static struct apic apic_x2apic_uv_x;
64 57
@@ -113,7 +106,7 @@ static int __init early_get_pnodeid(void)
113 break; 106 break;
114 case UV3_HUB_PART_NUMBER: 107 case UV3_HUB_PART_NUMBER:
115 case UV3_HUB_PART_NUMBER_X: 108 case UV3_HUB_PART_NUMBER_X:
116 uv_min_hub_revision_id += UV3_HUB_REVISION_BASE - 1; 109 uv_min_hub_revision_id += UV3_HUB_REVISION_BASE;
117 break; 110 break;
118 } 111 }
119 112
@@ -847,68 +840,6 @@ void uv_cpu_init(void)
847 set_x2apic_extra_bits(uv_hub_info->pnode); 840 set_x2apic_extra_bits(uv_hub_info->pnode);
848} 841}
849 842
850/*
851 * When NMI is received, print a stack trace.
852 */
853int uv_handle_nmi(unsigned int reason, struct pt_regs *regs)
854{
855 unsigned long real_uv_nmi;
856 int bid;
857
858 /*
859 * Each blade has an MMR that indicates when an NMI has been sent
860 * to cpus on the blade. If an NMI is detected, atomically
861 * clear the MMR and update a per-blade NMI count used to
862 * cause each cpu on the blade to notice a new NMI.
863 */
864 bid = uv_numa_blade_id();
865 real_uv_nmi = (uv_read_local_mmr(UVH_NMI_MMR) & UV_NMI_PENDING_MASK);
866
867 if (unlikely(real_uv_nmi)) {
868 spin_lock(&uv_blade_info[bid].nmi_lock);
869 real_uv_nmi = (uv_read_local_mmr(UVH_NMI_MMR) & UV_NMI_PENDING_MASK);
870 if (real_uv_nmi) {
871 uv_blade_info[bid].nmi_count++;
872 uv_write_local_mmr(UVH_NMI_MMR_CLEAR, UV_NMI_PENDING_MASK);
873 }
874 spin_unlock(&uv_blade_info[bid].nmi_lock);
875 }
876
877 if (likely(__get_cpu_var(cpu_last_nmi_count) == uv_blade_info[bid].nmi_count))
878 return NMI_DONE;
879
880 __get_cpu_var(cpu_last_nmi_count) = uv_blade_info[bid].nmi_count;
881
882 /*
883 * Use a lock so only one cpu prints at a time.
884 * This prevents intermixed output.
885 */
886 spin_lock(&uv_nmi_lock);
887 pr_info("UV NMI stack dump cpu %u:\n", smp_processor_id());
888 dump_stack();
889 spin_unlock(&uv_nmi_lock);
890
891 return NMI_HANDLED;
892}
893
894void uv_register_nmi_notifier(void)
895{
896 if (register_nmi_handler(NMI_UNKNOWN, uv_handle_nmi, 0, "uv"))
897 printk(KERN_WARNING "UV NMI handler failed to register\n");
898}
899
900void uv_nmi_init(void)
901{
902 unsigned int value;
903
904 /*
905 * Unmask NMI on all cpus
906 */
907 value = apic_read(APIC_LVT1) | APIC_DM_NMI;
908 value &= ~APIC_LVT_MASKED;
909 apic_write(APIC_LVT1, value);
910}
911
912void __init uv_system_init(void) 843void __init uv_system_init(void)
913{ 844{
914 union uvh_rh_gam_config_mmr_u m_n_config; 845 union uvh_rh_gam_config_mmr_u m_n_config;
@@ -1046,6 +977,7 @@ void __init uv_system_init(void)
1046 map_mmr_high(max_pnode); 977 map_mmr_high(max_pnode);
1047 map_mmioh_high(min_pnode, max_pnode); 978 map_mmioh_high(min_pnode, max_pnode);
1048 979
980 uv_nmi_setup();
1049 uv_cpu_init(); 981 uv_cpu_init();
1050 uv_scir_register_cpu_notifier(); 982 uv_scir_register_cpu_notifier();
1051 uv_register_nmi_notifier(); 983 uv_register_nmi_notifier();
diff --git a/arch/x86/kernel/asm-offsets.c b/arch/x86/kernel/asm-offsets.c
index 28610822fb3c..9f6b9341950f 100644
--- a/arch/x86/kernel/asm-offsets.c
+++ b/arch/x86/kernel/asm-offsets.c
@@ -32,7 +32,6 @@ void common(void) {
32 OFFSET(TI_flags, thread_info, flags); 32 OFFSET(TI_flags, thread_info, flags);
33 OFFSET(TI_status, thread_info, status); 33 OFFSET(TI_status, thread_info, status);
34 OFFSET(TI_addr_limit, thread_info, addr_limit); 34 OFFSET(TI_addr_limit, thread_info, addr_limit);
35 OFFSET(TI_preempt_count, thread_info, preempt_count);
36 35
37 BLANK(); 36 BLANK();
38 OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx); 37 OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx);
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 903a264af981..3daece79a142 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -823,8 +823,8 @@ static const struct cpu_dev amd_cpu_dev = {
823 .c_vendor = "AMD", 823 .c_vendor = "AMD",
824 .c_ident = { "AuthenticAMD" }, 824 .c_ident = { "AuthenticAMD" },
825#ifdef CONFIG_X86_32 825#ifdef CONFIG_X86_32
826 .c_models = { 826 .legacy_models = {
827 { .vendor = X86_VENDOR_AMD, .family = 4, .model_names = 827 { .family = 4, .model_names =
828 { 828 {
829 [3] = "486 DX/2", 829 [3] = "486 DX/2",
830 [7] = "486 DX/2-WB", 830 [7] = "486 DX/2-WB",
@@ -835,7 +835,7 @@ static const struct cpu_dev amd_cpu_dev = {
835 } 835 }
836 }, 836 },
837 }, 837 },
838 .c_size_cache = amd_size_cache, 838 .legacy_cache_size = amd_size_cache,
839#endif 839#endif
840 .c_early_init = early_init_amd, 840 .c_early_init = early_init_amd,
841 .c_detect_tlb = cpu_detect_tlb_amd, 841 .c_detect_tlb = cpu_detect_tlb_amd,
diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c
index fbf6c3bc2400..8d5652dc99dd 100644
--- a/arch/x86/kernel/cpu/centaur.c
+++ b/arch/x86/kernel/cpu/centaur.c
@@ -468,10 +468,10 @@ static void init_centaur(struct cpuinfo_x86 *c)
468#endif 468#endif
469} 469}
470 470
471#ifdef CONFIG_X86_32
471static unsigned int 472static unsigned int
472centaur_size_cache(struct cpuinfo_x86 *c, unsigned int size) 473centaur_size_cache(struct cpuinfo_x86 *c, unsigned int size)
473{ 474{
474#ifdef CONFIG_X86_32
475 /* VIA C3 CPUs (670-68F) need further shifting. */ 475 /* VIA C3 CPUs (670-68F) need further shifting. */
476 if ((c->x86 == 6) && ((c->x86_model == 7) || (c->x86_model == 8))) 476 if ((c->x86 == 6) && ((c->x86_model == 7) || (c->x86_model == 8)))
477 size >>= 8; 477 size >>= 8;
@@ -484,16 +484,18 @@ centaur_size_cache(struct cpuinfo_x86 *c, unsigned int size)
484 if ((c->x86 == 6) && (c->x86_model == 9) && 484 if ((c->x86 == 6) && (c->x86_model == 9) &&
485 (c->x86_mask == 1) && (size == 65)) 485 (c->x86_mask == 1) && (size == 65))
486 size -= 1; 486 size -= 1;
487#endif
488 return size; 487 return size;
489} 488}
489#endif
490 490
491static const struct cpu_dev centaur_cpu_dev = { 491static const struct cpu_dev centaur_cpu_dev = {
492 .c_vendor = "Centaur", 492 .c_vendor = "Centaur",
493 .c_ident = { "CentaurHauls" }, 493 .c_ident = { "CentaurHauls" },
494 .c_early_init = early_init_centaur, 494 .c_early_init = early_init_centaur,
495 .c_init = init_centaur, 495 .c_init = init_centaur,
496 .c_size_cache = centaur_size_cache, 496#ifdef CONFIG_X86_32
497 .legacy_cache_size = centaur_size_cache,
498#endif
497 .c_x86_vendor = X86_VENDOR_CENTAUR, 499 .c_x86_vendor = X86_VENDOR_CENTAUR,
498}; 500};
499 501
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 2793d1f095a2..6abc172b8258 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -346,7 +346,8 @@ static void filter_cpuid_features(struct cpuinfo_x86 *c, bool warn)
346/* Look up CPU names by table lookup. */ 346/* Look up CPU names by table lookup. */
347static const char *table_lookup_model(struct cpuinfo_x86 *c) 347static const char *table_lookup_model(struct cpuinfo_x86 *c)
348{ 348{
349 const struct cpu_model_info *info; 349#ifdef CONFIG_X86_32
350 const struct legacy_cpu_model_info *info;
350 351
351 if (c->x86_model >= 16) 352 if (c->x86_model >= 16)
352 return NULL; /* Range check */ 353 return NULL; /* Range check */
@@ -354,13 +355,14 @@ static const char *table_lookup_model(struct cpuinfo_x86 *c)
354 if (!this_cpu) 355 if (!this_cpu)
355 return NULL; 356 return NULL;
356 357
357 info = this_cpu->c_models; 358 info = this_cpu->legacy_models;
358 359
359 while (info && info->family) { 360 while (info->family) {
360 if (info->family == c->x86) 361 if (info->family == c->x86)
361 return info->model_names[c->x86_model]; 362 return info->model_names[c->x86_model];
362 info++; 363 info++;
363 } 364 }
365#endif
364 return NULL; /* Not found */ 366 return NULL; /* Not found */
365} 367}
366 368
@@ -450,8 +452,8 @@ void cpu_detect_cache_sizes(struct cpuinfo_x86 *c)
450 c->x86_tlbsize += ((ebx >> 16) & 0xfff) + (ebx & 0xfff); 452 c->x86_tlbsize += ((ebx >> 16) & 0xfff) + (ebx & 0xfff);
451#else 453#else
452 /* do processor-specific cache resizing */ 454 /* do processor-specific cache resizing */
453 if (this_cpu->c_size_cache) 455 if (this_cpu->legacy_cache_size)
454 l2size = this_cpu->c_size_cache(c, l2size); 456 l2size = this_cpu->legacy_cache_size(c, l2size);
455 457
456 /* Allow user to override all this if necessary. */ 458 /* Allow user to override all this if necessary. */
457 if (cachesize_override != -1) 459 if (cachesize_override != -1)
@@ -1095,6 +1097,9 @@ DEFINE_PER_CPU(char *, irq_stack_ptr) =
1095 1097
1096DEFINE_PER_CPU(unsigned int, irq_count) __visible = -1; 1098DEFINE_PER_CPU(unsigned int, irq_count) __visible = -1;
1097 1099
1100DEFINE_PER_CPU(int, __preempt_count) = INIT_PREEMPT_COUNT;
1101EXPORT_PER_CPU_SYMBOL(__preempt_count);
1102
1098DEFINE_PER_CPU(struct task_struct *, fpu_owner_task); 1103DEFINE_PER_CPU(struct task_struct *, fpu_owner_task);
1099 1104
1100/* 1105/*
@@ -1169,6 +1174,8 @@ void debug_stack_reset(void)
1169 1174
1170DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task; 1175DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task;
1171EXPORT_PER_CPU_SYMBOL(current_task); 1176EXPORT_PER_CPU_SYMBOL(current_task);
1177DEFINE_PER_CPU(int, __preempt_count) = INIT_PREEMPT_COUNT;
1178EXPORT_PER_CPU_SYMBOL(__preempt_count);
1172DEFINE_PER_CPU(struct task_struct *, fpu_owner_task); 1179DEFINE_PER_CPU(struct task_struct *, fpu_owner_task);
1173 1180
1174#ifdef CONFIG_CC_STACKPROTECTOR 1181#ifdef CONFIG_CC_STACKPROTECTOR
diff --git a/arch/x86/kernel/cpu/cpu.h b/arch/x86/kernel/cpu/cpu.h
index 4041c24ae7db..c37dc37e8317 100644
--- a/arch/x86/kernel/cpu/cpu.h
+++ b/arch/x86/kernel/cpu/cpu.h
@@ -1,12 +1,6 @@
1#ifndef ARCH_X86_CPU_H 1#ifndef ARCH_X86_CPU_H
2#define ARCH_X86_CPU_H 2#define ARCH_X86_CPU_H
3 3
4struct cpu_model_info {
5 int vendor;
6 int family;
7 const char *model_names[16];
8};
9
10/* attempt to consolidate cpu attributes */ 4/* attempt to consolidate cpu attributes */
11struct cpu_dev { 5struct cpu_dev {
12 const char *c_vendor; 6 const char *c_vendor;
@@ -14,15 +8,23 @@ struct cpu_dev {
14 /* some have two possibilities for cpuid string */ 8 /* some have two possibilities for cpuid string */
15 const char *c_ident[2]; 9 const char *c_ident[2];
16 10
17 struct cpu_model_info c_models[4];
18
19 void (*c_early_init)(struct cpuinfo_x86 *); 11 void (*c_early_init)(struct cpuinfo_x86 *);
20 void (*c_bsp_init)(struct cpuinfo_x86 *); 12 void (*c_bsp_init)(struct cpuinfo_x86 *);
21 void (*c_init)(struct cpuinfo_x86 *); 13 void (*c_init)(struct cpuinfo_x86 *);
22 void (*c_identify)(struct cpuinfo_x86 *); 14 void (*c_identify)(struct cpuinfo_x86 *);
23 void (*c_detect_tlb)(struct cpuinfo_x86 *); 15 void (*c_detect_tlb)(struct cpuinfo_x86 *);
24 unsigned int (*c_size_cache)(struct cpuinfo_x86 *, unsigned int);
25 int c_x86_vendor; 16 int c_x86_vendor;
17#ifdef CONFIG_X86_32
18 /* Optional vendor specific routine to obtain the cache size. */
19 unsigned int (*legacy_cache_size)(struct cpuinfo_x86 *,
20 unsigned int);
21
22 /* Family/stepping-based lookup table for model names. */
23 struct legacy_cpu_model_info {
24 int family;
25 const char *model_names[16];
26 } legacy_models[5];
27#endif
26}; 28};
27 29
28struct _tlb_table { 30struct _tlb_table {
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index ec7299566f79..dc1ec0dff939 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -665,8 +665,8 @@ static const struct cpu_dev intel_cpu_dev = {
665 .c_vendor = "Intel", 665 .c_vendor = "Intel",
666 .c_ident = { "GenuineIntel" }, 666 .c_ident = { "GenuineIntel" },
667#ifdef CONFIG_X86_32 667#ifdef CONFIG_X86_32
668 .c_models = { 668 .legacy_models = {
669 { .vendor = X86_VENDOR_INTEL, .family = 4, .model_names = 669 { .family = 4, .model_names =
670 { 670 {
671 [0] = "486 DX-25/33", 671 [0] = "486 DX-25/33",
672 [1] = "486 DX-50", 672 [1] = "486 DX-50",
@@ -679,7 +679,7 @@ static const struct cpu_dev intel_cpu_dev = {
679 [9] = "486 DX/4-WB" 679 [9] = "486 DX/4-WB"
680 } 680 }
681 }, 681 },
682 { .vendor = X86_VENDOR_INTEL, .family = 5, .model_names = 682 { .family = 5, .model_names =
683 { 683 {
684 [0] = "Pentium 60/66 A-step", 684 [0] = "Pentium 60/66 A-step",
685 [1] = "Pentium 60/66", 685 [1] = "Pentium 60/66",
@@ -690,7 +690,7 @@ static const struct cpu_dev intel_cpu_dev = {
690 [8] = "Mobile Pentium MMX" 690 [8] = "Mobile Pentium MMX"
691 } 691 }
692 }, 692 },
693 { .vendor = X86_VENDOR_INTEL, .family = 6, .model_names = 693 { .family = 6, .model_names =
694 { 694 {
695 [0] = "Pentium Pro A-step", 695 [0] = "Pentium Pro A-step",
696 [1] = "Pentium Pro", 696 [1] = "Pentium Pro",
@@ -704,7 +704,7 @@ static const struct cpu_dev intel_cpu_dev = {
704 [11] = "Pentium III (Tualatin)", 704 [11] = "Pentium III (Tualatin)",
705 } 705 }
706 }, 706 },
707 { .vendor = X86_VENDOR_INTEL, .family = 15, .model_names = 707 { .family = 15, .model_names =
708 { 708 {
709 [0] = "Pentium 4 (Unknown)", 709 [0] = "Pentium 4 (Unknown)",
710 [1] = "Pentium 4 (Willamette)", 710 [1] = "Pentium 4 (Willamette)",
@@ -714,7 +714,7 @@ static const struct cpu_dev intel_cpu_dev = {
714 } 714 }
715 }, 715 },
716 }, 716 },
717 .c_size_cache = intel_size_cache, 717 .legacy_cache_size = intel_size_cache,
718#endif 718#endif
719 .c_detect_tlb = intel_detect_tlb, 719 .c_detect_tlb = intel_detect_tlb,
720 .c_early_init = early_init_intel, 720 .c_early_init = early_init_intel,
diff --git a/arch/x86/kernel/cpu/mcheck/mce-apei.c b/arch/x86/kernel/cpu/mcheck/mce-apei.c
index cd8b166a1735..de8b60a53f69 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-apei.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-apei.c
@@ -42,8 +42,7 @@ void apei_mce_report_mem_error(int corrected, struct cper_sec_mem_err *mem_err)
42 struct mce m; 42 struct mce m;
43 43
44 /* Only corrected MC is reported */ 44 /* Only corrected MC is reported */
45 if (!corrected || !(mem_err->validation_bits & 45 if (!corrected || !(mem_err->validation_bits & CPER_MEM_VALID_PA))
46 CPER_MEM_VALID_PHYSICAL_ADDRESS))
47 return; 46 return;
48 47
49 mce_setup(&m); 48 mce_setup(&m);
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 71a39f3621ba..9f7ca266864a 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -15,6 +15,7 @@
15#include <linux/clocksource.h> 15#include <linux/clocksource.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/hardirq.h> 17#include <linux/hardirq.h>
18#include <linux/efi.h>
18#include <linux/interrupt.h> 19#include <linux/interrupt.h>
19#include <asm/processor.h> 20#include <asm/processor.h>
20#include <asm/hypervisor.h> 21#include <asm/hypervisor.h>
@@ -23,6 +24,8 @@
23#include <asm/desc.h> 24#include <asm/desc.h>
24#include <asm/idle.h> 25#include <asm/idle.h>
25#include <asm/irq_regs.h> 26#include <asm/irq_regs.h>
27#include <asm/i8259.h>
28#include <asm/apic.h>
26 29
27struct ms_hyperv_info ms_hyperv; 30struct ms_hyperv_info ms_hyperv;
28EXPORT_SYMBOL_GPL(ms_hyperv); 31EXPORT_SYMBOL_GPL(ms_hyperv);
@@ -76,6 +79,30 @@ static void __init ms_hyperv_init_platform(void)
76 printk(KERN_INFO "HyperV: features 0x%x, hints 0x%x\n", 79 printk(KERN_INFO "HyperV: features 0x%x, hints 0x%x\n",
77 ms_hyperv.features, ms_hyperv.hints); 80 ms_hyperv.features, ms_hyperv.hints);
78 81
82#ifdef CONFIG_X86_LOCAL_APIC
83 if (ms_hyperv.features & HV_X64_MSR_APIC_FREQUENCY_AVAILABLE) {
84 /*
85 * Get the APIC frequency.
86 */
87 u64 hv_lapic_frequency;
88
89 rdmsrl(HV_X64_MSR_APIC_FREQUENCY, hv_lapic_frequency);
90 hv_lapic_frequency = div_u64(hv_lapic_frequency, HZ);
91 lapic_timer_frequency = hv_lapic_frequency;
92 printk(KERN_INFO "HyperV: LAPIC Timer Frequency: %#x\n",
93 lapic_timer_frequency);
94
95 /*
96 * On Hyper-V, when we are booting off an EFI firmware stack,
97 * we do not have many legacy devices including PIC, PIT etc.
98 */
99 if (efi_enabled(EFI_BOOT)) {
100 printk(KERN_INFO "HyperV: Using null_legacy_pic\n");
101 legacy_pic = &null_legacy_pic;
102 }
103 }
104#endif
105
79 if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE) 106 if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE)
80 clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100); 107 clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100);
81} 108}
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 8355c84b9729..8e132931614d 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1276,16 +1276,16 @@ void perf_events_lapic_init(void)
1276static int __kprobes 1276static int __kprobes
1277perf_event_nmi_handler(unsigned int cmd, struct pt_regs *regs) 1277perf_event_nmi_handler(unsigned int cmd, struct pt_regs *regs)
1278{ 1278{
1279 int ret;
1280 u64 start_clock; 1279 u64 start_clock;
1281 u64 finish_clock; 1280 u64 finish_clock;
1281 int ret;
1282 1282
1283 if (!atomic_read(&active_events)) 1283 if (!atomic_read(&active_events))
1284 return NMI_DONE; 1284 return NMI_DONE;
1285 1285
1286 start_clock = local_clock(); 1286 start_clock = sched_clock();
1287 ret = x86_pmu.handle_irq(regs); 1287 ret = x86_pmu.handle_irq(regs);
1288 finish_clock = local_clock(); 1288 finish_clock = sched_clock();
1289 1289
1290 perf_sample_event_took(finish_clock - start_clock); 1290 perf_sample_event_took(finish_clock - start_clock);
1291 1291
@@ -1506,7 +1506,7 @@ static int __init init_hw_perf_events(void)
1506 err = amd_pmu_init(); 1506 err = amd_pmu_init();
1507 break; 1507 break;
1508 default: 1508 default:
1509 return 0; 1509 err = -ENOTSUPP;
1510 } 1510 }
1511 if (err != 0) { 1511 if (err != 0) {
1512 pr_cont("no PMU driver, software events only.\n"); 1512 pr_cont("no PMU driver, software events only.\n");
@@ -1883,26 +1883,21 @@ static struct pmu pmu = {
1883 1883
1884void arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now) 1884void arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
1885{ 1885{
1886 userpg->cap_usr_time = 0; 1886 userpg->cap_user_time = 0;
1887 userpg->cap_usr_time_zero = 0; 1887 userpg->cap_user_time_zero = 0;
1888 userpg->cap_usr_rdpmc = x86_pmu.attr_rdpmc; 1888 userpg->cap_user_rdpmc = x86_pmu.attr_rdpmc;
1889 userpg->pmc_width = x86_pmu.cntval_bits; 1889 userpg->pmc_width = x86_pmu.cntval_bits;
1890 1890
1891 if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) 1891 if (!sched_clock_stable)
1892 return; 1892 return;
1893 1893
1894 if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) 1894 userpg->cap_user_time = 1;
1895 return;
1896
1897 userpg->cap_usr_time = 1;
1898 userpg->time_mult = this_cpu_read(cyc2ns); 1895 userpg->time_mult = this_cpu_read(cyc2ns);
1899 userpg->time_shift = CYC2NS_SCALE_FACTOR; 1896 userpg->time_shift = CYC2NS_SCALE_FACTOR;
1900 userpg->time_offset = this_cpu_read(cyc2ns_offset) - now; 1897 userpg->time_offset = this_cpu_read(cyc2ns_offset) - now;
1901 1898
1902 if (sched_clock_stable && !check_tsc_disabled()) { 1899 userpg->cap_user_time_zero = 1;
1903 userpg->cap_usr_time_zero = 1; 1900 userpg->time_zero = this_cpu_read(cyc2ns_offset);
1904 userpg->time_zero = this_cpu_read(cyc2ns_offset);
1905 }
1906} 1901}
1907 1902
1908/* 1903/*
@@ -1994,7 +1989,7 @@ perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry)
1994 frame.return_address = 0; 1989 frame.return_address = 0;
1995 1990
1996 bytes = copy_from_user_nmi(&frame, fp, sizeof(frame)); 1991 bytes = copy_from_user_nmi(&frame, fp, sizeof(frame));
1997 if (bytes != sizeof(frame)) 1992 if (bytes != 0)
1998 break; 1993 break;
1999 1994
2000 if (!valid_user_frame(fp, sizeof(frame))) 1995 if (!valid_user_frame(fp, sizeof(frame)))
@@ -2046,7 +2041,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
2046 frame.return_address = 0; 2041 frame.return_address = 0;
2047 2042
2048 bytes = copy_from_user_nmi(&frame, fp, sizeof(frame)); 2043 bytes = copy_from_user_nmi(&frame, fp, sizeof(frame));
2049 if (bytes != sizeof(frame)) 2044 if (bytes != 0)
2050 break; 2045 break;
2051 2046
2052 if (!valid_user_frame(fp, sizeof(frame))) 2047 if (!valid_user_frame(fp, sizeof(frame)))
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index cc16faae0538..fd00bb29425d 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -164,6 +164,11 @@ struct cpu_hw_events {
164 struct perf_guest_switch_msr guest_switch_msrs[X86_PMC_IDX_MAX]; 164 struct perf_guest_switch_msr guest_switch_msrs[X86_PMC_IDX_MAX];
165 165
166 /* 166 /*
167 * Intel checkpoint mask
168 */
169 u64 intel_cp_status;
170
171 /*
167 * manage shared (per-core, per-cpu) registers 172 * manage shared (per-core, per-cpu) registers
168 * used on Intel NHM/WSM/SNB 173 * used on Intel NHM/WSM/SNB
169 */ 174 */
@@ -440,6 +445,7 @@ struct x86_pmu {
440 int lbr_nr; /* hardware stack size */ 445 int lbr_nr; /* hardware stack size */
441 u64 lbr_sel_mask; /* LBR_SELECT valid bits */ 446 u64 lbr_sel_mask; /* LBR_SELECT valid bits */
442 const int *lbr_sel_map; /* lbr_select mappings */ 447 const int *lbr_sel_map; /* lbr_select mappings */
448 bool lbr_double_abort; /* duplicated lbr aborts */
443 449
444 /* 450 /*
445 * Extra registers for events 451 * Extra registers for events
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index c62d88396ad5..0fa4f242f050 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -190,9 +190,9 @@ static struct extra_reg intel_snbep_extra_regs[] __read_mostly = {
190 EVENT_EXTRA_END 190 EVENT_EXTRA_END
191}; 191};
192 192
193EVENT_ATTR_STR(mem-loads, mem_ld_nhm, "event=0x0b,umask=0x10,ldlat=3"); 193EVENT_ATTR_STR(mem-loads, mem_ld_nhm, "event=0x0b,umask=0x10,ldlat=3");
194EVENT_ATTR_STR(mem-loads, mem_ld_snb, "event=0xcd,umask=0x1,ldlat=3"); 194EVENT_ATTR_STR(mem-loads, mem_ld_snb, "event=0xcd,umask=0x1,ldlat=3");
195EVENT_ATTR_STR(mem-stores, mem_st_snb, "event=0xcd,umask=0x2"); 195EVENT_ATTR_STR(mem-stores, mem_st_snb, "event=0xcd,umask=0x2");
196 196
197struct attribute *nhm_events_attrs[] = { 197struct attribute *nhm_events_attrs[] = {
198 EVENT_PTR(mem_ld_nhm), 198 EVENT_PTR(mem_ld_nhm),
@@ -899,8 +899,8 @@ static __initconst const u64 atom_hw_cache_event_ids
899static struct extra_reg intel_slm_extra_regs[] __read_mostly = 899static struct extra_reg intel_slm_extra_regs[] __read_mostly =
900{ 900{
901 /* must define OFFCORE_RSP_X first, see intel_fixup_er() */ 901 /* must define OFFCORE_RSP_X first, see intel_fixup_er() */
902 INTEL_UEVENT_EXTRA_REG(0x01b7, MSR_OFFCORE_RSP_0, 0x768005ffff, RSP_0), 902 INTEL_UEVENT_EXTRA_REG(0x01b7, MSR_OFFCORE_RSP_0, 0x768005ffffull, RSP_0),
903 INTEL_UEVENT_EXTRA_REG(0x02b7, MSR_OFFCORE_RSP_1, 0x768005ffff, RSP_1), 903 INTEL_UEVENT_EXTRA_REG(0x02b7, MSR_OFFCORE_RSP_1, 0x768005ffffull, RSP_1),
904 EVENT_EXTRA_END 904 EVENT_EXTRA_END
905}; 905};
906 906
@@ -1184,6 +1184,11 @@ static void intel_pmu_disable_fixed(struct hw_perf_event *hwc)
1184 wrmsrl(hwc->config_base, ctrl_val); 1184 wrmsrl(hwc->config_base, ctrl_val);
1185} 1185}
1186 1186
1187static inline bool event_is_checkpointed(struct perf_event *event)
1188{
1189 return (event->hw.config & HSW_IN_TX_CHECKPOINTED) != 0;
1190}
1191
1187static void intel_pmu_disable_event(struct perf_event *event) 1192static void intel_pmu_disable_event(struct perf_event *event)
1188{ 1193{
1189 struct hw_perf_event *hwc = &event->hw; 1194 struct hw_perf_event *hwc = &event->hw;
@@ -1197,6 +1202,7 @@ static void intel_pmu_disable_event(struct perf_event *event)
1197 1202
1198 cpuc->intel_ctrl_guest_mask &= ~(1ull << hwc->idx); 1203 cpuc->intel_ctrl_guest_mask &= ~(1ull << hwc->idx);
1199 cpuc->intel_ctrl_host_mask &= ~(1ull << hwc->idx); 1204 cpuc->intel_ctrl_host_mask &= ~(1ull << hwc->idx);
1205 cpuc->intel_cp_status &= ~(1ull << hwc->idx);
1200 1206
1201 /* 1207 /*
1202 * must disable before any actual event 1208 * must disable before any actual event
@@ -1271,6 +1277,9 @@ static void intel_pmu_enable_event(struct perf_event *event)
1271 if (event->attr.exclude_guest) 1277 if (event->attr.exclude_guest)
1272 cpuc->intel_ctrl_host_mask |= (1ull << hwc->idx); 1278 cpuc->intel_ctrl_host_mask |= (1ull << hwc->idx);
1273 1279
1280 if (unlikely(event_is_checkpointed(event)))
1281 cpuc->intel_cp_status |= (1ull << hwc->idx);
1282
1274 if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) { 1283 if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) {
1275 intel_pmu_enable_fixed(hwc); 1284 intel_pmu_enable_fixed(hwc);
1276 return; 1285 return;
@@ -1289,6 +1298,17 @@ static void intel_pmu_enable_event(struct perf_event *event)
1289int intel_pmu_save_and_restart(struct perf_event *event) 1298int intel_pmu_save_and_restart(struct perf_event *event)
1290{ 1299{
1291 x86_perf_event_update(event); 1300 x86_perf_event_update(event);
1301 /*
1302 * For a checkpointed counter always reset back to 0. This
1303 * avoids a situation where the counter overflows, aborts the
1304 * transaction and is then set back to shortly before the
1305 * overflow, and overflows and aborts again.
1306 */
1307 if (unlikely(event_is_checkpointed(event))) {
1308 /* No race with NMIs because the counter should not be armed */
1309 wrmsrl(event->hw.event_base, 0);
1310 local64_set(&event->hw.prev_count, 0);
1311 }
1292 return x86_perf_event_set_period(event); 1312 return x86_perf_event_set_period(event);
1293} 1313}
1294 1314
@@ -1372,6 +1392,13 @@ again:
1372 x86_pmu.drain_pebs(regs); 1392 x86_pmu.drain_pebs(regs);
1373 } 1393 }
1374 1394
1395 /*
1396 * Checkpointed counters can lead to 'spurious' PMIs because the
1397 * rollback caused by the PMI will have cleared the overflow status
1398 * bit. Therefore always force probe these counters.
1399 */
1400 status |= cpuc->intel_cp_status;
1401
1375 for_each_set_bit(bit, (unsigned long *)&status, X86_PMC_IDX_MAX) { 1402 for_each_set_bit(bit, (unsigned long *)&status, X86_PMC_IDX_MAX) {
1376 struct perf_event *event = cpuc->events[bit]; 1403 struct perf_event *event = cpuc->events[bit];
1377 1404
@@ -1837,6 +1864,20 @@ static int hsw_hw_config(struct perf_event *event)
1837 event->attr.precise_ip > 0)) 1864 event->attr.precise_ip > 0))
1838 return -EOPNOTSUPP; 1865 return -EOPNOTSUPP;
1839 1866
1867 if (event_is_checkpointed(event)) {
1868 /*
1869 * Sampling of checkpointed events can cause situations where
1870 * the CPU constantly aborts because of a overflow, which is
1871 * then checkpointed back and ignored. Forbid checkpointing
1872 * for sampling.
1873 *
1874 * But still allow a long sampling period, so that perf stat
1875 * from KVM works.
1876 */
1877 if (event->attr.sample_period > 0 &&
1878 event->attr.sample_period < 0x7fffffff)
1879 return -EOPNOTSUPP;
1880 }
1840 return 0; 1881 return 0;
1841} 1882}
1842 1883
@@ -2182,10 +2223,36 @@ static __init void intel_nehalem_quirk(void)
2182 } 2223 }
2183} 2224}
2184 2225
2185EVENT_ATTR_STR(mem-loads, mem_ld_hsw, "event=0xcd,umask=0x1,ldlat=3"); 2226EVENT_ATTR_STR(mem-loads, mem_ld_hsw, "event=0xcd,umask=0x1,ldlat=3");
2186EVENT_ATTR_STR(mem-stores, mem_st_hsw, "event=0xd0,umask=0x82") 2227EVENT_ATTR_STR(mem-stores, mem_st_hsw, "event=0xd0,umask=0x82")
2228
2229/* Haswell special events */
2230EVENT_ATTR_STR(tx-start, tx_start, "event=0xc9,umask=0x1");
2231EVENT_ATTR_STR(tx-commit, tx_commit, "event=0xc9,umask=0x2");
2232EVENT_ATTR_STR(tx-abort, tx_abort, "event=0xc9,umask=0x4");
2233EVENT_ATTR_STR(tx-capacity, tx_capacity, "event=0x54,umask=0x2");
2234EVENT_ATTR_STR(tx-conflict, tx_conflict, "event=0x54,umask=0x1");
2235EVENT_ATTR_STR(el-start, el_start, "event=0xc8,umask=0x1");
2236EVENT_ATTR_STR(el-commit, el_commit, "event=0xc8,umask=0x2");
2237EVENT_ATTR_STR(el-abort, el_abort, "event=0xc8,umask=0x4");
2238EVENT_ATTR_STR(el-capacity, el_capacity, "event=0x54,umask=0x2");
2239EVENT_ATTR_STR(el-conflict, el_conflict, "event=0x54,umask=0x1");
2240EVENT_ATTR_STR(cycles-t, cycles_t, "event=0x3c,in_tx=1");
2241EVENT_ATTR_STR(cycles-ct, cycles_ct, "event=0x3c,in_tx=1,in_tx_cp=1");
2187 2242
2188static struct attribute *hsw_events_attrs[] = { 2243static struct attribute *hsw_events_attrs[] = {
2244 EVENT_PTR(tx_start),
2245 EVENT_PTR(tx_commit),
2246 EVENT_PTR(tx_abort),
2247 EVENT_PTR(tx_capacity),
2248 EVENT_PTR(tx_conflict),
2249 EVENT_PTR(el_start),
2250 EVENT_PTR(el_commit),
2251 EVENT_PTR(el_abort),
2252 EVENT_PTR(el_capacity),
2253 EVENT_PTR(el_conflict),
2254 EVENT_PTR(cycles_t),
2255 EVENT_PTR(cycles_ct),
2189 EVENT_PTR(mem_ld_hsw), 2256 EVENT_PTR(mem_ld_hsw),
2190 EVENT_PTR(mem_st_hsw), 2257 EVENT_PTR(mem_st_hsw),
2191 NULL 2258 NULL
@@ -2325,6 +2392,7 @@ __init int intel_pmu_init(void)
2325 break; 2392 break;
2326 2393
2327 case 55: /* Atom 22nm "Silvermont" */ 2394 case 55: /* Atom 22nm "Silvermont" */
2395 case 77: /* Avoton "Silvermont" */
2328 memcpy(hw_cache_event_ids, slm_hw_cache_event_ids, 2396 memcpy(hw_cache_event_ids, slm_hw_cache_event_ids,
2329 sizeof(hw_cache_event_ids)); 2397 sizeof(hw_cache_event_ids));
2330 memcpy(hw_cache_extra_regs, slm_hw_cache_extra_regs, 2398 memcpy(hw_cache_extra_regs, slm_hw_cache_extra_regs,
@@ -2451,6 +2519,7 @@ __init int intel_pmu_init(void)
2451 x86_pmu.hw_config = hsw_hw_config; 2519 x86_pmu.hw_config = hsw_hw_config;
2452 x86_pmu.get_event_constraints = hsw_get_event_constraints; 2520 x86_pmu.get_event_constraints = hsw_get_event_constraints;
2453 x86_pmu.cpu_events = hsw_events_attrs; 2521 x86_pmu.cpu_events = hsw_events_attrs;
2522 x86_pmu.lbr_double_abort = true;
2454 pr_cont("Haswell events, "); 2523 pr_cont("Haswell events, ");
2455 break; 2524 break;
2456 2525
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 63438aad177f..ae96cfa5eddd 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -12,6 +12,7 @@
12 12
13#define BTS_BUFFER_SIZE (PAGE_SIZE << 4) 13#define BTS_BUFFER_SIZE (PAGE_SIZE << 4)
14#define PEBS_BUFFER_SIZE PAGE_SIZE 14#define PEBS_BUFFER_SIZE PAGE_SIZE
15#define PEBS_FIXUP_SIZE PAGE_SIZE
15 16
16/* 17/*
17 * pebs_record_32 for p4 and core not supported 18 * pebs_record_32 for p4 and core not supported
@@ -182,18 +183,32 @@ struct pebs_record_nhm {
182 * Same as pebs_record_nhm, with two additional fields. 183 * Same as pebs_record_nhm, with two additional fields.
183 */ 184 */
184struct pebs_record_hsw { 185struct pebs_record_hsw {
185 struct pebs_record_nhm nhm; 186 u64 flags, ip;
186 /* 187 u64 ax, bx, cx, dx;
187 * Real IP of the event. In the Intel documentation this 188 u64 si, di, bp, sp;
188 * is called eventingrip. 189 u64 r8, r9, r10, r11;
189 */ 190 u64 r12, r13, r14, r15;
190 u64 real_ip; 191 u64 status, dla, dse, lat;
191 /* 192 u64 real_ip, tsx_tuning;
192 * TSX tuning information field: abort cycles and abort flags. 193};
193 */ 194
194 u64 tsx_tuning; 195union hsw_tsx_tuning {
196 struct {
197 u32 cycles_last_block : 32,
198 hle_abort : 1,
199 rtm_abort : 1,
200 instruction_abort : 1,
201 non_instruction_abort : 1,
202 retry : 1,
203 data_conflict : 1,
204 capacity_writes : 1,
205 capacity_reads : 1;
206 };
207 u64 value;
195}; 208};
196 209
210#define PEBS_HSW_TSX_FLAGS 0xff00000000ULL
211
197void init_debug_store_on_cpu(int cpu) 212void init_debug_store_on_cpu(int cpu)
198{ 213{
199 struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds; 214 struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
@@ -214,12 +229,14 @@ void fini_debug_store_on_cpu(int cpu)
214 wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA, 0, 0); 229 wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA, 0, 0);
215} 230}
216 231
232static DEFINE_PER_CPU(void *, insn_buffer);
233
217static int alloc_pebs_buffer(int cpu) 234static int alloc_pebs_buffer(int cpu)
218{ 235{
219 struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds; 236 struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
220 int node = cpu_to_node(cpu); 237 int node = cpu_to_node(cpu);
221 int max, thresh = 1; /* always use a single PEBS record */ 238 int max, thresh = 1; /* always use a single PEBS record */
222 void *buffer; 239 void *buffer, *ibuffer;
223 240
224 if (!x86_pmu.pebs) 241 if (!x86_pmu.pebs)
225 return 0; 242 return 0;
@@ -228,6 +245,19 @@ static int alloc_pebs_buffer(int cpu)
228 if (unlikely(!buffer)) 245 if (unlikely(!buffer))
229 return -ENOMEM; 246 return -ENOMEM;
230 247
248 /*
249 * HSW+ already provides us the eventing ip; no need to allocate this
250 * buffer then.
251 */
252 if (x86_pmu.intel_cap.pebs_format < 2) {
253 ibuffer = kzalloc_node(PEBS_FIXUP_SIZE, GFP_KERNEL, node);
254 if (!ibuffer) {
255 kfree(buffer);
256 return -ENOMEM;
257 }
258 per_cpu(insn_buffer, cpu) = ibuffer;
259 }
260
231 max = PEBS_BUFFER_SIZE / x86_pmu.pebs_record_size; 261 max = PEBS_BUFFER_SIZE / x86_pmu.pebs_record_size;
232 262
233 ds->pebs_buffer_base = (u64)(unsigned long)buffer; 263 ds->pebs_buffer_base = (u64)(unsigned long)buffer;
@@ -248,6 +278,9 @@ static void release_pebs_buffer(int cpu)
248 if (!ds || !x86_pmu.pebs) 278 if (!ds || !x86_pmu.pebs)
249 return; 279 return;
250 280
281 kfree(per_cpu(insn_buffer, cpu));
282 per_cpu(insn_buffer, cpu) = NULL;
283
251 kfree((void *)(unsigned long)ds->pebs_buffer_base); 284 kfree((void *)(unsigned long)ds->pebs_buffer_base);
252 ds->pebs_buffer_base = 0; 285 ds->pebs_buffer_base = 0;
253} 286}
@@ -584,6 +617,7 @@ struct event_constraint intel_snb_pebs_event_constraints[] = {
584 INTEL_EVENT_CONSTRAINT(0xd0, 0xf), /* MEM_UOP_RETIRED.* */ 617 INTEL_EVENT_CONSTRAINT(0xd0, 0xf), /* MEM_UOP_RETIRED.* */
585 INTEL_EVENT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */ 618 INTEL_EVENT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */
586 INTEL_EVENT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ 619 INTEL_EVENT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */
620 INTEL_EVENT_CONSTRAINT(0xd3, 0xf), /* MEM_LOAD_UOPS_LLC_MISS_RETIRED.* */
587 INTEL_UEVENT_CONSTRAINT(0x02d4, 0xf), /* MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS */ 621 INTEL_UEVENT_CONSTRAINT(0x02d4, 0xf), /* MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS */
588 EVENT_CONSTRAINT_END 622 EVENT_CONSTRAINT_END
589}; 623};
@@ -714,6 +748,7 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
714 unsigned long old_to, to = cpuc->lbr_entries[0].to; 748 unsigned long old_to, to = cpuc->lbr_entries[0].to;
715 unsigned long ip = regs->ip; 749 unsigned long ip = regs->ip;
716 int is_64bit = 0; 750 int is_64bit = 0;
751 void *kaddr;
717 752
718 /* 753 /*
719 * We don't need to fixup if the PEBS assist is fault like 754 * We don't need to fixup if the PEBS assist is fault like
@@ -737,7 +772,7 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
737 * unsigned math, either ip is before the start (impossible) or 772 * unsigned math, either ip is before the start (impossible) or
738 * the basic block is larger than 1 page (sanity) 773 * the basic block is larger than 1 page (sanity)
739 */ 774 */
740 if ((ip - to) > PAGE_SIZE) 775 if ((ip - to) > PEBS_FIXUP_SIZE)
741 return 0; 776 return 0;
742 777
743 /* 778 /*
@@ -748,29 +783,33 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
748 return 1; 783 return 1;
749 } 784 }
750 785
786 if (!kernel_ip(ip)) {
787 int size, bytes;
788 u8 *buf = this_cpu_read(insn_buffer);
789
790 size = ip - to; /* Must fit our buffer, see above */
791 bytes = copy_from_user_nmi(buf, (void __user *)to, size);
792 if (bytes != 0)
793 return 0;
794
795 kaddr = buf;
796 } else {
797 kaddr = (void *)to;
798 }
799
751 do { 800 do {
752 struct insn insn; 801 struct insn insn;
753 u8 buf[MAX_INSN_SIZE];
754 void *kaddr;
755 802
756 old_to = to; 803 old_to = to;
757 if (!kernel_ip(ip)) {
758 int bytes, size = MAX_INSN_SIZE;
759
760 bytes = copy_from_user_nmi(buf, (void __user *)to, size);
761 if (bytes != size)
762 return 0;
763
764 kaddr = buf;
765 } else
766 kaddr = (void *)to;
767 804
768#ifdef CONFIG_X86_64 805#ifdef CONFIG_X86_64
769 is_64bit = kernel_ip(to) || !test_thread_flag(TIF_IA32); 806 is_64bit = kernel_ip(to) || !test_thread_flag(TIF_IA32);
770#endif 807#endif
771 insn_init(&insn, kaddr, is_64bit); 808 insn_init(&insn, kaddr, is_64bit);
772 insn_get_length(&insn); 809 insn_get_length(&insn);
810
773 to += insn.length; 811 to += insn.length;
812 kaddr += insn.length;
774 } while (to < ip); 813 } while (to < ip);
775 814
776 if (to == ip) { 815 if (to == ip) {
@@ -785,16 +824,34 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
785 return 0; 824 return 0;
786} 825}
787 826
827static inline u64 intel_hsw_weight(struct pebs_record_hsw *pebs)
828{
829 if (pebs->tsx_tuning) {
830 union hsw_tsx_tuning tsx = { .value = pebs->tsx_tuning };
831 return tsx.cycles_last_block;
832 }
833 return 0;
834}
835
836static inline u64 intel_hsw_transaction(struct pebs_record_hsw *pebs)
837{
838 u64 txn = (pebs->tsx_tuning & PEBS_HSW_TSX_FLAGS) >> 32;
839
840 /* For RTM XABORTs also log the abort code from AX */
841 if ((txn & PERF_TXN_TRANSACTION) && (pebs->ax & 1))
842 txn |= ((pebs->ax >> 24) & 0xff) << PERF_TXN_ABORT_SHIFT;
843 return txn;
844}
845
788static void __intel_pmu_pebs_event(struct perf_event *event, 846static void __intel_pmu_pebs_event(struct perf_event *event,
789 struct pt_regs *iregs, void *__pebs) 847 struct pt_regs *iregs, void *__pebs)
790{ 848{
791 /* 849 /*
792 * We cast to pebs_record_nhm to get the load latency data 850 * We cast to the biggest pebs_record but are careful not to
793 * if extra_reg MSR_PEBS_LD_LAT_THRESHOLD used 851 * unconditionally access the 'extra' entries.
794 */ 852 */
795 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 853 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
796 struct pebs_record_nhm *pebs = __pebs; 854 struct pebs_record_hsw *pebs = __pebs;
797 struct pebs_record_hsw *pebs_hsw = __pebs;
798 struct perf_sample_data data; 855 struct perf_sample_data data;
799 struct pt_regs regs; 856 struct pt_regs regs;
800 u64 sample_type; 857 u64 sample_type;
@@ -853,7 +910,7 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
853 regs.sp = pebs->sp; 910 regs.sp = pebs->sp;
854 911
855 if (event->attr.precise_ip > 1 && x86_pmu.intel_cap.pebs_format >= 2) { 912 if (event->attr.precise_ip > 1 && x86_pmu.intel_cap.pebs_format >= 2) {
856 regs.ip = pebs_hsw->real_ip; 913 regs.ip = pebs->real_ip;
857 regs.flags |= PERF_EFLAGS_EXACT; 914 regs.flags |= PERF_EFLAGS_EXACT;
858 } else if (event->attr.precise_ip > 1 && intel_pmu_pebs_fixup_ip(&regs)) 915 } else if (event->attr.precise_ip > 1 && intel_pmu_pebs_fixup_ip(&regs))
859 regs.flags |= PERF_EFLAGS_EXACT; 916 regs.flags |= PERF_EFLAGS_EXACT;
@@ -861,9 +918,18 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
861 regs.flags &= ~PERF_EFLAGS_EXACT; 918 regs.flags &= ~PERF_EFLAGS_EXACT;
862 919
863 if ((event->attr.sample_type & PERF_SAMPLE_ADDR) && 920 if ((event->attr.sample_type & PERF_SAMPLE_ADDR) &&
864 x86_pmu.intel_cap.pebs_format >= 1) 921 x86_pmu.intel_cap.pebs_format >= 1)
865 data.addr = pebs->dla; 922 data.addr = pebs->dla;
866 923
924 if (x86_pmu.intel_cap.pebs_format >= 2) {
925 /* Only set the TSX weight when no memory weight. */
926 if ((event->attr.sample_type & PERF_SAMPLE_WEIGHT) && !fll)
927 data.weight = intel_hsw_weight(pebs);
928
929 if (event->attr.sample_type & PERF_SAMPLE_TRANSACTION)
930 data.txn = intel_hsw_transaction(pebs);
931 }
932
867 if (has_branch_stack(event)) 933 if (has_branch_stack(event))
868 data.br_stack = &cpuc->lbr_stack; 934 data.br_stack = &cpuc->lbr_stack;
869 935
@@ -912,17 +978,34 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
912 __intel_pmu_pebs_event(event, iregs, at); 978 __intel_pmu_pebs_event(event, iregs, at);
913} 979}
914 980
915static void __intel_pmu_drain_pebs_nhm(struct pt_regs *iregs, void *at, 981static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
916 void *top)
917{ 982{
918 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 983 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
919 struct debug_store *ds = cpuc->ds; 984 struct debug_store *ds = cpuc->ds;
920 struct perf_event *event = NULL; 985 struct perf_event *event = NULL;
986 void *at, *top;
921 u64 status = 0; 987 u64 status = 0;
922 int bit; 988 int bit;
923 989
990 if (!x86_pmu.pebs_active)
991 return;
992
993 at = (struct pebs_record_nhm *)(unsigned long)ds->pebs_buffer_base;
994 top = (struct pebs_record_nhm *)(unsigned long)ds->pebs_index;
995
924 ds->pebs_index = ds->pebs_buffer_base; 996 ds->pebs_index = ds->pebs_buffer_base;
925 997
998 if (unlikely(at > top))
999 return;
1000
1001 /*
1002 * Should not happen, we program the threshold at 1 and do not
1003 * set a reset value.
1004 */
1005 WARN_ONCE(top - at > x86_pmu.max_pebs_events * x86_pmu.pebs_record_size,
1006 "Unexpected number of pebs records %ld\n",
1007 (long)(top - at) / x86_pmu.pebs_record_size);
1008
926 for (; at < top; at += x86_pmu.pebs_record_size) { 1009 for (; at < top; at += x86_pmu.pebs_record_size) {
927 struct pebs_record_nhm *p = at; 1010 struct pebs_record_nhm *p = at;
928 1011
@@ -950,61 +1033,6 @@ static void __intel_pmu_drain_pebs_nhm(struct pt_regs *iregs, void *at,
950 } 1033 }
951} 1034}
952 1035
953static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
954{
955 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
956 struct debug_store *ds = cpuc->ds;
957 struct pebs_record_nhm *at, *top;
958 int n;
959
960 if (!x86_pmu.pebs_active)
961 return;
962
963 at = (struct pebs_record_nhm *)(unsigned long)ds->pebs_buffer_base;
964 top = (struct pebs_record_nhm *)(unsigned long)ds->pebs_index;
965
966 ds->pebs_index = ds->pebs_buffer_base;
967
968 n = top - at;
969 if (n <= 0)
970 return;
971
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
982static void intel_pmu_drain_pebs_hsw(struct pt_regs *iregs)
983{
984 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
985 struct debug_store *ds = cpuc->ds;
986 struct pebs_record_hsw *at, *top;
987 int n;
988
989 if (!x86_pmu.pebs_active)
990 return;
991
992 at = (struct pebs_record_hsw *)(unsigned long)ds->pebs_buffer_base;
993 top = (struct pebs_record_hsw *)(unsigned long)ds->pebs_index;
994
995 n = top - at;
996 if (n <= 0)
997 return;
998 /*
999 * Should not happen, we program the threshold at 1 and do not
1000 * set a reset value.
1001 */
1002 WARN_ONCE(n > x86_pmu.max_pebs_events,
1003 "Unexpected number of pebs records %d\n", n);
1004
1005 return __intel_pmu_drain_pebs_nhm(iregs, at, top);
1006}
1007
1008/* 1036/*
1009 * BTS, PEBS probe and setup 1037 * BTS, PEBS probe and setup
1010 */ 1038 */
@@ -1039,7 +1067,7 @@ void intel_ds_init(void)
1039 case 2: 1067 case 2:
1040 pr_cont("PEBS fmt2%c, ", pebs_type); 1068 pr_cont("PEBS fmt2%c, ", pebs_type);
1041 x86_pmu.pebs_record_size = sizeof(struct pebs_record_hsw); 1069 x86_pmu.pebs_record_size = sizeof(struct pebs_record_hsw);
1042 x86_pmu.drain_pebs = intel_pmu_drain_pebs_hsw; 1070 x86_pmu.drain_pebs = intel_pmu_drain_pebs_nhm;
1043 break; 1071 break;
1044 1072
1045 default: 1073 default:
diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
index d5be06a5005e..d82d155aca8c 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
@@ -284,6 +284,7 @@ static void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc)
284 int lbr_format = x86_pmu.intel_cap.lbr_format; 284 int lbr_format = x86_pmu.intel_cap.lbr_format;
285 u64 tos = intel_pmu_lbr_tos(); 285 u64 tos = intel_pmu_lbr_tos();
286 int i; 286 int i;
287 int out = 0;
287 288
288 for (i = 0; i < x86_pmu.lbr_nr; i++) { 289 for (i = 0; i < x86_pmu.lbr_nr; i++) {
289 unsigned long lbr_idx = (tos - i) & mask; 290 unsigned long lbr_idx = (tos - i) & mask;
@@ -306,15 +307,27 @@ static void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc)
306 } 307 }
307 from = (u64)((((s64)from) << skip) >> skip); 308 from = (u64)((((s64)from) << skip) >> skip);
308 309
309 cpuc->lbr_entries[i].from = from; 310 /*
310 cpuc->lbr_entries[i].to = to; 311 * Some CPUs report duplicated abort records,
311 cpuc->lbr_entries[i].mispred = mis; 312 * with the second entry not having an abort bit set.
312 cpuc->lbr_entries[i].predicted = pred; 313 * Skip them here. This loop runs backwards,
313 cpuc->lbr_entries[i].in_tx = in_tx; 314 * so we need to undo the previous record.
314 cpuc->lbr_entries[i].abort = abort; 315 * If the abort just happened outside the window
315 cpuc->lbr_entries[i].reserved = 0; 316 * the extra entry cannot be removed.
317 */
318 if (abort && x86_pmu.lbr_double_abort && out > 0)
319 out--;
320
321 cpuc->lbr_entries[out].from = from;
322 cpuc->lbr_entries[out].to = to;
323 cpuc->lbr_entries[out].mispred = mis;
324 cpuc->lbr_entries[out].predicted = pred;
325 cpuc->lbr_entries[out].in_tx = in_tx;
326 cpuc->lbr_entries[out].abort = abort;
327 cpuc->lbr_entries[out].reserved = 0;
328 out++;
316 } 329 }
317 cpuc->lbr_stack.nr = i; 330 cpuc->lbr_stack.nr = out;
318} 331}
319 332
320void intel_pmu_lbr_read(void) 333void intel_pmu_lbr_read(void)
@@ -478,7 +491,7 @@ static int branch_type(unsigned long from, unsigned long to, int abort)
478 491
479 /* may fail if text not present */ 492 /* may fail if text not present */
480 bytes = copy_from_user_nmi(buf, (void __user *)from, size); 493 bytes = copy_from_user_nmi(buf, (void __user *)from, size);
481 if (bytes != size) 494 if (bytes != 0)
482 return X86_BR_NONE; 495 return X86_BR_NONE;
483 496
484 addr = buf; 497 addr = buf;
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index 8ed44589b0e4..29c248799ced 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -997,6 +997,20 @@ static int snbep_pci2phy_map_init(int devid)
997 } 997 }
998 } 998 }
999 999
1000 if (!err) {
1001 /*
1002 * For PCI bus with no UBOX device, find the next bus
1003 * that has UBOX device and use its mapping.
1004 */
1005 i = -1;
1006 for (bus = 255; bus >= 0; bus--) {
1007 if (pcibus_to_physid[bus] >= 0)
1008 i = pcibus_to_physid[bus];
1009 else
1010 pcibus_to_physid[bus] = i;
1011 }
1012 }
1013
1000 if (ubox_dev) 1014 if (ubox_dev)
1001 pci_dev_put(ubox_dev); 1015 pci_dev_put(ubox_dev);
1002 1016
@@ -1099,6 +1113,24 @@ static struct attribute *ivt_uncore_qpi_formats_attr[] = {
1099 &format_attr_umask.attr, 1113 &format_attr_umask.attr,
1100 &format_attr_edge.attr, 1114 &format_attr_edge.attr,
1101 &format_attr_thresh8.attr, 1115 &format_attr_thresh8.attr,
1116 &format_attr_match_rds.attr,
1117 &format_attr_match_rnid30.attr,
1118 &format_attr_match_rnid4.attr,
1119 &format_attr_match_dnid.attr,
1120 &format_attr_match_mc.attr,
1121 &format_attr_match_opc.attr,
1122 &format_attr_match_vnw.attr,
1123 &format_attr_match0.attr,
1124 &format_attr_match1.attr,
1125 &format_attr_mask_rds.attr,
1126 &format_attr_mask_rnid30.attr,
1127 &format_attr_mask_rnid4.attr,
1128 &format_attr_mask_dnid.attr,
1129 &format_attr_mask_mc.attr,
1130 &format_attr_mask_opc.attr,
1131 &format_attr_mask_vnw.attr,
1132 &format_attr_mask0.attr,
1133 &format_attr_mask1.attr,
1102 NULL, 1134 NULL,
1103}; 1135};
1104 1136
@@ -1312,17 +1344,83 @@ static struct intel_uncore_type ivt_uncore_imc = {
1312 IVT_UNCORE_PCI_COMMON_INIT(), 1344 IVT_UNCORE_PCI_COMMON_INIT(),
1313}; 1345};
1314 1346
1347/* registers in IRP boxes are not properly aligned */
1348static unsigned ivt_uncore_irp_ctls[] = {0xd8, 0xdc, 0xe0, 0xe4};
1349static unsigned ivt_uncore_irp_ctrs[] = {0xa0, 0xb0, 0xb8, 0xc0};
1350
1351static void ivt_uncore_irp_enable_event(struct intel_uncore_box *box, struct perf_event *event)
1352{
1353 struct pci_dev *pdev = box->pci_dev;
1354 struct hw_perf_event *hwc = &event->hw;
1355
1356 pci_write_config_dword(pdev, ivt_uncore_irp_ctls[hwc->idx],
1357 hwc->config | SNBEP_PMON_CTL_EN);
1358}
1359
1360static void ivt_uncore_irp_disable_event(struct intel_uncore_box *box, struct perf_event *event)
1361{
1362 struct pci_dev *pdev = box->pci_dev;
1363 struct hw_perf_event *hwc = &event->hw;
1364
1365 pci_write_config_dword(pdev, ivt_uncore_irp_ctls[hwc->idx], hwc->config);
1366}
1367
1368static u64 ivt_uncore_irp_read_counter(struct intel_uncore_box *box, struct perf_event *event)
1369{
1370 struct pci_dev *pdev = box->pci_dev;
1371 struct hw_perf_event *hwc = &event->hw;
1372 u64 count = 0;
1373
1374 pci_read_config_dword(pdev, ivt_uncore_irp_ctrs[hwc->idx], (u32 *)&count);
1375 pci_read_config_dword(pdev, ivt_uncore_irp_ctrs[hwc->idx] + 4, (u32 *)&count + 1);
1376
1377 return count;
1378}
1379
1380static struct intel_uncore_ops ivt_uncore_irp_ops = {
1381 .init_box = ivt_uncore_pci_init_box,
1382 .disable_box = snbep_uncore_pci_disable_box,
1383 .enable_box = snbep_uncore_pci_enable_box,
1384 .disable_event = ivt_uncore_irp_disable_event,
1385 .enable_event = ivt_uncore_irp_enable_event,
1386 .read_counter = ivt_uncore_irp_read_counter,
1387};
1388
1389static struct intel_uncore_type ivt_uncore_irp = {
1390 .name = "irp",
1391 .num_counters = 4,
1392 .num_boxes = 1,
1393 .perf_ctr_bits = 48,
1394 .event_mask = IVT_PMON_RAW_EVENT_MASK,
1395 .box_ctl = SNBEP_PCI_PMON_BOX_CTL,
1396 .ops = &ivt_uncore_irp_ops,
1397 .format_group = &ivt_uncore_format_group,
1398};
1399
1400static struct intel_uncore_ops ivt_uncore_qpi_ops = {
1401 .init_box = ivt_uncore_pci_init_box,
1402 .disable_box = snbep_uncore_pci_disable_box,
1403 .enable_box = snbep_uncore_pci_enable_box,
1404 .disable_event = snbep_uncore_pci_disable_event,
1405 .enable_event = snbep_qpi_enable_event,
1406 .read_counter = snbep_uncore_pci_read_counter,
1407 .hw_config = snbep_qpi_hw_config,
1408 .get_constraint = uncore_get_constraint,
1409 .put_constraint = uncore_put_constraint,
1410};
1411
1315static struct intel_uncore_type ivt_uncore_qpi = { 1412static struct intel_uncore_type ivt_uncore_qpi = {
1316 .name = "qpi", 1413 .name = "qpi",
1317 .num_counters = 4, 1414 .num_counters = 4,
1318 .num_boxes = 3, 1415 .num_boxes = 3,
1319 .perf_ctr_bits = 48, 1416 .perf_ctr_bits = 48,
1320 .perf_ctr = SNBEP_PCI_PMON_CTR0, 1417 .perf_ctr = SNBEP_PCI_PMON_CTR0,
1321 .event_ctl = SNBEP_PCI_PMON_CTL0, 1418 .event_ctl = SNBEP_PCI_PMON_CTL0,
1322 .event_mask = IVT_QPI_PCI_PMON_RAW_EVENT_MASK, 1419 .event_mask = IVT_QPI_PCI_PMON_RAW_EVENT_MASK,
1323 .box_ctl = SNBEP_PCI_PMON_BOX_CTL, 1420 .box_ctl = SNBEP_PCI_PMON_BOX_CTL,
1324 .ops = &ivt_uncore_pci_ops, 1421 .num_shared_regs = 1,
1325 .format_group = &ivt_uncore_qpi_format_group, 1422 .ops = &ivt_uncore_qpi_ops,
1423 .format_group = &ivt_uncore_qpi_format_group,
1326}; 1424};
1327 1425
1328static struct intel_uncore_type ivt_uncore_r2pcie = { 1426static struct intel_uncore_type ivt_uncore_r2pcie = {
@@ -1346,6 +1444,7 @@ static struct intel_uncore_type ivt_uncore_r3qpi = {
1346enum { 1444enum {
1347 IVT_PCI_UNCORE_HA, 1445 IVT_PCI_UNCORE_HA,
1348 IVT_PCI_UNCORE_IMC, 1446 IVT_PCI_UNCORE_IMC,
1447 IVT_PCI_UNCORE_IRP,
1349 IVT_PCI_UNCORE_QPI, 1448 IVT_PCI_UNCORE_QPI,
1350 IVT_PCI_UNCORE_R2PCIE, 1449 IVT_PCI_UNCORE_R2PCIE,
1351 IVT_PCI_UNCORE_R3QPI, 1450 IVT_PCI_UNCORE_R3QPI,
@@ -1354,6 +1453,7 @@ enum {
1354static struct intel_uncore_type *ivt_pci_uncores[] = { 1453static struct intel_uncore_type *ivt_pci_uncores[] = {
1355 [IVT_PCI_UNCORE_HA] = &ivt_uncore_ha, 1454 [IVT_PCI_UNCORE_HA] = &ivt_uncore_ha,
1356 [IVT_PCI_UNCORE_IMC] = &ivt_uncore_imc, 1455 [IVT_PCI_UNCORE_IMC] = &ivt_uncore_imc,
1456 [IVT_PCI_UNCORE_IRP] = &ivt_uncore_irp,
1357 [IVT_PCI_UNCORE_QPI] = &ivt_uncore_qpi, 1457 [IVT_PCI_UNCORE_QPI] = &ivt_uncore_qpi,
1358 [IVT_PCI_UNCORE_R2PCIE] = &ivt_uncore_r2pcie, 1458 [IVT_PCI_UNCORE_R2PCIE] = &ivt_uncore_r2pcie,
1359 [IVT_PCI_UNCORE_R3QPI] = &ivt_uncore_r3qpi, 1459 [IVT_PCI_UNCORE_R3QPI] = &ivt_uncore_r3qpi,
@@ -1401,6 +1501,10 @@ static DEFINE_PCI_DEVICE_TABLE(ivt_uncore_pci_ids) = {
1401 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xef1), 1501 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xef1),
1402 .driver_data = UNCORE_PCI_DEV_DATA(IVT_PCI_UNCORE_IMC, 7), 1502 .driver_data = UNCORE_PCI_DEV_DATA(IVT_PCI_UNCORE_IMC, 7),
1403 }, 1503 },
1504 { /* IRP */
1505 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe39),
1506 .driver_data = UNCORE_PCI_DEV_DATA(IVT_PCI_UNCORE_IRP, 0),
1507 },
1404 { /* QPI0 Port 0 */ 1508 { /* QPI0 Port 0 */
1405 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe32), 1509 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe32),
1406 .driver_data = UNCORE_PCI_DEV_DATA(IVT_PCI_UNCORE_QPI, 0), 1510 .driver_data = UNCORE_PCI_DEV_DATA(IVT_PCI_UNCORE_QPI, 0),
@@ -1429,6 +1533,16 @@ static DEFINE_PCI_DEVICE_TABLE(ivt_uncore_pci_ids) = {
1429 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe3e), 1533 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe3e),
1430 .driver_data = UNCORE_PCI_DEV_DATA(IVT_PCI_UNCORE_R3QPI, 2), 1534 .driver_data = UNCORE_PCI_DEV_DATA(IVT_PCI_UNCORE_R3QPI, 2),
1431 }, 1535 },
1536 { /* QPI Port 0 filter */
1537 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe86),
1538 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
1539 SNBEP_PCI_QPI_PORT0_FILTER),
1540 },
1541 { /* QPI Port 0 filter */
1542 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe96),
1543 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
1544 SNBEP_PCI_QPI_PORT1_FILTER),
1545 },
1432 { /* end: all zeroes */ } 1546 { /* end: all zeroes */ }
1433}; 1547};
1434 1548
@@ -2706,14 +2820,14 @@ static void uncore_pmu_init_hrtimer(struct intel_uncore_box *box)
2706 box->hrtimer.function = uncore_pmu_hrtimer; 2820 box->hrtimer.function = uncore_pmu_hrtimer;
2707} 2821}
2708 2822
2709struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type, int cpu) 2823static struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type, int node)
2710{ 2824{
2711 struct intel_uncore_box *box; 2825 struct intel_uncore_box *box;
2712 int i, size; 2826 int i, size;
2713 2827
2714 size = sizeof(*box) + type->num_shared_regs * sizeof(struct intel_uncore_extra_reg); 2828 size = sizeof(*box) + type->num_shared_regs * sizeof(struct intel_uncore_extra_reg);
2715 2829
2716 box = kzalloc_node(size, GFP_KERNEL, cpu_to_node(cpu)); 2830 box = kzalloc_node(size, GFP_KERNEL, node);
2717 if (!box) 2831 if (!box)
2718 return NULL; 2832 return NULL;
2719 2833
@@ -3031,7 +3145,7 @@ static int uncore_validate_group(struct intel_uncore_pmu *pmu,
3031 struct intel_uncore_box *fake_box; 3145 struct intel_uncore_box *fake_box;
3032 int ret = -EINVAL, n; 3146 int ret = -EINVAL, n;
3033 3147
3034 fake_box = uncore_alloc_box(pmu->type, smp_processor_id()); 3148 fake_box = uncore_alloc_box(pmu->type, NUMA_NO_NODE);
3035 if (!fake_box) 3149 if (!fake_box)
3036 return -ENOMEM; 3150 return -ENOMEM;
3037 3151
@@ -3294,7 +3408,7 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id
3294 } 3408 }
3295 3409
3296 type = pci_uncores[UNCORE_PCI_DEV_TYPE(id->driver_data)]; 3410 type = pci_uncores[UNCORE_PCI_DEV_TYPE(id->driver_data)];
3297 box = uncore_alloc_box(type, 0); 3411 box = uncore_alloc_box(type, NUMA_NO_NODE);
3298 if (!box) 3412 if (!box)
3299 return -ENOMEM; 3413 return -ENOMEM;
3300 3414
@@ -3499,7 +3613,7 @@ static int uncore_cpu_prepare(int cpu, int phys_id)
3499 if (pmu->func_id < 0) 3613 if (pmu->func_id < 0)
3500 pmu->func_id = j; 3614 pmu->func_id = j;
3501 3615
3502 box = uncore_alloc_box(type, cpu); 3616 box = uncore_alloc_box(type, cpu_to_node(cpu));
3503 if (!box) 3617 if (!box)
3504 return -ENOMEM; 3618 return -ENOMEM;
3505 3619
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index aee6317b902f..06fe3ed8b851 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -11,15 +11,12 @@ static void show_cpuinfo_core(struct seq_file *m, struct cpuinfo_x86 *c,
11 unsigned int cpu) 11 unsigned int cpu)
12{ 12{
13#ifdef CONFIG_SMP 13#ifdef CONFIG_SMP
14 if (c->x86_max_cores * smp_num_siblings > 1) { 14 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
15 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); 15 seq_printf(m, "siblings\t: %d\n", cpumask_weight(cpu_core_mask(cpu)));
16 seq_printf(m, "siblings\t: %d\n", 16 seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id);
17 cpumask_weight(cpu_core_mask(cpu))); 17 seq_printf(m, "cpu cores\t: %d\n", c->booted_cores);
18 seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); 18 seq_printf(m, "apicid\t\t: %d\n", c->apicid);
19 seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); 19 seq_printf(m, "initial apicid\t: %d\n", c->initial_apicid);
20 seq_printf(m, "apicid\t\t: %d\n", c->apicid);
21 seq_printf(m, "initial apicid\t: %d\n", c->initial_apicid);
22 }
23#endif 20#endif
24} 21}
25 22
diff --git a/arch/x86/kernel/cpu/umc.c b/arch/x86/kernel/cpu/umc.c
index 202759a14121..75c5ad5d35cc 100644
--- a/arch/x86/kernel/cpu/umc.c
+++ b/arch/x86/kernel/cpu/umc.c
@@ -11,8 +11,8 @@
11static const struct cpu_dev umc_cpu_dev = { 11static const struct cpu_dev umc_cpu_dev = {
12 .c_vendor = "UMC", 12 .c_vendor = "UMC",
13 .c_ident = { "UMC UMC UMC" }, 13 .c_ident = { "UMC UMC UMC" },
14 .c_models = { 14 .legacy_models = {
15 { .vendor = X86_VENDOR_UMC, .family = 4, .model_names = 15 { .family = 4, .model_names =
16 { 16 {
17 [1] = "U5D", 17 [1] = "U5D",
18 [2] = "U5S", 18 [2] = "U5S",
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index e0e0841eef45..18677a90d6a3 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -127,12 +127,12 @@ void native_machine_crash_shutdown(struct pt_regs *regs)
127 cpu_emergency_vmxoff(); 127 cpu_emergency_vmxoff();
128 cpu_emergency_svm_disable(); 128 cpu_emergency_svm_disable();
129 129
130 lapic_shutdown();
131#ifdef CONFIG_X86_IO_APIC 130#ifdef CONFIG_X86_IO_APIC
132 /* Prevent crash_kexec() from deadlocking on ioapic_lock. */ 131 /* Prevent crash_kexec() from deadlocking on ioapic_lock. */
133 ioapic_zap_locks(); 132 ioapic_zap_locks();
134 disable_IO_APIC(); 133 disable_IO_APIC();
135#endif 134#endif
135 lapic_shutdown();
136#ifdef CONFIG_HPET_TIMER 136#ifdef CONFIG_HPET_TIMER
137 hpet_disable(); 137 hpet_disable();
138#endif 138#endif
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index 376dc7873447..d35078ea1446 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -20,22 +20,13 @@
20#include <asm/hpet.h> 20#include <asm/hpet.h>
21#include <asm/apic.h> 21#include <asm/apic.h>
22#include <asm/pci_x86.h> 22#include <asm/pci_x86.h>
23#include <asm/setup.h>
23 24
24__initdata u64 initial_dtb; 25__initdata u64 initial_dtb;
25char __initdata cmd_line[COMMAND_LINE_SIZE]; 26char __initdata cmd_line[COMMAND_LINE_SIZE];
26 27
27int __initdata of_ioapic; 28int __initdata of_ioapic;
28 29
29unsigned long pci_address_to_pio(phys_addr_t address)
30{
31 /*
32 * The ioport address can be directly used by inX / outX
33 */
34 BUG_ON(address >= (1 << 16));
35 return (unsigned long)address;
36}
37EXPORT_SYMBOL_GPL(pci_address_to_pio);
38
39void __init early_init_dt_scan_chosen_arch(unsigned long node) 30void __init early_init_dt_scan_chosen_arch(unsigned long node)
40{ 31{
41 BUG(); 32 BUG();
@@ -51,15 +42,6 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
51 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)); 42 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS));
52} 43}
53 44
54#ifdef CONFIG_BLK_DEV_INITRD
55void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
56{
57 initrd_start = (unsigned long)__va(start);
58 initrd_end = (unsigned long)__va(end);
59 initrd_below_start_ok = 1;
60}
61#endif
62
63void __init add_dtb(u64 data) 45void __init add_dtb(u64 data)
64{ 46{
65 initial_dtb = data + offsetof(struct setup_data, data); 47 initial_dtb = data + offsetof(struct setup_data, data);
@@ -105,7 +87,6 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
105 87
106static int x86_of_pci_irq_enable(struct pci_dev *dev) 88static int x86_of_pci_irq_enable(struct pci_dev *dev)
107{ 89{
108 struct of_irq oirq;
109 u32 virq; 90 u32 virq;
110 int ret; 91 int ret;
111 u8 pin; 92 u8 pin;
@@ -116,12 +97,7 @@ static int x86_of_pci_irq_enable(struct pci_dev *dev)
116 if (!pin) 97 if (!pin)
117 return 0; 98 return 0;
118 99
119 ret = of_irq_map_pci(dev, &oirq); 100 virq = of_irq_parse_and_map_pci(dev, 0, 0);
120 if (ret)
121 return ret;
122
123 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
124 oirq.size);
125 if (virq == 0) 101 if (virq == 0)
126 return -EINVAL; 102 return -EINVAL;
127 dev->irq = virq; 103 dev->irq = virq;
@@ -230,7 +206,7 @@ static void __init dtb_apic_setup(void)
230static void __init x86_flattree_get_config(void) 206static void __init x86_flattree_get_config(void)
231{ 207{
232 u32 size, map_len; 208 u32 size, map_len;
233 void *new_dtb; 209 struct boot_param_header *dt;
234 210
235 if (!initial_dtb) 211 if (!initial_dtb)
236 return; 212 return;
@@ -238,24 +214,17 @@ static void __init x86_flattree_get_config(void)
238 map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), 214 map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK),
239 (u64)sizeof(struct boot_param_header)); 215 (u64)sizeof(struct boot_param_header));
240 216
241 initial_boot_params = early_memremap(initial_dtb, map_len); 217 dt = early_memremap(initial_dtb, map_len);
242 size = be32_to_cpu(initial_boot_params->totalsize); 218 size = be32_to_cpu(dt->totalsize);
243 if (map_len < size) { 219 if (map_len < size) {
244 early_iounmap(initial_boot_params, map_len); 220 early_iounmap(dt, map_len);
245 initial_boot_params = early_memremap(initial_dtb, size); 221 dt = early_memremap(initial_dtb, size);
246 map_len = size; 222 map_len = size;
247 } 223 }
248 224
249 new_dtb = alloc_bootmem(size); 225 initial_boot_params = dt;
250 memcpy(new_dtb, initial_boot_params, size); 226 unflatten_and_copy_device_tree();
251 early_iounmap(initial_boot_params, map_len); 227 early_iounmap(dt, map_len);
252
253 initial_boot_params = new_dtb;
254
255 /* root level address cells */
256 of_scan_flat_dt(early_init_dt_scan_root, NULL);
257
258 unflatten_device_tree();
259} 228}
260#else 229#else
261static inline void x86_flattree_get_config(void) { } 230static inline void x86_flattree_get_config(void) { }
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index deb6421c9e69..d9c12d3022a7 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -25,12 +25,17 @@ unsigned int code_bytes = 64;
25int kstack_depth_to_print = 3 * STACKSLOTS_PER_LINE; 25int kstack_depth_to_print = 3 * STACKSLOTS_PER_LINE;
26static int die_counter; 26static int die_counter;
27 27
28void printk_address(unsigned long address, int reliable) 28static void printk_stack_address(unsigned long address, int reliable)
29{ 29{
30 pr_cont(" [<%p>] %s%pB\n", 30 pr_cont(" [<%p>] %s%pB\n",
31 (void *)address, reliable ? "" : "? ", (void *)address); 31 (void *)address, reliable ? "" : "? ", (void *)address);
32} 32}
33 33
34void printk_address(unsigned long address)
35{
36 pr_cont(" [<%p>] %pS\n", (void *)address, (void *)address);
37}
38
34#ifdef CONFIG_FUNCTION_GRAPH_TRACER 39#ifdef CONFIG_FUNCTION_GRAPH_TRACER
35static void 40static void
36print_ftrace_graph_addr(unsigned long addr, void *data, 41print_ftrace_graph_addr(unsigned long addr, void *data,
@@ -151,7 +156,7 @@ static void print_trace_address(void *data, unsigned long addr, int reliable)
151{ 156{
152 touch_nmi_watchdog(); 157 touch_nmi_watchdog();
153 printk(data); 158 printk(data);
154 printk_address(addr, reliable); 159 printk_stack_address(addr, reliable);
155} 160}
156 161
157static const struct stacktrace_ops print_trace_ops = { 162static const struct stacktrace_ops print_trace_ops = {
@@ -281,7 +286,7 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
281#else 286#else
282 /* Executive summary in case the oops scrolled away */ 287 /* Executive summary in case the oops scrolled away */
283 printk(KERN_ALERT "RIP "); 288 printk(KERN_ALERT "RIP ");
284 printk_address(regs->ip, 1); 289 printk_address(regs->ip);
285 printk(" RSP <%016lx>\n", regs->sp); 290 printk(" RSP <%016lx>\n", regs->sp);
286#endif 291#endif
287 return 0; 292 return 0;
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index b3cd3ebae077..96f958d8cd45 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -313,6 +313,16 @@ static size_t __init gen6_stolen_size(int num, int slot, int func)
313 return gmch_ctrl << 25; /* 32 MB units */ 313 return gmch_ctrl << 25; /* 32 MB units */
314} 314}
315 315
316static inline size_t gen8_stolen_size(int num, int slot, int func)
317{
318 u16 gmch_ctrl;
319
320 gmch_ctrl = read_pci_config_16(num, slot, func, SNB_GMCH_CTRL);
321 gmch_ctrl >>= BDW_GMCH_GMS_SHIFT;
322 gmch_ctrl &= BDW_GMCH_GMS_MASK;
323 return gmch_ctrl << 25; /* 32 MB units */
324}
325
316typedef size_t (*stolen_size_fn)(int num, int slot, int func); 326typedef size_t (*stolen_size_fn)(int num, int slot, int func);
317 327
318static struct pci_device_id intel_stolen_ids[] __initdata = { 328static struct pci_device_id intel_stolen_ids[] __initdata = {
@@ -336,6 +346,8 @@ static struct pci_device_id intel_stolen_ids[] __initdata = {
336 INTEL_IVB_D_IDS(gen6_stolen_size), 346 INTEL_IVB_D_IDS(gen6_stolen_size),
337 INTEL_HSW_D_IDS(gen6_stolen_size), 347 INTEL_HSW_D_IDS(gen6_stolen_size),
338 INTEL_HSW_M_IDS(gen6_stolen_size), 348 INTEL_HSW_M_IDS(gen6_stolen_size),
349 INTEL_BDW_M_IDS(gen8_stolen_size),
350 INTEL_BDW_D_IDS(gen8_stolen_size)
339}; 351};
340 352
341static void __init intel_graphics_stolen(int num, int slot, int func) 353static void __init intel_graphics_stolen(int num, int slot, int func)
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index d15f575a861b..01d1c187c9f9 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -14,9 +14,11 @@
14#include <xen/hvc-console.h> 14#include <xen/hvc-console.h>
15#include <asm/pci-direct.h> 15#include <asm/pci-direct.h>
16#include <asm/fixmap.h> 16#include <asm/fixmap.h>
17#include <asm/mrst.h> 17#include <asm/intel-mid.h>
18#include <asm/pgtable.h> 18#include <asm/pgtable.h>
19#include <linux/usb/ehci_def.h> 19#include <linux/usb/ehci_def.h>
20#include <linux/efi.h>
21#include <asm/efi.h>
20 22
21/* Simple VGA output */ 23/* Simple VGA output */
22#define VGABASE (__ISA_IO_base + 0xb8000) 24#define VGABASE (__ISA_IO_base + 0xb8000)
@@ -234,6 +236,11 @@ static int __init setup_early_printk(char *buf)
234 early_console_register(&early_hsu_console, keep); 236 early_console_register(&early_hsu_console, keep);
235 } 237 }
236#endif 238#endif
239#ifdef CONFIG_EARLY_PRINTK_EFI
240 if (!strncmp(buf, "efi", 3))
241 early_console_register(&early_efi_console, keep);
242#endif
243
237 buf++; 244 buf++;
238 } 245 }
239 return 0; 246 return 0;
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index f0dcb0ceb6a2..51e2988c5728 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -362,12 +362,9 @@ END(ret_from_exception)
362#ifdef CONFIG_PREEMPT 362#ifdef CONFIG_PREEMPT
363ENTRY(resume_kernel) 363ENTRY(resume_kernel)
364 DISABLE_INTERRUPTS(CLBR_ANY) 364 DISABLE_INTERRUPTS(CLBR_ANY)
365 cmpl $0,TI_preempt_count(%ebp) # non-zero preempt_count ?
366 jnz restore_all
367need_resched: 365need_resched:
368 movl TI_flags(%ebp), %ecx # need_resched set ? 366 cmpl $0,PER_CPU_VAR(__preempt_count)
369 testb $_TIF_NEED_RESCHED, %cl 367 jnz restore_all
370 jz restore_all
371 testl $X86_EFLAGS_IF,PT_EFLAGS(%esp) # interrupts off (exception path) ? 368 testl $X86_EFLAGS_IF,PT_EFLAGS(%esp) # interrupts off (exception path) ?
372 jz restore_all 369 jz restore_all
373 call preempt_schedule_irq 370 call preempt_schedule_irq
@@ -1247,6 +1244,16 @@ return_to_handler:
1247 */ 1244 */
1248 .pushsection .kprobes.text, "ax" 1245 .pushsection .kprobes.text, "ax"
1249 1246
1247#ifdef CONFIG_TRACING
1248ENTRY(trace_page_fault)
1249 RING0_EC_FRAME
1250 ASM_CLAC
1251 pushl_cfi $trace_do_page_fault
1252 jmp error_code
1253 CFI_ENDPROC
1254END(trace_page_fault)
1255#endif
1256
1250ENTRY(page_fault) 1257ENTRY(page_fault)
1251 RING0_EC_FRAME 1258 RING0_EC_FRAME
1252 ASM_CLAC 1259 ASM_CLAC
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 1b69951a81e2..e21b0785a85b 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -487,21 +487,6 @@ ENDPROC(native_usergs_sysret64)
487 TRACE_IRQS_OFF 487 TRACE_IRQS_OFF
488 .endm 488 .endm
489 489
490ENTRY(save_rest)
491 PARTIAL_FRAME 1 (REST_SKIP+8)
492 movq 5*8+16(%rsp), %r11 /* save return address */
493 movq_cfi rbx, RBX+16
494 movq_cfi rbp, RBP+16
495 movq_cfi r12, R12+16
496 movq_cfi r13, R13+16
497 movq_cfi r14, R14+16
498 movq_cfi r15, R15+16
499 movq %r11, 8(%rsp) /* return address */
500 FIXUP_TOP_OF_STACK %r11, 16
501 ret
502 CFI_ENDPROC
503END(save_rest)
504
505/* save complete stack frame */ 490/* save complete stack frame */
506 .pushsection .kprobes.text, "ax" 491 .pushsection .kprobes.text, "ax"
507ENTRY(save_paranoid) 492ENTRY(save_paranoid)
@@ -1118,10 +1103,8 @@ retint_signal:
1118 /* Returning to kernel space. Check if we need preemption */ 1103 /* Returning to kernel space. Check if we need preemption */
1119 /* rcx: threadinfo. interrupts off. */ 1104 /* rcx: threadinfo. interrupts off. */
1120ENTRY(retint_kernel) 1105ENTRY(retint_kernel)
1121 cmpl $0,TI_preempt_count(%rcx) 1106 cmpl $0,PER_CPU_VAR(__preempt_count)
1122 jnz retint_restore_args 1107 jnz retint_restore_args
1123 bt $TIF_NEED_RESCHED,TI_flags(%rcx)
1124 jnc retint_restore_args
1125 bt $9,EFLAGS-ARGOFFSET(%rsp) /* interrupts off? */ 1108 bt $9,EFLAGS-ARGOFFSET(%rsp) /* interrupts off? */
1126 jnc retint_restore_args 1109 jnc retint_restore_args
1127 call preempt_schedule_irq 1110 call preempt_schedule_irq
@@ -1295,6 +1278,17 @@ ENTRY(\sym)
1295END(\sym) 1278END(\sym)
1296.endm 1279.endm
1297 1280
1281#ifdef CONFIG_TRACING
1282.macro trace_errorentry sym do_sym
1283errorentry trace(\sym) trace(\do_sym)
1284errorentry \sym \do_sym
1285.endm
1286#else
1287.macro trace_errorentry sym do_sym
1288errorentry \sym \do_sym
1289.endm
1290#endif
1291
1298 /* error code is on the stack already */ 1292 /* error code is on the stack already */
1299.macro paranoiderrorentry sym do_sym 1293.macro paranoiderrorentry sym do_sym
1300ENTRY(\sym) 1294ENTRY(\sym)
@@ -1357,7 +1351,7 @@ bad_gs:
1357 .previous 1351 .previous
1358 1352
1359/* Call softirq on interrupt stack. Interrupts are off. */ 1353/* Call softirq on interrupt stack. Interrupts are off. */
1360ENTRY(call_softirq) 1354ENTRY(do_softirq_own_stack)
1361 CFI_STARTPROC 1355 CFI_STARTPROC
1362 pushq_cfi %rbp 1356 pushq_cfi %rbp
1363 CFI_REL_OFFSET rbp,0 1357 CFI_REL_OFFSET rbp,0
@@ -1374,7 +1368,7 @@ ENTRY(call_softirq)
1374 decl PER_CPU_VAR(irq_count) 1368 decl PER_CPU_VAR(irq_count)
1375 ret 1369 ret
1376 CFI_ENDPROC 1370 CFI_ENDPROC
1377END(call_softirq) 1371END(do_softirq_own_stack)
1378 1372
1379#ifdef CONFIG_XEN 1373#ifdef CONFIG_XEN
1380zeroentry xen_hypervisor_callback xen_do_hypervisor_callback 1374zeroentry xen_hypervisor_callback xen_do_hypervisor_callback
@@ -1497,7 +1491,7 @@ zeroentry xen_int3 do_int3
1497errorentry xen_stack_segment do_stack_segment 1491errorentry xen_stack_segment do_stack_segment
1498#endif 1492#endif
1499errorentry general_protection do_general_protection 1493errorentry general_protection do_general_protection
1500errorentry page_fault do_page_fault 1494trace_errorentry page_fault do_page_fault
1501#ifdef CONFIG_KVM_GUEST 1495#ifdef CONFIG_KVM_GUEST
1502errorentry async_page_fault do_async_page_fault 1496errorentry async_page_fault do_async_page_fault
1503#endif 1497#endif
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index 06f87bece92a..c61a14a4a310 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -35,8 +35,8 @@ asmlinkage void __init i386_start_kernel(void)
35 35
36 /* Call the subarch specific early setup function */ 36 /* Call the subarch specific early setup function */
37 switch (boot_params.hdr.hardware_subarch) { 37 switch (boot_params.hdr.hardware_subarch) {
38 case X86_SUBARCH_MRST: 38 case X86_SUBARCH_INTEL_MID:
39 x86_mrst_early_setup(); 39 x86_intel_mid_early_setup();
40 break; 40 break;
41 case X86_SUBARCH_CE4100: 41 case X86_SUBARCH_CE4100:
42 x86_ce4100_early_setup(); 42 x86_ce4100_early_setup();
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 1be8e43b669e..85126ccbdf6b 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -162,7 +162,7 @@ asmlinkage void __init x86_64_start_kernel(char * real_mode_data)
162 clear_bss(); 162 clear_bss();
163 163
164 for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) 164 for (i = 0; i < NUM_EXCEPTION_VECTORS; i++)
165 set_intr_gate(i, &early_idt_handlers[i]); 165 set_intr_gate(i, early_idt_handlers[i]);
166 load_idt((const struct desc_ptr *)&idt_descr); 166 load_idt((const struct desc_ptr *)&idt_descr);
167 167
168 copy_bootdata(__va(real_mode_data)); 168 copy_bootdata(__va(real_mode_data));
diff --git a/arch/x86/kernel/i386_ksyms_32.c b/arch/x86/kernel/i386_ksyms_32.c
index 0fa69127209a..05fd74f537d6 100644
--- a/arch/x86/kernel/i386_ksyms_32.c
+++ b/arch/x86/kernel/i386_ksyms_32.c
@@ -37,3 +37,10 @@ EXPORT_SYMBOL(strstr);
37 37
38EXPORT_SYMBOL(csum_partial); 38EXPORT_SYMBOL(csum_partial);
39EXPORT_SYMBOL(empty_zero_page); 39EXPORT_SYMBOL(empty_zero_page);
40
41#ifdef CONFIG_PREEMPT
42EXPORT_SYMBOL(___preempt_schedule);
43#ifdef CONFIG_CONTEXT_TRACKING
44EXPORT_SYMBOL(___preempt_schedule_context);
45#endif
46#endif
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 5d576ab34403..e8368c6dd2a2 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -100,7 +100,7 @@ void unlazy_fpu(struct task_struct *tsk)
100 __save_init_fpu(tsk); 100 __save_init_fpu(tsk);
101 __thread_fpu_end(tsk); 101 __thread_fpu_end(tsk);
102 } else 102 } else
103 tsk->fpu_counter = 0; 103 tsk->thread.fpu_counter = 0;
104 preempt_enable(); 104 preempt_enable();
105} 105}
106EXPORT_SYMBOL(unlazy_fpu); 106EXPORT_SYMBOL(unlazy_fpu);
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c
index 9a5c460404dc..2e977b5d61dd 100644
--- a/arch/x86/kernel/i8259.c
+++ b/arch/x86/kernel/i8259.c
@@ -312,8 +312,7 @@ static void init_8259A(int auto_eoi)
312 */ 312 */
313 outb_pic(0x11, PIC_MASTER_CMD); /* ICW1: select 8259A-1 init */ 313 outb_pic(0x11, PIC_MASTER_CMD); /* ICW1: select 8259A-1 init */
314 314
315 /* ICW2: 8259A-1 IR0-7 mapped to 0x30-0x37 on x86-64, 315 /* ICW2: 8259A-1 IR0-7 mapped to 0x30-0x37 */
316 to 0x20-0x27 on i386 */
317 outb_pic(IRQ0_VECTOR, PIC_MASTER_IMR); 316 outb_pic(IRQ0_VECTOR, PIC_MASTER_IMR);
318 317
319 /* 8259A-1 (the master) has a slave on IR2 */ 318 /* 8259A-1 (the master) has a slave on IR2 */
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 4186755f1d7c..d7fcbedc9c43 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -100,9 +100,6 @@ execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq)
100 irqctx->tinfo.task = curctx->tinfo.task; 100 irqctx->tinfo.task = curctx->tinfo.task;
101 irqctx->tinfo.previous_esp = current_stack_pointer; 101 irqctx->tinfo.previous_esp = current_stack_pointer;
102 102
103 /* Copy the preempt_count so that the [soft]irq checks work. */
104 irqctx->tinfo.preempt_count = curctx->tinfo.preempt_count;
105
106 if (unlikely(overflow)) 103 if (unlikely(overflow))
107 call_on_stack(print_stack_overflow, isp); 104 call_on_stack(print_stack_overflow, isp);
108 105
@@ -131,7 +128,6 @@ void irq_ctx_init(int cpu)
131 THREAD_SIZE_ORDER)); 128 THREAD_SIZE_ORDER));
132 memset(&irqctx->tinfo, 0, sizeof(struct thread_info)); 129 memset(&irqctx->tinfo, 0, sizeof(struct thread_info));
133 irqctx->tinfo.cpu = cpu; 130 irqctx->tinfo.cpu = cpu;
134 irqctx->tinfo.preempt_count = HARDIRQ_OFFSET;
135 irqctx->tinfo.addr_limit = MAKE_MM_SEG(0); 131 irqctx->tinfo.addr_limit = MAKE_MM_SEG(0);
136 132
137 per_cpu(hardirq_ctx, cpu) = irqctx; 133 per_cpu(hardirq_ctx, cpu) = irqctx;
@@ -149,35 +145,21 @@ void irq_ctx_init(int cpu)
149 cpu, per_cpu(hardirq_ctx, cpu), per_cpu(softirq_ctx, cpu)); 145 cpu, per_cpu(hardirq_ctx, cpu), per_cpu(softirq_ctx, cpu));
150} 146}
151 147
152asmlinkage void do_softirq(void) 148void do_softirq_own_stack(void)
153{ 149{
154 unsigned long flags;
155 struct thread_info *curctx; 150 struct thread_info *curctx;
156 union irq_ctx *irqctx; 151 union irq_ctx *irqctx;
157 u32 *isp; 152 u32 *isp;
158 153
159 if (in_interrupt()) 154 curctx = current_thread_info();
160 return; 155 irqctx = __this_cpu_read(softirq_ctx);
161 156 irqctx->tinfo.task = curctx->task;
162 local_irq_save(flags); 157 irqctx->tinfo.previous_esp = current_stack_pointer;
163
164 if (local_softirq_pending()) {
165 curctx = current_thread_info();
166 irqctx = __this_cpu_read(softirq_ctx);
167 irqctx->tinfo.task = curctx->task;
168 irqctx->tinfo.previous_esp = current_stack_pointer;
169
170 /* build the stack frame on the softirq stack */
171 isp = (u32 *) ((char *)irqctx + sizeof(*irqctx));
172 158
173 call_on_stack(__do_softirq, isp); 159 /* build the stack frame on the softirq stack */
174 /* 160 isp = (u32 *) ((char *)irqctx + sizeof(*irqctx));
175 * Shouldn't happen, we returned above if in_interrupt():
176 */
177 WARN_ON_ONCE(softirq_count());
178 }
179 161
180 local_irq_restore(flags); 162 call_on_stack(__do_softirq, isp);
181} 163}
182 164
183bool handle_irq(unsigned irq, struct pt_regs *regs) 165bool handle_irq(unsigned irq, struct pt_regs *regs)
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index d04d3ecded62..4d1c746892eb 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -87,24 +87,3 @@ bool handle_irq(unsigned irq, struct pt_regs *regs)
87 generic_handle_irq_desc(irq, desc); 87 generic_handle_irq_desc(irq, desc);
88 return true; 88 return true;
89} 89}
90
91
92extern void call_softirq(void);
93
94asmlinkage void do_softirq(void)
95{
96 __u32 pending;
97 unsigned long flags;
98
99 if (in_interrupt())
100 return;
101
102 local_irq_save(flags);
103 pending = local_softirq_pending();
104 /* Switch to interrupt stack */
105 if (pending) {
106 call_softirq();
107 WARN_ON_ONCE(softirq_count());
108 }
109 local_irq_restore(flags);
110}
diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c
index ee11b7dfbfbb..26d5a55a2736 100644
--- a/arch/x86/kernel/jump_label.c
+++ b/arch/x86/kernel/jump_label.c
@@ -42,15 +42,27 @@ static void __jump_label_transform(struct jump_entry *entry,
42 int init) 42 int init)
43{ 43{
44 union jump_code_union code; 44 union jump_code_union code;
45 const unsigned char default_nop[] = { STATIC_KEY_INIT_NOP };
45 const unsigned char *ideal_nop = ideal_nops[NOP_ATOMIC5]; 46 const unsigned char *ideal_nop = ideal_nops[NOP_ATOMIC5];
46 47
47 if (type == JUMP_LABEL_ENABLE) { 48 if (type == JUMP_LABEL_ENABLE) {
48 /* 49 if (init) {
49 * We are enabling this jump label. If it is not a nop 50 /*
50 * then something must have gone wrong. 51 * Jump label is enabled for the first time.
51 */ 52 * So we expect a default_nop...
52 if (unlikely(memcmp((void *)entry->code, ideal_nop, 5) != 0)) 53 */
53 bug_at((void *)entry->code, __LINE__); 54 if (unlikely(memcmp((void *)entry->code, default_nop, 5)
55 != 0))
56 bug_at((void *)entry->code, __LINE__);
57 } else {
58 /*
59 * ...otherwise expect an ideal_nop. Otherwise
60 * something went horribly wrong.
61 */
62 if (unlikely(memcmp((void *)entry->code, ideal_nop, 5)
63 != 0))
64 bug_at((void *)entry->code, __LINE__);
65 }
54 66
55 code.jump = 0xe9; 67 code.jump = 0xe9;
56 code.offset = entry->target - 68 code.offset = entry->target -
@@ -63,7 +75,6 @@ static void __jump_label_transform(struct jump_entry *entry,
63 * are converting the default nop to the ideal nop. 75 * are converting the default nop to the ideal nop.
64 */ 76 */
65 if (init) { 77 if (init) {
66 const unsigned char default_nop[] = { STATIC_KEY_INIT_NOP };
67 if (unlikely(memcmp((void *)entry->code, default_nop, 5) != 0)) 78 if (unlikely(memcmp((void *)entry->code, default_nop, 5) != 0))
68 bug_at((void *)entry->code, __LINE__); 79 bug_at((void *)entry->code, __LINE__);
69 } else { 80 } else {
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 697b93af02dd..6dd802c6d780 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -464,7 +464,7 @@ static struct notifier_block kvm_cpu_notifier = {
464 464
465static void __init kvm_apf_trap_init(void) 465static void __init kvm_apf_trap_init(void)
466{ 466{
467 set_intr_gate(14, &async_page_fault); 467 set_intr_gate(14, async_page_fault);
468} 468}
469 469
470void __init kvm_guest_init(void) 470void __init kvm_guest_init(void)
@@ -609,7 +609,7 @@ static struct dentry *d_kvm_debug;
609 609
610struct dentry *kvm_init_debugfs(void) 610struct dentry *kvm_init_debugfs(void)
611{ 611{
612 d_kvm_debug = debugfs_create_dir("kvm", NULL); 612 d_kvm_debug = debugfs_create_dir("kvm-guest", NULL);
613 if (!d_kvm_debug) 613 if (!d_kvm_debug)
614 printk(KERN_WARNING "Could not create 'kvm' debugfs directory\n"); 614 printk(KERN_WARNING "Could not create 'kvm' debugfs directory\n");
615 615
@@ -775,11 +775,22 @@ void __init kvm_spinlock_init(void)
775 if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT)) 775 if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT))
776 return; 776 return;
777 777
778 printk(KERN_INFO "KVM setup paravirtual spinlock\n"); 778 pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(kvm_lock_spinning);
779 pv_lock_ops.unlock_kick = kvm_unlock_kick;
780}
781
782static __init int kvm_spinlock_init_jump(void)
783{
784 if (!kvm_para_available())
785 return 0;
786 if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT))
787 return 0;
779 788
780 static_key_slow_inc(&paravirt_ticketlocks_enabled); 789 static_key_slow_inc(&paravirt_ticketlocks_enabled);
790 printk(KERN_INFO "KVM setup paravirtual spinlock\n");
781 791
782 pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(kvm_lock_spinning); 792 return 0;
783 pv_lock_ops.unlock_kick = kvm_unlock_kick;
784} 793}
794early_initcall(kvm_spinlock_init_jump);
795
785#endif /* CONFIG_PARAVIRT_SPINLOCKS */ 796#endif /* CONFIG_PARAVIRT_SPINLOCKS */
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index 1570e0741344..e6041094ff26 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -139,6 +139,7 @@ bool kvm_check_and_clear_guest_paused(void)
139 src = &hv_clock[cpu].pvti; 139 src = &hv_clock[cpu].pvti;
140 if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) { 140 if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) {
141 src->flags &= ~PVCLOCK_GUEST_STOPPED; 141 src->flags &= ~PVCLOCK_GUEST_STOPPED;
142 pvclock_touch_watchdogs();
142 ret = true; 143 ret = true;
143 } 144 }
144 145
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 7123b5df479d..c3d4cc972eca 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -216,6 +216,7 @@ int apply_microcode_amd(int cpu)
216 /* need to apply patch? */ 216 /* need to apply patch? */
217 if (rev >= mc_amd->hdr.patch_id) { 217 if (rev >= mc_amd->hdr.patch_id) {
218 c->microcode = rev; 218 c->microcode = rev;
219 uci->cpu_sig.rev = rev;
219 return 0; 220 return 0;
220 } 221 }
221 222
@@ -430,7 +431,7 @@ static enum ucode_state request_microcode_amd(int cpu, struct device *device,
430 snprintf(fw_name, sizeof(fw_name), "amd-ucode/microcode_amd_fam%.2xh.bin", c->x86); 431 snprintf(fw_name, sizeof(fw_name), "amd-ucode/microcode_amd_fam%.2xh.bin", c->x86);
431 432
432 if (request_firmware(&fw, (const char *)fw_name, device)) { 433 if (request_firmware(&fw, (const char *)fw_name, device)) {
433 pr_err("failed to load file %s\n", fw_name); 434 pr_debug("failed to load file %s\n", fw_name);
434 goto out; 435 goto out;
435 } 436 }
436 437
diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c
index 216a4d754b0c..18be189368bb 100644
--- a/arch/x86/kernel/module.c
+++ b/arch/x86/kernel/module.c
@@ -49,7 +49,7 @@ void *module_alloc(unsigned long size)
49 return NULL; 49 return NULL;
50 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, 50 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
51 GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC, 51 GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC,
52 -1, __builtin_return_address(0)); 52 NUMA_NO_NODE, __builtin_return_address(0));
53} 53}
54 54
55#ifdef CONFIG_X86_32 55#ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index 88458faea2f8..05266b5aae22 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -46,7 +46,7 @@ static struct class *msr_class;
46static loff_t msr_seek(struct file *file, loff_t offset, int orig) 46static loff_t msr_seek(struct file *file, loff_t offset, int orig)
47{ 47{
48 loff_t ret; 48 loff_t ret;
49 struct inode *inode = file->f_mapping->host; 49 struct inode *inode = file_inode(file);
50 50
51 mutex_lock(&inode->i_mutex); 51 mutex_lock(&inode->i_mutex);
52 switch (orig) { 52 switch (orig) {
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index ba77ebc2c353..6fcb49ce50a1 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -113,10 +113,10 @@ static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2
113 u64 before, delta, whole_msecs; 113 u64 before, delta, whole_msecs;
114 int remainder_ns, decimal_msecs, thishandled; 114 int remainder_ns, decimal_msecs, thishandled;
115 115
116 before = local_clock(); 116 before = sched_clock();
117 thishandled = a->handler(type, regs); 117 thishandled = a->handler(type, regs);
118 handled += thishandled; 118 handled += thishandled;
119 delta = local_clock() - before; 119 delta = sched_clock() - before;
120 trace_nmi_handler(a->handler, (int)delta, thishandled); 120 trace_nmi_handler(a->handler, (int)delta, thishandled);
121 121
122 if (delta < nmi_longest_ns) 122 if (delta < nmi_longest_ns)
diff --git a/arch/x86/kernel/preempt.S b/arch/x86/kernel/preempt.S
new file mode 100644
index 000000000000..ca7f0d58a87d
--- /dev/null
+++ b/arch/x86/kernel/preempt.S
@@ -0,0 +1,25 @@
1
2#include <linux/linkage.h>
3#include <asm/dwarf2.h>
4#include <asm/asm.h>
5#include <asm/calling.h>
6
7ENTRY(___preempt_schedule)
8 CFI_STARTPROC
9 SAVE_ALL
10 call preempt_schedule
11 RESTORE_ALL
12 ret
13 CFI_ENDPROC
14
15#ifdef CONFIG_CONTEXT_TRACKING
16
17ENTRY(___preempt_schedule_context)
18 CFI_STARTPROC
19 SAVE_ALL
20 call preempt_schedule_context
21 RESTORE_ALL
22 ret
23 CFI_ENDPROC
24
25#endif
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index c83516be1052..3fb8d95ab8b5 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -391,9 +391,9 @@ static void amd_e400_idle(void)
391 * The switch back from broadcast mode needs to be 391 * The switch back from broadcast mode needs to be
392 * called with interrupts disabled. 392 * called with interrupts disabled.
393 */ 393 */
394 local_irq_disable(); 394 local_irq_disable();
395 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu); 395 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
396 local_irq_enable(); 396 local_irq_enable();
397 } else 397 } else
398 default_idle(); 398 default_idle();
399} 399}
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 884f98f69354..6f1236c29c4b 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -153,7 +153,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
153 childregs->orig_ax = -1; 153 childregs->orig_ax = -1;
154 childregs->cs = __KERNEL_CS | get_kernel_rpl(); 154 childregs->cs = __KERNEL_CS | get_kernel_rpl();
155 childregs->flags = X86_EFLAGS_IF | X86_EFLAGS_FIXED; 155 childregs->flags = X86_EFLAGS_IF | X86_EFLAGS_FIXED;
156 p->fpu_counter = 0; 156 p->thread.fpu_counter = 0;
157 p->thread.io_bitmap_ptr = NULL; 157 p->thread.io_bitmap_ptr = NULL;
158 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps)); 158 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
159 return 0; 159 return 0;
@@ -166,7 +166,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
166 p->thread.ip = (unsigned long) ret_from_fork; 166 p->thread.ip = (unsigned long) ret_from_fork;
167 task_user_gs(p) = get_user_gs(current_pt_regs()); 167 task_user_gs(p) = get_user_gs(current_pt_regs());
168 168
169 p->fpu_counter = 0; 169 p->thread.fpu_counter = 0;
170 p->thread.io_bitmap_ptr = NULL; 170 p->thread.io_bitmap_ptr = NULL;
171 tsk = current; 171 tsk = current;
172 err = -ENOMEM; 172 err = -ENOMEM;
@@ -292,6 +292,14 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
292 set_iopl_mask(next->iopl); 292 set_iopl_mask(next->iopl);
293 293
294 /* 294 /*
295 * If it were not for PREEMPT_ACTIVE we could guarantee that the
296 * preempt_count of all tasks was equal here and this would not be
297 * needed.
298 */
299 task_thread_info(prev_p)->saved_preempt_count = this_cpu_read(__preempt_count);
300 this_cpu_write(__preempt_count, task_thread_info(next_p)->saved_preempt_count);
301
302 /*
295 * Now maybe handle debug registers and/or IO bitmaps 303 * Now maybe handle debug registers and/or IO bitmaps
296 */ 304 */
297 if (unlikely(task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV || 305 if (unlikely(task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV ||
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index bb1dc51bab05..9c0280f93d05 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -63,7 +63,7 @@ void __show_regs(struct pt_regs *regs, int all)
63 unsigned int ds, cs, es; 63 unsigned int ds, cs, es;
64 64
65 printk(KERN_DEFAULT "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); 65 printk(KERN_DEFAULT "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip);
66 printk_address(regs->ip, 1); 66 printk_address(regs->ip);
67 printk(KERN_DEFAULT "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, 67 printk(KERN_DEFAULT "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss,
68 regs->sp, regs->flags); 68 regs->sp, regs->flags);
69 printk(KERN_DEFAULT "RAX: %016lx RBX: %016lx RCX: %016lx\n", 69 printk(KERN_DEFAULT "RAX: %016lx RBX: %016lx RCX: %016lx\n",
@@ -163,7 +163,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
163 p->thread.sp = (unsigned long) childregs; 163 p->thread.sp = (unsigned long) childregs;
164 p->thread.usersp = me->thread.usersp; 164 p->thread.usersp = me->thread.usersp;
165 set_tsk_thread_flag(p, TIF_FORK); 165 set_tsk_thread_flag(p, TIF_FORK);
166 p->fpu_counter = 0; 166 p->thread.fpu_counter = 0;
167 p->thread.io_bitmap_ptr = NULL; 167 p->thread.io_bitmap_ptr = NULL;
168 168
169 savesegment(gs, p->thread.gsindex); 169 savesegment(gs, p->thread.gsindex);
@@ -363,6 +363,14 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
363 this_cpu_write(old_rsp, next->usersp); 363 this_cpu_write(old_rsp, next->usersp);
364 this_cpu_write(current_task, next_p); 364 this_cpu_write(current_task, next_p);
365 365
366 /*
367 * If it were not for PREEMPT_ACTIVE we could guarantee that the
368 * preempt_count of all tasks was equal here and this would not be
369 * needed.
370 */
371 task_thread_info(prev_p)->saved_preempt_count = this_cpu_read(__preempt_count);
372 this_cpu_write(__preempt_count, task_thread_info(next_p)->saved_preempt_count);
373
366 this_cpu_write(kernel_stack, 374 this_cpu_write(kernel_stack,
367 (unsigned long)task_stack_page(next_p) + 375 (unsigned long)task_stack_page(next_p) +
368 THREAD_SIZE - KERNEL_STACK_OFFSET); 376 THREAD_SIZE - KERNEL_STACK_OFFSET);
diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
index a16bae3f83b3..2f355d229a58 100644
--- a/arch/x86/kernel/pvclock.c
+++ b/arch/x86/kernel/pvclock.c
@@ -43,6 +43,14 @@ unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src)
43 return pv_tsc_khz; 43 return pv_tsc_khz;
44} 44}
45 45
46void pvclock_touch_watchdogs(void)
47{
48 touch_softlockup_watchdog_sync();
49 clocksource_touch_watchdog();
50 rcu_cpu_stall_reset();
51 reset_hung_task_detector();
52}
53
46static atomic64_t last_value = ATOMIC64_INIT(0); 54static atomic64_t last_value = ATOMIC64_INIT(0);
47 55
48void pvclock_resume(void) 56void pvclock_resume(void)
@@ -74,6 +82,11 @@ cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src)
74 version = __pvclock_read_cycles(src, &ret, &flags); 82 version = __pvclock_read_cycles(src, &ret, &flags);
75 } while ((src->version & 1) || version != src->version); 83 } while ((src->version & 1) || version != src->version);
76 84
85 if (unlikely((flags & PVCLOCK_GUEST_STOPPED) != 0)) {
86 src->flags &= ~PVCLOCK_GUEST_STOPPED;
87 pvclock_touch_watchdogs();
88 }
89
77 if ((valid_flags & PVCLOCK_TSC_STABLE_BIT) && 90 if ((valid_flags & PVCLOCK_TSC_STABLE_BIT) &&
78 (flags & PVCLOCK_TSC_STABLE_BIT)) 91 (flags & PVCLOCK_TSC_STABLE_BIT))
79 return ret; 92 return ret;
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 563ed91e6faa..da3c599584a3 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -61,7 +61,7 @@ static int __init set_bios_reboot(const struct dmi_system_id *d)
61 if (reboot_type != BOOT_BIOS) { 61 if (reboot_type != BOOT_BIOS) {
62 reboot_type = BOOT_BIOS; 62 reboot_type = BOOT_BIOS;
63 pr_info("%s series board detected. Selecting %s-method for reboots.\n", 63 pr_info("%s series board detected. Selecting %s-method for reboots.\n",
64 "BIOS", d->ident); 64 d->ident, "BIOS");
65 } 65 }
66 return 0; 66 return 0;
67} 67}
@@ -117,7 +117,7 @@ static int __init set_pci_reboot(const struct dmi_system_id *d)
117 if (reboot_type != BOOT_CF9) { 117 if (reboot_type != BOOT_CF9) {
118 reboot_type = BOOT_CF9; 118 reboot_type = BOOT_CF9;
119 pr_info("%s series board detected. Selecting %s-method for reboots.\n", 119 pr_info("%s series board detected. Selecting %s-method for reboots.\n",
120 "PCI", d->ident); 120 d->ident, "PCI");
121 } 121 }
122 return 0; 122 return 0;
123} 123}
@@ -127,7 +127,7 @@ static int __init set_kbd_reboot(const struct dmi_system_id *d)
127 if (reboot_type != BOOT_KBD) { 127 if (reboot_type != BOOT_KBD) {
128 reboot_type = BOOT_KBD; 128 reboot_type = BOOT_KBD;
129 pr_info("%s series board detected. Selecting %s-method for reboot.\n", 129 pr_info("%s series board detected. Selecting %s-method for reboot.\n",
130 "KBD", d->ident); 130 d->ident, "KBD");
131 } 131 }
132 return 0; 132 return 0;
133} 133}
@@ -136,228 +136,256 @@ static int __init set_kbd_reboot(const struct dmi_system_id *d)
136 * This is a single dmi_table handling all reboot quirks. 136 * This is a single dmi_table handling all reboot quirks.
137 */ 137 */
138static struct dmi_system_id __initdata reboot_dmi_table[] = { 138static struct dmi_system_id __initdata reboot_dmi_table[] = {
139 { /* Handle problems with rebooting on Dell E520's */ 139
140 .callback = set_bios_reboot, 140 /* Acer */
141 .ident = "Dell E520", 141 { /* Handle reboot issue on Acer Aspire one */
142 .callback = set_kbd_reboot,
143 .ident = "Acer Aspire One A110",
142 .matches = { 144 .matches = {
143 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 145 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
144 DMI_MATCH(DMI_PRODUCT_NAME, "Dell DM061"), 146 DMI_MATCH(DMI_PRODUCT_NAME, "AOA110"),
145 }, 147 },
146 }, 148 },
147 { /* Handle problems with rebooting on Dell 1300's */ 149
148 .callback = set_bios_reboot, 150 /* Apple */
149 .ident = "Dell PowerEdge 1300", 151 { /* Handle problems with rebooting on Apple MacBook5 */
152 .callback = set_pci_reboot,
153 .ident = "Apple MacBook5",
150 .matches = { 154 .matches = {
151 DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"), 155 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
152 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 1300/"), 156 DMI_MATCH(DMI_PRODUCT_NAME, "MacBook5"),
153 }, 157 },
154 }, 158 },
155 { /* Handle problems with rebooting on Dell 300's */ 159 { /* Handle problems with rebooting on Apple MacBookPro5 */
156 .callback = set_bios_reboot, 160 .callback = set_pci_reboot,
157 .ident = "Dell PowerEdge 300", 161 .ident = "Apple MacBookPro5",
158 .matches = { 162 .matches = {
159 DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"), 163 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
160 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 300/"), 164 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5"),
161 }, 165 },
162 }, 166 },
163 { /* Handle problems with rebooting on Dell Optiplex 745's SFF */ 167 { /* Handle problems with rebooting on Apple Macmini3,1 */
164 .callback = set_bios_reboot, 168 .callback = set_pci_reboot,
165 .ident = "Dell OptiPlex 745", 169 .ident = "Apple Macmini3,1",
166 .matches = { 170 .matches = {
167 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 171 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
168 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 745"), 172 DMI_MATCH(DMI_PRODUCT_NAME, "Macmini3,1"),
169 }, 173 },
170 }, 174 },
171 { /* Handle problems with rebooting on Dell Optiplex 745's DFF */ 175 { /* Handle problems with rebooting on the iMac9,1. */
176 .callback = set_pci_reboot,
177 .ident = "Apple iMac9,1",
178 .matches = {
179 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
180 DMI_MATCH(DMI_PRODUCT_NAME, "iMac9,1"),
181 },
182 },
183
184 /* ASUS */
185 { /* Handle problems with rebooting on ASUS P4S800 */
172 .callback = set_bios_reboot, 186 .callback = set_bios_reboot,
173 .ident = "Dell OptiPlex 745", 187 .ident = "ASUS P4S800",
174 .matches = { 188 .matches = {
175 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 189 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
176 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 745"), 190 DMI_MATCH(DMI_BOARD_NAME, "P4S800"),
177 DMI_MATCH(DMI_BOARD_NAME, "0MM599"),
178 }, 191 },
179 }, 192 },
180 { /* Handle problems with rebooting on Dell Optiplex 745 with 0KW626 */ 193
194 /* Dell */
195 { /* Handle problems with rebooting on Dell DXP061 */
181 .callback = set_bios_reboot, 196 .callback = set_bios_reboot,
182 .ident = "Dell OptiPlex 745", 197 .ident = "Dell DXP061",
183 .matches = { 198 .matches = {
184 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 199 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
185 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 745"), 200 DMI_MATCH(DMI_PRODUCT_NAME, "Dell DXP061"),
186 DMI_MATCH(DMI_BOARD_NAME, "0KW626"),
187 }, 201 },
188 }, 202 },
189 { /* Handle problems with rebooting on Dell Optiplex 330 with 0KP561 */ 203 { /* Handle problems with rebooting on Dell E520's */
190 .callback = set_bios_reboot, 204 .callback = set_bios_reboot,
191 .ident = "Dell OptiPlex 330", 205 .ident = "Dell E520",
192 .matches = { 206 .matches = {
193 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 207 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
194 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 330"), 208 DMI_MATCH(DMI_PRODUCT_NAME, "Dell DM061"),
195 DMI_MATCH(DMI_BOARD_NAME, "0KP561"),
196 }, 209 },
197 }, 210 },
198 { /* Handle problems with rebooting on Dell Optiplex 360 with 0T656F */ 211 { /* Handle problems with rebooting on the Latitude E5410. */
199 .callback = set_bios_reboot, 212 .callback = set_pci_reboot,
200 .ident = "Dell OptiPlex 360", 213 .ident = "Dell Latitude E5410",
201 .matches = { 214 .matches = {
202 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 215 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
203 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 360"), 216 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E5410"),
204 DMI_MATCH(DMI_BOARD_NAME, "0T656F"),
205 }, 217 },
206 }, 218 },
207 { /* Handle problems with rebooting on Dell OptiPlex 760 with 0G919G */ 219 { /* Handle problems with rebooting on the Latitude E5420. */
208 .callback = set_bios_reboot, 220 .callback = set_pci_reboot,
209 .ident = "Dell OptiPlex 760", 221 .ident = "Dell Latitude E5420",
210 .matches = { 222 .matches = {
211 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 223 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
212 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 760"), 224 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E5420"),
213 DMI_MATCH(DMI_BOARD_NAME, "0G919G"),
214 }, 225 },
215 }, 226 },
216 { /* Handle problems with rebooting on Dell 2400's */ 227 { /* Handle problems with rebooting on the Latitude E6320. */
217 .callback = set_bios_reboot, 228 .callback = set_pci_reboot,
218 .ident = "Dell PowerEdge 2400", 229 .ident = "Dell Latitude E6320",
219 .matches = { 230 .matches = {
220 DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"), 231 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
221 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2400"), 232 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E6320"),
222 }, 233 },
223 }, 234 },
224 { /* Handle problems with rebooting on Dell T5400's */ 235 { /* Handle problems with rebooting on the Latitude E6420. */
225 .callback = set_bios_reboot, 236 .callback = set_pci_reboot,
226 .ident = "Dell Precision T5400", 237 .ident = "Dell Latitude E6420",
227 .matches = { 238 .matches = {
228 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 239 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
229 DMI_MATCH(DMI_PRODUCT_NAME, "Precision WorkStation T5400"), 240 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E6420"),
230 }, 241 },
231 }, 242 },
232 { /* Handle problems with rebooting on Dell T7400's */ 243 { /* Handle problems with rebooting on Dell Optiplex 330 with 0KP561 */
233 .callback = set_bios_reboot, 244 .callback = set_bios_reboot,
234 .ident = "Dell Precision T7400", 245 .ident = "Dell OptiPlex 330",
235 .matches = { 246 .matches = {
236 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 247 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
237 DMI_MATCH(DMI_PRODUCT_NAME, "Precision WorkStation T7400"), 248 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 330"),
249 DMI_MATCH(DMI_BOARD_NAME, "0KP561"),
238 }, 250 },
239 }, 251 },
240 { /* Handle problems with rebooting on HP laptops */ 252 { /* Handle problems with rebooting on Dell Optiplex 360 with 0T656F */
241 .callback = set_bios_reboot, 253 .callback = set_bios_reboot,
242 .ident = "HP Compaq Laptop", 254 .ident = "Dell OptiPlex 360",
243 .matches = { 255 .matches = {
244 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 256 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
245 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq"), 257 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 360"),
258 DMI_MATCH(DMI_BOARD_NAME, "0T656F"),
246 }, 259 },
247 }, 260 },
248 { /* Handle problems with rebooting on Dell XPS710 */ 261 { /* Handle problems with rebooting on Dell Optiplex 745's SFF */
249 .callback = set_bios_reboot, 262 .callback = set_bios_reboot,
250 .ident = "Dell XPS710", 263 .ident = "Dell OptiPlex 745",
251 .matches = { 264 .matches = {
252 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 265 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
253 DMI_MATCH(DMI_PRODUCT_NAME, "Dell XPS710"), 266 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 745"),
254 }, 267 },
255 }, 268 },
256 { /* Handle problems with rebooting on Dell DXP061 */ 269 { /* Handle problems with rebooting on Dell Optiplex 745's DFF */
257 .callback = set_bios_reboot, 270 .callback = set_bios_reboot,
258 .ident = "Dell DXP061", 271 .ident = "Dell OptiPlex 745",
259 .matches = { 272 .matches = {
260 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 273 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
261 DMI_MATCH(DMI_PRODUCT_NAME, "Dell DXP061"), 274 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 745"),
275 DMI_MATCH(DMI_BOARD_NAME, "0MM599"),
262 }, 276 },
263 }, 277 },
264 { /* Handle problems with rebooting on Sony VGN-Z540N */ 278 { /* Handle problems with rebooting on Dell Optiplex 745 with 0KW626 */
265 .callback = set_bios_reboot, 279 .callback = set_bios_reboot,
266 .ident = "Sony VGN-Z540N", 280 .ident = "Dell OptiPlex 745",
267 .matches = { 281 .matches = {
268 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), 282 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
269 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-Z540N"), 283 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 745"),
284 DMI_MATCH(DMI_BOARD_NAME, "0KW626"),
270 }, 285 },
271 }, 286 },
272 { /* Handle problems with rebooting on ASUS P4S800 */ 287 { /* Handle problems with rebooting on Dell OptiPlex 760 with 0G919G */
273 .callback = set_bios_reboot, 288 .callback = set_bios_reboot,
274 .ident = "ASUS P4S800", 289 .ident = "Dell OptiPlex 760",
275 .matches = { 290 .matches = {
276 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 291 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
277 DMI_MATCH(DMI_BOARD_NAME, "P4S800"), 292 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 760"),
293 DMI_MATCH(DMI_BOARD_NAME, "0G919G"),
278 }, 294 },
279 }, 295 },
280 296 { /* Handle problems with rebooting on the OptiPlex 990. */
281 { /* Handle reboot issue on Acer Aspire one */ 297 .callback = set_pci_reboot,
282 .callback = set_kbd_reboot, 298 .ident = "Dell OptiPlex 990",
283 .ident = "Acer Aspire One A110",
284 .matches = { 299 .matches = {
285 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 300 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
286 DMI_MATCH(DMI_PRODUCT_NAME, "AOA110"), 301 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 990"),
287 }, 302 },
288 }, 303 },
289 { /* Handle problems with rebooting on Apple MacBook5 */ 304 { /* Handle problems with rebooting on Dell 300's */
290 .callback = set_pci_reboot, 305 .callback = set_bios_reboot,
291 .ident = "Apple MacBook5", 306 .ident = "Dell PowerEdge 300",
292 .matches = { 307 .matches = {
293 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), 308 DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
294 DMI_MATCH(DMI_PRODUCT_NAME, "MacBook5"), 309 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 300/"),
295 }, 310 },
296 }, 311 },
297 { /* Handle problems with rebooting on Apple MacBookPro5 */ 312 { /* Handle problems with rebooting on Dell 1300's */
298 .callback = set_pci_reboot, 313 .callback = set_bios_reboot,
299 .ident = "Apple MacBookPro5", 314 .ident = "Dell PowerEdge 1300",
300 .matches = { 315 .matches = {
301 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), 316 DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
302 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5"), 317 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 1300/"),
303 }, 318 },
304 }, 319 },
305 { /* Handle problems with rebooting on Apple Macmini3,1 */ 320 { /* Handle problems with rebooting on Dell 2400's */
306 .callback = set_pci_reboot, 321 .callback = set_bios_reboot,
307 .ident = "Apple Macmini3,1", 322 .ident = "Dell PowerEdge 2400",
308 .matches = { 323 .matches = {
309 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), 324 DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
310 DMI_MATCH(DMI_PRODUCT_NAME, "Macmini3,1"), 325 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2400"),
311 }, 326 },
312 }, 327 },
313 { /* Handle problems with rebooting on the iMac9,1. */ 328 { /* Handle problems with rebooting on the Dell PowerEdge C6100. */
314 .callback = set_pci_reboot, 329 .callback = set_pci_reboot,
315 .ident = "Apple iMac9,1", 330 .ident = "Dell PowerEdge C6100",
316 .matches = { 331 .matches = {
317 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), 332 DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
318 DMI_MATCH(DMI_PRODUCT_NAME, "iMac9,1"), 333 DMI_MATCH(DMI_PRODUCT_NAME, "C6100"),
319 }, 334 },
320 }, 335 },
321 { /* Handle problems with rebooting on the Latitude E6320. */ 336 { /* Handle problems with rebooting on the Precision M6600. */
322 .callback = set_pci_reboot, 337 .callback = set_pci_reboot,
323 .ident = "Dell Latitude E6320", 338 .ident = "Dell Precision M6600",
324 .matches = { 339 .matches = {
325 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 340 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
326 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E6320"), 341 DMI_MATCH(DMI_PRODUCT_NAME, "Precision M6600"),
327 }, 342 },
328 }, 343 },
329 { /* Handle problems with rebooting on the Latitude E5420. */ 344 { /* Handle problems with rebooting on Dell T5400's */
330 .callback = set_pci_reboot, 345 .callback = set_bios_reboot,
331 .ident = "Dell Latitude E5420", 346 .ident = "Dell Precision T5400",
332 .matches = { 347 .matches = {
333 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 348 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
334 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E5420"), 349 DMI_MATCH(DMI_PRODUCT_NAME, "Precision WorkStation T5400"),
335 }, 350 },
336 }, 351 },
337 { /* Handle problems with rebooting on the Latitude E6420. */ 352 { /* Handle problems with rebooting on Dell T7400's */
338 .callback = set_pci_reboot, 353 .callback = set_bios_reboot,
339 .ident = "Dell Latitude E6420", 354 .ident = "Dell Precision T7400",
340 .matches = { 355 .matches = {
341 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 356 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
342 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E6420"), 357 DMI_MATCH(DMI_PRODUCT_NAME, "Precision WorkStation T7400"),
343 }, 358 },
344 }, 359 },
345 { /* Handle problems with rebooting on the OptiPlex 990. */ 360 { /* Handle problems with rebooting on Dell XPS710 */
346 .callback = set_pci_reboot, 361 .callback = set_bios_reboot,
347 .ident = "Dell OptiPlex 990", 362 .ident = "Dell XPS710",
348 .matches = { 363 .matches = {
349 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 364 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
350 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 990"), 365 DMI_MATCH(DMI_PRODUCT_NAME, "Dell XPS710"),
351 }, 366 },
352 }, 367 },
353 { /* Handle problems with rebooting on the Precision M6600. */ 368
354 .callback = set_pci_reboot, 369 /* Hewlett-Packard */
355 .ident = "Dell OptiPlex 990", 370 { /* Handle problems with rebooting on HP laptops */
371 .callback = set_bios_reboot,
372 .ident = "HP Compaq Laptop",
356 .matches = { 373 .matches = {
357 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 374 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
358 DMI_MATCH(DMI_PRODUCT_NAME, "Precision M6600"), 375 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq"),
376 },
377 },
378
379 /* Sony */
380 { /* Handle problems with rebooting on Sony VGN-Z540N */
381 .callback = set_bios_reboot,
382 .ident = "Sony VGN-Z540N",
383 .matches = {
384 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
385 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-Z540N"),
359 }, 386 },
360 }, 387 },
388
361 { } 389 { }
362}; 390};
363 391
@@ -511,10 +539,13 @@ static void native_machine_emergency_restart(void)
511 539
512 case BOOT_CF9_COND: 540 case BOOT_CF9_COND:
513 if (port_cf9_safe) { 541 if (port_cf9_safe) {
514 u8 cf9 = inb(0xcf9) & ~6; 542 u8 reboot_code = reboot_mode == REBOOT_WARM ?
543 0x06 : 0x0E;
544 u8 cf9 = inb(0xcf9) & ~reboot_code;
515 outb(cf9|2, 0xcf9); /* Request hard reset */ 545 outb(cf9|2, 0xcf9); /* Request hard reset */
516 udelay(50); 546 udelay(50);
517 outb(cf9|6, 0xcf9); /* Actually do the reset */ 547 /* Actually do the reset */
548 outb(cf9|reboot_code, 0xcf9);
518 udelay(50); 549 udelay(50);
519 } 550 }
520 reboot_type = BOOT_KBD; 551 reboot_type = BOOT_KBD;
@@ -526,6 +557,10 @@ static void native_machine_emergency_restart(void)
526void native_machine_shutdown(void) 557void native_machine_shutdown(void)
527{ 558{
528 /* Stop the cpus and apics */ 559 /* Stop the cpus and apics */
560#ifdef CONFIG_X86_IO_APIC
561 disable_IO_APIC();
562#endif
563
529#ifdef CONFIG_SMP 564#ifdef CONFIG_SMP
530 /* 565 /*
531 * Stop all of the others. Also disable the local irq to 566 * Stop all of the others. Also disable the local irq to
@@ -538,10 +573,6 @@ void native_machine_shutdown(void)
538 573
539 lapic_shutdown(); 574 lapic_shutdown();
540 575
541#ifdef CONFIG_X86_IO_APIC
542 disable_IO_APIC();
543#endif
544
545#ifdef CONFIG_HPET_TIMER 576#ifdef CONFIG_HPET_TIMER
546 hpet_disable(); 577 hpet_disable();
547#endif 578#endif
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index 0aa29394ed6f..ca9622a25e95 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -12,7 +12,7 @@
12#include <asm/vsyscall.h> 12#include <asm/vsyscall.h>
13#include <asm/x86_init.h> 13#include <asm/x86_init.h>
14#include <asm/time.h> 14#include <asm/time.h>
15#include <asm/mrst.h> 15#include <asm/intel-mid.h>
16#include <asm/rtc.h> 16#include <asm/rtc.h>
17 17
18#ifdef CONFIG_X86_32 18#ifdef CONFIG_X86_32
@@ -189,9 +189,17 @@ static __init int add_rtc_cmos(void)
189 return 0; 189 return 0;
190 190
191 /* Intel MID platforms don't have ioport rtc */ 191 /* Intel MID platforms don't have ioport rtc */
192 if (mrst_identify_cpu()) 192 if (intel_mid_identify_cpu())
193 return -ENODEV; 193 return -ENODEV;
194 194
195#ifdef CONFIG_ACPI
196 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC) {
197 /* This warning can likely go away again in a year or two. */
198 pr_info("ACPI: not registering RTC platform device\n");
199 return -ENODEV;
200 }
201#endif
202
195 platform_device_register(&rtc_device); 203 platform_device_register(&rtc_device);
196 dev_info(&rtc_device.dev, 204 dev_info(&rtc_device.dev,
197 "registered platform RTC device (no PNP device found)\n"); 205 "registered platform RTC device (no PNP device found)\n");
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index f0de6294b955..cb233bc9dee3 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -993,6 +993,7 @@ void __init setup_arch(char **cmdline_p)
993 efi_init(); 993 efi_init();
994 994
995 dmi_scan_machine(); 995 dmi_scan_machine();
996 dmi_memdev_walk();
996 dmi_set_dump_stack_arch_desc(); 997 dmi_set_dump_stack_arch_desc();
997 998
998 /* 999 /*
@@ -1120,8 +1121,6 @@ void __init setup_arch(char **cmdline_p)
1120 acpi_initrd_override((void *)initrd_start, initrd_end - initrd_start); 1121 acpi_initrd_override((void *)initrd_start, initrd_end - initrd_start);
1121#endif 1122#endif
1122 1123
1123 reserve_crashkernel();
1124
1125 vsmp_init(); 1124 vsmp_init();
1126 1125
1127 io_delay_init(); 1126 io_delay_init();
@@ -1134,6 +1133,13 @@ void __init setup_arch(char **cmdline_p)
1134 early_acpi_boot_init(); 1133 early_acpi_boot_init();
1135 1134
1136 initmem_init(); 1135 initmem_init();
1136
1137 /*
1138 * Reserve memory for crash kernel after SRAT is parsed so that it
1139 * won't consume hotpluggable memory.
1140 */
1141 reserve_crashkernel();
1142
1137 memblock_find_dma_reserve(); 1143 memblock_find_dma_reserve();
1138 1144
1139#ifdef CONFIG_KVM_GUEST 1145#ifdef CONFIG_KVM_GUEST
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index aecc98a93d1b..85dc05a3aa02 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -73,36 +73,14 @@
73#include <asm/setup.h> 73#include <asm/setup.h>
74#include <asm/uv/uv.h> 74#include <asm/uv/uv.h>
75#include <linux/mc146818rtc.h> 75#include <linux/mc146818rtc.h>
76
77#include <asm/smpboot_hooks.h> 76#include <asm/smpboot_hooks.h>
78#include <asm/i8259.h> 77#include <asm/i8259.h>
79
80#include <asm/realmode.h> 78#include <asm/realmode.h>
79#include <asm/misc.h>
81 80
82/* State of each CPU */ 81/* State of each CPU */
83DEFINE_PER_CPU(int, cpu_state) = { 0 }; 82DEFINE_PER_CPU(int, cpu_state) = { 0 };
84 83
85#ifdef CONFIG_HOTPLUG_CPU
86/*
87 * We need this for trampoline_base protection from concurrent accesses when
88 * off- and onlining cores wildly.
89 */
90static DEFINE_MUTEX(x86_cpu_hotplug_driver_mutex);
91
92void cpu_hotplug_driver_lock(void)
93{
94 mutex_lock(&x86_cpu_hotplug_driver_mutex);
95}
96
97void cpu_hotplug_driver_unlock(void)
98{
99 mutex_unlock(&x86_cpu_hotplug_driver_mutex);
100}
101
102ssize_t arch_cpu_probe(const char *buf, size_t count) { return -1; }
103ssize_t arch_cpu_release(const char *buf, size_t count) { return -1; }
104#endif
105
106/* Number of siblings per CPU package */ 84/* Number of siblings per CPU package */
107int smp_num_siblings = 1; 85int smp_num_siblings = 1;
108EXPORT_SYMBOL(smp_num_siblings); 86EXPORT_SYMBOL(smp_num_siblings);
@@ -648,21 +626,46 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
648 return (send_status | accept_status); 626 return (send_status | accept_status);
649} 627}
650 628
629void smp_announce(void)
630{
631 int num_nodes = num_online_nodes();
632
633 printk(KERN_INFO "x86: Booted up %d node%s, %d CPUs\n",
634 num_nodes, (num_nodes > 1 ? "s" : ""), num_online_cpus());
635}
636
651/* reduce the number of lines printed when booting a large cpu count system */ 637/* reduce the number of lines printed when booting a large cpu count system */
652static void announce_cpu(int cpu, int apicid) 638static void announce_cpu(int cpu, int apicid)
653{ 639{
654 static int current_node = -1; 640 static int current_node = -1;
655 int node = early_cpu_to_node(cpu); 641 int node = early_cpu_to_node(cpu);
642 static int width, node_width;
643
644 if (!width)
645 width = num_digits(num_possible_cpus()) + 1; /* + '#' sign */
646
647 if (!node_width)
648 node_width = num_digits(num_possible_nodes()) + 1; /* + '#' */
649
650 if (cpu == 1)
651 printk(KERN_INFO "x86: Booting SMP configuration:\n");
656 652
657 if (system_state == SYSTEM_BOOTING) { 653 if (system_state == SYSTEM_BOOTING) {
658 if (node != current_node) { 654 if (node != current_node) {
659 if (current_node > (-1)) 655 if (current_node > (-1))
660 pr_cont(" OK\n"); 656 pr_cont("\n");
661 current_node = node; 657 current_node = node;
662 pr_info("Booting Node %3d, Processors ", node); 658
659 printk(KERN_INFO ".... node %*s#%d, CPUs: ",
660 node_width - num_digits(node), " ", node);
663 } 661 }
664 pr_cont(" #%d%s", cpu, cpu == (nr_cpu_ids - 1) ? " OK\n" : ""); 662
665 return; 663 /* Add padding for the BSP */
664 if (cpu == 1)
665 pr_cont("%*s", width + 1, " ");
666
667 pr_cont("%*s#%d", width - num_digits(cpu), " ", cpu);
668
666 } else 669 } else
667 pr_info("Booting Node %d Processor %d APIC 0x%x\n", 670 pr_info("Booting Node %d Processor %d APIC 0x%x\n",
668 node, cpu, apicid); 671 node, cpu, apicid);
diff --git a/arch/x86/kernel/sysfb_simplefb.c b/arch/x86/kernel/sysfb_simplefb.c
index 22513e96b012..86179d409893 100644
--- a/arch/x86/kernel/sysfb_simplefb.c
+++ b/arch/x86/kernel/sysfb_simplefb.c
@@ -72,14 +72,14 @@ __init int create_simplefb(const struct screen_info *si,
72 * the part that is occupied by the framebuffer */ 72 * the part that is occupied by the framebuffer */
73 len = mode->height * mode->stride; 73 len = mode->height * mode->stride;
74 len = PAGE_ALIGN(len); 74 len = PAGE_ALIGN(len);
75 if (len > si->lfb_size << 16) { 75 if (len > (u64)si->lfb_size << 16) {
76 printk(KERN_WARNING "sysfb: VRAM smaller than advertised\n"); 76 printk(KERN_WARNING "sysfb: VRAM smaller than advertised\n");
77 return -EINVAL; 77 return -EINVAL;
78 } 78 }
79 79
80 /* setup IORESOURCE_MEM as framebuffer memory */ 80 /* setup IORESOURCE_MEM as framebuffer memory */
81 memset(&res, 0, sizeof(res)); 81 memset(&res, 0, sizeof(res));
82 res.flags = IORESOURCE_MEM; 82 res.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
83 res.name = simplefb_resname; 83 res.name = simplefb_resname;
84 res.start = si->lfb_base; 84 res.start = si->lfb_base;
85 res.end = si->lfb_base + len - 1; 85 res.end = si->lfb_base + len - 1;
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index 6e60b5fe2244..649b010da00b 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -65,29 +65,32 @@ int __ref _debug_hotplug_cpu(int cpu, int action)
65 if (!cpu_is_hotpluggable(cpu)) 65 if (!cpu_is_hotpluggable(cpu))
66 return -EINVAL; 66 return -EINVAL;
67 67
68 cpu_hotplug_driver_lock(); 68 lock_device_hotplug();
69 69
70 switch (action) { 70 switch (action) {
71 case 0: 71 case 0:
72 ret = cpu_down(cpu); 72 ret = cpu_down(cpu);
73 if (!ret) { 73 if (!ret) {
74 pr_info("CPU %u is now offline\n", cpu); 74 pr_info("CPU %u is now offline\n", cpu);
75 dev->offline = true;
75 kobject_uevent(&dev->kobj, KOBJ_OFFLINE); 76 kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
76 } else 77 } else
77 pr_debug("Can't offline CPU%d.\n", cpu); 78 pr_debug("Can't offline CPU%d.\n", cpu);
78 break; 79 break;
79 case 1: 80 case 1:
80 ret = cpu_up(cpu); 81 ret = cpu_up(cpu);
81 if (!ret) 82 if (!ret) {
83 dev->offline = false;
82 kobject_uevent(&dev->kobj, KOBJ_ONLINE); 84 kobject_uevent(&dev->kobj, KOBJ_ONLINE);
83 else 85 } else {
84 pr_debug("Can't online CPU%d.\n", cpu); 86 pr_debug("Can't online CPU%d.\n", cpu);
87 }
85 break; 88 break;
86 default: 89 default:
87 ret = -EINVAL; 90 ret = -EINVAL;
88 } 91 }
89 92
90 cpu_hotplug_driver_unlock(); 93 unlock_device_hotplug();
91 94
92 return ret; 95 return ret;
93} 96}
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 8c8093b146ca..b857ed890b4c 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -88,7 +88,7 @@ static inline void conditional_sti(struct pt_regs *regs)
88 88
89static inline void preempt_conditional_sti(struct pt_regs *regs) 89static inline void preempt_conditional_sti(struct pt_regs *regs)
90{ 90{
91 inc_preempt_count(); 91 preempt_count_inc();
92 if (regs->flags & X86_EFLAGS_IF) 92 if (regs->flags & X86_EFLAGS_IF)
93 local_irq_enable(); 93 local_irq_enable();
94} 94}
@@ -103,7 +103,7 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
103{ 103{
104 if (regs->flags & X86_EFLAGS_IF) 104 if (regs->flags & X86_EFLAGS_IF)
105 local_irq_disable(); 105 local_irq_disable();
106 dec_preempt_count(); 106 preempt_count_dec();
107} 107}
108 108
109static int __kprobes 109static int __kprobes
@@ -653,7 +653,7 @@ void math_state_restore(void)
653 return; 653 return;
654 } 654 }
655 655
656 tsk->fpu_counter++; 656 tsk->thread.fpu_counter++;
657} 657}
658EXPORT_SYMBOL_GPL(math_state_restore); 658EXPORT_SYMBOL_GPL(math_state_restore);
659 659
@@ -713,7 +713,7 @@ void __init early_trap_init(void)
713 /* int3 can be called from all */ 713 /* int3 can be called from all */
714 set_system_intr_gate_ist(X86_TRAP_BP, &int3, DEBUG_STACK); 714 set_system_intr_gate_ist(X86_TRAP_BP, &int3, DEBUG_STACK);
715#ifdef CONFIG_X86_32 715#ifdef CONFIG_X86_32
716 set_intr_gate(X86_TRAP_PF, &page_fault); 716 set_intr_gate(X86_TRAP_PF, page_fault);
717#endif 717#endif
718 load_idt(&idt_descr); 718 load_idt(&idt_descr);
719} 719}
@@ -721,7 +721,7 @@ void __init early_trap_init(void)
721void __init early_trap_pf_init(void) 721void __init early_trap_pf_init(void)
722{ 722{
723#ifdef CONFIG_X86_64 723#ifdef CONFIG_X86_64
724 set_intr_gate(X86_TRAP_PF, &page_fault); 724 set_intr_gate(X86_TRAP_PF, page_fault);
725#endif 725#endif
726} 726}
727 727
@@ -737,30 +737,30 @@ void __init trap_init(void)
737 early_iounmap(p, 4); 737 early_iounmap(p, 4);
738#endif 738#endif
739 739
740 set_intr_gate(X86_TRAP_DE, &divide_error); 740 set_intr_gate(X86_TRAP_DE, divide_error);
741 set_intr_gate_ist(X86_TRAP_NMI, &nmi, NMI_STACK); 741 set_intr_gate_ist(X86_TRAP_NMI, &nmi, NMI_STACK);
742 /* int4 can be called from all */ 742 /* int4 can be called from all */
743 set_system_intr_gate(X86_TRAP_OF, &overflow); 743 set_system_intr_gate(X86_TRAP_OF, &overflow);
744 set_intr_gate(X86_TRAP_BR, &bounds); 744 set_intr_gate(X86_TRAP_BR, bounds);
745 set_intr_gate(X86_TRAP_UD, &invalid_op); 745 set_intr_gate(X86_TRAP_UD, invalid_op);
746 set_intr_gate(X86_TRAP_NM, &device_not_available); 746 set_intr_gate(X86_TRAP_NM, device_not_available);
747#ifdef CONFIG_X86_32 747#ifdef CONFIG_X86_32
748 set_task_gate(X86_TRAP_DF, GDT_ENTRY_DOUBLEFAULT_TSS); 748 set_task_gate(X86_TRAP_DF, GDT_ENTRY_DOUBLEFAULT_TSS);
749#else 749#else
750 set_intr_gate_ist(X86_TRAP_DF, &double_fault, DOUBLEFAULT_STACK); 750 set_intr_gate_ist(X86_TRAP_DF, &double_fault, DOUBLEFAULT_STACK);
751#endif 751#endif
752 set_intr_gate(X86_TRAP_OLD_MF, &coprocessor_segment_overrun); 752 set_intr_gate(X86_TRAP_OLD_MF, coprocessor_segment_overrun);
753 set_intr_gate(X86_TRAP_TS, &invalid_TSS); 753 set_intr_gate(X86_TRAP_TS, invalid_TSS);
754 set_intr_gate(X86_TRAP_NP, &segment_not_present); 754 set_intr_gate(X86_TRAP_NP, segment_not_present);
755 set_intr_gate_ist(X86_TRAP_SS, &stack_segment, STACKFAULT_STACK); 755 set_intr_gate_ist(X86_TRAP_SS, &stack_segment, STACKFAULT_STACK);
756 set_intr_gate(X86_TRAP_GP, &general_protection); 756 set_intr_gate(X86_TRAP_GP, general_protection);
757 set_intr_gate(X86_TRAP_SPURIOUS, &spurious_interrupt_bug); 757 set_intr_gate(X86_TRAP_SPURIOUS, spurious_interrupt_bug);
758 set_intr_gate(X86_TRAP_MF, &coprocessor_error); 758 set_intr_gate(X86_TRAP_MF, coprocessor_error);
759 set_intr_gate(X86_TRAP_AC, &alignment_check); 759 set_intr_gate(X86_TRAP_AC, alignment_check);
760#ifdef CONFIG_X86_MCE 760#ifdef CONFIG_X86_MCE
761 set_intr_gate_ist(X86_TRAP_MC, &machine_check, MCE_STACK); 761 set_intr_gate_ist(X86_TRAP_MC, &machine_check, MCE_STACK);
762#endif 762#endif
763 set_intr_gate(X86_TRAP_XF, &simd_coprocessor_error); 763 set_intr_gate(X86_TRAP_XF, simd_coprocessor_error);
764 764
765 /* Reserve all the builtin and the syscall vector: */ 765 /* Reserve all the builtin and the syscall vector: */
766 for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++) 766 for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++)
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 10c4f3006afd..da6b35a98260 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -199,6 +199,15 @@ SECTIONS
199 __x86_cpu_dev_end = .; 199 __x86_cpu_dev_end = .;
200 } 200 }
201 201
202#ifdef CONFIG_X86_INTEL_MID
203 .x86_intel_mid_dev.init : AT(ADDR(.x86_intel_mid_dev.init) - \
204 LOAD_OFFSET) {
205 __x86_intel_mid_dev_start = .;
206 *(.x86_intel_mid_dev.init)
207 __x86_intel_mid_dev_end = .;
208 }
209#endif
210
202 /* 211 /*
203 * start address and size of operations which during runtime 212 * start address and size of operations which during runtime
204 * can be patched with virtualization friendly instructions or 213 * can be patched with virtualization friendly instructions or
diff --git a/arch/x86/kernel/x8664_ksyms_64.c b/arch/x86/kernel/x8664_ksyms_64.c
index b014d9414d08..040681928e9d 100644
--- a/arch/x86/kernel/x8664_ksyms_64.c
+++ b/arch/x86/kernel/x8664_ksyms_64.c
@@ -66,3 +66,10 @@ EXPORT_SYMBOL(empty_zero_page);
66#ifndef CONFIG_PARAVIRT 66#ifndef CONFIG_PARAVIRT
67EXPORT_SYMBOL(native_load_gs_index); 67EXPORT_SYMBOL(native_load_gs_index);
68#endif 68#endif
69
70#ifdef CONFIG_PREEMPT
71EXPORT_SYMBOL(___preempt_schedule);
72#ifdef CONFIG_CONTEXT_TRACKING
73EXPORT_SYMBOL(___preempt_schedule_context);
74#endif
75#endif
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index 8ce0072cd700..021783b1f46a 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -116,6 +116,8 @@ struct x86_msi_ops x86_msi = {
116 .teardown_msi_irqs = default_teardown_msi_irqs, 116 .teardown_msi_irqs = default_teardown_msi_irqs,
117 .restore_msi_irqs = default_restore_msi_irqs, 117 .restore_msi_irqs = default_restore_msi_irqs,
118 .setup_hpet_msi = default_setup_hpet_msi, 118 .setup_hpet_msi = default_setup_hpet_msi,
119 .msi_mask_irq = default_msi_mask_irq,
120 .msix_mask_irq = default_msix_mask_irq,
119}; 121};
120 122
121/* MSI arch specific hooks */ 123/* MSI arch specific hooks */
@@ -138,6 +140,14 @@ void arch_restore_msi_irqs(struct pci_dev *dev, int irq)
138{ 140{
139 x86_msi.restore_msi_irqs(dev, irq); 141 x86_msi.restore_msi_irqs(dev, irq);
140} 142}
143u32 arch_msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag)
144{
145 return x86_msi.msi_mask_irq(desc, mask, flag);
146}
147u32 arch_msix_mask_irq(struct msi_desc *desc, u32 flag)
148{
149 return x86_msi.msix_mask_irq(desc, flag);
150}
141#endif 151#endif
142 152
143struct x86_io_apic_ops x86_io_apic_ops = { 153struct x86_io_apic_ops x86_io_apic_ops = {
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index a47a3e54b964..b89c5db2b832 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -38,6 +38,7 @@ config KVM
38 select PERF_EVENTS 38 select PERF_EVENTS
39 select HAVE_KVM_MSI 39 select HAVE_KVM_MSI
40 select HAVE_KVM_CPU_RELAX_INTERCEPT 40 select HAVE_KVM_CPU_RELAX_INTERCEPT
41 select KVM_VFIO
41 ---help--- 42 ---help---
42 Support hosting fully virtualized guest machines using hardware 43 Support hosting fully virtualized guest machines using hardware
43 virtualization extensions. You will need a fairly recent 44 virtualization extensions. You will need a fairly recent
diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
index bf4fb04d0112..25d22b2d6509 100644
--- a/arch/x86/kvm/Makefile
+++ b/arch/x86/kvm/Makefile
@@ -9,7 +9,7 @@ KVM := ../../../virt/kvm
9 9
10kvm-y += $(KVM)/kvm_main.o $(KVM)/ioapic.o \ 10kvm-y += $(KVM)/kvm_main.o $(KVM)/ioapic.o \
11 $(KVM)/coalesced_mmio.o $(KVM)/irq_comm.o \ 11 $(KVM)/coalesced_mmio.o $(KVM)/irq_comm.o \
12 $(KVM)/eventfd.o $(KVM)/irqchip.o 12 $(KVM)/eventfd.o $(KVM)/irqchip.o $(KVM)/vfio.o
13kvm-$(CONFIG_KVM_DEVICE_ASSIGNMENT) += $(KVM)/assigned-dev.o $(KVM)/iommu.o 13kvm-$(CONFIG_KVM_DEVICE_ASSIGNMENT) += $(KVM)/assigned-dev.o $(KVM)/iommu.o
14kvm-$(CONFIG_KVM_ASYNC_PF) += $(KVM)/async_pf.o 14kvm-$(CONFIG_KVM_ASYNC_PF) += $(KVM)/async_pf.o
15 15
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index b110fe6c03d4..c6976257eff5 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -23,6 +23,26 @@
23#include "mmu.h" 23#include "mmu.h"
24#include "trace.h" 24#include "trace.h"
25 25
26static u32 xstate_required_size(u64 xstate_bv)
27{
28 int feature_bit = 0;
29 u32 ret = XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET;
30
31 xstate_bv &= ~XSTATE_FPSSE;
32 while (xstate_bv) {
33 if (xstate_bv & 0x1) {
34 u32 eax, ebx, ecx, edx;
35 cpuid_count(0xD, feature_bit, &eax, &ebx, &ecx, &edx);
36 ret = max(ret, eax + ebx);
37 }
38
39 xstate_bv >>= 1;
40 feature_bit++;
41 }
42
43 return ret;
44}
45
26void kvm_update_cpuid(struct kvm_vcpu *vcpu) 46void kvm_update_cpuid(struct kvm_vcpu *vcpu)
27{ 47{
28 struct kvm_cpuid_entry2 *best; 48 struct kvm_cpuid_entry2 *best;
@@ -46,6 +66,18 @@ void kvm_update_cpuid(struct kvm_vcpu *vcpu)
46 apic->lapic_timer.timer_mode_mask = 1 << 17; 66 apic->lapic_timer.timer_mode_mask = 1 << 17;
47 } 67 }
48 68
69 best = kvm_find_cpuid_entry(vcpu, 0xD, 0);
70 if (!best) {
71 vcpu->arch.guest_supported_xcr0 = 0;
72 vcpu->arch.guest_xstate_size = XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET;
73 } else {
74 vcpu->arch.guest_supported_xcr0 =
75 (best->eax | ((u64)best->edx << 32)) &
76 host_xcr0 & KVM_SUPPORTED_XCR0;
77 vcpu->arch.guest_xstate_size =
78 xstate_required_size(vcpu->arch.guest_supported_xcr0);
79 }
80
49 kvm_pmu_cpuid_update(vcpu); 81 kvm_pmu_cpuid_update(vcpu);
50} 82}
51 83
@@ -182,13 +214,35 @@ static bool supported_xcr0_bit(unsigned bit)
182{ 214{
183 u64 mask = ((u64)1 << bit); 215 u64 mask = ((u64)1 << bit);
184 216
185 return mask & (XSTATE_FP | XSTATE_SSE | XSTATE_YMM) & host_xcr0; 217 return mask & KVM_SUPPORTED_XCR0 & host_xcr0;
186} 218}
187 219
188#define F(x) bit(X86_FEATURE_##x) 220#define F(x) bit(X86_FEATURE_##x)
189 221
190static int do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, 222static int __do_cpuid_ent_emulated(struct kvm_cpuid_entry2 *entry,
191 u32 index, int *nent, int maxnent) 223 u32 func, u32 index, int *nent, int maxnent)
224{
225 switch (func) {
226 case 0:
227 entry->eax = 1; /* only one leaf currently */
228 ++*nent;
229 break;
230 case 1:
231 entry->ecx = F(MOVBE);
232 ++*nent;
233 break;
234 default:
235 break;
236 }
237
238 entry->function = func;
239 entry->index = index;
240
241 return 0;
242}
243
244static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
245 u32 index, int *nent, int maxnent)
192{ 246{
193 int r; 247 int r;
194 unsigned f_nx = is_efer_nx() ? F(NX) : 0; 248 unsigned f_nx = is_efer_nx() ? F(NX) : 0;
@@ -383,6 +437,8 @@ static int do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
383 case 0xd: { 437 case 0xd: {
384 int idx, i; 438 int idx, i;
385 439
440 entry->eax &= host_xcr0 & KVM_SUPPORTED_XCR0;
441 entry->edx &= (host_xcr0 & KVM_SUPPORTED_XCR0) >> 32;
386 entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; 442 entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
387 for (idx = 1, i = 1; idx < 64; ++idx) { 443 for (idx = 1, i = 1; idx < 64; ++idx) {
388 if (*nent >= maxnent) 444 if (*nent >= maxnent)
@@ -481,6 +537,15 @@ out:
481 return r; 537 return r;
482} 538}
483 539
540static int do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 func,
541 u32 idx, int *nent, int maxnent, unsigned int type)
542{
543 if (type == KVM_GET_EMULATED_CPUID)
544 return __do_cpuid_ent_emulated(entry, func, idx, nent, maxnent);
545
546 return __do_cpuid_ent(entry, func, idx, nent, maxnent);
547}
548
484#undef F 549#undef F
485 550
486struct kvm_cpuid_param { 551struct kvm_cpuid_param {
@@ -495,8 +560,36 @@ static bool is_centaur_cpu(const struct kvm_cpuid_param *param)
495 return boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR; 560 return boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR;
496} 561}
497 562
498int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid, 563static bool sanity_check_entries(struct kvm_cpuid_entry2 __user *entries,
499 struct kvm_cpuid_entry2 __user *entries) 564 __u32 num_entries, unsigned int ioctl_type)
565{
566 int i;
567 __u32 pad[3];
568
569 if (ioctl_type != KVM_GET_EMULATED_CPUID)
570 return false;
571
572 /*
573 * We want to make sure that ->padding is being passed clean from
574 * userspace in case we want to use it for something in the future.
575 *
576 * Sadly, this wasn't enforced for KVM_GET_SUPPORTED_CPUID and so we
577 * have to give ourselves satisfied only with the emulated side. /me
578 * sheds a tear.
579 */
580 for (i = 0; i < num_entries; i++) {
581 if (copy_from_user(pad, entries[i].padding, sizeof(pad)))
582 return true;
583
584 if (pad[0] || pad[1] || pad[2])
585 return true;
586 }
587 return false;
588}
589
590int kvm_dev_ioctl_get_cpuid(struct kvm_cpuid2 *cpuid,
591 struct kvm_cpuid_entry2 __user *entries,
592 unsigned int type)
500{ 593{
501 struct kvm_cpuid_entry2 *cpuid_entries; 594 struct kvm_cpuid_entry2 *cpuid_entries;
502 int limit, nent = 0, r = -E2BIG, i; 595 int limit, nent = 0, r = -E2BIG, i;
@@ -513,8 +606,12 @@ int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid,
513 goto out; 606 goto out;
514 if (cpuid->nent > KVM_MAX_CPUID_ENTRIES) 607 if (cpuid->nent > KVM_MAX_CPUID_ENTRIES)
515 cpuid->nent = KVM_MAX_CPUID_ENTRIES; 608 cpuid->nent = KVM_MAX_CPUID_ENTRIES;
609
610 if (sanity_check_entries(entries, cpuid->nent, type))
611 return -EINVAL;
612
516 r = -ENOMEM; 613 r = -ENOMEM;
517 cpuid_entries = vmalloc(sizeof(struct kvm_cpuid_entry2) * cpuid->nent); 614 cpuid_entries = vzalloc(sizeof(struct kvm_cpuid_entry2) * cpuid->nent);
518 if (!cpuid_entries) 615 if (!cpuid_entries)
519 goto out; 616 goto out;
520 617
@@ -526,7 +623,7 @@ int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid,
526 continue; 623 continue;
527 624
528 r = do_cpuid_ent(&cpuid_entries[nent], ent->func, ent->idx, 625 r = do_cpuid_ent(&cpuid_entries[nent], ent->func, ent->idx,
529 &nent, cpuid->nent); 626 &nent, cpuid->nent, type);
530 627
531 if (r) 628 if (r)
532 goto out_free; 629 goto out_free;
@@ -537,7 +634,7 @@ int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid,
537 limit = cpuid_entries[nent - 1].eax; 634 limit = cpuid_entries[nent - 1].eax;
538 for (func = ent->func + 1; func <= limit && nent < cpuid->nent && r == 0; ++func) 635 for (func = ent->func + 1; func <= limit && nent < cpuid->nent && r == 0; ++func)
539 r = do_cpuid_ent(&cpuid_entries[nent], func, ent->idx, 636 r = do_cpuid_ent(&cpuid_entries[nent], func, ent->idx,
540 &nent, cpuid->nent); 637 &nent, cpuid->nent, type);
541 638
542 if (r) 639 if (r)
543 goto out_free; 640 goto out_free;
@@ -661,6 +758,7 @@ void kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx)
661 *edx = best->edx; 758 *edx = best->edx;
662 } else 759 } else
663 *eax = *ebx = *ecx = *edx = 0; 760 *eax = *ebx = *ecx = *edx = 0;
761 trace_kvm_cpuid(function, *eax, *ebx, *ecx, *edx);
664} 762}
665EXPORT_SYMBOL_GPL(kvm_cpuid); 763EXPORT_SYMBOL_GPL(kvm_cpuid);
666 764
@@ -676,6 +774,5 @@ void kvm_emulate_cpuid(struct kvm_vcpu *vcpu)
676 kvm_register_write(vcpu, VCPU_REGS_RCX, ecx); 774 kvm_register_write(vcpu, VCPU_REGS_RCX, ecx);
677 kvm_register_write(vcpu, VCPU_REGS_RDX, edx); 775 kvm_register_write(vcpu, VCPU_REGS_RDX, edx);
678 kvm_x86_ops->skip_emulated_instruction(vcpu); 776 kvm_x86_ops->skip_emulated_instruction(vcpu);
679 trace_kvm_cpuid(function, eax, ebx, ecx, edx);
680} 777}
681EXPORT_SYMBOL_GPL(kvm_emulate_cpuid); 778EXPORT_SYMBOL_GPL(kvm_emulate_cpuid);
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index b7fd07984888..f1e4895174b2 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -6,8 +6,9 @@
6void kvm_update_cpuid(struct kvm_vcpu *vcpu); 6void kvm_update_cpuid(struct kvm_vcpu *vcpu);
7struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu, 7struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu,
8 u32 function, u32 index); 8 u32 function, u32 index);
9int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid, 9int kvm_dev_ioctl_get_cpuid(struct kvm_cpuid2 *cpuid,
10 struct kvm_cpuid_entry2 __user *entries); 10 struct kvm_cpuid_entry2 __user *entries,
11 unsigned int type);
11int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu, 12int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu,
12 struct kvm_cpuid *cpuid, 13 struct kvm_cpuid *cpuid,
13 struct kvm_cpuid_entry __user *entries); 14 struct kvm_cpuid_entry __user *entries);
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 2bc1e81045b0..07ffca0a89e9 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -130,7 +130,7 @@
130#define Mov (1<<20) 130#define Mov (1<<20)
131/* Misc flags */ 131/* Misc flags */
132#define Prot (1<<21) /* instruction generates #UD if not in prot-mode */ 132#define Prot (1<<21) /* instruction generates #UD if not in prot-mode */
133#define VendorSpecific (1<<22) /* Vendor specific instruction */ 133#define EmulateOnUD (1<<22) /* Emulate if unsupported by the host */
134#define NoAccess (1<<23) /* Don't access memory (lea/invlpg/verr etc) */ 134#define NoAccess (1<<23) /* Don't access memory (lea/invlpg/verr etc) */
135#define Op3264 (1<<24) /* Operand is 64b in long mode, 32b otherwise */ 135#define Op3264 (1<<24) /* Operand is 64b in long mode, 32b otherwise */
136#define Undefined (1<<25) /* No Such Instruction */ 136#define Undefined (1<<25) /* No Such Instruction */
@@ -785,9 +785,10 @@ static int do_insn_fetch(struct x86_emulate_ctxt *ctxt,
785 * @highbyte_regs specifies whether to decode AH,CH,DH,BH. 785 * @highbyte_regs specifies whether to decode AH,CH,DH,BH.
786 */ 786 */
787static void *decode_register(struct x86_emulate_ctxt *ctxt, u8 modrm_reg, 787static void *decode_register(struct x86_emulate_ctxt *ctxt, u8 modrm_reg,
788 int highbyte_regs) 788 int byteop)
789{ 789{
790 void *p; 790 void *p;
791 int highbyte_regs = (ctxt->rex_prefix == 0) && byteop;
791 792
792 if (highbyte_regs && modrm_reg >= 4 && modrm_reg < 8) 793 if (highbyte_regs && modrm_reg >= 4 && modrm_reg < 8)
793 p = (unsigned char *)reg_rmw(ctxt, modrm_reg & 3) + 1; 794 p = (unsigned char *)reg_rmw(ctxt, modrm_reg & 3) + 1;
@@ -1024,7 +1025,6 @@ static void decode_register_operand(struct x86_emulate_ctxt *ctxt,
1024 struct operand *op) 1025 struct operand *op)
1025{ 1026{
1026 unsigned reg = ctxt->modrm_reg; 1027 unsigned reg = ctxt->modrm_reg;
1027 int highbyte_regs = ctxt->rex_prefix == 0;
1028 1028
1029 if (!(ctxt->d & ModRM)) 1029 if (!(ctxt->d & ModRM))
1030 reg = (ctxt->b & 7) | ((ctxt->rex_prefix & 1) << 3); 1030 reg = (ctxt->b & 7) | ((ctxt->rex_prefix & 1) << 3);
@@ -1045,13 +1045,9 @@ static void decode_register_operand(struct x86_emulate_ctxt *ctxt,
1045 } 1045 }
1046 1046
1047 op->type = OP_REG; 1047 op->type = OP_REG;
1048 if (ctxt->d & ByteOp) { 1048 op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
1049 op->addr.reg = decode_register(ctxt, reg, highbyte_regs); 1049 op->addr.reg = decode_register(ctxt, reg, ctxt->d & ByteOp);
1050 op->bytes = 1; 1050
1051 } else {
1052 op->addr.reg = decode_register(ctxt, reg, 0);
1053 op->bytes = ctxt->op_bytes;
1054 }
1055 fetch_register_operand(op); 1051 fetch_register_operand(op);
1056 op->orig_val = op->val; 1052 op->orig_val = op->val;
1057} 1053}
@@ -1082,12 +1078,10 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt,
1082 ctxt->modrm_seg = VCPU_SREG_DS; 1078 ctxt->modrm_seg = VCPU_SREG_DS;
1083 1079
1084 if (ctxt->modrm_mod == 3) { 1080 if (ctxt->modrm_mod == 3) {
1085 int highbyte_regs = ctxt->rex_prefix == 0;
1086
1087 op->type = OP_REG; 1081 op->type = OP_REG;
1088 op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; 1082 op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
1089 op->addr.reg = decode_register(ctxt, ctxt->modrm_rm, 1083 op->addr.reg = decode_register(ctxt, ctxt->modrm_rm,
1090 highbyte_regs && (ctxt->d & ByteOp)); 1084 ctxt->d & ByteOp);
1091 if (ctxt->d & Sse) { 1085 if (ctxt->d & Sse) {
1092 op->type = OP_XMM; 1086 op->type = OP_XMM;
1093 op->bytes = 16; 1087 op->bytes = 16;
@@ -2025,6 +2019,17 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt)
2025 return rc; 2019 return rc;
2026} 2020}
2027 2021
2022static int em_ret_far_imm(struct x86_emulate_ctxt *ctxt)
2023{
2024 int rc;
2025
2026 rc = em_ret_far(ctxt);
2027 if (rc != X86EMUL_CONTINUE)
2028 return rc;
2029 rsp_increment(ctxt, ctxt->src.val);
2030 return X86EMUL_CONTINUE;
2031}
2032
2028static int em_cmpxchg(struct x86_emulate_ctxt *ctxt) 2033static int em_cmpxchg(struct x86_emulate_ctxt *ctxt)
2029{ 2034{
2030 /* Save real source value, then compare EAX against destination. */ 2035 /* Save real source value, then compare EAX against destination. */
@@ -2950,6 +2955,46 @@ static int em_mov(struct x86_emulate_ctxt *ctxt)
2950 return X86EMUL_CONTINUE; 2955 return X86EMUL_CONTINUE;
2951} 2956}
2952 2957
2958#define FFL(x) bit(X86_FEATURE_##x)
2959
2960static int em_movbe(struct x86_emulate_ctxt *ctxt)
2961{
2962 u32 ebx, ecx, edx, eax = 1;
2963 u16 tmp;
2964
2965 /*
2966 * Check MOVBE is set in the guest-visible CPUID leaf.
2967 */
2968 ctxt->ops->get_cpuid(ctxt, &eax, &ebx, &ecx, &edx);
2969 if (!(ecx & FFL(MOVBE)))
2970 return emulate_ud(ctxt);
2971
2972 switch (ctxt->op_bytes) {
2973 case 2:
2974 /*
2975 * From MOVBE definition: "...When the operand size is 16 bits,
2976 * the upper word of the destination register remains unchanged
2977 * ..."
2978 *
2979 * Both casting ->valptr and ->val to u16 breaks strict aliasing
2980 * rules so we have to do the operation almost per hand.
2981 */
2982 tmp = (u16)ctxt->src.val;
2983 ctxt->dst.val &= ~0xffffUL;
2984 ctxt->dst.val |= (unsigned long)swab16(tmp);
2985 break;
2986 case 4:
2987 ctxt->dst.val = swab32((u32)ctxt->src.val);
2988 break;
2989 case 8:
2990 ctxt->dst.val = swab64(ctxt->src.val);
2991 break;
2992 default:
2993 return X86EMUL_PROPAGATE_FAULT;
2994 }
2995 return X86EMUL_CONTINUE;
2996}
2997
2953static int em_cr_write(struct x86_emulate_ctxt *ctxt) 2998static int em_cr_write(struct x86_emulate_ctxt *ctxt)
2954{ 2999{
2955 if (ctxt->ops->set_cr(ctxt, ctxt->modrm_reg, ctxt->src.val)) 3000 if (ctxt->ops->set_cr(ctxt, ctxt->modrm_reg, ctxt->src.val))
@@ -3245,6 +3290,18 @@ static int em_cpuid(struct x86_emulate_ctxt *ctxt)
3245 return X86EMUL_CONTINUE; 3290 return X86EMUL_CONTINUE;
3246} 3291}
3247 3292
3293static int em_sahf(struct x86_emulate_ctxt *ctxt)
3294{
3295 u32 flags;
3296
3297 flags = EFLG_CF | EFLG_PF | EFLG_AF | EFLG_ZF | EFLG_SF;
3298 flags &= *reg_rmw(ctxt, VCPU_REGS_RAX) >> 8;
3299
3300 ctxt->eflags &= ~0xffUL;
3301 ctxt->eflags |= flags | X86_EFLAGS_FIXED;
3302 return X86EMUL_CONTINUE;
3303}
3304
3248static int em_lahf(struct x86_emulate_ctxt *ctxt) 3305static int em_lahf(struct x86_emulate_ctxt *ctxt)
3249{ 3306{
3250 *reg_rmw(ctxt, VCPU_REGS_RAX) &= ~0xff00UL; 3307 *reg_rmw(ctxt, VCPU_REGS_RAX) &= ~0xff00UL;
@@ -3491,7 +3548,7 @@ static const struct opcode group7_rm1[] = {
3491 3548
3492static const struct opcode group7_rm3[] = { 3549static const struct opcode group7_rm3[] = {
3493 DIP(SrcNone | Prot | Priv, vmrun, check_svme_pa), 3550 DIP(SrcNone | Prot | Priv, vmrun, check_svme_pa),
3494 II(SrcNone | Prot | VendorSpecific, em_vmmcall, vmmcall), 3551 II(SrcNone | Prot | EmulateOnUD, em_vmmcall, vmmcall),
3495 DIP(SrcNone | Prot | Priv, vmload, check_svme_pa), 3552 DIP(SrcNone | Prot | Priv, vmload, check_svme_pa),
3496 DIP(SrcNone | Prot | Priv, vmsave, check_svme_pa), 3553 DIP(SrcNone | Prot | Priv, vmsave, check_svme_pa),
3497 DIP(SrcNone | Prot | Priv, stgi, check_svme), 3554 DIP(SrcNone | Prot | Priv, stgi, check_svme),
@@ -3576,7 +3633,7 @@ static const struct group_dual group7 = { {
3576 II(SrcMem16 | Mov | Priv, em_lmsw, lmsw), 3633 II(SrcMem16 | Mov | Priv, em_lmsw, lmsw),
3577 II(SrcMem | ByteOp | Priv | NoAccess, em_invlpg, invlpg), 3634 II(SrcMem | ByteOp | Priv | NoAccess, em_invlpg, invlpg),
3578}, { 3635}, {
3579 I(SrcNone | Priv | VendorSpecific, em_vmcall), 3636 I(SrcNone | Priv | EmulateOnUD, em_vmcall),
3580 EXT(0, group7_rm1), 3637 EXT(0, group7_rm1),
3581 N, EXT(0, group7_rm3), 3638 N, EXT(0, group7_rm3),
3582 II(SrcNone | DstMem | Mov, em_smsw, smsw), N, 3639 II(SrcNone | DstMem | Mov, em_smsw, smsw), N,
@@ -3739,7 +3796,8 @@ static const struct opcode opcode_table[256] = {
3739 D(DstAcc | SrcNone), I(ImplicitOps | SrcAcc, em_cwd), 3796 D(DstAcc | SrcNone), I(ImplicitOps | SrcAcc, em_cwd),
3740 I(SrcImmFAddr | No64, em_call_far), N, 3797 I(SrcImmFAddr | No64, em_call_far), N,
3741 II(ImplicitOps | Stack, em_pushf, pushf), 3798 II(ImplicitOps | Stack, em_pushf, pushf),
3742 II(ImplicitOps | Stack, em_popf, popf), N, I(ImplicitOps, em_lahf), 3799 II(ImplicitOps | Stack, em_popf, popf),
3800 I(ImplicitOps, em_sahf), I(ImplicitOps, em_lahf),
3743 /* 0xA0 - 0xA7 */ 3801 /* 0xA0 - 0xA7 */
3744 I2bv(DstAcc | SrcMem | Mov | MemAbs, em_mov), 3802 I2bv(DstAcc | SrcMem | Mov | MemAbs, em_mov),
3745 I2bv(DstMem | SrcAcc | Mov | MemAbs | PageTable, em_mov), 3803 I2bv(DstMem | SrcAcc | Mov | MemAbs | PageTable, em_mov),
@@ -3763,7 +3821,8 @@ static const struct opcode opcode_table[256] = {
3763 G(ByteOp, group11), G(0, group11), 3821 G(ByteOp, group11), G(0, group11),
3764 /* 0xC8 - 0xCF */ 3822 /* 0xC8 - 0xCF */
3765 I(Stack | SrcImmU16 | Src2ImmByte, em_enter), I(Stack, em_leave), 3823 I(Stack | SrcImmU16 | Src2ImmByte, em_enter), I(Stack, em_leave),
3766 N, I(ImplicitOps | Stack, em_ret_far), 3824 I(ImplicitOps | Stack | SrcImmU16, em_ret_far_imm),
3825 I(ImplicitOps | Stack, em_ret_far),
3767 D(ImplicitOps), DI(SrcImmByte, intn), 3826 D(ImplicitOps), DI(SrcImmByte, intn),
3768 D(ImplicitOps | No64), II(ImplicitOps, em_iret, iret), 3827 D(ImplicitOps | No64), II(ImplicitOps, em_iret, iret),
3769 /* 0xD0 - 0xD7 */ 3828 /* 0xD0 - 0xD7 */
@@ -3798,7 +3857,7 @@ static const struct opcode opcode_table[256] = {
3798static const struct opcode twobyte_table[256] = { 3857static const struct opcode twobyte_table[256] = {
3799 /* 0x00 - 0x0F */ 3858 /* 0x00 - 0x0F */
3800 G(0, group6), GD(0, &group7), N, N, 3859 G(0, group6), GD(0, &group7), N, N,
3801 N, I(ImplicitOps | VendorSpecific, em_syscall), 3860 N, I(ImplicitOps | EmulateOnUD, em_syscall),
3802 II(ImplicitOps | Priv, em_clts, clts), N, 3861 II(ImplicitOps | Priv, em_clts, clts), N,
3803 DI(ImplicitOps | Priv, invd), DI(ImplicitOps | Priv, wbinvd), N, N, 3862 DI(ImplicitOps | Priv, invd), DI(ImplicitOps | Priv, wbinvd), N, N,
3804 N, D(ImplicitOps | ModRM), N, N, 3863 N, D(ImplicitOps | ModRM), N, N,
@@ -3818,8 +3877,8 @@ static const struct opcode twobyte_table[256] = {
3818 IIP(ImplicitOps, em_rdtsc, rdtsc, check_rdtsc), 3877 IIP(ImplicitOps, em_rdtsc, rdtsc, check_rdtsc),
3819 II(ImplicitOps | Priv, em_rdmsr, rdmsr), 3878 II(ImplicitOps | Priv, em_rdmsr, rdmsr),
3820 IIP(ImplicitOps, em_rdpmc, rdpmc, check_rdpmc), 3879 IIP(ImplicitOps, em_rdpmc, rdpmc, check_rdpmc),
3821 I(ImplicitOps | VendorSpecific, em_sysenter), 3880 I(ImplicitOps | EmulateOnUD, em_sysenter),
3822 I(ImplicitOps | Priv | VendorSpecific, em_sysexit), 3881 I(ImplicitOps | Priv | EmulateOnUD, em_sysexit),
3823 N, N, 3882 N, N,
3824 N, N, N, N, N, N, N, N, 3883 N, N, N, N, N, N, N, N,
3825 /* 0x40 - 0x4F */ 3884 /* 0x40 - 0x4F */
@@ -3880,6 +3939,30 @@ static const struct opcode twobyte_table[256] = {
3880 N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N 3939 N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N
3881}; 3940};
3882 3941
3942static const struct gprefix three_byte_0f_38_f0 = {
3943 I(DstReg | SrcMem | Mov, em_movbe), N, N, N
3944};
3945
3946static const struct gprefix three_byte_0f_38_f1 = {
3947 I(DstMem | SrcReg | Mov, em_movbe), N, N, N
3948};
3949
3950/*
3951 * Insns below are selected by the prefix which indexed by the third opcode
3952 * byte.
3953 */
3954static const struct opcode opcode_map_0f_38[256] = {
3955 /* 0x00 - 0x7f */
3956 X16(N), X16(N), X16(N), X16(N), X16(N), X16(N), X16(N), X16(N),
3957 /* 0x80 - 0xef */
3958 X16(N), X16(N), X16(N), X16(N), X16(N), X16(N), X16(N),
3959 /* 0xf0 - 0xf1 */
3960 GP(EmulateOnUD | ModRM | Prefix, &three_byte_0f_38_f0),
3961 GP(EmulateOnUD | ModRM | Prefix, &three_byte_0f_38_f1),
3962 /* 0xf2 - 0xff */
3963 N, N, X4(N), X8(N)
3964};
3965
3883#undef D 3966#undef D
3884#undef N 3967#undef N
3885#undef G 3968#undef G
@@ -4028,7 +4111,8 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
4028 case OpMem8: 4111 case OpMem8:
4029 ctxt->memop.bytes = 1; 4112 ctxt->memop.bytes = 1;
4030 if (ctxt->memop.type == OP_REG) { 4113 if (ctxt->memop.type == OP_REG) {
4031 ctxt->memop.addr.reg = decode_register(ctxt, ctxt->modrm_rm, 1); 4114 ctxt->memop.addr.reg = decode_register(ctxt,
4115 ctxt->modrm_rm, true);
4032 fetch_register_operand(&ctxt->memop); 4116 fetch_register_operand(&ctxt->memop);
4033 } 4117 }
4034 goto mem_common; 4118 goto mem_common;
@@ -4114,6 +4198,7 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len)
4114 ctxt->_eip = ctxt->eip; 4198 ctxt->_eip = ctxt->eip;
4115 ctxt->fetch.start = ctxt->_eip; 4199 ctxt->fetch.start = ctxt->_eip;
4116 ctxt->fetch.end = ctxt->fetch.start + insn_len; 4200 ctxt->fetch.end = ctxt->fetch.start + insn_len;
4201 ctxt->opcode_len = 1;
4117 if (insn_len > 0) 4202 if (insn_len > 0)
4118 memcpy(ctxt->fetch.data, insn, insn_len); 4203 memcpy(ctxt->fetch.data, insn, insn_len);
4119 4204
@@ -4196,9 +4281,16 @@ done_prefixes:
4196 opcode = opcode_table[ctxt->b]; 4281 opcode = opcode_table[ctxt->b];
4197 /* Two-byte opcode? */ 4282 /* Two-byte opcode? */
4198 if (ctxt->b == 0x0f) { 4283 if (ctxt->b == 0x0f) {
4199 ctxt->twobyte = 1; 4284 ctxt->opcode_len = 2;
4200 ctxt->b = insn_fetch(u8, ctxt); 4285 ctxt->b = insn_fetch(u8, ctxt);
4201 opcode = twobyte_table[ctxt->b]; 4286 opcode = twobyte_table[ctxt->b];
4287
4288 /* 0F_38 opcode map */
4289 if (ctxt->b == 0x38) {
4290 ctxt->opcode_len = 3;
4291 ctxt->b = insn_fetch(u8, ctxt);
4292 opcode = opcode_map_0f_38[ctxt->b];
4293 }
4202 } 4294 }
4203 ctxt->d = opcode.flags; 4295 ctxt->d = opcode.flags;
4204 4296
@@ -4255,7 +4347,7 @@ done_prefixes:
4255 if (ctxt->d == 0 || (ctxt->d & NotImpl)) 4347 if (ctxt->d == 0 || (ctxt->d & NotImpl))
4256 return EMULATION_FAILED; 4348 return EMULATION_FAILED;
4257 4349
4258 if (!(ctxt->d & VendorSpecific) && ctxt->only_vendor_specific_insn) 4350 if (!(ctxt->d & EmulateOnUD) && ctxt->ud)
4259 return EMULATION_FAILED; 4351 return EMULATION_FAILED;
4260 4352
4261 if (mode == X86EMUL_MODE_PROT64 && (ctxt->d & Stack)) 4353 if (mode == X86EMUL_MODE_PROT64 && (ctxt->d & Stack))
@@ -4528,8 +4620,10 @@ special_insn:
4528 goto writeback; 4620 goto writeback;
4529 } 4621 }
4530 4622
4531 if (ctxt->twobyte) 4623 if (ctxt->opcode_len == 2)
4532 goto twobyte_insn; 4624 goto twobyte_insn;
4625 else if (ctxt->opcode_len == 3)
4626 goto threebyte_insn;
4533 4627
4534 switch (ctxt->b) { 4628 switch (ctxt->b) {
4535 case 0x63: /* movsxd */ 4629 case 0x63: /* movsxd */
@@ -4714,6 +4808,8 @@ twobyte_insn:
4714 goto cannot_emulate; 4808 goto cannot_emulate;
4715 } 4809 }
4716 4810
4811threebyte_insn:
4812
4717 if (rc != X86EMUL_CONTINUE) 4813 if (rc != X86EMUL_CONTINUE)
4718 goto done; 4814 goto done;
4719 4815
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index dce0df8150df..40772ef0f2b1 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2570,11 +2570,6 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
2570 kvm_release_pfn_clean(pfn); 2570 kvm_release_pfn_clean(pfn);
2571} 2571}
2572 2572
2573static void nonpaging_new_cr3(struct kvm_vcpu *vcpu)
2574{
2575 mmu_free_roots(vcpu);
2576}
2577
2578static pfn_t pte_prefetch_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn, 2573static pfn_t pte_prefetch_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn,
2579 bool no_dirty_log) 2574 bool no_dirty_log)
2580{ 2575{
@@ -3424,18 +3419,11 @@ out_unlock:
3424 return 0; 3419 return 0;
3425} 3420}
3426 3421
3427static void nonpaging_free(struct kvm_vcpu *vcpu) 3422static void nonpaging_init_context(struct kvm_vcpu *vcpu,
3428{ 3423 struct kvm_mmu *context)
3429 mmu_free_roots(vcpu);
3430}
3431
3432static int nonpaging_init_context(struct kvm_vcpu *vcpu,
3433 struct kvm_mmu *context)
3434{ 3424{
3435 context->new_cr3 = nonpaging_new_cr3;
3436 context->page_fault = nonpaging_page_fault; 3425 context->page_fault = nonpaging_page_fault;
3437 context->gva_to_gpa = nonpaging_gva_to_gpa; 3426 context->gva_to_gpa = nonpaging_gva_to_gpa;
3438 context->free = nonpaging_free;
3439 context->sync_page = nonpaging_sync_page; 3427 context->sync_page = nonpaging_sync_page;
3440 context->invlpg = nonpaging_invlpg; 3428 context->invlpg = nonpaging_invlpg;
3441 context->update_pte = nonpaging_update_pte; 3429 context->update_pte = nonpaging_update_pte;
@@ -3444,7 +3432,6 @@ static int nonpaging_init_context(struct kvm_vcpu *vcpu,
3444 context->root_hpa = INVALID_PAGE; 3432 context->root_hpa = INVALID_PAGE;
3445 context->direct_map = true; 3433 context->direct_map = true;
3446 context->nx = false; 3434 context->nx = false;
3447 return 0;
3448} 3435}
3449 3436
3450void kvm_mmu_flush_tlb(struct kvm_vcpu *vcpu) 3437void kvm_mmu_flush_tlb(struct kvm_vcpu *vcpu)
@@ -3454,9 +3441,8 @@ void kvm_mmu_flush_tlb(struct kvm_vcpu *vcpu)
3454} 3441}
3455EXPORT_SYMBOL_GPL(kvm_mmu_flush_tlb); 3442EXPORT_SYMBOL_GPL(kvm_mmu_flush_tlb);
3456 3443
3457static void paging_new_cr3(struct kvm_vcpu *vcpu) 3444void kvm_mmu_new_cr3(struct kvm_vcpu *vcpu)
3458{ 3445{
3459 pgprintk("%s: cr3 %lx\n", __func__, kvm_read_cr3(vcpu));
3460 mmu_free_roots(vcpu); 3446 mmu_free_roots(vcpu);
3461} 3447}
3462 3448
@@ -3471,11 +3457,6 @@ static void inject_page_fault(struct kvm_vcpu *vcpu,
3471 vcpu->arch.mmu.inject_page_fault(vcpu, fault); 3457 vcpu->arch.mmu.inject_page_fault(vcpu, fault);
3472} 3458}
3473 3459
3474static void paging_free(struct kvm_vcpu *vcpu)
3475{
3476 nonpaging_free(vcpu);
3477}
3478
3479static bool sync_mmio_spte(struct kvm *kvm, u64 *sptep, gfn_t gfn, 3460static bool sync_mmio_spte(struct kvm *kvm, u64 *sptep, gfn_t gfn,
3480 unsigned access, int *nr_present) 3461 unsigned access, int *nr_present)
3481{ 3462{
@@ -3665,9 +3646,9 @@ static void update_last_pte_bitmap(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu)
3665 mmu->last_pte_bitmap = map; 3646 mmu->last_pte_bitmap = map;
3666} 3647}
3667 3648
3668static int paging64_init_context_common(struct kvm_vcpu *vcpu, 3649static void paging64_init_context_common(struct kvm_vcpu *vcpu,
3669 struct kvm_mmu *context, 3650 struct kvm_mmu *context,
3670 int level) 3651 int level)
3671{ 3652{
3672 context->nx = is_nx(vcpu); 3653 context->nx = is_nx(vcpu);
3673 context->root_level = level; 3654 context->root_level = level;
@@ -3677,27 +3658,24 @@ static int paging64_init_context_common(struct kvm_vcpu *vcpu,
3677 update_last_pte_bitmap(vcpu, context); 3658 update_last_pte_bitmap(vcpu, context);
3678 3659
3679 ASSERT(is_pae(vcpu)); 3660 ASSERT(is_pae(vcpu));
3680 context->new_cr3 = paging_new_cr3;
3681 context->page_fault = paging64_page_fault; 3661 context->page_fault = paging64_page_fault;
3682 context->gva_to_gpa = paging64_gva_to_gpa; 3662 context->gva_to_gpa = paging64_gva_to_gpa;
3683 context->sync_page = paging64_sync_page; 3663 context->sync_page = paging64_sync_page;
3684 context->invlpg = paging64_invlpg; 3664 context->invlpg = paging64_invlpg;
3685 context->update_pte = paging64_update_pte; 3665 context->update_pte = paging64_update_pte;
3686 context->free = paging_free;
3687 context->shadow_root_level = level; 3666 context->shadow_root_level = level;
3688 context->root_hpa = INVALID_PAGE; 3667 context->root_hpa = INVALID_PAGE;
3689 context->direct_map = false; 3668 context->direct_map = false;
3690 return 0;
3691} 3669}
3692 3670
3693static int paging64_init_context(struct kvm_vcpu *vcpu, 3671static void paging64_init_context(struct kvm_vcpu *vcpu,
3694 struct kvm_mmu *context) 3672 struct kvm_mmu *context)
3695{ 3673{
3696 return paging64_init_context_common(vcpu, context, PT64_ROOT_LEVEL); 3674 paging64_init_context_common(vcpu, context, PT64_ROOT_LEVEL);
3697} 3675}
3698 3676
3699static int paging32_init_context(struct kvm_vcpu *vcpu, 3677static void paging32_init_context(struct kvm_vcpu *vcpu,
3700 struct kvm_mmu *context) 3678 struct kvm_mmu *context)
3701{ 3679{
3702 context->nx = false; 3680 context->nx = false;
3703 context->root_level = PT32_ROOT_LEVEL; 3681 context->root_level = PT32_ROOT_LEVEL;
@@ -3706,33 +3684,28 @@ static int paging32_init_context(struct kvm_vcpu *vcpu,
3706 update_permission_bitmask(vcpu, context, false); 3684 update_permission_bitmask(vcpu, context, false);
3707 update_last_pte_bitmap(vcpu, context); 3685 update_last_pte_bitmap(vcpu, context);
3708 3686
3709 context->new_cr3 = paging_new_cr3;
3710 context->page_fault = paging32_page_fault; 3687 context->page_fault = paging32_page_fault;
3711 context->gva_to_gpa = paging32_gva_to_gpa; 3688 context->gva_to_gpa = paging32_gva_to_gpa;
3712 context->free = paging_free;
3713 context->sync_page = paging32_sync_page; 3689 context->sync_page = paging32_sync_page;
3714 context->invlpg = paging32_invlpg; 3690 context->invlpg = paging32_invlpg;
3715 context->update_pte = paging32_update_pte; 3691 context->update_pte = paging32_update_pte;
3716 context->shadow_root_level = PT32E_ROOT_LEVEL; 3692 context->shadow_root_level = PT32E_ROOT_LEVEL;
3717 context->root_hpa = INVALID_PAGE; 3693 context->root_hpa = INVALID_PAGE;
3718 context->direct_map = false; 3694 context->direct_map = false;
3719 return 0;
3720} 3695}
3721 3696
3722static int paging32E_init_context(struct kvm_vcpu *vcpu, 3697static void paging32E_init_context(struct kvm_vcpu *vcpu,
3723 struct kvm_mmu *context) 3698 struct kvm_mmu *context)
3724{ 3699{
3725 return paging64_init_context_common(vcpu, context, PT32E_ROOT_LEVEL); 3700 paging64_init_context_common(vcpu, context, PT32E_ROOT_LEVEL);
3726} 3701}
3727 3702
3728static int init_kvm_tdp_mmu(struct kvm_vcpu *vcpu) 3703static void init_kvm_tdp_mmu(struct kvm_vcpu *vcpu)
3729{ 3704{
3730 struct kvm_mmu *context = vcpu->arch.walk_mmu; 3705 struct kvm_mmu *context = vcpu->arch.walk_mmu;
3731 3706
3732 context->base_role.word = 0; 3707 context->base_role.word = 0;
3733 context->new_cr3 = nonpaging_new_cr3;
3734 context->page_fault = tdp_page_fault; 3708 context->page_fault = tdp_page_fault;
3735 context->free = nonpaging_free;
3736 context->sync_page = nonpaging_sync_page; 3709 context->sync_page = nonpaging_sync_page;
3737 context->invlpg = nonpaging_invlpg; 3710 context->invlpg = nonpaging_invlpg;
3738 context->update_pte = nonpaging_update_pte; 3711 context->update_pte = nonpaging_update_pte;
@@ -3767,37 +3740,32 @@ static int init_kvm_tdp_mmu(struct kvm_vcpu *vcpu)
3767 3740
3768 update_permission_bitmask(vcpu, context, false); 3741 update_permission_bitmask(vcpu, context, false);
3769 update_last_pte_bitmap(vcpu, context); 3742 update_last_pte_bitmap(vcpu, context);
3770
3771 return 0;
3772} 3743}
3773 3744
3774int kvm_init_shadow_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context) 3745void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context)
3775{ 3746{
3776 int r;
3777 bool smep = kvm_read_cr4_bits(vcpu, X86_CR4_SMEP); 3747 bool smep = kvm_read_cr4_bits(vcpu, X86_CR4_SMEP);
3778 ASSERT(vcpu); 3748 ASSERT(vcpu);
3779 ASSERT(!VALID_PAGE(vcpu->arch.mmu.root_hpa)); 3749 ASSERT(!VALID_PAGE(vcpu->arch.mmu.root_hpa));
3780 3750
3781 if (!is_paging(vcpu)) 3751 if (!is_paging(vcpu))
3782 r = nonpaging_init_context(vcpu, context); 3752 nonpaging_init_context(vcpu, context);
3783 else if (is_long_mode(vcpu)) 3753 else if (is_long_mode(vcpu))
3784 r = paging64_init_context(vcpu, context); 3754 paging64_init_context(vcpu, context);
3785 else if (is_pae(vcpu)) 3755 else if (is_pae(vcpu))
3786 r = paging32E_init_context(vcpu, context); 3756 paging32E_init_context(vcpu, context);
3787 else 3757 else
3788 r = paging32_init_context(vcpu, context); 3758 paging32_init_context(vcpu, context);
3789 3759
3790 vcpu->arch.mmu.base_role.nxe = is_nx(vcpu); 3760 vcpu->arch.mmu.base_role.nxe = is_nx(vcpu);
3791 vcpu->arch.mmu.base_role.cr4_pae = !!is_pae(vcpu); 3761 vcpu->arch.mmu.base_role.cr4_pae = !!is_pae(vcpu);
3792 vcpu->arch.mmu.base_role.cr0_wp = is_write_protection(vcpu); 3762 vcpu->arch.mmu.base_role.cr0_wp = is_write_protection(vcpu);
3793 vcpu->arch.mmu.base_role.smep_andnot_wp 3763 vcpu->arch.mmu.base_role.smep_andnot_wp
3794 = smep && !is_write_protection(vcpu); 3764 = smep && !is_write_protection(vcpu);
3795
3796 return r;
3797} 3765}
3798EXPORT_SYMBOL_GPL(kvm_init_shadow_mmu); 3766EXPORT_SYMBOL_GPL(kvm_init_shadow_mmu);
3799 3767
3800int kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context, 3768void kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context,
3801 bool execonly) 3769 bool execonly)
3802{ 3770{
3803 ASSERT(vcpu); 3771 ASSERT(vcpu);
@@ -3806,37 +3774,30 @@ int kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context,
3806 context->shadow_root_level = kvm_x86_ops->get_tdp_level(); 3774 context->shadow_root_level = kvm_x86_ops->get_tdp_level();
3807 3775
3808 context->nx = true; 3776 context->nx = true;
3809 context->new_cr3 = paging_new_cr3;
3810 context->page_fault = ept_page_fault; 3777 context->page_fault = ept_page_fault;
3811 context->gva_to_gpa = ept_gva_to_gpa; 3778 context->gva_to_gpa = ept_gva_to_gpa;
3812 context->sync_page = ept_sync_page; 3779 context->sync_page = ept_sync_page;
3813 context->invlpg = ept_invlpg; 3780 context->invlpg = ept_invlpg;
3814 context->update_pte = ept_update_pte; 3781 context->update_pte = ept_update_pte;
3815 context->free = paging_free;
3816 context->root_level = context->shadow_root_level; 3782 context->root_level = context->shadow_root_level;
3817 context->root_hpa = INVALID_PAGE; 3783 context->root_hpa = INVALID_PAGE;
3818 context->direct_map = false; 3784 context->direct_map = false;
3819 3785
3820 update_permission_bitmask(vcpu, context, true); 3786 update_permission_bitmask(vcpu, context, true);
3821 reset_rsvds_bits_mask_ept(vcpu, context, execonly); 3787 reset_rsvds_bits_mask_ept(vcpu, context, execonly);
3822
3823 return 0;
3824} 3788}
3825EXPORT_SYMBOL_GPL(kvm_init_shadow_ept_mmu); 3789EXPORT_SYMBOL_GPL(kvm_init_shadow_ept_mmu);
3826 3790
3827static int init_kvm_softmmu(struct kvm_vcpu *vcpu) 3791static void init_kvm_softmmu(struct kvm_vcpu *vcpu)
3828{ 3792{
3829 int r = kvm_init_shadow_mmu(vcpu, vcpu->arch.walk_mmu); 3793 kvm_init_shadow_mmu(vcpu, vcpu->arch.walk_mmu);
3830
3831 vcpu->arch.walk_mmu->set_cr3 = kvm_x86_ops->set_cr3; 3794 vcpu->arch.walk_mmu->set_cr3 = kvm_x86_ops->set_cr3;
3832 vcpu->arch.walk_mmu->get_cr3 = get_cr3; 3795 vcpu->arch.walk_mmu->get_cr3 = get_cr3;
3833 vcpu->arch.walk_mmu->get_pdptr = kvm_pdptr_read; 3796 vcpu->arch.walk_mmu->get_pdptr = kvm_pdptr_read;
3834 vcpu->arch.walk_mmu->inject_page_fault = kvm_inject_page_fault; 3797 vcpu->arch.walk_mmu->inject_page_fault = kvm_inject_page_fault;
3835
3836 return r;
3837} 3798}
3838 3799
3839static int init_kvm_nested_mmu(struct kvm_vcpu *vcpu) 3800static void init_kvm_nested_mmu(struct kvm_vcpu *vcpu)
3840{ 3801{
3841 struct kvm_mmu *g_context = &vcpu->arch.nested_mmu; 3802 struct kvm_mmu *g_context = &vcpu->arch.nested_mmu;
3842 3803
@@ -3873,11 +3834,9 @@ static int init_kvm_nested_mmu(struct kvm_vcpu *vcpu)
3873 3834
3874 update_permission_bitmask(vcpu, g_context, false); 3835 update_permission_bitmask(vcpu, g_context, false);
3875 update_last_pte_bitmap(vcpu, g_context); 3836 update_last_pte_bitmap(vcpu, g_context);
3876
3877 return 0;
3878} 3837}
3879 3838
3880static int init_kvm_mmu(struct kvm_vcpu *vcpu) 3839static void init_kvm_mmu(struct kvm_vcpu *vcpu)
3881{ 3840{
3882 if (mmu_is_nested(vcpu)) 3841 if (mmu_is_nested(vcpu))
3883 return init_kvm_nested_mmu(vcpu); 3842 return init_kvm_nested_mmu(vcpu);
@@ -3887,18 +3846,12 @@ static int init_kvm_mmu(struct kvm_vcpu *vcpu)
3887 return init_kvm_softmmu(vcpu); 3846 return init_kvm_softmmu(vcpu);
3888} 3847}
3889 3848
3890static void destroy_kvm_mmu(struct kvm_vcpu *vcpu) 3849void kvm_mmu_reset_context(struct kvm_vcpu *vcpu)
3891{ 3850{
3892 ASSERT(vcpu); 3851 ASSERT(vcpu);
3893 if (VALID_PAGE(vcpu->arch.mmu.root_hpa))
3894 /* mmu.free() should set root_hpa = INVALID_PAGE */
3895 vcpu->arch.mmu.free(vcpu);
3896}
3897 3852
3898int kvm_mmu_reset_context(struct kvm_vcpu *vcpu) 3853 kvm_mmu_unload(vcpu);
3899{ 3854 init_kvm_mmu(vcpu);
3900 destroy_kvm_mmu(vcpu);
3901 return init_kvm_mmu(vcpu);
3902} 3855}
3903EXPORT_SYMBOL_GPL(kvm_mmu_reset_context); 3856EXPORT_SYMBOL_GPL(kvm_mmu_reset_context);
3904 3857
@@ -3923,6 +3876,7 @@ EXPORT_SYMBOL_GPL(kvm_mmu_load);
3923void kvm_mmu_unload(struct kvm_vcpu *vcpu) 3876void kvm_mmu_unload(struct kvm_vcpu *vcpu)
3924{ 3877{
3925 mmu_free_roots(vcpu); 3878 mmu_free_roots(vcpu);
3879 WARN_ON(VALID_PAGE(vcpu->arch.mmu.root_hpa));
3926} 3880}
3927EXPORT_SYMBOL_GPL(kvm_mmu_unload); 3881EXPORT_SYMBOL_GPL(kvm_mmu_unload);
3928 3882
@@ -4281,12 +4235,12 @@ int kvm_mmu_create(struct kvm_vcpu *vcpu)
4281 return alloc_mmu_pages(vcpu); 4235 return alloc_mmu_pages(vcpu);
4282} 4236}
4283 4237
4284int kvm_mmu_setup(struct kvm_vcpu *vcpu) 4238void kvm_mmu_setup(struct kvm_vcpu *vcpu)
4285{ 4239{
4286 ASSERT(vcpu); 4240 ASSERT(vcpu);
4287 ASSERT(!VALID_PAGE(vcpu->arch.mmu.root_hpa)); 4241 ASSERT(!VALID_PAGE(vcpu->arch.mmu.root_hpa));
4288 4242
4289 return init_kvm_mmu(vcpu); 4243 init_kvm_mmu(vcpu);
4290} 4244}
4291 4245
4292void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot) 4246void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot)
@@ -4428,7 +4382,7 @@ mmu_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
4428 int nr_to_scan = sc->nr_to_scan; 4382 int nr_to_scan = sc->nr_to_scan;
4429 unsigned long freed = 0; 4383 unsigned long freed = 0;
4430 4384
4431 raw_spin_lock(&kvm_lock); 4385 spin_lock(&kvm_lock);
4432 4386
4433 list_for_each_entry(kvm, &vm_list, vm_list) { 4387 list_for_each_entry(kvm, &vm_list, vm_list) {
4434 int idx; 4388 int idx;
@@ -4478,9 +4432,8 @@ unlock:
4478 break; 4432 break;
4479 } 4433 }
4480 4434
4481 raw_spin_unlock(&kvm_lock); 4435 spin_unlock(&kvm_lock);
4482 return freed; 4436 return freed;
4483
4484} 4437}
4485 4438
4486static unsigned long 4439static unsigned long
@@ -4574,7 +4527,7 @@ void kvm_mmu_destroy(struct kvm_vcpu *vcpu)
4574{ 4527{
4575 ASSERT(vcpu); 4528 ASSERT(vcpu);
4576 4529
4577 destroy_kvm_mmu(vcpu); 4530 kvm_mmu_unload(vcpu);
4578 free_mmu_pages(vcpu); 4531 free_mmu_pages(vcpu);
4579 mmu_free_memory_caches(vcpu); 4532 mmu_free_memory_caches(vcpu);
4580} 4533}
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
index 77e044a0f5f7..292615274358 100644
--- a/arch/x86/kvm/mmu.h
+++ b/arch/x86/kvm/mmu.h
@@ -70,8 +70,8 @@ enum {
70}; 70};
71 71
72int 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);
73int kvm_init_shadow_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context); 73void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context);
74int kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context, 74void kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context,
75 bool execonly); 75 bool execonly);
76 76
77static inline unsigned int kvm_mmu_available_pages(struct kvm *kvm) 77static inline unsigned int kvm_mmu_available_pages(struct kvm *kvm)
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 043330159179..ad75d77999d0 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -99,6 +99,7 @@ struct guest_walker {
99 pt_element_t prefetch_ptes[PTE_PREFETCH_NUM]; 99 pt_element_t prefetch_ptes[PTE_PREFETCH_NUM];
100 gpa_t pte_gpa[PT_MAX_FULL_LEVELS]; 100 gpa_t pte_gpa[PT_MAX_FULL_LEVELS];
101 pt_element_t __user *ptep_user[PT_MAX_FULL_LEVELS]; 101 pt_element_t __user *ptep_user[PT_MAX_FULL_LEVELS];
102 bool pte_writable[PT_MAX_FULL_LEVELS];
102 unsigned pt_access; 103 unsigned pt_access;
103 unsigned pte_access; 104 unsigned pte_access;
104 gfn_t gfn; 105 gfn_t gfn;
@@ -235,6 +236,22 @@ static int FNAME(update_accessed_dirty_bits)(struct kvm_vcpu *vcpu,
235 if (pte == orig_pte) 236 if (pte == orig_pte)
236 continue; 237 continue;
237 238
239 /*
240 * If the slot is read-only, simply do not process the accessed
241 * and dirty bits. This is the correct thing to do if the slot
242 * is ROM, and page tables in read-as-ROM/write-as-MMIO slots
243 * are only supported if the accessed and dirty bits are already
244 * set in the ROM (so that MMIO writes are never needed).
245 *
246 * Note that NPT does not allow this at all and faults, since
247 * it always wants nested page table entries for the guest
248 * page tables to be writable. And EPT works but will simply
249 * overwrite the read-only memory to set the accessed and dirty
250 * bits.
251 */
252 if (unlikely(!walker->pte_writable[level - 1]))
253 continue;
254
238 ret = FNAME(cmpxchg_gpte)(vcpu, mmu, ptep_user, index, orig_pte, pte); 255 ret = FNAME(cmpxchg_gpte)(vcpu, mmu, ptep_user, index, orig_pte, pte);
239 if (ret) 256 if (ret)
240 return ret; 257 return ret;
@@ -309,7 +326,8 @@ retry_walk:
309 goto error; 326 goto error;
310 real_gfn = gpa_to_gfn(real_gfn); 327 real_gfn = gpa_to_gfn(real_gfn);
311 328
312 host_addr = gfn_to_hva(vcpu->kvm, real_gfn); 329 host_addr = gfn_to_hva_prot(vcpu->kvm, real_gfn,
330 &walker->pte_writable[walker->level - 1]);
313 if (unlikely(kvm_is_error_hva(host_addr))) 331 if (unlikely(kvm_is_error_hva(host_addr)))
314 goto error; 332 goto error;
315 333
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index c0bc80391e40..c7168a5cff1b 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1959,11 +1959,9 @@ static void nested_svm_inject_npf_exit(struct kvm_vcpu *vcpu,
1959 nested_svm_vmexit(svm); 1959 nested_svm_vmexit(svm);
1960} 1960}
1961 1961
1962static int nested_svm_init_mmu_context(struct kvm_vcpu *vcpu) 1962static void nested_svm_init_mmu_context(struct kvm_vcpu *vcpu)
1963{ 1963{
1964 int r; 1964 kvm_init_shadow_mmu(vcpu, &vcpu->arch.mmu);
1965
1966 r = kvm_init_shadow_mmu(vcpu, &vcpu->arch.mmu);
1967 1965
1968 vcpu->arch.mmu.set_cr3 = nested_svm_set_tdp_cr3; 1966 vcpu->arch.mmu.set_cr3 = nested_svm_set_tdp_cr3;
1969 vcpu->arch.mmu.get_cr3 = nested_svm_get_tdp_cr3; 1967 vcpu->arch.mmu.get_cr3 = nested_svm_get_tdp_cr3;
@@ -1971,8 +1969,6 @@ static int nested_svm_init_mmu_context(struct kvm_vcpu *vcpu)
1971 vcpu->arch.mmu.inject_page_fault = nested_svm_inject_npf_exit; 1969 vcpu->arch.mmu.inject_page_fault = nested_svm_inject_npf_exit;
1972 vcpu->arch.mmu.shadow_root_level = get_npt_level(); 1970 vcpu->arch.mmu.shadow_root_level = get_npt_level();
1973 vcpu->arch.walk_mmu = &vcpu->arch.nested_mmu; 1971 vcpu->arch.walk_mmu = &vcpu->arch.nested_mmu;
1974
1975 return r;
1976} 1972}
1977 1973
1978static void nested_svm_uninit_mmu_context(struct kvm_vcpu *vcpu) 1974static void nested_svm_uninit_mmu_context(struct kvm_vcpu *vcpu)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 1f1da43ff2a2..b2fe1c252f35 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1498,7 +1498,7 @@ static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr,
1498 break; 1498 break;
1499 1499
1500 if (i == NR_AUTOLOAD_MSRS) { 1500 if (i == NR_AUTOLOAD_MSRS) {
1501 printk_once(KERN_WARNING"Not enough mst switch entries. " 1501 printk_once(KERN_WARNING "Not enough msr switch entries. "
1502 "Can't add msr %x\n", msr); 1502 "Can't add msr %x\n", msr);
1503 return; 1503 return;
1504 } else if (i == m->nr) { 1504 } else if (i == m->nr) {
@@ -1898,16 +1898,12 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
1898/* 1898/*
1899 * KVM wants to inject page-faults which it got to the guest. This function 1899 * KVM wants to inject page-faults which it got to the guest. This function
1900 * checks whether in a nested guest, we need to inject them to L1 or L2. 1900 * checks whether in a nested guest, we need to inject them to L1 or L2.
1901 * This function assumes it is called with the exit reason in vmcs02 being
1902 * a #PF exception (this is the only case in which KVM injects a #PF when L2
1903 * is running).
1904 */ 1901 */
1905static int nested_pf_handled(struct kvm_vcpu *vcpu) 1902static int nested_vmx_check_exception(struct kvm_vcpu *vcpu, unsigned nr)
1906{ 1903{
1907 struct vmcs12 *vmcs12 = get_vmcs12(vcpu); 1904 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
1908 1905
1909 /* TODO: also check PFEC_MATCH/MASK, not just EB.PF. */ 1906 if (!(vmcs12->exception_bitmap & (1u << nr)))
1910 if (!(vmcs12->exception_bitmap & (1u << PF_VECTOR)))
1911 return 0; 1907 return 0;
1912 1908
1913 nested_vmx_vmexit(vcpu); 1909 nested_vmx_vmexit(vcpu);
@@ -1921,8 +1917,8 @@ static void vmx_queue_exception(struct kvm_vcpu *vcpu, unsigned nr,
1921 struct vcpu_vmx *vmx = to_vmx(vcpu); 1917 struct vcpu_vmx *vmx = to_vmx(vcpu);
1922 u32 intr_info = nr | INTR_INFO_VALID_MASK; 1918 u32 intr_info = nr | INTR_INFO_VALID_MASK;
1923 1919
1924 if (nr == PF_VECTOR && is_guest_mode(vcpu) && 1920 if (!reinject && is_guest_mode(vcpu) &&
1925 !vmx->nested.nested_run_pending && nested_pf_handled(vcpu)) 1921 nested_vmx_check_exception(vcpu, nr))
1926 return; 1922 return;
1927 1923
1928 if (has_error_code) { 1924 if (has_error_code) {
@@ -2204,9 +2200,15 @@ static __init void nested_vmx_setup_ctls_msrs(void)
2204#ifdef CONFIG_X86_64 2200#ifdef CONFIG_X86_64
2205 VM_EXIT_HOST_ADDR_SPACE_SIZE | 2201 VM_EXIT_HOST_ADDR_SPACE_SIZE |
2206#endif 2202#endif
2207 VM_EXIT_LOAD_IA32_PAT | VM_EXIT_SAVE_IA32_PAT; 2203 VM_EXIT_LOAD_IA32_PAT | VM_EXIT_SAVE_IA32_PAT |
2204 VM_EXIT_SAVE_VMX_PREEMPTION_TIMER;
2205 if (!(nested_vmx_pinbased_ctls_high & PIN_BASED_VMX_PREEMPTION_TIMER) ||
2206 !(nested_vmx_exit_ctls_high & VM_EXIT_SAVE_VMX_PREEMPTION_TIMER)) {
2207 nested_vmx_exit_ctls_high &= ~VM_EXIT_SAVE_VMX_PREEMPTION_TIMER;
2208 nested_vmx_pinbased_ctls_high &= ~PIN_BASED_VMX_PREEMPTION_TIMER;
2209 }
2208 nested_vmx_exit_ctls_high |= (VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR | 2210 nested_vmx_exit_ctls_high |= (VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR |
2209 VM_EXIT_LOAD_IA32_EFER); 2211 VM_EXIT_LOAD_IA32_EFER | VM_EXIT_SAVE_IA32_EFER);
2210 2212
2211 /* entry controls */ 2213 /* entry controls */
2212 rdmsr(MSR_IA32_VMX_ENTRY_CTLS, 2214 rdmsr(MSR_IA32_VMX_ENTRY_CTLS,
@@ -2226,7 +2228,8 @@ static __init void nested_vmx_setup_ctls_msrs(void)
2226 nested_vmx_procbased_ctls_low, nested_vmx_procbased_ctls_high); 2228 nested_vmx_procbased_ctls_low, nested_vmx_procbased_ctls_high);
2227 nested_vmx_procbased_ctls_low = 0; 2229 nested_vmx_procbased_ctls_low = 0;
2228 nested_vmx_procbased_ctls_high &= 2230 nested_vmx_procbased_ctls_high &=
2229 CPU_BASED_VIRTUAL_INTR_PENDING | CPU_BASED_USE_TSC_OFFSETING | 2231 CPU_BASED_VIRTUAL_INTR_PENDING |
2232 CPU_BASED_VIRTUAL_NMI_PENDING | CPU_BASED_USE_TSC_OFFSETING |
2230 CPU_BASED_HLT_EXITING | CPU_BASED_INVLPG_EXITING | 2233 CPU_BASED_HLT_EXITING | CPU_BASED_INVLPG_EXITING |
2231 CPU_BASED_MWAIT_EXITING | CPU_BASED_CR3_LOAD_EXITING | 2234 CPU_BASED_MWAIT_EXITING | CPU_BASED_CR3_LOAD_EXITING |
2232 CPU_BASED_CR3_STORE_EXITING | 2235 CPU_BASED_CR3_STORE_EXITING |
@@ -2252,13 +2255,15 @@ static __init void nested_vmx_setup_ctls_msrs(void)
2252 nested_vmx_secondary_ctls_low = 0; 2255 nested_vmx_secondary_ctls_low = 0;
2253 nested_vmx_secondary_ctls_high &= 2256 nested_vmx_secondary_ctls_high &=
2254 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES | 2257 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
2258 SECONDARY_EXEC_UNRESTRICTED_GUEST |
2255 SECONDARY_EXEC_WBINVD_EXITING; 2259 SECONDARY_EXEC_WBINVD_EXITING;
2256 2260
2257 if (enable_ept) { 2261 if (enable_ept) {
2258 /* nested EPT: emulate EPT also to L1 */ 2262 /* nested EPT: emulate EPT also to L1 */
2259 nested_vmx_secondary_ctls_high |= SECONDARY_EXEC_ENABLE_EPT; 2263 nested_vmx_secondary_ctls_high |= SECONDARY_EXEC_ENABLE_EPT;
2260 nested_vmx_ept_caps = VMX_EPT_PAGE_WALK_4_BIT | 2264 nested_vmx_ept_caps = VMX_EPT_PAGE_WALK_4_BIT |
2261 VMX_EPTP_WB_BIT | VMX_EPT_INVEPT_BIT; 2265 VMX_EPTP_WB_BIT | VMX_EPT_2MB_PAGE_BIT |
2266 VMX_EPT_INVEPT_BIT;
2262 nested_vmx_ept_caps &= vmx_capability.ept; 2267 nested_vmx_ept_caps &= vmx_capability.ept;
2263 /* 2268 /*
2264 * Since invept is completely emulated we support both global 2269 * Since invept is completely emulated we support both global
@@ -3255,25 +3260,29 @@ static void vmx_decache_cr4_guest_bits(struct kvm_vcpu *vcpu)
3255 3260
3256static void ept_load_pdptrs(struct kvm_vcpu *vcpu) 3261static void ept_load_pdptrs(struct kvm_vcpu *vcpu)
3257{ 3262{
3263 struct kvm_mmu *mmu = vcpu->arch.walk_mmu;
3264
3258 if (!test_bit(VCPU_EXREG_PDPTR, 3265 if (!test_bit(VCPU_EXREG_PDPTR,
3259 (unsigned long *)&vcpu->arch.regs_dirty)) 3266 (unsigned long *)&vcpu->arch.regs_dirty))
3260 return; 3267 return;
3261 3268
3262 if (is_paging(vcpu) && is_pae(vcpu) && !is_long_mode(vcpu)) { 3269 if (is_paging(vcpu) && is_pae(vcpu) && !is_long_mode(vcpu)) {
3263 vmcs_write64(GUEST_PDPTR0, vcpu->arch.mmu.pdptrs[0]); 3270 vmcs_write64(GUEST_PDPTR0, mmu->pdptrs[0]);
3264 vmcs_write64(GUEST_PDPTR1, vcpu->arch.mmu.pdptrs[1]); 3271 vmcs_write64(GUEST_PDPTR1, mmu->pdptrs[1]);
3265 vmcs_write64(GUEST_PDPTR2, vcpu->arch.mmu.pdptrs[2]); 3272 vmcs_write64(GUEST_PDPTR2, mmu->pdptrs[2]);
3266 vmcs_write64(GUEST_PDPTR3, vcpu->arch.mmu.pdptrs[3]); 3273 vmcs_write64(GUEST_PDPTR3, mmu->pdptrs[3]);
3267 } 3274 }
3268} 3275}
3269 3276
3270static void ept_save_pdptrs(struct kvm_vcpu *vcpu) 3277static void ept_save_pdptrs(struct kvm_vcpu *vcpu)
3271{ 3278{
3279 struct kvm_mmu *mmu = vcpu->arch.walk_mmu;
3280
3272 if (is_paging(vcpu) && is_pae(vcpu) && !is_long_mode(vcpu)) { 3281 if (is_paging(vcpu) && is_pae(vcpu) && !is_long_mode(vcpu)) {
3273 vcpu->arch.mmu.pdptrs[0] = vmcs_read64(GUEST_PDPTR0); 3282 mmu->pdptrs[0] = vmcs_read64(GUEST_PDPTR0);
3274 vcpu->arch.mmu.pdptrs[1] = vmcs_read64(GUEST_PDPTR1); 3283 mmu->pdptrs[1] = vmcs_read64(GUEST_PDPTR1);
3275 vcpu->arch.mmu.pdptrs[2] = vmcs_read64(GUEST_PDPTR2); 3284 mmu->pdptrs[2] = vmcs_read64(GUEST_PDPTR2);
3276 vcpu->arch.mmu.pdptrs[3] = vmcs_read64(GUEST_PDPTR3); 3285 mmu->pdptrs[3] = vmcs_read64(GUEST_PDPTR3);
3277 } 3286 }
3278 3287
3279 __set_bit(VCPU_EXREG_PDPTR, 3288 __set_bit(VCPU_EXREG_PDPTR,
@@ -3376,8 +3385,10 @@ static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
3376 if (enable_ept) { 3385 if (enable_ept) {
3377 eptp = construct_eptp(cr3); 3386 eptp = construct_eptp(cr3);
3378 vmcs_write64(EPT_POINTER, eptp); 3387 vmcs_write64(EPT_POINTER, eptp);
3379 guest_cr3 = is_paging(vcpu) ? kvm_read_cr3(vcpu) : 3388 if (is_paging(vcpu) || is_guest_mode(vcpu))
3380 vcpu->kvm->arch.ept_identity_map_addr; 3389 guest_cr3 = kvm_read_cr3(vcpu);
3390 else
3391 guest_cr3 = vcpu->kvm->arch.ept_identity_map_addr;
3381 ept_load_pdptrs(vcpu); 3392 ept_load_pdptrs(vcpu);
3382 } 3393 }
3383 3394
@@ -4875,6 +4886,17 @@ vmx_patch_hypercall(struct kvm_vcpu *vcpu, unsigned char *hypercall)
4875 hypercall[2] = 0xc1; 4886 hypercall[2] = 0xc1;
4876} 4887}
4877 4888
4889static bool nested_cr0_valid(struct vmcs12 *vmcs12, unsigned long val)
4890{
4891 unsigned long always_on = VMXON_CR0_ALWAYSON;
4892
4893 if (nested_vmx_secondary_ctls_high &
4894 SECONDARY_EXEC_UNRESTRICTED_GUEST &&
4895 nested_cpu_has2(vmcs12, SECONDARY_EXEC_UNRESTRICTED_GUEST))
4896 always_on &= ~(X86_CR0_PE | X86_CR0_PG);
4897 return (val & always_on) == always_on;
4898}
4899
4878/* called to set cr0 as appropriate for a mov-to-cr0 exit. */ 4900/* called to set cr0 as appropriate for a mov-to-cr0 exit. */
4879static int handle_set_cr0(struct kvm_vcpu *vcpu, unsigned long val) 4901static int handle_set_cr0(struct kvm_vcpu *vcpu, unsigned long val)
4880{ 4902{
@@ -4893,9 +4915,7 @@ static int handle_set_cr0(struct kvm_vcpu *vcpu, unsigned long val)
4893 val = (val & ~vmcs12->cr0_guest_host_mask) | 4915 val = (val & ~vmcs12->cr0_guest_host_mask) |
4894 (vmcs12->guest_cr0 & vmcs12->cr0_guest_host_mask); 4916 (vmcs12->guest_cr0 & vmcs12->cr0_guest_host_mask);
4895 4917
4896 /* TODO: will have to take unrestricted guest mode into 4918 if (!nested_cr0_valid(vmcs12, val))
4897 * account */
4898 if ((val & VMXON_CR0_ALWAYSON) != VMXON_CR0_ALWAYSON)
4899 return 1; 4919 return 1;
4900 4920
4901 if (kvm_set_cr0(vcpu, val)) 4921 if (kvm_set_cr0(vcpu, val))
@@ -5339,6 +5359,17 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu)
5339 return 0; 5359 return 0;
5340 } 5360 }
5341 5361
5362 /*
5363 * EPT violation happened while executing iret from NMI,
5364 * "blocked by NMI" bit has to be set before next VM entry.
5365 * There are errata that may cause this bit to not be set:
5366 * AAK134, BY25.
5367 */
5368 if (!(to_vmx(vcpu)->idt_vectoring_info & VECTORING_INFO_VALID_MASK) &&
5369 cpu_has_virtual_nmis() &&
5370 (exit_qualification & INTR_INFO_UNBLOCK_NMI))
5371 vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO, GUEST_INTR_STATE_NMI);
5372
5342 gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS); 5373 gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS);
5343 trace_kvm_page_fault(gpa, exit_qualification); 5374 trace_kvm_page_fault(gpa, exit_qualification);
5344 5375
@@ -6612,6 +6643,9 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
6612 return 0; 6643 return 0;
6613 else if (is_page_fault(intr_info)) 6644 else if (is_page_fault(intr_info))
6614 return enable_ept; 6645 return enable_ept;
6646 else if (is_no_device(intr_info) &&
6647 !(nested_read_cr0(vmcs12) & X86_CR0_TS))
6648 return 0;
6615 return vmcs12->exception_bitmap & 6649 return vmcs12->exception_bitmap &
6616 (1u << (intr_info & INTR_INFO_VECTOR_MASK)); 6650 (1u << (intr_info & INTR_INFO_VECTOR_MASK));
6617 case EXIT_REASON_EXTERNAL_INTERRUPT: 6651 case EXIT_REASON_EXTERNAL_INTERRUPT:
@@ -6707,6 +6741,27 @@ static void vmx_get_exit_info(struct kvm_vcpu *vcpu, u64 *info1, u64 *info2)
6707 *info2 = vmcs_read32(VM_EXIT_INTR_INFO); 6741 *info2 = vmcs_read32(VM_EXIT_INTR_INFO);
6708} 6742}
6709 6743
6744static void nested_adjust_preemption_timer(struct kvm_vcpu *vcpu)
6745{
6746 u64 delta_tsc_l1;
6747 u32 preempt_val_l1, preempt_val_l2, preempt_scale;
6748
6749 if (!(get_vmcs12(vcpu)->pin_based_vm_exec_control &
6750 PIN_BASED_VMX_PREEMPTION_TIMER))
6751 return;
6752 preempt_scale = native_read_msr(MSR_IA32_VMX_MISC) &
6753 MSR_IA32_VMX_MISC_PREEMPTION_TIMER_SCALE;
6754 preempt_val_l2 = vmcs_read32(VMX_PREEMPTION_TIMER_VALUE);
6755 delta_tsc_l1 = vmx_read_l1_tsc(vcpu, native_read_tsc())
6756 - vcpu->arch.last_guest_tsc;
6757 preempt_val_l1 = delta_tsc_l1 >> preempt_scale;
6758 if (preempt_val_l2 <= preempt_val_l1)
6759 preempt_val_l2 = 0;
6760 else
6761 preempt_val_l2 -= preempt_val_l1;
6762 vmcs_write32(VMX_PREEMPTION_TIMER_VALUE, preempt_val_l2);
6763}
6764
6710/* 6765/*
6711 * The guest has exited. See if we can fix it or if we need userspace 6766 * The guest has exited. See if we can fix it or if we need userspace
6712 * assistance. 6767 * assistance.
@@ -6721,20 +6776,6 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu)
6721 if (vmx->emulation_required) 6776 if (vmx->emulation_required)
6722 return handle_invalid_guest_state(vcpu); 6777 return handle_invalid_guest_state(vcpu);
6723 6778
6724 /*
6725 * the KVM_REQ_EVENT optimization bit is only on for one entry, and if
6726 * we did not inject a still-pending event to L1 now because of
6727 * nested_run_pending, we need to re-enable this bit.
6728 */
6729 if (vmx->nested.nested_run_pending)
6730 kvm_make_request(KVM_REQ_EVENT, vcpu);
6731
6732 if (!is_guest_mode(vcpu) && (exit_reason == EXIT_REASON_VMLAUNCH ||
6733 exit_reason == EXIT_REASON_VMRESUME))
6734 vmx->nested.nested_run_pending = 1;
6735 else
6736 vmx->nested.nested_run_pending = 0;
6737
6738 if (is_guest_mode(vcpu) && nested_vmx_exit_handled(vcpu)) { 6779 if (is_guest_mode(vcpu) && nested_vmx_exit_handled(vcpu)) {
6739 nested_vmx_vmexit(vcpu); 6780 nested_vmx_vmexit(vcpu);
6740 return 1; 6781 return 1;
@@ -7046,9 +7087,9 @@ static void __vmx_complete_interrupts(struct kvm_vcpu *vcpu,
7046 case INTR_TYPE_HARD_EXCEPTION: 7087 case INTR_TYPE_HARD_EXCEPTION:
7047 if (idt_vectoring_info & VECTORING_INFO_DELIVER_CODE_MASK) { 7088 if (idt_vectoring_info & VECTORING_INFO_DELIVER_CODE_MASK) {
7048 u32 err = vmcs_read32(error_code_field); 7089 u32 err = vmcs_read32(error_code_field);
7049 kvm_queue_exception_e(vcpu, vector, err); 7090 kvm_requeue_exception_e(vcpu, vector, err);
7050 } else 7091 } else
7051 kvm_queue_exception(vcpu, vector); 7092 kvm_requeue_exception(vcpu, vector);
7052 break; 7093 break;
7053 case INTR_TYPE_SOFT_INTR: 7094 case INTR_TYPE_SOFT_INTR:
7054 vcpu->arch.event_exit_inst_len = vmcs_read32(instr_len_field); 7095 vcpu->arch.event_exit_inst_len = vmcs_read32(instr_len_field);
@@ -7131,6 +7172,8 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
7131 atomic_switch_perf_msrs(vmx); 7172 atomic_switch_perf_msrs(vmx);
7132 debugctlmsr = get_debugctlmsr(); 7173 debugctlmsr = get_debugctlmsr();
7133 7174
7175 if (is_guest_mode(vcpu) && !vmx->nested.nested_run_pending)
7176 nested_adjust_preemption_timer(vcpu);
7134 vmx->__launched = vmx->loaded_vmcs->launched; 7177 vmx->__launched = vmx->loaded_vmcs->launched;
7135 asm( 7178 asm(
7136 /* Store host registers */ 7179 /* Store host registers */
@@ -7269,6 +7312,16 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
7269 vmx->exit_reason = vmcs_read32(VM_EXIT_REASON); 7312 vmx->exit_reason = vmcs_read32(VM_EXIT_REASON);
7270 trace_kvm_exit(vmx->exit_reason, vcpu, KVM_ISA_VMX); 7313 trace_kvm_exit(vmx->exit_reason, vcpu, KVM_ISA_VMX);
7271 7314
7315 /*
7316 * the KVM_REQ_EVENT optimization bit is only on for one entry, and if
7317 * we did not inject a still-pending event to L1 now because of
7318 * nested_run_pending, we need to re-enable this bit.
7319 */
7320 if (vmx->nested.nested_run_pending)
7321 kvm_make_request(KVM_REQ_EVENT, vcpu);
7322
7323 vmx->nested.nested_run_pending = 0;
7324
7272 vmx_complete_atomic_exit(vmx); 7325 vmx_complete_atomic_exit(vmx);
7273 vmx_recover_nmi_blocking(vmx); 7326 vmx_recover_nmi_blocking(vmx);
7274 vmx_complete_interrupts(vmx); 7327 vmx_complete_interrupts(vmx);
@@ -7395,8 +7448,7 @@ static u64 vmx_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio)
7395 */ 7448 */
7396 if (is_mmio) 7449 if (is_mmio)
7397 ret = MTRR_TYPE_UNCACHABLE << VMX_EPT_MT_EPTE_SHIFT; 7450 ret = MTRR_TYPE_UNCACHABLE << VMX_EPT_MT_EPTE_SHIFT;
7398 else if (vcpu->kvm->arch.iommu_domain && 7451 else if (kvm_arch_has_noncoherent_dma(vcpu->kvm))
7399 !(vcpu->kvm->arch.iommu_flags & KVM_IOMMU_CACHE_COHERENCY))
7400 ret = kvm_get_guest_memory_type(vcpu, gfn) << 7452 ret = kvm_get_guest_memory_type(vcpu, gfn) <<
7401 VMX_EPT_MT_EPTE_SHIFT; 7453 VMX_EPT_MT_EPTE_SHIFT;
7402 else 7454 else
@@ -7486,9 +7538,9 @@ static unsigned long nested_ept_get_cr3(struct kvm_vcpu *vcpu)
7486 return get_vmcs12(vcpu)->ept_pointer; 7538 return get_vmcs12(vcpu)->ept_pointer;
7487} 7539}
7488 7540
7489static int nested_ept_init_mmu_context(struct kvm_vcpu *vcpu) 7541static void nested_ept_init_mmu_context(struct kvm_vcpu *vcpu)
7490{ 7542{
7491 int r = kvm_init_shadow_ept_mmu(vcpu, &vcpu->arch.mmu, 7543 kvm_init_shadow_ept_mmu(vcpu, &vcpu->arch.mmu,
7492 nested_vmx_ept_caps & VMX_EPT_EXECUTE_ONLY_BIT); 7544 nested_vmx_ept_caps & VMX_EPT_EXECUTE_ONLY_BIT);
7493 7545
7494 vcpu->arch.mmu.set_cr3 = vmx_set_cr3; 7546 vcpu->arch.mmu.set_cr3 = vmx_set_cr3;
@@ -7496,8 +7548,6 @@ static int nested_ept_init_mmu_context(struct kvm_vcpu *vcpu)
7496 vcpu->arch.mmu.inject_page_fault = nested_ept_inject_page_fault; 7548 vcpu->arch.mmu.inject_page_fault = nested_ept_inject_page_fault;
7497 7549
7498 vcpu->arch.walk_mmu = &vcpu->arch.nested_mmu; 7550 vcpu->arch.walk_mmu = &vcpu->arch.nested_mmu;
7499
7500 return r;
7501} 7551}
7502 7552
7503static void nested_ept_uninit_mmu_context(struct kvm_vcpu *vcpu) 7553static void nested_ept_uninit_mmu_context(struct kvm_vcpu *vcpu)
@@ -7505,6 +7555,20 @@ static void nested_ept_uninit_mmu_context(struct kvm_vcpu *vcpu)
7505 vcpu->arch.walk_mmu = &vcpu->arch.mmu; 7555 vcpu->arch.walk_mmu = &vcpu->arch.mmu;
7506} 7556}
7507 7557
7558static void vmx_inject_page_fault_nested(struct kvm_vcpu *vcpu,
7559 struct x86_exception *fault)
7560{
7561 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
7562
7563 WARN_ON(!is_guest_mode(vcpu));
7564
7565 /* TODO: also check PFEC_MATCH/MASK, not just EB.PF. */
7566 if (vmcs12->exception_bitmap & (1u << PF_VECTOR))
7567 nested_vmx_vmexit(vcpu);
7568 else
7569 kvm_inject_page_fault(vcpu, fault);
7570}
7571
7508/* 7572/*
7509 * prepare_vmcs02 is called when the L1 guest hypervisor runs its nested 7573 * prepare_vmcs02 is called when the L1 guest hypervisor runs its nested
7510 * L2 guest. L1 has a vmcs for L2 (vmcs12), and this function "merges" it 7574 * L2 guest. L1 has a vmcs for L2 (vmcs12), and this function "merges" it
@@ -7518,6 +7582,7 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7518{ 7582{
7519 struct vcpu_vmx *vmx = to_vmx(vcpu); 7583 struct vcpu_vmx *vmx = to_vmx(vcpu);
7520 u32 exec_control; 7584 u32 exec_control;
7585 u32 exit_control;
7521 7586
7522 vmcs_write16(GUEST_ES_SELECTOR, vmcs12->guest_es_selector); 7587 vmcs_write16(GUEST_ES_SELECTOR, vmcs12->guest_es_selector);
7523 vmcs_write16(GUEST_CS_SELECTOR, vmcs12->guest_cs_selector); 7588 vmcs_write16(GUEST_CS_SELECTOR, vmcs12->guest_cs_selector);
@@ -7691,7 +7756,10 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7691 * we should use its exit controls. Note that VM_EXIT_LOAD_IA32_EFER 7756 * we should use its exit controls. Note that VM_EXIT_LOAD_IA32_EFER
7692 * bits are further modified by vmx_set_efer() below. 7757 * bits are further modified by vmx_set_efer() below.
7693 */ 7758 */
7694 vmcs_write32(VM_EXIT_CONTROLS, vmcs_config.vmexit_ctrl); 7759 exit_control = vmcs_config.vmexit_ctrl;
7760 if (vmcs12->pin_based_vm_exec_control & PIN_BASED_VMX_PREEMPTION_TIMER)
7761 exit_control |= VM_EXIT_SAVE_VMX_PREEMPTION_TIMER;
7762 vmcs_write32(VM_EXIT_CONTROLS, exit_control);
7695 7763
7696 /* vmcs12's VM_ENTRY_LOAD_IA32_EFER and VM_ENTRY_IA32E_MODE are 7764 /* vmcs12's VM_ENTRY_LOAD_IA32_EFER and VM_ENTRY_IA32E_MODE are
7697 * emulated by vmx_set_efer(), below. 7765 * emulated by vmx_set_efer(), below.
@@ -7758,6 +7826,9 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7758 kvm_set_cr3(vcpu, vmcs12->guest_cr3); 7826 kvm_set_cr3(vcpu, vmcs12->guest_cr3);
7759 kvm_mmu_reset_context(vcpu); 7827 kvm_mmu_reset_context(vcpu);
7760 7828
7829 if (!enable_ept)
7830 vcpu->arch.walk_mmu->inject_page_fault = vmx_inject_page_fault_nested;
7831
7761 /* 7832 /*
7762 * L1 may access the L2's PDPTR, so save them to construct vmcs12 7833 * L1 may access the L2's PDPTR, so save them to construct vmcs12
7763 */ 7834 */
@@ -7861,7 +7932,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
7861 return 1; 7932 return 1;
7862 } 7933 }
7863 7934
7864 if (((vmcs12->guest_cr0 & VMXON_CR0_ALWAYSON) != VMXON_CR0_ALWAYSON) || 7935 if (!nested_cr0_valid(vmcs12, vmcs12->guest_cr0) ||
7865 ((vmcs12->guest_cr4 & VMXON_CR4_ALWAYSON) != VMXON_CR4_ALWAYSON)) { 7936 ((vmcs12->guest_cr4 & VMXON_CR4_ALWAYSON) != VMXON_CR4_ALWAYSON)) {
7866 nested_vmx_entry_failure(vcpu, vmcs12, 7937 nested_vmx_entry_failure(vcpu, vmcs12,
7867 EXIT_REASON_INVALID_STATE, ENTRY_FAIL_DEFAULT); 7938 EXIT_REASON_INVALID_STATE, ENTRY_FAIL_DEFAULT);
@@ -7923,6 +7994,8 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
7923 7994
7924 enter_guest_mode(vcpu); 7995 enter_guest_mode(vcpu);
7925 7996
7997 vmx->nested.nested_run_pending = 1;
7998
7926 vmx->nested.vmcs01_tsc_offset = vmcs_read64(TSC_OFFSET); 7999 vmx->nested.vmcs01_tsc_offset = vmcs_read64(TSC_OFFSET);
7927 8000
7928 cpu = get_cpu(); 8001 cpu = get_cpu();
@@ -7990,7 +8063,7 @@ static void vmcs12_save_pending_event(struct kvm_vcpu *vcpu,
7990 u32 idt_vectoring; 8063 u32 idt_vectoring;
7991 unsigned int nr; 8064 unsigned int nr;
7992 8065
7993 if (vcpu->arch.exception.pending) { 8066 if (vcpu->arch.exception.pending && vcpu->arch.exception.reinject) {
7994 nr = vcpu->arch.exception.nr; 8067 nr = vcpu->arch.exception.nr;
7995 idt_vectoring = nr | VECTORING_INFO_VALID_MASK; 8068 idt_vectoring = nr | VECTORING_INFO_VALID_MASK;
7996 8069
@@ -8008,7 +8081,7 @@ static void vmcs12_save_pending_event(struct kvm_vcpu *vcpu,
8008 } 8081 }
8009 8082
8010 vmcs12->idt_vectoring_info_field = idt_vectoring; 8083 vmcs12->idt_vectoring_info_field = idt_vectoring;
8011 } else if (vcpu->arch.nmi_pending) { 8084 } else if (vcpu->arch.nmi_injected) {
8012 vmcs12->idt_vectoring_info_field = 8085 vmcs12->idt_vectoring_info_field =
8013 INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK | NMI_VECTOR; 8086 INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK | NMI_VECTOR;
8014 } else if (vcpu->arch.interrupt.pending) { 8087 } else if (vcpu->arch.interrupt.pending) {
@@ -8090,6 +8163,11 @@ static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
8090 vmcs12->guest_pending_dbg_exceptions = 8163 vmcs12->guest_pending_dbg_exceptions =
8091 vmcs_readl(GUEST_PENDING_DBG_EXCEPTIONS); 8164 vmcs_readl(GUEST_PENDING_DBG_EXCEPTIONS);
8092 8165
8166 if ((vmcs12->pin_based_vm_exec_control & PIN_BASED_VMX_PREEMPTION_TIMER) &&
8167 (vmcs12->vm_exit_controls & VM_EXIT_SAVE_VMX_PREEMPTION_TIMER))
8168 vmcs12->vmx_preemption_timer_value =
8169 vmcs_read32(VMX_PREEMPTION_TIMER_VALUE);
8170
8093 /* 8171 /*
8094 * In some cases (usually, nested EPT), L2 is allowed to change its 8172 * In some cases (usually, nested EPT), L2 is allowed to change its
8095 * own CR3 without exiting. If it has changed it, we must keep it. 8173 * own CR3 without exiting. If it has changed it, we must keep it.
@@ -8115,6 +8193,8 @@ static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
8115 vmcs12->guest_ia32_debugctl = vmcs_read64(GUEST_IA32_DEBUGCTL); 8193 vmcs12->guest_ia32_debugctl = vmcs_read64(GUEST_IA32_DEBUGCTL);
8116 if (vmcs12->vm_exit_controls & VM_EXIT_SAVE_IA32_PAT) 8194 if (vmcs12->vm_exit_controls & VM_EXIT_SAVE_IA32_PAT)
8117 vmcs12->guest_ia32_pat = vmcs_read64(GUEST_IA32_PAT); 8195 vmcs12->guest_ia32_pat = vmcs_read64(GUEST_IA32_PAT);
8196 if (vmcs12->vm_exit_controls & VM_EXIT_SAVE_IA32_EFER)
8197 vmcs12->guest_ia32_efer = vcpu->arch.efer;
8118 vmcs12->guest_sysenter_cs = vmcs_read32(GUEST_SYSENTER_CS); 8198 vmcs12->guest_sysenter_cs = vmcs_read32(GUEST_SYSENTER_CS);
8119 vmcs12->guest_sysenter_esp = vmcs_readl(GUEST_SYSENTER_ESP); 8199 vmcs12->guest_sysenter_esp = vmcs_readl(GUEST_SYSENTER_ESP);
8120 vmcs12->guest_sysenter_eip = vmcs_readl(GUEST_SYSENTER_EIP); 8200 vmcs12->guest_sysenter_eip = vmcs_readl(GUEST_SYSENTER_EIP);
@@ -8186,7 +8266,7 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
8186 * fpu_active (which may have changed). 8266 * fpu_active (which may have changed).
8187 * Note that vmx_set_cr0 refers to efer set above. 8267 * Note that vmx_set_cr0 refers to efer set above.
8188 */ 8268 */
8189 kvm_set_cr0(vcpu, vmcs12->host_cr0); 8269 vmx_set_cr0(vcpu, vmcs12->host_cr0);
8190 /* 8270 /*
8191 * If we did fpu_activate()/fpu_deactivate() during L2's run, we need 8271 * If we did fpu_activate()/fpu_deactivate() during L2's run, we need
8192 * to apply the same changes to L1's vmcs. We just set cr0 correctly, 8272 * to apply the same changes to L1's vmcs. We just set cr0 correctly,
@@ -8209,6 +8289,9 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
8209 kvm_set_cr3(vcpu, vmcs12->host_cr3); 8289 kvm_set_cr3(vcpu, vmcs12->host_cr3);
8210 kvm_mmu_reset_context(vcpu); 8290 kvm_mmu_reset_context(vcpu);
8211 8291
8292 if (!enable_ept)
8293 vcpu->arch.walk_mmu->inject_page_fault = kvm_inject_page_fault;
8294
8212 if (enable_vpid) { 8295 if (enable_vpid) {
8213 /* 8296 /*
8214 * Trivially support vpid by letting L2s share their parent 8297 * Trivially support vpid by letting L2s share their parent
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e5ca72a5cdb6..21ef1ba184ae 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -577,6 +577,7 @@ static void kvm_put_guest_xcr0(struct kvm_vcpu *vcpu)
577int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) 577int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
578{ 578{
579 u64 xcr0; 579 u64 xcr0;
580 u64 valid_bits;
580 581
581 /* Only support XCR_XFEATURE_ENABLED_MASK(xcr0) now */ 582 /* Only support XCR_XFEATURE_ENABLED_MASK(xcr0) now */
582 if (index != XCR_XFEATURE_ENABLED_MASK) 583 if (index != XCR_XFEATURE_ENABLED_MASK)
@@ -586,8 +587,16 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
586 return 1; 587 return 1;
587 if ((xcr0 & XSTATE_YMM) && !(xcr0 & XSTATE_SSE)) 588 if ((xcr0 & XSTATE_YMM) && !(xcr0 & XSTATE_SSE))
588 return 1; 589 return 1;
589 if (xcr0 & ~host_xcr0) 590
591 /*
592 * Do not allow the guest to set bits that we do not support
593 * saving. However, xcr0 bit 0 is always set, even if the
594 * emulated CPU does not support XSAVE (see fx_init).
595 */
596 valid_bits = vcpu->arch.guest_supported_xcr0 | XSTATE_FP;
597 if (xcr0 & ~valid_bits)
590 return 1; 598 return 1;
599
591 kvm_put_guest_xcr0(vcpu); 600 kvm_put_guest_xcr0(vcpu);
592 vcpu->arch.xcr0 = xcr0; 601 vcpu->arch.xcr0 = xcr0;
593 return 0; 602 return 0;
@@ -684,7 +693,7 @@ int kvm_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
684 693
685 vcpu->arch.cr3 = cr3; 694 vcpu->arch.cr3 = cr3;
686 __set_bit(VCPU_EXREG_CR3, (ulong *)&vcpu->arch.regs_avail); 695 __set_bit(VCPU_EXREG_CR3, (ulong *)&vcpu->arch.regs_avail);
687 vcpu->arch.mmu.new_cr3(vcpu); 696 kvm_mmu_new_cr3(vcpu);
688 return 0; 697 return 0;
689} 698}
690EXPORT_SYMBOL_GPL(kvm_set_cr3); 699EXPORT_SYMBOL_GPL(kvm_set_cr3);
@@ -2564,6 +2573,7 @@ int kvm_dev_ioctl_check_extension(long ext)
2564 case KVM_CAP_MMU_SHADOW_CACHE_CONTROL: 2573 case KVM_CAP_MMU_SHADOW_CACHE_CONTROL:
2565 case KVM_CAP_SET_TSS_ADDR: 2574 case KVM_CAP_SET_TSS_ADDR:
2566 case KVM_CAP_EXT_CPUID: 2575 case KVM_CAP_EXT_CPUID:
2576 case KVM_CAP_EXT_EMUL_CPUID:
2567 case KVM_CAP_CLOCKSOURCE: 2577 case KVM_CAP_CLOCKSOURCE:
2568 case KVM_CAP_PIT: 2578 case KVM_CAP_PIT:
2569 case KVM_CAP_NOP_IO_DELAY: 2579 case KVM_CAP_NOP_IO_DELAY:
@@ -2673,15 +2683,17 @@ long kvm_arch_dev_ioctl(struct file *filp,
2673 r = 0; 2683 r = 0;
2674 break; 2684 break;
2675 } 2685 }
2676 case KVM_GET_SUPPORTED_CPUID: { 2686 case KVM_GET_SUPPORTED_CPUID:
2687 case KVM_GET_EMULATED_CPUID: {
2677 struct kvm_cpuid2 __user *cpuid_arg = argp; 2688 struct kvm_cpuid2 __user *cpuid_arg = argp;
2678 struct kvm_cpuid2 cpuid; 2689 struct kvm_cpuid2 cpuid;
2679 2690
2680 r = -EFAULT; 2691 r = -EFAULT;
2681 if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid)) 2692 if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid))
2682 goto out; 2693 goto out;
2683 r = kvm_dev_ioctl_get_supported_cpuid(&cpuid, 2694
2684 cpuid_arg->entries); 2695 r = kvm_dev_ioctl_get_cpuid(&cpuid, cpuid_arg->entries,
2696 ioctl);
2685 if (r) 2697 if (r)
2686 goto out; 2698 goto out;
2687 2699
@@ -2715,8 +2727,7 @@ static void wbinvd_ipi(void *garbage)
2715 2727
2716static bool need_emulate_wbinvd(struct kvm_vcpu *vcpu) 2728static bool need_emulate_wbinvd(struct kvm_vcpu *vcpu)
2717{ 2729{
2718 return vcpu->kvm->arch.iommu_domain && 2730 return kvm_arch_has_noncoherent_dma(vcpu->kvm);
2719 !(vcpu->kvm->arch.iommu_flags & KVM_IOMMU_CACHE_COHERENCY);
2720} 2731}
2721 2732
2722void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 2733void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
@@ -2984,11 +2995,13 @@ static int kvm_vcpu_ioctl_x86_set_debugregs(struct kvm_vcpu *vcpu,
2984static void kvm_vcpu_ioctl_x86_get_xsave(struct kvm_vcpu *vcpu, 2995static void kvm_vcpu_ioctl_x86_get_xsave(struct kvm_vcpu *vcpu,
2985 struct kvm_xsave *guest_xsave) 2996 struct kvm_xsave *guest_xsave)
2986{ 2997{
2987 if (cpu_has_xsave) 2998 if (cpu_has_xsave) {
2988 memcpy(guest_xsave->region, 2999 memcpy(guest_xsave->region,
2989 &vcpu->arch.guest_fpu.state->xsave, 3000 &vcpu->arch.guest_fpu.state->xsave,
2990 xstate_size); 3001 vcpu->arch.guest_xstate_size);
2991 else { 3002 *(u64 *)&guest_xsave->region[XSAVE_HDR_OFFSET / sizeof(u32)] &=
3003 vcpu->arch.guest_supported_xcr0 | XSTATE_FPSSE;
3004 } else {
2992 memcpy(guest_xsave->region, 3005 memcpy(guest_xsave->region,
2993 &vcpu->arch.guest_fpu.state->fxsave, 3006 &vcpu->arch.guest_fpu.state->fxsave,
2994 sizeof(struct i387_fxsave_struct)); 3007 sizeof(struct i387_fxsave_struct));
@@ -3003,10 +3016,19 @@ static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu,
3003 u64 xstate_bv = 3016 u64 xstate_bv =
3004 *(u64 *)&guest_xsave->region[XSAVE_HDR_OFFSET / sizeof(u32)]; 3017 *(u64 *)&guest_xsave->region[XSAVE_HDR_OFFSET / sizeof(u32)];
3005 3018
3006 if (cpu_has_xsave) 3019 if (cpu_has_xsave) {
3020 /*
3021 * Here we allow setting states that are not present in
3022 * CPUID leaf 0xD, index 0, EDX:EAX. This is for compatibility
3023 * with old userspace.
3024 */
3025 if (xstate_bv & ~KVM_SUPPORTED_XCR0)
3026 return -EINVAL;
3027 if (xstate_bv & ~host_xcr0)
3028 return -EINVAL;
3007 memcpy(&vcpu->arch.guest_fpu.state->xsave, 3029 memcpy(&vcpu->arch.guest_fpu.state->xsave,
3008 guest_xsave->region, xstate_size); 3030 guest_xsave->region, vcpu->arch.guest_xstate_size);
3009 else { 3031 } else {
3010 if (xstate_bv & ~XSTATE_FPSSE) 3032 if (xstate_bv & ~XSTATE_FPSSE)
3011 return -EINVAL; 3033 return -EINVAL;
3012 memcpy(&vcpu->arch.guest_fpu.state->fxsave, 3034 memcpy(&vcpu->arch.guest_fpu.state->fxsave,
@@ -3042,9 +3064,9 @@ static int kvm_vcpu_ioctl_x86_set_xcrs(struct kvm_vcpu *vcpu,
3042 3064
3043 for (i = 0; i < guest_xcrs->nr_xcrs; i++) 3065 for (i = 0; i < guest_xcrs->nr_xcrs; i++)
3044 /* Only support XCR0 currently */ 3066 /* Only support XCR0 currently */
3045 if (guest_xcrs->xcrs[0].xcr == XCR_XFEATURE_ENABLED_MASK) { 3067 if (guest_xcrs->xcrs[i].xcr == XCR_XFEATURE_ENABLED_MASK) {
3046 r = __kvm_set_xcr(vcpu, XCR_XFEATURE_ENABLED_MASK, 3068 r = __kvm_set_xcr(vcpu, XCR_XFEATURE_ENABLED_MASK,
3047 guest_xcrs->xcrs[0].value); 3069 guest_xcrs->xcrs[i].value);
3048 break; 3070 break;
3049 } 3071 }
3050 if (r) 3072 if (r)
@@ -4775,8 +4797,8 @@ static void inject_emulated_exception(struct kvm_vcpu *vcpu)
4775 4797
4776static void init_decode_cache(struct x86_emulate_ctxt *ctxt) 4798static void init_decode_cache(struct x86_emulate_ctxt *ctxt)
4777{ 4799{
4778 memset(&ctxt->twobyte, 0, 4800 memset(&ctxt->opcode_len, 0,
4779 (void *)&ctxt->_regs - (void *)&ctxt->twobyte); 4801 (void *)&ctxt->_regs - (void *)&ctxt->opcode_len);
4780 4802
4781 ctxt->fetch.start = 0; 4803 ctxt->fetch.start = 0;
4782 ctxt->fetch.end = 0; 4804 ctxt->fetch.end = 0;
@@ -5094,8 +5116,7 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu,
5094 ctxt->have_exception = false; 5116 ctxt->have_exception = false;
5095 ctxt->perm_ok = false; 5117 ctxt->perm_ok = false;
5096 5118
5097 ctxt->only_vendor_specific_insn 5119 ctxt->ud = emulation_type & EMULTYPE_TRAP_UD;
5098 = emulation_type & EMULTYPE_TRAP_UD;
5099 5120
5100 r = x86_decode_insn(ctxt, insn, insn_len); 5121 r = x86_decode_insn(ctxt, insn, insn_len);
5101 5122
@@ -5263,7 +5284,7 @@ static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long va
5263 5284
5264 smp_call_function_single(freq->cpu, tsc_khz_changed, freq, 1); 5285 smp_call_function_single(freq->cpu, tsc_khz_changed, freq, 1);
5265 5286
5266 raw_spin_lock(&kvm_lock); 5287 spin_lock(&kvm_lock);
5267 list_for_each_entry(kvm, &vm_list, vm_list) { 5288 list_for_each_entry(kvm, &vm_list, vm_list) {
5268 kvm_for_each_vcpu(i, vcpu, kvm) { 5289 kvm_for_each_vcpu(i, vcpu, kvm) {
5269 if (vcpu->cpu != freq->cpu) 5290 if (vcpu->cpu != freq->cpu)
@@ -5273,7 +5294,7 @@ static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long va
5273 send_ipi = 1; 5294 send_ipi = 1;
5274 } 5295 }
5275 } 5296 }
5276 raw_spin_unlock(&kvm_lock); 5297 spin_unlock(&kvm_lock);
5277 5298
5278 if (freq->old < freq->new && send_ipi) { 5299 if (freq->old < freq->new && send_ipi) {
5279 /* 5300 /*
@@ -5426,12 +5447,12 @@ static void pvclock_gtod_update_fn(struct work_struct *work)
5426 struct kvm_vcpu *vcpu; 5447 struct kvm_vcpu *vcpu;
5427 int i; 5448 int i;
5428 5449
5429 raw_spin_lock(&kvm_lock); 5450 spin_lock(&kvm_lock);
5430 list_for_each_entry(kvm, &vm_list, vm_list) 5451 list_for_each_entry(kvm, &vm_list, vm_list)
5431 kvm_for_each_vcpu(i, vcpu, kvm) 5452 kvm_for_each_vcpu(i, vcpu, kvm)
5432 set_bit(KVM_REQ_MASTERCLOCK_UPDATE, &vcpu->requests); 5453 set_bit(KVM_REQ_MASTERCLOCK_UPDATE, &vcpu->requests);
5433 atomic_set(&kvm_guest_has_master_clock, 0); 5454 atomic_set(&kvm_guest_has_master_clock, 0);
5434 raw_spin_unlock(&kvm_lock); 5455 spin_unlock(&kvm_lock);
5435} 5456}
5436 5457
5437static DECLARE_WORK(pvclock_gtod_work, pvclock_gtod_update_fn); 5458static DECLARE_WORK(pvclock_gtod_work, pvclock_gtod_update_fn);
@@ -5945,10 +5966,12 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
5945 5966
5946 vcpu->mode = IN_GUEST_MODE; 5967 vcpu->mode = IN_GUEST_MODE;
5947 5968
5969 srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
5970
5948 /* We should set ->mode before check ->requests, 5971 /* We should set ->mode before check ->requests,
5949 * see the comment in make_all_cpus_request. 5972 * see the comment in make_all_cpus_request.
5950 */ 5973 */
5951 smp_mb(); 5974 smp_mb__after_srcu_read_unlock();
5952 5975
5953 local_irq_disable(); 5976 local_irq_disable();
5954 5977
@@ -5958,12 +5981,11 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
5958 smp_wmb(); 5981 smp_wmb();
5959 local_irq_enable(); 5982 local_irq_enable();
5960 preempt_enable(); 5983 preempt_enable();
5984 vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
5961 r = 1; 5985 r = 1;
5962 goto cancel_injection; 5986 goto cancel_injection;
5963 } 5987 }
5964 5988
5965 srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
5966
5967 if (req_immediate_exit) 5989 if (req_immediate_exit)
5968 smp_send_reschedule(vcpu->cpu); 5990 smp_send_reschedule(vcpu->cpu);
5969 5991
@@ -6688,7 +6710,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
6688 if (r) 6710 if (r)
6689 return r; 6711 return r;
6690 kvm_vcpu_reset(vcpu); 6712 kvm_vcpu_reset(vcpu);
6691 r = kvm_mmu_setup(vcpu); 6713 kvm_mmu_setup(vcpu);
6692 vcpu_put(vcpu); 6714 vcpu_put(vcpu);
6693 6715
6694 return r; 6716 return r;
@@ -6940,6 +6962,10 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
6940 6962
6941 vcpu->arch.ia32_tsc_adjust_msr = 0x0; 6963 vcpu->arch.ia32_tsc_adjust_msr = 0x0;
6942 vcpu->arch.pv_time_enabled = false; 6964 vcpu->arch.pv_time_enabled = false;
6965
6966 vcpu->arch.guest_supported_xcr0 = 0;
6967 vcpu->arch.guest_xstate_size = XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET;
6968
6943 kvm_async_pf_hash_reset(vcpu); 6969 kvm_async_pf_hash_reset(vcpu);
6944 kvm_pmu_init(vcpu); 6970 kvm_pmu_init(vcpu);
6945 6971
@@ -6981,6 +7007,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
6981 INIT_LIST_HEAD(&kvm->arch.active_mmu_pages); 7007 INIT_LIST_HEAD(&kvm->arch.active_mmu_pages);
6982 INIT_LIST_HEAD(&kvm->arch.zapped_obsolete_pages); 7008 INIT_LIST_HEAD(&kvm->arch.zapped_obsolete_pages);
6983 INIT_LIST_HEAD(&kvm->arch.assigned_dev_head); 7009 INIT_LIST_HEAD(&kvm->arch.assigned_dev_head);
7010 atomic_set(&kvm->arch.noncoherent_dma_count, 0);
6984 7011
6985 /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */ 7012 /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */
6986 set_bit(KVM_USERSPACE_IRQ_SOURCE_ID, &kvm->arch.irq_sources_bitmap); 7013 set_bit(KVM_USERSPACE_IRQ_SOURCE_ID, &kvm->arch.irq_sources_bitmap);
@@ -7065,7 +7092,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
7065 kfree(rcu_dereference_check(kvm->arch.apic_map, 1)); 7092 kfree(rcu_dereference_check(kvm->arch.apic_map, 1));
7066} 7093}
7067 7094
7068void kvm_arch_free_memslot(struct kvm_memory_slot *free, 7095void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
7069 struct kvm_memory_slot *dont) 7096 struct kvm_memory_slot *dont)
7070{ 7097{
7071 int i; 7098 int i;
@@ -7086,7 +7113,8 @@ void kvm_arch_free_memslot(struct kvm_memory_slot *free,
7086 } 7113 }
7087} 7114}
7088 7115
7089int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) 7116int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
7117 unsigned long npages)
7090{ 7118{
7091 int i; 7119 int i;
7092 7120
@@ -7283,7 +7311,7 @@ void kvm_arch_async_page_ready(struct kvm_vcpu *vcpu, struct kvm_async_pf *work)
7283 int r; 7311 int r;
7284 7312
7285 if ((vcpu->arch.mmu.direct_map != work->arch.direct_map) || 7313 if ((vcpu->arch.mmu.direct_map != work->arch.direct_map) ||
7286 is_error_page(work->page)) 7314 work->wakeup_all)
7287 return; 7315 return;
7288 7316
7289 r = kvm_mmu_reload(vcpu); 7317 r = kvm_mmu_reload(vcpu);
@@ -7393,7 +7421,7 @@ void kvm_arch_async_page_present(struct kvm_vcpu *vcpu,
7393 struct x86_exception fault; 7421 struct x86_exception fault;
7394 7422
7395 trace_kvm_async_pf_ready(work->arch.token, work->gva); 7423 trace_kvm_async_pf_ready(work->arch.token, work->gva);
7396 if (is_error_page(work->page)) 7424 if (work->wakeup_all)
7397 work->arch.token = ~0; /* broadcast wakeup */ 7425 work->arch.token = ~0; /* broadcast wakeup */
7398 else 7426 else
7399 kvm_del_async_pf_gfn(vcpu, work->arch.gfn); 7427 kvm_del_async_pf_gfn(vcpu, work->arch.gfn);
@@ -7420,6 +7448,24 @@ bool kvm_arch_can_inject_async_page_present(struct kvm_vcpu *vcpu)
7420 kvm_x86_ops->interrupt_allowed(vcpu); 7448 kvm_x86_ops->interrupt_allowed(vcpu);
7421} 7449}
7422 7450
7451void kvm_arch_register_noncoherent_dma(struct kvm *kvm)
7452{
7453 atomic_inc(&kvm->arch.noncoherent_dma_count);
7454}
7455EXPORT_SYMBOL_GPL(kvm_arch_register_noncoherent_dma);
7456
7457void kvm_arch_unregister_noncoherent_dma(struct kvm *kvm)
7458{
7459 atomic_dec(&kvm->arch.noncoherent_dma_count);
7460}
7461EXPORT_SYMBOL_GPL(kvm_arch_unregister_noncoherent_dma);
7462
7463bool kvm_arch_has_noncoherent_dma(struct kvm *kvm)
7464{
7465 return atomic_read(&kvm->arch.noncoherent_dma_count);
7466}
7467EXPORT_SYMBOL_GPL(kvm_arch_has_noncoherent_dma);
7468
7423EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_exit); 7469EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_exit);
7424EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_inj_virq); 7470EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_inj_virq);
7425EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_page_fault); 7471EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_page_fault);
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index e224f7a671b6..587fb9ede436 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -122,6 +122,7 @@ int kvm_write_guest_virt_system(struct x86_emulate_ctxt *ctxt,
122 gva_t addr, void *val, unsigned int bytes, 122 gva_t addr, void *val, unsigned int bytes,
123 struct x86_exception *exception); 123 struct x86_exception *exception);
124 124
125#define KVM_SUPPORTED_XCR0 (XSTATE_FP | XSTATE_SSE | XSTATE_YMM)
125extern u64 host_xcr0; 126extern u64 host_xcr0;
126 127
127extern struct static_key kvm_no_apic_vcpu; 128extern struct static_key kvm_no_apic_vcpu;
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 96b2c6697c9d..992d63bb154f 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -16,7 +16,7 @@ clean-files := inat-tables.c
16 16
17obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o 17obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o
18 18
19lib-y := delay.o 19lib-y := delay.o misc.o
20lib-y += thunk_$(BITS).o 20lib-y += thunk_$(BITS).o
21lib-y += usercopy_$(BITS).o usercopy.o getuser.o putuser.o 21lib-y += usercopy_$(BITS).o usercopy.o getuser.o putuser.o
22lib-y += memcpy_$(BITS).o 22lib-y += memcpy_$(BITS).o
diff --git a/arch/x86/lib/misc.c b/arch/x86/lib/misc.c
new file mode 100644
index 000000000000..76b373af03f0
--- /dev/null
+++ b/arch/x86/lib/misc.c
@@ -0,0 +1,21 @@
1/*
2 * Count the digits of @val including a possible sign.
3 *
4 * (Typed on and submitted from hpa's mobile phone.)
5 */
6int num_digits(int val)
7{
8 int m = 10;
9 int d = 1;
10
11 if (val < 0) {
12 d++;
13 val = -val;
14 }
15
16 while (val >= m) {
17 m *= 10;
18 d++;
19 }
20 return d;
21}
diff --git a/arch/x86/lib/msr-smp.c b/arch/x86/lib/msr-smp.c
index a6b1b86d2253..518532e6a3fa 100644
--- a/arch/x86/lib/msr-smp.c
+++ b/arch/x86/lib/msr-smp.c
@@ -47,6 +47,21 @@ int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
47} 47}
48EXPORT_SYMBOL(rdmsr_on_cpu); 48EXPORT_SYMBOL(rdmsr_on_cpu);
49 49
50int rdmsrl_on_cpu(unsigned int cpu, u32 msr_no, u64 *q)
51{
52 int err;
53 struct msr_info rv;
54
55 memset(&rv, 0, sizeof(rv));
56
57 rv.msr_no = msr_no;
58 err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1);
59 *q = rv.reg.q;
60
61 return err;
62}
63EXPORT_SYMBOL(rdmsrl_on_cpu);
64
50int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) 65int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
51{ 66{
52 int err; 67 int err;
@@ -63,6 +78,22 @@ int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
63} 78}
64EXPORT_SYMBOL(wrmsr_on_cpu); 79EXPORT_SYMBOL(wrmsr_on_cpu);
65 80
81int wrmsrl_on_cpu(unsigned int cpu, u32 msr_no, u64 q)
82{
83 int err;
84 struct msr_info rv;
85
86 memset(&rv, 0, sizeof(rv));
87
88 rv.msr_no = msr_no;
89 rv.reg.q = q;
90
91 err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1);
92
93 return err;
94}
95EXPORT_SYMBOL(wrmsrl_on_cpu);
96
66static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no, 97static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no,
67 struct msr *msrs, 98 struct msr *msrs,
68 void (*msr_func) (void *info)) 99 void (*msr_func) (void *info))
@@ -159,6 +190,37 @@ int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
159} 190}
160EXPORT_SYMBOL(wrmsr_safe_on_cpu); 191EXPORT_SYMBOL(wrmsr_safe_on_cpu);
161 192
193int wrmsrl_safe_on_cpu(unsigned int cpu, u32 msr_no, u64 q)
194{
195 int err;
196 struct msr_info rv;
197
198 memset(&rv, 0, sizeof(rv));
199
200 rv.msr_no = msr_no;
201 rv.reg.q = q;
202
203 err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1);
204
205 return err ? err : rv.err;
206}
207EXPORT_SYMBOL(wrmsrl_safe_on_cpu);
208
209int rdmsrl_safe_on_cpu(unsigned int cpu, u32 msr_no, u64 *q)
210{
211 int err;
212 struct msr_info rv;
213
214 memset(&rv, 0, sizeof(rv));
215
216 rv.msr_no = msr_no;
217 err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1);
218 *q = rv.reg.q;
219
220 return err ? err : rv.err;
221}
222EXPORT_SYMBOL(rdmsrl_safe_on_cpu);
223
162/* 224/*
163 * These variants are significantly slower, but allows control over 225 * These variants are significantly slower, but allows control over
164 * the entire 32-bit GPR set. 226 * the entire 32-bit GPR set.
diff --git a/arch/x86/lib/usercopy.c b/arch/x86/lib/usercopy.c
index 4f74d94c8d97..ddf9ecb53cc3 100644
--- a/arch/x86/lib/usercopy.c
+++ b/arch/x86/lib/usercopy.c
@@ -11,39 +11,26 @@
11#include <linux/sched.h> 11#include <linux/sched.h>
12 12
13/* 13/*
14 * best effort, GUP based copy_from_user() that is NMI-safe 14 * We rely on the nested NMI work to allow atomic faults from the NMI path; the
15 * nested NMI paths are careful to preserve CR2.
15 */ 16 */
16unsigned long 17unsigned long
17copy_from_user_nmi(void *to, const void __user *from, unsigned long n) 18copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
18{ 19{
19 unsigned long offset, addr = (unsigned long)from; 20 unsigned long ret;
20 unsigned long size, len = 0;
21 struct page *page;
22 void *map;
23 int ret;
24 21
25 if (__range_not_ok(from, n, TASK_SIZE)) 22 if (__range_not_ok(from, n, TASK_SIZE))
26 return len; 23 return 0;
27 24
28 do { 25 /*
29 ret = __get_user_pages_fast(addr, 1, 0, &page); 26 * Even though this function is typically called from NMI/IRQ context
30 if (!ret) 27 * disable pagefaults so that its behaviour is consistent even when
31 break; 28 * called form other contexts.
32 29 */
33 offset = addr & (PAGE_SIZE - 1); 30 pagefault_disable();
34 size = min(PAGE_SIZE - offset, n - len); 31 ret = __copy_from_user_inatomic(to, from, n);
35 32 pagefault_enable();
36 map = kmap_atomic(page); 33
37 memcpy(to, map+offset, size); 34 return ret;
38 kunmap_atomic(map);
39 put_page(page);
40
41 len += size;
42 to += size;
43 addr += size;
44
45 } while (len < n);
46
47 return len;
48} 35}
49EXPORT_SYMBOL_GPL(copy_from_user_nmi); 36EXPORT_SYMBOL_GPL(copy_from_user_nmi);
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c
index 3eb18acd0e40..e2f5e21c03b3 100644
--- a/arch/x86/lib/usercopy_32.c
+++ b/arch/x86/lib/usercopy_32.c
@@ -654,14 +654,13 @@ EXPORT_SYMBOL(__copy_from_user_ll_nocache_nozero);
654 * Returns number of bytes that could not be copied. 654 * Returns number of bytes that could not be copied.
655 * On success, this will be zero. 655 * On success, this will be zero.
656 */ 656 */
657unsigned long 657unsigned long _copy_to_user(void __user *to, const void *from, unsigned n)
658copy_to_user(void __user *to, const void *from, unsigned long n)
659{ 658{
660 if (access_ok(VERIFY_WRITE, to, n)) 659 if (access_ok(VERIFY_WRITE, to, n))
661 n = __copy_to_user(to, from, n); 660 n = __copy_to_user(to, from, n);
662 return n; 661 return n;
663} 662}
664EXPORT_SYMBOL(copy_to_user); 663EXPORT_SYMBOL(_copy_to_user);
665 664
666/** 665/**
667 * copy_from_user: - Copy a block of data from user space. 666 * copy_from_user: - Copy a block of data from user space.
@@ -679,8 +678,7 @@ EXPORT_SYMBOL(copy_to_user);
679 * If some data could not be copied, this function will pad the copied 678 * If some data could not be copied, this function will pad the copied
680 * data to the requested size using zero bytes. 679 * data to the requested size using zero bytes.
681 */ 680 */
682unsigned long 681unsigned long _copy_from_user(void *to, const void __user *from, unsigned n)
683_copy_from_user(void *to, const void __user *from, unsigned long n)
684{ 682{
685 if (access_ok(VERIFY_READ, from, n)) 683 if (access_ok(VERIFY_READ, from, n))
686 n = __copy_from_user(to, from, n); 684 n = __copy_from_user(to, from, n);
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile
index 23d8e5fecf76..6a19ad9f370d 100644
--- a/arch/x86/mm/Makefile
+++ b/arch/x86/mm/Makefile
@@ -6,6 +6,8 @@ nostackp := $(call cc-option, -fno-stack-protector)
6CFLAGS_physaddr.o := $(nostackp) 6CFLAGS_physaddr.o := $(nostackp)
7CFLAGS_setup_nx.o := $(nostackp) 7CFLAGS_setup_nx.o := $(nostackp)
8 8
9CFLAGS_fault.o := -I$(src)/../include/asm/trace
10
9obj-$(CONFIG_X86_PAT) += pat_rbtree.o 11obj-$(CONFIG_X86_PAT) += pat_rbtree.o
10obj-$(CONFIG_SMP) += tlb.o 12obj-$(CONFIG_SMP) += tlb.o
11 13
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 3aaeffcfd67a..9ff85bb8dd69 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -20,6 +20,9 @@
20#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */ 20#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */
21#include <asm/fixmap.h> /* VSYSCALL_START */ 21#include <asm/fixmap.h> /* VSYSCALL_START */
22 22
23#define CREATE_TRACE_POINTS
24#include <asm/trace/exceptions.h>
25
23/* 26/*
24 * Page fault error code bits: 27 * Page fault error code bits:
25 * 28 *
@@ -51,7 +54,7 @@ kmmio_fault(struct pt_regs *regs, unsigned long addr)
51 return 0; 54 return 0;
52} 55}
53 56
54static inline int __kprobes notify_page_fault(struct pt_regs *regs) 57static inline int __kprobes kprobes_fault(struct pt_regs *regs)
55{ 58{
56 int ret = 0; 59 int ret = 0;
57 60
@@ -596,7 +599,7 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code,
596 599
597 printk(KERN_CONT " at %p\n", (void *) address); 600 printk(KERN_CONT " at %p\n", (void *) address);
598 printk(KERN_ALERT "IP:"); 601 printk(KERN_ALERT "IP:");
599 printk_address(regs->ip, 1); 602 printk_address(regs->ip);
600 603
601 dump_pagetable(address); 604 dump_pagetable(address);
602} 605}
@@ -1048,7 +1051,7 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code)
1048 return; 1051 return;
1049 1052
1050 /* kprobes don't want to hook the spurious faults: */ 1053 /* kprobes don't want to hook the spurious faults: */
1051 if (notify_page_fault(regs)) 1054 if (kprobes_fault(regs))
1052 return; 1055 return;
1053 /* 1056 /*
1054 * Don't take the mm semaphore here. If we fixup a prefetch 1057 * Don't take the mm semaphore here. If we fixup a prefetch
@@ -1060,23 +1063,8 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code)
1060 } 1063 }
1061 1064
1062 /* kprobes don't want to hook the spurious faults: */ 1065 /* kprobes don't want to hook the spurious faults: */
1063 if (unlikely(notify_page_fault(regs))) 1066 if (unlikely(kprobes_fault(regs)))
1064 return; 1067 return;
1065 /*
1066 * It's safe to allow irq's after cr2 has been saved and the
1067 * vmalloc fault has been handled.
1068 *
1069 * User-mode registers count as a user access even for any
1070 * potential system fault or CPU buglet:
1071 */
1072 if (user_mode_vm(regs)) {
1073 local_irq_enable();
1074 error_code |= PF_USER;
1075 flags |= FAULT_FLAG_USER;
1076 } else {
1077 if (regs->flags & X86_EFLAGS_IF)
1078 local_irq_enable();
1079 }
1080 1068
1081 if (unlikely(error_code & PF_RSVD)) 1069 if (unlikely(error_code & PF_RSVD))
1082 pgtable_bad(regs, error_code, address); 1070 pgtable_bad(regs, error_code, address);
@@ -1088,8 +1076,6 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code)
1088 } 1076 }
1089 } 1077 }
1090 1078
1091 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
1092
1093 /* 1079 /*
1094 * If we're in an interrupt, have no user context or are running 1080 * If we're in an interrupt, have no user context or are running
1095 * in an atomic region then we must not take the fault: 1081 * in an atomic region then we must not take the fault:
@@ -1099,6 +1085,24 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code)
1099 return; 1085 return;
1100 } 1086 }
1101 1087
1088 /*
1089 * It's safe to allow irq's after cr2 has been saved and the
1090 * vmalloc fault has been handled.
1091 *
1092 * User-mode registers count as a user access even for any
1093 * potential system fault or CPU buglet:
1094 */
1095 if (user_mode_vm(regs)) {
1096 local_irq_enable();
1097 error_code |= PF_USER;
1098 flags |= FAULT_FLAG_USER;
1099 } else {
1100 if (regs->flags & X86_EFLAGS_IF)
1101 local_irq_enable();
1102 }
1103
1104 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
1105
1102 if (error_code & PF_WRITE) 1106 if (error_code & PF_WRITE)
1103 flags |= FAULT_FLAG_WRITE; 1107 flags |= FAULT_FLAG_WRITE;
1104 1108
@@ -1231,3 +1235,23 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
1231 __do_page_fault(regs, error_code); 1235 __do_page_fault(regs, error_code);
1232 exception_exit(prev_state); 1236 exception_exit(prev_state);
1233} 1237}
1238
1239static void trace_page_fault_entries(struct pt_regs *regs,
1240 unsigned long error_code)
1241{
1242 if (user_mode(regs))
1243 trace_page_fault_user(read_cr2(), regs, error_code);
1244 else
1245 trace_page_fault_kernel(read_cr2(), regs, error_code);
1246}
1247
1248dotraplinkage void __kprobes
1249trace_do_page_fault(struct pt_regs *regs, unsigned long error_code)
1250{
1251 enum ctx_state prev_state;
1252
1253 prev_state = exception_enter();
1254 trace_page_fault_entries(regs, error_code);
1255 __do_page_fault(regs, error_code);
1256 exception_exit(prev_state);
1257}
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 04664cdb7fda..f97130618113 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -53,12 +53,12 @@ __ref void *alloc_low_pages(unsigned int num)
53 if ((pgt_buf_end + num) > pgt_buf_top || !can_use_brk_pgt) { 53 if ((pgt_buf_end + num) > pgt_buf_top || !can_use_brk_pgt) {
54 unsigned long ret; 54 unsigned long ret;
55 if (min_pfn_mapped >= max_pfn_mapped) 55 if (min_pfn_mapped >= max_pfn_mapped)
56 panic("alloc_low_page: ran out of memory"); 56 panic("alloc_low_pages: ran out of memory");
57 ret = memblock_find_in_range(min_pfn_mapped << PAGE_SHIFT, 57 ret = memblock_find_in_range(min_pfn_mapped << PAGE_SHIFT,
58 max_pfn_mapped << PAGE_SHIFT, 58 max_pfn_mapped << PAGE_SHIFT,
59 PAGE_SIZE * num , PAGE_SIZE); 59 PAGE_SIZE * num , PAGE_SIZE);
60 if (!ret) 60 if (!ret)
61 panic("alloc_low_page: can not alloc memory"); 61 panic("alloc_low_pages: can not alloc memory");
62 memblock_reserve(ret, PAGE_SIZE * num); 62 memblock_reserve(ret, PAGE_SIZE * num);
63 pfn = ret >> PAGE_SHIFT; 63 pfn = ret >> PAGE_SHIFT;
64 } else { 64 } else {
@@ -399,29 +399,46 @@ static unsigned long __init init_range_memory_mapping(
399 return mapped_ram_size; 399 return mapped_ram_size;
400} 400}
401 401
402/* (PUD_SHIFT-PMD_SHIFT)/2 */ 402static unsigned long __init get_new_step_size(unsigned long step_size)
403#define STEP_SIZE_SHIFT 5 403{
404void __init init_mem_mapping(void) 404 /*
405 * Explain why we shift by 5 and why we don't have to worry about
406 * 'step_size << 5' overflowing:
407 *
408 * initial mapped size is PMD_SIZE (2M).
409 * We can not set step_size to be PUD_SIZE (1G) yet.
410 * In worse case, when we cross the 1G boundary, and
411 * PG_LEVEL_2M is not set, we will need 1+1+512 pages (2M + 8k)
412 * to map 1G range with PTE. Use 5 as shift for now.
413 *
414 * Don't need to worry about overflow, on 32bit, when step_size
415 * is 0, round_down() returns 0 for start, and that turns it
416 * into 0x100000000ULL.
417 */
418 return step_size << 5;
419}
420
421/**
422 * memory_map_top_down - Map [map_start, map_end) top down
423 * @map_start: start address of the target memory range
424 * @map_end: end address of the target memory range
425 *
426 * This function will setup direct mapping for memory range
427 * [map_start, map_end) in top-down. That said, the page tables
428 * will be allocated at the end of the memory, and we map the
429 * memory in top-down.
430 */
431static void __init memory_map_top_down(unsigned long map_start,
432 unsigned long map_end)
405{ 433{
406 unsigned long end, real_end, start, last_start; 434 unsigned long real_end, start, last_start;
407 unsigned long step_size; 435 unsigned long step_size;
408 unsigned long addr; 436 unsigned long addr;
409 unsigned long mapped_ram_size = 0; 437 unsigned long mapped_ram_size = 0;
410 unsigned long new_mapped_ram_size; 438 unsigned long new_mapped_ram_size;
411 439
412 probe_page_size_mask();
413
414#ifdef CONFIG_X86_64
415 end = max_pfn << PAGE_SHIFT;
416#else
417 end = max_low_pfn << PAGE_SHIFT;
418#endif
419
420 /* the ISA range is always mapped regardless of memory holes */
421 init_memory_mapping(0, ISA_END_ADDRESS);
422
423 /* xen has big range in reserved near end of ram, skip it at first.*/ 440 /* xen has big range in reserved near end of ram, skip it at first.*/
424 addr = memblock_find_in_range(ISA_END_ADDRESS, end, PMD_SIZE, PMD_SIZE); 441 addr = memblock_find_in_range(map_start, map_end, PMD_SIZE, PMD_SIZE);
425 real_end = addr + PMD_SIZE; 442 real_end = addr + PMD_SIZE;
426 443
427 /* step_size need to be small so pgt_buf from BRK could cover it */ 444 /* step_size need to be small so pgt_buf from BRK could cover it */
@@ -436,25 +453,106 @@ void __init init_mem_mapping(void)
436 * end of RAM in [min_pfn_mapped, max_pfn_mapped) used as new pages 453 * end of RAM in [min_pfn_mapped, max_pfn_mapped) used as new pages
437 * for page table. 454 * for page table.
438 */ 455 */
439 while (last_start > ISA_END_ADDRESS) { 456 while (last_start > map_start) {
440 if (last_start > step_size) { 457 if (last_start > step_size) {
441 start = round_down(last_start - 1, step_size); 458 start = round_down(last_start - 1, step_size);
442 if (start < ISA_END_ADDRESS) 459 if (start < map_start)
443 start = ISA_END_ADDRESS; 460 start = map_start;
444 } else 461 } else
445 start = ISA_END_ADDRESS; 462 start = map_start;
446 new_mapped_ram_size = init_range_memory_mapping(start, 463 new_mapped_ram_size = init_range_memory_mapping(start,
447 last_start); 464 last_start);
448 last_start = start; 465 last_start = start;
449 min_pfn_mapped = last_start >> PAGE_SHIFT; 466 min_pfn_mapped = last_start >> PAGE_SHIFT;
450 /* only increase step_size after big range get mapped */ 467 /* only increase step_size after big range get mapped */
451 if (new_mapped_ram_size > mapped_ram_size) 468 if (new_mapped_ram_size > mapped_ram_size)
452 step_size <<= STEP_SIZE_SHIFT; 469 step_size = get_new_step_size(step_size);
453 mapped_ram_size += new_mapped_ram_size; 470 mapped_ram_size += new_mapped_ram_size;
454 } 471 }
455 472
456 if (real_end < end) 473 if (real_end < map_end)
457 init_range_memory_mapping(real_end, end); 474 init_range_memory_mapping(real_end, map_end);
475}
476
477/**
478 * memory_map_bottom_up - Map [map_start, map_end) bottom up
479 * @map_start: start address of the target memory range
480 * @map_end: end address of the target memory range
481 *
482 * This function will setup direct mapping for memory range
483 * [map_start, map_end) in bottom-up. Since we have limited the
484 * bottom-up allocation above the kernel, the page tables will
485 * be allocated just above the kernel and we map the memory
486 * in [map_start, map_end) in bottom-up.
487 */
488static void __init memory_map_bottom_up(unsigned long map_start,
489 unsigned long map_end)
490{
491 unsigned long next, new_mapped_ram_size, start;
492 unsigned long mapped_ram_size = 0;
493 /* step_size need to be small so pgt_buf from BRK could cover it */
494 unsigned long step_size = PMD_SIZE;
495
496 start = map_start;
497 min_pfn_mapped = start >> PAGE_SHIFT;
498
499 /*
500 * We start from the bottom (@map_start) and go to the top (@map_end).
501 * The memblock_find_in_range() gets us a block of RAM from the
502 * end of RAM in [min_pfn_mapped, max_pfn_mapped) used as new pages
503 * for page table.
504 */
505 while (start < map_end) {
506 if (map_end - start > step_size) {
507 next = round_up(start + 1, step_size);
508 if (next > map_end)
509 next = map_end;
510 } else
511 next = map_end;
512
513 new_mapped_ram_size = init_range_memory_mapping(start, next);
514 start = next;
515
516 if (new_mapped_ram_size > mapped_ram_size)
517 step_size = get_new_step_size(step_size);
518 mapped_ram_size += new_mapped_ram_size;
519 }
520}
521
522void __init init_mem_mapping(void)
523{
524 unsigned long end;
525
526 probe_page_size_mask();
527
528#ifdef CONFIG_X86_64
529 end = max_pfn << PAGE_SHIFT;
530#else
531 end = max_low_pfn << PAGE_SHIFT;
532#endif
533
534 /* the ISA range is always mapped regardless of memory holes */
535 init_memory_mapping(0, ISA_END_ADDRESS);
536
537 /*
538 * If the allocation is in bottom-up direction, we setup direct mapping
539 * in bottom-up, otherwise we setup direct mapping in top-down.
540 */
541 if (memblock_bottom_up()) {
542 unsigned long kernel_end = __pa_symbol(_end);
543
544 /*
545 * we need two separate calls here. This is because we want to
546 * allocate page tables above the kernel. So we first map
547 * [kernel_end, end) to make memory above the kernel be mapped
548 * as soon as possible. And then use page tables allocated above
549 * the kernel to map [ISA_END_ADDRESS, kernel_end).
550 */
551 memory_map_bottom_up(kernel_end, end);
552 memory_map_bottom_up(ISA_END_ADDRESS, kernel_end);
553 } else {
554 memory_map_top_down(ISA_END_ADDRESS, end);
555 }
458 556
459#ifdef CONFIG_X86_64 557#ifdef CONFIG_X86_64
460 if (max_pfn > max_low_pfn) { 558 if (max_pfn > max_low_pfn) {
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 8bf93bae1f13..24aec58d6afd 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -567,6 +567,17 @@ static int __init numa_init(int (*init_func)(void))
567 ret = init_func(); 567 ret = init_func();
568 if (ret < 0) 568 if (ret < 0)
569 return ret; 569 return ret;
570
571 /*
572 * We reset memblock back to the top-down direction
573 * here because if we configured ACPI_NUMA, we have
574 * parsed SRAT in init_func(). It is ok to have the
575 * reset here even if we did't configure ACPI_NUMA
576 * or acpi numa init fails and fallbacks to dummy
577 * numa init.
578 */
579 memblock_set_bottom_up(false);
580
570 ret = numa_cleanup_meminfo(&numa_meminfo); 581 ret = numa_cleanup_meminfo(&numa_meminfo);
571 if (ret < 0) 582 if (ret < 0)
572 return ret; 583 return ret;
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index dfa537a03be1..a7cccb6d7fec 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -25,8 +25,12 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
25 struct page *pte; 25 struct page *pte;
26 26
27 pte = alloc_pages(__userpte_alloc_gfp, 0); 27 pte = alloc_pages(__userpte_alloc_gfp, 0);
28 if (pte) 28 if (!pte)
29 pgtable_page_ctor(pte); 29 return NULL;
30 if (!pgtable_page_ctor(pte)) {
31 __free_page(pte);
32 return NULL;
33 }
30 return pte; 34 return pte;
31} 35}
32 36
@@ -189,8 +193,10 @@ static void free_pmds(pmd_t *pmds[])
189 int i; 193 int i;
190 194
191 for(i = 0; i < PREALLOCATED_PMDS; i++) 195 for(i = 0; i < PREALLOCATED_PMDS; i++)
192 if (pmds[i]) 196 if (pmds[i]) {
197 pgtable_pmd_page_dtor(virt_to_page(pmds[i]));
193 free_page((unsigned long)pmds[i]); 198 free_page((unsigned long)pmds[i]);
199 }
194} 200}
195 201
196static int preallocate_pmds(pmd_t *pmds[]) 202static int preallocate_pmds(pmd_t *pmds[])
@@ -200,8 +206,13 @@ static int preallocate_pmds(pmd_t *pmds[])
200 206
201 for(i = 0; i < PREALLOCATED_PMDS; i++) { 207 for(i = 0; i < PREALLOCATED_PMDS; i++) {
202 pmd_t *pmd = (pmd_t *)__get_free_page(PGALLOC_GFP); 208 pmd_t *pmd = (pmd_t *)__get_free_page(PGALLOC_GFP);
203 if (pmd == NULL) 209 if (!pmd)
204 failed = true; 210 failed = true;
211 if (pmd && !pgtable_pmd_page_ctor(virt_to_page(pmd))) {
212 free_page((unsigned long)pmds[i]);
213 pmd = NULL;
214 failed = true;
215 }
205 pmds[i] = pmd; 216 pmds[i] = pmd;
206 } 217 }
207 218
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index 79c216aa0e2b..26328e800869 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -772,13 +772,23 @@ out:
772 return; 772 return;
773} 773}
774 774
775static void bpf_jit_free_deferred(struct work_struct *work)
776{
777 struct sk_filter *fp = container_of(work, struct sk_filter, work);
778 unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
779 struct bpf_binary_header *header = (void *)addr;
780
781 set_memory_rw(addr, header->pages);
782 module_free(NULL, header);
783 kfree(fp);
784}
785
775void bpf_jit_free(struct sk_filter *fp) 786void bpf_jit_free(struct sk_filter *fp)
776{ 787{
777 if (fp->bpf_func != sk_run_filter) { 788 if (fp->bpf_func != sk_run_filter) {
778 unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK; 789 INIT_WORK(&fp->work, bpf_jit_free_deferred);
779 struct bpf_binary_header *header = (void *)addr; 790 schedule_work(&fp->work);
780 791 } else {
781 set_memory_rw(addr, header->pages); 792 kfree(fp);
782 module_free(NULL, header);
783 } 793 }
784} 794}
diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c
index d6aa6e8315d1..5d04be5efb64 100644
--- a/arch/x86/oprofile/backtrace.c
+++ b/arch/x86/oprofile/backtrace.c
@@ -47,7 +47,7 @@ dump_user_backtrace_32(struct stack_frame_ia32 *head)
47 unsigned long bytes; 47 unsigned long bytes;
48 48
49 bytes = copy_from_user_nmi(bufhead, head, sizeof(bufhead)); 49 bytes = copy_from_user_nmi(bufhead, head, sizeof(bufhead));
50 if (bytes != sizeof(bufhead)) 50 if (bytes != 0)
51 return NULL; 51 return NULL;
52 52
53 fp = (struct stack_frame_ia32 *) compat_ptr(bufhead[0].next_frame); 53 fp = (struct stack_frame_ia32 *) compat_ptr(bufhead[0].next_frame);
@@ -93,7 +93,7 @@ static struct stack_frame *dump_user_backtrace(struct stack_frame *head)
93 unsigned long bytes; 93 unsigned long bytes;
94 94
95 bytes = copy_from_user_nmi(bufhead, head, sizeof(bufhead)); 95 bytes = copy_from_user_nmi(bufhead, head, sizeof(bufhead));
96 if (bytes != sizeof(bufhead)) 96 if (bytes != 0)
97 return NULL; 97 return NULL;
98 98
99 oprofile_add_trace(bufhead[0].return_address); 99 oprofile_add_trace(bufhead[0].return_address);
diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
index ee0af58ca5bd..e063eed0f912 100644
--- a/arch/x86/pci/Makefile
+++ b/arch/x86/pci/Makefile
@@ -18,7 +18,7 @@ obj-$(CONFIG_X86_VISWS) += visws.o
18obj-$(CONFIG_X86_NUMAQ) += numaq_32.o 18obj-$(CONFIG_X86_NUMAQ) += numaq_32.o
19obj-$(CONFIG_X86_NUMACHIP) += numachip.o 19obj-$(CONFIG_X86_NUMACHIP) += numachip.o
20 20
21obj-$(CONFIG_X86_INTEL_MID) += mrst.o 21obj-$(CONFIG_X86_INTEL_MID) += intel_mid_pci.o
22 22
23obj-y += common.o early.o 23obj-y += common.o early.o
24obj-y += bus_numa.o 24obj-y += bus_numa.o
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index b30e937689d6..7fb24e53d4c8 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -354,12 +354,12 @@ static void coalesce_windows(struct pci_root_info *info, unsigned long type)
354 * the kernel resource tree doesn't allow overlaps. 354 * the kernel resource tree doesn't allow overlaps.
355 */ 355 */
356 if (resource_overlaps(res1, res2)) { 356 if (resource_overlaps(res1, res2)) {
357 res1->start = min(res1->start, res2->start); 357 res2->start = min(res1->start, res2->start);
358 res1->end = max(res1->end, res2->end); 358 res2->end = max(res1->end, res2->end);
359 dev_info(&info->bridge->dev, 359 dev_info(&info->bridge->dev,
360 "host bridge window expanded to %pR; %pR ignored\n", 360 "host bridge window expanded to %pR; %pR ignored\n",
361 res1, res2); 361 res2, res1);
362 res2->flags = 0; 362 res1->flags = 0;
363 } 363 }
364 } 364 }
365 } 365 }
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index f5809fa2753e..b046e070e088 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -231,7 +231,7 @@ static int quirk_pcie_aspm_write(struct pci_bus *bus, unsigned int devfn, int wh
231 offset = quirk_aspm_offset[GET_INDEX(bus->self->device, devfn)]; 231 offset = quirk_aspm_offset[GET_INDEX(bus->self->device, devfn)];
232 232
233 if ((offset) && (where == offset)) 233 if ((offset) && (where == offset))
234 value = value & 0xfffffffc; 234 value = value & ~PCI_EXP_LNKCTL_ASPMC;
235 235
236 return raw_pci_write(pci_domain_nr(bus), bus->number, 236 return raw_pci_write(pci_domain_nr(bus), bus->number,
237 devfn, where, size, value); 237 devfn, where, size, value);
@@ -252,7 +252,7 @@ static struct pci_ops quirk_pcie_aspm_ops = {
252 */ 252 */
253static void pcie_rootport_aspm_quirk(struct pci_dev *pdev) 253static void pcie_rootport_aspm_quirk(struct pci_dev *pdev)
254{ 254{
255 int cap_base, i; 255 int i;
256 struct pci_bus *pbus; 256 struct pci_bus *pbus;
257 struct pci_dev *dev; 257 struct pci_dev *dev;
258 258
@@ -278,7 +278,7 @@ static void pcie_rootport_aspm_quirk(struct pci_dev *pdev)
278 for (i = GET_INDEX(pdev->device, 0); i <= GET_INDEX(pdev->device, 7); ++i) 278 for (i = GET_INDEX(pdev->device, 0); i <= GET_INDEX(pdev->device, 7); ++i)
279 quirk_aspm_offset[i] = 0; 279 quirk_aspm_offset[i] = 0;
280 280
281 pbus->ops = pbus->parent->ops; 281 pci_bus_set_ops(pbus, pbus->parent->ops);
282 } else { 282 } else {
283 /* 283 /*
284 * If devices are attached to the root port at power-up or 284 * If devices are attached to the root port at power-up or
@@ -286,13 +286,15 @@ static void pcie_rootport_aspm_quirk(struct pci_dev *pdev)
286 * each root port to save the register offsets and replace the 286 * each root port to save the register offsets and replace the
287 * bus ops. 287 * bus ops.
288 */ 288 */
289 list_for_each_entry(dev, &pbus->devices, bus_list) { 289 list_for_each_entry(dev, &pbus->devices, bus_list)
290 /* There are 0 to 8 devices attached to this bus */ 290 /* There are 0 to 8 devices attached to this bus */
291 cap_base = pci_find_capability(dev, PCI_CAP_ID_EXP); 291 quirk_aspm_offset[GET_INDEX(pdev->device, dev->devfn)] =
292 quirk_aspm_offset[GET_INDEX(pdev->device, dev->devfn)] = cap_base + 0x10; 292 dev->pcie_cap + PCI_EXP_LNKCTL;
293 } 293
294 pbus->ops = &quirk_pcie_aspm_ops; 294 pci_bus_set_ops(pbus, &quirk_pcie_aspm_ops);
295 dev_info(&pbus->dev, "writes to ASPM control bits will be ignored\n");
295 } 296 }
297
296} 298}
297DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PA, pcie_rootport_aspm_quirk); 299DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PA, pcie_rootport_aspm_quirk);
298DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PA1, pcie_rootport_aspm_quirk); 300DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PA1, pcie_rootport_aspm_quirk);
diff --git a/arch/x86/pci/mrst.c b/arch/x86/pci/intel_mid_pci.c
index 903fded50786..51384ca727ad 100644
--- a/arch/x86/pci/mrst.c
+++ b/arch/x86/pci/intel_mid_pci.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Moorestown PCI support 2 * Intel MID PCI support
3 * Copyright (c) 2008 Intel Corporation 3 * Copyright (c) 2008 Intel Corporation
4 * Jesse Barnes <jesse.barnes@intel.com> 4 * Jesse Barnes <jesse.barnes@intel.com>
5 * 5 *
@@ -150,12 +150,12 @@ static bool type1_access_ok(unsigned int bus, unsigned int devfn, int reg)
150 * shim. Therefore, use the header type in shim instead. 150 * shim. Therefore, use the header type in shim instead.
151 */ 151 */
152 if (reg >= 0x100 || reg == PCI_STATUS || reg == PCI_HEADER_TYPE) 152 if (reg >= 0x100 || reg == PCI_STATUS || reg == PCI_HEADER_TYPE)
153 return 0; 153 return false;
154 if (bus == 0 && (devfn == PCI_DEVFN(2, 0) 154 if (bus == 0 && (devfn == PCI_DEVFN(2, 0)
155 || devfn == PCI_DEVFN(0, 0) 155 || devfn == PCI_DEVFN(0, 0)
156 || devfn == PCI_DEVFN(3, 0))) 156 || devfn == PCI_DEVFN(3, 0)))
157 return 1; 157 return true;
158 return 0; /* Langwell on others */ 158 return false; /* Langwell on others */
159} 159}
160 160
161static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, 161static int pci_read(struct pci_bus *bus, unsigned int devfn, int where,
@@ -205,7 +205,7 @@ static int pci_write(struct pci_bus *bus, unsigned int devfn, int where,
205 where, size, value); 205 where, size, value);
206} 206}
207 207
208static int mrst_pci_irq_enable(struct pci_dev *dev) 208static int intel_mid_pci_irq_enable(struct pci_dev *dev)
209{ 209{
210 u8 pin; 210 u8 pin;
211 struct io_apic_irq_attr irq_attr; 211 struct io_apic_irq_attr irq_attr;
@@ -225,23 +225,23 @@ static int mrst_pci_irq_enable(struct pci_dev *dev)
225 return 0; 225 return 0;
226} 226}
227 227
228struct pci_ops pci_mrst_ops = { 228struct pci_ops intel_mid_pci_ops = {
229 .read = pci_read, 229 .read = pci_read,
230 .write = pci_write, 230 .write = pci_write,
231}; 231};
232 232
233/** 233/**
234 * pci_mrst_init - installs pci_mrst_ops 234 * intel_mid_pci_init - installs intel_mid_pci_ops
235 * 235 *
236 * Moorestown has an interesting PCI implementation (see above). 236 * Moorestown has an interesting PCI implementation (see above).
237 * Called when the early platform detection installs it. 237 * Called when the early platform detection installs it.
238 */ 238 */
239int __init pci_mrst_init(void) 239int __init intel_mid_pci_init(void)
240{ 240{
241 pr_info("Intel MID platform detected, using MID PCI ops\n"); 241 pr_info("Intel MID platform detected, using MID PCI ops\n");
242 pci_mmcfg_late_init(); 242 pci_mmcfg_late_init();
243 pcibios_enable_irq = mrst_pci_irq_enable; 243 pcibios_enable_irq = intel_mid_pci_irq_enable;
244 pci_root_ops = pci_mrst_ops; 244 pci_root_ops = intel_mid_pci_ops;
245 pci_soc_mode = 1; 245 pci_soc_mode = 1;
246 /* Continue with standard init */ 246 /* Continue with standard init */
247 return 1; 247 return 1;
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 5596c7bdd327..082e88129712 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -700,7 +700,7 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
700 if (!(pci_probe & PCI_PROBE_MMCONF) || pci_mmcfg_arch_init_failed) 700 if (!(pci_probe & PCI_PROBE_MMCONF) || pci_mmcfg_arch_init_failed)
701 return -ENODEV; 701 return -ENODEV;
702 702
703 if (start > end || !addr) 703 if (start > end)
704 return -EINVAL; 704 return -EINVAL;
705 705
706 mutex_lock(&pci_mmcfg_lock); 706 mutex_lock(&pci_mmcfg_lock);
@@ -716,6 +716,11 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
716 return -EEXIST; 716 return -EEXIST;
717 } 717 }
718 718
719 if (!addr) {
720 mutex_unlock(&pci_mmcfg_lock);
721 return -EINVAL;
722 }
723
719 rc = -EBUSY; 724 rc = -EBUSY;
720 cfg = pci_mmconfig_alloc(seg, start, end, addr); 725 cfg = pci_mmconfig_alloc(seg, start, end, addr);
721 if (cfg == NULL) { 726 if (cfg == NULL) {
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 48e8461057ba..5eee4959785d 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -382,7 +382,14 @@ static void xen_teardown_msi_irq(unsigned int irq)
382{ 382{
383 xen_destroy_irq(irq); 383 xen_destroy_irq(irq);
384} 384}
385 385static u32 xen_nop_msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag)
386{
387 return 0;
388}
389static u32 xen_nop_msix_mask_irq(struct msi_desc *desc, u32 flag)
390{
391 return 0;
392}
386#endif 393#endif
387 394
388int __init pci_xen_init(void) 395int __init pci_xen_init(void)
@@ -406,6 +413,8 @@ int __init pci_xen_init(void)
406 x86_msi.setup_msi_irqs = xen_setup_msi_irqs; 413 x86_msi.setup_msi_irqs = xen_setup_msi_irqs;
407 x86_msi.teardown_msi_irq = xen_teardown_msi_irq; 414 x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
408 x86_msi.teardown_msi_irqs = xen_teardown_msi_irqs; 415 x86_msi.teardown_msi_irqs = xen_teardown_msi_irqs;
416 x86_msi.msi_mask_irq = xen_nop_msi_mask_irq;
417 x86_msi.msix_mask_irq = xen_nop_msix_mask_irq;
409#endif 418#endif
410 return 0; 419 return 0;
411} 420}
@@ -485,6 +494,8 @@ int __init pci_xen_initial_domain(void)
485 x86_msi.setup_msi_irqs = xen_initdom_setup_msi_irqs; 494 x86_msi.setup_msi_irqs = xen_initdom_setup_msi_irqs;
486 x86_msi.teardown_msi_irq = xen_teardown_msi_irq; 495 x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
487 x86_msi.restore_msi_irqs = xen_initdom_restore_msi_irqs; 496 x86_msi.restore_msi_irqs = xen_initdom_restore_msi_irqs;
497 x86_msi.msi_mask_irq = xen_nop_msi_mask_irq;
498 x86_msi.msix_mask_irq = xen_nop_msix_mask_irq;
488#endif 499#endif
489 xen_setup_acpi_sci(); 500 xen_setup_acpi_sci();
490 __acpi_register_gsi = acpi_register_gsi_xen; 501 __acpi_register_gsi = acpi_register_gsi_xen;
diff --git a/arch/x86/platform/Makefile b/arch/x86/platform/Makefile
index 01e0231a113e..20342d4c82ce 100644
--- a/arch/x86/platform/Makefile
+++ b/arch/x86/platform/Makefile
@@ -4,7 +4,7 @@ obj-y += efi/
4obj-y += geode/ 4obj-y += geode/
5obj-y += goldfish/ 5obj-y += goldfish/
6obj-y += iris/ 6obj-y += iris/
7obj-y += mrst/ 7obj-y += intel-mid/
8obj-y += olpc/ 8obj-y += olpc/
9obj-y += scx200/ 9obj-y += scx200/
10obj-y += sfi/ 10obj-y += sfi/
diff --git a/arch/x86/platform/efi/Makefile b/arch/x86/platform/efi/Makefile
index 6db1cc4c7534..b7b0b35c1981 100644
--- a/arch/x86/platform/efi/Makefile
+++ b/arch/x86/platform/efi/Makefile
@@ -1,2 +1,3 @@
1obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o 1obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o
2obj-$(CONFIG_ACPI_BGRT) += efi-bgrt.o 2obj-$(CONFIG_ACPI_BGRT) += efi-bgrt.o
3obj-$(CONFIG_EARLY_PRINTK_EFI) += early_printk.o
diff --git a/arch/x86/platform/efi/early_printk.c b/arch/x86/platform/efi/early_printk.c
new file mode 100644
index 000000000000..6599a0027b76
--- /dev/null
+++ b/arch/x86/platform/efi/early_printk.c
@@ -0,0 +1,191 @@
1/*
2 * Copyright (C) 2013 Intel Corporation; author Matt Fleming
3 *
4 * This file is part of the Linux kernel, and is made available under
5 * the terms of the GNU General Public License version 2.
6 */
7
8#include <linux/console.h>
9#include <linux/efi.h>
10#include <linux/font.h>
11#include <linux/io.h>
12#include <linux/kernel.h>
13#include <asm/setup.h>
14
15static const struct font_desc *font;
16static u32 efi_x, efi_y;
17
18static __init void early_efi_clear_scanline(unsigned int y)
19{
20 unsigned long base, *dst;
21 u16 len;
22
23 base = boot_params.screen_info.lfb_base;
24 len = boot_params.screen_info.lfb_linelength;
25
26 dst = early_ioremap(base + y*len, len);
27 if (!dst)
28 return;
29
30 memset(dst, 0, len);
31 early_iounmap(dst, len);
32}
33
34static __init void early_efi_scroll_up(void)
35{
36 unsigned long base, *dst, *src;
37 u16 len;
38 u32 i, height;
39
40 base = boot_params.screen_info.lfb_base;
41 len = boot_params.screen_info.lfb_linelength;
42 height = boot_params.screen_info.lfb_height;
43
44 for (i = 0; i < height - font->height; i++) {
45 dst = early_ioremap(base + i*len, len);
46 if (!dst)
47 return;
48
49 src = early_ioremap(base + (i + font->height) * len, len);
50 if (!src) {
51 early_iounmap(dst, len);
52 return;
53 }
54
55 memmove(dst, src, len);
56
57 early_iounmap(src, len);
58 early_iounmap(dst, len);
59 }
60}
61
62static void early_efi_write_char(u32 *dst, unsigned char c, unsigned int h)
63{
64 const u32 color_black = 0x00000000;
65 const u32 color_white = 0x00ffffff;
66 const u8 *src;
67 u8 s8;
68 int m;
69
70 src = font->data + c * font->height;
71 s8 = *(src + h);
72
73 for (m = 0; m < 8; m++) {
74 if ((s8 >> (7 - m)) & 1)
75 *dst = color_white;
76 else
77 *dst = color_black;
78 dst++;
79 }
80}
81
82static __init void
83early_efi_write(struct console *con, const char *str, unsigned int num)
84{
85 struct screen_info *si;
86 unsigned long base;
87 unsigned int len;
88 const char *s;
89 void *dst;
90
91 base = boot_params.screen_info.lfb_base;
92 si = &boot_params.screen_info;
93 len = si->lfb_linelength;
94
95 while (num) {
96 unsigned int linemax;
97 unsigned int h, count = 0;
98
99 for (s = str; *s && *s != '\n'; s++) {
100 if (count == num)
101 break;
102 count++;
103 }
104
105 linemax = (si->lfb_width - efi_x) / font->width;
106 if (count > linemax)
107 count = linemax;
108
109 for (h = 0; h < font->height; h++) {
110 unsigned int n, x;
111
112 dst = early_ioremap(base + (efi_y + h) * len, len);
113 if (!dst)
114 return;
115
116 s = str;
117 n = count;
118 x = efi_x;
119
120 while (n-- > 0) {
121 early_efi_write_char(dst + x*4, *s, h);
122 x += font->width;
123 s++;
124 }
125
126 early_iounmap(dst, len);
127 }
128
129 num -= count;
130 efi_x += count * font->width;
131 str += count;
132
133 if (num > 0 && *s == '\n') {
134 efi_x = 0;
135 efi_y += font->height;
136 str++;
137 num--;
138 }
139
140 if (efi_x >= si->lfb_width) {
141 efi_x = 0;
142 efi_y += font->height;
143 }
144
145 if (efi_y + font->height >= si->lfb_height) {
146 u32 i;
147
148 efi_y -= font->height;
149 early_efi_scroll_up();
150
151 for (i = 0; i < font->height; i++)
152 early_efi_clear_scanline(efi_y + i);
153 }
154 }
155}
156
157static __init int early_efi_setup(struct console *con, char *options)
158{
159 struct screen_info *si;
160 u16 xres, yres;
161 u32 i;
162
163 si = &boot_params.screen_info;
164 xres = si->lfb_width;
165 yres = si->lfb_height;
166
167 /*
168 * early_efi_write_char() implicitly assumes a framebuffer with
169 * 32-bits per pixel.
170 */
171 if (si->lfb_depth != 32)
172 return -ENODEV;
173
174 font = get_default_font(xres, yres, -1, -1);
175 if (!font)
176 return -ENODEV;
177
178 efi_y = rounddown(yres, font->height) - font->height;
179 for (i = 0; i < (yres - efi_y) / font->height; i++)
180 early_efi_scroll_up();
181
182 return 0;
183}
184
185struct console early_efi_console = {
186 .name = "earlyefi",
187 .write = early_efi_write,
188 .setup = early_efi_setup,
189 .flags = CON_PRINTBUFFER,
190 .index = -1,
191};
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 90f6ed127096..92c02344a060 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -60,19 +60,6 @@
60 60
61static efi_char16_t efi_dummy_name[6] = { 'D', 'U', 'M', 'M', 'Y', 0 }; 61static efi_char16_t efi_dummy_name[6] = { 'D', 'U', 'M', 'M', 'Y', 0 };
62 62
63struct efi __read_mostly efi = {
64 .mps = EFI_INVALID_TABLE_ADDR,
65 .acpi = EFI_INVALID_TABLE_ADDR,
66 .acpi20 = EFI_INVALID_TABLE_ADDR,
67 .smbios = EFI_INVALID_TABLE_ADDR,
68 .sal_systab = EFI_INVALID_TABLE_ADDR,
69 .boot_info = EFI_INVALID_TABLE_ADDR,
70 .hcdp = EFI_INVALID_TABLE_ADDR,
71 .uga = EFI_INVALID_TABLE_ADDR,
72 .uv_systab = EFI_INVALID_TABLE_ADDR,
73};
74EXPORT_SYMBOL(efi);
75
76struct efi_memory_map memmap; 63struct efi_memory_map memmap;
77 64
78static struct efi efi_phys __initdata; 65static struct efi efi_phys __initdata;
@@ -80,6 +67,13 @@ static efi_system_table_t efi_systab __initdata;
80 67
81unsigned long x86_efi_facility; 68unsigned long x86_efi_facility;
82 69
70static __initdata efi_config_table_type_t arch_tables[] = {
71#ifdef CONFIG_X86_UV
72 {UV_SYSTEM_TABLE_GUID, "UVsystab", &efi.uv_systab},
73#endif
74 {NULL_GUID, NULL, NULL},
75};
76
83/* 77/*
84 * Returns 1 if 'facility' is enabled, 0 otherwise. 78 * Returns 1 if 'facility' is enabled, 0 otherwise.
85 */ 79 */
@@ -399,6 +393,8 @@ int __init efi_memblock_x86_reserve_range(void)
399 393
400 memblock_reserve(pmap, memmap.nr_map * memmap.desc_size); 394 memblock_reserve(pmap, memmap.nr_map * memmap.desc_size);
401 395
396 efi.memmap = &memmap;
397
402 return 0; 398 return 0;
403} 399}
404 400
@@ -578,80 +574,6 @@ static int __init efi_systab_init(void *phys)
578 return 0; 574 return 0;
579} 575}
580 576
581static int __init efi_config_init(u64 tables, int nr_tables)
582{
583 void *config_tables, *tablep;
584 int i, sz;
585
586 if (efi_enabled(EFI_64BIT))
587 sz = sizeof(efi_config_table_64_t);
588 else
589 sz = sizeof(efi_config_table_32_t);
590
591 /*
592 * Let's see what config tables the firmware passed to us.
593 */
594 config_tables = early_ioremap(tables, nr_tables * sz);
595 if (config_tables == NULL) {
596 pr_err("Could not map Configuration table!\n");
597 return -ENOMEM;
598 }
599
600 tablep = config_tables;
601 pr_info("");
602 for (i = 0; i < efi.systab->nr_tables; i++) {
603 efi_guid_t guid;
604 unsigned long table;
605
606 if (efi_enabled(EFI_64BIT)) {
607 u64 table64;
608 guid = ((efi_config_table_64_t *)tablep)->guid;
609 table64 = ((efi_config_table_64_t *)tablep)->table;
610 table = table64;
611#ifdef CONFIG_X86_32
612 if (table64 >> 32) {
613 pr_cont("\n");
614 pr_err("Table located above 4GB, disabling EFI.\n");
615 early_iounmap(config_tables,
616 efi.systab->nr_tables * sz);
617 return -EINVAL;
618 }
619#endif
620 } else {
621 guid = ((efi_config_table_32_t *)tablep)->guid;
622 table = ((efi_config_table_32_t *)tablep)->table;
623 }
624 if (!efi_guidcmp(guid, MPS_TABLE_GUID)) {
625 efi.mps = table;
626 pr_cont(" MPS=0x%lx ", table);
627 } else if (!efi_guidcmp(guid, ACPI_20_TABLE_GUID)) {
628 efi.acpi20 = table;
629 pr_cont(" ACPI 2.0=0x%lx ", table);
630 } else if (!efi_guidcmp(guid, ACPI_TABLE_GUID)) {
631 efi.acpi = table;
632 pr_cont(" ACPI=0x%lx ", table);
633 } else if (!efi_guidcmp(guid, SMBIOS_TABLE_GUID)) {
634 efi.smbios = table;
635 pr_cont(" SMBIOS=0x%lx ", table);
636#ifdef CONFIG_X86_UV
637 } else if (!efi_guidcmp(guid, UV_SYSTEM_TABLE_GUID)) {
638 efi.uv_systab = table;
639 pr_cont(" UVsystab=0x%lx ", table);
640#endif
641 } else if (!efi_guidcmp(guid, HCDP_TABLE_GUID)) {
642 efi.hcdp = table;
643 pr_cont(" HCDP=0x%lx ", table);
644 } else if (!efi_guidcmp(guid, UGA_IO_PROTOCOL_GUID)) {
645 efi.uga = table;
646 pr_cont(" UGA=0x%lx ", table);
647 }
648 tablep += sz;
649 }
650 pr_cont("\n");
651 early_iounmap(config_tables, efi.systab->nr_tables * sz);
652 return 0;
653}
654
655static int __init efi_runtime_init(void) 577static int __init efi_runtime_init(void)
656{ 578{
657 efi_runtime_services_t *runtime; 579 efi_runtime_services_t *runtime;
@@ -745,7 +667,7 @@ void __init efi_init(void)
745 efi.systab->hdr.revision >> 16, 667 efi.systab->hdr.revision >> 16,
746 efi.systab->hdr.revision & 0xffff, vendor); 668 efi.systab->hdr.revision & 0xffff, vendor);
747 669
748 if (efi_config_init(efi.systab->tables, efi.systab->nr_tables)) 670 if (efi_config_init(arch_tables))
749 return; 671 return;
750 672
751 set_bit(EFI_CONFIG_TABLES, &x86_efi_facility); 673 set_bit(EFI_CONFIG_TABLES, &x86_efi_facility);
@@ -816,34 +738,6 @@ static void __init runtime_code_page_mkexec(void)
816 } 738 }
817} 739}
818 740
819/*
820 * We can't ioremap data in EFI boot services RAM, because we've already mapped
821 * it as RAM. So, look it up in the existing EFI memory map instead. Only
822 * callable after efi_enter_virtual_mode and before efi_free_boot_services.
823 */
824void __iomem *efi_lookup_mapped_addr(u64 phys_addr)
825{
826 void *p;
827 if (WARN_ON(!memmap.map))
828 return NULL;
829 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
830 efi_memory_desc_t *md = p;
831 u64 size = md->num_pages << EFI_PAGE_SHIFT;
832 u64 end = md->phys_addr + size;
833 if (!(md->attribute & EFI_MEMORY_RUNTIME) &&
834 md->type != EFI_BOOT_SERVICES_CODE &&
835 md->type != EFI_BOOT_SERVICES_DATA)
836 continue;
837 if (!md->virt_addr)
838 continue;
839 if (phys_addr >= md->phys_addr && phys_addr < end) {
840 phys_addr += md->virt_addr - md->phys_addr;
841 return (__force void __iomem *)(unsigned long)phys_addr;
842 }
843 }
844 return NULL;
845}
846
847void efi_memory_uc(u64 addr, unsigned long size) 741void efi_memory_uc(u64 addr, unsigned long size)
848{ 742{
849 unsigned long page_shift = 1UL << EFI_PAGE_SHIFT; 743 unsigned long page_shift = 1UL << EFI_PAGE_SHIFT;
@@ -912,10 +806,13 @@ void __init efi_enter_virtual_mode(void)
912 806
913 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { 807 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
914 md = p; 808 md = p;
915 if (!(md->attribute & EFI_MEMORY_RUNTIME) && 809 if (!(md->attribute & EFI_MEMORY_RUNTIME)) {
916 md->type != EFI_BOOT_SERVICES_CODE && 810#ifdef CONFIG_X86_64
917 md->type != EFI_BOOT_SERVICES_DATA) 811 if (md->type != EFI_BOOT_SERVICES_CODE &&
918 continue; 812 md->type != EFI_BOOT_SERVICES_DATA)
813#endif
814 continue;
815 }
919 816
920 size = md->num_pages << EFI_PAGE_SHIFT; 817 size = md->num_pages << EFI_PAGE_SHIFT;
921 end = md->phys_addr + size; 818 end = md->phys_addr + size;
diff --git a/arch/x86/platform/geode/alix.c b/arch/x86/platform/geode/alix.c
index 90e23e7679a5..76b6632d3143 100644
--- a/arch/x86/platform/geode/alix.c
+++ b/arch/x86/platform/geode/alix.c
@@ -98,7 +98,7 @@ static struct platform_device alix_leds_dev = {
98 .dev.platform_data = &alix_leds_data, 98 .dev.platform_data = &alix_leds_data,
99}; 99};
100 100
101static struct __initdata platform_device *alix_devs[] = { 101static struct platform_device *alix_devs[] __initdata = {
102 &alix_buttons_dev, 102 &alix_buttons_dev,
103 &alix_leds_dev, 103 &alix_leds_dev,
104}; 104};
diff --git a/arch/x86/platform/geode/geos.c b/arch/x86/platform/geode/geos.c
index c2e6d53558be..aa733fba2471 100644
--- a/arch/x86/platform/geode/geos.c
+++ b/arch/x86/platform/geode/geos.c
@@ -87,7 +87,7 @@ static struct platform_device geos_leds_dev = {
87 .dev.platform_data = &geos_leds_data, 87 .dev.platform_data = &geos_leds_data,
88}; 88};
89 89
90static struct __initdata platform_device *geos_devs[] = { 90static struct platform_device *geos_devs[] __initdata = {
91 &geos_buttons_dev, 91 &geos_buttons_dev,
92 &geos_leds_dev, 92 &geos_leds_dev,
93}; 93};
diff --git a/arch/x86/platform/geode/net5501.c b/arch/x86/platform/geode/net5501.c
index 646e3b5b4bb6..927e38c0089f 100644
--- a/arch/x86/platform/geode/net5501.c
+++ b/arch/x86/platform/geode/net5501.c
@@ -78,7 +78,7 @@ static struct platform_device net5501_leds_dev = {
78 .dev.platform_data = &net5501_leds_data, 78 .dev.platform_data = &net5501_leds_data,
79}; 79};
80 80
81static struct __initdata platform_device *net5501_devs[] = { 81static struct platform_device *net5501_devs[] __initdata = {
82 &net5501_buttons_dev, 82 &net5501_buttons_dev,
83 &net5501_leds_dev, 83 &net5501_leds_dev,
84}; 84};
diff --git a/arch/x86/platform/intel-mid/Makefile b/arch/x86/platform/intel-mid/Makefile
new file mode 100644
index 000000000000..01cc29ea5ff7
--- /dev/null
+++ b/arch/x86/platform/intel-mid/Makefile
@@ -0,0 +1,7 @@
1obj-$(CONFIG_X86_INTEL_MID) += intel-mid.o
2obj-$(CONFIG_X86_INTEL_MID) += intel_mid_vrtc.o
3obj-$(CONFIG_EARLY_PRINTK_INTEL_MID) += early_printk_intel_mid.o
4# SFI specific code
5ifdef CONFIG_X86_INTEL_MID
6obj-$(CONFIG_SFI) += sfi.o device_libs/
7endif
diff --git a/arch/x86/platform/intel-mid/device_libs/Makefile b/arch/x86/platform/intel-mid/device_libs/Makefile
new file mode 100644
index 000000000000..097e7a7940d8
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/Makefile
@@ -0,0 +1,22 @@
1# IPC Devices
2obj-y += platform_ipc.o
3obj-$(subst m,y,$(CONFIG_MFD_INTEL_MSIC)) += platform_msic.o
4obj-$(subst m,y,$(CONFIG_SND_MFLD_MACHINE)) += platform_msic_audio.o
5obj-$(subst m,y,$(CONFIG_GPIO_MSIC)) += platform_msic_gpio.o
6obj-$(subst m,y,$(CONFIG_MFD_INTEL_MSIC)) += platform_msic_ocd.o
7obj-$(subst m,y,$(CONFIG_MFD_INTEL_MSIC)) += platform_msic_battery.o
8obj-$(subst m,y,$(CONFIG_INTEL_MID_POWER_BUTTON)) += platform_msic_power_btn.o
9obj-$(subst m,y,$(CONFIG_GPIO_INTEL_PMIC)) += platform_pmic_gpio.o
10obj-$(subst m,y,$(CONFIG_INTEL_MFLD_THERMAL)) += platform_msic_thermal.o
11# I2C Devices
12obj-$(subst m,y,$(CONFIG_SENSORS_EMC1403)) += platform_emc1403.o
13obj-$(subst m,y,$(CONFIG_SENSORS_LIS3LV02D)) += platform_lis331.o
14obj-$(subst m,y,$(CONFIG_GPIO_PCA953X)) += platform_max7315.o
15obj-$(subst m,y,$(CONFIG_INPUT_MPU3050)) += platform_mpu3050.o
16obj-$(subst m,y,$(CONFIG_INPUT_BMA150)) += platform_bma023.o
17obj-$(subst m,y,$(CONFIG_GPIO_PCA953X)) += platform_tca6416.o
18obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
19# SPI Devices
20obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
21# MISC Devices
22obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_bma023.c b/arch/x86/platform/intel-mid/device_libs/platform_bma023.c
new file mode 100644
index 000000000000..0ae7f2ae2296
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_bma023.c
@@ -0,0 +1,20 @@
1/*
2 * platform_bma023.c: bma023 platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; version 2
9 * of the License.
10 */
11
12#include <asm/intel-mid.h>
13
14static const struct devs_id bma023_dev_id __initconst = {
15 .name = "bma023",
16 .type = SFI_DEV_TYPE_I2C,
17 .delay = 1,
18};
19
20sfi_device(bma023_dev_id);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_emc1403.c b/arch/x86/platform/intel-mid/device_libs/platform_emc1403.c
new file mode 100644
index 000000000000..0d942c1d26d5
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_emc1403.c
@@ -0,0 +1,41 @@
1/*
2 * platform_emc1403.c: emc1403 platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/init.h>
14#include <linux/gpio.h>
15#include <linux/i2c.h>
16#include <asm/intel-mid.h>
17
18static void __init *emc1403_platform_data(void *info)
19{
20 static short intr2nd_pdata;
21 struct i2c_board_info *i2c_info = info;
22 int intr = get_gpio_by_name("thermal_int");
23 int intr2nd = get_gpio_by_name("thermal_alert");
24
25 if (intr == -1 || intr2nd == -1)
26 return NULL;
27
28 i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
29 intr2nd_pdata = intr2nd + INTEL_MID_IRQ_OFFSET;
30
31 return &intr2nd_pdata;
32}
33
34static const struct devs_id emc1403_dev_id __initconst = {
35 .name = "emc1403",
36 .type = SFI_DEV_TYPE_I2C,
37 .delay = 1,
38 .get_platform_data = &emc1403_platform_data,
39};
40
41sfi_device(emc1403_dev_id);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c b/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c
new file mode 100644
index 000000000000..a013a4834bbe
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c
@@ -0,0 +1,83 @@
1/*
2 * platform_gpio_keys.c: gpio_keys platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/input.h>
14#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/gpio.h>
17#include <linux/gpio_keys.h>
18#include <linux/platform_device.h>
19#include <asm/intel-mid.h>
20
21#define DEVICE_NAME "gpio-keys"
22
23/*
24 * we will search these buttons in SFI GPIO table (by name)
25 * and register them dynamically. Please add all possible
26 * buttons here, we will shrink them if no GPIO found.
27 */
28static struct gpio_keys_button gpio_button[] = {
29 {KEY_POWER, -1, 1, "power_btn", EV_KEY, 0, 3000},
30 {KEY_PROG1, -1, 1, "prog_btn1", EV_KEY, 0, 20},
31 {KEY_PROG2, -1, 1, "prog_btn2", EV_KEY, 0, 20},
32 {SW_LID, -1, 1, "lid_switch", EV_SW, 0, 20},
33 {KEY_VOLUMEUP, -1, 1, "vol_up", EV_KEY, 0, 20},
34 {KEY_VOLUMEDOWN, -1, 1, "vol_down", EV_KEY, 0, 20},
35 {KEY_CAMERA, -1, 1, "camera_full", EV_KEY, 0, 20},
36 {KEY_CAMERA_FOCUS, -1, 1, "camera_half", EV_KEY, 0, 20},
37 {SW_KEYPAD_SLIDE, -1, 1, "MagSw1", EV_SW, 0, 20},
38 {SW_KEYPAD_SLIDE, -1, 1, "MagSw2", EV_SW, 0, 20},
39};
40
41static struct gpio_keys_platform_data gpio_keys = {
42 .buttons = gpio_button,
43 .rep = 1,
44 .nbuttons = -1, /* will fill it after search */
45};
46
47static struct platform_device pb_device = {
48 .name = DEVICE_NAME,
49 .id = -1,
50 .dev = {
51 .platform_data = &gpio_keys,
52 },
53};
54
55/*
56 * Shrink the non-existent buttons, register the gpio button
57 * device if there is some
58 */
59static int __init pb_keys_init(void)
60{
61 struct gpio_keys_button *gb = gpio_button;
62 int i, num, good = 0;
63
64 num = sizeof(gpio_button) / sizeof(struct gpio_keys_button);
65 for (i = 0; i < num; i++) {
66 gb[i].gpio = get_gpio_by_name(gb[i].desc);
67 pr_debug("info[%2d]: name = %s, gpio = %d\n", i, gb[i].desc,
68 gb[i].gpio);
69 if (gb[i].gpio == -1)
70 continue;
71
72 if (i != good)
73 gb[good] = gb[i];
74 good++;
75 }
76
77 if (good) {
78 gpio_keys.nbuttons = good;
79 return platform_device_register(&pb_device);
80 }
81 return 0;
82}
83late_initcall(pb_keys_init);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_ipc.c b/arch/x86/platform/intel-mid/device_libs/platform_ipc.c
new file mode 100644
index 000000000000..a84b73d6c4a0
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_ipc.c
@@ -0,0 +1,68 @@
1/*
2 * platform_ipc.c: IPC platform library file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/interrupt.h>
16#include <linux/sfi.h>
17#include <linux/gpio.h>
18#include <asm/intel-mid.h>
19#include "platform_ipc.h"
20
21void __init ipc_device_handler(struct sfi_device_table_entry *pentry,
22 struct devs_id *dev)
23{
24 struct platform_device *pdev;
25 void *pdata = NULL;
26 static struct resource res __initdata = {
27 .name = "IRQ",
28 .flags = IORESOURCE_IRQ,
29 };
30
31 pr_debug("IPC bus, name = %16.16s, irq = 0x%2x\n",
32 pentry->name, pentry->irq);
33
34 /*
35 * We need to call platform init of IPC devices to fill misc_pdata
36 * structure. It will be used in msic_init for initialization.
37 */
38 if (dev != NULL)
39 pdata = dev->get_platform_data(pentry);
40
41 /*
42 * On Medfield the platform device creation is handled by the MSIC
43 * MFD driver so we don't need to do it here.
44 */
45 if (intel_mid_has_msic())
46 return;
47
48 pdev = platform_device_alloc(pentry->name, 0);
49 if (pdev == NULL) {
50 pr_err("out of memory for SFI platform device '%s'.\n",
51 pentry->name);
52 return;
53 }
54 res.start = pentry->irq;
55 platform_device_add_resources(pdev, &res, 1);
56
57 pdev->dev.platform_data = pdata;
58 intel_scu_device_register(pdev);
59}
60
61static const struct devs_id pmic_audio_dev_id __initconst = {
62 .name = "pmic_audio",
63 .type = SFI_DEV_TYPE_IPC,
64 .delay = 1,
65 .device_handler = &ipc_device_handler,
66};
67
68sfi_device(pmic_audio_dev_id);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_ipc.h b/arch/x86/platform/intel-mid/device_libs/platform_ipc.h
new file mode 100644
index 000000000000..8f568dd79605
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_ipc.h
@@ -0,0 +1,17 @@
1/*
2 * platform_ipc.h: IPC platform library header file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12#ifndef _PLATFORM_IPC_H_
13#define _PLATFORM_IPC_H_
14
15extern void __init ipc_device_handler(struct sfi_device_table_entry *pentry,
16 struct devs_id *dev) __attribute__((weak));
17#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_lis331.c b/arch/x86/platform/intel-mid/device_libs/platform_lis331.c
new file mode 100644
index 000000000000..15278c11f714
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_lis331.c
@@ -0,0 +1,39 @@
1/*
2 * platform_lis331.c: lis331 platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/i2c.h>
14#include <linux/gpio.h>
15#include <asm/intel-mid.h>
16
17static void __init *lis331dl_platform_data(void *info)
18{
19 static short intr2nd_pdata;
20 struct i2c_board_info *i2c_info = info;
21 int intr = get_gpio_by_name("accel_int");
22 int intr2nd = get_gpio_by_name("accel_2");
23
24 if (intr == -1 || intr2nd == -1)
25 return NULL;
26
27 i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
28 intr2nd_pdata = intr2nd + INTEL_MID_IRQ_OFFSET;
29
30 return &intr2nd_pdata;
31}
32
33static const struct devs_id lis331dl_dev_id __initconst = {
34 .name = "i2c_accel",
35 .type = SFI_DEV_TYPE_I2C,
36 .get_platform_data = &lis331dl_platform_data,
37};
38
39sfi_device(lis331dl_dev_id);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_max3111.c b/arch/x86/platform/intel-mid/device_libs/platform_max3111.c
new file mode 100644
index 000000000000..afd1df94e0e5
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_max3111.c
@@ -0,0 +1,35 @@
1/*
2 * platform_max3111.c: max3111 platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/gpio.h>
14#include <linux/spi/spi.h>
15#include <asm/intel-mid.h>
16
17static void __init *max3111_platform_data(void *info)
18{
19 struct spi_board_info *spi_info = info;
20 int intr = get_gpio_by_name("max3111_int");
21
22 spi_info->mode = SPI_MODE_0;
23 if (intr == -1)
24 return NULL;
25 spi_info->irq = intr + INTEL_MID_IRQ_OFFSET;
26 return NULL;
27}
28
29static const struct devs_id max3111_dev_id __initconst = {
30 .name = "spi_max3111",
31 .type = SFI_DEV_TYPE_SPI,
32 .get_platform_data = &max3111_platform_data,
33};
34
35sfi_device(max3111_dev_id);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_max7315.c b/arch/x86/platform/intel-mid/device_libs/platform_max7315.c
new file mode 100644
index 000000000000..94ade10024ae
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_max7315.c
@@ -0,0 +1,79 @@
1/*
2 * platform_max7315.c: max7315 platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/init.h>
14#include <linux/gpio.h>
15#include <linux/i2c.h>
16#include <linux/platform_data/pca953x.h>
17#include <asm/intel-mid.h>
18
19#define MAX7315_NUM 2
20
21static void __init *max7315_platform_data(void *info)
22{
23 static struct pca953x_platform_data max7315_pdata[MAX7315_NUM];
24 static int nr;
25 struct pca953x_platform_data *max7315 = &max7315_pdata[nr];
26 struct i2c_board_info *i2c_info = info;
27 int gpio_base, intr;
28 char base_pin_name[SFI_NAME_LEN + 1];
29 char intr_pin_name[SFI_NAME_LEN + 1];
30
31 if (nr == MAX7315_NUM) {
32 pr_err("too many max7315s, we only support %d\n",
33 MAX7315_NUM);
34 return NULL;
35 }
36 /* we have several max7315 on the board, we only need load several
37 * instances of the same pca953x driver to cover them
38 */
39 strcpy(i2c_info->type, "max7315");
40 if (nr++) {
41 sprintf(base_pin_name, "max7315_%d_base", nr);
42 sprintf(intr_pin_name, "max7315_%d_int", nr);
43 } else {
44 strcpy(base_pin_name, "max7315_base");
45 strcpy(intr_pin_name, "max7315_int");
46 }
47
48 gpio_base = get_gpio_by_name(base_pin_name);
49 intr = get_gpio_by_name(intr_pin_name);
50
51 if (gpio_base == -1)
52 return NULL;
53 max7315->gpio_base = gpio_base;
54 if (intr != -1) {
55 i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
56 max7315->irq_base = gpio_base + INTEL_MID_IRQ_OFFSET;
57 } else {
58 i2c_info->irq = -1;
59 max7315->irq_base = -1;
60 }
61 return max7315;
62}
63
64static const struct devs_id max7315_dev_id __initconst = {
65 .name = "i2c_max7315",
66 .type = SFI_DEV_TYPE_I2C,
67 .delay = 1,
68 .get_platform_data = &max7315_platform_data,
69};
70
71static const struct devs_id max7315_2_dev_id __initconst = {
72 .name = "i2c_max7315_2",
73 .type = SFI_DEV_TYPE_I2C,
74 .delay = 1,
75 .get_platform_data = &max7315_platform_data,
76};
77
78sfi_device(max7315_dev_id);
79sfi_device(max7315_2_dev_id);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c b/arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c
new file mode 100644
index 000000000000..dd28d63c84fb
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c
@@ -0,0 +1,36 @@
1/*
2 * platform_mpu3050.c: mpu3050 platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/gpio.h>
14#include <linux/i2c.h>
15#include <asm/intel-mid.h>
16
17static void *mpu3050_platform_data(void *info)
18{
19 struct i2c_board_info *i2c_info = info;
20 int intr = get_gpio_by_name("mpu3050_int");
21
22 if (intr == -1)
23 return NULL;
24
25 i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
26 return NULL;
27}
28
29static const struct devs_id mpu3050_dev_id __initconst = {
30 .name = "mpu3050",
31 .type = SFI_DEV_TYPE_I2C,
32 .delay = 1,
33 .get_platform_data = &mpu3050_platform_data,
34};
35
36sfi_device(mpu3050_dev_id);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic.c b/arch/x86/platform/intel-mid/device_libs/platform_msic.c
new file mode 100644
index 000000000000..9f4a775a69d6
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_msic.c
@@ -0,0 +1,87 @@
1/*
2 * platform_msic.c: MSIC platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/kernel.h>
14#include <linux/interrupt.h>
15#include <linux/scatterlist.h>
16#include <linux/init.h>
17#include <linux/sfi.h>
18#include <linux/mfd/intel_msic.h>
19#include <asm/intel_scu_ipc.h>
20#include <asm/intel-mid.h>
21#include "platform_msic.h"
22
23struct intel_msic_platform_data msic_pdata;
24
25static struct resource msic_resources[] = {
26 {
27 .start = INTEL_MSIC_IRQ_PHYS_BASE,
28 .end = INTEL_MSIC_IRQ_PHYS_BASE + 64 - 1,
29 .flags = IORESOURCE_MEM,
30 },
31};
32
33static struct platform_device msic_device = {
34 .name = "intel_msic",
35 .id = -1,
36 .dev = {
37 .platform_data = &msic_pdata,
38 },
39 .num_resources = ARRAY_SIZE(msic_resources),
40 .resource = msic_resources,
41};
42
43static int msic_scu_status_change(struct notifier_block *nb,
44 unsigned long code, void *data)
45{
46 if (code == SCU_DOWN) {
47 platform_device_unregister(&msic_device);
48 return 0;
49 }
50
51 return platform_device_register(&msic_device);
52}
53
54static int __init msic_init(void)
55{
56 static struct notifier_block msic_scu_notifier = {
57 .notifier_call = msic_scu_status_change,
58 };
59
60 /*
61 * We need to be sure that the SCU IPC is ready before MSIC device
62 * can be registered.
63 */
64 if (intel_mid_has_msic())
65 intel_scu_notifier_add(&msic_scu_notifier);
66
67 return 0;
68}
69arch_initcall(msic_init);
70
71/*
72 * msic_generic_platform_data - sets generic platform data for the block
73 * @info: pointer to the SFI device table entry for this block
74 * @block: MSIC block
75 *
76 * Function sets IRQ number from the SFI table entry for given device to
77 * the MSIC platform data.
78 */
79void *msic_generic_platform_data(void *info, enum intel_msic_block block)
80{
81 struct sfi_device_table_entry *entry = info;
82
83 BUG_ON(block < 0 || block >= INTEL_MSIC_BLOCK_LAST);
84 msic_pdata.irq[block] = entry->irq;
85
86 return NULL;
87}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic.h b/arch/x86/platform/intel-mid/device_libs/platform_msic.h
new file mode 100644
index 000000000000..917eb56d77da
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_msic.h
@@ -0,0 +1,19 @@
1/*
2 * platform_msic.h: MSIC platform data header file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12#ifndef _PLATFORM_MSIC_H_
13#define _PLATFORM_MSIC_H_
14
15extern struct intel_msic_platform_data msic_pdata;
16
17extern void *msic_generic_platform_data(void *info,
18 enum intel_msic_block block) __attribute__((weak));
19#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_audio.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_audio.c
new file mode 100644
index 000000000000..29629397d2b3
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_msic_audio.c
@@ -0,0 +1,47 @@
1/*
2 * platform_msic_audio.c: MSIC audio platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/kernel.h>
14#include <linux/interrupt.h>
15#include <linux/scatterlist.h>
16#include <linux/init.h>
17#include <linux/sfi.h>
18#include <linux/platform_device.h>
19#include <linux/mfd/intel_msic.h>
20#include <asm/intel-mid.h>
21
22#include "platform_msic.h"
23#include "platform_ipc.h"
24
25static void *msic_audio_platform_data(void *info)
26{
27 struct platform_device *pdev;
28
29 pdev = platform_device_register_simple("sst-platform", -1, NULL, 0);
30
31 if (IS_ERR(pdev)) {
32 pr_err("failed to create audio platform device\n");
33 return NULL;
34 }
35
36 return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_AUDIO);
37}
38
39static const struct devs_id msic_audio_dev_id __initconst = {
40 .name = "msic_audio",
41 .type = SFI_DEV_TYPE_IPC,
42 .delay = 1,
43 .get_platform_data = &msic_audio_platform_data,
44 .device_handler = &ipc_device_handler,
45};
46
47sfi_device(msic_audio_dev_id);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_battery.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_battery.c
new file mode 100644
index 000000000000..f446c33df1a8
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_msic_battery.c
@@ -0,0 +1,37 @@
1/*
2 * platform_msic_battery.c: MSIC battery platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/kernel.h>
14#include <linux/interrupt.h>
15#include <linux/scatterlist.h>
16#include <linux/init.h>
17#include <linux/sfi.h>
18#include <linux/mfd/intel_msic.h>
19#include <asm/intel-mid.h>
20
21#include "platform_msic.h"
22#include "platform_ipc.h"
23
24static void __init *msic_battery_platform_data(void *info)
25{
26 return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_BATTERY);
27}
28
29static const struct devs_id msic_battery_dev_id __initconst = {
30 .name = "msic_battery",
31 .type = SFI_DEV_TYPE_IPC,
32 .delay = 1,
33 .get_platform_data = &msic_battery_platform_data,
34 .device_handler = &ipc_device_handler,
35};
36
37sfi_device(msic_battery_dev_id);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c
new file mode 100644
index 000000000000..2a4f7b1dd917
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c
@@ -0,0 +1,48 @@
1/*
2 * platform_msic_gpio.c: MSIC GPIO platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/kernel.h>
14#include <linux/interrupt.h>
15#include <linux/scatterlist.h>
16#include <linux/sfi.h>
17#include <linux/init.h>
18#include <linux/gpio.h>
19#include <linux/mfd/intel_msic.h>
20#include <asm/intel-mid.h>
21
22#include "platform_msic.h"
23#include "platform_ipc.h"
24
25static void __init *msic_gpio_platform_data(void *info)
26{
27 static struct intel_msic_gpio_pdata msic_gpio_pdata;
28
29 int gpio = get_gpio_by_name("msic_gpio_base");
30
31 if (gpio < 0)
32 return NULL;
33
34 msic_gpio_pdata.gpio_base = gpio;
35 msic_pdata.gpio = &msic_gpio_pdata;
36
37 return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_GPIO);
38}
39
40static const struct devs_id msic_gpio_dev_id __initconst = {
41 .name = "msic_gpio",
42 .type = SFI_DEV_TYPE_IPC,
43 .delay = 1,
44 .get_platform_data = &msic_gpio_platform_data,
45 .device_handler = &ipc_device_handler,
46};
47
48sfi_device(msic_gpio_dev_id);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c
new file mode 100644
index 000000000000..6497111ddb54
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c
@@ -0,0 +1,49 @@
1/*
2 * platform_msic_ocd.c: MSIC OCD platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/kernel.h>
14#include <linux/interrupt.h>
15#include <linux/scatterlist.h>
16#include <linux/sfi.h>
17#include <linux/init.h>
18#include <linux/gpio.h>
19#include <linux/mfd/intel_msic.h>
20#include <asm/intel-mid.h>
21
22#include "platform_msic.h"
23#include "platform_ipc.h"
24
25static void __init *msic_ocd_platform_data(void *info)
26{
27 static struct intel_msic_ocd_pdata msic_ocd_pdata;
28 int gpio;
29
30 gpio = get_gpio_by_name("ocd_gpio");
31
32 if (gpio < 0)
33 return NULL;
34
35 msic_ocd_pdata.gpio = gpio;
36 msic_pdata.ocd = &msic_ocd_pdata;
37
38 return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_OCD);
39}
40
41static const struct devs_id msic_ocd_dev_id __initconst = {
42 .name = "msic_ocd",
43 .type = SFI_DEV_TYPE_IPC,
44 .delay = 1,
45 .get_platform_data = &msic_ocd_platform_data,
46 .device_handler = &ipc_device_handler,
47};
48
49sfi_device(msic_ocd_dev_id);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.c
new file mode 100644
index 000000000000..83a3459bc337
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.c
@@ -0,0 +1,36 @@
1/*
2 * platform_msic_power_btn.c: MSIC power btn platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12#include <linux/kernel.h>
13#include <linux/interrupt.h>
14#include <linux/scatterlist.h>
15#include <linux/sfi.h>
16#include <linux/init.h>
17#include <linux/mfd/intel_msic.h>
18#include <asm/intel-mid.h>
19
20#include "platform_msic.h"
21#include "platform_ipc.h"
22
23static void __init *msic_power_btn_platform_data(void *info)
24{
25 return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_POWER_BTN);
26}
27
28static const struct devs_id msic_power_btn_dev_id __initconst = {
29 .name = "msic_power_btn",
30 .type = SFI_DEV_TYPE_IPC,
31 .delay = 1,
32 .get_platform_data = &msic_power_btn_platform_data,
33 .device_handler = &ipc_device_handler,
34};
35
36sfi_device(msic_power_btn_dev_id);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.c
new file mode 100644
index 000000000000..a351878b96bc
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.c
@@ -0,0 +1,37 @@
1/*
2 * platform_msic_thermal.c: msic_thermal platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/input.h>
14#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/gpio.h>
17#include <linux/platform_device.h>
18#include <linux/mfd/intel_msic.h>
19#include <asm/intel-mid.h>
20
21#include "platform_msic.h"
22#include "platform_ipc.h"
23
24static void __init *msic_thermal_platform_data(void *info)
25{
26 return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_THERMAL);
27}
28
29static const struct devs_id msic_thermal_dev_id __initconst = {
30 .name = "msic_thermal",
31 .type = SFI_DEV_TYPE_IPC,
32 .delay = 1,
33 .get_platform_data = &msic_thermal_platform_data,
34 .device_handler = &ipc_device_handler,
35};
36
37sfi_device(msic_thermal_dev_id);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c b/arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c
new file mode 100644
index 000000000000..d87182a09263
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c
@@ -0,0 +1,54 @@
1/*
2 * platform_pmic_gpio.c: PMIC GPIO platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/kernel.h>
14#include <linux/interrupt.h>
15#include <linux/scatterlist.h>
16#include <linux/gpio.h>
17#include <linux/init.h>
18#include <linux/sfi.h>
19#include <linux/intel_pmic_gpio.h>
20#include <asm/intel-mid.h>
21
22#include "platform_ipc.h"
23
24static void __init *pmic_gpio_platform_data(void *info)
25{
26 static struct intel_pmic_gpio_platform_data pmic_gpio_pdata;
27 int gpio_base = get_gpio_by_name("pmic_gpio_base");
28
29 if (gpio_base == -1)
30 gpio_base = 64;
31 pmic_gpio_pdata.gpio_base = gpio_base;
32 pmic_gpio_pdata.irq_base = gpio_base + INTEL_MID_IRQ_OFFSET;
33 pmic_gpio_pdata.gpiointr = 0xffffeff8;
34
35 return &pmic_gpio_pdata;
36}
37
38static const struct devs_id pmic_gpio_spi_dev_id __initconst = {
39 .name = "pmic_gpio",
40 .type = SFI_DEV_TYPE_SPI,
41 .delay = 1,
42 .get_platform_data = &pmic_gpio_platform_data,
43};
44
45static const struct devs_id pmic_gpio_ipc_dev_id __initconst = {
46 .name = "pmic_gpio",
47 .type = SFI_DEV_TYPE_IPC,
48 .delay = 1,
49 .get_platform_data = &pmic_gpio_platform_data,
50 .device_handler = &ipc_device_handler
51};
52
53sfi_device(pmic_gpio_spi_dev_id);
54sfi_device(pmic_gpio_ipc_dev_id);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c b/arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c
new file mode 100644
index 000000000000..740fc757050c
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c
@@ -0,0 +1,36 @@
1/*
2 * platform_tc35876x.c: tc35876x platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/gpio.h>
14#include <linux/i2c/tc35876x.h>
15#include <asm/intel-mid.h>
16
17/*tc35876x DSI_LVDS bridge chip and panel platform data*/
18static void *tc35876x_platform_data(void *data)
19{
20 static struct tc35876x_platform_data pdata;
21
22 /* gpio pins set to -1 will not be used by the driver */
23 pdata.gpio_bridge_reset = get_gpio_by_name("LCMB_RXEN");
24 pdata.gpio_panel_bl_en = get_gpio_by_name("6S6P_BL_EN");
25 pdata.gpio_panel_vadd = get_gpio_by_name("EN_VREG_LCD_V3P3");
26
27 return &pdata;
28}
29
30static const struct devs_id tc35876x_dev_id __initconst = {
31 .name = "i2c_disp_brig",
32 .type = SFI_DEV_TYPE_I2C,
33 .get_platform_data = &tc35876x_platform_data,
34};
35
36sfi_device(tc35876x_dev_id);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_tca6416.c b/arch/x86/platform/intel-mid/device_libs/platform_tca6416.c
new file mode 100644
index 000000000000..22881c9a6737
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_tca6416.c
@@ -0,0 +1,57 @@
1/*
2 * platform_tca6416.c: tca6416 platform data initilization file
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/platform_data/pca953x.h>
14#include <linux/i2c.h>
15#include <linux/gpio.h>
16#include <asm/intel-mid.h>
17
18#define TCA6416_NAME "tca6416"
19#define TCA6416_BASE "tca6416_base"
20#define TCA6416_INTR "tca6416_int"
21
22static void *tca6416_platform_data(void *info)
23{
24 static struct pca953x_platform_data tca6416;
25 struct i2c_board_info *i2c_info = info;
26 int gpio_base, intr;
27 char base_pin_name[SFI_NAME_LEN + 1];
28 char intr_pin_name[SFI_NAME_LEN + 1];
29
30 strcpy(i2c_info->type, TCA6416_NAME);
31 strcpy(base_pin_name, TCA6416_BASE);
32 strcpy(intr_pin_name, TCA6416_INTR);
33
34 gpio_base = get_gpio_by_name(base_pin_name);
35 intr = get_gpio_by_name(intr_pin_name);
36
37 if (gpio_base == -1)
38 return NULL;
39 tca6416.gpio_base = gpio_base;
40 if (intr != -1) {
41 i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
42 tca6416.irq_base = gpio_base + INTEL_MID_IRQ_OFFSET;
43 } else {
44 i2c_info->irq = -1;
45 tca6416.irq_base = -1;
46 }
47 return &tca6416;
48}
49
50static const struct devs_id tca6416_dev_id __initconst = {
51 .name = "tca6416",
52 .type = SFI_DEV_TYPE_I2C,
53 .delay = 1,
54 .get_platform_data = &tca6416_platform_data,
55};
56
57sfi_device(tca6416_dev_id);
diff --git a/arch/x86/platform/mrst/early_printk_mrst.c b/arch/x86/platform/intel-mid/early_printk_intel_mid.c
index 028454f0c3a5..4f702f554f6e 100644
--- a/arch/x86/platform/mrst/early_printk_mrst.c
+++ b/arch/x86/platform/intel-mid/early_printk_intel_mid.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * early_printk_mrst.c - early consoles for Intel MID platforms 2 * early_printk_intel_mid.c - early consoles for Intel MID platforms
3 * 3 *
4 * Copyright (c) 2008-2010, Intel Corporation 4 * Copyright (c) 2008-2010, Intel Corporation
5 * 5 *
@@ -27,7 +27,7 @@
27 27
28#include <asm/fixmap.h> 28#include <asm/fixmap.h>
29#include <asm/pgtable.h> 29#include <asm/pgtable.h>
30#include <asm/mrst.h> 30#include <asm/intel-mid.h>
31 31
32#define MRST_SPI_TIMEOUT 0x200000 32#define MRST_SPI_TIMEOUT 0x200000
33#define MRST_REGBASE_SPI0 0xff128000 33#define MRST_REGBASE_SPI0 0xff128000
@@ -152,7 +152,7 @@ void mrst_early_console_init(void)
152 spi0_cdiv = ((*pclk_spi0) & 0xe00) >> 9; 152 spi0_cdiv = ((*pclk_spi0) & 0xe00) >> 9;
153 freq = 100000000 / (spi0_cdiv + 1); 153 freq = 100000000 / (spi0_cdiv + 1);
154 154
155 if (mrst_identify_cpu() == MRST_CPU_CHIP_PENWELL) 155 if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_PENWELL)
156 mrst_spi_paddr = MRST_REGBASE_SPI1; 156 mrst_spi_paddr = MRST_REGBASE_SPI1;
157 157
158 pspi = (void *)set_fixmap_offset_nocache(FIX_EARLYCON_MEM_BASE, 158 pspi = (void *)set_fixmap_offset_nocache(FIX_EARLYCON_MEM_BASE,
@@ -213,13 +213,14 @@ static void early_mrst_spi_putc(char c)
213 } 213 }
214 214
215 if (!timeout) 215 if (!timeout)
216 pr_warning("MRST earlycon: timed out\n"); 216 pr_warn("MRST earlycon: timed out\n");
217 else 217 else
218 max3110_write_data(c); 218 max3110_write_data(c);
219} 219}
220 220
221/* Early SPI only uses polling mode */ 221/* Early SPI only uses polling mode */
222static void early_mrst_spi_write(struct console *con, const char *str, unsigned n) 222static void early_mrst_spi_write(struct console *con, const char *str,
223 unsigned n)
223{ 224{
224 int i; 225 int i;
225 226
diff --git a/arch/x86/platform/intel-mid/intel-mid.c b/arch/x86/platform/intel-mid/intel-mid.c
new file mode 100644
index 000000000000..f90e290f689f
--- /dev/null
+++ b/arch/x86/platform/intel-mid/intel-mid.c
@@ -0,0 +1,213 @@
1/*
2 * intel-mid.c: Intel MID platform setup code
3 *
4 * (C) Copyright 2008, 2012 Intel Corporation
5 * Author: Jacob Pan (jacob.jun.pan@intel.com)
6 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; version 2
11 * of the License.
12 */
13
14#define pr_fmt(fmt) "intel_mid: " fmt
15
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/interrupt.h>
19#include <linux/scatterlist.h>
20#include <linux/sfi.h>
21#include <linux/irq.h>
22#include <linux/module.h>
23#include <linux/notifier.h>
24
25#include <asm/setup.h>
26#include <asm/mpspec_def.h>
27#include <asm/hw_irq.h>
28#include <asm/apic.h>
29#include <asm/io_apic.h>
30#include <asm/intel-mid.h>
31#include <asm/intel_mid_vrtc.h>
32#include <asm/io.h>
33#include <asm/i8259.h>
34#include <asm/intel_scu_ipc.h>
35#include <asm/apb_timer.h>
36#include <asm/reboot.h>
37
38/*
39 * the clockevent devices on Moorestown/Medfield can be APBT or LAPIC clock,
40 * cmdline option x86_intel_mid_timer can be used to override the configuration
41 * to prefer one or the other.
42 * at runtime, there are basically three timer configurations:
43 * 1. per cpu apbt clock only
44 * 2. per cpu always-on lapic clocks only, this is Penwell/Medfield only
45 * 3. per cpu lapic clock (C3STOP) and one apbt clock, with broadcast.
46 *
47 * by default (without cmdline option), platform code first detects cpu type
48 * to see if we are on lincroft or penwell, then set up both lapic or apbt
49 * clocks accordingly.
50 * i.e. by default, medfield uses configuration #2, moorestown uses #1.
51 * config #3 is supported but not recommended on medfield.
52 *
53 * rating and feature summary:
54 * lapic (with C3STOP) --------- 100
55 * apbt (always-on) ------------ 110
56 * lapic (always-on,ARAT) ------ 150
57 */
58
59enum intel_mid_timer_options intel_mid_timer_options;
60
61enum intel_mid_cpu_type __intel_mid_cpu_chip;
62EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip);
63
64static void intel_mid_power_off(void)
65{
66}
67
68static void intel_mid_reboot(void)
69{
70 intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0);
71}
72
73static unsigned long __init intel_mid_calibrate_tsc(void)
74{
75 unsigned long fast_calibrate;
76 u32 lo, hi, ratio, fsb;
77
78 rdmsr(MSR_IA32_PERF_STATUS, lo, hi);
79 pr_debug("IA32 perf status is 0x%x, 0x%0x\n", lo, hi);
80 ratio = (hi >> 8) & 0x1f;
81 pr_debug("ratio is %d\n", ratio);
82 if (!ratio) {
83 pr_err("read a zero ratio, should be incorrect!\n");
84 pr_err("force tsc ratio to 16 ...\n");
85 ratio = 16;
86 }
87 rdmsr(MSR_FSB_FREQ, lo, hi);
88 if ((lo & 0x7) == 0x7)
89 fsb = PENWELL_FSB_FREQ_83SKU;
90 else
91 fsb = PENWELL_FSB_FREQ_100SKU;
92 fast_calibrate = ratio * fsb;
93 pr_debug("read penwell tsc %lu khz\n", fast_calibrate);
94 lapic_timer_frequency = fsb * 1000 / HZ;
95 /* mark tsc clocksource as reliable */
96 set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE);
97
98 if (fast_calibrate)
99 return fast_calibrate;
100
101 return 0;
102}
103
104static void __init intel_mid_time_init(void)
105{
106 sfi_table_parse(SFI_SIG_MTMR, NULL, NULL, sfi_parse_mtmr);
107 switch (intel_mid_timer_options) {
108 case INTEL_MID_TIMER_APBT_ONLY:
109 break;
110 case INTEL_MID_TIMER_LAPIC_APBT:
111 x86_init.timers.setup_percpu_clockev = setup_boot_APIC_clock;
112 x86_cpuinit.setup_percpu_clockev = setup_secondary_APIC_clock;
113 break;
114 default:
115 if (!boot_cpu_has(X86_FEATURE_ARAT))
116 break;
117 x86_init.timers.setup_percpu_clockev = setup_boot_APIC_clock;
118 x86_cpuinit.setup_percpu_clockev = setup_secondary_APIC_clock;
119 return;
120 }
121 /* we need at least one APB timer */
122 pre_init_apic_IRQ0();
123 apbt_time_init();
124}
125
126static void intel_mid_arch_setup(void)
127{
128 if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x27)
129 __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_PENWELL;
130 else {
131 pr_err("Unknown Intel MID CPU (%d:%d), default to Penwell\n",
132 boot_cpu_data.x86, boot_cpu_data.x86_model);
133 __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_PENWELL;
134 }
135}
136
137/* MID systems don't have i8042 controller */
138static int intel_mid_i8042_detect(void)
139{
140 return 0;
141}
142
143/*
144 * Moorestown does not have external NMI source nor port 0x61 to report
145 * NMI status. The possible NMI sources are from pmu as a result of NMI
146 * watchdog or lock debug. Reading io port 0x61 results in 0xff which
147 * misled NMI handler.
148 */
149static unsigned char intel_mid_get_nmi_reason(void)
150{
151 return 0;
152}
153
154/*
155 * Moorestown specific x86_init function overrides and early setup
156 * calls.
157 */
158void __init x86_intel_mid_early_setup(void)
159{
160 x86_init.resources.probe_roms = x86_init_noop;
161 x86_init.resources.reserve_resources = x86_init_noop;
162
163 x86_init.timers.timer_init = intel_mid_time_init;
164 x86_init.timers.setup_percpu_clockev = x86_init_noop;
165
166 x86_init.irqs.pre_vector_init = x86_init_noop;
167
168 x86_init.oem.arch_setup = intel_mid_arch_setup;
169
170 x86_cpuinit.setup_percpu_clockev = apbt_setup_secondary_clock;
171
172 x86_platform.calibrate_tsc = intel_mid_calibrate_tsc;
173 x86_platform.i8042_detect = intel_mid_i8042_detect;
174 x86_init.timers.wallclock_init = intel_mid_rtc_init;
175 x86_platform.get_nmi_reason = intel_mid_get_nmi_reason;
176
177 x86_init.pci.init = intel_mid_pci_init;
178 x86_init.pci.fixup_irqs = x86_init_noop;
179
180 legacy_pic = &null_legacy_pic;
181
182 pm_power_off = intel_mid_power_off;
183 machine_ops.emergency_restart = intel_mid_reboot;
184
185 /* Avoid searching for BIOS MP tables */
186 x86_init.mpparse.find_smp_config = x86_init_noop;
187 x86_init.mpparse.get_smp_config = x86_init_uint_noop;
188 set_bit(MP_BUS_ISA, mp_bus_not_pci);
189}
190
191/*
192 * if user does not want to use per CPU apb timer, just give it a lower rating
193 * than local apic timer and skip the late per cpu timer init.
194 */
195static inline int __init setup_x86_intel_mid_timer(char *arg)
196{
197 if (!arg)
198 return -EINVAL;
199
200 if (strcmp("apbt_only", arg) == 0)
201 intel_mid_timer_options = INTEL_MID_TIMER_APBT_ONLY;
202 else if (strcmp("lapic_and_apbt", arg) == 0)
203 intel_mid_timer_options = INTEL_MID_TIMER_LAPIC_APBT;
204 else {
205 pr_warn("X86 INTEL_MID timer option %s not recognised"
206 " use x86_intel_mid_timer=apbt_only or lapic_and_apbt\n",
207 arg);
208 return -EINVAL;
209 }
210 return 0;
211}
212__setup("x86_intel_mid_timer=", setup_x86_intel_mid_timer);
213
diff --git a/arch/x86/platform/mrst/vrtc.c b/arch/x86/platform/intel-mid/intel_mid_vrtc.c
index 5e355b134ba4..4762cff7facd 100644
--- a/arch/x86/platform/mrst/vrtc.c
+++ b/arch/x86/platform/intel-mid/intel_mid_vrtc.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * vrtc.c: Driver for virtual RTC device on Intel MID platform 2 * intel_mid_vrtc.c: Driver for virtual RTC device on Intel MID platform
3 * 3 *
4 * (C) Copyright 2009 Intel Corporation 4 * (C) Copyright 2009 Intel Corporation
5 * 5 *
@@ -23,8 +23,8 @@
23#include <linux/sfi.h> 23#include <linux/sfi.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25 25
26#include <asm/mrst.h> 26#include <asm/intel-mid.h>
27#include <asm/mrst-vrtc.h> 27#include <asm/intel_mid_vrtc.h>
28#include <asm/time.h> 28#include <asm/time.h>
29#include <asm/fixmap.h> 29#include <asm/fixmap.h>
30 30
@@ -79,7 +79,7 @@ void vrtc_get_time(struct timespec *now)
79 /* vRTC YEAR reg contains the offset to 1972 */ 79 /* vRTC YEAR reg contains the offset to 1972 */
80 year += 1972; 80 year += 1972;
81 81
82 printk(KERN_INFO "vRTC: sec: %d min: %d hour: %d day: %d " 82 pr_info("vRTC: sec: %d min: %d hour: %d day: %d "
83 "mon: %d year: %d\n", sec, min, hour, mday, mon, year); 83 "mon: %d year: %d\n", sec, min, hour, mday, mon, year);
84 84
85 now->tv_sec = mktime(year, mon, mday, hour, min, sec); 85 now->tv_sec = mktime(year, mon, mday, hour, min, sec);
@@ -109,15 +109,14 @@ int vrtc_set_mmss(const struct timespec *now)
109 vrtc_cmos_write(tm.tm_sec, RTC_SECONDS); 109 vrtc_cmos_write(tm.tm_sec, RTC_SECONDS);
110 spin_unlock_irqrestore(&rtc_lock, flags); 110 spin_unlock_irqrestore(&rtc_lock, flags);
111 } else { 111 } else {
112 printk(KERN_ERR 112 pr_err("%s: Invalid vRTC value: write of %lx to vRTC failed\n",
113 "%s: Invalid vRTC value: write of %lx to vRTC failed\n",
114 __FUNCTION__, now->tv_sec); 113 __FUNCTION__, now->tv_sec);
115 retval = -EINVAL; 114 retval = -EINVAL;
116 } 115 }
117 return retval; 116 return retval;
118} 117}
119 118
120void __init mrst_rtc_init(void) 119void __init intel_mid_rtc_init(void)
121{ 120{
122 unsigned long vrtc_paddr; 121 unsigned long vrtc_paddr;
123 122
@@ -155,10 +154,10 @@ static struct platform_device vrtc_device = {
155}; 154};
156 155
157/* Register the RTC device if appropriate */ 156/* Register the RTC device if appropriate */
158static int __init mrst_device_create(void) 157static int __init intel_mid_device_create(void)
159{ 158{
160 /* No Moorestown, no device */ 159 /* No Moorestown, no device */
161 if (!mrst_identify_cpu()) 160 if (!intel_mid_identify_cpu())
162 return -ENODEV; 161 return -ENODEV;
163 /* No timer, no device */ 162 /* No timer, no device */
164 if (!sfi_mrtc_num) 163 if (!sfi_mrtc_num)
@@ -175,4 +174,4 @@ static int __init mrst_device_create(void)
175 return platform_device_register(&vrtc_device); 174 return platform_device_register(&vrtc_device);
176} 175}
177 176
178module_init(mrst_device_create); 177module_init(intel_mid_device_create);
diff --git a/arch/x86/platform/intel-mid/sfi.c b/arch/x86/platform/intel-mid/sfi.c
new file mode 100644
index 000000000000..c84c1ca396bf
--- /dev/null
+++ b/arch/x86/platform/intel-mid/sfi.c
@@ -0,0 +1,488 @@
1/*
2 * intel_mid_sfi.c: Intel MID SFI initialization code
3 *
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/interrupt.h>
16#include <linux/scatterlist.h>
17#include <linux/sfi.h>
18#include <linux/intel_pmic_gpio.h>
19#include <linux/spi/spi.h>
20#include <linux/i2c.h>
21#include <linux/skbuff.h>
22#include <linux/gpio.h>
23#include <linux/gpio_keys.h>
24#include <linux/input.h>
25#include <linux/platform_device.h>
26#include <linux/irq.h>
27#include <linux/module.h>
28#include <linux/notifier.h>
29#include <linux/mmc/core.h>
30#include <linux/mmc/card.h>
31#include <linux/blkdev.h>
32
33#include <asm/setup.h>
34#include <asm/mpspec_def.h>
35#include <asm/hw_irq.h>
36#include <asm/apic.h>
37#include <asm/io_apic.h>
38#include <asm/intel-mid.h>
39#include <asm/intel_mid_vrtc.h>
40#include <asm/io.h>
41#include <asm/i8259.h>
42#include <asm/intel_scu_ipc.h>
43#include <asm/apb_timer.h>
44#include <asm/reboot.h>
45
46#define SFI_SIG_OEM0 "OEM0"
47#define MAX_IPCDEVS 24
48#define MAX_SCU_SPI 24
49#define MAX_SCU_I2C 24
50
51static struct platform_device *ipc_devs[MAX_IPCDEVS];
52static struct spi_board_info *spi_devs[MAX_SCU_SPI];
53static struct i2c_board_info *i2c_devs[MAX_SCU_I2C];
54static struct sfi_gpio_table_entry *gpio_table;
55static struct sfi_timer_table_entry sfi_mtimer_array[SFI_MTMR_MAX_NUM];
56static int ipc_next_dev;
57static int spi_next_dev;
58static int i2c_next_dev;
59static int i2c_bus[MAX_SCU_I2C];
60static int gpio_num_entry;
61static u32 sfi_mtimer_usage[SFI_MTMR_MAX_NUM];
62int sfi_mrtc_num;
63int sfi_mtimer_num;
64
65struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX];
66EXPORT_SYMBOL_GPL(sfi_mrtc_array);
67
68struct blocking_notifier_head intel_scu_notifier =
69 BLOCKING_NOTIFIER_INIT(intel_scu_notifier);
70EXPORT_SYMBOL_GPL(intel_scu_notifier);
71
72#define intel_mid_sfi_get_pdata(dev, priv) \
73 ((dev)->get_platform_data ? (dev)->get_platform_data(priv) : NULL)
74
75/* parse all the mtimer info to a static mtimer array */
76int __init sfi_parse_mtmr(struct sfi_table_header *table)
77{
78 struct sfi_table_simple *sb;
79 struct sfi_timer_table_entry *pentry;
80 struct mpc_intsrc mp_irq;
81 int totallen;
82
83 sb = (struct sfi_table_simple *)table;
84 if (!sfi_mtimer_num) {
85 sfi_mtimer_num = SFI_GET_NUM_ENTRIES(sb,
86 struct sfi_timer_table_entry);
87 pentry = (struct sfi_timer_table_entry *) sb->pentry;
88 totallen = sfi_mtimer_num * sizeof(*pentry);
89 memcpy(sfi_mtimer_array, pentry, totallen);
90 }
91
92 pr_debug("SFI MTIMER info (num = %d):\n", sfi_mtimer_num);
93 pentry = sfi_mtimer_array;
94 for (totallen = 0; totallen < sfi_mtimer_num; totallen++, pentry++) {
95 pr_debug("timer[%d]: paddr = 0x%08x, freq = %dHz, irq = %d\n",
96 totallen, (u32)pentry->phys_addr,
97 pentry->freq_hz, pentry->irq);
98 if (!pentry->irq)
99 continue;
100 mp_irq.type = MP_INTSRC;
101 mp_irq.irqtype = mp_INT;
102/* triggering mode edge bit 2-3, active high polarity bit 0-1 */
103 mp_irq.irqflag = 5;
104 mp_irq.srcbus = MP_BUS_ISA;
105 mp_irq.srcbusirq = pentry->irq; /* IRQ */
106 mp_irq.dstapic = MP_APIC_ALL;
107 mp_irq.dstirq = pentry->irq;
108 mp_save_irq(&mp_irq);
109 }
110
111 return 0;
112}
113
114struct sfi_timer_table_entry *sfi_get_mtmr(int hint)
115{
116 int i;
117 if (hint < sfi_mtimer_num) {
118 if (!sfi_mtimer_usage[hint]) {
119 pr_debug("hint taken for timer %d irq %d\n",
120 hint, sfi_mtimer_array[hint].irq);
121 sfi_mtimer_usage[hint] = 1;
122 return &sfi_mtimer_array[hint];
123 }
124 }
125 /* take the first timer available */
126 for (i = 0; i < sfi_mtimer_num;) {
127 if (!sfi_mtimer_usage[i]) {
128 sfi_mtimer_usage[i] = 1;
129 return &sfi_mtimer_array[i];
130 }
131 i++;
132 }
133 return NULL;
134}
135
136void sfi_free_mtmr(struct sfi_timer_table_entry *mtmr)
137{
138 int i;
139 for (i = 0; i < sfi_mtimer_num;) {
140 if (mtmr->irq == sfi_mtimer_array[i].irq) {
141 sfi_mtimer_usage[i] = 0;
142 return;
143 }
144 i++;
145 }
146}
147
148/* parse all the mrtc info to a global mrtc array */
149int __init sfi_parse_mrtc(struct sfi_table_header *table)
150{
151 struct sfi_table_simple *sb;
152 struct sfi_rtc_table_entry *pentry;
153 struct mpc_intsrc mp_irq;
154
155 int totallen;
156
157 sb = (struct sfi_table_simple *)table;
158 if (!sfi_mrtc_num) {
159 sfi_mrtc_num = SFI_GET_NUM_ENTRIES(sb,
160 struct sfi_rtc_table_entry);
161 pentry = (struct sfi_rtc_table_entry *)sb->pentry;
162 totallen = sfi_mrtc_num * sizeof(*pentry);
163 memcpy(sfi_mrtc_array, pentry, totallen);
164 }
165
166 pr_debug("SFI RTC info (num = %d):\n", sfi_mrtc_num);
167 pentry = sfi_mrtc_array;
168 for (totallen = 0; totallen < sfi_mrtc_num; totallen++, pentry++) {
169 pr_debug("RTC[%d]: paddr = 0x%08x, irq = %d\n",
170 totallen, (u32)pentry->phys_addr, pentry->irq);
171 mp_irq.type = MP_INTSRC;
172 mp_irq.irqtype = mp_INT;
173 mp_irq.irqflag = 0xf; /* level trigger and active low */
174 mp_irq.srcbus = MP_BUS_ISA;
175 mp_irq.srcbusirq = pentry->irq; /* IRQ */
176 mp_irq.dstapic = MP_APIC_ALL;
177 mp_irq.dstirq = pentry->irq;
178 mp_save_irq(&mp_irq);
179 }
180 return 0;
181}
182
183
184/*
185 * Parsing GPIO table first, since the DEVS table will need this table
186 * to map the pin name to the actual pin.
187 */
188static int __init sfi_parse_gpio(struct sfi_table_header *table)
189{
190 struct sfi_table_simple *sb;
191 struct sfi_gpio_table_entry *pentry;
192 int num, i;
193
194 if (gpio_table)
195 return 0;
196 sb = (struct sfi_table_simple *)table;
197 num = SFI_GET_NUM_ENTRIES(sb, struct sfi_gpio_table_entry);
198 pentry = (struct sfi_gpio_table_entry *)sb->pentry;
199
200 gpio_table = kmalloc(num * sizeof(*pentry), GFP_KERNEL);
201 if (!gpio_table)
202 return -1;
203 memcpy(gpio_table, pentry, num * sizeof(*pentry));
204 gpio_num_entry = num;
205
206 pr_debug("GPIO pin info:\n");
207 for (i = 0; i < num; i++, pentry++)
208 pr_debug("info[%2d]: controller = %16.16s, pin_name = %16.16s,"
209 " pin = %d\n", i,
210 pentry->controller_name,
211 pentry->pin_name,
212 pentry->pin_no);
213 return 0;
214}
215
216int get_gpio_by_name(const char *name)
217{
218 struct sfi_gpio_table_entry *pentry = gpio_table;
219 int i;
220
221 if (!pentry)
222 return -1;
223 for (i = 0; i < gpio_num_entry; i++, pentry++) {
224 if (!strncmp(name, pentry->pin_name, SFI_NAME_LEN))
225 return pentry->pin_no;
226 }
227 return -1;
228}
229
230void __init intel_scu_device_register(struct platform_device *pdev)
231{
232 if (ipc_next_dev == MAX_IPCDEVS)
233 pr_err("too many SCU IPC devices");
234 else
235 ipc_devs[ipc_next_dev++] = pdev;
236}
237
238static void __init intel_scu_spi_device_register(struct spi_board_info *sdev)
239{
240 struct spi_board_info *new_dev;
241
242 if (spi_next_dev == MAX_SCU_SPI) {
243 pr_err("too many SCU SPI devices");
244 return;
245 }
246
247 new_dev = kzalloc(sizeof(*sdev), GFP_KERNEL);
248 if (!new_dev) {
249 pr_err("failed to alloc mem for delayed spi dev %s\n",
250 sdev->modalias);
251 return;
252 }
253 memcpy(new_dev, sdev, sizeof(*sdev));
254
255 spi_devs[spi_next_dev++] = new_dev;
256}
257
258static void __init intel_scu_i2c_device_register(int bus,
259 struct i2c_board_info *idev)
260{
261 struct i2c_board_info *new_dev;
262
263 if (i2c_next_dev == MAX_SCU_I2C) {
264 pr_err("too many SCU I2C devices");
265 return;
266 }
267
268 new_dev = kzalloc(sizeof(*idev), GFP_KERNEL);
269 if (!new_dev) {
270 pr_err("failed to alloc mem for delayed i2c dev %s\n",
271 idev->type);
272 return;
273 }
274 memcpy(new_dev, idev, sizeof(*idev));
275
276 i2c_bus[i2c_next_dev] = bus;
277 i2c_devs[i2c_next_dev++] = new_dev;
278}
279
280/* Called by IPC driver */
281void intel_scu_devices_create(void)
282{
283 int i;
284
285 for (i = 0; i < ipc_next_dev; i++)
286 platform_device_add(ipc_devs[i]);
287
288 for (i = 0; i < spi_next_dev; i++)
289 spi_register_board_info(spi_devs[i], 1);
290
291 for (i = 0; i < i2c_next_dev; i++) {
292 struct i2c_adapter *adapter;
293 struct i2c_client *client;
294
295 adapter = i2c_get_adapter(i2c_bus[i]);
296 if (adapter) {
297 client = i2c_new_device(adapter, i2c_devs[i]);
298 if (!client)
299 pr_err("can't create i2c device %s\n",
300 i2c_devs[i]->type);
301 } else
302 i2c_register_board_info(i2c_bus[i], i2c_devs[i], 1);
303 }
304 intel_scu_notifier_post(SCU_AVAILABLE, NULL);
305}
306EXPORT_SYMBOL_GPL(intel_scu_devices_create);
307
308/* Called by IPC driver */
309void intel_scu_devices_destroy(void)
310{
311 int i;
312
313 intel_scu_notifier_post(SCU_DOWN, NULL);
314
315 for (i = 0; i < ipc_next_dev; i++)
316 platform_device_del(ipc_devs[i]);
317}
318EXPORT_SYMBOL_GPL(intel_scu_devices_destroy);
319
320static void __init install_irq_resource(struct platform_device *pdev, int irq)
321{
322 /* Single threaded */
323 static struct resource res __initdata = {
324 .name = "IRQ",
325 .flags = IORESOURCE_IRQ,
326 };
327 res.start = irq;
328 platform_device_add_resources(pdev, &res, 1);
329}
330
331static void __init sfi_handle_ipc_dev(struct sfi_device_table_entry *pentry,
332 struct devs_id *dev)
333{
334 struct platform_device *pdev;
335 void *pdata = NULL;
336
337 pr_debug("IPC bus, name = %16.16s, irq = 0x%2x\n",
338 pentry->name, pentry->irq);
339 pdata = intel_mid_sfi_get_pdata(dev, pentry);
340
341 pdev = platform_device_alloc(pentry->name, 0);
342 if (pdev == NULL) {
343 pr_err("out of memory for SFI platform device '%s'.\n",
344 pentry->name);
345 return;
346 }
347 install_irq_resource(pdev, pentry->irq);
348
349 pdev->dev.platform_data = pdata;
350 platform_device_add(pdev);
351}
352
353static void __init sfi_handle_spi_dev(struct sfi_device_table_entry *pentry,
354 struct devs_id *dev)
355{
356 struct spi_board_info spi_info;
357 void *pdata = NULL;
358
359 memset(&spi_info, 0, sizeof(spi_info));
360 strncpy(spi_info.modalias, pentry->name, SFI_NAME_LEN);
361 spi_info.irq = ((pentry->irq == (u8)0xff) ? 0 : pentry->irq);
362 spi_info.bus_num = pentry->host_num;
363 spi_info.chip_select = pentry->addr;
364 spi_info.max_speed_hz = pentry->max_freq;
365 pr_debug("SPI bus=%d, name=%16.16s, irq=0x%2x, max_freq=%d, cs=%d\n",
366 spi_info.bus_num,
367 spi_info.modalias,
368 spi_info.irq,
369 spi_info.max_speed_hz,
370 spi_info.chip_select);
371
372 pdata = intel_mid_sfi_get_pdata(dev, &spi_info);
373
374 spi_info.platform_data = pdata;
375 if (dev->delay)
376 intel_scu_spi_device_register(&spi_info);
377 else
378 spi_register_board_info(&spi_info, 1);
379}
380
381static void __init sfi_handle_i2c_dev(struct sfi_device_table_entry *pentry,
382 struct devs_id *dev)
383{
384 struct i2c_board_info i2c_info;
385 void *pdata = NULL;
386
387 memset(&i2c_info, 0, sizeof(i2c_info));
388 strncpy(i2c_info.type, pentry->name, SFI_NAME_LEN);
389 i2c_info.irq = ((pentry->irq == (u8)0xff) ? 0 : pentry->irq);
390 i2c_info.addr = pentry->addr;
391 pr_debug("I2C bus = %d, name = %16.16s, irq = 0x%2x, addr = 0x%x\n",
392 pentry->host_num,
393 i2c_info.type,
394 i2c_info.irq,
395 i2c_info.addr);
396 pdata = intel_mid_sfi_get_pdata(dev, &i2c_info);
397 i2c_info.platform_data = pdata;
398
399 if (dev->delay)
400 intel_scu_i2c_device_register(pentry->host_num, &i2c_info);
401 else
402 i2c_register_board_info(pentry->host_num, &i2c_info, 1);
403}
404
405extern struct devs_id *const __x86_intel_mid_dev_start[],
406 *const __x86_intel_mid_dev_end[];
407
408static struct devs_id __init *get_device_id(u8 type, char *name)
409{
410 struct devs_id *const *dev_table;
411
412 for (dev_table = __x86_intel_mid_dev_start;
413 dev_table < __x86_intel_mid_dev_end; dev_table++) {
414 struct devs_id *dev = *dev_table;
415 if (dev->type == type &&
416 !strncmp(dev->name, name, SFI_NAME_LEN)) {
417 return dev;
418 }
419 }
420
421 return NULL;
422}
423
424static int __init sfi_parse_devs(struct sfi_table_header *table)
425{
426 struct sfi_table_simple *sb;
427 struct sfi_device_table_entry *pentry;
428 struct devs_id *dev = NULL;
429 int num, i;
430 int ioapic;
431 struct io_apic_irq_attr irq_attr;
432
433 sb = (struct sfi_table_simple *)table;
434 num = SFI_GET_NUM_ENTRIES(sb, struct sfi_device_table_entry);
435 pentry = (struct sfi_device_table_entry *)sb->pentry;
436
437 for (i = 0; i < num; i++, pentry++) {
438 int irq = pentry->irq;
439
440 if (irq != (u8)0xff) { /* native RTE case */
441 /* these SPI2 devices are not exposed to system as PCI
442 * devices, but they have separate RTE entry in IOAPIC
443 * so we have to enable them one by one here
444 */
445 ioapic = mp_find_ioapic(irq);
446 irq_attr.ioapic = ioapic;
447 irq_attr.ioapic_pin = irq;
448 irq_attr.trigger = 1;
449 irq_attr.polarity = 1;
450 io_apic_set_pci_routing(NULL, irq, &irq_attr);
451 } else
452 irq = 0; /* No irq */
453
454 dev = get_device_id(pentry->type, pentry->name);
455
456 if (!dev)
457 continue;
458
459 if (dev->device_handler) {
460 dev->device_handler(pentry, dev);
461 } else {
462 switch (pentry->type) {
463 case SFI_DEV_TYPE_IPC:
464 sfi_handle_ipc_dev(pentry, dev);
465 break;
466 case SFI_DEV_TYPE_SPI:
467 sfi_handle_spi_dev(pentry, dev);
468 break;
469 case SFI_DEV_TYPE_I2C:
470 sfi_handle_i2c_dev(pentry, dev);
471 break;
472 case SFI_DEV_TYPE_UART:
473 case SFI_DEV_TYPE_HSI:
474 default:
475 break;
476 }
477 }
478 }
479 return 0;
480}
481
482static int __init intel_mid_platform_init(void)
483{
484 sfi_table_parse(SFI_SIG_GPIO, NULL, NULL, sfi_parse_gpio);
485 sfi_table_parse(SFI_SIG_DEVS, NULL, NULL, sfi_parse_devs);
486 return 0;
487}
488arch_initcall(intel_mid_platform_init);
diff --git a/arch/x86/platform/mrst/Makefile b/arch/x86/platform/mrst/Makefile
deleted file mode 100644
index af1da7e623f9..000000000000
--- a/arch/x86/platform/mrst/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
1obj-$(CONFIG_X86_INTEL_MID) += mrst.o
2obj-$(CONFIG_X86_INTEL_MID) += vrtc.o
3obj-$(CONFIG_EARLY_PRINTK_INTEL_MID) += early_printk_mrst.o
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
deleted file mode 100644
index 3ca5957b7a34..000000000000
--- a/arch/x86/platform/mrst/mrst.c
+++ /dev/null
@@ -1,1052 +0,0 @@
1/*
2 * mrst.c: Intel Moorestown platform specific setup code
3 *
4 * (C) Copyright 2008 Intel Corporation
5 * Author: Jacob Pan (jacob.jun.pan@intel.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#define pr_fmt(fmt) "mrst: " fmt
14
15#include <linux/init.h>
16#include <linux/kernel.h>
17#include <linux/interrupt.h>
18#include <linux/scatterlist.h>
19#include <linux/sfi.h>
20#include <linux/intel_pmic_gpio.h>
21#include <linux/spi/spi.h>
22#include <linux/i2c.h>
23#include <linux/platform_data/pca953x.h>
24#include <linux/gpio_keys.h>
25#include <linux/input.h>
26#include <linux/platform_device.h>
27#include <linux/irq.h>
28#include <linux/module.h>
29#include <linux/notifier.h>
30#include <linux/mfd/intel_msic.h>
31#include <linux/gpio.h>
32#include <linux/i2c/tc35876x.h>
33
34#include <asm/setup.h>
35#include <asm/mpspec_def.h>
36#include <asm/hw_irq.h>
37#include <asm/apic.h>
38#include <asm/io_apic.h>
39#include <asm/mrst.h>
40#include <asm/mrst-vrtc.h>
41#include <asm/io.h>
42#include <asm/i8259.h>
43#include <asm/intel_scu_ipc.h>
44#include <asm/apb_timer.h>
45#include <asm/reboot.h>
46
47/*
48 * the clockevent devices on Moorestown/Medfield can be APBT or LAPIC clock,
49 * cmdline option x86_mrst_timer can be used to override the configuration
50 * to prefer one or the other.
51 * at runtime, there are basically three timer configurations:
52 * 1. per cpu apbt clock only
53 * 2. per cpu always-on lapic clocks only, this is Penwell/Medfield only
54 * 3. per cpu lapic clock (C3STOP) and one apbt clock, with broadcast.
55 *
56 * by default (without cmdline option), platform code first detects cpu type
57 * to see if we are on lincroft or penwell, then set up both lapic or apbt
58 * clocks accordingly.
59 * i.e. by default, medfield uses configuration #2, moorestown uses #1.
60 * config #3 is supported but not recommended on medfield.
61 *
62 * rating and feature summary:
63 * lapic (with C3STOP) --------- 100
64 * apbt (always-on) ------------ 110
65 * lapic (always-on,ARAT) ------ 150
66 */
67
68enum mrst_timer_options mrst_timer_options;
69
70static u32 sfi_mtimer_usage[SFI_MTMR_MAX_NUM];
71static struct sfi_timer_table_entry sfi_mtimer_array[SFI_MTMR_MAX_NUM];
72enum mrst_cpu_type __mrst_cpu_chip;
73EXPORT_SYMBOL_GPL(__mrst_cpu_chip);
74
75int sfi_mtimer_num;
76
77struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX];
78EXPORT_SYMBOL_GPL(sfi_mrtc_array);
79int sfi_mrtc_num;
80
81static void mrst_power_off(void)
82{
83}
84
85static void mrst_reboot(void)
86{
87 intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0);
88}
89
90/* parse all the mtimer info to a static mtimer array */
91static int __init sfi_parse_mtmr(struct sfi_table_header *table)
92{
93 struct sfi_table_simple *sb;
94 struct sfi_timer_table_entry *pentry;
95 struct mpc_intsrc mp_irq;
96 int totallen;
97
98 sb = (struct sfi_table_simple *)table;
99 if (!sfi_mtimer_num) {
100 sfi_mtimer_num = SFI_GET_NUM_ENTRIES(sb,
101 struct sfi_timer_table_entry);
102 pentry = (struct sfi_timer_table_entry *) sb->pentry;
103 totallen = sfi_mtimer_num * sizeof(*pentry);
104 memcpy(sfi_mtimer_array, pentry, totallen);
105 }
106
107 pr_debug("SFI MTIMER info (num = %d):\n", sfi_mtimer_num);
108 pentry = sfi_mtimer_array;
109 for (totallen = 0; totallen < sfi_mtimer_num; totallen++, pentry++) {
110 pr_debug("timer[%d]: paddr = 0x%08x, freq = %dHz,"
111 " irq = %d\n", totallen, (u32)pentry->phys_addr,
112 pentry->freq_hz, pentry->irq);
113 if (!pentry->irq)
114 continue;
115 mp_irq.type = MP_INTSRC;
116 mp_irq.irqtype = mp_INT;
117/* triggering mode edge bit 2-3, active high polarity bit 0-1 */
118 mp_irq.irqflag = 5;
119 mp_irq.srcbus = MP_BUS_ISA;
120 mp_irq.srcbusirq = pentry->irq; /* IRQ */
121 mp_irq.dstapic = MP_APIC_ALL;
122 mp_irq.dstirq = pentry->irq;
123 mp_save_irq(&mp_irq);
124 }
125
126 return 0;
127}
128
129struct sfi_timer_table_entry *sfi_get_mtmr(int hint)
130{
131 int i;
132 if (hint < sfi_mtimer_num) {
133 if (!sfi_mtimer_usage[hint]) {
134 pr_debug("hint taken for timer %d irq %d\n",\
135 hint, sfi_mtimer_array[hint].irq);
136 sfi_mtimer_usage[hint] = 1;
137 return &sfi_mtimer_array[hint];
138 }
139 }
140 /* take the first timer available */
141 for (i = 0; i < sfi_mtimer_num;) {
142 if (!sfi_mtimer_usage[i]) {
143 sfi_mtimer_usage[i] = 1;
144 return &sfi_mtimer_array[i];
145 }
146 i++;
147 }
148 return NULL;
149}
150
151void sfi_free_mtmr(struct sfi_timer_table_entry *mtmr)
152{
153 int i;
154 for (i = 0; i < sfi_mtimer_num;) {
155 if (mtmr->irq == sfi_mtimer_array[i].irq) {
156 sfi_mtimer_usage[i] = 0;
157 return;
158 }
159 i++;
160 }
161}
162
163/* parse all the mrtc info to a global mrtc array */
164int __init sfi_parse_mrtc(struct sfi_table_header *table)
165{
166 struct sfi_table_simple *sb;
167 struct sfi_rtc_table_entry *pentry;
168 struct mpc_intsrc mp_irq;
169
170 int totallen;
171
172 sb = (struct sfi_table_simple *)table;
173 if (!sfi_mrtc_num) {
174 sfi_mrtc_num = SFI_GET_NUM_ENTRIES(sb,
175 struct sfi_rtc_table_entry);
176 pentry = (struct sfi_rtc_table_entry *)sb->pentry;
177 totallen = sfi_mrtc_num * sizeof(*pentry);
178 memcpy(sfi_mrtc_array, pentry, totallen);
179 }
180
181 pr_debug("SFI RTC info (num = %d):\n", sfi_mrtc_num);
182 pentry = sfi_mrtc_array;
183 for (totallen = 0; totallen < sfi_mrtc_num; totallen++, pentry++) {
184 pr_debug("RTC[%d]: paddr = 0x%08x, irq = %d\n",
185 totallen, (u32)pentry->phys_addr, pentry->irq);
186 mp_irq.type = MP_INTSRC;
187 mp_irq.irqtype = mp_INT;
188 mp_irq.irqflag = 0xf; /* level trigger and active low */
189 mp_irq.srcbus = MP_BUS_ISA;
190 mp_irq.srcbusirq = pentry->irq; /* IRQ */
191 mp_irq.dstapic = MP_APIC_ALL;
192 mp_irq.dstirq = pentry->irq;
193 mp_save_irq(&mp_irq);
194 }
195 return 0;
196}
197
198static unsigned long __init mrst_calibrate_tsc(void)
199{
200 unsigned long fast_calibrate;
201 u32 lo, hi, ratio, fsb;
202
203 rdmsr(MSR_IA32_PERF_STATUS, lo, hi);
204 pr_debug("IA32 perf status is 0x%x, 0x%0x\n", lo, hi);
205 ratio = (hi >> 8) & 0x1f;
206 pr_debug("ratio is %d\n", ratio);
207 if (!ratio) {
208 pr_err("read a zero ratio, should be incorrect!\n");
209 pr_err("force tsc ratio to 16 ...\n");
210 ratio = 16;
211 }
212 rdmsr(MSR_FSB_FREQ, lo, hi);
213 if ((lo & 0x7) == 0x7)
214 fsb = PENWELL_FSB_FREQ_83SKU;
215 else
216 fsb = PENWELL_FSB_FREQ_100SKU;
217 fast_calibrate = ratio * fsb;
218 pr_debug("read penwell tsc %lu khz\n", fast_calibrate);
219 lapic_timer_frequency = fsb * 1000 / HZ;
220 /* mark tsc clocksource as reliable */
221 set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE);
222
223 if (fast_calibrate)
224 return fast_calibrate;
225
226 return 0;
227}
228
229static void __init mrst_time_init(void)
230{
231 sfi_table_parse(SFI_SIG_MTMR, NULL, NULL, sfi_parse_mtmr);
232 switch (mrst_timer_options) {
233 case MRST_TIMER_APBT_ONLY:
234 break;
235 case MRST_TIMER_LAPIC_APBT:
236 x86_init.timers.setup_percpu_clockev = setup_boot_APIC_clock;
237 x86_cpuinit.setup_percpu_clockev = setup_secondary_APIC_clock;
238 break;
239 default:
240 if (!boot_cpu_has(X86_FEATURE_ARAT))
241 break;
242 x86_init.timers.setup_percpu_clockev = setup_boot_APIC_clock;
243 x86_cpuinit.setup_percpu_clockev = setup_secondary_APIC_clock;
244 return;
245 }
246 /* we need at least one APB timer */
247 pre_init_apic_IRQ0();
248 apbt_time_init();
249}
250
251static void mrst_arch_setup(void)
252{
253 if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x27)
254 __mrst_cpu_chip = MRST_CPU_CHIP_PENWELL;
255 else {
256 pr_err("Unknown Intel MID CPU (%d:%d), default to Penwell\n",
257 boot_cpu_data.x86, boot_cpu_data.x86_model);
258 __mrst_cpu_chip = MRST_CPU_CHIP_PENWELL;
259 }
260}
261
262/* MID systems don't have i8042 controller */
263static int mrst_i8042_detect(void)
264{
265 return 0;
266}
267
268/*
269 * Moorestown does not have external NMI source nor port 0x61 to report
270 * NMI status. The possible NMI sources are from pmu as a result of NMI
271 * watchdog or lock debug. Reading io port 0x61 results in 0xff which
272 * misled NMI handler.
273 */
274static unsigned char mrst_get_nmi_reason(void)
275{
276 return 0;
277}
278
279/*
280 * Moorestown specific x86_init function overrides and early setup
281 * calls.
282 */
283void __init x86_mrst_early_setup(void)
284{
285 x86_init.resources.probe_roms = x86_init_noop;
286 x86_init.resources.reserve_resources = x86_init_noop;
287
288 x86_init.timers.timer_init = mrst_time_init;
289 x86_init.timers.setup_percpu_clockev = x86_init_noop;
290
291 x86_init.irqs.pre_vector_init = x86_init_noop;
292
293 x86_init.oem.arch_setup = mrst_arch_setup;
294
295 x86_cpuinit.setup_percpu_clockev = apbt_setup_secondary_clock;
296
297 x86_platform.calibrate_tsc = mrst_calibrate_tsc;
298 x86_platform.i8042_detect = mrst_i8042_detect;
299 x86_init.timers.wallclock_init = mrst_rtc_init;
300 x86_platform.get_nmi_reason = mrst_get_nmi_reason;
301
302 x86_init.pci.init = pci_mrst_init;
303 x86_init.pci.fixup_irqs = x86_init_noop;
304
305 legacy_pic = &null_legacy_pic;
306
307 /* Moorestown specific power_off/restart method */
308 pm_power_off = mrst_power_off;
309 machine_ops.emergency_restart = mrst_reboot;
310
311 /* Avoid searching for BIOS MP tables */
312 x86_init.mpparse.find_smp_config = x86_init_noop;
313 x86_init.mpparse.get_smp_config = x86_init_uint_noop;
314 set_bit(MP_BUS_ISA, mp_bus_not_pci);
315}
316
317/*
318 * if user does not want to use per CPU apb timer, just give it a lower rating
319 * than local apic timer and skip the late per cpu timer init.
320 */
321static inline int __init setup_x86_mrst_timer(char *arg)
322{
323 if (!arg)
324 return -EINVAL;
325
326 if (strcmp("apbt_only", arg) == 0)
327 mrst_timer_options = MRST_TIMER_APBT_ONLY;
328 else if (strcmp("lapic_and_apbt", arg) == 0)
329 mrst_timer_options = MRST_TIMER_LAPIC_APBT;
330 else {
331 pr_warning("X86 MRST timer option %s not recognised"
332 " use x86_mrst_timer=apbt_only or lapic_and_apbt\n",
333 arg);
334 return -EINVAL;
335 }
336 return 0;
337}
338__setup("x86_mrst_timer=", setup_x86_mrst_timer);
339
340/*
341 * Parsing GPIO table first, since the DEVS table will need this table
342 * to map the pin name to the actual pin.
343 */
344static struct sfi_gpio_table_entry *gpio_table;
345static int gpio_num_entry;
346
347static int __init sfi_parse_gpio(struct sfi_table_header *table)
348{
349 struct sfi_table_simple *sb;
350 struct sfi_gpio_table_entry *pentry;
351 int num, i;
352
353 if (gpio_table)
354 return 0;
355 sb = (struct sfi_table_simple *)table;
356 num = SFI_GET_NUM_ENTRIES(sb, struct sfi_gpio_table_entry);
357 pentry = (struct sfi_gpio_table_entry *)sb->pentry;
358
359 gpio_table = kmalloc(num * sizeof(*pentry), GFP_KERNEL);
360 if (!gpio_table)
361 return -1;
362 memcpy(gpio_table, pentry, num * sizeof(*pentry));
363 gpio_num_entry = num;
364
365 pr_debug("GPIO pin info:\n");
366 for (i = 0; i < num; i++, pentry++)
367 pr_debug("info[%2d]: controller = %16.16s, pin_name = %16.16s,"
368 " pin = %d\n", i,
369 pentry->controller_name,
370 pentry->pin_name,
371 pentry->pin_no);
372 return 0;
373}
374
375static int get_gpio_by_name(const char *name)
376{
377 struct sfi_gpio_table_entry *pentry = gpio_table;
378 int i;
379
380 if (!pentry)
381 return -1;
382 for (i = 0; i < gpio_num_entry; i++, pentry++) {
383 if (!strncmp(name, pentry->pin_name, SFI_NAME_LEN))
384 return pentry->pin_no;
385 }
386 return -1;
387}
388
389/*
390 * Here defines the array of devices platform data that IAFW would export
391 * through SFI "DEVS" table, we use name and type to match the device and
392 * its platform data.
393 */
394struct devs_id {
395 char name[SFI_NAME_LEN + 1];
396 u8 type;
397 u8 delay;
398 void *(*get_platform_data)(void *info);
399};
400
401/* the offset for the mapping of global gpio pin to irq */
402#define MRST_IRQ_OFFSET 0x100
403
404static void __init *pmic_gpio_platform_data(void *info)
405{
406 static struct intel_pmic_gpio_platform_data pmic_gpio_pdata;
407 int gpio_base = get_gpio_by_name("pmic_gpio_base");
408
409 if (gpio_base == -1)
410 gpio_base = 64;
411 pmic_gpio_pdata.gpio_base = gpio_base;
412 pmic_gpio_pdata.irq_base = gpio_base + MRST_IRQ_OFFSET;
413 pmic_gpio_pdata.gpiointr = 0xffffeff8;
414
415 return &pmic_gpio_pdata;
416}
417
418static void __init *max3111_platform_data(void *info)
419{
420 struct spi_board_info *spi_info = info;
421 int intr = get_gpio_by_name("max3111_int");
422
423 spi_info->mode = SPI_MODE_0;
424 if (intr == -1)
425 return NULL;
426 spi_info->irq = intr + MRST_IRQ_OFFSET;
427 return NULL;
428}
429
430/* we have multiple max7315 on the board ... */
431#define MAX7315_NUM 2
432static void __init *max7315_platform_data(void *info)
433{
434 static struct pca953x_platform_data max7315_pdata[MAX7315_NUM];
435 static int nr;
436 struct pca953x_platform_data *max7315 = &max7315_pdata[nr];
437 struct i2c_board_info *i2c_info = info;
438 int gpio_base, intr;
439 char base_pin_name[SFI_NAME_LEN + 1];
440 char intr_pin_name[SFI_NAME_LEN + 1];
441
442 if (nr == MAX7315_NUM) {
443 pr_err("too many max7315s, we only support %d\n",
444 MAX7315_NUM);
445 return NULL;
446 }
447 /* we have several max7315 on the board, we only need load several
448 * instances of the same pca953x driver to cover them
449 */
450 strcpy(i2c_info->type, "max7315");
451 if (nr++) {
452 sprintf(base_pin_name, "max7315_%d_base", nr);
453 sprintf(intr_pin_name, "max7315_%d_int", nr);
454 } else {
455 strcpy(base_pin_name, "max7315_base");
456 strcpy(intr_pin_name, "max7315_int");
457 }
458
459 gpio_base = get_gpio_by_name(base_pin_name);
460 intr = get_gpio_by_name(intr_pin_name);
461
462 if (gpio_base == -1)
463 return NULL;
464 max7315->gpio_base = gpio_base;
465 if (intr != -1) {
466 i2c_info->irq = intr + MRST_IRQ_OFFSET;
467 max7315->irq_base = gpio_base + MRST_IRQ_OFFSET;
468 } else {
469 i2c_info->irq = -1;
470 max7315->irq_base = -1;
471 }
472 return max7315;
473}
474
475static void *tca6416_platform_data(void *info)
476{
477 static struct pca953x_platform_data tca6416;
478 struct i2c_board_info *i2c_info = info;
479 int gpio_base, intr;
480 char base_pin_name[SFI_NAME_LEN + 1];
481 char intr_pin_name[SFI_NAME_LEN + 1];
482
483 strcpy(i2c_info->type, "tca6416");
484 strcpy(base_pin_name, "tca6416_base");
485 strcpy(intr_pin_name, "tca6416_int");
486
487 gpio_base = get_gpio_by_name(base_pin_name);
488 intr = get_gpio_by_name(intr_pin_name);
489
490 if (gpio_base == -1)
491 return NULL;
492 tca6416.gpio_base = gpio_base;
493 if (intr != -1) {
494 i2c_info->irq = intr + MRST_IRQ_OFFSET;
495 tca6416.irq_base = gpio_base + MRST_IRQ_OFFSET;
496 } else {
497 i2c_info->irq = -1;
498 tca6416.irq_base = -1;
499 }
500 return &tca6416;
501}
502
503static void *mpu3050_platform_data(void *info)
504{
505 struct i2c_board_info *i2c_info = info;
506 int intr = get_gpio_by_name("mpu3050_int");
507
508 if (intr == -1)
509 return NULL;
510
511 i2c_info->irq = intr + MRST_IRQ_OFFSET;
512 return NULL;
513}
514
515static void __init *emc1403_platform_data(void *info)
516{
517 static short intr2nd_pdata;
518 struct i2c_board_info *i2c_info = info;
519 int intr = get_gpio_by_name("thermal_int");
520 int intr2nd = get_gpio_by_name("thermal_alert");
521
522 if (intr == -1 || intr2nd == -1)
523 return NULL;
524
525 i2c_info->irq = intr + MRST_IRQ_OFFSET;
526 intr2nd_pdata = intr2nd + MRST_IRQ_OFFSET;
527
528 return &intr2nd_pdata;
529}
530
531static void __init *lis331dl_platform_data(void *info)
532{
533 static short intr2nd_pdata;
534 struct i2c_board_info *i2c_info = info;
535 int intr = get_gpio_by_name("accel_int");
536 int intr2nd = get_gpio_by_name("accel_2");
537
538 if (intr == -1 || intr2nd == -1)
539 return NULL;
540
541 i2c_info->irq = intr + MRST_IRQ_OFFSET;
542 intr2nd_pdata = intr2nd + MRST_IRQ_OFFSET;
543
544 return &intr2nd_pdata;
545}
546
547static void __init *no_platform_data(void *info)
548{
549 return NULL;
550}
551
552static struct resource msic_resources[] = {
553 {
554 .start = INTEL_MSIC_IRQ_PHYS_BASE,
555 .end = INTEL_MSIC_IRQ_PHYS_BASE + 64 - 1,
556 .flags = IORESOURCE_MEM,
557 },
558};
559
560static struct intel_msic_platform_data msic_pdata;
561
562static struct platform_device msic_device = {
563 .name = "intel_msic",
564 .id = -1,
565 .dev = {
566 .platform_data = &msic_pdata,
567 },
568 .num_resources = ARRAY_SIZE(msic_resources),
569 .resource = msic_resources,
570};
571
572static inline bool mrst_has_msic(void)
573{
574 return mrst_identify_cpu() == MRST_CPU_CHIP_PENWELL;
575}
576
577static int msic_scu_status_change(struct notifier_block *nb,
578 unsigned long code, void *data)
579{
580 if (code == SCU_DOWN) {
581 platform_device_unregister(&msic_device);
582 return 0;
583 }
584
585 return platform_device_register(&msic_device);
586}
587
588static int __init msic_init(void)
589{
590 static struct notifier_block msic_scu_notifier = {
591 .notifier_call = msic_scu_status_change,
592 };
593
594 /*
595 * We need to be sure that the SCU IPC is ready before MSIC device
596 * can be registered.
597 */
598 if (mrst_has_msic())
599 intel_scu_notifier_add(&msic_scu_notifier);
600
601 return 0;
602}
603arch_initcall(msic_init);
604
605/*
606 * msic_generic_platform_data - sets generic platform data for the block
607 * @info: pointer to the SFI device table entry for this block
608 * @block: MSIC block
609 *
610 * Function sets IRQ number from the SFI table entry for given device to
611 * the MSIC platform data.
612 */
613static void *msic_generic_platform_data(void *info, enum intel_msic_block block)
614{
615 struct sfi_device_table_entry *entry = info;
616
617 BUG_ON(block < 0 || block >= INTEL_MSIC_BLOCK_LAST);
618 msic_pdata.irq[block] = entry->irq;
619
620 return no_platform_data(info);
621}
622
623static void *msic_battery_platform_data(void *info)
624{
625 return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_BATTERY);
626}
627
628static void *msic_gpio_platform_data(void *info)
629{
630 static struct intel_msic_gpio_pdata pdata;
631 int gpio = get_gpio_by_name("msic_gpio_base");
632
633 if (gpio < 0)
634 return NULL;
635
636 pdata.gpio_base = gpio;
637 msic_pdata.gpio = &pdata;
638
639 return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_GPIO);
640}
641
642static void *msic_audio_platform_data(void *info)
643{
644 struct platform_device *pdev;
645
646 pdev = platform_device_register_simple("sst-platform", -1, NULL, 0);
647 if (IS_ERR(pdev)) {
648 pr_err("failed to create audio platform device\n");
649 return NULL;
650 }
651
652 return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_AUDIO);
653}
654
655static void *msic_power_btn_platform_data(void *info)
656{
657 return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_POWER_BTN);
658}
659
660static void *msic_ocd_platform_data(void *info)
661{
662 static struct intel_msic_ocd_pdata pdata;
663 int gpio = get_gpio_by_name("ocd_gpio");
664
665 if (gpio < 0)
666 return NULL;
667
668 pdata.gpio = gpio;
669 msic_pdata.ocd = &pdata;
670
671 return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_OCD);
672}
673
674static void *msic_thermal_platform_data(void *info)
675{
676 return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_THERMAL);
677}
678
679/* tc35876x DSI-LVDS bridge chip and panel platform data */
680static void *tc35876x_platform_data(void *data)
681{
682 static struct tc35876x_platform_data pdata;
683
684 /* gpio pins set to -1 will not be used by the driver */
685 pdata.gpio_bridge_reset = get_gpio_by_name("LCMB_RXEN");
686 pdata.gpio_panel_bl_en = get_gpio_by_name("6S6P_BL_EN");
687 pdata.gpio_panel_vadd = get_gpio_by_name("EN_VREG_LCD_V3P3");
688
689 return &pdata;
690}
691
692static const struct devs_id __initconst device_ids[] = {
693 {"bma023", SFI_DEV_TYPE_I2C, 1, &no_platform_data},
694 {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data},
695 {"pmic_gpio", SFI_DEV_TYPE_IPC, 1, &pmic_gpio_platform_data},
696 {"spi_max3111", SFI_DEV_TYPE_SPI, 0, &max3111_platform_data},
697 {"i2c_max7315", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data},
698 {"i2c_max7315_2", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data},
699 {"tca6416", SFI_DEV_TYPE_I2C, 1, &tca6416_platform_data},
700 {"emc1403", SFI_DEV_TYPE_I2C, 1, &emc1403_platform_data},
701 {"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data},
702 {"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data},
703 {"mpu3050", SFI_DEV_TYPE_I2C, 1, &mpu3050_platform_data},
704 {"i2c_disp_brig", SFI_DEV_TYPE_I2C, 0, &tc35876x_platform_data},
705
706 /* MSIC subdevices */
707 {"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data},
708 {"msic_gpio", SFI_DEV_TYPE_IPC, 1, &msic_gpio_platform_data},
709 {"msic_audio", SFI_DEV_TYPE_IPC, 1, &msic_audio_platform_data},
710 {"msic_power_btn", SFI_DEV_TYPE_IPC, 1, &msic_power_btn_platform_data},
711 {"msic_ocd", SFI_DEV_TYPE_IPC, 1, &msic_ocd_platform_data},
712 {"msic_thermal", SFI_DEV_TYPE_IPC, 1, &msic_thermal_platform_data},
713
714 {},
715};
716
717#define MAX_IPCDEVS 24
718static struct platform_device *ipc_devs[MAX_IPCDEVS];
719static int ipc_next_dev;
720
721#define MAX_SCU_SPI 24
722static struct spi_board_info *spi_devs[MAX_SCU_SPI];
723static int spi_next_dev;
724
725#define MAX_SCU_I2C 24
726static struct i2c_board_info *i2c_devs[MAX_SCU_I2C];
727static int i2c_bus[MAX_SCU_I2C];
728static int i2c_next_dev;
729
730static void __init intel_scu_device_register(struct platform_device *pdev)
731{
732 if(ipc_next_dev == MAX_IPCDEVS)
733 pr_err("too many SCU IPC devices");
734 else
735 ipc_devs[ipc_next_dev++] = pdev;
736}
737
738static void __init intel_scu_spi_device_register(struct spi_board_info *sdev)
739{
740 struct spi_board_info *new_dev;
741
742 if (spi_next_dev == MAX_SCU_SPI) {
743 pr_err("too many SCU SPI devices");
744 return;
745 }
746
747 new_dev = kzalloc(sizeof(*sdev), GFP_KERNEL);
748 if (!new_dev) {
749 pr_err("failed to alloc mem for delayed spi dev %s\n",
750 sdev->modalias);
751 return;
752 }
753 memcpy(new_dev, sdev, sizeof(*sdev));
754
755 spi_devs[spi_next_dev++] = new_dev;
756}
757
758static void __init intel_scu_i2c_device_register(int bus,
759 struct i2c_board_info *idev)
760{
761 struct i2c_board_info *new_dev;
762
763 if (i2c_next_dev == MAX_SCU_I2C) {
764 pr_err("too many SCU I2C devices");
765 return;
766 }
767
768 new_dev = kzalloc(sizeof(*idev), GFP_KERNEL);
769 if (!new_dev) {
770 pr_err("failed to alloc mem for delayed i2c dev %s\n",
771 idev->type);
772 return;
773 }
774 memcpy(new_dev, idev, sizeof(*idev));
775
776 i2c_bus[i2c_next_dev] = bus;
777 i2c_devs[i2c_next_dev++] = new_dev;
778}
779
780BLOCKING_NOTIFIER_HEAD(intel_scu_notifier);
781EXPORT_SYMBOL_GPL(intel_scu_notifier);
782
783/* Called by IPC driver */
784void intel_scu_devices_create(void)
785{
786 int i;
787
788 for (i = 0; i < ipc_next_dev; i++)
789 platform_device_add(ipc_devs[i]);
790
791 for (i = 0; i < spi_next_dev; i++)
792 spi_register_board_info(spi_devs[i], 1);
793
794 for (i = 0; i < i2c_next_dev; i++) {
795 struct i2c_adapter *adapter;
796 struct i2c_client *client;
797
798 adapter = i2c_get_adapter(i2c_bus[i]);
799 if (adapter) {
800 client = i2c_new_device(adapter, i2c_devs[i]);
801 if (!client)
802 pr_err("can't create i2c device %s\n",
803 i2c_devs[i]->type);
804 } else
805 i2c_register_board_info(i2c_bus[i], i2c_devs[i], 1);
806 }
807 intel_scu_notifier_post(SCU_AVAILABLE, NULL);
808}
809EXPORT_SYMBOL_GPL(intel_scu_devices_create);
810
811/* Called by IPC driver */
812void intel_scu_devices_destroy(void)
813{
814 int i;
815
816 intel_scu_notifier_post(SCU_DOWN, NULL);
817
818 for (i = 0; i < ipc_next_dev; i++)
819 platform_device_del(ipc_devs[i]);
820}
821EXPORT_SYMBOL_GPL(intel_scu_devices_destroy);
822
823static void __init install_irq_resource(struct platform_device *pdev, int irq)
824{
825 /* Single threaded */
826 static struct resource __initdata res = {
827 .name = "IRQ",
828 .flags = IORESOURCE_IRQ,
829 };
830 res.start = irq;
831 platform_device_add_resources(pdev, &res, 1);
832}
833
834static void __init sfi_handle_ipc_dev(struct sfi_device_table_entry *entry)
835{
836 const struct devs_id *dev = device_ids;
837 struct platform_device *pdev;
838 void *pdata = NULL;
839
840 while (dev->name[0]) {
841 if (dev->type == SFI_DEV_TYPE_IPC &&
842 !strncmp(dev->name, entry->name, SFI_NAME_LEN)) {
843 pdata = dev->get_platform_data(entry);
844 break;
845 }
846 dev++;
847 }
848
849 /*
850 * On Medfield the platform device creation is handled by the MSIC
851 * MFD driver so we don't need to do it here.
852 */
853 if (mrst_has_msic())
854 return;
855
856 pdev = platform_device_alloc(entry->name, 0);
857 if (pdev == NULL) {
858 pr_err("out of memory for SFI platform device '%s'.\n",
859 entry->name);
860 return;
861 }
862 install_irq_resource(pdev, entry->irq);
863
864 pdev->dev.platform_data = pdata;
865 intel_scu_device_register(pdev);
866}
867
868static void __init sfi_handle_spi_dev(struct spi_board_info *spi_info)
869{
870 const struct devs_id *dev = device_ids;
871 void *pdata = NULL;
872
873 while (dev->name[0]) {
874 if (dev->type == SFI_DEV_TYPE_SPI &&
875 !strncmp(dev->name, spi_info->modalias, SFI_NAME_LEN)) {
876 pdata = dev->get_platform_data(spi_info);
877 break;
878 }
879 dev++;
880 }
881 spi_info->platform_data = pdata;
882 if (dev->delay)
883 intel_scu_spi_device_register(spi_info);
884 else
885 spi_register_board_info(spi_info, 1);
886}
887
888static void __init sfi_handle_i2c_dev(int bus, struct i2c_board_info *i2c_info)
889{
890 const struct devs_id *dev = device_ids;
891 void *pdata = NULL;
892
893 while (dev->name[0]) {
894 if (dev->type == SFI_DEV_TYPE_I2C &&
895 !strncmp(dev->name, i2c_info->type, SFI_NAME_LEN)) {
896 pdata = dev->get_platform_data(i2c_info);
897 break;
898 }
899 dev++;
900 }
901 i2c_info->platform_data = pdata;
902
903 if (dev->delay)
904 intel_scu_i2c_device_register(bus, i2c_info);
905 else
906 i2c_register_board_info(bus, i2c_info, 1);
907 }
908
909
910static int __init sfi_parse_devs(struct sfi_table_header *table)
911{
912 struct sfi_table_simple *sb;
913 struct sfi_device_table_entry *pentry;
914 struct spi_board_info spi_info;
915 struct i2c_board_info i2c_info;
916 int num, i, bus;
917 int ioapic;
918 struct io_apic_irq_attr irq_attr;
919
920 sb = (struct sfi_table_simple *)table;
921 num = SFI_GET_NUM_ENTRIES(sb, struct sfi_device_table_entry);
922 pentry = (struct sfi_device_table_entry *)sb->pentry;
923
924 for (i = 0; i < num; i++, pentry++) {
925 int irq = pentry->irq;
926
927 if (irq != (u8)0xff) { /* native RTE case */
928 /* these SPI2 devices are not exposed to system as PCI
929 * devices, but they have separate RTE entry in IOAPIC
930 * so we have to enable them one by one here
931 */
932 ioapic = mp_find_ioapic(irq);
933 irq_attr.ioapic = ioapic;
934 irq_attr.ioapic_pin = irq;
935 irq_attr.trigger = 1;
936 irq_attr.polarity = 1;
937 io_apic_set_pci_routing(NULL, irq, &irq_attr);
938 } else
939 irq = 0; /* No irq */
940
941 switch (pentry->type) {
942 case SFI_DEV_TYPE_IPC:
943 pr_debug("info[%2d]: IPC bus, name = %16.16s, "
944 "irq = 0x%2x\n", i, pentry->name, pentry->irq);
945 sfi_handle_ipc_dev(pentry);
946 break;
947 case SFI_DEV_TYPE_SPI:
948 memset(&spi_info, 0, sizeof(spi_info));
949 strncpy(spi_info.modalias, pentry->name, SFI_NAME_LEN);
950 spi_info.irq = irq;
951 spi_info.bus_num = pentry->host_num;
952 spi_info.chip_select = pentry->addr;
953 spi_info.max_speed_hz = pentry->max_freq;
954 pr_debug("info[%2d]: SPI bus = %d, name = %16.16s, "
955 "irq = 0x%2x, max_freq = %d, cs = %d\n", i,
956 spi_info.bus_num,
957 spi_info.modalias,
958 spi_info.irq,
959 spi_info.max_speed_hz,
960 spi_info.chip_select);
961 sfi_handle_spi_dev(&spi_info);
962 break;
963 case SFI_DEV_TYPE_I2C:
964 memset(&i2c_info, 0, sizeof(i2c_info));
965 bus = pentry->host_num;
966 strncpy(i2c_info.type, pentry->name, SFI_NAME_LEN);
967 i2c_info.irq = irq;
968 i2c_info.addr = pentry->addr;
969 pr_debug("info[%2d]: I2C bus = %d, name = %16.16s, "
970 "irq = 0x%2x, addr = 0x%x\n", i, bus,
971 i2c_info.type,
972 i2c_info.irq,
973 i2c_info.addr);
974 sfi_handle_i2c_dev(bus, &i2c_info);
975 break;
976 case SFI_DEV_TYPE_UART:
977 case SFI_DEV_TYPE_HSI:
978 default:
979 ;
980 }
981 }
982 return 0;
983}
984
985static int __init mrst_platform_init(void)
986{
987 sfi_table_parse(SFI_SIG_GPIO, NULL, NULL, sfi_parse_gpio);
988 sfi_table_parse(SFI_SIG_DEVS, NULL, NULL, sfi_parse_devs);
989 return 0;
990}
991arch_initcall(mrst_platform_init);
992
993/*
994 * we will search these buttons in SFI GPIO table (by name)
995 * and register them dynamically. Please add all possible
996 * buttons here, we will shrink them if no GPIO found.
997 */
998static struct gpio_keys_button gpio_button[] = {
999 {KEY_POWER, -1, 1, "power_btn", EV_KEY, 0, 3000},
1000 {KEY_PROG1, -1, 1, "prog_btn1", EV_KEY, 0, 20},
1001 {KEY_PROG2, -1, 1, "prog_btn2", EV_KEY, 0, 20},
1002 {SW_LID, -1, 1, "lid_switch", EV_SW, 0, 20},
1003 {KEY_VOLUMEUP, -1, 1, "vol_up", EV_KEY, 0, 20},
1004 {KEY_VOLUMEDOWN, -1, 1, "vol_down", EV_KEY, 0, 20},
1005 {KEY_CAMERA, -1, 1, "camera_full", EV_KEY, 0, 20},
1006 {KEY_CAMERA_FOCUS, -1, 1, "camera_half", EV_KEY, 0, 20},
1007 {SW_KEYPAD_SLIDE, -1, 1, "MagSw1", EV_SW, 0, 20},
1008 {SW_KEYPAD_SLIDE, -1, 1, "MagSw2", EV_SW, 0, 20},
1009};
1010
1011static struct gpio_keys_platform_data mrst_gpio_keys = {
1012 .buttons = gpio_button,
1013 .rep = 1,
1014 .nbuttons = -1, /* will fill it after search */
1015};
1016
1017static struct platform_device pb_device = {
1018 .name = "gpio-keys",
1019 .id = -1,
1020 .dev = {
1021 .platform_data = &mrst_gpio_keys,
1022 },
1023};
1024
1025/*
1026 * Shrink the non-existent buttons, register the gpio button
1027 * device if there is some
1028 */
1029static int __init pb_keys_init(void)
1030{
1031 struct gpio_keys_button *gb = gpio_button;
1032 int i, num, good = 0;
1033
1034 num = sizeof(gpio_button) / sizeof(struct gpio_keys_button);
1035 for (i = 0; i < num; i++) {
1036 gb[i].gpio = get_gpio_by_name(gb[i].desc);
1037 pr_debug("info[%2d]: name = %s, gpio = %d\n", i, gb[i].desc, gb[i].gpio);
1038 if (gb[i].gpio == -1)
1039 continue;
1040
1041 if (i != good)
1042 gb[good] = gb[i];
1043 good++;
1044 }
1045
1046 if (good) {
1047 mrst_gpio_keys.nbuttons = good;
1048 return platform_device_register(&pb_device);
1049 }
1050 return 0;
1051}
1052late_initcall(pb_keys_init);
diff --git a/arch/x86/platform/olpc/olpc-xo15-sci.c b/arch/x86/platform/olpc/olpc-xo15-sci.c
index fef7d0ba7e3a..649a12befba9 100644
--- a/arch/x86/platform/olpc/olpc-xo15-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo15-sci.c
@@ -40,16 +40,9 @@ static bool lid_wake_on_close;
40 */ 40 */
41static int set_lid_wake_behavior(bool wake_on_close) 41static int set_lid_wake_behavior(bool wake_on_close)
42{ 42{
43 struct acpi_object_list arg_list;
44 union acpi_object arg;
45 acpi_status status; 43 acpi_status status;
46 44
47 arg_list.count = 1; 45 status = acpi_execute_simple_method(NULL, "\\_SB.PCI0.LID.LIDW", wake_on_close);
48 arg_list.pointer = &arg;
49 arg.type = ACPI_TYPE_INTEGER;
50 arg.integer.value = wake_on_close;
51
52 status = acpi_evaluate_object(NULL, "\\_SB.PCI0.LID.LIDW", &arg_list, NULL);
53 if (ACPI_FAILURE(status)) { 46 if (ACPI_FAILURE(status)) {
54 pr_warning(PFX "failed to set lid behavior\n"); 47 pr_warning(PFX "failed to set lid behavior\n");
55 return 1; 48 return 1;
diff --git a/arch/x86/platform/uv/Makefile b/arch/x86/platform/uv/Makefile
index 6c40995fefb8..52079bebd014 100644
--- a/arch/x86/platform/uv/Makefile
+++ b/arch/x86/platform/uv/Makefile
@@ -1 +1 @@
obj-$(CONFIG_X86_UV) += tlb_uv.o bios_uv.o uv_irq.o uv_sysfs.o uv_time.o obj-$(CONFIG_X86_UV) += tlb_uv.o bios_uv.o uv_irq.o uv_sysfs.o uv_time.o uv_nmi.o
diff --git a/arch/x86/platform/uv/uv_nmi.c b/arch/x86/platform/uv/uv_nmi.c
new file mode 100644
index 000000000000..8eeccba73130
--- /dev/null
+++ b/arch/x86/platform/uv/uv_nmi.c
@@ -0,0 +1,700 @@
1/*
2 * SGI NMI support routines
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 * Copyright (c) 2009-2013 Silicon Graphics, Inc. All Rights Reserved.
19 * Copyright (c) Mike Travis
20 */
21
22#include <linux/cpu.h>
23#include <linux/delay.h>
24#include <linux/kdb.h>
25#include <linux/kexec.h>
26#include <linux/kgdb.h>
27#include <linux/module.h>
28#include <linux/nmi.h>
29#include <linux/sched.h>
30#include <linux/slab.h>
31
32#include <asm/apic.h>
33#include <asm/current.h>
34#include <asm/kdebug.h>
35#include <asm/local64.h>
36#include <asm/nmi.h>
37#include <asm/traps.h>
38#include <asm/uv/uv.h>
39#include <asm/uv/uv_hub.h>
40#include <asm/uv/uv_mmrs.h>
41
42/*
43 * UV handler for NMI
44 *
45 * Handle system-wide NMI events generated by the global 'power nmi' command.
46 *
47 * Basic operation is to field the NMI interrupt on each cpu and wait
48 * until all cpus have arrived into the nmi handler. If some cpus do not
49 * make it into the handler, try and force them in with the IPI(NMI) signal.
50 *
51 * We also have to lessen UV Hub MMR accesses as much as possible as this
52 * disrupts the UV Hub's primary mission of directing NumaLink traffic and
53 * can cause system problems to occur.
54 *
55 * To do this we register our primary NMI notifier on the NMI_UNKNOWN
56 * chain. This reduces the number of false NMI calls when the perf
57 * tools are running which generate an enormous number of NMIs per
58 * second (~4M/s for 1024 cpu threads). Our secondary NMI handler is
59 * very short as it only checks that if it has been "pinged" with the
60 * IPI(NMI) signal as mentioned above, and does not read the UV Hub's MMR.
61 *
62 */
63
64static struct uv_hub_nmi_s **uv_hub_nmi_list;
65
66DEFINE_PER_CPU(struct uv_cpu_nmi_s, __uv_cpu_nmi);
67EXPORT_PER_CPU_SYMBOL_GPL(__uv_cpu_nmi);
68
69static unsigned long nmi_mmr;
70static unsigned long nmi_mmr_clear;
71static unsigned long nmi_mmr_pending;
72
73static atomic_t uv_in_nmi;
74static atomic_t uv_nmi_cpu = ATOMIC_INIT(-1);
75static atomic_t uv_nmi_cpus_in_nmi = ATOMIC_INIT(-1);
76static atomic_t uv_nmi_slave_continue;
77static atomic_t uv_nmi_kexec_failed;
78static cpumask_var_t uv_nmi_cpu_mask;
79
80/* Values for uv_nmi_slave_continue */
81#define SLAVE_CLEAR 0
82#define SLAVE_CONTINUE 1
83#define SLAVE_EXIT 2
84
85/*
86 * Default is all stack dumps go to the console and buffer.
87 * Lower level to send to log buffer only.
88 */
89static int uv_nmi_loglevel = 7;
90module_param_named(dump_loglevel, uv_nmi_loglevel, int, 0644);
91
92/*
93 * The following values show statistics on how perf events are affecting
94 * this system.
95 */
96static int param_get_local64(char *buffer, const struct kernel_param *kp)
97{
98 return sprintf(buffer, "%lu\n", local64_read((local64_t *)kp->arg));
99}
100
101static int param_set_local64(const char *val, const struct kernel_param *kp)
102{
103 /* clear on any write */
104 local64_set((local64_t *)kp->arg, 0);
105 return 0;
106}
107
108static struct kernel_param_ops param_ops_local64 = {
109 .get = param_get_local64,
110 .set = param_set_local64,
111};
112#define param_check_local64(name, p) __param_check(name, p, local64_t)
113
114static local64_t uv_nmi_count;
115module_param_named(nmi_count, uv_nmi_count, local64, 0644);
116
117static local64_t uv_nmi_misses;
118module_param_named(nmi_misses, uv_nmi_misses, local64, 0644);
119
120static local64_t uv_nmi_ping_count;
121module_param_named(ping_count, uv_nmi_ping_count, local64, 0644);
122
123static local64_t uv_nmi_ping_misses;
124module_param_named(ping_misses, uv_nmi_ping_misses, local64, 0644);
125
126/*
127 * Following values allow tuning for large systems under heavy loading
128 */
129static int uv_nmi_initial_delay = 100;
130module_param_named(initial_delay, uv_nmi_initial_delay, int, 0644);
131
132static int uv_nmi_slave_delay = 100;
133module_param_named(slave_delay, uv_nmi_slave_delay, int, 0644);
134
135static int uv_nmi_loop_delay = 100;
136module_param_named(loop_delay, uv_nmi_loop_delay, int, 0644);
137
138static int uv_nmi_trigger_delay = 10000;
139module_param_named(trigger_delay, uv_nmi_trigger_delay, int, 0644);
140
141static int uv_nmi_wait_count = 100;
142module_param_named(wait_count, uv_nmi_wait_count, int, 0644);
143
144static int uv_nmi_retry_count = 500;
145module_param_named(retry_count, uv_nmi_retry_count, int, 0644);
146
147/*
148 * Valid NMI Actions:
149 * "dump" - dump process stack for each cpu
150 * "ips" - dump IP info for each cpu
151 * "kdump" - do crash dump
152 * "kdb" - enter KDB/KGDB (default)
153 */
154static char uv_nmi_action[8] = "kdb";
155module_param_string(action, uv_nmi_action, sizeof(uv_nmi_action), 0644);
156
157static inline bool uv_nmi_action_is(const char *action)
158{
159 return (strncmp(uv_nmi_action, action, strlen(action)) == 0);
160}
161
162/* Setup which NMI support is present in system */
163static void uv_nmi_setup_mmrs(void)
164{
165 if (uv_read_local_mmr(UVH_NMI_MMRX_SUPPORTED)) {
166 uv_write_local_mmr(UVH_NMI_MMRX_REQ,
167 1UL << UVH_NMI_MMRX_REQ_SHIFT);
168 nmi_mmr = UVH_NMI_MMRX;
169 nmi_mmr_clear = UVH_NMI_MMRX_CLEAR;
170 nmi_mmr_pending = 1UL << UVH_NMI_MMRX_SHIFT;
171 pr_info("UV: SMI NMI support: %s\n", UVH_NMI_MMRX_TYPE);
172 } else {
173 nmi_mmr = UVH_NMI_MMR;
174 nmi_mmr_clear = UVH_NMI_MMR_CLEAR;
175 nmi_mmr_pending = 1UL << UVH_NMI_MMR_SHIFT;
176 pr_info("UV: SMI NMI support: %s\n", UVH_NMI_MMR_TYPE);
177 }
178}
179
180/* Read NMI MMR and check if NMI flag was set by BMC. */
181static inline int uv_nmi_test_mmr(struct uv_hub_nmi_s *hub_nmi)
182{
183 hub_nmi->nmi_value = uv_read_local_mmr(nmi_mmr);
184 atomic_inc(&hub_nmi->read_mmr_count);
185 return !!(hub_nmi->nmi_value & nmi_mmr_pending);
186}
187
188static inline void uv_local_mmr_clear_nmi(void)
189{
190 uv_write_local_mmr(nmi_mmr_clear, nmi_mmr_pending);
191}
192
193/*
194 * If first cpu in on this hub, set hub_nmi "in_nmi" and "owner" values and
195 * return true. If first cpu in on the system, set global "in_nmi" flag.
196 */
197static int uv_set_in_nmi(int cpu, struct uv_hub_nmi_s *hub_nmi)
198{
199 int first = atomic_add_unless(&hub_nmi->in_nmi, 1, 1);
200
201 if (first) {
202 atomic_set(&hub_nmi->cpu_owner, cpu);
203 if (atomic_add_unless(&uv_in_nmi, 1, 1))
204 atomic_set(&uv_nmi_cpu, cpu);
205
206 atomic_inc(&hub_nmi->nmi_count);
207 }
208 return first;
209}
210
211/* Check if this is a system NMI event */
212static int uv_check_nmi(struct uv_hub_nmi_s *hub_nmi)
213{
214 int cpu = smp_processor_id();
215 int nmi = 0;
216
217 local64_inc(&uv_nmi_count);
218 uv_cpu_nmi.queries++;
219
220 do {
221 nmi = atomic_read(&hub_nmi->in_nmi);
222 if (nmi)
223 break;
224
225 if (raw_spin_trylock(&hub_nmi->nmi_lock)) {
226
227 /* check hub MMR NMI flag */
228 if (uv_nmi_test_mmr(hub_nmi)) {
229 uv_set_in_nmi(cpu, hub_nmi);
230 nmi = 1;
231 break;
232 }
233
234 /* MMR NMI flag is clear */
235 raw_spin_unlock(&hub_nmi->nmi_lock);
236
237 } else {
238 /* wait a moment for the hub nmi locker to set flag */
239 cpu_relax();
240 udelay(uv_nmi_slave_delay);
241
242 /* re-check hub in_nmi flag */
243 nmi = atomic_read(&hub_nmi->in_nmi);
244 if (nmi)
245 break;
246 }
247
248 /* check if this BMC missed setting the MMR NMI flag */
249 if (!nmi) {
250 nmi = atomic_read(&uv_in_nmi);
251 if (nmi)
252 uv_set_in_nmi(cpu, hub_nmi);
253 }
254
255 } while (0);
256
257 if (!nmi)
258 local64_inc(&uv_nmi_misses);
259
260 return nmi;
261}
262
263/* Need to reset the NMI MMR register, but only once per hub. */
264static inline void uv_clear_nmi(int cpu)
265{
266 struct uv_hub_nmi_s *hub_nmi = uv_hub_nmi;
267
268 if (cpu == atomic_read(&hub_nmi->cpu_owner)) {
269 atomic_set(&hub_nmi->cpu_owner, -1);
270 atomic_set(&hub_nmi->in_nmi, 0);
271 uv_local_mmr_clear_nmi();
272 raw_spin_unlock(&hub_nmi->nmi_lock);
273 }
274}
275
276/* Print non-responding cpus */
277static void uv_nmi_nr_cpus_pr(char *fmt)
278{
279 static char cpu_list[1024];
280 int len = sizeof(cpu_list);
281 int c = cpumask_weight(uv_nmi_cpu_mask);
282 int n = cpulist_scnprintf(cpu_list, len, uv_nmi_cpu_mask);
283
284 if (n >= len-1)
285 strcpy(&cpu_list[len - 6], "...\n");
286
287 printk(fmt, c, cpu_list);
288}
289
290/* Ping non-responding cpus attemping to force them into the NMI handler */
291static void uv_nmi_nr_cpus_ping(void)
292{
293 int cpu;
294
295 for_each_cpu(cpu, uv_nmi_cpu_mask)
296 atomic_set(&uv_cpu_nmi_per(cpu).pinging, 1);
297
298 apic->send_IPI_mask(uv_nmi_cpu_mask, APIC_DM_NMI);
299}
300
301/* Clean up flags for cpus that ignored both NMI and ping */
302static void uv_nmi_cleanup_mask(void)
303{
304 int cpu;
305
306 for_each_cpu(cpu, uv_nmi_cpu_mask) {
307 atomic_set(&uv_cpu_nmi_per(cpu).pinging, 0);
308 atomic_set(&uv_cpu_nmi_per(cpu).state, UV_NMI_STATE_OUT);
309 cpumask_clear_cpu(cpu, uv_nmi_cpu_mask);
310 }
311}
312
313/* Loop waiting as cpus enter nmi handler */
314static int uv_nmi_wait_cpus(int first)
315{
316 int i, j, k, n = num_online_cpus();
317 int last_k = 0, waiting = 0;
318
319 if (first) {
320 cpumask_copy(uv_nmi_cpu_mask, cpu_online_mask);
321 k = 0;
322 } else {
323 k = n - cpumask_weight(uv_nmi_cpu_mask);
324 }
325
326 udelay(uv_nmi_initial_delay);
327 for (i = 0; i < uv_nmi_retry_count; i++) {
328 int loop_delay = uv_nmi_loop_delay;
329
330 for_each_cpu(j, uv_nmi_cpu_mask) {
331 if (atomic_read(&uv_cpu_nmi_per(j).state)) {
332 cpumask_clear_cpu(j, uv_nmi_cpu_mask);
333 if (++k >= n)
334 break;
335 }
336 }
337 if (k >= n) { /* all in? */
338 k = n;
339 break;
340 }
341 if (last_k != k) { /* abort if no new cpus coming in */
342 last_k = k;
343 waiting = 0;
344 } else if (++waiting > uv_nmi_wait_count)
345 break;
346
347 /* extend delay if waiting only for cpu 0 */
348 if (waiting && (n - k) == 1 &&
349 cpumask_test_cpu(0, uv_nmi_cpu_mask))
350 loop_delay *= 100;
351
352 udelay(loop_delay);
353 }
354 atomic_set(&uv_nmi_cpus_in_nmi, k);
355 return n - k;
356}
357
358/* Wait until all slave cpus have entered UV NMI handler */
359static void uv_nmi_wait(int master)
360{
361 /* indicate this cpu is in */
362 atomic_set(&uv_cpu_nmi.state, UV_NMI_STATE_IN);
363
364 /* if not the first cpu in (the master), then we are a slave cpu */
365 if (!master)
366 return;
367
368 do {
369 /* wait for all other cpus to gather here */
370 if (!uv_nmi_wait_cpus(1))
371 break;
372
373 /* if not all made it in, send IPI NMI to them */
374 uv_nmi_nr_cpus_pr(KERN_ALERT
375 "UV: Sending NMI IPI to %d non-responding CPUs: %s\n");
376 uv_nmi_nr_cpus_ping();
377
378 /* if all cpus are in, then done */
379 if (!uv_nmi_wait_cpus(0))
380 break;
381
382 uv_nmi_nr_cpus_pr(KERN_ALERT
383 "UV: %d CPUs not in NMI loop: %s\n");
384 } while (0);
385
386 pr_alert("UV: %d of %d CPUs in NMI\n",
387 atomic_read(&uv_nmi_cpus_in_nmi), num_online_cpus());
388}
389
390static void uv_nmi_dump_cpu_ip_hdr(void)
391{
392 printk(KERN_DEFAULT
393 "\nUV: %4s %6s %-32s %s (Note: PID 0 not listed)\n",
394 "CPU", "PID", "COMMAND", "IP");
395}
396
397static void uv_nmi_dump_cpu_ip(int cpu, struct pt_regs *regs)
398{
399 printk(KERN_DEFAULT "UV: %4d %6d %-32.32s ",
400 cpu, current->pid, current->comm);
401
402 printk_address(regs->ip);
403}
404
405/* Dump this cpu's state */
406static void uv_nmi_dump_state_cpu(int cpu, struct pt_regs *regs)
407{
408 const char *dots = " ................................. ";
409
410 if (uv_nmi_action_is("ips")) {
411 if (cpu == 0)
412 uv_nmi_dump_cpu_ip_hdr();
413
414 if (current->pid != 0)
415 uv_nmi_dump_cpu_ip(cpu, regs);
416
417 } else if (uv_nmi_action_is("dump")) {
418 printk(KERN_DEFAULT
419 "UV:%sNMI process trace for CPU %d\n", dots, cpu);
420 show_regs(regs);
421 }
422 atomic_set(&uv_cpu_nmi.state, UV_NMI_STATE_DUMP_DONE);
423}
424
425/* Trigger a slave cpu to dump it's state */
426static void uv_nmi_trigger_dump(int cpu)
427{
428 int retry = uv_nmi_trigger_delay;
429
430 if (atomic_read(&uv_cpu_nmi_per(cpu).state) != UV_NMI_STATE_IN)
431 return;
432
433 atomic_set(&uv_cpu_nmi_per(cpu).state, UV_NMI_STATE_DUMP);
434 do {
435 cpu_relax();
436 udelay(10);
437 if (atomic_read(&uv_cpu_nmi_per(cpu).state)
438 != UV_NMI_STATE_DUMP)
439 return;
440 } while (--retry > 0);
441
442 pr_crit("UV: CPU %d stuck in process dump function\n", cpu);
443 atomic_set(&uv_cpu_nmi_per(cpu).state, UV_NMI_STATE_DUMP_DONE);
444}
445
446/* Wait until all cpus ready to exit */
447static void uv_nmi_sync_exit(int master)
448{
449 atomic_dec(&uv_nmi_cpus_in_nmi);
450 if (master) {
451 while (atomic_read(&uv_nmi_cpus_in_nmi) > 0)
452 cpu_relax();
453 atomic_set(&uv_nmi_slave_continue, SLAVE_CLEAR);
454 } else {
455 while (atomic_read(&uv_nmi_slave_continue))
456 cpu_relax();
457 }
458}
459
460/* Walk through cpu list and dump state of each */
461static void uv_nmi_dump_state(int cpu, struct pt_regs *regs, int master)
462{
463 if (master) {
464 int tcpu;
465 int ignored = 0;
466 int saved_console_loglevel = console_loglevel;
467
468 pr_alert("UV: tracing %s for %d CPUs from CPU %d\n",
469 uv_nmi_action_is("ips") ? "IPs" : "processes",
470 atomic_read(&uv_nmi_cpus_in_nmi), cpu);
471
472 console_loglevel = uv_nmi_loglevel;
473 atomic_set(&uv_nmi_slave_continue, SLAVE_EXIT);
474 for_each_online_cpu(tcpu) {
475 if (cpumask_test_cpu(tcpu, uv_nmi_cpu_mask))
476 ignored++;
477 else if (tcpu == cpu)
478 uv_nmi_dump_state_cpu(tcpu, regs);
479 else
480 uv_nmi_trigger_dump(tcpu);
481 }
482 if (ignored)
483 printk(KERN_DEFAULT "UV: %d CPUs ignored NMI\n",
484 ignored);
485
486 console_loglevel = saved_console_loglevel;
487 pr_alert("UV: process trace complete\n");
488 } else {
489 while (!atomic_read(&uv_nmi_slave_continue))
490 cpu_relax();
491 while (atomic_read(&uv_cpu_nmi.state) != UV_NMI_STATE_DUMP)
492 cpu_relax();
493 uv_nmi_dump_state_cpu(cpu, regs);
494 }
495 uv_nmi_sync_exit(master);
496}
497
498static void uv_nmi_touch_watchdogs(void)
499{
500 touch_softlockup_watchdog_sync();
501 clocksource_touch_watchdog();
502 rcu_cpu_stall_reset();
503 touch_nmi_watchdog();
504}
505
506#if defined(CONFIG_KEXEC)
507static void uv_nmi_kdump(int cpu, int master, struct pt_regs *regs)
508{
509 /* Call crash to dump system state */
510 if (master) {
511 pr_emerg("UV: NMI executing crash_kexec on CPU%d\n", cpu);
512 crash_kexec(regs);
513
514 pr_emerg("UV: crash_kexec unexpectedly returned, ");
515 if (!kexec_crash_image) {
516 pr_cont("crash kernel not loaded\n");
517 atomic_set(&uv_nmi_kexec_failed, 1);
518 uv_nmi_sync_exit(1);
519 return;
520 }
521 pr_cont("kexec busy, stalling cpus while waiting\n");
522 }
523
524 /* If crash exec fails the slaves should return, otherwise stall */
525 while (atomic_read(&uv_nmi_kexec_failed) == 0)
526 mdelay(10);
527
528 /* Crash kernel most likely not loaded, return in an orderly fashion */
529 uv_nmi_sync_exit(0);
530}
531
532#else /* !CONFIG_KEXEC */
533static inline void uv_nmi_kdump(int cpu, int master, struct pt_regs *regs)
534{
535 if (master)
536 pr_err("UV: NMI kdump: KEXEC not supported in this kernel\n");
537}
538#endif /* !CONFIG_KEXEC */
539
540#ifdef CONFIG_KGDB_KDB
541/* Call KDB from NMI handler */
542static void uv_call_kdb(int cpu, struct pt_regs *regs, int master)
543{
544 int ret;
545
546 if (master) {
547 /* call KGDB NMI handler as MASTER */
548 ret = kgdb_nmicallin(cpu, X86_TRAP_NMI, regs,
549 &uv_nmi_slave_continue);
550 if (ret) {
551 pr_alert("KDB returned error, is kgdboc set?\n");
552 atomic_set(&uv_nmi_slave_continue, SLAVE_EXIT);
553 }
554 } else {
555 /* wait for KGDB signal that it's ready for slaves to enter */
556 int sig;
557
558 do {
559 cpu_relax();
560 sig = atomic_read(&uv_nmi_slave_continue);
561 } while (!sig);
562
563 /* call KGDB as slave */
564 if (sig == SLAVE_CONTINUE)
565 kgdb_nmicallback(cpu, regs);
566 }
567 uv_nmi_sync_exit(master);
568}
569
570#else /* !CONFIG_KGDB_KDB */
571static inline void uv_call_kdb(int cpu, struct pt_regs *regs, int master)
572{
573 pr_err("UV: NMI error: KGDB/KDB is not enabled in this kernel\n");
574}
575#endif /* !CONFIG_KGDB_KDB */
576
577/*
578 * UV NMI handler
579 */
580int uv_handle_nmi(unsigned int reason, struct pt_regs *regs)
581{
582 struct uv_hub_nmi_s *hub_nmi = uv_hub_nmi;
583 int cpu = smp_processor_id();
584 int master = 0;
585 unsigned long flags;
586
587 local_irq_save(flags);
588
589 /* If not a UV System NMI, ignore */
590 if (!atomic_read(&uv_cpu_nmi.pinging) && !uv_check_nmi(hub_nmi)) {
591 local_irq_restore(flags);
592 return NMI_DONE;
593 }
594
595 /* Indicate we are the first CPU into the NMI handler */
596 master = (atomic_read(&uv_nmi_cpu) == cpu);
597
598 /* If NMI action is "kdump", then attempt to do it */
599 if (uv_nmi_action_is("kdump"))
600 uv_nmi_kdump(cpu, master, regs);
601
602 /* Pause as all cpus enter the NMI handler */
603 uv_nmi_wait(master);
604
605 /* Dump state of each cpu */
606 if (uv_nmi_action_is("ips") || uv_nmi_action_is("dump"))
607 uv_nmi_dump_state(cpu, regs, master);
608
609 /* Call KDB if enabled */
610 else if (uv_nmi_action_is("kdb"))
611 uv_call_kdb(cpu, regs, master);
612
613 /* Clear per_cpu "in nmi" flag */
614 atomic_set(&uv_cpu_nmi.state, UV_NMI_STATE_OUT);
615
616 /* Clear MMR NMI flag on each hub */
617 uv_clear_nmi(cpu);
618
619 /* Clear global flags */
620 if (master) {
621 if (cpumask_weight(uv_nmi_cpu_mask))
622 uv_nmi_cleanup_mask();
623 atomic_set(&uv_nmi_cpus_in_nmi, -1);
624 atomic_set(&uv_nmi_cpu, -1);
625 atomic_set(&uv_in_nmi, 0);
626 }
627
628 uv_nmi_touch_watchdogs();
629 local_irq_restore(flags);
630
631 return NMI_HANDLED;
632}
633
634/*
635 * NMI handler for pulling in CPUs when perf events are grabbing our NMI
636 */
637int uv_handle_nmi_ping(unsigned int reason, struct pt_regs *regs)
638{
639 int ret;
640
641 uv_cpu_nmi.queries++;
642 if (!atomic_read(&uv_cpu_nmi.pinging)) {
643 local64_inc(&uv_nmi_ping_misses);
644 return NMI_DONE;
645 }
646
647 uv_cpu_nmi.pings++;
648 local64_inc(&uv_nmi_ping_count);
649 ret = uv_handle_nmi(reason, regs);
650 atomic_set(&uv_cpu_nmi.pinging, 0);
651 return ret;
652}
653
654void uv_register_nmi_notifier(void)
655{
656 if (register_nmi_handler(NMI_UNKNOWN, uv_handle_nmi, 0, "uv"))
657 pr_warn("UV: NMI handler failed to register\n");
658
659 if (register_nmi_handler(NMI_LOCAL, uv_handle_nmi_ping, 0, "uvping"))
660 pr_warn("UV: PING NMI handler failed to register\n");
661}
662
663void uv_nmi_init(void)
664{
665 unsigned int value;
666
667 /*
668 * Unmask NMI on all cpus
669 */
670 value = apic_read(APIC_LVT1) | APIC_DM_NMI;
671 value &= ~APIC_LVT_MASKED;
672 apic_write(APIC_LVT1, value);
673}
674
675void uv_nmi_setup(void)
676{
677 int size = sizeof(void *) * (1 << NODES_SHIFT);
678 int cpu, nid;
679
680 /* Setup hub nmi info */
681 uv_nmi_setup_mmrs();
682 uv_hub_nmi_list = kzalloc(size, GFP_KERNEL);
683 pr_info("UV: NMI hub list @ 0x%p (%d)\n", uv_hub_nmi_list, size);
684 BUG_ON(!uv_hub_nmi_list);
685 size = sizeof(struct uv_hub_nmi_s);
686 for_each_present_cpu(cpu) {
687 nid = cpu_to_node(cpu);
688 if (uv_hub_nmi_list[nid] == NULL) {
689 uv_hub_nmi_list[nid] = kzalloc_node(size,
690 GFP_KERNEL, nid);
691 BUG_ON(!uv_hub_nmi_list[nid]);
692 raw_spin_lock_init(&(uv_hub_nmi_list[nid]->nmi_lock));
693 atomic_set(&uv_hub_nmi_list[nid]->cpu_owner, -1);
694 }
695 uv_hub_nmi_per(cpu) = uv_hub_nmi_list[nid];
696 }
697 BUG_ON(!alloc_cpumask_var(&uv_nmi_cpu_mask, GFP_KERNEL));
698}
699
700
diff --git a/arch/x86/um/elfcore.c b/arch/x86/um/elfcore.c
index 6bb49b687c97..7bb89a27a5e4 100644
--- a/arch/x86/um/elfcore.c
+++ b/arch/x86/um/elfcore.c
@@ -11,8 +11,7 @@ Elf32_Half elf_core_extra_phdrs(void)
11 return vsyscall_ehdr ? (((struct elfhdr *)vsyscall_ehdr)->e_phnum) : 0; 11 return vsyscall_ehdr ? (((struct elfhdr *)vsyscall_ehdr)->e_phnum) : 0;
12} 12}
13 13
14int elf_core_write_extra_phdrs(struct file *file, loff_t offset, size_t *size, 14int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset)
15 unsigned long limit)
16{ 15{
17 if ( vsyscall_ehdr ) { 16 if ( vsyscall_ehdr ) {
18 const struct elfhdr *const ehdrp = 17 const struct elfhdr *const ehdrp =
@@ -32,17 +31,14 @@ int elf_core_write_extra_phdrs(struct file *file, loff_t offset, size_t *size,
32 phdr.p_offset += ofs; 31 phdr.p_offset += ofs;
33 } 32 }
34 phdr.p_paddr = 0; /* match other core phdrs */ 33 phdr.p_paddr = 0; /* match other core phdrs */
35 *size += sizeof(phdr); 34 if (!dump_emit(cprm, &phdr, sizeof(phdr)))
36 if (*size > limit
37 || !dump_write(file, &phdr, sizeof(phdr)))
38 return 0; 35 return 0;
39 } 36 }
40 } 37 }
41 return 1; 38 return 1;
42} 39}
43 40
44int elf_core_write_extra_data(struct file *file, size_t *size, 41int elf_core_write_extra_data(struct coredump_params *cprm)
45 unsigned long limit)
46{ 42{
47 if ( vsyscall_ehdr ) { 43 if ( vsyscall_ehdr ) {
48 const struct elfhdr *const ehdrp = 44 const struct elfhdr *const ehdrp =
@@ -55,10 +51,7 @@ int elf_core_write_extra_data(struct file *file, size_t *size,
55 if (phdrp[i].p_type == PT_LOAD) { 51 if (phdrp[i].p_type == PT_LOAD) {
56 void *addr = (void *) phdrp[i].p_vaddr; 52 void *addr = (void *) phdrp[i].p_vaddr;
57 size_t filesz = phdrp[i].p_filesz; 53 size_t filesz = phdrp[i].p_filesz;
58 54 if (!dump_emit(cprm, addr, filesz))
59 *size += filesz;
60 if (*size > limit
61 || !dump_write(file, addr, filesz))
62 return 0; 55 return 0;
63 } 56 }
64 } 57 }
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index 72074d528400..2ada505067cc 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -178,7 +178,7 @@ notrace static int __always_inline do_realtime(struct timespec *ts)
178 178
179 ts->tv_nsec = 0; 179 ts->tv_nsec = 0;
180 do { 180 do {
181 seq = read_seqcount_begin(&gtod->seq); 181 seq = read_seqcount_begin_no_lockdep(&gtod->seq);
182 mode = gtod->clock.vclock_mode; 182 mode = gtod->clock.vclock_mode;
183 ts->tv_sec = gtod->wall_time_sec; 183 ts->tv_sec = gtod->wall_time_sec;
184 ns = gtod->wall_time_snsec; 184 ns = gtod->wall_time_snsec;
@@ -198,7 +198,7 @@ notrace static int do_monotonic(struct timespec *ts)
198 198
199 ts->tv_nsec = 0; 199 ts->tv_nsec = 0;
200 do { 200 do {
201 seq = read_seqcount_begin(&gtod->seq); 201 seq = read_seqcount_begin_no_lockdep(&gtod->seq);
202 mode = gtod->clock.vclock_mode; 202 mode = gtod->clock.vclock_mode;
203 ts->tv_sec = gtod->monotonic_time_sec; 203 ts->tv_sec = gtod->monotonic_time_sec;
204 ns = gtod->monotonic_time_snsec; 204 ns = gtod->monotonic_time_snsec;
@@ -214,7 +214,7 @@ notrace static int do_realtime_coarse(struct timespec *ts)
214{ 214{
215 unsigned long seq; 215 unsigned long seq;
216 do { 216 do {
217 seq = read_seqcount_begin(&gtod->seq); 217 seq = read_seqcount_begin_no_lockdep(&gtod->seq);
218 ts->tv_sec = gtod->wall_time_coarse.tv_sec; 218 ts->tv_sec = gtod->wall_time_coarse.tv_sec;
219 ts->tv_nsec = gtod->wall_time_coarse.tv_nsec; 219 ts->tv_nsec = gtod->wall_time_coarse.tv_nsec;
220 } while (unlikely(read_seqcount_retry(&gtod->seq, seq))); 220 } while (unlikely(read_seqcount_retry(&gtod->seq, seq)));
@@ -225,7 +225,7 @@ notrace static int do_monotonic_coarse(struct timespec *ts)
225{ 225{
226 unsigned long seq; 226 unsigned long seq;
227 do { 227 do {
228 seq = read_seqcount_begin(&gtod->seq); 228 seq = read_seqcount_begin_no_lockdep(&gtod->seq);
229 ts->tv_sec = gtod->monotonic_time_coarse.tv_sec; 229 ts->tv_sec = gtod->monotonic_time_coarse.tv_sec;
230 ts->tv_nsec = gtod->monotonic_time_coarse.tv_nsec; 230 ts->tv_nsec = gtod->monotonic_time_coarse.tv_nsec;
231 } while (unlikely(read_seqcount_retry(&gtod->seq, seq))); 231 } while (unlikely(read_seqcount_retry(&gtod->seq, seq)));
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index fdc3ba28ca38..ce563be09cc1 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -468,8 +468,8 @@ PV_CALLEE_SAVE_REGS_THUNK(xen_pgd_val);
468 * 3 PCD PWT UC UC UC 468 * 3 PCD PWT UC UC UC
469 * 4 PAT WB WC WB 469 * 4 PAT WB WC WB
470 * 5 PAT PWT WC WP WT 470 * 5 PAT PWT WC WP WT
471 * 6 PAT PCD UC- UC UC- 471 * 6 PAT PCD UC- rsv UC-
472 * 7 PAT PCD PWT UC UC UC 472 * 7 PAT PCD PWT UC rsv UC
473 */ 473 */
474 474
475void xen_set_pat(u64 pat) 475void xen_set_pat(u64 pat)
@@ -796,8 +796,8 @@ static spinlock_t *xen_pte_lock(struct page *page, struct mm_struct *mm)
796{ 796{
797 spinlock_t *ptl = NULL; 797 spinlock_t *ptl = NULL;
798 798
799#if USE_SPLIT_PTLOCKS 799#if USE_SPLIT_PTE_PTLOCKS
800 ptl = __pte_lockptr(page); 800 ptl = ptlock_ptr(page);
801 spin_lock_nest_lock(ptl, &mm->page_table_lock); 801 spin_lock_nest_lock(ptl, &mm->page_table_lock);
802#endif 802#endif
803 803
@@ -1637,7 +1637,7 @@ static inline void xen_alloc_ptpage(struct mm_struct *mm, unsigned long pfn,
1637 1637
1638 __set_pfn_prot(pfn, PAGE_KERNEL_RO); 1638 __set_pfn_prot(pfn, PAGE_KERNEL_RO);
1639 1639
1640 if (level == PT_PTE && USE_SPLIT_PTLOCKS) 1640 if (level == PT_PTE && USE_SPLIT_PTE_PTLOCKS)
1641 __pin_pagetable_pfn(MMUEXT_PIN_L1_TABLE, pfn); 1641 __pin_pagetable_pfn(MMUEXT_PIN_L1_TABLE, pfn);
1642 1642
1643 xen_mc_issue(PARAVIRT_LAZY_MMU); 1643 xen_mc_issue(PARAVIRT_LAZY_MMU);
@@ -1671,7 +1671,7 @@ static inline void xen_release_ptpage(unsigned long pfn, unsigned level)
1671 if (!PageHighMem(page)) { 1671 if (!PageHighMem(page)) {
1672 xen_mc_batch(); 1672 xen_mc_batch();
1673 1673
1674 if (level == PT_PTE && USE_SPLIT_PTLOCKS) 1674 if (level == PT_PTE && USE_SPLIT_PTE_PTLOCKS)
1675 __pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, pfn); 1675 __pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, pfn);
1676 1676
1677 __set_pfn_prot(pfn, PAGE_KERNEL); 1677 __set_pfn_prot(pfn, PAGE_KERNEL);
@@ -2328,12 +2328,14 @@ static int xen_exchange_memory(unsigned long extents_in, unsigned int order_in,
2328 return success; 2328 return success;
2329} 2329}
2330 2330
2331int xen_create_contiguous_region(unsigned long vstart, unsigned int order, 2331int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
2332 unsigned int address_bits) 2332 unsigned int address_bits,
2333 dma_addr_t *dma_handle)
2333{ 2334{
2334 unsigned long *in_frames = discontig_frames, out_frame; 2335 unsigned long *in_frames = discontig_frames, out_frame;
2335 unsigned long flags; 2336 unsigned long flags;
2336 int success; 2337 int success;
2338 unsigned long vstart = (unsigned long)phys_to_virt(pstart);
2337 2339
2338 /* 2340 /*
2339 * Currently an auto-translated guest will not perform I/O, nor will 2341 * Currently an auto-translated guest will not perform I/O, nor will
@@ -2368,15 +2370,17 @@ int xen_create_contiguous_region(unsigned long vstart, unsigned int order,
2368 2370
2369 spin_unlock_irqrestore(&xen_reservation_lock, flags); 2371 spin_unlock_irqrestore(&xen_reservation_lock, flags);
2370 2372
2373 *dma_handle = virt_to_machine(vstart).maddr;
2371 return success ? 0 : -ENOMEM; 2374 return success ? 0 : -ENOMEM;
2372} 2375}
2373EXPORT_SYMBOL_GPL(xen_create_contiguous_region); 2376EXPORT_SYMBOL_GPL(xen_create_contiguous_region);
2374 2377
2375void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order) 2378void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order)
2376{ 2379{
2377 unsigned long *out_frames = discontig_frames, in_frame; 2380 unsigned long *out_frames = discontig_frames, in_frame;
2378 unsigned long flags; 2381 unsigned long flags;
2379 int success; 2382 int success;
2383 unsigned long vstart;
2380 2384
2381 if (xen_feature(XENFEAT_auto_translated_physmap)) 2385 if (xen_feature(XENFEAT_auto_translated_physmap))
2382 return; 2386 return;
@@ -2384,6 +2388,7 @@ void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order)
2384 if (unlikely(order > MAX_CONTIG_ORDER)) 2388 if (unlikely(order > MAX_CONTIG_ORDER))
2385 return; 2389 return;
2386 2390
2391 vstart = (unsigned long)phys_to_virt(pstart);
2387 memset((void *) vstart, 0, PAGE_SIZE << order); 2392 memset((void *) vstart, 0, PAGE_SIZE << order);
2388 2393
2389 spin_lock_irqsave(&xen_reservation_lock, flags); 2394 spin_lock_irqsave(&xen_reservation_lock, flags);
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 8b901e8d782d..2ae8699e8767 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -799,10 +799,10 @@ bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn)
799{ 799{
800 unsigned topidx, mididx, idx; 800 unsigned topidx, mididx, idx;
801 801
802 if (unlikely(xen_feature(XENFEAT_auto_translated_physmap))) { 802 /* don't track P2M changes in autotranslate guests */
803 BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY); 803 if (unlikely(xen_feature(XENFEAT_auto_translated_physmap)))
804 return true; 804 return true;
805 } 805
806 if (unlikely(pfn >= MAX_P2M_PFN)) { 806 if (unlikely(pfn >= MAX_P2M_PFN)) {
807 BUG_ON(mfn != INVALID_P2M_ENTRY); 807 BUG_ON(mfn != INVALID_P2M_ENTRY);
808 return true; 808 return true;
@@ -879,7 +879,6 @@ int m2p_add_override(unsigned long mfn, struct page *page,
879 unsigned long uninitialized_var(address); 879 unsigned long uninitialized_var(address);
880 unsigned level; 880 unsigned level;
881 pte_t *ptep = NULL; 881 pte_t *ptep = NULL;
882 int ret = 0;
883 882
884 pfn = page_to_pfn(page); 883 pfn = page_to_pfn(page);
885 if (!PageHighMem(page)) { 884 if (!PageHighMem(page)) {
@@ -926,8 +925,8 @@ int m2p_add_override(unsigned long mfn, struct page *page,
926 * frontend pages while they are being shared with the backend, 925 * frontend pages while they are being shared with the backend,
927 * because mfn_to_pfn (that ends up being called by GUPF) will 926 * because mfn_to_pfn (that ends up being called by GUPF) will
928 * return the backend pfn rather than the frontend pfn. */ 927 * return the backend pfn rather than the frontend pfn. */
929 ret = __get_user(pfn, &machine_to_phys_mapping[mfn]); 928 pfn = mfn_to_pfn_no_overrides(mfn);
930 if (ret == 0 && get_phys_to_machine(pfn) == mfn) 929 if (get_phys_to_machine(pfn) == mfn)
931 set_phys_to_machine(pfn, FOREIGN_FRAME(mfn)); 930 set_phys_to_machine(pfn, FOREIGN_FRAME(mfn));
932 931
933 return 0; 932 return 0;
@@ -942,7 +941,6 @@ int m2p_remove_override(struct page *page,
942 unsigned long uninitialized_var(address); 941 unsigned long uninitialized_var(address);
943 unsigned level; 942 unsigned level;
944 pte_t *ptep = NULL; 943 pte_t *ptep = NULL;
945 int ret = 0;
946 944
947 pfn = page_to_pfn(page); 945 pfn = page_to_pfn(page);
948 mfn = get_phys_to_machine(pfn); 946 mfn = get_phys_to_machine(pfn);
@@ -1029,8 +1027,8 @@ int m2p_remove_override(struct page *page,
1029 * the original pfn causes mfn_to_pfn(mfn) to return the frontend 1027 * the original pfn causes mfn_to_pfn(mfn) to return the frontend
1030 * pfn again. */ 1028 * pfn again. */
1031 mfn &= ~FOREIGN_FRAME_BIT; 1029 mfn &= ~FOREIGN_FRAME_BIT;
1032 ret = __get_user(pfn, &machine_to_phys_mapping[mfn]); 1030 pfn = mfn_to_pfn_no_overrides(mfn);
1033 if (ret == 0 && get_phys_to_machine(pfn) == FOREIGN_FRAME(mfn) && 1031 if (get_phys_to_machine(pfn) == FOREIGN_FRAME(mfn) &&
1034 m2p_find_override(mfn) == NULL) 1032 m2p_find_override(mfn) == NULL)
1035 set_phys_to_machine(pfn, mfn); 1033 set_phys_to_machine(pfn, mfn);
1036 1034
diff --git a/arch/x86/xen/pci-swiotlb-xen.c b/arch/x86/xen/pci-swiotlb-xen.c
index 969570491c39..0e98e5d241d0 100644
--- a/arch/x86/xen/pci-swiotlb-xen.c
+++ b/arch/x86/xen/pci-swiotlb-xen.c
@@ -75,8 +75,10 @@ void __init pci_xen_swiotlb_init(void)
75 xen_swiotlb_init(1, true /* early */); 75 xen_swiotlb_init(1, true /* early */);
76 dma_ops = &xen_swiotlb_dma_ops; 76 dma_ops = &xen_swiotlb_dma_ops;
77 77
78#ifdef CONFIG_PCI
78 /* Make sure ACS will be enabled */ 79 /* Make sure ACS will be enabled */
79 pci_request_acs(); 80 pci_request_acs();
81#endif
80 } 82 }
81} 83}
82 84
@@ -92,8 +94,10 @@ int pci_xen_swiotlb_init_late(void)
92 return rc; 94 return rc;
93 95
94 dma_ops = &xen_swiotlb_dma_ops; 96 dma_ops = &xen_swiotlb_dma_ops;
97#ifdef CONFIG_PCI
95 /* Make sure ACS will be enabled */ 98 /* Make sure ACS will be enabled */
96 pci_request_acs(); 99 pci_request_acs();
100#endif
97 101
98 return 0; 102 return 0;
99} 103}
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 09f3059cb00b..68c054f59de6 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -556,7 +556,7 @@ void xen_enable_syscall(void)
556 } 556 }
557#endif /* CONFIG_X86_64 */ 557#endif /* CONFIG_X86_64 */
558} 558}
559void __cpuinit xen_enable_nmi(void) 559void xen_enable_nmi(void)
560{ 560{
561#ifdef CONFIG_X86_64 561#ifdef CONFIG_X86_64
562 if (register_callback(CALLBACKTYPE_nmi, nmi)) 562 if (register_callback(CALLBACKTYPE_nmi, nmi))
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index d1e4777b4e75..c36b325abd83 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -149,7 +149,7 @@ static int xen_smp_intr_init(unsigned int cpu)
149 rc = bind_ipi_to_irqhandler(XEN_RESCHEDULE_VECTOR, 149 rc = bind_ipi_to_irqhandler(XEN_RESCHEDULE_VECTOR,
150 cpu, 150 cpu,
151 xen_reschedule_interrupt, 151 xen_reschedule_interrupt,
152 IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING, 152 IRQF_PERCPU|IRQF_NOBALANCING,
153 resched_name, 153 resched_name,
154 NULL); 154 NULL);
155 if (rc < 0) 155 if (rc < 0)
@@ -161,7 +161,7 @@ static int xen_smp_intr_init(unsigned int cpu)
161 rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_VECTOR, 161 rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_VECTOR,
162 cpu, 162 cpu,
163 xen_call_function_interrupt, 163 xen_call_function_interrupt,
164 IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING, 164 IRQF_PERCPU|IRQF_NOBALANCING,
165 callfunc_name, 165 callfunc_name,
166 NULL); 166 NULL);
167 if (rc < 0) 167 if (rc < 0)
@@ -171,7 +171,7 @@ static int xen_smp_intr_init(unsigned int cpu)
171 171
172 debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu); 172 debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu);
173 rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt, 173 rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt,
174 IRQF_DISABLED | IRQF_PERCPU | IRQF_NOBALANCING, 174 IRQF_PERCPU | IRQF_NOBALANCING,
175 debug_name, NULL); 175 debug_name, NULL);
176 if (rc < 0) 176 if (rc < 0)
177 goto fail; 177 goto fail;
@@ -182,7 +182,7 @@ static int xen_smp_intr_init(unsigned int cpu)
182 rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR, 182 rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR,
183 cpu, 183 cpu,
184 xen_call_function_single_interrupt, 184 xen_call_function_single_interrupt,
185 IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING, 185 IRQF_PERCPU|IRQF_NOBALANCING,
186 callfunc_name, 186 callfunc_name,
187 NULL); 187 NULL);
188 if (rc < 0) 188 if (rc < 0)
@@ -201,7 +201,7 @@ static int xen_smp_intr_init(unsigned int cpu)
201 rc = bind_ipi_to_irqhandler(XEN_IRQ_WORK_VECTOR, 201 rc = bind_ipi_to_irqhandler(XEN_IRQ_WORK_VECTOR,
202 cpu, 202 cpu,
203 xen_irq_work_interrupt, 203 xen_irq_work_interrupt,
204 IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING, 204 IRQF_PERCPU|IRQF_NOBALANCING,
205 callfunc_name, 205 callfunc_name,
206 NULL); 206 NULL);
207 if (rc < 0) 207 if (rc < 0)
@@ -278,6 +278,15 @@ static void __init xen_smp_prepare_boot_cpu(void)
278 old memory can be recycled */ 278 old memory can be recycled */
279 make_lowmem_page_readwrite(xen_initial_gdt); 279 make_lowmem_page_readwrite(xen_initial_gdt);
280 280
281#ifdef CONFIG_X86_32
282 /*
283 * Xen starts us with XEN_FLAT_RING1_DS, but linux code
284 * expects __USER_DS
285 */
286 loadsegment(ds, __USER_DS);
287 loadsegment(es, __USER_DS);
288#endif
289
281 xen_filter_cpu_maps(); 290 xen_filter_cpu_maps();
282 xen_setup_vcpu_info_placement(); 291 xen_setup_vcpu_info_placement();
283 } 292 }
diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index 253f63fceea1..0e36cde12f7e 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -234,7 +234,7 @@ void xen_init_lock_cpu(int cpu)
234 irq = bind_ipi_to_irqhandler(XEN_SPIN_UNLOCK_VECTOR, 234 irq = bind_ipi_to_irqhandler(XEN_SPIN_UNLOCK_VECTOR,
235 cpu, 235 cpu,
236 dummy_handler, 236 dummy_handler,
237 IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING, 237 IRQF_PERCPU|IRQF_NOBALANCING,
238 name, 238 name,
239 NULL); 239 NULL);
240 240
@@ -259,6 +259,14 @@ void xen_uninit_lock_cpu(int cpu)
259} 259}
260 260
261 261
262/*
263 * Our init of PV spinlocks is split in two init functions due to us
264 * using paravirt patching and jump labels patching and having to do
265 * all of this before SMP code is invoked.
266 *
267 * The paravirt patching needs to be done _before_ the alternative asm code
268 * is started, otherwise we would not patch the core kernel code.
269 */
262void __init xen_init_spinlocks(void) 270void __init xen_init_spinlocks(void)
263{ 271{
264 272
@@ -267,12 +275,26 @@ void __init xen_init_spinlocks(void)
267 return; 275 return;
268 } 276 }
269 277
270 static_key_slow_inc(&paravirt_ticketlocks_enabled);
271
272 pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(xen_lock_spinning); 278 pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(xen_lock_spinning);
273 pv_lock_ops.unlock_kick = xen_unlock_kick; 279 pv_lock_ops.unlock_kick = xen_unlock_kick;
274} 280}
275 281
282/*
283 * While the jump_label init code needs to happend _after_ the jump labels are
284 * enabled and before SMP is started. Hence we use pre-SMP initcall level
285 * init. We cannot do it in xen_init_spinlocks as that is done before
286 * jump labels are activated.
287 */
288static __init int xen_init_spinlocks_jump(void)
289{
290 if (!xen_pvspin)
291 return 0;
292
293 static_key_slow_inc(&paravirt_ticketlocks_enabled);
294 return 0;
295}
296early_initcall(xen_init_spinlocks_jump);
297
276static __init int xen_parse_nopvspin(char *arg) 298static __init int xen_parse_nopvspin(char *arg)
277{ 299{
278 xen_pvspin = false; 300 xen_pvspin = false;
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index ee365895b06b..12a1ca707b94 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -443,8 +443,7 @@ void xen_setup_timer(int cpu)
443 name = "<timer kasprintf failed>"; 443 name = "<timer kasprintf failed>";
444 444
445 irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt, 445 irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt,
446 IRQF_DISABLED|IRQF_PERCPU| 446 IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER|
447 IRQF_NOBALANCING|IRQF_TIMER|
448 IRQF_FORCE_RESUME, 447 IRQF_FORCE_RESUME,
449 name, NULL); 448 name, NULL);
450 449
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 1b982641ec35..228d6aee3a16 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -28,3 +28,4 @@ generic-y += termios.h
28generic-y += topology.h 28generic-y += topology.h
29generic-y += trace_clock.h 29generic-y += trace_clock.h
30generic-y += xor.h 30generic-y += xor.h
31generic-y += preempt.h
diff --git a/arch/xtensa/include/asm/pgalloc.h b/arch/xtensa/include/asm/pgalloc.h
index cf914c8c249a..d38eb9237e64 100644
--- a/arch/xtensa/include/asm/pgalloc.h
+++ b/arch/xtensa/include/asm/pgalloc.h
@@ -38,35 +38,46 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
38 free_page((unsigned long)pgd); 38 free_page((unsigned long)pgd);
39} 39}
40 40
41/* Use a slab cache for the pte pages (see also sparc64 implementation) */
42
43extern struct kmem_cache *pgtable_cache;
44
45static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 41static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
46 unsigned long address) 42 unsigned long address)
47{ 43{
48 return kmem_cache_alloc(pgtable_cache, GFP_KERNEL|__GFP_REPEAT); 44 pte_t *ptep;
45 int i;
46
47 ptep = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
48 if (!ptep)
49 return NULL;
50 for (i = 0; i < 1024; i++)
51 pte_clear(NULL, 0, ptep + i);
52 return ptep;
49} 53}
50 54
51static inline pgtable_t pte_alloc_one(struct mm_struct *mm, 55static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
52 unsigned long addr) 56 unsigned long addr)
53{ 57{
58 pte_t *pte;
54 struct page *page; 59 struct page *page;
55 60
56 page = virt_to_page(pte_alloc_one_kernel(mm, addr)); 61 pte = pte_alloc_one_kernel(mm, addr);
57 pgtable_page_ctor(page); 62 if (!pte)
63 return NULL;
64 page = virt_to_page(pte);
65 if (!pgtable_page_ctor(page)) {
66 __free_page(page);
67 return NULL;
68 }
58 return page; 69 return page;
59} 70}
60 71
61static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) 72static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
62{ 73{
63 kmem_cache_free(pgtable_cache, pte); 74 free_page((unsigned long)pte);
64} 75}
65 76
66static inline void pte_free(struct mm_struct *mm, pgtable_t pte) 77static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
67{ 78{
68 pgtable_page_dtor(pte); 79 pgtable_page_dtor(pte);
69 kmem_cache_free(pgtable_cache, page_address(pte)); 80 __free_page(pte);
70} 81}
71#define pmd_pgtable(pmd) pmd_page(pmd) 82#define pmd_pgtable(pmd) pmd_page(pmd)
72 83
diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h
index 0fdf5d043f82..216446295ada 100644
--- a/arch/xtensa/include/asm/pgtable.h
+++ b/arch/xtensa/include/asm/pgtable.h
@@ -220,12 +220,11 @@ extern unsigned long empty_zero_page[1024];
220#ifdef CONFIG_MMU 220#ifdef CONFIG_MMU
221extern pgd_t swapper_pg_dir[PAGE_SIZE/sizeof(pgd_t)]; 221extern pgd_t swapper_pg_dir[PAGE_SIZE/sizeof(pgd_t)];
222extern void paging_init(void); 222extern void paging_init(void);
223extern void pgtable_cache_init(void);
224#else 223#else
225# define swapper_pg_dir NULL 224# define swapper_pg_dir NULL
226static inline void paging_init(void) { } 225static inline void paging_init(void) { }
227static inline void pgtable_cache_init(void) { }
228#endif 226#endif
227static inline void pgtable_cache_init(void) { }
229 228
230/* 229/*
231 * The pmd contains the kernel virtual address of the pte page. 230 * The pmd contains the kernel virtual address of the pte page.
diff --git a/arch/xtensa/include/asm/prom.h b/arch/xtensa/include/asm/prom.h
deleted file mode 100644
index f3d7cd2c0de7..000000000000
--- a/arch/xtensa/include/asm/prom.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _XTENSA_ASM_PROM_H
2#define _XTENSA_ASM_PROM_H
3
4#define HAVE_ARCH_DEVTREE_FIXUPS
5
6#endif /* _XTENSA_ASM_PROM_H */
diff --git a/arch/xtensa/include/uapi/asm/socket.h b/arch/xtensa/include/uapi/asm/socket.h
index c114483010c1..7db5c22faa68 100644
--- a/arch/xtensa/include/uapi/asm/socket.h
+++ b/arch/xtensa/include/uapi/asm/socket.h
@@ -87,4 +87,6 @@
87 87
88#define SO_BUSY_POLL 46 88#define SO_BUSY_POLL 46
89 89
90#define SO_MAX_PACING_RATE 47
91
90#endif /* _XTENSA_SOCKET_H */ 92#endif /* _XTENSA_SOCKET_H */
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index de1dfa18d0a1..21dbe6bdb8ed 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -1122,7 +1122,7 @@ ENDPROC(fast_syscall_spill_registers)
1122 * a3: exctable, original value in excsave1 1122 * a3: exctable, original value in excsave1
1123 */ 1123 */
1124 1124
1125fast_syscall_spill_registers_fixup: 1125ENTRY(fast_syscall_spill_registers_fixup)
1126 1126
1127 rsr a2, windowbase # get current windowbase (a2 is saved) 1127 rsr a2, windowbase # get current windowbase (a2 is saved)
1128 xsr a0, depc # restore depc and a0 1128 xsr a0, depc # restore depc and a0
@@ -1134,22 +1134,26 @@ fast_syscall_spill_registers_fixup:
1134 */ 1134 */
1135 1135
1136 xsr a3, excsave1 # get spill-mask 1136 xsr a3, excsave1 # get spill-mask
1137 slli a2, a3, 1 # shift left by one 1137 slli a3, a3, 1 # shift left by one
1138 1138
1139 slli a3, a2, 32-WSBITS 1139 slli a2, a3, 32-WSBITS
1140 src a2, a2, a3 # a1 = xxwww1yyxxxwww1yy...... 1140 src a2, a3, a2 # a2 = xxwww1yyxxxwww1yy......
1141 wsr a2, windowstart # set corrected windowstart 1141 wsr a2, windowstart # set corrected windowstart
1142 1142
1143 rsr a3, excsave1 1143 srli a3, a3, 1
1144 l32i a2, a3, EXC_TABLE_DOUBLE_SAVE # restore a2 1144 rsr a2, excsave1
1145 l32i a3, a3, EXC_TABLE_PARAM # original WB (in user task) 1145 l32i a2, a2, EXC_TABLE_DOUBLE_SAVE # restore a2
1146 xsr a2, excsave1
1147 s32i a3, a2, EXC_TABLE_DOUBLE_SAVE # save a3
1148 l32i a3, a2, EXC_TABLE_PARAM # original WB (in user task)
1149 xsr a2, excsave1
1146 1150
1147 /* Return to the original (user task) WINDOWBASE. 1151 /* Return to the original (user task) WINDOWBASE.
1148 * We leave the following frame behind: 1152 * We leave the following frame behind:
1149 * a0, a1, a2 same 1153 * a0, a1, a2 same
1150 * a3: trashed (saved in excsave_1) 1154 * a3: trashed (saved in EXC_TABLE_DOUBLE_SAVE)
1151 * depc: depc (we have to return to that address) 1155 * depc: depc (we have to return to that address)
1152 * excsave_1: a3 1156 * excsave_1: exctable
1153 */ 1157 */
1154 1158
1155 wsr a3, windowbase 1159 wsr a3, windowbase
@@ -1159,9 +1163,9 @@ fast_syscall_spill_registers_fixup:
1159 * a0: return address 1163 * a0: return address
1160 * a1: used, stack pointer 1164 * a1: used, stack pointer
1161 * a2: kernel stack pointer 1165 * a2: kernel stack pointer
1162 * a3: available, saved in EXCSAVE_1 1166 * a3: available
1163 * depc: exception address 1167 * depc: exception address
1164 * excsave: a3 1168 * excsave: exctable
1165 * Note: This frame might be the same as above. 1169 * Note: This frame might be the same as above.
1166 */ 1170 */
1167 1171
@@ -1181,9 +1185,12 @@ fast_syscall_spill_registers_fixup:
1181 rsr a0, exccause 1185 rsr a0, exccause
1182 addx4 a0, a0, a3 # find entry in table 1186 addx4 a0, a0, a3 # find entry in table
1183 l32i a0, a0, EXC_TABLE_FAST_USER # load handler 1187 l32i a0, a0, EXC_TABLE_FAST_USER # load handler
1188 l32i a3, a3, EXC_TABLE_DOUBLE_SAVE
1184 jx a0 1189 jx a0
1185 1190
1186fast_syscall_spill_registers_fixup_return: 1191ENDPROC(fast_syscall_spill_registers_fixup)
1192
1193ENTRY(fast_syscall_spill_registers_fixup_return)
1187 1194
1188 /* When we return here, all registers have been restored (a2: DEPC) */ 1195 /* When we return here, all registers have been restored (a2: DEPC) */
1189 1196
@@ -1191,13 +1198,13 @@ fast_syscall_spill_registers_fixup_return:
1191 1198
1192 /* Restore fixup handler. */ 1199 /* Restore fixup handler. */
1193 1200
1194 xsr a3, excsave1 1201 rsr a2, excsave1
1195 movi a2, fast_syscall_spill_registers_fixup 1202 s32i a3, a2, EXC_TABLE_DOUBLE_SAVE
1196 s32i a2, a3, EXC_TABLE_FIXUP 1203 movi a3, fast_syscall_spill_registers_fixup
1197 s32i a0, a3, EXC_TABLE_DOUBLE_SAVE 1204 s32i a3, a2, EXC_TABLE_FIXUP
1198 rsr a2, windowbase 1205 rsr a3, windowbase
1199 s32i a2, a3, EXC_TABLE_PARAM 1206 s32i a3, a2, EXC_TABLE_PARAM
1200 l32i a2, a3, EXC_TABLE_KSTK 1207 l32i a2, a2, EXC_TABLE_KSTK
1201 1208
1202 /* Load WB at the time the exception occurred. */ 1209 /* Load WB at the time the exception occurred. */
1203 1210
@@ -1206,8 +1213,12 @@ fast_syscall_spill_registers_fixup_return:
1206 wsr a3, windowbase 1213 wsr a3, windowbase
1207 rsync 1214 rsync
1208 1215
1216 rsr a3, excsave1
1217 l32i a3, a3, EXC_TABLE_DOUBLE_SAVE
1218
1209 rfde 1219 rfde
1210 1220
1221ENDPROC(fast_syscall_spill_registers_fixup_return)
1211 1222
1212/* 1223/*
1213 * spill all registers. 1224 * spill all registers.
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 946fb8d06c8b..6e2b6638122d 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -21,11 +21,8 @@
21#include <linux/screen_info.h> 21#include <linux/screen_info.h>
22#include <linux/bootmem.h> 22#include <linux/bootmem.h>
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24
25#ifdef CONFIG_OF
26#include <linux/of_fdt.h> 24#include <linux/of_fdt.h>
27#include <linux/of_platform.h> 25#include <linux/of_platform.h>
28#endif
29 26
30#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) 27#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
31# include <linux/console.h> 28# include <linux/console.h>
@@ -64,8 +61,8 @@ extern struct rtc_ops no_rtc_ops;
64struct rtc_ops *rtc_ops; 61struct rtc_ops *rtc_ops;
65 62
66#ifdef CONFIG_BLK_DEV_INITRD 63#ifdef CONFIG_BLK_DEV_INITRD
67extern void *initrd_start; 64extern unsigned long initrd_start;
68extern void *initrd_end; 65extern unsigned long initrd_end;
69int initrd_is_mapped = 0; 66int initrd_is_mapped = 0;
70extern int initrd_below_start_ok; 67extern int initrd_below_start_ok;
71#endif 68#endif
@@ -152,8 +149,8 @@ static int __init parse_tag_initrd(const bp_tag_t* tag)
152{ 149{
153 meminfo_t* mi; 150 meminfo_t* mi;
154 mi = (meminfo_t*)(tag->data); 151 mi = (meminfo_t*)(tag->data);
155 initrd_start = __va(mi->start); 152 initrd_start = (unsigned long)__va(mi->start);
156 initrd_end = __va(mi->end); 153 initrd_end = (unsigned long)__va(mi->end);
157 154
158 return 0; 155 return 0;
159} 156}
@@ -170,13 +167,6 @@ static int __init parse_tag_fdt(const bp_tag_t *tag)
170 167
171__tagtable(BP_TAG_FDT, parse_tag_fdt); 168__tagtable(BP_TAG_FDT, parse_tag_fdt);
172 169
173void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
174{
175 initrd_start = (void *)__va(start);
176 initrd_end = (void *)__va(end);
177 initrd_below_start_ok = 1;
178}
179
180#endif /* CONFIG_OF */ 170#endif /* CONFIG_OF */
181 171
182#endif /* CONFIG_BLK_DEV_INITRD */ 172#endif /* CONFIG_BLK_DEV_INITRD */
@@ -222,9 +212,13 @@ static int __init parse_bootparam(const bp_tag_t* tag)
222} 212}
223 213
224#ifdef CONFIG_OF 214#ifdef CONFIG_OF
215bool __initdata dt_memory_scan = false;
225 216
226void __init early_init_dt_add_memory_arch(u64 base, u64 size) 217void __init early_init_dt_add_memory_arch(u64 base, u64 size)
227{ 218{
219 if (!dt_memory_scan)
220 return;
221
228 size &= PAGE_MASK; 222 size &= PAGE_MASK;
229 add_sysmem_bank(MEMORY_TYPE_CONVENTIONAL, base, base + size); 223 add_sysmem_bank(MEMORY_TYPE_CONVENTIONAL, base, base + size);
230} 224}
@@ -236,31 +230,13 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
236 230
237void __init early_init_devtree(void *params) 231void __init early_init_devtree(void *params)
238{ 232{
239 /* Setup flat device-tree pointer */
240 initial_boot_params = params;
241
242 /* Retrieve various informations from the /chosen node of the
243 * device-tree, including the platform type, initrd location and
244 * size, TCE reserve, and more ...
245 */
246 if (!command_line[0])
247 of_scan_flat_dt(early_init_dt_scan_chosen, command_line);
248
249 /* Scan memory nodes and rebuild MEMBLOCKs */
250 of_scan_flat_dt(early_init_dt_scan_root, NULL);
251 if (sysmem.nr_banks == 0) 233 if (sysmem.nr_banks == 0)
252 of_scan_flat_dt(early_init_dt_scan_memory, NULL); 234 dt_memory_scan = true;
253}
254 235
255static void __init copy_devtree(void) 236 early_init_dt_scan(params);
256{ 237
257 void *alloc = early_init_dt_alloc_memory_arch( 238 if (!command_line[0])
258 be32_to_cpu(initial_boot_params->totalsize), 8); 239 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
259 if (alloc) {
260 memcpy(alloc, initial_boot_params,
261 be32_to_cpu(initial_boot_params->totalsize));
262 initial_boot_params = alloc;
263 }
264} 240}
265 241
266static int __init xtensa_device_probe(void) 242static int __init xtensa_device_probe(void)
@@ -525,10 +501,7 @@ void __init setup_arch(char **cmdline_p)
525 501
526 bootmem_init(); 502 bootmem_init();
527 503
528#ifdef CONFIG_OF 504 unflatten_and_copy_device_tree();
529 copy_devtree();
530 unflatten_device_tree();
531#endif
532 505
533 platform_setup(cmdline_p); 506 platform_setup(cmdline_p);
534 507
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c
index 718eca1850bd..98b67d5f1514 100644
--- a/arch/xtensa/kernel/signal.c
+++ b/arch/xtensa/kernel/signal.c
@@ -341,7 +341,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
341 341
342 sp = regs->areg[1]; 342 sp = regs->areg[1];
343 343
344 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp)) { 344 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && sas_ss_flags(sp) == 0) {
345 sp = current->sas_ss_sp + current->sas_ss_size; 345 sp = current->sas_ss_sp + current->sas_ss_size;
346 } 346 }
347 347
diff --git a/arch/xtensa/mm/mmu.c b/arch/xtensa/mm/mmu.c
index a1077570e383..c43771c974be 100644
--- a/arch/xtensa/mm/mmu.c
+++ b/arch/xtensa/mm/mmu.c
@@ -50,23 +50,3 @@ void __init init_mmu(void)
50 */ 50 */
51 set_ptevaddr_register(PGTABLE_START); 51 set_ptevaddr_register(PGTABLE_START);
52} 52}
53
54struct kmem_cache *pgtable_cache __read_mostly;
55
56static void pgd_ctor(void *addr)
57{
58 pte_t *ptep = (pte_t *)addr;
59 int i;
60
61 for (i = 0; i < 1024; i++, ptep++)
62 pte_clear(NULL, 0, ptep);
63
64}
65
66void __init pgtable_cache_init(void)
67{
68 pgtable_cache = kmem_cache_create("pgd",
69 PAGE_SIZE, PAGE_SIZE,
70 SLAB_HWCACHE_ALIGN,
71 pgd_ctor);
72}
diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
index 56f88b7afe2f..e9e1aad8c271 100644
--- a/arch/xtensa/platforms/iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -737,7 +737,8 @@ static int __init iss_net_setup(char *str)
737 return 1; 737 return 1;
738 } 738 }
739 739
740 if ((new = alloc_bootmem(sizeof new)) == NULL) { 740 new = alloc_bootmem(sizeof(*new));
741 if (new == NULL) {
741 printk("Alloc_bootmem failed\n"); 742 printk("Alloc_bootmem failed\n");
742 return 1; 743 return 1;
743 } 744 }